Skip to content

The design language that makes your AI harness better at design.

JavaScript

Review recipe: fall back to /tmp without TMPDIR, and give a git diff for a gh without --exclude

Paul Bakausa4b8375ff583
diff --git a/AGENTS.md b/AGENTS.md
index 68e767cf1..8b1ab7ea0 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -77,19 +77,19 @@ The in-page bundle, the oracle goldens and the call vectors are marked `-diff` i
```sh
gh pr diff <n> --name-only # what changed
gh pr diff <n> --exclude 'tests/oracle/golden/*' --exclude 'tests/oracle/vectors/*' --exclude 'crates/live/assets/detect-antipatterns-browser.js'
-git fetch origin pull/<n>/head && git worktree add --detach "$TMPDIR/pr-<n>" FETCH_HEAD # Read and grep the PR's files here
-git -C "$TMPDIR/pr-<n>" merge-tree --write-tree --name-only origin/main HEAD # tree id, then any files that conflict with main
+git fetch origin pull/<n>/head && git worktree add --detach "${TMPDIR:-/tmp}/pr-<n>" FETCH_HEAD # Read and grep the PR's files here
+git -C "${TMPDIR:-/tmp}/pr-<n>" merge-tree --write-tree --name-only origin/main HEAD # tree id, then any files that conflict with main
gh pr checks <n>
```
-`gh pr diff` ignores `.gitattributes`, hence the `--exclude` flags; a local `git diff` honours the attributes of the checked-out tree, so a branch cut before they landed still prints the raw diff (`-- . ':!tests/oracle/golden' ':!crates/live/assets'` trims it). `git grep` reports these files as binary; use `rg` or `git grep -a`. To review a changed golden by hand, decode it on both sides:
+`gh pr diff` ignores `.gitattributes`, hence the `--exclude` flags. A `gh` too old for `--exclude` can skip that line and diff in the worktree instead: `git -C "${TMPDIR:-/tmp}/pr-<n>" diff origin/main...HEAD -- . ':!tests/oracle/golden' ':!tests/oracle/vectors' ':!crates/live/assets/detect-antipatterns-browser.js'`. The pathspec matters there too: a local `git diff` honours the attributes of the checked-out tree, so a branch cut before they landed still prints the raw diff. `git grep` reports these files as binary; use `rg` or `git grep -a`. To review a changed golden by hand, decode it on both sides:
```sh
g='to_entries[]|"== \(.key)\n\(.value|if type=="string" then . else tojson end)"'; f=tests/oracle/golden/<case>.json
diff <(git show origin/main:$f 2>/dev/null | jq -r "$g") <(git show HEAD:$f | jq -r "$g") # in the PR worktree; a new case diffs against nothing
```
-Remove the worktree when done (`git worktree remove "$TMPDIR/pr-<n>"`).
+Remove the worktree when done (`git worktree remove "${TMPDIR:-/tmp}/pr-<n>"`).
## Contributing, Issue, and PR Guidelines
diff --git a/CLAUDE.md b/CLAUDE.md
index db1bff074..40ba8d18f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -155,7 +155,7 @@ This contribution was prepared by an AI agent that tried to ship unchecked vibes
### Reviewing a PR
-The in-page bundle (`crates/live/assets/detect-antipatterns-browser.js`), the oracle goldens and the call vectors are `-diff` in `.gitattributes`, because their raw diffs run to megabytes. Follow **Reviewing a PR** in `AGENTS.md`: `gh pr diff <n> --exclude` those paths, check the PR head out into a detached worktree to read its files, and decode a changed golden with the `jq` recipe there rather than reading its raw diff.
+The in-page bundle (`crates/live/assets/detect-antipatterns-browser.js`), the oracle goldens and the call vectors are `-diff` in `.gitattributes`, because their raw diffs run to megabytes. Follow **Reviewing a PR** in `AGENTS.md`: `gh pr diff <n> --exclude` those paths (or, on a `gh` without `--exclude`, the pathspec `git diff` given there), check the PR head out into a detached worktree to read its files, and decode a changed golden with the `jq` recipe there rather than reading its raw diff.
## Testing