@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
package/README.md CHANGED
@@ -23,7 +23,7 @@ This is an **MCP (Model Context Protocol) server** that gives AI agents:
23
23
  8. **Graph auto-population** — during indexing, a lightweight regex extractor builds the knowledge graph automatically from TS/JS source files (functions, classes, interfaces, types, imports)
24
24
  9. **Optimized reindex** — full reindex skips redundant hash checks, batches graph writes (flush every 50 files), and skips per-file graph deletes when bulk-cleared
25
25
 
26
- The KB auto-indexes configured source directories on startup, stores embeddings in a local LanceDB vector store, and exposes everything through 64 MCP tools, 47 CLI commands, and 2 resources.
26
+ The KB auto-indexes configured source directories on startup, stores embeddings in a local LanceDB vector store, and exposes everything through 64 MCP tools, 45 CLI commands, and 2 resources.
27
27
 
28
28
  ---
29
29
 
@@ -36,6 +36,12 @@ pnpm add -D @vpxa/kb
36
36
  # Initialize in your project
37
37
  npx @vpxa/kb init
38
38
 
39
+ # After upgrading, overwrite all scaffold/skill files
40
+ npx @vpxa/kb init --force
41
+
42
+ # Check which files are outdated (JSON report for LLM consumption)
43
+ npx @vpxa/kb init --guide
44
+
39
45
  # Index your codebase
40
46
  npx @vpxa/kb reindex
41
47
 
@@ -54,13 +60,12 @@ npx @vpxa/kb serve
54
60
  | Tool | CLI | Description |
55
61
  |------|-----|-------------|
56
62
  | `kb_search` | `kb search` | Hybrid vector + keyword search |
57
- | `kb_find` | `kb find` | Federated search (vector, FTS, glob, regex) |
63
+ | `kb_find` | `kb find` | Federated search (vector, FTS, glob, regex). Use `mode: 'examples'` to find usage examples. |
58
64
  | `kb_symbol` | `kb symbol` | Resolve symbol definition, imports, references |
59
65
  | `kb_lookup` | `kb lookup` | Look up indexed chunks by file path |
60
66
  | `kb_trace` | `kb trace` | Forward/backward flow tracing |
61
- | `kb_find_examples` | `kb examples` | Find usage examples of a symbol |
62
67
  | `kb_scope_map` | `kb scope-map` | Generate task-scoped reading plan |
63
- | `kb_dead_symbols` | `kb dead-symbols` | Find unused exported symbols |
68
+ | `kb_dead_symbols` | `kb dead-symbols` | Find unused exported symbols (source vs docs) |
64
69
  | `kb_file_summary` | `kb summarize` | Structural file overview |
65
70
 
66
71
  ### Code Analysis
@@ -70,14 +75,14 @@ npx @vpxa/kb serve
70
75
  | `kb_analyze_dependencies` | `kb analyze deps` | Dependency graph |
71
76
  | `kb_analyze_symbols` | `kb analyze symbols` | Symbol extraction |
72
77
  | `kb_analyze_patterns` | `kb analyze patterns` | Code pattern detection |
73
- | `kb_analyze_entry_points` | `kb analyze entry-points` | Entry point discovery |
78
+ | `kb_analyze_entry_points` | `kb analyze entry-points` | Entry point discovery: handlers, CDK constructs, test suites, package exports (walks monorepo workspaces) |
74
79
  | `kb_analyze_diagram` | `kb analyze diagram` | Mermaid diagram generation |
75
80
  | `kb_blast_radius` | `kb analyze blast-radius` | Change impact analysis |
76
81
 
77
82
  ### Context Management
78
83
  | Tool | CLI | Description |
79
84
  |------|-----|-------------|
80
- | `kb_compact` | `kb compact` | Compress text to relevant sections |
85
+ | `kb_compact` | `kb compact` | Compress text/file to relevant sections (accepts `path`) |
81
86
  | `kb_workset` | `kb workset` | Named file set management |
82
87
  | `kb_stash` | `kb stash` | Named key-value store |
83
88
  | `kb_checkpoint` | `kb checkpoint` | Session checkpoint save/restore |
@@ -104,9 +109,10 @@ npx @vpxa/kb serve
104
109
  | Tool | CLI | Description |
105
110
  |------|-----|-------------|
106
111
  | `kb_eval` | `kb eval` | Sandboxed JavaScript/TypeScript execution |
107
- | `kb_check` | `kb check` | Incremental typecheck + lint |
112
+ | `kb_check` | `kb check` | Incremental typecheck + lint (`detail`: summary/errors/full) |
108
113
  | `kb_test_run` | `kb test` | Run tests with structured results |
109
114
  | `kb_batch` | `kb batch` | Parallel operation execution |
115
+ | `kb_audit` | `kb audit` | Unified project audit: runs structure, deps, patterns, health, dead symbols, check, entry points in one call. Returns score, recommendations, and next steps. |
110
116
 
111
117
  ### Knowledge Management
112
118
  | Tool | CLI | Description |
@@ -158,14 +164,14 @@ npx @vpxa/kb serve
158
164
  ### System
159
165
  | Tool | CLI | Description |
160
166
  |------|-----|-------------|
161
- | `kb_status` | `kb status` | Index statistics |
167
+ | `kb_status` | `kb status` | Index statistics + tree-sitter availability |
162
168
  | `kb_reindex` | `kb reindex` | Rebuild index |
163
- | `kb_health` | `kb health` | Project health checks (package.json, tsconfig, lockfile, etc.) |
169
+ | `kb_health` | `kb health` | Project health checks (package.json, tsconfig, lockfile, circular deps) |
170
+ | `kb_guide` | `kb guide` | Tool discovery — given a goal, recommends tools and workflow order |
164
171
  | `kb_queue` | `kb queue` | Task queue for sequential agent operations |
165
172
  | `kb_graph` | `kb graph` | Query and manage the knowledge graph (8 actions: find_nodes, find_edges, neighbors, traverse, stats, add, delete, clear) |
166
173
  | `kb_onboard` | `kb onboard` | First-time codebase onboarding — runs all analysis tools in one command, auto-persists results |
167
- | `kb_replay_list` | `kb replay` | View audit trail of tool invocations |
168
- | `kb_replay_clear` | `kb replay-clear` | Clear the replay audit trail |
174
+ | `kb_replay` | `kb replay` | View or clear the audit trail of tool invocations (action: list/clear) |
169
175
 
170
176
  ### TUI Dashboard
171
177
 
@@ -211,7 +217,7 @@ kb analyze <type> <path>
211
217
  kb lookup <path>
212
218
 
213
219
  # Context
214
- kb compact <query> [--max-chars N]
220
+ kb compact <query> [--path <file>] [--max-chars N]
215
221
  kb workset <action> [name] [--files f1,f2]
216
222
  kb stash <action> [key] [value]
217
223
  kb checkpoint <action> [label]
@@ -226,7 +232,7 @@ kb transform <expression>
226
232
  # Execution
227
233
  kb eval <code> [--lang js|ts] [--timeout N]
228
234
  kb test [files...] [--grep pattern]
229
- kb check [--skip-types] [--skip-lint]
235
+ kb check [--skip-types] [--skip-lint] [--detail summary|errors|full]
230
236
  kb batch
231
237
 
232
238
  # Knowledge
@@ -261,7 +267,7 @@ kb status
261
267
  kb reindex [--full]
262
268
  kb onboard <path> [--generate] [--out-dir <dir>]
263
269
  kb serve [--transport stdio|http] [--port N]
264
- kb init [--force]
270
+ kb init [--force] [--guide]
265
271
  ```
266
272
 
267
273
  ## Configuration
@@ -296,7 +302,7 @@ kb init [--force]
296
302
  │ ├── chunker/ — tree-sitter + regex code chunking
297
303
  │ ├── indexer/ — incremental file indexer
298
304
  │ ├── analyzers/ — blast-radius, deps, symbols, patterns, diagrams
299
- │ ├── tools/ — 49 tool modules (64 MCP tools)
305
+ │ ├── tools/ — 52 tool modules (64 MCP tools)
300
306
  │ ├── server/ — MCP protocol server
301
307
  │ └── cli/ — command-line interface
302
308
  ├── bin/kb.mjs — CLI entry point
@@ -466,7 +472,9 @@ Dependency results include a **confidence** level per import: `high` (ES static
466
472
  |-----------|------|----------|-------------|
467
473
  | `path` | string | **yes** | Root path |
468
474
 
469
- #### `kb_analyze_entry_points` — Find Lambda handlers, CLI bins, server starts
475
+ #### `kb_analyze_entry_points` — Find Lambda handlers, CDK constructs, test suites, package exports
476
+
477
+ Walks monorepo workspace packages (pnpm-workspace.yaml / package.json#workspaces), parses `exports` fields, detects CDK constructs and test suites.
470
478
 
471
479
  | Parameter | Type | Required | Description |
472
480
  |-----------|------|----------|-------------|
@@ -485,12 +493,13 @@ Dependency results include a **confidence** level per import: `high` (ES static
485
493
 
486
494
  | Parameter | Type | Required | Default | Description |
487
495
  |-----------|------|----------|---------|-------------|
488
- | `text` | string | **yes** | — | The text to compress |
496
+ | `text` | string | no* | — | The text to compress (provide `text` or `path`) |
497
+ | `path` | string | no* | — | File path to read server-side (avoids read_file round-trip) |
489
498
  | `query` | string | **yes** | — | Focus query — what are you trying to understand? |
490
499
  | `max_chars` | number (100–50000) | no | `3000` | Target output size in characters |
491
500
  | `segmentation` | enum | no | `paragraph` | How to split: `paragraph`, `sentence`, `line` |
492
501
 
493
- Uses embedding similarity (no LLM needed) to keep only the segments most relevant to the query. Returns compression stats (originalcompressed chars, ratio, segments kept/total) and the compressed text.
502
+ \* At least one of `text` or `path` must be provided. Using `path` is preferred it eliminates the `read_file``compact` two-call chain and prevents token doubling.
494
503
 
495
504
  #### `kb_workset` — Manage named file sets
496
505
 
@@ -641,16 +650,6 @@ Returns a ranked file list with estimated token counts, relevance %, focus line
641
650
 
642
651
  Follows imports, call sites, and references to build a relationship graph from a starting symbol or file location.
643
652
 
644
- #### `kb_find_examples` — Find real usage examples
645
-
646
- | Parameter | Type | Required | Default | Description |
647
- |-----------|------|----------|---------|-------------|
648
- | `query` | string | **yes** | — | Symbol or pattern to find examples of |
649
- | `limit` | number (1–20) | no | `5` | Maximum examples to return |
650
- | `content_type` | string | no | — | Filter by content type |
651
-
652
- Returns usage examples with file paths and code snippets from the indexed codebase.
653
-
654
653
  #### `kb_dead_symbols` — Find unused exported symbols
655
654
 
656
655
  | Parameter | Type | Required | Default | Description |
@@ -748,6 +747,18 @@ Returns structured pass/fail summary. `isError` set if any tests failed.
748
747
 
749
748
  Returns per-operation outcomes (success/failure with results or errors).
750
749
 
750
+ #### `kb_audit` — Unified project audit
751
+
752
+ Runs multiple analysis checks in a single call and returns a synthesized report with a composite score (0–100), per-check summaries, and prioritized recommendations.
753
+
754
+ | Parameter | Type | Required | Default | Description |
755
+ |-----------|------|----------|---------|-------------|
756
+ | `path` | string | no | `.` | Root path to audit |
757
+ | `checks` | string[] | no | all | Subset of checks: `structure`, `dependencies`, `patterns`, `health`, `dead_symbols`, `check`, `entry_points` |
758
+ | `detail` | enum | no | `summary` | `summary` (markdown overview) or `full` (structured JSON data) |
759
+
760
+ Returns `KBResponse<AuditData>` with `next[]` hints for follow-up actions.
761
+
751
762
  ### Git & Environment
752
763
 
753
764
  #### `kb_git_context` — Summarize Git repository state
@@ -931,13 +942,22 @@ Isolated file copies for parallel exploration. Create a lane, make changes, diff
931
942
 
932
943
  ### System
933
944
 
945
+ #### `kb_guide` — Tool discovery
946
+
947
+ | Parameter | Type | Required | Default | Description |
948
+ |-----------|------|----------|---------|-------------|
949
+ | `goal` | string | **yes** | — | What you want to accomplish |
950
+ | `max_recommendations` | number | no | 5 | Max tools to recommend (1-10) |
951
+
952
+ Given a goal description, recommends which KB tools to use and in what order. Matches against 10 predefined workflows: onboard, audit, bugfix, implement, refactor, search, context, memory, validate, analyze.
953
+
934
954
  #### `kb_health` — Run project health checks
935
955
 
936
956
  | Parameter | Type | Required | Default | Description |
937
957
  |-----------|------|----------|---------|-------------|
938
958
  | `path` | string | no | cwd | Root directory to check |
939
959
 
940
- Verifies package.json, tsconfig, scripts, lockfile, README, LICENSE, .gitignore.
960
+ Verifies package.json, tsconfig, scripts, lockfile, README, LICENSE, .gitignore, circular dependencies.
941
961
 
942
962
  #### `kb_queue` — Manage task queues
943
963
 
@@ -952,21 +972,18 @@ Verifies package.json, tsconfig, scripts, lockfile, README, LICENSE, .gitignore.
952
972
 
953
973
  Sequential task queues for agent operations.
954
974
 
955
- #### `kb_replay_list` — View audit trail
975
+ #### `kb_replay` — View or clear audit trail
956
976
 
957
977
  | Parameter | Type | Required | Default | Description |
958
978
  |-----------|------|----------|---------|-------------|
959
- | `last` | number | no | 20 | Number of entries to return |
960
- | `tool` | string | no | | Filter by tool name (e.g., `kb_search`) |
961
- | `source` | enum | no | — | Filter by source: `mcp` or `cli` |
962
- | `since` | string | no | — | ISO timestamp only show entries after this time |
979
+ | `action` | enum | no | `list` | `list` to view entries, `clear` to wipe the log |
980
+ | `last` | number | no | 20 | Number of entries to return (list only) |
981
+ | `tool` | string | no | — | Filter by tool name (list only) |
982
+ | `source` | enum | no | — | Filter by source: `mcp` or `cli` (list only) |
983
+ | `since` | string | no | — | ISO timestamp — only show entries after this time (list only) |
963
984
 
964
985
  Shows the audit trail of recent tool invocations. Each entry includes tool name, duration, input/output summaries, and status. Useful for debugging agent behavior.
965
986
 
966
- #### `kb_replay_clear` — Clear audit trail
967
-
968
- No parameters. Clears the entire replay log.
969
-
970
987
  ---
971
988
 
972
989
  ## MCP Resources
@@ -1138,6 +1155,6 @@ Every tool response includes a `_Next:` suggestion at the bottom. Follow these h
1138
1155
  - **Workflow Hints**: Every tool response includes `_Next:` suggestions for logical follow-up actions
1139
1156
  - **MCP SDK**: `@modelcontextprotocol/sdk` (stdio + StreamableHTTP transports)
1140
1157
  - **Runtime**: Node.js ≥ 24, TypeScript, ESM, pnpm workspaces
1141
- - **Build**: esbuild with tsc for declarations
1158
+ - **Build**: tsdown with integrated dts generation
1142
1159
  - **Lint**: Biome
1143
1160
  - **Test**: Vitest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/kb",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -23,6 +23,7 @@
23
23
  "bin/",
24
24
  "packages/*/dist/**/*.js",
25
25
  "packages/*/dist/**/*.d.ts",
26
+ "scaffold/",
26
27
  "skills/",
27
28
  "README.md",
28
29
  "LICENSE"
@@ -31,7 +32,8 @@
31
32
  ".": "./packages/core/dist/index.js",
32
33
  "./tools": "./packages/tools/dist/index.js",
33
34
  "./store": "./packages/store/dist/index.js",
34
- "./embeddings": "./packages/embeddings/dist/index.js"
35
+ "./embeddings": "./packages/embeddings/dist/index.js",
36
+ "./enterprise-bridge": "./packages/enterprise-bridge/dist/index.js"
35
37
  },
36
38
  "types": "./packages/core/dist/index.d.ts",
37
39
  "bin": {
@@ -51,11 +53,12 @@
51
53
  "devDependencies": {
52
54
  "@biomejs/biome": "^2.x",
53
55
  "@types/node": "^24.x",
54
- "esbuild": "^0.x",
55
- "glob": "^13.x",
56
56
  "rimraf": "^6.x",
57
- "typescript": "^5.x",
58
- "vitest": "^4.x"
57
+ "tsdown": "^0.x",
58
+ "turbo": "^2.x",
59
+ "typescript": "^6.x",
60
+ "vitest": "^4.x",
61
+ "ws": "^8.20.0"
59
62
  },
60
63
  "engines": {
61
64
  "node": ">=24"
@@ -63,7 +66,7 @@
63
66
  "scripts": {
64
67
  "build": "node scripts/build.mjs",
65
68
  "typecheck": "tsc -b tsconfig.build.json --emitDeclarationOnly",
66
- "clean": "rimraf --glob packages/*/dist packages/*/*.tsbuildinfo",
69
+ "clean": "turbo run clean && rimraf --glob node_modules \"packages/*/node_modules\"",
67
70
  "lint": "biome check .",
68
71
  "lint:fix": "biome check --write .",
69
72
  "format": "biome format --write .",
@@ -1,23 +1,20 @@
1
- /**
2
- * Blast-radius analyzer.
3
- *
4
- * Given a set of changed files, traces the dependency graph to find all
5
- * affected files (direct + transitive importers) and their associated tests.
6
- * Returns a minimal review context optimized for token efficiency.
7
- */
8
- import type { AnalysisResult } from './types.js';
9
- export interface BlastRadiusOptions {
10
- /** Changed file paths (relative to root) */
11
- files: string[];
12
- /** Maximum depth of transitive dependency traversal (default: 5) */
13
- maxDepth?: number;
14
- /** Output format */
15
- format?: 'json' | 'markdown';
1
+ import { AnalysisResult } from "./types.js";
2
+
3
+ //#region packages/analyzers/src/blast-radius-analyzer.d.ts
4
+ interface BlastRadiusOptions {
5
+ /** Changed file paths (relative to root) */
6
+ files: string[];
7
+ /** Maximum depth of transitive dependency traversal (default: 5) */
8
+ maxDepth?: number;
9
+ /** Output format */
10
+ format?: 'json' | 'markdown';
16
11
  }
17
- export declare class BlastRadiusAnalyzer {
18
- readonly name = "blast-radius";
19
- private depAnalyzer;
20
- analyze(rootPath: string, options: BlastRadiusOptions): Promise<AnalysisResult>;
21
- private formatMarkdown;
12
+ declare class BlastRadiusAnalyzer {
13
+ readonly name = "blast-radius";
14
+ private depAnalyzer;
15
+ analyze(rootPath: string, options: BlastRadiusOptions): Promise<AnalysisResult>;
16
+ private formatMarkdown;
22
17
  }
18
+ //#endregion
19
+ export { BlastRadiusAnalyzer, BlastRadiusOptions };
23
20
  //# sourceMappingURL=blast-radius-analyzer.d.ts.map
@@ -1,13 +1,7 @@
1
- import{DependencyAnalyzer as A}from"./dependency-analyzer.js";class j{name="blast-radius";depAnalyzer=new A;async analyze(d,n){const{files:c,maxDepth:t=5,format:f="markdown"}=n,p=Date.now(),o=(await this.depAnalyzer.analyze(d,{format:"json"})).data,e=o.reverseGraph??{},y=o.testCoverage??{},a=new Map,g=[];for(const s of c){a.set(s,{path:s,reason:"changed",depth:0});const i=s.replace(/\.[jt]sx?$/,"");g.push({path:i,depth:0})}for(;g.length>0;){const s=g.shift();if(!s)break;const{path:i,depth:h}=s;if(h>=t)continue;const l=e[i]??[];for(const m of l){if(a.has(m))continue;const v=h===0?"direct-importer":"transitive-importer";a.set(m,{path:m,reason:v,depth:h+1});const w=m.replace(/\.[jt]sx?$/,"");g.push({path:w,depth:h+1})}}const $=new Set;for(const[s]of a){const i=s.replace(/\.[jt]sx?$/,""),h=y[i]??[];for(const l of h)a.has(l)||($.add(l),a.set(l,{path:l,reason:"test",depth:999}))}const u=[...a.values()].sort((s,i)=>s.depth-i.depth);return{output:f==="json"?JSON.stringify({changedFiles:c,affected:u},null,2):this.formatMarkdown(c,u,e),data:{changedFiles:c,affected:u},meta:{analyzedAt:new Date().toISOString(),scope:d,fileCount:u.length,durationMs:Date.now()-p}}}formatMarkdown(d,n,c){const t=[];t.push(`## Blast Radius Analysis
2
- `),t.push(`**Changed files:** ${d.length}`),t.push(`**Total affected:** ${n.length}
3
- `);const f=n.filter(e=>e.reason==="changed");if(f.length>0){t.push(`### Changed Files
4
- `);for(const e of f)t.push(`- \`${e.path}\``)}const p=n.filter(e=>e.reason==="direct-importer");if(p.length>0){t.push(`
5
- ### Direct Importers (${p.length} files)
6
- `);for(const e of p)t.push(`- \`${e.path}\``)}const r=n.filter(e=>e.reason==="transitive-importer");if(r.length>0){t.push(`
7
- ### Transitive Importers (${r.length} files)
8
- `);for(const e of r.slice(0,20))t.push(`- \`${e.path}\` (depth ${e.depth})`);r.length>20&&t.push(`- ... and ${r.length-20} more`)}const o=n.filter(e=>e.reason==="test");if(o.length>0){t.push(`
9
- ### Affected Tests (${o.length} files)
10
- `);for(const e of o)t.push(`- \`${e.path}\``)}return t.push(`
1
+ import{DependencyAnalyzer as e}from"./dependency-analyzer.js";var t=class{name=`blast-radius`;depAnalyzer=new e;async analyze(e,t){let{files:n,maxDepth:r=5,format:i=`markdown`}=t,a=Date.now(),o=(await this.depAnalyzer.analyze(e,{format:`json`})).data,s=o.reverseGraph??{},c=o.testCoverage??{},l=new Map,u=[];for(let e of n){l.set(e,{path:e,reason:`changed`,depth:0});let t=e.replace(/\.[jt]sx?$/,``);u.push({path:t,depth:0})}for(;u.length>0;){let e=u.shift();if(!e)break;let{path:t,depth:n}=e;if(n>=r)continue;let i=s[t]??[];for(let e of i){if(l.has(e))continue;let t=n===0?`direct-importer`:`transitive-importer`;l.set(e,{path:e,reason:t,depth:n+1});let r=e.replace(/\.[jt]sx?$/,``);u.push({path:r,depth:n+1})}}let d=new Set;for(let[e]of l){let t=c[e.replace(/\.[jt]sx?$/,``)]??[];for(let e of t)l.has(e)||(d.add(e),l.set(e,{path:e,reason:`test`,depth:999}))}let f=[...l.values()].sort((e,t)=>e.depth-t.depth);return{output:i===`json`?JSON.stringify({changedFiles:n,affected:f},null,2):this.formatMarkdown(n,f,s),data:{changedFiles:n,affected:f},meta:{analyzedAt:new Date().toISOString(),scope:e,fileCount:f.length,durationMs:Date.now()-a}}}formatMarkdown(e,t,n){let r=[];r.push(`## Blast Radius Analysis
2
+ `),r.push(`**Changed files:** ${e.length}`),r.push(`**Total affected:** ${t.length}\n`);let i=t.filter(e=>e.reason===`changed`);if(i.length>0){r.push(`### Changed Files
3
+ `);for(let e of i)r.push(`- \`${e.path}\``)}let a=t.filter(e=>e.reason===`direct-importer`);if(a.length>0){r.push(`\n### Direct Importers (${a.length} files)\n`);for(let e of a)r.push(`- \`${e.path}\``)}let o=t.filter(e=>e.reason===`transitive-importer`);if(o.length>0){r.push(`\n### Transitive Importers (${o.length} files)\n`);for(let e of o.slice(0,20))r.push(`- \`${e.path}\` (depth ${e.depth})`);o.length>20&&r.push(`- ... and ${o.length-20} more`)}let s=t.filter(e=>e.reason===`test`);if(s.length>0){r.push(`\n### Affected Tests (${s.length} files)\n`);for(let e of s)r.push(`- \`${e.path}\``)}return r.push(`
11
4
  ### Review Summary
12
- `),t.push("| Category | Count |"),t.push("|----------|-------|"),t.push(`| Changed | ${f.length} |`),t.push(`| Direct importers | ${p.length} |`),t.push(`| Transitive importers | ${r.length} |`),t.push(`| Affected tests | ${o.length} |`),t.push(`| **Total review scope** | **${n.length}** |`),t.join(`
13
- `)}}export{j as BlastRadiusAnalyzer};
5
+ `),r.push(`| Category | Count |`),r.push(`|----------|-------|`),r.push(`| Changed | ${i.length} |`),r.push(`| Direct importers | ${a.length} |`),r.push(`| Transitive importers | ${o.length} |`),r.push(`| Affected tests | ${s.length} |`),r.push(`| **Total review scope** | **${t.length}** |`),r.join(`
6
+ `)}};export{t as BlastRadiusAnalyzer};
7
+ //# sourceMappingURL=blast-radius-analyzer.js.map
@@ -1,29 +1,33 @@
1
- import type { AnalysisResult, DependencyAnalyzerOptions, IAnalyzer, ImportInfo } from './types.js';
2
- export declare class DependencyAnalyzer implements IAnalyzer<DependencyAnalyzerOptions> {
3
- readonly name = "dependencies";
4
- /** Map of workspace package names to their relative entry point paths */
5
- private workspacePackages;
6
- analyze(rootPath: string, options?: DependencyAnalyzerOptions): Promise<AnalysisResult>;
7
- private collectFiles;
8
- private extractImports;
9
- private groupExternalDeps;
10
- private groupInternalDeps;
11
- /**
12
- * Build reverse graph: for each source file, who imports it?
13
- */
14
- buildReverseGraph(imports: ImportInfo[], _rootPath: string): Record<string, string[]>;
15
- /**
16
- * Build test coverage map: for each source file, which test files exercise it?
17
- */
18
- buildTestCoverage(imports: ImportInfo[], _rootPath: string): Record<string, string[]>;
19
- /** Resolve a relative import path to a normalized file path (best-effort). */
20
- private resolveImportPath;
21
- /**
22
- * Build a map of workspace package names → relative entry point paths.
23
- * Scans for package.json files in common workspace dirs.
24
- */
25
- private buildWorkspaceMap;
26
- private formatMarkdown;
27
- private formatMermaid;
1
+ import { AnalysisResult, DependencyAnalyzerOptions, IAnalyzer, ImportInfo } from "./types.js";
2
+
3
+ //#region packages/analyzers/src/dependency-analyzer.d.ts
4
+ declare class DependencyAnalyzer implements IAnalyzer<DependencyAnalyzerOptions> {
5
+ readonly name = "dependencies";
6
+ /** Map of workspace package names to their relative entry point paths */
7
+ private workspacePackages;
8
+ analyze(rootPath: string, options?: DependencyAnalyzerOptions): Promise<AnalysisResult>;
9
+ private collectFiles;
10
+ private extractImports;
11
+ private groupExternalDeps;
12
+ private groupInternalDeps;
13
+ /**
14
+ * Build reverse graph: for each source file, who imports it?
15
+ */
16
+ buildReverseGraph(imports: ImportInfo[], _rootPath: string): Record<string, string[]>;
17
+ /**
18
+ * Build test coverage map: for each source file, which test files exercise it?
19
+ */
20
+ buildTestCoverage(imports: ImportInfo[], _rootPath: string): Record<string, string[]>;
21
+ /** Resolve a relative import path to a normalized file path (best-effort). */
22
+ private resolveImportPath;
23
+ /**
24
+ * Build a map of workspace package names → relative entry point paths.
25
+ * Scans for package.json files in common workspace dirs.
26
+ */
27
+ private buildWorkspaceMap;
28
+ private formatMarkdown;
29
+ private formatMermaid;
28
30
  }
31
+ //#endregion
32
+ export { DependencyAnalyzer };
29
33
  //# sourceMappingURL=dependency-analyzer.d.ts.map
@@ -1,11 +1,9 @@
1
- import{readdir as w,readFile as j}from"node:fs/promises";import{dirname as x,extname as m,join as u,relative as v,resolve as R}from"node:path";const $=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".java",".go",".cs",".kt",".scala",".rb",".rs",".php",".swift"]),P=[{regex:/import\s+(?:(?:type\s+)?(?:(?:\{[^}]*\}|[\w*]+)\s+from\s+)?)['"]([^'"]+)['"]/g,confidence:"high"},{regex:/import\(\s*['"]([^'"]+)['"]\s*\)/g,confidence:"medium"},{regex:/require\(\s*['"]([^'"]+)['"]\s*\)/g,confidence:"medium"},{regex:/^from\s+([\w.]+)\s+import\b/gm,confidence:"high",lang:"python"},{regex:/^import\s+([\w.]+)\s*$/gm,confidence:"high",lang:"python"},{regex:/^import\s+(?:static\s+)?([\w.]+(?:\.\*)?)\s*;/gm,confidence:"high",lang:"java"},{regex:/(?:^import\s+|^\s+)[""]([^""]+)[""]/gm,confidence:"high",lang:"go"},{regex:/^using\s+(?:static\s+)?([\w.]+)\s*;/gm,confidence:"high",lang:"csharp"},{regex:/^use\s+([\w:]+(?:::\w+)*)/gm,confidence:"high",lang:"rust"},{regex:/^use\s+([\w\\]+)\s*;/gm,confidence:"high",lang:"php"},{regex:/require(?:_relative)?\s+['"]([^'"]+)['"]/g,confidence:"medium",lang:"ruby"},{regex:/^import\s+(\w+)\s*$/gm,confidence:"high",lang:"swift"}],I=new Set(["node_modules",".git","dist","build","coverage",".turbo",".cache","cdk.out"]),E=[/\.(test|spec)\.[jt]sx?$/,/\/__tests__\//,/\/test\//,/\/tests\//],b={".ts":"js",".tsx":"js",".js":"js",".jsx":"js",".mjs":"js",".cjs":"js",".py":"python",".java":"java",".kt":"java",".scala":"java",".go":"go",".cs":"csharp",".rs":"rust",".php":"php",".rb":"ruby",".swift":"swift"};function S(a,n){return!n||n==="js"?!a.startsWith(".")&&!a.startsWith("/"):n==="python"?!a.startsWith("."):n==="java"?!a.startsWith("com.")||a.startsWith("com.amazonaws")||a.startsWith("com.google")||a.startsWith("com.fasterxml"):n==="go"?a.includes(".")&&!a.startsWith("."):n==="csharp"?a.startsWith("System")||a.startsWith("Microsoft")||a.startsWith("Newtonsoft")||a.startsWith("Amazon"):n==="rust"?!a.startsWith("crate::")&&!a.startsWith("self::")&&!a.startsWith("super::"):!0}function y(a){return E.some(n=>n.test(a))}class W{name="dependencies";workspacePackages=new Map;async analyze(n,o={}){const{format:i="markdown"}=o,t=Date.now();this.workspacePackages=await this.buildWorkspaceMap(n);const e=await this.collectFiles(n),r=[];for(const d of e){const f=await j(d,"utf-8"),h=this.extractImports(f,d,n);r.push(...h)}const s=this.groupExternalDeps(r),c=this.groupInternalDeps(r,n),g=this.buildReverseGraph(r,n),l=this.buildTestCoverage(r,n);return{output:i==="json"?JSON.stringify({external:s,internal:c,reverseGraph:g,testCoverage:l},null,2):i==="mermaid"?this.formatMermaid(c):this.formatMarkdown(s,c,n,l),data:{external:s,internal:c,reverseGraph:g,testCoverage:l,totalImports:r.length},meta:{analyzedAt:new Date().toISOString(),scope:n,fileCount:e.length,durationMs:Date.now()-t}}}async collectFiles(n){const o=[],i=async t=>{const e=await w(t,{withFileTypes:!0});for(const r of e){if(I.has(r.name)||r.name.startsWith("."))continue;const s=u(t,r.name);r.isDirectory()?await i(s):$.has(m(r.name))&&o.push(s)}};return await i(n),o}extractImports(n,o,i){const t=[],e=m(o).toLowerCase(),r=b[e];for(const s of P){if(s.lang&&s.lang!==r||!s.lang&&r&&r!=="js")continue;const c=new RegExp(s.regex.source,s.regex.flags);let g;for(;(g=c.exec(n))!==null;){const l=g[1],p=S(l,r);t.push({source:l,specifiers:[],filePath:v(i,o).replace(/\\/g,"/"),isExternal:p,confidence:s.confidence})}}return t}groupExternalDeps(n){const o={};for(const t of n){if(!t.isExternal)continue;const e=m(t.filePath).toLowerCase(),r=b[e];let s;if(r==="java"){const c=t.source.split(".");for(;c.length>1;){const g=c[c.length-1];if(g==="*"||/^[A-Z]/.test(g))c.pop();else break}c.length>=2?s=c.slice(0,2).join("."):s=c.join(".")}else if(r==="python")s=t.source.split(".")[0];else if(r==="go")s=t.source;else if(r==="csharp"){const c=t.source.split(".");s=c.length>=2?c.slice(0,2).join("."):t.source}else s=t.source.startsWith("@")?t.source.split("/").slice(0,2).join("/"):t.source.split("/")[0];o[s]||(o[s]={count:0,confidence:t.confidence,usedBy:new Set}),o[s].count++,o[s].usedBy.add(t.filePath),t.confidence==="high"?o[s].confidence="high":t.confidence==="medium"&&o[s].confidence==="low"&&(o[s].confidence="medium")}const i={};for(const[t,e]of Object.entries(o))i[t]={count:e.count,confidence:e.confidence,usedBy:[...e.usedBy]};return i}groupInternalDeps(n,o){const i={};for(const e of n)e.isExternal||(i[e.filePath]||(i[e.filePath]=new Set),i[e.filePath].add(e.source));const t={};for(const[e,r]of Object.entries(i))t[e]=[...r];return t}buildReverseGraph(n,o){const i={};for(const e of n){const r=x(e.filePath),s=this.resolveImportPath(e.source,r);s&&(i[s]||(i[s]=new Set),i[s].add(e.filePath))}const t={};for(const[e,r]of Object.entries(i))t[e]=[...r];return t}buildTestCoverage(n,o){const i={};for(const e of n){if(!y(e.filePath))continue;const r=x(e.filePath),s=this.resolveImportPath(e.source,r);!s||y(s)||(i[s]||(i[s]=new Set),i[s].add(e.filePath))}const t={};for(const[e,r]of Object.entries(i))t[e]=[...r];return t}resolveImportPath(n,o){if(n.startsWith("."))return u(o,n).replace(/\\/g,"/").replace(/\.[jt]sx?$/,"");const i=n.startsWith("@")?n.split("/").slice(0,2).join("/"):n.split("/")[0],t=this.workspacePackages.get(i);return t?t.replace(/\.[jt]sx?$/,""):null}async buildWorkspaceMap(n){const o=new Map,i=["packages","functions","libs","apps","cdk"];for(const t of i){const e=u(n,t);try{const r=await w(e,{withFileTypes:!0});for(const s of r)if(!(!s.isDirectory()||I.has(s.name)))try{const c=u(e,s.name,"package.json"),g=JSON.parse(await j(c,"utf-8"));if(g.name){const l=g.main??g.exports?.["."]??"src/index.ts",p=v(n,R(e,s.name,l)).replace(/\\/g,"/");o.set(g.name,p)}}catch{}}catch{}}return o}formatMarkdown(n,o,i,t){const e=[];e.push(`## Dependencies: ${i}
2
- `);const r=Object.entries(n).sort((l,p)=>p[1].count-l[1].count),s=r.length,c=r.reduce((l,[,p])=>l+p.count,0),g=r.slice(0,5).map(([l])=>l);e.push(`**${s} external packages**, **${c} total imports**, **${Object.keys(o).length} files** with internal imports.
3
- `),g.length>0&&e.push(`**Top dependencies**: ${g.join(", ")}
4
- `),e.push(`### External Dependencies
5
- `),e.push("| Package | Imports | Used By |"),e.push("|---------|---------|---------|");for(const[l,p]of r)e.push(`| ${l} | ${p.count} | ${p.usedBy.length} ${p.usedBy.length===1?"file":"files"} |`);if(t&&Object.keys(t).length>0){const l=Object.keys(t).length,p=Object.keys(o).filter(f=>!y(f)&&!t[f.replace(/\\.[jt]sx?$/,"")]);e.push(`
1
+ import{readFile as e,readdir as t}from"node:fs/promises";import{dirname as n,extname as r,join as i,relative as a,resolve as o}from"node:path";const s=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.py`,`.java`,`.go`,`.cs`,`.kt`,`.scala`,`.rb`,`.rs`,`.php`,`.swift`]),c=[{regex:/import\s+(?:(?:type\s+)?(?:(?:\{[^}]*\}|[\w*]+)\s+from\s+)?)['"]([^'"]+)['"]/g,confidence:`high`},{regex:/import\(\s*['"]([^'"]+)['"]\s*\)/g,confidence:`medium`},{regex:/require\(\s*['"]([^'"]+)['"]\s*\)/g,confidence:`medium`},{regex:/^from\s+([\w.]+)\s+import\b/gm,confidence:`high`,lang:`python`},{regex:/^import\s+([\w.]+)\s*$/gm,confidence:`high`,lang:`python`},{regex:/^import\s+(?:static\s+)?([\w.]+(?:\.\*)?)\s*;/gm,confidence:`high`,lang:`java`},{regex:/(?:^import\s+|^\s+)[""]([^""]+)[""]/gm,confidence:`high`,lang:`go`},{regex:/^using\s+(?:static\s+)?([\w.]+)\s*;/gm,confidence:`high`,lang:`csharp`},{regex:/^use\s+([\w:]+(?:::\w+)*)/gm,confidence:`high`,lang:`rust`},{regex:/^use\s+([\w\\]+)\s*;/gm,confidence:`high`,lang:`php`},{regex:/require(?:_relative)?\s+['"]([^'"]+)['"]/g,confidence:`medium`,lang:`ruby`},{regex:/^import\s+(\w+)\s*$/gm,confidence:`high`,lang:`swift`}],l=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`]),u=[/\.(test|spec)\.[jt]sx?$/,/\/__tests__\//,/\/test\//,/\/tests\//],d={".ts":`js`,".tsx":`js`,".js":`js`,".jsx":`js`,".mjs":`js`,".cjs":`js`,".py":`python`,".java":`java`,".kt":`java`,".scala":`java`,".go":`go`,".cs":`csharp`,".rs":`rust`,".php":`php`,".rb":`ruby`,".swift":`swift`};function f(e,t){return!t||t===`js`?!e.startsWith(`.`)&&!e.startsWith(`/`):t===`python`?!e.startsWith(`.`):t===`java`?!e.startsWith(`com.`)||e.startsWith(`com.amazonaws`)||e.startsWith(`com.google`)||e.startsWith(`com.fasterxml`):t===`go`?e.includes(`.`)&&!e.startsWith(`.`):t===`csharp`?e.startsWith(`System`)||e.startsWith(`Microsoft`)||e.startsWith(`Newtonsoft`)||e.startsWith(`Amazon`):t===`rust`?!e.startsWith(`crate::`)&&!e.startsWith(`self::`)&&!e.startsWith(`super::`):!0}function p(e){return u.some(t=>t.test(e))}var m=class{name=`dependencies`;workspacePackages=new Map;async analyze(t,n={}){let{format:r=`markdown`}=n,i=Date.now();this.workspacePackages=await this.buildWorkspaceMap(t);let a=await this.collectFiles(t),o=[];for(let n of a){let r=await e(n,`utf-8`),i=this.extractImports(r,n,t);o.push(...i)}let s=this.groupExternalDeps(o),c=this.groupInternalDeps(o,t),l=this.buildReverseGraph(o,t),u=this.buildTestCoverage(o,t);return{output:r===`json`?JSON.stringify({external:s,internal:c,reverseGraph:l,testCoverage:u},null,2):r===`mermaid`?this.formatMermaid(c):this.formatMarkdown(s,c,t,u),data:{external:s,internal:c,reverseGraph:l,testCoverage:u,totalImports:o.length},meta:{analyzedAt:new Date().toISOString(),scope:t,fileCount:a.length,durationMs:Date.now()-i}}}async collectFiles(e){let n=[],a=async e=>{let o=await t(e,{withFileTypes:!0});for(let t of o){if(l.has(t.name)||t.name.startsWith(`.`))continue;let o=i(e,t.name);t.isDirectory()?await a(o):s.has(r(t.name))&&n.push(o)}};return await a(e),n}extractImports(e,t,n){let i=[],o=d[r(t).toLowerCase()];for(let r of c){if(r.lang&&r.lang!==o||!r.lang&&o&&o!==`js`)continue;let s=new RegExp(r.regex.source,r.regex.flags),c;for(;(c=s.exec(e))!==null;){let e=c[1],s=f(e,o);i.push({source:e,specifiers:[],filePath:a(n,t).replace(/\\/g,`/`),isExternal:s,confidence:r.confidence})}}return i}groupExternalDeps(e){let t={};for(let n of e){if(!n.isExternal)continue;let e=d[r(n.filePath).toLowerCase()],i;if(e===`java`){let e=n.source.split(`.`);for(;e.length>1;){let t=e[e.length-1];if(t===`*`||/^[A-Z]/.test(t))e.pop();else break}i=e.length>=2?e.slice(0,2).join(`.`):e.join(`.`)}else if(e===`python`)i=n.source.split(`.`)[0];else if(e===`go`)i=n.source;else if(e===`csharp`){let e=n.source.split(`.`);i=e.length>=2?e.slice(0,2).join(`.`):n.source}else i=n.source.startsWith(`@`)?n.source.split(`/`).slice(0,2).join(`/`):n.source.split(`/`)[0];t[i]||(t[i]={count:0,confidence:n.confidence,usedBy:new Set}),t[i].count++,t[i].usedBy.add(n.filePath),n.confidence===`high`?t[i].confidence=`high`:n.confidence===`medium`&&t[i].confidence===`low`&&(t[i].confidence=`medium`)}let n={};for(let[e,r]of Object.entries(t))n[e]={count:r.count,confidence:r.confidence,usedBy:[...r.usedBy]};return n}groupInternalDeps(e,t){let n={};for(let t of e)t.isExternal||(n[t.filePath]||(n[t.filePath]=new Set),n[t.filePath].add(t.source));let r={};for(let[e,t]of Object.entries(n))r[e]=[...t];return r}buildReverseGraph(e,t){let r={};for(let t of e){let e=n(t.filePath),i=this.resolveImportPath(t.source,e);i&&(r[i]||(r[i]=new Set),r[i].add(t.filePath))}let i={};for(let[e,t]of Object.entries(r))i[e]=[...t];return i}buildTestCoverage(e,t){let r={};for(let t of e){if(!p(t.filePath))continue;let e=n(t.filePath),i=this.resolveImportPath(t.source,e);!i||p(i)||(r[i]||(r[i]=new Set),r[i].add(t.filePath))}let i={};for(let[e,t]of Object.entries(r))i[e]=[...t];return i}resolveImportPath(e,t){if(e.startsWith(`.`))return i(t,e).replace(/\\/g,`/`).replace(/\.[jt]sx?$/,``);let n=e.startsWith(`@`)?e.split(`/`).slice(0,2).join(`/`):e.split(`/`)[0],r=this.workspacePackages.get(n);return r?r.replace(/\.[jt]sx?$/,``):null}async buildWorkspaceMap(n){let r=new Map;for(let s of[`packages`,`functions`,`libs`,`apps`,`cdk`]){let c=i(n,s);try{let s=await t(c,{withFileTypes:!0});for(let t of s)if(!(!t.isDirectory()||l.has(t.name)))try{let s=i(c,t.name,`package.json`),l=JSON.parse(await e(s,`utf-8`));if(l.name){let e=l.main??l.exports?.[`.`]??`src/index.ts`,i=a(n,o(c,t.name,e)).replace(/\\/g,`/`);r.set(l.name,i)}}catch{}}catch{}}return r}formatMarkdown(e,t,n,r){let i=[];i.push(`## Dependencies: ${n}\n`);let a=Object.entries(e).sort((e,t)=>t[1].count-e[1].count),o=a.length,s=a.reduce((e,[,t])=>e+t.count,0),c=a.slice(0,5).map(([e])=>e);i.push(`**${o} external packages**, **${s} total imports**, **${Object.keys(t).length} files** with internal imports.\n`),c.length>0&&i.push(`**Top dependencies**: ${c.join(`, `)}\n`),i.push(`### External Dependencies
2
+ `),i.push(`| Package | Imports | Used By |`),i.push(`|---------|---------|---------|`);for(let[e,t]of a)i.push(`| ${e} | ${t.count} | ${t.usedBy.length} ${t.usedBy.length===1?`file`:`files`} |`);if(r&&Object.keys(r).length>0){let e=Object.keys(r).length,n=Object.keys(t).filter(e=>!p(e)&&!r[e.replace(/\\.[jt]sx?$/,``)]);i.push(`
6
3
  ### Test Coverage Summary
7
- `),e.push(`**${l} source modules** with test coverage.`),p.length>0&&e.push(`**${p.length} source files** with no detected test coverage.`);const d=Object.entries(t).sort((f,h)=>h[1].length-f[1].length);e.push(`
4
+ `),i.push(`**${e} source modules** with test coverage.`),n.length>0&&i.push(`**${n.length} source files** with no detected test coverage.`);let a=Object.entries(r).sort((e,t)=>t[1].length-e[1].length);i.push(`
8
5
  **Most-tested modules:**
9
- `);for(const[f,h]of d.slice(0,10)){const k=f.replace(/\/dist\/[^/]*$/,"/src/index").replace(/\.mjs$/,".ts");e.push(`- ${k} (${h.length} ${h.length===1?"test":"tests"})`)}}return e.join(`
10
- `)}formatMermaid(n){const o=["graph LR"],i=t=>t.replace(/[^a-zA-Z0-9]/g,"_");for(const[t,e]of Object.entries(n).slice(0,40)){const r=i(t);for(const s of e){const c=i(s);o.push(` ${r}["${t}"] --> ${c}["${s}"]`)}}return o.join(`
11
- `)}}export{W as DependencyAnalyzer};
6
+ `);for(let[e,t]of a.slice(0,10)){let n=e.replace(/\/dist\/[^/]*$/,`/src/index`).replace(/\.mjs$/,`.ts`);i.push(`- ${n} (${t.length} ${t.length===1?`test`:`tests`})`)}}return i.join(`
7
+ `)}formatMermaid(e){let t=[`graph LR`],n=e=>e.replace(/[^a-zA-Z0-9]/g,`_`);for(let[r,i]of Object.entries(e).slice(0,40)){let e=n(r);for(let a of i){let i=n(a);t.push(` ${e}["${r}"] --> ${i}["${a}"]`)}}return t.join(`
8
+ `)}};export{m as DependencyAnalyzer};
9
+ //# sourceMappingURL=dependency-analyzer.js.map
@@ -1,13 +1,17 @@
1
- import type { AnalysisResult, DiagramOptions, IAnalyzer } from './types.js';
1
+ import { AnalysisResult, DiagramOptions, IAnalyzer } from "./types.js";
2
+
3
+ //#region packages/analyzers/src/diagram-generator.d.ts
2
4
  /**
3
5
  * Generates Mermaid diagrams by combining output from other analyzers.
4
6
  */
5
- export declare class DiagramGenerator implements IAnalyzer<DiagramOptions> {
6
- readonly name = "diagrams";
7
- private readonly structureAnalyzer;
8
- private readonly dependencyAnalyzer;
9
- analyze(rootPath: string, options?: DiagramOptions): Promise<AnalysisResult>;
10
- private generateArchitectureDiagram;
11
- private generateDependencyDiagram;
7
+ declare class DiagramGenerator implements IAnalyzer<DiagramOptions> {
8
+ readonly name = "diagrams";
9
+ private readonly structureAnalyzer;
10
+ private readonly dependencyAnalyzer;
11
+ analyze(rootPath: string, options?: DiagramOptions): Promise<AnalysisResult>;
12
+ private generateArchitectureDiagram;
13
+ private generateDependencyDiagram;
12
14
  }
15
+ //#endregion
16
+ export { DiagramGenerator };
13
17
  //# sourceMappingURL=diagram-generator.d.ts.map
@@ -1,4 +1,3 @@
1
- import{DependencyAnalyzer as u}from"./dependency-analyzer.js";import{StructureAnalyzer as g}from"./structure-analyzer.js";class D{name="diagrams";structureAnalyzer=new g;dependencyAnalyzer=new u;async analyze(r,d={}){const{diagramType:o="architecture"}=d,p=Date.now();let s;return o==="dependencies"?s=await this.generateDependencyDiagram(r):s=await this.generateArchitectureDiagram(r),{output:s,data:{diagramType:o},meta:{analyzedAt:new Date().toISOString(),scope:r,fileCount:0,durationMs:Date.now()-p}}}async generateArchitectureDiagram(r){const o=(await this.structureAnalyzer.analyze(r,{format:"json",maxDepth:4})).data.tree,s=(await this.dependencyAnalyzer.analyze(r,{format:"json"})).data,n=["```mermaid","graph TB"],y=(o.children??[]).filter(t=>t.type==="directory").slice(0,15);for(const t of y){const c=t.name.replace(/[^a-zA-Z0-9]/g,"_"),a=(t.children??[]).filter(e=>e.type==="directory");if(a.length>0){n.push(` subgraph ${c}["${t.name}/"]`);for(const e of a.slice(0,12)){const i=`${c}_${e.name.replace(/[^a-zA-Z0-9]/g,"_")}`,l=Array.isArray(e.children)?e.children.length:0;n.push(` ${i}["${e.name}/ (${l})"]`)}n.push(" end")}else{const e=Array.isArray(t.children)?t.children.length:0;n.push(` ${c}["${t.name}/ (${e} files)"]`)}}const m=new Set;if(s.internal)for(const[t,c]of Object.entries(s.internal)){const a=t.split("/")[0]?.replace(/[^a-zA-Z0-9]/g,"_");for(const e of c){if(e.startsWith("."))continue;const i=e.split("/")[0]?.replace(/[^a-zA-Z0-9]/g,"_");if(a&&i&&a!==i){const l=`${a}->${i}`;m.has(l)||(m.add(l),n.push(` ${a} --> ${i}`))}}}return n.push("```"),n.join(`
2
- `)}async generateDependencyDiagram(r){return`\`\`\`mermaid
3
- ${(await this.dependencyAnalyzer.analyze(r,{format:"mermaid"})).output}
4
- \`\`\``}}export{D as DiagramGenerator};
1
+ import{DependencyAnalyzer as e}from"./dependency-analyzer.js";import{StructureAnalyzer as t}from"./structure-analyzer.js";var n=class{name=`diagrams`;structureAnalyzer=new t;dependencyAnalyzer=new e;async analyze(e,t={}){let{diagramType:n=`architecture`}=t,r=Date.now(),i;switch(n){case`dependencies`:i=await this.generateDependencyDiagram(e);break;default:i=await this.generateArchitectureDiagram(e);break}return{output:i,data:{diagramType:n},meta:{analyzedAt:new Date().toISOString(),scope:e,fileCount:0,durationMs:Date.now()-r}}}async generateArchitectureDiagram(e){let t=(await this.structureAnalyzer.analyze(e,{format:`json`,maxDepth:4})).data.tree,n=(await this.dependencyAnalyzer.analyze(e,{format:`json`})).data,r=["```mermaid",`graph TB`],i=(t.children??[]).filter(e=>e.type===`directory`).slice(0,15);for(let e of i){let t=e.name.replace(/[^a-zA-Z0-9]/g,`_`),n=(e.children??[]).filter(e=>e.type===`directory`);if(n.length>0){r.push(` subgraph ${t}["${e.name}/"]`);for(let e of n.slice(0,12)){let n=`${t}_${e.name.replace(/[^a-zA-Z0-9]/g,`_`)}`,i=Array.isArray(e.children)?e.children.length:0;r.push(` ${n}["${e.name}/ (${i})"]`)}r.push(` end`)}else{let n=Array.isArray(e.children)?e.children.length:0;r.push(` ${t}["${e.name}/ (${n} files)"]`)}}let a=new Set;if(n.internal)for(let[e,t]of Object.entries(n.internal)){let n=e.split(`/`)[0]?.replace(/[^a-zA-Z0-9]/g,`_`);for(let e of t){if(e.startsWith(`.`))continue;let t=e.split(`/`)[0]?.replace(/[^a-zA-Z0-9]/g,`_`);if(n&&t&&n!==t){let e=`${n}->${t}`;a.has(e)||(a.add(e),r.push(` ${n} --> ${t}`))}}}return r.push("```"),r.join(`
2
+ `)}async generateDependencyDiagram(e){return`\`\`\`mermaid\n${(await this.dependencyAnalyzer.analyze(e,{format:`mermaid`})).output}\n\`\`\``}};export{n as DiagramGenerator};
3
+ //# sourceMappingURL=diagram-generator.js.map
@@ -1,19 +1,41 @@
1
- import type { AnalysisResult, AnalyzerOptions, IAnalyzer } from './types.js';
2
- export declare class EntryPointAnalyzer implements IAnalyzer<AnalyzerOptions> {
3
- readonly name = "entry-points";
4
- analyze(rootPath: string, _options?: AnalyzerOptions): Promise<AnalysisResult>;
5
- private fromPackageJson;
6
- private fromHandlerExports;
7
- /** Extract a meaningful name from the file path for non-JS entry points */
8
- private inferNameFromFile;
9
- /**
10
- * Derive a contextual name from the directory path for generic handler/main files.
11
- * E.g., "services/channels/email/delivery/src/handler.ts" → "email-delivery"
12
- */
13
- private deriveContextualName;
14
- private inferEntryType;
15
- private detectTrigger;
16
- private collectFiles;
17
- private formatMarkdown;
1
+ import { AnalysisResult, AnalyzerOptions, IAnalyzer } from "./types.js";
2
+
3
+ //#region packages/analyzers/src/entry-point-analyzer.d.ts
4
+ declare class EntryPointAnalyzer implements IAnalyzer<AnalyzerOptions> {
5
+ readonly name = "entry-points";
6
+ analyze(rootPath: string, _options?: AnalyzerOptions): Promise<AnalysisResult>;
7
+ private fromPackageJson;
8
+ /** Parse package.json `exports` field into entry points. */
9
+ private parseExportsField;
10
+ /** Resolve export value through condition maps (import > default > first string). */
11
+ private resolveExportValue;
12
+ /**
13
+ * Find all workspace package directories in a monorepo.
14
+ * Supports pnpm-workspace.yaml and package.json#workspaces.
15
+ */
16
+ private findWorkspacePackages;
17
+ /** Simple YAML parser for pnpm-workspace.yaml — extracts packages list. */
18
+ private parsePnpmWorkspaceYaml;
19
+ /**
20
+ * Expand a workspace glob like "packages/*" into actual directories
21
+ * that contain package.json files.
22
+ */
23
+ private expandWorkspaceGlob;
24
+ private fromHandlerExports;
25
+ /** Check if a file is a test suite. */
26
+ private isTestFile;
27
+ /** Extract a meaningful name from the file path for non-JS entry points */
28
+ private inferNameFromFile;
29
+ /**
30
+ * Derive a contextual name from the directory path for generic handler/main files.
31
+ * E.g., "services/channels/email/delivery/src/handler.ts" → "email-delivery"
32
+ */
33
+ private deriveContextualName;
34
+ private inferEntryType;
35
+ private detectTrigger;
36
+ private collectFiles;
37
+ private formatMarkdown;
18
38
  }
39
+ //#endregion
40
+ export { EntryPointAnalyzer };
19
41
  //# sourceMappingURL=entry-point-analyzer.d.ts.map