@invariant.guru/cli 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -161,10 +161,36 @@ When the session is done, stamp it:
161
161
  invariant plan:complete <session-id> --summary "Booking command + tests"
162
162
  ```
163
163
 
164
- ### 6. `invariant ui` — see and manage your sessions
164
+ ### 6. `invariant review` — have the diff read by someone who did not write it
165
+
166
+ Composes a *review session*: a second session whose job is to review the branch
167
+ and write the result into `doc/review/<branch>.xml`.
168
+
169
+ ```bash
170
+ invariant review --session <session-id> # review the work that session produced
171
+ invariant review --base origin/develop # diff against something else
172
+ ```
173
+
174
+ Paste its execute line into a **new** agent conversation. That is the point: a
175
+ fresh one has not seen the plan, so it reads the diff as evidence rather than as
176
+ confirmation. It reviews exactly `git diff --cached $(git merge-base <base> HEAD)`
177
+ — every commit on the branch plus whatever is staged, and nothing that is only in
178
+ your working tree.
179
+
180
+ You then rule on each comment (in the UI, or with `invariant review show`), and:
181
+
182
+ ```bash
183
+ invariant review plan-changes <branch>
184
+ ```
185
+
186
+ writes the comments you accepted into that same session's `## Plan` and moves it
187
+ to `planned`. Executing it implements them. Nothing is ever committed or pushed —
188
+ you stage and commit when you are happy.
189
+
190
+ ### 7. `invariant ui` — see and manage your sessions
165
191
 
166
192
  Opens a local dashboard for this project's sessions: a board grouped by status,
167
- rendered markdown, a rich editor, and a command palette.
193
+ rendered markdown, a rich editor, review triage, and a command palette.
168
194
 
169
195
  ```bash
170
196
  invariant ui # start on 4200 (or the next free port) and open a browser
@@ -184,6 +210,7 @@ invariant add nest-clean-architecture # activate the whole module
184
210
  invariant sync
185
211
  invariant plan "add the cargo booking command"
186
212
  invariant ui # follow it through to done
213
+ invariant review # then have the diff reviewed
187
214
  ```
188
215
 
189
216
  ---
@@ -415,6 +442,47 @@ invariant plan:complete session-uuid -n "Follow-up: rate limiting" -d 2026-08-19
415
442
  | `-n, --note <note>` | Extra note line (repeatable) |
416
443
  | `-d, --date <date>` | Completion date (`YYYY-MM-DD`), defaults to today |
417
444
 
445
+ ### `invariant review [options]`
446
+
447
+ Compose a review session for the current branch. The session reviews the diff,
448
+ waits for you to rule on every comment, and then implements the ones you
449
+ accepted — one file, one conversation.
450
+
451
+ ```bash
452
+ invariant review # review the current branch
453
+ invariant review --session <session-id> # link it to the work under review
454
+ invariant review --base origin/develop # diff against another ref
455
+ invariant review list # every review document
456
+ invariant review show <branch> --open # what still needs a decision
457
+ invariant review plan-changes <branch> # accepted comments → the session's Plan
458
+ ```
459
+
460
+ | Subcommand | Description |
461
+ |--------|-------------|
462
+ | *(none)* | Compose a review session for the current branch |
463
+ | `list` | Every review document in the project (`--json`) |
464
+ | `show <review>` | Print a review's comments (`--staged`, `--open`, `--json`) |
465
+ | `plan-changes <review>` | Write the accepted comments into the session's `## Plan` |
466
+
467
+ | Option | Description |
468
+ |--------|-------------|
469
+ | `-s, --session <session>` | The plan session whose work is under review |
470
+ | `-b, --base <ref>` | Ref to diff against (default: `origin/main`, then `origin/master`, `main`, `master`) |
471
+
472
+ Reviews land in `doc/review/<branch>.xml`, one file per branch, appended to on
473
+ each pass. **`plan-changes` refuses while any comment is still undecided** —
474
+ partial triage silently drops the comments nobody looked at, so it is not
475
+ allowed. Nothing here touches the index or a remote: the git commands this tool
476
+ may run are allowlisted to read-only ones.
477
+
478
+ Configure it under `review` in `invariant.json`:
479
+
480
+ ```jsonc
481
+ { "review": { "directory": "doc/review", "baseBranch": "origin/main", "editor": "vscode" } }
482
+ ```
483
+
484
+ See [docs/spec-review.md](docs/spec-review.md) for the document format.
485
+
418
486
  ### `invariant ui [port]`
419
487
 
420
488
  Start (or attach to) the local session UI for the current project, then open a
@@ -447,13 +515,15 @@ per-instance token kept in `~/.invariant/ui.json` (mode 0600). What it can read
447
515
  and write is limited to the directory it was started in.
448
516
 
449
517
  In the UI: `⌘K` opens the command palette, `⇧⌘V` toggles rendered preview and
450
- editing, `N` starts a session, `?` lists every shortcut.
518
+ editing, `N` starts a session, `?` lists every shortcut. On a review session,
519
+ `j`/`k` move between comments and `s` / `d` / `e` stage, discard, or edit one.
451
520
 
452
521
  To work on the UI itself: start a daemon (`invariant ui --no-open`), then run
453
522
  `yarn dev:ui` for Vite with hot reload against it — `INVARIANT_UI_PORT=<port>`
454
523
  when the daemon landed on something other than 4200.
455
524
 
456
- See [docs/spec-ui.md](docs/spec-ui.md) for the header contract and the HTTP API.
525
+ See [docs/spec-ui.md](docs/spec-ui.md) for the header contract and the HTTP API,
526
+ and [docs/spec-review.md](docs/spec-review.md) for reviews.
457
527
 
458
528
  ### `invariant scan`
459
529