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
17 changes: 14 additions & 3 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,31 @@ jobs:
# not covered by its optional exclude_paths (so "general" can be
# everything-except-app-dirs). Agents without exclude_paths behave
# exactly as before.
#
# diff_paths / exclude_paths are matched as literal path PREFIXES, not
# globs — "packages/" matches "packages/foo/bar.cairo". A repo-root
# catch-all ("." or "./" or "") normalizes to the empty prefix, which
# every path starts with; without that, "." would only match dotfiles
# and a catch-all agent would silently skip README.md-only PRs.
MATRIX_JSON=$(jq -c --argjson changed_files "$CHANGED_FILES_JSON" '
def norm_prefix: if . == "." or . == "./" or . == "" then "" else . end;
{
include: [
.agents[]
| . as $a
| (($a.diff_paths // []) | map(norm_prefix)) as $include_prefixes
| (($a.exclude_paths // []) | map(norm_prefix)) as $exclude_prefixes
| select(
[ $changed_files[]
| . as $f
| (($a.diff_paths // []) | any(. as $p | $f | startswith($p)))
and (($a.exclude_paths // []) | any(. as $p | $f | startswith($p)) | not)
| ($include_prefixes | any(. as $p | $f | startswith($p)))
and ($exclude_prefixes | any(. as $p | $f | startswith($p)) | not)
] | any
)
| . + {
diff_paths_str: (.diff_paths | join(" ")),
# "" is a valid prefix but not a valid git pathspec; "." is
# both, and means the same thing to git.
diff_paths_str: (.diff_paths | map(if . == "" then "." else . end) | join(" ")),
exclude_paths_str: ((.exclude_paths // []) | map(":!" + .) | join(" "))
}
]
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ review config and prompts.
An agent runs only when the PR touches one of its `diff_paths`. Add more
agents for different areas (each gets its own scoped prompt + PR comment).

`diff_paths` and `exclude_paths` are matched as **literal path prefixes,
not globs**: `"packages/"` matches `packages/foo/bar.cairo`, and
`"package.json"` matches only that file. Do not write `"src/**"` — `**` is
not special here, so the entry would match nothing. Use `"."` (or `""`) for
a repo-root catch-all that matches every changed file.

Optional **`exclude_paths`** narrows an agent to "matched by `diff_paths`
but not under these paths" — useful for a catch-all `general` agent that
reviews everything *except* the app dirs:
Expand Down