gsd-pi 2.42.0 → 2.43.0-dev.5717b75

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 (291) hide show
  1. package/README.md +23 -0
  2. package/dist/cli.js +18 -3
  3. package/dist/loader.js +3 -1
  4. package/dist/resource-loader.js +39 -6
  5. package/dist/resources/extensions/async-jobs/async-bash-tool.js +52 -4
  6. package/dist/resources/extensions/async-jobs/await-tool.js +5 -0
  7. package/dist/resources/extensions/async-jobs/index.js +2 -0
  8. package/dist/resources/extensions/gsd/auto/phases.js +1 -3
  9. package/dist/resources/extensions/gsd/auto-prompts.js +3 -16
  10. package/dist/resources/extensions/gsd/auto-start.js +8 -11
  11. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +11 -5
  12. package/dist/resources/extensions/gsd/detection.js +19 -0
  13. package/dist/resources/extensions/gsd/doctor-checks.js +31 -1
  14. package/dist/resources/extensions/gsd/doctor-providers.js +10 -0
  15. package/dist/resources/extensions/gsd/forensics.js +84 -0
  16. package/dist/resources/extensions/gsd/git-constants.js +1 -0
  17. package/dist/resources/extensions/gsd/git-service.js +1 -1
  18. package/dist/resources/extensions/gsd/native-git-bridge.js +1 -0
  19. package/dist/resources/extensions/gsd/preferences-types.js +1 -0
  20. package/dist/resources/extensions/gsd/preferences.js +59 -8
  21. package/dist/resources/extensions/gsd/prompts/forensics.md +12 -5
  22. package/dist/resources/extensions/gsd/repo-identity.js +46 -5
  23. package/dist/resources/extensions/gsd/service-tier.js +13 -4
  24. package/dist/resources/extensions/gsd/session-lock.js +2 -2
  25. package/dist/resources/extensions/gsd/worktree-resolver.js +2 -2
  26. package/dist/resources/extensions/gsd/worktree.js +2 -2
  27. package/dist/resources/extensions/mcp-client/index.js +2 -1
  28. package/dist/resources/extensions/search-the-web/tool-search.js +3 -3
  29. package/dist/web/standalone/.next/BUILD_ID +1 -1
  30. package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
  31. package/dist/web/standalone/.next/build-manifest.json +3 -3
  32. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  33. package/dist/web/standalone/.next/required-server-files.json +3 -3
  34. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  35. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  36. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  37. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  38. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  45. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  46. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  47. package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
  48. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  49. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  51. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  52. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  53. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  54. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  55. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  56. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  57. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  58. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  59. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  60. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  61. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  62. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  63. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  64. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  65. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  66. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  67. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  68. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  69. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  70. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  71. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  72. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  73. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  74. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  75. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  76. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  77. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  78. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  79. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  80. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  81. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  82. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  83. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  84. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  85. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  86. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  87. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  88. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  89. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  90. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  91. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  92. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  93. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  94. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  95. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  96. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  97. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  98. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +5 -5
  99. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  100. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  101. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  102. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  103. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  104. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  105. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  106. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  107. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  108. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  109. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  110. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  111. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  112. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  113. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  114. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  115. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  116. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
  117. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  118. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  119. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  120. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  121. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  122. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
  123. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  124. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  125. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  126. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  127. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  128. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  129. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  130. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  131. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  132. package/dist/web/standalone/.next/server/app/index.html +1 -1
  133. package/dist/web/standalone/.next/server/app/index.rsc +4 -4
  134. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  135. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
  136. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  137. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
  138. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  139. package/dist/web/standalone/.next/server/app/page.js +2 -2
  140. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  141. package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
  142. package/dist/web/standalone/.next/server/chunks/229.js +2 -2
  143. package/dist/web/standalone/.next/server/chunks/471.js +3 -3
  144. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  145. package/dist/web/standalone/.next/server/middleware.js +2 -2
  146. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  147. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  148. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  149. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  150. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  151. package/dist/web/standalone/.next/static/chunks/app/_not-found/page-f2a7482d42a5614b.js +1 -0
  152. package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +1 -0
  153. package/dist/web/standalone/.next/static/chunks/app/page-b9367c5ae13b99c6.js +1 -0
  154. package/dist/web/standalone/.next/static/chunks/{main-app-2f2ee7b85712c2bd.js → main-app-fdab67f7802d7832.js} +1 -1
  155. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
  156. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  157. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  158. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  159. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
  160. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
  161. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
  162. package/dist/web/standalone/server.js +1 -1
  163. package/dist/web-mode.d.ts +2 -0
  164. package/dist/web-mode.js +40 -4
  165. package/package.json +1 -1
  166. package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
  167. package/packages/pi-agent-core/dist/agent.js +2 -0
  168. package/packages/pi-agent-core/dist/agent.js.map +1 -1
  169. package/packages/pi-agent-core/dist/types.d.ts +6 -0
  170. package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
  171. package/packages/pi-agent-core/dist/types.js.map +1 -1
  172. package/packages/pi-agent-core/src/agent.test.ts +53 -0
  173. package/packages/pi-agent-core/src/agent.ts +3 -0
  174. package/packages/pi-agent-core/src/types.ts +6 -0
  175. package/packages/pi-agent-core/tsconfig.json +1 -1
  176. package/packages/pi-ai/dist/models.d.ts +5 -3
  177. package/packages/pi-ai/dist/models.d.ts.map +1 -1
  178. package/packages/pi-ai/dist/models.generated.d.ts +801 -1468
  179. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  180. package/packages/pi-ai/dist/models.generated.js +1135 -1588
  181. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  182. package/packages/pi-ai/dist/models.js.map +1 -1
  183. package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  184. package/packages/pi-ai/dist/utils/oauth/github-copilot.js +60 -2
  185. package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  186. package/packages/pi-ai/scripts/generate-models.ts +1543 -0
  187. package/packages/pi-ai/src/models.generated.ts +1140 -1593
  188. package/packages/pi-ai/src/models.ts +7 -4
  189. package/packages/pi-ai/src/utils/oauth/github-copilot.ts +74 -2
  190. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  191. package/packages/pi-coding-agent/dist/core/agent-session.js +8 -1
  192. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  193. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +7 -0
  194. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  195. package/packages/pi-coding-agent/dist/core/auth-storage.js +29 -2
  196. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  197. package/packages/pi-coding-agent/dist/core/auth-storage.test.js +60 -0
  198. package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
  199. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  200. package/packages/pi-coding-agent/dist/core/extensions/loader.js +18 -0
  201. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  202. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
  203. package/packages/pi-coding-agent/dist/core/lsp/client.js +23 -0
  204. package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
  205. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  206. package/packages/pi-coding-agent/dist/core/model-registry.js +2 -0
  207. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  208. package/packages/pi-coding-agent/dist/core/package-manager.d.ts +6 -0
  209. package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  210. package/packages/pi-coding-agent/dist/core/package-manager.js +63 -11
  211. package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  212. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +9 -0
  213. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  214. package/packages/pi-coding-agent/dist/core/resource-loader.js +20 -6
  215. package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  216. package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
  217. package/packages/pi-coding-agent/dist/core/system-prompt.js +6 -5
  218. package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
  219. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  220. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +3 -0
  221. package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -1
  222. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  223. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +9 -6
  224. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  225. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  226. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +30 -10
  227. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  228. package/packages/pi-coding-agent/package.json +1 -1
  229. package/packages/pi-coding-agent/src/core/agent-session.ts +7 -1
  230. package/packages/pi-coding-agent/src/core/auth-storage.test.ts +68 -0
  231. package/packages/pi-coding-agent/src/core/auth-storage.ts +30 -2
  232. package/packages/pi-coding-agent/src/core/extensions/loader.ts +18 -0
  233. package/packages/pi-coding-agent/src/core/lsp/client.ts +29 -0
  234. package/packages/pi-coding-agent/src/core/model-registry.ts +3 -0
  235. package/packages/pi-coding-agent/src/core/package-manager.ts +99 -58
  236. package/packages/pi-coding-agent/src/core/resource-loader.ts +24 -6
  237. package/packages/pi-coding-agent/src/core/system-prompt.ts +6 -5
  238. package/packages/pi-coding-agent/src/modes/interactive/components/extension-editor.ts +3 -0
  239. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +10 -6
  240. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +31 -11
  241. package/pkg/package.json +1 -1
  242. package/src/resources/extensions/async-jobs/async-bash-timeout.test.ts +122 -0
  243. package/src/resources/extensions/async-jobs/async-bash-tool.ts +40 -4
  244. package/src/resources/extensions/async-jobs/await-tool.test.ts +47 -0
  245. package/src/resources/extensions/async-jobs/await-tool.ts +5 -0
  246. package/src/resources/extensions/async-jobs/index.ts +1 -0
  247. package/src/resources/extensions/async-jobs/job-manager.ts +2 -0
  248. package/src/resources/extensions/gsd/auto/loop-deps.ts +0 -1
  249. package/src/resources/extensions/gsd/auto/phases.ts +1 -3
  250. package/src/resources/extensions/gsd/auto-prompts.ts +2 -18
  251. package/src/resources/extensions/gsd/auto-start.ts +7 -10
  252. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +13 -5
  253. package/src/resources/extensions/gsd/detection.ts +19 -0
  254. package/src/resources/extensions/gsd/doctor-checks.ts +32 -1
  255. package/src/resources/extensions/gsd/doctor-providers.ts +13 -0
  256. package/src/resources/extensions/gsd/doctor-types.ts +1 -0
  257. package/src/resources/extensions/gsd/forensics.ts +92 -0
  258. package/src/resources/extensions/gsd/git-constants.ts +1 -0
  259. package/src/resources/extensions/gsd/git-service.ts +0 -1
  260. package/src/resources/extensions/gsd/gitignore.ts +1 -1
  261. package/src/resources/extensions/gsd/native-git-bridge.ts +1 -0
  262. package/src/resources/extensions/gsd/preferences-types.ts +3 -0
  263. package/src/resources/extensions/gsd/preferences.ts +62 -6
  264. package/src/resources/extensions/gsd/prompts/forensics.md +12 -5
  265. package/src/resources/extensions/gsd/repo-identity.ts +48 -5
  266. package/src/resources/extensions/gsd/service-tier.ts +17 -4
  267. package/src/resources/extensions/gsd/session-lock.ts +2 -2
  268. package/src/resources/extensions/gsd/tests/activity-log.test.ts +31 -69
  269. package/src/resources/extensions/gsd/tests/forensics-dedup.test.ts +48 -0
  270. package/src/resources/extensions/gsd/tests/forensics-issue-routing.test.ts +43 -0
  271. package/src/resources/extensions/gsd/tests/git-locale.test.ts +133 -0
  272. package/src/resources/extensions/gsd/tests/git-service.test.ts +44 -0
  273. package/src/resources/extensions/gsd/tests/journal.test.ts +82 -127
  274. package/src/resources/extensions/gsd/tests/manifest-status.test.ts +73 -82
  275. package/src/resources/extensions/gsd/tests/service-tier.test.ts +30 -1
  276. package/src/resources/extensions/gsd/tests/skill-activation.test.ts +56 -3
  277. package/src/resources/extensions/gsd/tests/symlink-numbered-variants.test.ts +151 -0
  278. package/src/resources/extensions/gsd/tests/verification-gate.test.ts +156 -263
  279. package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +35 -78
  280. package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +81 -74
  281. package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +1 -2
  282. package/src/resources/extensions/gsd/worktree-resolver.ts +2 -3
  283. package/src/resources/extensions/gsd/worktree.ts +2 -2
  284. package/src/resources/extensions/mcp-client/index.ts +5 -1
  285. package/src/resources/extensions/search-the-web/tool-search.ts +3 -3
  286. package/dist/web/standalone/.next/static/chunks/app/_not-found/page-e07acdb7dd069836.js +0 -1
  287. package/dist/web/standalone/.next/static/chunks/app/layout-745c6ed5fea5fb06.js +0 -1
  288. package/dist/web/standalone/.next/static/chunks/app/page-801b53eff6e83579.js +0 -1
  289. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-e6255954dccfcf0a.js +0 -1
  290. /package/dist/web/standalone/.next/static/{QSuuaY2tP8h_zzhHcVxNj → 5ULZcR9XhHFzlAZFiSKRl}/_buildManifest.js +0 -0
  291. /package/dist/web/standalone/.next/static/{QSuuaY2tP8h_zzhHcVxNj → 5ULZcR9XhHFzlAZFiSKRl}/_ssgManifest.js +0 -0
@@ -0,0 +1,48 @@
1
+ import { describe, it } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { readFileSync } from "node:fs";
4
+ import { join, dirname } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const gsdDir = join(__dirname, "..");
9
+
10
+ describe("forensics dedup (#2096)", () => {
11
+ it("forensics_dedup is in KNOWN_PREFERENCE_KEYS", () => {
12
+ const source = readFileSync(join(gsdDir, "preferences-types.ts"), "utf-8");
13
+ assert.ok(source.includes('"forensics_dedup"'),
14
+ "KNOWN_PREFERENCE_KEYS must contain forensics_dedup");
15
+ assert.ok(source.includes("forensics_dedup?: boolean"),
16
+ "GSDPreferences must declare forensics_dedup as optional boolean");
17
+ });
18
+
19
+ it("forensics prompt contains {{dedupSection}} placeholder", () => {
20
+ const prompt = readFileSync(join(gsdDir, "prompts", "forensics.md"), "utf-8");
21
+ assert.ok(prompt.includes("{{dedupSection}}"),
22
+ "forensics.md must contain {{dedupSection}} placeholder");
23
+ });
24
+
25
+ it("DEDUP_PROMPT_SECTION contains required search commands", async () => {
26
+ const source = readFileSync(join(gsdDir, "forensics.ts"), "utf-8");
27
+ assert.ok(source.includes("DEDUP_PROMPT_SECTION"), "forensics.ts must define DEDUP_PROMPT_SECTION");
28
+ assert.ok(source.includes("gh issue list --repo gsd-build/gsd-2 --state closed"));
29
+ assert.ok(source.includes("gh pr list --repo gsd-build/gsd-2 --state open"));
30
+ assert.ok(source.includes("gh pr list --repo gsd-build/gsd-2 --state merged"));
31
+ });
32
+
33
+ it("handleForensics checks forensics_dedup preference", () => {
34
+ const source = readFileSync(join(gsdDir, "forensics.ts"), "utf-8");
35
+ assert.ok(source.includes("forensics_dedup"),
36
+ "handleForensics must reference forensics_dedup preference");
37
+ assert.ok(source.includes("dedupSection"),
38
+ "handleForensics must pass dedupSection to loadPrompt");
39
+ });
40
+
41
+ it("first-time opt-in shows when preference is undefined", () => {
42
+ const source = readFileSync(join(gsdDir, "forensics.ts"), "utf-8");
43
+ assert.ok(source.includes("=== undefined"),
44
+ "first-time detection must check for undefined (not false)");
45
+ assert.ok(source.includes("Duplicate detection available") || source.includes("duplicate detection"),
46
+ "opt-in notice must mention duplicate detection");
47
+ });
48
+ });
@@ -0,0 +1,43 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { readFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+
6
+ const promptsDir = join(process.cwd(), "src/resources/extensions/gsd/prompts");
7
+
8
+ function readPrompt(name: string): string {
9
+ return readFileSync(join(promptsDir, `${name}.md`), "utf-8");
10
+ }
11
+
12
+ test("forensics prompt explicitly forbids github_issues tool for issue creation", () => {
13
+ const prompt = readPrompt("forensics");
14
+
15
+ // Must contain an explicit prohibition against using the github_issues tool
16
+ assert.match(
17
+ prompt,
18
+ /Do NOT use the `?github_issues`? tool/i,
19
+ "Prompt must explicitly prohibit the github_issues tool",
20
+ );
21
+ });
22
+
23
+ test("forensics prompt requires gh CLI with --repo gsd-build/gsd-2 for issue creation", () => {
24
+ const prompt = readPrompt("forensics");
25
+
26
+ // Must contain the exact gh CLI command with the correct repo flag
27
+ assert.match(
28
+ prompt,
29
+ /gh issue create --repo gsd-build\/gsd-2/,
30
+ "Prompt must specify gh issue create --repo gsd-build/gsd-2",
31
+ );
32
+ });
33
+
34
+ test("forensics prompt routes issue creation through bash tool, not github_issues", () => {
35
+ const prompt = readPrompt("forensics");
36
+
37
+ // The constraint about using bash tool must be present
38
+ assert.match(
39
+ prompt,
40
+ /`?bash`? tool/i,
41
+ "Prompt must instruct use of the bash tool for issue creation",
42
+ );
43
+ });
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Regression tests for #1997: git locale not forced to C.
3
+ *
4
+ * Validates that GIT_NO_PROMPT_ENV includes LC_ALL=C so git always produces
5
+ * English output, and that nativeMergeSquash passes the env to execFileSync.
6
+ */
7
+
8
+ import { mkdtempSync, mkdirSync, writeFileSync, rmSync, readFileSync } from "node:fs";
9
+ import { join } from "node:path";
10
+ import { tmpdir } from "node:os";
11
+ import { execFileSync } from "node:child_process";
12
+
13
+ import { GIT_NO_PROMPT_ENV } from "../git-constants.ts";
14
+ import { nativeAddAllWithExclusions } from "../native-git-bridge.ts";
15
+ import { RUNTIME_EXCLUSION_PATHS } from "../git-service.ts";
16
+ import { createTestContext } from "./test-helpers.ts";
17
+
18
+ const { assertEq, assertTrue, report } = createTestContext();
19
+
20
+ function git(cwd: string, ...args: string[]): string {
21
+ return execFileSync("git", args, { cwd, stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }).trim();
22
+ }
23
+
24
+ function initTempRepo(): string {
25
+ const dir = mkdtempSync(join(tmpdir(), "gsd-locale-"));
26
+ git(dir, "init");
27
+ git(dir, "config", "user.email", "test@test.com");
28
+ git(dir, "config", "user.name", "Test");
29
+ // Initial commit so HEAD exists
30
+ writeFileSync(join(dir, "init.txt"), "init");
31
+ git(dir, "add", "-A");
32
+ git(dir, "commit", "-m", "init");
33
+ return dir;
34
+ }
35
+
36
+ function createFile(base: string, relPath: string, content: string): void {
37
+ const full = join(base, relPath);
38
+ mkdirSync(join(full, ".."), { recursive: true });
39
+ writeFileSync(full, content);
40
+ }
41
+
42
+ async function main(): Promise<void> {
43
+ // ─── GIT_NO_PROMPT_ENV includes LC_ALL=C ─────────────────────────────
44
+
45
+ console.log("\n=== GIT_NO_PROMPT_ENV includes LC_ALL=C ===");
46
+
47
+ assertEq(
48
+ GIT_NO_PROMPT_ENV.LC_ALL,
49
+ "C",
50
+ "GIT_NO_PROMPT_ENV must set LC_ALL to 'C' to force English git output"
51
+ );
52
+
53
+ assertTrue(
54
+ "GIT_TERMINAL_PROMPT" in GIT_NO_PROMPT_ENV,
55
+ "GIT_NO_PROMPT_ENV still contains GIT_TERMINAL_PROMPT"
56
+ );
57
+
58
+ // ─── nativeAddAllWithExclusions: non-English locale does not throw ───
59
+
60
+ console.log("\n=== nativeAddAllWithExclusions: non-English locale does not throw ===");
61
+
62
+ {
63
+ // Simulate what happens on a German system: .gsd is gitignored,
64
+ // exclusion pathspecs trigger an advisory warning exit code 1.
65
+ // With LC_ALL=C the English stderr guard should match and suppress.
66
+ const repo = initTempRepo();
67
+
68
+ writeFileSync(join(repo, ".gitignore"), ".gsd\n");
69
+ createFile(repo, ".gsd/STATE.md", "# State");
70
+ createFile(repo, "src/app.ts", "export const x = 1;");
71
+
72
+ // Save original LC_ALL / LANG and force German locale env
73
+ const origLcAll = process.env.LC_ALL;
74
+ const origLang = process.env.LANG;
75
+ process.env.LANG = "de_DE.UTF-8";
76
+ delete process.env.LC_ALL;
77
+
78
+ let threw = false;
79
+ try {
80
+ nativeAddAllWithExclusions(repo, RUNTIME_EXCLUSION_PATHS);
81
+ } catch (e) {
82
+ threw = true;
83
+ console.error(" unexpected error:", e);
84
+ }
85
+
86
+ // Restore
87
+ if (origLcAll !== undefined) process.env.LC_ALL = origLcAll;
88
+ else delete process.env.LC_ALL;
89
+ if (origLang !== undefined) process.env.LANG = origLang;
90
+ else delete process.env.LANG;
91
+
92
+ assertTrue(
93
+ !threw,
94
+ "nativeAddAllWithExclusions must not throw on non-English locale when .gsd is gitignored (#1997)"
95
+ );
96
+
97
+ const staged = git(repo, "diff", "--cached", "--name-only");
98
+ assertTrue(staged.includes("src/app.ts"), "real file staged despite German locale");
99
+
100
+ rmSync(repo, { recursive: true, force: true });
101
+ }
102
+
103
+ // ─── nativeMergeSquash: env is passed (merge-squash stderr is English) ─
104
+
105
+ console.log("\n=== nativeMergeSquash fallback uses GIT_NO_PROMPT_ENV ===");
106
+
107
+ {
108
+ // We verify indirectly: the source code must pass env: GIT_NO_PROMPT_ENV.
109
+ // Read the source and check for the pattern. This is a static check.
110
+ const src = readFileSync(
111
+ join(import.meta.dirname, "..", "native-git-bridge.ts"),
112
+ "utf-8"
113
+ );
114
+
115
+ // Find the nativeMergeSquash function and check it uses GIT_NO_PROMPT_ENV
116
+ const fnStart = src.indexOf("export function nativeMergeSquash");
117
+ assertTrue(fnStart !== -1, "nativeMergeSquash function exists in source");
118
+
119
+ const fnBody = src.slice(fnStart, src.indexOf("\nexport function", fnStart + 1));
120
+ const hasEnv = fnBody.includes("env: GIT_NO_PROMPT_ENV");
121
+ assertTrue(
122
+ hasEnv,
123
+ "nativeMergeSquash fallback must pass env: GIT_NO_PROMPT_ENV to execFileSync (#1997)"
124
+ );
125
+ }
126
+
127
+ report();
128
+ }
129
+
130
+ main().catch((error) => {
131
+ console.error(error);
132
+ process.exit(1);
133
+ });
@@ -1411,6 +1411,50 @@ async function main(): Promise<void> {
1411
1411
  rmSync(repo, { recursive: true, force: true });
1412
1412
  }
1413
1413
 
1414
+ // ─── autoCommit: symlinked .gsd does NOT stage milestone artifacts (#2247) ──
1415
+
1416
+ console.log("\n=== autoCommit: symlinked .gsd does NOT stage milestone artifacts (#2247) ===");
1417
+
1418
+ {
1419
+ // When .gsd is a symlink (external state project), .gsd/ files live outside
1420
+ // the repo by design. smartStage() must NOT force-stage them into git — the
1421
+ // .gitignore exclusion is correct and intentional.
1422
+ const repo = initTempRepo();
1423
+
1424
+ // Create an external .gsd directory and symlink it into the repo
1425
+ const externalGsd = mkdtempSync(join(tmpdir(), "gsd-external-symlink-"));
1426
+ mkdirSync(join(externalGsd, "milestones", "M009"), { recursive: true });
1427
+ mkdirSync(join(externalGsd, "activity"), { recursive: true });
1428
+ mkdirSync(join(externalGsd, "runtime"), { recursive: true });
1429
+
1430
+ symlinkSync(externalGsd, join(repo, ".gsd"));
1431
+
1432
+ // .gitignore blocks .gsd (as ensureGitignore would do for symlink projects)
1433
+ writeFileSync(join(repo, ".gitignore"), ".gsd\n");
1434
+ run('git add .gitignore', repo);
1435
+ run('git commit -m "add gitignore"', repo);
1436
+
1437
+ // Simulate new milestone artifacts created during execution
1438
+ writeFileSync(join(externalGsd, "milestones", "M009", "M009-SUMMARY.md"), "# M009 Summary");
1439
+ writeFileSync(join(externalGsd, "milestones", "M009", "S01-SUMMARY.md"), "# S01 Summary");
1440
+ writeFileSync(join(externalGsd, "milestones", "M009", "T01-VERIFY.json"), '{"passed":true}');
1441
+
1442
+ // Also create a normal source file change
1443
+ createFile(repo, "src/feature.ts", "export const feature = true;");
1444
+
1445
+ const svc = new GitServiceImpl(repo);
1446
+ const msg = svc.autoCommit("complete-milestone", "M009");
1447
+ assertTrue(msg !== null, "symlink autoCommit: commit succeeds");
1448
+
1449
+ const committed = run("git show --name-only HEAD", repo);
1450
+ assertTrue(committed.includes("src/feature.ts"), "symlink autoCommit: source file committed");
1451
+ assertTrue(!committed.includes(".gsd/milestones/"),
1452
+ "symlink autoCommit: .gsd/milestones/ files are NOT staged (external state stays external)");
1453
+
1454
+ try { rmSync(repo, { recursive: true, force: true }); } catch {}
1455
+ try { rmSync(externalGsd, { recursive: true, force: true }); } catch {}
1456
+ }
1457
+
1414
1458
  report();
1415
1459
  }
1416
1460
 
@@ -1,4 +1,4 @@
1
- import test from "node:test";
1
+ import { describe, test, beforeEach, afterEach } from "node:test";
2
2
  import assert from "node:assert/strict";
3
3
  import {
4
4
  mkdirSync,
@@ -46,9 +46,12 @@ function makeEntry(overrides: Partial<JournalEntry> = {}): JournalEntry {
46
46
 
47
47
  // ─── emitJournalEvent ─────────────────────────────────────────────────────────
48
48
 
49
- test("emitJournalEvent creates journal directory and JSONL file", () => {
50
- const base = makeTmpBase();
51
- try {
49
+ describe("emitJournalEvent", () => {
50
+ let base: string;
51
+ beforeEach(() => { base = makeTmpBase(); });
52
+ afterEach(() => { cleanup(base); });
53
+
54
+ test("creates journal directory and JSONL file", () => {
52
55
  const entry = makeEntry();
53
56
  emitJournalEvent(base, entry);
54
57
 
@@ -61,14 +64,9 @@ test("emitJournalEvent creates journal directory and JSONL file", () => {
61
64
  assert.equal(parsed.flowId, entry.flowId);
62
65
  assert.equal(parsed.seq, entry.seq);
63
66
  assert.equal(parsed.eventType, entry.eventType);
64
- } finally {
65
- cleanup(base);
66
- }
67
- });
67
+ });
68
68
 
69
- test("emitJournalEvent appends multiple lines to the same file", () => {
70
- const base = makeTmpBase();
71
- try {
69
+ test("appends multiple lines to the same file", () => {
72
70
  emitJournalEvent(base, makeEntry({ seq: 0 }));
73
71
  emitJournalEvent(base, makeEntry({ seq: 1, eventType: "dispatch-match" }));
74
72
  emitJournalEvent(base, makeEntry({ seq: 2, eventType: "unit-start" }));
@@ -82,26 +80,9 @@ test("emitJournalEvent appends multiple lines to the same file", () => {
82
80
  assert.equal(parsed[1].seq, 1);
83
81
  assert.equal(parsed[2].seq, 2);
84
82
  assert.equal(parsed[1].eventType, "dispatch-match");
85
- } finally {
86
- cleanup(base);
87
- }
88
- });
89
-
90
- test("emitJournalEvent auto-creates nonexistent parent directory", () => {
91
- const base = join(tmpdir(), `gsd-journal-test-${randomUUID()}`);
92
- // Don't create .gsd/ — emitJournalEvent should handle it via mkdirSync recursive
93
- try {
94
- emitJournalEvent(base, makeEntry());
95
- const filePath = join(base, ".gsd", "journal", "2025-03-21.jsonl");
96
- assert.ok(existsSync(filePath), "File should exist even when parent dirs did not");
97
- } finally {
98
- cleanup(base);
99
- }
100
- });
83
+ });
101
84
 
102
- test("emitJournalEvent preserves optional fields (rule, causedBy, data)", () => {
103
- const base = makeTmpBase();
104
- try {
85
+ test("preserves optional fields (rule, causedBy, data)", () => {
105
86
  const entry = makeEntry({
106
87
  rule: "my-dispatch-rule",
107
88
  causedBy: { flowId: "flow-prior", seq: 3 },
@@ -115,24 +96,12 @@ test("emitJournalEvent preserves optional fields (rule, causedBy, data)", () =>
115
96
  assert.deepEqual(parsed.causedBy, { flowId: "flow-prior", seq: 3 });
116
97
  assert.equal(parsed.data.unitId, "M001/S01/T01");
117
98
  assert.equal(parsed.data.status, "ok");
118
- } finally {
119
- cleanup(base);
120
- }
121
- });
122
-
123
- test("emitJournalEvent silently catches write errors (no throw)", () => {
124
- // Use a path that can't be created — null bytes in path
125
- assert.doesNotThrow(() => {
126
- emitJournalEvent("/dev/null/impossible\0path", makeEntry());
127
99
  });
128
- });
129
100
 
130
- test("emitJournalEvent silently catches read-only directory errors", () => {
131
- const base = makeTmpBase();
132
- const journalDir = join(base, ".gsd", "journal");
133
- mkdirSync(journalDir, { recursive: true });
101
+ test("silently catches read-only directory errors", () => {
102
+ const journalDir = join(base, ".gsd", "journal");
103
+ mkdirSync(journalDir, { recursive: true });
134
104
 
135
- try {
136
105
  // Make the journal directory read-only
137
106
  chmodSync(journalDir, 0o444);
138
107
 
@@ -140,22 +109,46 @@ test("emitJournalEvent silently catches read-only directory errors", () => {
140
109
  assert.doesNotThrow(() => {
141
110
  emitJournalEvent(base, makeEntry());
142
111
  });
143
- } finally {
112
+
144
113
  // Restore permissions for cleanup
145
114
  try {
146
115
  chmodSync(journalDir, 0o755);
147
116
  } catch {
148
117
  /* */
149
118
  }
150
- cleanup(base);
151
- }
119
+ });
120
+ });
121
+
122
+ describe("emitJournalEvent — auto-creates parent directory", () => {
123
+ let base: string;
124
+ beforeEach(() => {
125
+ base = join(tmpdir(), `gsd-journal-test-${randomUUID()}`);
126
+ // Don't create .gsd/ — emitJournalEvent should handle it via mkdirSync recursive
127
+ });
128
+ afterEach(() => { cleanup(base); });
129
+
130
+ test("auto-creates nonexistent parent directory", () => {
131
+ emitJournalEvent(base, makeEntry());
132
+ const filePath = join(base, ".gsd", "journal", "2025-03-21.jsonl");
133
+ assert.ok(existsSync(filePath), "File should exist even when parent dirs did not");
134
+ });
135
+ });
136
+
137
+ test("emitJournalEvent silently catches write errors (no throw)", () => {
138
+ // Use a path that can't be created — null bytes in path
139
+ assert.doesNotThrow(() => {
140
+ emitJournalEvent("/dev/null/impossible\0path", makeEntry());
141
+ });
152
142
  });
153
143
 
154
144
  // ─── Daily Rotation ───────────────────────────────────────────────────────────
155
145
 
156
- test("daily rotation: events with different dates go to different files", () => {
157
- const base = makeTmpBase();
158
- try {
146
+ describe("daily rotation", () => {
147
+ let base: string;
148
+ beforeEach(() => { base = makeTmpBase(); });
149
+ afterEach(() => { cleanup(base); });
150
+
151
+ test("events with different dates go to different files", () => {
159
152
  emitJournalEvent(base, makeEntry({ ts: "2025-03-20T23:59:59.000Z" }));
160
153
  emitJournalEvent(base, makeEntry({ ts: "2025-03-21T00:00:01.000Z" }));
161
154
  emitJournalEvent(base, makeEntry({ ts: "2025-03-22T12:00:00.000Z" }));
@@ -172,16 +165,17 @@ test("daily rotation: events with different dates go to different files", () =>
172
165
  .split("\n");
173
166
  assert.equal(lines.length, 1, `${date}.jsonl should have 1 line`);
174
167
  }
175
- } finally {
176
- cleanup(base);
177
- }
168
+ });
178
169
  });
179
170
 
180
171
  // ─── queryJournal ─────────────────────────────────────────────────────────────
181
172
 
182
- test("queryJournal returns all entries when no filters provided", () => {
183
- const base = makeTmpBase();
184
- try {
173
+ describe("queryJournal", () => {
174
+ let base: string;
175
+ beforeEach(() => { base = makeTmpBase(); });
176
+ afterEach(() => { cleanup(base); });
177
+
178
+ test("returns all entries when no filters provided", () => {
185
179
  emitJournalEvent(base, makeEntry({ seq: 0 }));
186
180
  emitJournalEvent(base, makeEntry({ seq: 1, eventType: "dispatch-match" }));
187
181
 
@@ -189,14 +183,9 @@ test("queryJournal returns all entries when no filters provided", () => {
189
183
  assert.equal(results.length, 2);
190
184
  assert.equal(results[0].seq, 0);
191
185
  assert.equal(results[1].seq, 1);
192
- } finally {
193
- cleanup(base);
194
- }
195
- });
186
+ });
196
187
 
197
- test("queryJournal filters by flowId", () => {
198
- const base = makeTmpBase();
199
- try {
188
+ test("filters by flowId", () => {
200
189
  emitJournalEvent(base, makeEntry({ flowId: "flow-aaa", seq: 0 }));
201
190
  emitJournalEvent(base, makeEntry({ flowId: "flow-bbb", seq: 1 }));
202
191
  emitJournalEvent(base, makeEntry({ flowId: "flow-aaa", seq: 2 }));
@@ -204,14 +193,9 @@ test("queryJournal filters by flowId", () => {
204
193
  const results = queryJournal(base, { flowId: "flow-aaa" });
205
194
  assert.equal(results.length, 2);
206
195
  assert.ok(results.every(e => e.flowId === "flow-aaa"));
207
- } finally {
208
- cleanup(base);
209
- }
210
- });
196
+ });
211
197
 
212
- test("queryJournal filters by eventType", () => {
213
- const base = makeTmpBase();
214
- try {
198
+ test("filters by eventType", () => {
215
199
  emitJournalEvent(base, makeEntry({ eventType: "iteration-start", seq: 0 }));
216
200
  emitJournalEvent(base, makeEntry({ eventType: "dispatch-match", seq: 1 }));
217
201
  emitJournalEvent(base, makeEntry({ eventType: "unit-start", seq: 2 }));
@@ -220,14 +204,9 @@ test("queryJournal filters by eventType", () => {
220
204
  const results = queryJournal(base, { eventType: "dispatch-match" });
221
205
  assert.equal(results.length, 2);
222
206
  assert.ok(results.every(e => e.eventType === "dispatch-match"));
223
- } finally {
224
- cleanup(base);
225
- }
226
- });
207
+ });
227
208
 
228
- test("queryJournal filters by unitId (from data.unitId)", () => {
229
- const base = makeTmpBase();
230
- try {
209
+ test("filters by unitId (from data.unitId)", () => {
231
210
  emitJournalEvent(
232
211
  base,
233
212
  makeEntry({ seq: 0, data: { unitId: "M001/S01/T01" } }),
@@ -249,14 +228,9 @@ test("queryJournal filters by unitId (from data.unitId)", () => {
249
228
  e => (e.data as Record<string, unknown>)?.unitId === "M001/S01/T01",
250
229
  ),
251
230
  );
252
- } finally {
253
- cleanup(base);
254
- }
255
- });
231
+ });
256
232
 
257
- test("queryJournal filters by time range (after/before)", () => {
258
- const base = makeTmpBase();
259
- try {
233
+ test("filters by time range (after/before)", () => {
260
234
  emitJournalEvent(base, makeEntry({ ts: "2025-03-20T08:00:00.000Z", seq: 0 }));
261
235
  emitJournalEvent(base, makeEntry({ ts: "2025-03-21T10:00:00.000Z", seq: 1 }));
262
236
  emitJournalEvent(base, makeEntry({ ts: "2025-03-21T15:00:00.000Z", seq: 2 }));
@@ -276,14 +250,9 @@ test("queryJournal filters by time range (after/before)", () => {
276
250
  before: "2025-03-21T23:59:59.000Z",
277
251
  });
278
252
  assert.equal(rangeResults.length, 2, "2 entries within 2025-03-21");
279
- } finally {
280
- cleanup(base);
281
- }
282
- });
253
+ });
283
254
 
284
- test("queryJournal combines multiple filters", () => {
285
- const base = makeTmpBase();
286
- try {
255
+ test("combines multiple filters", () => {
287
256
  emitJournalEvent(
288
257
  base,
289
258
  makeEntry({ flowId: "flow-aaa", eventType: "unit-start", seq: 0 }),
@@ -304,25 +273,9 @@ test("queryJournal combines multiple filters", () => {
304
273
  assert.equal(results.length, 1);
305
274
  assert.equal(results[0].flowId, "flow-aaa");
306
275
  assert.equal(results[0].eventType, "unit-start");
307
- } finally {
308
- cleanup(base);
309
- }
310
- });
311
-
312
- test("queryJournal on nonexistent directory returns empty array", () => {
313
- const base = join(tmpdir(), `gsd-journal-test-${randomUUID()}`);
314
- // Don't create anything
315
- try {
316
- const results = queryJournal(base);
317
- assert.deepEqual(results, []);
318
- } finally {
319
- cleanup(base);
320
- }
321
- });
276
+ });
322
277
 
323
- test("queryJournal skips malformed JSON lines gracefully", () => {
324
- const base = makeTmpBase();
325
- try {
278
+ test("skips malformed JSON lines gracefully", () => {
326
279
  const journalDir = join(base, ".gsd", "journal");
327
280
  mkdirSync(journalDir, { recursive: true });
328
281
 
@@ -335,14 +288,9 @@ test("queryJournal skips malformed JSON lines gracefully", () => {
335
288
  assert.equal(results.length, 2, "Should skip the malformed line");
336
289
  assert.equal(results[0].seq, 0);
337
290
  assert.equal(results[1].seq, 1);
338
- } finally {
339
- cleanup(base);
340
- }
341
- });
291
+ });
342
292
 
343
- test("queryJournal reads across multiple daily files", () => {
344
- const base = makeTmpBase();
345
- try {
293
+ test("reads across multiple daily files", () => {
346
294
  emitJournalEvent(base, makeEntry({ ts: "2025-03-20T12:00:00.000Z", seq: 0 }));
347
295
  emitJournalEvent(base, makeEntry({ ts: "2025-03-21T12:00:00.000Z", seq: 1 }));
348
296
  emitJournalEvent(base, makeEntry({ ts: "2025-03-22T12:00:00.000Z", seq: 2 }));
@@ -353,14 +301,9 @@ test("queryJournal reads across multiple daily files", () => {
353
301
  assert.equal(results[0].ts, "2025-03-20T12:00:00.000Z");
354
302
  assert.equal(results[1].ts, "2025-03-21T12:00:00.000Z");
355
303
  assert.equal(results[2].ts, "2025-03-22T12:00:00.000Z");
356
- } finally {
357
- cleanup(base);
358
- }
359
- });
304
+ });
360
305
 
361
- test("queryJournal filters by rule", () => {
362
- const base = makeTmpBase();
363
- try {
306
+ test("filters by rule", () => {
364
307
  emitJournalEvent(
365
308
  base,
366
309
  makeEntry({ seq: 0, eventType: "dispatch-match", rule: "dispatch-task" }),
@@ -380,7 +323,19 @@ test("queryJournal filters by rule", () => {
380
323
  results.every(e => e.rule === "dispatch-task"),
381
324
  "All results should have rule === 'dispatch-task'",
382
325
  );
383
- } finally {
384
- cleanup(base);
385
- }
326
+ });
327
+ });
328
+
329
+ describe("queryJournal — nonexistent directory", () => {
330
+ let base: string;
331
+ beforeEach(() => {
332
+ base = join(tmpdir(), `gsd-journal-test-${randomUUID()}`);
333
+ // Don't create anything
334
+ });
335
+ afterEach(() => { cleanup(base); });
336
+
337
+ test("on nonexistent directory returns empty array", () => {
338
+ const results = queryJournal(base);
339
+ assert.deepEqual(results, []);
340
+ });
386
341
  });