@nodii/dev 0.6.82 → 0.6.84

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
@@ -278,7 +278,9 @@ catalog (`registry.json`). A DS component set (Empty State, Pagination) is not
278
278
  a Surface, so its node comes from the design catalogue
279
279
  (`design-catalog.json`): the entry whose `figma.componentSetKey` (or
280
280
  `figma.componentKey`) is the key names its `figma.fileKey` and
281
- `figma.nodeId`. `lane check`'s Figma boundary resolves it the same way. The
281
+ `figma.nodeId`. A set with no entry of its own (Table Header, Table cell) is
282
+ listed on its family's entry, in `figma.familySets` (`componentSetKey`, `nodeId`,
283
+ `name`), in that entry's file. `lane check`'s Figma boundary resolves it the same way. The
282
284
  CLI never reads Figma REST for this. A key in neither catalogue is refused with
283
285
  `FIGMA_KEY_UNKNOWN`; the fix is to publish the key on its design catalogue
284
286
  entry in the design-system repository (the Figma MCP's
@@ -477,6 +479,8 @@ nodii-dev lane done-check KEY --evidence TEXT|URL
477
479
  # the lane's done check is met (NODII-DEV-CLI-4); a launched
478
480
  # run that exits after it ends finished, not orphaned; on a
479
481
  # lane already on_dev (land → verify first) it is a no-op
482
+ # refused with FIGMA_AFTER_IMAGES_MISSING while an open change
483
+ # set the lane holds has a changed node with no after image
480
484
  nodii-dev lane subagent-quota KEY N
481
485
  nodii-dev lane heartbeat KEY [--note TEXT]
482
486
  # a note starting "BLOCKED" or "WAITING:" (capitals) marks
@@ -525,7 +529,7 @@ nodii-dev lane check KEY [--gate CMD ...] [--critical] [--max-iterations N]
525
529
  nodii-dev lane review KEY --file REVIEW.json
526
530
  nodii-dev lane reviews KEY # each run with its checks and findings
527
531
  nodii-dev lane land KEY
528
- nodii-dev lane verify KEY --dev-check REF
532
+ nodii-dev lane verify KEY --dev-check REF [--checks FILE]
529
533
  nodii-dev lane list [--kind KIND] [--status STATUS] [--machine UUID]
530
534
  [--agent UUID|--mine] [--waiting-on SIDE] [--stuck true|false]
531
535
  [--cursor CURSOR] [--limit N]
@@ -574,6 +578,27 @@ nodii-dev watchdog install [--interval SECONDS] # install/update com.nodii.watch
574
578
  nodii-dev watchdog sweep # launchd entrypoint; normally not run by hand
575
579
  ```
576
580
 
581
+ ### Structured dev checks
582
+
583
+ `lane verify --checks FILE` sends what you read on dev. FILE is a JSON array, one entry per service and kind. Dev decides each result from the evidence and stores it, failed ones too. `lane show` lists them as `devChecks`.
584
+
585
+ | `kind` | `evidence` | Passes when |
586
+ |---|---|---|
587
+ | `catalog_publish` | `source` (`publisher_state`, `tenant_api` or `log`), `state`, `keyCount`, `version`, `expectedVersion`, optional `lastError` | `state` is `published`, `keyCount` is at least 1, and `version` equals `expectedVersion` |
588
+ | `worker_ready` | `endpoint`, `httpStatus`, `ready` | the status is 200 and `ready` is true |
589
+ | `outbox_draining` | `unpublishedBefore`, `unpublishedAfter` | the count is zero or falling |
590
+ | `replica_caught_up` | `replica`, `lagSeconds` | the lag is 60 seconds or less |
591
+ | `edge_request` | `url`, `method`, `status`, `bodyShape`, `bodyMatched` | the status is 2xx and the body matched |
592
+
593
+ Every entry also has `kind`, `serviceId`, `deployedDigest` (`sha256:...` or a commit) and `checkedAt`. Every kind takes an optional `observed` for the log line or probe output. Don't put secrets or personal data in it. A read more than 24 hours old fails.
594
+
595
+ ```json
596
+ [{"kind": "catalog_publish", "serviceId": "nodii-ticketing-service", "deployedDigest": "a0de85e3", "checkedAt": "2026-11-02T11:50:00Z",
597
+ "evidence": {"source": "publisher_state", "state": "published", "keyCount": 40, "version": "1.2.0", "expectedVersion": "1.2.0"}}]
598
+ ```
599
+
600
+ Dev refuses `on_dev` with `DEV_CHECK_FAILED` when the latest check of any kind failed. It refuses with `DEV_CHECK_REQUIRED` when a check is missing: `worker_ready` for a service with an implemented worker in Dev's registry, and `catalog_publish` for a service recorded as using `@nodii/role-catalog`. A rollout status or a passing `/readyz` does not prove a publish: a pod that published earlier keeps serving.
601
+
577
602
  The per-Mac watchdog runs outside agent sessions. Run `watchdog install` once
578
603
  with the machine coordinator's config; it refuses a lane or unassigned agent.
579
604
  Every sweep reports three host facts to Dev: watched run processes that exited
@@ -583,9 +608,11 @@ remote branch. Each observation is posted to the watched run by the machine
583
608
  coordinator; `process_dead` transitions it to explicit `orphan` immediately.
584
609
  Every watched run whose PID is alive (or whose lane supervisor is, between
585
610
  same-session continuations) is reported as `process_alive`. That is not a
586
- heartbeat: a lane run with no heartbeat still goes Quiet at 15 minutes (MW1-36),
587
- and Dev holds it at Quiet, short of Orphan, while its Mac still sees the process.
588
- Only a coordinator run takes `process_alive` as its heartbeat.
611
+ heartbeat. With Dev's matching sweep change (NODII-DEV-CLI-42), a lane
612
+ run with no heartbeat goes Quiet at 15 minutes and Orphan at 45 minutes even
613
+ while its Mac still sees the process (MW1-36); a Dev without that change holds
614
+ the run short of Orphan while `process_alive` arrives. Only a coordinator run
615
+ takes `process_alive` as its heartbeat.
589
616
  Each sweep also reads Dev's live runs for the machine. A dead process is reported
590
617
  again while Dev still holds its run as running, and a live lane or coordinator
591
618
  run with no local record is listed as `unwatchedRuns`.
@@ -1298,10 +1325,13 @@ and permission mode, and sends `Lane KEY: done check not recorded. Continue the
1298
1325
  Task: STEP.` on stdin. It does this up to `NODII_DEV_LANE_CONTINUATIONS` times
1299
1326
  (default 3; 0 turns it off). Each continuation is a run heartbeat, and
1300
1327
  `process.pid` and the watchdog record follow the new PID. A killed runtime
1301
- (a signal) is never continued. While the runtime lives, continuations
1302
- included, the supervisor heartbeats its run every
1303
- `NODII_DEV_RUN_HEARTBEAT_SECONDS` (60) as the lane identity that owns it;
1304
- nothing else heartbeats a launched lane's run. After the last continuation, the exit is
1328
+ (a signal) is never continued. While the runtime writes to its log,
1329
+ continuations included, the supervisor heartbeats its run every
1330
+ `NODII_DEV_RUN_HEARTBEAT_SECONDS` (60) as the lane identity that owns it. A
1331
+ runtime that is alive but writes nothing gets no heartbeat from the supervisor,
1332
+ so it goes Quiet at 15 minutes and Orphan at 45 (MW1-36). `lane heartbeat` and
1333
+ the harness's `hook lane-heartbeat` (on `PostToolUse` and `Stop`) also heartbeat
1334
+ the run. After the last continuation, the exit is
1305
1335
  reported as above and its reason counts the continuations. A supervisor runs
1306
1336
  the CLI version that started it, so a fix to this rule reaches a lane only
1307
1337
  when it is launched or resumed on that version.
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  refuseFromLane,
22
22
  revokeOAuth,
23
23
  } from "./oauth.js";
24
- import { FIGMA_HOOK_DENIALS, heartbeatCurrentLane, postHook, postHookFailure, preHook, settingsSnippet, workflowSuggestion } from "./hooks.js";
24
+ import { FIGMA_HOOK_DENIALS, heartbeatFromHook, postHook, postHookFailure, preHook, settingsSnippet, workflowSuggestion } from "./hooks.js";
25
25
  import { setupCommand } from "./setup.js";
26
26
  import { harnessCommand } from "./harness.js";
27
27
  import { repoCommand } from "./repo-policy.js";
@@ -106,6 +106,7 @@ import {
106
106
  import {
107
107
  amendmentGuard,
108
108
  amendLaneCommand,
109
+ laneAuthorityCommand,
109
110
  coordinatorCommand,
110
111
  gatherLaneCommand,
111
112
  launchLaneCommand,
@@ -280,6 +281,12 @@ Usage: nodii-dev <command> [options] [--json]
280
281
  # Figma scope by published key: --route derives it from the
281
282
  # DS catalog (route -> Surfaces -> componentSetKey -> file)
282
283
  lane amend <key> --objective|--scope|--rules TEXT --reason TEXT
284
+ # an --objective or --scope amendment needs the person's recorded
285
+ # scope_change first (MW1-12.5); a --rules amendment needs none
286
+ lane authority record <key> --kind scope_change|handover|deploy_go --quote TEXT --at ISO [--to-agent ID]
287
+ # a person's word, verbatim, with when they said it (MW1-12.5);
288
+ # recorded from their own sign-in, never from a lane's config
289
+ lane authority list <key> # the lane's recorded authority, oldest first
283
290
  lane gather [<key>] [--delta] [--objective TEXT] [--done-check TEXT] [--components a,b] [--paths a,b]
284
291
  # infers a launched worktree; explicit contract inputs support manual lane start
285
292
  lane gather [<key>] --picker agent [--shortlist ID --documents CODE[,CODE]]
@@ -323,6 +330,10 @@ Usage: nodii-dev <command> [options] [--json]
323
330
  # coordinator declares the machine's lane cap, at least every 60 minutes;
324
331
  # a raise needs a yes and a reason (MW1-38.10, MW1-38.13)
325
332
  lane heartbeat|resume|land|verify|prioritize|deprioritize|stop <key>
333
+ lane verify <key> --dev-check REF [--checks FILE]
334
+ # FILE is a JSON array of what you read on dev; Dev decides each result.
335
+ # A lane whose repos publish a catalogue or run workers needs passing
336
+ # catalog_publish and worker_ready checks (DEV_CHECK_REQUIRED, DEV_CHECK_FAILED)
326
337
  lane heartbeat <key> --note "BLOCKED: ..."|"WAITING: ..."
327
338
  # a note starting BLOCKED or WAITING: (capitals) marks the lane blocked:
328
339
  # an exit then ends its run blocked and never counts as a death
@@ -368,7 +379,10 @@ Usage: nodii-dev <command> [options] [--json]
368
379
  lane freeze drop <key> --section SECTION --item ID --reason TEXT
369
380
  lane freeze swap <key> --section SECTION [--item ID] --file VALUE.json --reason TEXT
370
381
  lane freeze show|history <key> # durable compact-safe contract and all versions
371
- lane stop <key> --reason TEXT [--sweeper LANE] [--no-closeout]
382
+ lane stop <key> [<key> ...] --reason TEXT [--sweeper LANE] [--no-closeout]
383
+ # hub-268: several keys stop one after another in one process, so the
384
+ # operator's one TOTP code covers them all; a lane that fails is reported
385
+ # and the rest still stop (LANE_STOP_INCOMPLETE names each failure)
372
386
  # hub-244: Dev ends the lane and releases its holds in one step
373
387
  # (issue claims; editing and all-rejected change sets with their scopes;
374
388
  # sets holding operator decisions move to --sweeper or are listed on the
@@ -686,7 +700,9 @@ export async function main(argv = process.argv.slice(2)) {
686
700
  // A nudge hook is fail-open and writes only its own JSON: it cannot run a
687
701
  // Delta gather, and a waiting-results banner would corrupt its output.
688
702
  // surface-gen-pre runs in every session, lane or not, so it never reaches Dev.
689
- if (argv[0] !== "__run-supervisor" && !readsHelp(argv) && !(argv[0] === "hook" && (argv[1]?.startsWith("nudge-") || argv[1] === "surface-gen-pre"))) {
703
+ // The heartbeat hook fires on every tool call, so these checks would call Dev each
704
+ // time past its rate limit, and a failed check would silently stop the heartbeat.
705
+ if (argv[0] !== "__run-supervisor" && !readsHelp(argv) && !(argv[0] === "hook" && (argv[1]?.startsWith("nudge-") || argv[1] === "surface-gen-pre" || argv[1] === "lane-heartbeat"))) {
690
706
  await amendmentGuard(argv);
691
707
  await showWaitingResults({ acknowledge: argv[0] !== "hook" });
692
708
  }
@@ -910,6 +926,7 @@ export async function main(argv = process.argv.slice(2)) {
910
926
  return emit({ data: result.data }, json, result.text);
911
927
  }
912
928
  if (command === "lane" && action === "amend") return emitCommand(await amendLaneCommand(rest[0], f));
929
+ if (command === "lane" && action === "authority") return emitCommand(await laneAuthorityCommand(rest[0], rest[1], f));
913
930
  if (command === "lane" && action === "gather") {
914
931
  const result = await gatherLaneCommand(rest[0], f);
915
932
  // An agent picker's shortlist step records nothing yet.
@@ -1459,8 +1476,16 @@ export async function main(argv = process.argv.slice(2)) {
1459
1476
  return;
1460
1477
  }
1461
1478
  if (action === "lane-heartbeat") {
1462
- const result = await heartbeatCurrentLane();
1463
- return emit(result, json, result.heartbeated ? `Heartbeat recorded for ${result.key}.` : "No current-branch lane; no heartbeat sent.");
1479
+ // A heartbeat never blocks the tool call or the stop that fired it.
1480
+ try {
1481
+ let payload = {};
1482
+ if (!process.stdin.isTTY) { try { payload = JSON.parse(await stdinText()); } catch {} }
1483
+ const result = await heartbeatFromHook(payload);
1484
+ return emit(result, json, result.heartbeated ? `Heartbeat recorded for ${result.key}.` : `No heartbeat sent: ${result.reason}.`);
1485
+ } catch (error) {
1486
+ process.stderr.write(`nodii-dev lane heartbeat: ${error?.code ?? "ERROR"}: ${error?.message ?? String(error)}\n`);
1487
+ return;
1488
+ }
1464
1489
  }
1465
1490
  const payload = JSON.parse(await stdinText());
1466
1491
  await recordHookFire(payload).catch(() => {});
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.82";
7
+ export const VERSION = "0.6.84";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
@@ -183,6 +183,9 @@ async function devFetchOnce(method, path, bodyText, contentType, accept, extra =
183
183
  // process's memory. Without a TTY (an agent) the refusal is surfaced as it is.
184
184
  export const OPERATOR_STEP_UP_PATH = "/api/v1/operator/step-up";
185
185
  export const OPERATOR_STEP_UP_HEADER = "x-operator-step-up";
186
+ // hub-268: a staff-or-operator route (lane stop, Built acknowledge) refuses the
187
+ // CLI with STAFF_OPERATOR_REQUIRED and accepts the same grant.
188
+ const STEP_UP_REFUSALS = new Set(["OPERATOR_REQUIRED", "STAFF_OPERATOR_REQUIRED"]);
186
189
  let stepUpGrant = null; // { grant, expiresAt } for this process only
187
190
  let pendingStepUp = null; // the step-up in flight, shared by concurrent refusals
188
191
  let totpPrompt = defaultTotpPrompt;
@@ -270,7 +273,7 @@ async function devFetch(method, path, bodyText, contentType, accept, extra = {},
270
273
  const first = await send(held);
271
274
  const code = refusalCode(first.raw);
272
275
  const refused =
273
- (first.response.status === 403 && code === "OPERATOR_REQUIRED") ||
276
+ (first.response.status === 403 && STEP_UP_REFUSALS.has(code)) ||
274
277
  (first.response.status === 401 && code === "OPERATOR_STEP_UP_INVALID");
275
278
  if (!refused) return first;
276
279
  // Drop only the grant this call was refused with; one obtained meanwhile by