Skip to content

prism-cli 1.20.0: change codewatch's reviewer and model per repo, as your default, or for the team - #121

Merged
Enclavet merged 2 commits into
mainfrom
feat/codewatch-reviewer-picker
Nov 16, 2026
Merged

Enclavet merged 2 commits into
mainfrom
feat/codewatch-reviewer-picker

Conversation

@Enclavet

Copy link
Copy Markdown
Contributor

prism-cli 1.20.0. The user asked to change codewatch's reviewer and model from the dashboard: per repo, as a default for every repo, or for the team.

What changes

Where What
Repo page › Repo settings A Reviewer and model block shows the reviewer and model a push uses there and where each comes from: overridden for this repo, your default, team file or tool default. It also shows whether the tool is installed and, if the chosen tool is missing, which one runs instead. Change offers Override for this repo (the default), Use my default and Team default. The team default warns that the file must be committed and that CI reads it, and shows the diff before saving and again in the dialog. A personal model under a team pin says the pin wins and offers the team default. Reset to my default and Reset the team default are there too.
Settings › Repos Codewatch default reviewer and model shows your default (git config --global) with Change my default and Remove my default. Below it are the repos that override it, each with a link and Reset to default. Apply my default to all repos has a confirm dialog that lists the repos it changes, and it never touches .prism/config.json. Each repo row links to its page.
CLI prism-cli codewatch reviewer shows the effective values and where they come from. Options: --scope clone|team|global with --reviewer/--model, --reset, and --clear-overrides <dir...>.

The values come from the hook's own resolveReviewer and resolveReviewModel, unchanged. No new config file: git config already stores a global prism.reviewer.

Precedence (as the code already resolves it)

  • Reviewer: this repo's git config --local prism.reviewer > your git config --global prism.reviewer > team eval.reviewer > the installed tool. A chosen tool that is not installed falls back to the installed one.
  • Model: team eval.model (only when set for the reviewer that runs) > --local prism.<tool>Model > --global prism.<tool>Model > the tool default.

Note: your global default beats the team file for the reviewer. That is today's behaviour, because git config --get prism.reviewer returns local, then global, before the hook reads the team file. I kept it and did not change it. CI is unaffected: it never reads prism.reviewer.

Model suggestions

Neither tool has a list that is sure to work offline. kiro-cli chat --list-models answers from the account, so the dashboard offers no kiro list. Claude Code's documented aliases (sonnet, opus, haiku) are offered. Any id that matches MODEL_ID_RE is accepted.

Security

  • Writes go through 7 new allowlisted actions that run prism-cli codewatch reviewer with a fixed argv and no shell.
  • The server checks reviewer against REVIEWER_IDS and model against MODEL_ID_RE (no leading -). The repo id comes from the scan list.
  • Apply-all appends only the server's own absolute repo paths.
  • The team actions need confirm.
  • Reads: GET /api/codewatch/reviewer and GET /api/codewatch/defaults (git config and one file, paths shown with ~).
  • Listener, token, CSP and CSRF are unchanged.

Tests

  • npm test (aws guard): 888/888. New codewatch-reviewer.test.ts, using real git with a temp global config:
    • every scope's write and reset;
    • a precedence table over every global/local/team combination, plus the model rule;
    • the team-pin warning;
    • refused reviewer and model values, including a leading -;
    • the fallback when a tool is not installed;
    • the team diff;
    • apply-all clears only the local keys of the listed repos and leaves the team file alone;
    • both routes, the runner's checks, and the card UI.
  • npm run docs:check: 0 problems.
  • Full e2e: 71/71. The new reviewer suite (CWR1–8) uses demo repos, a fake claude that never reviews, and no AWS. It covers:
    • set the default in Settings and see both repo cards follow it;
    • override one repo, and see it listed in Settings;
    • the team default with its diff and checkbox;
    • the pin warning;
    • reset the team default, then reset the repo to my default;
    • apply-all, with its listing confirm;
    • no sideways scroll at 390 px.

Docs: USER_GUIDE (Choosing the Reviewer and Choosing the Review Model updated, plus a new Changing the Reviewer and Model section with a demo screenshot) and CLI-REFERENCE.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ PRISM Eval Gate -- PASS

Score: 0.88 | Findings: 9 (0 high, 1 medium)

Summary: No blocking issues. Argv values are validated server-side, the diff uses allowlisted actions with execFile-style argv, and page text goes through txt(). The remaining findings are an unbounded concurr

File Line Severity Category Issue
cli/src/dashboard/repo-page.ts 121 low maintainability cwForm is about 52 lines and mixes form construction, validation, proposal rendering and save/reset handlers. Split it into smaller helpers.
cli/src/commands/codewatch/reviewer.ts 29 low maintainability catch (e: any) is used with no justifying comment, and again in the applySetting block. Use unknown and narrow it, or add a comment explaining why any is needed.
cli/src/commands/codewatch/reviewer.ts 20 low maintainability The action() function is about 45 lines and handles three flows: clear-overrides, change and show. Extract each flow into its own function.
cli/src/codewatch/reviewer-settings.ts 196 low reliability clearOverrides throws on the first git failure, so repos handled earlier stay changed and the caller never gets the changed list. Collect failures per repo and report them, or report the partial res
cli/src/dashboard/codewatch-reviewer.ts 66 medium performance codewatchDefaults starts one git process per scanned repo at the same time through an unbounded Promise.all. With many repos this can exhaust processes or file handles. Limit the concurrency.
cli/src/dashboard/actions.ts 383 low reliability The 'codewatch-reviewer-apply-all' action passes every scanned repo path as a separate argv entry, with no cap on the count. A very large scan list could exceed the OS argument limit (E2BIG). Cap the
cli/src/codewatch/reviewer-settings.ts 170 low maintainability The list [REVIEWER_GIT_CONFIG_KEY, ...REVIEWER_IDS.map(reviewModelGitKey)] appears in both applySetting and clearOverrides. The reviewer/model-per-scope mapping is also built three times (reviewerVi
cli/src/dashboard/codewatch-reviewer.ts 43 low maintainability The tools array (id, name, binary, installed, modelKey, suggestions) is built identically in codewatchReviewer and codewatchDefaults. Extract a shared function.
cli/src/codewatch/reviewer-settings.ts 28 low maintainability last() and valueIn() repeat the logic that finds the last matching git config entry, and reviewerView does (x.value ?? '').trim() null inline in several places. Reuse one helper.

Powered by kiro-cli headless - Model: auto - Threshold: 0.82


✅ Secret scan -- no credentials found in this PR's commits.

…your default, or for the team

- prism-cli codewatch reviewer: show the effective reviewer/model and their
  source; --scope clone|team|global, --reset, --clear-overrides <dir...>.
- Repo page: Reviewer and model block (source, installed tool, fallback),
  Change: Override for this repo / Use my default / Team default (repo-file
  warning and diff), team-pin warning, Reset.
- Settings > Repos: your default (git config --global prism.reviewer and
  prism.<tool>Model), the repos that override it, Reset per repo, Apply my
  default to all repos (confirm lists the repos; team files untouched).
- Allowlisted actions; reviewer/model checked server side (REVIEWER_IDS,
  MODEL_ID_RE); apply-all appends only the server's own repo paths.
@Enclavet
Enclavet force-pushed the feat/codewatch-reviewer-picker branch from 0162a9b to e9e3adc Compare November 16, 2026 04:25
@Enclavet
Enclavet merged commit d6ac1e2 into main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants