@vpxa/kb 0.1.12 → 0.1.15

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 (383) hide show
  1. package/README.md +56 -39
  2. package/package.json +10 -7
  3. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -20
  4. package/packages/analyzers/dist/blast-radius-analyzer.js +6 -12
  5. package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -27
  6. package/packages/analyzers/dist/dependency-analyzer.js +7 -9
  7. package/packages/analyzers/dist/diagram-generator.d.ts +12 -8
  8. package/packages/analyzers/dist/diagram-generator.js +3 -4
  9. package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -17
  10. package/packages/analyzers/dist/entry-point-analyzer.js +5 -5
  11. package/packages/analyzers/dist/index.d.ts +12 -14
  12. package/packages/analyzers/dist/index.js +1 -1
  13. package/packages/analyzers/dist/knowledge-producer.d.ts +29 -25
  14. package/packages/analyzers/dist/knowledge-producer.js +16 -15
  15. package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -10
  16. package/packages/analyzers/dist/pattern-analyzer.js +3 -5
  17. package/packages/analyzers/dist/regex-call-graph.d.ts +6 -12
  18. package/packages/analyzers/dist/regex-call-graph.js +2 -1
  19. package/packages/analyzers/dist/structure-analyzer.d.ts +13 -9
  20. package/packages/analyzers/dist/structure-analyzer.js +3 -4
  21. package/packages/analyzers/dist/symbol-analyzer.d.ts +12 -8
  22. package/packages/analyzers/dist/symbol-analyzer.js +8 -13
  23. package/packages/analyzers/dist/ts-call-graph.d.ts +16 -13
  24. package/packages/analyzers/dist/ts-call-graph.js +2 -1
  25. package/packages/analyzers/dist/types.d.ts +82 -79
  26. package/packages/analyzers/dist/types.js +1 -0
  27. package/packages/chunker/dist/call-graph-extractor.d.ts +13 -10
  28. package/packages/chunker/dist/call-graph-extractor.js +2 -1
  29. package/packages/chunker/dist/chunker-factory.d.ts +6 -2
  30. package/packages/chunker/dist/chunker-factory.js +2 -1
  31. package/packages/chunker/dist/chunker.interface.d.ts +8 -4
  32. package/packages/chunker/dist/chunker.interface.js +1 -0
  33. package/packages/chunker/dist/code-chunker.d.ts +16 -12
  34. package/packages/chunker/dist/code-chunker.js +12 -14
  35. package/packages/chunker/dist/generic-chunker.d.ts +14 -10
  36. package/packages/chunker/dist/generic-chunker.js +6 -5
  37. package/packages/chunker/dist/index.d.ts +8 -8
  38. package/packages/chunker/dist/index.js +1 -1
  39. package/packages/chunker/dist/markdown-chunker.d.ts +16 -12
  40. package/packages/chunker/dist/markdown-chunker.js +4 -10
  41. package/packages/chunker/dist/treesitter-chunker.d.ts +28 -31
  42. package/packages/chunker/dist/treesitter-chunker.js +7 -8
  43. package/packages/cli/dist/commands/analyze.d.ts +6 -2
  44. package/packages/cli/dist/commands/analyze.js +3 -3
  45. package/packages/cli/dist/commands/context-cmds.d.ts +6 -2
  46. package/packages/cli/dist/commands/context-cmds.js +2 -1
  47. package/packages/cli/dist/commands/environment.d.ts +6 -2
  48. package/packages/cli/dist/commands/environment.js +2 -2
  49. package/packages/cli/dist/commands/execution.d.ts +6 -2
  50. package/packages/cli/dist/commands/execution.js +2 -1
  51. package/packages/cli/dist/commands/graph.d.ts +6 -2
  52. package/packages/cli/dist/commands/graph.js +6 -6
  53. package/packages/cli/dist/commands/init/adapters.d.ts +27 -0
  54. package/packages/cli/dist/commands/init/adapters.js +2 -0
  55. package/packages/cli/dist/commands/init/config.d.ts +11 -0
  56. package/packages/cli/dist/commands/init/config.js +4 -0
  57. package/packages/cli/dist/commands/init/curated.d.ts +8 -0
  58. package/packages/cli/dist/commands/init/curated.js +2 -0
  59. package/packages/cli/dist/commands/init/index.d.ts +23 -0
  60. package/packages/cli/dist/commands/init/index.js +3 -0
  61. package/packages/cli/dist/commands/init/scaffold.d.ts +24 -0
  62. package/packages/cli/dist/commands/init/scaffold.js +2 -0
  63. package/packages/cli/dist/commands/init/templates.d.ts +10 -0
  64. package/packages/cli/dist/commands/init/templates.js +302 -0
  65. package/packages/cli/dist/commands/init.d.ts +9 -3
  66. package/packages/cli/dist/commands/init.js +253 -197
  67. package/packages/cli/dist/commands/knowledge.d.ts +6 -2
  68. package/packages/cli/dist/commands/knowledge.js +2 -1
  69. package/packages/cli/dist/commands/search.d.ts +6 -2
  70. package/packages/cli/dist/commands/search.js +2 -8
  71. package/packages/cli/dist/commands/system.d.ts +6 -2
  72. package/packages/cli/dist/commands/system.js +5 -4
  73. package/packages/cli/dist/commands/workspace.d.ts +6 -2
  74. package/packages/cli/dist/commands/workspace.js +2 -2
  75. package/packages/cli/dist/context.d.ts +7 -4
  76. package/packages/cli/dist/context.js +2 -1
  77. package/packages/cli/dist/helpers.d.ts +51 -47
  78. package/packages/cli/dist/helpers.js +6 -3
  79. package/packages/cli/dist/index.d.ts +4 -1
  80. package/packages/cli/dist/index.js +3 -2
  81. package/packages/cli/dist/kb-init.d.ts +48 -50
  82. package/packages/cli/dist/kb-init.js +2 -1
  83. package/packages/cli/dist/types.d.ts +8 -5
  84. package/packages/cli/dist/types.js +1 -0
  85. package/packages/core/dist/constants.d.ts +36 -33
  86. package/packages/core/dist/constants.js +2 -1
  87. package/packages/core/dist/content-detector.d.ts +10 -5
  88. package/packages/core/dist/content-detector.js +2 -1
  89. package/packages/core/dist/errors.d.ts +15 -12
  90. package/packages/core/dist/errors.js +2 -1
  91. package/packages/core/dist/index.d.ts +6 -6
  92. package/packages/core/dist/index.js +1 -1
  93. package/packages/core/dist/logger.d.ts +16 -7
  94. package/packages/core/dist/logger.js +2 -1
  95. package/packages/core/dist/types.d.ts +108 -90
  96. package/packages/core/dist/types.js +2 -0
  97. package/packages/embeddings/dist/embedder.interface.d.ts +22 -19
  98. package/packages/embeddings/dist/embedder.interface.js +1 -0
  99. package/packages/embeddings/dist/index.d.ts +3 -3
  100. package/packages/embeddings/dist/index.js +1 -1
  101. package/packages/embeddings/dist/onnx-embedder.d.ts +21 -22
  102. package/packages/embeddings/dist/onnx-embedder.js +2 -1
  103. package/packages/enterprise-bridge/dist/cache.d.ts +29 -0
  104. package/packages/enterprise-bridge/dist/cache.js +2 -0
  105. package/packages/enterprise-bridge/dist/er-client.d.ts +38 -0
  106. package/packages/enterprise-bridge/dist/er-client.js +2 -0
  107. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +63 -0
  108. package/packages/enterprise-bridge/dist/evolution-collector.js +2 -0
  109. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  110. package/packages/enterprise-bridge/dist/index.js +1 -0
  111. package/packages/enterprise-bridge/dist/policy-store.d.ts +46 -0
  112. package/packages/enterprise-bridge/dist/policy-store.js +2 -0
  113. package/packages/enterprise-bridge/dist/push-adapter.d.ts +24 -0
  114. package/packages/enterprise-bridge/dist/push-adapter.js +2 -0
  115. package/packages/enterprise-bridge/dist/result-merger.d.ts +15 -0
  116. package/packages/enterprise-bridge/dist/result-merger.js +2 -0
  117. package/packages/enterprise-bridge/dist/types.d.ts +82 -0
  118. package/packages/enterprise-bridge/dist/types.js +2 -0
  119. package/packages/indexer/dist/file-hasher.d.ts +5 -2
  120. package/packages/indexer/dist/file-hasher.js +2 -1
  121. package/packages/indexer/dist/filesystem-crawler.d.ts +23 -20
  122. package/packages/indexer/dist/filesystem-crawler.js +2 -1
  123. package/packages/indexer/dist/graph-extractor.d.ts +9 -12
  124. package/packages/indexer/dist/graph-extractor.js +2 -1
  125. package/packages/indexer/dist/incremental-indexer.d.ts +49 -43
  126. package/packages/indexer/dist/incremental-indexer.js +2 -1
  127. package/packages/indexer/dist/index.d.ts +5 -5
  128. package/packages/indexer/dist/index.js +1 -1
  129. package/packages/server/dist/api.d.ts +3 -8
  130. package/packages/server/dist/api.js +1 -1
  131. package/packages/server/dist/config.d.ts +6 -2
  132. package/packages/server/dist/config.js +2 -1
  133. package/packages/server/dist/curated-manager.d.ts +79 -76
  134. package/packages/server/dist/curated-manager.js +6 -10
  135. package/packages/server/dist/index.d.ts +1 -2
  136. package/packages/server/dist/index.js +2 -1
  137. package/packages/server/dist/replay-interceptor.d.ts +6 -6
  138. package/packages/server/dist/replay-interceptor.js +2 -1
  139. package/packages/server/dist/resources/resources.d.ts +7 -3
  140. package/packages/server/dist/resources/resources.js +3 -2
  141. package/packages/server/dist/server.d.ts +34 -24
  142. package/packages/server/dist/server.js +2 -1
  143. package/packages/server/dist/tools/analyze.tools.d.ts +14 -10
  144. package/packages/server/dist/tools/analyze.tools.js +2 -1
  145. package/packages/server/dist/tools/audit.tool.d.ts +9 -0
  146. package/packages/server/dist/tools/audit.tool.js +2 -0
  147. package/packages/server/dist/tools/bridge.tools.d.ts +35 -0
  148. package/packages/server/dist/tools/bridge.tools.js +16 -0
  149. package/packages/server/dist/tools/evolution.tools.d.ts +8 -0
  150. package/packages/server/dist/tools/evolution.tools.js +6 -0
  151. package/packages/server/dist/tools/forge.tools.d.ts +13 -11
  152. package/packages/server/dist/tools/forge.tools.js +11 -13
  153. package/packages/server/dist/tools/forget.tool.d.ts +7 -3
  154. package/packages/server/dist/tools/forget.tool.js +2 -7
  155. package/packages/server/dist/tools/graph.tool.d.ts +7 -3
  156. package/packages/server/dist/tools/graph.tool.js +5 -5
  157. package/packages/server/dist/tools/list.tool.d.ts +7 -3
  158. package/packages/server/dist/tools/list.tool.js +3 -8
  159. package/packages/server/dist/tools/lookup.tool.d.ts +7 -3
  160. package/packages/server/dist/tools/lookup.tool.js +3 -9
  161. package/packages/server/dist/tools/onboard.tool.d.ts +8 -4
  162. package/packages/server/dist/tools/onboard.tool.js +3 -2
  163. package/packages/server/dist/tools/policy.tools.d.ts +8 -0
  164. package/packages/server/dist/tools/policy.tools.js +3 -0
  165. package/packages/server/dist/tools/produce.tool.d.ts +6 -2
  166. package/packages/server/dist/tools/produce.tool.js +3 -2
  167. package/packages/server/dist/tools/read.tool.d.ts +7 -3
  168. package/packages/server/dist/tools/read.tool.js +3 -6
  169. package/packages/server/dist/tools/reindex.tool.d.ts +10 -6
  170. package/packages/server/dist/tools/reindex.tool.js +3 -2
  171. package/packages/server/dist/tools/remember.tool.d.ts +8 -3
  172. package/packages/server/dist/tools/remember.tool.js +4 -5
  173. package/packages/server/dist/tools/replay.tool.d.ts +6 -2
  174. package/packages/server/dist/tools/replay.tool.js +3 -6
  175. package/packages/server/dist/tools/search.tool.d.ts +10 -4
  176. package/packages/server/dist/tools/search.tool.js +7 -18
  177. package/packages/server/dist/tools/status.tool.d.ts +7 -3
  178. package/packages/server/dist/tools/status.tool.js +3 -3
  179. package/packages/server/dist/tools/toolkit.tools.d.ts +36 -34
  180. package/packages/server/dist/tools/toolkit.tools.js +20 -21
  181. package/packages/server/dist/tools/update.tool.d.ts +7 -3
  182. package/packages/server/dist/tools/update.tool.js +2 -6
  183. package/packages/server/dist/tools/utility.tools.d.ts +15 -14
  184. package/packages/server/dist/tools/utility.tools.js +11 -23
  185. package/packages/server/dist/version-check.d.ts +5 -1
  186. package/packages/server/dist/version-check.js +2 -1
  187. package/packages/store/dist/graph-store.interface.d.ts +89 -86
  188. package/packages/store/dist/graph-store.interface.js +1 -0
  189. package/packages/store/dist/index.d.ts +6 -6
  190. package/packages/store/dist/index.js +1 -1
  191. package/packages/store/dist/lance-store.d.ts +37 -30
  192. package/packages/store/dist/lance-store.js +2 -1
  193. package/packages/store/dist/sqlite-graph-store.d.ts +43 -46
  194. package/packages/store/dist/sqlite-graph-store.js +14 -13
  195. package/packages/store/dist/store-factory.d.ts +11 -7
  196. package/packages/store/dist/store-factory.js +2 -1
  197. package/packages/store/dist/store.interface.d.ts +47 -44
  198. package/packages/store/dist/store.interface.js +1 -0
  199. package/packages/tools/dist/audit.d.ts +66 -0
  200. package/packages/tools/dist/audit.js +7 -0
  201. package/packages/tools/dist/batch.d.ts +20 -17
  202. package/packages/tools/dist/batch.js +2 -1
  203. package/packages/tools/dist/changelog.d.ts +29 -26
  204. package/packages/tools/dist/changelog.js +3 -2
  205. package/packages/tools/dist/check.d.ts +45 -22
  206. package/packages/tools/dist/check.js +3 -2
  207. package/packages/tools/dist/checkpoint.d.ts +17 -14
  208. package/packages/tools/dist/checkpoint.js +2 -2
  209. package/packages/tools/dist/codemod.d.ts +35 -32
  210. package/packages/tools/dist/codemod.js +3 -2
  211. package/packages/tools/dist/compact.d.ts +34 -35
  212. package/packages/tools/dist/compact.js +3 -2
  213. package/packages/tools/dist/data-transform.d.ts +10 -7
  214. package/packages/tools/dist/data-transform.js +2 -1
  215. package/packages/tools/dist/dead-symbols.d.ts +29 -17
  216. package/packages/tools/dist/dead-symbols.js +3 -2
  217. package/packages/tools/dist/delegate.d.ts +26 -23
  218. package/packages/tools/dist/delegate.js +2 -5
  219. package/packages/tools/dist/diff-parse.d.ts +24 -21
  220. package/packages/tools/dist/diff-parse.js +4 -3
  221. package/packages/tools/dist/digest.d.ts +43 -45
  222. package/packages/tools/dist/digest.js +5 -5
  223. package/packages/tools/dist/encode.d.ts +11 -8
  224. package/packages/tools/dist/encode.js +2 -1
  225. package/packages/tools/dist/env-info.d.ts +25 -22
  226. package/packages/tools/dist/env-info.js +2 -1
  227. package/packages/tools/dist/eval.d.ts +13 -10
  228. package/packages/tools/dist/eval.js +3 -3
  229. package/packages/tools/dist/evidence-map.d.ts +64 -61
  230. package/packages/tools/dist/evidence-map.js +3 -3
  231. package/packages/tools/dist/file-cache.d.ts +42 -0
  232. package/packages/tools/dist/file-cache.js +4 -0
  233. package/packages/tools/dist/file-summary.d.ts +34 -29
  234. package/packages/tools/dist/file-summary.js +3 -2
  235. package/packages/tools/dist/file-walk.d.ts +6 -3
  236. package/packages/tools/dist/file-walk.js +2 -1
  237. package/packages/tools/dist/find-examples.d.ts +26 -21
  238. package/packages/tools/dist/find-examples.js +4 -3
  239. package/packages/tools/dist/find.d.ts +39 -40
  240. package/packages/tools/dist/find.js +2 -1
  241. package/packages/tools/dist/forge-classify.d.ts +35 -38
  242. package/packages/tools/dist/forge-classify.js +3 -2
  243. package/packages/tools/dist/forge-ground.d.ts +58 -60
  244. package/packages/tools/dist/forge-ground.js +2 -1
  245. package/packages/tools/dist/git-context.d.ts +22 -19
  246. package/packages/tools/dist/git-context.js +4 -3
  247. package/packages/tools/dist/graph-query.d.ts +75 -78
  248. package/packages/tools/dist/graph-query.js +2 -1
  249. package/packages/tools/dist/guide.d.ts +26 -0
  250. package/packages/tools/dist/guide.js +2 -0
  251. package/packages/tools/dist/health.d.ts +13 -10
  252. package/packages/tools/dist/health.js +3 -1
  253. package/packages/tools/dist/http-request.d.ts +20 -17
  254. package/packages/tools/dist/http-request.js +2 -1
  255. package/packages/tools/dist/index.d.ts +54 -49
  256. package/packages/tools/dist/index.js +1 -1
  257. package/packages/tools/dist/lane.d.ts +28 -25
  258. package/packages/tools/dist/lane.js +7 -7
  259. package/packages/tools/dist/measure.d.ts +32 -29
  260. package/packages/tools/dist/measure.js +3 -2
  261. package/packages/tools/dist/onboard.d.ts +29 -26
  262. package/packages/tools/dist/onboard.js +18 -41
  263. package/packages/tools/dist/parse-output.d.ts +48 -45
  264. package/packages/tools/dist/parse-output.js +3 -2
  265. package/packages/tools/dist/path-resolver.d.ts +15 -0
  266. package/packages/tools/dist/path-resolver.js +2 -0
  267. package/packages/tools/dist/process-manager.d.ts +18 -15
  268. package/packages/tools/dist/process-manager.js +2 -1
  269. package/packages/tools/dist/queue.d.ts +28 -25
  270. package/packages/tools/dist/queue.js +2 -2
  271. package/packages/tools/dist/regex-test.d.ts +26 -23
  272. package/packages/tools/dist/regex-test.js +2 -1
  273. package/packages/tools/dist/rename.d.ts +28 -25
  274. package/packages/tools/dist/rename.js +3 -2
  275. package/packages/tools/dist/replay.d.ts +33 -30
  276. package/packages/tools/dist/replay.js +5 -6
  277. package/packages/tools/dist/response-envelope.d.ts +44 -0
  278. package/packages/tools/dist/response-envelope.js +2 -0
  279. package/packages/tools/dist/schema-validate.d.ts +15 -12
  280. package/packages/tools/dist/schema-validate.js +2 -1
  281. package/packages/tools/dist/scope-map.d.ts +45 -45
  282. package/packages/tools/dist/scope-map.js +2 -1
  283. package/packages/tools/dist/snippet.d.ts +26 -24
  284. package/packages/tools/dist/snippet.js +2 -1
  285. package/packages/tools/dist/stash.d.ts +13 -10
  286. package/packages/tools/dist/stash.js +2 -2
  287. package/packages/tools/dist/stratum-card.d.ts +27 -27
  288. package/packages/tools/dist/stratum-card.js +4 -5
  289. package/packages/tools/dist/symbol.d.ts +29 -25
  290. package/packages/tools/dist/symbol.js +4 -3
  291. package/packages/tools/dist/test-run.d.ts +19 -15
  292. package/packages/tools/dist/test-run.js +3 -2
  293. package/packages/tools/dist/text-utils.d.ts +6 -3
  294. package/packages/tools/dist/text-utils.js +3 -2
  295. package/packages/tools/dist/time-utils.d.ts +15 -12
  296. package/packages/tools/dist/time-utils.js +2 -1
  297. package/packages/tools/dist/trace.d.ts +24 -20
  298. package/packages/tools/dist/trace.js +3 -2
  299. package/packages/tools/dist/truncation.d.ts +14 -2
  300. package/packages/tools/dist/truncation.js +8 -14
  301. package/packages/tools/dist/watch.d.ts +28 -25
  302. package/packages/tools/dist/watch.js +2 -1
  303. package/packages/tools/dist/web-fetch.d.ts +35 -32
  304. package/packages/tools/dist/web-fetch.js +7 -12
  305. package/packages/tools/dist/web-search.d.ts +16 -13
  306. package/packages/tools/dist/web-search.js +2 -1
  307. package/packages/tools/dist/workset.d.ts +19 -16
  308. package/packages/tools/dist/workset.js +2 -2
  309. package/packages/tui/dist/App-BAlmxCCw.js +3 -0
  310. package/packages/tui/dist/App.d.ts +11 -5
  311. package/packages/tui/dist/App.js +1 -450
  312. package/packages/tui/dist/CuratedPanel-sYdZAICX.js +3 -0
  313. package/packages/tui/dist/LogPanel-DVB8Sv46.js +4 -0
  314. package/packages/tui/dist/SearchPanel-DREo6zgt.js +3 -0
  315. package/packages/tui/dist/StatusPanel-2ex8fLOO.js +3 -0
  316. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  317. package/packages/tui/dist/devtools-DUyj952l.js +8 -0
  318. package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +29 -0
  319. package/packages/tui/dist/index-B9VpfVPP.d.ts +14 -0
  320. package/packages/tui/dist/index.d.ts +3 -19
  321. package/packages/tui/dist/index.js +2 -476
  322. package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +317 -0
  323. package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -5
  324. package/packages/tui/dist/panels/CuratedPanel.js +1 -371
  325. package/packages/tui/dist/panels/LogPanel.d.ts +7 -2
  326. package/packages/tui/dist/panels/LogPanel.js +1 -449
  327. package/packages/tui/dist/panels/SearchPanel.d.ts +14 -7
  328. package/packages/tui/dist/panels/SearchPanel.js +1 -372
  329. package/packages/tui/dist/panels/StatusPanel.d.ts +11 -5
  330. package/packages/tui/dist/panels/StatusPanel.js +1 -371
  331. package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +151 -0
  332. package/scaffold/adapters/claude-code.mjs +20 -0
  333. package/scaffold/adapters/copilot.mjs +320 -0
  334. package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +14 -0
  335. package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +14 -0
  336. package/scaffold/copilot/agents/Code-Reviewer-Alpha.agent.md +12 -0
  337. package/scaffold/copilot/agents/Code-Reviewer-Beta.agent.md +12 -0
  338. package/scaffold/copilot/agents/Debugger.agent.md +31 -0
  339. package/scaffold/copilot/agents/Documenter.agent.md +35 -0
  340. package/scaffold/copilot/agents/Explorer.agent.md +50 -0
  341. package/scaffold/copilot/agents/Frontend.agent.md +29 -0
  342. package/scaffold/copilot/agents/Implementer.agent.md +31 -0
  343. package/scaffold/copilot/agents/Orchestrator.agent.md +96 -0
  344. package/scaffold/copilot/agents/Planner.agent.md +45 -0
  345. package/scaffold/copilot/agents/README.md +57 -0
  346. package/scaffold/copilot/agents/Refactor.agent.md +30 -0
  347. package/scaffold/copilot/agents/Researcher-Alpha.agent.md +12 -0
  348. package/scaffold/copilot/agents/Researcher-Beta.agent.md +12 -0
  349. package/scaffold/copilot/agents/Researcher-Delta.agent.md +12 -0
  350. package/scaffold/copilot/agents/Researcher-Gamma.agent.md +12 -0
  351. package/scaffold/copilot/agents/Security.agent.md +42 -0
  352. package/scaffold/copilot/agents/_shared/adr-protocol.md +91 -0
  353. package/scaffold/copilot/agents/_shared/architect-reviewer-base.md +50 -0
  354. package/scaffold/copilot/agents/_shared/code-agent-base.md +70 -0
  355. package/scaffold/copilot/agents/_shared/code-reviewer-base.md +54 -0
  356. package/scaffold/copilot/agents/_shared/decision-protocol.md +27 -0
  357. package/scaffold/copilot/agents/_shared/forge-protocol.md +46 -0
  358. package/scaffold/copilot/agents/_shared/researcher-base.md +61 -0
  359. package/scaffold/copilot/agents/templates/adr-template.md +27 -0
  360. package/scaffold/copilot/agents/templates/execution-state.md +25 -0
  361. package/scaffold/copilot/prompts/ask.prompt.md +20 -0
  362. package/scaffold/copilot/prompts/debug.prompt.md +25 -0
  363. package/scaffold/copilot/prompts/design.prompt.md +22 -0
  364. package/scaffold/copilot/prompts/implement.prompt.md +26 -0
  365. package/scaffold/copilot/prompts/plan.prompt.md +24 -0
  366. package/scaffold/copilot/prompts/review.prompt.md +31 -0
  367. package/scaffold/definitions/agents.mjs +165 -0
  368. package/scaffold/definitions/bodies.mjs +292 -0
  369. package/scaffold/definitions/hooks.mjs +43 -0
  370. package/scaffold/definitions/models.mjs +56 -0
  371. package/scaffold/definitions/plugins.mjs +24 -0
  372. package/scaffold/definitions/prompts.mjs +145 -0
  373. package/scaffold/definitions/protocols.mjs +322 -0
  374. package/scaffold/definitions/tools.mjs +176 -0
  375. package/scaffold/generate.mjs +74 -0
  376. package/skills/brainstorming/SKILL.md +259 -0
  377. package/skills/brainstorming/scripts/frame-template.html +365 -0
  378. package/skills/brainstorming/scripts/helper.js +216 -0
  379. package/skills/brainstorming/scripts/server.cjs +9 -0
  380. package/skills/brainstorming/scripts/server.src.cjs +249 -0
  381. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  382. package/skills/brainstorming/visual-companion.md +430 -0
  383. package/skills/knowledge-base/SKILL.md +34 -21
@@ -1,13 +1,8 @@
1
- import{readdir as S,readFile as A}from"node:fs/promises";import{extname as y,join as T,relative as P}from"node:path";const v=new Set([".ts",".tsx",".js",".jsx",".java",".py",".go",".cs",".rb",".kt",".scala",".rs",".php",".swift"]),E=new Set(["node_modules",".git","dist","build","coverage",".turbo",".cache","cdk.out","__pycache__",".venv","target","bin","obj",".gradle","venv","env"]),b={exported:[{pattern:/^export\s+(?:async\s+)?function\s+(\w+)/gm,kind:"function"},{pattern:/^export\s+(?:default\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^export\s+interface\s+(\w+)/gm,kind:"interface"},{pattern:/^export\s+type\s+(\w+)/gm,kind:"type"},{pattern:/^export\s+(?:const|let)\s+(\w+)/gm,kind:"const"},{pattern:/^export\s+enum\s+(\w+)/gm,kind:"enum"}],local:[{pattern:/^(?:async\s+)?function\s+(\w+)/gm,kind:"function"},{pattern:/^class\s+(\w+)/gm,kind:"class"},{pattern:/^interface\s+(\w+)/gm,kind:"interface"},{pattern:/^type\s+(\w+)/gm,kind:"type"},{pattern:/^(?:const|let)\s+(\w+)\s*=/gm,kind:"const"},{pattern:/^enum\s+(\w+)/gm,kind:"enum"}]},I={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:"interface"},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:"enum"},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:abstract\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:"function"}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:"function"},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*[;=]/gm,kind:"variable"}],skipIndentFilter:!0},R={exported:[{pattern:/^def\s+(\w+)\s*\(/gm,kind:"function"},{pattern:/^async\s+def\s+(\w+)\s*\(/gm,kind:"function"},{pattern:/^class\s+(\w+)/gm,kind:"class"}],local:[{pattern:/^[ \t]+def\s+(\w+)\s*\(/gm,kind:"function"},{pattern:/^[ \t]+async\s+def\s+(\w+)\s*\(/gm,kind:"function"}],skipIndentFilter:!0},_={exported:[{pattern:/^func\s+([A-Z]\w*)\s*\(/gm,kind:"function"},{pattern:/^func\s+\([^)]+\)\s+([A-Z]\w*)\s*\(/gm,kind:"function"},{pattern:/^type\s+([A-Z]\w*)\s+struct\b/gm,kind:"class"},{pattern:/^type\s+([A-Z]\w*)\s+interface\b/gm,kind:"interface"},{pattern:/^type\s+([A-Z]\w*)\s+/gm,kind:"type"}],local:[{pattern:/^func\s+([a-z]\w*)\s*\(/gm,kind:"function"},{pattern:/^func\s+\([^)]+\)\s+([a-z]\w*)\s*\(/gm,kind:"function"},{pattern:/^type\s+([a-z]\w*)\s+struct\b/gm,kind:"class"},{pattern:/^type\s+([a-z]\w*)\s+/gm,kind:"type"}],skipIndentFilter:!0},F={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:partial\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:"interface"},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:"enum"},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:virtual\s+)?(?:override\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])?)\s+(\w+)\s*\(/gm,kind:"function"}],local:[{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*\(/gm,kind:"function"}],skipIndentFilter:!0},L={exported:[{pattern:/^(?:open\s+|data\s+|sealed\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^(?:fun|suspend\s+fun)\s+(\w+)\s*[(<]/gm,kind:"function"},{pattern:/^interface\s+(\w+)/gm,kind:"interface"},{pattern:/^object\s+(\w+)/gm,kind:"class"},{pattern:/^enum\s+class\s+(\w+)/gm,kind:"enum"}],local:[{pattern:/^[ \t]+(?:private|internal)\s+(?:fun|suspend\s+fun)\s+(\w+)/gm,kind:"function"},{pattern:/^[ \t]+(?:private|internal)\s+(?:val|var)\s+(\w+)/gm,kind:"variable"}],skipIndentFilter:!0},j={exported:[{pattern:/^class\s+(\w+)/gm,kind:"class"},{pattern:/^module\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]+def\s+self\.(\w+)/gm,kind:"function"}],local:[{pattern:/^[ \t]+def\s+(\w+)/gm,kind:"function"}],skipIndentFilter:!0},$={exported:[{pattern:/^pub\s+(?:async\s+)?fn\s+(\w+)/gm,kind:"function"},{pattern:/^pub\s+struct\s+(\w+)/gm,kind:"class"},{pattern:/^pub\s+trait\s+(\w+)/gm,kind:"interface"},{pattern:/^pub\s+enum\s+(\w+)/gm,kind:"enum"},{pattern:/^pub\s+type\s+(\w+)/gm,kind:"type"}],local:[{pattern:/^(?:async\s+)?fn\s+(\w+)/gm,kind:"function"},{pattern:/^struct\s+(\w+)/gm,kind:"class"},{pattern:/^trait\s+(\w+)/gm,kind:"interface"},{pattern:/^enum\s+(\w+)/gm,kind:"enum"}],skipIndentFilter:!0},O={exported:[{pattern:/^[ \t]*(?:abstract\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*interface\s+(\w+)/gm,kind:"interface"},{pattern:/^[ \t]*public\s+(?:static\s+)?function\s+(\w+)/gm,kind:"function"},{pattern:/^function\s+(\w+)\s*\(/gm,kind:"function"}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?function\s+(\w+)/gm,kind:"function"}],skipIndentFilter:!0},N={exported:[{pattern:/^[ \t]*(?:open|public)\s+class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*(?:open|public)\s+struct\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*(?:open|public)\s+protocol\s+(\w+)/gm,kind:"interface"},{pattern:/^[ \t]*(?:open|public)\s+enum\s+(\w+)/gm,kind:"enum"},{pattern:/^[ \t]*(?:open|public)\s+func\s+(\w+)/gm,kind:"function"}],local:[{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+func\s+(\w+)/gm,kind:"function"},{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+class\s+(\w+)/gm,kind:"class"}],skipIndentFilter:!0},z={exported:[{pattern:/^[ \t]*(?:case\s+)?class\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*object\s+(\w+)/gm,kind:"class"},{pattern:/^[ \t]*trait\s+(\w+)/gm,kind:"interface"},{pattern:/^[ \t]*def\s+(\w+)/gm,kind:"function"}],local:[],skipIndentFilter:!0};function C(k){switch(k){case".ts":case".tsx":case".js":case".jsx":return b;case".java":return I;case".py":return R;case".go":return _;case".cs":return F;case".kt":return L;case".rb":return j;case".rs":return $;case".php":return O;case".swift":return N;case".scala":return z;default:return b}}function h(k,s){let r="",e=0,c=!1;for(let o=s;o<Math.min(s+5,k.length);o++){const i=k[o].trim();r+=(r?" ":"")+i;for(const n of i)n==="("&&(e++,c=!0),n===")"&&e--;if(c&&e<=0)return r.replace(/\s*\{.*$/,"").replace(/\s*:\s*$/,"").trim()}return r.trim()||void 0}class U{name="symbols";async analyze(s,r={}){const{format:e="markdown",filter:c}=r,o=Date.now(),i=await this.collectFiles(s);let n=[];for(const a of i){const d=await A(a,"utf-8"),t=this.extractSymbols(d,P(s,a).replace(/\\/g,"/"));n.push(...t)}if(c){const a=c.toLowerCase();n=n.filter(d=>d.name.toLowerCase().includes(a))}return{output:e==="json"?JSON.stringify(n,null,2):this.formatMarkdown(n,s),data:{symbols:n,byKind:this.groupByKind(n),exportedCount:n.filter(a=>a.exported).length,totalCount:n.length},meta:{analyzedAt:new Date().toISOString(),scope:s,fileCount:i.length,durationMs:Date.now()-o}}}async collectFiles(s){const r=[],e=async c=>{const o=await S(c,{withFileTypes:!0});for(const i of o){if(E.has(i.name)||i.name.startsWith("."))continue;const n=T(c,i.name);i.isDirectory()?await e(n):v.has(y(i.name))&&r.push(n)}};return await e(s),r}extractSymbols(s,r){const e=[],c=s.split(`
2
- `),o=new Set,i=y(r),n=C(i);for(const{pattern:u,kind:a}of n.exported){const d=new RegExp(u.source,u.flags);let t;for(;(t=d.exec(s))!==null;){const l=t[1];o.add(l);const p=s.slice(0,t.index).split(`
3
- `).length,f=a==="function"||a==="method"?h(c,p-1):void 0;e.push({name:l,kind:a,exported:!0,filePath:r,line:p,signature:f})}}for(const{pattern:u,kind:a}of n.local){const d=new RegExp(u.source,u.flags);let t;for(;(t=d.exec(s))!==null;){const l=t[1];if(o.has(l))continue;if(!n.skipIndentFilter){const m=s.slice(0,t.index).split(`
4
- `).length-1,w=c[m]??"";if(w.startsWith(" ")||w.startsWith(" "))continue}const p=s.slice(0,t.index).split(`
5
- `).length,f=a==="function"||a==="method"?h(c,p-1):void 0;e.push({name:l,kind:a,exported:!1,filePath:r,line:p,signature:f})}}return e}groupByKind(s){const r={};for(const e of s)r[e.kind]=(r[e.kind]??0)+1;return r}formatMarkdown(s,r){const e=[],c=s.filter(t=>t.exported).length;e.push(`## Symbols: ${r}
6
- `),e.push(`**${s.length} symbols** (${c} exported)
7
- `);const o={};for(const t of s)o[t.kind]=(o[t.kind]??0)+1;const i=Object.entries(o).sort((t,l)=>l[1]-t[1]).map(([t,l])=>{const p=t==="class"?"classes":`${t}s`;return`${l} ${p}`}).join(", ");e.push(`**Breakdown**: ${i}
8
- `);const n={};for(const t of s)n[t.filePath]||(n[t.filePath]=[]),n[t.filePath].push(t);e.push(`**${Object.keys(n).length} files** with symbols
9
- `);let u=0;const a=80*1024,d=Object.entries(n).sort((t,l)=>{const p=t[1].filter(m=>m.exported).length;return l[1].filter(m=>m.exported).length-p});for(const[t,l]of d){const p=l.filter(g=>g.exported);if(p.length===0)continue;const f=[`### ${t}
10
- `];for(const g of p){const x=g.signature?` \u2014 \`${g.signature}\``:"";f.push(`- \u{1F4E4} \`${g.kind}\` **${g.name}** (line ${g.line})${x}`)}const m=l.length-p.length;m>0&&f.push(`- _${m} internal ${m===1?"symbol":"symbols"}_`),f.push("");const w=f.join(`
11
- `);if(u+=w.length,u>a){e.push(`
12
- _Output truncated at 80KB. ${Object.keys(n).length-e.filter(g=>g.startsWith("### ")).length} files omitted._`);break}e.push(w)}return e.join(`
13
- `)}}export{U as SymbolAnalyzer};
1
+ import{readFile as e,readdir as t}from"node:fs/promises";import{extname as n,join as r,relative as i}from"node:path";const a=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.java`,`.py`,`.go`,`.cs`,`.rb`,`.kt`,`.scala`,`.rs`,`.php`,`.swift`]),o=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,`__pycache__`,`.venv`,`target`,`bin`,`obj`,`.gradle`,`venv`,`env`]),s={exported:[{pattern:/^export\s+(?:async\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^export\s+(?:default\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^export\s+interface\s+(\w+)/gm,kind:`interface`},{pattern:/^export\s+type\s+(\w+)/gm,kind:`type`},{pattern:/^export\s+(?:const|let)\s+(\w+)/gm,kind:`const`},{pattern:/^export\s+enum\s+(\w+)/gm,kind:`enum`}],local:[{pattern:/^(?:async\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^class\s+(\w+)/gm,kind:`class`},{pattern:/^interface\s+(\w+)/gm,kind:`interface`},{pattern:/^type\s+(\w+)/gm,kind:`type`},{pattern:/^(?:const|let)\s+(\w+)\s*=/gm,kind:`const`},{pattern:/^enum\s+(\w+)/gm,kind:`enum`}]},c={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:abstract\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*[;=]/gm,kind:`variable`}],skipIndentFilter:!0},l={exported:[{pattern:/^def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^async\s+def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^class\s+(\w+)/gm,kind:`class`}],local:[{pattern:/^[ \t]+def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^[ \t]+async\s+def\s+(\w+)\s*\(/gm,kind:`function`}],skipIndentFilter:!0},u={exported:[{pattern:/^func\s+([A-Z]\w*)\s*\(/gm,kind:`function`},{pattern:/^func\s+\([^)]+\)\s+([A-Z]\w*)\s*\(/gm,kind:`function`},{pattern:/^type\s+([A-Z]\w*)\s+struct\b/gm,kind:`class`},{pattern:/^type\s+([A-Z]\w*)\s+interface\b/gm,kind:`interface`},{pattern:/^type\s+([A-Z]\w*)\s+/gm,kind:`type`}],local:[{pattern:/^func\s+([a-z]\w*)\s*\(/gm,kind:`function`},{pattern:/^func\s+\([^)]+\)\s+([a-z]\w*)\s*\(/gm,kind:`function`},{pattern:/^type\s+([a-z]\w*)\s+struct\b/gm,kind:`class`},{pattern:/^type\s+([a-z]\w*)\s+/gm,kind:`type`}],skipIndentFilter:!0},d={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:partial\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:virtual\s+)?(?:override\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])?)\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*\(/gm,kind:`function`}],skipIndentFilter:!0},f={exported:[{pattern:/^(?:open\s+|data\s+|sealed\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^(?:fun|suspend\s+fun)\s+(\w+)\s*[(<]/gm,kind:`function`},{pattern:/^interface\s+(\w+)/gm,kind:`interface`},{pattern:/^object\s+(\w+)/gm,kind:`class`},{pattern:/^enum\s+class\s+(\w+)/gm,kind:`enum`}],local:[{pattern:/^[ \t]+(?:private|internal)\s+(?:fun|suspend\s+fun)\s+(\w+)/gm,kind:`function`},{pattern:/^[ \t]+(?:private|internal)\s+(?:val|var)\s+(\w+)/gm,kind:`variable`}],skipIndentFilter:!0},p={exported:[{pattern:/^class\s+(\w+)/gm,kind:`class`},{pattern:/^module\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]+def\s+self\.(\w+)/gm,kind:`function`}],local:[{pattern:/^[ \t]+def\s+(\w+)/gm,kind:`function`}],skipIndentFilter:!0},m={exported:[{pattern:/^pub\s+(?:async\s+)?fn\s+(\w+)/gm,kind:`function`},{pattern:/^pub\s+struct\s+(\w+)/gm,kind:`class`},{pattern:/^pub\s+trait\s+(\w+)/gm,kind:`interface`},{pattern:/^pub\s+enum\s+(\w+)/gm,kind:`enum`},{pattern:/^pub\s+type\s+(\w+)/gm,kind:`type`}],local:[{pattern:/^(?:async\s+)?fn\s+(\w+)/gm,kind:`function`},{pattern:/^struct\s+(\w+)/gm,kind:`class`},{pattern:/^trait\s+(\w+)/gm,kind:`interface`},{pattern:/^enum\s+(\w+)/gm,kind:`enum`}],skipIndentFilter:!0},h={exported:[{pattern:/^[ \t]*(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^function\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?function\s+(\w+)/gm,kind:`function`}],skipIndentFilter:!0},g={exported:[{pattern:/^[ \t]*(?:open|public)\s+class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:open|public)\s+struct\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:open|public)\s+protocol\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*(?:open|public)\s+enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*(?:open|public)\s+func\s+(\w+)/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+func\s+(\w+)/gm,kind:`function`},{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+class\s+(\w+)/gm,kind:`class`}],skipIndentFilter:!0},_={exported:[{pattern:/^[ \t]*(?:case\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*object\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*trait\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*def\s+(\w+)/gm,kind:`function`}],local:[],skipIndentFilter:!0};function v(e){switch(e){case`.ts`:case`.tsx`:case`.js`:case`.jsx`:return s;case`.java`:return c;case`.py`:return l;case`.go`:return u;case`.cs`:return d;case`.kt`:return f;case`.rb`:return p;case`.rs`:return m;case`.php`:return h;case`.swift`:return g;case`.scala`:return _;default:return s}}function y(e,t){let n=``,r=0,i=!1;for(let a=t;a<Math.min(t+5,e.length);a++){let t=e[a].trim();n+=(n?` `:``)+t;for(let e of t)e===`(`&&(r++,i=!0),e===`)`&&r--;if(i&&r<=0)return n.replace(/\s*\{.*$/,``).replace(/\s*:\s*$/,``).trim()}return n.trim()||void 0}var b=class{name=`symbols`;async analyze(t,n={}){let{format:r=`markdown`,filter:a}=n,o=Date.now(),s=await this.collectFiles(t),c=[];for(let n of s){let r=await e(n,`utf-8`),a=this.extractSymbols(r,i(t,n).replace(/\\/g,`/`));c.push(...a)}if(a){let e=a.toLowerCase();c=c.filter(t=>t.name.toLowerCase().includes(e))}return{output:r===`json`?JSON.stringify(c,null,2):this.formatMarkdown(c,t),data:{symbols:c,byKind:this.groupByKind(c),exportedCount:c.filter(e=>e.exported).length,totalCount:c.length},meta:{analyzedAt:new Date().toISOString(),scope:t,fileCount:s.length,durationMs:Date.now()-o}}}async collectFiles(e){let i=[],s=async e=>{let c=await t(e,{withFileTypes:!0});for(let t of c){if(o.has(t.name)||t.name.startsWith(`.`))continue;let c=r(e,t.name);t.isDirectory()?await s(c):a.has(n(t.name))&&i.push(c)}};return await s(e),i}extractSymbols(e,t){let r=[],i=e.split(`
2
+ `),a=new Set,o=v(n(t));for(let{pattern:n,kind:s}of o.exported){let o=new RegExp(n.source,n.flags),c;for(;(c=o.exec(e))!==null;){let n=c[1];a.add(n);let o=e.slice(0,c.index).split(`
3
+ `).length,l=s===`function`||s===`method`?y(i,o-1):void 0;r.push({name:n,kind:s,exported:!0,filePath:t,line:o,signature:l})}}for(let{pattern:n,kind:s}of o.local){let c=new RegExp(n.source,n.flags),l;for(;(l=c.exec(e))!==null;){let n=l[1];if(a.has(n))continue;if(!o.skipIndentFilter){let t=i[e.slice(0,l.index).split(`
4
+ `).length-1]??``;if(t.startsWith(` `)||t.startsWith(` `))continue}let c=e.slice(0,l.index).split(`
5
+ `).length,u=s===`function`||s===`method`?y(i,c-1):void 0;r.push({name:n,kind:s,exported:!1,filePath:t,line:c,signature:u})}}return r}groupByKind(e){let t={};for(let n of e)t[n.kind]=(t[n.kind]??0)+1;return t}formatMarkdown(e,t){let n=[],r=e.filter(e=>e.exported).length;n.push(`## Symbols: ${t}\n`),n.push(`**${e.length} symbols** (${r} exported)\n`);let i={};for(let t of e)i[t.kind]=(i[t.kind]??0)+1;let a=Object.entries(i).sort((e,t)=>t[1]-e[1]).map(([e,t])=>`${t} ${e===`class`?`classes`:`${e}s`}`).join(`, `);n.push(`**Breakdown**: ${a}\n`);let o={};for(let t of e)o[t.filePath]||(o[t.filePath]=[]),o[t.filePath].push(t);n.push(`**${Object.keys(o).length} files** with symbols\n`);let s=0,c=Object.entries(o).sort((e,t)=>{let n=e[1].filter(e=>e.exported).length;return t[1].filter(e=>e.exported).length-n});for(let[e,t]of c){let r=t.filter(e=>e.exported);if(r.length===0)continue;let i=[`### ${e}\n`];for(let e of r){let t=e.signature?` — \`${e.signature}\``:``;i.push(`- 📤 \`${e.kind}\` **${e.name}** (line ${e.line})${t}`)}let a=t.length-r.length;a>0&&i.push(`- _${a} internal ${a===1?`symbol`:`symbols`}_`),i.push(``);let c=i.join(`
6
+ `);if(s+=c.length,s>81920){n.push(`\n_Output truncated at 80KB. ${Object.keys(o).length-n.filter(e=>e.startsWith(`### `)).length} files omitted._`);break}n.push(c)}return n.join(`
7
+ `)}};export{b as SymbolAnalyzer};
8
+ //# sourceMappingURL=symbol-analyzer.js.map
@@ -1,3 +1,4 @@
1
+ //#region packages/analyzers/src/ts-call-graph.d.ts
1
2
  /**
2
3
  * TypeScript Compiler API-based call graph extractor.
3
4
  *
@@ -5,23 +6,25 @@
5
6
  * the AST to find function call sites and resolve them to their declaration files.
6
7
  * Produces module-level call edges: which modules call functions in which other modules.
7
8
  */
8
- export interface ModuleCallEdge {
9
- /** Caller module (relative path) */
10
- from: string;
11
- /** Callee module (relative path) */
12
- to: string;
13
- /** Function/symbol names called across this edge */
14
- symbols: string[];
9
+ interface ModuleCallEdge {
10
+ /** Caller module (relative path) */
11
+ from: string;
12
+ /** Callee module (relative path) */
13
+ to: string;
14
+ /** Function/symbol names called across this edge */
15
+ symbols: string[];
15
16
  }
16
- export interface CallGraphResult {
17
- edges: ModuleCallEdge[];
18
- fileCount: number;
19
- edgeCount: number;
20
- durationMs: number;
17
+ interface CallGraphResult {
18
+ edges: ModuleCallEdge[];
19
+ fileCount: number;
20
+ edgeCount: number;
21
+ durationMs: number;
21
22
  }
22
23
  /**
23
24
  * Extract module-level call graph from a TypeScript/JavaScript project.
24
25
  * Returns null if TypeScript compiler is unavailable or no TS files found.
25
26
  */
26
- export declare function extractTsCallGraph(rootPath: string): Promise<CallGraphResult | null>;
27
+ declare function extractTsCallGraph(rootPath: string): Promise<CallGraphResult | null>;
28
+ //#endregion
29
+ export { CallGraphResult, ModuleCallEdge, extractTsCallGraph };
27
30
  //# sourceMappingURL=ts-call-graph.d.ts.map
@@ -1 +1,2 @@
1
- import{existsSync as m,readdirSync as y,readFileSync as b}from"node:fs";import{extname as F,join as g,relative as d}from"node:path";const S=new Set(["node_modules",".git","dist","build","coverage",".turbo",".cache","cdk.out"]);async function _(e){const t=Date.now();if(!T(e))return null;let s;try{s=await import("typescript")}catch{return null}const i=w(e);if(i.length===0)return null;const r=i.slice(0,800),c=x(s,e),n=s.createProgram(r,{...c,noEmit:!0,skipLibCheck:!0,allowJs:!0,target:s.ScriptTarget.ESNext,module:s.ModuleKind.ESNext,moduleResolution:s.ModuleResolutionKind.Bundler}),o=n.getTypeChecker(),f=new Map;for(const l of n.getSourceFiles()){const a=l.fileName;if(l.isDeclarationFile||a.includes("node_modules"))continue;const p=d(e,a).replace(/\\/g,"/");p.startsWith("..")||h(s,l,l,o,e,p,f)}const u=[];for(const[l,a]of f){const[p,C]=l.split("|");u.push({from:p,to:C,symbols:[...a].sort().slice(0,10)})}return u.sort((l,a)=>a.symbols.length-l.symbols.length),{edges:u,fileCount:r.length,edgeCount:u.length,durationMs:Date.now()-t}}function T(e){if(m(g(e,"tsconfig.json"))||m(g(e,"tsconfig.build.json")))return!0;try{for(const t of y(e,{withFileTypes:!0}))if(t.isDirectory()&&!S.has(t.name)&&!t.name.startsWith(".")&&m(g(e,t.name,"tsconfig.json")))return!0}catch{}return!1}function x(e,t){const s=g(t,"tsconfig.json");if(!m(s))return{};try{const i=e.readConfigFile(s,c=>b(c,"utf-8"));return i.error?{}:e.parseJsonConfigFileContent(i.config,e.sys,t).options}catch{return{}}}function w(e){const t=[],s=new Set([".ts",".tsx"]),i=(r,c)=>{if(!(c>10))try{for(const n of y(r,{withFileTypes:!0})){if(S.has(n.name)||n.name.startsWith("."))continue;const o=g(r,n.name);if(n.isDirectory())i(o,c+1);else if(s.has(F(n.name))){if(n.name.endsWith(".d.ts")||/\.(test|spec)\.[jt]sx?$/.test(n.name)||d(e,r).replace(/\\/g,"/").split("/").some(u=>u==="test"||u==="tests"||u==="__tests__"||u==="spec"))continue;t.push(o)}}}catch{}};return i(e,0),t}function h(e,t,s,i,r,c,n){if(e.isCallExpression(t)||e.isNewExpression(t)){const o=t.expression;D(e,o,i,r,c,n)}e.forEachChild(t,o=>{h(e,o,s,i,r,c,n)})}function E(e){const t=e.match(/^(.+?)\/dist\/(.+)$/);if(!t)return e;const[,s,i]=t,r=i.replace(/\.d\.(m?ts|cts)$/,".ts");return`${s}/src/${r}`}function D(e,t,s,i,r,c){try{let n,o;if(e.isIdentifier(t)?(n=s.getSymbolAtLocation(t),o=t.text):e.isPropertyAccessExpression(t)&&(n=s.getSymbolAtLocation(t.name),o=t.name.text),!n||!o)return;n.flags&e.SymbolFlags.Alias&&(n=s.getAliasedSymbol(n));const f=n.getDeclarations();if(!f||f.length===0)return;const u=f[0].getSourceFile().fileName;if(u.includes("node_modules"))return;let l=d(i,u).replace(/\\/g,"/");if(l=E(l),l===r||l.startsWith(".."))return;const a=`${r}|${l}`,p=c.get(a);p?p.add(o):c.set(a,new Set([o]))}catch{}}export{_ as extractTsCallGraph};
1
+ import{extname as e,join as t,relative as n}from"node:path";import{existsSync as r,readFileSync as i,readdirSync as a}from"node:fs";const o=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`]);async function s(e){let t=Date.now();if(!c(e))return null;let r;try{r=await import(`typescript`)}catch{return null}let i=u(e);if(i.length===0)return null;let a=i.slice(0,800),o=l(r,e),s=r.createProgram(a,{...o,noEmit:!0,skipLibCheck:!0,allowJs:!0,target:r.ScriptTarget.ESNext,module:r.ModuleKind.ESNext,moduleResolution:r.ModuleResolutionKind.Bundler}),f=s.getTypeChecker(),p=new Map;for(let t of s.getSourceFiles()){let i=t.fileName;if(t.isDeclarationFile||i.includes(`node_modules`))continue;let a=n(e,i).replace(/\\/g,`/`);a.startsWith(`..`)||d(r,t,t,f,e,a,p)}let m=[];for(let[e,t]of p){let[n,r]=e.split(`|`);m.push({from:n,to:r,symbols:[...t].sort().slice(0,10)})}return m.sort((e,t)=>t.symbols.length-e.symbols.length),{edges:m,fileCount:a.length,edgeCount:m.length,durationMs:Date.now()-t}}function c(e){if(r(t(e,`tsconfig.json`))||r(t(e,`tsconfig.build.json`)))return!0;try{for(let n of a(e,{withFileTypes:!0}))if(n.isDirectory()&&!o.has(n.name)&&!n.name.startsWith(`.`)&&r(t(e,n.name,`tsconfig.json`)))return!0}catch{}return!1}function l(e,n){let a=t(n,`tsconfig.json`);if(!r(a))return{};try{let t=e.readConfigFile(a,e=>i(e,`utf-8`));return t.error?{}:e.parseJsonConfigFileContent(t.config,e.sys,n).options}catch{return{}}}function u(r){let i=[],s=new Set([`.ts`,`.tsx`]),c=(l,u)=>{if(!(u>10))try{for(let d of a(l,{withFileTypes:!0})){if(o.has(d.name)||d.name.startsWith(`.`))continue;let a=t(l,d.name);if(d.isDirectory())c(a,u+1);else if(s.has(e(d.name))){if(d.name.endsWith(`.d.ts`)||/\.(test|spec)\.[jt]sx?$/.test(d.name)||n(r,l).replace(/\\/g,`/`).split(`/`).some(e=>e===`test`||e===`tests`||e===`__tests__`||e===`spec`))continue;i.push(a)}}}catch{}};return c(r,0),i}function d(e,t,n,r,i,a,o){if(e.isCallExpression(t)||e.isNewExpression(t)){let n=t.expression;p(e,n,r,i,a,o)}e.forEachChild(t,t=>{d(e,t,n,r,i,a,o)})}function f(e){let t=e.match(/^(.+?)\/dist\/(.+)$/);if(!t)return e;let[,n,r]=t;return`${n}/src/${r.replace(/\.d\.(m?ts|cts)$/,`.ts`)}`}function p(e,t,r,i,a,o){try{let s,c;if(e.isIdentifier(t)?(s=r.getSymbolAtLocation(t),c=t.text):e.isPropertyAccessExpression(t)&&(s=r.getSymbolAtLocation(t.name),c=t.name.text),!s||!c)return;s.flags&e.SymbolFlags.Alias&&(s=r.getAliasedSymbol(s));let l=s.getDeclarations();if(!l||l.length===0)return;let u=l[0].getSourceFile().fileName;if(u.includes(`node_modules`))return;let d=n(i,u).replace(/\\/g,`/`);if(d=f(d),d===a||d.startsWith(`..`))return;let p=`${a}|${d}`,m=o.get(p);m?m.add(c):o.set(p,new Set([c]))}catch{}}export{s as extractTsCallGraph};
2
+ //# sourceMappingURL=ts-call-graph.js.map
@@ -1,98 +1,101 @@
1
+ //#region packages/analyzers/src/types.d.ts
1
2
  /**
2
3
  * Analyzer interfaces and result types.
3
4
  */
4
- export interface AnalysisResult {
5
- /** Formatted output (Markdown, JSON, or Mermaid) */
6
- output: string;
7
- /** Structured data for programmatic access */
8
- data: Record<string, unknown>;
9
- /** Analysis metadata */
10
- meta: {
11
- analyzedAt: string;
12
- scope: string;
13
- fileCount: number;
14
- durationMs: number;
15
- };
5
+ interface AnalysisResult {
6
+ /** Formatted output (Markdown, JSON, or Mermaid) */
7
+ output: string;
8
+ /** Structured data for programmatic access */
9
+ data: Record<string, unknown>;
10
+ /** Analysis metadata */
11
+ meta: {
12
+ analyzedAt: string;
13
+ scope: string;
14
+ fileCount: number;
15
+ durationMs: number;
16
+ };
16
17
  }
17
- export interface AnalyzerOptions {
18
- format?: 'json' | 'markdown' | 'mermaid';
19
- [key: string]: unknown;
18
+ interface AnalyzerOptions {
19
+ format?: 'json' | 'markdown' | 'mermaid';
20
+ [key: string]: unknown;
20
21
  }
21
- export interface IAnalyzer<TOpts extends AnalyzerOptions = AnalyzerOptions> {
22
- readonly name: string;
23
- analyze(rootPath: string, options?: TOpts): Promise<AnalysisResult>;
22
+ interface IAnalyzer<TOpts extends AnalyzerOptions = AnalyzerOptions> {
23
+ readonly name: string;
24
+ analyze(rootPath: string, options?: TOpts): Promise<AnalysisResult>;
24
25
  }
25
- export interface StructureAnalyzerOptions extends AnalyzerOptions {
26
- format?: 'json' | 'markdown';
27
- maxDepth?: number;
28
- /** When true, only include source code and config files (no docs, images, fonts, etc.) */
29
- sourceOnly?: boolean;
26
+ interface StructureAnalyzerOptions extends AnalyzerOptions {
27
+ format?: 'json' | 'markdown';
28
+ maxDepth?: number;
29
+ /** When true, only include source code and config files (no docs, images, fonts, etc.) */
30
+ sourceOnly?: boolean;
30
31
  }
31
- export interface DependencyAnalyzerOptions extends AnalyzerOptions {
32
- format?: 'json' | 'markdown' | 'mermaid';
33
- maxNodes?: number;
32
+ interface DependencyAnalyzerOptions extends AnalyzerOptions {
33
+ format?: 'json' | 'markdown' | 'mermaid';
34
+ maxNodes?: number;
34
35
  }
35
- export interface SymbolAnalyzerOptions extends AnalyzerOptions {
36
- filter?: string;
37
- format?: 'json' | 'markdown';
36
+ interface SymbolAnalyzerOptions extends AnalyzerOptions {
37
+ filter?: string;
38
+ format?: 'json' | 'markdown';
38
39
  }
39
- export interface DiagramOptions extends AnalyzerOptions {
40
- diagramType?: 'architecture' | 'dependencies';
41
- scope?: string;
40
+ interface DiagramOptions extends AnalyzerOptions {
41
+ diagramType?: 'architecture' | 'dependencies';
42
+ scope?: string;
42
43
  }
43
- export interface TreeNode {
44
- name: string;
45
- type: 'file' | 'directory';
46
- purpose?: string;
47
- language?: string;
48
- size?: number;
49
- children?: TreeNode[];
44
+ interface TreeNode {
45
+ name: string;
46
+ type: 'file' | 'directory';
47
+ purpose?: string;
48
+ language?: string;
49
+ size?: number;
50
+ children?: TreeNode[];
50
51
  }
51
- export interface ProjectStats {
52
- totalFiles: number;
53
- totalSize: number;
54
- languages: Record<string, number>;
52
+ interface ProjectStats {
53
+ totalFiles: number;
54
+ totalSize: number;
55
+ languages: Record<string, number>;
55
56
  }
56
- export interface ImportInfo {
57
- source: string;
58
- specifiers: string[];
59
- filePath: string;
60
- isExternal: boolean;
61
- /** Confidence level based on import resolution method */
62
- confidence: 'high' | 'medium' | 'low';
57
+ interface ImportInfo {
58
+ source: string;
59
+ specifiers: string[];
60
+ filePath: string;
61
+ isExternal: boolean;
62
+ /** Confidence level based on import resolution method */
63
+ confidence: 'high' | 'medium' | 'low';
63
64
  }
64
- export interface SymbolInfo {
65
- name: string;
66
- kind: 'function' | 'class' | 'interface' | 'type' | 'const' | 'enum' | 'variable' | 'method';
67
- exported: boolean;
68
- filePath: string;
69
- line: number;
70
- /** Full signature for functions/methods (parameter list + return type) */
71
- signature?: string;
65
+ interface SymbolInfo {
66
+ name: string;
67
+ kind: 'function' | 'class' | 'interface' | 'type' | 'const' | 'enum' | 'variable' | 'method';
68
+ exported: boolean;
69
+ filePath: string;
70
+ line: number;
71
+ /** Full signature for functions/methods (parameter list + return type) */
72
+ signature?: string;
72
73
  }
73
- export interface PatternMatch {
74
- pattern: string;
75
- description: string;
76
- locations: string[];
77
- confidence: 'high' | 'medium' | 'low';
74
+ interface PatternMatch {
75
+ pattern: string;
76
+ description: string;
77
+ locations: string[];
78
+ confidence: 'high' | 'medium' | 'low';
78
79
  }
79
- export interface EntryPoint {
80
- name: string;
81
- type: 'lambda-handler' | 'main' | 'bin' | 'server' | 'cli';
82
- filePath: string;
83
- trigger?: string;
80
+ interface EntryPoint {
81
+ name: string;
82
+ type: 'lambda-handler' | 'main' | 'bin' | 'server' | 'cli' | 'test' | 'cdk-construct';
83
+ filePath: string;
84
+ trigger?: string;
84
85
  }
85
- export interface ExtractionBaselines {
86
- structure?: AnalysisResult;
87
- dependencies?: AnalysisResult;
88
- symbols?: AnalysisResult;
89
- patterns?: AnalysisResult;
90
- entryPoints?: AnalysisResult;
91
- diagrams?: AnalysisResult[];
86
+ interface ExtractionBaselines {
87
+ structure?: AnalysisResult;
88
+ dependencies?: AnalysisResult;
89
+ symbols?: AnalysisResult;
90
+ patterns?: AnalysisResult;
91
+ entryPoints?: AnalysisResult;
92
+ diagrams?: AnalysisResult[];
92
93
  }
93
- export interface ExistingKnowledge {
94
- categories: string[];
95
- lastProduced: Record<string, string>;
96
- documentCount: number;
94
+ interface ExistingKnowledge {
95
+ categories: string[];
96
+ lastProduced: Record<string, string>;
97
+ documentCount: number;
97
98
  }
99
+ //#endregion
100
+ export { AnalysisResult, AnalyzerOptions, DependencyAnalyzerOptions, DiagramOptions, EntryPoint, ExistingKnowledge, ExtractionBaselines, IAnalyzer, ImportInfo, PatternMatch, ProjectStats, StructureAnalyzerOptions, SymbolAnalyzerOptions, SymbolInfo, TreeNode };
98
101
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ export{};
@@ -1,22 +1,25 @@
1
+ //#region packages/chunker/src/call-graph-extractor.d.ts
1
2
  /**
2
3
  * Call-graph extractor using tree-sitter AST.
3
4
  *
4
5
  * Extracts function-level call sites from parsed code, producing
5
6
  * caller→callee edges for blast-radius and dependency analysis.
6
7
  */
7
- export interface CallEdge {
8
- /** File containing the call */
9
- callerFile: string;
10
- /** Function/method making the call (or '<module>' for top-level) */
11
- callerName: string;
12
- /** Name of the function/method being called */
13
- calleeName: string;
14
- /** 1-based line number of the call site */
15
- line: number;
8
+ interface CallEdge {
9
+ /** File containing the call */
10
+ callerFile: string;
11
+ /** Function/method making the call (or '<module>' for top-level) */
12
+ callerName: string;
13
+ /** Name of the function/method being called */
14
+ calleeName: string;
15
+ /** 1-based line number of the call site */
16
+ line: number;
16
17
  }
17
18
  /**
18
19
  * Extract call edges from a source file using tree-sitter AST.
19
20
  * Returns null if tree-sitter is unavailable or doesn't support the language.
20
21
  */
21
- export declare function extractCallEdges(content: string, filePath: string): CallEdge[] | null;
22
+ declare function extractCallEdges(content: string, filePath: string): CallEdge[] | null;
23
+ //#endregion
24
+ export { CallEdge, extractCallEdges };
22
25
  //# sourceMappingURL=call-graph-extractor.d.ts.map
@@ -1 +1,2 @@
1
- import{extname as a}from"node:path";import{TreeSitterRuntime as u}from"./treesitter-chunker.js";const s=new Set(["function_declaration","method_definition","arrow_function","function_definition","function_declaration","method_declaration","function_item","method_declaration","constructor_declaration"]),f=new Set(["call_expression","new_expression","call"]);function g(t,e){const n=u.get();if(!n)return null;const l=a(e).toLowerCase();if(!n.hasLanguage(l))return null;const i=n.parse(t,l);if(!i)return null;const r=[],o=i.rootNode;return c(o,e,"<module>",r),r}function c(t,e,n,l){if(!t)return;let i=n;if(s.has(t.type)&&(i=p(t)??n),f.has(t.type)){const r=d(t);r&&l.push({callerFile:e,callerName:i,calleeName:r,line:(t.startPosition?.row??0)+1})}for(let r=0;r<(t.childCount??0);r++){const o=t.child(r);o&&c(o,e,i,l)}}function p(t){for(let e=0;e<(t.childCount??0);e++){const n=t.child(e);if(n&&(n.type==="identifier"||n.type==="property_identifier"||n.type==="name"))return n.text??null}return null}function d(t){const e=t.childForFieldName?.("function")??t.child(0);return e?e.type==="identifier"||e.type==="name"?e.text??null:e.type==="member_expression"||e.type==="attribute"?(e.childForFieldName?.("property")??e.childForFieldName?.("attribute"))?.text??null:t.type==="new_expression"?t.child(1)?.text??null:null:null}export{g as extractCallEdges};
1
+ import{TreeSitterRuntime as e}from"./treesitter-chunker.js";import{extname as t}from"node:path";const n=new Set([`function_declaration`,`method_definition`,`arrow_function`,`function_definition`,`function_declaration`,`method_declaration`,`function_item`,`method_declaration`,`constructor_declaration`]),r=new Set([`call_expression`,`new_expression`,`call`]);function i(n,r){let i=e.get();if(!i)return null;let o=t(r).toLowerCase();if(!i.hasLanguage(o))return null;let s=i.parse(n,o);if(!s)return null;let c=[],l=s.rootNode;return a(l,r,`<module>`,c),c}function a(e,t,i,c){if(!e)return;let l=i;if(n.has(e.type)&&(l=o(e)??i),r.has(e.type)){let n=s(e);n&&c.push({callerFile:t,callerName:l,calleeName:n,line:(e.startPosition?.row??0)+1})}for(let n=0;n<(e.childCount??0);n++){let r=e.child(n);r&&a(r,t,l,c)}}function o(e){for(let t=0;t<(e.childCount??0);t++){let n=e.child(t);if(n&&(n.type===`identifier`||n.type===`property_identifier`||n.type===`name`))return n.text??null}return null}function s(e){let t=e.childForFieldName?.(`function`)??e.child(0);return t?t.type===`identifier`||t.type===`name`?t.text??null:t.type===`member_expression`||t.type===`attribute`?(t.childForFieldName?.(`property`)??t.childForFieldName?.(`attribute`))?.text??null:e.type===`new_expression`?e.child(1)?.text??null:null:null}export{i as extractCallEdges};
2
+ //# sourceMappingURL=call-graph-extractor.js.map
@@ -1,7 +1,11 @@
1
- import type { IChunker } from './chunker.interface.js';
1
+ import { IChunker } from "./chunker.interface.js";
2
+
3
+ //#region packages/chunker/src/chunker-factory.d.ts
2
4
  /**
3
5
  * Create the appropriate chunker for a file extension.
4
6
  * Prefers tree-sitter AST-based chunking when available; falls back to regex-based.
5
7
  */
6
- export declare function createChunker(fileExtension: string): IChunker;
8
+ declare function createChunker(fileExtension: string): IChunker;
9
+ //#endregion
10
+ export { createChunker };
7
11
  //# sourceMappingURL=chunker-factory.d.ts.map
@@ -1 +1,2 @@
1
- import{CodeChunker as s}from"./code-chunker.js";import{GenericChunker as n}from"./generic-chunker.js";import{MarkdownChunker as a}from"./markdown-chunker.js";import{TreeSitterChunker as c,TreeSitterRuntime as o}from"./treesitter-chunker.js";function f(t){const e=t.toLowerCase();switch(e){case".md":case".mdx":return new a;case".ts":case".tsx":case".mts":case".cts":case".js":case".jsx":case".mjs":case".cjs":case".py":case".go":case".rs":case".java":{const r=o.get();return r?.hasLanguage(e)?new c(r):new s}default:return new n}}export{f as createChunker};
1
+ import{CodeChunker as e}from"./code-chunker.js";import{TreeSitterChunker as t,TreeSitterRuntime as n}from"./treesitter-chunker.js";import{GenericChunker as r}from"./generic-chunker.js";import{MarkdownChunker as i}from"./markdown-chunker.js";function a(a){let o=a.toLowerCase();switch(o){case`.md`:case`.mdx`:return new i;case`.ts`:case`.tsx`:case`.mts`:case`.cts`:case`.js`:case`.jsx`:case`.mjs`:case`.cjs`:case`.py`:case`.go`:case`.rs`:case`.java`:{let r=n.get();return r?.hasLanguage(o)?new t(r):new e}default:return new r}}export{a as createChunker};
2
+ //# sourceMappingURL=chunker-factory.js.map
@@ -1,10 +1,14 @@
1
- import type { ChunkMetadata, RawChunk } from '@kb/core';
1
+ import { ChunkMetadata, RawChunk } from "@kb/core";
2
+
3
+ //#region packages/chunker/src/chunker.interface.d.ts
2
4
  /**
3
5
  * Interface for content chunkers.
4
6
  * Each chunker splits a specific content type into searchable chunks.
5
7
  */
6
- export interface IChunker {
7
- /** Split content into chunks */
8
- chunk(content: string, metadata: ChunkMetadata): RawChunk[];
8
+ interface IChunker {
9
+ /** Split content into chunks */
10
+ chunk(content: string, metadata: ChunkMetadata): RawChunk[];
9
11
  }
12
+ //#endregion
13
+ export { IChunker };
10
14
  //# sourceMappingURL=chunker.interface.d.ts.map
@@ -0,0 +1 @@
1
+ export{};
@@ -1,14 +1,18 @@
1
- import type { ChunkMetadata, RawChunk } from '@kb/core';
2
- import type { IChunker } from './chunker.interface.js';
3
- export declare class CodeChunker implements IChunker {
4
- private readonly maxChunkSize;
5
- constructor(options?: {
6
- maxChunkSize?: number;
7
- });
8
- chunk(content: string, metadata: ChunkMetadata): RawChunk[];
9
- private findDeclarationBoundaries;
10
- private fallbackChunk;
11
- private splitByLines;
12
- private getLineNumber;
1
+ import { IChunker } from "./chunker.interface.js";
2
+ import { ChunkMetadata, RawChunk } from "@kb/core";
3
+
4
+ //#region packages/chunker/src/code-chunker.d.ts
5
+ declare class CodeChunker implements IChunker {
6
+ private readonly maxChunkSize;
7
+ constructor(options?: {
8
+ maxChunkSize?: number;
9
+ });
10
+ chunk(content: string, metadata: ChunkMetadata): RawChunk[];
11
+ private findDeclarationBoundaries;
12
+ private fallbackChunk;
13
+ private splitByLines;
14
+ private getLineNumber;
13
15
  }
16
+ //#endregion
17
+ export { CodeChunker };
14
18
  //# sourceMappingURL=code-chunker.d.ts.map
@@ -1,14 +1,12 @@
1
- import{CHUNK_SIZES as p}from"../../core/dist/index.js";class C{maxChunkSize;constructor(e){this.maxChunkSize=e?.maxChunkSize??p.code.max}chunk(e,n){const r=this.findDeclarationBoundaries(e);if(r.length===0)return this.fallbackChunk(e,n);const s=[];for(let t=0;t<r.length;t++){const i=r[t].offset,l=t+1<r.length?r[t+1].offset:e.length;let h=e.slice(i,l).trim();if(h=`// File: ${n.sourcePath}
2
- `+h,h.length>this.maxChunkSize){const u=this.splitByLines(h,this.maxChunkSize);let c=this.getLineNumber(e,i);for(const a of u){const f=a.split(`
3
- `).length;s.push({text:a,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:s.length,totalChunks:0,startLine:c,endLine:c+f-1}),c+=f}}else{const u=this.getLineNumber(e,i);s.push({text:h,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:s.length,totalChunks:0,startLine:u,endLine:u+h.split(`
4
- `).length-1})}}if(r[0].offset>0){const t=e.slice(0,r[0].offset).trim();t.length>0&&s.unshift({text:`// File: ${n.sourcePath}
5
- ${t}`,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:0,totalChunks:0,startLine:1,endLine:this.getLineNumber(e,r[0].offset)-1})}return s.map((t,i)=>({...t,chunkIndex:i,totalChunks:s.length}))}findDeclarationBoundaries(e){const n=/^(?:export\s+)?(?:default\s+)?(?:async\s+)?(?:function|class|interface|type|const|enum|abstract\s+class)\s+(\w+)/gm,r=[];let s;for(;(s=n.exec(e))!==null;){const t=e.lastIndexOf(`
6
- `,s.index-1)+1;let i=t;const h=e.slice(0,t).split(`
7
- `);let o=h.length-1;for(;o>=0;){const u=h[o].trim();if(u===""||u.startsWith("//")||u.startsWith("*")||u.startsWith("/*")||u.startsWith("*/")||u.startsWith("@"))o--;else break}o<h.length-1&&(i=h.slice(0,o+1).join(`
8
- `).length+1),r.push({offset:i,name:s[1]})}return r}fallbackChunk(e,n){return[{text:`// File: ${n.sourcePath}
9
- `+e,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:0,totalChunks:1,startLine:1,endLine:e.split(`
10
- `).length}]}splitByLines(e,n){const r=e.split(`
11
- `),s=[];let t=[],i=0;for(const l of r)i+l.length+1>n&&t.length>0?(s.push(t.join(`
12
- `)),t=[l],i=l.length):(t.push(l),i+=l.length+1);return t.length>0&&s.push(t.join(`
13
- `)),s}getLineNumber(e,n){return e.slice(0,n).split(`
14
- `).length}}export{C as CodeChunker};
1
+ import{CHUNK_SIZES as e}from"../../core/dist/index.js";var t=class{maxChunkSize;constructor(t){this.maxChunkSize=t?.maxChunkSize??e.code.max}chunk(e,t){let n=this.findDeclarationBoundaries(e);if(n.length===0)return this.fallbackChunk(e,t);let r=[];for(let i=0;i<n.length;i++){let a=n[i].offset,o=i+1<n.length?n[i+1].offset:e.length,s=e.slice(a,o).trim();if(s=`// File: ${t.sourcePath}\n`+s,s.length>this.maxChunkSize){let n=this.splitByLines(s,this.maxChunkSize),i=this.getLineNumber(e,a);for(let e of n){let n=e.split(`
2
+ `).length;r.push({text:e,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:i,endLine:i+n-1}),i+=n}}else{let n=this.getLineNumber(e,a);r.push({text:s,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:n,endLine:n+s.split(`
3
+ `).length-1})}}if(n[0].offset>0){let i=e.slice(0,n[0].offset).trim();i.length>0&&r.unshift({text:`// File: ${t.sourcePath}\n${i}`,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:0,totalChunks:0,startLine:1,endLine:this.getLineNumber(e,n[0].offset)-1})}return r.map((e,t)=>({...e,chunkIndex:t,totalChunks:r.length}))}findDeclarationBoundaries(e){let t=/^(?:export\s+)?(?:default\s+)?(?:async\s+)?(?:function|class|interface|type|const|enum|abstract\s+class)\s+(\w+)/gm,n=[],r;for(;(r=t.exec(e))!==null;){let t=e.lastIndexOf(`
4
+ `,r.index-1)+1,i=t,a=e.slice(0,t).split(`
5
+ `),o=a.length-1;for(;o>=0;){let e=a[o].trim();if(e===``||e.startsWith(`//`)||e.startsWith(`*`)||e.startsWith(`/*`)||e.startsWith(`*/`)||e.startsWith(`@`))o--;else break}o<a.length-1&&(i=a.slice(0,o+1).join(`
6
+ `).length+1),n.push({offset:i,name:r[1]})}return n}fallbackChunk(e,t){return[{text:`// File: ${t.sourcePath}\n`+e,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:0,totalChunks:1,startLine:1,endLine:e.split(`
7
+ `).length}]}splitByLines(e,t){let n=e.split(`
8
+ `),r=[],i=[],a=0;for(let e of n)a+e.length+1>t&&i.length>0?(r.push(i.join(`
9
+ `)),i=[e],a=e.length):(i.push(e),a+=e.length+1);return i.length>0&&r.push(i.join(`
10
+ `)),r}getLineNumber(e,t){return e.slice(0,t).split(`
11
+ `).length}};export{t as CodeChunker};
12
+ //# sourceMappingURL=code-chunker.js.map
@@ -1,12 +1,16 @@
1
- import type { ChunkMetadata, RawChunk } from '@kb/core';
2
- import type { IChunker } from './chunker.interface.js';
3
- export declare class GenericChunker implements IChunker {
4
- private readonly maxChunkSize;
5
- private readonly overlap;
6
- constructor(options?: {
7
- maxChunkSize?: number;
8
- overlap?: number;
9
- });
10
- chunk(content: string, metadata: ChunkMetadata): RawChunk[];
1
+ import { IChunker } from "./chunker.interface.js";
2
+ import { ChunkMetadata, RawChunk } from "@kb/core";
3
+
4
+ //#region packages/chunker/src/generic-chunker.d.ts
5
+ declare class GenericChunker implements IChunker {
6
+ private readonly maxChunkSize;
7
+ private readonly overlap;
8
+ constructor(options?: {
9
+ maxChunkSize?: number;
10
+ overlap?: number;
11
+ });
12
+ chunk(content: string, metadata: ChunkMetadata): RawChunk[];
11
13
  }
14
+ //#endregion
15
+ export { GenericChunker };
12
16
  //# sourceMappingURL=generic-chunker.d.ts.map
@@ -1,5 +1,6 @@
1
- import{CHUNK_SIZES as p}from"../../core/dist/index.js";class C{maxChunkSize;overlap;constructor(n){this.maxChunkSize=n?.maxChunkSize??p.default.max,this.overlap=n?.overlap??p.default.overlap}chunk(n,h){if(n.length<=this.maxChunkSize)return[{text:n,sourcePath:h.sourcePath,contentType:h.contentType,chunkIndex:0,totalChunks:1,startLine:1,endLine:n.split(`
2
- `).length}];const c=n.split(`
3
- `),r=[];let e=[],s=0,l=1;for(let u=0;u<c.length;u++){const t=c[u];if(s+t.length+1>this.maxChunkSize&&e.length>0){r.push({text:e.join(`
4
- `),sourcePath:h.sourcePath,contentType:h.contentType,chunkIndex:r.length,totalChunks:0,startLine:l,endLine:l+e.length-1});const o=[];let a=0;for(let i=e.length-1;i>=0&&!(a+e[i].length+1>this.overlap);i--)o.unshift(e[i]),a+=e[i].length+1;l=l+e.length-o.length,e=[...o,t],s=a+t.length+1}else e.push(t),s+=t.length+1}return e.length>0&&r.push({text:e.join(`
5
- `),sourcePath:h.sourcePath,contentType:h.contentType,chunkIndex:r.length,totalChunks:0,startLine:l,endLine:l+e.length-1}),r.map((u,t)=>({...u,chunkIndex:t,totalChunks:r.length}))}}export{C as GenericChunker};
1
+ import{CHUNK_SIZES as e}from"../../core/dist/index.js";var t=class{maxChunkSize;overlap;constructor(t){this.maxChunkSize=t?.maxChunkSize??e.default.max,this.overlap=t?.overlap??e.default.overlap}chunk(e,t){if(e.length<=this.maxChunkSize)return[{text:e,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:0,totalChunks:1,startLine:1,endLine:e.split(`
2
+ `).length}];let n=e.split(`
3
+ `),r=[],i=[],a=0,o=1;for(let e=0;e<n.length;e++){let s=n[e];if(a+s.length+1>this.maxChunkSize&&i.length>0){r.push({text:i.join(`
4
+ `),sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:o,endLine:o+i.length-1});let e=[],n=0;for(let t=i.length-1;t>=0&&!(n+i[t].length+1>this.overlap);t--)e.unshift(i[t]),n+=i[t].length+1;o=o+i.length-e.length,i=[...e,s],a=n+s.length+1}else i.push(s),a+=s.length+1}return i.length>0&&r.push({text:i.join(`
5
+ `),sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:o,endLine:o+i.length-1}),r.map((e,t)=>({...e,chunkIndex:t,totalChunks:r.length}))}};export{t as GenericChunker};
6
+ //# sourceMappingURL=generic-chunker.js.map
@@ -1,8 +1,8 @@
1
- export { type CallEdge, extractCallEdges } from './call-graph-extractor.js';
2
- export type { IChunker } from './chunker.interface.js';
3
- export { createChunker } from './chunker-factory.js';
4
- export { CodeChunker } from './code-chunker.js';
5
- export { GenericChunker } from './generic-chunker.js';
6
- export { MarkdownChunker } from './markdown-chunker.js';
7
- export { initializeTreeSitter, TreeSitterChunker, TreeSitterRuntime, } from './treesitter-chunker.js';
8
- //# sourceMappingURL=index.d.ts.map
1
+ import { CallEdge, extractCallEdges } from "./call-graph-extractor.js";
2
+ import { IChunker } from "./chunker.interface.js";
3
+ import { createChunker } from "./chunker-factory.js";
4
+ import { CodeChunker } from "./code-chunker.js";
5
+ import { GenericChunker } from "./generic-chunker.js";
6
+ import { MarkdownChunker } from "./markdown-chunker.js";
7
+ import { TreeSitterChunker, TreeSitterRuntime, initializeTreeSitter } from "./treesitter-chunker.js";
8
+ export { type CallEdge, CodeChunker, GenericChunker, type IChunker, MarkdownChunker, TreeSitterChunker, TreeSitterRuntime, createChunker, extractCallEdges, initializeTreeSitter };
@@ -1 +1 @@
1
- import{extractCallEdges as t}from"./call-graph-extractor.js";import{createChunker as n}from"./chunker-factory.js";import{CodeChunker as p}from"./code-chunker.js";import{GenericChunker as f}from"./generic-chunker.js";import{MarkdownChunker as m}from"./markdown-chunker.js";import{initializeTreeSitter as x,TreeSitterChunker as a,TreeSitterRuntime as h}from"./treesitter-chunker.js";export{p as CodeChunker,f as GenericChunker,m as MarkdownChunker,a as TreeSitterChunker,h as TreeSitterRuntime,n as createChunker,t as extractCallEdges,x as initializeTreeSitter};
1
+ import{CodeChunker as e}from"./code-chunker.js";import{TreeSitterChunker as t,TreeSitterRuntime as n,initializeTreeSitter as r}from"./treesitter-chunker.js";import{extractCallEdges as i}from"./call-graph-extractor.js";import{GenericChunker as a}from"./generic-chunker.js";import{MarkdownChunker as o}from"./markdown-chunker.js";import{createChunker as s}from"./chunker-factory.js";export{e as CodeChunker,a as GenericChunker,o as MarkdownChunker,t as TreeSitterChunker,n as TreeSitterRuntime,s as createChunker,i as extractCallEdges,r as initializeTreeSitter};