/ca-preview — reviewer-fleet dry-run
See what codeArbiter would do to your real code before paying any onboarding cost. This is a
read-only dry-run against the current uncommitted diff: it predicts which reviewers the change
would dispatch, runs the checks that need no project rules, and reports. It never writes state.
It requires no /ca-init, no .codearbiter/ directory, and no decompose or create-context
interview. It functions in a repo that never opted in, and it modifies nothing: not the worktree,
not the index, not .codearbiter/. git status is unchanged by a run.
Flow
Collect the diff. Call the thin entry hook preview.py in diff mode, which wraps
collect_diff from <plugin-root>/hooks/_previewlib.py. It unions HEAD-vs-worktree
changes, staged changes, and untracked files (forward-slash paths). Run it from the project
root so _previewlib/_hooklib resolve on the same sys.path:
python3 "<plugin-root>/hooks/preview.py" diff || python "<plugin-root>/hooks/preview.py" diff
If the result is empty (clean tree, or not a git repo), print a friendly "Nothing to
preview" line and STOP. This is a clean exit, not an error: no stack trace, no failure.
Predict reviewers by path. Read the reviewer-to-path matrix at
<plugin-root>/includes/review-matrix.md. That include is the single source of truth
for which reviewer is dispatched when scope touches a given path: do NOT restate, fork, or
inline a second copy of the table here. For each changed path, list the reviewers that WOULD
dispatch and name the triggering path for each. This is the same mapping /ca-review uses, so
the predicted set matches what a real review would dispatch.
Run the state-free secret scan. Call the thin entry hook preview.py in secrets mode,
which wraps scan_secrets from <plugin-root>/hooks/_previewlib.py. It reads each
changed file's current content and returns SecretFinding(path, line_no, snippet) for every
credential line, with the secret VALUE already masked to **** in snippet:
python3 "<plugin-root>/hooks/preview.py" secrets || python "<plugin-root>/hooks/preview.py" secrets
Report each finding by path:line_no with its redacted snippet. The snippet arrives already
masked: never reconstruct or print a raw secret value.
Report
Emit one clear report with these parts:
- Changed files — the reviewed-file set from step 1, each with its change kind(s) (unstaged,
staged, untracked).
- Predicted reviewers — per the matrix, which reviewers would dispatch and the triggering path
for each. These are predicted (would-dispatch), not run here.
- Secret findings — the results of the real scan from step 3, by
path:line_no with the
redacted snippet, marked as found (ran locally), at BLOCK severity. State "none found" when the
scan is clean.
- Onboarding nudge — close with one line: the full gated review comes via
/ca-init then
/ca-review.
Distinct from /ca-doctor
This reports reviewer and gate behavior on the current diff. It makes NO hook-probe claims and says
nothing about wrapper wiring or the active-dispatch coverage gap: that is /ca-doctor.
Do not blend the two.
When NOT to use
An onboarded repo wanting the full gated verdict → /ca-init then /ca-review.
Inspecting wrapper wiring and the active-dispatch coverage gap → /ca-doctor.
A question about the code → /ca-btw.
Hard gate
- Read-only. MUST NOT write, create, or modify any file, including anything under
.codearbiter/;
MUST NOT stage or commit. git status MUST be unchanged after a run.
- MUST NOT require, trigger, or error on missing
/ca-init, .codearbiter/ state, or the
decompose / create-context interview.
- MUST NOT print a raw secret value: the lib returns the snippet already redacted, and the report
carries only that masked form.
- An empty diff or a non-git directory MUST yield the "Nothing to preview" message and a clean
exit, never a stack trace.
- MUST treat the reviewer prediction as predicted (would-dispatch) and the secret scan as found
(ran locally): it MUST NOT attribute fabricated findings to any predicted reviewer.
1---2name: ca-preview-23description: Zero-onboarding, read-only dry-run of the reviewer fleet against the current uncommitted diff. Predicts reviewers, runs the state-free secret scan, writes nothing.4---56# /ca-preview — reviewer-fleet dry-run78See what codeArbiter would do to your real code before paying any onboarding cost. This is a9read-only dry-run against the current uncommitted diff: it predicts which reviewers the change10would dispatch, runs the checks that need no project rules, and reports. It never writes state.1112It requires no `/ca-init`, no `.codearbiter/` directory, and no decompose or create-context13interview. It functions in a repo that never opted in, and it modifies nothing: not the worktree,14not the index, not `.codearbiter/`. `git status` is unchanged by a run.1516## Flow17181. **Collect the diff.** Call the thin entry hook `preview.py` in `diff` mode, which wraps19 `collect_diff` from `<plugin-root>/hooks/_previewlib.py`. It unions HEAD-vs-worktree20 changes, staged changes, and untracked files (forward-slash paths). Run it from the project21 root so `_previewlib`/`_hooklib` resolve on the same `sys.path`:22 ```23 python3 "<plugin-root>/hooks/preview.py" diff || python "<plugin-root>/hooks/preview.py" diff24 ```25 If the result is empty (clean tree, or not a git repo), print a friendly **"Nothing to26 preview"** line and STOP. This is a clean exit, not an error: no stack trace, no failure.27282. **Predict reviewers by path.** Read the reviewer-to-path matrix at29 `<plugin-root>/includes/review-matrix.md`. That include is the single source of truth30 for which reviewer is dispatched when scope touches a given path: do NOT restate, fork, or31 inline a second copy of the table here. For each changed path, list the reviewers that WOULD32 dispatch and name the triggering path for each. This is the same mapping `/ca-review` uses, so33 the predicted set matches what a real review would dispatch.34353. **Run the state-free secret scan.** Call the thin entry hook `preview.py` in `secrets` mode,36 which wraps `scan_secrets` from `<plugin-root>/hooks/_previewlib.py`. It reads each37 changed file's current content and returns `SecretFinding(path, line_no, snippet)` for every38 credential line, with the secret VALUE already masked to `****` in `snippet`:39 ```40 python3 "<plugin-root>/hooks/preview.py" secrets || python "<plugin-root>/hooks/preview.py" secrets41 ```42 Report each finding by `path:line_no` with its redacted snippet. The snippet arrives already43 masked: never reconstruct or print a raw secret value.4445## Report4647Emit one clear report with these parts:4849- **Changed files** — the reviewed-file set from step 1, each with its change kind(s) (unstaged,50 staged, untracked).51- **Predicted reviewers** — per the matrix, which reviewers would dispatch and the triggering path52 for each. These are predicted (would-dispatch), not run here.53- **Secret findings** — the results of the real scan from step 3, by `path:line_no` with the54 redacted snippet, marked as found (ran locally), at BLOCK severity. State "none found" when the55 scan is clean.56- **Onboarding nudge** — close with one line: the full gated review comes via `/ca-init` then57 `/ca-review`.5859## Distinct from /ca-doctor6061This reports reviewer and gate behavior on the current diff. It makes NO hook-probe claims and says62nothing about wrapper wiring or the active-dispatch coverage gap: that is `/ca-doctor`.63 Do not blend the two.6465## When NOT to use6667- An onboarded repo wanting the full gated verdict → `/ca-init` then `/ca-review`.68- Inspecting wrapper wiring and the active-dispatch coverage gap → `/ca-doctor`.6970- A question about the code → `/ca-btw`.7172## Hard gate7374- Read-only. MUST NOT write, create, or modify any file, including anything under `.codearbiter/`;75 MUST NOT stage or commit. `git status` MUST be unchanged after a run.76- MUST NOT require, trigger, or error on missing `/ca-init`, `.codearbiter/` state, or the77 decompose / create-context interview.78- MUST NOT print a raw secret value: the lib returns the snippet already redacted, and the report79 carries only that masked form.80- An empty diff or a non-git directory MUST yield the "Nothing to preview" message and a clean81 exit, never a stack trace.82- MUST treat the reviewer prediction as predicted (would-dispatch) and the secret scan as found83 (ran locally): it MUST NOT attribute fabricated findings to any predicted reviewer.