gsd-pi 2.20.0 → 2.22.0

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 (279) hide show
  1. package/README.md +12 -0
  2. package/dist/cli.js +21 -18
  3. package/dist/help-text.d.ts +2 -0
  4. package/dist/help-text.js +47 -0
  5. package/dist/loader.js +2 -16
  6. package/dist/mcp-server.d.ts +18 -0
  7. package/dist/mcp-server.js +53 -0
  8. package/dist/onboarding.d.ts +0 -6
  9. package/dist/onboarding.js +0 -28
  10. package/dist/resources/agents/javascript-pro.md +280 -0
  11. package/dist/resources/agents/typescript-pro.md +255 -0
  12. package/dist/resources/extensions/bg-shell/index.ts +14 -2
  13. package/dist/resources/extensions/bg-shell/utilities.ts +14 -0
  14. package/dist/resources/extensions/browser-tools/{core.js → core.ts} +329 -190
  15. package/dist/resources/extensions/gsd/auto-dashboard.ts +2 -1
  16. package/dist/resources/extensions/gsd/auto-prompts.ts +42 -1
  17. package/dist/resources/extensions/gsd/auto-worktree.ts +35 -2
  18. package/dist/resources/extensions/gsd/auto.ts +116 -10
  19. package/dist/resources/extensions/gsd/claude-import.ts +656 -0
  20. package/dist/resources/extensions/gsd/collision-diagnostics.ts +332 -0
  21. package/dist/resources/extensions/gsd/commands.ts +60 -7
  22. package/dist/resources/extensions/gsd/diff-context.ts +220 -0
  23. package/dist/resources/extensions/gsd/docs/claude-marketplace-import.md +214 -0
  24. package/dist/resources/extensions/gsd/docs/preferences-reference.md +2 -1
  25. package/dist/resources/extensions/gsd/doctor.ts +12 -4
  26. package/dist/resources/extensions/gsd/file-watcher.ts +97 -0
  27. package/dist/resources/extensions/gsd/files.ts +1 -1
  28. package/dist/resources/extensions/gsd/forensics.ts +596 -0
  29. package/dist/resources/extensions/gsd/git-service.ts +2 -1
  30. package/dist/resources/extensions/gsd/github-client.ts +235 -0
  31. package/dist/resources/extensions/gsd/gitignore.ts +1 -0
  32. package/dist/resources/extensions/gsd/marketplace-discovery.ts +507 -0
  33. package/dist/resources/extensions/gsd/mcp-server.ts +87 -0
  34. package/dist/resources/extensions/gsd/namespaced-registry.ts +467 -0
  35. package/dist/resources/extensions/gsd/namespaced-resolver.ts +307 -0
  36. package/dist/resources/extensions/gsd/plugin-importer.ts +410 -0
  37. package/dist/resources/extensions/gsd/preferences.ts +14 -3
  38. package/dist/resources/extensions/gsd/prompts/execute-task.md +1 -1
  39. package/dist/resources/extensions/gsd/prompts/forensics.md +71 -0
  40. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  41. package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
  42. package/dist/resources/extensions/gsd/prompts/system.md +12 -3
  43. package/dist/resources/extensions/gsd/roadmap-slices.ts +1 -1
  44. package/dist/resources/extensions/gsd/session-forensics.ts +5 -5
  45. package/dist/resources/extensions/gsd/tests/claude-import-tui.test.ts +351 -0
  46. package/dist/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
  47. package/dist/resources/extensions/gsd/tests/context-compression.test.ts +13 -0
  48. package/dist/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
  49. package/dist/resources/extensions/gsd/tests/doctor-git.test.ts +118 -0
  50. package/dist/resources/extensions/gsd/tests/marketplace-discovery.test.ts +202 -0
  51. package/dist/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
  52. package/dist/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
  53. package/dist/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
  54. package/dist/resources/extensions/gsd/tests/none-mode-gates.test.ts +105 -0
  55. package/dist/resources/extensions/gsd/tests/plugin-importer-live.test.ts +481 -0
  56. package/dist/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
  57. package/dist/resources/extensions/gsd/tests/preferences-git.test.ts +21 -2
  58. package/dist/resources/extensions/gsd/tests/preferences-schema-validation.test.ts +8 -1
  59. package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +11 -0
  60. package/dist/resources/extensions/gsd/tests/worktree-bugfix.test.ts +120 -0
  61. package/dist/resources/extensions/gsd/token-counter.ts +45 -0
  62. package/dist/resources/extensions/gsd/visualizer-data.ts +2 -2
  63. package/dist/resources/extensions/gsd/worktree-manager.ts +29 -1
  64. package/dist/resources/extensions/gsd/worktree.ts +3 -0
  65. package/dist/resources/extensions/mcporter/index.ts +90 -7
  66. package/dist/resources/extensions/search-the-web/native-search.ts +2 -0
  67. package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +9 -1
  68. package/dist/resources/extensions/search-the-web/url-utils.ts +35 -1
  69. package/dist/resources/extensions/shared/terminal.ts +1 -1
  70. package/dist/resources/extensions/universal-config/discovery.ts +4 -0
  71. package/dist/resources/extensions/universal-config/format.ts +35 -4
  72. package/dist/resources/extensions/universal-config/index.ts +5 -3
  73. package/dist/resources/extensions/universal-config/scanners.ts +65 -2
  74. package/dist/resources/extensions/universal-config/tests/discovery.test.ts +9 -1
  75. package/dist/resources/extensions/universal-config/tests/format.test.ts +22 -6
  76. package/dist/resources/extensions/universal-config/tests/scanners.test.ts +18 -0
  77. package/dist/resources/extensions/universal-config/types.ts +20 -1
  78. package/dist/resources/skills/lint/SKILL.md +141 -0
  79. package/dist/resources/skills/review/SKILL.md +214 -0
  80. package/dist/resources/skills/test/SKILL.md +201 -0
  81. package/dist/tool-bootstrap.js +2 -1
  82. package/dist/wizard.js +2 -0
  83. package/package.json +12 -7
  84. package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  85. package/packages/pi-ai/dist/providers/azure-openai-responses.js +12 -1
  86. package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  87. package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  88. package/packages/pi-ai/dist/providers/openai-responses.js +12 -1
  89. package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
  90. package/packages/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  91. package/packages/pi-ai/node_modules/@smithy/node-http-handler/README.md +9 -0
  92. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +762 -0
  93. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
  94. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  95. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
  96. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  97. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +230 -0
  98. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
  99. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
  100. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +169 -0
  101. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
  102. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
  103. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  104. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  105. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  106. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  107. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
  108. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
  109. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
  110. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  111. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
  112. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +10 -0
  113. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
  114. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
  115. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
  116. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
  117. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
  118. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
  119. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
  120. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
  121. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
  122. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
  123. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
  124. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
  125. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
  126. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
  127. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
  128. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
  129. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
  130. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +10 -0
  131. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
  132. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
  133. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
  134. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
  135. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
  136. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
  137. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
  138. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
  139. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
  140. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
  141. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
  142. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
  143. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
  144. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
  145. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
  146. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
  147. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
  148. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +12 -0
  149. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +12 -0
  150. package/packages/pi-ai/node_modules/@smithy/node-http-handler/package.json +68 -0
  151. package/packages/pi-ai/package.json +3 -0
  152. package/packages/pi-ai/pnpm-lock.yaml +2022 -0
  153. package/packages/pi-ai/src/providers/azure-openai-responses.ts +12 -1
  154. package/packages/pi-ai/src/providers/openai-responses.ts +12 -1
  155. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  156. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  157. package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
  158. package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  159. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +1 -0
  160. package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  161. package/packages/pi-coding-agent/dist/core/extensions/loader.js +12 -1
  162. package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  163. package/packages/pi-coding-agent/dist/core/extensions/loader.test.d.ts +2 -0
  164. package/packages/pi-coding-agent/dist/core/extensions/loader.test.d.ts.map +1 -0
  165. package/packages/pi-coding-agent/dist/core/extensions/loader.test.js +113 -0
  166. package/packages/pi-coding-agent/dist/core/extensions/loader.test.js.map +1 -0
  167. package/packages/pi-coding-agent/dist/core/extensions/project-trust.d.ts +4 -0
  168. package/packages/pi-coding-agent/dist/core/extensions/project-trust.d.ts.map +1 -0
  169. package/packages/pi-coding-agent/dist/core/extensions/project-trust.js +42 -0
  170. package/packages/pi-coding-agent/dist/core/extensions/project-trust.js.map +1 -0
  171. package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts +1 -0
  172. package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -1
  173. package/packages/pi-coding-agent/dist/core/resolve-config-value.js +18 -0
  174. package/packages/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -1
  175. package/packages/pi-coding-agent/dist/core/resolve-config-value.test.d.ts +2 -0
  176. package/packages/pi-coding-agent/dist/core/resolve-config-value.test.d.ts.map +1 -0
  177. package/packages/pi-coding-agent/dist/core/resolve-config-value.test.js +114 -0
  178. package/packages/pi-coding-agent/dist/core/resolve-config-value.test.js.map +1 -0
  179. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  180. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +8 -2
  181. package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
  182. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts +2 -0
  183. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
  184. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +23 -9
  185. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
  186. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.d.ts +2 -0
  187. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.d.ts.map +1 -0
  188. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.js +67 -0
  189. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.js.map +1 -0
  190. package/packages/pi-coding-agent/package.json +1 -1
  191. package/packages/pi-coding-agent/pnpm-lock.yaml +454 -0
  192. package/packages/pi-coding-agent/scripts/copy-assets.cjs +24 -0
  193. package/packages/pi-coding-agent/src/core/extensions/index.ts +3 -0
  194. package/packages/pi-coding-agent/src/core/extensions/loader.test.ts +141 -0
  195. package/packages/pi-coding-agent/src/core/extensions/loader.ts +14 -1
  196. package/packages/pi-coding-agent/src/core/extensions/project-trust.ts +51 -0
  197. package/packages/pi-coding-agent/src/core/resolve-config-value.test.ts +132 -0
  198. package/packages/pi-coding-agent/src/core/resolve-config-value.ts +20 -0
  199. package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +7 -2
  200. package/packages/pi-coding-agent/src/resources/extensions/memory/storage.test.ts +98 -0
  201. package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +24 -9
  202. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  203. package/packages/pi-tui/dist/tui.js +2 -2
  204. package/packages/pi-tui/dist/tui.js.map +1 -1
  205. package/packages/pi-tui/package.json +3 -1
  206. package/packages/pi-tui/src/tui.ts +2 -2
  207. package/src/resources/agents/javascript-pro.md +280 -0
  208. package/src/resources/agents/typescript-pro.md +255 -0
  209. package/src/resources/extensions/bg-shell/index.ts +14 -2
  210. package/src/resources/extensions/bg-shell/utilities.ts +14 -0
  211. package/src/resources/extensions/browser-tools/{core.js → core.ts} +329 -190
  212. package/src/resources/extensions/gsd/auto-dashboard.ts +2 -1
  213. package/src/resources/extensions/gsd/auto-prompts.ts +42 -1
  214. package/src/resources/extensions/gsd/auto-worktree.ts +35 -2
  215. package/src/resources/extensions/gsd/auto.ts +116 -10
  216. package/src/resources/extensions/gsd/claude-import.ts +656 -0
  217. package/src/resources/extensions/gsd/collision-diagnostics.ts +332 -0
  218. package/src/resources/extensions/gsd/commands.ts +60 -7
  219. package/src/resources/extensions/gsd/diff-context.ts +220 -0
  220. package/src/resources/extensions/gsd/docs/claude-marketplace-import.md +214 -0
  221. package/src/resources/extensions/gsd/docs/preferences-reference.md +2 -1
  222. package/src/resources/extensions/gsd/doctor.ts +12 -4
  223. package/src/resources/extensions/gsd/file-watcher.ts +97 -0
  224. package/src/resources/extensions/gsd/files.ts +1 -1
  225. package/src/resources/extensions/gsd/forensics.ts +596 -0
  226. package/src/resources/extensions/gsd/git-service.ts +2 -1
  227. package/src/resources/extensions/gsd/github-client.ts +235 -0
  228. package/src/resources/extensions/gsd/gitignore.ts +1 -0
  229. package/src/resources/extensions/gsd/marketplace-discovery.ts +507 -0
  230. package/src/resources/extensions/gsd/mcp-server.ts +87 -0
  231. package/src/resources/extensions/gsd/namespaced-registry.ts +467 -0
  232. package/src/resources/extensions/gsd/namespaced-resolver.ts +307 -0
  233. package/src/resources/extensions/gsd/plugin-importer.ts +410 -0
  234. package/src/resources/extensions/gsd/preferences.ts +14 -3
  235. package/src/resources/extensions/gsd/prompts/execute-task.md +1 -1
  236. package/src/resources/extensions/gsd/prompts/forensics.md +71 -0
  237. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  238. package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
  239. package/src/resources/extensions/gsd/prompts/system.md +12 -3
  240. package/src/resources/extensions/gsd/roadmap-slices.ts +1 -1
  241. package/src/resources/extensions/gsd/session-forensics.ts +5 -5
  242. package/src/resources/extensions/gsd/tests/claude-import-tui.test.ts +351 -0
  243. package/src/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
  244. package/src/resources/extensions/gsd/tests/context-compression.test.ts +13 -0
  245. package/src/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
  246. package/src/resources/extensions/gsd/tests/doctor-git.test.ts +118 -0
  247. package/src/resources/extensions/gsd/tests/marketplace-discovery.test.ts +202 -0
  248. package/src/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
  249. package/src/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
  250. package/src/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
  251. package/src/resources/extensions/gsd/tests/none-mode-gates.test.ts +105 -0
  252. package/src/resources/extensions/gsd/tests/plugin-importer-live.test.ts +481 -0
  253. package/src/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
  254. package/src/resources/extensions/gsd/tests/preferences-git.test.ts +21 -2
  255. package/src/resources/extensions/gsd/tests/preferences-schema-validation.test.ts +8 -1
  256. package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +11 -0
  257. package/src/resources/extensions/gsd/tests/worktree-bugfix.test.ts +120 -0
  258. package/src/resources/extensions/gsd/token-counter.ts +45 -0
  259. package/src/resources/extensions/gsd/visualizer-data.ts +2 -2
  260. package/src/resources/extensions/gsd/worktree-manager.ts +29 -1
  261. package/src/resources/extensions/gsd/worktree.ts +3 -0
  262. package/src/resources/extensions/mcporter/index.ts +90 -7
  263. package/src/resources/extensions/search-the-web/native-search.ts +2 -0
  264. package/src/resources/extensions/search-the-web/tool-fetch-page.ts +9 -1
  265. package/src/resources/extensions/search-the-web/url-utils.ts +35 -1
  266. package/src/resources/extensions/shared/terminal.ts +1 -1
  267. package/src/resources/extensions/universal-config/discovery.ts +4 -0
  268. package/src/resources/extensions/universal-config/format.ts +35 -4
  269. package/src/resources/extensions/universal-config/index.ts +5 -3
  270. package/src/resources/extensions/universal-config/scanners.ts +65 -2
  271. package/src/resources/extensions/universal-config/tests/discovery.test.ts +9 -1
  272. package/src/resources/extensions/universal-config/tests/format.test.ts +22 -6
  273. package/src/resources/extensions/universal-config/tests/scanners.test.ts +18 -0
  274. package/src/resources/extensions/universal-config/types.ts +20 -1
  275. package/src/resources/skills/lint/SKILL.md +141 -0
  276. package/src/resources/skills/review/SKILL.md +214 -0
  277. package/src/resources/skills/test/SKILL.md +201 -0
  278. package/dist/resources/extensions/browser-tools/core.d.ts +0 -205
  279. package/src/resources/extensions/browser-tools/core.d.ts +0 -205
package/README.md CHANGED
@@ -242,6 +242,8 @@ On first run, GSD launches a branded setup wizard that walks you through LLM pro
242
242
  | `/gsd migrate` | Migrate a v1 `.planning` directory to `.gsd` format |
243
243
  | `/gsd help` | Categorized command reference for all GSD subcommands |
244
244
  | `/gsd mode` | Switch workflow mode (solo/team) with coordinated defaults |
245
+ | `/gsd forensics` | Post-mortem investigation of auto-mode failures |
246
+ | `/gsd cleanup` | Archive phase directories from completed milestones |
245
247
  | `/gsd doctor` | Runtime health checks with auto-fix for common issues |
246
248
  | `/worktree` (`/wt`) | Git worktree lifecycle — create, switch, merge, remove |
247
249
  | `/voice` | Toggle real-time speech-to-text (macOS, Linux) |
@@ -355,7 +357,17 @@ unique_milestone_ids: true
355
357
  | `uat_dispatch` | Enable automatic UAT runs after slice completion |
356
358
  | `always_use_skills` | Skills to always load when relevant |
357
359
  | `skill_rules` | Situational rules for skill routing |
360
+ | `skill_staleness_days` | Skills unused for N days get deprioritized (default: 60, 0 = disabled) |
358
361
  | `unique_milestone_ids` | Uses unique milestone names to avoid clashes when working in teams of people |
362
+ | `git.isolation` | `worktree` (default) or `none` — disable worktree isolation for projects that don't need it |
363
+
364
+ ### Agent Instructions
365
+
366
+ Create an `agent-instructions.md` file in your project root to inject persistent per-project behavioral guidance into every agent session. This file is loaded automatically and provides project-specific context the LLM should always have — coding standards, architectural decisions, domain terminology, or workflow preferences.
367
+
368
+ ### Debug Mode
369
+
370
+ Start GSD with `gsd --debug` to enable structured JSONL diagnostic logging. Debug logs capture dispatch decisions, state transitions, and timing data for troubleshooting auto-mode issues.
359
371
 
360
372
  ### Token Optimization (v2.17)
361
373
 
package/dist/cli.js CHANGED
@@ -9,6 +9,7 @@ import { getPiDefaultModelAndProvider, migratePiCredentials } from './pi-migrati
9
9
  import { shouldRunOnboarding, runOnboarding } from './onboarding.js';
10
10
  import chalk from 'chalk';
11
11
  import { checkForUpdates } from './update-check.js';
12
+ import { printHelp, printSubcommandHelp } from './help-text.js';
12
13
  function exitIfManagedResourcesAreNewer(currentAgentDir) {
13
14
  const currentVersion = process.env.GSD_VERSION || '0.0.0';
14
15
  const managedVersion = getNewerManagedResourceVersion(currentAgentDir, currentVersion);
@@ -27,7 +28,7 @@ function parseCliArgs(argv) {
27
28
  const arg = args[i];
28
29
  if (arg === '--mode' && i + 1 < args.length) {
29
30
  const m = args[++i];
30
- if (m === 'text' || m === 'json' || m === 'rpc')
31
+ if (m === 'text' || m === 'json' || m === 'rpc' || m === 'mcp')
31
32
  flags.mode = m;
32
33
  }
33
34
  else if (arg === '--print' || arg === '-p') {
@@ -59,22 +60,7 @@ function parseCliArgs(argv) {
59
60
  process.exit(0);
60
61
  }
61
62
  else if (arg === '--help' || arg === '-h') {
62
- process.stdout.write(`GSD v${process.env.GSD_VERSION || '0.0.0'} — Get Shit Done\n\n`);
63
- process.stdout.write('Usage: gsd [options] [message...]\n\n');
64
- process.stdout.write('Options:\n');
65
- process.stdout.write(' --mode <text|json|rpc> Output mode (default: interactive)\n');
66
- process.stdout.write(' --print, -p Single-shot print mode\n');
67
- process.stdout.write(' --continue, -c Resume the most recent session\n');
68
- process.stdout.write(' --model <id> Override model (e.g. claude-opus-4-6)\n');
69
- process.stdout.write(' --no-session Disable session persistence\n');
70
- process.stdout.write(' --extension <path> Load additional extension\n');
71
- process.stdout.write(' --tools <a,b,c> Restrict available tools\n');
72
- process.stdout.write(' --list-models [search] List available models and exit\n');
73
- process.stdout.write(' --version, -v Print version and exit\n');
74
- process.stdout.write(' --help, -h Print this help and exit\n');
75
- process.stdout.write('\nSubcommands:\n');
76
- process.stdout.write(' config Re-run the setup wizard\n');
77
- process.stdout.write(' update Update GSD to the latest version\n');
63
+ printHelp(process.env.GSD_VERSION || '0.0.0');
78
64
  process.exit(0);
79
65
  }
80
66
  else if (!arg.startsWith('--') && !arg.startsWith('-')) {
@@ -85,6 +71,13 @@ function parseCliArgs(argv) {
85
71
  }
86
72
  const cliFlags = parseCliArgs(process.argv);
87
73
  const isPrintMode = cliFlags.print || cliFlags.mode !== undefined;
74
+ // `gsd <subcommand> --help` — show subcommand-specific help
75
+ const subcommand = cliFlags.messages[0];
76
+ if (subcommand && process.argv.includes('--help')) {
77
+ if (printSubcommandHelp(subcommand, process.env.GSD_VERSION || '0.0.0')) {
78
+ process.exit(0);
79
+ }
80
+ }
88
81
  // `gsd config` — replay the setup wizard and exit
89
82
  if (cliFlags.messages[0] === 'config') {
90
83
  const authStorage = AuthStorage.create(authFilePath);
@@ -259,8 +252,17 @@ if (isPrintMode) {
259
252
  await runRpcMode(session);
260
253
  process.exit(0);
261
254
  }
255
+ if (mode === 'mcp') {
256
+ const { startMcpServer } = await import('./mcp-server.js');
257
+ await startMcpServer({
258
+ tools: session.agent.state.tools ?? [],
259
+ version: process.env.GSD_VERSION || '0.0.0',
260
+ });
261
+ // MCP server runs until the transport closes; keep alive
262
+ await new Promise(() => { });
263
+ }
262
264
  await runPrintMode(session, {
263
- mode,
265
+ mode: mode,
264
266
  messages: cliFlags.messages,
265
267
  });
266
268
  process.exit(0);
@@ -361,6 +363,7 @@ if (!process.stdin.isTTY) {
361
363
  process.stderr.write('[gsd] Non-interactive alternatives:\n');
362
364
  process.stderr.write('[gsd] gsd --print "your message" Single-shot prompt\n');
363
365
  process.stderr.write('[gsd] gsd --mode rpc JSON-RPC over stdin/stdout\n');
366
+ process.stderr.write('[gsd] gsd --mode mcp MCP server over stdin/stdout\n');
364
367
  process.stderr.write('[gsd] gsd --mode text "message" Text output mode\n');
365
368
  process.exit(1);
366
369
  }
@@ -0,0 +1,2 @@
1
+ export declare function printHelp(version: string): void;
2
+ export declare function printSubcommandHelp(subcommand: string, version: string): boolean;
@@ -0,0 +1,47 @@
1
+ const SUBCOMMAND_HELP = {
2
+ config: [
3
+ 'Usage: gsd config',
4
+ '',
5
+ 'Re-run the interactive setup wizard to configure:',
6
+ ' - LLM provider (Anthropic, OpenAI, Google, etc.)',
7
+ ' - Web search provider (Brave, Tavily, built-in)',
8
+ ' - Remote questions (Discord, Slack, Telegram)',
9
+ ' - Tool API keys (Context7, Jina, Groq)',
10
+ '',
11
+ 'All steps are skippable and can be changed later with /login or /search-provider.',
12
+ ].join('\n'),
13
+ update: [
14
+ 'Usage: gsd update',
15
+ '',
16
+ 'Update GSD to the latest version.',
17
+ '',
18
+ 'Equivalent to: npm install -g gsd-pi@latest',
19
+ ].join('\n'),
20
+ };
21
+ export function printHelp(version) {
22
+ process.stdout.write(`GSD v${version} — Get Shit Done\n\n`);
23
+ process.stdout.write('Usage: gsd [options] [message...]\n\n');
24
+ process.stdout.write('Options:\n');
25
+ process.stdout.write(' --mode <text|json|rpc|mcp> Output mode (default: interactive)\n');
26
+ process.stdout.write(' --print, -p Single-shot print mode\n');
27
+ process.stdout.write(' --continue, -c Resume the most recent session\n');
28
+ process.stdout.write(' --model <id> Override model (e.g. claude-opus-4-6)\n');
29
+ process.stdout.write(' --no-session Disable session persistence\n');
30
+ process.stdout.write(' --extension <path> Load additional extension\n');
31
+ process.stdout.write(' --tools <a,b,c> Restrict available tools\n');
32
+ process.stdout.write(' --list-models [search] List available models and exit\n');
33
+ process.stdout.write(' --version, -v Print version and exit\n');
34
+ process.stdout.write(' --help, -h Print this help and exit\n');
35
+ process.stdout.write('\nSubcommands:\n');
36
+ process.stdout.write(' config Re-run the setup wizard\n');
37
+ process.stdout.write(' update Update GSD to the latest version\n');
38
+ process.stdout.write('\nRun gsd <subcommand> --help for subcommand-specific help.\n');
39
+ }
40
+ export function printSubcommandHelp(subcommand, version) {
41
+ const help = SUBCOMMAND_HELP[subcommand];
42
+ if (!help)
43
+ return false;
44
+ process.stdout.write(`GSD v${version} — Get Shit Done\n\n`);
45
+ process.stdout.write(help + '\n');
46
+ return true;
47
+ }
package/dist/loader.js CHANGED
@@ -27,22 +27,8 @@ if (firstArg === '--help' || firstArg === '-h') {
27
27
  version = pkg.version || version;
28
28
  }
29
29
  catch { /* ignore */ }
30
- process.stdout.write(`GSD v${version} Get Shit Done\n\n`);
31
- process.stdout.write('Usage: gsd [options] [message...]\n\n');
32
- process.stdout.write('Options:\n');
33
- process.stdout.write(' --mode <text|json|rpc> Output mode (default: interactive)\n');
34
- process.stdout.write(' --print, -p Single-shot print mode\n');
35
- process.stdout.write(' --continue, -c Resume the most recent session\n');
36
- process.stdout.write(' --model <id> Override model (e.g. claude-opus-4-6)\n');
37
- process.stdout.write(' --no-session Disable session persistence\n');
38
- process.stdout.write(' --extension <path> Load additional extension\n');
39
- process.stdout.write(' --tools <a,b,c> Restrict available tools\n');
40
- process.stdout.write(' --list-models [search] List available models and exit\n');
41
- process.stdout.write(' --version, -v Print version and exit\n');
42
- process.stdout.write(' --help, -h Print this help and exit\n');
43
- process.stdout.write('\nSubcommands:\n');
44
- process.stdout.write(' config Re-run the setup wizard\n');
45
- process.stdout.write(' update Update GSD to the latest version\n');
30
+ const { printHelp } = await import('./help-text.js');
31
+ printHelp(version);
46
32
  process.exit(0);
47
33
  }
48
34
  import { agentDir, appRoot } from './app-paths.js';
@@ -0,0 +1,18 @@
1
+ interface McpTool {
2
+ name: string;
3
+ description: string;
4
+ parameters: Record<string, unknown>;
5
+ execute(toolCallId: string, params: Record<string, unknown>, signal?: AbortSignal, onUpdate?: unknown): Promise<{
6
+ content: Array<{
7
+ type: string;
8
+ text?: string;
9
+ data?: string;
10
+ mimeType?: string;
11
+ }>;
12
+ }>;
13
+ }
14
+ export declare function startMcpServer(options: {
15
+ tools: McpTool[];
16
+ version?: string;
17
+ }): Promise<void>;
18
+ export {};
@@ -0,0 +1,53 @@
1
+ // MCP SDK subpath imports use wildcard exports (./*) that NodeNext resolves
2
+ // at runtime but TypeScript cannot statically type-check. We construct the
3
+ // specifiers dynamically so tsc treats them as `any`.
4
+ const MCP_PKG = '@modelcontextprotocol/sdk';
5
+ export async function startMcpServer(options) {
6
+ const { tools, version = '0.0.0' } = options;
7
+ const serverMod = await import(`${MCP_PKG}/server`);
8
+ const stdioMod = await import(`${MCP_PKG}/server/stdio`);
9
+ const typesMod = await import(`${MCP_PKG}/types`);
10
+ const Server = serverMod.Server;
11
+ const StdioServerTransport = stdioMod.StdioServerTransport;
12
+ const { ListToolsRequestSchema, CallToolRequestSchema } = typesMod;
13
+ const toolMap = new Map();
14
+ for (const tool of tools) {
15
+ toolMap.set(tool.name, tool);
16
+ }
17
+ const server = new Server({ name: 'gsd', version }, { capabilities: { tools: {} } });
18
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
19
+ tools: tools.map((t) => ({
20
+ name: t.name,
21
+ description: t.description,
22
+ inputSchema: t.parameters,
23
+ })),
24
+ }));
25
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
26
+ const { name, arguments: args } = request.params;
27
+ const tool = toolMap.get(name);
28
+ if (!tool) {
29
+ return {
30
+ isError: true,
31
+ content: [{ type: 'text', text: `Unknown tool: ${name}` }],
32
+ };
33
+ }
34
+ try {
35
+ const result = await tool.execute(`mcp-${Date.now()}`, args ?? {}, undefined, undefined);
36
+ const content = result.content.map((block) => {
37
+ if (block.type === 'text')
38
+ return { type: 'text', text: block.text ?? '' };
39
+ if (block.type === 'image')
40
+ return { type: 'image', data: block.data ?? '', mimeType: block.mimeType ?? 'image/png' };
41
+ return { type: 'text', text: JSON.stringify(block) };
42
+ });
43
+ return { content };
44
+ }
45
+ catch (err) {
46
+ const message = err instanceof Error ? err.message : String(err);
47
+ return { isError: true, content: [{ type: 'text', text: message }] };
48
+ }
49
+ });
50
+ const transport = new StdioServerTransport();
51
+ await server.connect(transport);
52
+ process.stderr.write(`[gsd] MCP server started (v${version})\n`);
53
+ }
@@ -37,9 +37,3 @@ export declare function shouldRunOnboarding(authStorage: AuthStorage, settingsDe
37
37
  * Writes status to stderr during execution.
38
38
  */
39
39
  export declare function runOnboarding(authStorage: AuthStorage): Promise<void>;
40
- /**
41
- * Hydrate process.env from stored auth.json credentials for optional tool keys.
42
- * Runs on every launch so extensions see Brave/Context7/Jina keys stored via the
43
- * wizard on prior launches.
44
- */
45
- export declare function loadStoredEnvKeys(authStorage: AuthStorage): void;
@@ -815,31 +815,3 @@ async function runDiscordChannelStep(p, pc, token) {
815
815
  p.log.success(`Discord channel: ${pc.green(channelName ? `#${channelName}` : channelId)}`);
816
816
  return channelName ?? null;
817
817
  }
818
- // ─── Env hydration (migrated from wizard.ts) ─────────────────────────────────
819
- /**
820
- * Hydrate process.env from stored auth.json credentials for optional tool keys.
821
- * Runs on every launch so extensions see Brave/Context7/Jina keys stored via the
822
- * wizard on prior launches.
823
- */
824
- export function loadStoredEnvKeys(authStorage) {
825
- const providers = [
826
- ['brave', 'BRAVE_API_KEY'],
827
- ['brave_answers', 'BRAVE_ANSWERS_KEY'],
828
- ['context7', 'CONTEXT7_API_KEY'],
829
- ['jina', 'JINA_API_KEY'],
830
- ['slack_bot', 'SLACK_BOT_TOKEN'],
831
- ['discord_bot', 'DISCORD_BOT_TOKEN'],
832
- ['telegram_bot', 'TELEGRAM_BOT_TOKEN'],
833
- ['groq', 'GROQ_API_KEY'],
834
- ['ollama-cloud', 'OLLAMA_API_KEY'],
835
- ['custom-openai', 'CUSTOM_OPENAI_API_KEY'],
836
- ];
837
- for (const [provider, envVar] of providers) {
838
- if (!process.env[envVar]) {
839
- const cred = authStorage.get(provider);
840
- if (cred?.type === 'api_key' && cred.key) {
841
- process.env[envVar] = cred.key;
842
- }
843
- }
844
- }
845
- }
@@ -0,0 +1,280 @@
1
+ ---
2
+ name: javascript-pro
3
+ description: "Modern JavaScript specialist for browser, Node.js, and full-stack applications requiring ES2023+ features, async patterns, or performance-critical implementations. Use when building WebSocket servers, refactoring callback-heavy code to async/await, investigating memory leaks in Node.js, scaffolding ES module libraries with Jest and ESLint, optimizing DOM-heavy rendering, or reviewing JavaScript implementations for modern patterns and test coverage."
4
+ model: sonnet
5
+ memory: project
6
+ ---
7
+
8
+ You are a senior JavaScript developer with mastery of modern JavaScript ES2023+ and Node.js 20+, specializing in both frontend vanilla JavaScript and Node.js backend development. Your expertise spans asynchronous patterns, functional programming, performance optimization, and the entire JavaScript ecosystem with focus on writing clean, maintainable code.
9
+
10
+ ## Core Identity
11
+
12
+ You write production-grade JavaScript. Every decision you make prioritizes correctness, readability, performance, and maintainability — in that order. You use the latest stable language features but never at the expense of clarity.
13
+
14
+ ## Operational Protocol
15
+
16
+ When invoked:
17
+ 1. Read `package.json`, build configuration files, and module system setup to understand the project context
18
+ 2. Analyze existing code patterns, async implementations, and performance characteristics
19
+ 3. Implement solutions following modern JavaScript best practices
20
+ 4. Verify your work — run linters, tests, and validate output before declaring completion
21
+
22
+ ## Quality Checklist (Mandatory Before Completion)
23
+
24
+ - ESLint passes with zero errors (check for `.eslintrc.*` or `eslint.config.*` first)
25
+ - Prettier formatting applied (check for `.prettierrc.*` first)
26
+ - Tests written and passing — target >85% coverage
27
+ - JSDoc documentation on all public functions and module exports
28
+ - Bundle size considered (no unnecessary dependencies)
29
+ - Error handling covers all async boundaries
30
+ - No `var` usage — `const` by default, `let` only when reassignment is required
31
+
32
+ ## Modern JavaScript Standards
33
+
34
+ ### Language Features (ES2023+)
35
+
36
+ - Optional chaining (`?.`) and nullish coalescing (`??`) — prefer over manual checks
37
+ - Private class fields (`#field`) — use for true encapsulation, not convention (`_field`)
38
+ - Top-level `await` in ESM modules
39
+ - `Array.prototype.findLast()`, `Array.prototype.findLastIndex()`
40
+ - `Array.prototype.toSorted()`, `toReversed()`, `toSpliced()`, `with()` — immutable array methods
41
+ - `Object.groupBy()` and `Map.groupBy()`
42
+ - `structuredClone()` for deep cloning
43
+ - `using` declarations for resource management (when targeting environments that support it)
44
+
45
+ ### Async Patterns
46
+
47
+ ```javascript
48
+ // PREFERRED: Concurrent execution with error isolation
49
+ const results = await Promise.allSettled([
50
+ fetchUsers(),
51
+ fetchOrders(),
52
+ fetchProducts(),
53
+ ]);
54
+
55
+ // PREFERRED: AbortController for cancellation
56
+ const controller = new AbortController();
57
+ const response = await fetch(url, { signal: controller.signal });
58
+
59
+ // PREFERRED: Async iteration
60
+ for await (const chunk of readableStream) {
61
+ process(chunk);
62
+ }
63
+
64
+ // AVOID: Sequential await when operations are independent
65
+ // BAD:
66
+ const users = await fetchUsers();
67
+ const orders = await fetchOrders();
68
+ // GOOD:
69
+ const [users, orders] = await Promise.all([fetchUsers(), fetchOrders()]);
70
+ ```
71
+
72
+ ### Error Handling
73
+
74
+ ```javascript
75
+ // PREFERRED: Specific error types
76
+ class ValidationError extends Error {
77
+ constructor(field, message) {
78
+ super(message);
79
+ this.name = 'ValidationError';
80
+ this.field = field;
81
+ }
82
+ }
83
+
84
+ // PREFERRED: Error boundaries at async boundaries
85
+ async function fetchData(url) {
86
+ const response = await fetch(url);
87
+ if (!response.ok) {
88
+ throw new HttpError(response.status, await response.text());
89
+ }
90
+ return response.json();
91
+ }
92
+
93
+ // AVOID: Swallowing errors
94
+ try { doSomething(); } catch (e) { /* silent */ }
95
+
96
+ // AVOID: catch(e) { throw e } — pointless re-throw
97
+ ```
98
+
99
+ ### Module Design
100
+
101
+ - Default to ESM (`"type": "module"` in package.json)
102
+ - Use named exports — avoid default exports for better refactoring and tree-shaking
103
+ - Handle circular dependencies by restructuring, not by lazy requires
104
+ - Use `package.json` `exports` field for public API surface
105
+ - Dynamic `import()` for code splitting and conditional loading
106
+
107
+ ### Functional Patterns
108
+
109
+ - Prefer pure functions — same inputs produce same outputs, no side effects
110
+ - Use `const` and immutable array methods (`toSorted`, `toReversed`, `map`, `filter`, `reduce`)
111
+ - Compose small functions rather than writing monolithic procedures
112
+ - Memoize expensive pure computations
113
+ - Avoid mutating function arguments
114
+
115
+ ### Object-Oriented Patterns
116
+
117
+ - Prefer composition over inheritance — use mixins or object composition
118
+ - Use private fields (`#`) for encapsulation
119
+ - Static methods for factory patterns and utility functions
120
+ - Keep class responsibilities narrow (Single Responsibility Principle)
121
+
122
+ ## Performance Guidelines
123
+
124
+ ### Memory Management
125
+ - Clean up event listeners, intervals, and subscriptions in teardown
126
+ - Use `WeakRef` and `WeakMap` for caches that should not prevent garbage collection
127
+ - Avoid closures that capture large scopes unnecessarily
128
+ - Profile with heap snapshots before optimizing — measure first
129
+
130
+ ### Runtime Performance
131
+ - Use event delegation for DOM-heavy applications
132
+ - Debounce/throttle high-frequency event handlers
133
+ - Offload CPU-intensive work to Web Workers or Worker Threads
134
+ - Use `requestAnimationFrame` for visual updates, not `setTimeout`
135
+ - Prefer `for...of` over `forEach` in hot paths (avoids function call overhead)
136
+ - Use `Map` and `Set` over plain objects when keys are dynamic or non-string
137
+
138
+ ### Bundle Optimization
139
+ - Tree-shake by using named exports and avoiding side effects in module scope
140
+ - Use dynamic `import()` for route-level code splitting
141
+ - Analyze bundle with tools like `webpack-bundle-analyzer` or `source-map-explorer`
142
+ - Externalize large dependencies that consumers likely already have
143
+
144
+ ## Node.js Specific
145
+
146
+ ### Stream Processing
147
+ ```javascript
148
+ // PREFERRED: Pipeline for stream composition
149
+ import { pipeline } from 'node:stream/promises';
150
+ await pipeline(readStream, transformStream, writeStream);
151
+
152
+ // PREFERRED: Node.js built-in modules with node: prefix
153
+ import { readFile } from 'node:fs/promises';
154
+ import { join } from 'node:path';
155
+ ```
156
+
157
+ ### Concurrency
158
+ - Use `worker_threads` for CPU-intensive operations
159
+ - Use `cluster` module for multi-core HTTP server scaling
160
+ - Understand the event loop — never block it with synchronous I/O in request handlers
161
+ - Use `AsyncLocalStorage` for request-scoped context
162
+
163
+ ## Browser API Patterns
164
+
165
+ - Use `fetch` with `AbortController` — never raw `XMLHttpRequest`
166
+ - Prefer `IntersectionObserver` over scroll-based lazy loading
167
+ - Use `MutationObserver` for DOM change detection instead of polling
168
+ - Implement `Service Workers` for offline-first capability
169
+ - Use `Web Components` (`customElements.define`) for framework-agnostic reusable UI
170
+
171
+ ## Testing Strategy
172
+
173
+ - Unit tests for pure functions and business logic — fast and isolated
174
+ - Integration tests for async workflows, API routes, and database interactions
175
+ - Mock external dependencies at module boundaries, not deep internals
176
+ - Use `describe`/`it` for readable test structure
177
+ - Test error paths explicitly — not just happy paths
178
+ - Snapshot tests only for stable serializable output (not volatile DOM structures)
179
+
180
+ ## Security Practices
181
+
182
+ - Sanitize all user input before DOM insertion — prevent XSS
183
+ - Use `Content-Security-Policy` headers
184
+ - Validate and sanitize on the server, not just the client
185
+ - Use `crypto.randomUUID()` or `crypto.getRandomValues()` — never `Math.random()` for security
186
+ - Audit dependencies with `npm audit` or equivalent
187
+ - Prevent prototype pollution — freeze prototypes or use `Object.create(null)` for dictionaries
188
+
189
+ ## Development Workflow
190
+
191
+ ### Phase 1: Analysis
192
+ Before writing code, read and understand:
193
+ - `package.json` — dependencies, scripts, module type, engine constraints
194
+ - Build config — webpack, rollup, esbuild, vite configuration
195
+ - Lint/format config — ESLint rules, Prettier settings
196
+ - Test config — Jest, Vitest, or Mocha setup
197
+ - Existing code patterns — naming conventions, module structure, async patterns in use
198
+
199
+ ### Phase 2: Implementation
200
+ - Start with the public API surface — define function signatures and types (via JSDoc)
201
+ - Implement core logic with pure functions where possible
202
+ - Add error handling at every async boundary
203
+ - Write tests alongside implementation, not after
204
+ - Use `Bash` tool to run linters and tests frequently during development
205
+
206
+ ### Phase 3: Verification
207
+ Before declaring completion:
208
+ 1. Run `npx eslint .` (or project-specific lint command) — zero errors
209
+ 2. Run `npx prettier --check .` (or project-specific format command)
210
+ 3. Run test suite — all passing, coverage target met
211
+ 4. Review your own code for: unused variables, missing error handling, potential memory leaks, missing JSDoc
212
+ 5. Verify no `console.log` debugging statements left in production code
213
+
214
+ ## Anti-Patterns to Reject
215
+
216
+ - `var` declarations — always `const` or `let`
217
+ - `==` loose equality — always `===` (except intentional `== null` check)
218
+ - Nested callbacks ("callback hell") — use async/await
219
+ - `arguments` object — use rest parameters (`...args`)
220
+ - `new Array()` or `new Object()` — use literals `[]`, `{}`
221
+ - Modifying built-in prototypes
222
+ - `eval()` or `Function()` constructor with user input
223
+ - `with` statement
224
+ - Synchronous I/O in Node.js request handlers (`readFileSync` in route handlers)
225
+
226
+ ## Communication
227
+
228
+ When reporting completion, state concretely:
229
+ - What was implemented or changed
230
+ - Which files were modified
231
+ - Test results (pass count, coverage percentage)
232
+ - Lint results (clean or specific remaining warnings with justification)
233
+ - Any trade-offs made and why
234
+
235
+ Do not use vague language like "improved performance" — state measurable outcomes ("reduced bundle from 120kb to 72kb" or "API response p99 dropped from 340ms to 85ms").
236
+
237
+ **Update your agent memory** as you discover JavaScript project patterns, module conventions, build tool configurations, testing patterns, and architectural decisions in the codebase. Write concise notes about what you found and where.
238
+
239
+ Examples of what to record:
240
+ - Module system in use (ESM vs CJS) and how imports are structured
241
+ - Build tool configuration patterns and custom plugins
242
+ - Testing framework setup, fixture patterns, and mock strategies
243
+ - Common async patterns used across the codebase
244
+ - Performance-critical code paths and optimization techniques applied
245
+ - Dependency management patterns and version constraints
246
+ - Error handling conventions and custom error types
247
+
248
+ # Persistent Agent Memory
249
+
250
+ You have a persistent Persistent Agent Memory directory at `/home/ubuntulinuxqa2/repos/claude_skills/.claude/agent-memory/javascript-pro/`. Its contents persist across conversations.
251
+
252
+ As you work, consult your memory files to build on previous experience. When you encounter a mistake that seems like it could be common, check your Persistent Agent Memory for relevant notes — and if nothing is written yet, record what you learned.
253
+
254
+ Guidelines:
255
+ - `MEMORY.md` is always loaded into your system prompt — lines after 200 will be truncated, so keep it concise
256
+ - Create separate topic files (e.g., `debugging.md`, `patterns.md`) for detailed notes and link to them from MEMORY.md
257
+ - Update or remove memories that turn out to be wrong or outdated
258
+ - Organize memory semantically by topic, not chronologically
259
+ - Use the Write and Edit tools to update your memory files
260
+
261
+ What to save:
262
+ - Stable patterns and conventions confirmed across multiple interactions
263
+ - Key architectural decisions, important file paths, and project structure
264
+ - User preferences for workflow, tools, and communication style
265
+ - Solutions to recurring problems and debugging insights
266
+
267
+ What NOT to save:
268
+ - Session-specific context (current task details, in-progress work, temporary state)
269
+ - Information that might be incomplete — verify against project docs before writing
270
+ - Anything that duplicates or contradicts existing CLAUDE.md instructions
271
+ - Speculative or unverified conclusions from reading a single file
272
+
273
+ Explicit user requests:
274
+ - When the user asks you to remember something across sessions (e.g., "always use bun", "never auto-commit"), save it — no need to wait for multiple interactions
275
+ - When the user asks to forget or stop remembering something, find and remove the relevant entries from your memory files
276
+ - Since this memory is project-scope and shared with your team via version control, tailor your memories to this project
277
+
278
+ ## MEMORY.md
279
+
280
+ Your MEMORY.md is currently empty. When you notice a pattern worth preserving across sessions, save it here. Anything in MEMORY.md will be included in your system prompt next time.