gsd-pi 2.66.1-dev.3c26b49 → 2.66.1-dev.3cea7ac
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/dist/resources/extensions/ask-user-questions.js +79 -11
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +4 -3
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +10 -3
- package/dist/resources/extensions/gsd/auto/loop.js +13 -1
- package/dist/resources/extensions/gsd/auto/phases.js +10 -4
- package/dist/resources/extensions/gsd/auto/run-unit.js +10 -2
- package/dist/resources/extensions/gsd/auto/session.js +1 -1
- package/dist/resources/extensions/gsd/auto-dashboard.js +65 -15
- package/dist/resources/extensions/gsd/auto-dispatch.js +30 -28
- package/dist/resources/extensions/gsd/auto-prompts.js +6 -6
- package/dist/resources/extensions/gsd/auto-recovery.js +11 -12
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +18 -6
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +59 -5
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +8 -5
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +186 -14
- package/dist/resources/extensions/gsd/codebase-generator.js +4 -0
- package/dist/resources/extensions/gsd/commands/handlers/core.js +3 -3
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -4
- package/dist/resources/extensions/gsd/custom-workflow-engine.js +3 -1
- package/dist/resources/extensions/gsd/detection.js +6 -0
- package/dist/resources/extensions/gsd/files.js +19 -2
- package/dist/resources/extensions/gsd/guided-flow.js +12 -8
- package/dist/resources/extensions/gsd/index.js +1 -1
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +2 -0
- package/dist/resources/extensions/gsd/parsers-legacy.js +3 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-prepared.md +7 -7
- package/dist/resources/extensions/gsd/prompts/discuss.md +3 -3
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +3 -3
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +3 -1
- package/dist/resources/extensions/gsd/prompts/rethink.md +6 -2
- package/dist/resources/extensions/gsd/prompts/system.md +1 -1
- package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +4 -4
- package/dist/resources/extensions/gsd/prompts/worktree-merge.md +3 -1
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +2 -1
- package/dist/resources/extensions/gsd/state.js +2 -1
- package/dist/resources/extensions/gsd/visualizer-overlay.js +27 -26
- package/dist/resources/extensions/gsd/workflow-reconcile.js +46 -7
- package/dist/resources/extensions/remote-questions/manager.js +8 -0
- package/dist/resources/extensions/shared/interview-ui.js +10 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +20 -20
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +20 -20
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +4 -3
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/utils/json-parse.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/json-parse.js +11 -1
- package/packages/pi-ai/dist/utils/json-parse.js.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.js +60 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.js.map +1 -1
- package/packages/pi-ai/dist/utils/tests/json-parse.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/tests/json-parse.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/tests/json-parse.test.js +14 -0
- package/packages/pi-ai/dist/utils/tests/json-parse.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js +10 -0
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +4 -3
- package/packages/pi-ai/src/utils/json-parse.ts +11 -1
- package/packages/pi-ai/src/utils/repair-tool-json.ts +69 -1
- package/packages/pi-ai/src/utils/tests/json-parse.test.ts +17 -0
- package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +13 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.js +17 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +9 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts +18 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +11 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/scoped-models-selector.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +2 -2
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +13 -0
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js +35 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/tui.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +43 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -0
- package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/packages/pi-tui/dist/autocomplete.js +9 -7
- package/packages/pi-tui/dist/autocomplete.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/editor.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.js +54 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.js.map +1 -0
- package/packages/pi-tui/dist/components/editor.d.ts +3 -1
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +14 -3
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.js +6 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +8 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +15 -0
- package/packages/pi-tui/src/__tests__/stdin-buffer.test.ts +43 -0
- package/packages/pi-tui/src/__tests__/tui.test.ts +50 -0
- package/packages/pi-tui/src/autocomplete.ts +9 -7
- package/packages/pi-tui/src/components/__tests__/editor.test.ts +64 -0
- package/packages/pi-tui/src/components/editor.ts +14 -3
- package/packages/pi-tui/src/stdin-buffer.ts +7 -0
- package/packages/pi-tui/src/tui.ts +9 -0
- package/src/resources/extensions/ask-user-questions.ts +103 -11
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +4 -3
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +12 -3
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +17 -0
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +18 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -1
- package/src/resources/extensions/gsd/auto/loop.ts +14 -1
- package/src/resources/extensions/gsd/auto/phases.ts +10 -5
- package/src/resources/extensions/gsd/auto/run-unit.ts +14 -2
- package/src/resources/extensions/gsd/auto/session.ts +1 -1
- package/src/resources/extensions/gsd/auto-dashboard.ts +76 -16
- package/src/resources/extensions/gsd/auto-dispatch.ts +36 -35
- package/src/resources/extensions/gsd/auto-prompts.ts +5 -6
- package/src/resources/extensions/gsd/auto-recovery.ts +15 -15
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +27 -6
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +67 -6
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +11 -8
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +209 -16
- package/src/resources/extensions/gsd/codebase-generator.ts +4 -0
- package/src/resources/extensions/gsd/commands/handlers/core.ts +6 -6
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +11 -4
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +3 -1
- package/src/resources/extensions/gsd/detection.ts +6 -0
- package/src/resources/extensions/gsd/files.ts +21 -2
- package/src/resources/extensions/gsd/guided-flow.ts +15 -8
- package/src/resources/extensions/gsd/index.ts +6 -0
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +2 -0
- package/src/resources/extensions/gsd/parsers-legacy.ts +3 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-prepared.md +7 -7
- package/src/resources/extensions/gsd/prompts/discuss.md +3 -3
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +3 -3
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +3 -1
- package/src/resources/extensions/gsd/prompts/rethink.md +6 -2
- package/src/resources/extensions/gsd/prompts/system.md +1 -1
- package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +4 -4
- package/src/resources/extensions/gsd/prompts/worktree-merge.md +3 -1
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +4 -1
- package/src/resources/extensions/gsd/state.ts +2 -1
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +52 -1
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +50 -2
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/core-overlay-fallback.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/detection.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +53 -13
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +3 -4
- package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +71 -2
- package/src/resources/extensions/gsd/tests/parsers.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/queue-execution-guard.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/reactive-graph.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/workflow-reconcile.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +210 -35
- package/src/resources/extensions/gsd/visualizer-overlay.ts +31 -27
- package/src/resources/extensions/gsd/workflow-reconcile.ts +59 -8
- package/src/resources/extensions/remote-questions/manager.ts +9 -0
- package/src/resources/extensions/shared/interview-ui.ts +13 -0
- /package/dist/web/standalone/.next/static/{ZzNRjwBFLOhqEu4BYCQi9 → HxFcJ8GrYNPsg9ARz7GPz}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ZzNRjwBFLOhqEu4BYCQi9 → HxFcJ8GrYNPsg9ARz7GPz}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const MILESTONE_CONTEXT_RE = /M\d+(?:-[a-z0-9]{6})?-CONTEXT\.md$/;
|
|
2
|
+
const CONTEXT_MILESTONE_RE = /(?:^|[/\\])(M\d+(?:-[a-z0-9]{6})?)-CONTEXT\.md$/i;
|
|
3
|
+
const DEPTH_VERIFICATION_MILESTONE_RE = /depth_verification[_-](M\d+(?:-[a-z0-9]{6})?)/i;
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Path segment that identifies .gsd/ planning artifacts.
|
|
@@ -26,11 +28,53 @@ const QUEUE_SAFE_TOOLS = new Set([
|
|
|
26
28
|
*/
|
|
27
29
|
const BASH_READ_ONLY_RE = /^\s*(cat|head|tail|less|more|wc|file|stat|du|df|which|type|echo|printf|ls|find|grep|rg|awk|sed\b(?!.*-i)|sort|uniq|diff|comm|tr|cut|tee\s+-a\s+\/dev\/null|git\s+(log|show|diff|status|branch|tag|remote|rev-parse|ls-files|blame|shortlog|describe|stash\s+list|config\s+--get|cat-file)|gh\s+(issue|pr|api|repo|release)\s+(view|list|diff|status|checks)|mkdir\s+-p\s+\.gsd|rtk\s)/;
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
const verifiedDepthMilestones = new Set<string>();
|
|
30
32
|
let activeQueuePhase = false;
|
|
31
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Discussion gate enforcement state.
|
|
36
|
+
*
|
|
37
|
+
* When ask_user_questions is called with a recognized gate question ID,
|
|
38
|
+
* we track the pending gate. Until the gate is confirmed (user selects the
|
|
39
|
+
* first/recommended option), all non-read-only tool calls are blocked.
|
|
40
|
+
* This mechanically prevents the model from rationalizing past failed or
|
|
41
|
+
* cancelled gate questions.
|
|
42
|
+
*/
|
|
43
|
+
let pendingGateId: string | null = null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Recognized gate question ID patterns.
|
|
47
|
+
* These appear in both discuss-prepared.md (4-layer) and discuss.md (depth/requirements/roadmap).
|
|
48
|
+
*/
|
|
49
|
+
const GATE_QUESTION_PATTERNS = [
|
|
50
|
+
"layer1_scope_gate",
|
|
51
|
+
"layer2_architecture_gate",
|
|
52
|
+
"layer3_error_gate",
|
|
53
|
+
"layer4_quality_gate",
|
|
54
|
+
"depth_verification",
|
|
55
|
+
] as const;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Tools that are safe to call while a gate is pending.
|
|
59
|
+
* Includes read-only tools and ask_user_questions itself (so the model can re-ask).
|
|
60
|
+
*/
|
|
61
|
+
const GATE_SAFE_TOOLS = new Set([
|
|
62
|
+
"ask_user_questions",
|
|
63
|
+
"read", "grep", "find", "ls", "glob",
|
|
64
|
+
"search-the-web", "resolve_library", "get_library_docs", "fetch_page",
|
|
65
|
+
"search_and_read",
|
|
66
|
+
]);
|
|
67
|
+
|
|
32
68
|
export function isDepthVerified(): boolean {
|
|
33
|
-
return
|
|
69
|
+
return verifiedDepthMilestones.size > 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Check whether a specific milestone has passed depth verification.
|
|
74
|
+
*/
|
|
75
|
+
export function isMilestoneDepthVerified(milestoneId: string | null | undefined): boolean {
|
|
76
|
+
if (!milestoneId) return false;
|
|
77
|
+
return verifiedDepthMilestones.has(milestoneId);
|
|
34
78
|
}
|
|
35
79
|
|
|
36
80
|
export function isQueuePhaseActive(): boolean {
|
|
@@ -42,16 +86,120 @@ export function setQueuePhaseActive(active: boolean): void {
|
|
|
42
86
|
}
|
|
43
87
|
|
|
44
88
|
export function resetWriteGateState(): void {
|
|
45
|
-
|
|
89
|
+
verifiedDepthMilestones.clear();
|
|
90
|
+
pendingGateId = null;
|
|
46
91
|
}
|
|
47
92
|
|
|
48
93
|
export function clearDiscussionFlowState(): void {
|
|
49
|
-
|
|
94
|
+
verifiedDepthMilestones.clear();
|
|
50
95
|
activeQueuePhase = false;
|
|
96
|
+
pendingGateId = null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function markDepthVerified(milestoneId?: string | null): void {
|
|
100
|
+
if (!milestoneId) return;
|
|
101
|
+
verifiedDepthMilestones.add(milestoneId);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check whether a question ID matches a recognized gate pattern.
|
|
106
|
+
*/
|
|
107
|
+
export function isGateQuestionId(questionId: string): boolean {
|
|
108
|
+
return GATE_QUESTION_PATTERNS.some(pattern => questionId.includes(pattern));
|
|
51
109
|
}
|
|
52
110
|
|
|
53
|
-
|
|
54
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Extract the milestone ID embedded in a depth-verification question id.
|
|
113
|
+
* Prompts are expected to use ids like `depth_verification_M001_confirm`.
|
|
114
|
+
*/
|
|
115
|
+
export function extractDepthVerificationMilestoneId(questionId: string): string | null {
|
|
116
|
+
const match = questionId.match(DEPTH_VERIFICATION_MILESTONE_RE);
|
|
117
|
+
return match?.[1] ?? null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Extract the milestone ID from a milestone CONTEXT file path.
|
|
122
|
+
*/
|
|
123
|
+
function extractContextMilestoneId(inputPath: string): string | null {
|
|
124
|
+
const match = inputPath.match(CONTEXT_MILESTONE_RE);
|
|
125
|
+
return match?.[1] ?? null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Mark a gate as pending (called when ask_user_questions is invoked with a gate ID).
|
|
130
|
+
*/
|
|
131
|
+
export function setPendingGate(gateId: string): void {
|
|
132
|
+
pendingGateId = gateId;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Clear the pending gate (called when the user confirms).
|
|
137
|
+
*/
|
|
138
|
+
export function clearPendingGate(): void {
|
|
139
|
+
pendingGateId = null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get the currently pending gate, if any.
|
|
144
|
+
*/
|
|
145
|
+
export function getPendingGate(): string | null {
|
|
146
|
+
return pendingGateId;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Check whether a tool call should be blocked because a discussion gate
|
|
151
|
+
* is pending (ask_user_questions was called but not confirmed).
|
|
152
|
+
*
|
|
153
|
+
* Returns { block: true, reason } if the tool should be blocked.
|
|
154
|
+
* Read-only tools and ask_user_questions itself are always allowed.
|
|
155
|
+
*/
|
|
156
|
+
export function shouldBlockPendingGate(
|
|
157
|
+
toolName: string,
|
|
158
|
+
_milestoneId: string | null,
|
|
159
|
+
_queuePhaseActive?: boolean,
|
|
160
|
+
): { block: boolean; reason?: string } {
|
|
161
|
+
if (!pendingGateId) return { block: false };
|
|
162
|
+
|
|
163
|
+
if (GATE_SAFE_TOOLS.has(toolName)) return { block: false };
|
|
164
|
+
|
|
165
|
+
// Bash read-only commands are also safe
|
|
166
|
+
if (toolName === "bash") return { block: false }; // bash is checked separately below
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
block: true,
|
|
170
|
+
reason: [
|
|
171
|
+
`HARD BLOCK: Discussion gate "${pendingGateId}" has not been confirmed by the user.`,
|
|
172
|
+
`You MUST re-call ask_user_questions with the gate question before making any other tool calls.`,
|
|
173
|
+
`If the previous ask_user_questions call failed, errored, was cancelled, or the user's response`,
|
|
174
|
+
`did not match a provided option, you MUST re-ask — never rationalize past the block.`,
|
|
175
|
+
`Do NOT proceed, do NOT use alternative approaches, do NOT skip the gate.`,
|
|
176
|
+
].join(" "),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Check whether a bash command should be blocked because a discussion gate is pending.
|
|
182
|
+
* Read-only bash commands are allowed; mutating commands are blocked.
|
|
183
|
+
*/
|
|
184
|
+
export function shouldBlockPendingGateBash(
|
|
185
|
+
command: string,
|
|
186
|
+
_milestoneId: string | null,
|
|
187
|
+
_queuePhaseActive?: boolean,
|
|
188
|
+
): { block: boolean; reason?: string } {
|
|
189
|
+
if (!pendingGateId) return { block: false };
|
|
190
|
+
|
|
191
|
+
// Allow read-only bash commands
|
|
192
|
+
if (BASH_READ_ONLY_RE.test(command)) return { block: false };
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
block: true,
|
|
196
|
+
reason: [
|
|
197
|
+
`HARD BLOCK: Discussion gate "${pendingGateId}" has not been confirmed by the user.`,
|
|
198
|
+
`You MUST re-call ask_user_questions with the gate question before running mutating commands.`,
|
|
199
|
+
`If the previous ask_user_questions call failed, errored, was cancelled, or the user's response`,
|
|
200
|
+
`did not match a provided option, you MUST re-ask — never rationalize past the block.`,
|
|
201
|
+
].join(" "),
|
|
202
|
+
};
|
|
55
203
|
}
|
|
56
204
|
|
|
57
205
|
/**
|
|
@@ -87,16 +235,24 @@ export function shouldBlockContextWrite(
|
|
|
87
235
|
toolName: string,
|
|
88
236
|
inputPath: string,
|
|
89
237
|
milestoneId: string | null,
|
|
90
|
-
|
|
91
|
-
queuePhaseActive?: boolean,
|
|
238
|
+
_queuePhaseActive?: boolean,
|
|
92
239
|
): { block: boolean; reason?: string } {
|
|
93
240
|
if (toolName !== "write") return { block: false };
|
|
94
|
-
|
|
95
|
-
const inDiscussion = milestoneId !== null;
|
|
96
|
-
const inQueue = queuePhaseActive ?? false;
|
|
97
|
-
if (!inDiscussion && !inQueue) return { block: false };
|
|
98
241
|
if (!MILESTONE_CONTEXT_RE.test(inputPath)) return { block: false };
|
|
99
|
-
|
|
242
|
+
|
|
243
|
+
const targetMilestoneId = extractContextMilestoneId(inputPath) ?? milestoneId;
|
|
244
|
+
if (!targetMilestoneId) {
|
|
245
|
+
return {
|
|
246
|
+
block: true,
|
|
247
|
+
reason: [
|
|
248
|
+
`HARD BLOCK: Cannot write milestone CONTEXT.md without knowing which milestone it belongs to.`,
|
|
249
|
+
`This is a mechanical gate — you MUST NOT proceed, retry, or rationalize past this block.`,
|
|
250
|
+
`Required action: call ask_user_questions with question id containing "depth_verification" and the milestone id.`,
|
|
251
|
+
].join(" "),
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (isMilestoneDepthVerified(targetMilestoneId)) return { block: false };
|
|
100
256
|
|
|
101
257
|
return {
|
|
102
258
|
block: true,
|
|
@@ -110,6 +266,40 @@ export function shouldBlockContextWrite(
|
|
|
110
266
|
};
|
|
111
267
|
}
|
|
112
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Check whether a gsd_summary_save CONTEXT artifact should be blocked.
|
|
271
|
+
* Slice-level CONTEXT artifacts are allowed; milestone-level CONTEXT writes
|
|
272
|
+
* require the milestone to be depth-verified first.
|
|
273
|
+
*/
|
|
274
|
+
export function shouldBlockContextArtifactSave(
|
|
275
|
+
artifactType: string,
|
|
276
|
+
milestoneId: string | null,
|
|
277
|
+
sliceId?: string | null,
|
|
278
|
+
): { block: boolean; reason?: string } {
|
|
279
|
+
if (artifactType !== "CONTEXT") return { block: false };
|
|
280
|
+
if (sliceId) return { block: false };
|
|
281
|
+
if (!milestoneId) {
|
|
282
|
+
return {
|
|
283
|
+
block: true,
|
|
284
|
+
reason: [
|
|
285
|
+
`HARD BLOCK: Cannot save milestone CONTEXT without a milestone_id.`,
|
|
286
|
+
`This is a mechanical gate — you MUST NOT proceed, retry, or rationalize past this block.`,
|
|
287
|
+
].join(" "),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (isMilestoneDepthVerified(milestoneId)) return { block: false };
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
block: true,
|
|
294
|
+
reason: [
|
|
295
|
+
`HARD BLOCK: Cannot save milestone CONTEXT without depth verification for ${milestoneId}.`,
|
|
296
|
+
`This is a mechanical gate — you MUST NOT proceed, retry, or rationalize past this block.`,
|
|
297
|
+
`Required action: call ask_user_questions with question id containing "depth_verification_${milestoneId}".`,
|
|
298
|
+
`The user MUST select the "(Recommended)" confirmation option to unlock this gate.`,
|
|
299
|
+
].join(" "),
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
113
303
|
/**
|
|
114
304
|
* Queue-mode execution guard (#2545).
|
|
115
305
|
*
|
|
@@ -155,7 +345,10 @@ export function shouldBlockQueueExecution(
|
|
|
155
345
|
};
|
|
156
346
|
}
|
|
157
347
|
|
|
158
|
-
// Unknown tools —
|
|
159
|
-
|
|
348
|
+
// Unknown tools — block by default in queue mode so custom tools cannot
|
|
349
|
+
// bypass execution restrictions.
|
|
350
|
+
return {
|
|
351
|
+
block: true,
|
|
352
|
+
reason: `Blocked: /gsd queue is a planning tool — it creates milestones, not executes work. Unknown tools are not permitted during queue mode.`,
|
|
353
|
+
};
|
|
160
354
|
}
|
|
161
|
-
|
|
@@ -84,8 +84,8 @@ export async function handleStatus(ctx: ExtensionCommandContext): Promise<void>
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
const { GSDDashboardOverlay } = await import("../../dashboard-overlay.js");
|
|
87
|
-
const result = await ctx.ui.custom<
|
|
88
|
-
(tui, theme, _kb, done) => new GSDDashboardOverlay(tui, theme, () => done()),
|
|
87
|
+
const result = await ctx.ui.custom<boolean>(
|
|
88
|
+
(tui, theme, _kb, done) => new GSDDashboardOverlay(tui, theme, () => done(true)),
|
|
89
89
|
{
|
|
90
90
|
overlay: true,
|
|
91
91
|
overlayOptions: {
|
|
@@ -113,8 +113,8 @@ export async function handleVisualize(ctx: ExtensionCommandContext): Promise<voi
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
const { GSDVisualizerOverlay } = await import("../../visualizer-overlay.js");
|
|
116
|
-
const result = await ctx.ui.custom<
|
|
117
|
-
(tui, theme, _kb, done) => new GSDVisualizerOverlay(tui, theme, () => done()),
|
|
116
|
+
const result = await ctx.ui.custom<boolean>(
|
|
117
|
+
(tui, theme, _kb, done) => new GSDVisualizerOverlay(tui, theme, () => done(true)),
|
|
118
118
|
{
|
|
119
119
|
overlay: true,
|
|
120
120
|
overlayOptions: {
|
|
@@ -221,8 +221,8 @@ export async function handleCoreCommand(trimmed: string, ctx: ExtensionCommandCo
|
|
|
221
221
|
}
|
|
222
222
|
if (trimmed === "show-config") {
|
|
223
223
|
const { GSDConfigOverlay, formatConfigText } = await import("../../config-overlay.js");
|
|
224
|
-
const result = await ctx.ui.custom<
|
|
225
|
-
(tui, theme, _kb, done) => new GSDConfigOverlay(tui, theme, () => done()),
|
|
224
|
+
const result = await ctx.ui.custom<boolean>(
|
|
225
|
+
(tui, theme, _kb, done) => new GSDConfigOverlay(tui, theme, () => done(true)),
|
|
226
226
|
{
|
|
227
227
|
overlay: true,
|
|
228
228
|
overlayOptions: {
|
|
@@ -277,10 +277,17 @@ async function configureModels(ctx: ExtensionCommandContext, prefs: Record<strin
|
|
|
277
277
|
group.sort((a, b) => a.id.localeCompare(b.id));
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
//
|
|
280
|
+
// Display names for providers in the preferences wizard UI.
|
|
281
|
+
const PROVIDER_DISPLAY_NAMES: Record<string, string> = { anthropic: "anthropic-api" };
|
|
282
|
+
const displayName = (p: string) => PROVIDER_DISPLAY_NAMES[p] ?? p;
|
|
283
|
+
|
|
284
|
+
// Build provider menu with model counts (display name → real name lookup)
|
|
285
|
+
const displayToReal = new Map<string, string>();
|
|
281
286
|
const providerOptions = providers.map(p => {
|
|
282
287
|
const count = byProvider.get(p)!.length;
|
|
283
|
-
|
|
288
|
+
const label = `${displayName(p)} (${count} models)`;
|
|
289
|
+
displayToReal.set(label, p);
|
|
290
|
+
return label;
|
|
284
291
|
});
|
|
285
292
|
providerOptions.push("(keep current)", "(clear)", "(type manually)");
|
|
286
293
|
|
|
@@ -310,14 +317,14 @@ async function configureModels(ctx: ExtensionCommandContext, prefs: Record<strin
|
|
|
310
317
|
}
|
|
311
318
|
|
|
312
319
|
// Step 2: pick model within provider
|
|
313
|
-
const providerName = providerChoice.replace(/ \(\d+ models?\)$/, "");
|
|
320
|
+
const providerName = displayToReal.get(providerChoice) ?? providerChoice.replace(/ \(\d+ models?\)$/, "");
|
|
314
321
|
const group = byProvider.get(providerName);
|
|
315
322
|
if (!group) continue;
|
|
316
323
|
|
|
317
324
|
const modelOptions = group.map(m => m.id);
|
|
318
325
|
modelOptions.push("(keep current)", "(clear)");
|
|
319
326
|
|
|
320
|
-
const modelChoice = await ctx.ui.select(`${phaseLabel} — ${providerName}:`, modelOptions);
|
|
327
|
+
const modelChoice = await ctx.ui.select(`${phaseLabel} — ${displayName(providerName)}:`, modelOptions);
|
|
321
328
|
if (modelChoice && typeof modelChoice === "string" && modelChoice !== "(keep current)") {
|
|
322
329
|
if (modelChoice === "(clear)") {
|
|
323
330
|
delete models[phase];
|
|
@@ -179,7 +179,9 @@ export class CustomWorkflowEngine implements WorkflowEngine {
|
|
|
179
179
|
state: EngineState,
|
|
180
180
|
completedStep: CompletedStep,
|
|
181
181
|
): Promise<ReconcileResult> {
|
|
182
|
-
|
|
182
|
+
// Re-read the graph from disk so we do not overwrite concurrent
|
|
183
|
+
// workflow edits with a stale in-memory snapshot from deriveState().
|
|
184
|
+
const graph = readGraph(this.runDir);
|
|
183
185
|
|
|
184
186
|
// Extract stepId from "<workflowName>/<stepId>"
|
|
185
187
|
const { milestone, slice, task } = parseUnitId(completedStep.unitId);
|
|
@@ -242,6 +242,12 @@ const TEST_MARKERS = [
|
|
|
242
242
|
/** Directories skipped during bounded recursive project scans. */
|
|
243
243
|
const RECURSIVE_SCAN_IGNORED_DIRS = new Set([
|
|
244
244
|
".git",
|
|
245
|
+
".gsd",
|
|
246
|
+
".planning",
|
|
247
|
+
".plans",
|
|
248
|
+
".claude",
|
|
249
|
+
".cursor",
|
|
250
|
+
".vscode",
|
|
245
251
|
"node_modules",
|
|
246
252
|
".venv",
|
|
247
253
|
"venv",
|
|
@@ -132,6 +132,25 @@ function escapeRegex(s: string): string {
|
|
|
132
132
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Normalize a task-plan file reference that may include inline description text
|
|
137
|
+
* after the path, for example:
|
|
138
|
+
* "docs/file.md — explanation"
|
|
139
|
+
* "docs/file.md - explanation"
|
|
140
|
+
*/
|
|
141
|
+
export function normalizePlannedFileReference(value: string): string {
|
|
142
|
+
const trimmed = value.trim().replace(/`/g, "");
|
|
143
|
+
const match = /^(.*?)(?:\s+(?:—|-)\s+)(.+)$/.exec(trimmed);
|
|
144
|
+
if (!match) return trimmed;
|
|
145
|
+
|
|
146
|
+
const pathCandidate = match[1].trim();
|
|
147
|
+
if (pathCandidate.includes("/") || pathCandidate.includes("\\") || pathCandidate.includes(".")) {
|
|
148
|
+
return pathCandidate;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return trimmed;
|
|
152
|
+
}
|
|
153
|
+
|
|
135
154
|
/** Parse bullet list items from a text block. */
|
|
136
155
|
export function parseBullets(text: string): string[] {
|
|
137
156
|
return text.split('\n')
|
|
@@ -622,11 +641,11 @@ export function parseTaskPlanIO(content: string): { inputFiles: string[]; output
|
|
|
622
641
|
let match: RegExpExecArray | null;
|
|
623
642
|
backtickPathRegex.lastIndex = 0;
|
|
624
643
|
while ((match = backtickPathRegex.exec(trimmed)) !== null) {
|
|
625
|
-
const candidate = match[1];
|
|
644
|
+
const candidate = normalizePlannedFileReference(match[1]);
|
|
626
645
|
// Filter out things that look like code tokens rather than file paths
|
|
627
646
|
// (e.g. `true`, `false`, `npm run test`). A file path has at least one
|
|
628
647
|
// dot or slash.
|
|
629
|
-
if (candidate.includes("/") || candidate.includes(".")) {
|
|
648
|
+
if (candidate.includes("/") || candidate.includes("\\") || candidate.includes(".")) {
|
|
630
649
|
paths.push(candidate);
|
|
631
650
|
}
|
|
632
651
|
}
|
|
@@ -186,12 +186,13 @@ export function checkAutoStartAfterDiscuss(): boolean {
|
|
|
186
186
|
// Parse PROJECT.md for milestone sequence, warn if any are missing context.
|
|
187
187
|
// Don't block — milestones can be intentionally queued without context.
|
|
188
188
|
const projectFile = resolveGsdRootFile(basePath, "PROJECT");
|
|
189
|
+
let projectIds: string[] = [];
|
|
189
190
|
if (projectFile) {
|
|
190
191
|
try {
|
|
191
192
|
const projectContent = readFileSync(projectFile, "utf-8");
|
|
192
|
-
|
|
193
|
-
if (
|
|
194
|
-
const missing =
|
|
193
|
+
projectIds = parseMilestoneSequenceFromProject(projectContent);
|
|
194
|
+
if (projectIds.length > 1) {
|
|
195
|
+
const missing = projectIds.filter(id => {
|
|
195
196
|
const hasContext = !!resolveMilestoneFile(basePath, id, "CONTEXT");
|
|
196
197
|
const hasDraft = !!resolveMilestoneFile(basePath, id, "CONTEXT-DRAFT");
|
|
197
198
|
const hasDir = existsSync(join(gsdRoot(basePath), "milestones", id));
|
|
@@ -210,9 +211,17 @@ export function checkAutoStartAfterDiscuss(): boolean {
|
|
|
210
211
|
|
|
211
212
|
// Gate 4: Discussion manifest process verification (multi-milestone only)
|
|
212
213
|
// The LLM writes DISCUSSION-MANIFEST.json after each Phase 3 gate decision.
|
|
213
|
-
// If the
|
|
214
|
-
//
|
|
214
|
+
// If the project is multi-milestone, the manifest is required. When it is
|
|
215
|
+
// missing, fail closed instead of assuming the discussion finished.
|
|
215
216
|
const manifestPath = join(gsdRoot(basePath), "DISCUSSION-MANIFEST.json");
|
|
217
|
+
const requiresManifest = projectIds.length > 1 || findMilestoneIds(basePath).length > 1;
|
|
218
|
+
if (requiresManifest && !existsSync(manifestPath)) {
|
|
219
|
+
ctx.ui.notify(
|
|
220
|
+
"Multi-milestone discussion manifest is missing. Auto-start will remain paused until the manifest is written.",
|
|
221
|
+
"warning",
|
|
222
|
+
);
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
216
225
|
if (existsSync(manifestPath)) {
|
|
217
226
|
try {
|
|
218
227
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
@@ -225,9 +234,7 @@ export function checkAutoStartAfterDiscuss(): boolean {
|
|
|
225
234
|
}
|
|
226
235
|
|
|
227
236
|
// Cross-check manifest milestones against PROJECT.md if available
|
|
228
|
-
if (
|
|
229
|
-
const projectContent = readFileSync(projectFile, "utf-8");
|
|
230
|
-
const projectIds = parseMilestoneSequenceFromProject(projectContent);
|
|
237
|
+
if (projectIds.length > 0) {
|
|
231
238
|
const manifestIds = Object.keys(manifest.milestones ?? {});
|
|
232
239
|
const untracked = projectIds.filter(id => !manifestIds.includes(id));
|
|
233
240
|
if (untracked.length > 0) {
|
|
@@ -3,10 +3,16 @@ import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
|
|
3
3
|
export {
|
|
4
4
|
isDepthConfirmationAnswer,
|
|
5
5
|
isDepthVerified,
|
|
6
|
+
isGateQuestionId,
|
|
6
7
|
isQueuePhaseActive,
|
|
7
8
|
setQueuePhaseActive,
|
|
8
9
|
shouldBlockContextWrite,
|
|
10
|
+
shouldBlockPendingGate,
|
|
11
|
+
shouldBlockPendingGateBash,
|
|
9
12
|
shouldBlockQueueExecution,
|
|
13
|
+
setPendingGate,
|
|
14
|
+
clearPendingGate,
|
|
15
|
+
getPendingGate,
|
|
10
16
|
} from "./bootstrap/write-gate.js";
|
|
11
17
|
|
|
12
18
|
export default async function registerExtension(pi: ExtensionAPI) {
|
|
@@ -490,6 +490,8 @@ export class ParallelMonitorOverlay {
|
|
|
490
490
|
|
|
491
491
|
// Apply scroll — use terminal rows as height estimate
|
|
492
492
|
const termHeight = process.stdout.rows || 40;
|
|
493
|
+
const maxScroll = Math.max(0, lines.length - termHeight);
|
|
494
|
+
this.scrollOffset = Math.min(Math.max(this.scrollOffset, 0), maxScroll);
|
|
493
495
|
const visible = lines.slice(this.scrollOffset, this.scrollOffset + termHeight);
|
|
494
496
|
this.cachedLines = visible;
|
|
495
497
|
return visible;
|
|
@@ -210,7 +210,9 @@ function _parsePlanImpl(content: string): SlicePlan {
|
|
|
210
210
|
for (const line of lines) {
|
|
211
211
|
const cbMatch = line.match(/^-\s+\[([ xX])\]\s+\*\*([\w.]+):\s+(.+?)\*\*\s*(.*)/);
|
|
212
212
|
// Heading-style: ### T01 -- Title, ### T01: Title, ### T01 — Title
|
|
213
|
-
const hdMatch = !cbMatch
|
|
213
|
+
const hdMatch = !cbMatch
|
|
214
|
+
? line.match(/^#{2,4}\s+([A-Z]+\d+(?:\.[A-Z]+\d+)*)\s*(?:--|—|:)\s*(.+)/)
|
|
215
|
+
: null;
|
|
214
216
|
if (cbMatch || hdMatch) {
|
|
215
217
|
const taskId = cbMatch ? cbMatch[2] : hdMatch![1];
|
|
216
218
|
// Skip tasks already found in the Tasks section
|
|
@@ -63,6 +63,6 @@ Then:
|
|
|
63
63
|
13. Do not commit manually — the system auto-commits your changes after this unit completes.
|
|
64
64
|
- Say: "Milestone {{milestoneId}} complete."
|
|
65
65
|
|
|
66
|
-
**Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. Verification failures BLOCK completion — there is no override. The milestone stays in its current state until issues are resolved and verification is re-run.
|
|
66
|
+
**Important:** Do NOT skip the code change verification, success criteria, or definition of done verification (steps 3-5). The milestone summary must reflect actual verified outcomes, not assumed success. Verification failures BLOCK completion — there is no override. The milestone stays in its current state until issues are resolved and verification is re-run. **If a verification tool itself fails, errors, or returns unexpected output, treat it as a verification failure** — never rationalize past a tool error ("tool didn't respond, assuming success" is forbidden). A tool that cannot verify is a tool that did not verify.
|
|
67
67
|
|
|
68
68
|
**File system safety:** When scanning milestone directories for evidence, use `ls` or `find` to list directory contents first — never pass a directory path (e.g. `tasks/`, `slices/`) directly to the `read` tool. The `read` tool only accepts file paths, not directories.
|
|
@@ -109,7 +109,7 @@ Options:
|
|
|
109
109
|
- "Needs adjustment" — user will clarify, then re-present scope
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
**Do NOT proceed to Layer 2 until the user explicitly approves the scope
|
|
112
|
+
**CRITICAL — Non-bypassable gate:** Do NOT proceed to Layer 2 until the user explicitly approves the scope. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. "Tool not responding, I'll proceed," "auth issues," or "I'll use my recommended scope" are all **forbidden**. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
|
|
113
113
|
|
|
114
114
|
---
|
|
115
115
|
|
|
@@ -120,7 +120,7 @@ Before presenting Layer 2 findings, use your available web search tools to resea
|
|
|
120
120
|
1. Search for "[technology] [version] best practices [current year]"
|
|
121
121
|
2. Search for "[technology] [version] known issues"
|
|
122
122
|
|
|
123
|
-
Summarize findings concisely. If
|
|
123
|
+
Summarize findings concisely. If search tools fail or are unavailable, note this and proceed using your training knowledge — but do NOT use a search failure as justification to skip any gate.
|
|
124
124
|
|
|
125
125
|
Present ecosystem findings at the start of Layer 2 alongside your architecture recommendation.
|
|
126
126
|
|
|
@@ -180,7 +180,7 @@ Options:
|
|
|
180
180
|
- "Want to adjust" — user will clarify, then re-present architecture
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
**Do NOT proceed to Layer 3 until the user explicitly approves the architecture
|
|
183
|
+
**CRITICAL — Non-bypassable gate:** Do NOT proceed to Layer 3 until the user explicitly approves the architecture. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
|
|
184
184
|
|
|
185
185
|
---
|
|
186
186
|
|
|
@@ -243,7 +243,7 @@ Options:
|
|
|
243
243
|
- "Want to adjust error handling" — user will clarify, then re-present errors
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
**Do NOT proceed to Layer 4 until the user explicitly approves error handling
|
|
246
|
+
**CRITICAL — Non-bypassable gate:** Do NOT proceed to Layer 4 until the user explicitly approves error handling. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
|
|
247
247
|
|
|
248
248
|
---
|
|
249
249
|
|
|
@@ -297,7 +297,7 @@ Options:
|
|
|
297
297
|
- "Want to adjust the quality bar" — user will clarify, then re-present quality
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
**Do NOT proceed to Output Phase until the user explicitly approves the quality bar
|
|
300
|
+
**CRITICAL — Non-bypassable gate:** Do NOT proceed to Output Phase until the user explicitly approves the quality bar. If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
|
|
301
301
|
|
|
302
302
|
---
|
|
303
303
|
|
|
@@ -315,13 +315,13 @@ Before writing a roadmap, produce or update `.gsd/REQUIREMENTS.md`.
|
|
|
315
315
|
|
|
316
316
|
Use it as the project's explicit capability contract. Requirements discovered during the 4-layer discussion should be captured here with source `user` or `inferred` as appropriate.
|
|
317
317
|
|
|
318
|
-
**Print the requirements in chat before writing the roadmap.** Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?"
|
|
318
|
+
**Print the requirements in chat before writing the roadmap.** Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?" **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never proceed to roadmap creation without explicit requirement confirmation.
|
|
319
319
|
|
|
320
320
|
### Roadmap Preview
|
|
321
321
|
|
|
322
322
|
Before writing any files, **print the planned roadmap in chat** so the user can see and approve it. Print a markdown table with columns: Slice, Title, Risk, Depends, Demo. One row per slice. Below the table, print the milestone definition of done as a bullet list.
|
|
323
323
|
|
|
324
|
-
If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two.
|
|
324
|
+
If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two. **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never write files without explicit approval. A missing response is not a "yes."
|
|
325
325
|
|
|
326
326
|
### Naming Convention
|
|
327
327
|
|
|
@@ -173,7 +173,7 @@ For multi-milestone projects, requirements should span the full vision. Requirem
|
|
|
173
173
|
|
|
174
174
|
If the project is new or has no `REQUIREMENTS.md`, surface candidate requirements in chat before writing the roadmap. Ask for correction only on material omissions, wrong ownership, or wrong scope. If the user has already been specific and raises no substantive objection, treat the requirement set as confirmed and continue.
|
|
175
175
|
|
|
176
|
-
**Print the requirements in chat before writing the roadmap.** Do not say "here are the requirements" and then only write them to a file. The user must see them in the terminal. Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?"
|
|
176
|
+
**Print the requirements in chat before writing the roadmap.** Do not say "here are the requirements" and then only write them to a file. The user must see them in the terminal. Print a markdown table with columns: ID, Title, Status, Owner, Source. Group by status (Active, Deferred, Out of Scope). After the table, ask: "Confirm, adjust, or add?" **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never proceed to roadmap creation without explicit requirement confirmation.
|
|
177
177
|
|
|
178
178
|
## Scope Assessment
|
|
179
179
|
|
|
@@ -185,7 +185,7 @@ Before moving to output, confirm the size estimate from your reflection still ho
|
|
|
185
185
|
|
|
186
186
|
Before writing any files, **print the planned roadmap in chat** so the user can see and approve it. Print a markdown table with columns: Slice, Title, Risk, Depends, Demo. One row per slice. Below the table, print the milestone definition of done as a bullet list.
|
|
187
187
|
|
|
188
|
-
If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two.
|
|
188
|
+
If the user raises a substantive objection, adjust the roadmap. Otherwise, present the roadmap and ask: "Ready to write, or want to adjust?" — one gate, not two. **Non-bypassable:** If the user does not respond or gives an ambiguous answer, you MUST re-ask — never write files without explicit approval. A missing response is not a "yes."
|
|
189
189
|
|
|
190
190
|
### Naming Convention
|
|
191
191
|
|
|
@@ -242,7 +242,7 @@ If a milestone has no dependencies, omit the frontmatter. The dependency chain f
|
|
|
242
242
|
|
|
243
243
|
#### Phase 3: Sequential readiness gate for remaining milestones
|
|
244
244
|
|
|
245
|
-
For each remaining milestone **one at a time, in sequence**, decide the most likely readiness mode from the evidence you already have, then use `ask_user_questions` to let the user correct that recommendation. Present three options:
|
|
245
|
+
For each remaining milestone **one at a time, in sequence**, decide the most likely readiness mode from the evidence you already have, then use `ask_user_questions` to let the user correct that recommendation. **Non-bypassable:** If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block or auto-select a readiness mode. Present three options:
|
|
246
246
|
|
|
247
247
|
- **"Discuss now"** — The user wants to conduct a focused discussion for this milestone in the current session, while the context from the broader discussion is still fresh. Proceed with a focused discussion for this milestone (reflection → investigation → questioning → depth verification). When the discussion concludes, write a full `CONTEXT.md`. Then move to the gate for the next milestone.
|
|
248
248
|
- **"Write draft for later"** — This milestone has seed material from the current conversation but needs its own dedicated discussion in a future session. Write a `CONTEXT-DRAFT.md` capturing the seed material (what was discussed, key ideas, provisional scope, open questions). Mark it clearly as a draft, not a finalized context. **What happens downstream:** When auto-mode reaches this milestone, it pauses and notifies the user: "M00x has draft context — needs discussion. Run /gsd." The `/gsd` wizard shows a "Discuss from draft" option that seeds the new discussion with this draft, so nothing from the current conversation is lost. After the dedicated discussion produces a full CONTEXT.md, the draft file is automatically deleted.
|
|
@@ -92,15 +92,15 @@ Before moving to the wrap-up gate, verify you have covered:
|
|
|
92
92
|
- header: "Depth Check"
|
|
93
93
|
- question: "Did I capture the depth right?"
|
|
94
94
|
- options: "Yes, you got it (Recommended)", "Not quite — let me clarify"
|
|
95
|
-
- **The question ID must contain `depth_verification
|
|
95
|
+
- **The question ID must contain `depth_verification` and the milestone id** (e.g. `depth_verification_{{milestoneId}}_confirm`) — this enables the write-gate downstream and keeps verification scoped to the milestone being discussed.
|
|
96
96
|
|
|
97
|
-
**If `{{structuredQuestionsAvailable}}` is `false`:** ask in plain text: "Did I capture that correctly? If not, tell me what I missed." Wait for confirmation before proceeding.
|
|
97
|
+
**If `{{structuredQuestionsAvailable}}` is `false`:** ask in plain text: "Did I capture that correctly? If not, tell me what I missed." Wait for explicit confirmation before proceeding. **The same non-bypassable gate applies to the plain-text path** — if the user does not respond, gives an ambiguous answer, or does not explicitly confirm, you MUST re-ask. Never rationalize past a missing confirmation.
|
|
98
98
|
|
|
99
99
|
If they clarify, absorb the correction and re-verify.
|
|
100
100
|
|
|
101
101
|
The depth verification is the only required confirmation gate. Do not add a second "ready to proceed?" gate after it.
|
|
102
102
|
|
|
103
|
-
**CRITICAL — Non-bypassable gate:** The system mechanically blocks CONTEXT.md writes until the user selects the "(Recommended)" option. If the user declines, cancels, or the tool fails, you MUST re-ask — never rationalize past the block ("tool not responding, I'll proceed" is forbidden). The gate exists to protect the user's work; treat a block as an instruction, not an obstacle to work around.
|
|
103
|
+
**CRITICAL — Non-bypassable gate:** The system mechanically blocks CONTEXT.md writes until the user selects the "(Recommended)" option (structured path) or explicitly confirms (plain-text path). If the user declines, cancels, does not respond, or the tool fails, you MUST re-ask — never rationalize past the block ("tool not responding, I'll proceed" is forbidden). The gate exists to protect the user's work; treat a block as an instruction, not an obstacle to work around.
|
|
104
104
|
|
|
105
105
|
---
|
|
106
106
|
|
|
@@ -41,11 +41,13 @@ After each round of answers, decide whether you already have enough signal to wr
|
|
|
41
41
|
- Ask a single wrap-up question only when you genuinely believe the slice is well understood or the user signals they want to stop.
|
|
42
42
|
- When you do ask it, offer two choices: "Write the context file" *(recommended when the slice is well understood)* or "One more pass". Use `ask_user_questions` if available, otherwise ask in plain text.
|
|
43
43
|
|
|
44
|
+
**CRITICAL — Non-bypassable gate:** Do NOT write the context file until the user explicitly selects "Write the context file." If `ask_user_questions` fails, errors, returns no response, or the user's response does not match a provided option, you MUST re-ask — never rationalize past the block. "Tool not responding, I'll proceed," "auth issues," or "the slice seems well understood, I'll write it" are all **forbidden**. The gate exists to protect the user's work; treat a block as an instruction to wait, not an obstacle to work around.
|
|
45
|
+
|
|
44
46
|
---
|
|
45
47
|
|
|
46
48
|
## Output
|
|
47
49
|
|
|
48
|
-
Once the user
|
|
50
|
+
Once the user has explicitly confirmed they are ready to write the context file:
|
|
49
51
|
|
|
50
52
|
1. Use the **Slice Context** output template below
|
|
51
53
|
2. `mkdir -p {{sliceDirPath}}`
|