@invariant.guru/cli 0.6.9 → 0.7.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 CHANGED
@@ -214,20 +214,48 @@ GitLab merge request, anchored on its file and line. Nothing is submitted for
214
214
  you and nobody is notified — you read the drafts in GitLab and press *Submit
215
215
  review*. The token is per project: see [docs/spec-review.md](docs/spec-review.md) §9.
216
216
 
217
+ Publishing is one of the project's **integrations**, configured on the
218
+ Configuration page. The other is **Linear**: link a session to an issue, and one
219
+ block of that session — the human-facing spec, not the plan — syncs in either
220
+ direction. The rest of the session is never sent.
221
+
222
+ ```
223
+ Configuration → GitLab publish a triaged review to a merge request
224
+ Configuration → Linear link a session to an issue and sync its spec
225
+ ```
226
+
227
+ Conventions (host, project path, team key, the issue template an agent aims at)
228
+ go into `invariant.json`, so a team shares them. Tokens go into
229
+ `.invariant/integrations.local.json`, `0600` and git-ignored, and never leave
230
+ the daemon. An action an integration does not enable is not shown at all — with
231
+ no GitLab token, the review footer is simply *Plan changes*. See
232
+ [docs/spec-integrations.md](docs/spec-integrations.md).
233
+
217
234
  ### 7. `invariant ui` — see and manage your sessions
218
235
 
219
- Opens a local dashboard for this project: a session board grouped by status,
220
- rendered markdown, a rich editor, review triage, package management, and a
221
- command palette.
236
+ Opens a local dashboard: a session list, rendered markdown, a rich editor, review
237
+ triage, package management, and a command palette.
222
238
 
223
239
  ```bash
224
240
  invariant ui # start on 4200 (or the next free port) and open a browser
225
- invariant ui status # every running instance on this machine
226
- invariant ui stop # stop this project's instance
241
+ invariant ui status # the daemon, and the projects it serves
242
+ invariant ui stop # stop it
243
+ ```
244
+
245
+ **One server, every project.** Running `invariant ui` in a second repository does
246
+ not start a second server — it registers that folder and opens it in the one
247
+ already running. `⌘P` switches between projects; `⇧⌘H` goes to the list of them
248
+ all. Switching is a URL change (`/p/<project>/sessions`), so back, forward,
249
+ reload, bookmarks and a second tab on a second project all work the way you
250
+ would expect, and nothing from one project survives into the next.
251
+
252
+ ```bash
253
+ invariant projects # every registered project
254
+ invariant projects add [path] # register one (defaults to the current folder)
255
+ invariant projects remove # forget one — its files are left alone
227
256
  ```
228
257
 
229
- Each directory gets its own instance on its own port, so several repositories can
230
- be open at once without ever mixing sessions.
258
+ The list lives in `~/.invariant/projects.json`.
231
259
 
232
260
  ### Full walkthrough
233
261
 
@@ -558,24 +586,30 @@ See [docs/spec-review.md](docs/spec-review.md) for the document format.
558
586
 
559
587
  ### `invariant ui [port]`
560
588
 
561
- Start (or attach to) the local session UI for the current project, then open a
562
- browser. One instance per directory; the default port is 4200 and the next free
563
- port is used when it is taken.
589
+ Start or attach to the one local UI server on this machine, then open a
590
+ browser on the project you ran it from. The default port is 4200 and the next
591
+ free port is used when it is taken.
592
+
593
+ There is exactly one server. Running `invariant ui` again, here or in another
594
+ repository, attaches to it rather than racing a second one onto another port;
595
+ asking for a different port while it runs is refused rather than silently
596
+ ignored. A folder with no `invariant.json` is fine too — the server opens on the
597
+ project list instead.
564
598
 
565
599
  ```bash
566
- invariant ui # start and open a browser
567
- invariant ui 4300 # ask for a specific port (fails if it is busy)
600
+ invariant ui # start or attach, and open this project
601
+ invariant ui 4300 # ask for a specific port (refused if one is already running)
568
602
  invariant ui --no-open # start without opening a browser
569
- invariant ui status --json # machine-readable status of every instance
570
- invariant ui stop --all # stop every instance on this machine
603
+ invariant ui status --json # machine-readable status
604
+ invariant ui stop # stop the server
571
605
  invariant ui migrate-headers # add <session-meta> headers to legacy sessions
572
606
  ```
573
607
 
574
608
  | Subcommand | Description |
575
609
  |--------|-------------|
576
610
  | *(none)* / `start [port]` | Start or attach, then open a browser |
577
- | `stop` | Stop this project's instance (`--all` for every instance) |
578
- | `status` | Every instance, liveness-checked (`--json`) |
611
+ | `stop` | Stop the server |
612
+ | `status` | The server and its projects, liveness-checked (`--json`) |
579
613
  | `migrate-headers` | Give legacy session files a canonical `<session-meta>` header |
580
614
 
581
615
  | Option | Description |
@@ -584,19 +618,35 @@ invariant ui migrate-headers # add <session-meta> headers to legacy sessions
584
618
  | `--no-open` | Do not open a browser window |
585
619
 
586
620
  The server binds `127.0.0.1` only, checks `Host` and `Origin`, and requires a
587
- per-instance token kept in `~/.invariant/ui.json` (mode 0600). What it can read
588
- and write is limited to the directory it was started in.
621
+ token kept in `~/.invariant/ui.json` (mode 0600). Every request names the project
622
+ it acts on (`/api/p/<project>/…`) and is scoped to that project's directory for
623
+ its whole lifetime, so one project can never read or write another's files.
624
+
625
+ ### `invariant projects`
626
+
627
+ The projects the UI serves, kept in `~/.invariant/projects.json`.
628
+
629
+ ```bash
630
+ invariant projects # list them, with what each is waiting on
631
+ invariant projects add [path] # register a folder (defaults to the current one)
632
+ invariant projects remove [id|path] # forget one — nothing on disk is touched
633
+ ```
634
+
635
+ A project must have been initialized (`invariant init`) before it can be added.
636
+ Removing one only edits the list: re-adding the path brings back every session,
637
+ review and setting exactly as they were.
589
638
 
590
- In the UI: `⌘K` opens the command palette, `⇧⌘V` toggles rendered preview and
591
- editing, `N` starts a session, `?` lists every shortcut. On a review session,
639
+ In the UI: `⌘K` opens the command palette, `⌘P` switches project, `⇧⌘H` goes to
640
+ the project list, `⇧⌘V` toggles rendered preview and editing, `N` starts a
641
+ session, `?` lists every shortcut. On a review session,
592
642
  `j`/`k` move between comments and `s` / `d` / `e` stage, discard, or edit one.
593
643
 
594
644
  #### The Packages page
595
645
 
596
646
  The **Packages** section of the UI is a view over the package commands — it runs
597
647
  the same `invariant install`, `add`, `remove`, `uninstall` and `sync` you would
598
- type, in the directory the UI was started in, and shows you the command before it
599
- runs. It never writes `invariant.json` itself.
648
+ type, in the folder of the project you are currently in, and shows you the
649
+ command before it runs. It never writes `invariant.json` itself.
600
650
 
601
651
  - **The tree is `invariant inspect`.** Selecting a package lists everything it
602
652
  ships, grouped by type, with the active items ticked.
@@ -620,7 +670,7 @@ runs. It never writes `invariant.json` itself.
620
670
 
621
671
  A change made in a terminal shows up in an open page within a couple of seconds.
622
672
 
623
- To work on the UI itself: start a daemon (`invariant ui --no-open`), then run
673
+ To work on the UI itself: start the server (`invariant ui --no-open`), then run
624
674
  `yarn dev:ui` for Vite with hot reload against it — `INVARIANT_UI_PORT=<port>`
625
675
  when the daemon landed on something other than 4200.
626
676