@vpxa/kb 0.1.13 → 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 +8 -2
  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 -35
  10. package/packages/analyzers/dist/entry-point-analyzer.js +5 -6
  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 +8 -3
  66. package/packages/cli/dist/commands/init.js +120 -123
  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 -7
  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 -5
  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 +8 -7
  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 +107 -91
  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 -3
  145. package/packages/server/dist/tools/audit.tool.d.ts +8 -4
  146. package/packages/server/dist/tools/audit.tool.js +2 -4
  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 -22
  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 -24
  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 -46
  198. package/packages/store/dist/store.interface.js +1 -0
  199. package/packages/tools/dist/audit.d.ts +61 -61
  200. package/packages/tools/dist/audit.js +5 -5
  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 +42 -38
  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 -37
  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 -25
  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 +14 -11
  250. package/packages/tools/dist/guide.js +2 -1
  251. package/packages/tools/dist/health.d.ts +13 -10
  252. package/packages/tools/dist/health.js +3 -2
  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 -53
  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 +4 -1
  266. package/packages/tools/dist/path-resolver.js +2 -1
  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 +32 -29
  276. package/packages/tools/dist/replay.js +5 -6
  277. package/packages/tools/dist/response-envelope.d.ts +32 -29
  278. package/packages/tools/dist/response-envelope.js +2 -1
  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 -47
  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 +6 -3
  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 +22 -9
@@ -1,4 +1,4 @@
1
- import{existsSync as g,mkdirSync as l,readFileSync as N,writeFileSync as f}from"node:fs";import{dirname as S,join as I}from"node:path";class b{db=null;dbPath;dirty=!1;constructor(e){const t=e?.path??".kb-data";this.dbPath=I(t,"graph.db")}async initialize(){const e=S(this.dbPath);g(e)||l(e,{recursive:!0});const t=(await import("sql.js")).default,s=await t();if(g(this.dbPath)){const i=N(this.dbPath);this.db=new s.Database(i)}else this.db=new s.Database;this.db.run("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA foreign_keys = ON;"),this.db.run(`
1
+ import{existsSync as e,mkdirSync as t,readFileSync as n,writeFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";var o=class{db=null;dbPath;dirty=!1;constructor(e){this.dbPath=a(e?.path??`.kb-data`,`graph.db`)}async initialize(){let r=i(this.dbPath);e(r)||t(r,{recursive:!0});let a=(await import(`sql.js`)).default,o=await a();if(e(this.dbPath)){let e=n(this.dbPath);this.db=new o.Database(e)}else this.db=new o.Database;this.db.run(`PRAGMA journal_mode = WAL`),this.db.exec(`PRAGMA foreign_keys = ON;`),this.db.run(`
2
2
  CREATE TABLE IF NOT EXISTS nodes (
3
3
  id TEXT PRIMARY KEY,
4
4
  type TEXT NOT NULL,
@@ -19,7 +19,7 @@ import{existsSync as g,mkdirSync as l,readFileSync as N,writeFileSync as f}from"
19
19
  FOREIGN KEY (from_id) REFERENCES nodes(id) ON DELETE CASCADE,
20
20
  FOREIGN KEY (to_id) REFERENCES nodes(id) ON DELETE CASCADE
21
21
  )
22
- `),this.db.run("CREATE INDEX IF NOT EXISTS idx_nodes_type ON nodes(type)"),this.db.run("CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)"),this.db.run("CREATE INDEX IF NOT EXISTS idx_nodes_source_path ON nodes(source_path)"),this.db.run("CREATE INDEX IF NOT EXISTS idx_edges_from ON edges(from_id)"),this.db.run("CREATE INDEX IF NOT EXISTS idx_edges_to ON edges(to_id)"),this.db.run("CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(type)"),this.persist()}ensureDb(){if(!this.db)throw new Error("Graph store not initialized \u2014 call initialize() first");return this.db}persist(){if(!this.db)return;const e=this.db.export();f(this.dbPath,Buffer.from(e)),this.db.exec("PRAGMA foreign_keys = ON;"),this.dirty=!1}markDirty(){this.dirty=!0}flushIfDirty(){this.dirty&&this.persist()}query(e,t=[]){const i=this.ensureDb().prepare(e);i.bind(t);const d=[];for(;i.step();)d.push(i.getAsObject());return i.free(),d}run(e,t=[]){this.ensureDb().run(e,t)}async upsertNode(e){this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
22
+ `),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_type ON nodes(type)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_source_path ON nodes(source_path)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_from ON edges(from_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_to ON edges(to_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(type)`),this.persist()}ensureDb(){if(!this.db)throw Error(`Graph store not initialized call initialize() first`);return this.db}persist(){if(!this.db)return;let e=this.db.export();try{r(this.dbPath,Buffer.from(e))}finally{this.db.exec(`PRAGMA foreign_keys = ON;`)}this.dirty=!1}markDirty(){this.dirty=!0}flushIfDirty(){this.dirty&&this.persist()}query(e,t=[]){let n=this.ensureDb().prepare(e);n.bind(t);let r=[];try{for(;n.step();)r.push(n.getAsObject())}finally{n.free()}return r}run(e,t=[]){this.ensureDb().run(e,t)}async upsertNode(e){this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
23
23
  VALUES (?, ?, ?, ?, ?, ?, ?)
24
24
  ON CONFLICT(id) DO UPDATE SET
25
25
  type = excluded.type, name = excluded.name, properties = excluded.properties,
@@ -27,20 +27,21 @@ import{existsSync as g,mkdirSync as l,readFileSync as N,writeFileSync as f}from"
27
27
  VALUES (?, ?, ?, ?, ?, ?)
28
28
  ON CONFLICT(id) DO UPDATE SET
29
29
  from_id = excluded.from_id, to_id = excluded.to_id,
30
- type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[e.id,e.fromId,e.toId,e.type,e.weight??1,JSON.stringify(e.properties??{})]),this.markDirty(),this.flushIfDirty()}async upsertNodes(e){if(e.length!==0){this.ensureDb().run("BEGIN TRANSACTION");for(const t of e)this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
31
- VALUES (?, ?, ?, ?, ?, ?, ?)
32
- ON CONFLICT(id) DO UPDATE SET
33
- type = excluded.type, name = excluded.name, properties = excluded.properties,
34
- source_record_id = excluded.source_record_id, source_path = excluded.source_path`,[t.id,t.type,t.name,JSON.stringify(t.properties),t.sourceRecordId??null,t.sourcePath??null,t.createdAt??new Date().toISOString()]);this.ensureDb().run("COMMIT"),this.markDirty(),this.flushIfDirty()}}async upsertEdges(e){if(e.length!==0){this.ensureDb().run("BEGIN TRANSACTION");for(const t of e)this.run(`INSERT INTO edges (id, from_id, to_id, type, weight, properties)
35
- VALUES (?, ?, ?, ?, ?, ?)
36
- ON CONFLICT(id) DO UPDATE SET
37
- from_id = excluded.from_id, to_id = excluded.to_id,
38
- type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,JSON.stringify(t.properties??{})]);this.ensureDb().run("COMMIT"),this.markDirty(),this.flushIfDirty()}}async getNode(e){const t=this.query("SELECT * FROM nodes WHERE id = ?",[e]);return t.length>0?T(t[0]):null}async getNeighbors(e,t){const s=t?.direction??"both",i=t?.edgeType,d=t?.limit??50,p=[],n=[],u=new Set,h=`
30
+ type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[e.id,e.fromId,e.toId,e.type,e.weight??1,JSON.stringify(e.properties??{})]),this.markDirty(),this.flushIfDirty()}async upsertNodes(e){if(e.length===0)return;let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{for(let t of e)this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
31
+ VALUES (?, ?, ?, ?, ?, ?, ?)
32
+ ON CONFLICT(id) DO UPDATE SET
33
+ type = excluded.type, name = excluded.name, properties = excluded.properties,
34
+ source_record_id = excluded.source_record_id, source_path = excluded.source_path`,[t.id,t.type,t.name,JSON.stringify(t.properties),t.sourceRecordId??null,t.sourcePath??null,t.createdAt??new Date().toISOString()]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async upsertEdges(e){if(e.length===0)return;let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{for(let t of e)this.run(`INSERT INTO edges (id, from_id, to_id, type, weight, properties)
35
+ VALUES (?, ?, ?, ?, ?, ?)
36
+ ON CONFLICT(id) DO UPDATE SET
37
+ from_id = excluded.from_id, to_id = excluded.to_id,
38
+ type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,JSON.stringify(t.properties??{})]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async getNode(e){let t=this.query(`SELECT * FROM nodes WHERE id = ?`,[e]);return t.length>0?c(t[0]):null}async getNeighbors(e,t){let n=t?.direction??`both`,r=t?.edgeType,i=t?.limit??50,a=[],o=[],s=new Set;if(n===`outgoing`||n===`both`){let t=`
39
39
  SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight, e.properties AS edge_props,
40
40
  n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
41
41
  n.source_record_id AS node_src_rec, n.source_path AS node_src_path, n.created_at AS node_created
42
- FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,_=`
42
+ FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(u(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(d(e)))}if(n===`incoming`||n===`both`){let t=`
43
43
  SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight, e.properties AS edge_props,
44
44
  n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
45
45
  n.source_record_id AS node_src_rec, n.source_path AS node_src_path, n.created_at AS node_created
46
- FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`;if(s==="outgoing"||s==="both"){let o=h;const c=[e];i&&(o+=" AND e.type = ?",c.push(i)),o+=" LIMIT ?",c.push(d);const a=this.query(o,c);for(const E of a)n.push(y(E)),u.has(E.node_id)||(u.add(E.node_id),p.push(m(E)))}if(s==="incoming"||s==="both"){let o=_;const c=[e];i&&(o+=" AND e.type = ?",c.push(i)),o+=" LIMIT ?",c.push(d);const a=this.query(o,c);for(const E of a)n.push(y(E)),u.has(E.node_id)||(u.add(E.node_id),p.push(m(E)))}return{nodes:p,edges:n}}async traverse(e,t){const s=t?.maxDepth??2,i=t?.direction??"both",d=t?.edgeType,p=t?.limit??50,n=new Map,u=new Map,h=new Set,_=[{nodeId:e,depth:0}];for(;_.length>0&&n.size<p;){const o=_.shift();if(!o||h.has(o.nodeId)||o.depth>s)continue;h.add(o.nodeId);const c=await this.getNeighbors(o.nodeId,{direction:i,edgeType:d,limit:p-n.size});for(const a of c.nodes)n.has(a.id)||(n.set(a.id,a),o.depth+1<s&&_.push({nodeId:a.id,depth:o.depth+1}));for(const a of c.edges)u.set(a.id,a)}return{nodes:[...n.values()],edges:[...u.values()]}}async findNodes(e){const t=[],s=[];e.type&&(t.push("type = ?"),s.push(e.type)),e.namePattern&&(t.push("name LIKE ?"),s.push(`%${e.namePattern}%`)),e.sourcePath&&(t.push("source_path = ?"),s.push(e.sourcePath));const i=t.length>0?`WHERE ${t.join(" AND ")}`:"",d=e.limit??100;return this.query(`SELECT * FROM nodes ${i} LIMIT ?`,[...s,d]).map(n=>T(n))}async findEdges(e){const t=[],s=[];e.type&&(t.push("type = ?"),s.push(e.type)),e.fromId&&(t.push("from_id = ?"),s.push(e.fromId)),e.toId&&(t.push("to_id = ?"),s.push(e.toId));const i=t.length>0?`WHERE ${t.join(" AND ")}`:"",d=e.limit??100;return this.query(`SELECT * FROM edges ${i} LIMIT ?`,[...s,d]).map(n=>O(n))}async deleteNode(e){this.ensureDb().run("BEGIN TRANSACTION"),this.run("DELETE FROM edges WHERE from_id = ? OR to_id = ?",[e,e]),this.run("DELETE FROM nodes WHERE id = ?",[e]),this.ensureDb().run("COMMIT"),this.markDirty(),this.flushIfDirty()}async deleteBySourcePath(e){const t=this.query("SELECT id FROM nodes WHERE source_path = ?",[e]);if(t.length===0)return 0;this.ensureDb().run("BEGIN TRANSACTION");for(const s of t)this.run("DELETE FROM edges WHERE from_id = ? OR to_id = ?",[s.id,s.id]);return this.run("DELETE FROM nodes WHERE source_path = ?",[e]),this.ensureDb().run("COMMIT"),this.markDirty(),this.flushIfDirty(),t.length}async clear(){this.run("DELETE FROM edges"),this.run("DELETE FROM nodes"),this.markDirty(),this.flushIfDirty()}async getStats(){const t=this.query("SELECT COUNT(*) as count FROM nodes")[0]?.count??0,i=this.query("SELECT COUNT(*) as count FROM edges")[0]?.count??0,d=this.query("SELECT type, COUNT(*) as count FROM nodes GROUP BY type"),p={};for(const h of d)p[h.type]=h.count;const n=this.query("SELECT type, COUNT(*) as count FROM edges GROUP BY type"),u={};for(const h of n)u[h.type]=h.count;return{nodeCount:t,edgeCount:i,nodeTypes:p,edgeTypes:u}}async close(){this.db&&(this.flushIfDirty(),this.db.close(),this.db=null)}}function T(r){return{id:r.id,type:r.type,name:r.name,properties:JSON.parse(r.properties),sourceRecordId:r.source_record_id??void 0,sourcePath:r.source_path??void 0,createdAt:r.created_at}}function O(r){return{id:r.id,fromId:r.from_id,toId:r.to_id,type:r.type,weight:r.weight??1,properties:JSON.parse(r.properties)}}function y(r){return{id:r.edge_id,fromId:r.from_id,toId:r.to_id,type:r.edge_type,weight:r.weight??1,properties:JSON.parse(r.edge_props??"{}")}}function m(r){return{id:r.node_id,type:r.node_type,name:r.node_name,properties:JSON.parse(r.node_props??"{}"),sourceRecordId:r.node_src_rec??void 0,sourcePath:r.node_src_path??void 0,createdAt:r.node_created}}export{b as SqliteGraphStore};
46
+ FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(u(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(d(e)))}return{nodes:a,edges:o}}async traverse(e,t){let n=t?.maxDepth??2,r=t?.direction??`both`,i=t?.edgeType,a=t?.limit??50,o=new Map,s=new Map,c=new Set,l=[{nodeId:e,depth:0}];for(;l.length>0&&o.size<a;){let e=l.shift();if(!e||c.has(e.nodeId)||e.depth>n)continue;c.add(e.nodeId);let t=await this.getNeighbors(e.nodeId,{direction:r,edgeType:i,limit:a-o.size});for(let r of t.nodes)o.has(r.id)||(o.set(r.id,r),e.depth+1<n&&l.push({nodeId:r.id,depth:e.depth+1}));for(let e of t.edges)s.set(e.id,e)}return{nodes:[...o.values()],edges:[...s.values()]}}async findNodes(e){let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.namePattern&&(t.push(`name LIKE ?`),n.push(`%${e.namePattern}%`)),e.sourcePath&&(t.push(`source_path = ?`),n.push(e.sourcePath));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM nodes ${r} LIMIT ?`,[...n,i]).map(e=>c(e))}async findEdges(e){let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.fromId&&(t.push(`from_id = ?`),n.push(e.fromId)),e.toId&&(t.push(`to_id = ?`),n.push(e.toId));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM edges ${r} LIMIT ?`,[...n,i]).map(e=>l(e))}async deleteNode(e){let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e,e]),this.run(`DELETE FROM nodes WHERE id = ?`,[e]),t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async deleteBySourcePath(e){let t=this.query(`SELECT id FROM nodes WHERE source_path = ?`,[e]);if(t.length===0)return 0;let n=this.ensureDb();n.run(`BEGIN TRANSACTION`);try{for(let e of t)this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e.id,e.id]);this.run(`DELETE FROM nodes WHERE source_path = ?`,[e]),n.run(`COMMIT`)}catch(e){throw n.run(`ROLLBACK`),e}return this.markDirty(),this.flushIfDirty(),t.length}async clear(){this.run(`DELETE FROM edges`),this.run(`DELETE FROM nodes`),this.markDirty(),this.flushIfDirty()}async getStats(){let e=this.query(`SELECT COUNT(*) as count FROM nodes`)[0]?.count??0,t=this.query(`SELECT COUNT(*) as count FROM edges`)[0]?.count??0,n=this.query(`SELECT type, COUNT(*) as count FROM nodes GROUP BY type`),r={};for(let e of n)r[e.type]=e.count;let i=this.query(`SELECT type, COUNT(*) as count FROM edges GROUP BY type`),a={};for(let e of i)a[e.type]=e.count;return{nodeCount:e,edgeCount:t,nodeTypes:r,edgeTypes:a}}async close(){this.db&&=(this.flushIfDirty(),this.db.close(),null)}};function s(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function c(e){return{id:e.id,type:e.type,name:e.name,properties:s(e.properties),sourceRecordId:e.source_record_id??void 0,sourcePath:e.source_path??void 0,createdAt:e.created_at}}function l(e){return{id:e.id,fromId:e.from_id,toId:e.to_id,type:e.type,weight:e.weight??1,properties:s(e.properties)}}function u(e){return{id:e.edge_id,fromId:e.from_id,toId:e.to_id,type:e.edge_type,weight:e.weight??1,properties:s(e.edge_props??`{}`)}}function d(e){return{id:e.node_id,type:e.node_type,name:e.node_name,properties:s(e.node_props??`{}`),sourceRecordId:e.node_src_rec??void 0,sourcePath:e.node_src_path??void 0,createdAt:e.node_created}}export{o as SqliteGraphStore};
47
+ //# sourceMappingURL=sqlite-graph-store.js.map
@@ -1,9 +1,13 @@
1
- import type { IKnowledgeStore } from './store.interface.js';
2
- export type StoreBackend = 'lancedb' | 'sqlite-vec';
3
- export interface StoreConfig {
4
- backend: StoreBackend;
5
- path: string;
6
- options?: Record<string, unknown>;
1
+ import { IKnowledgeStore } from "./store.interface.js";
2
+
3
+ //#region packages/store/src/store-factory.d.ts
4
+ type StoreBackend = 'lancedb' | 'sqlite-vec';
5
+ interface StoreConfig {
6
+ backend: StoreBackend;
7
+ path: string;
8
+ options?: Record<string, unknown>;
7
9
  }
8
- export declare function createStore(config: StoreConfig): Promise<IKnowledgeStore>;
10
+ declare function createStore(config: StoreConfig): Promise<IKnowledgeStore>;
11
+ //#endregion
12
+ export { StoreBackend, StoreConfig, createStore };
9
13
  //# sourceMappingURL=store-factory.d.ts.map
@@ -1 +1,2 @@
1
- async function n(e){if(e.backend==="lancedb"){const{LanceStore:t}=await import("./lance-store.js");return new t({path:e.path})}else throw new Error(`Unknown store backend: "${e.backend}". Supported: lancedb`)}export{n as createStore};
1
+ async function e(e){switch(e.backend){case`lancedb`:{let{LanceStore:t}=await import(`./lance-store.js`);return new t({path:e.path})}default:throw Error(`Unknown store backend: "${e.backend}". Supported: lancedb`)}}export{e as createStore};
2
+ //# sourceMappingURL=store-factory.js.map
@@ -1,50 +1,51 @@
1
- /**
2
- * Knowledge store abstraction — allows swapping vector DB backends.
3
- */
4
- import type { IndexStats, KnowledgeRecord, SearchResult } from '@kb/core';
1
+ import { ContentType, IndexStats, KnowledgeOrigin, KnowledgeRecord, SearchResult, SourceType } from "@kb/core";
2
+
3
+ //#region packages/store/src/store.interface.d.ts
5
4
  /** Options for searching the store */
6
- export interface SearchOptions {
7
- /** Maximum number of results to return */
8
- limit?: number;
9
- /** Minimum similarity score (0-1) */
10
- minScore?: number;
11
- /** Filter by content type */
12
- contentType?: string;
13
- /** Filter by coarse source type (source, documentation, test, config, generated) */
14
- sourceType?: string;
15
- /** Filter by origin */
16
- origin?: string;
17
- /** Filter by category */
18
- category?: string;
19
- /** Filter by tags (any match) */
20
- tags?: string[];
5
+ interface SearchOptions {
6
+ /** Maximum number of results to return */
7
+ limit?: number;
8
+ /** Minimum similarity score (0-1) */
9
+ minScore?: number;
10
+ /** Filter by content type */
11
+ contentType?: ContentType;
12
+ /** Filter by coarse source type (source, documentation, test, config, generated) */
13
+ sourceType?: SourceType;
14
+ /** Filter by origin */
15
+ origin?: KnowledgeOrigin;
16
+ /** Filter by category */
17
+ category?: string;
18
+ /** Filter by tags (any match) */
19
+ tags?: string[];
21
20
  }
22
- export interface IKnowledgeStore {
23
- /** Initialize the store (create tables, etc.) */
24
- initialize(): Promise<void>;
25
- /** Add or update records with their embedding vectors */
26
- upsert(records: KnowledgeRecord[], vectors: Float32Array[]): Promise<void>;
27
- /** Search by vector similarity */
28
- search(queryVector: Float32Array, options?: SearchOptions): Promise<SearchResult[]>;
29
- /** Get a specific record by ID */
30
- getById(id: string): Promise<KnowledgeRecord | null>;
31
- /** Delete records by source path (used during re-indexing) */
32
- deleteBySourcePath(sourcePath: string): Promise<number>;
33
- /** Delete a specific record by ID */
34
- deleteById(id: string): Promise<boolean>;
35
- /** Get all records for a source path */
36
- getBySourcePath(sourcePath: string): Promise<KnowledgeRecord[]>;
37
- /** Get index statistics */
38
- getStats(): Promise<IndexStats>;
39
- /** List all unique source paths in the store */
40
- listSourcePaths(): Promise<string[]>;
41
- /** Create a full-text search index on the content column for keyword search */
42
- createFtsIndex(): Promise<void>;
43
- /** Full-text keyword search (requires FTS index) */
44
- ftsSearch(query: string, options?: SearchOptions): Promise<SearchResult[]>;
45
- /** Drop the backing table entirely — used for hard resets (e.g. dimension changes) */
46
- dropTable(): Promise<void>;
47
- /** Close the store connection */
48
- close(): Promise<void>;
21
+ interface IKnowledgeStore {
22
+ /** Initialize the store (create tables, etc.) */
23
+ initialize(): Promise<void>;
24
+ /** Add or update records with their embedding vectors */
25
+ upsert(records: KnowledgeRecord[], vectors: Float32Array[]): Promise<void>;
26
+ /** Search by vector similarity */
27
+ search(queryVector: Float32Array, options?: SearchOptions): Promise<SearchResult[]>;
28
+ /** Get a specific record by ID */
29
+ getById(id: string): Promise<KnowledgeRecord | null>;
30
+ /** Delete records by source path (used during re-indexing) */
31
+ deleteBySourcePath(sourcePath: string): Promise<number>;
32
+ /** Delete a specific record by ID */
33
+ deleteById(id: string): Promise<boolean>;
34
+ /** Get all records for a source path */
35
+ getBySourcePath(sourcePath: string): Promise<KnowledgeRecord[]>;
36
+ /** Get index statistics */
37
+ getStats(): Promise<IndexStats>;
38
+ /** List all unique source paths in the store */
39
+ listSourcePaths(): Promise<string[]>;
40
+ /** Create a full-text search index on the content column for keyword search */
41
+ createFtsIndex(): Promise<void>;
42
+ /** Full-text keyword search (requires FTS index) */
43
+ ftsSearch(query: string, options?: SearchOptions): Promise<SearchResult[]>;
44
+ /** Drop the backing table entirely — used for hard resets (e.g. dimension changes) */
45
+ dropTable(): Promise<void>;
46
+ /** Close the store connection */
47
+ close(): Promise<void>;
49
48
  }
49
+ //#endregion
50
+ export { IKnowledgeStore, SearchOptions };
50
51
  //# sourceMappingURL=store.interface.d.ts.map
@@ -0,0 +1 @@
1
+ export{};
@@ -1,66 +1,66 @@
1
- /**
2
- * Unified audit tool (E-007) — runs structure, dependencies, patterns, health,
3
- * dead_symbols, and check in one call, producing a synthesized report.
4
- */
5
- import type { IEmbedder } from '@kb/embeddings';
6
- import type { IKnowledgeStore } from '@kb/store';
7
- import { type KBResponse } from './response-envelope.js';
8
- export type AuditCheck = 'structure' | 'dependencies' | 'patterns' | 'health' | 'dead_symbols' | 'check' | 'entry_points';
9
- export interface AuditOptions {
10
- /** Root path to audit (default: cwd) */
11
- path?: string;
12
- /** Which checks to run (default: all) */
13
- checks?: AuditCheck[];
14
- /** Detail level (default: 'summary') */
15
- detail?: 'summary' | 'full';
1
+ import { KBResponse } from "./response-envelope.js";
2
+ import { IEmbedder } from "@kb/embeddings";
3
+ import { IKnowledgeStore } from "@kb/store";
4
+
5
+ //#region packages/tools/src/audit.d.ts
6
+ type AuditCheck = 'structure' | 'dependencies' | 'patterns' | 'health' | 'dead_symbols' | 'check' | 'entry_points';
7
+ interface AuditOptions {
8
+ /** Root path to audit (default: cwd) */
9
+ path?: string;
10
+ /** Which checks to run (default: all) */
11
+ checks?: AuditCheck[];
12
+ /** Detail level (default: 'summary') */
13
+ detail?: 'summary' | 'full';
16
14
  }
17
- export interface AuditRecommendation {
18
- priority: 'high' | 'medium' | 'low';
19
- area: string;
20
- message: string;
15
+ interface AuditRecommendation {
16
+ priority: 'high' | 'medium' | 'low';
17
+ area: string;
18
+ message: string;
21
19
  }
22
- export interface AuditData {
20
+ interface AuditData {
21
+ score: number;
22
+ structure?: {
23
+ files: number;
24
+ packages: number;
25
+ languages: Record<string, number>;
26
+ };
27
+ dependencies?: {
28
+ external: number;
29
+ internal: number;
30
+ };
31
+ patterns?: Array<{
32
+ name: string;
33
+ confidence: string;
34
+ count: number;
35
+ }>;
36
+ health?: {
23
37
  score: number;
24
- structure?: {
25
- files: number;
26
- packages: number;
27
- languages: Record<string, number>;
28
- };
29
- dependencies?: {
30
- external: number;
31
- internal: number;
32
- };
33
- patterns?: Array<{
34
- name: string;
35
- confidence: string;
36
- count: number;
37
- }>;
38
- health?: {
39
- score: number;
40
- checks: number;
41
- passed: number;
42
- warned: number;
43
- failed: number;
44
- };
45
- deadSymbols?: {
46
- source: number;
47
- docs: number;
48
- };
49
- entryPoints?: {
50
- total: number;
51
- types: Record<string, number>;
52
- };
53
- typecheck?: {
54
- passed: boolean;
55
- errorCount: number;
56
- topErrors: string[];
57
- };
58
- lint?: {
59
- passed: boolean;
60
- errorCount: number;
61
- topErrors: string[];
62
- };
63
- recommendations: AuditRecommendation[];
38
+ checks: number;
39
+ passed: number;
40
+ warned: number;
41
+ failed: number;
42
+ };
43
+ deadSymbols?: {
44
+ source: number;
45
+ docs: number;
46
+ };
47
+ entryPoints?: {
48
+ total: number;
49
+ types: Record<string, number>;
50
+ };
51
+ typecheck?: {
52
+ passed: boolean;
53
+ errorCount: number;
54
+ topErrors: string[];
55
+ };
56
+ lint?: {
57
+ passed: boolean;
58
+ errorCount: number;
59
+ topErrors: string[];
60
+ };
61
+ recommendations: AuditRecommendation[];
64
62
  }
65
- export declare function audit(store: IKnowledgeStore, embedder: IEmbedder, options?: AuditOptions): Promise<KBResponse<AuditData>>;
63
+ declare function audit(store: IKnowledgeStore, embedder: IEmbedder, options?: AuditOptions): Promise<KBResponse<AuditData>>;
64
+ //#endregion
65
+ export { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit };
66
66
  //# sourceMappingURL=audit.d.ts.map
@@ -1,7 +1,7 @@
1
- import{DependencyAnalyzer as $,EntryPointAnalyzer as A,PatternAnalyzer as w,StructureAnalyzer as S}from"../../analyzers/dist/index.js";import{check as x,summarizeCheckResult as C}from"./check.js";import{findDeadSymbols as D}from"./dead-symbols.js";import{health as R}from"./health.js";import{resolvePath as P}from"./path-resolver.js";import{errorResponse as z,okResponse as E}from"./response-envelope.js";const _=["structure","dependencies","patterns","health","dead_symbols","check","entry_points"];async function B(e,h,n={}){const o=Date.now(),i=P(n.path),l=n.checks??_,f=n.detail??"summary",d=[],t={score:100,recommendations:d};try{const c=[];l.includes("structure")&&c.push((async()=>{const s=await new S().analyze(i,{format:"json"}),a=s.data;t.structure={files:a.stats?.totalFiles??s.meta.fileCount,packages:Array.isArray(a.packages)?a.packages.length:0,languages:a.stats?.languages??{}}})()),l.includes("dependencies")&&c.push((async()=>{const a=(await new $().analyze(i)).data,u=a.imports??[];t.dependencies={external:a.external?.length??u.filter(p=>p.isExternal).length,internal:a.internal?.length??u.filter(p=>!p.isExternal).length}})()),l.includes("patterns")&&c.push((async()=>{const a=(await new w().analyze(i)).data;t.patterns=(a.patterns??[]).map(u=>({name:u.pattern,confidence:u.confidence,count:u.locations.length}))})()),l.includes("entry_points")&&c.push((async()=>{const a=(await new A().analyze(i)).data,u=a.entryPoints??[],p={};for(const b of u)p[b.type]=(p[b.type]??0)+1;t.entryPoints={total:a.total??u.length,types:p}})()),l.includes("health")&&c.push((async()=>{const r=R(i);t.health={score:r.score,checks:r.checks.length,passed:r.checks.filter(s=>s.status==="pass").length,warned:r.checks.filter(s=>s.status==="warn").length,failed:r.checks.filter(s=>s.status==="fail").length},r.score<70&&d.push({priority:"medium",area:"health",message:`Health score ${r.score}/100 \u2014 ${t.health.failed} failed checks`})})()),l.includes("dead_symbols")&&c.push((async()=>{const r=await D(h,e,{rootPath:i});t.deadSymbols={source:r.totalDeadSource,docs:r.totalDeadDocs},r.totalDeadSource>0&&d.push({priority:r.totalDeadSource>10?"high":"medium",area:"dead-code",message:`${r.totalDeadSource} unused exports in source files`})})()),l.includes("check")&&c.push((async()=>{const r=await x({cwd:i}),s=C(r);t.typecheck={passed:s.tsc.passed,errorCount:s.tsc.errorCount,topErrors:s.tsc.topErrors},t.lint={passed:s.biome.passed,errorCount:s.biome.errorCount,topErrors:s.biome.topErrors},s.tsc.passed||d.push({priority:"high",area:"type-safety",message:`Fix ${s.tsc.errorCount} tsc error(s)`}),s.biome.passed||d.push({priority:"medium",area:"lint",message:`Fix ${s.biome.errorCount} lint error(s)`})})()),await Promise.all(c);let m=0;t.typecheck&&!t.typecheck.passed&&(m+=15),t.lint&&!t.lint.passed&&(m+=5),t.health&&t.health.score<80&&(m+=10),t.deadSymbols&&t.deadSymbols.source>10&&(m+=5),t.entryPoints&&t.entryPoints.total===0&&(m+=5),t.score=Math.max(0,100-m);const g={high:0,medium:1,low:2};d.sort((r,s)=>g[r.priority]-g[s.priority]);const k=j(t,f),y=[];return t.typecheck&&!t.typecheck.passed&&y.push({tool:"check",reason:"Get full error details",suggested_args:{detail:"errors"}}),t.deadSymbols&&t.deadSymbols.source>0&&y.push({tool:"dead_symbols",reason:"See which exports are unused",suggested_args:{root_path:i}}),E("audit",k,t,{durationMs:Date.now()-o,detail:f},y)}catch(c){return z("audit",{code:"ANALYSIS_FAILED",category:"runtime",retryable:!1,message:`Audit failed: ${c.message}`},Date.now()-o)}}function j(e,h){const n=[];if(n.push(`## Audit Report \u2014 Score: ${e.score}/100
2
- `),e.structure&&n.push(`**Structure:** ${e.structure.files} files, ${e.structure.packages} packages, ${Object.keys(e.structure.languages).length} languages`),e.entryPoints){const o=Object.entries(e.entryPoints.types).map(([i,l])=>`${l} ${i}`).join(", ");n.push(`**Entry Points:** ${e.entryPoints.total} (${o||"none"})`)}if(e.dependencies&&n.push(`**Dependencies:** ${e.dependencies.external} external, ${e.dependencies.internal} internal`),e.health&&n.push(`**Health:** ${e.health.score}/100 (${e.health.passed}\u2713 ${e.health.warned}\u26A0 ${e.health.failed}\u2717)`),e.deadSymbols&&n.push(`**Dead Symbols:** ${e.deadSymbols.source} in source (actionable), ${e.deadSymbols.docs} in docs`),e.typecheck){const o=e.typecheck.passed?"\u2713 passed":`\u2717 ${e.typecheck.errorCount} errors`;n.push(`**Typecheck:** ${o}`)}if(e.lint){const o=e.lint.passed?"\u2713 passed":`\u2717 ${e.lint.errorCount} errors`;n.push(`**Lint:** ${o}`)}if(e.recommendations.length>0){n.push(`
1
+ import{check as e,summarizeCheckResult as t}from"./check.js";import{findDeadSymbols as n}from"./dead-symbols.js";import{health as r}from"./health.js";import{resolvePath as i}from"./path-resolver.js";import{errorResponse as a,okResponse as o}from"./response-envelope.js";import{DependencyAnalyzer as s,EntryPointAnalyzer as c,PatternAnalyzer as l,StructureAnalyzer as u}from"../../analyzers/dist/index.js";const d=[`structure`,`dependencies`,`patterns`,`health`,`dead_symbols`,`check`,`entry_points`];async function f(f,m,h={}){let g=Date.now(),_=i(h.path),v=h.checks??d,y=h.detail??`summary`,b=[],x={score:100,recommendations:b};try{let i=[];v.includes(`structure`)&&i.push((async()=>{let e=await new u().analyze(_,{format:`json`}),t=e.data;x.structure={files:t.stats?.totalFiles??e.meta.fileCount,packages:Array.isArray(t.packages)?t.packages.length:0,languages:t.stats?.languages??{}}})()),v.includes(`dependencies`)&&i.push((async()=>{let e=(await new s().analyze(_)).data,t=e.imports??[];x.dependencies={external:e.external?.length??t.filter(e=>e.isExternal).length,internal:e.internal?.length??t.filter(e=>!e.isExternal).length}})()),v.includes(`patterns`)&&i.push((async()=>{x.patterns=((await new l().analyze(_)).data.patterns??[]).map(e=>({name:e.pattern,confidence:e.confidence,count:e.locations.length}))})()),v.includes(`entry_points`)&&i.push((async()=>{let e=(await new c().analyze(_)).data,t=e.entryPoints??[],n={};for(let e of t)n[e.type]=(n[e.type]??0)+1;x.entryPoints={total:e.total??t.length,types:n}})()),v.includes(`health`)&&i.push((async()=>{let e=r(_);x.health={score:e.score,checks:e.checks.length,passed:e.checks.filter(e=>e.status===`pass`).length,warned:e.checks.filter(e=>e.status===`warn`).length,failed:e.checks.filter(e=>e.status===`fail`).length},e.score<70&&b.push({priority:`medium`,area:`health`,message:`Health score ${e.score}/100 ${x.health.failed} failed checks`})})()),v.includes(`dead_symbols`)&&i.push((async()=>{let e=await n(m,f,{rootPath:_});x.deadSymbols={source:e.totalDeadSource,docs:e.totalDeadDocs},e.totalDeadSource>0&&b.push({priority:e.totalDeadSource>10?`high`:`medium`,area:`dead-code`,message:`${e.totalDeadSource} unused exports in source files`})})()),v.includes(`check`)&&i.push((async()=>{let n=t(await e({cwd:_}));x.typecheck={passed:n.tsc.passed,errorCount:n.tsc.errorCount,topErrors:n.tsc.topErrors},x.lint={passed:n.biome.passed,errorCount:n.biome.errorCount,topErrors:n.biome.topErrors},n.tsc.passed||b.push({priority:`high`,area:`type-safety`,message:`Fix ${n.tsc.errorCount} tsc error(s)`}),n.biome.passed||b.push({priority:`medium`,area:`lint`,message:`Fix ${n.biome.errorCount} lint error(s)`})})()),await Promise.all(i);let a=0;x.typecheck&&!x.typecheck.passed&&(a+=15),x.lint&&!x.lint.passed&&(a+=5),x.health&&x.health.score<80&&(a+=10),x.deadSymbols&&x.deadSymbols.source>10&&(a+=5),x.entryPoints&&x.entryPoints.total===0&&(a+=5),x.score=Math.max(0,100-a);let d={high:0,medium:1,low:2};b.sort((e,t)=>d[e.priority]-d[t.priority]);let h=p(x,y),S=[];return x.typecheck&&!x.typecheck.passed&&S.push({tool:`check`,reason:`Get full error details`,suggested_args:{detail:`errors`}}),x.deadSymbols&&x.deadSymbols.source>0&&S.push({tool:`dead_symbols`,reason:`See which exports are unused`,suggested_args:{root_path:_}}),o(`audit`,h,x,{durationMs:Date.now()-g,detail:y},S)}catch{return a(`audit`,{code:`ANALYSIS_FAILED`,category:`runtime`,retryable:!1,message:`Audit failed. Check server logs for details.`},Date.now()-g)}}function p(e,t){let n=[];if(n.push(`## Audit Report Score: ${e.score}/100\n`),e.structure&&n.push(`**Structure:** ${e.structure.files} files, ${e.structure.packages} packages, ${Object.keys(e.structure.languages).length} languages`),e.entryPoints){let t=Object.entries(e.entryPoints.types).map(([e,t])=>`${t} ${e}`).join(`, `);n.push(`**Entry Points:** ${e.entryPoints.total} (${t||`none`})`)}if(e.dependencies&&n.push(`**Dependencies:** ${e.dependencies.external} external, ${e.dependencies.internal} internal`),e.health&&n.push(`**Health:** ${e.health.score}/100 (${e.health.passed}✓ ${e.health.warned}⚠ ${e.health.failed}✗)`),e.deadSymbols&&n.push(`**Dead Symbols:** ${e.deadSymbols.source} in source (actionable), ${e.deadSymbols.docs} in docs`),e.typecheck){let t=e.typecheck.passed?`✓ passed`:`✗ ${e.typecheck.errorCount} errors`;n.push(`**Typecheck:** ${t}`)}if(e.lint){let t=e.lint.passed?`✓ passed`:`✗ ${e.lint.errorCount} errors`;n.push(`**Lint:** ${t}`)}if(e.recommendations.length>0){n.push(`
3
2
  ### Recommendations
4
- `);for(const o of e.recommendations){const i=o.priority==="high"?"\u{1F534}":o.priority==="medium"?"\u{1F7E1}":"\u{1F7E2}";n.push(`${i} **${o.area}:** ${o.message}`)}}if(h==="full"&&e.patterns&&e.patterns.length>0){n.push(`
3
+ `);for(let t of e.recommendations){let e=t.priority===`high`?`🔴`:t.priority===`medium`?`🟡`:`🟢`;n.push(`${e} **${t.area}:** ${t.message}`)}}if(t===`full`&&e.patterns&&e.patterns.length>0){n.push(`
5
4
  ### Patterns Detected
6
- `),n.push("| Pattern | Confidence | Count |"),n.push("|---------|-----------|-------|");for(const o of e.patterns)n.push(`| ${o.name} | ${o.confidence} | ${o.count} |`)}return n.join(`
7
- `)}export{B as audit};
5
+ `),n.push(`| Pattern | Confidence | Count |`),n.push(`|---------|-----------|-------|`);for(let t of e.patterns)n.push(`| ${t.name} | ${t.confidence} | ${t.count} |`)}return n.join(`
6
+ `)}export{f as audit};
7
+ //# sourceMappingURL=audit.js.map
@@ -1,21 +1,24 @@
1
- export interface BatchOperation {
2
- /** Unique ID for this operation */
3
- id: string;
4
- /** Operation type */
5
- type: string;
6
- /** Arguments for the operation */
7
- args: Record<string, unknown>;
1
+ //#region packages/tools/src/batch.d.ts
2
+ interface BatchOperation {
3
+ /** Unique ID for this operation */
4
+ id: string;
5
+ /** Operation type */
6
+ type: string;
7
+ /** Arguments for the operation */
8
+ args: Record<string, unknown>;
8
9
  }
9
- export interface BatchResult {
10
- id: string;
11
- status: 'success' | 'error';
12
- result?: unknown;
13
- error?: string;
14
- durationMs: number;
10
+ interface BatchResult {
11
+ id: string;
12
+ status: 'success' | 'error';
13
+ result?: unknown;
14
+ error?: string;
15
+ durationMs: number;
15
16
  }
16
- export interface BatchOptions {
17
- /** Max concurrent operations (default: 4) */
18
- concurrency?: number;
17
+ interface BatchOptions {
18
+ /** Max concurrent operations (default: 4) */
19
+ concurrency?: number;
19
20
  }
20
- export declare function batch(operations: BatchOperation[], executor: (op: BatchOperation) => Promise<unknown>, options?: BatchOptions): Promise<BatchResult[]>;
21
+ declare function batch(operations: BatchOperation[], executor: (op: BatchOperation) => Promise<unknown>, options?: BatchOptions): Promise<BatchResult[]>;
22
+ //#endregion
23
+ export { BatchOperation, BatchOptions, BatchResult, batch };
21
24
  //# sourceMappingURL=batch.d.ts.map
@@ -1 +1,2 @@
1
- async function h(o,a,c={}){const i=Math.max(1,c.concurrency??4),e=[],s=[...o];async function u(r){const n=Date.now();try{const t=await a(r);return{id:r.id,status:"success",result:t,durationMs:Date.now()-n}}catch(t){return{id:r.id,status:"error",error:t instanceof Error?t.message:String(t),durationMs:Date.now()-n}}}for(;s.length>0;){const r=s.splice(0,i),n=await Promise.allSettled(r.map(t=>u(t)));for(const t of n){if(t.status==="fulfilled"){e.push(t.value);continue}e.push({id:"unknown",status:"error",error:t.reason instanceof Error?t.reason.message:"Promise rejected",durationMs:0})}}return e}export{h as batch};
1
+ async function e(e,t,n={}){let r=Math.max(1,n.concurrency??4),i=[],a=[...e];async function o(e){let n=Date.now();try{let r=await t(e);return{id:e.id,status:`success`,result:r,durationMs:Date.now()-n}}catch(t){return{id:e.id,status:`error`,error:t instanceof Error?t.message:String(t),durationMs:Date.now()-n}}}for(;a.length>0;){let e=a.splice(0,r),t=await Promise.allSettled(e.map(e=>o(e)));for(let e of t){if(e.status===`fulfilled`){i.push(e.value);continue}i.push({id:`unknown`,status:`error`,error:e.reason instanceof Error?e.reason.message:`Promise rejected`,durationMs:0})}}return i}export{e as batch};
2
+ //# sourceMappingURL=batch.js.map
@@ -1,34 +1,37 @@
1
+ //#region packages/tools/src/changelog.d.ts
1
2
  /**
2
3
  * kb_changelog — Generate a changelog from git history.
3
4
  */
4
- export type ChangelogFormat = 'grouped' | 'chronological' | 'per-scope';
5
- export interface ChangelogOptions {
6
- from: string;
7
- to?: string;
8
- format?: ChangelogFormat;
9
- includeBreaking?: boolean;
10
- cwd?: string;
5
+ type ChangelogFormat = 'grouped' | 'chronological' | 'per-scope';
6
+ interface ChangelogOptions {
7
+ from: string;
8
+ to?: string;
9
+ format?: ChangelogFormat;
10
+ includeBreaking?: boolean;
11
+ cwd?: string;
11
12
  }
12
- export interface ChangelogEntry {
13
- hash: string;
14
- type: string;
15
- scope: string;
16
- subject: string;
17
- body: string;
18
- author: string;
19
- date: string;
20
- breaking: boolean;
13
+ interface ChangelogEntry {
14
+ hash: string;
15
+ type: string;
16
+ scope: string;
17
+ subject: string;
18
+ body: string;
19
+ author: string;
20
+ date: string;
21
+ breaking: boolean;
21
22
  }
22
- export interface ChangelogResult {
23
- entries: ChangelogEntry[];
24
- markdown: string;
25
- stats: {
26
- total: number;
27
- breaking: number;
28
- types: Record<string, number>;
29
- };
23
+ interface ChangelogResult {
24
+ entries: ChangelogEntry[];
25
+ markdown: string;
26
+ stats: {
27
+ total: number;
28
+ breaking: number;
29
+ types: Record<string, number>;
30
+ };
30
31
  }
31
- export declare function changelog(options: ChangelogOptions): ChangelogResult;
32
+ declare function changelog(options: ChangelogOptions): ChangelogResult;
32
33
  /** Exported for testing */
33
- export declare function formatChangelog(entries: ChangelogEntry[], format: ChangelogFormat, includeBreaking: boolean): string;
34
+ declare function formatChangelog(entries: ChangelogEntry[], format: ChangelogFormat, includeBreaking: boolean): string;
35
+ //#endregion
36
+ export { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog };
34
37
  //# sourceMappingURL=changelog.d.ts.map
@@ -1,2 +1,3 @@
1
- import{execSync as E}from"node:child_process";const $=/^[a-zA-Z0-9_./\-~^@{}]+$/;function w(i){const{from:a,to:g="HEAD",format:r="grouped",includeBreaking:e=!0,cwd:t=process.cwd()}=i;if(!$.test(a))throw new Error(`Invalid git ref: ${a}`);if(!$.test(g))throw new Error(`Invalid git ref: ${g}`);const n="",o="",s=`%H${n}%s${n}%b${n}%an${n}%ai${o}`;let h;try{h=E(`git log "${a}..${g}" --format="${s}"`,{cwd:t,encoding:"utf8",maxBuffer:10*1024*1024})}catch{throw new Error(`Git log failed. Ensure "${a}" and "${g}" are valid refs.`)}const p=h.split(o).map(c=>c.trim()).filter(Boolean).map(c=>{const[m="",d="",b="",y="",C=""]=c.split(n),f=d.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:m.slice(0,8),type:f?.[1]??"other",scope:f?.[2]??"",subject:f?.[4]??d,body:b.trim(),author:y.trim(),date:C.trim().split(" ")[0],breaking:!!(f?.[3]||/BREAKING[\s-]CHANGE/i.test(b))}}),l={};let u=0;for(const c of p)l[c.type]=(l[c.type]??0)+1,c.breaking&&u++;return{entries:p,markdown:k(p,r,e),stats:{total:p.length,breaking:u,types:l}}}function k(i,a,g){const r=["# Changelog",""];if(g){const e=i.filter(t=>t.breaking);if(e.length>0){r.push("## Breaking Changes","");for(const t of e)r.push(`- ${t.subject} (${t.hash})`);r.push("")}}if(a==="grouped"){const e={};for(const o of i)e[o.type]||(e[o.type]=[]),e[o.type].push(o);const t=["feat","fix","refactor","perf","test","docs","chore"],n={feat:"Features",fix:"Bug Fixes",refactor:"Refactoring",perf:"Performance",test:"Tests",docs:"Documentation",chore:"Chores",other:"Other"};for(const o of[...t,...Object.keys(e).filter(s=>!t.includes(s))])if(e[o]?.length){r.push(`## ${n[o]??o}`,"");for(const s of e[o]){const h=s.scope?`**${s.scope}:** `:"";r.push(`- ${h}${s.subject} (${s.hash})`)}r.push("")}}else if(a==="chronological")for(const e of i){const t=e.scope?`(${e.scope}) `:"";r.push(`- \`${e.date}\` ${e.type}: ${t}${e.subject} (${e.hash})`)}else{const e={};for(const t of i){const n=t.scope||"general";e[n]||(e[n]=[]),e[n].push(t)}for(const[t,n]of Object.entries(e)){r.push(`## ${t}`,"");for(const o of n)r.push(`- ${o.type}: ${o.subject} (${o.hash})`);r.push("")}}return r.join(`
2
- `)}export{w as changelog,k as formatChangelog};
1
+ import{execSync as e}from"node:child_process";const t=/^[a-zA-Z0-9_./\-~^@{}]+$/;function n(n){let{from:i,to:a=`HEAD`,format:o=`grouped`,includeBreaking:s=!0,cwd:c=process.cwd()}=n;if(!t.test(i))throw Error(`Invalid git ref: ${i}`);if(!t.test(a))throw Error(`Invalid git ref: ${a}`);let l;try{l=e(`git log "${i}..${a}" --format="%H%s%b%an%ai"`,{cwd:c,encoding:`utf8`,maxBuffer:10*1024*1024,timeout:3e4})}catch{throw Error(`Git log failed. Ensure "${i}" and "${a}" are valid refs.`)}let u=l.split(``).map(e=>e.trim()).filter(Boolean).map(e=>{let[t=``,n=``,r=``,i=``,a=``]=e.split(``),o=n.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:t.slice(0,8),type:o?.[1]??`other`,scope:o?.[2]??``,subject:o?.[4]??n,body:r.trim(),author:i.trim(),date:a.trim().split(` `)[0],breaking:!!(o?.[3]||/BREAKING[\s-]CHANGE/i.test(r))}}),d={},f=0;for(let e of u)d[e.type]=(d[e.type]??0)+1,e.breaking&&f++;return{entries:u,markdown:r(u,o,s),stats:{total:u.length,breaking:f,types:d}}}function r(e,t,n){let r=[`# Changelog`,``];if(n){let t=e.filter(e=>e.breaking);if(t.length>0){r.push(`## Breaking Changes`,``);for(let e of t)r.push(`- ${e.subject} (${e.hash})`);r.push(``)}}if(t===`grouped`){let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);let n=[`feat`,`fix`,`refactor`,`perf`,`test`,`docs`,`chore`],i={feat:`Features`,fix:`Bug Fixes`,refactor:`Refactoring`,perf:`Performance`,test:`Tests`,docs:`Documentation`,chore:`Chores`,other:`Other`};for(let e of[...n,...Object.keys(t).filter(e=>!n.includes(e))])if(t[e]?.length){r.push(`## ${i[e]??e}`,``);for(let n of t[e]){let e=n.scope?`**${n.scope}:** `:``;r.push(`- ${e}${n.subject} (${n.hash})`)}r.push(``)}}else if(t===`chronological`)for(let t of e){let e=t.scope?`(${t.scope}) `:``;r.push(`- \`${t.date}\` ${t.type}: ${e}${t.subject} (${t.hash})`)}else{let t={};for(let n of e){let e=n.scope||`general`;t[e]||(t[e]=[]),t[e].push(n)}for(let[e,n]of Object.entries(t)){r.push(`## ${e}`,``);for(let e of n)r.push(`- ${e.type}: ${e.subject} (${e.hash})`);r.push(``)}}return r.join(`
2
+ `)}export{n as changelog,r as formatChangelog};
3
+ //# sourceMappingURL=changelog.js.map