pi-spine 1.0.2 → 1.1.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 +61 -489
- package/bin/get-version.mjs +1 -13
- package/bin/spine-batch.mjs +5 -1
- package/bin/spine-config.mjs +1 -212
- package/bin/spine-doctor.mjs +2 -418
- package/bin/spine-init.mjs +1 -398
- package/bin/spine-preflight.mjs +1 -700
- package/bin/spine-review-step.mjs +6 -4
- package/bin/spine-tasks.mjs +96 -11
- package/bin/spine-worker-runner.mjs +14 -4
- package/bin/spine.mjs +3 -1
- package/extensions/spine/worker-tools.ts +14 -12
- package/package.json +5 -2
- package/skills/create-spine-tasks/SKILL.md +135 -6
- package/skills/create-spine-tasks/references/clarify-template.md +73 -0
- package/skills/create-spine-tasks/references/prompt-template.md +2 -0
- package/skills/create-spine-tasks/references/requirements-checklist-template.md +94 -0
- package/src/batch/abort.mjs +1 -1
- package/src/batch/detached-start.mjs +41 -7
- package/src/batch/diagnosis.mjs +51 -6
- package/src/batch/engine-lanes/merge.mjs +70 -7
- package/src/batch/engine-lanes/review.mjs +32 -74
- package/src/batch/engine-scope.mjs +31 -4
- package/src/batch/engine.mjs +40 -48
- package/src/batch/evidence.mjs +3 -2
- package/src/batch/gate.mjs +3 -3
- package/src/batch/integrate.mjs +1 -1
- package/src/batch/journal.mjs +22 -0
- package/src/batch/lifecycle.mjs +1 -1
- package/src/batch/merge/adoption-doc-merge.mjs +160 -0
- package/src/batch/merge/wave-merge-state.mjs +105 -0
- package/src/batch/post-merge-limbo.mjs +87 -15
- package/src/batch/reconcile.mjs +50 -2
- package/src/batch/resume-common.mjs +1 -1
- package/src/batch/resume-engine.mjs +58 -1
- package/src/batch/resume-multi-validate.mjs +82 -3
- package/src/batch/resume-multi.mjs +36 -40
- package/src/batch/resume.mjs +20 -10
- package/src/batch/review-shared.mjs +196 -0
- package/src/batch/review-spawn.mjs +320 -0
- package/src/batch/review.mjs +178 -212
- package/src/batch/task-stall-budget.mjs +72 -0
- package/src/batch/worker-host.mjs +94 -34
- package/src/batch/worktree.mjs +10 -0
- package/src/cli/handoff.mjs +1 -1
- package/src/cli/rules.mjs +1 -1
- package/src/cli/settings-set.mjs +1 -1
- package/src/cli/settings-slash.mjs +27 -5
- package/src/config/spine-config-load.mjs +221 -0
- package/src/config/spine-init-constants.mjs +423 -0
- package/src/config/spine-preflight-lib.mjs +725 -0
- package/src/dashboard/public/dashboard.js +4 -25
- package/src/dashboard/public/index.html +1 -7
- package/src/dashboard/snapshot.mjs +172 -5
- package/src/dashboard/view.mjs +2 -0
- package/src/doctor/run-doctor-checks.mjs +458 -0
- package/src/doctor/stale-path.mjs +22 -0
- package/src/migrate/taskplane-config.mjs +1 -1
- package/src/planner/pending.mjs +92 -1
- package/src/tasks/analyze/index.mjs +453 -0
- package/src/util/command-exists.mjs +19 -0
- package/templates/docs/constitution.md +61 -0
- package/templates/spine-config.json +1 -1
|
@@ -32,7 +32,7 @@ export function parseReviewStepArgs(argv) {
|
|
|
32
32
|
/**
|
|
33
33
|
* @param {object} options
|
|
34
34
|
*/
|
|
35
|
-
export function runSpineReviewStep(options) {
|
|
35
|
+
export async function runSpineReviewStep(options) {
|
|
36
36
|
const taskFolder = options.taskFolder ?? process.env.SPINE_TASK_FOLDER;
|
|
37
37
|
const worktreePath = options.worktreePath ?? process.env.SPINE_WORKTREE ?? process.cwd();
|
|
38
38
|
if (!taskFolder) {
|
|
@@ -63,7 +63,7 @@ export function runSpineReviewStep(options) {
|
|
|
63
63
|
|
|
64
64
|
const journal = options.journal ?? resolveBatchJournalContext();
|
|
65
65
|
|
|
66
|
-
const result = runStepReview({
|
|
66
|
+
const result = await runStepReview({
|
|
67
67
|
taskFolder,
|
|
68
68
|
worktreePath,
|
|
69
69
|
stepNumber: args.step,
|
|
@@ -91,7 +91,9 @@ export function runSpineReviewStep(options) {
|
|
|
91
91
|
} else if (result.spawnFailed) {
|
|
92
92
|
output = `REVIEW FAILED: ${result.error}\n`;
|
|
93
93
|
} else if (result.skipped) {
|
|
94
|
-
output =
|
|
94
|
+
output = result.feedback
|
|
95
|
+
? `SKIPPED: ${result.feedback}\n`
|
|
96
|
+
: "SKIPPED (review level does not require this review type)\n";
|
|
95
97
|
} else {
|
|
96
98
|
output = `${result.verdict ?? "UNKNOWN"}: ${result.feedback || ""}\n`;
|
|
97
99
|
}
|
|
@@ -118,7 +120,7 @@ function findProjectRoot(startPath) {
|
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
if (isCliEntrypoint(import.meta.url)) {
|
|
121
|
-
const { exitCode, output } = runSpineReviewStep({});
|
|
123
|
+
const { exitCode, output } = await runSpineReviewStep({});
|
|
122
124
|
process.stdout.write(output ?? "");
|
|
123
125
|
process.exit(exitCode);
|
|
124
126
|
}
|
package/bin/spine-tasks.mjs
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { c, isCliEntrypoint, writeCommandResult } from './spine-cli/shared.mjs';
|
|
9
9
|
import { loadSpineConfig } from './spine-config.mjs';
|
|
10
10
|
import { resolveTasksRootPath } from '../src/config/env-overrides.mjs';
|
|
11
|
+
import { analyzeTasksScope } from '../src/tasks/analyze/index.mjs';
|
|
11
12
|
import {
|
|
12
13
|
collectPromptValidationFailure,
|
|
13
14
|
discoverTasks,
|
|
@@ -105,28 +106,40 @@ export function buildTasksValidateResult({ scope, tasks }) {
|
|
|
105
106
|
|
|
106
107
|
export function printTasksHelp() {
|
|
107
108
|
console.log(`
|
|
108
|
-
${c.bold}spine tasks${c.reset} — validate task PROMPT packets (FR-UXB-02)
|
|
109
|
+
${c.bold}spine tasks${c.reset} — validate and analyze task PROMPT packets (FR-UXB-02)
|
|
109
110
|
|
|
110
111
|
${c.bold}Usage:${c.reset}
|
|
111
112
|
spine tasks validate <scope> [--json] [--warnings-only]
|
|
113
|
+
spine tasks analyze <scope> [--json]
|
|
112
114
|
|
|
113
115
|
${c.bold}Scope:${c.reset}
|
|
114
116
|
Same resolution as ${c.cyan}spine plan${c.reset}: all, pending, task IDs, globs.
|
|
115
117
|
|
|
116
|
-
${c.bold}
|
|
118
|
+
${c.bold}Validate options:${c.reset}
|
|
117
119
|
--json Emit TasksValidateResult JSON (handoff §6.4)
|
|
118
120
|
--warnings-only Include non-blocking P1 checks as warnings:
|
|
119
121
|
folder name ≠ heading ID, missing STATUS.md, deps mismatch
|
|
120
122
|
|
|
121
|
-
${c.bold}
|
|
123
|
+
${c.bold}Analyze:${c.reset}
|
|
124
|
+
Deterministic structural checks: parallel file-scope overlap, dependency cycles,
|
|
125
|
+
orphan task IDs (blocking); wave M-count, explore refs, PROMPT/JSON deps drift (warnings).
|
|
126
|
+
|
|
127
|
+
${c.bold}Exit codes (validate):${c.reset}
|
|
122
128
|
0 all selected tasks pass
|
|
123
129
|
1 one or more PROMPT validation failures
|
|
124
130
|
2 config, tasksRoot, or scope resolution error
|
|
125
131
|
|
|
132
|
+
${c.bold}Exit codes (analyze):${c.reset}
|
|
133
|
+
0 no blocking findings (warnings alone exit 0)
|
|
134
|
+
1 one or more blocking findings
|
|
135
|
+
2 config, tasksRoot, or scope resolution error
|
|
136
|
+
|
|
126
137
|
${c.bold}Examples:${c.reset}
|
|
127
138
|
spine tasks validate all
|
|
128
139
|
spine tasks validate pending --warnings-only
|
|
129
140
|
spine tasks validate FX-101 --json
|
|
141
|
+
spine tasks analyze pending
|
|
142
|
+
spine tasks analyze all --json
|
|
130
143
|
`);
|
|
131
144
|
}
|
|
132
145
|
|
|
@@ -254,17 +267,44 @@ export async function runSpineTasksValidate({
|
|
|
254
267
|
}
|
|
255
268
|
|
|
256
269
|
/**
|
|
257
|
-
* @param {string
|
|
270
|
+
* @param {string} message
|
|
271
|
+
* @param {{ suggestedCommand?: string, exitCode?: number }} [options]
|
|
258
272
|
*/
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
273
|
+
function throwTasksAnalyzeError(message, { suggestedCommand, exitCode = 2 } = {}) {
|
|
274
|
+
const err = new Error(message);
|
|
275
|
+
if (suggestedCommand) err.suggestedCommand = suggestedCommand;
|
|
276
|
+
err.exitCode = exitCode;
|
|
277
|
+
throw err;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @param {{ projectRoot?: string, scope?: string, json?: boolean }} [args]
|
|
282
|
+
*/
|
|
283
|
+
export async function runSpineTasksAnalyze({
|
|
284
|
+
projectRoot = process.cwd(),
|
|
285
|
+
scope = 'all',
|
|
286
|
+
json = false,
|
|
287
|
+
} = {}) {
|
|
288
|
+
try {
|
|
289
|
+
const analyzeResult = await analyzeTasksScope({ projectRoot, scope });
|
|
290
|
+
const output = json
|
|
291
|
+
? JSON.stringify(analyzeResult.result, null, 2) + '\n'
|
|
292
|
+
: analyzeResult.output;
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
...analyzeResult,
|
|
296
|
+
output,
|
|
297
|
+
};
|
|
298
|
+
} catch (err) {
|
|
299
|
+
if (err?.exitCode != null) throw err;
|
|
300
|
+
throwTasksAnalyzeError(err?.message ?? String(err));
|
|
266
301
|
}
|
|
302
|
+
}
|
|
267
303
|
|
|
304
|
+
/**
|
|
305
|
+
* @param {string[]} args
|
|
306
|
+
*/
|
|
307
|
+
async function handleTasksValidate(args) {
|
|
268
308
|
const json = args.includes('--json');
|
|
269
309
|
const warningsOnly = args.includes('--warnings-only');
|
|
270
310
|
const scope = args.filter((a) => !a.startsWith('--')).slice(1).join(' ') || 'all';
|
|
@@ -288,6 +328,51 @@ export async function handleTasks(args) {
|
|
|
288
328
|
}
|
|
289
329
|
}
|
|
290
330
|
|
|
331
|
+
/**
|
|
332
|
+
* @param {string[]} args
|
|
333
|
+
*/
|
|
334
|
+
async function handleTasksAnalyze(args) {
|
|
335
|
+
const json = args.includes('--json');
|
|
336
|
+
const scope = args.filter((a) => !a.startsWith('--')).slice(1).join(' ') || 'all';
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
const result = await runSpineTasksAnalyze({
|
|
340
|
+
projectRoot: process.cwd(),
|
|
341
|
+
scope,
|
|
342
|
+
json,
|
|
343
|
+
});
|
|
344
|
+
writeCommandResult(result);
|
|
345
|
+
} catch (err) {
|
|
346
|
+
const msg = err?.message ?? String(err);
|
|
347
|
+
if (err?.suggestedCommand) {
|
|
348
|
+
console.error(`Error: ${msg}\nSuggested: ${err.suggestedCommand}`);
|
|
349
|
+
} else {
|
|
350
|
+
console.error(`Error: ${msg}`);
|
|
351
|
+
}
|
|
352
|
+
process.exit(err?.exitCode ?? 2);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* @param {string[]} args
|
|
358
|
+
*/
|
|
359
|
+
export async function handleTasks(args) {
|
|
360
|
+
const sub = args[0];
|
|
361
|
+
if (sub === 'validate') {
|
|
362
|
+
await handleTasksValidate(args);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (sub === 'analyze') {
|
|
366
|
+
await handleTasksAnalyze(args);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const { die } = await import('./spine-cli/shared.mjs');
|
|
371
|
+
die(
|
|
372
|
+
`Unknown tasks subcommand: ${sub ?? '(none)'}\nRun ${c.cyan}spine help tasks${c.reset} for usage.`,
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
291
376
|
if (isCliEntrypoint(import.meta.url)) {
|
|
292
377
|
handleTasks(process.argv.slice(2));
|
|
293
378
|
}
|
|
@@ -125,11 +125,11 @@ function resolveTaskFileScope(taskFolder) {
|
|
|
125
125
|
return parsePrompt(fs.readFileSync(promptPath, "utf-8")).fileScope ?? [];
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
function enforceStubReviewIfConfigured(taskFolder, worktreePath) {
|
|
128
|
+
async function enforceStubReviewIfConfigured(taskFolder, worktreePath) {
|
|
129
129
|
if (process.env.SPINE_WORKER_STUB_ENFORCE_REVIEW !== "1") return;
|
|
130
130
|
if (readReviewLevel(taskFolder) <= 0) return;
|
|
131
131
|
|
|
132
|
-
const reviewResult = runStepReview({
|
|
132
|
+
const reviewResult = await runStepReview({
|
|
133
133
|
taskFolder,
|
|
134
134
|
worktreePath: worktreePath || process.cwd(),
|
|
135
135
|
stepNumber: Number(process.env.SPINE_WORKER_STUB_REVIEW_STEP || 1),
|
|
@@ -200,12 +200,22 @@ async function runWorkerRunner() {
|
|
|
200
200
|
// Separate poll epochs: checkpoint progress first, then file-scope activity only.
|
|
201
201
|
spawnSync("sleep", ["4"], { stdio: "ignore" });
|
|
202
202
|
const scopeRel = process.env.SPINE_WORKER_STUB_FILE_SCOPE;
|
|
203
|
+
const postScopeMs = Number(process.env.SPINE_WORKER_STUB_SAT020_POST_SCOPE_MS || 10_000);
|
|
204
|
+
const scopeBumpMs = Math.min(5_000, Math.max(0, postScopeMs));
|
|
205
|
+
const postScopeRemainderMs = Math.max(0, postScopeMs - scopeBumpMs);
|
|
203
206
|
if (scopeRel && worktreePath) {
|
|
204
207
|
const scopePath = path.join(worktreePath, scopeRel);
|
|
205
208
|
fs.mkdirSync(path.dirname(scopePath), { recursive: true });
|
|
206
209
|
fs.writeFileSync(scopePath, `sat020 scope touch ${new Date().toISOString()}\n`, "utf-8");
|
|
210
|
+
if (scopeBumpMs > 0) {
|
|
211
|
+
spawnSync("sleep", [String(scopeBumpMs / 1000)], { stdio: "ignore" });
|
|
212
|
+
// Second touch gives the host a fresh activity epoch after step_completed settles.
|
|
213
|
+
fs.writeFileSync(scopePath, `sat020 scope touch ${new Date().toISOString()}\n`, "utf-8");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (postScopeRemainderMs > 0) {
|
|
217
|
+
spawnSync("sleep", [String(postScopeRemainderMs / 1000)], { stdio: "ignore" });
|
|
207
218
|
}
|
|
208
|
-
spawnSync("sleep", ["10"], { stdio: "ignore" });
|
|
209
219
|
}
|
|
210
220
|
|
|
211
221
|
const delayMs = Number(process.env.SPINE_WORKER_STUB_DELAY_MS || 0);
|
|
@@ -244,7 +254,7 @@ async function runWorkerRunner() {
|
|
|
244
254
|
);
|
|
245
255
|
}
|
|
246
256
|
|
|
247
|
-
enforceStubReviewIfConfigured(taskFolder, worktreePath);
|
|
257
|
+
await enforceStubReviewIfConfigured(taskFolder, worktreePath);
|
|
248
258
|
|
|
249
259
|
const donePath = path.join(taskFolder, ".DONE");
|
|
250
260
|
fs.writeFileSync(
|
package/bin/spine.mjs
CHANGED
|
@@ -91,7 +91,7 @@ async function cmdReview(args) {
|
|
|
91
91
|
die(`Unknown review subcommand: ${sub ?? "(none)"}\nRun ${c.cyan}spine review step --step N${c.reset} for usage.`);
|
|
92
92
|
}
|
|
93
93
|
const { runSpineReviewStep } = await import("./spine-review-step.mjs");
|
|
94
|
-
const result = runSpineReviewStep({ projectRoot: process.cwd(), args: args.slice(1) });
|
|
94
|
+
const result = await runSpineReviewStep({ projectRoot: process.cwd(), args: args.slice(1) });
|
|
95
95
|
process.stdout.write(result.output ?? "");
|
|
96
96
|
if (result.exitCode !== 0) process.exit(result.exitCode);
|
|
97
97
|
}
|
|
@@ -298,6 +298,8 @@ ${c.bold}Examples:${c.reset}
|
|
|
298
298
|
spine dashboard --json # one-shot snapshot JSON
|
|
299
299
|
spine tasks validate pending # validate pending task PROMPTs
|
|
300
300
|
spine tasks validate all --json # structured TasksValidateResult
|
|
301
|
+
spine tasks analyze pending # structural checks (overlap, cycles, warnings)
|
|
302
|
+
spine tasks analyze pending --json # structured AnalyzeTasksResult
|
|
301
303
|
spine help tasks # tasks subcommand usage
|
|
302
304
|
spine version # show package and environment info
|
|
303
305
|
`);
|
|
@@ -36,7 +36,9 @@ export function buildReviewStepCliArgs(params: SpineReviewStepParams): string[]
|
|
|
36
36
|
type SpineReviewStepToolResult = AgentToolResult<SpineReviewStepDetails> & { isError?: boolean };
|
|
37
37
|
|
|
38
38
|
/** Run review step logic shared by the Pi tool handler. */
|
|
39
|
-
export function executeSpineReviewStep(
|
|
39
|
+
export async function executeSpineReviewStep(
|
|
40
|
+
params: SpineReviewStepParams,
|
|
41
|
+
): Promise<SpineReviewStepToolResult> {
|
|
40
42
|
const taskFolder = process.env.SPINE_TASK_FOLDER;
|
|
41
43
|
if (!taskFolder) {
|
|
42
44
|
return {
|
|
@@ -60,7 +62,7 @@ export function executeSpineReviewStep(params: SpineReviewStepParams): SpineRevi
|
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
const { exitCode, output, result } = runSpineReviewStep({
|
|
65
|
+
const { exitCode, output, result } = await runSpineReviewStep({
|
|
64
66
|
taskFolder,
|
|
65
67
|
worktreePath: process.env.SPINE_WORKTREE ?? process.cwd(),
|
|
66
68
|
args: buildReviewStepCliArgs(params),
|
|
@@ -83,15 +85,14 @@ export function executeSpineReviewStep(params: SpineReviewStepParams): SpineRevi
|
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
const fallbackText =
|
|
87
|
-
details.
|
|
88
|
-
|
|
89
|
-
: details.error || "review step failed";
|
|
88
|
+
const fallbackText = details.skipped
|
|
89
|
+
? details.feedback || "review skipped (engine-owned)"
|
|
90
|
+
: details.error || "review step failed";
|
|
90
91
|
|
|
91
92
|
return {
|
|
92
93
|
content: [{ type: "text" as const, text: output.trim() || fallbackText }],
|
|
93
94
|
details,
|
|
94
|
-
isError: exitCode !== 0,
|
|
95
|
+
isError: exitCode !== 0 && !details.skipped,
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -99,11 +100,12 @@ export const spineReviewStepTool = defineTool({
|
|
|
99
100
|
name: "spine_review_step",
|
|
100
101
|
label: "Spine Review Step",
|
|
101
102
|
description:
|
|
102
|
-
"
|
|
103
|
-
promptSnippet: "
|
|
103
|
+
"Request plan or code review for a task step. In real-pi worker sessions the tool returns skipped (exit 0) — the batch engine runs reviews after .DONE (SP-195/SP-278). Stub batches may receive APPROVE via --stub.",
|
|
104
|
+
promptSnippet: "Request plan or code review for a worker task step (engine-owned in real-pi sessions)",
|
|
104
105
|
promptGuidelines: [
|
|
105
|
-
"
|
|
106
|
-
"
|
|
106
|
+
"In real-pi worker sessions, do not rely on spine_review_step for plan or code review — the batch engine runs those after worker success.",
|
|
107
|
+
"Stub batches (SPINE_WORKER_STUB=1) may call spine_review_step for stub APPROVE at plan checkpoints.",
|
|
108
|
+
"On REVISE verdict from engine-owned review, address feedback before continuing.",
|
|
107
109
|
],
|
|
108
110
|
parameters: Type.Object({
|
|
109
111
|
step: Type.Integer({ minimum: 0, description: "Step number from PROMPT.md." }),
|
|
@@ -117,7 +119,7 @@ export const spineReviewStepTool = defineTool({
|
|
|
117
119
|
),
|
|
118
120
|
}),
|
|
119
121
|
async execute(_toolCallId, params): Promise<SpineReviewStepToolResult> {
|
|
120
|
-
return executeSpineReviewStep(params);
|
|
122
|
+
return await executeSpineReviewStep(params);
|
|
121
123
|
},
|
|
122
124
|
});
|
|
123
125
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-spine",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Orchestration spine for long-running pi development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"doctor": "node bin/spine.mjs doctor",
|
|
31
|
-
"
|
|
31
|
+
"lint": "eslint src bin tests scripts",
|
|
32
|
+
"typecheck": "tsc --project tsconfig.json --noEmit && tsc --project tsconfig.batch.json --noEmit",
|
|
32
33
|
"test": "SPINE_SUPPRESS_JOURNAL_ATTACH=1 node --experimental-strip-types --test tests/*.test.mjs tests/cli/*.test.mjs tests/compat/*.test.mjs tests/tasks/*.test.mjs tests/config/*.test.mjs tests/config/cursor-rules/*.test.mjs tests/planner/*.test.mjs tests/batch/*.test.mjs tests/agents/*.test.mjs tests/adoption/*.test.mjs tests/dashboard/*.test.mjs tests/doctor/*.test.mjs tests/migrate/*.test.mjs tests/worker-tools/*.test.mjs tests/coverage/*.test.mjs tests/extensions/*.test.mjs",
|
|
33
34
|
"test:batch": "SPINE_SUPPRESS_JOURNAL_ATTACH=1 node --experimental-strip-types --test tests/batch/*.test.mjs",
|
|
34
35
|
"test:core": "SPINE_SUPPRESS_JOURNAL_ATTACH=1 node --experimental-strip-types --test tests/*.test.mjs tests/cli/*.test.mjs tests/compat/*.test.mjs tests/tasks/*.test.mjs tests/config/*.test.mjs tests/config/cursor-rules/*.test.mjs tests/planner/*.test.mjs tests/agents/*.test.mjs tests/adoption/*.test.mjs tests/dashboard/*.test.mjs tests/doctor/*.test.mjs tests/migrate/*.test.mjs tests/worker-tools/*.test.mjs tests/coverage/*.test.mjs",
|
|
@@ -67,6 +68,8 @@
|
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"@earendil-works/pi-coding-agent": "^0.78.0",
|
|
69
70
|
"@types/node": "^22.19.18",
|
|
71
|
+
"eslint": "^9.28.0",
|
|
72
|
+
"globals": "^16.2.0",
|
|
70
73
|
"typebox": "1.1.38",
|
|
71
74
|
"typescript": "5.6.3"
|
|
72
75
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-spine-tasks
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.1.0
|
|
4
4
|
description: Decomposes PRDs and feature briefs into spine task packets (PROMPT.md, STATUS.md) under spine-tasks/ for autonomous execution via spine batch. Use when asked to "create a spine task", "decompose a PRD", "stage tasks for spine", "write PROMPT.md for spine", "create SP-* tasks", or queue work for spine workers.
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -13,15 +13,24 @@ Works from a local pi-spine checkout (`pi install /path/to/pi-spine -l`) or afte
|
|
|
13
13
|
## Architecture
|
|
14
14
|
|
|
15
15
|
```
|
|
16
|
-
|
|
16
|
+
PRD / brief
|
|
17
|
+
│
|
|
18
|
+
├─ Lean authoring ─────────────────────────────────────────────┐
|
|
19
|
+
│ Step 0? → Step A → Step B → Step C │
|
|
20
|
+
│ │
|
|
21
|
+
└─ Full authoring ───────────────────────────────────────────┤
|
|
22
|
+
Step 0? → A.5 clarify → A.6 checklist → B slice → C.5 analyze? → C
|
|
23
|
+
│
|
|
24
|
+
create-spine-tasks skill → PROMPT.md + STATUS.md (+ dependencies.json edits)
|
|
25
|
+
→ optional _explore/ and _authoring/ artifacts
|
|
17
26
|
spine-orchestrator extension → Slash commands, batch guidance
|
|
18
|
-
spine CLI →
|
|
27
|
+
spine CLI → tasks validate, tasks analyze, plan, batch start, gates
|
|
19
28
|
├─ .spine/agents/worker.md → Worker standing orders (checkpoint discipline)
|
|
20
29
|
├─ .spine/agents/reviewer.md → Reviewer rubric
|
|
21
30
|
└─ .spine/spine-config.json → tasks root, testing commands, lanes, gates
|
|
22
31
|
```
|
|
23
32
|
|
|
24
|
-
The skill only creates and updates task files. Execution behavior lives in pi-spine and the worker/reviewer agent prompts.
|
|
33
|
+
The skill only creates and updates task files. Execution behavior lives in pi-spine and the worker/reviewer agent prompts. Authoring artifacts under `{tasksRoot}/_explore/` and `{tasksRoot}/_authoring/` inform decomposition — they are not batch engine input.
|
|
25
34
|
|
|
26
35
|
## Prerequisites
|
|
27
36
|
|
|
@@ -49,6 +58,19 @@ Override tasks root at runtime with `SPINE_TASKS_ROOT` (env > file).
|
|
|
49
58
|
|
|
50
59
|
Use this workflow when the user supplies a PRD, epic brief, or feature spec instead of a single task description.
|
|
51
60
|
|
|
61
|
+
### Authoring modes
|
|
62
|
+
|
|
63
|
+
Pick **lean** or **full** before decomposition. Terminology aligns with [spec-kit presets](https://github.com/github/spec-kit): lean skips pre-slice quality gates; full runs clarify, checklist, and optional LLM analyze before slicing.
|
|
64
|
+
|
|
65
|
+
| Mode | Pipeline | When to use |
|
|
66
|
+
|------|----------|-------------|
|
|
67
|
+
| **Lean** | Optional Step 0 explore → Step A read → Step B slice → Step C track | Greenfield or brownfield with clear PRD paths; single S/M task; quick experiments; operator already validated requirements |
|
|
68
|
+
| **Full** | Step 0 (if brownfield) → Step A.5 clarify → Step A.6 checklist → Step B slice → optional Step C.5 analyze → Step C track | L/XL epics; ambiguous or conflicting requirements; security/compliance surface; parallel wave planning; production-grade decomposition |
|
|
69
|
+
|
|
70
|
+
**Lean** mirrors spec-kit's lean preset (Specify → Plan → Tasks): move from sources to packets with minimal upstream gates. **Full** mirrors the standard spec-kit path (adds Clarify, Checklist, and Analyze before implementation) — use skill Steps A.5/A.6/C.5 or external [Path 4 spec-kit](../../docs/adoption/upstream-execution-workflow.md#path-4--spec-kit-optional-upstream) upstream, then convert artifacts into spine packets.
|
|
71
|
+
|
|
72
|
+
Default to **lean** when the operator does not specify a mode and signals are weak. Switch to **full** when any row in the full-mode table applies.
|
|
73
|
+
|
|
52
74
|
### Step 0: Explore (optional — brownfield / large epics)
|
|
53
75
|
|
|
54
76
|
Run **before** Step A when decomposition needs codebase discovery. Authoring-only — `spine tasks validate` does **not** require explore artifacts.
|
|
@@ -90,6 +112,76 @@ See [docs/adoption/upstream-execution-workflow.md](../../docs/adoption/upstream-
|
|
|
90
112
|
2. `{tasksRoot}/CONTEXT.md` — current phase, **Next Task ID**, execution policy
|
|
91
113
|
3. Existing `{tasksRoot}/dependencies.json` and open task folders (avoid duplicate work)
|
|
92
114
|
|
|
115
|
+
### Step A.5: Clarify (optional — ambiguity pass before slice)
|
|
116
|
+
|
|
117
|
+
Run **after** Step A when using **full** authoring mode or when the PRD/brief needs ambiguity resolution before decomposition. Authoring-only — `spine tasks validate` does **not** require clarify artifacts.
|
|
118
|
+
|
|
119
|
+
External equivalent: [spec-kit `/speckit.clarify`](https://github.com/github/spec-kit) — see [Path 4](../../docs/adoption/upstream-execution-workflow.md#path-4--spec-kit-optional-upstream).
|
|
120
|
+
|
|
121
|
+
**When to run:**
|
|
122
|
+
|
|
123
|
+
| Signal | Why clarify helps |
|
|
124
|
+
|--------|-------------------|
|
|
125
|
+
| Ambiguous PRD / brief | Scope, acceptance criteria, or deps unclear before slicing |
|
|
126
|
+
| L/XL epic | Must split anyway; resolved decisions drive wave boundaries |
|
|
127
|
+
| Conflicting requirements | Multiple sources or stakeholders need reconciliation |
|
|
128
|
+
| Post-explore open questions | Step 0 findings left decomposition blockers |
|
|
129
|
+
| Full authoring pipeline | Operator wants clarify → checklist → slice before packets |
|
|
130
|
+
|
|
131
|
+
**When to skip:**
|
|
132
|
+
|
|
133
|
+
- **Lean** mode with unambiguous PRD and concrete paths
|
|
134
|
+
- Single S/M task with no open requirements questions
|
|
135
|
+
- Migrating existing Taskplane packets unchanged
|
|
136
|
+
- Prior `{tasksRoot}/_authoring/{slug}/clarify.md` still `Status: complete`
|
|
137
|
+
|
|
138
|
+
**Constraints (read-only on sources):**
|
|
139
|
+
|
|
140
|
+
- No commits; no file edits outside read targets and the clarify artifact
|
|
141
|
+
- Output path: `{tasksRoot}/_authoring/{slug}/clarify.md` (git-tracked by default)
|
|
142
|
+
- Clarify informs Step B slicing — not batch engine input
|
|
143
|
+
|
|
144
|
+
**Workflow:**
|
|
145
|
+
|
|
146
|
+
1. Read-only review — PRD/brief, explore findings (if any), CONTEXT.md.
|
|
147
|
+
2. Write `{tasksRoot}/_authoring/{slug}/clarify.md` using [references/clarify-template.md](references/clarify-template.md) (Summary, Open questions, Assumptions, Resolved decisions, Blockers for decomposition).
|
|
148
|
+
3. Link the slug in `{tasksRoot}/CONTEXT.md` — clarify table row or `Clarify complete: {slug}` with date and path.
|
|
149
|
+
4. Use **Resolved decisions** and resolved **Open questions** when slicing tasks in Step B.
|
|
150
|
+
|
|
151
|
+
### Step A.6 — Requirements checklist (optional)
|
|
152
|
+
|
|
153
|
+
Run **after Step A.5 — Clarify** and **before Step B — Slice**. Authoring-only — `spine tasks validate` does **not** require checklist artifacts.
|
|
154
|
+
|
|
155
|
+
**Purpose:** Validate requirement quality ("unit tests for requirements") before decomposition — inspired by spec-kit `/speckit.checklist`. Checks whether the PRD/brief is complete, measurable, and slice-ready; does **not** verify implementation.
|
|
156
|
+
|
|
157
|
+
**Output path:** `{tasksRoot}/_authoring/{slug}/checklist.md` using [references/requirements-checklist-template.md](references/requirements-checklist-template.md).
|
|
158
|
+
|
|
159
|
+
**When to run:**
|
|
160
|
+
|
|
161
|
+
| Signal | Why checklist helps |
|
|
162
|
+
|--------|---------------------|
|
|
163
|
+
| After clarify with open assumptions | Surfaces requirement gaps before slicing |
|
|
164
|
+
| L/XL epic or multi-task decomposition | Catches missing NFRs and edge cases early |
|
|
165
|
+
| Security- or compliance-touching work | Forces explicit auth/data handling in requirements |
|
|
166
|
+
| Vague acceptance language | Converts ambiguity into measurable criteria |
|
|
167
|
+
| Parallel wave planning | Ensures disjoint scopes are justified by clear requirements |
|
|
168
|
+
|
|
169
|
+
**When to skip:**
|
|
170
|
+
|
|
171
|
+
- Single S/M task with concrete File Scope and measurable acceptance criteria
|
|
172
|
+
- Greenfield with a short, unambiguous brief and no security surface
|
|
173
|
+
- Migrating existing spine packets unchanged
|
|
174
|
+
- Requirements already validated; no open items in `clarify.md`
|
|
175
|
+
|
|
176
|
+
**Workflow:**
|
|
177
|
+
|
|
178
|
+
1. Read PRD/brief, `clarify.md` (if present), and project standards referenced in the brief.
|
|
179
|
+
2. Write `{tasksRoot}/_authoring/{slug}/checklist.md` — cover acceptance criteria quality, security, edge cases, testability, and non-functional requirements (see template).
|
|
180
|
+
3. Resolve or explicitly defer `[Gap]` items before Step B; do **not** duplicate Step 0 explore `findings.md` (explore maps codebase; checklist validates requirements).
|
|
181
|
+
4. Link the slug in `{tasksRoot}/CONTEXT.md` when checklist informs decomposition.
|
|
182
|
+
|
|
183
|
+
**Authoring order:** clarify → checklist → slice (Step A.5 → A.6 → B).
|
|
184
|
+
|
|
93
185
|
### Step B: Slice into spine tasks
|
|
94
186
|
|
|
95
187
|
| Rule | Guidance |
|
|
@@ -102,13 +194,45 @@ See [docs/adoption/upstream-execution-workflow.md](../../docs/adoption/upstream-
|
|
|
102
194
|
| **Waves** | Order via `## Dependencies` and `{tasksRoot}/dependencies.json`. |
|
|
103
195
|
| **Review** | Score complexity (below). Do not default to Level 0 for implementation work. |
|
|
104
196
|
|
|
197
|
+
### Step C.5: Analyze (optional — LLM structural review after slice)
|
|
198
|
+
|
|
199
|
+
Run **after** Step B and **before** Step C when using **full** authoring mode and the operator wants an LLM-authored structural review of drafted packets. Authoring-only — `spine tasks validate` does **not** require analyze artifacts.
|
|
200
|
+
|
|
201
|
+
External equivalent: [spec-kit `/speckit.analyze`](https://github.com/github/spec-kit) — cross-artifact consistency check before implementation.
|
|
202
|
+
|
|
203
|
+
**Purpose:** Read-only review of drafted PROMPT/STATUS packets and dependency graph — wave sizing, scope overlap, missing deps, explore/authoring refs. Complements deterministic **`spine tasks analyze`** (CLI structural checks after decomposition).
|
|
204
|
+
|
|
205
|
+
**Output path:** `{tasksRoot}/_authoring/{slug}/analyze.md` — LLM-authored, read-only report (not batch engine input).
|
|
206
|
+
|
|
207
|
+
**When to run:**
|
|
208
|
+
|
|
209
|
+
| Signal | Why LLM analyze helps |
|
|
210
|
+
|--------|----------------------|
|
|
211
|
+
| Multi-task wave with ≥4 M-sized tasks | Catch scope overlap and wave stall risk before batch |
|
|
212
|
+
| First decomposition on a new epic slug | Sanity-check packet quality before operator approval |
|
|
213
|
+
| Full authoring pipeline | Close the loop after clarify → checklist → slice |
|
|
214
|
+
| Operator requests pre-batch review | Human gate before `spine batch start` |
|
|
215
|
+
|
|
216
|
+
**When to skip:**
|
|
217
|
+
|
|
218
|
+
- **Lean** mode or single S/M packet
|
|
219
|
+
- Operator will run only `spine tasks analyze pending` (deterministic CLI suffices)
|
|
220
|
+
- Packets already reviewed in a prior batch iteration
|
|
221
|
+
|
|
222
|
+
**Workflow:**
|
|
223
|
+
|
|
224
|
+
1. Read drafted task folders, `dependencies.json`, and any `_authoring/{slug}/clarify.md` or `checklist.md`.
|
|
225
|
+
2. Write `{tasksRoot}/_authoring/{slug}/analyze.md` — structural findings, wave recommendations, blocking issues for operator (resolve before batch).
|
|
226
|
+
3. Fix packet issues identified in analyze.md before Step C tracking updates.
|
|
227
|
+
4. After Step C, run **`spine tasks analyze pending`** for deterministic structural checks (wave M-count, explore refs, PROMPT/JSON deps drift).
|
|
228
|
+
|
|
105
229
|
### Step C: Update tracking
|
|
106
230
|
|
|
107
231
|
After creating packets:
|
|
108
232
|
|
|
109
233
|
1. **`{tasksRoot}/CONTEXT.md`** — increment `Next Task ID`; add rows to the phase table for new tasks
|
|
110
234
|
2. **`{tasksRoot}/dependencies.json`** — add edges for every dependency (machine-parseable)
|
|
111
|
-
3. Report launch commands: `spine tasks validate pending` (fix contract/PROMPT errors first), `spine plan pending`, then `spine batch start <id>`
|
|
235
|
+
3. Report launch commands: `spine tasks validate pending` (fix contract/PROMPT errors first), `spine tasks analyze pending` (structural checks — wave sizing, deps drift, explore refs), `spine plan pending`, then `spine batch start <id>`
|
|
112
236
|
|
|
113
237
|
**Example decomposition** (feature brief → three tasks):
|
|
114
238
|
|
|
@@ -179,6 +303,7 @@ If the task depends on others, update **both**:
|
|
|
179
303
|
|
|
180
304
|
```bash
|
|
181
305
|
spine tasks validate pending
|
|
306
|
+
spine tasks analyze pending
|
|
182
307
|
spine plan pending
|
|
183
308
|
spine preflight
|
|
184
309
|
SPINE_WORKER_STUB=1 spine batch start SP-042 # stub / CI
|
|
@@ -329,6 +454,7 @@ Do **not** generate Taskplane polyrepo **`#### Segment: <repoId>`** markers —
|
|
|
329
454
|
|
|
330
455
|
Before reporting launch commands:
|
|
331
456
|
|
|
457
|
+
- [ ] Authoring mode chosen (lean default; full when ambiguity, L/XL epic, or security surface)
|
|
332
458
|
- [ ] `Next Task ID` read from CONTEXT.md and incremented
|
|
333
459
|
- [ ] Folder at `{tasksRoot}/{PREFIX-###-slug}/`
|
|
334
460
|
- [ ] Complexity scored; review level assigned (0–3)
|
|
@@ -338,7 +464,8 @@ Before reporting launch commands:
|
|
|
338
464
|
- [ ] STATUS.md with matching steps (hydration markers where needed)
|
|
339
465
|
- [ ] `dependencies.json` updated when task has deps
|
|
340
466
|
- [ ] CONTEXT.md phase table updated for PRD decompositions
|
|
341
|
-
- [ ]
|
|
467
|
+
- [ ] Full mode: clarify/checklist/analyze artifacts complete or explicitly skipped with rationale
|
|
468
|
+
- [ ] Launch: `spine tasks validate pending` → `spine tasks analyze pending` → `spine plan pending` → `spine preflight` → `spine batch start <id>`
|
|
342
469
|
|
|
343
470
|
---
|
|
344
471
|
|
|
@@ -369,6 +496,8 @@ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
|
|
|
369
496
|
- [references/prompt-template.md](references/prompt-template.md) — PROMPT.md and STATUS.md templates
|
|
370
497
|
- [references/contract-template.md](references/contract-template.md) — `## Contract` field guidance and examples (v2.0 §4)
|
|
371
498
|
- [references/explore-template.md](references/explore-template.md) — Step 0 `findings.md` schema (v1.3 §6.3)
|
|
499
|
+
- [references/clarify-template.md](references/clarify-template.md) — Step A.5 `clarify.md` schema (spec-kit `/speckit.clarify` equivalent)
|
|
500
|
+
- [references/requirements-checklist-template.md](references/requirements-checklist-template.md) — Step A.6 `checklist.md` schema (spec-kit `/speckit.checklist` equivalent)
|
|
372
501
|
- [references/context-template.md](references/context-template.md) — `{tasksRoot}/CONTEXT.md` scaffold
|
|
373
502
|
- [docs/PRD.md](../../docs/PRD.md) — task format spec (§13)
|
|
374
503
|
- [docs/adoption/bootstrap-checklist.md](../../docs/adoption/bootstrap-checklist.md) — greenfield setup
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Clarify template
|
|
2
|
+
|
|
3
|
+
Use for **Step A.5 — Clarify (optional)** in the create-spine-tasks skill.
|
|
4
|
+
Output path: `{tasksRoot}/_authoring/{slug}/clarify.md`
|
|
5
|
+
|
|
6
|
+
**Constraints:** read-only pass on PRD/brief sources; no commits; no file edits outside read targets and the clarify artifact. Clarify informs task slicing in Step B. `spine tasks validate` does **not** require clarify artifacts.
|
|
7
|
+
|
|
8
|
+
External equivalent: [spec-kit `/speckit.clarify`](https://github.com/github/spec-kit) (see [Path 4](../../docs/adoption/upstream-execution-workflow.md#path-4--spec-kit-optional-upstream) in upstream-execution-workflow).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
# Clarify: {slug}
|
|
14
|
+
|
|
15
|
+
**Date:** YYYY-MM-DD
|
|
16
|
+
**Status:** complete | superseded
|
|
17
|
+
**Sources:** (PRD/brief paths reviewed)
|
|
18
|
+
|
|
19
|
+
## Summary
|
|
20
|
+
|
|
21
|
+
(1–3 sentences: what was clarified and readiness for decomposition.)
|
|
22
|
+
|
|
23
|
+
## Open questions
|
|
24
|
+
|
|
25
|
+
- (unresolved ambiguities needing operator or stakeholder input; None if clear)
|
|
26
|
+
|
|
27
|
+
## Assumptions
|
|
28
|
+
|
|
29
|
+
- (working assumptions for slicing until confirmed)
|
|
30
|
+
|
|
31
|
+
## Resolved decisions
|
|
32
|
+
|
|
33
|
+
- (decisions made during clarify; include rationale when non-obvious)
|
|
34
|
+
|
|
35
|
+
## Blockers for decomposition
|
|
36
|
+
|
|
37
|
+
- (must-resolve items before Step B slice; None if ready)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## When to skip clarify
|
|
43
|
+
|
|
44
|
+
- Greenfield with unambiguous PRD and concrete File Scope paths
|
|
45
|
+
- Single S/M task with no open requirements questions
|
|
46
|
+
- Migrating existing Taskplane packets unchanged
|
|
47
|
+
- Prior clarify artifact for the same slug is still `Status: complete`
|
|
48
|
+
|
|
49
|
+
## When clarify is recommended
|
|
50
|
+
|
|
51
|
+
- PRD or brief has ambiguous scope, acceptance criteria, or dependencies
|
|
52
|
+
- L/XL epics before splitting into waves
|
|
53
|
+
- Multiple stakeholders or conflicting requirements in source docs
|
|
54
|
+
- Brownfield work where explore findings raised open questions
|
|
55
|
+
- Full authoring mode (see SP-291 lean vs full) before checklist and slice
|
|
56
|
+
|
|
57
|
+
## Linking in CONTEXT.md
|
|
58
|
+
|
|
59
|
+
Add a row or note:
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
| Clarify: feature-x | 2026-06-18 | complete | spine-tasks/_authoring/feature-x/clarify.md |
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or: `Clarify complete: feature-x (2026-06-18) — spine-tasks/_authoring/feature-x/clarify.md`
|
|
66
|
+
|
|
67
|
+
## Ordering with explore and slice
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
Step 0 Explore (optional) → Step A Read sources → Step A.5 Clarify (optional) → Step B Slice
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use **Resolved decisions** and **Blockers for decomposition** when writing `## File Scope` and `## Dependencies` in downstream packets.
|
|
@@ -18,6 +18,8 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
|
|
|
18
18
|
**Assessment:** [1-2 sentences explaining the score]
|
|
19
19
|
**Score:** [N]/8 — Blast radius: [N], Pattern novelty: [N], Security: [N], Reversibility: [N]
|
|
20
20
|
|
|
21
|
+
> **Real-pi batches (SP-195/SP-278):** Do **not** add per-step "Call `spine_review_step`" checkboxes for Review Level ≥ 1. The batch engine runs plan, code, and final reviews after worker `.DONE`. Stub batches (`SPINE_WORKER_STUB=1`) may still use in-worker stub plan review via the tool when a checkpoint marker requires it.
|
|
22
|
+
|
|
21
23
|
## Canonical Task Folder
|
|
22
24
|
|
|
23
25
|
```
|