pi-spine 2.34.0 → 2.36.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-dashboard.mjs +87 -4
- package/bin/spine-integrate.mjs +5 -5
- package/bin/spine-plan.mjs +14 -1
- package/package.json +1 -1
- package/skills/create-spine-tasks/SKILL.md +7 -7
- package/skills/spine-orchestrate-waves/SKILL.md +1 -1
- package/skills/spine-release-operator/SKILL.md +2 -2
- package/src/batch/engine-lanes/queue.mjs +5 -0
- package/src/batch/engine-lanes/vl-slot-dispatch.mjs +227 -0
- package/src/batch/engine-lanes/vl-wave-dispatch.mjs +325 -0
- package/src/batch/engine-scope.mjs +116 -0
- package/src/batch/engine.mjs +28 -95
- package/src/batch/integrate.mjs +3 -3
- package/src/batch/resume-multi-queue.mjs +276 -75
- package/src/cli/board-select.mjs +26 -10
- package/src/config/defaults.mjs +8 -5
- package/src/config/spine-config-schema.mjs +28 -12
- package/src/dashboard/snapshot-lanes.mjs +97 -2
- package/src/integrations/issues/providers/github.mjs +47 -0
- package/src/integrations/{github → issues}/sync-on-land.mjs +32 -59
- /package/src/integrations/{github → issues}/mission-issue-links.mjs +0 -0
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* VL slot-pool wiring for multi-task resume waves (SP-899 / #358 partial).
|
|
4
|
+
*
|
|
5
|
+
* Replaces the pre-#358 sticky per-lane resume queues (`Promise.all` across
|
|
6
|
+
* `task.laneNumber` lane queues — the same barrier pattern the engine tick
|
|
7
|
+
* loop had): on resume after pause/orphan, remaining ready virtual lanes
|
|
8
|
+
* (VLs) dispatch onto free physical slots `1..lanes.maxParallel` using the
|
|
9
|
+
* SP-897 helper API (`createVlSlotPool` / `selectReadyVl`) — the same rules
|
|
10
|
+
* as the SP-903 start path (`engine-lanes/vl-wave-dispatch.mjs`):
|
|
11
|
+
*
|
|
12
|
+
* 1. `lanes.maxParallel` caps in-flight VLs via the physical slot pool.
|
|
13
|
+
* 2. Two scope-overlapping VLs never run concurrently (`selectReadyVl`
|
|
14
|
+
* skips blockers; a freed slot journals `lane.slot_conflict_wait`).
|
|
15
|
+
* 3. Same-VL serial ordering: a VL holds at most one slot; its remaining
|
|
16
|
+
* tasks drain serially behind the running task (mid-run steal across a
|
|
17
|
+
* VL queue stays out of scope, #358).
|
|
18
|
+
* 4. No tick barriers: a VL that finishes early frees its slot immediately
|
|
19
|
+
* for the next dispatchable VL (uneven completion).
|
|
20
|
+
*
|
|
21
|
+
* Resume has no persisted `wave.laneAssignments` (planner-only field), so
|
|
22
|
+
* ready VLs are rebuilt from packet file scopes with the planner's own
|
|
23
|
+
* greedy packing predicate (`fileScopesOverlap` via `scopesOverlap`): tasks
|
|
24
|
+
* whose scopes overlap share one VL/serial queue; disjoint tasks get
|
|
25
|
+
* separate VLs and may run in parallel on different slots. Tasks whose
|
|
26
|
+
* packet scope cannot be re-read dispatch with empty scopes (never overlap
|
|
27
|
+
* — resume must not silently drop tasks the way the start path skips them).
|
|
28
|
+
*
|
|
29
|
+
* VL→slot binding (merge affinity): merge keys off
|
|
30
|
+
* `task.laneNumber === lane.laneNumber`, so a re-run task rebinds to its
|
|
31
|
+
* dispatch slot before the run persists state (SP-903 pattern). Already
|
|
32
|
+
* complete tasks keep their sticky lane — their committed evidence lives on
|
|
33
|
+
* that lane's branch.
|
|
4
34
|
*/
|
|
5
35
|
|
|
6
36
|
import path from "node:path";
|
|
7
37
|
import crypto from "node:crypto";
|
|
8
38
|
import {
|
|
39
|
+
loadResumeFileScopePaths,
|
|
9
40
|
resolveTaskFolderInWorktree,
|
|
10
41
|
taskAlreadyComplete,
|
|
11
42
|
taskTerminalSuccessInBatch,
|
|
@@ -18,10 +49,24 @@ import {
|
|
|
18
49
|
runResumedTaskOnLane,
|
|
19
50
|
} from "./resume-multi-lanes.mjs";
|
|
20
51
|
import { runWithQuotaFallback } from "./engine-lanes/quota-fallback-run.mjs";
|
|
52
|
+
import {
|
|
53
|
+
buildConflictWaitPayload,
|
|
54
|
+
createVlSlotPool,
|
|
55
|
+
selectReadyVl,
|
|
56
|
+
scopesOverlap,
|
|
57
|
+
VL_SLOT_CONFLICT_WAIT_EVENT,
|
|
58
|
+
} from "./engine-lanes/vl-slot-dispatch.mjs";
|
|
21
59
|
import { resolveWorkerBackend } from "../config/worker-backend.mjs";
|
|
22
60
|
|
|
23
61
|
/**
|
|
24
|
-
* Build
|
|
62
|
+
* Build resume VL queue entries for one wave and run them through the
|
|
63
|
+
* physical slot pool.
|
|
64
|
+
*
|
|
65
|
+
* Classification (per wave task, same filters as the sticky queue):
|
|
66
|
+
* terminal-success tasks skip; already-complete tasks queue a disk-marking
|
|
67
|
+
* run on their sticky lane; non-resumable tasks skip; remaining resumable
|
|
68
|
+
* tasks greedy-pack into VLs by file-scope overlap and dispatch onto free
|
|
69
|
+
* slots.
|
|
25
70
|
*
|
|
26
71
|
* @param {object} params
|
|
27
72
|
* @returns {Promise<{ ok: true, waveResults: object[], batchAborted: boolean } | { ok: false, result: object }>}
|
|
@@ -36,17 +81,63 @@ export async function executeResumeWave({
|
|
|
36
81
|
waveTaskIds,
|
|
37
82
|
events,
|
|
38
83
|
}) {
|
|
39
|
-
|
|
40
|
-
|
|
84
|
+
const lanes = state.lanes ?? [];
|
|
85
|
+
// Slot pool positions map onto provisioned lanes in laneNumber order, so
|
|
86
|
+
// slot N always resolves to a real lane even when legacy state provisioned
|
|
87
|
+
// fewer lanes than the current config maxParallel.
|
|
88
|
+
const provisionedLanes = [...lanes].sort(
|
|
89
|
+
(a, b) => Number(a?.laneNumber ?? 0) - Number(b?.laneNumber ?? 0),
|
|
90
|
+
);
|
|
41
91
|
let batchAborted = false;
|
|
42
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Ready VL entries in dispatch-priority (wave) order.
|
|
95
|
+
*
|
|
96
|
+
* @type {Array<{ vlId: string, scopes: string[], tasks: Array<{ taskId: string, bindsSlot: boolean, run: (slotLane: object, slotCorrelationId: string) => Promise<object> }> }>}
|
|
97
|
+
*/
|
|
98
|
+
const vlQueue = [];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Resumable-task run: single-hop quota fallback retry (SP-809) wraps the
|
|
102
|
+
* resumed lane run; an aborted result flags the batch (abort short-
|
|
103
|
+
* circuit) exactly like the sticky queue did.
|
|
104
|
+
*
|
|
105
|
+
* @param {object} task
|
|
106
|
+
* @param {string} taskFolderRel
|
|
107
|
+
* @returns {(slotLane: object, slotCorrelationId: string) => Promise<object>}
|
|
108
|
+
*/
|
|
109
|
+
const makeResumableRun = (task, taskFolderRel) => async (slotLane, slotCorrelationId) =>
|
|
110
|
+
runWithQuotaFallback(
|
|
111
|
+
() =>
|
|
112
|
+
runResumedTaskOnLane({
|
|
113
|
+
projectRoot,
|
|
114
|
+
state,
|
|
115
|
+
batchId,
|
|
116
|
+
config,
|
|
117
|
+
task,
|
|
118
|
+
lane: slotLane,
|
|
119
|
+
taskFolderRel,
|
|
120
|
+
laneCorrelationId: slotCorrelationId,
|
|
121
|
+
}),
|
|
122
|
+
{
|
|
123
|
+
projectRoot,
|
|
124
|
+
batchId,
|
|
125
|
+
state,
|
|
126
|
+
taskId: task.taskId,
|
|
127
|
+
config,
|
|
128
|
+
workerBackend: resolveWorkerBackend(config),
|
|
129
|
+
},
|
|
130
|
+
).then((result) => {
|
|
131
|
+
if (result?.aborted) batchAborted = true;
|
|
132
|
+
return result;
|
|
133
|
+
});
|
|
134
|
+
|
|
43
135
|
for (const taskId of waveTaskIds) {
|
|
44
136
|
const task = (state.tasks ?? []).find((entry) => entry?.taskId === taskId);
|
|
45
137
|
if (!task) continue;
|
|
46
138
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
if (!lane) {
|
|
139
|
+
const stickyLane = lanes.find((entry) => entry.laneNumber === task.laneNumber);
|
|
140
|
+
if (!stickyLane) {
|
|
50
141
|
return {
|
|
51
142
|
ok: false,
|
|
52
143
|
result: {
|
|
@@ -55,7 +146,7 @@ export async function executeResumeWave({
|
|
|
55
146
|
batchId,
|
|
56
147
|
taskId,
|
|
57
148
|
error: "lane_not_found",
|
|
58
|
-
output: `No lane assigned for task ${taskId} (lane ${laneNumber}).\n`,
|
|
149
|
+
output: `No lane assigned for task ${taskId} (lane ${task.laneNumber}).\n`,
|
|
59
150
|
},
|
|
60
151
|
};
|
|
61
152
|
}
|
|
@@ -68,17 +159,12 @@ export async function executeResumeWave({
|
|
|
68
159
|
const taskFolderInWorktree = resolveTaskFolderInWorktree({
|
|
69
160
|
projectRoot,
|
|
70
161
|
task,
|
|
71
|
-
lane,
|
|
162
|
+
lane: stickyLane,
|
|
72
163
|
tasksRootRel,
|
|
73
164
|
batchId,
|
|
74
165
|
});
|
|
75
|
-
const laneCorrelationId =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (!runsByLane.has(laneNumber)) {
|
|
79
|
-
runsByLane.set(laneNumber, { lane, runs: [] });
|
|
80
|
-
}
|
|
81
|
-
const laneQueue = runsByLane.get(laneNumber);
|
|
166
|
+
const laneCorrelationId = stickyLane.correlationId ?? crypto.randomUUID();
|
|
167
|
+
stickyLane.correlationId = laneCorrelationId;
|
|
82
168
|
|
|
83
169
|
if (
|
|
84
170
|
taskTerminalSuccessInBatch({
|
|
@@ -91,20 +177,30 @@ export async function executeResumeWave({
|
|
|
91
177
|
}
|
|
92
178
|
|
|
93
179
|
if (taskAlreadyComplete({ taskFolder: taskFolderInWorktree, events, task })) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
180
|
+
// Disk-marking run on the sticky lane: evidence and committed work
|
|
181
|
+
// live on that lane's branch, so no VL→slot rebind. Empty scopes —
|
|
182
|
+
// a complete-marking never conflicts with running work.
|
|
183
|
+
vlQueue.push({
|
|
184
|
+
vlId: `vl-resume-done:${taskId}`,
|
|
185
|
+
scopes: [],
|
|
186
|
+
tasks: [
|
|
187
|
+
{
|
|
188
|
+
taskId,
|
|
189
|
+
bindsSlot: false,
|
|
190
|
+
run: async () =>
|
|
191
|
+
markTaskCompleteFromDisk({
|
|
192
|
+
projectRoot,
|
|
193
|
+
state,
|
|
194
|
+
batchId,
|
|
195
|
+
config,
|
|
196
|
+
task,
|
|
197
|
+
lane: stickyLane,
|
|
198
|
+
taskBranch: stickyLane.branch ?? laneTaskBranch(batchId, stickyLane.laneNumber),
|
|
199
|
+
taskFolderInWorktree,
|
|
200
|
+
laneCorrelationId,
|
|
201
|
+
}),
|
|
202
|
+
},
|
|
203
|
+
],
|
|
108
204
|
});
|
|
109
205
|
continue;
|
|
110
206
|
}
|
|
@@ -113,62 +209,167 @@ export async function executeResumeWave({
|
|
|
113
209
|
continue;
|
|
114
210
|
}
|
|
115
211
|
|
|
116
|
-
|
|
212
|
+
// Resumable task: greedy-pack into the first VL whose scopes overlap
|
|
213
|
+
// (planner packing predicate), else open a new VL. Tasks whose packet
|
|
214
|
+
// scope cannot be re-read dispatch with empty scopes rather than
|
|
215
|
+
// being dropped from the wave.
|
|
216
|
+
const scopeResult = loadResumeFileScopePaths(path.join(projectRoot, taskFolderRel));
|
|
217
|
+
const scopes = scopeResult.ok ? scopeResult.fileScopePaths ?? [] : [];
|
|
218
|
+
const targetVl = vlQueue.find((vl) => scopesOverlap(scopes, vl.scopes));
|
|
219
|
+
const queuedTask = {
|
|
117
220
|
taskId,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{
|
|
134
|
-
projectRoot,
|
|
135
|
-
batchId,
|
|
136
|
-
state,
|
|
137
|
-
taskId,
|
|
138
|
-
config,
|
|
139
|
-
workerBackend: resolveWorkerBackend(config),
|
|
140
|
-
},
|
|
141
|
-
).then((result) => {
|
|
142
|
-
if (result.aborted) batchAborted = true;
|
|
143
|
-
return result;
|
|
144
|
-
}),
|
|
145
|
-
});
|
|
221
|
+
bindsSlot: true,
|
|
222
|
+
run: makeResumableRun(task, taskFolderRel),
|
|
223
|
+
};
|
|
224
|
+
if (targetVl) {
|
|
225
|
+
targetVl.tasks.push(queuedTask);
|
|
226
|
+
for (const scope of scopes) {
|
|
227
|
+
if (!targetVl.scopes.includes(scope)) targetVl.scopes.push(scope);
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
vlQueue.push({
|
|
231
|
+
vlId: `vl-resume:${taskId}`,
|
|
232
|
+
scopes: [...scopes],
|
|
233
|
+
tasks: [queuedTask],
|
|
234
|
+
});
|
|
235
|
+
}
|
|
146
236
|
}
|
|
147
237
|
|
|
148
|
-
const
|
|
149
|
-
|
|
238
|
+
const slotPool = createVlSlotPool(
|
|
239
|
+
// `lanes.maxParallel` caps in-flight VLs; the pool never exceeds the
|
|
240
|
+
// provisioned lanes so a slot always maps to a lane worktree (resumed
|
|
241
|
+
// batches may predate a maxParallel increase — fail closed to the
|
|
242
|
+
// provisioned lanes instead of dispatching into a missing worktree).
|
|
243
|
+
Math.min(config?.lanes?.maxParallel ?? 1, Math.max(1, provisionedLanes.length)),
|
|
244
|
+
);
|
|
245
|
+
/** @type {typeof vlQueue} */
|
|
246
|
+
const readyVls = [...vlQueue];
|
|
247
|
+
/** @type {Array<{ vlId: string, scopes: string[], tasks: unknown[] }>} */
|
|
248
|
+
const runningVls = [];
|
|
249
|
+
/** @type {Set<Promise<object[]>>} */
|
|
250
|
+
const inFlightVls = new Set();
|
|
251
|
+
/** @type {object[]} */
|
|
252
|
+
const waveResults = [];
|
|
253
|
+
/** @type {Error | null} */
|
|
254
|
+
let runError = null;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Free a VL's slot, drop it from the running set, collect its results,
|
|
258
|
+
* and surface a thrown run error (first error wins) without rejecting
|
|
259
|
+
* the tracked completion.
|
|
260
|
+
*/
|
|
261
|
+
const settleVlSlot = (vl, slot, completion, results, error) => {
|
|
262
|
+
slotPool.release(slot);
|
|
263
|
+
const runningIndex = runningVls.indexOf(vl);
|
|
264
|
+
if (runningIndex >= 0) runningVls.splice(runningIndex, 1);
|
|
265
|
+
inFlightVls.delete(completion);
|
|
266
|
+
if (error && !runError) runError = error;
|
|
267
|
+
if (Array.isArray(results)) waveResults.push(...results);
|
|
268
|
+
return results;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Run one VL's serial task queue on the physical lane bound to `slot`.
|
|
273
|
+
* Aborts (and a prior run error) short-circuit the queue's remaining
|
|
274
|
+
* tasks; a thrown run error rejects and is converted to a batch engine
|
|
275
|
+
* error by the settle handler.
|
|
276
|
+
*
|
|
277
|
+
* @returns {Promise<object[]>}
|
|
278
|
+
*/
|
|
279
|
+
const runVlOnSlot = async (vl, slot) => {
|
|
280
|
+
const slotLane = provisionedLanes[slot - 1] ?? null;
|
|
281
|
+
if (!slotLane) throw new Error(`no lane provisioned for slot ${slot} (resume dispatch)`);
|
|
282
|
+
|
|
283
|
+
// VL→slot bind (SP-903 pattern): merge (and downstream resume/
|
|
284
|
+
// dashboard consumers) key off `task.laneNumber`, so the runtime
|
|
285
|
+
// binding must replace the plan-time sticky value before any run
|
|
286
|
+
// persists state. Already-complete tasks keep their sticky lane.
|
|
287
|
+
for (const queued of vl.tasks) {
|
|
288
|
+
if (!queued.bindsSlot) continue;
|
|
289
|
+
const boundTask = (state.tasks ?? []).find((entry) => entry?.taskId === queued.taskId);
|
|
290
|
+
if (boundTask) boundTask.laneNumber = slotLane.laneNumber;
|
|
291
|
+
}
|
|
292
|
+
const slotCorrelationId = slotLane.correlationId ?? crypto.randomUUID();
|
|
293
|
+
slotLane.correlationId = slotCorrelationId;
|
|
294
|
+
|
|
295
|
+
if (vl.tasks.length > 1) {
|
|
150
296
|
appendJournalEvent(projectRoot, batchId, "lane.tasks_serialized", {
|
|
151
|
-
laneNumber,
|
|
152
|
-
laneId:
|
|
297
|
+
laneNumber: slotLane.laneNumber,
|
|
298
|
+
laneId: slotLane.laneId,
|
|
153
299
|
waveIndex,
|
|
154
|
-
taskIds:
|
|
155
|
-
correlationId:
|
|
300
|
+
taskIds: vl.tasks.map((queued) => queued.taskId),
|
|
301
|
+
correlationId: slotCorrelationId,
|
|
156
302
|
});
|
|
157
303
|
}
|
|
158
304
|
|
|
159
305
|
/** @type {object[]} */
|
|
160
|
-
const
|
|
161
|
-
for (const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
306
|
+
const results = [];
|
|
307
|
+
for (const queued of vl.tasks) {
|
|
308
|
+
if (batchAborted || runError) return results;
|
|
309
|
+
results.push(await queued.run(slotLane, slotCorrelationId));
|
|
310
|
+
}
|
|
311
|
+
return results;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
while (readyVls.length > 0 || inFlightVls.size > 0) {
|
|
315
|
+
if (!batchAborted && !runError && readyVls.length > 0) {
|
|
316
|
+
const slot = slotPool.tryAcquire();
|
|
317
|
+
if (slot !== null) {
|
|
318
|
+
const selection = selectReadyVl(readyVls, runningVls);
|
|
319
|
+
if (selection.status === "dispatch" && selection.vl) {
|
|
320
|
+
const vl = selection.vl;
|
|
321
|
+
const readyIndex = readyVls.indexOf(vl);
|
|
322
|
+
if (readyIndex >= 0) readyVls.splice(readyIndex, 1);
|
|
323
|
+
runningVls.push(vl);
|
|
324
|
+
/** @type {Promise<object[]>} */
|
|
325
|
+
const completion = runVlOnSlot(vl, slot).then(
|
|
326
|
+
(outcome) => settleVlSlot(vl, slot, completion, outcome),
|
|
327
|
+
(error) =>
|
|
328
|
+
settleVlSlot(
|
|
329
|
+
vl,
|
|
330
|
+
slot,
|
|
331
|
+
completion,
|
|
332
|
+
[],
|
|
333
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
334
|
+
),
|
|
335
|
+
);
|
|
336
|
+
inFlightVls.add(completion);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
// Slot free but no dispatchable VL: scope conflicts or same-VL
|
|
340
|
+
// serial queues are journalable (SP-897 payload).
|
|
341
|
+
if (selection.status === "conflict-wait") {
|
|
342
|
+
appendJournalEvent(
|
|
343
|
+
projectRoot,
|
|
344
|
+
batchId,
|
|
345
|
+
VL_SLOT_CONFLICT_WAIT_EVENT,
|
|
346
|
+
buildConflictWaitPayload({
|
|
347
|
+
slot,
|
|
348
|
+
blocked: selection.blocked,
|
|
349
|
+
waitingOn: selection.waitingOn,
|
|
350
|
+
runningVlIds: runningVls.map((running) => running.vlId ?? null),
|
|
351
|
+
readyCount: readyVls.length,
|
|
352
|
+
}),
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
slotPool.release(slot);
|
|
167
356
|
}
|
|
168
357
|
}
|
|
169
|
-
return laneResults;
|
|
170
|
-
});
|
|
171
358
|
|
|
172
|
-
|
|
359
|
+
if (inFlightVls.size > 0) {
|
|
360
|
+
// Slot pool full (or nothing dispatchable): wait for a running VL
|
|
361
|
+
// to free its slot, then re-select.
|
|
362
|
+
await Promise.race([...inFlightVls]);
|
|
363
|
+
} else if (readyVls.length === 0 || batchAborted || runError) {
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (runError) {
|
|
369
|
+
// Preserve the sticky-queue contract: a thrown run error propagates to
|
|
370
|
+
// resume-multi's engine error handler (failBatchFromEngineError) after
|
|
371
|
+
// in-flight VLs drain.
|
|
372
|
+
throw runError;
|
|
373
|
+
}
|
|
173
374
|
return { ok: true, waveResults, batchAborted };
|
|
174
375
|
}
|
package/src/cli/board-select.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `spine plan` / `spine batch start`. Never starts batches, never polls, and
|
|
7
7
|
* never mutates issue state; re-run when the board changes.
|
|
8
8
|
*
|
|
9
|
-
* CLI surface: `node bin/spine-plan.mjs --
|
|
9
|
+
* CLI surface: `node bin/spine-plan.mjs --issue-label <label>… [--milestone <m>] [--print-ids]`.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { spawnSync } from "node:child_process";
|
|
@@ -14,7 +14,7 @@ import fs from "node:fs";
|
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
|
|
16
16
|
import { compareTaskIds, discoverTasks } from "../tasks/packet/discover.mjs";
|
|
17
|
-
import { parseMissionIssueLinks } from "../integrations/
|
|
17
|
+
import { parseMissionIssueLinks } from "../integrations/issues/mission-issue-links.mjs";
|
|
18
18
|
import { loadSpineConfig } from "../config/spine-config-load.mjs";
|
|
19
19
|
import { resolveTasksRootPath } from "../config/env-overrides.mjs";
|
|
20
20
|
import { missingConfigHint } from "../config/missing-config-hint.mjs";
|
|
@@ -54,10 +54,17 @@ const MISSION_SECTION_RE = /^## Mission\s*\n([\s\S]*?)(?=^## |\s*$)/m;
|
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
/** argv flags that select a board rather than a scope. */
|
|
57
|
-
const BOARD_LABEL_FLAG = "--
|
|
57
|
+
const BOARD_LABEL_FLAG = "--issue-label";
|
|
58
58
|
const BOARD_MILESTONE_FLAG = "--milestone";
|
|
59
59
|
const BOARD_PRINT_IDS_FLAG = "--print-ids";
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Pre-SP-894 (#387) label flag spelling. Rejected fail-closed in
|
|
63
|
+
* `parseBoardSelectArgs` — no silent alias: scripts using the old flag
|
|
64
|
+
* must move to `--issue-label`.
|
|
65
|
+
*/
|
|
66
|
+
const LEGACY_BOARD_LABEL_FLAG = "--github-label";
|
|
67
|
+
|
|
61
68
|
/**
|
|
62
69
|
* @param {string} filePath
|
|
63
70
|
* @returns {string}
|
|
@@ -90,9 +97,11 @@ export function defaultRunGh(projectRoot, args) {
|
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
/**
|
|
93
|
-
* Parse the board-select argv subset: repeatable `--
|
|
94
|
-
* (also `--
|
|
95
|
-
* number), and `--print-ids`. Unknown flags pass through in `rest
|
|
100
|
+
* Parse the board-select argv subset: repeatable `--issue-label <label>`
|
|
101
|
+
* (also `--issue-label=<label>`), optional `--milestone <m>` (title or
|
|
102
|
+
* number), and `--print-ids`. Unknown flags pass through in `rest`, except
|
|
103
|
+
* the retired `--github-label` spelling, which throws fail-closed (no
|
|
104
|
+
* silent alias; SP-894 / #387).
|
|
96
105
|
*
|
|
97
106
|
* @param {string[]} argv
|
|
98
107
|
* @returns {{ labels: string[], milestone: string | null, printIds: boolean, rest: string[] }}
|
|
@@ -109,6 +118,13 @@ export function parseBoardSelectArgs(argv) {
|
|
|
109
118
|
let pendingFlag = null;
|
|
110
119
|
|
|
111
120
|
for (const arg of argv) {
|
|
121
|
+
if (arg === LEGACY_BOARD_LABEL_FLAG || arg.startsWith(`${LEGACY_BOARD_LABEL_FLAG}=`)) {
|
|
122
|
+
// SP-894 (#387): fail closed — the old flag spelling is rejected,
|
|
123
|
+
// never aliased; scripts must move to --issue-label.
|
|
124
|
+
const err = new Error("Unknown option: --github-label (renamed to --issue-label; old flag not accepted)");
|
|
125
|
+
err.suggestedCommand = "spine plan --issue-label <label>";
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
112
128
|
if (pendingFlag !== null && !arg.startsWith("--")) {
|
|
113
129
|
if (pendingFlag === BOARD_LABEL_FLAG) {
|
|
114
130
|
labels.push(arg);
|
|
@@ -145,7 +161,7 @@ export function parseBoardSelectArgs(argv) {
|
|
|
145
161
|
|
|
146
162
|
/**
|
|
147
163
|
* `gh issue list` argv for the open-issue board pull. Fields `number`,
|
|
148
|
-
* `labels`, `milestone` are filtered in-memory so multiple `--
|
|
164
|
+
* `labels`, `milestone` are filtered in-memory so multiple `--issue-label`
|
|
149
165
|
* values keep documented any-match semantics regardless of gh's own
|
|
150
166
|
* repeated-flag behavior.
|
|
151
167
|
*
|
|
@@ -261,9 +277,9 @@ export function resolveBoardTaskIds({
|
|
|
261
277
|
const requestedMilestone = milestone == null ? null : String(milestone).trim();
|
|
262
278
|
if (requestedLabels.length === 0 && (requestedMilestone === null || requestedMilestone === "")) {
|
|
263
279
|
const err = new Error(
|
|
264
|
-
"Board selection needs at least one --
|
|
280
|
+
"Board selection needs at least one --issue-label <label> or --milestone <title|number>",
|
|
265
281
|
);
|
|
266
|
-
err.suggestedCommand = "spine plan --
|
|
282
|
+
err.suggestedCommand = "spine plan --issue-label <label>";
|
|
267
283
|
throw err;
|
|
268
284
|
}
|
|
269
285
|
|
|
@@ -424,7 +440,7 @@ export function formatBoardSelection({ filters, boardIssueCount, taskIds, readEr
|
|
|
424
440
|
|
|
425
441
|
/**
|
|
426
442
|
* Full board-select CLI path: resolve + format. Used by `bin/spine-plan.mjs`
|
|
427
|
-
* when `--
|
|
443
|
+
* when `--issue-label` / `--milestone` are present.
|
|
428
444
|
*
|
|
429
445
|
* @param {object} [params]
|
|
430
446
|
* @param {string} [params.projectRoot]
|
package/src/config/defaults.mjs
CHANGED
|
@@ -64,13 +64,16 @@ export const INTEGRATE_DEFAULTS = Object.freeze({
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Third-party integrations (SP-887 / #383
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* Third-party integrations (SP-887 / #383; forge-neutral rename SP-890 / #387).
|
|
68
|
+
* The section is the `issues` umbrella with a `provider` field: only the default
|
|
69
|
+
* provider `"github"` has a working backend today, and `syncOnLand` stays opt-in
|
|
70
|
+
* so the key reads as an explicit, documented default rather than an accidental
|
|
71
|
+
* undefined. The legacy `integrations.github` key is rejected fail-closed at
|
|
72
|
+
* validation time — no silent alias.
|
|
70
73
|
*
|
|
71
|
-
* @type {Readonly<{
|
|
74
|
+
* @type {Readonly<{ issues: Readonly<{ provider: string; syncOnLand: boolean }> }>} */
|
|
72
75
|
export const INTEGRATIONS_DEFAULTS = Object.freeze({
|
|
73
|
-
|
|
76
|
+
issues: Object.freeze({ provider: "github", syncOnLand: false }),
|
|
74
77
|
});
|
|
75
78
|
|
|
76
79
|
/** @type {Readonly<{ review: typeof REVIEW_DEFAULTS; handoff: typeof HANDOFF_DEFAULTS; metrics: typeof METRICS_DEFAULTS; contract: typeof CONTRACT_DEFAULTS; lanes: typeof LANES_DEFAULTS; integrate: typeof INTEGRATE_DEFAULTS; integrations: typeof INTEGRATIONS_DEFAULTS; orchestrator: typeof ORCHESTRATOR_DEFAULTS }>} */
|
|
@@ -219,12 +219,14 @@ export function resolveSequenceStallMs({ config = {} } = {}) {
|
|
|
219
219
|
return DEFAULT_SEQUENCE_STALL_MS;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
// --- Integrations (SP-887 / #383) ---
|
|
222
|
+
// --- Integrations (SP-887 / #383; forge-neutral rename SP-890 / #387) ---
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
|
-
* Validate `integrations.
|
|
226
|
-
* Structural only:
|
|
227
|
-
*
|
|
225
|
+
* Validate `integrations.issues` (forge-neutral issue-tracker section, #387).
|
|
226
|
+
* Structural only: `provider` must be a string when set (defaults to "github"
|
|
227
|
+
* via INTEGRATIONS_DEFAULTS) and `syncOnLand` must be a boolean when set
|
|
228
|
+
* (defaults to false). Absent values are valid. The legacy `integrations.github`
|
|
229
|
+
* key is rejected fail-closed — no silent alias (#387).
|
|
228
230
|
*
|
|
229
231
|
* @param {Record<string, any>} config
|
|
230
232
|
* @returns {null | { code: string; message: string; suggestedCommand: string }}
|
|
@@ -241,22 +243,36 @@ export function validateIntegrationsConfig(config) {
|
|
|
241
243
|
suggestedCommand: "spine init --force",
|
|
242
244
|
};
|
|
243
245
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
+
if ("github" in integrations) {
|
|
247
|
+
return {
|
|
248
|
+
code: "CONFIG_INTEGRATIONS_INVALID",
|
|
249
|
+
message: 'integrations.github is no longer supported — rename it to integrations.issues (the default provider remains "github")',
|
|
250
|
+
suggestedCommand: 'Edit .spine/spine-config.json: rename integrations.github to integrations.issues, e.g. "issues": { "provider": "github", "syncOnLand": true }',
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
const issues = integrations.issues;
|
|
254
|
+
if (issues == null) {
|
|
246
255
|
return null;
|
|
247
256
|
}
|
|
248
|
-
if (!isPlainObject(
|
|
257
|
+
if (!isPlainObject(issues)) {
|
|
258
|
+
return {
|
|
259
|
+
code: "CONFIG_INTEGRATIONS_INVALID",
|
|
260
|
+
message: "integrations.issues must be an object when set",
|
|
261
|
+
suggestedCommand: "Edit .spine/spine-config.json: integrations.issues must be an object",
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (issues.provider != null && typeof issues.provider !== "string") {
|
|
249
265
|
return {
|
|
250
266
|
code: "CONFIG_INTEGRATIONS_INVALID",
|
|
251
|
-
message: "integrations.
|
|
252
|
-
suggestedCommand:
|
|
267
|
+
message: "integrations.issues.provider must be a string when set",
|
|
268
|
+
suggestedCommand: 'Edit .spine/spine-config.json: set integrations.issues.provider to "github"',
|
|
253
269
|
};
|
|
254
270
|
}
|
|
255
|
-
if (
|
|
271
|
+
if (issues.syncOnLand != null && typeof issues.syncOnLand !== "boolean") {
|
|
256
272
|
return {
|
|
257
273
|
code: "CONFIG_INTEGRATIONS_INVALID",
|
|
258
|
-
message: "integrations.
|
|
259
|
-
suggestedCommand: "Edit .spine/spine-config.json: set integrations.
|
|
274
|
+
message: "integrations.issues.syncOnLand must be a boolean when set",
|
|
275
|
+
suggestedCommand: "Edit .spine/spine-config.json: set integrations.issues.syncOnLand to true or false",
|
|
260
276
|
};
|
|
261
277
|
}
|
|
262
278
|
return null;
|