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
@@ -31,13 +31,13 @@ export default function universalConfig(pi: ExtensionAPI) {
31
31
  label: "Discover Configs",
32
32
  description:
33
33
  "Scan for existing AI coding tool configurations in this project and the user's home directory. " +
34
- "Discovers MCP servers, rules, context files, and settings from Claude Code, Cursor, Windsurf, " +
34
+ "Discovers MCP servers, rules, context files, settings, Claude skills, and Claude plugins from Claude Code, Cursor, Windsurf, " +
35
35
  "Gemini CLI, Codex, Cline, GitHub Copilot, and VS Code. Read-only — never modifies config files.",
36
- promptSnippet: "Discover existing AI tool configs (MCP servers, rules, context files) from 8 coding tools.",
36
+ promptSnippet: "Discover existing AI tool configs (MCP servers, rules, context files, Claude skills/plugins) from 8 coding tools.",
37
37
  promptGuidelines: [
38
38
  "Use discover_configs when a user asks about their existing configuration, MCP servers, or when switching from another AI coding tool.",
39
39
  "The tool scans both user-level (~/) and project-level (./) config directories.",
40
- "Results include MCP servers that could be reused, rules/instructions that could be adapted, and context files from other tools.",
40
+ "Results include MCP servers that could be reused, rules/instructions that could be adapted, context files from other tools, and Claude skills/plugins that could be imported.",
41
41
  ],
42
42
  parameters: Type.Object({
43
43
  tool: Type.Optional(
@@ -83,6 +83,8 @@ export default function universalConfig(pi: ExtensionAPI) {
83
83
  rules: allItems.filter((i) => i.type === "rule").length,
84
84
  contextFiles: allItems.filter((i) => i.type === "context-file").length,
85
85
  settings: allItems.filter((i) => i.type === "settings").length,
86
+ claudeSkills: allItems.filter((i) => i.type === "claude-skill").length,
87
+ claudePlugins: allItems.filter((i) => i.type === "claude-plugin").length,
86
88
  totalItems: allItems.length,
87
89
  toolsWithConfig: filtered.filter((t) => t.items.length > 0).length,
88
90
  },
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import { readFile, readdir, stat } from "node:fs/promises";
11
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
11
12
  import { join, basename, resolve } from "node:path";
12
13
  import { homedir } from "node:os";
13
14
  import type {
@@ -29,6 +30,30 @@ function source(tool: ToolInfo, path: string, level: ConfigLevel): ConfigSource
29
30
  return { tool: tool.id, toolName: tool.name, path, level };
30
31
  }
31
32
 
33
+ function walkDirectories(root: string, visit: (dir: string, depth: number) => void, maxDepth = 4): void {
34
+ const skip = new Set([".git", "node_modules", ".worktrees", "dist", "build", "cache", ".cache"]);
35
+
36
+ function walk(dir: string, depth: number) {
37
+ visit(dir, depth);
38
+ if (depth >= maxDepth) return;
39
+
40
+ let entries: Array<{ name: string; isDirectory: () => boolean }> = [];
41
+ try {
42
+ entries = readdirSync(dir, { withFileTypes: true });
43
+ } catch {
44
+ return;
45
+ }
46
+
47
+ for (const entry of entries) {
48
+ if (!entry.isDirectory()) continue;
49
+ if (skip.has(entry.name)) continue;
50
+ walk(join(dir, entry.name), depth + 1);
51
+ }
52
+ }
53
+
54
+ walk(root, 0);
55
+ }
56
+
32
57
  async function readTextFile(path: string): Promise<string | null> {
33
58
  try {
34
59
  return await readFile(path, "utf8");
@@ -166,8 +191,8 @@ async function scanClaude(projectRoot: string, home: string, tool: ToolInfo): Pr
166
191
  }
167
192
  }
168
193
 
169
- // Project-level MCP: .claude/.mcp.json or .claude/mcp.json
170
- for (const relPath of [".claude/.mcp.json", ".claude/mcp.json"]) {
194
+ // Project-level MCP: .mcp.json (standard), .claude/.mcp.json, or .claude/mcp.json
195
+ for (const relPath of [".mcp.json", ".claude/.mcp.json", ".claude/mcp.json"]) {
171
196
  const fullPath = join(projectRoot, relPath);
172
197
  const content = await readTextFile(fullPath);
173
198
  if (content) {
@@ -208,6 +233,44 @@ async function scanClaude(projectRoot: string, home: string, tool: ToolInfo): Pr
208
233
  }
209
234
  }
210
235
 
236
+ // Claude skills: ~/.claude/skills/**/SKILL.md
237
+ const userSkillsRoot = join(home, ".claude/skills");
238
+ if (existsSync(userSkillsRoot)) {
239
+ walkDirectories(userSkillsRoot, (dir) => {
240
+ const skillFile = join(dir, "SKILL.md");
241
+ if (!existsSync(skillFile)) return;
242
+ items.push({
243
+ type: "claude-skill",
244
+ name: basename(dir),
245
+ path: dir,
246
+ source: source(tool, skillFile, "user"),
247
+ });
248
+ }, 5);
249
+ }
250
+
251
+ // Claude plugins: ~/.claude/plugins/**/package.json
252
+ const userPluginsRoot = join(home, ".claude/plugins");
253
+ if (existsSync(userPluginsRoot)) {
254
+ walkDirectories(userPluginsRoot, (dir) => {
255
+ const packageJsonPath = join(dir, "package.json");
256
+ if (!existsSync(packageJsonPath)) return;
257
+ let packageName: string | undefined;
258
+ try {
259
+ const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8")) as { name?: string };
260
+ packageName = pkg.name;
261
+ } catch {
262
+ packageName = undefined;
263
+ }
264
+ items.push({
265
+ type: "claude-plugin",
266
+ name: packageName || basename(dir),
267
+ packageName,
268
+ path: dir,
269
+ source: source(tool, packageJsonPath, "user"),
270
+ });
271
+ }, 4);
272
+ }
273
+
211
274
  // User-level settings: ~/.claude/settings.json
212
275
  const userSettings = join(home, ".claude/settings.json");
213
276
  const settingsContent = await readTextFile(userSettings);
@@ -41,6 +41,8 @@ describe("discoverAllConfigs", () => {
41
41
  assert.equal(result.summary.totalItems, 0);
42
42
  assert.equal(result.summary.toolsScanned, 8);
43
43
  assert.equal(result.summary.toolsWithConfig, 0);
44
+ assert.equal(result.summary.claudeSkills, 0);
45
+ assert.equal(result.summary.claudePlugins, 0);
44
46
  assert.ok(result.durationMs >= 0);
45
47
  } finally {
46
48
  cleanup();
@@ -53,6 +55,8 @@ describe("discoverAllConfigs", () => {
53
55
  writeJson(join(testHome, ".claude.json"), {
54
56
  mcpServers: { "claude-mcp": { command: "node", args: ["server.js"] } },
55
57
  });
58
+ writeText(join(testHome, ".claude/skills/test-skill/SKILL.md"), "# Test skill");
59
+ writeJson(join(testHome, ".claude/plugins/test-plugin/package.json"), { name: "test-plugin" });
56
60
  writeText(join(testRoot, ".cursorrules"), "Use semicolons.");
57
61
  writeText(join(testRoot, ".github/copilot-instructions.md"), "Be helpful.");
58
62
 
@@ -61,7 +65,9 @@ describe("discoverAllConfigs", () => {
61
65
  assert.equal(result.summary.mcpServers, 1);
62
66
  assert.equal(result.summary.rules, 1);
63
67
  assert.equal(result.summary.contextFiles, 1);
64
- assert.equal(result.allItems.length, 3);
68
+ assert.equal(result.summary.claudeSkills, 1);
69
+ assert.equal(result.summary.claudePlugins, 1);
70
+ assert.equal(result.allItems.length, 5);
65
71
  } finally {
66
72
  cleanup();
67
73
  }
@@ -103,6 +109,8 @@ describe("discoverAllConfigs", () => {
103
109
  assert.equal(result.summary.rules, 2);
104
110
  assert.equal(result.summary.contextFiles, 1);
105
111
  assert.equal(result.summary.settings, 1);
112
+ assert.equal(result.summary.claudeSkills, 0);
113
+ assert.equal(result.summary.claudePlugins, 0);
106
114
  assert.equal(result.summary.totalItems, 5);
107
115
  } finally {
108
116
  cleanup();
@@ -16,6 +16,8 @@ const emptyResult: DiscoveryResult = {
16
16
  rules: 0,
17
17
  contextFiles: 0,
18
18
  settings: 0,
19
+ claudeSkills: 0,
20
+ claudePlugins: 0,
19
21
  totalItems: 0,
20
22
  toolsScanned: 8,
21
23
  toolsWithConfig: 0,
@@ -38,11 +40,17 @@ const populatedResult: DiscoveryResult = {
38
40
  source: { tool: "cursor", toolName: "Cursor", path: "/project/.cursor/mcp.json", level: "project" },
39
41
  },
40
42
  {
41
- type: "rule",
42
- name: "style",
43
- content: "Use semicolons and strict TypeScript.",
44
- alwaysApply: true,
45
- source: { tool: "cursor", toolName: "Cursor", path: "/project/.cursor/rules/style.mdc", level: "project" },
43
+ type: "claude-skill",
44
+ name: "cursor-mdc-editor",
45
+ path: "/home/user/.claude/skills/cursor-mdc-editor",
46
+ source: { tool: "claude", toolName: "Claude Code", path: "/home/user/.claude/skills/cursor-mdc-editor/SKILL.md", level: "user" },
47
+ },
48
+ {
49
+ type: "claude-plugin",
50
+ name: "context-mode",
51
+ packageName: "context-mode",
52
+ path: "/home/user/.claude/plugins/marketplaces/context-mode",
53
+ source: { tool: "claude", toolName: "Claude Code", path: "/home/user/.claude/plugins/marketplaces/context-mode/package.json", level: "user" },
46
54
  },
47
55
  ],
48
56
  warnings: [],
@@ -66,7 +74,9 @@ const populatedResult: DiscoveryResult = {
66
74
  rules: 1,
67
75
  contextFiles: 1,
68
76
  settings: 0,
69
- totalItems: 3,
77
+ claudeSkills: 1,
78
+ claudePlugins: 1,
79
+ totalItems: 5,
70
80
  toolsScanned: 8,
71
81
  toolsWithConfig: 2,
72
82
  },
@@ -86,10 +96,14 @@ describe("formatDiscoveryForTool", () => {
86
96
  const text = formatDiscoveryForTool(populatedResult);
87
97
  assert.ok(text.includes("2/8 tools with config"));
88
98
  assert.ok(text.includes("1 MCP server(s)"));
99
+ assert.ok(text.includes("1 Claude skill(s)"));
100
+ assert.ok(text.includes("1 Claude plugin(s)"));
89
101
  assert.ok(text.includes("Cursor"));
90
102
  assert.ok(text.includes("test-mcp"));
91
103
  assert.ok(text.includes("GitHub Copilot"));
92
104
  assert.ok(text.includes("copilot-instructions.md"));
105
+ assert.ok(text.includes("cursor-mdc-editor"));
106
+ assert.ok(text.includes("context-mode"));
93
107
  });
94
108
  });
95
109
 
@@ -107,5 +121,7 @@ describe("formatDiscoveryForCommand", () => {
107
121
  assert.ok(text.includes("2 of 8"));
108
122
  assert.ok(text.includes("Cursor"));
109
123
  assert.ok(text.includes("MCP: test-mcp"));
124
+ assert.ok(text.includes("Skill: cursor-mdc-editor"));
125
+ assert.ok(text.includes("Plugin: context-mode"));
110
126
  });
111
127
  });
@@ -107,6 +107,24 @@ describe("Claude Code scanner", () => {
107
107
  }
108
108
  });
109
109
 
110
+ test("discovers Claude Code skills and plugins", async () => {
111
+ const { testRoot, testHome, cleanup } = makeTempDirs();
112
+ try {
113
+ writeText(join(testHome, ".claude/skills/test-skill/SKILL.md"), "# test skill");
114
+ writeJson(join(testHome, ".claude/plugins/test-plugin/package.json"), { name: "test-plugin" });
115
+
116
+ const { items } = await SCANNERS.claude(testRoot, testHome, getTool("claude"));
117
+ const skills = items.filter((i) => i.type === "claude-skill");
118
+ const plugins = items.filter((i) => i.type === "claude-plugin");
119
+ assert.equal(skills.length, 1);
120
+ assert.equal(plugins.length, 1);
121
+ if (skills[0]?.type === "claude-skill") assert.equal(skills[0].name, "test-skill");
122
+ if (plugins[0]?.type === "claude-plugin") assert.equal(plugins[0].name, "test-plugin");
123
+ } finally {
124
+ cleanup();
125
+ }
126
+ });
127
+
110
128
  test("discovers settings.json", async () => {
111
129
  const { testRoot, testHome, cleanup } = makeTempDirs();
112
130
  try {
@@ -80,11 +80,28 @@ export interface DiscoveredSettings {
80
80
  source: ConfigSource;
81
81
  }
82
82
 
83
+ export interface DiscoveredClaudeSkill {
84
+ type: "claude-skill";
85
+ name: string;
86
+ path: string;
87
+ source: ConfigSource;
88
+ }
89
+
90
+ export interface DiscoveredClaudePlugin {
91
+ type: "claude-plugin";
92
+ name: string;
93
+ path: string;
94
+ packageName?: string;
95
+ source: ConfigSource;
96
+ }
97
+
83
98
  export type DiscoveredItem =
84
99
  | DiscoveredMCPServer
85
100
  | DiscoveredRule
86
101
  | DiscoveredContextFile
87
- | DiscoveredSettings;
102
+ | DiscoveredSettings
103
+ | DiscoveredClaudeSkill
104
+ | DiscoveredClaudePlugin;
88
105
 
89
106
  // ── Discovery result ──────────────────────────────────────────────────────────
90
107
 
@@ -105,6 +122,8 @@ export interface DiscoveryResult {
105
122
  rules: number;
106
123
  contextFiles: number;
107
124
  settings: number;
125
+ claudeSkills: number;
126
+ claudePlugins: number;
108
127
  totalItems: number;
109
128
  toolsScanned: number;
110
129
  toolsWithConfig: number;
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: lint
3
+ description: Lint and format code. Auto-detects ESLint, Biome, Prettier, or language-native formatters and runs them with auto-fix. Reports remaining issues with actionable suggestions.
4
+ ---
5
+
6
+ <objective>
7
+ Lint and format code in the current project. Auto-detect the project's linter and formatter toolchain, run them against the target files, and report results grouped by severity with actionable fix suggestions.
8
+ </objective>
9
+
10
+ <arguments>
11
+ This skill accepts optional arguments after `/lint`:
12
+
13
+ - **No arguments**: Lint only files changed in the current working tree (`git diff --name-only` and `git diff --cached --name-only`).
14
+ - **A file or directory path**: Lint only that specific path (e.g., `/lint src/utils`).
15
+ - **`--fix`**: Automatically apply safe fixes. Can be combined with a path (e.g., `/lint src/ --fix`).
16
+ - **`--fix` without a path**: Auto-fix changed files only.
17
+
18
+ Parse the arguments before proceeding. If `--fix` is present, set fix mode. If a non-flag argument is present, treat it as the target path.
19
+ </arguments>
20
+
21
+ <detection>
22
+ Auto-detect the project's linter and formatter by checking configuration files in the project root. Check in this order and use the **first match found** for each category (linter vs. formatter). A project may have both a linter and a formatter.
23
+
24
+ **JavaScript/TypeScript Linters:**
25
+
26
+ 1. **Biome** — Look for `biome.json` or `biome.jsonc` in the project root.
27
+ - Lint command: `npx @biomejs/biome check .` (or `--apply` with `--fix`)
28
+ - Format command: `npx @biomejs/biome format .` (or `--write` with `--fix`)
29
+ - Biome handles both linting and formatting. No need for a separate formatter if Biome is detected.
30
+
31
+ 2. **ESLint** — Look for `.eslintrc`, `.eslintrc.*` (js, cjs, json, yml, yaml), `eslint.config.*` (js, mjs, cjs, ts, mts, cts), or an `"eslintConfig"` key in `package.json`.
32
+ - Lint command: `npx eslint .` (or `--fix` with `--fix`)
33
+ - Check `package.json` for the installed version. ESLint 9+ uses flat config (`eslint.config.*`).
34
+
35
+ **JavaScript/TypeScript Formatters (only if Biome was NOT detected):**
36
+
37
+ 3. **Prettier** — Look for `.prettierrc`, `.prettierrc.*`, `prettier.config.*`, or a `"prettier"` key in `package.json`.
38
+ - Format check: `npx prettier --check .`
39
+ - Format fix: `npx prettier --write .`
40
+
41
+ **Rust:**
42
+
43
+ 4. **rustfmt** — Look for `rustfmt.toml` or `.rustfmt.toml`, or `Cargo.toml` in the project root.
44
+ - Format check: `cargo fmt -- --check`
45
+ - Format fix: `cargo fmt`
46
+ - Lint: `cargo clippy` (if available)
47
+
48
+ **Go:**
49
+
50
+ 5. **Go tools** — Look for `go.mod` in the project root.
51
+ - Format check: `gofmt -l .`
52
+ - Format fix: `gofmt -w .`
53
+ - Lint: `golangci-lint run` (if installed), otherwise `go vet ./...`
54
+
55
+ **Python:**
56
+
57
+ 6. **Ruff** — Look for `ruff.toml` or a `[tool.ruff]` section in `pyproject.toml`.
58
+ - Lint command: `ruff check .` (or `--fix` with `--fix`)
59
+ - Format command: `ruff format .` (or `--check` without `--fix`)
60
+
61
+ 7. **Black** — Look for a `[tool.black]` section in `pyproject.toml`, or `black` in requirements files.
62
+ - Format check: `black --check .`
63
+ - Format fix: `black .`
64
+
65
+ If no linter or formatter is detected, inform the user and suggest common options for their project type based on the files present.
66
+ </detection>
67
+
68
+ <execution>
69
+
70
+ **Step 1: Determine target files**
71
+
72
+ - If a path argument was provided, use that path.
73
+ - If no path argument, get changed files:
74
+ ```bash
75
+ git diff --name-only
76
+ git diff --cached --name-only
77
+ ```
78
+ Filter to files that still exist on disk. If no files are changed, inform the user and offer to lint the entire project instead.
79
+
80
+ **Step 2: Run the detected tools**
81
+
82
+ Run the linter and/or formatter against the target files or directory.
83
+
84
+ - **Without `--fix`**: Run in check/report mode only. Do NOT modify any files.
85
+ - **With `--fix`**: Run with auto-fix flags enabled.
86
+
87
+ When running formatters without `--fix`, show a preview of what would change:
88
+ - For Prettier: use `--check` and list files that would change.
89
+ - For Biome: use `check` without `--apply`.
90
+ - For Black: use `--check --diff` to show the diff preview.
91
+ - For Ruff: use `--diff` for format and standard output for lint.
92
+ - For rustfmt/gofmt: use `--check` or `-l` to list files, then show a diff for up to 5 files using `diff <(command) file`.
93
+
94
+ **Step 3: Parse and organize output**
95
+
96
+ Parse the tool output and organize issues:
97
+
98
+ ```markdown
99
+ ## Lint Results
100
+
101
+ ### Errors (X issues)
102
+ | File | Line | Rule | Message |
103
+ |------|------|------|---------|
104
+ | ... | ... | ... | ... |
105
+
106
+ ### Warnings (X issues)
107
+ | File | Line | Rule | Message |
108
+ |------|------|------|---------|
109
+ | ... | ... | ... | ... |
110
+
111
+ ### Formatting
112
+ - X files would be reformatted
113
+ - [list files]
114
+
115
+ ### Summary
116
+ - Total issues: X errors, Y warnings, Z formatting
117
+ - Auto-fixable: N issues (run `/lint --fix` to apply)
118
+ ```
119
+
120
+ **Step 4: Suggest fixes for common issues**
121
+
122
+ For the most frequent issues, provide brief actionable guidance:
123
+
124
+ - If the same rule appears 5+ times, suggest a bulk fix or config change.
125
+ - For unused imports/variables, list them for quick removal.
126
+ - For formatting-only issues, note that `--fix` will resolve them safely.
127
+ - For issues that cannot be auto-fixed, provide a one-line explanation of how to resolve each unique rule violation.
128
+
129
+ </execution>
130
+
131
+ <critical_rules>
132
+
133
+ 1. **Never modify files without `--fix`**: Default mode is report-only. Respect the user's working tree.
134
+ 2. **Use the project's own config**: Do not invent lint rules. Use whatever config files exist in the project.
135
+ 3. **Use the project's installed version**: Always prefer `npx`, `cargo`, or the project-local binary. Do not use globally installed tools unless no local version exists.
136
+ 4. **Handle missing tools gracefully**: If a config file exists but the tool is not installed, inform the user and provide the install command (e.g., `npm install --save-dev eslint`).
137
+ 5. **Respect `.gitignore` and ignore patterns**: Do not lint `node_modules`, `dist`, `build`, `target`, `.git`, or other commonly ignored directories. Most tools handle this automatically; verify they do.
138
+ 6. **Limit output**: If there are more than 50 issues, show the first 30 grouped by severity, then summarize the rest with counts per file. Do not flood the user with hundreds of lines.
139
+ 7. **Exit cleanly**: After presenting results, do not take further action. Let the user decide next steps.
140
+
141
+ </critical_rules>
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: review
3
+ description: Review code changes for security, performance, bugs, and quality. Reviews staged changes, unstaged changes, specific commits, or PR-ready diffs.
4
+ ---
5
+
6
+ <objective>
7
+ Review code changes and provide structured feedback covering security, performance, bug risks, code quality, and test coverage gaps. This skill analyzes diffs and surrounding context to catch issues before they reach production.
8
+ </objective>
9
+
10
+ <context>
11
+ This skill reviews code changes at various stages of the development workflow. It can review staged changes before a commit, unstaged work-in-progress, a specific commit, or the full set of changes on a branch that are ready for a pull request.
12
+
13
+ The reviewer reads both the diff and the surrounding source files to understand intent and catch issues that only appear in context.
14
+ </context>
15
+
16
+ <core_principle>
17
+ **FIND REAL ISSUES, NOT STYLE NITS.** Focus on problems that cause bugs, security vulnerabilities, performance degradation, or maintainability pain. Avoid nitpicking formatting or subjective style preferences unless they harm readability.
18
+ </core_principle>
19
+
20
+ <analysis_only_rule>
21
+ **THIS SKILL IS READ-ONLY. DO NOT MODIFY CODE.**
22
+
23
+ The purpose is to review and report findings. Making changes during review conflates the reviewer and author roles. Present findings and let the user decide what to act on.
24
+ </analysis_only_rule>
25
+
26
+ <quick_start>
27
+
28
+ <determine_review_scope>
29
+
30
+ Parse the user's input to determine what to review:
31
+
32
+ 1. **No arguments** - Review staged changes first. If nothing is staged, review unstaged changes.
33
+ - Staged: `git diff --cached`
34
+ - Unstaged: `git diff`
35
+ - If both are empty, review the most recent commit: `git show HEAD`
36
+
37
+ 2. **Commit hash argument** (e.g., `/review abc1234`) - Review that specific commit.
38
+ - `git show <hash>`
39
+
40
+ 3. **File path argument** (e.g., `/review src/foo.ts`) - Review unstaged changes in that file.
41
+ - `git diff -- <path>` then fall back to `git diff --cached -- <path>`
42
+
43
+ 4. **"pr" argument** (e.g., `/review pr`) - Review all changes since branching from main.
44
+ - `git diff main...HEAD`
45
+ - If on main, review `git diff HEAD~1`
46
+
47
+ After obtaining the diff, if it is empty, inform the user that there are no changes to review and stop.
48
+
49
+ </determine_review_scope>
50
+
51
+ <gather_context>
52
+
53
+ Before analyzing the diff:
54
+
55
+ 1. **Read changed files in full** - Do not review a diff in isolation. Read each modified file to understand the surrounding code, imports, types, and control flow.
56
+ 2. **Identify the tech stack** - Note languages, frameworks, and libraries in use. This affects what patterns are risky.
57
+ 3. **Check for related test files** - For each changed source file, look for corresponding test files. Note whether tests were updated alongside the changes.
58
+ 4. **Check for configuration changes** - If config files changed (env, CI, package.json, tsconfig, etc.), pay extra attention to side effects.
59
+
60
+ </gather_context>
61
+
62
+ <review_categories>
63
+
64
+ Analyze the changes against each category below. Only report findings that are actually present. Skip categories with no issues.
65
+
66
+ **A. Security Issues** (Severity: CRITICAL or HIGH)
67
+ - Injection vulnerabilities (SQL injection, command injection, template injection)
68
+ - Cross-site scripting (XSS) - unsanitized user input rendered in HTML
69
+ - Authentication and authorization flaws (missing auth checks, privilege escalation)
70
+ - Secrets or credentials hardcoded or logged
71
+ - Insecure deserialization or unsafe eval usage
72
+ - Path traversal or file access vulnerabilities
73
+ - Missing input validation on external data
74
+
75
+ **B. Performance Concerns** (Severity: HIGH or MEDIUM)
76
+ - N+1 query patterns in database access
77
+ - Unnecessary memory allocations in hot paths or loops
78
+ - Blocking operations on the main thread or in async contexts
79
+ - Missing pagination on unbounded queries
80
+ - Redundant computation that could be cached or memoized
81
+ - Large payloads without streaming or chunking
82
+
83
+ **C. Bug Risks** (Severity: HIGH or MEDIUM)
84
+ - Off-by-one errors in loops or array access
85
+ - Null/undefined dereferences without guards
86
+ - Race conditions in concurrent or async code
87
+ - Incorrect error handling (swallowed errors, wrong error types)
88
+ - Type mismatches or unsafe type assertions
89
+ - Logic errors in conditionals (inverted checks, missing cases)
90
+ - Resource leaks (unclosed connections, file handles, listeners)
91
+
92
+ **D. Code Quality** (Severity: MEDIUM or LOW)
93
+ - Unclear or misleading naming
94
+ - Significant code duplication that should be extracted
95
+ - Excessive complexity (deeply nested logic, functions doing too many things)
96
+ - Dead code or unreachable branches
97
+ - Missing or misleading comments on non-obvious logic
98
+ - Inconsistency with patterns used elsewhere in the codebase
99
+
100
+ **E. Test Coverage Gaps** (Severity: MEDIUM or LOW)
101
+ - New logic paths without corresponding test cases
102
+ - Changed behavior without updated tests
103
+ - Edge cases not covered (empty inputs, boundary values, error paths)
104
+ - Missing integration tests for new API endpoints or database changes
105
+
106
+ </review_categories>
107
+
108
+ <format_findings>
109
+
110
+ For each finding, use this structure:
111
+
112
+ ```
113
+ ### [SEVERITY] Category: Brief Title
114
+
115
+ **File**: `path/to/file.ext` (lines X-Y)
116
+
117
+ **Issue**: Clear description of the problem.
118
+
119
+ **Why it matters**: What could go wrong if this is not addressed.
120
+
121
+ **Suggestion**: How to fix it, with a code snippet if helpful.
122
+ ```
123
+
124
+ Severity levels:
125
+ - **CRITICAL** - Must fix before merge. Security vulnerability or data loss risk.
126
+ - **HIGH** - Should fix before merge. Likely bug or significant performance issue.
127
+ - **MEDIUM** - Should fix soon. Code quality or moderate risk issue.
128
+ - **LOW** - Consider fixing. Minor improvement opportunity.
129
+
130
+ </format_findings>
131
+
132
+ </quick_start>
133
+
134
+ <critical_rules>
135
+
136
+ 1. **READ THE FULL FILE**: Never review a diff without reading the complete source file for context
137
+ 2. **NO FALSE ALARMS**: Only report issues you can explain concretely. Do not report vague concerns
138
+ 3. **PRIORITIZE**: Lead with the most severe findings. Do not bury critical issues under style nits
139
+ 4. **BE SPECIFIC**: Include file paths, line numbers, and code references for every finding
140
+ 5. **EXPLAIN THE RISK**: For each finding, explain what could actually go wrong
141
+ 6. **CHECK TESTS**: Always check whether changes have corresponding test updates
142
+ 7. **CONSIDER THE STACK**: Apply language-specific and framework-specific knowledge to your review
143
+ 8. **DO NOT MODIFY CODE**: Present findings only. The user decides what to act on
144
+
145
+ </critical_rules>
146
+
147
+ <output_format>
148
+
149
+ ```markdown
150
+ ## Code Review: [brief description of what was reviewed]
151
+
152
+ **Scope**: [staged changes | unstaged changes | commit abc1234 | PR changes from main]
153
+ **Files reviewed**: [count] files changed, [additions] additions, [deletions] deletions
154
+
155
+ ---
156
+
157
+ ### Findings
158
+
159
+ [Findings grouped by severity, highest first. Use the format from <format_findings>.]
160
+
161
+ ---
162
+
163
+ ### Summary
164
+
165
+ | Severity | Count |
166
+ |----------|-------|
167
+ | CRITICAL | X |
168
+ | HIGH | X |
169
+ | MEDIUM | X |
170
+ | LOW | X |
171
+
172
+ ### Recommended Actions
173
+
174
+ 1. [Most important action to take]
175
+ 2. [Next most important action]
176
+ 3. [...]
177
+ ```
178
+
179
+ If no issues are found:
180
+
181
+ ```markdown
182
+ ## Code Review: [brief description]
183
+
184
+ **Scope**: [what was reviewed]
185
+ **Files reviewed**: [count]
186
+
187
+ No significant issues found. The changes look good to merge.
188
+ ```
189
+
190
+ </output_format>
191
+
192
+ <decision_gate>
193
+
194
+ **After presenting findings, ALWAYS offer these options:**
195
+
196
+ ```
197
+ ─────────────────────────────────────────
198
+ REVIEW COMPLETE
199
+
200
+ What would you like to do?
201
+
202
+ 1. **Fix issues** - I'll address the findings starting with the most critical
203
+ 2. **Save review** - Export findings to a markdown file
204
+ 3. **Review again** - Re-review with different scope or focus
205
+ 4. **Discuss a finding** - Ask questions about a specific issue
206
+ 5. **Other** - Tell me what you need
207
+ ─────────────────────────────────────────
208
+ ```
209
+
210
+ **Wait for user response before taking any action.**
211
+
212
+ This gate is MANDATORY. Never skip it. Never auto-implement fixes.
213
+
214
+ </decision_gate>