gsd-pi 2.80.0-dev.c5f2443b3 → 2.80.0-dev.e146beb20

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 (342) hide show
  1. package/dist/resources/.managed-resources-content-hash +1 -1
  2. package/dist/resources/GSD-WORKFLOW.md +2 -2
  3. package/dist/resources/extensions/github-sync/templates.js +39 -8
  4. package/dist/resources/extensions/gsd/auto/loop.js +48 -10
  5. package/dist/resources/extensions/gsd/auto/phases.js +37 -30
  6. package/dist/resources/extensions/gsd/auto/run-unit.js +19 -15
  7. package/dist/resources/extensions/gsd/auto-dashboard.js +51 -15
  8. package/dist/resources/extensions/gsd/auto-dispatch.js +10 -0
  9. package/dist/resources/extensions/gsd/auto-post-unit.js +10 -10
  10. package/dist/resources/extensions/gsd/auto-prompts.js +111 -1
  11. package/dist/resources/extensions/gsd/auto-recovery.js +154 -8
  12. package/dist/resources/extensions/gsd/auto-start.js +2 -3
  13. package/dist/resources/extensions/gsd/auto.js +9 -1
  14. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +15 -1
  15. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +11 -1
  16. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +129 -1
  17. package/dist/resources/extensions/gsd/clean-root-preflight.js +42 -4
  18. package/dist/resources/extensions/gsd/commands/dispatcher.js +5 -0
  19. package/dist/resources/extensions/gsd/commands-extract-learnings.js +17 -12
  20. package/dist/resources/extensions/gsd/crash-recovery.js +56 -10
  21. package/dist/resources/extensions/gsd/custom-workflow-engine.js +22 -2
  22. package/dist/resources/extensions/gsd/db-base-schema.js +14 -0
  23. package/dist/resources/extensions/gsd/db-migration-steps.js +16 -0
  24. package/dist/resources/extensions/gsd/detection.js +106 -0
  25. package/dist/resources/extensions/gsd/graph.js +9 -3
  26. package/dist/resources/extensions/gsd/gsd-db.js +102 -2
  27. package/dist/resources/extensions/gsd/guided-flow.js +49 -12
  28. package/dist/resources/extensions/gsd/planning-path-scope.js +26 -0
  29. package/dist/resources/extensions/gsd/pr-evidence.js +57 -16
  30. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +7 -8
  31. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
  32. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  33. package/dist/resources/extensions/gsd/safety/evidence-collector.js +10 -2
  34. package/dist/resources/extensions/gsd/tools/plan-slice.js +9 -0
  35. package/dist/resources/extensions/gsd/tools/plan-task.js +9 -0
  36. package/dist/resources/extensions/gsd/unit-runtime.js +11 -0
  37. package/dist/resources/extensions/gsd/working-output-messages.js +64 -0
  38. package/dist/resources/extensions/gsd/worktree-manager.js +16 -14
  39. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  40. package/dist/web/standalone/.next/BUILD_ID +1 -1
  41. package/dist/web/standalone/.next/app-path-routes-manifest.json +16 -16
  42. package/dist/web/standalone/.next/build-manifest.json +3 -3
  43. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  44. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  45. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  46. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  51. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  52. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  53. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  54. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  56. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  61. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  62. package/dist/web/standalone/.next/server/app/index.html +1 -1
  63. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  64. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  65. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  66. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  67. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  68. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  69. package/dist/web/standalone/.next/server/app-paths-manifest.json +16 -16
  70. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  71. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  72. package/dist/web/standalone/.next/server/middleware-react-loadable-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/dist/web/standalone/.next/static/chunks/{8336.6f6f30e410419aff.js → 8336.631939fb583761fa.js} +1 -1
  77. package/dist/web/standalone/.next/static/chunks/{webpack-d82dbee6356c1733.js → webpack-0481f1221120a7c6.js} +1 -1
  78. package/package.json +10 -6
  79. package/packages/contracts/package.json +1 -1
  80. package/packages/pi-ai/dist/models/fake-model.d.ts +12 -0
  81. package/packages/pi-ai/dist/models/fake-model.d.ts.map +1 -0
  82. package/packages/pi-ai/dist/models/fake-model.js +27 -0
  83. package/packages/pi-ai/dist/models/fake-model.js.map +1 -0
  84. package/packages/pi-ai/dist/models/index.d.ts.map +1 -1
  85. package/packages/pi-ai/dist/models/index.js +8 -0
  86. package/packages/pi-ai/dist/models/index.js.map +1 -1
  87. package/packages/pi-ai/dist/providers/fake.d.ts +42 -0
  88. package/packages/pi-ai/dist/providers/fake.d.ts.map +1 -0
  89. package/packages/pi-ai/dist/providers/fake.js +319 -0
  90. package/packages/pi-ai/dist/providers/fake.js.map +1 -0
  91. package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  92. package/packages/pi-ai/dist/providers/register-builtins.js +24 -0
  93. package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
  94. package/packages/pi-ai/src/models/fake-model.ts +30 -0
  95. package/packages/pi-ai/src/models/index.ts +9 -0
  96. package/packages/pi-ai/src/providers/fake.ts +376 -0
  97. package/packages/pi-ai/src/providers/register-builtins.ts +23 -0
  98. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  99. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +74 -0
  100. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  101. package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts +15 -0
  102. package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts.map +1 -0
  103. package/packages/pi-coding-agent/dist/core/db-snapshot.js +66 -0
  104. package/packages/pi-coding-agent/dist/core/db-snapshot.js.map +1 -0
  105. package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts +2 -0
  106. package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts.map +1 -0
  107. package/packages/pi-coding-agent/dist/core/db-snapshot.test.js +24 -0
  108. package/packages/pi-coding-agent/dist/core/db-snapshot.test.js.map +1 -0
  109. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -0
  110. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  111. package/packages/pi-coding-agent/dist/core/extensions/runner.js +14 -1
  112. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  113. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +97 -0
  114. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
  115. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  116. package/packages/pi-coding-agent/dist/core/model-registry.js +5 -0
  117. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  118. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +4 -0
  119. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  120. package/packages/pi-coding-agent/dist/core/settings-manager.js +8 -0
  121. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  122. package/packages/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -1
  123. package/packages/pi-coding-agent/dist/core/slash-commands.js +1 -0
  124. package/packages/pi-coding-agent/dist/core/slash-commands.js.map +1 -1
  125. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +6 -4
  126. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -1
  127. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +54 -15
  128. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  129. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts +26 -0
  130. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts.map +1 -0
  131. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js +112 -0
  132. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -0
  133. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts +2 -0
  134. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts.map +1 -0
  135. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js +51 -0
  136. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js.map +1 -0
  137. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  138. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  139. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  140. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +10 -9
  141. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  142. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +3 -0
  143. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  144. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +11 -0
  145. package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  146. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +7 -6
  147. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -1
  148. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +16 -0
  149. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  150. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +106 -17
  151. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  152. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  153. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +60 -1
  154. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  155. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +40 -1
  156. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
  157. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +1 -0
  158. package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
  159. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +1 -0
  160. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
  161. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
  162. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +3 -0
  163. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  164. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +23 -0
  165. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  166. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -1
  167. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +20 -0
  168. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
  169. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts +2 -0
  170. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts.map +1 -0
  171. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js +79 -0
  172. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js.map +1 -0
  173. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
  174. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  175. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +13 -0
  176. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  177. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -1
  178. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  179. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +18 -1
  180. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  181. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  182. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +36 -27
  183. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  184. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts +11 -0
  185. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts.map +1 -0
  186. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js +18 -0
  187. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js.map +1 -0
  188. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts +2 -0
  189. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts.map +1 -0
  190. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +48 -0
  191. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -0
  192. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts +2 -0
  193. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts.map +1 -0
  194. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +10 -0
  195. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -0
  196. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
  197. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +3 -2
  198. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
  199. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +87 -0
  200. package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
  201. package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
  202. package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +108 -0
  203. package/packages/pi-coding-agent/src/core/extensions/runner.ts +16 -1
  204. package/packages/pi-coding-agent/src/core/model-registry.ts +4 -0
  205. package/packages/pi-coding-agent/src/core/settings-manager.ts +12 -0
  206. package/packages/pi-coding-agent/src/core/slash-commands.ts +1 -0
  207. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +7 -5
  208. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +78 -15
  209. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.test.ts +59 -0
  210. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +160 -0
  211. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +1 -0
  212. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +10 -9
  213. package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +15 -0
  214. package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +10 -9
  215. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +118 -17
  216. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +43 -1
  217. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +75 -1
  218. package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +1 -0
  219. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +1 -1
  220. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +25 -0
  221. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.test.ts +95 -0
  222. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +24 -1
  223. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +13 -0
  224. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +32 -2
  225. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +36 -27
  226. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +65 -0
  227. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.ts +29 -0
  228. package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +14 -0
  229. package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +3 -2
  230. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  231. package/packages/pi-tui/dist/__tests__/style.test.d.ts +2 -0
  232. package/packages/pi-tui/dist/__tests__/style.test.d.ts.map +1 -0
  233. package/packages/pi-tui/dist/__tests__/style.test.js +63 -0
  234. package/packages/pi-tui/dist/__tests__/style.test.js.map +1 -0
  235. package/packages/pi-tui/dist/__tests__/tui.test.js +24 -3
  236. package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
  237. package/packages/pi-tui/dist/index.d.ts +1 -0
  238. package/packages/pi-tui/dist/index.d.ts.map +1 -1
  239. package/packages/pi-tui/dist/index.js +2 -0
  240. package/packages/pi-tui/dist/index.js.map +1 -1
  241. package/packages/pi-tui/dist/style.d.ts +41 -0
  242. package/packages/pi-tui/dist/style.d.ts.map +1 -0
  243. package/packages/pi-tui/dist/style.js +158 -0
  244. package/packages/pi-tui/dist/style.js.map +1 -0
  245. package/packages/pi-tui/dist/tui.d.ts +0 -1
  246. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  247. package/packages/pi-tui/dist/tui.js +3 -8
  248. package/packages/pi-tui/dist/tui.js.map +1 -1
  249. package/packages/pi-tui/src/__tests__/style.test.ts +76 -0
  250. package/packages/pi-tui/src/__tests__/tui.test.ts +29 -3
  251. package/packages/pi-tui/src/index.ts +9 -0
  252. package/packages/pi-tui/src/style.ts +225 -0
  253. package/packages/pi-tui/src/tui.ts +3 -8
  254. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  255. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
  256. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  257. package/pkg/dist/modes/interactive/theme/theme-schema.js +13 -0
  258. package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  259. package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -1
  260. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  261. package/pkg/dist/modes/interactive/theme/theme.js +18 -1
  262. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  263. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  264. package/pkg/dist/modes/interactive/theme/themes.js +36 -27
  265. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  266. package/src/resources/GSD-WORKFLOW.md +2 -2
  267. package/src/resources/extensions/github-sync/templates.ts +38 -8
  268. package/src/resources/extensions/github-sync/tests/inline-code.test.ts +66 -0
  269. package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
  270. package/src/resources/extensions/gsd/auto/loop.ts +67 -18
  271. package/src/resources/extensions/gsd/auto/phases.ts +42 -28
  272. package/src/resources/extensions/gsd/auto/run-unit.ts +24 -14
  273. package/src/resources/extensions/gsd/auto-dashboard.ts +57 -8
  274. package/src/resources/extensions/gsd/auto-dispatch.ts +17 -0
  275. package/src/resources/extensions/gsd/auto-post-unit.ts +10 -10
  276. package/src/resources/extensions/gsd/auto-prompts.ts +116 -1
  277. package/src/resources/extensions/gsd/auto-recovery.ts +153 -7
  278. package/src/resources/extensions/gsd/auto-start.ts +7 -6
  279. package/src/resources/extensions/gsd/auto.ts +12 -1
  280. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +16 -1
  281. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +17 -1
  282. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +135 -1
  283. package/src/resources/extensions/gsd/clean-root-preflight.ts +41 -3
  284. package/src/resources/extensions/gsd/commands/dispatcher.ts +6 -0
  285. package/src/resources/extensions/gsd/commands-extract-learnings.ts +17 -12
  286. package/src/resources/extensions/gsd/crash-recovery.ts +67 -10
  287. package/src/resources/extensions/gsd/custom-workflow-engine.ts +24 -1
  288. package/src/resources/extensions/gsd/db-base-schema.ts +15 -0
  289. package/src/resources/extensions/gsd/db-migration-steps.ts +17 -0
  290. package/src/resources/extensions/gsd/detection.ts +128 -0
  291. package/src/resources/extensions/gsd/graph.ts +12 -5
  292. package/src/resources/extensions/gsd/gsd-db.ts +119 -1
  293. package/src/resources/extensions/gsd/guided-flow.ts +49 -12
  294. package/src/resources/extensions/gsd/planning-path-scope.ts +35 -0
  295. package/src/resources/extensions/gsd/pr-evidence.ts +63 -5
  296. package/src/resources/extensions/gsd/prompts/complete-milestone.md +7 -8
  297. package/src/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
  298. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  299. package/src/resources/extensions/gsd/safety/evidence-collector.ts +11 -2
  300. package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +7 -1
  301. package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +33 -0
  302. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +84 -5
  303. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +170 -1
  304. package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +88 -2
  305. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +9 -0
  306. package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +55 -0
  307. package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +22 -0
  308. package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +112 -6
  309. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +40 -2
  310. package/src/resources/extensions/gsd/tests/db-migration-steps.integration.test.ts +428 -0
  311. package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +2 -2
  312. package/src/resources/extensions/gsd/tests/detection.test.ts +140 -0
  313. package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-basic.md +52 -0
  314. package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-empty-optionals.md +42 -0
  315. package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +55 -0
  316. package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +60 -0
  317. package/src/resources/extensions/gsd/tests/graph-operations.test.ts +10 -0
  318. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -0
  319. package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +33 -1
  320. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +50 -0
  321. package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
  322. package/src/resources/extensions/gsd/tests/pr-evidence-equivalence.test.ts +102 -0
  323. package/src/resources/extensions/gsd/tests/pr-evidence-hardening.test.ts +165 -0
  324. package/src/resources/extensions/gsd/tests/right-sized-workflow-prompts.test.ts +192 -0
  325. package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +29 -0
  326. package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +38 -0
  327. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +46 -2
  328. package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +7 -0
  329. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
  330. package/src/resources/extensions/gsd/tests/working-output-messages.test.ts +93 -0
  331. package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +37 -6
  332. package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +7 -0
  333. package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +9 -2
  334. package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
  335. package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -0
  336. package/src/resources/extensions/gsd/tools/plan-task.ts +10 -0
  337. package/src/resources/extensions/gsd/unit-runtime.ts +14 -0
  338. package/src/resources/extensions/gsd/working-output-messages.ts +120 -0
  339. package/src/resources/extensions/gsd/worktree-manager.ts +15 -4
  340. package/packages/contracts/tsconfig.tsbuildinfo +0 -1
  341. /package/dist/web/standalone/.next/static/{bQDK5_LtkGVS64AirQgQG → y73quA-XdLo9n41nxphjW}/_buildManifest.js +0 -0
  342. /package/dist/web/standalone/.next/static/{bQDK5_LtkGVS64AirQgQG → y73quA-XdLo9n41nxphjW}/_ssgManifest.js +0 -0
@@ -6,6 +6,7 @@
6
6
  * flow to show when entering a project directory.
7
7
  */
8
8
 
9
+ import { execFileSync } from "node:child_process";
9
10
  import { existsSync, openSync, readSync, closeSync, readdirSync, readFileSync, statSync } from "node:fs";
10
11
  import { dirname, join, parse as parsePath } from "node:path";
11
12
  import { homedir } from "node:os";
@@ -72,6 +73,22 @@ export interface ProjectSignals {
72
73
  verificationCommands: string[];
73
74
  }
74
75
 
76
+ export type ProjectClassificationKind =
77
+ | "invalid-repo"
78
+ | "greenfield"
79
+ | "untyped-existing"
80
+ | "typed-existing";
81
+
82
+ export interface ProjectClassification {
83
+ kind: ProjectClassificationKind;
84
+ signals: ProjectSignals;
85
+ trackedFiles: string[];
86
+ untrackedFiles: string[];
87
+ contentFiles: string[];
88
+ markers: string[];
89
+ reason: string;
90
+ }
91
+
75
92
  // ─── Project File Markers ───────────────────────────────────────────────────────
76
93
 
77
94
  export const PROJECT_FILES = [
@@ -243,6 +260,7 @@ const TEST_MARKERS = [
243
260
  const RECURSIVE_SCAN_IGNORED_DIRS = new Set([
244
261
  ".git",
245
262
  ".gsd",
263
+ ".bg-shell",
246
264
  ".planning",
247
265
  ".plans",
248
266
  ".claude",
@@ -267,6 +285,8 @@ const RECURSIVE_SCAN_IGNORED_DIRS = new Set([
267
285
  "out",
268
286
  ]) as ReadonlySet<string>;
269
287
 
288
+ const PROJECT_CONTENT_EXCLUDE_DIRS = RECURSIVE_SCAN_IGNORED_DIRS;
289
+
270
290
  /** Project file markers safe to detect recursively via suffix matching. */
271
291
  const ROOT_ONLY_PROJECT_FILES = new Set<string>([
272
292
  ".github/workflows",
@@ -536,6 +556,114 @@ export function detectProjectSignals(basePath: string): ProjectSignals {
536
556
  };
537
557
  }
538
558
 
559
+ function normalizeGitPath(file: string): string {
560
+ return file.replaceAll("\\", "/").replace(/^\.\//, "");
561
+ }
562
+
563
+ function isProjectContentFile(file: string): boolean {
564
+ const normalized = normalizeGitPath(file);
565
+ if (!normalized || normalized.endsWith("/")) return false;
566
+ if (normalized === ".gitignore" || normalized === ".gitattributes") return false;
567
+ const parts = normalized.split("/");
568
+ if (parts.some((part) => PROJECT_CONTENT_EXCLUDE_DIRS.has(part))) return false;
569
+ if (normalized.endsWith(".DS_Store")) return false;
570
+ return true;
571
+ }
572
+
573
+ function runGitLines(basePath: string, args: string[]): string[] {
574
+ try {
575
+ const output = execFileSync("git", args, {
576
+ cwd: basePath,
577
+ stdio: ["ignore", "pipe", "ignore"],
578
+ encoding: "utf-8",
579
+ }).trim();
580
+ return output ? output.split("\n").map((line) => line.trim()).filter(Boolean) : [];
581
+ } catch {
582
+ return [];
583
+ }
584
+ }
585
+
586
+ function listTrackedProjectFiles(basePath: string): string[] {
587
+ return runGitLines(basePath, ["ls-files"])
588
+ .map(normalizeGitPath)
589
+ .filter(isProjectContentFile);
590
+ }
591
+
592
+ function listUntrackedProjectFiles(basePath: string): string[] {
593
+ return runGitLines(basePath, ["ls-files", "--others", "--exclude-standard"])
594
+ .map(normalizeGitPath)
595
+ .filter(isProjectContentFile);
596
+ }
597
+
598
+ function hasKnownProjectMarkers(basePath: string, signals: ProjectSignals): boolean {
599
+ if (signals.detectedFiles.length > 0) return true;
600
+ if (signals.xcodePlatforms.length > 0) return true;
601
+ return false;
602
+ }
603
+
604
+ /**
605
+ * Classify repo presence separately from ecosystem/tooling markers.
606
+ *
607
+ * Known project files identify tooling. Git-tracked/non-ignored content
608
+ * identifies whether this is an existing project at all. This keeps small
609
+ * static or documentation repos from being mislabeled as greenfield.
610
+ */
611
+ export function classifyProject(basePath: string): ProjectClassification {
612
+ const signals = detectProjectSignals(basePath);
613
+ const markers = [...signals.detectedFiles];
614
+
615
+ if (!signals.isGitRepo) {
616
+ return {
617
+ kind: "invalid-repo",
618
+ signals,
619
+ trackedFiles: [],
620
+ untrackedFiles: [],
621
+ contentFiles: [],
622
+ markers,
623
+ reason: "missing .git",
624
+ };
625
+ }
626
+
627
+ const trackedFiles = listTrackedProjectFiles(basePath);
628
+ const untrackedFiles = listUntrackedProjectFiles(basePath);
629
+ const contentFiles = [...new Set([...trackedFiles, ...untrackedFiles])];
630
+ const hasMarkers = hasKnownProjectMarkers(basePath, signals);
631
+
632
+ if (hasMarkers) {
633
+ return {
634
+ kind: "typed-existing",
635
+ signals,
636
+ trackedFiles,
637
+ untrackedFiles,
638
+ contentFiles,
639
+ markers,
640
+ reason: markers.length > 0 ? `detected markers: ${markers.join(", ")}` : "detected project structure",
641
+ };
642
+ }
643
+
644
+ if (contentFiles.length > 0) {
645
+ return {
646
+ kind: "untyped-existing",
647
+ signals,
648
+ trackedFiles,
649
+ untrackedFiles,
650
+ contentFiles,
651
+ markers,
652
+ reason: "project content exists but no recognized tooling markers were found",
653
+ };
654
+ }
655
+
656
+ return {
657
+ kind: "greenfield",
658
+ signals,
659
+ trackedFiles,
660
+ untrackedFiles,
661
+ contentFiles,
662
+ markers,
663
+ reason: "no tracked or non-ignored project content",
664
+ };
665
+ }
666
+
539
667
  // ─── Xcode Platform Detection ───────────────────────────────────────────────────
540
668
 
541
669
  /** Known SDKROOT values → canonical platform names. */
@@ -31,7 +31,7 @@ export interface GraphStep {
31
31
  status: "pending" | "active" | "complete" | "expanded";
32
32
  /** The prompt to dispatch for this step. */
33
33
  prompt: string;
34
- /** IDs of steps that must be "complete" before this step can run. */
34
+ /** IDs of steps that must be terminal before this step can run. */
35
35
  dependsOn: string[];
36
36
  /** For iteration instances: ID of the parent step that was expanded. */
37
37
  parentStepId?: string;
@@ -152,10 +152,17 @@ export function writeGraph(runDir: string, graph: WorkflowGraph): void {
152
152
  }
153
153
 
154
154
  /**
155
- * Get the next pending step whose dependencies are all complete.
155
+ * Return whether a graph step status satisfies dependency edges.
156
+ */
157
+ export function isTerminalStepStatus(status: GraphStep["status"] | undefined): boolean {
158
+ return status === "complete" || status === "expanded";
159
+ }
160
+
161
+ /**
162
+ * Get the next pending step whose dependencies are all terminal.
156
163
  *
157
164
  * Returns the first step (in array order) with status "pending" where
158
- * every step in its `dependsOn` list has status "complete".
165
+ * every step in its `dependsOn` list has status "complete" or "expanded".
159
166
  *
160
167
  * @param graph — the workflow graph to query
161
168
  * @returns The next dispatchable step, or null if none available
@@ -165,8 +172,8 @@ export function getNextPendingStep(graph: WorkflowGraph): GraphStep | null {
165
172
 
166
173
  for (const step of graph.steps) {
167
174
  if (step.status !== "pending") continue;
168
- const depsComplete = step.dependsOn.every(
169
- (depId) => statusMap.get(depId) === "complete",
175
+ const depsComplete = step.dependsOn.every((depId) =>
176
+ isTerminalStepStatus(statusMap.get(depId)),
170
177
  );
171
178
  if (depsComplete) return step;
172
179
  }
@@ -77,6 +77,7 @@ import {
77
77
  applyMigrationV21StructuredMemories,
78
78
  applyMigrationV22QualityGateRepair,
79
79
  applyMigrationV23MilestoneQueue,
80
+ applyMigrationV26MilestoneCommitAttributions,
80
81
  } from "./db-migration-steps.js";
81
82
  import { isMemoriesFtsAvailableSchema, tryCreateMemoriesFtsSchema } from "./db-memory-fts-schema.js";
82
83
  import { createDbOpenState, type DbOpenPhase } from "./db-open-state.js";
@@ -105,7 +106,7 @@ const providerLoader = createSqliteProviderLoader({
105
106
  writeStderr: (message: string) => process.stderr.write(message),
106
107
  });
107
108
 
108
- export const SCHEMA_VERSION = 25;
109
+ export const SCHEMA_VERSION = 26;
109
110
 
110
111
  function initSchema(db: DbAdapter, fileBacked: boolean): void {
111
112
  if (fileBacked) db.exec("PRAGMA journal_mode=WAL");
@@ -329,6 +330,11 @@ function migrateSchema(db: DbAdapter): void {
329
330
  recordSchemaVersion(db, 25);
330
331
  }
331
332
 
333
+ if (currentVersion < 26) {
334
+ applyMigrationV26MilestoneCommitAttributions(db);
335
+ recordSchemaVersion(db, 26);
336
+ }
337
+
332
338
  db.exec("COMMIT");
333
339
  } catch (err) {
334
340
  db.exec("ROLLBACK");
@@ -1349,6 +1355,45 @@ export function getSliceTasks(milestoneId: string, sliceId: string): TaskRow[] {
1349
1355
  return rows.map(rowToTask);
1350
1356
  }
1351
1357
 
1358
+ export function getCompletedMilestoneTaskFileHints(milestoneId: string): string[] {
1359
+ if (!currentDb) return [];
1360
+ const rows = currentDb.prepare(
1361
+ `SELECT files, key_files
1362
+ FROM tasks
1363
+ WHERE milestone_id = :mid AND status IN ('complete', 'done')`,
1364
+ ).all({ ":mid": milestoneId }) as Array<Record<string, unknown>>;
1365
+
1366
+ const hints = new Set<string>();
1367
+ for (const row of rows) {
1368
+ for (const raw of [row["files"], row["key_files"]]) {
1369
+ for (const file of parseStringArrayColumn(raw)) {
1370
+ const normalized = normalizeRepoPath(file);
1371
+ if (normalized) hints.add(normalized);
1372
+ }
1373
+ }
1374
+ }
1375
+ return [...hints];
1376
+ }
1377
+
1378
+ function parseStringArrayColumn(raw: unknown): string[] {
1379
+ if (Array.isArray(raw)) return raw.filter((entry): entry is string => typeof entry === "string");
1380
+ if (typeof raw !== "string") return [];
1381
+ const trimmed = raw.trim();
1382
+ if (!trimmed) return [];
1383
+ try {
1384
+ const parsed = JSON.parse(trimmed);
1385
+ if (Array.isArray(parsed)) return parsed.filter((entry): entry is string => typeof entry === "string");
1386
+ if (typeof parsed === "string") return [parsed];
1387
+ } catch {
1388
+ return trimmed.split(",");
1389
+ }
1390
+ return [];
1391
+ }
1392
+
1393
+ function normalizeRepoPath(file: string): string {
1394
+ return file.trim().replace(/\\/g, "/").replace(/^\.\/+/, "");
1395
+ }
1396
+
1352
1397
  // ─── ADR-011 Phase 2 escalation helpers ──────────────────────────────────
1353
1398
 
1354
1399
  /** Set pause-on-escalation state on a completed task. Mutually exclusive with awaiting_review. */
@@ -2073,6 +2118,9 @@ export function deleteMilestone(milestoneId: string): void {
2073
2118
  currentDb!.prepare(
2074
2119
  `DELETE FROM artifacts WHERE milestone_id = :mid`,
2075
2120
  ).run({ ":mid": milestoneId });
2121
+ currentDb!.prepare(
2122
+ `DELETE FROM milestone_commit_attributions WHERE milestone_id = :mid`,
2123
+ ).run({ ":mid": milestoneId });
2076
2124
  currentDb!.prepare(
2077
2125
  `DELETE FROM milestone_leases WHERE milestone_id = :mid`,
2078
2126
  ).run({ ":mid": milestoneId });
@@ -2391,6 +2439,75 @@ export function upsertTurnGitTransaction(entry: {
2391
2439
  });
2392
2440
  }
2393
2441
 
2442
+ export function getMilestoneCommitAttributionShas(milestoneId: string): string[] {
2443
+ if (!currentDb) return [];
2444
+ const rows = currentDb.prepare(
2445
+ `SELECT commit_sha
2446
+ FROM milestone_commit_attributions
2447
+ WHERE milestone_id = :mid
2448
+ ORDER BY created_at, commit_sha`,
2449
+ ).all({ ":mid": milestoneId }) as Array<Record<string, unknown>>;
2450
+ return rows
2451
+ .map((row) => typeof row["commit_sha"] === "string" ? row["commit_sha"] : "")
2452
+ .filter(Boolean);
2453
+ }
2454
+
2455
+ export function recordMilestoneCommitAttribution(entry: {
2456
+ commitSha: string;
2457
+ milestoneId: string;
2458
+ sliceId?: string;
2459
+ taskId?: string;
2460
+ source: "recorded" | "backfill";
2461
+ confidence: number;
2462
+ files: string[];
2463
+ createdAt: string;
2464
+ }): void {
2465
+ if (!currentDb) return;
2466
+ transaction(() => {
2467
+ currentDb!.prepare(
2468
+ `INSERT OR REPLACE INTO milestone_commit_attributions (
2469
+ commit_sha, milestone_id, slice_id, task_id, source, confidence, files_json, created_at
2470
+ ) VALUES (
2471
+ :commit_sha, :milestone_id, :slice_id, :task_id, :source, :confidence, :files_json, :created_at
2472
+ )`,
2473
+ ).run({
2474
+ ":commit_sha": entry.commitSha,
2475
+ ":milestone_id": entry.milestoneId,
2476
+ ":slice_id": entry.sliceId ?? null,
2477
+ ":task_id": entry.taskId ?? null,
2478
+ ":source": entry.source,
2479
+ ":confidence": entry.confidence,
2480
+ ":files_json": JSON.stringify(entry.files),
2481
+ ":created_at": entry.createdAt,
2482
+ });
2483
+
2484
+ currentDb!.prepare(
2485
+ `INSERT OR IGNORE INTO audit_events (
2486
+ event_id, trace_id, turn_id, caused_by, category, type, ts, payload_json
2487
+ ) VALUES (
2488
+ :event_id, :trace_id, :turn_id, :caused_by, :category, :type, :ts, :payload_json
2489
+ )`,
2490
+ ).run({
2491
+ ":event_id": `milestone-commit-attribution:${entry.milestoneId}:${entry.commitSha}`,
2492
+ ":trace_id": "milestone-commit-attribution",
2493
+ ":turn_id": null,
2494
+ ":caused_by": null,
2495
+ ":category": "git",
2496
+ ":type": "milestone-commit-attribution-recorded",
2497
+ ":ts": entry.createdAt,
2498
+ ":payload_json": JSON.stringify({
2499
+ commitSha: entry.commitSha,
2500
+ milestoneId: entry.milestoneId,
2501
+ sliceId: entry.sliceId ?? null,
2502
+ taskId: entry.taskId ?? null,
2503
+ source: entry.source,
2504
+ confidence: entry.confidence,
2505
+ files: entry.files,
2506
+ }),
2507
+ });
2508
+ });
2509
+ }
2510
+
2394
2511
  export function insertAuditEvent(entry: {
2395
2512
  eventId: string;
2396
2513
  traceId: string;
@@ -2494,6 +2611,7 @@ export function clearEngineHierarchy(): void {
2494
2611
  currentDb!.exec("DELETE FROM slice_dependencies");
2495
2612
  currentDb!.exec("DELETE FROM assessments");
2496
2613
  currentDb!.exec("DELETE FROM replan_history");
2614
+ currentDb!.exec("DELETE FROM milestone_commit_attributions");
2497
2615
  currentDb!.exec("DELETE FROM tasks");
2498
2616
  currentDb!.exec("DELETE FROM slices");
2499
2617
  currentDb!.exec("DELETE FROM milestone_leases");
@@ -30,7 +30,7 @@ import {
30
30
  formatInterruptedSessionRunningMessage,
31
31
  formatInterruptedSessionSummary,
32
32
  } from "./interrupted-session.js";
33
- import { listUnitRuntimeRecords, clearUnitRuntimeRecord } from "./unit-runtime.js";
33
+ import { listUnitRuntimeRecords, clearUnitRuntimeRecord, isInFlightRuntimePhase } from "./unit-runtime.js";
34
34
  import { resolveExpectedArtifactPath } from "./auto.js";
35
35
  import { gsdHome } from "./gsd-home.js";
36
36
  import {
@@ -118,6 +118,22 @@ export function resolveExpectedArtifactPathForScope(
118
118
  return resolveExpectedArtifactPath(unitType, unitId, scope.workspace.projectRoot);
119
119
  }
120
120
 
121
+ async function runQuickTaskChoice(ctx: ExtensionCommandContext, pi: ExtensionAPI): Promise<void> {
122
+ if (!ctx.hasUI) {
123
+ ctx.ui.notify("Run /gsd quick <task> for small bounded work, or /gsd do <task> for natural-language routing.", "info");
124
+ return;
125
+ }
126
+
127
+ const task = (await ctx.ui.input("Quick task", "Describe the small task to run with /gsd quick"))?.trim();
128
+ if (!task) {
129
+ ctx.ui.notify("Quick task cancelled.", "info");
130
+ return;
131
+ }
132
+
133
+ const { handleQuick } = await import("./quick.js");
134
+ await handleQuick(task, ctx, pi);
135
+ }
136
+
121
137
  /**
122
138
  * Scope-based overload of isGhostMilestone.
123
139
  * Binds basePath and milestoneId from the scope, ensuring path resolution
@@ -1786,8 +1802,8 @@ function selfHealRuntimeRecords(basePath: string, ctx: ExtensionContext): { clea
1786
1802
  cleared++;
1787
1803
  continue;
1788
1804
  }
1789
- // Clear records stuck in dispatched or timeout phase (process died mid-unit)
1790
- if (phase === "dispatched" || phase === "timeout") {
1805
+ // Clear records stuck in an in-flight phase (process died mid-unit).
1806
+ if (isInFlightRuntimePhase(phase)) {
1791
1807
  clearUnitRuntimeRecord(basePath, unitType, unitId);
1792
1808
  cleared++;
1793
1809
  }
@@ -2064,8 +2080,8 @@ export async function showSmartEntry(
2064
2080
  // standard wizard below.
2065
2081
  {
2066
2082
  const prefs = loadEffectiveGSDPreferences(basePath)?.preferences;
2067
- const { hasPendingDeepStage } = await import("./auto-dispatch.js");
2068
- if (hasPendingDeepStage(prefs, basePath)) {
2083
+ const { shouldRunDeepProjectSetup } = await import("./auto-dispatch.js");
2084
+ if (shouldRunDeepProjectSetup(state, prefs, basePath)) {
2069
2085
  await startDeepProjectSetupForeground(ctx, pi, basePath, stepMode);
2070
2086
  return;
2071
2087
  }
@@ -2134,17 +2150,24 @@ export async function showSmartEntry(
2134
2150
  title: "GSD — Get Shit Done",
2135
2151
  summary: ["No active milestone."],
2136
2152
  actions: [
2153
+ {
2154
+ id: "quick_task",
2155
+ label: "Quick task",
2156
+ description: "For small bounded work, run /gsd quick <task> or /gsd do <task>.",
2157
+ recommended: true,
2158
+ },
2137
2159
  {
2138
2160
  id: "new_milestone",
2139
2161
  label: "Create next milestone",
2140
- description: "Define what to build next.",
2141
- recommended: true,
2162
+ description: "Define a larger body of work with planning artifacts.",
2142
2163
  },
2143
2164
  ],
2144
2165
  notYetMessage: "Run /gsd when ready.",
2145
2166
  });
2146
2167
 
2147
- if (choice === "new_milestone") {
2168
+ if (choice === "quick_task") {
2169
+ await runQuickTaskChoice(ctx, pi);
2170
+ } else if (choice === "new_milestone") {
2148
2171
  setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId: nextId, step: stepMode });
2149
2172
  await dispatchWorkflow(pi, await prepareAndBuildDiscussPrompt(ctx, pi, nextId,
2150
2173
  `New milestone ${nextId}.`,
@@ -2181,11 +2204,16 @@ export async function showSmartEntry(
2181
2204
  title: `GSD — ${milestoneId}: ${milestoneTitle}`,
2182
2205
  summary: ["All milestones complete."],
2183
2206
  actions: [
2207
+ {
2208
+ id: "quick_task",
2209
+ label: "Quick task",
2210
+ description: "Do a small bounded task without opening a milestone.",
2211
+ recommended: true,
2212
+ },
2184
2213
  {
2185
2214
  id: "new_milestone",
2186
2215
  label: "Start new milestone",
2187
2216
  description: "Define and plan the next milestone.",
2188
- recommended: true,
2189
2217
  },
2190
2218
  {
2191
2219
  id: "status",
@@ -2196,7 +2224,9 @@ export async function showSmartEntry(
2196
2224
  notYetMessage: "Run /gsd when ready.",
2197
2225
  });
2198
2226
 
2199
- if (choice === "new_milestone") {
2227
+ if (choice === "quick_task") {
2228
+ await runQuickTaskChoice(ctx, pi);
2229
+ } else if (choice === "new_milestone") {
2200
2230
  const milestoneIds = findMilestoneIds(basePath);
2201
2231
  const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
2202
2232
  const nextId = nextMilestoneIdReserved(milestoneIds, uniqueMilestoneIds, basePath);
@@ -2300,13 +2330,18 @@ export async function showSmartEntry(
2300
2330
  const hasContext = !!(contextFile && await loadFile(contextFile));
2301
2331
 
2302
2332
  const actions = [
2333
+ {
2334
+ id: "quick_task",
2335
+ label: "Quick task instead",
2336
+ description: "Use this when the work is small and should not become a milestone.",
2337
+ recommended: true,
2338
+ },
2303
2339
  {
2304
2340
  id: "plan",
2305
2341
  label: "Create roadmap",
2306
2342
  description: hasContext
2307
2343
  ? "Context captured. Decompose into slices with a boundary map."
2308
2344
  : "Decompose the milestone into slices with a boundary map.",
2309
- recommended: true,
2310
2345
  },
2311
2346
  ...(!hasContext ? [{
2312
2347
  id: "discuss",
@@ -2332,7 +2367,9 @@ export async function showSmartEntry(
2332
2367
  notYetMessage: "Run /gsd when ready.",
2333
2368
  });
2334
2369
 
2335
- if (choice === "plan") {
2370
+ if (choice === "quick_task") {
2371
+ await runQuickTaskChoice(ctx, pi);
2372
+ } else if (choice === "plan") {
2336
2373
  setPendingAutoStart(basePath, { ctx, pi, basePath, milestoneId, step: stepMode });
2337
2374
  await dispatchWorkflow(
2338
2375
  pi,
@@ -0,0 +1,35 @@
1
+ import { isAbsolute, relative, resolve } from "node:path";
2
+ import { normalizePlannedFileReference } from "./files.js";
3
+
4
+ export interface PlanningPathScopeField {
5
+ field: string;
6
+ values: string[];
7
+ }
8
+
9
+ function isInsideBase(basePath: string, candidate: string): boolean {
10
+ const base = resolve(basePath);
11
+ const abs = resolve(candidate);
12
+ const rel = relative(base, abs);
13
+ return rel === "" || (!!rel && !rel.startsWith("..") && !isAbsolute(rel));
14
+ }
15
+
16
+ /**
17
+ * Planning IO fields are execution contracts. Absolute paths are only safe when
18
+ * they stay inside the active working directory; in worktree mode, an absolute
19
+ * path to the original checkout makes executors edit the wrong tree.
20
+ */
21
+ export function validatePlanningPathScope(
22
+ basePath: string,
23
+ fields: PlanningPathScopeField[],
24
+ ): string | null {
25
+ for (const { field, values } of fields) {
26
+ for (const raw of values) {
27
+ const candidate = normalizePlannedFileReference(raw);
28
+ if (!isAbsolute(candidate)) continue;
29
+ if (isInsideBase(basePath, candidate)) continue;
30
+ return `${field} contains absolute path outside working directory: ${candidate}. Use a path relative to ${basePath}.`;
31
+ }
32
+ }
33
+
34
+ return null;
35
+ }
@@ -11,6 +11,7 @@ export interface PrEvidenceInput {
11
11
  changeType?: PrChangeType;
12
12
  linkedIssue?: string;
13
13
  summaries?: string[];
14
+ blockers?: string[];
14
15
  roadmapItems?: string[];
15
16
  metrics?: string[];
16
17
  testsRun?: string[];
@@ -34,8 +35,54 @@ const CHANGE_TYPE_LABELS: Record<PrChangeType, string> = {
34
35
  chore: "Build, CI, or tooling changes",
35
36
  };
36
37
 
38
+ // Per-item cap for user-supplied content. 2 KB gives slice titles plus
39
+ // descriptions room while still bounding malicious DoS-via-PR-body input.
40
+ const USER_CONTENT_CAP_BYTES = 2048;
41
+ const TRUNCATION_SUFFIX = " … [truncated]";
42
+
43
+ // Strips HTML comments, fake commit trailers (Co-Authored-By, Signed-off-by —
44
+ // case-insensitive on the trailer name), and caps total length. Designed to
45
+ // be a no-op for well-formed input; golden fixtures must remain byte-stable.
46
+ // Trailer lines are removed (not rejected) so that a single bad line in an
47
+ // otherwise legitimate description does not block the entire PR.
48
+ function sanitizeUserContent(s: string): string {
49
+ if (!s) return s;
50
+ // Strip HTML comments greedily across newlines.
51
+ let out = s.replace(/<!--[\s\S]*?-->/g, "");
52
+ // Drop lines that look like commit trailers we do not want forged.
53
+ out = out
54
+ .split("\n")
55
+ .filter((line) => !/^\s*(co-authored-by|signed-off-by)\s*:/i.test(line))
56
+ .join("\n");
57
+ if (Buffer.byteLength(out, "utf8") > USER_CONTENT_CAP_BYTES) {
58
+ const budget = USER_CONTENT_CAP_BYTES - Buffer.byteLength(TRUNCATION_SUFFIX, "utf8");
59
+ // Truncate by code units to stay safely under the byte budget for ASCII;
60
+ // for multibyte content we conservatively walk back until under budget.
61
+ let sliced = out.slice(0, Math.max(0, budget));
62
+ while (Buffer.byteLength(sliced, "utf8") > budget && sliced.length > 0) {
63
+ sliced = sliced.slice(0, -1);
64
+ }
65
+ out = sliced + TRUNCATION_SUFFIX;
66
+ }
67
+ return out;
68
+ }
69
+
70
+ // Strips HTML comments and fake trailers without applying the length cap.
71
+ // Used for short fields like linkedIssue where truncation would be confusing.
72
+ function sanitizeIssueRef(s: string): string {
73
+ if (!s) return s;
74
+ let out = s.replace(/<!--[\s\S]*?-->/g, "");
75
+ out = out
76
+ .split("\n")
77
+ .filter((line) => !/^\s*(co-authored-by|signed-off-by)\s*:/i.test(line))
78
+ .join("\n");
79
+ return out;
80
+ }
81
+
37
82
  function normalizeList(values: readonly string[] | undefined): string[] {
38
- return (values ?? []).map((value) => value.trim()).filter(Boolean);
83
+ return (values ?? [])
84
+ .map((value) => sanitizeUserContent(value).trim())
85
+ .filter(Boolean);
39
86
  }
40
87
 
41
88
  function changeTypeChecklist(selected: PrChangeType): string[] {
@@ -56,13 +103,17 @@ export function buildPrEvidence(input: PrEvidenceInput): PrEvidence {
56
103
  const subjectTitle = input.milestoneTitle?.trim() || subjectId;
57
104
  const changeType = input.changeType ?? "feat";
58
105
  const summaries = normalizeList(input.summaries);
106
+ const blockers = normalizeList(input.blockers);
59
107
  const roadmapItems = normalizeList(input.roadmapItems);
60
108
  const metrics = normalizeList(input.metrics);
61
109
  const testsRun = normalizeList(input.testsRun);
62
110
  const rollbackNotes = normalizeList(input.rollbackNotes);
63
- const linkedIssue = input.linkedIssue?.trim() || "Not specified. Add an issue link before marking this PR ready if CONTRIBUTING.md requires one.";
64
- const why = input.why?.trim() || `${capitalize(subjectKind)} work is complete and ready for review.`;
65
- const how = input.how?.trim() || "Generated from GSD evidence and local workflow artifacts.";
111
+ // linkedIssue is sanitized but not length-capped: legitimate issue refs
112
+ // are short by nature, and truncating "Closes #123" would be unhelpful.
113
+ const linkedIssueRaw = input.linkedIssue ? sanitizeIssueRef(input.linkedIssue).trim() : "";
114
+ const linkedIssue = linkedIssueRaw || "Not specified. Add an issue link before marking this PR ready if CONTRIBUTING.md requires one.";
115
+ const why = (input.why ? sanitizeUserContent(input.why).trim() : "") || `${capitalize(subjectKind)} work is complete and ready for review.`;
116
+ const how = (input.how ? sanitizeUserContent(input.how).trim() : "") || "Generated from GSD evidence and local workflow artifacts.";
66
117
  const title = `${changeType}: ${subjectTitle}`;
67
118
 
68
119
  const sections: string[] = [
@@ -75,6 +126,13 @@ export function buildPrEvidence(input: PrEvidenceInput): PrEvidence {
75
126
  "## What",
76
127
  "",
77
128
  summaries.length > 0 ? summaries.join("\n\n") : `${capitalize(subjectKind)} ${subjectId} completed.`,
129
+ ];
130
+
131
+ if (blockers.length > 0) {
132
+ sections.push("", "## Blockers", "", blockers.map((blocker) => `- ${blocker}`).join("\n"));
133
+ }
134
+
135
+ sections.push(
78
136
  "",
79
137
  "## Why",
80
138
  "",
@@ -87,7 +145,7 @@ export function buildPrEvidence(input: PrEvidenceInput): PrEvidence {
87
145
  "## Linked Issue",
88
146
  "",
89
147
  linkedIssue,
90
- ];
148
+ );
91
149
 
92
150
  if (roadmapItems.length > 0) {
93
151
  sections.push("", "## Roadmap", "", roadmapItems.join("\n"));