pi-spine 2.20.0 → 2.22.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 +7 -5
- package/package.json +8 -8
- package/skills/spine-autonomous-operator/references/agent-shell-batch-policy.md +2 -0
- package/skills/spine-orchestrate-waves/SKILL.md +2 -0
- package/skills/spine-release-operator/SKILL.md +26 -10
- package/skills/spine-release-operator/references/issue-intake-checklist.md +46 -0
- package/skills/spine-release-operator/references/release-manifest-template.md +12 -0
- package/skills/spine-release-operator/references/release-profiles.md +6 -2
- package/skills/spine-release-operator/scripts/collect-release-intake.sh +44 -0
- package/src/batch/diagnosis-primary-failure.mjs +34 -3
- package/src/batch/diagnosis-suggested-command.mjs +2 -0
- package/src/batch/evidence-command.mjs +5 -2
- package/src/batch/journal-rebuild-structural.mjs +13 -2
- package/src/batch/reconcile-diagnosis-enrich.mjs +173 -0
- package/src/batch/reconcile-diagnosis.mjs +63 -135
- package/src/batch/salvage-batch-integrate-heal.mjs +116 -0
- package/src/batch/salvage-batch-integrate.mjs +18 -0
- package/src/cli/wait.mjs +163 -1
- package/src/config/preflight/tracked-gitignored.mjs +178 -0
- package/src/config/spine-preflight-lib.mjs +9 -0
- package/src/doctor/run-doctor-checks.mjs +5 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
const TRACKED_GITIGNORED_CHECK_ID = "tracked-gitignored";
|
|
4
|
+
const TRACKED_GITIGNORED_LABEL = "tracked gitignored paths";
|
|
5
|
+
const PREVIEW_LIMIT = 3;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {object} TrackedGitignoredPathsResult
|
|
9
|
+
* @property {string[]} paths Tracked paths that also match ignore patterns.
|
|
10
|
+
* @property {string | null} error Non-null when the git query itself failed.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {object} TrackedGitignoredPreflightCheck
|
|
15
|
+
* @property {"tracked-gitignored"} id
|
|
16
|
+
* @property {true} ok Always advisory — this check never blocks preflight (#289).
|
|
17
|
+
* @property {string} message
|
|
18
|
+
* @property {true} [warning]
|
|
19
|
+
* @property {{ paths: string[] }} [details]
|
|
20
|
+
* @property {string} [suggestedCommand]
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {object} TrackedGitignoredDoctorCheck
|
|
25
|
+
* @property {"tracked gitignored paths"} label
|
|
26
|
+
* @property {true} ok Always advisory — this check never increments issueCount (#289).
|
|
27
|
+
* @property {true} [warning]
|
|
28
|
+
* @property {string} detail
|
|
29
|
+
* @property {string} [suggestedCommand]
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {"tracked-gitignored"} id
|
|
34
|
+
* @param {true} ok
|
|
35
|
+
* @param {string} message
|
|
36
|
+
* @param {Partial<Omit<TrackedGitignoredPreflightCheck, "id" | "ok" | "message">>} [extra]
|
|
37
|
+
* @returns {TrackedGitignoredPreflightCheck}
|
|
38
|
+
*/
|
|
39
|
+
function makeCheck(id, ok, message, extra = {}) {
|
|
40
|
+
return { id, ok, message, ...extra };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* List tracked files that also match .gitignore / exclude patterns (issue #289).
|
|
45
|
+
*
|
|
46
|
+
* Bare `git ls-files -i` is fatal on supported git versions ("ls-files -i must
|
|
47
|
+
* be used with either -o or -c"), so `-c` is passed explicitly: the signal we
|
|
48
|
+
* want is exactly "tracked AND ignore-matched". Files that were committed
|
|
49
|
+
* before being ignored keep mutating in lane worktrees and can fail
|
|
50
|
+
* DirtyWorktree after a PASS.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} projectRoot
|
|
53
|
+
* @returns {TrackedGitignoredPathsResult}
|
|
54
|
+
*/
|
|
55
|
+
export function listTrackedGitignoredPaths(projectRoot) {
|
|
56
|
+
try {
|
|
57
|
+
const output = execFileSync(
|
|
58
|
+
"git",
|
|
59
|
+
["ls-files", "-i", "-c", "--exclude-standard"],
|
|
60
|
+
{
|
|
61
|
+
cwd: projectRoot,
|
|
62
|
+
encoding: "utf-8",
|
|
63
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
64
|
+
timeout: 5000,
|
|
65
|
+
},
|
|
66
|
+
).trim();
|
|
67
|
+
const paths = output
|
|
68
|
+
.split(/\r?\n/)
|
|
69
|
+
.map((line) => line.trim())
|
|
70
|
+
.filter(Boolean);
|
|
71
|
+
return { paths, error: null };
|
|
72
|
+
} catch (err) {
|
|
73
|
+
return {
|
|
74
|
+
paths: [],
|
|
75
|
+
error: err instanceof Error ? err.message : String(err),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Bounded remediation command: untrack while keeping the working copy, letting
|
|
82
|
+
* .gitignore keep it out of future commits (#289).
|
|
83
|
+
*
|
|
84
|
+
* @param {string[]} paths
|
|
85
|
+
* @returns {string}
|
|
86
|
+
*/
|
|
87
|
+
export function trackedGitignoredRemediation(paths) {
|
|
88
|
+
return `git rm -r --cached -- ${paths.slice(0, PREVIEW_LIMIT).join(" ")}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {string[]} paths
|
|
93
|
+
* @returns {string}
|
|
94
|
+
*/
|
|
95
|
+
function previewWithSuffix(paths) {
|
|
96
|
+
const preview = paths.slice(0, PREVIEW_LIMIT).join(", ");
|
|
97
|
+
const suffix =
|
|
98
|
+
paths.length > PREVIEW_LIMIT ? ` +${paths.length - PREVIEW_LIMIT} more` : "";
|
|
99
|
+
return `${preview}${suffix}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Advisory preflight check (#289): warn when tracked paths also match
|
|
104
|
+
* .gitignore. Non-blocking by default — operators may track such paths on
|
|
105
|
+
* purpose, so the check never fails; it only suggests the untrack remediation.
|
|
106
|
+
*
|
|
107
|
+
* @param {object} ctx
|
|
108
|
+
* @param {string} ctx.projectRoot
|
|
109
|
+
* @returns {TrackedGitignoredPreflightCheck}
|
|
110
|
+
*/
|
|
111
|
+
export function checkTrackedGitignoredWarn(ctx) {
|
|
112
|
+
const { projectRoot } = ctx;
|
|
113
|
+
const { paths, error } = listTrackedGitignoredPaths(projectRoot);
|
|
114
|
+
|
|
115
|
+
if (error) {
|
|
116
|
+
return makeCheck(
|
|
117
|
+
TRACKED_GITIGNORED_CHECK_ID,
|
|
118
|
+
true,
|
|
119
|
+
`tracked gitignored check skipped: ${error}`,
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
if (paths.length === 0) {
|
|
123
|
+
return makeCheck(
|
|
124
|
+
TRACKED_GITIGNORED_CHECK_ID,
|
|
125
|
+
true,
|
|
126
|
+
"no tracked files match .gitignore",
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return makeCheck(
|
|
131
|
+
TRACKED_GITIGNORED_CHECK_ID,
|
|
132
|
+
true,
|
|
133
|
+
`${paths.length} tracked file(s) also match .gitignore (${previewWithSuffix(paths)}) — they mutate outside version control and can fail DirtyWorktree after PASS; untrack but keep working copies, relying on .gitignore`,
|
|
134
|
+
{
|
|
135
|
+
warning: true,
|
|
136
|
+
details: { paths },
|
|
137
|
+
suggestedCommand: trackedGitignoredRemediation(paths),
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Doctor advisory (#289) — same signal as checkTrackedGitignoredWarn, shaped
|
|
144
|
+
* for doctor output ({label, ok, warning, detail, suggestedCommand}).
|
|
145
|
+
*
|
|
146
|
+
* @param {object} ctx
|
|
147
|
+
* @param {string} ctx.projectRoot
|
|
148
|
+
* @returns {TrackedGitignoredDoctorCheck}
|
|
149
|
+
*/
|
|
150
|
+
export function buildTrackedGitignoredDoctorCheck(ctx) {
|
|
151
|
+
const { projectRoot } = ctx;
|
|
152
|
+
const { paths, error } = listTrackedGitignoredPaths(projectRoot);
|
|
153
|
+
|
|
154
|
+
if (error) {
|
|
155
|
+
return {
|
|
156
|
+
label: TRACKED_GITIGNORED_LABEL,
|
|
157
|
+
ok: true,
|
|
158
|
+
detail: `skipped: ${error}`,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (paths.length === 0) {
|
|
162
|
+
return {
|
|
163
|
+
label: TRACKED_GITIGNORED_LABEL,
|
|
164
|
+
ok: true,
|
|
165
|
+
detail: "none",
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
label: TRACKED_GITIGNORED_LABEL,
|
|
171
|
+
ok: true,
|
|
172
|
+
warning: true,
|
|
173
|
+
detail:
|
|
174
|
+
`${paths.length} tracked file(s) also match .gitignore (${previewWithSuffix(paths)}) — ` +
|
|
175
|
+
"untrack but keep working copies, relying on .gitignore",
|
|
176
|
+
suggestedCommand: trackedGitignoredRemediation(paths),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
runPreflightPlanCheck,
|
|
30
30
|
} from "./preflight/integrate-plan.mjs";
|
|
31
31
|
import { checkLocCapstoneReadiness } from "./preflight/loc-capstone.mjs";
|
|
32
|
+
import { checkTrackedGitignoredWarn } from "./preflight/tracked-gitignored.mjs";
|
|
32
33
|
import { INTEGRATE_DEFAULTS } from "./defaults.mjs";
|
|
33
34
|
import { parseContract } from "../tasks/packet/parse-prompt.mjs";
|
|
34
35
|
import { hasReleaseCriticalContract, isStubWorkerMode } from "../batch/contract-verify.mjs";
|
|
@@ -78,6 +79,13 @@ export {
|
|
|
78
79
|
listPendingLocCapstoneTasks,
|
|
79
80
|
} from "./preflight/loc-capstone.mjs";
|
|
80
81
|
|
|
82
|
+
export {
|
|
83
|
+
buildTrackedGitignoredDoctorCheck,
|
|
84
|
+
checkTrackedGitignoredWarn,
|
|
85
|
+
listTrackedGitignoredPaths,
|
|
86
|
+
trackedGitignoredRemediation,
|
|
87
|
+
} from "./preflight/tracked-gitignored.mjs";
|
|
88
|
+
|
|
81
89
|
const CONCURRENT_DEV_LABEL = "concurrent development on base branch";
|
|
82
90
|
|
|
83
91
|
/**
|
|
@@ -355,6 +363,7 @@ export function runBatchPreflight(options) {
|
|
|
355
363
|
checks.push(checkStalePathSpine(ctx));
|
|
356
364
|
|
|
357
365
|
checks.push(checkGitClean(ctx));
|
|
366
|
+
checks.push(checkTrackedGitignoredWarn(ctx));
|
|
358
367
|
checks.push(
|
|
359
368
|
buildCoexistencePreflightCheck({
|
|
360
369
|
projectRoot,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { buildStalePathDoctorCheck } from "./stale-path.mjs";
|
|
18
18
|
import { buildCoexistenceDoctorCheck } from "./coexistence.mjs";
|
|
19
19
|
import { buildConcurrentDevDoctorCheck } from "../config/spine-preflight-lib.mjs";
|
|
20
|
+
import { buildTrackedGitignoredDoctorCheck } from "../config/preflight/tracked-gitignored.mjs";
|
|
20
21
|
import { buildTaskPacketSizeDoctorCheck } from "./task-packet-size.mjs";
|
|
21
22
|
import {
|
|
22
23
|
buildPiWorkerTimeoutDoctorCheck,
|
|
@@ -576,6 +577,10 @@ export function runDoctorChecks(projectRoot = process.cwd()) {
|
|
|
576
577
|
} catch {
|
|
577
578
|
// Git ls-files unavailable; skip tracked-metrics advisory.
|
|
578
579
|
}
|
|
580
|
+
|
|
581
|
+
// Advisory only (#289): tracked files that also match .gitignore mutate in
|
|
582
|
+
// lane worktrees and fail DirtyWorktree after PASS; warn with remediation.
|
|
583
|
+
checks.push(buildTrackedGitignoredDoctorCheck({ projectRoot }));
|
|
579
584
|
}
|
|
580
585
|
|
|
581
586
|
const rulesRootPath = path.join(projectRoot, CURSOR_RULES_ROOT_REL);
|