@nodii/dev 0.6.189 → 0.6.191

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
@@ -198,6 +198,7 @@ nodii-dev figma publish FILE --sets CS-1,CS-2 [--dry-run]
198
198
 
199
199
  - **Board.** "Waiting on" comes from Dev's real state: the lane's status, the change sets it holds (state, pending items, file order), Dev's wait records, the heavy-slot queue and `answered.md`. It never comes from the lane's note, which is shown as written in its own column. A question counts as the operator's only when it is an open item on the sheet. `--write` puts "What's running" on the status page `docs/open/<sheet>-status.md` and only the lanes that wait on the operator on the sheet, because MW4-31 keeps status off the sheet. It works in the worktree `nodii-infra/.claude/worktrees/<sheet>-board` and merges through a PR. First it copies every answer the operator typed in their checkout, verbatim, into `answered.md` and into the sheet. Then it fast-forwards the operator's checkout, and only when nothing else there differs from main. An empty board, or one that drops by more than half, is refused (`--force` once you have checked Dev). Priority domains are coordinator configuration in `~/.config/nodii-dev/coordinator/settings.json` (`domains`); a lane outside them is listed under "Other lanes".
200
200
  - **Watch.** Jobs and intervals: board 15 min, apply-watch 3, publish-watch 10, real-stuck 30, complexity 30, orphan-slots 10, keepalive 10. Everything goes to one log, `coordinator-watch.log`, under `~/Library/Logs/nodii-dev/` on macOS and `~/.local/state/nodii-dev/logs/` on Linux. On Linux the memory guard on a resume reads `MemAvailable` from `/proc/meminfo`. Alerts go to `~/.config/nodii-dev/coordinator/alerts.log` and open the coordinator's next session. A job is paused by `~/.config/nodii-dev/coordinator/hold-<job>`. A resume tries the lane's own account first. On an account refusal it tries the accounts listed in `settings.json` `keepaliveProfiles` (`[{ "profile": "/abs/path", "class": "short" }]`), because the account roster is the operator's call (MW1-38.3). The watch never stops a process it did not start (K02-15). It reports an orphaned slot instead. Keepalive resumes a blocked lane, or any down lane with waits of its own whatever Dev reports as its liveness, only through `lane resume --if-changed` (MW1-102): a lane whose blockers have not changed, or could not be read, stays down, and does not use up the run's resumes. Each resume's log line names the change that let it through. A down lane with no waits (an orphan) resumes as before. At `NODII_DEV_RESUME_IF_CHANGED=0`, keepalive resumes a blocked lane at most once an hour. When the installed `@nodii/dev` is not the version the daemon started with, the daemon logs it and exits, and launchd (`KeepAlive`) or systemd (`Restart=always`) starts it again on the new code.
201
+ - **A restarted lane runs like a launched one (hub-242, the operator's ruling of 20 Nov: "fix the watcher").** The watch daemon and the watchdog run at launchd's `Standard` priority, not `Background`, so the lanes they restart are not starved of CPU; re-run `nodii-dev coordinator watch install` and `nodii-dev watchdog install` after upgrading so the plists change. Before a resume the daemon puts the Figma token in the environment the lane inherits, from where a coordinator's own resume gets it: `FIGMA_PAT`/`FIGMA_TOKEN`, else the Keychain item publish-watch reads, else `FIGMA_PAT` in `~/Projects/design-system/.env.local`; it is never logged. The accounts the operator rules out sit in the coordinator's `settings.json` as `"excludedProfiles": [{ "profile": "/abs/path", "reason": "..." }]` (MW1-38.3, the roster). The one account picker, keepalive's own `keepaliveProfiles` list and a named `lane resume --profile` (refused `ACCOUNT_EXCLUDED`) all skip them. The restart cap is the machine's declared lane cap (`laneCapState.cap` on Dev's machine record, set with `lane cap`), never a fixed 42; a cap that cannot be read refuses the restart.
201
202
  - **publish-watch** stays off until the coordinator sets `"publishWatch": true` in `settings.json`. MW8-7 still names the operator as publisher until hub-429 lands. It needs a Figma token to read the new version. It reads the token from `FIGMA_PAT` (or `FIGMA_TOKEN`) in the daemon's own environment first, then from the macOS keychain (`security add-generic-password -s nodii-dev-figma-pat -a "$USER" -w`). The plist that `coordinator watch install` writes carries no token, so the keychain is the usual source; a token someone adds to the plist's environment would be used before it. It never reads a file. On Linux the job answers "macOS only", so nothing there reads a Secret Service for the token.
202
203
  - **Chrome.** `chrome start` adopts the Chrome already serving the port, or starts one on the profile, and records the endpoint on Dev's machine record (`hostFacts.sharedChrome`; coordinator or staff only). Every command opens its own background tab and closes only that tab (K02-16, K02-17). `chrome signin` refuses anything but a `tech-*` tenant and a yopmail test identity. It signs in within its own tab and opens `--open PATH` if given. Then it signs out (the app's logout, then that origin's storage and cookies cleared), so no session or token outlives it (MW3-40.2). It never prints or stores a credential, tries each tenant at most once an hour, skips a tenant another tab has open, and rests a tenant after a failed sign-in until `--clear-rest`.
203
204
  - **figma publish** refuses a set that is not `awaiting_publish`. It ticks exactly the approved components of the named sets in Figma's Publish library dialog and unticks every other row. It stops if a row won't settle or if it saw fewer rows than the dialog counts. It records a set in Dev only when all of the set's components were published.
@@ -714,7 +715,11 @@ nodii-dev lane heartbeat KEY [--note TEXT]
714
715
  # when the note names an open issue no live lane holds, Dev
715
716
  # answers with the lane leeway command to run and the
716
717
  # heartbeat prints it; the lane is then not blocked
717
- nodii-dev lane leeway KEY --blocker ISSUE [--repo NAME] --reason TEXT
718
+ nodii-dev lane leeway KEY --blocker ISSUE [--repo NAME] [--parent LEEWAY_ID] --reason TEXT
719
+ # hub-600 (MW1-12.8): a leeway is a chain link only when
720
+ # --parent names the granted leeway whose own work this
721
+ # blocker stops; otherwise Dev gives it depth 1, and only the
722
+ # 2-open cap bounds it (LEEWAY_PARENT_INVALID for a bad parent).
718
723
  # ask the machine coordinator for leeway to fix the blocker
719
724
  # instead of ending BLOCKED (MW1-12.6, DEC-0486); the ask
720
725
  # claims the blocker issue for the lane (MW1-21.1)
@@ -2017,7 +2022,7 @@ and does not file a note and stop (MW1-12.6). It asks its machine coordinator
2017
2022
  for leeway to fix that one issue:
2018
2023
 
2019
2024
  ```
2020
- nodii-dev lane leeway KEY --blocker ISSUE [--repo NAME] --reason TEXT
2025
+ nodii-dev lane leeway KEY --blocker ISSUE [--repo NAME] [--parent LEEWAY_ID] --reason TEXT
2021
2026
  ```
2022
2027
 
2023
2028
  Dev claims the issue for the lane (MW1-21.1) and the command prints `Leeway asked (ID):
package/dist/accounts.js CHANGED
@@ -265,20 +265,39 @@ export async function recordExhaustedAccount(profile, entry, { path = exhaustedA
265
265
  return entries[key];
266
266
  }
267
267
 
268
+ /**
269
+ * hub-242: the accounts the operator ruled out for lanes (19 Nov: no lanes on
270
+ * ~/.claude-naman-sahni-at-nodii). The roster is the operator's call (MW1-38.3),
271
+ * so it is configuration: `excludedProfiles` in the coordinator's settings.json,
272
+ * as `[{ "profile": "/abs/path", "reason": "..." }]` or plain paths. Every account
273
+ * choice asks this one rule: the picker, keepalive's own list and a named --profile.
274
+ */
275
+ export async function excludedProfiles({ home = homedir(), read = readFile } = {}) {
276
+ let settings = {};
277
+ try { settings = JSON.parse(await read(join(home, ".config", "nodii-dev", "coordinator", "settings.json"), "utf8")); }
278
+ catch { return []; }
279
+ const list = Array.isArray(settings?.excludedProfiles) ? settings.excludedProfiles : [];
280
+ return list.map((entry) => profilePath(typeof entry === "string" ? entry : entry?.profile)).filter((value) => typeof value === "string" && value.length > 1);
281
+ }
282
+
283
+ export async function accountExcluded(profile, options = {}) {
284
+ return (await excludedProfiles(options)).includes(profilePath(profile));
285
+ }
286
+
268
287
  // MW1-38.2: a long resume needs an ok band; a short or no-build one fits up to short_only.
269
288
  const ADMITS = { long: ["ok"], short: ["ok", "warning", "short_only"], no_build: ["ok", "warning", "short_only"] };
270
289
 
271
290
  /**
272
291
  * Another registered account of the runtime on this machine whose freshly
273
- * read band admits the work class, skipping `from` and the `exclude`d
274
- * (recorded exhausted) profiles; null when none has headroom or the
292
+ * read band admits the work class, skipping `from`, the `exclude`d
293
+ * (recorded exhausted) profiles and the operator's excluded ones (hub-242); null when none has headroom or the
275
294
  * accounts cannot be listed.
276
295
  */
277
- export async function pickHeadroomAccount({ runtime, from, exclude = [], workClass = "long" }, { request = devRequest, config = readConfig, readers = READERS } = {}) {
296
+ export async function pickHeadroomAccount({ runtime, from, exclude = [], workClass = "long" }, { request = devRequest, config = readConfig, readers = READERS, home = homedir() } = {}) {
278
297
  let accounts;
279
298
  try { accounts = await listAccounts(await coordinatorMachineId({ request, config }), { request }); }
280
299
  catch { return null; }
281
- const skip = new Set([from, ...exclude].map(profilePath));
300
+ const skip = new Set([from, ...exclude, ...(await excludedProfiles({ home }))].map(profilePath));
282
301
  const candidates = accounts.filter((account) => account.runtime === runtime && !skip.has(profilePath(account.profile)));
283
302
  if (!candidates.length) return null;
284
303
  const results = await reportUsage(candidates, { request, readers });
package/dist/cli.js CHANGED
@@ -538,7 +538,9 @@ Usage: nodii-dev <command> [options] [--json]
538
538
  # note names an open issue no live lane holds, Dev answers with the
539
539
  # lane leeway command to run and the heartbeat prints it: the lane is then
540
540
  # not blocked, and the Stop gate and the supervisor continue its session
541
- lane leeway <key> --blocker ISSUE [--repo NAME] --reason TEXT
541
+ lane leeway <key> --blocker ISSUE [--repo NAME] [--parent LEEWAY_ID] --reason TEXT
542
+ # hub-600 (MW1-12.8): --parent names the granted leeway whose own work
543
+ # this blocker stops; only then is it a chain link. Without it, depth 1
542
544
  # MW1-12.6 (DEC-0486): a lane blocked on an open issue no live lane holds asks
543
545
  # its machine coordinator for leeway to fix it, instead of ending BLOCKED. Dev
544
546
  # claims the issue for the lane (MW1-21.1); LEEWAY_BLOCKER_HELD names the lane
@@ -28,6 +28,7 @@ import {
28
28
  DEFAULT_DOMAINS, boardCommand, coordinatorHome, heavyQueue, laneDomain, laneProcesses, liveChangeSets, machineLanes, readCoordinatorSettings,
29
29
  } from "./coordinator-board.js";
30
30
  import { governorMachineId } from "./governor.js";
31
+ import { excludedProfiles } from "./accounts.js";
31
32
  import { envAssignment, execLine, installNote, installSupervised, lingerLine, logsDir, supervisedDirs, unitActive, unitPath, unitText } from "./systemd.js";
32
33
 
33
34
  const execFile = promisify(execFileCallback);
@@ -93,7 +94,11 @@ export async function machineGuards({ execute = execFile, load = loadavg, os = p
93
94
 
94
95
  /** Whether a resume may run now. Priority lanes get more room, as on 12 Nov. */
95
96
  export function resumeAllowed(guards, { priority, hold = false }) {
96
- if (guards.laneProcesses !== null && guards.laneProcesses >= 42) return { ok: false, reason: `${guards.laneProcesses} lane processes (cap 42)` };
97
+ // hub-242: the cap is the machine's declared lane cap (Dev's laneCapState), never a fixed number.
98
+ if (guards.laneProcesses !== null) {
99
+ if (!Number.isFinite(guards.laneCap)) return { ok: false, reason: "the machine's declared lane cap could not be read" };
100
+ if (guards.laneProcesses >= guards.laneCap) return { ok: false, reason: `${guards.laneProcesses} lane processes (declared cap ${guards.laneCap})` };
101
+ }
97
102
  if (guards.freePercent !== null && guards.freePercent < (priority ? 25 : 20)) return { ok: false, reason: `memory ${guards.freePercent}% free` };
98
103
  if (guards.load15 >= (priority ? 100 : 60)) return { ok: false, reason: `load ${guards.load15}` };
99
104
  if (hold && !priority) return { ok: false, reason: "keepalive hold" };
@@ -328,17 +333,41 @@ export async function figmaPatFromKeychain(execute) {
328
333
  catch { return null; }
329
334
  }
330
335
 
331
- export function watchContext({ home = homedir(), request = devRequest, config = readConfig, execute = execFile, now = Date.now, sleep = delay, log, jobState = {}, os = platform(), resume = async (key, flags) => (await import("./lanes.js")).laneCommand("resume", [key], flags), guardsFor = () => machineGuards({ execute, os }) } = {}) {
336
+ /**
337
+ * hub-242: the Figma token a restarted lane needs, from where a coordinator's
338
+ * own lane resume gets it: the environment (FIGMA_PAT or FIGMA_TOKEN), else the
339
+ * Keychain item publish-watch reads, else FIGMA_PAT in the design-system
340
+ * checkout's .env.local (as its scripts and the coordinators read it). Never printed.
341
+ */
342
+ export async function figmaToken({ env = process.env, execute = execFile, home = homedir(), read = readFile } = {}) {
343
+ if (env.FIGMA_PAT || env.FIGMA_TOKEN) return env.FIGMA_PAT || env.FIGMA_TOKEN;
344
+ const fromKeychain = await figmaPatFromKeychain(execute);
345
+ if (fromKeychain) return fromKeychain;
346
+ try {
347
+ const line = (await read(join(home, "Projects", "design-system", ".env.local"), "utf8")).split("\n").find((l) => /^\s*FIGMA_PAT\s*=/.test(l));
348
+ const value = line?.replace(/^\s*FIGMA_PAT\s*=\s*/, "").trim().replace(/^["']|["']$/g, "");
349
+ return value || null;
350
+ } catch { return null; }
351
+ }
352
+
353
+ export function watchContext({ home = homedir(), request = devRequest, config = readConfig, execute = execFile, now = Date.now, sleep = delay, log, jobState = {}, os = platform(), resume = async (key, flags) => (await import("./lanes.js")).laneCommand("resume", [key], flags), guardsFor = () => machineGuards({ execute, os }), env = process.env, figmaToken: tokenFor = () => figmaToken({ env, execute, home }) } = {}) {
332
354
  let machine = null;
333
355
  let processesCache = null;
334
356
  let guardsCache = null;
357
+ // hub-242: the restart cap is the cap the machine declared in Dev.
358
+ const withLaneCap = async (guards) => {
359
+ if (guards && "laneCap" in guards) return guards;
360
+ let laneCap = null;
361
+ try { laneCap = (await request("GET", `/api/v1/machines/${encode(await ctx.machineId())}`)).data?.laneCapState?.cap ?? null; } catch {}
362
+ return { ...guards, laneCap: Number.isFinite(laneCap) ? laneCap : null };
363
+ };
335
364
  const ctx = {
336
365
  home, request, now, sleep, jobState, os,
337
366
  stamp: () => new Date(now()).toISOString().slice(11, 16) + "Z",
338
367
  machineId: async () => (machine ??= await governorMachineId({}, { request, config })),
339
368
  processes: async () => (processesCache ??= await laneProcesses()),
340
369
  heavy: () => heavyQueue({ execute, os }),
341
- guards: async () => (guardsCache ??= await guardsFor()),
370
+ guards: async () => (guardsCache ??= await withLaneCap(await guardsFor())),
342
371
  amend: async (key, rules, reason) => {
343
372
  const { amendLaneCommand } = await import("./starting.js");
344
373
  await amendLaneCommand(key, { rules, reason });
@@ -352,10 +381,17 @@ export function watchContext({ home = homedir(), request = devRequest, config =
352
381
  // allowed lane accounts in order (settings.keepaliveProfiles: the account
353
382
  // roster is the operator's call, MW1-38.3, so it is configuration).
354
383
  const settings = await readCoordinatorSettings(home);
384
+ // hub-242: the restarted lane gets the Figma token a coordinator's own
385
+ // resume has, in the environment it inherits; never logged.
386
+ if (!env.FIGMA_PAT && !env.FIGMA_TOKEN) {
387
+ const token = await tokenFor().catch(() => null);
388
+ if (token) env.FIGMA_PAT = token;
389
+ }
390
+ const excluded = new Set(await excludedProfiles({ home }));
355
391
  // A resume the caller knows is due (a set it holds was decided) passes
356
392
  // --ungated: that change is not in the blocker fingerprint (NODII-DEV-CLI-191).
357
393
  const gate = ifChanged ? { "if-changed": true } : ungated ? { ungated: true } : {};
358
- const attempts = [{ ...gate }, ...(settings.keepaliveProfiles ?? []).map((p) => ({ ...gate, profile: p.profile, class: p.class ?? "short" }))];
394
+ const attempts = [{ ...gate }, ...(settings.keepaliveProfiles ?? []).filter((p) => !excluded.has(String(p.profile ?? "").replace(/\/+$/, ""))).map((p) => ({ ...gate, profile: p.profile, class: p.class ?? "short" }))];
359
395
  let last = "LANE_RESUME_FAILED";
360
396
  for (const flags of attempts) {
361
397
  try {
@@ -569,7 +605,7 @@ const xml = (value) => String(value).replaceAll("&", "&amp;").replaceAll("<", "&
569
605
 
570
606
  export function watchPlist({ runtime, entry, config, log, path }) {
571
607
  const args = [runtime, entry, "coordinator", "watch", "run"].map((v) => `<string>${xml(v)}</string>`).join("");
572
- return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>${WATCH_LABEL}</string><key>ProgramArguments</key><array>${args}</array><key>EnvironmentVariables</key><dict><key>NODII_DEV_CONFIG_PATH</key><string>${xml(config)}</string><key>PATH</key><string>${xml(path)}</string></dict><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>ThrottleInterval</key><integer>60</integer><key>ProcessType</key><string>Background</string><key>StandardOutPath</key><string>${xml(log)}</string><key>StandardErrorPath</key><string>${xml(log)}</string></dict></plist>\n`;
608
+ return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>${WATCH_LABEL}</string><key>ProgramArguments</key><array>${args}</array><key>EnvironmentVariables</key><dict><key>NODII_DEV_CONFIG_PATH</key><string>${xml(config)}</string><key>PATH</key><string>${xml(path)}</string></dict><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>ThrottleInterval</key><integer>60</integer><key>ProcessType</key><string>Standard</string><key>StandardOutPath</key><string>${xml(log)}</string><key>StandardErrorPath</key><string>${xml(log)}</string></dict></plist>\n`;
573
609
  }
574
610
 
575
611
  /**
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.189";
7
+ export const VERSION = "0.6.191";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/flags.js CHANGED
@@ -59,7 +59,7 @@ export const COMMAND_FLAGS = {
59
59
  "lane closeout": ["reason"],
60
60
  "lane repo": ["repo", "branch", "worktree", "read-only", "reason"],
61
61
  // MW1-12.6: ask (--blocker, --repo, --reason), grant (--note, --source, --worktree), refuse (--note), list (--machine, --state, --lane, --cursor, --limit).
62
- "lane leeway": ["blocker", "repo", "reason", "note", "source", "worktree", "machine", "state", "lane", "cursor", "limit"],
62
+ "lane leeway": ["blocker", "repo", "parent", "reason", "note", "source", "worktree", "machine", "state", "lane", "cursor", "limit"],
63
63
  // hub-232: the honest close-out and the governor.
64
64
  "lane close": ["delivered-by", "reason", "sweeper", "no-closeout"],
65
65
  "governor show": ["machine-id"],
package/dist/lanes.js CHANGED
@@ -3,7 +3,7 @@ import { execFile } from "node:child_process";
3
3
  import { readFile, realpath, writeFile } from "node:fs/promises";
4
4
  import { isAbsolute, join } from "node:path";
5
5
  import { promisify } from "node:util";
6
- import { coordinatorMachineId, listAccounts, liveExhaustedAccounts, pickHeadroomAccount, profilePath, reportUsage } from "./accounts.js";
6
+ import { accountExcluded, coordinatorMachineId, listAccounts, liveExhaustedAccounts, pickHeadroomAccount, profilePath, reportUsage } from "./accounts.js";
7
7
  import { CliError, encode, devRequest, query, readConfig, requireFlag, LANE_CAP_RAISE_PROMPT } from "./core.js";
8
8
  import { launchRecovery, recoveryStateRoot } from "./runtime-launcher.js";
9
9
  import { defaultReaders, fingerprintStore, resumeGate } from "./resume-gate.js";
@@ -1121,6 +1121,9 @@ export async function laneCommand(action, args, flags, deps = {}) {
1121
1121
  const exhausted = await exhaustedAccounts().catch(() => ({}));
1122
1122
  const refusal = (profile, entry, why) => new CliError("ACCOUNT_EXHAUSTED", `${ref}: ${profile} is recorded exhausted (${entry.kind}) until ${entry.until}${why}. Resume it after that, or move it with lane resume ${ref} --profile PATH --class long|short|no-build to another account.`, 1);
1123
1123
  if (named && exhausted[named.profile]) throw refusal(named.profile, exhausted[named.profile], "");
1124
+ // hub-242: an account the operator ruled out is never used, even when named.
1125
+ if (named && await (deps.accountExcluded ?? accountExcluded)(named.profile))
1126
+ throw new CliError("ACCOUNT_EXCLUDED", `${ref}: ${named.profile} is excluded from lanes (coordinator settings.json excludedProfiles, the operator's ruling). Name another account with --profile PATH.`, 1);
1124
1127
  let target = named;
1125
1128
  let picked = null;
1126
1129
  if (!named && Object.keys(exhausted).length) {
package/dist/leeway.js CHANGED
@@ -13,7 +13,7 @@ import { createWorktrees, writeLaneMarkers } from "./starting.js";
13
13
  * grants or refuses, and a grant reaches the lane as an amendment it
14
14
  * acknowledges with a Delta gather before it starts the fix.
15
15
  *
16
- * lane leeway <key> --blocker ISSUE [--repo NAME] --reason TEXT
16
+ * lane leeway <key> --blocker ISSUE [--repo NAME] [--parent LEEWAY_ID] --reason TEXT
17
17
  * lane leeway grant <id> [--note TEXT] [--source PATH] [--worktree PATH]
18
18
  * lane leeway refuse <id> [--note TEXT]
19
19
  * lane leeway withdraw <id>
@@ -23,10 +23,10 @@ import { createWorktrees, writeLaneMarkers } from "./starting.js";
23
23
 
24
24
  const execFile = promisify(execFileCallback);
25
25
  const via = { via: "nodii-dev" };
26
- const USAGE = "lane leeway <key> --blocker ISSUE [--repo NAME] --reason TEXT | lane leeway grant <id> [--note TEXT] [--source PATH] [--worktree PATH] | lane leeway refuse <id> [--note TEXT] | lane leeway withdraw <id> | lane leeway list [--machine M] [--state S] [--lane KEY] [--cursor C] [--limit N] | lane leeway show <id>";
26
+ const USAGE = "lane leeway <key> --blocker ISSUE [--repo NAME] [--parent LEEWAY_ID] --reason TEXT | lane leeway grant <id> [--note TEXT] [--source PATH] [--worktree PATH] | lane leeway refuse <id> [--note TEXT] | lane leeway withdraw <id> | lane leeway list [--machine M] [--state S] [--lane KEY] [--cursor C] [--limit N] | lane leeway show <id>";
27
27
  const SUBCOMMANDS = ["grant", "refuse", "withdraw", "list", "show"];
28
28
  const FLAGS = {
29
- ask: ["blocker", "repo", "reason"],
29
+ ask: ["blocker", "repo", "reason", "parent"],
30
30
  grant: ["note", "source", "worktree"],
31
31
  refuse: ["note"],
32
32
  withdraw: [],
@@ -77,9 +77,13 @@ async function ask(key, flags, { request }) {
77
77
  const blocker = String(requireFlag(flags, "blocker"));
78
78
  const reason = String(requireFlag(flags, "reason"));
79
79
  const repo = flags.repo === undefined ? undefined : String(requireFlag(flags, "repo"));
80
+ // hub-600 (MW1-12.8): only a leeway that names its parent is a chain link.
81
+ const parent = flags.parent === undefined ? undefined : String(flags.parent).trim();
82
+ if (parent !== undefined && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(parent))
83
+ throw new CliError("USAGE", "--parent takes the id of the granted leeway whose own work this blocker stops (lane leeway list --lane KEY).", 2);
80
84
  let payload;
81
85
  try {
82
- payload = await request("POST", `/api/v1/lanes/${encode(key)}/leeway`, { blocker, ...(repo ? { repo } : {}), reason, ...via });
86
+ payload = await request("POST", `/api/v1/lanes/${encode(key)}/leeway`, { blocker, ...(repo ? { repo } : {}), reason, ...(parent ? { parent } : {}), ...via });
83
87
  } catch (error) {
84
88
  // Every other refusal is Dev's own text. This one also says who holds the issue and what the lane does next.
85
89
  if (error?.code !== "LEEWAY_BLOCKER_HELD") throw error;
package/dist/watchdog.js CHANGED
@@ -419,7 +419,7 @@ export function watchdogPath(envPath = process.env.PATH, runtime = process.execP
419
419
 
420
420
  export function launchdPlist({ runtime, entry, config, interval, stdoutPath, stderrPath, path = watchdogPath(undefined, runtime) }) {
421
421
  const args = [runtime, entry, "watchdog", "sweep", "--json"].map((value) => `<string>${xml(value)}</string>`).join("");
422
- return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>${WATCHDOG_LABEL}</string><key>ProgramArguments</key><array>${args}</array><key>EnvironmentVariables</key><dict><key>NODII_DEV_CONFIG_PATH</key><string>${xml(config)}</string><key>PATH</key><string>${xml(path)}</string></dict><key>RunAtLoad</key><true/><key>StartInterval</key><integer>${interval}</integer><key>ProcessType</key><string>Background</string><key>StandardOutPath</key><string>${xml(stdoutPath)}</string><key>StandardErrorPath</key><string>${xml(stderrPath)}</string></dict></plist>\n`;
422
+ return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict><key>Label</key><string>${WATCHDOG_LABEL}</string><key>ProgramArguments</key><array>${args}</array><key>EnvironmentVariables</key><dict><key>NODII_DEV_CONFIG_PATH</key><string>${xml(config)}</string><key>PATH</key><string>${xml(path)}</string></dict><key>RunAtLoad</key><true/><key>StartInterval</key><integer>${interval}</integer><key>ProcessType</key><string>Standard</string><key>StandardOutPath</key><string>${xml(stdoutPath)}</string><key>StandardErrorPath</key><string>${xml(stderrPath)}</string></dict></plist>\n`;
423
423
  }
424
424
 
425
425
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.189",
3
+ "version": "0.6.191",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {