@invariant.guru/cli 0.5.6 → 0.6.1
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 +133 -1
- package/dist/main.js +885 -841
- package/dist/ui/assets/Editor-BacggN6k.js +38 -0
- package/dist/ui/assets/Preview-BNQ0QaKY.js +18 -0
- package/dist/ui/assets/index-AAKJY32z.js +245 -0
- package/dist/ui/assets/index-CpSfiNpv.css +1 -0
- package/dist/ui/index.html +16 -0
- package/package.json +39 -13
package/README.md
CHANGED
|
@@ -151,12 +151,56 @@ invariant plan "implement the cargo booking command" --context nest-clean-archit
|
|
|
151
151
|
invariant plan "implement the cargo booking command" --full
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
Every session file starts with a `<session-meta>` header carrying its title and
|
|
155
|
+
status (`draft` → `planned` → `in-progress` → `executed`). The agent updates it
|
|
156
|
+
as the work progresses; the UI reads it.
|
|
157
|
+
|
|
154
158
|
When the session is done, stamp it:
|
|
155
159
|
|
|
156
160
|
```bash
|
|
157
161
|
invariant plan:complete <session-id> --summary "Booking command + tests"
|
|
158
162
|
```
|
|
159
163
|
|
|
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>.md`.
|
|
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
|
|
191
|
+
|
|
192
|
+
Opens a local dashboard for this project's sessions: a board grouped by status,
|
|
193
|
+
rendered markdown, a rich editor, review triage, and a command palette.
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
invariant ui # start on 4200 (or the next free port) and open a browser
|
|
197
|
+
invariant ui status # every running instance on this machine
|
|
198
|
+
invariant ui stop # stop this project's instance
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Each directory gets its own instance on its own port, so several repositories can
|
|
202
|
+
be open at once without ever mixing sessions.
|
|
203
|
+
|
|
160
204
|
### Full walkthrough
|
|
161
205
|
|
|
162
206
|
```bash
|
|
@@ -165,6 +209,8 @@ invariant install github:invariant-guru/inv-nest-clean-architecture
|
|
|
165
209
|
invariant add nest-clean-architecture # activate the whole module
|
|
166
210
|
invariant sync
|
|
167
211
|
invariant plan "add the cargo booking command"
|
|
212
|
+
invariant ui # follow it through to done
|
|
213
|
+
invariant review # then have the diff reviewed
|
|
168
214
|
```
|
|
169
215
|
|
|
170
216
|
---
|
|
@@ -381,7 +427,9 @@ invariant plan "implement user authentication" --context nest-clean-architecture
|
|
|
381
427
|
|
|
382
428
|
### `invariant plan:complete <session>`
|
|
383
429
|
|
|
384
|
-
|
|
430
|
+
Mark a session finished: sets `<status>` to `executed` and stamps `<summary>` and
|
|
431
|
+
`<completed>` in the session's `<session-meta>` header. Notes are appended to the
|
|
432
|
+
body as a **Completion notes** section.
|
|
385
433
|
|
|
386
434
|
```bash
|
|
387
435
|
invariant plan:complete session-uuid --summary "Auth command + e2e tests"
|
|
@@ -394,6 +442,89 @@ invariant plan:complete session-uuid -n "Follow-up: rate limiting" -d 2026-08-19
|
|
|
394
442
|
| `-n, --note <note>` | Extra note line (repeatable) |
|
|
395
443
|
| `-d, --date <date>` | Completion date (`YYYY-MM-DD`), defaults to today |
|
|
396
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>.md`, 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
|
+
|
|
486
|
+
### `invariant ui [port]`
|
|
487
|
+
|
|
488
|
+
Start (or attach to) the local session UI for the current project, then open a
|
|
489
|
+
browser. One instance per directory; the default port is 4200 and the next free
|
|
490
|
+
port is used when it is taken.
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
invariant ui # start and open a browser
|
|
494
|
+
invariant ui 4300 # ask for a specific port (fails if it is busy)
|
|
495
|
+
invariant ui --no-open # start without opening a browser
|
|
496
|
+
invariant ui status --json # machine-readable status of every instance
|
|
497
|
+
invariant ui stop --all # stop every instance on this machine
|
|
498
|
+
invariant ui migrate-headers # add <session-meta> headers to legacy sessions
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
| Subcommand | Description |
|
|
502
|
+
|--------|-------------|
|
|
503
|
+
| *(none)* / `start [port]` | Start or attach, then open a browser |
|
|
504
|
+
| `stop` | Stop this project's instance (`--all` for every instance) |
|
|
505
|
+
| `status` | Every instance, liveness-checked (`--json`) |
|
|
506
|
+
| `migrate-headers` | Give legacy session files a canonical `<session-meta>` header |
|
|
507
|
+
|
|
508
|
+
| Option | Description |
|
|
509
|
+
|--------|-------------|
|
|
510
|
+
| `-p, --port <port>` | Port to listen on (default 4200) |
|
|
511
|
+
| `--no-open` | Do not open a browser window |
|
|
512
|
+
|
|
513
|
+
The server binds `127.0.0.1` only, checks `Host` and `Origin`, and requires a
|
|
514
|
+
per-instance token kept in `~/.invariant/ui.json` (mode 0600). What it can read
|
|
515
|
+
and write is limited to the directory it was started in.
|
|
516
|
+
|
|
517
|
+
In the UI: `⌘K` opens the command palette, `⇧⌘V` toggles rendered preview and
|
|
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.
|
|
520
|
+
|
|
521
|
+
To work on the UI itself: start a daemon (`invariant ui --no-open`), then run
|
|
522
|
+
`yarn dev:ui` for Vite with hot reload against it — `INVARIANT_UI_PORT=<port>`
|
|
523
|
+
when the daemon landed on something other than 4200.
|
|
524
|
+
|
|
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.
|
|
527
|
+
|
|
397
528
|
### `invariant scan`
|
|
398
529
|
|
|
399
530
|
Scan the codebase with embedded tree-sitter grammars and write a CodeGraph to `.invariant/codegraph/` — a structured inventory of files, languages, and top-level symbols for LLM navigation.
|
|
@@ -533,6 +664,7 @@ After `init` + `install` + `sync`:
|
|
|
533
664
|
│ ├── contexts/ # rendered contexts
|
|
534
665
|
│ ├── instructions/ # rendered instructions
|
|
535
666
|
│ ├── sessions/ # `invariant plan` output
|
|
667
|
+
│ │ └── .archive/ # sessions archived from the UI
|
|
536
668
|
│ └── codegraph/ # `invariant scan` output
|
|
537
669
|
├── .agents/ # canonical store — the only physical copy
|
|
538
670
|
│ ├── skills/<name>/SKILL.md
|