@remits/remits-cli 0.1.122 → 0.1.125

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remits/remits-cli",
3
- "version": "0.1.122",
3
+ "version": "0.1.125",
4
4
  "description": "Local CLI for auth, component sync, and live test execution against Remits",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -74,7 +74,9 @@ reference named after it.
74
74
  (`development-loop.md`)
75
75
  - **Give each agent its own lane: `remits-cli workspace use --auto`.** Without a workspace you are in
76
76
  the SHARED lane, where a full stage replaces what another agent is testing rather than merging with
77
- it. (`component-resolution.md`)
77
+ it. Each agent works in its own **clone**, never a same-branch worktree: worktrees share the branch
78
+ ref, so one agent's pull moves `HEAD` under the others, and `components commit` refuses there.
79
+ (`component-resolution.md`)
78
80
  - **On a variant branch, sync with `remits-cli components sync --safe`.** It dry-runs first and refuses
79
81
  a plan that would write components this checkout did not change — which is what a branch that is
80
82
  behind trunk produces, because it still physically carries old copies of files nobody touched.
@@ -82,8 +84,12 @@ reference named after it.
82
84
  - **`stage` is always safe. `components commit` on trunk is the most dangerous command in the CLI.**
83
85
  It is not a convenience wrapper: it `git add -A`, commits, pushes, and then reconciles the whole
84
86
  pushed repo into the live component database — creating, updating, renaming, and **hard-deleting**
85
- rows. Prefer the observable `git commit → git push → components sync → git pull`.
86
- (`component-integrity.md`)
87
+ rows. Prefer the observable `git commit → git push → components sync → git pull`. On trunk it refuses
88
+ before any git write unless you pass `--yes`. (`component-integrity.md`)
89
+ - **After anyone lands, ask whether your lane is stale: `remits-cli components status`.** A landing clears
90
+ only the lander's lane; yours keeps shadowing their new rows with content staged from the old base.
91
+ `LANDED SINCE YOUR BASE` / `STALE OVERLAY` mean pull, re-stage, then verify — a pass against a stale
92
+ lane proves nothing. (`component-resolution.md`)
87
93
  - **A component filename's numeric id prefix is load-bearing.** Renumber it and the next trunk sync
88
94
  creates a duplicate at the new id and hard-deletes the original. A live component whose files are
89
95
  missing from the repo at trunk-sync time is hard-deleted. Never renumber, rename across ids, or
@@ -274,7 +274,8 @@ remits-cli components branch <name> --retire [--force]
274
274
  ```
275
275
 
276
276
  Branch administration commands act **as the account you are running from**, which is treated as the branch
277
- **owner** — run them from the owner's trunk checkout. Authorization is downward-only.
277
+ **owner** — run them from the owner's trunk checkout. Authorization is downward-only. (`--retire` checks
278
+ this and refuses from a non-owner; the read commands below resolve the owner for you.)
278
279
 
279
280
  - **`--subscribe` sets the branch on an edge that must already exist — it cannot create one.** Failure
280
281
  reads *"Account N has no relationship edge to subscribe; add a membership edge first"*. Create it with
@@ -295,7 +296,22 @@ Branch administration commands act **as the account you are running from**, whic
295
296
  subscriptions.
296
297
  - **Retiring is explicit.** Deleting the *git* branch does **not** remove its overlays; subscribers would
297
298
  keep resolving a branch that no longer exists. `--retire` refuses while subscribers remain unless you
298
- pass `--force`.
299
+ pass `--force`, and it refuses (naming the owner) when run from any account other than the branch owner.
300
+ - **Reads work from any checkout.** `components branch <name>` (status, `--diff`, `--subscribers`) and
301
+ `components promotion` resolve the branch owner the account actually resolves the branch from —
302
+ including an inherited subscription held by an ancestor — and report it as `branchOwnerAccountId`.
303
+ `components branches` lists branches this account OWNS; from a subscriber it also names the branch it
304
+ resolves and from whom. If `components status` prints `INHERITED BRANCH`, this account gets the branch
305
+ through an ancestor's subscription: a sync from here varies THIS account's own components (for it and the
306
+ accounts beneath it). To change the owner's components, work in the owner's repository on that branch.
307
+ - **A commit must push to the repository the platform syncs.** `components status` names it (`sync reads
308
+ repository`). `components commit` refuses before any git write, and `components sync --safe` refuses,
309
+ when this checkout's `origin` is a different repository; a plain sync warns.
310
+ - **Every prompt varies on a branch, including the README and agent prompts.** Edit the repo-root
311
+ `README.md`, an agent's `.md` in `components/agents/`, or a prompt in `components/prompts/` exactly as
312
+ you would any other component file: stage, verify, sync, and subscribers resolve it; merging to trunk
313
+ lands it. The README becomes an overlay of the account's README prompt (a branch without `README.md`
314
+ reverts to trunk's); an agent's prompt travels inside that agent's overlay.
299
315
 
300
316
  **Every component kind can be varied** — `schema`, `reader`, `action`, `embeddable`, `i18n`, `htmltemplate`,
301
317
  `rule`, `test`, `utility` (agent), `tool`, `prompt` — including tombstones and branch-only additions. A
@@ -193,20 +193,20 @@ remits-cli listen [stop|status] [--foreground true] # compatibility alias
193
193
  remits-cli data-mode [set test|prod]
194
194
  remits-cli components stage [--workset | --changed-only] [--branch <name>] [--workspace <name>] [--empty-workset clear] [--data-mode test|prod] [--json|--verbose] # default = FULL SNAPSHOT of the repo; --workset = only what git says changed, lane reconciled to it
195
195
  remits-cli workspace [show | use <name> | use --auto | clear]
196
- remits-cli components status [--branch <name>] [--component-type <type>] [--component-id <id>] [--json|--verbose]
196
+ remits-cli components status [--branch <name>] [--component-type <type>] [--component-id <id>] [--json|--verbose] # also: has anyone landed since this lane was staged (freshness)
197
197
  remits-cli components lanes [--json] # every indexed staging lane on the account
198
198
  remits-cli components entries --lane-id <id> [--json|--verbose] # authoritative staged files for one lane
199
199
  remits-cli components clear [--branch <name>] [--component-type <type>] [--component-id <id>] [--all] [--json|--verbose] # id alone scopes to one component when unambiguous (ids are type-local; add --component-type if the same id is staged in multiple families); no filter clears the whole branch scope; --all forces the full wipe
200
200
  remits-cli components sync [--safe [--yes]] [--branch <name>] [--data-mode test|prod] [--force-tombstones] [--dry-run] [--summary] [--changed-only [--changed-since <ref>]] # gated; on trunk = full repo->DB reconcile, on a variant branch = ComponentVariant overlays only
201
- remits-cli components commit [--safe] [--message "msg"] [--data-mode test|prod] [--force-tombstones] # phase 1 merge-stages + compile-validates changed source (never reconciles the lane); --safe gates sync writes
201
+ remits-cli components commit [--yes] [--safe] [--allow-shared-branch] [--message|-m "msg"] [--data-mode test|prod] [--force-tombstones] [--json [--summary]] # phase 1 merge-stages + compile-validates changed source (never reconciles the lane); on TRUNK refuses before any git write unless --yes; --safe gates variant sync writes
202
202
  remits-cli components branches [--json] # branches carrying committed variants, with counts + drift
203
- remits-cli components branch <name> [--json] # one branch: overridden / added / removed, drift flags, subscribers
203
+ remits-cli components branch <name> [--json] # one branch: owner account, overridden / added / removed, drift flags, subscribers
204
204
  remits-cli components branch <name> --diff <componentId> --component-type <kind> [--json]
205
205
  remits-cli components branch <name> --subscribers [--json]
206
206
  remits-cli components branch <name> --subscribe <accountId> [--parent-account <id>] [--domain <host>] [--dry-run] [--confirm-primary-edge] # make an account resolve this branch
207
207
  remits-cli components branch <name> --unsubscribe <accountId> # return that account to trunk
208
208
  remits-cli components branch <name> --retire [--force] # delete the branch's overlays
209
- remits-cli test run --test <id|name> [--branch <stagingScope>] [--names "a|b"] [--watch true|false] [--data-mode test|prod] [--as-account <ID>] [--variant-branch <name|none>]
209
+ remits-cli test run --test <id|name> [--branch <stagingScope>] [--names "a|b"] [--watch true|false] [--data-mode test|prod] [--as-account <ID>] [--variant-branch <name|none>] [--json]
210
210
  remits-cli token [--path <embeddablePathOrId>] [--data-mode test|prod] [--as-account <ID>] [--variant-branch <name|none>]
211
211
  remits-cli token inspect --token <token|tokenKey|URL> # inspect token metadata, safety/dataMode evidence, and full context
212
212
  remits-cli tools [--branch <name>] [--data-mode test|prod] [--variant-branch <name|none>]
@@ -316,16 +316,39 @@ For tests specifically:
316
316
  `--variant-branch none` when an existing staged cache on the real git branch would shadow committed trunk
317
317
  or variant rows. On `components sync` / `commit`, `--branch` is different: it names the GitHub branch to
318
318
  reconcile.
319
+ - `--json` on `test run` prints exactly one JSON document to stdout: the final status/result. Safety
320
+ banners, start/progress lines, and websocket case progress go to stderr so shell callers can parse
321
+ stdout directly. The exit code is non-zero when the run fails, does not complete, or a requested case
322
+ selector matches nothing.
319
323
  - `--force-tombstones` is only for non-trunk variant syncs, when missing trunk component files are known,
320
324
  intentional tombstone overrides. It is rejected on trunk.
321
325
  - `--dry-run` is only for `components sync` on non-trunk variant branches. It reports the variant write
322
326
  plan without writing rows, caching the sync SHA, or clearing staging.
323
- - `--summary` on `components sync --dry-run` prints compact counts, removals/tombstones, skipped items, errors,
324
- and warnings instead of the full override/add/remove payload.
327
+ - `--summary` on `components sync` prints compact counts plus named updated (with the fields that
328
+ changed), renamed, skipped, removal/tombstone, error, and gate details instead of the full payload. A
329
+ trunk sync reports an untouched component under `unchanged`, not `updated`.
330
+ - `--json` on `components stage`, `components sync`, `components commit`, and `tool` prints one
331
+ parseable JSON document to stdout. Safety banners and prose go to stderr, and sync safety-gate failures
332
+ are reported inside `gateViolations` with a non-zero exit code instead of appending prose after the JSON.
333
+ - `components commit --json` prints the COMMIT outcome, not the sync's: `phase` (`stage` → `git` → `sync`
334
+ → `pull` → `complete`), `gitCommitted`, `pushed`, `pushedSha`, `synced`, `postSyncSha`, `pulled`, the
335
+ nested `sync` (summary with `--summary`), and on failure `error` + `nextStep`. It stops at the first
336
+ failed phase. `phase: "sync"` with `pushed: true` means the remote holds work the platform has not
337
+ reconciled — follow `nextStep`; do not re-run `components commit`.
338
+ - `components commit` on trunk refuses before staging, committing, or pushing unless `--yes` is present —
339
+ with or without `--safe`. Trunk has no dry-run plan, so nothing can preview the full repo-to-DB reconcile.
340
+ - `components commit` refuses before any git write while its branch is checked out in another worktree
341
+ (`sharedBranchWorktrees` in `--json`). Worktrees of one branch share its ref, so a stale one would commit
342
+ over landed work. Use one clone per agent; `--allow-shared-branch` overrides after `git status` is clean
343
+ apart from your own changes.
344
+ - `components commit` refuses before any git write, and `components sync --safe` refuses, when this checkout's
345
+ `origin` is not the repository the platform syncs for the resolved account (`branchContext.repository` in
346
+ `components status`). A plain sync warns and reports `repositoryCheck`, including under `--summary`.
325
347
  - **Fail-closed sync gates.** On non-trunk variant branches these flags now force a server dry-run first,
326
348
  evaluate that plan before any overlay row is written, and only then run the mutating sync when the plan
327
349
  passes. On trunk, there is no safe dry-run plan, so do not treat these as scoped commit controls:
328
- - `--changed-only` — fail unless every planned write is a component **this checkout actually changed**.
350
+ - `--changed-only` — fail unless every planned write is a component **this checkout actually changed**
351
+ (matched by type + id, type + name, or the repo file it came from — so a root `README.md` edit counts).
329
352
  This is the strongest guard against a sync that quietly rewrites components you never touched. It
330
353
  also fails when the checkout is not a git working tree, because "git could not answer" must never
331
354
  be read as "nothing changed".
@@ -388,6 +411,11 @@ REPRESENTABLE. On a non-trunk variant branch, prove a deletion through
388
411
  `components sync --dry-run --summary --fail-on-errors`; on trunk there is no dry-run plan, so use the
389
412
  full pre-sync safety check before any mutating reconcile.
390
413
 
414
+ The repo-root `README.md` is staged as the account's README-purpose Prompt. It is part of the git workset
415
+ for `components stage --workset`, even though it does not live under `components/`. It behaves like any
416
+ other component on trunk AND on a variant branch: a variant sync stores a README change as an overlay of
417
+ the README prompt, and an agent's `.md` in `components/agents/` travels with that agent's overlay.
418
+
391
419
  ### Prod banners and retryable failures
392
420
 
393
421
  - Every command that can touch production (`tool`, `test run`, `components sync`) prints a `PROD DATA`
@@ -115,6 +115,18 @@ Key implications:
115
115
  immediately syncs. Never run it while the tree contains drift or unexplained changes. Prefer the explicit,
116
116
  observable `components stage → git commit → git push → components sync → git pull` sequence so each
117
117
  phase can be inspected.
118
+ - **`components commit` on trunk refuses before any git write unless `--yes` is present** — with or
119
+ without `--safe`, and with `--skip-git`. Trunk has no dry-run sync plan, so an explicit acknowledgement
120
+ is the only honest gate; the CLI must not create or push a commit and only then discover it.
121
+ - **A commit that fails after the push says so.** `phase`, `pushed`, `pushedSha` and `nextStep` (in
122
+ `--json`, one document on stdout) tell you whether the remote now holds work the platform has not
123
+ reconciled. If it does, fix the cause and run `components sync` — do not re-run `components commit`.
124
+ - **A commit refuses when the push and the sync would hit different repositories** — this checkout's
125
+ `origin` versus the repository the platform syncs for the account the command resolved. Fix the account
126
+ (account-info.json, `--account-id`) or run from the right checkout; never force it.
127
+ - **A commit refuses while its branch is checked out in another worktree.** Worktrees of one branch share
128
+ its ref: a pull in one moves `HEAD` under the others, and `git add -A` from a stale one reverts work that
129
+ has already landed. Give each agent its own clone.
118
130
  - **`components sync` acts on the pushed remote**, so local edits are invisible to it until committed **and
119
131
  pushed**, and a drifted **remote** is dangerous even when your local tree looks fine.
120
132
  - **Runtime-compiled component source is validated before durable writes.** When a trunk sync or variant
@@ -165,14 +177,14 @@ file is catastrophic.
165
177
  push generated artifacts back to the branch.
166
178
  - Local filenames and live inventory (`mcp_account_view`) **agree on id and name for every component**: no live
167
179
  component appears locally under a different id, and no expected component is missing a repo file.
168
- > **Do not run this comparison against `account-info.json` alone — it will report false orphans.** That
180
+ > **Do not run this comparison against `account-info.json` alone — it can still be incomplete.** That
169
181
  > file omits `auxiliary: true` components by design, so every auxiliary component looks like a repo file
170
182
  > with no DB row, i.e. exactly the "a trunk sync will CREATE a duplicate" signal this check exists to
171
- > catch. It also omits README- and AGENT-purpose Prompts, which live at the repo root and as `.md`
172
- > sidecars in `components/agents/` rather than in `components/prompts/`, so they look like DB rows with
173
- > no repo file — the "will be DELETED" signal. Both are benign. Before treating a flagged component as
174
- > drift, confirm against the live row: `mcp_component_view`, or
175
- > `mcp_run_action controlAction:"describe"` for an Action. A component that answers is not an orphan.
183
+ > catch. README- and AGENT-purpose Prompts are also intentionally absent from the `Prompts` collection:
184
+ > they live at repo-root `README.md` and as `.md` sidecars in `components/agents/`, not in
185
+ > `components/prompts/`. Before treating a flagged component as drift, confirm against the live row:
186
+ > `mcp_component_view`, or `mcp_run_action controlAction:"describe"` for an Action. A component that
187
+ > answers is not an orphan.
176
188
  - You can state the expected create/update/delete set. **If any delete or renumber is unexpected, stop.**
177
189
 
178
190
  ### If something looks wrong — stop, don't paper over
@@ -174,22 +174,21 @@ overwrite each other, and a `components commit` clears the lane out from under t
174
174
  If more than one agent is working on the same branch, give each its own workspace:
175
175
 
176
176
  ```bash
177
- git fetch origin
177
+ git clone <repository-url> repo-agent-a # one CLONE per agent, same branch
178
+ cd repo-agent-a
178
179
  git switch forked
179
- git pull --ff-only origin forked
180
180
  git rev-list --left-right --count HEAD...origin/forked # must print: 0 0
181
- git worktree add --force ../repo-agent-a forked # one checkout per agent, same branch
182
- cd ../repo-agent-a
183
181
  remits-cli workspace use --auto # names the lane after this directory
184
182
  remits-cli components stage # isolated: nobody else sees it, nobody overwrites it
185
183
  remits-cli test run --test 42
186
184
  remits-cli token --path /page/whatever
187
185
  ```
188
186
 
189
- That first block matters. `git worktree add ... forked` uses the local `forked` ref; it does not fetch or
190
- prove that `forked` equals `origin/forked`. If the local ref is stale, every isolated staging lane starts
191
- from the same stale files and a later sync looks like a deliberate revert. Before the first edit in a new
192
- or reused worktree, `git status --porcelain`, `git log origin/<branch>..<branch>`, and
187
+ **A clone, not `git worktree add --force`.** Worktrees of one branch share its ref: a pull or commit in one
188
+ moves `HEAD` under the others, and a `components commit` from a stale one reverts work that already landed.
189
+ `components commit` refuses while its branch is checked out in another worktree (`--allow-shared-branch`
190
+ overrides, only once `git status` shows nothing but your own changes). A stale clone is still stale: before
191
+ the first edit in a new or reused clone, `git status --porcelain`, `git log origin/<branch>..<branch>`, and
193
192
  `git log <branch>..origin/<branch>` should all be empty. For variant branches, run
194
193
  `remits-cli components promotion --branch <branch>` too; a branch can be current with its own remote and
195
194
  still stale relative to trunk.
@@ -199,7 +198,7 @@ account, and the run still resolves whatever committed variant branch the accoun
199
198
  does **not** have the side effects of inventing a throwaway git branch per agent (which would make a
200
199
  commit write `ComponentVariant` overlays for a branch nobody subscribes to).
201
200
 
202
- - `.remits-cli/workspace` is per-checkout and gitignored, so each worktree keeps its own lane.
201
+ - `.remits-cli/workspace` is per-checkout and gitignored, so each clone keeps its own lane.
203
202
  - Precedence: `--workspace NAME` > `REMITS_WORKSPACE` > `.remits-cli/workspace` > shared default lane.
204
203
  - `--no-workspace` targets the shared lane for one command without clearing the file.
205
204
  - Every stage / test run / token / clear prints its `Staging lane:` — if a change seems to have had no
@@ -211,6 +210,18 @@ commit write `ComponentVariant` overlays for a branch nobody subscribes to).
211
210
  - `remits-cli components lanes` is the review view across users/branches/workspaces, and
212
211
  `remits-cli components entries --lane-id <id>` is the drill-down into actual staged files.
213
212
  - `remits-cli components clear --all` is scoped to YOUR lane and never touches another agent's.
213
+ - In lane rows, `currentLane` (also `mine`) marks THIS command's lane; `ownedByCaller` marks every lane
214
+ staged by your CLI user — your other clones' agents included.
215
+ - **A landing clears only the lander's lane.** Every stage records the commit it came from
216
+ (`stageBaseSha`), and `components status` compares that with the last commit the platform synced for the
217
+ branch (`branchContext.lastSyncedSha`) using your local git:
218
+ - `LANDED SINCE YOUR BASE` — the platform synced a commit this checkout does not contain. Somebody landed
219
+ after you pulled: `git fetch origin && git pull --ff-only`, then re-stage.
220
+ - `STALE OVERLAY` — entries staged from a commit older than the last sync. They shadow rows that landed
221
+ after they were staged; re-stage with `--workset` or clear them.
222
+ - `--json` carries the same answer as `freshness` (`landedSinceHead`, `entriesBehindLastSync`, `stale`).
223
+ `null` means unknown — a lane staged by an older CLI, or a branch whose last sync is not recorded —
224
+ never "fresh".
214
225
 
215
226
  ### A lane holds an OVERLAY; your workset is a different number
216
227
 
@@ -235,6 +235,11 @@ Two things to read correctly when it refuses:
235
235
  lease) and writes nothing at all.
236
236
  - **Every failure is printed, not just the first.** The one-line error is the first failure; the full list
237
237
  (identified by type and id) follows it. Fix them in one pass rather than one round trip each.
238
+ - **`N NOT compile-checked` is not a pass.** A `new_` component whose source file is empty or blank cannot
239
+ be judged, so it is listed by name with its reason instead of being counted as compiled. It will not run.
240
+ - **Deleting a component's source file while its sidecar stays is `content-file-deleted`.** The lane keeps
241
+ the source it already held, and that is what gets compiled and run. Clear that one component with the
242
+ command the CLI prints (`components clear --component-type <type> --component-id <id>`).
238
243
 
239
244
  If git cannot identify the changed set — you are not in a working tree, or git failed — there is no
240
245
  workset to validate, and the CLI prints `Compile validation: NOT RUN — workset-unknown` rather than