pi-spine 1.3.0 → 1.5.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/bin/spine-cli/verify.mjs +3 -0
- package/bin/spine-deps.mjs +0 -2
- package/bin/spine-rules.mjs +0 -2
- package/bin/spine-settings.mjs +0 -2
- package/bin/spine.mjs +2 -5
- package/package.json +2 -2
- package/skills/create-spine-tasks/SKILL.md +13 -1
- package/skills/create-spine-tasks/references/contract-template.md +6 -3
- package/skills/create-spine-tasks/references/requirements-checklist-template.md +1 -0
- package/src/batch/attached-engine-handoff.mjs +0 -1
- package/src/batch/attached-runner.mjs +1 -1
- package/src/batch/contract-verify.mjs +133 -14
- package/src/batch/diagnosis-retry-limbo.mjs +1 -1
- package/src/batch/diagnosis.mjs +0 -1
- package/src/batch/engine-lanes/commit.mjs +6 -0
- package/src/batch/engine-lanes/merge.mjs +1 -2
- package/src/batch/engine-lanes/review.mjs +57 -34
- package/src/batch/engine-lanes.mjs +0 -2
- package/src/batch/engine.mjs +0 -1
- package/src/batch/evidence.mjs +1 -2
- package/src/batch/git-exec.mjs +5 -2
- package/src/batch/journal-rebuild.mjs +110 -1
- package/src/batch/lane-commit.mjs +6 -5
- package/src/batch/lane-dirty-check.mjs +196 -1
- package/src/batch/reconcile.mjs +0 -1
- package/src/batch/resume-multi.mjs +1 -1
- package/src/batch/resume.mjs +0 -3
- package/src/batch/review-spawn.mjs +1 -1
- package/src/batch/review.mjs +0 -4
- package/src/batch/sequence-waves.mjs +221 -0
- package/src/batch/sequence.mjs +117 -4
- package/src/batch/worker-host.mjs +13 -5
- package/src/cli/deps.mjs +0 -2
- package/src/config/contract.mjs +10 -0
- package/src/dashboard/public/dashboard.css +8 -0
- package/src/dashboard/public/dashboard.js +22 -6
- package/src/dashboard/snapshot.mjs +0 -1
- package/src/tasks/packet/validate-prompt.mjs +0 -1
package/src/batch/git-exec.mjs
CHANGED
|
@@ -5,18 +5,21 @@
|
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
6
|
import { resolveGitCommitEnv } from "./git-commit-env.mjs";
|
|
7
7
|
|
|
8
|
+
const GIT_EXEC_MAX_BUFFER = 10 * 1024 * 1024;
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @param {string} cwd
|
|
10
12
|
* @param {string[]} args
|
|
11
|
-
* @param {{ throwOnError?: boolean; projectRoot?: string }} [options]
|
|
13
|
+
* @param {{ throwOnError?: boolean; projectRoot?: string; maxBuffer?: number }} [options]
|
|
12
14
|
*/
|
|
13
|
-
export function gitExec(cwd, args, { throwOnError = true, projectRoot } = {}) {
|
|
15
|
+
export function gitExec(cwd, args, { throwOnError = true, projectRoot, maxBuffer = GIT_EXEC_MAX_BUFFER } = {}) {
|
|
14
16
|
const identityRoot = projectRoot ?? cwd;
|
|
15
17
|
try {
|
|
16
18
|
return execFileSync("git", args, {
|
|
17
19
|
cwd,
|
|
18
20
|
encoding: "utf-8",
|
|
19
21
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22
|
+
maxBuffer,
|
|
20
23
|
env: { ...process.env, ...resolveGitCommitEnv(identityRoot) },
|
|
21
24
|
}).trim();
|
|
22
25
|
} catch (err) {
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Rebuild batch task/segment status from append-only journal (FR-REL-01/02, PRD §11.4).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { appendJournalEvent, readJournalEvents, STRUCTURAL_JOURNAL_EVENT_TYPES } from "./journal.mjs";
|
|
7
|
+
import { parseReviewVerdict } from "./review-shared.mjs";
|
|
6
8
|
import {
|
|
7
9
|
clearTaskFailureMetadata,
|
|
8
10
|
createInitialBatchState,
|
|
@@ -384,6 +386,113 @@ function classifiedShowsDoneInLaneDrift(classified) {
|
|
|
384
386
|
);
|
|
385
387
|
}
|
|
386
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Detect review.started events that have no matching review.completed for the same
|
|
391
|
+
* taskId + reviewType. These represent engine crashes mid-review where the artifact
|
|
392
|
+
* may exist on disk but the completion was never journaled.
|
|
393
|
+
*
|
|
394
|
+
* @param {object[]} events
|
|
395
|
+
* @returns {object[]} orphaned review.started events
|
|
396
|
+
*/
|
|
397
|
+
export function detectOrphanedReviewStarted(events) {
|
|
398
|
+
/** @type {Map<string, object>} keyed by "taskId:reviewType" */
|
|
399
|
+
const latestStarted = new Map();
|
|
400
|
+
/** @type {Set<string>} */
|
|
401
|
+
const completedKeys = new Set();
|
|
402
|
+
|
|
403
|
+
for (const event of events) {
|
|
404
|
+
const type = String(event?.type ?? "");
|
|
405
|
+
const payload = event.payload && typeof event.payload === "object" ? event.payload : {};
|
|
406
|
+
const taskId = event.taskId ?? payload.taskId;
|
|
407
|
+
if (!taskId) continue;
|
|
408
|
+
const reviewType = payload.reviewType;
|
|
409
|
+
if (!reviewType) continue;
|
|
410
|
+
const key = `${taskId}:${reviewType}`;
|
|
411
|
+
|
|
412
|
+
if (type === "review.started") {
|
|
413
|
+
latestStarted.set(key, event);
|
|
414
|
+
} else if (type === "review.completed") {
|
|
415
|
+
completedKeys.add(key);
|
|
416
|
+
latestStarted.delete(key);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const orphaned = [];
|
|
421
|
+
for (const [key, event] of latestStarted) {
|
|
422
|
+
if (!completedKeys.has(key)) {
|
|
423
|
+
orphaned.push(event);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return orphaned;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** @type {ReadonlySet<string>} Verdicts that indicate a successful review outcome. */
|
|
430
|
+
const APPROVED_VERDICTS = new Set(["APPROVE", "PASS"]);
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Reconcile orphaned review.started events by checking for on-disk artifacts with
|
|
434
|
+
* valid verdicts and synthesizing the missing review.completed + task.completed events.
|
|
435
|
+
* Called at resume time to self-heal after engine crashes mid-review (SP-484 / #131).
|
|
436
|
+
*
|
|
437
|
+
* @param {object} params
|
|
438
|
+
* @param {string} params.projectRoot
|
|
439
|
+
* @param {string} params.batchId
|
|
440
|
+
* @param {object[]} params.events - journal events
|
|
441
|
+
* @returns {{ synthesized: Array<{ taskId: string, reviewType: string, verdict: string, artifactPath: string }> }}
|
|
442
|
+
*/
|
|
443
|
+
export function reconcileOrphanedReviewEvents({ projectRoot, batchId, events }) {
|
|
444
|
+
const orphaned = detectOrphanedReviewStarted(events);
|
|
445
|
+
/** @type {Array<{ taskId: string, reviewType: string, verdict: string, artifactPath: string }>} */
|
|
446
|
+
const synthesized = [];
|
|
447
|
+
|
|
448
|
+
for (const event of orphaned) {
|
|
449
|
+
const payload = event.payload && typeof event.payload === "object" ? event.payload : {};
|
|
450
|
+
const artifactPath = typeof payload.artifactPath === "string" ? payload.artifactPath : "";
|
|
451
|
+
const taskId = event.taskId ?? payload.taskId;
|
|
452
|
+
if (!taskId || !artifactPath) continue;
|
|
453
|
+
if (!fs.existsSync(artifactPath)) continue;
|
|
454
|
+
|
|
455
|
+
let content;
|
|
456
|
+
try {
|
|
457
|
+
content = fs.readFileSync(artifactPath, "utf-8");
|
|
458
|
+
} catch {
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
const reviewType = payload.reviewType ?? "code";
|
|
463
|
+
const { verdict, feedback } = parseReviewVerdict(content, { reviewType });
|
|
464
|
+
if (!verdict || !APPROVED_VERDICTS.has(verdict)) continue;
|
|
465
|
+
|
|
466
|
+
appendJournalEvent(projectRoot, batchId, "review.completed", {
|
|
467
|
+
taskId,
|
|
468
|
+
laneNumber: payload.laneNumber ?? null,
|
|
469
|
+
correlationId: payload.correlationId ?? null,
|
|
470
|
+
stepNumber: payload.stepNumber ?? null,
|
|
471
|
+
reviewType,
|
|
472
|
+
reviewLevel: payload.reviewLevel ?? null,
|
|
473
|
+
verdict,
|
|
474
|
+
feedback: feedback ?? "",
|
|
475
|
+
artifactPath,
|
|
476
|
+
synthesized: true,
|
|
477
|
+
synthesizeReason: "orphaned_review_crash_recovery",
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
appendJournalEvent(projectRoot, batchId, "task.completed", {
|
|
481
|
+
taskId,
|
|
482
|
+
laneNumber: payload.laneNumber ?? null,
|
|
483
|
+
correlationId: payload.correlationId ?? null,
|
|
484
|
+
synthesized: true,
|
|
485
|
+
synthesizeReason: "orphaned_review_crash_recovery",
|
|
486
|
+
exitReason: "done",
|
|
487
|
+
doneFileFound: true,
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
synthesized.push({ taskId, reviewType, verdict, artifactPath });
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return { synthesized };
|
|
494
|
+
}
|
|
495
|
+
|
|
387
496
|
export function detectBatchStateDrift(cachedState, rebuiltState, events = [], classifiedTasks = null) {
|
|
388
497
|
/** @type {DriftEntry[]} */
|
|
389
498
|
const entries = [];
|
|
@@ -6,6 +6,7 @@ import fs from "node:fs";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { execFileSync } from "node:child_process";
|
|
8
8
|
import { filterGitignoredPaths, gitAddFilteredPaths } from "./git-helpers.mjs";
|
|
9
|
+
import { classifyGitignoredPaths, formatGitignoredRemediationMessage } from "./lane-dirty-check.mjs";
|
|
9
10
|
import { gitExec } from "./git-exec.mjs";
|
|
10
11
|
import { parseContract } from "../tasks/packet/parse-prompt.mjs";
|
|
11
12
|
import {
|
|
@@ -39,6 +40,7 @@ export function gitPorcelain(worktreePath) {
|
|
|
39
40
|
cwd: worktreePath,
|
|
40
41
|
encoding: "utf-8",
|
|
41
42
|
stdio: ["ignore", "pipe", "pipe"],
|
|
43
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
42
44
|
}).trim();
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -107,6 +109,7 @@ export function countCommitsAhead(projectRoot, baseRef, headRef) {
|
|
|
107
109
|
cwd: projectRoot,
|
|
108
110
|
encoding: "utf-8",
|
|
109
111
|
stdio: ["ignore", "pipe", "pipe"],
|
|
112
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
110
113
|
}).trim();
|
|
111
114
|
return Number.parseInt(count, 10) || 0;
|
|
112
115
|
}
|
|
@@ -119,6 +122,7 @@ function listIgnoredUntrackedPaths(worktreePath) {
|
|
|
119
122
|
cwd: worktreePath,
|
|
120
123
|
encoding: "utf-8",
|
|
121
124
|
stdio: ["ignore", "pipe", "pipe"],
|
|
125
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
122
126
|
}).trim();
|
|
123
127
|
if (!output) return [];
|
|
124
128
|
return output.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
@@ -201,13 +205,10 @@ export function commitLaneWorktree({
|
|
|
201
205
|
const { stageable, skipped: gitignoredDirtyPaths } = filterGitignoredPaths(worktreePath, dirtyPaths);
|
|
202
206
|
const gitignoredPaths = [...new Set([...gitignoredDirtyPaths, ...ignoredUntrackedPaths])];
|
|
203
207
|
if (stageable.length === 0 && gitignoredPaths.length > 0) {
|
|
204
|
-
const
|
|
205
|
-
const suffix = gitignoredPaths.length > 20 ? "…" : "";
|
|
208
|
+
const { indexTracked, worktreeOnly } = classifyGitignoredPaths(worktreePath, gitignoredPaths);
|
|
206
209
|
return {
|
|
207
210
|
ok: false,
|
|
208
|
-
error:
|
|
209
|
-
`Lane worktree has gitignored dirty files only (${preview}${suffix}) — ` +
|
|
210
|
-
"remove from the index with git rm --cached on the task branch before resume",
|
|
211
|
+
error: formatGitignoredRemediationMessage(indexTracked, worktreeOnly),
|
|
211
212
|
failureClass: "GitignoredDirtyWorktree",
|
|
212
213
|
gitignoredPaths,
|
|
213
214
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Coverage artifacts regenerated by npm test are ephemeral when not in task file scope.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
7
|
import { loadSpineConfig } from "../config/spine-config-load.mjs";
|
|
8
8
|
import { resolveWorktreeSetupHook } from "../config/worktree-setup-hook.mjs";
|
|
9
9
|
import { filterPorcelain, gitPorcelain } from "./lane-commit.mjs";
|
|
@@ -16,6 +16,19 @@ import { runWorktreeSetupHook } from "./worktree.mjs";
|
|
|
16
16
|
*/
|
|
17
17
|
export const COVERAGE_ARTIFACT_MARKERS = ["/coverage/", "coverage/"];
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Path segments for gitignored build artifacts that npm test and similar tools
|
|
21
|
+
* regenerate in lane worktrees (SP-471 / #95).
|
|
22
|
+
*/
|
|
23
|
+
export const GITIGNORED_ARTIFACT_MARKERS = [
|
|
24
|
+
"/node_modules/",
|
|
25
|
+
"node_modules/",
|
|
26
|
+
"/coverage/",
|
|
27
|
+
"coverage/",
|
|
28
|
+
"/__pycache__/",
|
|
29
|
+
"__pycache__/",
|
|
30
|
+
];
|
|
31
|
+
|
|
19
32
|
/**
|
|
20
33
|
* @param {string} filePath
|
|
21
34
|
* @returns {boolean}
|
|
@@ -351,6 +364,188 @@ export function resolveSetupHookSymlinkDriftPorcelain(
|
|
|
351
364
|
return filterSetupHookSymlinkDriftPorcelain(porcelain);
|
|
352
365
|
}
|
|
353
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Split gitignored paths into index-tracked (removable with git rm --cached)
|
|
369
|
+
* and worktree-only (ephemeral artifacts not in the index).
|
|
370
|
+
*
|
|
371
|
+
* @param {string} worktreePath
|
|
372
|
+
* @param {string[]} gitignoredPaths
|
|
373
|
+
* @returns {{ indexTracked: string[], worktreeOnly: string[] }}
|
|
374
|
+
*/
|
|
375
|
+
/**
|
|
376
|
+
* @param {string} filePath
|
|
377
|
+
* @returns {boolean}
|
|
378
|
+
*/
|
|
379
|
+
export function isGitignoredArtifactPath(filePath) {
|
|
380
|
+
if (!filePath || typeof filePath !== "string") return false;
|
|
381
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
382
|
+
return GITIGNORED_ARTIFACT_MARKERS.some(
|
|
383
|
+
(marker) =>
|
|
384
|
+
normalized === marker.slice(0, -1) ||
|
|
385
|
+
normalized.startsWith(marker) ||
|
|
386
|
+
normalized.includes(marker),
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @param {string} filePath
|
|
392
|
+
* @returns {string | null}
|
|
393
|
+
*/
|
|
394
|
+
function gitignoredArtifactRootForPath(filePath) {
|
|
395
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
396
|
+
for (const marker of ["/node_modules/", "/coverage/", "/__pycache__/"]) {
|
|
397
|
+
const markerIdx = normalized.indexOf(marker);
|
|
398
|
+
if (markerIdx >= 0) {
|
|
399
|
+
return normalized.slice(0, markerIdx + marker.length - 1);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (normalized === "node_modules" || normalized.startsWith("node_modules/")) {
|
|
403
|
+
return "node_modules";
|
|
404
|
+
}
|
|
405
|
+
if (normalized === "coverage" || normalized.startsWith("coverage/")) {
|
|
406
|
+
return "coverage";
|
|
407
|
+
}
|
|
408
|
+
if (normalized === "__pycache__" || normalized.startsWith("__pycache__/")) {
|
|
409
|
+
return "__pycache__";
|
|
410
|
+
}
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* @param {string[]} filePaths
|
|
416
|
+
* @returns {string[]}
|
|
417
|
+
*/
|
|
418
|
+
export function listGitignoredArtifactRoots(filePaths) {
|
|
419
|
+
const roots = new Set();
|
|
420
|
+
for (const filePath of filePaths) {
|
|
421
|
+
if (!isGitignoredArtifactPath(filePath)) continue;
|
|
422
|
+
const root = gitignoredArtifactRootForPath(filePath);
|
|
423
|
+
if (root) roots.add(root);
|
|
424
|
+
}
|
|
425
|
+
return [...roots].sort();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @param {string} worktreePath
|
|
430
|
+
* @returns {string[]}
|
|
431
|
+
*/
|
|
432
|
+
function listIgnoredUntrackedPaths(worktreePath) {
|
|
433
|
+
let output = "";
|
|
434
|
+
try {
|
|
435
|
+
output = execFileSync("git", ["ls-files", "-o", "-i", "--exclude-standard"], {
|
|
436
|
+
cwd: worktreePath,
|
|
437
|
+
encoding: "utf-8",
|
|
438
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
439
|
+
}).trim();
|
|
440
|
+
} catch {
|
|
441
|
+
return [];
|
|
442
|
+
}
|
|
443
|
+
if (!output) return [];
|
|
444
|
+
return output.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Auto-clean worktree-only gitignored artifacts under known dirs before lane dirty gate.
|
|
449
|
+
*
|
|
450
|
+
* @param {string} worktreePath
|
|
451
|
+
* @param {{ projectRoot?: string, porcelain?: string, enabled?: boolean }} [options]
|
|
452
|
+
* @returns {{ cleanedRoots: string[] }}
|
|
453
|
+
*/
|
|
454
|
+
export function sanitizeGitignoredArtifactsBeforeLaneCommit(
|
|
455
|
+
worktreePath,
|
|
456
|
+
{ projectRoot, porcelain, enabled = true } = {},
|
|
457
|
+
) {
|
|
458
|
+
if (!enabled) return { cleanedRoots: [] };
|
|
459
|
+
|
|
460
|
+
const identityRoot = projectRoot ?? worktreePath;
|
|
461
|
+
const rawPorcelain = typeof porcelain === "string" ? porcelain : "";
|
|
462
|
+
const dirtyPaths = listPorcelainPaths(rawPorcelain);
|
|
463
|
+
const ignoredUntrackedPaths = listIgnoredUntrackedPaths(worktreePath);
|
|
464
|
+
const gitignoredCandidates = [...new Set([...dirtyPaths, ...ignoredUntrackedPaths])];
|
|
465
|
+
if (gitignoredCandidates.length === 0) {
|
|
466
|
+
return { cleanedRoots: [] };
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
const { worktreeOnly } = classifyGitignoredPaths(worktreePath, gitignoredCandidates);
|
|
470
|
+
const artifactRoots = listGitignoredArtifactRoots(worktreeOnly);
|
|
471
|
+
for (const root of artifactRoots) {
|
|
472
|
+
gitExec(worktreePath, ["clean", "-fdX", "--", root], {
|
|
473
|
+
projectRoot: identityRoot,
|
|
474
|
+
throwOnError: false,
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return { cleanedRoots: artifactRoots };
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export function classifyGitignoredPaths(worktreePath, gitignoredPaths) {
|
|
482
|
+
if (!Array.isArray(gitignoredPaths) || gitignoredPaths.length === 0) {
|
|
483
|
+
return { indexTracked: [], worktreeOnly: [] };
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
let indexedOutput = "";
|
|
487
|
+
try {
|
|
488
|
+
indexedOutput = execFileSync(
|
|
489
|
+
"git",
|
|
490
|
+
["ls-files", "--cached", "--", ...gitignoredPaths],
|
|
491
|
+
{
|
|
492
|
+
cwd: worktreePath,
|
|
493
|
+
encoding: "utf-8",
|
|
494
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
495
|
+
},
|
|
496
|
+
).trim();
|
|
497
|
+
} catch {
|
|
498
|
+
// If ls-files fails, treat all as worktree-only (safe fallback).
|
|
499
|
+
return { indexTracked: [], worktreeOnly: [...gitignoredPaths] };
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
const indexedSet = new Set(
|
|
503
|
+
indexedOutput ? indexedOutput.split("\n").map((l) => l.trim()).filter(Boolean) : [],
|
|
504
|
+
);
|
|
505
|
+
const indexTracked = [];
|
|
506
|
+
const worktreeOnly = [];
|
|
507
|
+
for (const p of gitignoredPaths) {
|
|
508
|
+
if (indexedSet.has(p)) {
|
|
509
|
+
indexTracked.push(p);
|
|
510
|
+
} else {
|
|
511
|
+
worktreeOnly.push(p);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return { indexTracked, worktreeOnly };
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Build a remediation message appropriate for the gitignored path classification.
|
|
519
|
+
*
|
|
520
|
+
* @param {string[]} indexTracked
|
|
521
|
+
* @param {string[]} worktreeOnly
|
|
522
|
+
* @returns {string}
|
|
523
|
+
*/
|
|
524
|
+
export function formatGitignoredRemediationMessage(indexTracked, worktreeOnly) {
|
|
525
|
+
const allPaths = [...indexTracked, ...worktreeOnly];
|
|
526
|
+
const preview = allPaths.slice(0, 20).join(", ");
|
|
527
|
+
const suffix = allPaths.length > 20 ? "…" : "";
|
|
528
|
+
const prefix = `Lane worktree has gitignored dirty files only (${preview}${suffix})`;
|
|
529
|
+
|
|
530
|
+
if (indexTracked.length > 0 && worktreeOnly.length > 0) {
|
|
531
|
+
return (
|
|
532
|
+
`${prefix} — ` +
|
|
533
|
+
`remove index-tracked paths with git rm --cached on the task branch, ` +
|
|
534
|
+
`then git clean -fdX to remove worktree-only artifacts before resume`
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
if (indexTracked.length > 0) {
|
|
538
|
+
return (
|
|
539
|
+
`${prefix} — ` +
|
|
540
|
+
`remove from the index with git rm --cached on the task branch before resume`
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
return (
|
|
544
|
+
`${prefix} — ` +
|
|
545
|
+
`worktree-only artifacts (not in git index); clean with git clean -fdX before resume`
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
354
549
|
export function filterOutOfScopeCoveragePorcelain(porcelain, fileScopePaths, ignorePatterns = []) {
|
|
355
550
|
const afterIgnore = filterPorcelain(porcelain, ignorePatterns);
|
|
356
551
|
if (!afterIgnore?.trim()) return "";
|
package/src/batch/reconcile.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { assessWaveMergeEligibility } from "./engine-scope.mjs";
|
|
|
9
9
|
import { mergeWaveLanesToOrch } from "./engine-lanes.mjs";
|
|
10
10
|
import { recordResumePhaseTransition } from "./resume-common.mjs";
|
|
11
11
|
import { appendJournalEvent, readJournalEvents } from "./journal.mjs";
|
|
12
|
-
import { finalizeResumedBatchForIntegrate
|
|
12
|
+
import { finalizeResumedBatchForIntegrate } from "./post-merge-limbo.mjs";
|
|
13
13
|
import {
|
|
14
14
|
succeededWaveMergeIndices,
|
|
15
15
|
waveTasksAllTerminal,
|
package/src/batch/resume.mjs
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
* Batch pause and resume for single-lane batches (TP-015, PRD §18.2).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import fs from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
7
6
|
import crypto from "node:crypto";
|
|
8
7
|
import { loadSpineConfig } from "../config/spine-config-load.mjs";
|
|
9
8
|
import { DEFAULT_TASKS_ROOT } from "../config/spine-init-constants.mjs";
|
|
10
|
-
import { resolveTasksRoot } from "../config/spine-preflight-lib.mjs";
|
|
11
9
|
import { installAttachedEngineShutdownHandlers } from "./attached-engine-handoff.mjs";
|
|
12
10
|
import { enforceAttachedEngineSingleOwner, finalizeResumePostMergeLimbo } from "./attached-runner.mjs";
|
|
13
11
|
import { openIntegrateGateAfterBatchComplete } from "./gate.mjs";
|
|
@@ -97,7 +95,6 @@ export async function resumeBatch({ projectRoot, force = false }) {
|
|
|
97
95
|
const taskId = task.taskId;
|
|
98
96
|
const taskBranch = lane.branch ?? laneTaskBranch(batchId, 1);
|
|
99
97
|
const wt = lane.worktreePath ?? laneWorktreePath(projectRoot, batchId, 1);
|
|
100
|
-
const tasksRoot = resolveTasksRoot(projectRoot, configResult);
|
|
101
98
|
const taskFolderRel = resolveTaskFolderRel(task, projectRoot);
|
|
102
99
|
const tasksRootRel = config.paths?.tasksRoot ?? DEFAULT_TASKS_ROOT;
|
|
103
100
|
const taskFolderInWorktree = taskFolderRel
|
package/src/batch/review.mjs
CHANGED
|
@@ -11,18 +11,14 @@ import { buildReviewerContext } from "../config/reviewer-context.mjs";
|
|
|
11
11
|
import { resolveReviewScopePaths } from "./review-scope.mjs";
|
|
12
12
|
import { commandExists as pathCommandExists } from "../util/command-exists.mjs";
|
|
13
13
|
import {
|
|
14
|
-
DEFAULT_REVIEW_SPAWN_TIMEOUT_MS,
|
|
15
14
|
ARTIFACT_READY_HONOR_REASON,
|
|
16
|
-
isActiveWorkerSession,
|
|
17
15
|
NESTED_REVIEW_SPAWN_BLOCKED,
|
|
18
16
|
NESTED_REVIEW_SPAWN_REASON,
|
|
19
17
|
REVIEW_SPAWN_TIMEOUT_EXIT_CODE,
|
|
20
|
-
REVIEW_TIMEOUT_REASON,
|
|
21
18
|
shouldBlockNestedReviewerSpawn,
|
|
22
19
|
spawnReviewerPi,
|
|
23
20
|
} from "./review-spawn.mjs";
|
|
24
21
|
import {
|
|
25
|
-
REVIEW_LEVEL_RE,
|
|
26
22
|
buildFinalReviewArtifactPath,
|
|
27
23
|
buildReviewArtifactPath,
|
|
28
24
|
isReviewTypeRequired,
|