Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .agents/rules/github_actions_workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ globs: ".github/workflows/**,.github/actions/**,.github/dependabot.yml"
binary directly from `bazel-bin/<pkg>/<target>` instead of `bazel run`,
explicitly include `//<pkg>:<target>` in `bazel build` so its `.runfiles` tree
is materialized.
* **Flat Staging for `actions/upload-artifact` Across Split Transitions**:
`actions/upload-artifact` strips only the longest common parent directory of
all matched `path` entries. When uploading files from multiple Bazel
configurations (`bazel-out/<cfg-1>/...`, `bazel-out/<cfg-2>/...`), stage them
into a single flat directory first (reading paths from the rule's `.txt`
manifest) so `<cfg>/...` subdirectories are not preserved in the artifact.

## Workflow Scripts & Testing
* **Separate Script Files (No Inline Scripts)**: Factor non-trivial scripts
Expand Down
13 changes: 13 additions & 0 deletions .agents/rules/shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
trigger: glob
description: Shell / Bash scripting style and portability rules
globs: "*.sh"
---

# Shell Scripting Rules

* Use `elif` instead of nesting `if` inside an `else` block.
* When reading file paths from a manifest or list file, iterate line-by-line
with `while IFS= read -r file; do ...; done < "$manifest"`. Do not use
unquoted command substitution (`$(cat "$manifest")`) or suppress ShellCheck
`SC2046` assuming paths lack spaces.
8 changes: 8 additions & 0 deletions .agents/rules/starlark.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ globs: "*.bzl,BUILD,BUILD.bazel,*.bazel"
fields must be immutable when `depset()` is called (eager check before rule
freeze). Use `tuple[T]` or `depset[T]` in providers placed into depsets; do
not use mutable `list[T]`.
* **Dedicated Providers over Filtering `DefaultInfo.files`**: When a rule needs
a subset of a dependency's outputs (e.g., binaries without a sibling `.txt`
manifest), return a dedicated provider (e.g., `_ReleaseFilesInfo`) instead of
filtering `DefaultInfo.files` by filename or extension.

## Code Style & Conventions
* **Do Not Export `BUILD` Files Unnecessarily**: Do not add `BUILD` or
`BUILD.bazel` to `exports_files(...)` unless strictly required.
* **No Nested List Comprehensions**: Do not write nested list comprehensions
(`[x for y in ... for x in ...]`). Use explicit `for` loops instead.
* **Direct Attribute Access**: Use normal attribute access (`x.field`) instead
of `getattr(x, "field", default)` for fields defined on a provider or struct
schema. When an object may be one of multiple provider/struct variants with
Expand Down
Loading