stage-resolve
Pick up the review comments the user left in the Stage UI for the current diff, make the…
Generate Stage chapters for the current local git branch and open them in a browser for review.
$ npx -y skills add reviewstage/stage-cli --skill stage-chapters --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/stage-chaptersContext preview
The summary Claude sees to decide when to auto-load this skill.
Generate Stage chapters for the current local git branch and open them in a browser for review.
name: stage-chapters description: Generate Stage chapters for the current local git branch and open them in a browser for review. user-invocable: true
Generates a Stage chapter run for the current local git branch and opens it in a browser. Uses `stagereview prep` to compute the diff, then generates chapters and a prologue, and hands the result to `stagereview show` to launch the SPA.
Run these checks before any other work. If either fails, stop with the error message — do not continue.
1. **`stagereview` is installed.** Run `which stagereview`. If it exits non-zero, instruct the user:
stagereview is not installed. Run:
npm install -g stagereview
Then retry /stage-chapters.Stop.
2. **The current directory is a git repo.** Run `git rev-parse --is-inside-work-tree`. If it does not print `true`, stop with:
/stage-chapters must be run inside a git repository.
PREP_FILE=$(stagereview prep)
`stagereview prep` auto-detects the base ref (main/master), computes the merge-base, generates the diff, filters out lockfiles/binaries, and formats hunks with line numbers for analysis. By default it auto-detects the diff scope: if uncommitted changes are present the diff includes staged, unstaged, and untracked files; otherwise it uses the committed branch diff. It writes a plain-text file and prints only the file path to stdout.
`prep` and `show` also accept positional git refs:
PREP_FILE=$(stagereview prep main) PREP_FILE=$(stagereview prep main feature) PREP_FILE=$(stagereview prep main..feature) PREP_FILE=$(stagereview prep main...feature)
Use the same positional refs for `show`:
stagereview show "$AGENT_OUTPUT" main..feature
Both `prep` and `show` accept these optional flags:
When flags or positional refs are specified, pass the same scope to **both** `prep` and `show`:
PREP_FILE=$(stagereview prep --base feature-a --ref staged) # ... later ... stagereview show --base feature-a --ref staged "$AGENT_OUTPUT" PREP_FILE=$(stagereview prep --base main --compare feature) # ... later ... stagereview show --base main --compare feature "$AGENT_OUTPUT" # Review a GitHub PR by number or URL PREP_FILE=$(stagereview prep --pr 123) # ... later ... stagereview show --pr 123 "$AGENT_OUTPUT"
If `prep` exits non-zero, relay its stderr to the user and stop.
**Do not modify files in the working tree between running `prep` and running `show`.** Both commands independently snapshot the git state. If the diff changes between them, `show` will reject the chapters with a hunk coverage error because the hunks no longer match.
Read `$PREP_FILE` via the Read tool (or equivalent). For large diffs, use the Read tool's `offset` and `limit` parameters to read in chunks.
`prep` writes a single combined file with sections separated by `=== ... ===` headers, in this order. Not every section is always present:
=== File: src/app.ts (modified) | filePath: "src/app.ts", oldStart: 1 === === Hunk @1: @@ -1,5 +1,6 @@ === 1 1 | const a = 1; 2 |-const b = 2; 2 |+const b = 3; 3 |+const c = 4; 3 4 | const d = 5;
The two number columns are the **old line number** (left) and **new line number** (right). A blank column means the line doesn't exist on that side — additions have no old line number, deletions have no new line number. These numbers are used directly for `lineRefs` in key changes (see Step 3d).
Using the hunks from the `=== HUNKS ===` section, produce a `chapters` array. Each chapter groups related hunks into a coherent
A viewer for reviewing local code changes in small individual chapters. Works with any AI agent.
Repo: reviewstage/stage-cli
Pick up the review comments the user left in the Stage UI for the current diff, make the…