@nodii/dev 0.6.220 → 0.6.222

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
@@ -166,10 +166,10 @@ nodii-dev heavy run --size light -- bun test tests/unit/money.test.ts
166
166
  nodii-dev heavy run -- git push -u origin HEAD
167
167
  nodii-dev heavy run --tighten memory=40 -- true # refused (exit 75) unless 40 GB is available
168
168
  nodii-dev heavy status
169
- nodii-dev heavy run --help # prints the usage; takes no slot and runs nothing
169
+ nodii-dev heavy run --help # prints what it does, then the usage; takes no slot and runs nothing
170
170
  ```
171
171
 
172
- - **The machine's floor (DEV-PROCESS-2).** Every job reads the floor before it queues and again when a slot is free (`src/machine-floor.js`). Available memory, after what running jobs hold back for their peaks, must be at least 10 GB (5 GB for a light job); swap used at most 24 GB; disk free at least 15 GB. A running job holds back its class's peak (7 GB heavy, 1 GB light) less what its process tree uses now. Under the floor a job exits 75 at once with `MACHINE_UNDER_FLOOR`, naming the reading, the figure and the five largest holders of memory. It is never queued and never let through: there is no exception for a lone job, a landing or a push (hub-490). The readings use the system tools' absolute paths (`/usr/bin/vm_stat`, `/usr/sbin/sysctl vm.swapusage`, `/bin/df -Pk /`), on the install's own node.
172
+ - **The machine's floor (DEV-PROCESS-2).** Every job reads the floor before it queues and again when a slot is free (`src/machine-floor.js`). Available memory, after what running jobs hold back for their peaks, must be at least 10 GB (5 GB for a light job); swap used at most 24 GB; disk free at least 15 GB. A running job holds back its class's peak (7 GB heavy, 1 GB light) less what its process tree uses now. Under the floor a job exits 75 at once with `MACHINE_UNDER_FLOOR`, naming the reading, the figure and the five largest holders of memory. It is never queued and never let through: there is no exception for a lone job, a landing or a push (hub-490). A job that queued for a slot and is then refused when one frees leaves no queue ticket behind. The readings use the system tools' absolute paths (`/usr/bin/vm_stat`, `/usr/sbin/sysctl vm.swapusage`, `/bin/df -Pk /`), on the install's own node.
173
173
  - **The floor file.** The floor, the class peaks, the ceilings (3 heavy slots, one of them only for a push forced heavy; 8 light slots) and the 10 s stagger live in `/etc/nodii/floor.env`. It counts only when root owns it and `/etc/nodii`, neither is group- or world-writable, and the lanes' user cannot write it; else the shipped defaults hold, and `heavy status` says why. Only the machine owner installs or changes it, with their password (`sudo install -d -o root -g wheel -m 755 /etc/nodii && sudo install -o root -g wheel -m 644 floor.env /etc/nodii/floor.env`). No variable moves it or the slot directory: `NODII_RESOURCE_LIMITS`, `HEAVY_SLOT_DIR`, `NODII_HEAVY_SLOT`, `NODII_HEAVY_SLOT_HELD` and `HEAVY_LANDING` are gone. `~/.config/nodii-resources/limits.env` keeps only the coordinator's `LANE_CAP`, `STACK_CAP`, `LIGHT_LANE_CAP` and `DEV_SERVER_CAP`.
174
174
  - `--tighten memory=GB|swap=GB|disk=GB` (repeatable, or a comma list) makes one call stricter than the floor; a figure that would loosen it exits 2 (`USAGE`). `lane launch` and `lane resume` take it too.
175
175
  - **Heavy is end-to-end; light is a short list (MW2-51).** A heavy slot is for end-to-end, real-stack and browser-flow work: Playwright, Cypress and other browser drivers, an `e2e`, `integration`, real-stack or stack script, an image build and a detached stack start. A light slot (under the light floor, 5 GB, with no stagger) is for a typecheck or lint on the diff's files only (`tsc`, `tsgo`, `vue-tsc`, `eslint`, `biome` or `oxlint` naming the files it checks, or a package manager's `typecheck`, `lint` or `tsc` script scoped by its name: `:affected`, `:changed`, `:touched`, `:diff`, `:staged`; a whole-repository typecheck or lint counts heavy), a unit-test run naming at most 20 test files (`bun test`, `vitest`, `jest`, `mocha`, `node --test`; no globs, no compound commands) and `git push`. Anything else counts heavy (`sleep`, `true`, a whole suite, an install), and a command declared light with `--size light` that is none of those counts heavy and says so. `--size heavy` makes any job heavy. Light locks live in `/tmp/nodii-heavy-slots/light`.
@@ -186,7 +186,7 @@ nodii-dev heavy run --help # prints the usage; takes no s
186
186
 
187
187
  It then stops its own job's process tree and logs the reclaim (slot, lane, time held and why) to `/tmp/nodii-heavy-slots/reclaim.log`. `heavy status` shows each slot's lane, marks a reclaim candidate and lists the last reclaims. No session ever signals another session's processes (MW2-49): a waiter only waits. A slot taken outside a lane, or held by a pre-v26 copy, is never reclaimed this way; a check that can't tell (Dev unreachable, no `lsof`) keeps the slot.
188
188
  - It can't be skipped. In a lane, the safety hook (`hook safety-pre`) refuses an unqueued heavy command (`SAFETY_HEAVY_UNQUEUED`) and prints the same command with `nodii-dev heavy run --` in front of each heavy part. Only the installed queue queues: a file named `heavy-slot.sh`, run directly or by a shell, is no queue, so its job is judged as if run bare. design-system's surface-gen check (`node infra/code-connect/surface-gen.mjs check`) is heavy.
189
- - Every-page checks run in CI only (DEV-PROCESS-2, hub-650). In a lane, the hook refuses with `SAFETY_CI_ONLY`, naming the pull-request check that covers it: `nodii-dev surface generate --all --check` (also through `npx @nodii/dev`, `pnpm dlx` or an env prefix) and any surface-gen check run with `CI=` set, bare or queued, are covered by "Generated pages match their Surfaces" (job `surface-gen-equal`); `pnpm verify:frame-conformance` and `pnpm verify:frame-conformance:gate`, with or without `--touched`, bare or queued, by "Frame conformance for touched pages" (job `frame-conformance`). `surface generate --all --write` and `nodii-dev heavy run -- node infra/code-connect/surface-gen.mjs check` (no `CI=`) stay allowed.
189
+ - Every-page checks run in CI only (DEV-PROCESS-2, hub-650). In a lane, the hook refuses with `SAFETY_CI_ONLY`. The refusal opens with "`<check>` runs over every page and runs in CI only; locally run it on the touched pages (`--touched`). Covered by the pull request's `<job>` check (MW1-107)." and names the pull-request check that covers it: `nodii-dev surface generate --all --check` (also through `npx @nodii/dev`, `pnpm dlx` or an env prefix) and any surface-gen check run with `CI=` set, bare or queued, are covered by "Generated pages match their Surfaces" (job `surface-gen-equal`); `pnpm verify:frame-conformance` and `pnpm verify:frame-conformance:gate`, with or without `--touched`, bare or queued, by "Frame conformance for touched pages" (job `frame-conformance`). `surface generate --all --write` and `nodii-dev heavy run -- node infra/code-connect/surface-gen.mjs check` (no `CI=`) stay allowed.
190
190
  - `lane check --gate` and `receipt write --run` queue every gate themselves, `lane check` runs each reviewer under a slot (its timeout starts once the slot is granted), and `lane closeout` pushes through the landing reserve.
191
191
  - `[TOOL GAP hub-86]` MW5-19 places this helper as the `heavy-slot` util. It ships here until the util pipeline exists.
192
192
 
@@ -820,7 +820,13 @@ nodii-dev lane done-check KEY --evidence TEXT|URL
820
820
  # run that exits after it ends finished, not orphaned; on a
821
821
  # lane already on_dev (land → verify first) it is a no-op
822
822
  # refused with FIGMA_AFTER_IMAGES_MISSING while an open change
823
- # set the lane holds has a changed node with no after image
823
+ # set the lane holds has a changed node with no after image.
824
+ # O21 (DEV-PROCESS-12): both this and lane finish fetch origin in
825
+ # each repository the lane changes, run the landed check, and send
826
+ # Dev that machine report; Dev compares its refs with GitHub's and
827
+ # refuses LANE_BRANCH_NOT_LANDED (proposed) while a commit's change
828
+ # is not on main (patches, so a squash counts) or anything is
829
+ # uncommitted, untracked or stashed, one line per commit or path
824
830
  nodii-dev lane finish KEY --reason TEXT --evidence TEXT|URL
825
831
  # the lane's own agent marks the lane finished (MW1-28.2):
826
832
  # why, and what it delivered and where its branch and
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/pr
4
4
  import { homedir, platform } from "node:os";
5
5
  import { basename, dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.220";
7
+ export const VERSION = "0.6.222";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
@@ -209,6 +209,8 @@ while [ $# -gt 0 ]; do
209
209
  --tighten=*) TIGHTEN="${TIGHTEN:+$TIGHTEN,}${1#--tighten=}"; shift;;
210
210
  # The drill's red run (o2-red-run.confirm.md): `heavy run --help` once took a slot and ran `--help` as a command.
211
211
  -h|--help) cat <<'USAGE'
212
+ Runs a command in a heavy slot (end-to-end only) or a light slot (typecheck, lint, unit tests, push), or refuses it at once below the machine floor (MW2-51).
213
+
212
214
  usage: nodii-dev heavy run [--size light|heavy] [--tighten READING=GB] -- <command...>
213
215
  nodii-dev heavy status
214
216
 
@@ -431,7 +433,9 @@ local frc=0; floor_gate || frc=$?; [ "$frc" -eq 0 ] || return "$frc"
431
433
  # (limit - held) live tickets may try for a slot. Landings keep their reserve and skip the line.
432
434
  local Q="$D/q" TICKET=""; [ "$SIZE" = light ] && Q="$D/lq"; mkdir -p "$Q" 2>/dev/null
433
435
  if [ "$IS_LANDING" != 1 ]; then TICKET="$Q/$(date +%s).$(printf '%06d' $$)"; echo $$ > "$TICKET"; fi
434
- trap '[ -n "$TICKET" ] && rm -f "$TICKET"' EXIT
436
+ # The trap names the ticket's path, not $TICKET: TICKET is local to main, so when a refusal returns from main the EXIT
437
+ # trap ran with it unset ("TICKET: unbound variable" under set -u, O2 green run 28 Nov) and the ticket stayed queued.
438
+ if [ -n "$TICKET" ]; then trap "rm -f '$TICKET'" EXIT; fi
435
439
  # v25 (13 Nov, hub-377): a STOPPED waiter (ps state T: ^Z, SIGSTOP, a suspended session) never polls, so it can never
436
440
  # take a slot, yet it kept its rank: eight stopped head tickets held 46 live waiters for an hour with 1/6 slots held
437
441
  # (05:30Z, reported by rbac-edge-strip). A stopped waiter keeps its ticket, so it gets its place back when it resumes,
@@ -487,7 +491,7 @@ while :; do
487
491
  # v30: this read is the one that admits the job, so it is the one logged (--admit), once, admission or
488
492
  # refusal, without the job's own slot (--self) and before the job starts.
489
493
  frc=0; floor_gate --self "$l" --admit || frc=$?
490
- if [ "$frc" -ne 0 ]; then rmdir "$D/.admit"; rm -rf "$l"; return "$frc"; fi
494
+ if [ "$frc" -ne 0 ]; then rmdir "$D/.admit"; rm -rf "$l"; [ -n "$TICKET" ] && rm -f "$TICKET"; TICKET=""; return "$frc"; fi
491
495
  date +%s > "$SD/last-admit"; rmdir "$D/.admit"; slot="$l"; [ -n "$TICKET" ] && rm -f "$TICKET"; TICKET=""; break 2
492
496
  fi
493
497
  rmdir "$D/.admit"
package/dist/heavy.js CHANGED
@@ -474,8 +474,9 @@ export function ciOnlyViolation(command) {
474
474
  return {
475
475
  code: "SAFETY_CI_ONLY",
476
476
  message: [
477
- `Every-page checks run in CI only (DEV-PROCESS-2; hub-650). Not run here: \`${found.text}\`.`,
478
- `The pull-request check "${covering.check}" (design-system CI, job ${covering.job}) covers it.`,
477
+ // The first line is the frozen text in DEV-PROCESS-2's o2-clause-texts.md ("Help and hook text"); done check step 7.
478
+ `\`${found.text}\` runs over every page and runs in CI only; locally run it on the touched pages (\`--touched\`). Covered by the pull request's ${covering.job} check (MW1-107).`,
479
+ `Not run here. That check is "${covering.check}" (design-system CI, job ${covering.job}). DEV-PROCESS-2, hub-650.`,
479
480
  covering.local,
480
481
  ].join("\n"),
481
482
  };
@@ -0,0 +1,487 @@
1
+ // DEV-PROCESS-12 / O21: a lane is done only when every commit's change on its branch is on main and its
2
+ // tree is clean. This is the Node port of the frozen drill oracle (evidence/o21/oracle.sh, which is never
3
+ // shipped here): same semantics, same line format, for ONE repo. A lane over several repos combines the
4
+ // per-repo answers with combineLandedChecks().
5
+ //
6
+ // The check never fetches: it judges the refs already present (refs/remotes/origin/main, the local branch
7
+ // and origin/<branch>). The caller fetches first with its own credentials. Git runs isolated from the
8
+ // caller's global and system config (only the caller's core.excludesFile is carried over), and never once
9
+ // per commit: patch-ids, file writes and trees come from a few batched streams.
10
+ //
11
+ // Output lines (as the oracle prints them):
12
+ // VERDICT LANDED|NOT-LANDED|ERROR
13
+ // REASON commit <sha> <subject>
14
+ // FILE +<add> -<del> <path>
15
+ // REASON stash <stash@{n}> <sha>
16
+ // REASON uncommitted <path>
17
+ // REASON untracked <path>
18
+ // REASON worktree on <other> not <branch>
19
+ // REASON branch not found
20
+ // REASON error <what>
21
+ // LANDED-BY content on main (merge-tree)
22
+ // INFO <text>
23
+ import { spawn } from "node:child_process";
24
+ import { stat } from "node:fs/promises";
25
+ import { basename } from "node:path";
26
+
27
+ const MAIN = "refs/remotes/origin/main";
28
+
29
+ class CheckError extends Error {}
30
+ const die = (what) => {
31
+ throw new CheckError(what);
32
+ };
33
+
34
+ async function isDir(path) {
35
+ try {
36
+ return (await stat(path)).isDirectory();
37
+ } catch {
38
+ return false;
39
+ }
40
+ }
41
+ async function isFile(path) {
42
+ try {
43
+ return (await stat(path)).isFile();
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+ async function exists(path) {
49
+ try {
50
+ await stat(path);
51
+ return true;
52
+ } catch {
53
+ return false;
54
+ }
55
+ }
56
+
57
+ /** Run one command; resolves { code, stdout } (never rejects on exit code; rejects on spawn failure). */
58
+ function run(cmd, args, { env, input, signal } = {}) {
59
+ return new Promise((resolve, reject) => {
60
+ const child = spawn(cmd, args, { env, stdio: ["pipe", "pipe", "ignore"], signal });
61
+ const out = [];
62
+ child.stdout.on("data", (d) => out.push(d));
63
+ child.on("error", reject);
64
+ child.on("close", (code, sig) => resolve({ code: code ?? (sig ? 128 : 1), stdout: Buffer.concat(out).toString("utf8") }));
65
+ child.stdin.on("error", () => {});
66
+ child.stdin.end(input ?? "");
67
+ });
68
+ }
69
+
70
+ /** Run `a | b` with pipefail semantics; resolves { code, stdout } of b, code = first non-zero. */
71
+ function runPipe(cmdA, argsA, cmdB, argsB, { env, signal } = {}) {
72
+ return new Promise((resolve, reject) => {
73
+ const a = spawn(cmdA, argsA, { env, stdio: ["ignore", "pipe", "ignore"], signal });
74
+ const b = spawn(cmdB, argsB, { env, stdio: ["pipe", "pipe", "ignore"], signal });
75
+ const out = [];
76
+ let codeA, codeB, failed = false;
77
+ const done = () => {
78
+ if (codeA === undefined || codeB === undefined) return;
79
+ resolve({ code: codeA || codeB, stdout: Buffer.concat(out).toString("utf8") });
80
+ };
81
+ const fail = (e) => {
82
+ if (failed) return;
83
+ failed = true;
84
+ try { a.kill(); } catch {}
85
+ try { b.kill(); } catch {}
86
+ reject(e);
87
+ };
88
+ a.on("error", fail);
89
+ b.on("error", fail);
90
+ b.stdin.on("error", () => {});
91
+ a.stdout.pipe(b.stdin);
92
+ b.stdout.on("data", (d) => out.push(d));
93
+ a.on("close", (code, sig) => { codeA = code ?? (sig ? 128 : 1); done(); });
94
+ b.on("close", (code, sig) => { codeB = code ?? (sig ? 128 : 1); done(); });
95
+ });
96
+ }
97
+
98
+ const lines = (s) => {
99
+ const l = s.split("\n");
100
+ if (l.length && l[l.length - 1] === "") l.pop();
101
+ return l;
102
+ };
103
+ const firstLine = (s) => s.split("\n")[0];
104
+
105
+ /** Parse raw diff output (with commit-id lines) into [commit, "mode:blob"|"DEL", path] triples. */
106
+ function rawPairs(text) {
107
+ const res = [];
108
+ let c = "";
109
+ for (const l of lines(text)) {
110
+ let m;
111
+ if (/^[0-9a-f]+$/.test(l)) { c = l; continue; }
112
+ if ((m = /^C ([0-9a-f]+)$/.exec(l))) { c = m[1]; continue; }
113
+ if (l.startsWith(":")) {
114
+ const i = l.indexOf("\t");
115
+ const f = l.slice(0, i === -1 ? l.length : i).split(/[ \t]+/).filter(Boolean);
116
+ const b = /^0+$/.test(f[3] ?? "") ? "DEL" : `${f[1]}:${f[3]}`;
117
+ res.push([c, b, i === -1 ? "" : l.slice(i + 1)]);
118
+ }
119
+ }
120
+ return res;
121
+ }
122
+
123
+ const byteSortUnique = (arr) => {
124
+ const s = [...new Set(arr)];
125
+ return s.sort((x, y) => Buffer.compare(Buffer.from(x), Buffer.from(y)));
126
+ };
127
+
128
+ /**
129
+ * Judge one repo for one lane branch.
130
+ * @param {object} o
131
+ * @param {string} o.worktree the lane's worktree path (may no longer exist)
132
+ * @param {string} o.branch the lane branch, e.g. "lane/s2"
133
+ * @param {string} [o.repo] where the refs live when the worktree is gone (default: the worktree)
134
+ * @param {object} [o.env] the caller's environment (default process.env); its core.excludesFile is honoured
135
+ * @param {AbortSignal} [o.signal] aborts the run (answers ERROR)
136
+ * @returns {Promise<{verdict: "LANDED"|"NOT-LANDED"|"ERROR", exitCode: 0|1|2, lines: string[],
137
+ * reasons: string[], landedBy: string|null, info: string[]}>}
138
+ * lines: the oracle's stdout lines exactly (VERDICT first); reasons: the REASON and FILE lines in order;
139
+ * info: the INFO lines (without "INFO ").
140
+ */
141
+ export async function landedCheck({ worktree, branch, repo, env, signal } = {}) {
142
+ let out;
143
+ try {
144
+ out = await check({ worktree, branch, repo, env: env ?? process.env, signal });
145
+ } catch (e) {
146
+ let what;
147
+ if (e instanceof CheckError) what = e.message;
148
+ else if (e?.name === "AbortError") what = "aborted (timeout?)";
149
+ else what = `unexpected: ${e?.message ?? String(e)}`;
150
+ out = ["VERDICT ERROR", `REASON error ${what}`];
151
+ }
152
+ return shape(out);
153
+ }
154
+
155
+ function shape(out) {
156
+ const verdict = out[0].slice("VERDICT ".length);
157
+ return {
158
+ verdict,
159
+ exitCode: verdict === "LANDED" ? 0 : verdict === "NOT-LANDED" ? 1 : 2,
160
+ lines: out,
161
+ reasons: out.filter((l) => l.startsWith("REASON ") || l.startsWith(" FILE ")),
162
+ landedBy: out.find((l) => l.startsWith("LANDED-BY "))?.slice("LANDED-BY ".length) ?? null,
163
+ info: out.filter((l) => l.startsWith("INFO ")).map((l) => l.slice(5)),
164
+ };
165
+ }
166
+
167
+ /**
168
+ * Combine per-repo answers for a lane over several repos, as the O21 drill does: one repo is its own
169
+ * answer; otherwise every repo that is not LANDED adds "REASON repo <name>" and its lines (VERDICT
170
+ * dropped). The verdict is ERROR if any repo errored (the drill would read it as NOT-LANDED), else
171
+ * NOT-LANDED if any repo is, else LANDED.
172
+ * @param {{repo: string, result: Awaited<ReturnType<typeof landedCheck>>}[]} parts
173
+ */
174
+ export function combineLandedChecks(parts) {
175
+ if (parts.length === 1) return parts[0].result;
176
+ const body = [];
177
+ let anyErr = false, anyNot = false;
178
+ for (const { repo, result } of parts) {
179
+ if (result.exitCode === 0) continue;
180
+ if (result.verdict === "ERROR") anyErr = true;
181
+ else anyNot = true;
182
+ body.push(`REASON repo ${basename(repo)}`, ...result.lines.filter((l) => !l.startsWith("VERDICT ")));
183
+ }
184
+ return shape([`VERDICT ${anyErr ? "ERROR" : anyNot ? "NOT-LANDED" : "LANDED"}`, ...body]);
185
+ }
186
+
187
+ async function check({ worktree, branch, repo, env: callerEnv, signal }) {
188
+ if (typeof worktree !== "string" || !worktree || typeof branch !== "string" || !branch || (repo != null && typeof repo !== "string")) {
189
+ die("usage: landedCheck({ worktree, branch[, repo] })");
190
+ }
191
+ const WT = worktree, BRANCH = branch, REPO = repo || worktree;
192
+ let CLONE, WT_PRESENT;
193
+ if (await isDir(WT)) { CLONE = WT; WT_PRESENT = true; }
194
+ else if (await isDir(REPO)) { CLONE = REPO; WT_PRESENT = false; }
195
+ else die(`neither worktree ${WT} nor repo ${REPO} exists`);
196
+
197
+ const baseEnv = { ...callerEnv };
198
+ delete baseEnv.GIT_DIR; delete baseEnv.GIT_WORK_TREE; delete baseEnv.GIT_INDEX_FILE;
199
+
200
+ let ver;
201
+ try {
202
+ ver = (await run("git", ["version"], { env: baseEnv, signal })).stdout.split(/\s+/)[2] ?? "";
203
+ } catch (e) {
204
+ if (e?.name === "AbortError") throw e;
205
+ die(`cannot run git: ${e?.message ?? e}`);
206
+ }
207
+ const [maj, min] = ver.split(".").map((n) => parseInt(n, 10));
208
+ if (!(maj > 2 || (maj === 2 && min >= 43))) die(`git ${ver} is older than 2.43 (merge-tree --merge-base, show-ref --exists)`);
209
+
210
+ const bareDir = !(await exists(`${CLONE}/.git`)) && (await isFile(`${CLONE}/HEAD`)) && (await isDir(`${CLONE}/objects`));
211
+ const GLOC = bareDir ? [`--git-dir=${CLONE}`] : ["-C", CLONE];
212
+
213
+ // The caller's core.excludesFile, before isolating from the global config.
214
+ const XF = lines((await run("git", [...GLOC, "config", "--type=path", "--get", "core.excludesFile"], { env: baseEnv, signal })).stdout)[0] ?? "";
215
+
216
+ const env = { ...baseEnv, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: "/dev/null", GIT_TERMINAL_PROMPT: "0", LC_ALL: "C" };
217
+ const G = [...GLOC, "-c", "core.hooksPath=/dev/null", "-c", "diff.noprefix=false", "-c", "core.quotePath=false"];
218
+ const g = (args, input) => run("git", [...G, ...args], { env, input, signal });
219
+ /** g that must succeed; returns stdout. */
220
+ const gok = async (args, what, input) => {
221
+ const r = await g(args, input);
222
+ if (r.code !== 0) die(`${what ?? `git ${args[0]}`} failed (exit ${r.code})`);
223
+ return r.stdout;
224
+ };
225
+ const DIFFOPTS = ["--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", "--full-index", "--binary"];
226
+ const pidStream = async (revs) => { // [[commit, patch-id]] per non-merge commit with a non-empty diff
227
+ const r = await runPipe("git", [...G, "log", "--no-merges", "-p", ...DIFFOPTS, "--format=commit %H", ...revs],
228
+ "git", [...GLOC, "patch-id", "--verbatim"], { env, signal });
229
+ if (r.code !== 0) die(`patch-id stream for ${revs.join(" ")} failed (exit ${r.code})`);
230
+ return lines(r.stdout).map((l) => { const [p, c] = l.split(" "); return [c, p]; });
231
+ };
232
+
233
+ if ((await g(["rev-parse", "--git-dir"])).code !== 0) die(`not a git repository: ${CLONE}`);
234
+ if ((await g(["rev-parse", "--verify", "--quiet", `${MAIN}^{commit}`])).code !== 0) die(`no origin/main in ${CLONE}`);
235
+ const mainTree = firstLine(await gok(["rev-parse", `${MAIN}^{tree}`]));
236
+
237
+ const reasons = [], info = [], named = new Set(), landedSingle = new Set(), mergeBaseOf = new Map();
238
+ if (!WT_PRESENT) info.push("INFO worktree missing");
239
+ const refs = [];
240
+ for (const r of [`refs/heads/${BRANCH}`, `refs/remotes/origin/${BRANCH}`]) {
241
+ const rc = (await g(["show-ref", "--exists", r])).code;
242
+ if (rc === 2) continue;
243
+ if (rc !== 0) die(`cannot check whether ${r} exists (git show-ref exit ${rc})`);
244
+ if ((await g(["rev-parse", "--verify", "--quiet", `${r}^{commit}`])).code !== 0) die(`cannot read ${r} (ref exists, its commit does not)`);
245
+ if ((await g(["cat-file", "-e", `${r}^{tree}`])).code !== 0) die(`cannot read the tree of ${r}`);
246
+ refs.push(r);
247
+ }
248
+ if (refs.length === 0) return ["VERDICT NOT-LANDED", "REASON branch not found", ...info];
249
+ if (refs.length === 1) info.push(`INFO only ${refs[0]} exists`);
250
+ else if (firstLine(await gok(["rev-parse", refs[0]])) !== firstLine(await gok(["rev-parse", refs[1]]))) {
251
+ info.push(`INFO local and origin ${BRANCH} differ; checking both`);
252
+ }
253
+
254
+ let landedByTree = false;
255
+ for (const ref of refs) {
256
+ const first = lines(await gok(["rev-list", "--first-parent", "--reverse", ref, "--not", MAIN], "git rev-list"))[0];
257
+ if (!first) continue; // every commit of the ref is reachable from main
258
+ const forkR = await g(["rev-parse", "--verify", "--quiet", `${first}^`]);
259
+ const fork = forkR.code === 0 ? firstLine(forkR.stdout) : "";
260
+ if (!fork) die(`${ref} has no fork point with main (its history shares no commit with origin/main)`);
261
+
262
+ const [mainPidList, mainPairsText, brPidList, walkText, treesText, forkTreeText, forkTreeId] = await Promise.all([
263
+ pidStream([MAIN, "--not", fork]),
264
+ gok(["log", "--no-merges", "--raw", "--no-abbrev", "--no-renames", "--format=C %H", MAIN, "--not", fork], "git log --raw"),
265
+ pidStream([ref, "--not", MAIN]),
266
+ gok(["rev-list", "--reverse", "--topo-order", "--parents", ref, "--not", MAIN], "git rev-list"),
267
+ gok(["log", "--format=%H %T", ref, "--not", MAIN], "git log"),
268
+ gok(["ls-tree", "-r", "--full-tree", fork], "git ls-tree"),
269
+ gok(["rev-parse", `${fork}^{tree}`]),
270
+ ]);
271
+ const mp = new Set(mainPidList.map(([, p]) => p));
272
+ const pid = new Map(brPidList);
273
+ const walk = lines(walkText).map((l) => l.split(" ").filter(Boolean));
274
+ const tr = new Map(lines(treesText).map((l) => l.split(" ")));
275
+ const stepInput = walk.map((w, i) => `${w[0]} ${i === 0 ? fork : walk[i - 1][0]}\n`).join("");
276
+ const stepsText = await gok(["diff-tree", "--stdin", "-r", "--raw", "--no-renames", "--no-abbrev"], "git diff-tree", stepInput);
277
+ const steps = new Map();
278
+ for (const [c, b, p] of rawPairs(stepsText)) {
279
+ if (!steps.has(c)) steps.set(c, []);
280
+ steps.get(c).push([p, b]);
281
+ }
282
+ const fk = new Map();
283
+ for (const l of lines(forkTreeText)) {
284
+ const i = l.indexOf("\t");
285
+ const f = l.slice(0, i).split(" ");
286
+ fk.set(l.slice(i + 1), `${f[0]}:${f[2]}`);
287
+ }
288
+ // Merges: clean (tree equals the automatic merge of its two parents) or with their own change.
289
+ const mg = new Map(), mfrom = new Map();
290
+ for (const [c, ...ps] of walk) {
291
+ if (ps.length < 2) continue;
292
+ if (ps.length === 2) {
293
+ const r = await g(["merge-tree", "--write-tree", ps[0], ps[1]]);
294
+ if (r.code > 1) die(`git merge-tree failed (exit ${r.code}) on merge ${c}`);
295
+ const auto = firstLine(r.stdout);
296
+ if (r.code === 0 && auto === tr.get(c)) { mg.set(c, "clean"); mfrom.set(c, "-"); }
297
+ else if (r.code === 0) { mg.set(c, "own"); mfrom.set(c, auto); }
298
+ else { mg.set(c, "own"); mfrom.set(c, ps[0]); }
299
+ } else { mg.set(c, "own"); mfrom.set(c, ps[0]); }
300
+ }
301
+ // What each main commit writes since the fork (first write of a path per commit wins).
302
+ const want = new Map(), need = new Map(), wl = new Map(), dsat = new Map(), full = new Map();
303
+ for (const [m, b, p] of rawPairs(mainPairsText)) {
304
+ if (!want.has(m)) want.set(m, new Map());
305
+ const wm = want.get(m);
306
+ if (wm.has(p)) continue;
307
+ wm.set(p, b);
308
+ need.set(m, (need.get(m) ?? 0) + 1);
309
+ if (!wl.has(p)) wl.set(p, []);
310
+ wl.get(p).push(m);
311
+ }
312
+ for (const m of need.keys()) dsat.set(m, 0);
313
+
314
+ // The walk (oldest first), keeping the branch's exact file state against the last landed point.
315
+ const cur = new Map(), bst = new Map();
316
+ let chg = new Set();
317
+ let base = fork, btree = firstLine(forkTreeId), pend = [], ndiff = 0;
318
+ const fst = (p) => fk.get(p) ?? "DEL";
319
+ const curv = (p) => (cur.has(p) ? cur.get(p) : fst(p));
320
+ const bv = (p) => (bst.has(p) ? bst.get(p) : fst(p));
321
+ const setd = (m, d) => {
322
+ const n = need.get(m);
323
+ if (dsat.get(m) === n) full.set(n, (full.get(n) ?? 0) - 1);
324
+ dsat.set(m, dsat.get(m) + d);
325
+ if (dsat.get(m) === n) full.set(n, (full.get(n) ?? 0) + 1);
326
+ };
327
+ const write = (p, b) => {
328
+ const old = curv(p);
329
+ if (old === b) return;
330
+ const bs = bv(p);
331
+ for (const m of wl.get(p) ?? []) {
332
+ const w = want.get(m).get(p);
333
+ const oc = old === w && old !== bs ? 1 : 0, nc = b === w && b !== bs ? 1 : 0;
334
+ if (oc !== nc) setd(m, nc - oc);
335
+ }
336
+ if (old !== bs && b === bs) ndiff--;
337
+ else if (old === bs && b !== bs) ndiff++;
338
+ chg.add(p);
339
+ cur.set(p, b);
340
+ };
341
+ const movebase = (c) => {
342
+ for (const p of chg) {
343
+ const cv = curv(p), bs = bv(p);
344
+ for (const m of wl.get(p) ?? []) if (cv === want.get(m).get(p) && cv !== bs) setd(m, -1);
345
+ bst.set(p, cv);
346
+ }
347
+ chg = new Set(); ndiff = 0; base = c; btree = tr.get(c);
348
+ };
349
+ const rangepid = async (a, b) => {
350
+ const r = await runPipe("git", [...G, "diff", ...DIFFOPTS, a, b], "git", [...GLOC, "patch-id", "--verbatim"], { env, signal });
351
+ if (r.code !== 0) die(`walk failed for ${ref}: ERROR range diff ${a}..${b} failed`);
352
+ return (lines(r.stdout)[0] ?? "").split(" ")[0];
353
+ };
354
+ for (const [c, ...ps] of walk) {
355
+ const p1 = ps[0] ?? "";
356
+ for (const [p, b] of steps.get(c) ?? []) write(p, b);
357
+ if (ps.length >= 2) {
358
+ if (mg.get(c) === "clean") {
359
+ info.push(`INFO ${c} is a clean merge on ${ref}; carries no change of its own`);
360
+ if (pend.length === 0) movebase(c);
361
+ continue;
362
+ }
363
+ if (!mergeBaseOf.has(c)) mergeBaseOf.set(c, mfrom.get(c));
364
+ info.push(`INFO ${c} is a merge with its own change on ${ref}`);
365
+ pend.push(c);
366
+ } else {
367
+ const st = !pid.has(c) ? "E" : mp.has(pid.get(c)) ? "M" : "N";
368
+ if (st !== "N") {
369
+ if (pend.length === 0) { movebase(c); continue; }
370
+ landedSingle.add(c);
371
+ }
372
+ pend.push(c);
373
+ if (pend.length === 1 && base === p1) continue;
374
+ }
375
+ if (tr.get(c) === btree) { pend = []; movebase(c); continue; }
376
+ if (ndiff > 0 && (full.get(ndiff) ?? 0) > 0) {
377
+ const r = await rangepid(base, c);
378
+ if (r !== "" && mp.has(r)) { pend = []; movebase(c); }
379
+ }
380
+ }
381
+ if (pend.length === 0) continue;
382
+
383
+ // Fallback: content check from the walk's last landed point.
384
+ const mt = await g(["merge-tree", "--write-tree", `--merge-base=${base}`, MAIN, ref]);
385
+ if (mt.code > 1) die(`git merge-tree failed (exit ${mt.code}) for ${ref} from ${base}`);
386
+ if (mt.code === 0 && firstLine(mt.stdout) === mainTree) { landedByTree = true; continue; }
387
+
388
+ // Name what is left, in walk order: non-merge commits in batches (one git log), merges one by one.
389
+ const toName = [];
390
+ for (const c of pend) if (!landedSingle.has(c) && !named.has(c) && !toName.includes(c)) toName.push(c);
391
+ for (const c of toName) named.add(c);
392
+ let batch = [];
393
+ const flush = async () => {
394
+ if (batch.length === 0) return;
395
+ const text = await gok(["log", "--no-walk=unsorted", "--stdin", "--numstat", "--no-renames", "--format=REASON commit %H %s"],
396
+ "git log --numstat", batch.map((c) => `${c}\n`).join(""));
397
+ for (const l of lines(text)) {
398
+ if (l.startsWith("REASON commit ")) { reasons.push(l); continue; }
399
+ const f = l.split("\t");
400
+ if (f.length === 3) reasons.push(` FILE +${f[0]} -${f[1]} ${f[2]}`);
401
+ }
402
+ batch = [];
403
+ };
404
+ for (const c of toName) {
405
+ const from = mergeBaseOf.get(c);
406
+ if (!from) { batch.push(c); continue; }
407
+ await flush();
408
+ const subj = (await gok(["log", "-1", "--format=%s", c], "git log -1")).replace(/\n+$/, "");
409
+ reasons.push(`REASON commit ${c} ${subj}`);
410
+ for (const l of lines(await gok(["diff", "--numstat", "--no-renames", from, c], "git diff --numstat"))) {
411
+ const i = l.indexOf("\t"), j = l.indexOf("\t", i + 1);
412
+ if (i === -1 || j === -1) continue;
413
+ reasons.push(` FILE +${l.slice(0, i)} -${l.slice(i + 1, j)} ${l.slice(j + 1)}`);
414
+ }
415
+ }
416
+ await flush();
417
+ }
418
+
419
+ // Stash: only the lane's entries (refs/stash is shared by every worktree of a repo).
420
+ const isAnc = async (a, b) => (await g(["merge-base", "--is-ancestor", a, b])).code === 0;
421
+ const stashReasons = [];
422
+ if ((await g(["rev-parse", "--verify", "--quiet", "refs/stash"])).code === 0) {
423
+ const entries = lines(await gok(["log", "-g", "--format=%H %gs", "refs/stash"], "git log -g refs/stash"));
424
+ for (let n = 0; n < entries.length; n++) {
425
+ const sref = `stash@{${n}}`;
426
+ const m = /^[ \t]*(\S*)[ \t]*(.*?)[ \t]*$/.exec(entries[n]);
427
+ const sha = m[1], subj = m[2];
428
+ let mine = subj.startsWith(`On ${BRANCH}: `) || subj === `On ${BRANCH}:` || subj.startsWith(`WIP on ${BRANCH}: `) || subj === `WIP on ${BRANCH}:`;
429
+ if (!mine) {
430
+ const sb = await g(["rev-parse", "--verify", "--quiet", `${sha}^1`]);
431
+ const sbase = sb.code === 0 ? firstLine(sb.stdout) : "";
432
+ if (sbase) {
433
+ let onLane = false;
434
+ for (const r of refs) if (await isAnc(sbase, r)) { onLane = true; break; }
435
+ if (onLane && !(await isAnc(sbase, MAIN))) mine = true;
436
+ }
437
+ }
438
+ if (mine) stashReasons.push(`REASON stash ${sref} ${sha}`);
439
+ else info.push(`INFO stash ${sref} is not this lane's (${subj})`);
440
+ }
441
+ }
442
+ reasons.push(...byteSortUnique(stashReasons));
443
+
444
+ // Worktree: uncommitted, untracked (ignored excluded) and hidden-flag files.
445
+ if (WT_PRESENT && firstLine(await gok(["rev-parse", "--is-bare-repository"])) === "true") {
446
+ info.push("INFO no work tree");
447
+ } else if (WT_PRESENT) {
448
+ const hb = await g(["symbolic-ref", "--quiet", "--short", "HEAD"]);
449
+ const headBranch = hb.code === 0 ? firstLine(hb.stdout) : "(detached)";
450
+ if (headBranch !== BRANCH) {
451
+ reasons.push(`REASON worktree on ${headBranch} not ${BRANCH}`);
452
+ } else {
453
+ const sp = await g(["config", "--bool", "--get", "core.sparseCheckout"]);
454
+ const sparse = sp.code === 0 ? firstLine(sp.stdout) : "false";
455
+ const wtReasons = [];
456
+ const xargs = XF ? ["-c", `core.excludesFile=${XF}`] : [];
457
+ const status = await gok([...xargs, "status", "--porcelain=v1", "-z", "--untracked-files=all", "--no-renames"], "git status");
458
+ for (const line of status.split(/[\0\n]/)) {
459
+ if (!line) continue;
460
+ const xy = line.slice(0, 2), path = line.slice(3);
461
+ wtReasons.push(xy === "??" ? `REASON untracked ${path}` : `REASON uncommitted ${path}`);
462
+ }
463
+ const top = firstLine(await gok(["rev-parse", "--show-toplevel"]));
464
+ const flagged = await gok(["ls-files", "-v", "-z"], "git ls-files");
465
+ for (const line of flagged.split(/[\0\n]/)) {
466
+ if (!line) continue;
467
+ const tag = line[0], path = line.slice(2);
468
+ if (!(tag === "S" || (tag >= "a" && tag <= "z"))) continue;
469
+ const hr = await g(["rev-parse", "--verify", "--quiet", `HEAD:${path}`]);
470
+ const headBlob = hr.code === 0 ? firstLine(hr.stdout) : "";
471
+ if (!(await exists(`${top}/${path}`))) {
472
+ if (tag === "S" && sparse === "true") continue;
473
+ if (headBlob) wtReasons.push(`REASON uncommitted ${path}`);
474
+ continue;
475
+ }
476
+ const wtBlob = firstLine(await gok(["hash-object", `--path=${path}`, "--", `${top}/${path}`], "git hash-object"));
477
+ if (headBlob !== wtBlob) wtReasons.push(`REASON uncommitted ${path}`);
478
+ }
479
+ reasons.push(...byteSortUnique(wtReasons));
480
+ }
481
+ }
482
+
483
+ const res = [reasons.length ? "VERDICT NOT-LANDED" : "VERDICT LANDED", ...reasons];
484
+ if (landedByTree && named.size === 0) res.push("LANDED-BY content on main (merge-tree)");
485
+ res.push(...info);
486
+ return res;
487
+ }
@@ -0,0 +1,97 @@
1
+ // DEV-PROCESS-12 / O21: the report `lane done-check` and `lane finish` send Dev. The CLI collects it
2
+ // mechanically on the lane's machine, for every repository the lane changes (its Dev record, never the
3
+ // lane's own text): it fetches origin with the machine's credentials, runs the landed check, and names
4
+ // the refs it judged so Dev can compare them with its own read of GitHub. Dev decides; this only reports.
5
+ import { execFile } from "node:child_process";
6
+ import { stat } from "node:fs/promises";
7
+ import { promisify } from "node:util";
8
+ import { VERSION } from "./core.js";
9
+ import { landedCheck } from "./landed-check.js";
10
+
11
+ const run = promisify(execFile);
12
+ const FETCH_TIMEOUT_MS = 120_000;
13
+ /** Dev's name for a lane judged on its own branch (lane_landed.ts OWN_BRANCH_REPO). */
14
+ export const OWN_BRANCH_REPO = "lane";
15
+
16
+ const isDir = async (path) => {
17
+ try {
18
+ return (await stat(path)).isDirectory();
19
+ } catch {
20
+ return false;
21
+ }
22
+ };
23
+
24
+ /**
25
+ * Where the repository's refs live when the lane's worktree is gone (S17): a lane worktree sits at
26
+ * <repo>/.claude/worktrees/<key>, so the repository is the path before that.
27
+ */
28
+ export const repoOfWorktree = (worktree) => {
29
+ const at = worktree.indexOf("/.claude/worktrees/");
30
+ return at > 0 ? worktree.slice(0, at) : worktree;
31
+ };
32
+
33
+ const git = (dir, args, env) =>
34
+ run("git", ["-C", dir, ...args], { env: { ...env, GIT_TERMINAL_PROMPT: "0" }, timeout: FETCH_TIMEOUT_MS, maxBuffer: 1 << 20 });
35
+
36
+ const refSha = async (dir, ref, env) => {
37
+ try {
38
+ const { stdout } = await git(dir, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`], env);
39
+ return stdout.trim() || null;
40
+ } catch {
41
+ return null;
42
+ }
43
+ };
44
+
45
+ /**
46
+ * One repository's report entry. A failed fetch is an ERROR: judging stale refs could land a lane
47
+ * whose pushed branch moved.
48
+ */
49
+ export async function collectRepo({ repo, branch, worktree }, { env = process.env, check = landedCheck } = {}) {
50
+ const dir = (await isDir(worktree)) ? worktree : repoOfWorktree(worktree);
51
+ const base = { repo, branch, originMain: null, originBranch: null, localBranch: null };
52
+ if (!(await isDir(dir))) return { ...base, verdict: "ERROR", lines: [`REASON error neither worktree ${worktree} nor its repository exists`] };
53
+ try {
54
+ await git(dir, ["fetch", "--quiet", "--prune", "origin"], env);
55
+ } catch (error) {
56
+ const why = String(error?.stderr || error?.message || error).trim().split("\n").pop();
57
+ return { ...base, verdict: "ERROR", lines: [`REASON error git fetch origin failed: ${why}`.slice(0, 2_000)] };
58
+ }
59
+ const result = await check({ worktree, branch, repo: dir, env });
60
+ const [originMain, originBranch, localBranch] = await Promise.all([
61
+ refSha(dir, "refs/remotes/origin/main", env),
62
+ refSha(dir, `refs/remotes/origin/${branch}`, env),
63
+ refSha(dir, `refs/heads/${branch}`, env),
64
+ ]);
65
+ return {
66
+ ...base,
67
+ verdict: result.verdict,
68
+ lines: result.lines.filter((line) => !line.startsWith("VERDICT ")).map((line) => line.slice(0, 2_000)),
69
+ originMain,
70
+ originBranch,
71
+ localBranch,
72
+ };
73
+ }
74
+
75
+ /**
76
+ * The report for a lane record from Dev (`GET /lanes/:id`): every repository but read-only ones, in
77
+ * order. Null when the lane changes no repository, so Dev has nothing to judge.
78
+ */
79
+ export async function collectLandedReport(lane, options = {}) {
80
+ // Dev fills in one entry for a lane with no repository rows (repos[0], the lane's own branch and
81
+ // worktree); a stub lane names no repository, so it goes under the name Dev expects for it. A lane
82
+ // with no branch or worktree (a steward) has nothing to judge.
83
+ const repos = (lane?.repositories ?? [])
84
+ .filter((r) => !r.readOnly && r.branch && r.worktree)
85
+ .map((r) => ({ ...r, repo: r.repo || OWN_BRANCH_REPO }));
86
+ if (!repos.length) return null;
87
+ const entries = [];
88
+ // One at a time: each fetch and check is git-heavy, and the lane waits on the slowest anyway.
89
+ for (const r of repos) entries.push(await collectRepo(r, options));
90
+ return { collector: `nodii-dev@${VERSION}`, collectedAt: new Date().toISOString(), repos: entries };
91
+ }
92
+
93
+ /** The refusal lines a human reads when the CLI already sees the lane is not landed. */
94
+ export const reportProblems = (report) =>
95
+ (report?.repos ?? [])
96
+ .filter((r) => r.verdict !== "LANDED")
97
+ .flatMap((r) => [...(report.repos.length > 1 ? [`repo ${r.repo}`] : []), ...r.lines.filter((l) => /^\s*(REASON|FILE) /.test(l)).map((l) => l.replace(/^REASON /, ""))]);
package/dist/lanes.js CHANGED
@@ -21,6 +21,7 @@ import { SWAP_BOUNDARIES, componentsForScope, guidelineLookup, laneFigmaScope, l
21
21
  import { designCheck } from "./design.js";
22
22
  import { LANE_ENV_FIX, laneConfigName, laneEnvProblem, laneEnvReport } from "./lane-env.js";
23
23
  import { closeoutLane } from "./closeout.js";
24
+ import { collectLandedReport } from "./landed-report.js";
24
25
  import { assertLaneOnThisMachine, endLane } from "./lane-pause.js";
25
26
  import { isProcessAlive, readWatchedRuns } from "./watchdog.js";
26
27
  import { GATES_RECEIPT, REVIEW_FILE, REVIEW_LAST, REVIEW_LOOP, checkLines, checkReviewChecks, citationText, diffDigest, findingId, laneDiff, privateStore, repoGeneratedPaths, reviewGates, runBody, runLaneCheck, runOutcome, treatChecks, treatable, worktreeCommitted } from "./review.js";
@@ -1047,6 +1048,11 @@ export async function laneCommand(action, args, flags, deps = {}) {
1047
1048
  // A lane whose done check already counts has nothing more to record, so it is not held.
1048
1049
  const current = (await request("GET", `/api/v1/lanes/${encode(id)}`)).data;
1049
1050
  if (!doneCheckRecorded(current)) await assertLaneAfterImages(ref, current, { request });
1051
+ // DEV-PROCESS-12 (O21): Dev refuses unless every commit's change is on main and nothing is
1052
+ // uncommitted, judged from this machine report, never from the evidence text.
1053
+ // Always: a later done check is judged afresh, so work added after the first one counts.
1054
+ const landed = await collectLandedReport(current);
1055
+ if (landed) body.landed = landed;
1050
1056
  let payload;
1051
1057
  try {
1052
1058
  payload = await request("POST", `/api/v1/lanes/${encode(id)}/evidence`, body);
@@ -1078,6 +1084,9 @@ export async function laneCommand(action, args, flags, deps = {}) {
1078
1084
  evidence: text("evidence", 8_000, "TEXT|URL: what the lane delivered and where its branch and commits went."),
1079
1085
  ...via,
1080
1086
  };
1087
+ // DEV-PROCESS-12 (O21): the same machine report as done-check; Dev refuses while work is left.
1088
+ const landed = await collectLandedReport((await request("GET", `/api/v1/lanes/${encode(id)}`)).data);
1089
+ if (landed) body.landed = landed;
1081
1090
  const payload = await request("POST", `/api/v1/lanes/${encode(id)}/finish`, body);
1082
1091
  return { payload, human: `${ref}: recorded finished. Its coordinator can close it with nodii-dev lane close ${ref} --reason TEXT.` };
1083
1092
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.220",
3
+ "version": "0.6.222",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {