pi-spine 2.19.0 → 2.21.0

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.
Files changed (31) hide show
  1. package/README.md +7 -5
  2. package/bin/spine-batch.mjs +15 -5
  3. package/bin/spine-gate.mjs +18 -3
  4. package/bin/spine-status.mjs +45 -0
  5. package/package.json +8 -8
  6. package/skills/spine-autonomous-operator/references/agent-shell-batch-policy.md +2 -0
  7. package/skills/spine-orchestrate-waves/SKILL.md +2 -0
  8. package/skills/spine-release-operator/SKILL.md +26 -10
  9. package/skills/spine-release-operator/references/issue-intake-checklist.md +46 -0
  10. package/skills/spine-release-operator/references/release-manifest-template.md +12 -0
  11. package/skills/spine-release-operator/references/release-profiles.md +6 -2
  12. package/skills/spine-release-operator/scripts/collect-release-intake.sh +44 -0
  13. package/src/batch/contract-exec.mjs +19 -18
  14. package/src/batch/engine-lanes/commit.mjs +6 -0
  15. package/src/batch/engine-lanes/matrix-run.mjs +238 -22
  16. package/src/batch/engine-lanes/matrix.mjs +33 -2
  17. package/src/batch/gate-posture-approve.mjs +16 -2
  18. package/src/batch/lane-commit.mjs +27 -12
  19. package/src/batch/readers/spine-state.mjs +4 -0
  20. package/src/batch/resume-multi-lanes.mjs +31 -0
  21. package/src/batch/resume.mjs +79 -59
  22. package/src/batch/retry-row.mjs +328 -0
  23. package/src/batch/retry.mjs +114 -44
  24. package/src/batch/state-guards.mjs +4 -5
  25. package/src/batch/state-io.mjs +2 -2
  26. package/src/batch/worker-host.mjs +3 -0
  27. package/src/batch/worker-spawn.mjs +14 -0
  28. package/src/cli/wait.mjs +163 -1
  29. package/src/metrics/quota-probes.mjs +44 -0
  30. package/src/tasks/packet/parse-prompt.mjs +17 -0
  31. package/src/tasks/packet/validate-contract.mjs +1 -0
package/README.md CHANGED
@@ -43,11 +43,13 @@ Primary monitor surfaces: **`spine status --diagnose`**, **`spine dashboard`** /
43
43
 
44
44
  ## Prerequisites
45
45
 
46
- | Dependency | Required |
47
- |------------|----------|
48
- | [Node.js](https://nodejs.org/) ≥ 22 | Yes |
49
- | [pi](https://pi.dev) coding agent | Yes |
50
- | Git (worktree support) | Yes |
46
+ | Dependency | Minimum | Required |
47
+ |------------|---------|----------|
48
+ | [Node.js](https://nodejs.org/) | ≥ 22.19.0 (`engines.node`) | Yes |
49
+ | [pi](https://pi.dev) coding agent | ≥ 0.80.0 (`pi.minPiVersion`) | Yes |
50
+ | Git (worktree support) | — | Yes |
51
+
52
+ These are the Wave A floors ([#285](https://github.com/beettlle/pi-spine/issues/285)). `spine doctor` **warns** when the installed pi is below `pi.minPiVersion` ("pi version supported"). The optional peer `@earendil-works/pi-coding-agent` is developed and tested against `^0.85.1` (pinned in `devDependencies`; the `peerDependencies` range stays `*`).
51
53
 
52
54
  ## Install
53
55
 
@@ -14,6 +14,7 @@ import { parseBatchStartWaveFilter } from "../src/planner/wave-scope.mjs";
14
14
  import { pauseBatch } from "../src/batch/pause.mjs";
15
15
  import { resumeBatch } from "../src/batch/resume.mjs";
16
16
  import { retryTask, skipTask } from "../src/batch/retry.mjs";
17
+ import { retryTaskRow, skipTaskRow, parseMatrixRowRef } from "../src/batch/retry-row.mjs";
17
18
  import { reconcileBatch } from "../src/batch/reconcile.mjs";
18
19
  import {
19
20
  finishAttachedBatchCli,
@@ -38,7 +39,8 @@ const BATCH_FLAG_VALUE_TAKERS = new Set([
38
39
  */
39
40
  export function printBatchHelp() {
40
41
  return (
41
- "Usage: spine batch start <scope>|pause|resume|retry <taskId>|skip <taskId>|force-merge [--wave N]|salvage|abort|dismiss|complete [--batch ID] [--lane N] [--integrate] [--yes] [--reason TEXT] [--hard] [--force] [--force-superseded] [--attached] [--dry-run] [--wave N] [--through-wave N] [--skip-preflight] [--detect-manual-merge] [--json]\n" +
42
+ "Usage: spine batch start <scope>|pause|resume|retry <taskId|[rowId]>|skip <taskId|[rowId]>|force-merge [--wave N]|salvage|abort|dismiss|complete [--batch ID] [--lane N] [--integrate] [--yes] [--reason TEXT] [--hard] [--force] [--force-superseded] [--attached] [--dry-run] [--wave N] [--through-wave N] [--skip-preflight] [--detect-manual-merge] [--json]\n" +
43
+ " Row identity: retry/skip 'SP-X[rowId]' targets one matrix row; plain SP-X targets the whole task.\n" +
42
44
  " abort --dry-run Preview abort (reason/archive target); does not archive, journal, or clear live batch\n"
43
45
  );
44
46
  }
@@ -349,10 +351,13 @@ export async function runSpineBatch(options) {
349
351
  if (!parsed.taskId) {
350
352
  return {
351
353
  exitCode: 1,
352
- output: "Usage: spine batch retry <taskId> [--json]\n",
354
+ output: "Usage: spine batch retry <taskId> | <taskId>[rowId] [--json]\n",
353
355
  };
354
356
  }
355
- const result = retryTask({ projectRoot, taskId: parsed.taskId });
357
+ const rowRef = parseMatrixRowRef(parsed.taskId);
358
+ const result = rowRef
359
+ ? retryTaskRow({ projectRoot, taskId: rowRef.taskId, rowId: rowRef.rowId })
360
+ : retryTask({ projectRoot, taskId: parsed.taskId });
356
361
  if (parsed.json) {
357
362
  return {
358
363
  exitCode: result.exitCode ?? (result.ok ? 0 : 1),
@@ -368,6 +373,7 @@ export async function runSpineBatch(options) {
368
373
  ];
369
374
  if (result.batchId) lines.push("", ` Batch: ${result.batchId}`);
370
375
  if (result.taskId) lines.push(` Task: ${result.taskId}`);
376
+ if (result.rowId) lines.push(` Row: ${result.rowId}`);
371
377
  if (result.pendingSegments != null) lines.push(` Pending segments: ${result.pendingSegments}`);
372
378
  lines.push("");
373
379
  return {
@@ -381,10 +387,13 @@ export async function runSpineBatch(options) {
381
387
  if (!parsed.taskId) {
382
388
  return {
383
389
  exitCode: 1,
384
- output: "Usage: spine batch skip <taskId> [--json]\n",
390
+ output: "Usage: spine batch skip <taskId> | <taskId>[rowId] [--json]\n",
385
391
  };
386
392
  }
387
- const result = skipTask({ projectRoot, taskId: parsed.taskId });
393
+ const rowRef = parseMatrixRowRef(parsed.taskId);
394
+ const result = rowRef
395
+ ? skipTaskRow({ projectRoot, taskId: rowRef.taskId, rowId: rowRef.rowId })
396
+ : skipTask({ projectRoot, taskId: parsed.taskId });
388
397
  if (parsed.json) {
389
398
  return {
390
399
  exitCode: result.exitCode ?? (result.ok ? 0 : 1),
@@ -400,6 +409,7 @@ export async function runSpineBatch(options) {
400
409
  ];
401
410
  if (result.batchId) lines.push("", ` Batch: ${result.batchId}`);
402
411
  if (result.taskId) lines.push(` Task: ${result.taskId}`);
412
+ if (result.rowId) lines.push(` Row: ${result.rowId}`);
403
413
  lines.push("");
404
414
  return {
405
415
  exitCode: result.exitCode ?? (result.ok ? 0 : 1),
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Integrate gate inspection and resolution (PRD §12, FR-GATE).
4
- * Usage: spine gate [approve|reject|status|reopen] [--batch ID] [--reason text] [--json]
4
+ * Usage: spine gate [approve|reject|status|reopen] [--batch ID] [--reason text] [--synthesis text] [--json]
5
5
  */
6
6
 
7
7
  import { isCliEntrypoint } from "./spine-cli/shared.mjs";
@@ -32,6 +32,10 @@ export function formatGateHuman(result, json = false) {
32
32
  ` Status: ${result.gate.status}`,
33
33
  ` Kind: ${result.gate.kind}`,
34
34
  );
35
+ // SP-747 / #280: show the operator's synthesis readback when one was recorded.
36
+ if (typeof result.gate.synthesis === "string" && result.gate.synthesis.trim() !== "") {
37
+ lines.push(` Synthesis: ${result.gate.synthesis}`);
38
+ }
35
39
  if (Array.isArray(result.gate.evidenceRefs) && result.gate.evidenceRefs.length > 0) {
36
40
  lines.push("", " Evidence:");
37
41
  for (const ref of result.gate.evidenceRefs) {
@@ -87,6 +91,12 @@ export function runSpineGate(options) {
87
91
  reason = args[reasonIdx + 1];
88
92
  }
89
93
 
94
+ let synthesis = null;
95
+ const synthesisIdx = args.indexOf("--synthesis");
96
+ if (synthesisIdx >= 0 && args[synthesisIdx + 1]) {
97
+ synthesis = args[synthesisIdx + 1];
98
+ }
99
+
90
100
  batchId = resolveActiveBatchId(projectRoot, batchId);
91
101
  if (!batchId) {
92
102
  const result = {
@@ -106,10 +116,15 @@ export function runSpineGate(options) {
106
116
  let result;
107
117
  switch (action) {
108
118
  case "approve":
109
- result = approveIntegrateGate({ projectRoot, batchId });
119
+ result = approveIntegrateGate({ projectRoot, batchId, synthesis: synthesis ?? undefined });
110
120
  break;
111
121
  case "reject":
112
- result = rejectIntegrateGate({ projectRoot, batchId, reason: reason ?? undefined });
122
+ result = rejectIntegrateGate({
123
+ projectRoot,
124
+ batchId,
125
+ reason: reason ?? undefined,
126
+ synthesis: synthesis ?? undefined,
127
+ });
113
128
  break;
114
129
  case "status":
115
130
  result = getIntegrateGateStatus({ projectRoot, batchId });
@@ -4,6 +4,49 @@ import { readJournalEvents, readJournalTail } from "../src/batch/journal.mjs";
4
4
  import { reconcileBatch } from "../src/batch/reconcile.mjs";
5
5
  import { formatStatusJson } from "../src/batch/status-json.mjs";
6
6
 
7
+ /**
8
+ * Per-row matrix state lines (#230): one block per matrix task listing each
9
+ * row's running/succeeded/failed state, plus concrete retry/cancel commands
10
+ * for the failing rows. Rendered for both plain and --diagnose human output.
11
+ *
12
+ * @param {string[]} lines Output lines (mutated).
13
+ * @param {object} result Reconciliation result from reconcileBatch.
14
+ */
15
+ function appendMatrixRowSections(lines, result) {
16
+ const matrixTasks = (result.signals?.tasks ?? []).filter(
17
+ (task) => Array.isArray(task?.matrixRows) && task.matrixRows.length > 0,
18
+ );
19
+ if (matrixTasks.length === 0) return;
20
+
21
+ for (const task of matrixTasks) {
22
+ const failedRowIds = task.matrixRows
23
+ .filter((row) => row && row.status === "failed")
24
+ .map((row) => row.rowId)
25
+ .filter(Boolean);
26
+ lines.push("", ` Matrix rows (${task.taskId}):`);
27
+ for (const row of task.matrixRows) {
28
+ if (!row || typeof row !== "object") continue;
29
+ const status = String(row.status ?? "pending");
30
+ const exit = row.exitCode != null ? ` exit=${row.exitCode}` : "";
31
+ const commit = typeof row.commitSha === "string" && row.commitSha ? ` @ ${row.commitSha.slice(0, 8)}` : "";
32
+ lines.push(` ${row.rowId}: ${status}${exit}${commit}`);
33
+ }
34
+ if (failedRowIds.length > 0) {
35
+ lines.push(
36
+ ` → Retry one failed row: spine batch retry '${task.taskId}[${failedRowIds[0]}]'`,
37
+ );
38
+ }
39
+ const cancellable = task.matrixRows.some(
40
+ (row) => row && row.status !== "succeeded" && row.status !== "canceled",
41
+ );
42
+ if (cancellable) {
43
+ lines.push(
44
+ ` → Cancel one row: spine batch skip '${task.taskId}[<rowId>]' (whole matrix: spine batch skip ${task.taskId})`,
45
+ );
46
+ }
47
+ }
48
+ }
49
+
7
50
  /**
8
51
  * @param {object} options
9
52
  * @param {string} options.projectRoot
@@ -56,6 +99,8 @@ export function runSpineStatus(options) {
56
99
  lines.push(` → ${result.suggestedCommand}`);
57
100
  }
58
101
 
102
+ appendMatrixRowSections(lines, result);
103
+
59
104
  if (diagnose && result.mergeFailed) {
60
105
  lines.push("");
61
106
  lines.push(` Merge failed: ${result.failedMerges} wave(s)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-spine",
3
- "version": "2.19.0",
3
+ "version": "2.21.0",
4
4
  "description": "Orchestration spine for long-running pi development",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -22,11 +22,11 @@
22
22
  "skills": [
23
23
  "./skills"
24
24
  ],
25
- "minPiVersion": "0.60.0"
25
+ "minPiVersion": "0.80.0"
26
26
  },
27
27
  "type": "module",
28
28
  "engines": {
29
- "node": ">=22.0.0"
29
+ "node": ">=22.19.0"
30
30
  },
31
31
  "scripts": {
32
32
  "doctor": "node bin/spine.mjs doctor",
@@ -72,12 +72,12 @@
72
72
  }
73
73
  },
74
74
  "devDependencies": {
75
- "@earendil-works/pi-coding-agent": "^0.80.3",
75
+ "@earendil-works/pi-coding-agent": "^0.85.1",
76
76
  "@types/node": "^22.19.18",
77
- "eslint": "^9.28.0",
78
- "globals": "^16.2.0",
79
- "typebox": "1.1.38",
80
- "typescript": "5.6.3"
77
+ "eslint": "^10.10.0",
78
+ "globals": "^17.12.0",
79
+ "typebox": "1.3.30",
80
+ "typescript": "6.0.3"
81
81
  },
82
82
  "license": "MIT",
83
83
  "dependencies": {
@@ -18,6 +18,8 @@ spine wait --until completed,needs_integrate,failed,aborted --timeout 4h # opt
18
18
 
19
19
  Detached start/resume returns when the engine **starts**, not when work completes.
20
20
 
21
+ > **Wait progress vs quiet-stdout hosts:** human-mode `spine wait` prints a start banner and a `Wait progress:` line per poll, but agent hosts that buffer stdout until process exit (MonitorCreate, non-TTY shells) only see the terminal line. For machine-readable output use `--json` — one JSON snapshot at the terminal state.
22
+
21
23
  ---
22
24
 
23
25
  ## Cursor Agent shell
@@ -119,6 +119,8 @@ Increment `WAVE` and repeat until `spine plan pending` shows no remaining waves.
119
119
 
120
120
  > **Wait recipe note:** With SP-683, gate-pending land loops report the taxonomy diagnosis `needs_integrate`, so the default `--until` list above wakes on that diagnosis. The operator runbook documents optional land-loop pseudo-diagnoses (`gate_open`, `needs_approval`, `post_merge_limbo`) as belt-and-suspenders waits when you need finer-grained blocking inside the land loop itself.
121
121
 
122
+ > **Wait liveness (SP-754):** human-mode `spine wait` shows liveness output — a start banner, a `Wait progress:` line per poll (diagnosis, phase, wave, elapsed), and a terminal `Wait matched:` / `Wait timed out` headline. A quiet wait between progress lines is alive, not hung; use `--json` for machine parsing.
123
+
122
124
  **Optional script template:** `spine run sequence pending --attached --dry-run` — execute each printed block with judgment; do **not** chain `--auto-approve-gate` with real pi workers.
123
125
 
124
126
  Full reference: [references/outer-loop.md](references/outer-loop.md).
@@ -47,6 +47,7 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
47
47
  - **Never** run `npm version` or `git push --tags` when `npm run release:check` exits non-zero on current `main` ([#175](https://github.com/beettlle/pi-spine/issues/175))
48
48
  - **Never** run `npm version` or `git push --tags` when the **CI** workflow is not green on current `HEAD` — release-safe profile: typecheck + lint + tests + coverage (parity with `ci.yml`) ([#156](https://github.com/beettlle/pi-spine/issues/156))
49
49
  - **Always** parse target version / bump type **before** task selection (Phase 2)
50
+ - **Always** record dependency drift in Phase 1 (`npm outdated` + `npm audit`) and apply include/defer thresholds — never auto-add a full “update all deps” task; see [issue-intake-checklist.md](references/issue-intake-checklist.md) § Dependency drift check
50
51
  - **Always** prioritize documentation issues over enhancements
51
52
  - **Always** run `spine gate approve` before `spine integrate`
52
53
  - **Always** run `npm install` on `main` after successful integrate
@@ -154,9 +155,18 @@ spine tasks analyze pending
154
155
  rg 'Closes #|Closes:|Partial #|Partial:' spine-tasks/*/PROMPT.md
155
156
  ```
156
157
 
158
+ **Dependency drift check** (every profile, including patch) — full thresholds in [issue-intake-checklist.md](references/issue-intake-checklist.md):
159
+
160
+ ```bash
161
+ npm outdated
162
+ npm audit
163
+ ```
164
+
165
+ Classify each signal as **include** or **defer** (security highs even in patch; peer ≥1-minor drift and toolchain majors for minor/major only). Prefer an existing open dep issue (e.g. title contains “Bump dependencies” / “pi-coding-agent”) over inventing a duplicate gap. Record a one-row summary in the intake output and the manifest **Dependency drift** section.
166
+
157
167
  Read `spine-tasks/CONTEXT.md` for `Next Task ID`.
158
168
 
159
- **Output:** intake table (issue #, labels, mapped SP-* or gap, bucket, profile fit).
169
+ **Output:** intake table (issue #, labels, mapped SP-* or gap, bucket, profile fit) **plus** deps mini-table (package, current, latest, include|defer).
160
170
 
161
171
  ---
162
172
 
@@ -173,9 +183,11 @@ Use [references/release-manifest-template.md](references/release-manifest-templa
173
183
  ### Selection order (strict)
174
184
 
175
185
  1. **Documentation first** — all feasible doc items before feature work
176
- 2. **Bug fixes** — target 3–5 with user impact
177
- 3. **Enhancements** — per profile (0 for patch, 1–2 for minor)
178
- 4. **Defer** everything else with one-line rationale
186
+ 2. **Bug fixes** — target 3–5 with user impact; include **security-high dep fixes** from the Phase 1 drift check here (hygiene, not a fourth unlimited bucket)
187
+ 3. **Enhancements** — per profile (0 for patch, 1–2 for minor); peer ≥1-minor drift / toolchain majors from the drift check consume an enh/hygiene slot when thresholds fire
188
+ 4. **Defer** everything else with one-line rationale (including “deps OK — deferred” when no threshold fires)
189
+
190
+ Dep hygiene from the drift check **inserts into** the bug or enh slot per [issue-intake-checklist.md](references/issue-intake-checklist.md) thresholds — it is not a separate uncapped bucket. Prefer one focused peer/security packet over “bump everything” when the enh slot is already full.
179
191
 
180
192
  ### Apply profile budgets
181
193
 
@@ -193,6 +205,7 @@ Present manifest summary:
193
205
 
194
206
  - Target version and profile
195
207
  - Selected SP-* / issues by bucket
208
+ - Dependency drift action (included SP-*/#NNN or deferred rationale)
196
209
  - Deferred count
197
210
  - Profile audit status
198
211
 
@@ -307,6 +320,8 @@ spine wait --until completed,failed,needs_integrate,needs_retry,aborted --timeou
307
320
 
308
321
  Optional pi watchdog: `LoopCreate` every 2m, `readOnly: true`, `maxFires: 50` — see pi-async-orchestration.
309
322
 
323
+ > **Wait progress (SP-754):** human-mode `spine wait` is not silent until exit — it prints a start banner, a `Wait progress:` line per poll (diagnosis, phase, wave, elapsed), and a terminal `Wait matched:` (stdout) or `Wait timed out` (stderr) headline. Quiet output between progress lines means the wait is between polls, not hung. Use `--json` when a machine parses the result.
324
+
310
325
  > **Wait recipe note:** With SP-683, gate-pending land loops report the taxonomy diagnosis `needs_integrate`, so the default `--until` lists above wake on that diagnosis. The operator runbook documents optional land-loop pseudo-diagnoses (`gate_open`, `needs_approval`, `post_merge_limbo`) as belt-and-suspenders waits when you need finer-grained blocking inside the land loop itself.
311
326
 
312
327
  **Do not** start wave N+1 until wave N is integrated on `main`.
@@ -551,12 +566,13 @@ Include the published version/tag in the close comment when closing at Phase 6 (
551
566
  1. **Release manifest** — path, target version, profile, composition table
552
567
  2. **Tasks completed** — SP-IDs, waves, issues closed (list `#NNN` CLOSED with close time or comment URL)
553
568
  3. **Deferred backlog** — count and top items for next release (issues left OPEN + rationale)
554
- 4. **Authoring changes** — new SP-* created, splits/fixes in Phase 3
555
- 5. **Issues filed** — pi-spine GitHub links or "none"
556
- 6. **Recovery actions** — aborts, retries, contract fixes
557
- 7. **Verification** — paste `spine preflight` tail, **`npm run release:check` output** (or log path), test/coverage output
558
- 8. **Publish** — version bumped (Y/N), tag pushed (Y/N), workflow URL, or "awaiting operator approval"
559
- 9. **Issue tracker hygiene** — confirm every release-scoped `Closes #NNN` is CLOSED (paste `gh issue view` states or list)
569
+ 4. **Dependency drift** — Phase 1 check outcome: included SP-*/#NNN or deferred rationale (and audit high/critical count)
570
+ 5. **Authoring changes** — new SP-* created, splits/fixes in Phase 3
571
+ 6. **Issues filed** — pi-spine GitHub links or "none"
572
+ 7. **Recovery actions** — aborts, retries, contract fixes
573
+ 8. **Verification** — paste `spine preflight` tail, **`npm run release:check` output** (or log path), test/coverage output
574
+ 9. **Publish** — version bumped (Y/N), tag pushed (Y/N), workflow URL, or "awaiting operator approval"
575
+ 10. **Issue tracker hygiene** — confirm every release-scoped `Closes #NNN` is CLOSED (paste `gh issue view` states or list)
560
576
 
561
577
  ---
562
578
 
@@ -86,6 +86,43 @@ Exclude when:
86
86
  - Disjoint `fileScopeMustChange` from bug tasks in same wave
87
87
  - P1/P2 over P3
88
88
 
89
+ ## Dependency drift check
90
+
91
+ Run during **Phase 1** for **every** profile (including patch). Always record results; only **include** a dep/hygiene task when a threshold fires — never auto-add “update all deps” to every minor.
92
+
93
+ ### Commands
94
+
95
+ ```bash
96
+ npm outdated
97
+ npm audit
98
+ ```
99
+
100
+ Optional: glance at GitHub Actions major pins in `.github/workflows/*.yml` (`actions/checkout`, `actions/setup-node`, `actions/upload-artifact`, `actions/github-script`) for toolchain major drift.
101
+
102
+ ### Include / defer thresholds
103
+
104
+ | Signal | Include in release? | Bucket |
105
+ |--------|---------------------|--------|
106
+ | `npm audit` high or critical | Yes — even **patch** if fix is S-sized | bug / hygiene |
107
+ | `@earendil-works/pi-coding-agent` behind by ≥1 0.x minor (e.g. 0.80 → 0.85) | Yes for **minor/major**; patch only if also audit-high | enh / hygiene (counts against enh budget on minor) |
108
+ | Same-major patch/minor drift only (eslint 9.x, `@types/node` 22.x) | Include only if enh budget has room **or** operator override; otherwise defer | hygiene |
109
+ | TypeScript / ESLint / Actions **major** | **minor/major** only — never default into patch | enh / hygiene |
110
+ | No overdue signal | Record “deps OK — deferred” in the manifest; **no new task** | — |
111
+
112
+ **Scope when included:** prefer one focused peer/security packet over “bump everything” when the enhancement slot is already full. Dep hygiene inserts into the bug or enh slot — it is not a fourth unlimited bucket.
113
+
114
+ ### Map before authoring a gap
115
+
116
+ Search open issues for an existing dep bump ticket before creating a new SP-*:
117
+
118
+ ```bash
119
+ gh issue list --repo beettlle/pi-spine --state open --limit 100 \
120
+ --json number,title,labels \
121
+ --jq '.[] | select(.title | test("dependenc|pi-coding-agent|npm audit|Bump dep"; "i"))'
122
+ ```
123
+
124
+ Prefer `Closes #NNN` on that issue over inventing duplicate work.
125
+
89
126
  ## Pending task inventory
90
127
 
91
128
  ```bash
@@ -105,3 +142,12 @@ Cross-reference pending SP-* with open issues. The release executes **manifest s
105
142
  |---------|--------|-------------|--------|-------------|-------|
106
143
  | #130 | bug | SP-483 | bug | patch ✓ | post-merge restore |
107
144
  | #90 | documentation | — (gap) | doc | minor ✓ | needs new SP-* |
145
+
146
+ ### Deps mini-table (required)
147
+
148
+ | Package | Current | Latest | Action |
149
+ |---------|---------|--------|--------|
150
+ | @earendil-works/pi-coding-agent | 0.80.3 | 0.85.1 | include (#285) / defer: … |
151
+ | (others from `npm outdated`) | … | … | include \| defer |
152
+
153
+ Also record: `npm audit` high/critical count and overall action for the manifest **Dependency drift** section.
@@ -24,6 +24,18 @@
24
24
 
25
25
  ---
26
26
 
27
+ ## Dependency drift
28
+
29
+ | Check | Result |
30
+ |-------|--------|
31
+ | `npm outdated` | (paste summary or path to intake snapshot) |
32
+ | `npm audit` highs/criticals | n |
33
+ | Action | include SP-### / #NNN \| deferred: {reason} |
34
+
35
+ Thresholds: [issue-intake-checklist.md](issue-intake-checklist.md) § Dependency drift check. Always record; include a task only when a threshold fires.
36
+
37
+ ---
38
+
27
39
  ## Selected tasks
28
40
 
29
41
  | SP-ID | Issue | Bucket | Size | Title | Notes |
@@ -72,8 +72,11 @@ Breaking changes and large migrations. Operator-defined epic scope.
72
72
  Apply in this order; stop when profile budget is full:
73
73
 
74
74
  1. **Documentation** — `label:documentation`, `skill:create-spine-tasks` doc issues, pending docs-only SP-* tasks
75
- 2. **Bug fixes** — open `label:bug` with user impact; prefer already-tasked or quick S
76
- 3. **Enhancements** — only if profile allows; one user-visible improvement per minor release
75
+ 2. **Bug fixes** — open `label:bug` with user impact; prefer already-tasked or quick S; **security-high dep fixes** from the Phase 1 drift check insert here before enhancements
76
+ 3. **Enhancements / dep hygiene** — only if profile allows; one user-visible improvement per minor release; peer ≥1-minor drift (`pi-coding-agent`) or toolchain majors from the drift check fill **one** enh/hygiene slot on minor/major when thresholds fire (see [issue-intake-checklist.md](issue-intake-checklist.md) § Dependency drift check)
77
+ 4. **Defer** the rest — including “deps OK — deferred” when no threshold fires
78
+
79
+ Never treat dependency updates as an uncapped fourth bucket. Prefer one focused peer/security packet over “bump everything” when the enh slot is already full.
77
80
 
78
81
  ## Profile audit (must pass before Phase 3)
79
82
 
@@ -86,6 +89,7 @@ Fill the composition audit table in the manifest. Fail or warn when:
86
89
  | Total tasks | >8 without override | >15 without override | — |
87
90
  | M/L tasks in patch | any without override | — | — |
88
91
  | Doc paths in File Scope | required for doc tasks (#144) | required | required |
92
+ | Dep drift check recorded | WARN if missing | **FAIL** without override if missing | **FAIL** without override if missing |
89
93
 
90
94
  Record `Profile audit: PASS` or `PASS with operator override` before proceeding.
91
95
 
@@ -67,5 +67,49 @@ else
67
67
  fi
68
68
  echo ""
69
69
 
70
+ echo "=== npm outdated ==="
71
+ # npm outdated exits 1 when updates exist — must not abort this script
72
+ npm outdated 2>/dev/null || true
73
+ echo ""
74
+
75
+ echo "=== npm audit (vulnerability counts) ==="
76
+ if command -v node >/dev/null 2>&1; then
77
+ # npm audit exits non-zero when vulns exist — capture JSON without aborting
78
+ AUDIT_JSON="$(npm audit --json 2>/dev/null || true)"
79
+ if [ -n "$AUDIT_JSON" ]; then
80
+ printf '%s' "$AUDIT_JSON" | node -e '
81
+ let s = "";
82
+ process.stdin.on("data", (c) => { s += c; });
83
+ process.stdin.on("end", () => {
84
+ try {
85
+ const d = JSON.parse(s || "{}");
86
+ const v = (d.metadata && d.metadata.vulnerabilities) || {};
87
+ const info = v.info || 0;
88
+ const low = v.low || 0;
89
+ const moderate = v.moderate || 0;
90
+ const high = v.high || 0;
91
+ const critical = v.critical || 0;
92
+ const total = v.total != null ? v.total : info + low + moderate + high + critical;
93
+ console.log(
94
+ "info=" + info +
95
+ " low=" + low +
96
+ " moderate=" + moderate +
97
+ " high=" + high +
98
+ " critical=" + critical +
99
+ " total=" + total
100
+ );
101
+ } catch {
102
+ console.log("(could not parse npm audit --json)");
103
+ }
104
+ });
105
+ '
106
+ else
107
+ echo "(npm audit --json produced no output)"
108
+ fi
109
+ else
110
+ npm audit 2>/dev/null || true
111
+ fi
112
+ echo ""
113
+
70
114
  echo "=== Next Task ID (from CONTEXT.md) ==="
71
115
  grep -E '^\*\*Next Task ID:\*\*' spine-tasks/CONTEXT.md 2>/dev/null || echo "(CONTEXT.md not found)"
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Contract testCommand execution, npm guard, and verifyContract (SP-603 / SP-541).
4
3
  */
@@ -29,7 +28,7 @@ import {
29
28
  import { formatRefusedContractMetacharMessage, isRefusedContractMetacharCommand } from "../tasks/packet/parse-prompt.mjs";
30
29
 
31
30
  // Shared pre-spawn refusal envelope for the npm-scope (#187) and metachar (#268) guards.
32
- function refusedBeforeSpawnResult(summary) {
31
+ function refusedBeforeSpawnResult(/** @type {string} */ summary) {
33
32
  return { ok: false, exitCode: 1, output: summary, summary, refusedBeforeSpawn: true };
34
33
  }
35
34
 
@@ -147,12 +146,11 @@ function formatRefusedNpmTestDashDashMessage(command) {
147
146
  return `Contract testCommand refused before spawn: npm test -- <path> is blocked at runtime (command: ${command}). ${TEST_COMMAND_NPM_TEST_DASH_DASH_FIX_HINT}`;
148
147
  }
149
148
 
150
- /**
151
-
152
149
  /**
153
150
  * @param {string} worktreePath
154
151
  * @param {string} command
155
152
  * @param {{ maxBuffer?: number }} [options]
153
+ * @returns {{ ok: boolean, exitCode: number, output: string, bufferOverflow?: boolean, summary?: string, refusedBeforeSpawn?: boolean }}
156
154
  */
157
155
  export function runContractTestCommand(worktreePath, command, options = {}) {
158
156
  const trimmed = String(command ?? "").trim();
@@ -183,7 +181,7 @@ export function runContractTestCommand(worktreePath, command, options = {}) {
183
181
  const stderr = String(result.stderr ?? "");
184
182
  const output = `${stdout}\n${stderr}`;
185
183
 
186
- if (result.error?.code === "ENOBUFS") {
184
+ if (/** @type {NodeJS.ErrnoException | undefined} */ (result.error)?.code === "ENOBUFS") {
187
185
  const limitLabel = formatMaxBufferLabel(maxBuffer);
188
186
  return {
189
187
  ok: false,
@@ -204,8 +202,7 @@ export function runContractTestCommand(worktreePath, command, options = {}) {
204
202
  }
205
203
 
206
204
  /**
207
- * @param {string} worktreePath
208
- * @param {object} config
205
+ * @param {{ testing?: { test?: string, testWithCoverage?: string } }} [config]
209
206
  */
210
207
  function resolveCoverageCommand(config) {
211
208
  return (
@@ -260,7 +257,7 @@ function findArtifactMatch(worktreePath, artifactPattern) {
260
257
  /** @type {Array<{ abs: string, rel: string }>} */
261
258
  const stack = [{ abs: searchRoot, rel: baseDir === "." ? "" : baseDir }];
262
259
  while (stack.length > 0) {
263
- const { abs, rel } = stack.pop();
260
+ const { abs, rel } = /** @type {{ abs: string, rel: string }} */ (stack.pop());
264
261
  for (const entry of fs.readdirSync(abs, { withFileTypes: true })) {
265
262
  const entryRel = rel ? `${rel}/${entry.name}` : entry.name;
266
263
  const entryAbs = path.join(abs, entry.name);
@@ -306,6 +303,9 @@ export function prepareContractVerifyEnvironment(worktreePath, parsedContract, c
306
303
  * @param {string} [config.batchId] Batch ID for journal events (optional).
307
304
  * @param {string} [config.taskId] Task ID for journal events (optional).
308
305
  * @param {string} [config.taskFolder] Task folder path for writing failure logs to .reviews/ (optional).
306
+ * @param {{ testRetries?: number, testRetryDelayMs?: number }} [config.contract] Retry tuning for testCommand attempts.
307
+ * @param {number} [config.contractTestMaxBuffer] stdout/stderr capture limit override.
308
+ * @param {{ test?: string, testWithCoverage?: string }} [config.testing] Coverage command selection.
309
309
  * @returns {{ ok: boolean, checks: Array<{ field: string, ok: boolean, message: string }>, retries?: number }}
310
310
  */
311
311
  export function verifyContract(worktreePath, parsedContract, config = {}) {
@@ -315,7 +315,8 @@ export function verifyContract(worktreePath, parsedContract, config = {}) {
315
315
  const sinceCommit = config?.sinceCommit ?? config?.taskStartCommit ?? undefined;
316
316
  const committedFiles = listChangedFiles(worktreePath, baseBranch, sinceCommit);
317
317
 
318
- let indexAndWorktreeFiles = [];
318
+ /** @type {string[]} */
319
+ let indexAndWorktreeFiles = /** @type {string[]} */ ([]);
319
320
  try {
320
321
  const stdout = execFileSync("git", ["diff", "--name-only", "HEAD"], { cwd: worktreePath, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] });
321
322
  indexAndWorktreeFiles = stdout.split(/\r?\n/).map(l => l.trim()).filter(Boolean);
@@ -334,8 +335,7 @@ export function verifyContract(worktreePath, parsedContract, config = {}) {
334
335
  const maxRetries = config?.contract?.testRetries ?? CONTRACT_TEST_DEFAULT_RETRIES;
335
336
  const retryDelayMs = config?.contract?.testRetryDelayMs ?? CONTRACT_TEST_RETRY_DELAY_MS;
336
337
  const totalAttempts = maxRetries + 1;
337
- let lastResult = null;
338
- let successAttempt = 0;
338
+ let lastResult = /** @type {{ ok: boolean, exitCode: number, output: string, bufferOverflow?: boolean, summary?: string, refusedBeforeSpawn?: boolean } | null} */ (null), successAttempt = 0;
339
339
 
340
340
  for (let attempt = 1; attempt <= totalAttempts; attempt++) {
341
341
  lastResult = runContractTestCommand(worktreePath, parsedContract.testCommand, {
@@ -369,19 +369,20 @@ export function verifyContract(worktreePath, parsedContract, config = {}) {
369
369
  }
370
370
  }
371
371
 
372
- testCommandOutput = lastResult.output;
373
- testCommandOk = lastResult.ok;
372
+ const finalResult = /** @type {{ ok: boolean, exitCode: number, output: string, bufferOverflow?: boolean, summary?: string, refusedBeforeSpawn?: boolean }} */ (lastResult);
373
+ testCommandOutput = finalResult.output;
374
+ testCommandOk = finalResult.ok;
374
375
  const attemptLabel = successAttempt > 1
375
376
  ? ` (passed on attempt ${successAttempt} of ${totalAttempts})`
376
377
  : "";
377
378
  checks.push({
378
379
  field: "testCommand",
379
- ok: lastResult.ok,
380
- message: lastResult.ok
380
+ ok: finalResult.ok,
381
+ message: finalResult.ok
381
382
  ? `testCommand passed${attemptLabel}`
382
- : lastResult.bufferOverflow
383
- ? `Contract ${lastResult.summary}`
384
- : `Contract testCommand failed after ${totalAttempts} attempt(s) (exit ${lastResult.exitCode}): ${lastResult.summary || "(no output)"}`,
383
+ : finalResult.bufferOverflow
384
+ ? `Contract ${finalResult.summary}`
385
+ : `Contract testCommand failed after ${totalAttempts} attempt(s) (exit ${finalResult.exitCode}): ${finalResult.summary || "(no output)"}`,
385
386
  });
386
387
  }
387
388
 
@@ -65,6 +65,11 @@ export function commitLaneAndValidateWorktree({
65
65
  porcelain: preCommitPorcelain,
66
66
  });
67
67
 
68
+ const canceledMatrixRowIds = (Array.isArray(task?.matrixRows) ? task.matrixRows : [])
69
+ .filter((row) => row && row.status === "canceled")
70
+ .map((row) => row.rowId)
71
+ .filter(Boolean);
72
+
68
73
  const laneCommit = commitLaneWorktree({
69
74
  worktreePath,
70
75
  taskBranch,
@@ -74,6 +79,7 @@ export function commitLaneAndValidateWorktree({
74
79
  projectRoot,
75
80
  ignorePatterns,
76
81
  fileScopePaths,
82
+ canceledMatrixRowIds,
77
83
  });
78
84
  if (!laneCommit.ok) {
79
85
  task.status = "failed";