gsd-pi 2.31.2 → 2.32.0-dev.d792ba5
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 +27 -20
- package/dist/cli.js +5 -5
- package/dist/resources/extensions/gsd/auto-constants.ts +6 -0
- package/dist/resources/extensions/gsd/auto-dashboard.ts +20 -26
- package/dist/resources/extensions/gsd/auto-direct-dispatch.ts +1 -6
- package/dist/resources/extensions/gsd/auto-dispatch.ts +4 -8
- package/dist/resources/extensions/gsd/auto-post-unit.ts +27 -32
- package/dist/resources/extensions/gsd/auto-prompts.ts +38 -34
- package/dist/resources/extensions/gsd/auto-start.ts +8 -6
- package/dist/resources/extensions/gsd/auto.ts +54 -33
- package/dist/resources/extensions/gsd/commands-workflow-templates.ts +3 -5
- package/dist/resources/extensions/gsd/commands.ts +19 -0
- package/dist/resources/extensions/gsd/crash-recovery.ts +15 -2
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +28 -0
- package/dist/resources/extensions/gsd/doctor-environment.ts +497 -0
- package/dist/resources/extensions/gsd/doctor-providers.ts +343 -0
- package/dist/resources/extensions/gsd/doctor-types.ts +14 -1
- package/dist/resources/extensions/gsd/doctor.ts +6 -0
- package/dist/resources/extensions/gsd/git-service.ts +9 -0
- package/dist/resources/extensions/gsd/guided-flow-queue.ts +1 -8
- package/dist/resources/extensions/gsd/health-widget.ts +167 -0
- package/dist/resources/extensions/gsd/index.ts +12 -0
- package/dist/resources/extensions/gsd/migrate-external.ts +18 -2
- package/dist/resources/extensions/gsd/preferences-types.ts +8 -0
- package/dist/resources/extensions/gsd/preferences-validation.ts +3 -10
- package/dist/resources/extensions/gsd/progress-score.ts +273 -0
- package/dist/resources/extensions/gsd/prompts/run-uat.md +1 -42
- package/dist/resources/extensions/gsd/quick.ts +59 -7
- package/dist/resources/extensions/gsd/repo-identity.ts +22 -1
- package/dist/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +127 -0
- package/dist/resources/extensions/gsd/tests/doctor-environment.test.ts +314 -0
- package/dist/resources/extensions/gsd/tests/doctor-providers.test.ts +298 -0
- package/dist/resources/extensions/gsd/tests/export-html-enhancements.test.ts +3 -0
- package/dist/resources/extensions/gsd/tests/memory-leak-guards.test.ts +7 -3
- package/dist/resources/extensions/gsd/tests/progress-score.test.ts +206 -0
- package/dist/resources/extensions/gsd/tests/run-uat.test.ts +56 -7
- package/dist/resources/extensions/gsd/tests/visualizer-views.test.ts +12 -0
- package/dist/resources/extensions/gsd/visualizer-data.ts +60 -2
- package/dist/resources/extensions/gsd/visualizer-views.ts +54 -0
- package/dist/worktree-cli.d.ts +42 -6
- package/dist/worktree-cli.js +88 -48
- package/package.json +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/auto-constants.ts +6 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +20 -26
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +1 -6
- package/src/resources/extensions/gsd/auto-dispatch.ts +4 -8
- package/src/resources/extensions/gsd/auto-post-unit.ts +27 -32
- package/src/resources/extensions/gsd/auto-prompts.ts +38 -34
- package/src/resources/extensions/gsd/auto-start.ts +8 -6
- package/src/resources/extensions/gsd/auto.ts +54 -33
- package/src/resources/extensions/gsd/commands-workflow-templates.ts +3 -5
- package/src/resources/extensions/gsd/commands.ts +19 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +15 -2
- package/src/resources/extensions/gsd/dashboard-overlay.ts +28 -0
- package/src/resources/extensions/gsd/doctor-environment.ts +497 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +343 -0
- package/src/resources/extensions/gsd/doctor-types.ts +14 -1
- package/src/resources/extensions/gsd/doctor.ts +6 -0
- package/src/resources/extensions/gsd/git-service.ts +9 -0
- package/src/resources/extensions/gsd/guided-flow-queue.ts +1 -8
- package/src/resources/extensions/gsd/health-widget.ts +167 -0
- package/src/resources/extensions/gsd/index.ts +12 -0
- package/src/resources/extensions/gsd/migrate-external.ts +18 -2
- package/src/resources/extensions/gsd/preferences-types.ts +8 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +3 -10
- package/src/resources/extensions/gsd/progress-score.ts +273 -0
- package/src/resources/extensions/gsd/prompts/run-uat.md +1 -42
- package/src/resources/extensions/gsd/quick.ts +59 -7
- package/src/resources/extensions/gsd/repo-identity.ts +22 -1
- package/src/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/doctor-environment.test.ts +314 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +298 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/memory-leak-guards.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/progress-score.test.ts +206 -0
- package/src/resources/extensions/gsd/tests/run-uat.test.ts +56 -7
- package/src/resources/extensions/gsd/tests/visualizer-views.test.ts +12 -0
- package/src/resources/extensions/gsd/visualizer-data.ts +60 -2
- package/src/resources/extensions/gsd/visualizer-views.ts +54 -0
package/README.md
CHANGED
|
@@ -24,21 +24,24 @@ One command. Walk away. Come back to a built project with clean git history.
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
## What's New in v2.
|
|
28
|
-
|
|
29
|
-
- **
|
|
30
|
-
-
|
|
31
|
-
- **
|
|
32
|
-
-
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
-
|
|
27
|
+
## What's New in v2.32
|
|
28
|
+
|
|
29
|
+
- **Simplified pipeline** — research merged into planning, mechanical completion (ADR-003)
|
|
30
|
+
- **Always-on health widget** — 🟢🟡🔴 traffic-light indicator in the progress widget and visualizer health tab
|
|
31
|
+
- **Environment health checks** — progress scoring and status integration for auto-mode
|
|
32
|
+
- **Extension registry** — user-managed enable/disable for bundled and custom extensions
|
|
33
|
+
- **Built-in skill authoring** — create and distribute custom skills from within GSD
|
|
34
|
+
- **Workflow templates** — right-sized workflows for every task type (research, plan, execute, complete)
|
|
35
|
+
- **AWS Bedrock auth** — automatic credential refresh via the new `aws-auth` extension
|
|
36
|
+
- **`-w` / `--worktree` CLI flag** — launch isolated worktree sessions from the command line
|
|
37
|
+
- **Native MCP client** — replaced MCPorter with a built-in MCP client for better reliability
|
|
38
|
+
- **External state directory** — `.gsd/` now lives in `~/.gsd/projects/` with a symlink (ADR-002)
|
|
39
|
+
- **Model health indicator** — live health status based on error trends and consecutive failures
|
|
40
|
+
- **Quick-task branch cleanup** — `/gsd quick` branches auto-merge back after completion
|
|
41
|
+
- **Windows EPERM fallback** — migration rename uses copy+delete when NTFS blocks rename
|
|
42
|
+
- **Worktree identity fix** — stable project hash across worktrees and main repo
|
|
43
|
+
- **Crash recovery guidance** — actionable next-step messages based on what was interrupted
|
|
44
|
+
- **UAT verdict gating** — non-PASS verdicts now block slice progression instead of being ignored
|
|
42
45
|
|
|
43
46
|
See the full [Changelog](./CHANGELOG.md) for details.
|
|
44
47
|
|
|
@@ -65,6 +68,7 @@ Full documentation is available in the [`docs/`](./docs/) directory:
|
|
|
65
68
|
- **[Visualizer](./docs/visualizer.md)** — workflow visualizer with stats and discussion status
|
|
66
69
|
- **[Remote Questions](./docs/remote-questions.md)** — route decisions to Slack or Discord when human input is needed
|
|
67
70
|
- **[Dynamic Model Routing](./docs/dynamic-model-routing.md)** — complexity-based model selection and budget pressure
|
|
71
|
+
- **[Pipeline Simplification (ADR-003)](./docs/ADR-003-pipeline-simplification.md)** — merged research into planning, mechanical completion
|
|
68
72
|
- **[Migration from v1](./docs/migration.md)** — `.planning` → `.gsd` migration
|
|
69
73
|
|
|
70
74
|
---
|
|
@@ -141,12 +145,12 @@ The iron rule: **a task must fit in one context window.** If it can't, it's two
|
|
|
141
145
|
Each slice flows through phases automatically:
|
|
142
146
|
|
|
143
147
|
```
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
Plan (with integrated research) → Execute (per task) → Complete → Reassess Roadmap → Next Slice
|
|
149
|
+
↓ (all slices done)
|
|
150
|
+
Validate Milestone → Complete Milestone
|
|
147
151
|
```
|
|
148
152
|
|
|
149
|
-
**
|
|
153
|
+
**Plan** scouts the codebase, researches relevant docs, and decomposes the slice into tasks with must-haves (mechanically verifiable outcomes). **Execute** runs each task in a fresh context window with only the relevant files pre-loaded — then runs configured verification commands (lint, test, etc.) with auto-fix retries. **Complete** writes the summary, UAT script, marks the roadmap, and commits with meaningful messages derived from task summaries. **Reassess** checks if the roadmap still makes sense given what was learned. **Validate Milestone** runs a reconciliation gate after all slices complete — comparing roadmap success criteria against actual results before sealing the milestone.
|
|
150
154
|
|
|
151
155
|
### `/gsd auto` — The Main Event
|
|
152
156
|
|
|
@@ -326,6 +330,7 @@ On first run, GSD launches a branded setup wizard that walks you through LLM pro
|
|
|
326
330
|
| `gsd headless [cmd]` | Run `/gsd` commands without TUI (CI, cron, scripts) |
|
|
327
331
|
| `gsd headless query` | Instant JSON snapshot — state, next dispatch, costs (no LLM) |
|
|
328
332
|
| `gsd --continue` (`-c`) | Resume the most recent session for the current directory |
|
|
333
|
+
| `gsd --worktree` (`-w`) | Launch an isolated worktree session for the active milestone |
|
|
329
334
|
| `gsd sessions` | Interactive session picker — browse and resume any saved session |
|
|
330
335
|
|
|
331
336
|
---
|
|
@@ -483,7 +488,7 @@ See the full [Token Optimization Guide](./docs/token-optimization.md) for detail
|
|
|
483
488
|
|
|
484
489
|
### Bundled Tools
|
|
485
490
|
|
|
486
|
-
GSD ships with
|
|
491
|
+
GSD ships with 18 extensions, all loaded automatically:
|
|
487
492
|
|
|
488
493
|
| Extension | What it provides |
|
|
489
494
|
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -503,6 +508,8 @@ GSD ships with 16 extensions, all loaded automatically:
|
|
|
503
508
|
| **Secure Env Collect** | Masked secret collection without manual .env editing |
|
|
504
509
|
| **Remote Questions** | Route decisions to Slack/Discord when human input is needed in headless/CI mode |
|
|
505
510
|
| **Universal Config** | Discover and import MCP servers and rules from other AI coding tools |
|
|
511
|
+
| **AWS Auth** | Automatic Bedrock credential refresh for AWS-hosted models |
|
|
512
|
+
| **TTSR** | Tool-use type-safe runtime validation |
|
|
506
513
|
|
|
507
514
|
### Bundled Agents
|
|
508
515
|
|
package/dist/cli.js
CHANGED
|
@@ -359,16 +359,16 @@ if (cliFlags.messages[0] === 'worktree' || cliFlags.messages[0] === 'wt') {
|
|
|
359
359
|
const sub = cliFlags.messages[1];
|
|
360
360
|
const subArgs = cliFlags.messages.slice(2);
|
|
361
361
|
if (!sub || sub === 'list') {
|
|
362
|
-
handleList(process.cwd());
|
|
362
|
+
await handleList(process.cwd());
|
|
363
363
|
}
|
|
364
364
|
else if (sub === 'merge') {
|
|
365
365
|
await handleMerge(process.cwd(), subArgs);
|
|
366
366
|
}
|
|
367
367
|
else if (sub === 'clean') {
|
|
368
|
-
handleClean(process.cwd());
|
|
368
|
+
await handleClean(process.cwd());
|
|
369
369
|
}
|
|
370
370
|
else if (sub === 'remove' || sub === 'rm') {
|
|
371
|
-
handleRemove(process.cwd(), subArgs);
|
|
371
|
+
await handleRemove(process.cwd(), subArgs);
|
|
372
372
|
}
|
|
373
373
|
else {
|
|
374
374
|
process.stderr.write(`Unknown worktree command: ${sub}\n`);
|
|
@@ -381,7 +381,7 @@ if (cliFlags.messages[0] === 'worktree' || cliFlags.messages[0] === 'wt') {
|
|
|
381
381
|
// ---------------------------------------------------------------------------
|
|
382
382
|
if (cliFlags.worktree) {
|
|
383
383
|
const { handleWorktreeFlag } = await import('./worktree-cli.js');
|
|
384
|
-
handleWorktreeFlag(cliFlags.worktree);
|
|
384
|
+
await handleWorktreeFlag(cliFlags.worktree);
|
|
385
385
|
}
|
|
386
386
|
// ---------------------------------------------------------------------------
|
|
387
387
|
// Active worktree banner — remind user of unmerged worktrees on normal launch
|
|
@@ -389,7 +389,7 @@ if (cliFlags.worktree) {
|
|
|
389
389
|
if (!cliFlags.worktree && !isPrintMode) {
|
|
390
390
|
try {
|
|
391
391
|
const { handleStatusBanner } = await import('./worktree-cli.js');
|
|
392
|
-
handleStatusBanner(process.cwd());
|
|
392
|
+
await handleStatusBanner(process.cwd());
|
|
393
393
|
}
|
|
394
394
|
catch { /* non-fatal */ }
|
|
395
395
|
}
|
|
@@ -48,40 +48,34 @@ export interface AutoDashboardData {
|
|
|
48
48
|
|
|
49
49
|
// ─── Unit Description Helpers ─────────────────────────────────────────────────
|
|
50
50
|
|
|
51
|
+
/** Canonical verb and phase label for each known unit type. */
|
|
52
|
+
const UNIT_TYPE_INFO: Record<string, { verb: string; phaseLabel: string }> = {
|
|
53
|
+
"research-milestone": { verb: "researching", phaseLabel: "RESEARCH" },
|
|
54
|
+
"research-slice": { verb: "researching", phaseLabel: "RESEARCH" },
|
|
55
|
+
"plan-milestone": { verb: "planning", phaseLabel: "PLAN" },
|
|
56
|
+
"plan-slice": { verb: "planning", phaseLabel: "PLAN" },
|
|
57
|
+
"execute-task": { verb: "executing", phaseLabel: "EXECUTE" },
|
|
58
|
+
"complete-slice": { verb: "completing", phaseLabel: "COMPLETE" },
|
|
59
|
+
"replan-slice": { verb: "replanning", phaseLabel: "REPLAN" },
|
|
60
|
+
"rewrite-docs": { verb: "rewriting", phaseLabel: "REWRITE" },
|
|
61
|
+
"reassess-roadmap": { verb: "reassessing", phaseLabel: "REASSESS" },
|
|
62
|
+
"run-uat": { verb: "running UAT", phaseLabel: "UAT" },
|
|
63
|
+
};
|
|
64
|
+
|
|
51
65
|
export function unitVerb(unitType: string): string {
|
|
52
66
|
if (unitType.startsWith("hook/")) return `hook: ${unitType.slice(5)}`;
|
|
53
|
-
|
|
54
|
-
case "research-milestone":
|
|
55
|
-
case "research-slice": return "researching";
|
|
56
|
-
case "plan-milestone":
|
|
57
|
-
case "plan-slice": return "planning";
|
|
58
|
-
case "execute-task": return "executing";
|
|
59
|
-
case "complete-slice": return "completing";
|
|
60
|
-
case "replan-slice": return "replanning";
|
|
61
|
-
case "rewrite-docs": return "rewriting";
|
|
62
|
-
case "reassess-roadmap": return "reassessing";
|
|
63
|
-
case "run-uat": return "running UAT";
|
|
64
|
-
default: return unitType;
|
|
65
|
-
}
|
|
67
|
+
return UNIT_TYPE_INFO[unitType]?.verb ?? unitType;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
export function unitPhaseLabel(unitType: string): string {
|
|
69
71
|
if (unitType.startsWith("hook/")) return "HOOK";
|
|
70
|
-
|
|
71
|
-
case "research-milestone": return "RESEARCH";
|
|
72
|
-
case "research-slice": return "RESEARCH";
|
|
73
|
-
case "plan-milestone": return "PLAN";
|
|
74
|
-
case "plan-slice": return "PLAN";
|
|
75
|
-
case "execute-task": return "EXECUTE";
|
|
76
|
-
case "complete-slice": return "COMPLETE";
|
|
77
|
-
case "replan-slice": return "REPLAN";
|
|
78
|
-
case "rewrite-docs": return "REWRITE";
|
|
79
|
-
case "reassess-roadmap": return "REASSESS";
|
|
80
|
-
case "run-uat": return "UAT";
|
|
81
|
-
default: return unitType.toUpperCase();
|
|
82
|
-
}
|
|
72
|
+
return UNIT_TYPE_INFO[unitType]?.phaseLabel ?? unitType.toUpperCase();
|
|
83
73
|
}
|
|
84
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Describe the expected next step after the current unit completes.
|
|
77
|
+
* Unit types here mirror the keys in UNIT_TYPE_INFO above.
|
|
78
|
+
*/
|
|
85
79
|
function peekNext(unitType: string, state: GSDState): string {
|
|
86
80
|
// Show active hook info in progress display
|
|
87
81
|
const activeHookState = getActiveHook();
|
|
@@ -182,15 +182,10 @@ export async function dispatchDirectPhase(
|
|
|
182
182
|
ctx.ui.notify("Cannot dispatch run-uat: no UAT file found.", "warning");
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
const uatContent = await loadFile(uatFile);
|
|
186
|
-
if (!uatContent) {
|
|
187
|
-
ctx.ui.notify("Cannot dispatch run-uat: UAT file is empty.", "warning");
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
185
|
const uatPath = relSliceFile(base, mid, sid, "UAT");
|
|
191
186
|
unitType = "run-uat";
|
|
192
187
|
unitId = `${mid}/${sid}`;
|
|
193
|
-
prompt = await buildRunUatPrompt(mid, sid, uatPath,
|
|
188
|
+
prompt = await buildRunUatPrompt(mid, sid, uatPath, base);
|
|
194
189
|
break;
|
|
195
190
|
}
|
|
196
191
|
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import type { GSDState } from "./types.js";
|
|
13
13
|
import type { GSDPreferences } from "./preferences.js";
|
|
14
|
-
import
|
|
15
|
-
import { loadFile, extractUatType, loadActiveOverrides, parseRoadmap } from "./files.js";
|
|
14
|
+
import { loadFile, loadActiveOverrides, parseRoadmap } from "./files.js";
|
|
16
15
|
import {
|
|
17
16
|
resolveMilestoneFile, resolveMilestonePath, resolveSliceFile, resolveTaskFile,
|
|
18
17
|
relSliceFile, buildMilestoneFileName,
|
|
@@ -39,7 +38,7 @@ import {
|
|
|
39
38
|
// ─── Types ────────────────────────────────────────────────────────────────
|
|
40
39
|
|
|
41
40
|
export type DispatchAction =
|
|
42
|
-
| { action: "dispatch"; unitType: string; unitId: string; prompt: string
|
|
41
|
+
| { action: "dispatch"; unitType: string; unitId: string; prompt: string }
|
|
43
42
|
| { action: "stop"; reason: string; level: "info" | "warning" | "error" }
|
|
44
43
|
| { action: "skip" };
|
|
45
44
|
|
|
@@ -138,17 +137,14 @@ const DISPATCH_RULES: DispatchRule[] = [
|
|
|
138
137
|
match: async ({ state, mid, basePath, prefs }) => {
|
|
139
138
|
const needsRunUat = await checkNeedsRunUat(basePath, mid, state, prefs);
|
|
140
139
|
if (!needsRunUat) return null;
|
|
141
|
-
const { sliceId
|
|
142
|
-
const uatFile = resolveSliceFile(basePath, mid, sliceId, "UAT")!;
|
|
143
|
-
const uatContent = await loadFile(uatFile);
|
|
140
|
+
const { sliceId } = needsRunUat;
|
|
144
141
|
return {
|
|
145
142
|
action: "dispatch",
|
|
146
143
|
unitType: "run-uat",
|
|
147
144
|
unitId: `${mid}/${sliceId}`,
|
|
148
145
|
prompt: await buildRunUatPrompt(
|
|
149
|
-
mid, sliceId, relSliceFile(basePath, mid, sliceId, "UAT"),
|
|
146
|
+
mid, sliceId, relSliceFile(basePath, mid, sliceId, "UAT"), basePath,
|
|
150
147
|
),
|
|
151
|
-
pauseAfterDispatch: uatType !== "artifact-driven",
|
|
152
148
|
};
|
|
153
149
|
},
|
|
154
150
|
},
|
|
@@ -60,9 +60,31 @@ import {
|
|
|
60
60
|
hideFooter,
|
|
61
61
|
} from "./auto-dashboard.js";
|
|
62
62
|
import { join } from "node:path";
|
|
63
|
+
import { STATE_REBUILD_MIN_INTERVAL_MS } from "./auto-constants.js";
|
|
63
64
|
|
|
64
|
-
/**
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Initialize a unit dispatch: stamp the current time, set `s.currentUnit`,
|
|
67
|
+
* and persist the initial runtime record. Returns `startedAt` for callers
|
|
68
|
+
* that need the timestamp.
|
|
69
|
+
*/
|
|
70
|
+
function dispatchUnit(
|
|
71
|
+
s: AutoSession,
|
|
72
|
+
basePath: string,
|
|
73
|
+
unitType: string,
|
|
74
|
+
unitId: string,
|
|
75
|
+
): number {
|
|
76
|
+
const startedAt = Date.now();
|
|
77
|
+
s.currentUnit = { type: unitType, id: unitId, startedAt };
|
|
78
|
+
writeUnitRuntimeRecord(basePath, unitType, unitId, startedAt, {
|
|
79
|
+
phase: "dispatched",
|
|
80
|
+
wrapupWarningSent: false,
|
|
81
|
+
timeoutAt: null,
|
|
82
|
+
lastProgressAt: startedAt,
|
|
83
|
+
progressCount: 0,
|
|
84
|
+
lastProgressKind: "dispatch",
|
|
85
|
+
});
|
|
86
|
+
return startedAt;
|
|
87
|
+
}
|
|
66
88
|
|
|
67
89
|
export interface PostUnitContext {
|
|
68
90
|
s: AutoSession;
|
|
@@ -364,19 +386,10 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
364
386
|
if (s.currentUnit && !s.stepMode) {
|
|
365
387
|
const hookUnit = checkPostUnitHooks(s.currentUnit.type, s.currentUnit.id, s.basePath);
|
|
366
388
|
if (hookUnit) {
|
|
367
|
-
const hookStartedAt = Date.now();
|
|
368
389
|
if (s.currentUnit) {
|
|
369
390
|
await closeoutUnit(ctx, s.basePath, s.currentUnit.type, s.currentUnit.id, s.currentUnit.startedAt, buildSnapshotOpts(s.currentUnit.type, s.currentUnit.id));
|
|
370
391
|
}
|
|
371
|
-
s.
|
|
372
|
-
writeUnitRuntimeRecord(s.basePath, hookUnit.unitType, hookUnit.unitId, hookStartedAt, {
|
|
373
|
-
phase: "dispatched",
|
|
374
|
-
wrapupWarningSent: false,
|
|
375
|
-
timeoutAt: null,
|
|
376
|
-
lastProgressAt: hookStartedAt,
|
|
377
|
-
progressCount: 0,
|
|
378
|
-
lastProgressKind: "dispatch",
|
|
379
|
-
});
|
|
392
|
+
dispatchUnit(s, s.basePath, hookUnit.unitType, hookUnit.unitId);
|
|
380
393
|
|
|
381
394
|
const state = await deriveState(s.basePath);
|
|
382
395
|
updateProgressWidget(ctx, hookUnit.unitType, hookUnit.unitId, state);
|
|
@@ -498,16 +511,7 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
498
511
|
|
|
499
512
|
const triageUnitType = "triage-captures";
|
|
500
513
|
const triageUnitId = `${mid}/${sid}/triage`;
|
|
501
|
-
|
|
502
|
-
s.currentUnit = { type: triageUnitType, id: triageUnitId, startedAt: triageStartedAt };
|
|
503
|
-
writeUnitRuntimeRecord(s.basePath, triageUnitType, triageUnitId, triageStartedAt, {
|
|
504
|
-
phase: "dispatched",
|
|
505
|
-
wrapupWarningSent: false,
|
|
506
|
-
timeoutAt: null,
|
|
507
|
-
lastProgressAt: triageStartedAt,
|
|
508
|
-
progressCount: 0,
|
|
509
|
-
lastProgressKind: "dispatch",
|
|
510
|
-
});
|
|
514
|
+
dispatchUnit(s, s.basePath, triageUnitType, triageUnitId);
|
|
511
515
|
updateProgressWidget(ctx, triageUnitType, triageUnitId, state);
|
|
512
516
|
|
|
513
517
|
const result = await s.cmdCtx!.newSession();
|
|
@@ -568,16 +572,7 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
568
572
|
|
|
569
573
|
const qtUnitType = "quick-task";
|
|
570
574
|
const qtUnitId = `${s.currentMilestoneId}/${capture.id}`;
|
|
571
|
-
|
|
572
|
-
s.currentUnit = { type: qtUnitType, id: qtUnitId, startedAt: qtStartedAt };
|
|
573
|
-
writeUnitRuntimeRecord(s.basePath, qtUnitType, qtUnitId, qtStartedAt, {
|
|
574
|
-
phase: "dispatched",
|
|
575
|
-
wrapupWarningSent: false,
|
|
576
|
-
timeoutAt: null,
|
|
577
|
-
lastProgressAt: qtStartedAt,
|
|
578
|
-
progressCount: 0,
|
|
579
|
-
lastProgressKind: "dispatch",
|
|
580
|
-
});
|
|
575
|
+
dispatchUnit(s, s.basePath, qtUnitType, qtUnitId);
|
|
581
576
|
const state = await deriveState(s.basePath);
|
|
582
577
|
updateProgressWidget(ctx, qtUnitType, qtUnitId, state);
|
|
583
578
|
|
|
@@ -324,6 +324,27 @@ function oneLine(text: string): string {
|
|
|
324
324
|
return text.replace(/\s+/g, " ").trim();
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
/** Build the standard inlined-context section used by all prompt builders. */
|
|
328
|
+
function buildInlinedContextSection(inlined: string[]): string {
|
|
329
|
+
return `## Inlined Context (preloaded — do not re-read these files)\n\n${inlined.join("\n\n---\n\n")}`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** Build the formatted list of available GSD source files for planners to read on demand. */
|
|
333
|
+
function buildSourceFileList(base: string, opts?: { includeProject?: boolean }): string {
|
|
334
|
+
const paths: string[] = [];
|
|
335
|
+
if (opts?.includeProject && existsSync(resolveGsdRootFile(base, "PROJECT")))
|
|
336
|
+
paths.push(`- **Project**: \`${relGsdRootFile("PROJECT")}\``);
|
|
337
|
+
if (existsSync(resolveGsdRootFile(base, "REQUIREMENTS")))
|
|
338
|
+
paths.push(`- **Requirements**: \`${relGsdRootFile("REQUIREMENTS")}\``);
|
|
339
|
+
if (existsSync(resolveGsdRootFile(base, "DECISIONS")))
|
|
340
|
+
paths.push(`- **Decisions**: \`${relGsdRootFile("DECISIONS")}\``);
|
|
341
|
+
if (paths.length === 0) {
|
|
342
|
+
const types = opts?.includeProject ? "project/requirements/decisions" : "requirements/decisions";
|
|
343
|
+
return `_No ${types} files found._`;
|
|
344
|
+
}
|
|
345
|
+
return paths.join("\n");
|
|
346
|
+
}
|
|
347
|
+
|
|
327
348
|
// ─── Section Builders ──────────────────────────────────────────────────────
|
|
328
349
|
|
|
329
350
|
export function buildResumeSection(
|
|
@@ -540,8 +561,11 @@ export async function checkNeedsRunUat(
|
|
|
540
561
|
if (resultContent) return null;
|
|
541
562
|
}
|
|
542
563
|
|
|
543
|
-
// Classify UAT type;
|
|
564
|
+
// Classify UAT type; skip non-artifact-driven types — auto-mode can only
|
|
565
|
+
// execute mechanical checks. Non-artifact UATs are tracked in the dashboard
|
|
566
|
+
// but don't block auto-mode progression.
|
|
544
567
|
const uatType = extractUatType(uatContent) ?? "human-experience";
|
|
568
|
+
if (uatType !== "artifact-driven") return null;
|
|
545
569
|
|
|
546
570
|
return { sliceId: sid, uatType };
|
|
547
571
|
}
|
|
@@ -564,7 +588,7 @@ export async function buildResearchMilestonePrompt(mid: string, midTitle: string
|
|
|
564
588
|
if (knowledgeInlineRM) inlined.push(knowledgeInlineRM);
|
|
565
589
|
inlined.push(inlineTemplate("research", "Research"));
|
|
566
590
|
|
|
567
|
-
const inlinedContext =
|
|
591
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
568
592
|
|
|
569
593
|
const outputRelPath = relMilestoneFile(base, mid, "RESEARCH");
|
|
570
594
|
return loadPrompt("research-milestone", {
|
|
@@ -592,17 +616,7 @@ export async function buildPlanMilestonePrompt(mid: string, midTitle: string, ba
|
|
|
592
616
|
const { inlinePriorMilestoneSummary } = await import("./files.js");
|
|
593
617
|
const priorSummaryInline = await inlinePriorMilestoneSummary(mid, base);
|
|
594
618
|
if (priorSummaryInline) inlined.push(priorSummaryInline);
|
|
595
|
-
|
|
596
|
-
const sourcePaths: string[] = [];
|
|
597
|
-
if (existsSync(resolveGsdRootFile(base, "PROJECT")))
|
|
598
|
-
sourcePaths.push(`- **Project**: \`${relGsdRootFile("PROJECT")}\``);
|
|
599
|
-
if (existsSync(resolveGsdRootFile(base, "REQUIREMENTS")))
|
|
600
|
-
sourcePaths.push(`- **Requirements**: \`${relGsdRootFile("REQUIREMENTS")}\``);
|
|
601
|
-
if (existsSync(resolveGsdRootFile(base, "DECISIONS")))
|
|
602
|
-
sourcePaths.push(`- **Decisions**: \`${relGsdRootFile("DECISIONS")}\``);
|
|
603
|
-
const sourceFilePaths = sourcePaths.length > 0
|
|
604
|
-
? sourcePaths.join("\n")
|
|
605
|
-
: "_No project/requirements/decisions files found._";
|
|
619
|
+
const sourceFilePaths = buildSourceFileList(base, { includeProject: true });
|
|
606
620
|
|
|
607
621
|
const knowledgeInlinePM = await inlineGsdRootFile(base, "knowledge.md", "Project Knowledge");
|
|
608
622
|
if (knowledgeInlinePM) inlined.push(knowledgeInlinePM);
|
|
@@ -618,7 +632,7 @@ export async function buildPlanMilestonePrompt(mid: string, midTitle: string, ba
|
|
|
618
632
|
inlined.push(inlineTemplate("task-plan", "Task Plan"));
|
|
619
633
|
}
|
|
620
634
|
|
|
621
|
-
const inlinedContext =
|
|
635
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
622
636
|
|
|
623
637
|
const outputRelPath = relMilestoneFile(base, mid, "ROADMAP");
|
|
624
638
|
const secretsOutputPath = join(base, relMilestoneFile(base, mid, "SECRETS"));
|
|
@@ -667,7 +681,7 @@ export async function buildResearchSlicePrompt(
|
|
|
667
681
|
const overridesInline = formatOverridesSection(activeOverrides);
|
|
668
682
|
if (overridesInline) inlined.unshift(overridesInline);
|
|
669
683
|
|
|
670
|
-
const inlinedContext =
|
|
684
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
671
685
|
|
|
672
686
|
const outputRelPath = relSliceFile(base, mid, sid, "RESEARCH");
|
|
673
687
|
return loadPrompt("research-slice", {
|
|
@@ -697,15 +711,7 @@ export async function buildPlanSlicePrompt(
|
|
|
697
711
|
inlined.push(await inlineFile(roadmapPath, roadmapRel, "Milestone Roadmap"));
|
|
698
712
|
const researchInline = await inlineFileOptional(researchPath, researchRel, "Slice Research");
|
|
699
713
|
if (researchInline) inlined.push(researchInline);
|
|
700
|
-
|
|
701
|
-
const sliceSourcePaths: string[] = [];
|
|
702
|
-
if (existsSync(resolveGsdRootFile(base, "REQUIREMENTS")))
|
|
703
|
-
sliceSourcePaths.push(`- **Requirements**: \`${relGsdRootFile("REQUIREMENTS")}\``);
|
|
704
|
-
if (existsSync(resolveGsdRootFile(base, "DECISIONS")))
|
|
705
|
-
sliceSourcePaths.push(`- **Decisions**: \`${relGsdRootFile("DECISIONS")}\``);
|
|
706
|
-
const sliceSourceFilePaths = sliceSourcePaths.length > 0
|
|
707
|
-
? sliceSourcePaths.join("\n")
|
|
708
|
-
: "_No requirements/decisions files found._";
|
|
714
|
+
const sliceSourceFilePaths = buildSourceFileList(base);
|
|
709
715
|
|
|
710
716
|
const knowledgeInlinePS = await inlineGsdRootFile(base, "knowledge.md", "Project Knowledge");
|
|
711
717
|
if (knowledgeInlinePS) inlined.push(knowledgeInlinePS);
|
|
@@ -719,7 +725,7 @@ export async function buildPlanSlicePrompt(
|
|
|
719
725
|
const planOverridesInline = formatOverridesSection(planActiveOverrides);
|
|
720
726
|
if (planOverridesInline) inlined.unshift(planOverridesInline);
|
|
721
727
|
|
|
722
|
-
const inlinedContext =
|
|
728
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
723
729
|
|
|
724
730
|
// Build executor context constraints from the budget engine
|
|
725
731
|
const executorContextConstraints = formatExecutorConstraints();
|
|
@@ -894,7 +900,7 @@ export async function buildCompleteSlicePrompt(
|
|
|
894
900
|
const completeOverridesInline = formatOverridesSection(completeActiveOverrides);
|
|
895
901
|
if (completeOverridesInline) inlined.unshift(completeOverridesInline);
|
|
896
902
|
|
|
897
|
-
const inlinedContext =
|
|
903
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
898
904
|
|
|
899
905
|
const sliceRel = relSlicePath(base, mid, sid);
|
|
900
906
|
const sliceSummaryPath = join(base, `${sliceRel}/${sid}-SUMMARY.md`);
|
|
@@ -953,7 +959,7 @@ export async function buildCompleteMilestonePrompt(
|
|
|
953
959
|
if (contextInline) inlined.push(contextInline);
|
|
954
960
|
inlined.push(inlineTemplate("milestone-summary", "Milestone Summary"));
|
|
955
961
|
|
|
956
|
-
const inlinedContext =
|
|
962
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
957
963
|
|
|
958
964
|
const milestoneSummaryPath = join(base, `${relMilestonePath(base, mid)}/${mid}-SUMMARY.md`);
|
|
959
965
|
|
|
@@ -1024,7 +1030,7 @@ export async function buildValidateMilestonePrompt(
|
|
|
1024
1030
|
const contextInline = await inlineFileOptional(contextPath, contextRel, "Milestone Context");
|
|
1025
1031
|
if (contextInline) inlined.push(contextInline);
|
|
1026
1032
|
|
|
1027
|
-
const inlinedContext =
|
|
1033
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
1028
1034
|
|
|
1029
1035
|
const validationOutputPath = join(base, `${relMilestonePath(base, mid)}/${mid}-VALIDATION.md`);
|
|
1030
1036
|
const roadmapOutputPath = `${relMilestonePath(base, mid)}/${mid}-ROADMAP.md`;
|
|
@@ -1078,7 +1084,7 @@ export async function buildReplanSlicePrompt(
|
|
|
1078
1084
|
const replanOverridesInline = formatOverridesSection(replanActiveOverrides);
|
|
1079
1085
|
if (replanOverridesInline) inlined.unshift(replanOverridesInline);
|
|
1080
1086
|
|
|
1081
|
-
const inlinedContext =
|
|
1087
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
1082
1088
|
|
|
1083
1089
|
const replanPath = join(base, `${relSlicePath(base, mid, sid)}/${sid}-REPLAN.md`);
|
|
1084
1090
|
|
|
@@ -1111,7 +1117,7 @@ export async function buildReplanSlicePrompt(
|
|
|
1111
1117
|
}
|
|
1112
1118
|
|
|
1113
1119
|
export async function buildRunUatPrompt(
|
|
1114
|
-
mid: string, sliceId: string, uatPath: string,
|
|
1120
|
+
mid: string, sliceId: string, uatPath: string, base: string,
|
|
1115
1121
|
): Promise<string> {
|
|
1116
1122
|
const inlined: string[] = [];
|
|
1117
1123
|
inlined.push(await inlineFile(resolveSliceFile(base, mid, sliceId, "UAT"), uatPath, `${sliceId} UAT`));
|
|
@@ -1126,10 +1132,9 @@ export async function buildRunUatPrompt(
|
|
|
1126
1132
|
const projectInline = await inlineProjectFromDb(base);
|
|
1127
1133
|
if (projectInline) inlined.push(projectInline);
|
|
1128
1134
|
|
|
1129
|
-
const inlinedContext =
|
|
1135
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
1130
1136
|
|
|
1131
1137
|
const uatResultPath = join(base, relSliceFile(base, mid, sliceId, "UAT-RESULT"));
|
|
1132
|
-
const uatType = extractUatType(uatContent) ?? "human-experience";
|
|
1133
1138
|
|
|
1134
1139
|
return loadPrompt("run-uat", {
|
|
1135
1140
|
workingDirectory: base,
|
|
@@ -1137,7 +1142,6 @@ export async function buildRunUatPrompt(
|
|
|
1137
1142
|
sliceId,
|
|
1138
1143
|
uatPath,
|
|
1139
1144
|
uatResultPath,
|
|
1140
|
-
uatType,
|
|
1141
1145
|
inlinedContext,
|
|
1142
1146
|
});
|
|
1143
1147
|
}
|
|
@@ -1165,7 +1169,7 @@ export async function buildReassessRoadmapPrompt(
|
|
|
1165
1169
|
const knowledgeInlineRA = await inlineGsdRootFile(base, "knowledge.md", "Project Knowledge");
|
|
1166
1170
|
if (knowledgeInlineRA) inlined.push(knowledgeInlineRA);
|
|
1167
1171
|
|
|
1168
|
-
const inlinedContext =
|
|
1172
|
+
const inlinedContext = buildInlinedContextSection(inlined);
|
|
1169
1173
|
|
|
1170
1174
|
const assessmentPath = join(base, relSliceFile(base, mid, completedSliceId, "ASSESSMENT"));
|
|
1171
1175
|
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
import { selfHealRuntimeRecords } from "./auto-recovery.js";
|
|
39
39
|
import { ensureGitignore, untrackRuntimeFiles } from "./gitignore.js";
|
|
40
40
|
import { nativeIsRepo, nativeInit } from "./native-git-bridge.js";
|
|
41
|
-
import {
|
|
41
|
+
import { createGitService } from "./git-service.js";
|
|
42
42
|
import {
|
|
43
43
|
captureIntegrationBranch,
|
|
44
44
|
detectWorktreeName,
|
|
@@ -129,11 +129,13 @@ export async function bootstrapAutoSession(
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// Initialize GitServiceImpl
|
|
132
|
-
s.gitService =
|
|
132
|
+
s.gitService = createGitService(s.basePath);
|
|
133
133
|
|
|
134
|
-
// Check for crash from previous session (use both old and new lock data)
|
|
134
|
+
// Check for crash from previous session (use both old and new lock data).
|
|
135
|
+
// Skip if the lock PID matches this process — acquireSessionLock() writes
|
|
136
|
+
// to the same auto.lock file before this check, so we'd always false-positive.
|
|
135
137
|
const crashLock = readCrashLock(base);
|
|
136
|
-
if (crashLock) {
|
|
138
|
+
if (crashLock && crashLock.pid !== process.pid) {
|
|
137
139
|
// We already hold the session lock, so no concurrent session is running.
|
|
138
140
|
// The crash lock is from a dead process — recover context from it.
|
|
139
141
|
const recoveredMid = crashLock.unitId.split("/")[0];
|
|
@@ -330,12 +332,12 @@ export async function bootstrapAutoSession(
|
|
|
330
332
|
if (existingWtPath) {
|
|
331
333
|
const wtPath = enterAutoWorktree(base, s.currentMilestoneId);
|
|
332
334
|
s.basePath = wtPath;
|
|
333
|
-
s.gitService =
|
|
335
|
+
s.gitService = createGitService(s.basePath);
|
|
334
336
|
ctx.ui.notify(`Entered auto-worktree at ${wtPath}`, "info");
|
|
335
337
|
} else {
|
|
336
338
|
const wtPath = createAutoWorktree(base, s.currentMilestoneId);
|
|
337
339
|
s.basePath = wtPath;
|
|
338
|
-
s.gitService =
|
|
340
|
+
s.gitService = createGitService(s.basePath);
|
|
339
341
|
ctx.ui.notify(`Created auto-worktree at ${wtPath}`, "info");
|
|
340
342
|
}
|
|
341
343
|
registerSigtermHandler(s.originalBasePath);
|