@selvakumaresra/specship 0.1.3 → 0.4.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 (718) hide show
  1. package/README.md +2 -2
  2. package/commands/ss-design-implement.md +84 -0
  3. package/commands/ss-design-loop.md +125 -0
  4. package/commands/{cg-drifted.md → ss-drifted.md} +2 -2
  5. package/commands/{cg-fix.md → ss-fix.md} +1 -1
  6. package/commands/{cg-implement.md → ss-implement.md} +1 -1
  7. package/commands/ss-spec-author.md +43 -0
  8. package/commands/ss-spec-review.md +48 -0
  9. package/dist/bin/node-version-check.d.ts +37 -0
  10. package/dist/bin/node-version-check.d.ts.map +1 -0
  11. package/dist/bin/node-version-check.js +79 -0
  12. package/dist/bin/node-version-check.js.map +1 -0
  13. package/dist/bin/specship.d.ts +25 -0
  14. package/dist/bin/specship.d.ts.map +1 -0
  15. package/dist/bin/specship.js +2085 -0
  16. package/dist/bin/specship.js.map +1 -0
  17. package/dist/bin/uninstall.d.ts +13 -0
  18. package/dist/bin/uninstall.d.ts.map +1 -0
  19. package/dist/bin/uninstall.js +35 -0
  20. package/dist/bin/uninstall.js.map +1 -0
  21. package/dist/context/formatter.d.ts +30 -0
  22. package/dist/context/formatter.d.ts.map +1 -0
  23. package/dist/context/formatter.js +263 -0
  24. package/dist/context/formatter.js.map +1 -0
  25. package/dist/context/index.d.ts +119 -0
  26. package/dist/context/index.d.ts.map +1 -0
  27. package/dist/context/index.js +1289 -0
  28. package/dist/context/index.js.map +1 -0
  29. package/dist/context/markers.d.ts +19 -0
  30. package/dist/context/markers.d.ts.map +1 -0
  31. package/dist/context/markers.js +22 -0
  32. package/dist/context/markers.js.map +1 -0
  33. package/dist/db/index.d.ts +103 -0
  34. package/dist/db/index.d.ts.map +1 -0
  35. package/dist/db/index.js +279 -0
  36. package/dist/db/index.js.map +1 -0
  37. package/dist/db/migrations.d.ts +44 -0
  38. package/dist/db/migrations.d.ts.map +1 -0
  39. package/dist/db/migrations.js +462 -0
  40. package/dist/db/migrations.js.map +1 -0
  41. package/dist/db/queries.d.ts +357 -0
  42. package/dist/db/queries.d.ts.map +1 -0
  43. package/dist/db/queries.js +1504 -0
  44. package/dist/db/queries.js.map +1 -0
  45. package/dist/db/schema.sql +419 -0
  46. package/dist/db/spec-queries.d.ts +101 -0
  47. package/dist/db/spec-queries.d.ts.map +1 -0
  48. package/dist/db/spec-queries.js +675 -0
  49. package/dist/db/spec-queries.js.map +1 -0
  50. package/dist/db/sqlite-adapter.d.ts +65 -0
  51. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  52. package/dist/db/sqlite-adapter.js +214 -0
  53. package/dist/db/sqlite-adapter.js.map +1 -0
  54. package/dist/designer/artifact-store.js +54 -0
  55. package/dist/designer/browser.js +141 -0
  56. package/dist/designer/cdp-ensure.js +60 -0
  57. package/dist/designer/cdp-env.js +18 -0
  58. package/dist/designer/cdp-trace.js +599 -0
  59. package/dist/designer/cross-platform.js +74 -0
  60. package/dist/designer/designer-controller.js +1413 -0
  61. package/dist/designer/file-panel.js +39 -0
  62. package/dist/designer/interstitials.js +97 -0
  63. package/dist/designer/oopif-reader.js +176 -0
  64. package/dist/designer/package-meta.js +18 -0
  65. package/dist/designer/preview-host.js +50 -0
  66. package/dist/designer/repo-root.js +31 -0
  67. package/dist/designer/run-state.js +353 -0
  68. package/dist/designer/session-store.js +59 -0
  69. package/dist/designer/ui-anchors.js +651 -0
  70. package/dist/directory.d.ts +67 -0
  71. package/dist/directory.d.ts.map +1 -0
  72. package/dist/directory.js +267 -0
  73. package/dist/directory.js.map +1 -0
  74. package/dist/errors.d.ts +136 -0
  75. package/dist/errors.d.ts.map +1 -0
  76. package/dist/errors.js +219 -0
  77. package/dist/errors.js.map +1 -0
  78. package/dist/extraction/dfm-extractor.d.ts +31 -0
  79. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  80. package/dist/extraction/dfm-extractor.js +151 -0
  81. package/dist/extraction/dfm-extractor.js.map +1 -0
  82. package/dist/extraction/generated-detection.d.ts +30 -0
  83. package/dist/extraction/generated-detection.d.ts.map +1 -0
  84. package/dist/extraction/generated-detection.js +80 -0
  85. package/dist/extraction/generated-detection.js.map +1 -0
  86. package/dist/extraction/grammars.d.ts +100 -0
  87. package/dist/extraction/grammars.d.ts.map +1 -0
  88. package/dist/extraction/grammars.js +426 -0
  89. package/dist/extraction/grammars.js.map +1 -0
  90. package/dist/extraction/index.d.ts +138 -0
  91. package/dist/extraction/index.d.ts.map +1 -0
  92. package/dist/extraction/index.js +1394 -0
  93. package/dist/extraction/index.js.map +1 -0
  94. package/dist/extraction/languages/c-cpp.d.ts +4 -0
  95. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  96. package/dist/extraction/languages/c-cpp.js +171 -0
  97. package/dist/extraction/languages/c-cpp.js.map +1 -0
  98. package/dist/extraction/languages/csharp.d.ts +3 -0
  99. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  100. package/dist/extraction/languages/csharp.js +73 -0
  101. package/dist/extraction/languages/csharp.js.map +1 -0
  102. package/dist/extraction/languages/dart.d.ts +3 -0
  103. package/dist/extraction/languages/dart.d.ts.map +1 -0
  104. package/dist/extraction/languages/dart.js +192 -0
  105. package/dist/extraction/languages/dart.js.map +1 -0
  106. package/dist/extraction/languages/go.d.ts +3 -0
  107. package/dist/extraction/languages/go.d.ts.map +1 -0
  108. package/dist/extraction/languages/go.js +74 -0
  109. package/dist/extraction/languages/go.js.map +1 -0
  110. package/dist/extraction/languages/index.d.ts +10 -0
  111. package/dist/extraction/languages/index.d.ts.map +1 -0
  112. package/dist/extraction/languages/index.js +51 -0
  113. package/dist/extraction/languages/index.js.map +1 -0
  114. package/dist/extraction/languages/java.d.ts +3 -0
  115. package/dist/extraction/languages/java.d.ts.map +1 -0
  116. package/dist/extraction/languages/java.js +70 -0
  117. package/dist/extraction/languages/java.js.map +1 -0
  118. package/dist/extraction/languages/javascript.d.ts +3 -0
  119. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  120. package/dist/extraction/languages/javascript.js +90 -0
  121. package/dist/extraction/languages/javascript.js.map +1 -0
  122. package/dist/extraction/languages/kotlin.d.ts +3 -0
  123. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  124. package/dist/extraction/languages/kotlin.js +259 -0
  125. package/dist/extraction/languages/kotlin.js.map +1 -0
  126. package/dist/extraction/languages/lua.d.ts +3 -0
  127. package/dist/extraction/languages/lua.d.ts.map +1 -0
  128. package/dist/extraction/languages/lua.js +150 -0
  129. package/dist/extraction/languages/lua.js.map +1 -0
  130. package/dist/extraction/languages/luau.d.ts +3 -0
  131. package/dist/extraction/languages/luau.d.ts.map +1 -0
  132. package/dist/extraction/languages/luau.js +37 -0
  133. package/dist/extraction/languages/luau.js.map +1 -0
  134. package/dist/extraction/languages/objc.d.ts +3 -0
  135. package/dist/extraction/languages/objc.d.ts.map +1 -0
  136. package/dist/extraction/languages/objc.js +133 -0
  137. package/dist/extraction/languages/objc.js.map +1 -0
  138. package/dist/extraction/languages/pascal.d.ts +3 -0
  139. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  140. package/dist/extraction/languages/pascal.js +66 -0
  141. package/dist/extraction/languages/pascal.js.map +1 -0
  142. package/dist/extraction/languages/php.d.ts +3 -0
  143. package/dist/extraction/languages/php.d.ts.map +1 -0
  144. package/dist/extraction/languages/php.js +107 -0
  145. package/dist/extraction/languages/php.js.map +1 -0
  146. package/dist/extraction/languages/python.d.ts +3 -0
  147. package/dist/extraction/languages/python.d.ts.map +1 -0
  148. package/dist/extraction/languages/python.js +56 -0
  149. package/dist/extraction/languages/python.js.map +1 -0
  150. package/dist/extraction/languages/ruby.d.ts +3 -0
  151. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  152. package/dist/extraction/languages/ruby.js +114 -0
  153. package/dist/extraction/languages/ruby.js.map +1 -0
  154. package/dist/extraction/languages/rust.d.ts +3 -0
  155. package/dist/extraction/languages/rust.d.ts.map +1 -0
  156. package/dist/extraction/languages/rust.js +109 -0
  157. package/dist/extraction/languages/rust.js.map +1 -0
  158. package/dist/extraction/languages/scala.d.ts +3 -0
  159. package/dist/extraction/languages/scala.d.ts.map +1 -0
  160. package/dist/extraction/languages/scala.js +139 -0
  161. package/dist/extraction/languages/scala.js.map +1 -0
  162. package/dist/extraction/languages/swift.d.ts +3 -0
  163. package/dist/extraction/languages/swift.d.ts.map +1 -0
  164. package/dist/extraction/languages/swift.js +91 -0
  165. package/dist/extraction/languages/swift.js.map +1 -0
  166. package/dist/extraction/languages/typescript.d.ts +3 -0
  167. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  168. package/dist/extraction/languages/typescript.js +129 -0
  169. package/dist/extraction/languages/typescript.js.map +1 -0
  170. package/dist/extraction/liquid-extractor.d.ts +52 -0
  171. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  172. package/dist/extraction/liquid-extractor.js +313 -0
  173. package/dist/extraction/liquid-extractor.js.map +1 -0
  174. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  175. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  176. package/dist/extraction/mybatis-extractor.js +198 -0
  177. package/dist/extraction/mybatis-extractor.js.map +1 -0
  178. package/dist/extraction/parse-worker.d.ts +8 -0
  179. package/dist/extraction/parse-worker.d.ts.map +1 -0
  180. package/dist/extraction/parse-worker.js +94 -0
  181. package/dist/extraction/parse-worker.js.map +1 -0
  182. package/dist/extraction/specs/markdown-spec-extractor.d.ts +59 -0
  183. package/dist/extraction/specs/markdown-spec-extractor.d.ts.map +1 -0
  184. package/dist/extraction/specs/markdown-spec-extractor.js +327 -0
  185. package/dist/extraction/specs/markdown-spec-extractor.js.map +1 -0
  186. package/dist/extraction/specs/types.d.ts +39 -0
  187. package/dist/extraction/specs/types.d.ts.map +1 -0
  188. package/dist/extraction/specs/types.js +8 -0
  189. package/dist/extraction/specs/types.js.map +1 -0
  190. package/dist/extraction/svelte-extractor.d.ts +56 -0
  191. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  192. package/dist/extraction/svelte-extractor.js +272 -0
  193. package/dist/extraction/svelte-extractor.js.map +1 -0
  194. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  195. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  196. package/dist/extraction/tree-sitter-helpers.js +103 -0
  197. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  198. package/dist/extraction/tree-sitter-types.d.ts +193 -0
  199. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  200. package/dist/extraction/tree-sitter-types.js +10 -0
  201. package/dist/extraction/tree-sitter-types.js.map +1 -0
  202. package/dist/extraction/tree-sitter.d.ts +317 -0
  203. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  204. package/dist/extraction/tree-sitter.js +3092 -0
  205. package/dist/extraction/tree-sitter.js.map +1 -0
  206. package/dist/extraction/vue-extractor.d.ts +51 -0
  207. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  208. package/dist/extraction/vue-extractor.js +251 -0
  209. package/dist/extraction/vue-extractor.js.map +1 -0
  210. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  211. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  212. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  213. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  214. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  215. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  216. package/dist/extraction/wasm-runtime-flags.js +106 -0
  217. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  218. package/dist/graph/index.d.ts +8 -0
  219. package/dist/graph/index.d.ts.map +1 -0
  220. package/dist/graph/index.js +13 -0
  221. package/dist/graph/index.js.map +1 -0
  222. package/dist/graph/queries.d.ts +106 -0
  223. package/dist/graph/queries.d.ts.map +1 -0
  224. package/dist/graph/queries.js +366 -0
  225. package/dist/graph/queries.js.map +1 -0
  226. package/dist/graph/traversal.d.ts +127 -0
  227. package/dist/graph/traversal.d.ts.map +1 -0
  228. package/dist/graph/traversal.js +531 -0
  229. package/dist/graph/traversal.js.map +1 -0
  230. package/dist/index.d.ts +551 -0
  231. package/dist/index.d.ts.map +1 -0
  232. package/dist/index.js +1165 -0
  233. package/dist/index.js.map +1 -0
  234. package/dist/installer/config-writer.d.ts +28 -0
  235. package/dist/installer/config-writer.d.ts.map +1 -0
  236. package/dist/installer/config-writer.js +91 -0
  237. package/dist/installer/config-writer.js.map +1 -0
  238. package/dist/installer/index.d.ts +92 -0
  239. package/dist/installer/index.d.ts.map +1 -0
  240. package/dist/installer/index.js +416 -0
  241. package/dist/installer/index.js.map +1 -0
  242. package/dist/installer/instructions-template.d.ts +35 -0
  243. package/dist/installer/instructions-template.d.ts.map +1 -0
  244. package/dist/installer/instructions-template.js +51 -0
  245. package/dist/installer/instructions-template.js.map +1 -0
  246. package/dist/installer/targets/claude.d.ts +117 -0
  247. package/dist/installer/targets/claude.d.ts.map +1 -0
  248. package/dist/installer/targets/claude.js +736 -0
  249. package/dist/installer/targets/claude.js.map +1 -0
  250. package/dist/installer/targets/registry.d.ts +19 -0
  251. package/dist/installer/targets/registry.d.ts.map +1 -0
  252. package/dist/installer/targets/registry.js +31 -0
  253. package/dist/installer/targets/registry.js.map +1 -0
  254. package/dist/installer/targets/shared.d.ts +76 -0
  255. package/dist/installer/targets/shared.d.ts.map +1 -0
  256. package/dist/installer/targets/shared.js +256 -0
  257. package/dist/installer/targets/shared.js.map +1 -0
  258. package/dist/installer/targets/types.d.ts +84 -0
  259. package/dist/installer/targets/types.d.ts.map +1 -0
  260. package/dist/installer/targets/types.js +12 -0
  261. package/dist/installer/targets/types.js.map +1 -0
  262. package/dist/isolation/worktree.d.ts +65 -0
  263. package/dist/isolation/worktree.d.ts.map +1 -0
  264. package/dist/isolation/worktree.js +231 -0
  265. package/dist/isolation/worktree.js.map +1 -0
  266. package/dist/mcp/daemon-paths.d.ts +46 -0
  267. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  268. package/dist/mcp/daemon-paths.js +125 -0
  269. package/dist/mcp/daemon-paths.js.map +1 -0
  270. package/dist/mcp/daemon.d.ts +161 -0
  271. package/dist/mcp/daemon.d.ts.map +1 -0
  272. package/dist/mcp/daemon.js +403 -0
  273. package/dist/mcp/daemon.js.map +1 -0
  274. package/dist/mcp/designer-tools.d.ts +33 -0
  275. package/dist/mcp/designer-tools.d.ts.map +1 -0
  276. package/dist/mcp/designer-tools.js +313 -0
  277. package/dist/mcp/designer-tools.js.map +1 -0
  278. package/dist/mcp/engine.d.ts +105 -0
  279. package/dist/mcp/engine.d.ts.map +1 -0
  280. package/dist/mcp/engine.js +270 -0
  281. package/dist/mcp/engine.js.map +1 -0
  282. package/dist/mcp/index.d.ts +112 -0
  283. package/dist/mcp/index.d.ts.map +1 -0
  284. package/dist/mcp/index.js +477 -0
  285. package/dist/mcp/index.js.map +1 -0
  286. package/dist/mcp/proxy.d.ts +81 -0
  287. package/dist/mcp/proxy.d.ts.map +1 -0
  288. package/dist/mcp/proxy.js +510 -0
  289. package/dist/mcp/proxy.js.map +1 -0
  290. package/dist/mcp/server-instructions.d.ts +18 -0
  291. package/dist/mcp/server-instructions.d.ts.map +1 -0
  292. package/dist/mcp/server-instructions.js +77 -0
  293. package/dist/mcp/server-instructions.js.map +1 -0
  294. package/dist/mcp/session.d.ts +77 -0
  295. package/dist/mcp/session.d.ts.map +1 -0
  296. package/dist/mcp/session.js +294 -0
  297. package/dist/mcp/session.js.map +1 -0
  298. package/dist/mcp/spec-tools.d.ts +39 -0
  299. package/dist/mcp/spec-tools.d.ts.map +1 -0
  300. package/dist/mcp/spec-tools.js +326 -0
  301. package/dist/mcp/spec-tools.js.map +1 -0
  302. package/dist/mcp/tools.d.ts +404 -0
  303. package/dist/mcp/tools.d.ts.map +1 -0
  304. package/dist/mcp/tools.js +3087 -0
  305. package/dist/mcp/tools.js.map +1 -0
  306. package/dist/mcp/transport.d.ts +188 -0
  307. package/dist/mcp/transport.d.ts.map +1 -0
  308. package/dist/mcp/transport.js +343 -0
  309. package/dist/mcp/transport.js.map +1 -0
  310. package/dist/mcp/version.d.ts +19 -0
  311. package/dist/mcp/version.d.ts.map +1 -0
  312. package/dist/mcp/version.js +71 -0
  313. package/dist/mcp/version.js.map +1 -0
  314. package/dist/resolution/callback-synthesizer.d.ts +10 -0
  315. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  316. package/dist/resolution/callback-synthesizer.js +1300 -0
  317. package/dist/resolution/callback-synthesizer.js.map +1 -0
  318. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  319. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  320. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  321. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  322. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  323. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  324. package/dist/resolution/frameworks/csharp.js +241 -0
  325. package/dist/resolution/frameworks/csharp.js.map +1 -0
  326. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  327. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  328. package/dist/resolution/frameworks/drupal.js +367 -0
  329. package/dist/resolution/frameworks/drupal.js.map +1 -0
  330. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  331. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  332. package/dist/resolution/frameworks/expo-modules.js +143 -0
  333. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  334. package/dist/resolution/frameworks/express.d.ts +8 -0
  335. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  336. package/dist/resolution/frameworks/express.js +308 -0
  337. package/dist/resolution/frameworks/express.js.map +1 -0
  338. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  339. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  340. package/dist/resolution/frameworks/fabric.js +354 -0
  341. package/dist/resolution/frameworks/fabric.js.map +1 -0
  342. package/dist/resolution/frameworks/go.d.ts +8 -0
  343. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  344. package/dist/resolution/frameworks/go.js +161 -0
  345. package/dist/resolution/frameworks/go.js.map +1 -0
  346. package/dist/resolution/frameworks/index.d.ts +48 -0
  347. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  348. package/dist/resolution/frameworks/index.js +161 -0
  349. package/dist/resolution/frameworks/index.js.map +1 -0
  350. package/dist/resolution/frameworks/java.d.ts +8 -0
  351. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  352. package/dist/resolution/frameworks/java.js +504 -0
  353. package/dist/resolution/frameworks/java.js.map +1 -0
  354. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  355. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  356. package/dist/resolution/frameworks/laravel.js +257 -0
  357. package/dist/resolution/frameworks/laravel.js.map +1 -0
  358. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  359. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  360. package/dist/resolution/frameworks/nestjs.js +698 -0
  361. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  362. package/dist/resolution/frameworks/play.d.ts +19 -0
  363. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  364. package/dist/resolution/frameworks/play.js +111 -0
  365. package/dist/resolution/frameworks/play.js.map +1 -0
  366. package/dist/resolution/frameworks/python.d.ts +10 -0
  367. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  368. package/dist/resolution/frameworks/python.js +396 -0
  369. package/dist/resolution/frameworks/python.js.map +1 -0
  370. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  371. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  372. package/dist/resolution/frameworks/react-native.js +360 -0
  373. package/dist/resolution/frameworks/react-native.js.map +1 -0
  374. package/dist/resolution/frameworks/react.d.ts +8 -0
  375. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  376. package/dist/resolution/frameworks/react.js +365 -0
  377. package/dist/resolution/frameworks/react.js.map +1 -0
  378. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  379. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  380. package/dist/resolution/frameworks/ruby.js +302 -0
  381. package/dist/resolution/frameworks/ruby.js.map +1 -0
  382. package/dist/resolution/frameworks/rust.d.ts +8 -0
  383. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  384. package/dist/resolution/frameworks/rust.js +304 -0
  385. package/dist/resolution/frameworks/rust.js.map +1 -0
  386. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  387. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  388. package/dist/resolution/frameworks/svelte.js +249 -0
  389. package/dist/resolution/frameworks/svelte.js.map +1 -0
  390. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  391. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  392. package/dist/resolution/frameworks/swift-objc.js +252 -0
  393. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  394. package/dist/resolution/frameworks/swift.d.ts +10 -0
  395. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  396. package/dist/resolution/frameworks/swift.js +400 -0
  397. package/dist/resolution/frameworks/swift.js.map +1 -0
  398. package/dist/resolution/frameworks/vue.d.ts +9 -0
  399. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  400. package/dist/resolution/frameworks/vue.js +306 -0
  401. package/dist/resolution/frameworks/vue.js.map +1 -0
  402. package/dist/resolution/go-module.d.ts +26 -0
  403. package/dist/resolution/go-module.d.ts.map +1 -0
  404. package/dist/resolution/go-module.js +78 -0
  405. package/dist/resolution/go-module.js.map +1 -0
  406. package/dist/resolution/import-resolver.d.ts +68 -0
  407. package/dist/resolution/import-resolver.d.ts.map +1 -0
  408. package/dist/resolution/import-resolver.js +1275 -0
  409. package/dist/resolution/import-resolver.js.map +1 -0
  410. package/dist/resolution/index.d.ts +117 -0
  411. package/dist/resolution/index.d.ts.map +1 -0
  412. package/dist/resolution/index.js +895 -0
  413. package/dist/resolution/index.js.map +1 -0
  414. package/dist/resolution/lru-cache.d.ts +24 -0
  415. package/dist/resolution/lru-cache.d.ts.map +1 -0
  416. package/dist/resolution/lru-cache.js +62 -0
  417. package/dist/resolution/lru-cache.js.map +1 -0
  418. package/dist/resolution/name-matcher.d.ts +32 -0
  419. package/dist/resolution/name-matcher.d.ts.map +1 -0
  420. package/dist/resolution/name-matcher.js +596 -0
  421. package/dist/resolution/name-matcher.js.map +1 -0
  422. package/dist/resolution/path-aliases.d.ts +68 -0
  423. package/dist/resolution/path-aliases.d.ts.map +1 -0
  424. package/dist/resolution/path-aliases.js +238 -0
  425. package/dist/resolution/path-aliases.js.map +1 -0
  426. package/dist/resolution/spec-link-resolver.d.ts +103 -0
  427. package/dist/resolution/spec-link-resolver.d.ts.map +1 -0
  428. package/dist/resolution/spec-link-resolver.js +259 -0
  429. package/dist/resolution/spec-link-resolver.js.map +1 -0
  430. package/dist/resolution/strip-comments.d.ts +27 -0
  431. package/dist/resolution/strip-comments.d.ts.map +1 -0
  432. package/dist/resolution/strip-comments.js +441 -0
  433. package/dist/resolution/strip-comments.js.map +1 -0
  434. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  435. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  436. package/dist/resolution/swift-objc-bridge.js +256 -0
  437. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  438. package/dist/resolution/types.d.ts +216 -0
  439. package/dist/resolution/types.d.ts.map +1 -0
  440. package/dist/resolution/types.js +8 -0
  441. package/dist/resolution/types.js.map +1 -0
  442. package/dist/resolution/workspace-packages.d.ts +48 -0
  443. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  444. package/dist/resolution/workspace-packages.js +208 -0
  445. package/dist/resolution/workspace-packages.js.map +1 -0
  446. package/dist/search/query-parser.d.ts +57 -0
  447. package/dist/search/query-parser.d.ts.map +1 -0
  448. package/dist/search/query-parser.js +177 -0
  449. package/dist/search/query-parser.js.map +1 -0
  450. package/dist/search/query-utils.d.ts +71 -0
  451. package/dist/search/query-utils.d.ts.map +1 -0
  452. package/dist/search/query-utils.js +380 -0
  453. package/dist/search/query-utils.js.map +1 -0
  454. package/dist/server/cli.js +152 -0
  455. package/dist/server/index.js +12 -0
  456. package/dist/server/ingest/index.js +18 -0
  457. package/dist/server/ingest/ingestor.js +506 -0
  458. package/dist/server/ingest/parser.js +104 -0
  459. package/dist/server/ingest/pricing.js +78 -0
  460. package/dist/server/ingest/types.js +9 -0
  461. package/dist/server/ingest/watcher.js +77 -0
  462. package/dist/server/package.json +3 -0
  463. package/dist/server/project-registry.js +101 -0
  464. package/dist/server/routes/claude.js +868 -0
  465. package/dist/server/routes/graph.js +211 -0
  466. package/dist/server/routes/memory.js +272 -0
  467. package/dist/server/routes/projects.js +197 -0
  468. package/dist/server/routes/spec.js +265 -0
  469. package/dist/server/routes/status.js +112 -0
  470. package/dist/server/routes/workflow.js +212 -0
  471. package/dist/server/server.js +206 -0
  472. package/dist/server/static-handler.js +87 -0
  473. package/dist/sync/git-hooks.d.ts +45 -0
  474. package/dist/sync/git-hooks.d.ts.map +1 -0
  475. package/dist/sync/git-hooks.js +225 -0
  476. package/dist/sync/git-hooks.js.map +1 -0
  477. package/dist/sync/index.d.ts +19 -0
  478. package/dist/sync/index.d.ts.map +1 -0
  479. package/dist/sync/index.js +35 -0
  480. package/dist/sync/index.js.map +1 -0
  481. package/dist/sync/watch-policy.d.ts +48 -0
  482. package/dist/sync/watch-policy.d.ts.map +1 -0
  483. package/dist/sync/watch-policy.js +124 -0
  484. package/dist/sync/watch-policy.js.map +1 -0
  485. package/dist/sync/watcher.d.ts +283 -0
  486. package/dist/sync/watcher.d.ts.map +1 -0
  487. package/dist/sync/watcher.js +606 -0
  488. package/dist/sync/watcher.js.map +1 -0
  489. package/dist/sync/worktree.d.ts +54 -0
  490. package/dist/sync/worktree.d.ts.map +1 -0
  491. package/dist/sync/worktree.js +137 -0
  492. package/dist/sync/worktree.js.map +1 -0
  493. package/dist/types.d.ts +623 -0
  494. package/dist/types.d.ts.map +1 -0
  495. package/dist/types.js +108 -0
  496. package/dist/types.js.map +1 -0
  497. package/dist/ui/glyphs.d.ts +42 -0
  498. package/dist/ui/glyphs.d.ts.map +1 -0
  499. package/dist/ui/glyphs.js +78 -0
  500. package/dist/ui/glyphs.js.map +1 -0
  501. package/dist/ui/shimmer-progress.d.ts +11 -0
  502. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  503. package/dist/ui/shimmer-progress.js +90 -0
  504. package/dist/ui/shimmer-progress.js.map +1 -0
  505. package/dist/ui/shimmer-worker.d.ts +2 -0
  506. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  507. package/dist/ui/shimmer-worker.js +118 -0
  508. package/dist/ui/shimmer-worker.js.map +1 -0
  509. package/dist/ui/types.d.ts +17 -0
  510. package/dist/ui/types.d.ts.map +1 -0
  511. package/dist/ui/types.js +3 -0
  512. package/dist/ui/types.js.map +1 -0
  513. package/dist/utils.d.ts +205 -0
  514. package/dist/utils.d.ts.map +1 -0
  515. package/dist/utils.js +549 -0
  516. package/dist/utils.js.map +1 -0
  517. package/dist/web/chunk-2AJCHB7P.js +1 -0
  518. package/dist/web/chunk-2CPLUFCH.js +2 -0
  519. package/dist/web/chunk-2GBEK2GM.js +1 -0
  520. package/dist/web/chunk-2I7L37NS.js +1 -0
  521. package/dist/web/chunk-2NAWAJB5.js +1 -0
  522. package/dist/web/chunk-2OJBIPE4.js +1 -0
  523. package/dist/web/chunk-2YUJNZ2Y.js +6 -0
  524. package/dist/web/chunk-3E2WB6D5.js +1 -0
  525. package/dist/web/chunk-3EBFYSCH.js +2 -0
  526. package/dist/web/chunk-3QCQ4BXS.js +1 -0
  527. package/dist/web/chunk-42XVAQ6I.js +1 -0
  528. package/dist/web/chunk-45QHGCB4.js +17 -0
  529. package/dist/web/chunk-4IMMPEYM.js +1 -0
  530. package/dist/web/chunk-4TJQJPCZ.js +1 -0
  531. package/dist/web/chunk-4WZIHTPC.js +1 -0
  532. package/dist/web/chunk-4YVSYOSD.js +1 -0
  533. package/dist/web/chunk-5BQIOYKW.js +1 -0
  534. package/dist/web/chunk-5HGWHUJA.js +1 -0
  535. package/dist/web/chunk-5Y244R4G.js +1 -0
  536. package/dist/web/chunk-6RRDPT5Z.js +1 -0
  537. package/dist/web/chunk-6VKB2ZWM.js +1 -0
  538. package/dist/web/chunk-7DMFVTU4.js +1 -0
  539. package/dist/web/chunk-7RNS77UP.js +1 -0
  540. package/dist/web/chunk-7SMPKVEP.js +1 -0
  541. package/dist/web/chunk-A5R3MJMO.js +1 -0
  542. package/dist/web/chunk-ASZ77FMZ.js +1 -0
  543. package/dist/web/chunk-AZJVTPLU.js +1 -0
  544. package/dist/web/chunk-B3YPFY6A.js +1 -0
  545. package/dist/web/chunk-BLBRMCN2.js +1 -0
  546. package/dist/web/chunk-BMIAXD2V.js +2 -0
  547. package/dist/web/chunk-BUXWEHIY.js +1 -0
  548. package/dist/web/chunk-BYZFQSM6.js +1 -0
  549. package/dist/web/chunk-D5OCNEJA.js +2 -0
  550. package/dist/web/chunk-DLQPZWSI.css +1 -0
  551. package/dist/web/chunk-DTRN7FZR.js +1 -0
  552. package/dist/web/chunk-DYRFLPJA.js +1 -0
  553. package/dist/web/chunk-E3J3CXR5.js +1 -0
  554. package/dist/web/chunk-E44X4RH2.js +1 -0
  555. package/dist/web/chunk-E73OX2P7.js +1 -0
  556. package/dist/web/chunk-EAXRKDLV.js +1 -0
  557. package/dist/web/chunk-EBKKDHYI.js +1 -0
  558. package/dist/web/chunk-EE7V7Q5P.js +1 -0
  559. package/dist/web/chunk-EKY2FUHU.js +1 -0
  560. package/dist/web/chunk-EMGMOEVR.js +1 -0
  561. package/dist/web/chunk-EP6XOPXH.js +1 -0
  562. package/dist/web/chunk-ESGDLJOJ.js +1 -0
  563. package/dist/web/chunk-ETJG7NCY.js +1 -0
  564. package/dist/web/chunk-EUUEFEDI.js +1 -0
  565. package/dist/web/chunk-FGNZDHTL.js +11 -0
  566. package/dist/web/chunk-FHZHD2ZG.js +1 -0
  567. package/dist/web/chunk-FIJW2UNJ.js +1 -0
  568. package/dist/web/chunk-FMV5PXRC.js +5 -0
  569. package/dist/web/chunk-G7VZT5KB.js +3 -0
  570. package/dist/web/chunk-GR72OOCN.js +1 -0
  571. package/dist/web/chunk-GRZYXPSO.js +7 -0
  572. package/dist/web/chunk-GWPVKJIY.js +1 -0
  573. package/dist/web/chunk-GYGPS3AN.js +1 -0
  574. package/dist/web/chunk-H7AF7YS4.js +1 -0
  575. package/dist/web/chunk-HDZDQILN.js +1 -0
  576. package/dist/web/chunk-HMK6UO6N.js +1 -0
  577. package/dist/web/chunk-HZA6NEAB.js +1 -0
  578. package/dist/web/chunk-IHEE5NYJ.js +1 -0
  579. package/dist/web/chunk-ISNEBICW.js +1 -0
  580. package/dist/web/chunk-J2GZVLHH.js +1 -0
  581. package/dist/web/chunk-JTFXTIPE.js +903 -0
  582. package/dist/web/chunk-L37MTFSG.js +3 -0
  583. package/dist/web/chunk-LB6JPLX2.js +1 -0
  584. package/dist/web/chunk-LNSVDHCI.js +1 -0
  585. package/dist/web/chunk-LVGIY3SO.js +1 -0
  586. package/dist/web/chunk-LXLHIHEN.js +1 -0
  587. package/dist/web/chunk-MC4DFIHG.js +1 -0
  588. package/dist/web/chunk-MVOMVPYB.js +1 -0
  589. package/dist/web/chunk-N6SS4G6S.js +1 -0
  590. package/dist/web/chunk-NTBJG6SJ.js +1 -0
  591. package/dist/web/chunk-NUDB3Q2Y.js +3 -0
  592. package/dist/web/chunk-NZEZCT65.js +1 -0
  593. package/dist/web/chunk-OXEF5E3E.js +1 -0
  594. package/dist/web/chunk-PDN6QYGJ.js +4 -0
  595. package/dist/web/chunk-PGGJPDJG.js +1 -0
  596. package/dist/web/chunk-PUYSJNJR.js +1 -0
  597. package/dist/web/chunk-Q2RVFS45.js +1 -0
  598. package/dist/web/chunk-Q7L6LLAK.js +1 -0
  599. package/dist/web/chunk-QCMKJIWY.js +1 -0
  600. package/dist/web/chunk-QH6CF3M3.js +1 -0
  601. package/dist/web/chunk-QQ5LD7PI.js +1 -0
  602. package/dist/web/chunk-QR6L3KAC.js +1 -0
  603. package/dist/web/chunk-R2DLK4HO.js +1 -0
  604. package/dist/web/chunk-R5W2MDZN.js +1 -0
  605. package/dist/web/chunk-RD6TVPOT.js +1 -0
  606. package/dist/web/chunk-RKY4EJYJ.js +1 -0
  607. package/dist/web/chunk-RONYWVY7.js +1 -0
  608. package/dist/web/chunk-RXKXYF2C.js +1 -0
  609. package/dist/web/chunk-SBWU7JFC.js +1 -0
  610. package/dist/web/chunk-SEXBRGYK.js +1 -0
  611. package/dist/web/chunk-SHPTC4RL.js +1 -0
  612. package/dist/web/chunk-SUZYBYDW.js +1 -0
  613. package/dist/web/chunk-SWKJRNYY.js +1 -0
  614. package/dist/web/chunk-T66XVKGB.js +1 -0
  615. package/dist/web/chunk-T7AZ65JP.js +1 -0
  616. package/dist/web/chunk-TCZDVOHD.js +1 -0
  617. package/dist/web/chunk-TPTITA3V.js +1 -0
  618. package/dist/web/chunk-TR335633.js +1 -0
  619. package/dist/web/chunk-UBOZGQNK.js +1 -0
  620. package/dist/web/chunk-UR5KDXPX.js +1 -0
  621. package/dist/web/chunk-UR6O2GEH.js +1 -0
  622. package/dist/web/chunk-UTNMGWTP.js +1 -0
  623. package/dist/web/chunk-UYC52MBC.js +1 -0
  624. package/dist/web/chunk-VECWMHJP.js +1 -0
  625. package/dist/web/chunk-VUACT35R.js +3 -0
  626. package/dist/web/chunk-VZI7H4SZ.js +1 -0
  627. package/dist/web/chunk-WAI2JMZP.js +1 -0
  628. package/dist/web/chunk-WB6YHOD4.js +1 -0
  629. package/dist/web/chunk-WBT64AWV.js +1 -0
  630. package/dist/web/chunk-WCKHQIYN.js +1 -0
  631. package/dist/web/chunk-WDU3WICG.js +1 -0
  632. package/dist/web/chunk-WFXJIXZE.js +4 -0
  633. package/dist/web/chunk-WLIMNDS3.js +1 -0
  634. package/dist/web/chunk-WTGYRH3Z.js +298 -0
  635. package/dist/web/chunk-WXTCVDTP.js +1 -0
  636. package/dist/web/chunk-X2HTISHL.js +1 -0
  637. package/dist/web/chunk-XCDHWLVH.js +1 -0
  638. package/dist/web/chunk-Y3H6FFUZ.js +1 -0
  639. package/dist/web/chunk-Y4F5ULGJ.js +1 -0
  640. package/dist/web/chunk-YAMRN47K.js +2 -0
  641. package/dist/web/chunk-YEGKAAEE.js +1 -0
  642. package/dist/web/chunk-YM2KU57F.js +1 -0
  643. package/dist/web/chunk-YRERBP6T.js +1 -0
  644. package/dist/web/chunk-ZLV4VCDG.js +3 -0
  645. package/dist/web/chunk-ZTVI5KFF.js +1 -0
  646. package/dist/web/favicon-16.png +0 -0
  647. package/dist/web/favicon-180.png +0 -0
  648. package/dist/web/favicon-32.png +0 -0
  649. package/dist/web/favicon-512.png +0 -0
  650. package/dist/web/favicon-small.svg +15 -0
  651. package/dist/web/favicon.ico +0 -0
  652. package/dist/web/favicon.svg +20 -0
  653. package/dist/web/index.html +145 -0
  654. package/dist/web/main-ESADRXN2.css +1 -0
  655. package/dist/web/main-R53HA54V.js +1 -0
  656. package/dist/web/media/codicon-LN6W7LCM.ttf +0 -0
  657. package/dist/web/styles-KSOPUVDA.css +1 -0
  658. package/dist/web/sw.js +69 -0
  659. package/dist/workflows/condition-evaluator.d.ts +75 -0
  660. package/dist/workflows/condition-evaluator.d.ts.map +1 -0
  661. package/dist/workflows/condition-evaluator.js +282 -0
  662. package/dist/workflows/condition-evaluator.js.map +1 -0
  663. package/dist/workflows/defaults/claude-design-implement.yaml +336 -0
  664. package/dist/workflows/defaults/index.d.ts +26 -0
  665. package/dist/workflows/defaults/index.d.ts.map +1 -0
  666. package/dist/workflows/defaults/index.js +94 -0
  667. package/dist/workflows/defaults/index.js.map +1 -0
  668. package/dist/workflows/defaults/spec-author.yaml +214 -0
  669. package/dist/workflows/defaults/spec-fix.yaml +110 -0
  670. package/dist/workflows/defaults/spec-implement.yaml +150 -0
  671. package/dist/workflows/defaults/spec-relink.yaml +81 -0
  672. package/dist/workflows/defaults/spec-verify.yaml +51 -0
  673. package/dist/workflows/discovery.d.ts +46 -0
  674. package/dist/workflows/discovery.d.ts.map +1 -0
  675. package/dist/workflows/discovery.js +193 -0
  676. package/dist/workflows/discovery.js.map +1 -0
  677. package/dist/workflows/executor.d.ts +83 -0
  678. package/dist/workflows/executor.d.ts.map +1 -0
  679. package/dist/workflows/executor.js +624 -0
  680. package/dist/workflows/executor.js.map +1 -0
  681. package/dist/workflows/runners/approval.d.ts +18 -0
  682. package/dist/workflows/runners/approval.d.ts.map +1 -0
  683. package/dist/workflows/runners/approval.js +34 -0
  684. package/dist/workflows/runners/approval.js.map +1 -0
  685. package/dist/workflows/runners/bash.d.ts +13 -0
  686. package/dist/workflows/runners/bash.d.ts.map +1 -0
  687. package/dist/workflows/runners/bash.js +143 -0
  688. package/dist/workflows/runners/bash.js.map +1 -0
  689. package/dist/workflows/runners/cancel.d.ts +10 -0
  690. package/dist/workflows/runners/cancel.d.ts.map +1 -0
  691. package/dist/workflows/runners/cancel.js +19 -0
  692. package/dist/workflows/runners/cancel.js.map +1 -0
  693. package/dist/workflows/runners/prompt.d.ts +28 -0
  694. package/dist/workflows/runners/prompt.d.ts.map +1 -0
  695. package/dist/workflows/runners/prompt.js +212 -0
  696. package/dist/workflows/runners/prompt.js.map +1 -0
  697. package/dist/workflows/runners/script.d.ts +17 -0
  698. package/dist/workflows/runners/script.d.ts.map +1 -0
  699. package/dist/workflows/runners/script.js +155 -0
  700. package/dist/workflows/runners/script.js.map +1 -0
  701. package/dist/workflows/runners/types.d.ts +51 -0
  702. package/dist/workflows/runners/types.d.ts.map +1 -0
  703. package/dist/workflows/runners/types.js +13 -0
  704. package/dist/workflows/runners/types.js.map +1 -0
  705. package/dist/workflows/schemas/workflow.d.ts +166 -0
  706. package/dist/workflows/schemas/workflow.d.ts.map +1 -0
  707. package/dist/workflows/schemas/workflow.js +437 -0
  708. package/dist/workflows/schemas/workflow.js.map +1 -0
  709. package/hooks/hooks.json +11 -0
  710. package/package.json +7 -3
  711. package/scripts/offline-install.sh +19 -6
  712. package/selectors.json +41 -0
  713. /package/commands/{cg-explore.md → ss-explore.md} +0 -0
  714. /package/commands/{cg-impact.md → ss-impact.md} +0 -0
  715. /package/commands/{cg-relink.md → ss-relink.md} +0 -0
  716. /package/commands/{cg-spec.md → ss-spec.md} +0 -0
  717. /package/commands/{cg-sync.md → ss-sync.md} +0 -0
  718. /package/commands/{cg-trace.md → ss-trace.md} +0 -0
@@ -0,0 +1,736 @@
1
+ "use strict";
2
+ /**
3
+ * Claude Code target. Writes:
4
+ *
5
+ * - MCP server entry to `~/.claude.json` (global = user scope, loads
6
+ * in every project) or `./.mcp.json` (local = project scope, the
7
+ * file Claude Code actually reads for a single project). See the
8
+ * scope table at https://code.claude.com/docs/en/mcp.
9
+ * - Permissions to `~/.claude/settings.json` (global) or
10
+ * `./.claude/settings.json` (local), gated on `autoAllow`.
11
+ * - Instructions to `~/.claude/CLAUDE.md` (global) or
12
+ * `./.claude/CLAUDE.md` (local).
13
+ *
14
+ * Earlier versions wrote the local MCP entry to `./.claude.json` — a
15
+ * file Claude Code never reads — so the server silently never loaded
16
+ * until the user manually renamed it to `.mcp.json` (issue #207). We
17
+ * now write `./.mcp.json` and migrate any stale `./.claude.json` entry
18
+ * out of the way on install and uninstall.
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
32
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
33
+ }) : function(o, v) {
34
+ o["default"] = v;
35
+ });
36
+ var __importStar = (this && this.__importStar) || (function () {
37
+ var ownKeys = function(o) {
38
+ ownKeys = Object.getOwnPropertyNames || function (o) {
39
+ var ar = [];
40
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
41
+ return ar;
42
+ };
43
+ return ownKeys(o);
44
+ };
45
+ return function (mod) {
46
+ if (mod && mod.__esModule) return mod;
47
+ var result = {};
48
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
49
+ __setModuleDefault(result, mod);
50
+ return result;
51
+ };
52
+ })();
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.claudeTarget = void 0;
55
+ exports.writeMcpEntry = writeMcpEntry;
56
+ exports.cleanupLegacyHooks = cleanupLegacyHooks;
57
+ exports.cleanupCurrentHooks = cleanupCurrentHooks;
58
+ exports.writePermissionsEntry = writePermissionsEntry;
59
+ exports.removeInstructionsEntry = removeInstructionsEntry;
60
+ exports.writeHooksEntry = writeHooksEntry;
61
+ exports.writeSddHookEntry = writeSddHookEntry;
62
+ exports.cleanupSddHooks = cleanupSddHooks;
63
+ exports.writeSddInstructionsEntry = writeSddInstructionsEntry;
64
+ exports.removeSddInstructionsEntry = removeSddInstructionsEntry;
65
+ exports.writeCommandsEntries = writeCommandsEntries;
66
+ exports.cleanupLegacyCommandsEntries = cleanupLegacyCommandsEntries;
67
+ exports.writeAgentsEntries = writeAgentsEntries;
68
+ exports.removeCommandsEntries = removeCommandsEntries;
69
+ exports.removeAgentsEntries = removeAgentsEntries;
70
+ const fs = __importStar(require("fs"));
71
+ const path = __importStar(require("path"));
72
+ const os = __importStar(require("os"));
73
+ const shared_1 = require("./shared");
74
+ const instructions_template_1 = require("../instructions-template");
75
+ function configDir(loc) {
76
+ return loc === 'global'
77
+ ? path.join(os.homedir(), '.claude')
78
+ : path.join(process.cwd(), '.claude');
79
+ }
80
+ function mcpJsonPath(loc) {
81
+ // global → ~/.claude.json (user scope: visible in every project).
82
+ // local → ./.mcp.json (project scope: the ONLY project-level MCP
83
+ // file Claude Code reads — NOT ./.claude.json, which it ignores).
84
+ return loc === 'global'
85
+ ? path.join(os.homedir(), '.claude.json')
86
+ : path.join(process.cwd(), '.mcp.json');
87
+ }
88
+ /**
89
+ * Where pre-#207 installers wrote the local MCP entry. Claude Code
90
+ * never reads a project-level `./.claude.json`, so we migrate the
91
+ * specship entry out of it on install and strip it on uninstall.
92
+ * Only the project-local path is legacy — global `~/.claude.json` is
93
+ * the correct user-scope location and is left untouched.
94
+ */
95
+ function legacyLocalMcpPath() {
96
+ return path.join(process.cwd(), '.claude.json');
97
+ }
98
+ function settingsJsonPath(loc) {
99
+ return path.join(configDir(loc), 'settings.json');
100
+ }
101
+ function instructionsPath(loc) {
102
+ return path.join(configDir(loc), 'CLAUDE.md');
103
+ }
104
+ /**
105
+ * The CLAUDE.md Claude Code actually LOADS as memory — distinct from
106
+ * `instructionsPath` (the legacy `.claude/CLAUDE.md`, which the #529 block
107
+ * used). Project memory is the repo-root `./CLAUDE.md`; user memory is
108
+ * `~/.claude/CLAUDE.md`. The spec-driven-development steering rule goes here so
109
+ * the agent actually reads it.
110
+ */
111
+ function claudeMdPath(loc) {
112
+ return loc === 'global'
113
+ ? path.join(os.homedir(), '.claude', 'CLAUDE.md')
114
+ : path.join(process.cwd(), 'CLAUDE.md');
115
+ }
116
+ function commandsDir(loc) {
117
+ return path.join(configDir(loc), 'commands');
118
+ }
119
+ function agentsDir(loc) {
120
+ return path.join(configDir(loc), 'agents');
121
+ }
122
+ /**
123
+ * Plugin-asset source dir at the package root — same `commands/`,
124
+ * `agents/`, `hooks/` directories that ship the plugin manifest path.
125
+ * Resolves identically from `src/installer/targets/claude.ts` (dev /
126
+ * test) and `dist/installer/targets/claude.js` (installed npm package).
127
+ */
128
+ function packageAssetPath(...segments) {
129
+ return path.join(__dirname, '..', '..', '..', ...segments);
130
+ }
131
+ /** Slash commands the installer copies into Claude's commands dir. */
132
+ const SHIPPED_COMMANDS = [
133
+ 'ss-sync.md',
134
+ 'ss-trace.md',
135
+ 'ss-explore.md',
136
+ 'ss-impact.md',
137
+ // Spec-layer commands:
138
+ 'ss-spec.md',
139
+ 'ss-implement.md',
140
+ 'ss-drifted.md',
141
+ 'ss-fix.md',
142
+ 'ss-relink.md',
143
+ // Spec-authoring commands (v0.2):
144
+ 'ss-spec-author.md',
145
+ 'ss-spec-review.md',
146
+ // Design-import workflow (v0.2):
147
+ 'ss-design-implement.md',
148
+ // Full design→code loop (taste via merged designer tools → spec → implement):
149
+ 'ss-design-loop.md',
150
+ ];
151
+ /**
152
+ * Slash commands the installer used to ship under the legacy `cg-`
153
+ * prefix (historical from when SpecShip was called "code graph").
154
+ * Renamed to `ss-` in v0.2 so the prefix clearly ties to SpecShip.
155
+ *
156
+ * Listed so the installer can self-heal on upgrade: install removes any
157
+ * of these that an earlier installer wrote, so users don't end up with
158
+ * both prefixes side-by-side cluttering their slash-command autocomplete.
159
+ * Uninstall strips them too.
160
+ */
161
+ const LEGACY_SHIPPED_COMMANDS = [
162
+ 'cg-sync.md',
163
+ 'cg-trace.md',
164
+ 'cg-explore.md',
165
+ 'cg-impact.md',
166
+ 'cg-spec.md',
167
+ 'cg-implement.md',
168
+ 'cg-drifted.md',
169
+ 'cg-fix.md',
170
+ 'cg-relink.md',
171
+ 'cg-spec-author.md',
172
+ 'cg-spec-review.md',
173
+ ];
174
+ /** Subagents the installer copies into Claude's agents dir. */
175
+ const SHIPPED_AGENTS = ['specship-explorer.md'];
176
+ /** The PostToolUse + SessionStart hooks the installer writes. */
177
+ const SPECSHIP_HOOKS = [
178
+ {
179
+ event: 'PostToolUse',
180
+ matcher: 'Edit|Write|MultiEdit',
181
+ hook: { type: 'command', command: 'specship sync --quiet', async: true },
182
+ },
183
+ {
184
+ event: 'SessionStart',
185
+ matcher: 'startup|resume',
186
+ hook: { type: 'command', command: 'specship sync --quiet' },
187
+ },
188
+ ];
189
+ /**
190
+ * The spec-driven-development steering hook (SDD-INSTALL-DOC, REQ-SDD-002).
191
+ * A `UserPromptSubmit` hook executed by the harness; `specship spec-nudge`
192
+ * reads the prompt and, on feature/bug-shaped intent, injects a non-blocking
193
+ * reminder to author the spec via spec-author first. UserPromptSubmit has no
194
+ * tool matcher, so the matcher is empty (runs on every prompt; the nudge
195
+ * command does the conservative intent filtering itself).
196
+ */
197
+ const SPECSHIP_SDD_HOOKS = [
198
+ {
199
+ event: 'UserPromptSubmit',
200
+ matcher: '',
201
+ hook: { type: 'command', command: 'specship spec-nudge' },
202
+ },
203
+ ];
204
+ class ClaudeCodeTarget {
205
+ id = 'claude';
206
+ displayName = 'Claude Code';
207
+ docsUrl = 'https://docs.claude.com/en/docs/claude-code';
208
+ supportsLocation(_loc) {
209
+ return true;
210
+ }
211
+ detect(loc) {
212
+ const mcpPath = mcpJsonPath(loc);
213
+ const config = (0, shared_1.readJsonFile)(mcpPath);
214
+ const alreadyConfigured = !!config.mcpServers?.specship;
215
+ // For "installed" we infer from the existence of either the dir
216
+ // (global) or the project marker file (local). Cheap and avoids
217
+ // shelling out to `claude --version`.
218
+ const installed = loc === 'global'
219
+ ? fs.existsSync(configDir(loc)) || fs.existsSync(mcpPath)
220
+ : fs.existsSync(mcpPath) || fs.existsSync(configDir(loc));
221
+ return { installed, alreadyConfigured, configPath: mcpPath };
222
+ }
223
+ install(loc, opts) {
224
+ const files = [];
225
+ // 1. MCP server entry
226
+ files.push(writeMcpEntry(loc));
227
+ // 1b. Migrate away any stale ./.claude.json left by a pre-#207
228
+ // local install, so the project isn't left with two competing
229
+ // (one dead) MCP configs.
230
+ if (loc === 'local') {
231
+ const migrated = cleanupLegacyLocalMcp();
232
+ if (migrated)
233
+ files.push(migrated);
234
+ }
235
+ // 2. Permissions (only when autoAllow)
236
+ if (opts.autoAllow) {
237
+ files.push(writePermissionsEntry(loc));
238
+ }
239
+ // 2b. Strip stale auto-sync hooks left by a pre-0.8 install. Those
240
+ // versions wrote `specship mark-dirty` / `sync-if-dirty` hooks to
241
+ // settings.json; both subcommands are gone from the CLI, so the
242
+ // Stop hook now fails every turn with "unknown command
243
+ // 'sync-if-dirty'". Cleaning up on install makes an upgrade
244
+ // self-healing. Only surfaced when something was actually removed.
245
+ const hookCleanup = cleanupLegacyHooks(loc);
246
+ if (hookCleanup.action === 'removed')
247
+ files.push(hookCleanup);
248
+ // 2c. Write the current auto-sync hooks (PostToolUse + SessionStart
249
+ // running `specship sync --quiet`). Gated on autoAllow — same
250
+ // posture as the permissions list since both auto-execute commands
251
+ // without prompting. Idempotent: re-running with identical hooks
252
+ // already in settings.json returns 'unchanged'.
253
+ if (opts.autoAllow) {
254
+ files.push(writeHooksEntry(loc));
255
+ }
256
+ // 3. CLAUDE.md instructions — no longer written. The specship
257
+ // usage guidance now ships solely in the MCP server's `initialize`
258
+ // response (see `mcp/server-instructions.ts`), which Claude Code
259
+ // surfaces in the system prompt automatically. Writing it into
260
+ // CLAUDE.md as well meant the agent read the same playbook twice
261
+ // every turn (issue #529). Strip any block a previous install left
262
+ // behind so an upgrade self-heals — same idiom as the hook cleanup.
263
+ const instrCleanup = removeInstructionsEntry(loc);
264
+ if (instrCleanup.action === 'removed')
265
+ files.push(instrCleanup);
266
+ // 4. Slash commands + the specship-explorer subagent. NOT gated on
267
+ // autoAllow — these only execute when the user / agent invokes them
268
+ // explicitly. Copies the same .md files that ship for the plugin
269
+ // install path, so the two flows can't drift apart.
270
+ //
271
+ // 4a. Strip any legacy `cg-*.md` slash commands the pre-v0.2
272
+ // installer wrote. Self-heals on upgrade so the user's autocomplete
273
+ // doesn't carry both prefixes side-by-side.
274
+ for (const f of cleanupLegacyCommandsEntries(loc))
275
+ files.push(f);
276
+ for (const f of writeCommandsEntries(loc))
277
+ files.push(f);
278
+ for (const f of writeAgentsEntries(loc))
279
+ files.push(f);
280
+ // 5. Spec-driven-development steering (SDD-INSTALL-DOC). On by default;
281
+ // `--no-sdd` sets opts.sdd=false to skip. Writes a marker-delimited
282
+ // "invoke spec-author first" rule into the project CLAUDE.md and a
283
+ // UserPromptSubmit nudge hook, so feature/bug work is steered to
284
+ // spec-author before any brainstorming/planning skill. NOT gated on
285
+ // autoAllow — it's its own opt-out, and the CLAUDE.md rule executes
286
+ // nothing; the nudge hook only prints guidance.
287
+ if (opts.sdd !== false) {
288
+ files.push(writeSddInstructionsEntry(loc));
289
+ files.push(writeSddHookEntry(loc));
290
+ }
291
+ return { files };
292
+ }
293
+ uninstall(loc) {
294
+ const files = [];
295
+ // 1. MCP server entry
296
+ const mcpPath = mcpJsonPath(loc);
297
+ const config = (0, shared_1.readJsonFile)(mcpPath);
298
+ if (config.mcpServers?.specship) {
299
+ delete config.mcpServers.specship;
300
+ if (Object.keys(config.mcpServers).length === 0) {
301
+ delete config.mcpServers;
302
+ }
303
+ (0, shared_1.writeJsonFile)(mcpPath, config);
304
+ files.push({ path: mcpPath, action: 'removed' });
305
+ }
306
+ else {
307
+ files.push({ path: mcpPath, action: 'not-found' });
308
+ }
309
+ // 1b. Also strip the specship entry from a legacy ./.claude.json
310
+ // so uninstall fully reverses a pre-#207 local install.
311
+ if (loc === 'local') {
312
+ const migrated = cleanupLegacyLocalMcp();
313
+ if (migrated)
314
+ files.push(migrated);
315
+ }
316
+ // 2. Permissions
317
+ const settingsPath = settingsJsonPath(loc);
318
+ const settings = (0, shared_1.readJsonFile)(settingsPath);
319
+ if (Array.isArray(settings.permissions?.allow)) {
320
+ const before = settings.permissions.allow.length;
321
+ settings.permissions.allow = settings.permissions.allow.filter((p) => !p.startsWith('mcp__specship__'));
322
+ if (settings.permissions.allow.length !== before) {
323
+ if (settings.permissions.allow.length === 0) {
324
+ delete settings.permissions.allow;
325
+ }
326
+ if (Object.keys(settings.permissions).length === 0) {
327
+ delete settings.permissions;
328
+ }
329
+ (0, shared_1.writeJsonFile)(settingsPath, settings);
330
+ files.push({ path: settingsPath, action: 'removed' });
331
+ }
332
+ else {
333
+ files.push({ path: settingsPath, action: 'not-found' });
334
+ }
335
+ }
336
+ else {
337
+ files.push({ path: settingsPath, action: 'not-found' });
338
+ }
339
+ // 2b. Strip auto-sync hooks the installer wrote — both the
340
+ // current `specship sync --quiet` form (writeHooksEntry) and the
341
+ // legacy `mark-dirty`/`sync-if-dirty` forms (pre-0.8). Two passes
342
+ // so each predicate stays narrow and we never accidentally strip a
343
+ // user-written hook.
344
+ const currentCleanup = cleanupCurrentHooks(loc);
345
+ if (currentCleanup.action === 'removed')
346
+ files.push(currentCleanup);
347
+ const legacyCleanup = cleanupLegacyHooks(loc);
348
+ if (legacyCleanup.action === 'removed')
349
+ files.push(legacyCleanup);
350
+ // 3. Instructions — strip the legacy SpecShip block if present.
351
+ files.push(removeInstructionsEntry(loc));
352
+ // 4. Slash commands + subagent — remove our shipped files; sibling
353
+ // user-written .md files in the same dir are left untouched.
354
+ // Includes legacy `cg-*.md` from pre-v0.2 installers so uninstall
355
+ // leaves the commands dir clean regardless of which prefix was
356
+ // installed.
357
+ for (const f of cleanupLegacyCommandsEntries(loc))
358
+ files.push(f);
359
+ for (const f of removeCommandsEntries(loc))
360
+ files.push(f);
361
+ for (const f of removeAgentsEntries(loc))
362
+ files.push(f);
363
+ // 5. Spec-driven-development steering — strip the CLAUDE.md rule block
364
+ // and the nudge hook (no-op when absent). Always runs so uninstall fully
365
+ // reverses install regardless of whether --no-sdd was used.
366
+ files.push(removeSddInstructionsEntry(loc));
367
+ const sddHookCleanup = cleanupSddHooks(loc);
368
+ if (sddHookCleanup.action === 'removed')
369
+ files.push(sddHookCleanup);
370
+ return { files };
371
+ }
372
+ printConfig(loc) {
373
+ const target = mcpJsonPath(loc);
374
+ const snippet = JSON.stringify({ mcpServers: { specship: (0, shared_1.getMcpServerConfig)() } }, null, 2);
375
+ return `# Add to ${target}\n\n${snippet}\n`;
376
+ }
377
+ describePaths(loc) {
378
+ return [
379
+ mcpJsonPath(loc),
380
+ settingsJsonPath(loc),
381
+ instructionsPath(loc),
382
+ ...SHIPPED_COMMANDS.map((f) => path.join(commandsDir(loc), f)),
383
+ ...SHIPPED_AGENTS.map((f) => path.join(agentsDir(loc), f)),
384
+ ];
385
+ }
386
+ }
387
+ /**
388
+ * Per-file write helpers, exported so the legacy `config-writer.ts`
389
+ * shim can call only the named operation (writeMcpConfig writes ONLY
390
+ * the MCP entry, etc.) instead of `claudeTarget.install()` which
391
+ * writes all three files. Without this split the shims silently
392
+ * cause side effects callers don't expect.
393
+ */
394
+ function writeMcpEntry(loc) {
395
+ const file = mcpJsonPath(loc);
396
+ const existing = (0, shared_1.readJsonFile)(file);
397
+ const before = existing.mcpServers?.specship;
398
+ const after = (0, shared_1.getMcpServerConfig)();
399
+ if ((0, shared_1.jsonDeepEqual)(before, after)) {
400
+ // Already exactly what we'd write — preserve byte-identical file.
401
+ return { path: file, action: 'unchanged' };
402
+ }
403
+ // 'created' here means: the file itself did not exist before this
404
+ // write. A pre-existing MCP JSON file (`~/.claude.json` globally,
405
+ // `./.mcp.json` locally) containing other MCP servers (no
406
+ // `specship` key) is 'updated', not 'created' — we're adding an
407
+ // entry to a file that was already there. Codex uses a different
408
+ // idiom (empty-content => 'created') because its config.toml is
409
+ // ours alone to manage.
410
+ const action = before ? 'updated' : (fs.existsSync(file) ? 'updated' : 'created');
411
+ if (!existing.mcpServers)
412
+ existing.mcpServers = {};
413
+ existing.mcpServers.specship = after;
414
+ (0, shared_1.writeJsonFile)(file, existing);
415
+ return { path: file, action };
416
+ }
417
+ /**
418
+ * Strip the specship entry from a legacy project-local
419
+ * `./.claude.json` (written by pre-#207 installers, which Claude Code
420
+ * never read). Surgical: only our `specship` key is removed; sibling
421
+ * MCP servers and any unrelated keys are preserved, and the file is
422
+ * deleted only when removal leaves it completely empty. Returns the
423
+ * file action for reporting, or `null` when there's nothing to migrate.
424
+ */
425
+ function cleanupLegacyLocalMcp() {
426
+ const file = legacyLocalMcpPath();
427
+ if (!fs.existsSync(file))
428
+ return null;
429
+ const config = (0, shared_1.readJsonFile)(file);
430
+ if (!config.mcpServers?.specship)
431
+ return null;
432
+ delete config.mcpServers.specship;
433
+ if (Object.keys(config.mcpServers).length === 0)
434
+ delete config.mcpServers;
435
+ if (Object.keys(config).length === 0) {
436
+ try {
437
+ fs.unlinkSync(file);
438
+ }
439
+ catch { /* ignore */ }
440
+ }
441
+ else {
442
+ (0, shared_1.writeJsonFile)(file, config);
443
+ }
444
+ return { path: file, action: 'removed' };
445
+ }
446
+ /**
447
+ * True when a Claude Code hook `command` is one of the **pre-0.8**
448
+ * specship auto-sync hooks: `specship mark-dirty` (PostToolUse) /
449
+ * `specship sync-if-dirty` (Stop). Both subcommands have since been
450
+ * removed from the CLI, so the Stop hook fails every turn with
451
+ * "unknown command 'sync-if-dirty'" — stripping them on install
452
+ * (self-heal on upgrade) is what keeps the upgrade quiet. Local builds
453
+ * also wrote the npx form, which still contains the `specship
454
+ * <subcommand>` substring; the substring match covers both. Sibling
455
+ * user hooks (e.g. GitKraken's `gk ai hook run`) match nothing here.
456
+ *
457
+ * The **current** auto-sync hook form (`specship sync --quiet`) is
458
+ * NOT matched here — install writes those and would re-strip its own
459
+ * work if this predicate covered them. The uninstall flow uses
460
+ * `isCurrentSpecshipHookCommand` for those, on top of this one.
461
+ */
462
+ function isLegacySpecshipHookCommand(command) {
463
+ if (typeof command !== 'string')
464
+ return false;
465
+ return (command.includes('specship mark-dirty') ||
466
+ command.includes('specship sync-if-dirty'));
467
+ }
468
+ /**
469
+ * True when a hook `command` is one of the auto-sync hooks
470
+ * `writeHooksEntry` writes in this release (`specship sync --quiet`).
471
+ * Uninstall-only — install must NOT match these or it would destroy
472
+ * the entries it just wrote.
473
+ */
474
+ function isCurrentSpecshipHookCommand(command) {
475
+ if (typeof command !== 'string')
476
+ return false;
477
+ return SPECSHIP_HOOKS.some(({ hook }) => command === hook.command);
478
+ }
479
+ /**
480
+ * Strip specship hook commands matched by `predicate` from Claude
481
+ * `settings.json`. Surgical at the individual-command level: only
482
+ * matched entries are dropped, so a sibling hook sharing a matcher
483
+ * group (or the Stop event) survives. Matcher groups are pruned only
484
+ * once their `hooks` array is empty, events only once they have no
485
+ * groups left, and `hooks` itself only once every event is gone — and
486
+ * none of that runs unless we actually removed a command, so a
487
+ * settings.json with no matching hooks is left byte-for-byte untouched
488
+ * and reported `unchanged`.
489
+ */
490
+ function stripHooksMatching(loc, predicate) {
491
+ const file = settingsJsonPath(loc);
492
+ if (!fs.existsSync(file))
493
+ return { path: file, action: 'not-found' };
494
+ const settings = (0, shared_1.readJsonFile)(file);
495
+ const hooks = settings.hooks;
496
+ if (!hooks || typeof hooks !== 'object' || Array.isArray(hooks)) {
497
+ return { path: file, action: 'unchanged' };
498
+ }
499
+ let removedAny = false;
500
+ for (const event of Object.keys(hooks)) {
501
+ const groups = hooks[event];
502
+ if (!Array.isArray(groups))
503
+ continue;
504
+ for (const group of groups) {
505
+ if (!group || !Array.isArray(group.hooks))
506
+ continue;
507
+ const before = group.hooks.length;
508
+ group.hooks = group.hooks.filter((h) => !predicate(h?.command));
509
+ if (group.hooks.length !== before)
510
+ removedAny = true;
511
+ }
512
+ }
513
+ if (!removedAny)
514
+ return { path: file, action: 'unchanged' };
515
+ for (const event of Object.keys(hooks)) {
516
+ const groups = hooks[event];
517
+ if (!Array.isArray(groups))
518
+ continue;
519
+ hooks[event] = groups.filter((g) => !(g && Array.isArray(g.hooks) && g.hooks.length === 0));
520
+ if (hooks[event].length === 0)
521
+ delete hooks[event];
522
+ }
523
+ if (Object.keys(hooks).length === 0)
524
+ delete settings.hooks;
525
+ (0, shared_1.writeJsonFile)(file, settings);
526
+ return { path: file, action: 'removed' };
527
+ }
528
+ /**
529
+ * Remove stale **pre-0.8** specship auto-sync hooks
530
+ * (`specship mark-dirty` / `specship sync-if-dirty`) from Claude
531
+ * `settings.json`. Safe to call from both `install` (self-heal on
532
+ * upgrade) and `uninstall`. Exported so it can be unit-tested directly.
533
+ */
534
+ function cleanupLegacyHooks(loc) {
535
+ return stripHooksMatching(loc, isLegacySpecshipHookCommand);
536
+ }
537
+ /**
538
+ * Remove the current-release auto-sync hooks (`specship sync --quiet`)
539
+ * written by `writeHooksEntry`. Uninstall-only — install would
540
+ * destroy its own write if this ran there.
541
+ */
542
+ function cleanupCurrentHooks(loc) {
543
+ return stripHooksMatching(loc, isCurrentSpecshipHookCommand);
544
+ }
545
+ function writePermissionsEntry(loc) {
546
+ const file = settingsJsonPath(loc);
547
+ const settings = (0, shared_1.readJsonFile)(file);
548
+ const created = !fs.existsSync(file);
549
+ if (!settings.permissions)
550
+ settings.permissions = {};
551
+ if (!Array.isArray(settings.permissions.allow))
552
+ settings.permissions.allow = [];
553
+ const want = (0, shared_1.getSpecShipPermissions)();
554
+ const before = [...settings.permissions.allow];
555
+ for (const perm of want) {
556
+ if (!settings.permissions.allow.includes(perm)) {
557
+ settings.permissions.allow.push(perm);
558
+ }
559
+ }
560
+ if ((0, shared_1.jsonDeepEqual)(before, settings.permissions.allow) && !created) {
561
+ return { path: file, action: 'unchanged' };
562
+ }
563
+ (0, shared_1.writeJsonFile)(file, settings);
564
+ return { path: file, action: created ? 'created' : 'updated' };
565
+ }
566
+ /**
567
+ * Strip the marker-delimited SpecShip block from CLAUDE.md if a prior
568
+ * install wrote one. Specship no longer maintains an instructions file
569
+ * (issue #529) — the MCP server's `initialize` instructions are the
570
+ * single source of truth — so both install (self-heal on upgrade) and
571
+ * uninstall call this. `removeMarkedSection` returns `not-found`/`kept`
572
+ * when there's nothing to strip; the install caller drops those from
573
+ * the report so a fresh install stays quiet.
574
+ */
575
+ function removeInstructionsEntry(loc) {
576
+ const file = instructionsPath(loc);
577
+ const action = (0, shared_1.removeMarkedSection)(file, instructions_template_1.SPECSHIP_SECTION_START, instructions_template_1.SPECSHIP_SECTION_END);
578
+ return { path: file, action };
579
+ }
580
+ /**
581
+ * Write specship's auto-sync hooks into Claude `settings.json`. Merges
582
+ * idempotently into any user-defined hooks: a matcher group sharing our
583
+ * exact matcher string is reused; sibling matchers / events / events are
584
+ * untouched. Returns `unchanged` when our two hook commands are already
585
+ * present byte-for-byte in the right places.
586
+ *
587
+ * Gated by `install()` on `autoAllow` — same posture as the permissions
588
+ * list. The matching uninstall lives in `cleanupLegacyHooks` (whose
589
+ * matcher predicate covers BOTH the new `specship sync --quiet` form
590
+ * and the legacy `specship mark-dirty`/`sync-if-dirty` forms).
591
+ */
592
+ function writeHooksEntry(loc) {
593
+ return writeHooksFor(loc, SPECSHIP_HOOKS);
594
+ }
595
+ /**
596
+ * Write the spec-driven-development UserPromptSubmit nudge hook into
597
+ * `settings.json` (SDD-INSTALL-DOC, REQ-SDD-002). Same idempotent merge as
598
+ * the auto-sync hooks; gated by `install()` on `opts.sdd` rather than
599
+ * `autoAllow`, since it's part of the SDD steering feature.
600
+ */
601
+ function writeSddHookEntry(loc) {
602
+ return writeHooksFor(loc, SPECSHIP_SDD_HOOKS);
603
+ }
604
+ /**
605
+ * Idempotently merge a set of hooks into Claude `settings.json`. A matcher
606
+ * group sharing our exact matcher string is reused; sibling matchers / events
607
+ * are untouched; a command already present byte-for-byte is skipped. Returns
608
+ * `unchanged` when nothing was added.
609
+ */
610
+ function writeHooksFor(loc, hooks) {
611
+ const file = settingsJsonPath(loc);
612
+ const created = !fs.existsSync(file);
613
+ const settings = (0, shared_1.readJsonFile)(file);
614
+ const beforeJson = JSON.stringify(settings);
615
+ if (!settings.hooks || typeof settings.hooks !== 'object' || Array.isArray(settings.hooks)) {
616
+ settings.hooks = {};
617
+ }
618
+ for (const { event, matcher, hook } of hooks) {
619
+ if (!Array.isArray(settings.hooks[event]))
620
+ settings.hooks[event] = [];
621
+ let group = settings.hooks[event].find((g) => g && g.matcher === matcher);
622
+ if (!group) {
623
+ group = { matcher, hooks: [] };
624
+ settings.hooks[event].push(group);
625
+ }
626
+ if (!Array.isArray(group.hooks))
627
+ group.hooks = [];
628
+ // Idempotent: skip if a command-equal entry is already there.
629
+ if (!group.hooks.some((h) => h && h.command === hook.command)) {
630
+ group.hooks.push({ ...hook });
631
+ }
632
+ }
633
+ const afterJson = JSON.stringify(settings);
634
+ if (beforeJson === afterJson && !created) {
635
+ return { path: file, action: 'unchanged' };
636
+ }
637
+ (0, shared_1.writeJsonFile)(file, settings);
638
+ return { path: file, action: created ? 'created' : 'updated' };
639
+ }
640
+ /** True when a hook command is the SDD nudge (`specship spec-nudge`). Uninstall-only. */
641
+ function isSddHookCommand(command) {
642
+ if (typeof command !== 'string')
643
+ return false;
644
+ return SPECSHIP_SDD_HOOKS.some(({ hook }) => command === hook.command);
645
+ }
646
+ /** Remove the SDD nudge hook written by `writeSddHookEntry`. Uninstall-only. */
647
+ function cleanupSddHooks(loc) {
648
+ return stripHooksMatching(loc, isSddHookCommand);
649
+ }
650
+ /**
651
+ * Write the spec-driven-development steering rule into the project CLAUDE.md
652
+ * (SDD-INSTALL-DOC, REQ-SDD-001). Idempotent + marker-delimited so the user's
653
+ * surrounding content is untouched and a re-run reports `unchanged`. Distinct
654
+ * markers from the legacy #529 block — this is the ordering rule, not the MCP
655
+ * playbook.
656
+ */
657
+ function writeSddInstructionsEntry(loc) {
658
+ const file = claudeMdPath(loc);
659
+ const action = (0, shared_1.upsertMarkedSection)(file, instructions_template_1.SPECSHIP_SDD_SECTION_START, instructions_template_1.SPECSHIP_SDD_SECTION_END, (0, instructions_template_1.getSddRuleBlock)());
660
+ return { path: file, action };
661
+ }
662
+ /** Inverse of `writeSddInstructionsEntry`: strip the SDD rule block. */
663
+ function removeSddInstructionsEntry(loc) {
664
+ const file = claudeMdPath(loc);
665
+ const action = (0, shared_1.removeMarkedSection)(file, instructions_template_1.SPECSHIP_SDD_SECTION_START, instructions_template_1.SPECSHIP_SDD_SECTION_END);
666
+ return { path: file, action };
667
+ }
668
+ /**
669
+ * Copy our shipped slash commands (commands/ss-*.md) into the user's
670
+ * commands dir (~/.claude/commands/ globally, ./.claude/commands/
671
+ * locally). Per-file idempotent: a destination with identical bytes is
672
+ * reported `unchanged`. Sibling user-written .md files in the same dir
673
+ * are never touched.
674
+ */
675
+ function writeCommandsEntries(loc) {
676
+ return SHIPPED_COMMANDS.map((name) => copyAsset(packageAssetPath('commands', name), path.join(commandsDir(loc), name)));
677
+ }
678
+ /**
679
+ * Remove legacy `cg-*.md` slash commands left behind by a pre-v0.2
680
+ * installer. Called from `install()` so an upgrade self-heals (the user
681
+ * doesn't end up with both prefixes side-by-side cluttering their
682
+ * autocomplete) and from `uninstall()` so the legacy files don't
683
+ * persist after specship is removed. Sibling user-written .md files
684
+ * in the same dir are never touched — only the exact filenames in
685
+ * LEGACY_SHIPPED_COMMANDS are candidates.
686
+ */
687
+ function cleanupLegacyCommandsEntries(loc) {
688
+ return LEGACY_SHIPPED_COMMANDS
689
+ .map((name) => removeFile(path.join(commandsDir(loc), name)))
690
+ // Only surface files that actually existed and got removed — keeps
691
+ // the install/uninstall log quiet for users who never had the
692
+ // legacy `cg-*` prefix on disk.
693
+ .filter((entry) => entry.action === 'removed');
694
+ }
695
+ /**
696
+ * Copy our shipped subagent (agents/specship-explorer.md) into the
697
+ * user's agents dir. Same idempotency contract as writeCommandsEntries.
698
+ */
699
+ function writeAgentsEntries(loc) {
700
+ return SHIPPED_AGENTS.map((name) => copyAsset(packageAssetPath('agents', name), path.join(agentsDir(loc), name)));
701
+ }
702
+ /**
703
+ * Inverse of writeCommandsEntries: delete each cg-*.md we shipped, if
704
+ * present. A file the user replaced with their own content is still
705
+ * removed — match the existing uninstall posture for files specship
706
+ * owns (the user can re-add their version after).
707
+ */
708
+ function removeCommandsEntries(loc) {
709
+ return SHIPPED_COMMANDS.map((name) => removeFile(path.join(commandsDir(loc), name)));
710
+ }
711
+ /** Inverse of writeAgentsEntries. */
712
+ function removeAgentsEntries(loc) {
713
+ return SHIPPED_AGENTS.map((name) => removeFile(path.join(agentsDir(loc), name)));
714
+ }
715
+ function copyAsset(src, dest) {
716
+ const body = fs.readFileSync(src, 'utf-8');
717
+ if (fs.existsSync(dest)) {
718
+ const existing = fs.readFileSync(dest, 'utf-8');
719
+ if (existing === body)
720
+ return { path: dest, action: 'unchanged' };
721
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
722
+ fs.writeFileSync(dest, body);
723
+ return { path: dest, action: 'updated' };
724
+ }
725
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
726
+ fs.writeFileSync(dest, body);
727
+ return { path: dest, action: 'created' };
728
+ }
729
+ function removeFile(p) {
730
+ if (!fs.existsSync(p))
731
+ return { path: p, action: 'not-found' };
732
+ fs.unlinkSync(p);
733
+ return { path: p, action: 'removed' };
734
+ }
735
+ exports.claudeTarget = new ClaudeCodeTarget();
736
+ //# sourceMappingURL=claude.js.map