gsd-pi 2.82.0-dev.9d5798940 → 2.82.0-dev.dfbc5f58f

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.
Files changed (185) hide show
  1. package/README.md +2 -2
  2. package/dist/resources/.managed-resources-content-hash +1 -1
  3. package/dist/resources/GSD-WORKFLOW.md +7 -0
  4. package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
  5. package/dist/resources/extensions/gsd/auto/loop.js +5 -5
  6. package/dist/resources/extensions/gsd/auto/orchestrator.js +11 -0
  7. package/dist/resources/extensions/gsd/auto/phases.js +8 -1
  8. package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
  9. package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
  10. package/dist/resources/extensions/gsd/auto-post-unit.js +1 -1
  11. package/dist/resources/extensions/gsd/auto-start.js +78 -9
  12. package/dist/resources/extensions/gsd/auto-worktree.js +15 -1
  13. package/dist/resources/extensions/gsd/auto.js +30 -3
  14. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +9 -8
  15. package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +5 -2
  16. package/dist/resources/extensions/gsd/crash-recovery.js +31 -5
  17. package/dist/resources/extensions/gsd/db/unit-dispatches.js +1 -0
  18. package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
  19. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
  20. package/dist/resources/extensions/gsd/doctor.js +2 -28
  21. package/dist/resources/extensions/gsd/git-service.js +39 -1
  22. package/dist/resources/extensions/gsd/gsd-db.js +1 -0
  23. package/dist/resources/extensions/gsd/guided-flow.js +6 -0
  24. package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
  25. package/dist/resources/extensions/gsd/native-git-bridge.js +40 -9
  26. package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
  27. package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
  28. package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
  29. package/dist/resources/extensions/gsd/prompts/plan-slice.md +3 -3
  30. package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
  31. package/dist/resources/extensions/gsd/status-guards.js +4 -0
  32. package/dist/resources/extensions/gsd/templates/plan.md +8 -5
  33. package/dist/resources/extensions/gsd/templates/task-plan.md +4 -2
  34. package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
  35. package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
  36. package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
  37. package/dist/resources/extensions/gsd/tools/plan-slice.js +88 -14
  38. package/dist/resources/extensions/gsd/validation.js +23 -1
  39. package/dist/resources/extensions/gsd/verification-gate.js +68 -7
  40. package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
  41. package/dist/resources/extensions/gsd/worktree-lifecycle.js +5 -1
  42. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  43. package/dist/web/standalone/.next/BUILD_ID +1 -1
  44. package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
  45. package/dist/web/standalone/.next/build-manifest.json +2 -2
  46. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  47. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  48. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  51. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  52. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  53. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  54. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  56. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  61. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  62. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  63. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  64. package/dist/web/standalone/.next/server/app/index.html +1 -1
  65. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  66. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  67. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  68. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  69. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  70. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  71. package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
  72. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  73. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  74. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  75. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  76. package/package.json +2 -2
  77. package/packages/mcp-server/src/workflow-tools.test.ts +1 -1
  78. package/packages/native/tsconfig.json +2 -1
  79. package/packages/native/tsconfig.tsbuildinfo +1 -1
  80. package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  81. package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
  82. package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  83. package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
  84. package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
  85. package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
  86. package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
  87. package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
  88. package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
  89. package/packages/pi-ai/dist/providers/simple-options.js +5 -6
  90. package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
  91. package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
  92. package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
  93. package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
  94. package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
  95. package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
  96. package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
  97. package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
  98. package/packages/pi-ai/src/providers/simple-options.ts +5 -6
  99. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  100. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
  101. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
  102. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
  103. package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
  104. package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
  105. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  106. package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
  107. package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
  108. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  109. package/src/resources/GSD-WORKFLOW.md +7 -0
  110. package/src/resources/extensions/gsd/auto/contracts.ts +14 -6
  111. package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
  112. package/src/resources/extensions/gsd/auto/loop.ts +8 -5
  113. package/src/resources/extensions/gsd/auto/orchestrator.ts +11 -0
  114. package/src/resources/extensions/gsd/auto/phases.ts +7 -1
  115. package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
  116. package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
  117. package/src/resources/extensions/gsd/auto-post-unit.ts +1 -1
  118. package/src/resources/extensions/gsd/auto-start.ts +85 -6
  119. package/src/resources/extensions/gsd/auto-worktree.ts +15 -1
  120. package/src/resources/extensions/gsd/auto.ts +32 -3
  121. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +9 -8
  122. package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +3 -1
  123. package/src/resources/extensions/gsd/crash-recovery.ts +30 -4
  124. package/src/resources/extensions/gsd/db/unit-dispatches.ts +1 -0
  125. package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
  126. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
  127. package/src/resources/extensions/gsd/doctor.ts +2 -27
  128. package/src/resources/extensions/gsd/git-service.ts +45 -1
  129. package/src/resources/extensions/gsd/gsd-db.ts +3 -0
  130. package/src/resources/extensions/gsd/guided-flow.ts +6 -0
  131. package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
  132. package/src/resources/extensions/gsd/native-git-bridge.ts +46 -9
  133. package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
  134. package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
  135. package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
  136. package/src/resources/extensions/gsd/prompts/plan-slice.md +3 -3
  137. package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
  138. package/src/resources/extensions/gsd/status-guards.ts +5 -0
  139. package/src/resources/extensions/gsd/templates/plan.md +8 -5
  140. package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
  141. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +54 -0
  142. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +80 -1
  143. package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +6 -6
  144. package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
  145. package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
  146. package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
  147. package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +43 -2
  148. package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +2 -0
  149. package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
  150. package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
  151. package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
  152. package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
  153. package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
  154. package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
  155. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +103 -1
  156. package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
  157. package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
  158. package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +63 -2
  159. package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
  160. package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
  161. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +200 -1
  162. package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
  163. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +86 -0
  164. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
  165. package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
  166. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +31 -1
  167. package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +26 -2
  168. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
  169. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
  170. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +1 -1
  171. package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
  172. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
  173. package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
  174. package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +7 -0
  175. package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
  176. package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
  177. package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
  178. package/src/resources/extensions/gsd/tools/plan-slice.ts +96 -12
  179. package/src/resources/extensions/gsd/types.ts +1 -1
  180. package/src/resources/extensions/gsd/validation.ts +23 -1
  181. package/src/resources/extensions/gsd/verification-gate.ts +78 -6
  182. package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
  183. package/src/resources/extensions/gsd/worktree-lifecycle.ts +7 -1
  184. /package/dist/web/standalone/.next/static/{BdZQhe8yKl6bdKLiXVEzh → q0WYuDVbHeFFYbdd-fei2}/_buildManifest.js +0 -0
  185. /package/dist/web/standalone/.next/static/{BdZQhe8yKl6bdKLiXVEzh → q0WYuDVbHeFFYbdd-fei2}/_ssgManifest.js +0 -0
@@ -5,7 +5,7 @@ import { milestonesDir, gsdRoot, resolveGsdRootFile } from "./paths.js";
5
5
  import { deriveState, isGhostMilestone, isReusableGhostMilestone } from "./state.js";
6
6
  import { saveFile } from "./files.js";
7
7
  import { nativeIsRepo, nativeForEachRef, nativeUpdateRef } from "./native-git-bridge.js";
8
- import { readCrashLock, isLockProcessAlive, clearLock } from "./crash-recovery.js";
8
+ import { readCrashLock, isLockProcessAlive, clearStaleWorkerLock } from "./crash-recovery.js";
9
9
  import { getActiveAutoWorkers } from "./db/auto-workers.js";
10
10
  import { normalizeRealPath } from "./paths.js";
11
11
  import { ensureGitignore, isGsdGitignored } from "./gitignore.js";
@@ -46,7 +46,7 @@ export async function checkRuntimeHealth(basePath, issues, fixesApplied, shouldF
46
46
  fixable: true,
47
47
  });
48
48
  if (shouldFix("stale_crash_lock")) {
49
- clearLock(basePath);
49
+ clearStaleWorkerLock(basePath);
50
50
  fixesApplied.push("cleared stale auto-mode worker state");
51
51
  }
52
52
  }
@@ -70,15 +70,32 @@ export async function checkRuntimeHealth(basePath, issues, fixesApplied, shouldF
70
70
  // heartbeat for this project?" — readCrashLock returns null for
71
71
  // healthy live workers (it surfaces stale ones only), so we must
72
72
  // consult getActiveAutoWorkers directly.
73
- const projectRoot = normalizeRealPath(basePath);
74
- const activeWorkers = getActiveAutoWorkers().filter((w) => w.project_root_realpath === projectRoot && isLockProcessAlive({
75
- pid: w.pid,
76
- startedAt: w.started_at,
77
- unitType: "starting",
78
- unitId: "bootstrap",
79
- unitStartedAt: w.started_at,
80
- }));
81
- const lockHolderAlive = activeWorkers.length > 0;
73
+ let lockHolderAlive = false;
74
+ try {
75
+ const projectRoot = normalizeRealPath(basePath);
76
+ for (const worker of getActiveAutoWorkers()) {
77
+ if (worker.project_root_realpath !== projectRoot)
78
+ continue;
79
+ try {
80
+ if (isLockProcessAlive({
81
+ pid: worker.pid,
82
+ startedAt: worker.started_at,
83
+ unitType: "starting",
84
+ unitId: "bootstrap",
85
+ unitStartedAt: worker.started_at,
86
+ })) {
87
+ lockHolderAlive = true;
88
+ break;
89
+ }
90
+ }
91
+ catch {
92
+ // Ignore malformed worker rows or transient PID probe failures.
93
+ }
94
+ }
95
+ }
96
+ catch {
97
+ // If worker lookup fails, continue with the stranded lock diagnosis.
98
+ }
82
99
  if (!lockHolderAlive) {
83
100
  issues.push({
84
101
  severity: "error",
@@ -12,37 +12,11 @@ import { GLOBAL_STATE_CODES } from "./doctor-types.js";
12
12
  import { checkGitHealth, checkRuntimeHealth, checkGlobalHealth, checkEngineHealth } from "./doctor-checks.js";
13
13
  import { checkEnvironmentHealth } from "./doctor-environment.js";
14
14
  import { runProviderChecks } from "./doctor-providers.js";
15
+ import { validateTitle } from "./validation.js";
15
16
  export { summarizeDoctorIssues, filterDoctorIssues, formatDoctorReport, formatDoctorIssuesForPrompt, formatDoctorReportJson } from "./doctor-format.js";
16
17
  export { runEnvironmentChecks, runFullEnvironmentChecks, formatEnvironmentReport } from "./doctor-environment.js";
17
18
  export { computeProgressScore, computeProgressScoreWithContext, formatProgressLine, formatProgressReport } from "./progress-score.js";
18
- /**
19
- * Characters that are used as delimiters in GSD state management documents
20
- * and should not appear in milestone or slice titles.
21
- *
22
- * - "\u2014" (em dash, U+2014): used as a display separator in STATE.md and other docs.
23
- * A title containing "\u2014" makes the separator ambiguous, corrupting state display
24
- * and confusing the LLM agent that reads and writes these files.
25
- * - "\u2013" (en dash, U+2013): visually similar to em dash; same ambiguity risk.
26
- * - "/" (forward slash, U+002F): used as the path separator in unit IDs (M001/S01)
27
- * and git branch names (gsd/M001/S01). A slash in a title can break path resolution.
28
- */
29
- const TITLE_DELIMITER_RE = /[\u2014\u2013\/]/; // em dash, en dash, forward slash
30
- /**
31
- * Check whether a milestone or slice title contains characters that conflict
32
- * with GSD's state document delimiter conventions.
33
- * Returns a human-readable description of the problem, or null if the title is safe.
34
- */
35
- export function validateTitle(title) {
36
- if (TITLE_DELIMITER_RE.test(title)) {
37
- const found = [];
38
- if (/[\u2014\u2013]/.test(title))
39
- found.push("em/en dash (\u2014 or \u2013)");
40
- if (/\//.test(title))
41
- found.push("forward slash (/)");
42
- return `title contains ${found.join(" and ")}, which conflict with GSD state document delimiters`;
43
- }
44
- return null;
45
- }
19
+ export { validateTitle } from "./validation.js";
46
20
  function validatePreferenceShape(preferences) {
47
21
  const issues = [];
48
22
  const listFields = ["always_use_skills", "prefer_skills", "avoid_skills", "custom_instructions"];
@@ -139,6 +139,30 @@ function isExcludedScopedPath(path, exclusions) {
139
139
  }
140
140
  return false;
141
141
  }
142
+ function submodulePathsFromLsFiles(output) {
143
+ const submodulePaths = new Set();
144
+ if (!output)
145
+ return submodulePaths;
146
+ for (const line of output.split("\n")) {
147
+ const match = line.match(/^160000\s+\S+\s+\d+\t(.+)$/);
148
+ if (!match)
149
+ continue;
150
+ submodulePaths.add(match[1].replace(/\\/g, "/").replace(/\/+$/, ""));
151
+ }
152
+ return submodulePaths;
153
+ }
154
+ function isInsideSubmodule(path, submodulePaths) {
155
+ const normalizedPath = path.replace(/\\/g, "/");
156
+ if (submodulePaths.has(normalizedPath))
157
+ return true;
158
+ let slashIndex = normalizedPath.lastIndexOf("/");
159
+ while (slashIndex > 0) {
160
+ if (submodulePaths.has(normalizedPath.slice(0, slashIndex)))
161
+ return true;
162
+ slashIndex = normalizedPath.lastIndexOf("/", slashIndex - 1);
163
+ }
164
+ return false;
165
+ }
142
166
  /**
143
167
  * Thrown when a slice merge hits code conflicts in non-.gsd files.
144
168
  * The working tree is left in a conflicted state (no reset) so the
@@ -572,6 +596,20 @@ export class GitServiceImpl {
572
596
  .filter((file) => file !== null)
573
597
  .filter(file => !nativeIsIgnored(this.basePath, file))
574
598
  .filter(file => !isExcludedScopedPath(file, allExclusions));
599
+ const scopedPaths = [];
600
+ const submodulePaths = [];
601
+ const repoSubmodules = submodulePathsFromLsFiles(runGit(this.basePath, ["ls-files", "--stage"], { allowFailure: true }));
602
+ for (const path of normalized) {
603
+ if (isInsideSubmodule(path, repoSubmodules)) {
604
+ submodulePaths.push(path);
605
+ }
606
+ else {
607
+ scopedPaths.push(path);
608
+ }
609
+ }
610
+ if (submodulePaths.length > 0) {
611
+ logWarning("engine", `scoped stage: dropping ${submodulePaths.length} keyFile(s) inside git submodule(s): ${submodulePaths.join(", ")}`, { file: "git-service.ts" });
612
+ }
575
613
  // Drop entries that don't exist on disk. The LLM occasionally lists files
576
614
  // it intended to write but didn't (or names them with wrong casing/path).
577
615
  // Pre-`b304f738b` `git add -A` swallowed these silently; the scoped
@@ -579,7 +617,7 @@ export class GitServiceImpl {
579
617
  // the whole commit fail (see #5500). Filter so valid paths still commit.
580
618
  const missing = [];
581
619
  const existing = [];
582
- for (const path of normalized) {
620
+ for (const path of scopedPaths) {
583
621
  if (existsSync(join(this.basePath, path))) {
584
622
  existing.push(path);
585
623
  }
@@ -1769,6 +1769,7 @@ export function deleteTask(milestoneId, sliceId, taskId) {
1769
1769
  transaction(() => {
1770
1770
  // Must delete verification_evidence first (FK constraint)
1771
1771
  currentDb.prepare(`DELETE FROM verification_evidence WHERE milestone_id = :mid AND slice_id = :sid AND task_id = :tid`).run({ ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
1772
+ currentDb.prepare(`DELETE FROM quality_gates WHERE milestone_id = :mid AND slice_id = :sid AND task_id = :tid`).run({ ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
1772
1773
  currentDb.prepare(`DELETE FROM tasks WHERE milestone_id = :mid AND slice_id = :sid AND id = :tid`).run({ ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
1773
1774
  });
1774
1775
  }
@@ -1238,6 +1238,7 @@ export async function showDiscuss(ctx, pi, basePath) {
1238
1238
  const discussMilestoneTemplates = inlineTemplate("context", "Context");
1239
1239
  const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
1240
1240
  const basePrompt = loadPrompt("guided-discuss-milestone", {
1241
+ workingDirectory: basePath,
1241
1242
  milestoneId: mid, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
1242
1243
  commitInstruction: buildDocsCommitInstruction(`docs(${mid}): milestone context from discuss`),
1243
1244
  fastPathInstruction: "",
@@ -1253,6 +1254,7 @@ export async function showDiscuss(ctx, pi, basePath) {
1253
1254
  const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
1254
1255
  setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: mid, step: false });
1255
1256
  await dispatchWorkflow(pi, loadPrompt("guided-discuss-milestone", {
1257
+ workingDirectory: basePath,
1256
1258
  milestoneId: mid, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
1257
1259
  commitInstruction: buildDocsCommitInstruction(`docs(${mid}): milestone context from discuss`),
1258
1260
  fastPathInstruction: "",
@@ -1488,6 +1490,7 @@ async function dispatchDiscussForMilestone(ctx, pi, basePath, mid, milestoneTitl
1488
1490
  const discussMilestoneTemplates = inlineTemplate("context", "Context");
1489
1491
  const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
1490
1492
  const basePrompt = loadPrompt("guided-discuss-milestone", {
1493
+ workingDirectory: basePath,
1491
1494
  milestoneId: mid,
1492
1495
  milestoneTitle,
1493
1496
  inlinedTemplates: discussMilestoneTemplates,
@@ -1957,6 +1960,7 @@ export async function showSmartEntry(ctx, pi, basePath, options) {
1957
1960
  const discussMilestoneTemplates = inlineTemplate("context", "Context");
1958
1961
  const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
1959
1962
  const basePrompt = loadPrompt("guided-discuss-milestone", {
1963
+ workingDirectory: basePath,
1960
1964
  milestoneId, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
1961
1965
  commitInstruction: buildDocsCommitInstruction(`docs(${milestoneId}): milestone context from discuss`),
1962
1966
  fastPathInstruction: "",
@@ -1972,6 +1976,7 @@ export async function showSmartEntry(ctx, pi, basePath, options) {
1972
1976
  const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
1973
1977
  setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
1974
1978
  await dispatchWorkflow(pi, loadPrompt("guided-discuss-milestone", {
1979
+ workingDirectory: basePath,
1975
1980
  milestoneId, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
1976
1981
  commitInstruction: buildDocsCommitInstruction(`docs(${milestoneId}): milestone context from discuss`),
1977
1982
  fastPathInstruction: "",
@@ -2052,6 +2057,7 @@ export async function showSmartEntry(ctx, pi, basePath, options) {
2052
2057
  const discussMilestoneTemplates = inlineTemplate("context", "Context");
2053
2058
  const structuredQuestionsAvailable = getStructuredQuestionsAvailability(pi, ctx);
2054
2059
  await dispatchWorkflow(pi, loadPrompt("guided-discuss-milestone", {
2060
+ workingDirectory: basePath,
2055
2061
  milestoneId, milestoneTitle, inlinedTemplates: discussMilestoneTemplates, structuredQuestionsAvailable,
2056
2062
  commitInstruction: buildDocsCommitInstruction(`docs(${milestoneId}): milestone context from discuss`),
2057
2063
  fastPathInstruction: "",
@@ -71,6 +71,16 @@ function parsePhaseEntry(line) {
71
71
  raw: line,
72
72
  };
73
73
  }
74
+ // Format 3: - ✅ v1.0 MVP — Phases 1-6
75
+ const fmtVersionPhases = stripped.match(/^-\s+([✅🚧])\s+v\d+(?:\.\d+)*\s+(.+?)\s*[—–]\s*Phases?\s+(\d+(?:\.\d+)?)(?:\s*-\s*\d+(?:\.\d+)?)?(?:\s+\(.*\))?\s*$/iu);
76
+ if (fmtVersionPhases) {
77
+ return {
78
+ number: parseFloat(fmtVersionPhases[3]),
79
+ title: fmtVersionPhases[2].trim(),
80
+ done: fmtVersionPhases[1] === '✅',
81
+ raw: line,
82
+ };
83
+ }
74
84
  return null;
75
85
  }
76
86
  /**
@@ -14,6 +14,8 @@ import { isInfrastructureError } from "./auto/infra-errors.js";
14
14
  // Issue #453: keep auto-mode bookkeeping on the stable git CLI path unless a
15
15
  // caller explicitly opts into the native helper.
16
16
  const NATIVE_GSD_GIT_ENABLED = process.env.GSD_ENABLE_NATIVE_GSD_GIT === "1";
17
+ const TRANSIENT_GIT_RETRY_CODES = new Set(["ENOBUFS", "EAGAIN"]);
18
+ const GIT_RETRY_DELAY_MS = 200;
17
19
  // ─── Native Module Loading ──────────────────────────────────────────────────
18
20
  let nativeModule = null;
19
21
  let loadAttempted = false;
@@ -46,10 +48,42 @@ function gitExec(basePath, args, allowFailure = false) {
46
48
  env: GIT_NO_PROMPT_ENV,
47
49
  }).trim();
48
50
  }
49
- catch {
51
+ catch (err) {
50
52
  if (allowFailure)
51
53
  return "";
52
- throw new GSDError(GSD_GIT_ERROR, `git ${args.join(" ")} failed in ${basePath}`);
54
+ throw new GSDError(GSD_GIT_ERROR, `git ${args.join(" ")} failed in ${basePath}: ${getErrorMessage(err)}`);
55
+ }
56
+ }
57
+ /** sleepSync uses Atomics.wait for a blocking pause without busy-waiting; it blocks the current thread and requires Atomics.wait support. */
58
+ function sleepSync(ms) {
59
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
60
+ }
61
+ function isRetryableGitError(err) {
62
+ const code = isInfrastructureError(err)
63
+ ?? isInfrastructureError(err?.stderr ?? "");
64
+ return code !== null && TRANSIENT_GIT_RETRY_CODES.has(code);
65
+ }
66
+ function execGitFileSyncWithRetry(basePath, args, options) {
67
+ try {
68
+ return execFileSync("git", args, {
69
+ cwd: basePath,
70
+ stdio: ["ignore", "pipe", "pipe"],
71
+ encoding: "utf-8",
72
+ env: GIT_NO_PROMPT_ENV,
73
+ ...options,
74
+ }).trim();
75
+ }
76
+ catch (err) {
77
+ if (!isRetryableGitError(err))
78
+ throw err;
79
+ sleepSync(GIT_RETRY_DELAY_MS);
80
+ return execFileSync("git", args, {
81
+ cwd: basePath,
82
+ stdio: ["ignore", "pipe", "pipe"],
83
+ encoding: "utf-8",
84
+ env: GIT_NO_PROMPT_ENV,
85
+ ...options,
86
+ }).trim();
53
87
  }
54
88
  }
55
89
  /** Run a git command via execFileSync. Returns trimmed stdout. */
@@ -62,10 +96,10 @@ function gitFileExec(basePath, args, allowFailure = false) {
62
96
  env: GIT_NO_PROMPT_ENV,
63
97
  }).trim();
64
98
  }
65
- catch {
99
+ catch (err) {
66
100
  if (allowFailure)
67
101
  return "";
68
- throw new GSDError(GSD_GIT_ERROR, `git ${args.join(" ")} failed in ${basePath}`);
102
+ throw new GSDError(GSD_GIT_ERROR, `git ${args.join(" ")} failed in ${basePath}: ${getErrorMessage(err)}`);
69
103
  }
70
104
  }
71
105
  // ─── Existing Read Functions ──────────────────────────────────────────────
@@ -782,13 +816,10 @@ export function nativeCommit(basePath, message, options) {
782
816
  const args = ["commit", "-F", "-"];
783
817
  if (options?.allowEmpty)
784
818
  args.push("--allow-empty");
785
- const result = execFileSync("git", args, {
786
- cwd: basePath,
819
+ const result = execGitFileSyncWithRetry(basePath, args, {
787
820
  stdio: ["pipe", "pipe", "pipe"],
788
- encoding: "utf-8",
789
- env: GIT_NO_PROMPT_ENV,
790
821
  input: message,
791
- }).trim();
822
+ });
792
823
  return result;
793
824
  }
794
825
  catch (err) {
@@ -17,6 +17,43 @@
17
17
  import { existsSync, readFileSync } from "node:fs";
18
18
  import { resolve, dirname, extname } from "node:path";
19
19
  // ─── Import Resolution Check ─────────────────────────────────────────────────
20
+ /**
21
+ * Replace the contents of single- and double-quoted string literals on a single
22
+ * source line with spaces so import patterns do not match text inside strings.
23
+ * Template-literal spans are handled separately via the inTemplateLiteral flag.
24
+ */
25
+ function stripStringLiterals(line) {
26
+ let result = "";
27
+ let i = 0;
28
+ while (i < line.length) {
29
+ const ch = line[i];
30
+ if (ch === '"' || ch === "'") {
31
+ result += ch;
32
+ i++;
33
+ while (i < line.length) {
34
+ const c = line[i];
35
+ if (c === "\\" && i + 1 < line.length) {
36
+ result += " ";
37
+ i += 2;
38
+ }
39
+ else if (c === ch) {
40
+ result += ch;
41
+ i++;
42
+ break;
43
+ }
44
+ else {
45
+ result += " ";
46
+ i++;
47
+ }
48
+ }
49
+ }
50
+ else {
51
+ result += ch;
52
+ i++;
53
+ }
54
+ }
55
+ return result;
56
+ }
20
57
  /**
21
58
  * Extract relative import paths from TypeScript/JavaScript source code.
22
59
  * Returns array of { importPath, lineNum } for relative imports.
@@ -30,11 +67,19 @@ export function extractRelativeImports(source) {
30
67
  // import './path'
31
68
  // require('./path')
32
69
  // require("../path")
33
- const importPattern = /(?:import\s+(?:.*?\s+from\s+)?|require\s*\(\s*)(['"])(\.\.?\/[^'"]+)\1/g;
70
+ const importPattern = /(?:^|[;{}]\s*)import\s+(?:.*?\s+from\s+)?(['"])(\.\.?\/[^'"]+)\1/g;
71
+ const requirePattern = /require\s*\(\s*(['"])(\.\.?\/[^'"]+)\1/g;
34
72
  // Track if we're inside a block comment
35
73
  let inBlockComment = false;
74
+ let inTemplateLiteral = false;
36
75
  for (let i = 0; i < lines.length; i++) {
37
76
  const line = lines[i];
77
+ if (inTemplateLiteral) {
78
+ if ((line.match(/(?<!\\)`/g) ?? []).length % 2 === 1) {
79
+ inTemplateLiteral = false;
80
+ }
81
+ continue;
82
+ }
38
83
  // Handle block comment boundaries
39
84
  if (inBlockComment) {
40
85
  if (line.includes("*/")) {
@@ -61,9 +106,17 @@ export function extractRelativeImports(source) {
61
106
  let match;
62
107
  // Reset lastIndex for each line
63
108
  importPattern.lastIndex = 0;
109
+ requirePattern.lastIndex = 0;
110
+ const strippedLine = stripStringLiterals(line);
64
111
  while ((match = importPattern.exec(line)) !== null) {
112
+ const importOffset = match[0].indexOf("import");
113
+ const importStart = match.index + importOffset;
114
+ if (strippedLine.slice(importStart, importStart + "import".length) !==
115
+ "import") {
116
+ continue;
117
+ }
65
118
  // Check if this match is after a // comment marker on the same line
66
- const beforeMatch = line.substring(0, match.index);
119
+ const beforeMatch = strippedLine.substring(0, match.index);
67
120
  if (beforeMatch.includes("//")) {
68
121
  continue;
69
122
  }
@@ -72,6 +125,24 @@ export function extractRelativeImports(source) {
72
125
  lineNum: i + 1,
73
126
  });
74
127
  }
128
+ while ((match = requirePattern.exec(line)) !== null) {
129
+ if (strippedLine.slice(match.index, match.index + "require".length) !==
130
+ "require") {
131
+ continue;
132
+ }
133
+ // Check if this match is after a // comment marker on the same line
134
+ const beforeMatch = strippedLine.substring(0, match.index);
135
+ if (beforeMatch.includes("//")) {
136
+ continue;
137
+ }
138
+ imports.push({
139
+ importPath: match[2],
140
+ lineNum: i + 1,
141
+ });
142
+ }
143
+ if ((strippedLine.match(/(?<!\\)`/g) ?? []).length % 2 === 1) {
144
+ inTemplateLiteral = true;
145
+ }
75
146
  }
76
147
  return imports;
77
148
  }
@@ -19,7 +19,33 @@ import { existsSync } from "node:fs";
19
19
  import { spawn } from "node:child_process";
20
20
  import { homedir } from "node:os";
21
21
  import { resolve } from "node:path";
22
+ import { validateVerificationCommand } from "./verification-gate.js";
22
23
  const NPM_COMMAND = process.platform === "win32" ? "npm.cmd" : "npm";
24
+ export function checkVerificationCommands(tasks) {
25
+ const results = [];
26
+ for (const task of tasks) {
27
+ const verify = task.verify.trim();
28
+ if (!verify)
29
+ continue;
30
+ const commands = verify
31
+ .split("&&")
32
+ .map((command) => command.trim())
33
+ .filter(Boolean);
34
+ for (const command of commands) {
35
+ const validation = validateVerificationCommand(command);
36
+ if (!validation.ok) {
37
+ results.push({
38
+ category: "tool",
39
+ target: `${task.id} Verify`,
40
+ passed: false,
41
+ message: `Unsafe or non-runnable Verify command: ${command} (${validation.reason})`,
42
+ blocking: true,
43
+ });
44
+ }
45
+ }
46
+ }
47
+ return results;
48
+ }
23
49
  // ─── Package Existence Check ─────────────────────────────────────────────────
24
50
  /**
25
51
  * Extract npm package names from task descriptions.
@@ -647,7 +673,8 @@ export async function runPreExecutionChecks(tasks, basePath) {
647
673
  const fileChecks = checkFilePathConsistency(tasks, basePath);
648
674
  const orderingChecks = checkTaskOrdering(tasks, basePath);
649
675
  const contractChecks = checkInterfaceContracts(tasks, basePath);
650
- allChecks.push(...fileChecks, ...orderingChecks, ...contractChecks);
676
+ const verificationChecks = checkVerificationCommands(tasks);
677
+ allChecks.push(...fileChecks, ...orderingChecks, ...contractChecks, ...verificationChecks);
651
678
  // Run async package checks
652
679
  const packageChecks = await checkPackageExistence(tasks, basePath);
653
680
  allChecks.push(...packageChecks);
@@ -181,7 +181,7 @@ export function loadPrompt(name, vars = {}) {
181
181
  .map(m => m.slice(2, -2))
182
182
  .filter(key => !(key in effectiveVars));
183
183
  if (missing.length > 0) {
184
- throw new GSDError(GSD_PARSE_ERROR, `loadPrompt("${name}"): template declares {{${missing.join("}}, {{")}}}} but no value was provided. ` +
184
+ throw new GSDError(GSD_PARSE_ERROR, `loadPrompt("${name}"): template declares {{${missing.join("}}, {{")}}} but no value was provided. ` +
185
185
  `This usually means the extension code in memory is older than the template on disk. ` +
186
186
  `Restart pi to reload the extension.`);
187
187
  }
@@ -26,7 +26,7 @@ Before planning, validate roadmap assumptions against code and dependency summar
26
26
 
27
27
  {{sourceFilePaths}}
28
28
 
29
- If slice research is inlined, trust it. Explore enough code to confirm paths, boundaries, and verification. Executors later get only task plans, slice excerpt, and prior summaries, so put required paths, steps, inputs, and outputs in task plans.
29
+ If slice research is inlined, trust its architectural findings, but verify every concrete file path you place in task `inputs` or `expectedOutput` against the current tree or prior/same-task outputs. Explore enough code to confirm paths, boundaries, and verification. Executors later get only task plans, slice excerpt, and prior summaries, so put required paths, steps, inputs, and outputs in task plans.
30
30
 
31
31
  {{executorContextConstraints}}
32
32
 
@@ -39,8 +39,8 @@ If slice research is inlined, trust it. Explore enough code to confirm paths, bo
39
39
  5. Define slice verification before tasks. Non-trivial slices need real tests or executable assertions; boundary contracts need contract-exercising checks. Tests must not read .gitignore/gitignored paths such as `.gsd/`, `.planning/`, or `.audits/`.
40
40
  6. Include Threat Surface (Q3), Requirement Impact (Q4), proof level, observability, integration closure, Failure Modes (Q5), Load Profile (Q6), and Negative Tests (Q7) only where applicable.
41
41
  7. Right-size tasks. Simple slices can be one task; split only when context, ownership, or verification boundaries justify it.
42
- 8. Each task needs a concrete title, Why / Files / Do / Verify / Done when, plus task-plan description, steps, must-haves, verification, inputs, and expected output. Inputs and Expected Output must include concrete backtick-wrapped paths. Use paths relative to `{{workingDirectory}}`; do not put absolute paths to the original checkout or any directory outside `{{workingDirectory}}` in `files`, `inputs`, `expectedOutput`, or verification commands. **`expected_output` must only list files the task actually creates or overwrites on disk.** Do NOT include files the task merely reads, verifies, or tests — those belong only in `inputs`. If a task is a pure verification or test task that produces no new files, its `expected_output` may be empty or limited to test-result artifacts (e.g. a log or assertion output). A file that does not yet exist on disk and is needed as an `input` must be produced by an earlier task's `expected_output` — if no prior task creates it, add a task before this one that does.
43
- 9. Persist with `gsd_plan_slice` using goal, successCriteria, optional proofLevel/integrationClosure/observabilityImpact, and tasks. `gsd_plan_slice` handles task persistence transactionally and renders `{{outputPath}}` plus task plans; do not call `gsd_plan_task`. The DB-backed tool is the canonical write path. Do **not** rely on direct `PLAN.md` writes as the source of truth.
42
+ 8. Each task needs the exact `gsd_plan_slice.tasks[]` shape: `taskId`, `title`, `description`, `estimate`, `files`, `verify`, `inputs`, `expectedOutput`, and optional `observabilityImpact`. `description` should contain the Why / Do / Done-when narrative. `files`, `inputs`, and `expectedOutput` must be JSON arrays of strings, even when there is only one path (for example, `"inputs": ["src/index.ts"]`, never `"inputs": "src/index.ts"`). Use paths relative to `{{workingDirectory}}`; do not put absolute paths to the original checkout or any directory outside `{{workingDirectory}}` in `files`, `inputs`, `expectedOutput`, or verification commands. **`expectedOutput` must only list files the task actually creates or overwrites on disk.** Do NOT include files the task merely reads, verifies, or tests — those belong only in `inputs`. If a task is a pure verification or test task that produces no new files, `expectedOutput` may be `[]` or limited to test-result artifacts (e.g. a log or assertion output). A file that does not yet exist on disk and is needed as an `input` must be produced by an earlier task's `expectedOutput` — if no prior task creates it, add a task before this one that does.
43
+ 9. Persist with `gsd_plan_slice` using `milestoneId`, `sliceId`, `goal`, optional `successCriteria`/`proofLevel`/`integrationClosure`/`observabilityImpact`, and `tasks`. `gsd_plan_slice` handles task persistence transactionally and renders `{{outputPath}}` plus task plans; do not call `gsd_plan_task`. The DB-backed tool is the canonical write path. Do **not** rely on direct `PLAN.md` writes as the source of truth.
44
44
  10. Self-audit before finishing: goal/demo closure, requirement coverage, locked decisions, concrete paths, dependency order, wiring, scope size, proof truthfulness, feature completeness, and quality gates. Quality gates: non-trivial slices/tasks include specific Q3-Q7 coverage where applicable.
45
45
  11. If planning creates structural decisions, append them to `.gsd/DECISIONS.md`.
46
46
  12. {{commitInstruction}}
@@ -64,7 +64,7 @@ Then:
64
64
  2. {{skillActivation}} Record the installed skills you expect executors to use in each task plan's `skills_used` frontmatter.
65
65
  3. Define slice-level verification: the objective stopping condition. Plan real test files with real assertions; for simple slices, executable commands are fine.
66
66
  4. For non-trivial slices, plan observability / proof level / integration closure, threat surface, and requirement impact. Omit entirely for simple slices.
67
- 5. Decompose the slice into tasks that fit one context window each. Every task must have Why / Files / Do / Verify / Done-when, plus a task plan with description, steps, must-haves, verification, inputs (backtick-wrapped paths), and expected output (backtick-wrapped paths).
67
+ 5. Decompose the slice into tasks that fit one context window each. Every task passed to `gsd_plan_slice` must use the exact keys `taskId`, `title`, `description`, `estimate`, `files`, `verify`, `inputs`, `expectedOutput`, and optional `observabilityImpact`. Put Why / Do / Done-when detail in `description`. `files`, `inputs`, and `expectedOutput` must be JSON arrays of strings, even for one path (for example, `"expectedOutput": ["src/index.ts"]`, never `"expectedOutput": "src/index.ts"`).
68
68
  6. **Persist planning state through `gsd_plan_slice`.** Call it with the full payload. The tool writes to the DB and renders `{{outputPath}}` and `{{slicePath}}/tasks/T##-PLAN.md` automatically. Do NOT rely on direct `PLAN.md` writes.
69
69
  7. **Self-audit the plan.** If every task were completed exactly as written, the slice goal/demo should be true. Every must-have maps to a task. Inputs and Expected Output are backtick-wrapped file paths.
70
70
  8. If refinement produced structural decisions that diverge from the sketch, append them to `.gsd/DECISIONS.md`.
@@ -22,3 +22,7 @@ export function isDeferredStatus(status) {
22
22
  export function isInactiveStatus(status) {
23
23
  return isClosedStatus(status) || isDeferredStatus(status);
24
24
  }
25
+ /** Returns true when a prior milestone should not block dispatch ordering. */
26
+ export function isSkippedForDispatch(status) {
27
+ return isClosedStatus(status) || status === "parked" || isDeferredStatus(status);
28
+ }
@@ -99,11 +99,11 @@
99
99
  - "Improve UI"
100
100
 
101
101
  Each task should usually include:
102
- - Why: why this task exists / what part of the slice it closes
103
- - Files: the main files likely touched
104
- - Do: concrete implementation steps and important constraints
105
- - Verify: the command, test, or runtime check that proves it worked
106
- - Done when: a measurable acceptance condition
102
+ - description: why this task exists, concrete steps, and done-when acceptance
103
+ - files: JSON array of likely touched paths
104
+ - verify: the command, test, or runtime check that proves it worked
105
+ - inputs: JSON array of existing paths or prior task outputs this task consumes
106
+ - expectedOutput: JSON array of paths this task creates or overwrites
107
107
 
108
108
  Keep the checkbox line format exactly:
109
109
  - [ ] **T01: Title** `est:30m`
@@ -131,10 +131,13 @@
131
131
 
132
132
  Verify field rules:
133
133
  - MUST be a mechanically executable command: `npm test`, `grep -q "pattern" file`, `test -f path`
134
+ - MUST NOT use shell pipes, redirects, semicolons, backticks, command substitution, or output trimming
134
135
  - For content/document tasks: verify file existence, section count, YAML validity, or word count
135
136
  NOT exact phrasing, specific formulas, or "zero TBD" aspirational criteria
136
137
  - If no command can verify the output, write: "Manual review — file exists and is non-empty"
138
+ - BAD: `python3 -m pytest tests/ -q --tb=short 2>&1 | tail -5`
137
139
  - BAD: "Sections 3.1 and 3.2 exist with exact formulas. Zero TBD/TODO."
140
+ - GOOD: `python3 -m pytest tests/ -q --tb=short`
138
141
  - GOOD: `grep -c "^## " doc.md` returns >= 4 (4+ sections), `! grep -q "TBD\|TODO" doc.md`
139
142
 
140
143
  Integration closure rule:
@@ -72,7 +72,8 @@ skills_used:
72
72
  <!-- Every input MUST be a backtick-wrapped file path. These paths are machine-parsed to
73
73
  derive task dependencies — vague descriptions without paths break dependency detection.
74
74
  For the first task in a slice with no prior task outputs, list the existing source files
75
- this task reads or modifies. -->
75
+ this task reads or modifies.
76
+ Tool field: inputs must be an array of strings, e.g. ["src/index.ts"], never a single string. -->
76
77
 
77
78
  - `{{filePath}}` — {{whatThisTaskNeedsFromPriorWork}}
78
79
 
@@ -82,6 +83,7 @@ skills_used:
82
83
  or modifies. These paths are machine-parsed to derive task dependencies.
83
84
  This task should produce a real increment toward making the slice goal/demo true. A full
84
85
  slice plan should not be able to mark every task complete while the claimed slice behavior
85
- still does not work at the stated proof level. -->
86
+ still does not work at the stated proof level.
87
+ Tool field: expectedOutput must be an array of strings, e.g. ["src/index.ts"], never a single string. -->
86
88
 
87
89
  - `{{filePath}}` — {{whatThisTaskCreatesOrModifies}}
@@ -24,11 +24,11 @@ function renderMilestoneSummaryMarkdown(params, completedAt) {
24
24
  const keyFiles = params.keyFiles ?? [];
25
25
  const lessonsLearned = params.lessonsLearned ?? [];
26
26
  const keyDecisionsYaml = keyDecisions.length > 0
27
- ? keyDecisions.map(d => ` - ${d}`).join("\n")
28
- : " - (none)";
27
+ ? `\n${keyDecisions.map(d => ` - ${d}`).join("\n")}`
28
+ : " []";
29
29
  const keyFilesYaml = keyFiles.length > 0
30
- ? keyFiles.map(f => ` - ${f}`).join("\n")
31
- : " - (none)";
30
+ ? `\n${keyFiles.map(f => ` - ${f}`).join("\n")}`
31
+ : " []";
32
32
  const lessonsYaml = lessonsLearned.length > 0
33
33
  ? lessonsLearned.map(l => ` - ${l}`).join("\n")
34
34
  : " - (none)";
@@ -37,10 +37,8 @@ id: ${params.milestoneId}
37
37
  title: "${displayTitle}"
38
38
  status: complete
39
39
  completed_at: ${completedAt}
40
- key_decisions:
41
- ${keyDecisionsYaml}
42
- key_files:
43
- ${keyFilesYaml}
40
+ key_decisions:${keyDecisionsYaml}
41
+ key_files:${keyFilesYaml}
44
42
  lessons_learned:
45
43
  ${lessonsYaml}
46
44
  ---
@@ -65,11 +65,11 @@ function renderSliceSummaryMarkdown(params) {
65
65
  ? affects.map(a => ` - ${a}`).join("\n")
66
66
  : " []";
67
67
  const keyFilesYaml = keyFiles.length > 0
68
- ? keyFiles.map(f => ` - ${f}`).join("\n")
69
- : " - (none)";
68
+ ? `\n${keyFiles.map(f => ` - ${f}`).join("\n")}`
69
+ : " []";
70
70
  const keyDecisionsYaml = keyDecisions.length > 0
71
- ? keyDecisions.map(d => ` - ${d}`).join("\n")
72
- : " - (none)";
71
+ ? `\n${keyDecisions.map(d => ` - ${d}`).join("\n")}`
72
+ : " []";
73
73
  const patternsYaml = patternsEstablished.length > 0
74
74
  ? patternsEstablished.map(p => ` - ${p}`).join("\n")
75
75
  : " - (none)";
@@ -106,10 +106,8 @@ requires:
106
106
  ${requiresYaml}
107
107
  affects:
108
108
  ${affectsYaml}
109
- key_files:
110
- ${keyFilesYaml}
111
- key_decisions:
112
- ${keyDecisionsYaml}
109
+ key_files:${keyFilesYaml}
110
+ key_decisions:${keyDecisionsYaml}
113
111
  patterns_established:
114
112
  ${patternsYaml}
115
113
  observability_surfaces: