pi-spine 1.1.0 → 1.3.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.
- package/README.md +4 -4
- package/bin/spine-batch.mjs +160 -53
- package/bin/spine-cli/batch.mjs +3 -3
- package/bin/spine-cli/lane-logs.mjs +24 -0
- package/bin/spine-cli/scenarios.mjs +298 -0
- package/bin/spine-cli/verify.mjs +3 -0
- package/bin/spine-cli/wait.mjs +30 -0
- package/bin/spine-cli/watch.mjs +27 -0
- package/bin/spine-issue.mjs +196 -0
- package/bin/spine-journal.mjs +1 -0
- package/bin/spine-plan.mjs +49 -1
- package/bin/spine-run.mjs +30 -0
- package/bin/spine-status.mjs +19 -1
- package/bin/spine-tasks.mjs +16 -2
- package/bin/spine-worker-runner.mjs +144 -12
- package/bin/spine.mjs +49 -1
- package/package.json +1 -1
- package/skills/create-spine-tasks/SKILL.md +7 -2
- package/skills/create-spine-tasks/references/contract-template.md +114 -3
- package/src/batch/abort.mjs +2 -11
- package/src/batch/agent-session-worker.mjs +45 -5
- package/src/batch/attached-engine-handoff.mjs +188 -0
- package/src/batch/attached-runner.mjs +388 -0
- package/src/batch/contract-prelanded.mjs +180 -0
- package/src/batch/contract-stub-delivery.mjs +110 -0
- package/src/batch/contract-task-start.mjs +204 -0
- package/src/batch/contract-verify.mjs +195 -10
- package/src/batch/detached-start.mjs +137 -3
- package/src/batch/diagnosis-alternatives.mjs +46 -0
- package/src/batch/diagnosis-launch-failure.mjs +114 -0
- package/src/batch/diagnosis-merge-failure.mjs +79 -0
- package/src/batch/diagnosis-primary-failure.mjs +89 -0
- package/src/batch/diagnosis-retry-limbo.mjs +34 -0
- package/src/batch/diagnosis-stub.mjs +109 -0
- package/src/batch/diagnosis-tail-state.mjs +57 -0
- package/src/batch/diagnosis-task-done.mjs +110 -0
- package/src/batch/diagnosis-worker-done-missing.mjs +96 -0
- package/src/batch/diagnosis.mjs +140 -164
- package/src/batch/engine-lanes/commit.mjs +145 -0
- package/src/batch/engine-lanes/merge.mjs +110 -82
- package/src/batch/engine-lanes/queue.mjs +4 -1
- package/src/batch/engine-lanes/review.mjs +67 -87
- package/src/batch/engine-lanes/watch.mjs +29 -0
- package/src/batch/engine-lanes.mjs +21 -78
- package/src/batch/engine-scope.mjs +11 -1
- package/src/batch/engine.mjs +125 -24
- package/src/batch/evidence.mjs +78 -15
- package/src/batch/gate.mjs +43 -14
- package/src/batch/git-helpers.mjs +96 -0
- package/src/batch/heartbeat.mjs +75 -9
- package/src/batch/integrate-assert.mjs +69 -0
- package/src/batch/integrate-worktree.mjs +354 -0
- package/src/batch/integrate.mjs +193 -102
- package/src/batch/journal-rebuild.mjs +48 -2
- package/src/batch/journal.mjs +66 -0
- package/src/batch/lane-commit.mjs +90 -5
- package/src/batch/lane-dirty-check.mjs +437 -0
- package/src/batch/lifecycle.mjs +130 -3
- package/src/batch/limbo-detect.mjs +34 -0
- package/src/batch/macro-phase.mjs +302 -0
- package/src/batch/merge/adoption-doc-merge.mjs +93 -10
- package/src/batch/merge/wave-merge-state.mjs +3 -0
- package/src/batch/metrics.mjs +76 -5
- package/src/batch/orphan-detect.mjs +74 -0
- package/src/batch/pause.mjs +234 -0
- package/src/batch/post-merge-limbo.mjs +259 -28
- package/src/batch/reconcile.mjs +508 -63
- package/src/batch/resume-common.mjs +32 -1
- package/src/batch/resume-lane-reviews.mjs +16 -0
- package/src/batch/resume-multi-lanes.mjs +67 -1
- package/src/batch/resume-multi-validate.mjs +67 -6
- package/src/batch/resume-multi.mjs +11 -4
- package/src/batch/resume.mjs +59 -45
- package/src/batch/retry.mjs +97 -15
- package/src/batch/review-spawn.mjs +8 -2
- package/src/batch/rules-manifest-drift.mjs +198 -0
- package/src/batch/salvage.mjs +2 -1
- package/src/batch/sequence-state.mjs +290 -0
- package/src/batch/sequence.mjs +516 -0
- package/src/batch/state.mjs +34 -3
- package/src/batch/status-json.mjs +67 -0
- package/src/batch/task-stall-budget.mjs +22 -10
- package/src/batch/worker-host.mjs +96 -7
- package/src/batch/worker-output.mjs +196 -3
- package/src/cli/issue-draft.mjs +180 -0
- package/src/cli/journal-follow.mjs +239 -0
- package/src/cli/lane-logs.mjs +291 -0
- package/src/cli/sequence.mjs +121 -0
- package/src/cli/settings-set.mjs +35 -24
- package/src/cli/wait.mjs +187 -0
- package/src/cli/watch.mjs +160 -0
- package/src/config/agent-model-resolve.mjs +48 -0
- package/src/config/cursor-rules/discover.mjs +3 -21
- package/src/config/defaults.mjs +7 -1
- package/src/config/model-id.mjs +103 -0
- package/src/config/settings-fields.mjs +48 -0
- package/src/config/spine-init-constants.mjs +2 -0
- package/src/config/spine-preflight-lib.mjs +494 -17
- package/src/dashboard/lane-throughput.mjs +351 -0
- package/src/dashboard/public/dashboard.css +25 -1
- package/src/dashboard/public/dashboard.js +234 -18
- package/src/dashboard/public/index.html +14 -2
- package/src/dashboard/running-tail-state.mjs +31 -0
- package/src/dashboard/server.mjs +8 -0
- package/src/dashboard/snapshot.mjs +472 -26
- package/src/dashboard/view.mjs +282 -19
- package/src/doctor/agent-model-inherit.mjs +61 -6
- package/src/doctor/agent-models.mjs +53 -0
- package/src/doctor/batch-size-guidance.mjs +30 -2
- package/src/doctor/pi-extension-conflict.mjs +169 -0
- package/src/doctor/run-doctor-checks.mjs +32 -1
- package/src/doctor/sequence-safety.mjs +57 -0
- package/src/doctor/stale-worktrees.mjs +102 -0
- package/src/fixtures/scenario-registry.mjs +194 -0
- package/src/fs/atomic-write.mjs +49 -0
- package/src/planner/file-scope.mjs +246 -0
- package/src/planner/format-plan.mjs +9 -7
- package/src/planner/index.mjs +6 -2
- package/src/planner/scope.mjs +5 -1
- package/src/planner/wave-scope.mjs +136 -0
- package/src/planner/waves.mjs +133 -0
- package/src/tasks/packet/index.mjs +1 -0
- package/src/tasks/packet/parse-prompt.mjs +73 -2
- package/src/tasks/packet/validate-contract.mjs +108 -0
- package/src/tasks/packet/validate-prompt.mjs +124 -0
- package/templates/spine-config.json +8 -1
package/bin/spine.mjs
CHANGED
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
WARN,
|
|
34
34
|
} from "./spine-cli/shared.mjs";
|
|
35
35
|
import { handleStatus } from "./spine-cli/status.mjs";
|
|
36
|
+
import { handleLane } from "./spine-cli/lane-logs.mjs";
|
|
37
|
+
import { handleWatch } from "./spine-cli/watch.mjs";
|
|
38
|
+
import { handleWait } from "./spine-cli/wait.mjs";
|
|
39
|
+
import { handleScenarios } from "./spine-cli/scenarios.mjs";
|
|
36
40
|
import { loadSpineConfig } from "./spine-config.mjs";
|
|
37
41
|
import { cmdInit, SPINE_GITIGNORE_ENTRIES } from "./spine-init.mjs";
|
|
38
42
|
import { cmdMigrateFromTaskplane } from "./spine-migrate-from-taskplane.mjs";
|
|
@@ -58,6 +62,15 @@ async function cmdPreflight(args) {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
async function cmdJournal(args) {
|
|
65
|
+
const subcommand = args[0];
|
|
66
|
+
if (subcommand === "follow") {
|
|
67
|
+
const { runJournalFollow } = await import("../src/cli/journal-follow.mjs");
|
|
68
|
+
const result = await runJournalFollow({ projectRoot: process.cwd(), args: args.slice(1) });
|
|
69
|
+
process.stdout.write(result.output);
|
|
70
|
+
if (result.exitCode !== 0) process.exit(result.exitCode);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
const { runSpineJournal } = await import("./spine-journal.mjs");
|
|
62
75
|
const result = runSpineJournal({ projectRoot: process.cwd(), args });
|
|
63
76
|
process.stdout.write(result.output);
|
|
@@ -131,6 +144,13 @@ async function cmdHandoff(args) {
|
|
|
131
144
|
if (result.exitCode !== 0) process.exit(result.exitCode);
|
|
132
145
|
}
|
|
133
146
|
|
|
147
|
+
async function cmdIssue(args) {
|
|
148
|
+
const { runSpineIssue } = await import("./spine-issue.mjs");
|
|
149
|
+
const result = runSpineIssue({ projectRoot: process.cwd(), args });
|
|
150
|
+
process.stdout.write(result.output ?? "");
|
|
151
|
+
if (result.exitCode !== 0) process.exit(result.exitCode);
|
|
152
|
+
}
|
|
153
|
+
|
|
134
154
|
async function cmdMetrics(args) {
|
|
135
155
|
const sub = args[0];
|
|
136
156
|
if (sub !== "show") {
|
|
@@ -232,9 +252,12 @@ ${c.bold}Commands:${c.reset}
|
|
|
232
252
|
${c.cyan}settings${c.reset} Show or set editable spine-config fields (FR-CFG-03)
|
|
233
253
|
${c.cyan}rules${c.reset} Discover, select, and sync Cursor rules manifest
|
|
234
254
|
${c.cyan}status${c.reset} Reconciled batch diagnosis and lane health (FR-BATCH-14)
|
|
255
|
+
${c.cyan}watch${c.reset} Poll reconcile loop for live batch monitoring (#44)
|
|
256
|
+
${c.cyan}wait${c.reset} Block until diagnosis reaches target set (#46)
|
|
235
257
|
${c.cyan}batch${c.reset} Start, dismiss, or complete batch (Phase 2 start)
|
|
236
|
-
${c.cyan}run${c.reset} Start batch
|
|
258
|
+
${c.cyan}run${c.reset} Start batch or planner wave sequence (PRD §15.2, #54)
|
|
237
259
|
${c.cyan}handoff${c.reset} Write operator handoff note (FR-UXB-05)
|
|
260
|
+
${c.cyan}issue draft${c.reset} Build GitHub issue draft from project state (#60)
|
|
238
261
|
${c.cyan}metrics${c.reset} Show run metrics JSONL (FR-UXB-06)
|
|
239
262
|
${c.cyan}review step${c.reset} Spawn reviewer for a task step (FR-REV)
|
|
240
263
|
${c.cyan}report progress${c.reset} Emit task.step_completed to batch journal (FR-WORK-09)
|
|
@@ -246,6 +269,7 @@ ${c.bold}Commands:${c.reset}
|
|
|
246
269
|
${c.cyan}next${c.reset} Print or execute suggested next command (dry-run default)
|
|
247
270
|
${c.cyan}dashboard${c.reset} Local SSE dashboard (default http://127.0.0.1:8109)
|
|
248
271
|
${c.cyan}tasks${c.reset} Validate task PROMPT packets (FR-UXB-02)
|
|
272
|
+
${c.cyan}scenarios${c.reset} List, show, and materialize scenario fixtures
|
|
249
273
|
${c.cyan}version${c.reset} Show version information
|
|
250
274
|
${c.cyan}help${c.reset} Show this help message
|
|
251
275
|
|
|
@@ -270,6 +294,9 @@ ${c.bold}Examples:${c.reset}
|
|
|
270
294
|
spine doctor # check installation health
|
|
271
295
|
spine preflight # verify batch readiness
|
|
272
296
|
spine status --diagnose # reconciled batch diagnosis
|
|
297
|
+
spine watch # compact live reconcile poll (5s default)
|
|
298
|
+
spine watch --json --once # one NDJSON snapshot for scripts
|
|
299
|
+
spine wait --until completed,failed --timeout 2h # CI: block until terminal diagnosis
|
|
273
300
|
spine deps all # show dependency graph
|
|
274
301
|
spine deps TP-031 --json # JSON graph for one task scope
|
|
275
302
|
spine settings show # list editable config fields
|
|
@@ -282,9 +309,12 @@ ${c.bold}Examples:${c.reset}
|
|
|
282
309
|
spine batch start TP-012 # detached batch engine (default)
|
|
283
310
|
spine batch start TP-012 --attached # foreground batch engine
|
|
284
311
|
spine run pending --dry-run # run unfinished tasks (alias for batch start)
|
|
312
|
+
spine run sequence pending --dry-run # print wave-by-wave land loop commands (#54)
|
|
313
|
+
spine run sequence pending --from-wave 1 # resume sequence from planner wave 1
|
|
285
314
|
spine batch dismiss --reason limbo-recovery # archive and clear stale batch
|
|
286
315
|
spine batch complete --detect-manual-merge # complete after manual git merge
|
|
287
316
|
spine handoff [--batch ID] [--json] # operator handoff note
|
|
317
|
+
spine issue draft [--type bug] [--json] # GitHub issue draft from diagnose state
|
|
288
318
|
spine metrics show [--batch ID] [--last N] # read run-metrics.jsonl
|
|
289
319
|
spine review step --step N [--type plan|code|final] # step or final review
|
|
290
320
|
spine report progress --step N # journal step progress (worker shell-out)
|
|
@@ -301,6 +331,9 @@ ${c.bold}Examples:${c.reset}
|
|
|
301
331
|
spine tasks analyze pending # structural checks (overlap, cycles, warnings)
|
|
302
332
|
spine tasks analyze pending --json # structured AnalyzeTasksResult
|
|
303
333
|
spine help tasks # tasks subcommand usage
|
|
334
|
+
spine scenarios list # list registered scenario fixtures
|
|
335
|
+
spine scenarios show orphan-running-resume # show one scenario entry
|
|
336
|
+
spine scenarios materialize orphan-running-resume --target . # write batch-state + journal
|
|
304
337
|
spine version # show package and environment info
|
|
305
338
|
`);
|
|
306
339
|
}
|
|
@@ -337,9 +370,18 @@ if (isCliEntrypoint(import.meta.url)) {
|
|
|
337
370
|
case "tasks":
|
|
338
371
|
await cmdTasks(args);
|
|
339
372
|
break;
|
|
373
|
+
case "scenarios":
|
|
374
|
+
await handleScenarios(args);
|
|
375
|
+
break;
|
|
340
376
|
case "status":
|
|
341
377
|
await handleStatus(args);
|
|
342
378
|
break;
|
|
379
|
+
case "watch":
|
|
380
|
+
await handleWatch(args);
|
|
381
|
+
break;
|
|
382
|
+
case "wait":
|
|
383
|
+
await handleWait(args);
|
|
384
|
+
break;
|
|
343
385
|
case "batch":
|
|
344
386
|
await handleBatch(args);
|
|
345
387
|
break;
|
|
@@ -349,6 +391,9 @@ if (isCliEntrypoint(import.meta.url)) {
|
|
|
349
391
|
case "journal":
|
|
350
392
|
await cmdJournal(args);
|
|
351
393
|
break;
|
|
394
|
+
case "lane":
|
|
395
|
+
await handleLane(args);
|
|
396
|
+
break;
|
|
352
397
|
case "state":
|
|
353
398
|
await cmdState(args);
|
|
354
399
|
break;
|
|
@@ -361,6 +406,9 @@ if (isCliEntrypoint(import.meta.url)) {
|
|
|
361
406
|
case "handoff":
|
|
362
407
|
await cmdHandoff(args);
|
|
363
408
|
break;
|
|
409
|
+
case "issue":
|
|
410
|
+
await cmdIssue(args);
|
|
411
|
+
break;
|
|
364
412
|
case "metrics":
|
|
365
413
|
await cmdMetrics(args);
|
|
366
414
|
break;
|
package/package.json
CHANGED
|
@@ -285,7 +285,7 @@ Use [references/prompt-template.md](references/prompt-template.md). Spine-specif
|
|
|
285
285
|
- **Worker tools** — when Review Level > 0, steps must note `spine_review_step` after each step
|
|
286
286
|
- **Testing step (required for all tasks)** — every packet MUST include `### Step N: Testing & Verification` inside `## Steps`, placed **before** `## Completion Criteria`. This applies to **docs-only Review Level 0 tasks** as well — omitting the step causes `prompt_parse_failed` at batch launch (SP-075). Docs-only tasks still run the full test suite; they may omit the coverage-gate checkbox when no application code changes.
|
|
287
287
|
- **Coverage gate** — when the task changes application code, add a coverage verification checkbox in the Testing step using `testing.testWithCoverage` (≥77% line coverage policy)
|
|
288
|
-
- **Contract (required for new SP-\* tasks)** — add `## Contract` after `## File Scope` using [references/contract-template.md](references/contract-template.md). Include `testCommand` for code tasks; use `` `true` `` for docs-only S tasks. Legacy `TP-*` packets may omit Contract when `contract.legacyTaskIdPrefixes` includes `TP-`.
|
|
288
|
+
- **Contract (required for new SP-\* tasks)** — add `## Contract` after `## File Scope` using [references/contract-template.md](references/contract-template.md). Include `testCommand` for code tasks; use `` `true` `` for docs-only S tasks. When using `fileScopeMustNotChange`, follow parallel-only semantics and never ban `spine-tasks/**` (see contract template and [File Scope and parallel batches](#file-scope-and-parallel-batches)). Legacy `TP-*` packets may omit Contract when `contract.legacyTaskIdPrefixes` includes `TP-`.
|
|
289
289
|
- **Completion** — worker creates `{task-folder}/.DONE`; batch engine may auto-commit remaining work
|
|
290
290
|
|
|
291
291
|
### Step 5: Create STATUS.md
|
|
@@ -438,6 +438,10 @@ Task IDs in JSON use the **folder slug** (full `SP-011-api-handlers`) or bare ID
|
|
|
438
438
|
|
|
439
439
|
When decomposing a PRD, assign non-overlapping file scopes to tasks that should run in parallel.
|
|
440
440
|
|
|
441
|
+
**`fileScopeMustNotChange` (parallel lanes only):** When a packet includes `fileScopeMustNotChange` in `## Contract`, use it only to guard **product paths that concurrent tasks on different lanes** must not edit in the same wave — not to isolate paths touched by **prior serialized tasks** on the same lane. When `spine plan` reports `File scope overlaps (tasks serialized to the same lane)`, those tasks run sequentially on one lane; use disjoint `fileScopeMustChange` paths instead of relying on must-not-change. Full semantics and examples: [references/contract-template.md](references/contract-template.md#filescopemustnotchange-semantics).
|
|
442
|
+
|
|
443
|
+
**Never ban `spine-tasks/**`:** Do **not** list `spine-tasks/**` or the **current task folder** in `fileScopeMustNotChange`. Workers must update `STATUS.md`, create `.DONE`, and may write `.reviews/` — banning those paths causes `contract.verified` failures even when implementation is correct.
|
|
444
|
+
|
|
441
445
|
**Worker rules:** File Scope also drives **glob-matched Cursor rules** injected into batch workers (FR-WORK-05). Tasks touching `**/*.{js,mjs}` activate JS standards; Swift/Python tasks need scope paths that match those rule globs. Keep scope precise — wide scope pulls more rules and increases prompt byte usage.
|
|
442
446
|
|
|
443
447
|
**Reviewer rules (FR-REV-08):** Plan reviews use the same File Scope for glob matching; code reviews use changed paths from `git diff`. Final reviews load always-on rules only. Worker-only packs (`taskplane-worker-cursor.mdc`) are excluded from reviewer context by default.
|
|
@@ -483,7 +487,8 @@ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
|
|
|
483
487
|
|
|
484
488
|
## Key Principles
|
|
485
489
|
|
|
486
|
-
- **Self-contained PROMPT.md** — the worker has no memory of this conversation.
|
|
490
|
+
- **Self-contained PROMPT.md** — the worker has no memory of this conversation. Cross-model reviewers receive a **fresh spawn** (FR-REV-04) with only the review request, diff, and Contract — not `referenceDocs` or worker rules. Place acceptance criteria and spec references in PROMPT `## Mission`, `## Contract`, and step checkboxes.
|
|
491
|
+
- **Scoped `testCommand` for cross-model batches** — lane worktrees differ from dev checkouts; broad `flutter test` / `npm test` can fail in lanes even when targeted tests pass. See [cross-model authoring guidance](references/contract-template.md#cross-model-authoring-worker--reviewer) for the `testCommand` decision table.
|
|
487
492
|
- **Testing step required (never omit)** — every task packet needs `### Step N: Testing & Verification` inside `## Steps`, before `## Completion Criteria`. **Do not skip this for docs-only or Review Level 0 tasks** — the worker rejects packets without a Testing step. Use `testing.test` from spine config; for **code deliverables**, also include `testing.testWithCoverage` and a **≥77% line coverage** checkbox (see prompt template). Docs-only tasks may omit the coverage checkbox.
|
|
488
493
|
- **Documentation in every task** — "Must Update" / "Check If Affected" prevent doc drift.
|
|
489
494
|
- **Concrete deliverables** — name files to create/modify; avoid shortcuttable vague steps.
|
|
@@ -22,6 +22,14 @@ Normative schema: [PRD v2.0 implementation handoff §4](../../docs/PRD-v2.0-impl
|
|
|
22
22
|
| artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
**Path list formatting:** wrap each path in its own backticks. Do **not** put multiple comma-separated paths inside one pair:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
| fileScopeMustChange | `bin/a.mjs`, `bin/b.mjs` |
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Avoid `` `bin/a.mjs,bin/b.mjs` `` — `tasks validate` warns (or errors in required mode) and the parser must recover for legacy packets.
|
|
32
|
+
|
|
25
33
|
---
|
|
26
34
|
|
|
27
35
|
## Field guidance
|
|
@@ -29,15 +37,61 @@ Normative schema: [PRD v2.0 implementation handoff §4](../../docs/PRD-v2.0-impl
|
|
|
29
37
|
| Field | When to include | Value format |
|
|
30
38
|
|-------|-----------------|--------------|
|
|
31
39
|
| `testCommand` | **Required** for code tasks (Review Level ≥ 1, Size M/L, or implementation steps) | Shell command in backticks; max 500 chars; no newlines. Use `` `true` `` for docs-only S tasks with no code changes. |
|
|
32
|
-
| `fileScopeMustChange` | When you need proof specific paths were touched | Comma-separated paths/globs relative to repo root |
|
|
33
|
-
| `fileScopeMustNotChange` | When parallel
|
|
40
|
+
| `fileScopeMustChange` | When you need proof specific paths were touched | Comma-separated paths/globs relative to repo root; **one backtick per path** (not `` `a.mjs,b.mjs` ``) |
|
|
41
|
+
| `fileScopeMustNotChange` | When **parallel lanes** must not collide on product paths (see semantics below) | Comma-separated paths/globs relative to repo root; **one backtick per path** |
|
|
34
42
|
| `minLineCoverage` | When task changes application code | Integer 0–100 (pi-spine policy: **77**) |
|
|
35
|
-
| `artifactsMustExist` | When deliverables must exist on disk | Comma-separated file paths |
|
|
43
|
+
| `artifactsMustExist` | When deliverables must exist on disk | Comma-separated file paths; **one backtick per path** |
|
|
44
|
+
| `stallTimeoutMinutes` | Long external jobs (operator matrix, CI arms) exceeding global/size stall budget | Positive integer minutes; engine uses `max(global, size floor, contract)` |
|
|
45
|
+
| `extendGraceOnFileScope` | STATUS-only progress during long external work | `true` or `false`; when `true`, file-scope mtime extends stall grace for this task |
|
|
36
46
|
|
|
37
47
|
Unknown field names produce **warnings** at validate time (not errors). Duplicate rows are errors.
|
|
38
48
|
|
|
39
49
|
---
|
|
40
50
|
|
|
51
|
+
## `fileScopeMustNotChange` semantics
|
|
52
|
+
|
|
53
|
+
**Parallel lanes only.** Use this field to guard product paths that **concurrent tasks on different lanes** must not edit in the same wave. It is **not** for isolating paths touched by **prior serialized tasks** on the same lane.
|
|
54
|
+
|
|
55
|
+
**How verify works today:** Final contract verify compares changed files on the lane branch against each pattern (currently `main...HEAD` cumulative diff until per-task scoping lands in SP-416). On a serialized lane, commits from earlier tasks remain in that diff — so `fileScopeMustNotChange` can fail even when the current worker behaved correctly.
|
|
56
|
+
|
|
57
|
+
**Planner overlap warning:** When `spine plan` reports:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
File scope overlaps (tasks serialized to the same lane):
|
|
61
|
+
Wave N: SP-AAA ↔ SP-BBB
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
those tasks run **sequentially on one lane**, not in parallel. Do **not** rely on `fileScopeMustNotChange` to separate them; use distinct `fileScopeMustChange` paths or accept cumulative diff semantics until per-task verify ships. The overlap warning means **concurrency is already prevented** — `fileScopeMustNotChange` targets **different lanes** editing the same product path in the same wave.
|
|
65
|
+
|
|
66
|
+
### Never ban `spine-tasks/**`
|
|
67
|
+
|
|
68
|
+
Workers **must** update `STATUS.md`, create `.DONE`, and may write `.reviews/`. These orchestration artifacts are not product-code scope violations.
|
|
69
|
+
|
|
70
|
+
- **Never** list `spine-tasks/**` in `fileScopeMustNotChange`.
|
|
71
|
+
- **Never** list the **current task folder** (e.g. `spine-tasks/SP-410-*/**`) — it blocks required worker outputs.
|
|
72
|
+
|
|
73
|
+
**Good** (parallel collision guard on product paths):
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
| fileScopeMustNotChange | `extension/**`, `.spine/**` |
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Bad** (blocks required worker artifacts — fails `contract.verified` even when implementation is correct):
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
| fileScopeMustNotChange | `extension/**`, `.spine/**`, `spine-tasks/**` |
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Bad** (blocks current task's `STATUS.md` and `.DONE`):
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
| fileScopeMustNotChange | `spine-tasks/SP-410-contract-template-parallel-semantics/**` |
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Symptom in journal: `testCommand` passes but `fileScopeMustNotChange` fails with messages like `forbidden change spine-tasks/SP-001/STATUS.md` or `.DONE`.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
41
95
|
## Examples
|
|
42
96
|
|
|
43
97
|
### Minimal S task (code change)
|
|
@@ -85,6 +139,63 @@ Unknown field names produce **warnings** at validate time (not errors). Duplicat
|
|
|
85
139
|
| artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
|
|
86
140
|
```
|
|
87
141
|
|
|
142
|
+
### Operator matrix / long external job (SP-314)
|
|
143
|
+
|
|
144
|
+
Use when a task runs a multi-hour external matrix or CI arm with little in-repo checkpoint progress (only `STATUS.md` edits). Per-task override avoids raising global `lanes.stallTimeoutMinutes` for the whole batch.
|
|
145
|
+
|
|
146
|
+
```markdown
|
|
147
|
+
## Contract
|
|
148
|
+
|
|
149
|
+
| Field | Value |
|
|
150
|
+
|-------|-------|
|
|
151
|
+
| testCommand | `npm run typecheck && SPINE_WORKER_STUB=1 npm test` |
|
|
152
|
+
| stallTimeoutMinutes | 240 |
|
|
153
|
+
| extendGraceOnFileScope | true |
|
|
154
|
+
| fileScopeMustChange | `spine-tasks/SP-029-*/STATUS.md` |
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Recommended: **240** minutes for jobs expected to run 2+ hours. Size S floor (90m) and global default (120m) are additive floors; contract value wins when higher.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Cross-model authoring (worker ≠ reviewer)
|
|
162
|
+
|
|
163
|
+
When the worker model differs from the reviewer model (e.g. worker `cursor/auto`, reviewer `google/gemini-3.1-pro-preview`), contract shape directly affects review outcomes. The most common cross-model failure is `review_exhausted` caused by broad `testCommand` or missing context — not reviewer rejection of code quality.
|
|
164
|
+
|
|
165
|
+
### Scoped `testCommand`
|
|
166
|
+
|
|
167
|
+
Lane worktrees are **not** identical to the developer checkout. Worktree setup hooks, missing assets, pre-existing test failures, and Flutter/monorepo full-suite pollution can cause a scoped worker to pass targeted tests while the unscoped `testCommand` in Contract fails at final verify.
|
|
168
|
+
|
|
169
|
+
| Avoid | Prefer |
|
|
170
|
+
|-------|--------|
|
|
171
|
+
| `` `flutter test` `` / `` `npm test` `` (full suite in lane worktree) | Targeted command matching the Testing step: `` `flutter test test/unit/services/foo_test.dart` `` |
|
|
172
|
+
| Same command in Contract and global `testing.test` without verifying lane compatibility | Document when to use `` `true` `` (docs-only) vs scoped shell proof |
|
|
173
|
+
| Unscoped command producing >10 MB stdout (SP-426 `maxBuffer`) | Narrow test scope; prefer `npm test -- tests/feature.test.mjs` |
|
|
174
|
+
|
|
175
|
+
**Engine-side lane fixes:** [#78](https://github.com/beettlle/pi-spine/issues/78), [#80](https://github.com/beettlle/pi-spine/issues/80) track worktree setup hook and analyzer hygiene — docs alone cannot fix lane environment drift.
|
|
176
|
+
|
|
177
|
+
### Self-contained PROMPT for independent reviewers
|
|
178
|
+
|
|
179
|
+
Reviewers spawn as **fresh sessions** with no memory of the worker session (FR-REV-04). Cross-model reviewers receive:
|
|
180
|
+
|
|
181
|
+
| Worker sees | Reviewer sees |
|
|
182
|
+
|-------------|---------------|
|
|
183
|
+
| `taskplane-worker-cursor.mdc`, glob-matched language standards | Bounded rule subset via `profile.reviewer.*` (FR-REV-08); worker/authoring rules excluded |
|
|
184
|
+
| `referenceDocs` (e.g. `docs/constitution.md`) | **Not** auto-loaded; 16 KiB rule cap |
|
|
185
|
+
| Full PROMPT + STATUS in session, accumulated context | Fresh spawn; review request + diff + Contract only |
|
|
186
|
+
|
|
187
|
+
**Authoring implication:** Place acceptance criteria, spec references, and "done means" in PROMPT `## Mission`, `## Contract`, and step checkboxes — do not assume the reviewer read `IMPLEMENTATION.md`, domain plans, or `referenceDocs` unless quoted verbatim in PROMPT.
|
|
188
|
+
|
|
189
|
+
### `testCommand` decision table
|
|
190
|
+
|
|
191
|
+
| Task type | Recommended `testCommand` |
|
|
192
|
+
|-----------|---------------------------|
|
|
193
|
+
| Docs-only, no code changes | `` `true` `` |
|
|
194
|
+
| Single module, targeted tests exist | `` `npm test -- tests/feature.test.mjs` `` or `` `flutter test test/unit/services/foo_test.dart` `` |
|
|
195
|
+
| Full-suite safe in lane worktree | `` `npm run typecheck && SPINE_WORKER_STUB=1 npm test` `` |
|
|
196
|
+
| Coverage gate required (pi-spine ≥77%) | `` `npm run coverage:check` `` |
|
|
197
|
+
| Long external job (>2h) | Scoped command + `stallTimeoutMinutes` and `extendGraceOnFileScope` in Contract (see SP-314 example above) |
|
|
198
|
+
|
|
88
199
|
---
|
|
89
200
|
|
|
90
201
|
## Validate before plan
|
package/src/batch/abort.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { appendJournalEvent, journalPath, readJournalEvents, readJournalTail } f
|
|
|
10
10
|
import { loadBatchStateFile } from "./reconcile.mjs";
|
|
11
11
|
import { appendBatchHistoryEntry } from "./state.mjs";
|
|
12
12
|
import { removeLaneWorktree } from "./worktree.mjs";
|
|
13
|
+
import { terminateLaneWorkers } from "./worker-host.mjs";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {string} projectRoot
|
|
@@ -79,17 +80,7 @@ function clearActiveBatchState(batchStatePath) {
|
|
|
79
80
|
* @param {boolean} hard
|
|
80
81
|
*/
|
|
81
82
|
function killLaneWorkers(lanes, hard) {
|
|
82
|
-
|
|
83
|
-
for (const lane of lanes ?? []) {
|
|
84
|
-
if (!lane || typeof lane !== "object") continue;
|
|
85
|
-
const pid = Number(/** @type {{ workerPid?: number }} */ (lane).workerPid);
|
|
86
|
-
if (!Number.isFinite(pid) || pid <= 0) continue;
|
|
87
|
-
try {
|
|
88
|
-
process.kill(pid, signal);
|
|
89
|
-
} catch {
|
|
90
|
-
// process may already be gone
|
|
91
|
-
}
|
|
92
|
-
}
|
|
83
|
+
terminateLaneWorkers(lanes, { hard });
|
|
93
84
|
}
|
|
94
85
|
|
|
95
86
|
/**
|
|
@@ -7,8 +7,22 @@ import path from "node:path";
|
|
|
7
7
|
import { appendJournalEvent } from "./journal.mjs";
|
|
8
8
|
import { resolvePiSpineRoot } from "../config/pi-spine-root.mjs";
|
|
9
9
|
import { readReviewLevel } from "./review.mjs";
|
|
10
|
+
import { writeWorkerDoneMarker, createWorkerLiveLogWriter } from "./worker-output.mjs";
|
|
10
11
|
import { buildWorkerTailPrompt } from "./worker-prompt.mjs";
|
|
11
12
|
|
|
13
|
+
const LIVE_LOG_FLUSH_INTERVAL_MS = 2_000;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} taskFolder
|
|
17
|
+
*/
|
|
18
|
+
function resolveTaskIdFromFolder(taskFolder) {
|
|
19
|
+
return (
|
|
20
|
+
process.env.SPINE_TASK_ID ||
|
|
21
|
+
path.basename(taskFolder).match(/^([A-Z]+-\d+)/)?.[1] ||
|
|
22
|
+
"unknown"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
/**
|
|
13
27
|
* @param {object} params
|
|
14
28
|
* @param {string} params.worktreePath
|
|
@@ -74,11 +88,7 @@ export function createStubAgentSession({ worktreePath, taskFolder, fail = false
|
|
|
74
88
|
"utf-8",
|
|
75
89
|
);
|
|
76
90
|
}
|
|
77
|
-
|
|
78
|
-
donePath,
|
|
79
|
-
`Completed: ${new Date().toISOString()}\nTask: agent-session-stub\n`,
|
|
80
|
-
"utf-8",
|
|
81
|
-
);
|
|
91
|
+
writeWorkerDoneMarker(donePath, { taskId: resolveTaskIdFromFolder(taskFolder) });
|
|
82
92
|
streaming = false;
|
|
83
93
|
},
|
|
84
94
|
subscribe: () => () => {},
|
|
@@ -184,6 +194,31 @@ export function startAgentSessionWorker(
|
|
|
184
194
|
const piSpineRoot = resolvePiSpineRoot(config, projectRoot ?? process.cwd());
|
|
185
195
|
process.env.PI_SPINE_ROOT = piSpineRoot;
|
|
186
196
|
|
|
197
|
+
const liveLogWriter = createWorkerLiveLogWriter({
|
|
198
|
+
projectRoot: journal?.projectRoot ?? projectRoot,
|
|
199
|
+
batchId: journal?.batchId ?? process.env.SPINE_BATCH_ID,
|
|
200
|
+
laneNumber:
|
|
201
|
+
journal?.laneNumber ??
|
|
202
|
+
(process.env.SPINE_LANE_NUMBER ? Number(process.env.SPINE_LANE_NUMBER) : undefined),
|
|
203
|
+
taskId: journal?.taskId ?? process.env.SPINE_TASK_ID ?? resolveTaskIdFromFolder(taskFolder),
|
|
204
|
+
config,
|
|
205
|
+
});
|
|
206
|
+
let lastFlushedTranscriptLength = 0;
|
|
207
|
+
/** @type {ReturnType<typeof setInterval> | null} */
|
|
208
|
+
let liveLogFlushTimer = null;
|
|
209
|
+
|
|
210
|
+
const flushTranscriptToLiveLog = () => {
|
|
211
|
+
if (!liveLogWriter) return;
|
|
212
|
+
const delta = state.transcript.slice(lastFlushedTranscriptLength);
|
|
213
|
+
if (!delta) return;
|
|
214
|
+
liveLogWriter.append(delta);
|
|
215
|
+
lastFlushedTranscriptLength = state.transcript.length;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
if (liveLogWriter) {
|
|
219
|
+
liveLogFlushTimer = setInterval(flushTranscriptToLiveLog, LIVE_LOG_FLUSH_INTERVAL_MS);
|
|
220
|
+
}
|
|
221
|
+
|
|
187
222
|
const donePromise = (async () => {
|
|
188
223
|
try {
|
|
189
224
|
const createAgentSession = await loadCreateAgentSession(deps);
|
|
@@ -258,6 +293,11 @@ export function startAgentSessionWorker(
|
|
|
258
293
|
err instanceof Error ? err.message : String(err),
|
|
259
294
|
);
|
|
260
295
|
} finally {
|
|
296
|
+
if (liveLogFlushTimer) {
|
|
297
|
+
clearInterval(liveLogFlushTimer);
|
|
298
|
+
liveLogFlushTimer = null;
|
|
299
|
+
}
|
|
300
|
+
flushTranscriptToLiveLog();
|
|
261
301
|
state.session?.dispose?.();
|
|
262
302
|
state.session = null;
|
|
263
303
|
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attached engine post-merge SIGTERM survival (SP-316, GitHub #21).
|
|
3
|
+
*
|
|
4
|
+
* When parent shell/tooling sends SIGTERM after the last merge but before the land
|
|
5
|
+
* loop opens the integrate gate, finalize in-process or spawn a detached resume engine.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
import {
|
|
11
|
+
buildAttachedBatchResumeArgv,
|
|
12
|
+
spawnDetachedBatchEngine,
|
|
13
|
+
} from "./detached-start.mjs";
|
|
14
|
+
import { loadGateRecord } from "./gate.mjs";
|
|
15
|
+
import { appendJournalEvent } from "./journal.mjs";
|
|
16
|
+
import {
|
|
17
|
+
finalizeBatchForIntegrate,
|
|
18
|
+
isPostMergeLimbo,
|
|
19
|
+
tryFinalizePostMergeLimbo,
|
|
20
|
+
} from "./post-merge-limbo.mjs";
|
|
21
|
+
import {
|
|
22
|
+
clearBatchEnginePid,
|
|
23
|
+
loadSpineBatchState,
|
|
24
|
+
recordBatchEnginePid,
|
|
25
|
+
saveSpineBatchState,
|
|
26
|
+
} from "./state.mjs";
|
|
27
|
+
|
|
28
|
+
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
29
|
+
|
|
30
|
+
/** @type {boolean} */
|
|
31
|
+
let shutdownHandlerInstalled = false;
|
|
32
|
+
|
|
33
|
+
/** @type {boolean} */
|
|
34
|
+
let shutdownHandoffInFlight = false;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} [spineBin]
|
|
38
|
+
*/
|
|
39
|
+
export function resolveDefaultSpineBin(spineBin) {
|
|
40
|
+
if (spineBin && path.isAbsolute(spineBin)) return spineBin;
|
|
41
|
+
if (spineBin) return path.resolve(spineBin);
|
|
42
|
+
return path.join(PACKAGE_ROOT, "bin", "spine.mjs");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {object} params
|
|
47
|
+
* @param {string} params.projectRoot
|
|
48
|
+
* @param {object} params.state
|
|
49
|
+
* @param {string} params.batchId
|
|
50
|
+
*/
|
|
51
|
+
function postMergeLimboGateMissing({ projectRoot, state, batchId }) {
|
|
52
|
+
if (String(state.phase ?? "") === "completed") return false;
|
|
53
|
+
if (!isPostMergeLimbo(state)) return false;
|
|
54
|
+
return loadGateRecord(projectRoot, batchId) == null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Finalize post-merge limbo in-process when eligible.
|
|
59
|
+
*
|
|
60
|
+
* @param {object} params
|
|
61
|
+
* @param {string} params.projectRoot
|
|
62
|
+
* @param {object} params.state
|
|
63
|
+
* @param {string} params.batchId
|
|
64
|
+
* @param {string} params.orchBranch
|
|
65
|
+
*/
|
|
66
|
+
export function finalizeAttachedPostMergeLimbo({ projectRoot, state, batchId, orchBranch }) {
|
|
67
|
+
if (!postMergeLimboGateMissing({ projectRoot, state, batchId })) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return tryFinalizePostMergeLimbo({
|
|
71
|
+
projectRoot,
|
|
72
|
+
state,
|
|
73
|
+
batchId,
|
|
74
|
+
orchBranch,
|
|
75
|
+
resumed: false,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {object} params
|
|
81
|
+
* @param {string} params.projectRoot
|
|
82
|
+
* @param {string} [params.spineBin]
|
|
83
|
+
* @param {string} [params.signal]
|
|
84
|
+
*/
|
|
85
|
+
export function attemptPostMergeLandLoopHandoff({
|
|
86
|
+
projectRoot,
|
|
87
|
+
spineBin,
|
|
88
|
+
signal = "SIGTERM",
|
|
89
|
+
}) {
|
|
90
|
+
if (shutdownHandoffInFlight) {
|
|
91
|
+
return { handled: false, reason: "handoff_in_flight" };
|
|
92
|
+
}
|
|
93
|
+
shutdownHandoffInFlight = true;
|
|
94
|
+
|
|
95
|
+
const loaded = loadSpineBatchState(projectRoot);
|
|
96
|
+
if (!loaded.raw) {
|
|
97
|
+
shutdownHandoffInFlight = false;
|
|
98
|
+
return { handled: false, reason: "no_active_batch" };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const state = loaded.raw;
|
|
102
|
+
const batchId = String(state.batchId ?? "");
|
|
103
|
+
const orchBranch = String(state.orchBranch ?? "");
|
|
104
|
+
|
|
105
|
+
if (String(state.phase ?? "") === "completed" || loadGateRecord(projectRoot, batchId)) {
|
|
106
|
+
shutdownHandoffInFlight = false;
|
|
107
|
+
return { handled: true, action: "already_finalized", batchId };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!isPostMergeLimbo(state)) {
|
|
111
|
+
shutdownHandoffInFlight = false;
|
|
112
|
+
return { handled: false, reason: "not_post_merge_limbo", batchId };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const finalizeResult = finalizeAttachedPostMergeLimbo({
|
|
116
|
+
projectRoot,
|
|
117
|
+
state,
|
|
118
|
+
batchId,
|
|
119
|
+
orchBranch,
|
|
120
|
+
});
|
|
121
|
+
if (finalizeResult?.ok) {
|
|
122
|
+
clearBatchEnginePid(state);
|
|
123
|
+
saveSpineBatchState(projectRoot, state, { bypassWriteGuard: true });
|
|
124
|
+
appendJournalEvent(projectRoot, batchId, "engine.attached_post_merge_handoff", {
|
|
125
|
+
signal,
|
|
126
|
+
action: "finalized_in_process",
|
|
127
|
+
});
|
|
128
|
+
shutdownHandoffInFlight = false;
|
|
129
|
+
return {
|
|
130
|
+
handled: true,
|
|
131
|
+
action: "finalized_in_process",
|
|
132
|
+
batchId,
|
|
133
|
+
result: finalizeResult,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const resolvedSpineBin = resolveDefaultSpineBin(spineBin);
|
|
138
|
+
const argv = buildAttachedBatchResumeArgv({ force: false });
|
|
139
|
+
const { enginePid, logPath } = spawnDetachedBatchEngine({
|
|
140
|
+
projectRoot,
|
|
141
|
+
spineBin: resolvedSpineBin,
|
|
142
|
+
argv,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const fresh = loadSpineBatchState(projectRoot);
|
|
146
|
+
if (fresh.raw && enginePid) {
|
|
147
|
+
recordBatchEnginePid(fresh.raw, enginePid);
|
|
148
|
+
saveSpineBatchState(projectRoot, fresh.raw, { bypassWriteGuard: true });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
appendJournalEvent(projectRoot, batchId, "engine.attached_post_merge_handoff", {
|
|
152
|
+
signal,
|
|
153
|
+
action: "detached_resume_spawned",
|
|
154
|
+
enginePid,
|
|
155
|
+
logPath,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
shutdownHandoffInFlight = false;
|
|
159
|
+
return {
|
|
160
|
+
handled: true,
|
|
161
|
+
action: "detached_resume_spawned",
|
|
162
|
+
batchId,
|
|
163
|
+
enginePid,
|
|
164
|
+
logPath,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Install SIGTERM/SIGINT handlers for attached batch engines.
|
|
170
|
+
*
|
|
171
|
+
* @param {object} params
|
|
172
|
+
* @param {string} params.projectRoot
|
|
173
|
+
* @param {string} [params.spineBin]
|
|
174
|
+
*/
|
|
175
|
+
export function installAttachedEngineShutdownHandlers({ projectRoot, spineBin }) {
|
|
176
|
+
if (shutdownHandlerInstalled) return;
|
|
177
|
+
shutdownHandlerInstalled = true;
|
|
178
|
+
|
|
179
|
+
const onShutdown = (signal) => {
|
|
180
|
+
const handoff = attemptPostMergeLandLoopHandoff({ projectRoot, spineBin, signal });
|
|
181
|
+
if (handoff.handled) {
|
|
182
|
+
process.exit(0);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
process.once("SIGTERM", () => onShutdown("SIGTERM"));
|
|
187
|
+
process.once("SIGINT", () => onShutdown("SIGINT"));
|
|
188
|
+
}
|