@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,895 @@
1
+ "use strict";
2
+ /**
3
+ * Reference Resolution Orchestrator
4
+ *
5
+ * Coordinates all reference resolution strategies.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
41
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.ReferenceResolver = void 0;
45
+ exports.createResolver = createResolver;
46
+ const fs = __importStar(require("fs"));
47
+ const path = __importStar(require("path"));
48
+ const name_matcher_1 = require("./name-matcher");
49
+ const import_resolver_1 = require("./import-resolver");
50
+ const frameworks_1 = require("./frameworks");
51
+ const callback_synthesizer_1 = require("./callback-synthesizer");
52
+ const path_aliases_1 = require("./path-aliases");
53
+ const go_module_1 = require("./go-module");
54
+ const workspace_packages_1 = require("./workspace-packages");
55
+ const errors_1 = require("../errors");
56
+ const lru_cache_1 = require("./lru-cache");
57
+ /**
58
+ * Cache size limits. Each per-resolver cache is bounded so memory
59
+ * stays flat on large codebases (20k+ files). Sizes were chosen to
60
+ * cover the working set for typical resolution batches without
61
+ * exceeding a few hundred MB worst-case. Override via the env var
62
+ * `SPECSHIP_RESOLVER_CACHE_SIZE` (single integer applied to all
63
+ * caches) when tuning for very large or very small projects.
64
+ */
65
+ const DEFAULT_CACHE_LIMIT = 5_000;
66
+ function resolveCacheLimit() {
67
+ const raw = process.env.SPECSHIP_RESOLVER_CACHE_SIZE;
68
+ if (!raw)
69
+ return DEFAULT_CACHE_LIMIT;
70
+ const parsed = Number.parseInt(raw, 10);
71
+ if (Number.isFinite(parsed) && parsed > 0)
72
+ return parsed;
73
+ return DEFAULT_CACHE_LIMIT;
74
+ }
75
+ // Re-export types
76
+ __exportStar(require("./types"), exports);
77
+ // Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
78
+ const JS_BUILT_INS = new Set([
79
+ 'console', 'window', 'document', 'global', 'process',
80
+ 'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
81
+ 'Date', 'Math', 'JSON', 'RegExp', 'Error', 'Map', 'Set',
82
+ 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
83
+ 'fetch', 'require', 'module', 'exports', '__dirname', '__filename',
84
+ ]);
85
+ const REACT_HOOKS = new Set([
86
+ 'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
87
+ 'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
88
+ ]);
89
+ const PYTHON_BUILT_INS = new Set([
90
+ 'print', 'len', 'range', 'str', 'int', 'float', 'list', 'dict', 'set', 'tuple',
91
+ 'open', 'input', 'type', 'isinstance', 'hasattr', 'getattr', 'setattr',
92
+ 'super', 'self', 'cls', 'None', 'True', 'False',
93
+ ]);
94
+ const PYTHON_BUILT_IN_TYPES = new Set([
95
+ 'list', 'dict', 'set', 'tuple', 'str', 'int', 'float', 'bool',
96
+ 'bytes', 'bytearray', 'frozenset', 'object', 'super',
97
+ ]);
98
+ const PYTHON_BUILT_IN_METHODS = new Set([
99
+ 'append', 'extend', 'insert', 'remove', 'pop', 'clear', 'sort', 'reverse', 'copy',
100
+ 'update', 'keys', 'values', 'items', 'get',
101
+ 'add', 'discard', 'union', 'intersection', 'difference',
102
+ 'split', 'join', 'strip', 'lstrip', 'rstrip', 'replace', 'lower', 'upper',
103
+ 'startswith', 'endswith', 'find', 'index', 'count', 'encode', 'decode',
104
+ 'format', 'isdigit', 'isalpha', 'isalnum',
105
+ 'read', 'write', 'readline', 'readlines', 'close', 'flush', 'seek',
106
+ ]);
107
+ const GO_STDLIB_PACKAGES = new Set([
108
+ 'fmt', 'os', 'io', 'net', 'http', 'log', 'math', 'sort', 'sync',
109
+ 'time', 'path', 'bytes', 'strings', 'strconv', 'errors', 'context',
110
+ 'json', 'xml', 'csv', 'html', 'template', 'regexp', 'reflect',
111
+ 'runtime', 'testing', 'flag', 'bufio', 'crypto', 'encoding',
112
+ 'filepath', 'hash', 'mime', 'rand', 'signal', 'sql', 'syscall',
113
+ 'unicode', 'unsafe', 'atomic', 'binary', 'debug', 'exec', 'heap',
114
+ 'ring', 'scanner', 'tar', 'zip', 'gzip', 'zlib', 'tls', 'url',
115
+ 'user', 'pprof', 'trace', 'ast', 'build', 'parser', 'printer',
116
+ 'token', 'types', 'cgo', 'plugin', 'race', 'ioutil',
117
+ // Kubernetes-common stdlib aliases
118
+ 'utilruntime', 'utilwait', 'utilnet',
119
+ ]);
120
+ const GO_BUILT_INS = new Set([
121
+ 'make', 'new', 'len', 'cap', 'append', 'copy', 'delete', 'close',
122
+ 'panic', 'recover', 'print', 'println', 'complex', 'real', 'imag',
123
+ 'error', 'nil', 'true', 'false', 'iota',
124
+ 'int', 'int8', 'int16', 'int32', 'int64',
125
+ 'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uintptr',
126
+ 'float32', 'float64', 'complex64', 'complex128',
127
+ 'string', 'bool', 'byte', 'rune', 'any',
128
+ ]);
129
+ const PASCAL_UNIT_PREFIXES = [
130
+ 'System.', 'Winapi.', 'Vcl.', 'Fmx.', 'Data.', 'Datasnap.',
131
+ 'Soap.', 'Xml.', 'Web.', 'REST.', 'FireDAC.', 'IBX.',
132
+ 'IdHTTP', 'IdTCP', 'IdSSL',
133
+ ];
134
+ const PASCAL_BUILT_INS = new Set([
135
+ 'System', 'SysUtils', 'Classes', 'Types', 'Variants', 'StrUtils',
136
+ 'Math', 'DateUtils', 'IOUtils', 'Generics.Collections', 'Generics.Defaults',
137
+ 'Rtti', 'TypInfo', 'SyncObjs', 'RegularExpressions',
138
+ 'SysInit', 'Windows', 'Messages', 'Graphics', 'Controls', 'Forms',
139
+ 'Dialogs', 'StdCtrls', 'ExtCtrls', 'ComCtrls', 'Menus', 'ActnList',
140
+ 'WriteLn', 'Write', 'ReadLn', 'Read', 'Inc', 'Dec', 'Ord', 'Chr',
141
+ 'Length', 'SetLength', 'High', 'Low', 'Assigned', 'FreeAndNil',
142
+ 'Format', 'IntToStr', 'StrToInt', 'FloatToStr', 'StrToFloat',
143
+ 'Trim', 'UpperCase', 'LowerCase', 'Pos', 'Copy', 'Delete', 'Insert',
144
+ 'Now', 'Date', 'Time', 'DateToStr', 'StrToDate',
145
+ 'Raise', 'Exit', 'Break', 'Continue', 'Abort',
146
+ 'True', 'False', 'nil', 'Self', 'Result',
147
+ 'Create', 'Destroy', 'Free',
148
+ 'TObject', 'TComponent', 'TPersistent', 'TInterfacedObject',
149
+ 'TList', 'TStringList', 'TStrings', 'TStream', 'TMemoryStream', 'TFileStream',
150
+ 'Exception', 'EAbort', 'EConvertError', 'EAccessViolation',
151
+ 'IInterface', 'IUnknown',
152
+ ]);
153
+ const C_BUILT_INS = new Set([
154
+ // Standard C library functions
155
+ 'printf', 'fprintf', 'sprintf', 'snprintf', 'scanf', 'fscanf', 'sscanf',
156
+ 'malloc', 'calloc', 'realloc', 'free',
157
+ 'memcpy', 'memmove', 'memset', 'memcmp', 'memchr',
158
+ 'strlen', 'strcpy', 'strncpy', 'strcat', 'strncat', 'strcmp', 'strncmp',
159
+ 'strstr', 'strchr', 'strrchr', 'strtok', 'strdup',
160
+ 'fopen', 'fclose', 'fread', 'fwrite', 'fgets', 'fputs', 'fputc', 'fgetc',
161
+ 'feof', 'ferror', 'fflush', 'fseek', 'ftell', 'rewind',
162
+ 'exit', 'abort', 'atexit', 'atoi', 'atol', 'atof', 'strtol', 'strtoul', 'strtod',
163
+ 'qsort', 'bsearch',
164
+ 'abs', 'labs', 'rand', 'srand',
165
+ 'sin', 'cos', 'tan', 'sqrt', 'pow', 'log', 'log10', 'exp', 'ceil', 'floor', 'fabs',
166
+ 'time', 'clock', 'difftime', 'mktime', 'localtime', 'gmtime', 'strftime', 'asctime',
167
+ 'assert', 'errno',
168
+ 'perror', 'remove', 'rename', 'tmpfile', 'tmpnam',
169
+ 'getenv', 'system',
170
+ 'signal', 'raise',
171
+ 'setjmp', 'longjmp',
172
+ 'va_start', 'va_end', 'va_arg', 'va_copy',
173
+ 'NULL', 'EOF', 'BUFSIZ', 'FILENAME_MAX', 'RAND_MAX', 'EXIT_SUCCESS', 'EXIT_FAILURE',
174
+ 'size_t', 'ptrdiff_t', 'wchar_t', 'intptr_t', 'uintptr_t',
175
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t',
176
+ 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
177
+ 'FILE',
178
+ // POSIX additions commonly seen
179
+ 'stat', 'lstat', 'fstat', 'open', 'close', 'read', 'write', 'pipe',
180
+ 'fork', 'exec', 'waitpid', 'getpid', 'getppid', 'kill', 'sleep', 'usleep',
181
+ 'pthread_create', 'pthread_join', 'pthread_mutex_lock', 'pthread_mutex_unlock',
182
+ 'dlopen', 'dlsym', 'dlclose',
183
+ ]);
184
+ const CPP_BUILT_INS = new Set([
185
+ // iostream objects (often used without std:: prefix via using)
186
+ 'cout', 'cin', 'cerr', 'clog', 'endl', 'flush', 'ws',
187
+ 'std', // the namespace itself when used as std::something
188
+ // Common C++ keywords that leak as references
189
+ 'nullptr', 'true', 'false', 'this', 'sizeof', 'alignof', 'typeid',
190
+ 'static_cast', 'dynamic_cast', 'reinterpret_cast', 'const_cast',
191
+ 'make_unique', 'make_shared', 'make_pair',
192
+ 'move', 'forward', 'swap',
193
+ ]);
194
+ /**
195
+ * Reference Resolver
196
+ *
197
+ * Orchestrates reference resolution using multiple strategies.
198
+ */
199
+ class ReferenceResolver {
200
+ projectRoot;
201
+ queries;
202
+ context;
203
+ frameworks = [];
204
+ // All per-resolver caches are LRU-bounded. Previously these were
205
+ // unbounded Maps that grew with every distinct lookup and OOM'd on
206
+ // codebases with 20k+ files (see issue: unbounded cache growth).
207
+ nodeCache; // per-file node cache
208
+ fileCache; // per-file content cache
209
+ importMappingCache;
210
+ reExportCache;
211
+ nameCache; // name → nodes cache
212
+ lowerNameCache; // lower(name) → nodes cache
213
+ qualifiedNameCache; // qualified_name → nodes cache
214
+ knownNames = null; // all known symbol names for fast pre-filtering
215
+ knownFiles = null;
216
+ cachesWarmed = false;
217
+ // tsconfig/jsconfig path-alias map. `undefined` = not yet computed,
218
+ // `null` = computed and absent. Treated as immutable for the
219
+ // resolver's lifetime; callers re-create the resolver if config changes.
220
+ projectAliases = undefined;
221
+ // go.mod module path. Same lazy/immutable convention as projectAliases.
222
+ goModule = undefined;
223
+ // Monorepo workspace member packages. Same lazy/immutable convention.
224
+ workspacePackages = undefined;
225
+ constructor(projectRoot, queries) {
226
+ this.projectRoot = projectRoot;
227
+ this.queries = queries;
228
+ const limit = resolveCacheLimit();
229
+ // The content cache is heavier (full file text), so we give it a
230
+ // smaller budget than the metadata caches.
231
+ const contentLimit = Math.max(64, Math.floor(limit / 5));
232
+ this.nodeCache = new lru_cache_1.LRUCache(limit);
233
+ this.fileCache = new lru_cache_1.LRUCache(contentLimit);
234
+ this.importMappingCache = new lru_cache_1.LRUCache(limit);
235
+ this.reExportCache = new lru_cache_1.LRUCache(limit);
236
+ this.nameCache = new lru_cache_1.LRUCache(limit);
237
+ this.lowerNameCache = new lru_cache_1.LRUCache(limit);
238
+ this.qualifiedNameCache = new lru_cache_1.LRUCache(limit);
239
+ this.context = this.createContext();
240
+ }
241
+ /**
242
+ * Initialize the resolver (detect frameworks, etc.)
243
+ */
244
+ initialize() {
245
+ this.frameworks = (0, frameworks_1.detectFrameworks)(this.context);
246
+ this.clearCaches();
247
+ }
248
+ /**
249
+ * Run each framework resolver's cross-file finalization pass and persist
250
+ * the returned node updates. Idempotent — safe to call after every indexAll
251
+ * and every incremental sync. Returns the number of nodes updated.
252
+ *
253
+ * Caches are cleared before/after so the post-extract pass sees fresh DB
254
+ * state and downstream queries see the updated names.
255
+ */
256
+ runPostExtract() {
257
+ let updated = 0;
258
+ this.clearCaches();
259
+ for (const fw of this.frameworks) {
260
+ if (!fw.postExtract)
261
+ continue;
262
+ try {
263
+ const nodes = fw.postExtract(this.context);
264
+ for (const node of nodes) {
265
+ this.queries.updateNode(node);
266
+ updated++;
267
+ }
268
+ }
269
+ catch (err) {
270
+ (0, errors_1.logDebug)(`Framework '${fw.name}' postExtract failed`, {
271
+ error: err instanceof Error ? err.message : String(err),
272
+ });
273
+ }
274
+ }
275
+ if (updated > 0)
276
+ this.clearCaches();
277
+ return updated;
278
+ }
279
+ /**
280
+ * Pre-build lightweight caches for resolution.
281
+ * Node lookups are now handled by indexed SQLite queries instead of
282
+ * loading all nodes into memory (which caused OOM on large codebases).
283
+ * We cache the set of known symbol names for fast pre-filtering.
284
+ */
285
+ warmCaches() {
286
+ if (this.cachesWarmed)
287
+ return;
288
+ // Only cache the set of known file paths (lightweight string set)
289
+ this.knownFiles = new Set(this.queries.getAllFilePaths());
290
+ // Cache all distinct symbol names for fast pre-filtering (just strings, not full nodes)
291
+ this.knownNames = new Set(this.queries.getAllNodeNames());
292
+ this.cachesWarmed = true;
293
+ }
294
+ /**
295
+ * Clear internal caches
296
+ */
297
+ clearCaches() {
298
+ this.nodeCache.clear();
299
+ this.fileCache.clear();
300
+ this.importMappingCache.clear();
301
+ this.reExportCache.clear();
302
+ this.nameCache.clear();
303
+ this.lowerNameCache.clear();
304
+ this.qualifiedNameCache.clear();
305
+ this.knownNames = null;
306
+ this.knownFiles = null;
307
+ this.cachesWarmed = false;
308
+ }
309
+ /**
310
+ * Create the resolution context
311
+ */
312
+ createContext() {
313
+ return {
314
+ getNodesInFile: (filePath) => {
315
+ if (!this.nodeCache.has(filePath)) {
316
+ this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
317
+ }
318
+ return this.nodeCache.get(filePath);
319
+ },
320
+ getNodesByName: (name) => {
321
+ const cached = this.nameCache.get(name);
322
+ if (cached !== undefined)
323
+ return cached;
324
+ const result = this.queries.getNodesByName(name);
325
+ this.nameCache.set(name, result);
326
+ return result;
327
+ },
328
+ getNodesByQualifiedName: (qualifiedName) => {
329
+ const cached = this.qualifiedNameCache.get(qualifiedName);
330
+ if (cached !== undefined)
331
+ return cached;
332
+ const result = this.queries.getNodesByQualifiedNameExact(qualifiedName);
333
+ this.qualifiedNameCache.set(qualifiedName, result);
334
+ return result;
335
+ },
336
+ getNodesByKind: (kind) => {
337
+ return this.queries.getNodesByKind(kind);
338
+ },
339
+ fileExists: (filePath) => {
340
+ // Check pre-built known files set first (O(1))
341
+ if (this.knownFiles) {
342
+ const normalized = filePath.replace(/\\/g, '/');
343
+ if (this.knownFiles.has(filePath) || this.knownFiles.has(normalized)) {
344
+ return true;
345
+ }
346
+ }
347
+ // Fall back to filesystem for files not yet indexed
348
+ const fullPath = path.join(this.projectRoot, filePath);
349
+ try {
350
+ return fs.existsSync(fullPath);
351
+ }
352
+ catch (error) {
353
+ (0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
354
+ return false;
355
+ }
356
+ },
357
+ readFile: (filePath) => {
358
+ if (this.fileCache.has(filePath)) {
359
+ return this.fileCache.get(filePath);
360
+ }
361
+ const fullPath = path.join(this.projectRoot, filePath);
362
+ try {
363
+ const content = fs.readFileSync(fullPath, 'utf-8');
364
+ this.fileCache.set(filePath, content);
365
+ return content;
366
+ }
367
+ catch (error) {
368
+ (0, errors_1.logDebug)('Failed to read file for resolution', { filePath, error: String(error) });
369
+ this.fileCache.set(filePath, null);
370
+ return null;
371
+ }
372
+ },
373
+ getProjectRoot: () => this.projectRoot,
374
+ getAllFiles: () => {
375
+ return this.queries.getAllFilePaths();
376
+ },
377
+ listDirectories: (relativePath) => {
378
+ const target = relativePath === '.' || relativePath === ''
379
+ ? this.projectRoot
380
+ : path.join(this.projectRoot, relativePath);
381
+ try {
382
+ return fs
383
+ .readdirSync(target, { withFileTypes: true })
384
+ .filter((entry) => entry.isDirectory())
385
+ .map((entry) => entry.name);
386
+ }
387
+ catch (error) {
388
+ (0, errors_1.logDebug)('Failed to list directory for resolution', {
389
+ relativePath,
390
+ error: String(error),
391
+ });
392
+ return [];
393
+ }
394
+ },
395
+ getNodesByLowerName: (lowerName) => {
396
+ const cached = this.lowerNameCache.get(lowerName);
397
+ if (cached !== undefined)
398
+ return cached;
399
+ const result = this.queries.getNodesByLowerName(lowerName);
400
+ this.lowerNameCache.set(lowerName, result);
401
+ return result;
402
+ },
403
+ getImportMappings: (filePath, language) => {
404
+ const cacheKey = filePath;
405
+ const cached = this.importMappingCache.get(cacheKey);
406
+ if (cached)
407
+ return cached;
408
+ const content = this.context.readFile(filePath);
409
+ if (!content) {
410
+ this.importMappingCache.set(cacheKey, []);
411
+ return [];
412
+ }
413
+ const mappings = (0, import_resolver_1.extractImportMappings)(filePath, content, language);
414
+ this.importMappingCache.set(cacheKey, mappings);
415
+ return mappings;
416
+ },
417
+ getProjectAliases: () => {
418
+ if (this.projectAliases === undefined) {
419
+ this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot);
420
+ }
421
+ return this.projectAliases;
422
+ },
423
+ getGoModule: () => {
424
+ if (this.goModule === undefined) {
425
+ this.goModule = (0, go_module_1.loadGoModule)(this.projectRoot);
426
+ }
427
+ return this.goModule;
428
+ },
429
+ getWorkspacePackages: () => {
430
+ if (this.workspacePackages === undefined) {
431
+ this.workspacePackages = (0, workspace_packages_1.loadWorkspacePackages)(this.projectRoot);
432
+ }
433
+ return this.workspacePackages;
434
+ },
435
+ getReExports: (filePath, language) => {
436
+ const cached = this.reExportCache.get(filePath);
437
+ if (cached)
438
+ return cached;
439
+ const content = this.context.readFile(filePath);
440
+ if (!content) {
441
+ this.reExportCache.set(filePath, []);
442
+ return [];
443
+ }
444
+ // Re-exports are a JS/TS-only construct, and what matters is the
445
+ // BARREL file's own language — not the consuming reference's. A
446
+ // `.svelte`/`.vue` consumer threads its own language down the
447
+ // re-export chase, which would make extractReExports() bail on a
448
+ // `.ts` index barrel and silently break the chain (#629). Re-key
449
+ // the parse on the barrel's extension so the chase works no matter
450
+ // what kind of file imports through it.
451
+ const isJsFamily = /\.(?:d\.ts|[cm]?tsx?|[cm]?jsx?)$/i.test(filePath);
452
+ const reExports = (0, import_resolver_1.extractReExports)(content, isJsFamily ? 'typescript' : language);
453
+ this.reExportCache.set(filePath, reExports);
454
+ return reExports;
455
+ },
456
+ getCppIncludeDirs: () => {
457
+ return (0, import_resolver_1.loadCppIncludeDirs)(this.projectRoot);
458
+ },
459
+ };
460
+ }
461
+ /**
462
+ * Resolve all unresolved references
463
+ */
464
+ resolveAll(unresolvedRefs, onProgress) {
465
+ // Pre-load all nodes into memory for fast lookups
466
+ this.warmCaches();
467
+ const resolved = [];
468
+ const unresolved = [];
469
+ const byMethod = {};
470
+ // Convert to our internal format, using denormalized fields when available
471
+ const refs = unresolvedRefs.map((ref) => ({
472
+ fromNodeId: ref.fromNodeId,
473
+ referenceName: ref.referenceName,
474
+ referenceKind: ref.referenceKind,
475
+ line: ref.line,
476
+ column: ref.column,
477
+ filePath: ref.filePath || this.getFilePathFromNodeId(ref.fromNodeId),
478
+ language: ref.language || this.getLanguageFromNodeId(ref.fromNodeId),
479
+ }));
480
+ const total = refs.length;
481
+ let lastReportedPercent = -1;
482
+ for (let i = 0; i < refs.length; i++) {
483
+ const ref = refs[i]; // Array index is guaranteed to be in bounds
484
+ const result = this.resolveOne(ref);
485
+ if (result) {
486
+ resolved.push(result);
487
+ byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
488
+ }
489
+ else {
490
+ unresolved.push(ref);
491
+ }
492
+ // Report progress every 1% to avoid too many updates
493
+ if (onProgress) {
494
+ const currentPercent = Math.floor((i / total) * 100);
495
+ if (currentPercent > lastReportedPercent) {
496
+ lastReportedPercent = currentPercent;
497
+ onProgress(i + 1, total);
498
+ }
499
+ }
500
+ }
501
+ // Final progress report
502
+ if (onProgress && total > 0) {
503
+ onProgress(total, total);
504
+ }
505
+ return {
506
+ resolved,
507
+ unresolved,
508
+ stats: {
509
+ total: refs.length,
510
+ resolved: resolved.length,
511
+ unresolved: unresolved.length,
512
+ byMethod,
513
+ },
514
+ };
515
+ }
516
+ /**
517
+ * Check if a reference name has any possible match in the codebase.
518
+ * Uses the pre-built knownNames set to skip expensive resolution
519
+ * for names that definitely don't exist as symbols.
520
+ */
521
+ hasAnyPossibleMatch(name) {
522
+ if (!this.knownNames)
523
+ return true; // no pre-filter available
524
+ // Direct name match
525
+ if (this.knownNames.has(name))
526
+ return true;
527
+ // For qualified names like "obj.method" or "Class::method", check the parts
528
+ const dotIdx = name.indexOf('.');
529
+ if (dotIdx > 0) {
530
+ const receiver = name.substring(0, dotIdx);
531
+ const member = name.substring(dotIdx + 1);
532
+ if (this.knownNames.has(receiver) || this.knownNames.has(member))
533
+ return true;
534
+ // Also check capitalized receiver (instance-method resolution)
535
+ const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
536
+ if (this.knownNames.has(capitalized))
537
+ return true;
538
+ // JVM FQN: `com.example.foo.Bar` — the only useful segment is the
539
+ // last one (`Bar`); the earlier check finds `example.foo.Bar` which
540
+ // never matches a node name.
541
+ const lastDot = name.lastIndexOf('.');
542
+ if (lastDot > dotIdx) {
543
+ const tail = name.substring(lastDot + 1);
544
+ if (tail && this.knownNames.has(tail))
545
+ return true;
546
+ }
547
+ }
548
+ const colonIdx = name.indexOf('::');
549
+ if (colonIdx > 0) {
550
+ const receiver = name.substring(0, colonIdx);
551
+ const member = name.substring(colonIdx + 2);
552
+ if (this.knownNames.has(receiver) || this.knownNames.has(member))
553
+ return true;
554
+ }
555
+ // For path-like references (e.g., "snippets/drawer-menu.liquid"), check the filename
556
+ const slashIdx = name.lastIndexOf('/');
557
+ if (slashIdx > 0) {
558
+ const fileName = name.substring(slashIdx + 1);
559
+ if (this.knownNames.has(fileName))
560
+ return true;
561
+ }
562
+ return false;
563
+ }
564
+ /**
565
+ * Does `ref.referenceName` match an import declared in its containing
566
+ * file? Used as a pre-filter escape so re-export chain resolution
567
+ * still gets a chance when the name has no project-wide declaration.
568
+ */
569
+ matchesAnyImport(ref) {
570
+ const imports = this.context.getImportMappings(ref.filePath, ref.language);
571
+ if (imports.length === 0)
572
+ return false;
573
+ for (const imp of imports) {
574
+ if (imp.localName === ref.referenceName ||
575
+ ref.referenceName.startsWith(imp.localName + '.')) {
576
+ return true;
577
+ }
578
+ }
579
+ return false;
580
+ }
581
+ /**
582
+ * Resolve a single reference
583
+ */
584
+ resolveOne(ref) {
585
+ // Skip built-in/external references
586
+ if (this.isBuiltInOrExternal(ref)) {
587
+ return null;
588
+ }
589
+ // Fast pre-filter: skip if no symbol with this name exists anywhere
590
+ // AND the name doesn't match a local import. The import escape is
591
+ // necessary because re-export rename chains (`import { login }
592
+ // from './barrel'` where the barrel has `export { signIn as login }
593
+ // from './auth'`) intentionally call a name that has no
594
+ // declaration anywhere — only the renamed upstream symbol does.
595
+ if (!this.hasAnyPossibleMatch(ref.referenceName) &&
596
+ !this.matchesAnyImport(ref) &&
597
+ !this.frameworks.some((f) => f.claimsReference?.(ref.referenceName))) {
598
+ return null;
599
+ }
600
+ // JVM FQN imports skip framework/name-matcher: `import com.example.Bar`
601
+ // resolves directly through the qualifiedName index, which is unambiguous
602
+ // even when several `Bar` classes exist in different packages.
603
+ const jvmImport = (0, import_resolver_1.resolveJvmImport)(ref, this.context);
604
+ if (jvmImport)
605
+ return jvmImport;
606
+ const candidates = [];
607
+ // Strategy 1: Try framework-specific resolution
608
+ for (const framework of this.frameworks) {
609
+ const result = framework.resolve(ref, this.context);
610
+ if (result) {
611
+ if (result.confidence >= 0.9)
612
+ return result; // High confidence, return immediately
613
+ candidates.push(result);
614
+ }
615
+ }
616
+ // Strategy 2: Try import-based resolution
617
+ const importResult = (0, import_resolver_1.resolveViaImport)(ref, this.context);
618
+ if (importResult) {
619
+ if (importResult.confidence >= 0.9)
620
+ return importResult;
621
+ candidates.push(importResult);
622
+ }
623
+ // Strategy 3: Try name matching
624
+ const nameResult = (0, name_matcher_1.matchReference)(ref, this.context);
625
+ if (nameResult) {
626
+ candidates.push(nameResult);
627
+ }
628
+ if (candidates.length === 0)
629
+ return null;
630
+ // Return highest confidence candidate
631
+ return candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
632
+ }
633
+ /**
634
+ * Create edges from resolved references
635
+ */
636
+ createEdges(resolved) {
637
+ return resolved.map((ref) => {
638
+ let kind = ref.original.referenceKind;
639
+ // Promote "extends" to "implements" when a class/struct targets an interface
640
+ if (kind === 'extends') {
641
+ const targetNode = this.queries.getNodeById(ref.targetNodeId);
642
+ if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
643
+ const sourceNode = this.queries.getNodeById(ref.original.fromNodeId);
644
+ if (sourceNode && sourceNode.kind !== 'interface' && sourceNode.kind !== 'protocol') {
645
+ kind = 'implements';
646
+ }
647
+ }
648
+ }
649
+ // Promote "calls" to "instantiates" when the resolved target is a
650
+ // class/struct. Languages without a `new` keyword (Python, Ruby)
651
+ // express instantiation as `Foo()` — extraction can't tell that
652
+ // apart from a function call without symbol info, but resolution
653
+ // can: if `Foo` resolves to a class, the call IS an instantiation.
654
+ if (kind === 'calls') {
655
+ const targetNode = this.queries.getNodeById(ref.targetNodeId);
656
+ if (targetNode && (targetNode.kind === 'class' || targetNode.kind === 'struct')) {
657
+ kind = 'instantiates';
658
+ }
659
+ }
660
+ return {
661
+ source: ref.original.fromNodeId,
662
+ target: ref.targetNodeId,
663
+ kind,
664
+ line: ref.original.line,
665
+ column: ref.original.column,
666
+ metadata: {
667
+ confidence: ref.confidence,
668
+ resolvedBy: ref.resolvedBy,
669
+ },
670
+ };
671
+ });
672
+ }
673
+ /**
674
+ * Resolve and persist edges to database
675
+ */
676
+ resolveAndPersist(unresolvedRefs, onProgress) {
677
+ const result = this.resolveAll(unresolvedRefs, onProgress);
678
+ // Create edges from resolved references
679
+ const edges = this.createEdges(result.resolved);
680
+ // Insert edges into database
681
+ if (edges.length > 0) {
682
+ this.queries.insertEdges(edges);
683
+ }
684
+ // Clean up resolved refs from unresolved_refs table so metrics are accurate
685
+ if (result.resolved.length > 0) {
686
+ this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
687
+ fromNodeId: r.original.fromNodeId,
688
+ referenceName: r.original.referenceName,
689
+ referenceKind: r.original.referenceKind,
690
+ })));
691
+ }
692
+ return result;
693
+ }
694
+ /**
695
+ * Resolve and persist in batches to keep memory bounded.
696
+ * Processes unresolved references in chunks, persisting edges and cleaning
697
+ * up resolved refs after each batch to avoid accumulating large arrays.
698
+ */
699
+ async resolveAndPersistBatched(onProgress, batchSize = 5000) {
700
+ this.warmCaches();
701
+ const total = this.queries.getUnresolvedReferencesCount();
702
+ let processed = 0;
703
+ const aggregateStats = {
704
+ total: 0,
705
+ resolved: 0,
706
+ unresolved: 0,
707
+ byMethod: {},
708
+ };
709
+ // Process in batches. We always read from offset 0 because resolved refs
710
+ // are deleted after each batch, shifting the remaining rows forward.
711
+ while (true) {
712
+ const batch = this.queries.getUnresolvedReferencesBatch(0, batchSize);
713
+ if (batch.length === 0)
714
+ break;
715
+ const result = this.resolveAll(batch);
716
+ // Persist edges immediately
717
+ const edges = this.createEdges(result.resolved);
718
+ if (edges.length > 0) {
719
+ this.queries.insertEdges(edges);
720
+ }
721
+ // Clean up resolved refs so they don't appear in the next batch
722
+ if (result.resolved.length > 0) {
723
+ this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
724
+ fromNodeId: r.original.fromNodeId,
725
+ referenceName: r.original.referenceName,
726
+ referenceKind: r.original.referenceKind,
727
+ })));
728
+ }
729
+ // Delete unresolvable refs from this batch to avoid re-processing them
730
+ if (result.unresolved.length > 0) {
731
+ this.queries.deleteSpecificResolvedReferences(result.unresolved.map((r) => ({
732
+ fromNodeId: r.fromNodeId,
733
+ referenceName: r.referenceName,
734
+ referenceKind: r.referenceKind,
735
+ })));
736
+ }
737
+ // Aggregate stats
738
+ aggregateStats.total += result.stats.total;
739
+ aggregateStats.resolved += result.stats.resolved;
740
+ aggregateStats.unresolved += result.stats.unresolved;
741
+ for (const [method, count] of Object.entries(result.stats.byMethod)) {
742
+ aggregateStats.byMethod[method] = (aggregateStats.byMethod[method] || 0) + count;
743
+ }
744
+ processed += batch.length;
745
+ onProgress?.(processed, total);
746
+ // Yield so progress UI can render between batches
747
+ await new Promise(resolve => setImmediate(resolve));
748
+ // If nothing was resolved or removed in this batch, we'd loop forever
749
+ // on the same rows. Break to avoid infinite loop.
750
+ if (result.resolved.length === 0 && result.unresolved.length === batch.length) {
751
+ break;
752
+ }
753
+ }
754
+ // Dynamic-edge synthesis: now that all base `calls` edges are persisted,
755
+ // synthesize observer/callback dispatch edges (dispatcher → registered
756
+ // callbacks) that static parsing leaves out. Best-effort — never fail the
757
+ // index on it. See docs/design/callback-edge-synthesis.md.
758
+ try {
759
+ aggregateStats.byMethod['callback-synthesis'] = (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context);
760
+ }
761
+ catch {
762
+ // synthesis is additive and optional; ignore failures
763
+ }
764
+ return {
765
+ resolved: [],
766
+ unresolved: [],
767
+ stats: aggregateStats,
768
+ };
769
+ }
770
+ /**
771
+ * Get detected frameworks
772
+ */
773
+ getDetectedFrameworks() {
774
+ return this.frameworks.map((f) => f.name);
775
+ }
776
+ /**
777
+ * Check if reference is to a built-in or external symbol
778
+ */
779
+ isBuiltInOrExternal(ref) {
780
+ const name = ref.referenceName;
781
+ const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
782
+ || ref.language === 'tsx' || ref.language === 'jsx';
783
+ // JavaScript/TypeScript built-ins
784
+ if (isJsTs && JS_BUILT_INS.has(name)) {
785
+ return true;
786
+ }
787
+ // Common JS/TS library calls (console.log, Math.floor, JSON.parse)
788
+ if (isJsTs && (name.startsWith('console.') || name.startsWith('Math.') || name.startsWith('JSON.'))) {
789
+ return true;
790
+ }
791
+ // React hooks from React itself
792
+ if (isJsTs && REACT_HOOKS.has(name)) {
793
+ return true;
794
+ }
795
+ // Python built-ins (bare calls only — dotted calls like console.print are method calls)
796
+ if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
797
+ return true;
798
+ }
799
+ // Python built-in method calls (e.g., list.extend, dict.update)
800
+ if (ref.language === 'python') {
801
+ const dotIdx = name.indexOf('.');
802
+ if (dotIdx > 0) {
803
+ const receiver = name.substring(0, dotIdx);
804
+ const method = name.substring(dotIdx + 1);
805
+ // Filter calls on built-in types (list.append, dict.update, etc.)
806
+ if (PYTHON_BUILT_IN_TYPES.has(receiver)) {
807
+ return true;
808
+ }
809
+ // Filter built-in methods on non-class receivers
810
+ // (e.g., items.append where items is a local list variable)
811
+ // But allow if the capitalized receiver matches a known codebase class
812
+ if (PYTHON_BUILT_IN_METHODS.has(method)) {
813
+ const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
814
+ if (!this.knownNames?.has(capitalized)) {
815
+ return true;
816
+ }
817
+ }
818
+ }
819
+ // A bare name colliding with a builtin method (index, get, update, count…)
820
+ // is only a builtin when NOTHING in the codebase declares it. A declared
821
+ // symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
822
+ // `def get()` — is a real reference target. Mirrors the knownNames guard on
823
+ // the dotted branch above; without it, every handler named after a builtin
824
+ // method silently loses its route→handler edge.
825
+ if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
826
+ return true;
827
+ }
828
+ }
829
+ // Go standard library packages — refs like "fmt.Println", "http.ListenAndServe", etc.
830
+ if (ref.language === 'go') {
831
+ const dotIdx = name.indexOf('.');
832
+ if (dotIdx > 0) {
833
+ const pkg = name.substring(0, dotIdx);
834
+ if (GO_STDLIB_PACKAGES.has(pkg)) {
835
+ return true;
836
+ }
837
+ }
838
+ if (GO_BUILT_INS.has(name)) {
839
+ return true;
840
+ }
841
+ }
842
+ // Pascal/Delphi built-ins and standard library units
843
+ if (ref.language === 'pascal') {
844
+ if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p))) {
845
+ return true;
846
+ }
847
+ if (PASCAL_BUILT_INS.has(name)) {
848
+ return true;
849
+ }
850
+ }
851
+ // C/C++ standard library symbols (printf, malloc, std::vector, etc.).
852
+ // Names that collide with user-defined symbols are NOT filtered —
853
+ // C and C++ projects routinely shadow stdlib names (custom allocators
854
+ // define `malloc`/`free`, stream wrappers define `read`/`write`/`open`,
855
+ // containers define `move`/`swap`, logging libs wrap `printf`). Killing
856
+ // those resolutions makes the graph wrong, not cleaner. We only filter
857
+ // when there's no user node with this name — then name-matching would
858
+ // produce zero edges anyway and the filter just short-circuits work.
859
+ if (ref.language === 'c' || ref.language === 'cpp') {
860
+ // C++ std:: namespace prefix — safe to filter unconditionally,
861
+ // since `std::foo` is never a user-defined qualified name in
862
+ // tree-sitter output.
863
+ if (name.startsWith('std::'))
864
+ return true;
865
+ if (C_BUILT_INS.has(name) || CPP_BUILT_INS.has(name)) {
866
+ return !this.hasAnyPossibleMatch(name);
867
+ }
868
+ }
869
+ return false;
870
+ }
871
+ /**
872
+ * Get file path from node ID
873
+ */
874
+ getFilePathFromNodeId(nodeId) {
875
+ const node = this.queries.getNodeById(nodeId);
876
+ return node?.filePath || '';
877
+ }
878
+ /**
879
+ * Get language from node ID
880
+ */
881
+ getLanguageFromNodeId(nodeId) {
882
+ const node = this.queries.getNodeById(nodeId);
883
+ return node?.language || 'unknown';
884
+ }
885
+ }
886
+ exports.ReferenceResolver = ReferenceResolver;
887
+ /**
888
+ * Create a reference resolver instance
889
+ */
890
+ function createResolver(projectRoot, queries) {
891
+ const resolver = new ReferenceResolver(projectRoot, queries);
892
+ resolver.initialize();
893
+ return resolver;
894
+ }
895
+ //# sourceMappingURL=index.js.map