@vpxa/kb 0.1.12 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/README.md +56 -39
  2. package/package.json +10 -7
  3. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -20
  4. package/packages/analyzers/dist/blast-radius-analyzer.js +6 -12
  5. package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -27
  6. package/packages/analyzers/dist/dependency-analyzer.js +7 -9
  7. package/packages/analyzers/dist/diagram-generator.d.ts +12 -8
  8. package/packages/analyzers/dist/diagram-generator.js +3 -4
  9. package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -17
  10. package/packages/analyzers/dist/entry-point-analyzer.js +5 -5
  11. package/packages/analyzers/dist/index.d.ts +12 -14
  12. package/packages/analyzers/dist/index.js +1 -1
  13. package/packages/analyzers/dist/knowledge-producer.d.ts +29 -25
  14. package/packages/analyzers/dist/knowledge-producer.js +16 -15
  15. package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -10
  16. package/packages/analyzers/dist/pattern-analyzer.js +3 -5
  17. package/packages/analyzers/dist/regex-call-graph.d.ts +6 -12
  18. package/packages/analyzers/dist/regex-call-graph.js +2 -1
  19. package/packages/analyzers/dist/structure-analyzer.d.ts +13 -9
  20. package/packages/analyzers/dist/structure-analyzer.js +3 -4
  21. package/packages/analyzers/dist/symbol-analyzer.d.ts +12 -8
  22. package/packages/analyzers/dist/symbol-analyzer.js +8 -13
  23. package/packages/analyzers/dist/ts-call-graph.d.ts +16 -13
  24. package/packages/analyzers/dist/ts-call-graph.js +2 -1
  25. package/packages/analyzers/dist/types.d.ts +82 -79
  26. package/packages/analyzers/dist/types.js +1 -0
  27. package/packages/chunker/dist/call-graph-extractor.d.ts +13 -10
  28. package/packages/chunker/dist/call-graph-extractor.js +2 -1
  29. package/packages/chunker/dist/chunker-factory.d.ts +6 -2
  30. package/packages/chunker/dist/chunker-factory.js +2 -1
  31. package/packages/chunker/dist/chunker.interface.d.ts +8 -4
  32. package/packages/chunker/dist/chunker.interface.js +1 -0
  33. package/packages/chunker/dist/code-chunker.d.ts +16 -12
  34. package/packages/chunker/dist/code-chunker.js +12 -14
  35. package/packages/chunker/dist/generic-chunker.d.ts +14 -10
  36. package/packages/chunker/dist/generic-chunker.js +6 -5
  37. package/packages/chunker/dist/index.d.ts +8 -8
  38. package/packages/chunker/dist/index.js +1 -1
  39. package/packages/chunker/dist/markdown-chunker.d.ts +16 -12
  40. package/packages/chunker/dist/markdown-chunker.js +4 -10
  41. package/packages/chunker/dist/treesitter-chunker.d.ts +28 -31
  42. package/packages/chunker/dist/treesitter-chunker.js +7 -8
  43. package/packages/cli/dist/commands/analyze.d.ts +6 -2
  44. package/packages/cli/dist/commands/analyze.js +3 -3
  45. package/packages/cli/dist/commands/context-cmds.d.ts +6 -2
  46. package/packages/cli/dist/commands/context-cmds.js +2 -1
  47. package/packages/cli/dist/commands/environment.d.ts +6 -2
  48. package/packages/cli/dist/commands/environment.js +2 -2
  49. package/packages/cli/dist/commands/execution.d.ts +6 -2
  50. package/packages/cli/dist/commands/execution.js +2 -1
  51. package/packages/cli/dist/commands/graph.d.ts +6 -2
  52. package/packages/cli/dist/commands/graph.js +6 -6
  53. package/packages/cli/dist/commands/init/adapters.d.ts +27 -0
  54. package/packages/cli/dist/commands/init/adapters.js +2 -0
  55. package/packages/cli/dist/commands/init/config.d.ts +11 -0
  56. package/packages/cli/dist/commands/init/config.js +4 -0
  57. package/packages/cli/dist/commands/init/curated.d.ts +8 -0
  58. package/packages/cli/dist/commands/init/curated.js +2 -0
  59. package/packages/cli/dist/commands/init/index.d.ts +23 -0
  60. package/packages/cli/dist/commands/init/index.js +3 -0
  61. package/packages/cli/dist/commands/init/scaffold.d.ts +24 -0
  62. package/packages/cli/dist/commands/init/scaffold.js +2 -0
  63. package/packages/cli/dist/commands/init/templates.d.ts +10 -0
  64. package/packages/cli/dist/commands/init/templates.js +302 -0
  65. package/packages/cli/dist/commands/init.d.ts +9 -3
  66. package/packages/cli/dist/commands/init.js +253 -197
  67. package/packages/cli/dist/commands/knowledge.d.ts +6 -2
  68. package/packages/cli/dist/commands/knowledge.js +2 -1
  69. package/packages/cli/dist/commands/search.d.ts +6 -2
  70. package/packages/cli/dist/commands/search.js +2 -8
  71. package/packages/cli/dist/commands/system.d.ts +6 -2
  72. package/packages/cli/dist/commands/system.js +5 -4
  73. package/packages/cli/dist/commands/workspace.d.ts +6 -2
  74. package/packages/cli/dist/commands/workspace.js +2 -2
  75. package/packages/cli/dist/context.d.ts +7 -4
  76. package/packages/cli/dist/context.js +2 -1
  77. package/packages/cli/dist/helpers.d.ts +51 -47
  78. package/packages/cli/dist/helpers.js +6 -3
  79. package/packages/cli/dist/index.d.ts +4 -1
  80. package/packages/cli/dist/index.js +3 -2
  81. package/packages/cli/dist/kb-init.d.ts +48 -50
  82. package/packages/cli/dist/kb-init.js +2 -1
  83. package/packages/cli/dist/types.d.ts +8 -5
  84. package/packages/cli/dist/types.js +1 -0
  85. package/packages/core/dist/constants.d.ts +36 -33
  86. package/packages/core/dist/constants.js +2 -1
  87. package/packages/core/dist/content-detector.d.ts +10 -5
  88. package/packages/core/dist/content-detector.js +2 -1
  89. package/packages/core/dist/errors.d.ts +15 -12
  90. package/packages/core/dist/errors.js +2 -1
  91. package/packages/core/dist/index.d.ts +6 -6
  92. package/packages/core/dist/index.js +1 -1
  93. package/packages/core/dist/logger.d.ts +16 -7
  94. package/packages/core/dist/logger.js +2 -1
  95. package/packages/core/dist/types.d.ts +108 -90
  96. package/packages/core/dist/types.js +2 -0
  97. package/packages/embeddings/dist/embedder.interface.d.ts +22 -19
  98. package/packages/embeddings/dist/embedder.interface.js +1 -0
  99. package/packages/embeddings/dist/index.d.ts +3 -3
  100. package/packages/embeddings/dist/index.js +1 -1
  101. package/packages/embeddings/dist/onnx-embedder.d.ts +21 -22
  102. package/packages/embeddings/dist/onnx-embedder.js +2 -1
  103. package/packages/enterprise-bridge/dist/cache.d.ts +29 -0
  104. package/packages/enterprise-bridge/dist/cache.js +2 -0
  105. package/packages/enterprise-bridge/dist/er-client.d.ts +38 -0
  106. package/packages/enterprise-bridge/dist/er-client.js +2 -0
  107. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +63 -0
  108. package/packages/enterprise-bridge/dist/evolution-collector.js +2 -0
  109. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  110. package/packages/enterprise-bridge/dist/index.js +1 -0
  111. package/packages/enterprise-bridge/dist/policy-store.d.ts +46 -0
  112. package/packages/enterprise-bridge/dist/policy-store.js +2 -0
  113. package/packages/enterprise-bridge/dist/push-adapter.d.ts +24 -0
  114. package/packages/enterprise-bridge/dist/push-adapter.js +2 -0
  115. package/packages/enterprise-bridge/dist/result-merger.d.ts +15 -0
  116. package/packages/enterprise-bridge/dist/result-merger.js +2 -0
  117. package/packages/enterprise-bridge/dist/types.d.ts +82 -0
  118. package/packages/enterprise-bridge/dist/types.js +2 -0
  119. package/packages/indexer/dist/file-hasher.d.ts +5 -2
  120. package/packages/indexer/dist/file-hasher.js +2 -1
  121. package/packages/indexer/dist/filesystem-crawler.d.ts +23 -20
  122. package/packages/indexer/dist/filesystem-crawler.js +2 -1
  123. package/packages/indexer/dist/graph-extractor.d.ts +9 -12
  124. package/packages/indexer/dist/graph-extractor.js +2 -1
  125. package/packages/indexer/dist/incremental-indexer.d.ts +49 -43
  126. package/packages/indexer/dist/incremental-indexer.js +2 -1
  127. package/packages/indexer/dist/index.d.ts +5 -5
  128. package/packages/indexer/dist/index.js +1 -1
  129. package/packages/server/dist/api.d.ts +3 -8
  130. package/packages/server/dist/api.js +1 -1
  131. package/packages/server/dist/config.d.ts +6 -2
  132. package/packages/server/dist/config.js +2 -1
  133. package/packages/server/dist/curated-manager.d.ts +79 -76
  134. package/packages/server/dist/curated-manager.js +6 -10
  135. package/packages/server/dist/index.d.ts +1 -2
  136. package/packages/server/dist/index.js +2 -1
  137. package/packages/server/dist/replay-interceptor.d.ts +6 -6
  138. package/packages/server/dist/replay-interceptor.js +2 -1
  139. package/packages/server/dist/resources/resources.d.ts +7 -3
  140. package/packages/server/dist/resources/resources.js +3 -2
  141. package/packages/server/dist/server.d.ts +34 -24
  142. package/packages/server/dist/server.js +2 -1
  143. package/packages/server/dist/tools/analyze.tools.d.ts +14 -10
  144. package/packages/server/dist/tools/analyze.tools.js +2 -1
  145. package/packages/server/dist/tools/audit.tool.d.ts +9 -0
  146. package/packages/server/dist/tools/audit.tool.js +2 -0
  147. package/packages/server/dist/tools/bridge.tools.d.ts +35 -0
  148. package/packages/server/dist/tools/bridge.tools.js +16 -0
  149. package/packages/server/dist/tools/evolution.tools.d.ts +8 -0
  150. package/packages/server/dist/tools/evolution.tools.js +6 -0
  151. package/packages/server/dist/tools/forge.tools.d.ts +13 -11
  152. package/packages/server/dist/tools/forge.tools.js +11 -13
  153. package/packages/server/dist/tools/forget.tool.d.ts +7 -3
  154. package/packages/server/dist/tools/forget.tool.js +2 -7
  155. package/packages/server/dist/tools/graph.tool.d.ts +7 -3
  156. package/packages/server/dist/tools/graph.tool.js +5 -5
  157. package/packages/server/dist/tools/list.tool.d.ts +7 -3
  158. package/packages/server/dist/tools/list.tool.js +3 -8
  159. package/packages/server/dist/tools/lookup.tool.d.ts +7 -3
  160. package/packages/server/dist/tools/lookup.tool.js +3 -9
  161. package/packages/server/dist/tools/onboard.tool.d.ts +8 -4
  162. package/packages/server/dist/tools/onboard.tool.js +3 -2
  163. package/packages/server/dist/tools/policy.tools.d.ts +8 -0
  164. package/packages/server/dist/tools/policy.tools.js +3 -0
  165. package/packages/server/dist/tools/produce.tool.d.ts +6 -2
  166. package/packages/server/dist/tools/produce.tool.js +3 -2
  167. package/packages/server/dist/tools/read.tool.d.ts +7 -3
  168. package/packages/server/dist/tools/read.tool.js +3 -6
  169. package/packages/server/dist/tools/reindex.tool.d.ts +10 -6
  170. package/packages/server/dist/tools/reindex.tool.js +3 -2
  171. package/packages/server/dist/tools/remember.tool.d.ts +8 -3
  172. package/packages/server/dist/tools/remember.tool.js +4 -5
  173. package/packages/server/dist/tools/replay.tool.d.ts +6 -2
  174. package/packages/server/dist/tools/replay.tool.js +3 -6
  175. package/packages/server/dist/tools/search.tool.d.ts +10 -4
  176. package/packages/server/dist/tools/search.tool.js +7 -18
  177. package/packages/server/dist/tools/status.tool.d.ts +7 -3
  178. package/packages/server/dist/tools/status.tool.js +3 -3
  179. package/packages/server/dist/tools/toolkit.tools.d.ts +36 -34
  180. package/packages/server/dist/tools/toolkit.tools.js +20 -21
  181. package/packages/server/dist/tools/update.tool.d.ts +7 -3
  182. package/packages/server/dist/tools/update.tool.js +2 -6
  183. package/packages/server/dist/tools/utility.tools.d.ts +15 -14
  184. package/packages/server/dist/tools/utility.tools.js +11 -23
  185. package/packages/server/dist/version-check.d.ts +5 -1
  186. package/packages/server/dist/version-check.js +2 -1
  187. package/packages/store/dist/graph-store.interface.d.ts +89 -86
  188. package/packages/store/dist/graph-store.interface.js +1 -0
  189. package/packages/store/dist/index.d.ts +6 -6
  190. package/packages/store/dist/index.js +1 -1
  191. package/packages/store/dist/lance-store.d.ts +37 -30
  192. package/packages/store/dist/lance-store.js +2 -1
  193. package/packages/store/dist/sqlite-graph-store.d.ts +43 -46
  194. package/packages/store/dist/sqlite-graph-store.js +14 -13
  195. package/packages/store/dist/store-factory.d.ts +11 -7
  196. package/packages/store/dist/store-factory.js +2 -1
  197. package/packages/store/dist/store.interface.d.ts +47 -44
  198. package/packages/store/dist/store.interface.js +1 -0
  199. package/packages/tools/dist/audit.d.ts +66 -0
  200. package/packages/tools/dist/audit.js +7 -0
  201. package/packages/tools/dist/batch.d.ts +20 -17
  202. package/packages/tools/dist/batch.js +2 -1
  203. package/packages/tools/dist/changelog.d.ts +29 -26
  204. package/packages/tools/dist/changelog.js +3 -2
  205. package/packages/tools/dist/check.d.ts +45 -22
  206. package/packages/tools/dist/check.js +3 -2
  207. package/packages/tools/dist/checkpoint.d.ts +17 -14
  208. package/packages/tools/dist/checkpoint.js +2 -2
  209. package/packages/tools/dist/codemod.d.ts +35 -32
  210. package/packages/tools/dist/codemod.js +3 -2
  211. package/packages/tools/dist/compact.d.ts +34 -35
  212. package/packages/tools/dist/compact.js +3 -2
  213. package/packages/tools/dist/data-transform.d.ts +10 -7
  214. package/packages/tools/dist/data-transform.js +2 -1
  215. package/packages/tools/dist/dead-symbols.d.ts +29 -17
  216. package/packages/tools/dist/dead-symbols.js +3 -2
  217. package/packages/tools/dist/delegate.d.ts +26 -23
  218. package/packages/tools/dist/delegate.js +2 -5
  219. package/packages/tools/dist/diff-parse.d.ts +24 -21
  220. package/packages/tools/dist/diff-parse.js +4 -3
  221. package/packages/tools/dist/digest.d.ts +43 -45
  222. package/packages/tools/dist/digest.js +5 -5
  223. package/packages/tools/dist/encode.d.ts +11 -8
  224. package/packages/tools/dist/encode.js +2 -1
  225. package/packages/tools/dist/env-info.d.ts +25 -22
  226. package/packages/tools/dist/env-info.js +2 -1
  227. package/packages/tools/dist/eval.d.ts +13 -10
  228. package/packages/tools/dist/eval.js +3 -3
  229. package/packages/tools/dist/evidence-map.d.ts +64 -61
  230. package/packages/tools/dist/evidence-map.js +3 -3
  231. package/packages/tools/dist/file-cache.d.ts +42 -0
  232. package/packages/tools/dist/file-cache.js +4 -0
  233. package/packages/tools/dist/file-summary.d.ts +34 -29
  234. package/packages/tools/dist/file-summary.js +3 -2
  235. package/packages/tools/dist/file-walk.d.ts +6 -3
  236. package/packages/tools/dist/file-walk.js +2 -1
  237. package/packages/tools/dist/find-examples.d.ts +26 -21
  238. package/packages/tools/dist/find-examples.js +4 -3
  239. package/packages/tools/dist/find.d.ts +39 -40
  240. package/packages/tools/dist/find.js +2 -1
  241. package/packages/tools/dist/forge-classify.d.ts +35 -38
  242. package/packages/tools/dist/forge-classify.js +3 -2
  243. package/packages/tools/dist/forge-ground.d.ts +58 -60
  244. package/packages/tools/dist/forge-ground.js +2 -1
  245. package/packages/tools/dist/git-context.d.ts +22 -19
  246. package/packages/tools/dist/git-context.js +4 -3
  247. package/packages/tools/dist/graph-query.d.ts +75 -78
  248. package/packages/tools/dist/graph-query.js +2 -1
  249. package/packages/tools/dist/guide.d.ts +26 -0
  250. package/packages/tools/dist/guide.js +2 -0
  251. package/packages/tools/dist/health.d.ts +13 -10
  252. package/packages/tools/dist/health.js +3 -1
  253. package/packages/tools/dist/http-request.d.ts +20 -17
  254. package/packages/tools/dist/http-request.js +2 -1
  255. package/packages/tools/dist/index.d.ts +54 -49
  256. package/packages/tools/dist/index.js +1 -1
  257. package/packages/tools/dist/lane.d.ts +28 -25
  258. package/packages/tools/dist/lane.js +7 -7
  259. package/packages/tools/dist/measure.d.ts +32 -29
  260. package/packages/tools/dist/measure.js +3 -2
  261. package/packages/tools/dist/onboard.d.ts +29 -26
  262. package/packages/tools/dist/onboard.js +18 -41
  263. package/packages/tools/dist/parse-output.d.ts +48 -45
  264. package/packages/tools/dist/parse-output.js +3 -2
  265. package/packages/tools/dist/path-resolver.d.ts +15 -0
  266. package/packages/tools/dist/path-resolver.js +2 -0
  267. package/packages/tools/dist/process-manager.d.ts +18 -15
  268. package/packages/tools/dist/process-manager.js +2 -1
  269. package/packages/tools/dist/queue.d.ts +28 -25
  270. package/packages/tools/dist/queue.js +2 -2
  271. package/packages/tools/dist/regex-test.d.ts +26 -23
  272. package/packages/tools/dist/regex-test.js +2 -1
  273. package/packages/tools/dist/rename.d.ts +28 -25
  274. package/packages/tools/dist/rename.js +3 -2
  275. package/packages/tools/dist/replay.d.ts +33 -30
  276. package/packages/tools/dist/replay.js +5 -6
  277. package/packages/tools/dist/response-envelope.d.ts +44 -0
  278. package/packages/tools/dist/response-envelope.js +2 -0
  279. package/packages/tools/dist/schema-validate.d.ts +15 -12
  280. package/packages/tools/dist/schema-validate.js +2 -1
  281. package/packages/tools/dist/scope-map.d.ts +45 -45
  282. package/packages/tools/dist/scope-map.js +2 -1
  283. package/packages/tools/dist/snippet.d.ts +26 -24
  284. package/packages/tools/dist/snippet.js +2 -1
  285. package/packages/tools/dist/stash.d.ts +13 -10
  286. package/packages/tools/dist/stash.js +2 -2
  287. package/packages/tools/dist/stratum-card.d.ts +27 -27
  288. package/packages/tools/dist/stratum-card.js +4 -5
  289. package/packages/tools/dist/symbol.d.ts +29 -25
  290. package/packages/tools/dist/symbol.js +4 -3
  291. package/packages/tools/dist/test-run.d.ts +19 -15
  292. package/packages/tools/dist/test-run.js +3 -2
  293. package/packages/tools/dist/text-utils.d.ts +6 -3
  294. package/packages/tools/dist/text-utils.js +3 -2
  295. package/packages/tools/dist/time-utils.d.ts +15 -12
  296. package/packages/tools/dist/time-utils.js +2 -1
  297. package/packages/tools/dist/trace.d.ts +24 -20
  298. package/packages/tools/dist/trace.js +3 -2
  299. package/packages/tools/dist/truncation.d.ts +14 -2
  300. package/packages/tools/dist/truncation.js +8 -14
  301. package/packages/tools/dist/watch.d.ts +28 -25
  302. package/packages/tools/dist/watch.js +2 -1
  303. package/packages/tools/dist/web-fetch.d.ts +35 -32
  304. package/packages/tools/dist/web-fetch.js +7 -12
  305. package/packages/tools/dist/web-search.d.ts +16 -13
  306. package/packages/tools/dist/web-search.js +2 -1
  307. package/packages/tools/dist/workset.d.ts +19 -16
  308. package/packages/tools/dist/workset.js +2 -2
  309. package/packages/tui/dist/App-BAlmxCCw.js +3 -0
  310. package/packages/tui/dist/App.d.ts +11 -5
  311. package/packages/tui/dist/App.js +1 -450
  312. package/packages/tui/dist/CuratedPanel-sYdZAICX.js +3 -0
  313. package/packages/tui/dist/LogPanel-DVB8Sv46.js +4 -0
  314. package/packages/tui/dist/SearchPanel-DREo6zgt.js +3 -0
  315. package/packages/tui/dist/StatusPanel-2ex8fLOO.js +3 -0
  316. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  317. package/packages/tui/dist/devtools-DUyj952l.js +8 -0
  318. package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +29 -0
  319. package/packages/tui/dist/index-B9VpfVPP.d.ts +14 -0
  320. package/packages/tui/dist/index.d.ts +3 -19
  321. package/packages/tui/dist/index.js +2 -476
  322. package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +317 -0
  323. package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -5
  324. package/packages/tui/dist/panels/CuratedPanel.js +1 -371
  325. package/packages/tui/dist/panels/LogPanel.d.ts +7 -2
  326. package/packages/tui/dist/panels/LogPanel.js +1 -449
  327. package/packages/tui/dist/panels/SearchPanel.d.ts +14 -7
  328. package/packages/tui/dist/panels/SearchPanel.js +1 -372
  329. package/packages/tui/dist/panels/StatusPanel.d.ts +11 -5
  330. package/packages/tui/dist/panels/StatusPanel.js +1 -371
  331. package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +151 -0
  332. package/scaffold/adapters/claude-code.mjs +20 -0
  333. package/scaffold/adapters/copilot.mjs +320 -0
  334. package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +14 -0
  335. package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +14 -0
  336. package/scaffold/copilot/agents/Code-Reviewer-Alpha.agent.md +12 -0
  337. package/scaffold/copilot/agents/Code-Reviewer-Beta.agent.md +12 -0
  338. package/scaffold/copilot/agents/Debugger.agent.md +31 -0
  339. package/scaffold/copilot/agents/Documenter.agent.md +35 -0
  340. package/scaffold/copilot/agents/Explorer.agent.md +50 -0
  341. package/scaffold/copilot/agents/Frontend.agent.md +29 -0
  342. package/scaffold/copilot/agents/Implementer.agent.md +31 -0
  343. package/scaffold/copilot/agents/Orchestrator.agent.md +96 -0
  344. package/scaffold/copilot/agents/Planner.agent.md +45 -0
  345. package/scaffold/copilot/agents/README.md +57 -0
  346. package/scaffold/copilot/agents/Refactor.agent.md +30 -0
  347. package/scaffold/copilot/agents/Researcher-Alpha.agent.md +12 -0
  348. package/scaffold/copilot/agents/Researcher-Beta.agent.md +12 -0
  349. package/scaffold/copilot/agents/Researcher-Delta.agent.md +12 -0
  350. package/scaffold/copilot/agents/Researcher-Gamma.agent.md +12 -0
  351. package/scaffold/copilot/agents/Security.agent.md +42 -0
  352. package/scaffold/copilot/agents/_shared/adr-protocol.md +91 -0
  353. package/scaffold/copilot/agents/_shared/architect-reviewer-base.md +50 -0
  354. package/scaffold/copilot/agents/_shared/code-agent-base.md +70 -0
  355. package/scaffold/copilot/agents/_shared/code-reviewer-base.md +54 -0
  356. package/scaffold/copilot/agents/_shared/decision-protocol.md +27 -0
  357. package/scaffold/copilot/agents/_shared/forge-protocol.md +46 -0
  358. package/scaffold/copilot/agents/_shared/researcher-base.md +61 -0
  359. package/scaffold/copilot/agents/templates/adr-template.md +27 -0
  360. package/scaffold/copilot/agents/templates/execution-state.md +25 -0
  361. package/scaffold/copilot/prompts/ask.prompt.md +20 -0
  362. package/scaffold/copilot/prompts/debug.prompt.md +25 -0
  363. package/scaffold/copilot/prompts/design.prompt.md +22 -0
  364. package/scaffold/copilot/prompts/implement.prompt.md +26 -0
  365. package/scaffold/copilot/prompts/plan.prompt.md +24 -0
  366. package/scaffold/copilot/prompts/review.prompt.md +31 -0
  367. package/scaffold/definitions/agents.mjs +165 -0
  368. package/scaffold/definitions/bodies.mjs +292 -0
  369. package/scaffold/definitions/hooks.mjs +43 -0
  370. package/scaffold/definitions/models.mjs +56 -0
  371. package/scaffold/definitions/plugins.mjs +24 -0
  372. package/scaffold/definitions/prompts.mjs +145 -0
  373. package/scaffold/definitions/protocols.mjs +322 -0
  374. package/scaffold/definitions/tools.mjs +176 -0
  375. package/scaffold/generate.mjs +74 -0
  376. package/skills/brainstorming/SKILL.md +259 -0
  377. package/skills/brainstorming/scripts/frame-template.html +365 -0
  378. package/skills/brainstorming/scripts/helper.js +216 -0
  379. package/skills/brainstorming/scripts/server.cjs +9 -0
  380. package/skills/brainstorming/scripts/server.src.cjs +249 -0
  381. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  382. package/skills/brainstorming/visual-companion.md +430 -0
  383. package/skills/knowledge-base/SKILL.md +34 -21
@@ -1,147 +1,92 @@
1
- import{appendFileSync as p,existsSync as o,mkdirSync as u,readFileSync as m,writeFileSync as a}from"node:fs";import{basename as g,resolve as t}from"node:path";const h={sources:[{path:".",excludePatterns:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.kb-data/**","**/coverage/**","**/*.min.js","**/package-lock.json","**/pnpm-lock.yaml"]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:"mixedbread-ai/mxbai-embed-large-v1",dimensions:1024},store:{backend:"lancedb",path:".kb-data/lance"},curated:{path:"curated"}};function f(e){return{servers:{[`${e}-kb`]:{type:"stdio",command:"npx",args:["@vpxa/kb","serve"]}}}}function y(e){return`# ${e} \u2014 Copilot Instructions
2
-
3
- This project uses **@vpxa/kb** as an MCP knowledge base server. Use the KB tools to search, analyze, and understand the codebase before making changes.
4
-
5
- ## KB Tools
6
-
7
- Before starting any task on **${e}**, use these MCP tools:
8
-
9
- | Action | Tool | Example |
10
- |--------|------|---------|
11
- | Search code & decisions | \`kb_search\` | \`kb_search({ query: "..." })\` |
12
- | Find symbol definition | \`kb_symbol\` | \`kb_symbol({ name: "ClassName" })\` |
13
- | Plan what to read | \`kb_scope_map\` | \`kb_scope_map({ task: "..." })\` |
14
- | Trace call chains | \`kb_trace\` | \`kb_trace({ symbol: "fn", file: "path" })\` |
15
- | Impact of a change | \`kb_blast_radius\` | \`kb_blast_radius({ changed_files: ["..."] })\` |
16
- | Persist what you learn | \`kb_remember\` | \`kb_remember({ title: "...", category: "decisions" })\` |
17
- | Typecheck + lint | \`kb_check\` | \`kb_check({})\` |
18
- | Run tests | \`kb_test_run\` | \`kb_test_run({})\` |
19
-
20
- ## Workflow
21
-
22
- \`\`\`
23
- kb_search({ query: "your task keywords" }) # Recall prior decisions
24
- kb_scope_map({ task: "what you are doing" }) # Get a reading plan
25
- # ... do the work ...
26
- kb_check({}) # Typecheck + lint
27
- kb_test_run({}) # Run tests
28
- kb_remember({ title: "What I learned", category: "decisions" }) # Persist
29
- \`\`\`
30
-
31
- ## KB MCP Tools \u2014 Complete Reference
32
-
33
- ### Search & Discovery
34
- | Tool | Purpose |
35
- |------|---------|
36
- | \`kb_search\` | Hybrid vector + keyword search. Modes: \`hybrid\` (default), \`semantic\`, \`keyword\`. Filters: \`origin\`, \`category\`, \`content_type\`, \`tags\`. |
37
- | \`kb_find\` | Federated search: vector + FTS + glob + regex in one call. |
38
- | \`kb_symbol\` | Resolve symbol definition, imports, and all references across files. |
39
- | \`kb_lookup\` | Full-file retrieval by path or record ID. |
40
- | \`kb_scope_map\` | Task-scoped reading plan with file list and token estimates. |
41
- | \`kb_trace\` | Forward/backward flow tracing through call chains. |
42
- | \`kb_find_examples\` | Find real usage examples of a symbol or pattern. |
43
- | \`kb_dead_symbols\` | Find exported symbols that are never imported anywhere. |
44
- | \`kb_file_summary\` | Structural overview of a file (exports, imports, functions). |
45
-
46
- ### Code Analysis
47
- | Tool | Purpose |
48
- |------|---------|
49
- | \`kb_analyze_structure\` | Project structure overview with file tree and stats. |
50
- | \`kb_analyze_dependencies\` | Dependency graph with confidence scoring. |
51
- | \`kb_analyze_symbols\` | Symbol extraction and cross-references. |
52
- | \`kb_analyze_patterns\` | Design pattern detection (Singleton, Factory, etc.). |
53
- | \`kb_analyze_entry_points\` | Discover entry points (Lambda handlers, CLI, HTTP routes). |
54
- | \`kb_analyze_diagram\` | Generate Mermaid architecture diagrams. |
55
- | \`kb_blast_radius\` | Change impact analysis \u2014 what breaks if you modify a file. |
56
-
57
- ### Knowledge Management
58
- | Tool | Purpose |
59
- |------|---------|
60
- | \`kb_remember\` | Store a curated knowledge entry (decisions, patterns, conventions). |
61
- | \`kb_read\` | Read a curated entry by path. |
62
- | \`kb_update\` | Update an existing curated entry. |
63
- | \`kb_forget\` | Delete a curated entry (requires reason). |
64
- | \`kb_list\` | List curated entries, filterable by category and tags. |
65
- | \`kb_produce_knowledge\` | Auto-generate knowledge from codebase analysis. |
66
-
67
- ### Execution & Validation
68
- | Tool | Purpose |
69
- |------|---------|
70
- | \`kb_check\` | Incremental typecheck + lint in one call (tsc + biome). |
71
- | \`kb_test_run\` | Run tests with structured pass/fail results. |
72
- | \`kb_eval\` | Sandboxed JavaScript/TypeScript execution. |
73
- | \`kb_batch\` | Execute multiple operations in parallel. |
74
-
75
- ### Code Manipulation
76
- | Tool | Purpose |
77
- |------|---------|
78
- | \`kb_rename\` | Smart whole-word symbol rename across files (dry-run supported). |
79
- | \`kb_codemod\` | Regex-based code transformations with rule files (dry-run supported). |
80
- | \`kb_diff_parse\` | Parse unified diff into structured file changes. |
81
- | \`kb_data_transform\` | JQ-like JSON transformations. |
82
-
83
- ### Context Management
84
- | Tool | Purpose |
85
- |------|---------|
86
- | \`kb_compact\` | Compress text to relevant sections using embeddings (no LLM). |
87
- | \`kb_workset\` | Named file set management (save/load/add/remove working sets). |
88
- | \`kb_stash\` | Named key-value store for session data. |
89
- | \`kb_checkpoint\` | Save/restore lightweight session checkpoints. |
90
- | \`kb_parse_output\` | Parse build tool output (tsc, vitest, biome, git) into structured JSON. |
91
-
92
- ### FORGE & Context Compression
93
- | Tool | Purpose |
94
- |------|---------|
95
- | \`kb_forge_ground\` | Full FORGE Ground phase (classify + scope + constraints + evidence). |
96
- | \`kb_forge_classify\` | Quick FORGE tier classification (Floor/Standard/Critical). |
97
- | \`kb_evidence_map\` | Track critical-path claims as Verified/Assumed/Unknown with receipts. |
98
- | \`kb_digest\` | Compress multiple text blocks into token-budgeted digest. |
99
- | \`kb_stratum_card\` | Generate T1/T2 context cards (10-100x token reduction). |
100
-
101
- ### Web & Network
102
- | Tool | Purpose |
103
- |------|---------|
104
- | \`kb_web_fetch\` | Fetch web page \u2192 LLM-optimized markdown. CSS selectors, 4 modes, smart truncation. |
105
- | \`kb_web_search\` | Search the web via DuckDuckGo (no API key needed). |
106
- | \`kb_http\` | HTTP requests (GET/POST/PUT/PATCH/DELETE) for API testing with timing. |
107
-
108
- ### Verified Lanes
109
- | Tool | Purpose |
110
- |------|---------|
111
- | \`kb_lane\` | Manage isolated file copies for parallel exploration. Actions: \`create\`, \`list\`, \`status\`, \`diff\`, \`merge\`, \`discard\`. |
112
-
113
- ### Git & Environment
114
- | Tool | Purpose |
115
- |------|---------|
116
- | \`kb_git_context\` | Branch, status, recent commits, optional diff stats. |
117
- | \`kb_process\` | Process supervisor (start/stop/logs). |
118
- | \`kb_watch\` | Filesystem watcher for auto-triggered workflows. |
119
- | \`kb_delegate\` | Delegate subtask to a local Ollama model. |
120
-
121
- ### Developer Utilities
122
- | Tool | Purpose |
123
- |------|---------|
124
- | \`kb_regex_test\` | Test regex patterns with match/replace/split modes. |
125
- | \`kb_encode\` | Base64, URL, SHA-256, MD5, hex encode/decode, JWT decode. |
126
- | \`kb_measure\` | Code complexity metrics (cyclomatic complexity, line counts). |
127
- | \`kb_changelog\` | Generate changelog from git history (conventional commits). |
128
- | \`kb_schema_validate\` | Validate JSON data against JSON Schema. |
129
- | \`kb_snippet\` | Save/get/search/delete persistent code snippets. |
130
- | \`kb_env\` | System and runtime environment info (sensitive values redacted). |
131
- | \`kb_time\` | Date parsing, timezone conversion, duration math. |
132
-
133
- ### System
134
- | Tool | Purpose |
135
- |------|---------|
136
- | \`kb_status\` | Index statistics (record count, file count, content types). |
137
- | \`kb_reindex\` | Rebuild the vector index from configured sources. |
138
- | \`kb_health\` | Project health checks (package.json, tsconfig, lockfile, etc.). |
139
- | \`kb_onboard\` | First-time codebase onboarding \u2014 runs all analyses, auto-persists results. |
140
- | \`kb_graph\` | Knowledge graph queries (find_nodes, find_edges, neighbors, traverse, stats). |
141
- | \`kb_queue\` | Task queue for sequential agent operations. |
142
- | \`kb_replay_list\` | View audit trail of tool invocations. |
143
- | \`kb_replay_clear\` | Clear the replay audit trail. |
144
- `}function w(e){return`# ${e} \u2014 Agent Instructions
1
+ import{appendFileSync as e,copyFileSync as t,existsSync as n,mkdirSync as r,readFileSync as i,readdirSync as a,statSync as o,writeFileSync as s}from"node:fs";import{basename as c,dirname as l,resolve as u}from"node:path";import{fileURLToPath as d}from"node:url";const f={serverName:`knowledge-base`,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/.kb-data/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:`mixedbread-ai/mxbai-embed-large-v1`,dimensions:1024},store:{backend:`lancedb`,path:`.kb-data/lance`},curated:{path:`curated`}};function p(e){return{servers:{[e]:{type:`stdio`,command:`npx`,args:[`@vpxa/kb`,`serve`]}}}}function m(e,t){let n=e=>e;return`# ${e} Copilot Instructions
2
+
3
+ This project uses **@vpxa/kb** as an MCP knowledge base server. The KB provides search, context compression, persistent memory, and validation tools that **MUST** be used to maintain quality and performance.
4
+
5
+ ## Mandatory Rules
6
+
7
+ ### 1. ALWAYS search before acting
8
+ Before writing or modifying code, you MUST recall prior decisions and understand the affected area:
9
+ \`\`\`
10
+ ${n(`search`)}({ query: "<task keywords>" })
11
+ ${n(`scope_map`)}({ task: "<what you are doing>" })
12
+ \`\`\`
13
+
14
+ ### 2. ALWAYS compress context before reading large files
15
+ Do NOT read entire files into context. Use these tools to reduce tokens and focus on what matters:
16
+
17
+ | Situation | Tool | Why |
18
+ |-----------|------|-----|
19
+ | Need relevant sections of a large file | \`${n(`compact`)}\` | Extracts only semantically relevant chunks — 5-20x reduction |
20
+ | Need to summarize multiple sources | \`${n(`digest`)}\` | Compresses multiple text blocks into a token-budgeted summary |
21
+ | Need a quick structural overview of a file | \`${n(`file_summary`)}\` | Returns exports, imports, functions without reading the full file |
22
+ | Need a reusable context card | \`${n(`stratum_card`)}\` | Generates T1/T2 cards — 10-100x token reduction |
23
+
24
+ **Example reading a 400-line file:**
25
+ \`\`\`
26
+ # BAD: read_file entire file (wastes ~3000 tokens)
27
+ # GOOD: get structure first, then compact only what you need
28
+ ${n(`file_summary`)}({ path: "src/http-client.ts" })
29
+ ${n(`compact`)}({ path: "src/http-client.ts", query: "retry logic" })
30
+ \`\`\`
31
+
32
+ ### 3. ALWAYS use persistent memory
33
+ - **Start of session**: Read prior knowledge with \`${n(`list`)}()\` and \`${n(`search`)}({ query: "SESSION CHECKPOINT", origin: "curated" })\`
34
+ - **During session**: Use \`${n(`stash`)}\` for temporary working data, \`${n(`checkpoint`)}\` to save progress
35
+ - **End of session**: MUST call \`${n(`remember`)}\` to persist decisions, patterns, and lessons learned
36
+ - **Before proposing a new approach**: MUST \`${n(`search`)}\` to check if a decision already exists
37
+
38
+ | Tool | When | Persistence |
39
+ |------|------|-------------|
40
+ | \`${n(`stash`)}\` | Temporary data within a session (intermediate results, scratch notes) | Session only |
41
+ | \`${n(`checkpoint`)}\` | Save/restore session progress (resumable work) | Session only |
42
+ | \`${n(`remember`)}\` | Architecture decisions, conventions, patterns, troubleshooting | Permanent (survives reindex) |
43
+
44
+ ### 4. ALWAYS validate before committing
45
+ \`\`\`
46
+ ${n(`check`)}({}) # Typecheck + lint (returns summary by default)
47
+ ${n(`test_run`)}({}) # Run tests
48
+ ${n(`blast_radius`)}({ changed_files: ["..."] }) # Impact analysis
49
+ ${n(`audit`)}({}) # Unified project audit with score and recommendations
50
+ \`\`\`
51
+
52
+ ### 5. Use FORGE for complex tasks
53
+ For tasks involving multiple files or architectural decisions:
54
+ \`\`\`
55
+ ${n(`forge_classify`)}({ task: "<description>" }) # Classify complexity tier
56
+ ${n(`forge_ground`)}({ task: "<description>" }) # Full analysis: scope + constraints + evidence
57
+ ${n(`evidence_map`)}({ claims: [...] }) # Track verified vs assumed claims
58
+ \`\`\`
59
+
60
+ ## Quick Workflow
61
+
62
+ \`\`\`
63
+ # 1. Orient
64
+ ${n(`search`)}({ query: "task keywords" })
65
+ ${n(`scope_map`)}({ task: "what you are doing" })
66
+
67
+ # 2. Read efficiently (NEVER raw-read large files)
68
+ ${n(`file_summary`)}({ path: "relevant-file.ts" })
69
+ ${n(`compact`)}({ path: "relevant-file.ts", query: "specific concern" })
70
+
71
+ # 3. Do the work
72
+
73
+ # 4. Validate
74
+ ${n(`check`)}({})
75
+ ${n(`test_run`)}({})
76
+
77
+ # 5. Persist
78
+ ${n(`remember`)}({ title: "What I learned", content: "...", category: "decisions" })
79
+ \`\`\`
80
+
81
+ ## Context Budget Rules
82
+
83
+ - **Prefer \`${n(`file_summary`)}\` over \`read_file\`** for understanding file structure
84
+ - **Prefer \`${n(`compact`)}\` over full file reads** when you need specific sections (use \`path\` param to avoid read_file round-trip)
85
+ - **Prefer \`${n(`search`)}\` over \`grep_search\`** for semantic/conceptual queries
86
+ - **Prefer \`${n(`symbol`)}\` over manual grep** for finding definitions and references
87
+ - **Use \`${n(`digest`)}\`** when combining information from 3+ sources
88
+ - **Use \`${n(`stratum_card`)}\`** to create reusable compressed context for repeated reference
89
+ `}function h(e,t){let n=e=>e;return`# ${e} Agent Instructions
145
90
 
146
91
  ## KB Knowledge Base
147
92
 
@@ -150,100 +95,211 @@ This project has a **@vpxa/kb** MCP server providing search, analysis, memory, a
150
95
  ### Skills Reference
151
96
 
152
97
  | Context | Skill | Details |
153
- |---------|-------|---------|
154
- | KB search, analysis, memory | \`kb\` | See [skills/knowledge-base/SKILL.md](skills/knowledge-base/SKILL.md) or run \`kb_status({})\` |
98
+ |---------|-------|--------|
99
+ | KB search, analysis, memory | \`kb\` | See [.github/skills/knowledge-base/SKILL.md](.github/skills/knowledge-base/SKILL.md) or run \`${n(`status`)}({})\` |
100
+ | Brainstorming & design | \`brainstorming\` | See [.github/skills/brainstorming/SKILL.md](.github/skills/brainstorming/SKILL.md) |
155
101
 
156
102
  ### Available Tool Categories
157
103
 
158
104
  | Category | Tools | Purpose |
159
105
  |----------|-------|---------|
160
- | Search & Discovery | \`kb_search\`, \`kb_find\`, \`kb_symbol\`, \`kb_trace\`, \`kb_scope_map\`, \`kb_lookup\`, \`kb_find_examples\`, \`kb_dead_symbols\`, \`kb_file_summary\` | Find code, symbols, data flow, reading plans |
161
- | Code Analysis | \`kb_analyze_structure\`, \`kb_analyze_dependencies\`, \`kb_analyze_symbols\`, \`kb_analyze_patterns\`, \`kb_analyze_entry_points\`, \`kb_analyze_diagram\`, \`kb_blast_radius\` | Structure, deps, patterns, impact, diagrams |
162
- | Knowledge | \`kb_remember\`, \`kb_read\`, \`kb_update\`, \`kb_forget\`, \`kb_list\`, \`kb_produce_knowledge\` | Persistent cross-session memory |
163
- | Execution | \`kb_check\`, \`kb_test_run\`, \`kb_eval\`, \`kb_batch\` | Typecheck, lint, test, run code |
164
- | Code Manipulation | \`kb_rename\`, \`kb_codemod\`, \`kb_diff_parse\`, \`kb_data_transform\` | Safe renames, transforms, diff parsing |
165
- | Context | \`kb_compact\`, \`kb_workset\`, \`kb_stash\`, \`kb_checkpoint\`, \`kb_parse_output\` | Manage working sets, save progress |
166
- | FORGE | \`kb_forge_ground\`, \`kb_forge_classify\`, \`kb_evidence_map\`, \`kb_digest\`, \`kb_stratum_card\` | Quality gates, context compression |
167
- | Web & API | \`kb_web_fetch\`, \`kb_web_search\`, \`kb_http\` | Fetch pages, search web, test APIs |
168
- | Lanes | \`kb_lane\` | Isolated file copies for parallel exploration (create/list/status/diff/merge/discard) |
169
- | Git & Environment | \`kb_git_context\`, \`kb_process\`, \`kb_watch\`, \`kb_delegate\` | Git info, process management |
170
- | Utilities | \`kb_regex_test\`, \`kb_encode\`, \`kb_measure\`, \`kb_changelog\`, \`kb_schema_validate\`, \`kb_snippet\`, \`kb_env\`, \`kb_time\` | Regex, encoding, metrics, validation |
171
- | System | \`kb_status\`, \`kb_reindex\`, \`kb_health\`, \`kb_onboard\`, \`kb_graph\`, \`kb_queue\`, \`kb_replay_list\`, \`kb_replay_clear\` | Index management, health checks, knowledge graph |
106
+ | Search & Discovery | \`${n(`search`)}\`, \`${n(`find`)}\`, \`${n(`symbol`)}\`, \`${n(`trace`)}\`, \`${n(`scope_map`)}\`, \`${n(`lookup`)}\`, \`${n(`dead_symbols`)}\`, \`${n(`file_summary`)}\` | Find code, symbols, data flow, reading plans |
107
+ | Code Analysis | \`${n(`analyze_structure`)}\`, \`${n(`analyze_dependencies`)}\`, \`${n(`analyze_symbols`)}\`, \`${n(`analyze_patterns`)}\`, \`${n(`analyze_entry_points`)}\`, \`${n(`analyze_diagram`)}\`, \`${n(`blast_radius`)}\` | Structure, deps, patterns, impact, diagrams |
108
+ | Knowledge | \`${n(`remember`)}\`, \`${n(`read`)}\`, \`${n(`update`)}\`, \`${n(`forget`)}\`, \`${n(`list`)}\`, \`${n(`produce_knowledge`)}\` | Persistent cross-session memory |
109
+ | Execution | \`${n(`check`)}\`, \`${n(`test_run`)}\`, \`${n(`eval`)}\`, \`${n(`batch`)}\`, \`${n(`audit`)}\` | Typecheck, lint, test, run code, unified audit. \`check\` defaults to summary output (~300 tokens) |
110
+ | Code Manipulation | \`${n(`rename`)}\`, \`${n(`codemod`)}\`, \`${n(`diff_parse`)}\`, \`${n(`data_transform`)}\` | Safe renames, transforms, diff parsing |
111
+ | Context | \`${n(`compact`)}\`, \`${n(`workset`)}\`, \`${n(`stash`)}\`, \`${n(`checkpoint`)}\`, \`${n(`parse_output`)}\` | Manage working sets, save progress. \`compact\` accepts \`path\` for server-side file read |
112
+ | FORGE | \`${n(`forge_ground`)}\`, \`${n(`forge_classify`)}\`, \`${n(`evidence_map`)}\`, \`${n(`digest`)}\`, \`${n(`stratum_card`)}\` | Quality gates, context compression |
113
+ | Web & API | \`${n(`web_fetch`)}\`, \`${n(`web_search`)}\`, \`${n(`http`)}\` | Fetch pages, search web, test APIs |
114
+ | Lanes | \`${n(`lane`)}\` | Isolated file copies for parallel exploration (create/list/status/diff/merge/discard) |
115
+ | Git & Environment | \`${n(`git_context`)}\`, \`${n(`process`)}\`, \`${n(`watch`)}\`, \`${n(`delegate`)}\` | Git info, process management |
116
+ | Utilities | \`${n(`regex_test`)}\`, \`${n(`encode`)}\`, \`${n(`measure`)}\`, \`${n(`changelog`)}\`, \`${n(`schema_validate`)}\`, \`${n(`snippet`)}\`, \`${n(`env`)}\`, \`${n(`time`)}\` | Regex, encoding, metrics, validation |
117
+ | System | \`${n(`status`)}\`, \`${n(`reindex`)}\`, \`${n(`health`)}\`, \`${n(`guide`)}\`, \`${n(`onboard`)}\`, \`${n(`graph`)}\`, \`${n(`queue`)}\`, \`${n(`replay`)}\` | Index management, health checks, tool discovery, knowledge graph |
118
+
119
+ ---
120
+
121
+ ## MANDATORY: Context Reduction Protocol
172
122
 
173
- ### Search Modes
123
+ **Every agent interaction MUST minimize context window usage.** Raw file reads waste tokens and degrade LLM output quality. Use these tools instead:
174
124
 
175
- The \`kb_search\` tool supports three search strategies via the \`search_mode\` parameter:
125
+ ### Decision Tree How to Read Code
176
126
 
177
- - **\`hybrid\`** (default) \u2014 Vector similarity + full-text keyword search merged via Reciprocal Rank Fusion. Best for most queries.
178
- - **\`semantic\`** \u2014 Pure vector cosine similarity. Best for conceptual/meaning-based queries.
179
- - **\`keyword\`** \u2014 Full-text search only. Best for exact identifiers, function names, specific strings.
127
+ \`\`\`
128
+ Need to understand a file?
129
+ ├─ Just structure? ${n(`file_summary`)} (exports, imports, functions ~50 tokens)
130
+ ├─ Specific section? → ${n(`compact`)}({ path: "file.ts", query: "topic" }) — 5-20x reduction
131
+ ├─ Multiple files? → ${n(`digest`)} (multi-source compression — token-budgeted)
132
+ ├─ Repeated reference? → ${n(`stratum_card`)} (T1/T2 card — 10-100x reduction)
133
+ └─ Full file needed? → ONLY as last resort, and compact it after reading
134
+ \`\`\`
135
+
136
+ ### Rules
137
+ 1. **NEVER read a file >100 lines without compressing it first**
138
+ 2. **ALWAYS use \`${n(`file_summary`)}\` before \`read_file\`** — often the summary is sufficient
139
+ 3. **ALWAYS use \`${n(`compact`)}\` when you only need specific sections** of a file (use \`path\` param to read server-side)
140
+ 4. **Use \`${n(`digest`)}\` when synthesizing from 3+ sources** — don't accumulate raw text
141
+ 5. **Use \`${n(`stratum_card`)}\` for files you'll reference repeatedly** in a session
142
+
143
+ ---
144
+
145
+ ## MANDATORY: Memory Protocol
146
+
147
+ **Every session MUST read and write persistent memory.** Without this, every conversation starts from zero.
148
+
149
+ ### Session Start (MUST do ALL of these)
150
+ \`\`\`
151
+ ${n(`status`)}({}) # Verify KB is ready
152
+ ${n(`list`)}() # See what knowledge exists
153
+ ${n(`search`)}({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
154
+ \`\`\`
155
+
156
+ ### During Session
157
+ | Situation | Action |
158
+ |-----------|--------|
159
+ | Found a useful intermediate result | \`${n(`stash`)}({ key: "name", value: "data" })\` |
160
+ | Completed a milestone | \`${n(`checkpoint`)}({ action: "save", name: "milestone" })\` |
161
+ | Made an architecture decision | \`${n(`remember`)}({ title: "...", category: "decisions" })\` |
162
+ | Discovered a pattern or convention | \`${n(`remember`)}({ title: "...", category: "patterns" })\` |
163
+ | Found a non-obvious solution | \`${n(`remember`)}({ title: "...", category: "troubleshooting" })\` |
164
+ | About to propose a new approach | \`${n(`search`)}({ query: "..." })\` — check if decided before |
165
+
166
+ ### Session End (MUST do this)
167
+ \`\`\`
168
+ ${n(`remember`)}({
169
+ title: "Session checkpoint: <topic>",
170
+ content: "<what was done, decisions made, blockers, next steps>",
171
+ category: "conventions"
172
+ })
173
+ \`\`\`
174
+
175
+ ### Memory Decision Tree
176
+ \`\`\`
177
+ Is this data temporary (scratch, intermediate)?
178
+ ├─ Yes → ${n(`stash`)} (session-scoped key-value)
179
+ └─ No → Is it resumable progress?
180
+ ├─ Yes → ${n(`checkpoint`)} (session-scoped snapshot)
181
+ └─ No → ${n(`remember`)} (permanent, survives reindex)
182
+ Categories: decisions | patterns | conventions | troubleshooting
183
+ \`\`\`
180
184
 
181
- Additional filters: \`origin\` (\`indexed\`/\`curated\`/\`produced\`), \`category\`, \`content_type\`, \`tags\`, \`min_score\`.
185
+ ---
182
186
 
183
- ### Session Protocol
187
+ ## MANDATORY: Search-Before-Act Protocol
188
+
189
+ **NEVER write or modify code without first searching for context.**
184
190
 
185
- **Start of session:**
186
191
  \`\`\`
187
- kb_status({})
188
- kb_search({ query: "SESSION CHECKPOINT", origin: "curated" })
192
+ # Before ANY code change:
193
+ ${n(`search`)}({ query: "<what you're about to change>" }) # Prior decisions?
194
+ ${n(`scope_map`)}({ task: "<description>" }) # What files to read?
195
+ ${n(`symbol`)}({ name: "<key symbol>" }) # Where is it defined/used?
189
196
  \`\`\`
190
197
 
191
- **During session:**
198
+ If \`${n(`search`)}\` returns a prior decision about the topic, you MUST follow it or explicitly explain why you're deviating.
199
+
200
+ ---
201
+
202
+ ## MANDATORY: Validation Protocol
203
+
204
+ **NEVER commit or present code without validation.**
205
+
192
206
  \`\`\`
193
- kb_search \u2192 kb_scope_map \u2192 kb_symbol \u2192 kb_trace # Orient
194
- kb_check \u2192 kb_test_run # Validate changes
195
- kb_remember # Capture insights
207
+ ${n(`check`)}({}) # Typecheck + lint (tsc + biome)
208
+ ${n(`test_run`)}({}) # Run tests
209
+ ${n(`blast_radius`)}({ changed_files: ["..."] }) # Impact analysis
210
+ ${n(`audit`)}({}) # Unified project audit (structure, deps, patterns, health, dead symbols, entry points)
196
211
  \`\`\`
197
212
 
198
- **End of session:**
213
+ ---
214
+
215
+ ## FORGE Protocol (for complex tasks)
216
+
217
+ For tasks touching 3+ files or involving architectural decisions:
218
+
199
219
  \`\`\`
200
- kb_remember({ title: "Session checkpoint: <topic>", content: "<summary>", category: "conventions" })
220
+ ${n(`forge_classify`)}({ task: "<description>" }) # Quick: Floor/Standard/Critical tier
221
+ ${n(`forge_ground`)}({ task: "<description>" }) # Full: scope + constraints + evidence
222
+ ${n(`evidence_map`)}({ claims: ["claim1", "claim2"] }) # Track verified vs assumed
201
223
  \`\`\`
202
224
 
203
- ### Workflow Chains
225
+ ---
226
+
227
+ ## Search Modes
228
+
229
+ | Mode | When | Example |
230
+ |------|------|---------|
231
+ | \`hybrid\` (default) | General queries | \`${n(`search`)}({ query: "error handling" })\` |
232
+ | \`semantic\` | Conceptual/meaning-based | \`${n(`search`)}({ query: "retry with backoff", search_mode: "semantic" })\` |
233
+ | \`keyword\` | Exact identifiers | \`${n(`search`)}({ query: "CircuitBreaker", search_mode: "keyword" })\` |
234
+
235
+ Filters: \`origin\` (\`indexed\`/\`curated\`/\`produced\`), \`category\`, \`content_type\`, \`tags\`, \`min_score\`.
236
+
237
+ ---
238
+
239
+ ## Workflow Chains
204
240
 
205
241
  **Codebase onboarding:**
206
242
  \`\`\`
207
- kb_onboard({ path: "." }) \u2192 kb_produce_knowledge({ path: "src/" }) \u2192 kb_remember(...)
243
+ ${n(`onboard`)}({ path: "." }) ${n(`produce_knowledge`)}({ path: "src/" }) ${n(`remember`)}(...)
208
244
  \`\`\`
209
245
 
210
246
  **Planning a task:**
211
247
  \`\`\`
212
- kb_search({ query: "task keywords" }) \u2192 kb_scope_map({ task: "description" }) \u2192 kb_workset({ action: "save", name: "task", files: [...] })
248
+ ${n(`search`)}({ query: "task keywords" })
249
+ → ${n(`scope_map`)}({ task: "description" })
250
+ → ${n(`file_summary`)} for each file in scope
251
+ → ${n(`compact`)}({ path: "relevant-file.ts", query: "detail needed" }) for files needing detail
252
+ → ${n(`workset`)}({ action: "save", name: "task", files: [...] })
213
253
  \`\`\`
214
254
 
215
255
  **Bug investigation:**
216
256
  \`\`\`
217
- kb_parse_output({ output: "<error>" }) \u2192 kb_symbol({ name: "failingFn" }) \u2192 kb_trace({ symbol: "failingFn", direction: "backward" }) \u2192 kb_blast_radius({ changed_files: ["suspect.ts"] })
257
+ ${n(`parse_output`)}({ output: "<error>" })
258
+ → ${n(`symbol`)}({ name: "failingFn" })
259
+ → ${n(`trace`)}({ symbol: "failingFn", direction: "backward" })
260
+ → ${n(`blast_radius`)}({ changed_files: ["suspect.ts"] })
218
261
  \`\`\`
219
262
 
220
263
  **Safe refactor with lanes:**
221
264
  \`\`\`
222
- kb_lane({ action: "create", name: "refactor", files: [...] }) \u2192 [make changes] \u2192 kb_lane({ action: "diff", name: "refactor" }) \u2192 kb_check({}) \u2192 kb_lane({ action: "merge", name: "refactor" })
265
+ ${n(`lane`)}({ action: "create", name: "refactor", files: [...] })
266
+ → [make changes]
267
+ → ${n(`lane`)}({ action: "diff", name: "refactor" })
268
+ → ${n(`check`)}({}) → ${n(`test_run`)}({})
269
+ → ${n(`lane`)}({ action: "merge", name: "refactor" })
223
270
  \`\`\`
224
271
 
225
272
  **After making changes:**
226
273
  \`\`\`
227
- kb_blast_radius({ changed_files: ["src/file.ts"] }) \u2192 kb_check({}) \u2192 kb_test_run({}) \u2192 kb_reindex({}) \u2192 kb_remember(...)
274
+ ${n(`blast_radius`)}({ changed_files: ["src/file.ts"] })
275
+ → ${n(`check`)}({}) → ${n(`test_run`)}({})
276
+ → ${n(`reindex`)}({})
277
+ → ${n(`remember`)}(...)
228
278
  \`\`\`
229
279
 
230
- ### Knowledge Categories
280
+ ---
281
+
282
+ ## Knowledge Categories
283
+
284
+ | Category | What to store |
285
+ |----------|---------------|
286
+ | \`decisions\` | Architecture choices, trade-offs, rejected alternatives |
287
+ | \`patterns\` | Code patterns, naming conventions, structural patterns |
288
+ | \`conventions\` | Session checkpoints, workflow conventions, team agreements |
289
+ | \`troubleshooting\` | Non-obvious fixes, debugging strategies, workarounds |
231
290
 
232
- \`decisions\` | \`patterns\` | \`conventions\` | \`troubleshooting\`
291
+ ---
233
292
 
234
- ### Core Rules
293
+ ## Core Rules Summary
235
294
 
236
- - Search KB for prior decisions before proposing new ones
237
- - Follow \`_Next:\` hints in tool responses for guided workflows
238
- - Use \`kb_check\` and \`kb_test_run\` to validate before committing
239
- - Use \`kb_remember\` to persist architecture decisions and lessons learned
240
- - Analysis results are auto-persisted as \`origin: "produced"\` entries
241
- `}async function P(e){const s=process.cwd(),i=t(s,"kb.config.json");if(o(i)&&!e.force){console.log("kb.config.json already exists. Use --force to overwrite.");return}a(i,`${JSON.stringify(h,null,2)}
242
- `,"utf-8"),console.log(" Created kb.config.json");const c=t(s,"curated");o(c)||(u(c,{recursive:!0}),console.log(" Created curated/"));const r=t(s,".gitignore");o(r)?m(r,"utf-8").includes(".kb-data")||(p(r,`
243
- # Knowledge base vector store
244
- .kb-data/
245
- `,"utf-8"),console.log(" Added .kb-data/ to .gitignore")):(a(r,`# Knowledge base vector store
246
- .kb-data/
247
- `,"utf-8"),console.log(" Created .gitignore with .kb-data/"));const n=g(s),l=t(s,".vscode"),d=t(l,"mcp.json");o(l)&&!o(d)&&(a(d,`${JSON.stringify(f(n),null,2)}
248
- `,"utf-8"),console.log(" Created .vscode/mcp.json"));const b=t(s,".github"),k=t(b,"copilot-instructions.md");o(k)||(u(b,{recursive:!0}),a(k,y(n),"utf-8"),console.log(" Created .github/copilot-instructions.md"));const _=t(s,"AGENTS.md");o(_)||(a(_,w(n),"utf-8"),console.log(" Created AGENTS.md")),console.log(`
249
- Knowledge base initialized! Next steps:`),console.log(" kb reindex Index your codebase"),console.log(" kb search Search indexed content"),console.log(" kb serve Start MCP server for IDE integration")}export{P as initProject};
295
+ 1. **Search KB before proposing anything new** — prior decisions exist
296
+ 2. **Compress context aggressively** \`file_summary\` \`compact\` \`digest\`
297
+ 3. **Use persistent memory** — \`remember\` decisions, \`stash\` temporary data
298
+ 4. **Validate before committing** \`check\` + \`test_run\` + \`blast_radius\`
299
+ 5. **Follow \`_Next:\` hints** in tool responses for guided workflow
300
+ 6. **Use FORGE for complex tasks** \`forge_classify\` \`forge_ground\` → \`evidence_map\`
301
+ `}function g(e,i,s=``,c=!1){r(i,{recursive:!0});for(let r of a(e)){let a=u(e,r),l=u(i,r),d=s?`${s}/${r}`:r;if(o(a).isDirectory())g(a,l,d,c);else if(c||!n(l)){let e=n(l)?`Updated`:`Created`;t(a,l),console.log(` ${e} .github/${d}`)}}}function _(e,t,r,s){if(n(e))for(let c of a(e)){let a=u(e,c),l=r?`${r}/${c}`:c;if(o(a).isDirectory())_(a,u(t,c),l,s);else{let e=u(t,c),r=i(a,`utf-8`);n(e)?r===i(e,`utf-8`)?s.push({status:`current`,relativePath:l,sourcePath:a}):s.push({status:`outdated`,relativePath:l,sourcePath:a,content:r}):s.push({status:`new`,relativePath:l,sourcePath:a,content:r})}}}async function v(t){let a=process.cwd(),o=u(a,`kb.config.json`);if(n(o)&&!t.force){console.log(`kb.config.json already exists. Use --force to overwrite.`);return}s(o,`${JSON.stringify(f,null,2)}\n`,`utf-8`),console.log(` Created kb.config.json`);let _=u(a,`curated`);n(_)||(r(_,{recursive:!0}),console.log(` Created curated/`));let v=u(a,`.gitignore`),y=[{dir:`.kb-data/`,label:`Knowledge base vector store`},{dir:`.brainstorm/`,label:`Brainstorming sessions`},{dir:`curated/`,label:`Curated knowledge entries`}];if(n(v)){let t=i(v,`utf-8`),n=y.filter(e=>!t.includes(e.dir));n.length>0&&(e(v,`\n${n.map(e=>`# ${e.label}\n${e.dir}`).join(`
302
+ `)}\n`,`utf-8`),console.log(` Added ${n.map(e=>e.dir).join(`, `)} to .gitignore`))}else s(v,`${y.map(e=>`# ${e.label}\n${e.dir}`).join(`
303
+ `)}\n`,`utf-8`),console.log(` Created .gitignore with KB entries`);let b=c(a),x=f.serverName,S=u(a,`.vscode`),C=u(S,`mcp.json`);n(S)&&!n(C)&&(s(C,`${JSON.stringify(p(x),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json`));let w=u(a,`.github`),T=u(w,`copilot-instructions.md`);n(T)||(r(w,{recursive:!0}),s(T,m(b,x),`utf-8`),console.log(` Created .github/copilot-instructions.md`));let E=u(a,`AGENTS.md`);n(E)||(s(E,h(b,x),`utf-8`),console.log(` Created AGENTS.md`));let D=u(l(d(import.meta.url)),`..`,`..`,`..`,`..`);for(let e of[`knowledge-base`,`brainstorming`]){let r=u(D,`skills`,e);n(r)&&g(r,u(a,`.github`,`skills`,e),`skills/${e}`,t.force)}let O=u(D,`scaffold`,`copilot`);for(let e of[`agents`,`prompts`]){let r=u(O,e),i=u(a,`.github`,e);n(r)&&g(r,i,``,t.force)}for(let e of[`decisions`,`patterns`,`conventions`,`troubleshooting`]){let t=u(_,e);n(t)||r(t,{recursive:!0})}console.log(` Created curated/{decisions,patterns,conventions,troubleshooting}/`),console.log(`
304
+ Knowledge base initialized! Next steps:`),console.log(` kb reindex Index your codebase`),console.log(` kb search Search indexed content`),console.log(` kb serve Start MCP server for IDE integration`)}async function y(){let e=process.cwd(),t=u(l(d(import.meta.url)),`..`,`..`,`..`,`..`),r=[];for(let i of[`knowledge-base`,`brainstorming`]){let a=u(t,`skills`,i);n(a)&&_(a,u(e,`.github`,`skills`,i),`skills/${i}`,r)}let i=u(t,`scaffold`,`copilot`);for(let t of[`agents`,`prompts`])_(u(i,t),u(e,`.github`,t),t,r);let a={summary:{total:r.length,new:r.filter(e=>e.status===`new`).length,outdated:r.filter(e=>e.status===`outdated`).length,current:r.filter(e=>e.status===`current`).length},files:r};console.log(JSON.stringify(a,null,2))}export{y as guideProject,v as initProject};
305
+ //# sourceMappingURL=init.js.map
@@ -1,3 +1,7 @@
1
- import type { Command } from '../types.js';
2
- export declare const knowledgeCommands: Command[];
1
+ import { Command } from "../types.js";
2
+
3
+ //#region packages/cli/src/commands/knowledge.d.ts
4
+ declare const knowledgeCommands: Command[];
5
+ //#endregion
6
+ export { knowledgeCommands };
3
7
  //# sourceMappingURL=knowledge.d.ts.map
@@ -1 +1,2 @@
1
- import{compact as m}from"../../../tools/dist/index.js";import{ctx as i}from"../context.js";import{extractNumFlag as p,extractStrFlag as c,readStdin as l,splitCsv as d}from"../helpers.js";const f=[{name:"remember",description:"Store curated knowledge",usage:"kb remember <title> --category <cat> [--tags tag1,tag2]",run:async t=>{const o=c(t,"--category","").trim(),a=d(c(t,"--tags","")),e=t.shift()?.trim()??"",r=await l(),n=r.trim().length>0?r:t.join(" ").trim();(!e||!o||!n.trim())&&(console.error("Usage: kb remember <title> --category <cat> [--tags tag1,tag2]"),process.exit(1));const{curated:s}=await i(),g=await s.remember(e,n,o,a);console.log("Stored curated entry"),console.log(` Path: ${g.path}`),console.log(` Category: ${o}`),a.length>0&&console.log(` Tags: ${a.join(", ")}`)}},{name:"forget",description:"Remove a curated entry",usage:"kb forget <path> --reason <reason>",run:async t=>{const o=c(t,"--reason","").trim(),a=t.shift()?.trim()??"";(!a||!o)&&(console.error("Usage: kb forget <path> --reason <reason>"),process.exit(1));const{curated:e}=await i(),r=await e.forget(a,o);console.log(`Removed curated entry: ${r.path}`)}},{name:"read",description:"Read a curated entry",usage:"kb read <path>",run:async t=>{const o=t.shift()?.trim()??"";o||(console.error("Usage: kb read <path>"),process.exit(1));const{curated:a}=await i(),e=await a.read(o);console.log(e.title),console.log("\u2500".repeat(60)),console.log(`Path: ${e.path}`),console.log(`Category: ${e.category}`),console.log(`Version: ${e.version}`),console.log(`Tags: ${e.tags.length>0?e.tags.join(", "):"None"}`),console.log(""),console.log(e.content)}},{name:"list",description:"List curated entries",usage:"kb list [--category <cat>] [--tag <tag>]",run:async t=>{const o=c(t,"--category","").trim()||void 0,a=c(t,"--tag","").trim()||void 0,{curated:e}=await i(),r=await e.list({category:o,tag:a});if(r.length===0){console.log("No curated entries found.");return}console.log(`Curated entries (${r.length})`),console.log("\u2500".repeat(60));for(const n of r){console.log(n.path),console.log(` ${n.title}`),console.log(` Category: ${n.category} | Version: ${n.version}`),console.log(` Tags: ${n.tags.length>0?n.tags.join(", "):"None"}`);const s=n.contentPreview.replace(/\s+/g," ").trim();s&&console.log(` Preview: ${s}`),console.log("")}}},{name:"update",description:"Update a curated entry",usage:"kb update <path> --reason <reason>",run:async t=>{const o=c(t,"--reason","").trim(),a=t.shift()?.trim()??"",e=await l();(!a||!o||!e.trim())&&(console.error("Usage: kb update <path> --reason <reason>"),process.exit(1));const{curated:r}=await i(),n=await r.update(a,e,o);console.log("Updated curated entry"),console.log(` Path: ${n.path}`),console.log(` Version: ${n.version}`)}},{name:"compact",description:"Compress text for context",usage:"kb compact <query> [--max-chars N] [--segmentation paragraph|sentence|line]",run:async t=>{const o=p(t,"--max-chars",3e3),a=c(t,"--segmentation","paragraph"),e=t.join(" ").trim(),r=await l();(!e||!r.trim())&&(console.error("Usage: kb compact <query> [--max-chars N] [--segmentation paragraph|sentence|line]"),process.exit(1));const{embedder:n}=await i(),s=await m(n,{text:r,query:e,maxChars:o,segmentation:a});console.log(`Compressed ${s.originalChars} chars to ${s.compressedChars} chars`),console.log(`Ratio: ${(s.ratio*100).toFixed(1)}% | Segments: ${s.segmentsKept}/${s.segmentsTotal}`),console.log(""),console.log(s.text)}}];export{f as knowledgeCommands};
1
+ import{ctx as e}from"../context.js";import{extractNumFlag as t,extractStrFlag as n,readStdin as r,splitCsv as i}from"../helpers.js";import{compact as a}from"../../../tools/dist/index.js";const o=[{name:`remember`,description:`Store curated knowledge`,usage:`kb remember <title> --category <cat> [--tags tag1,tag2]`,run:async t=>{let a=n(t,`--category`,``).trim(),o=i(n(t,`--tags`,``)),s=t.shift()?.trim()??``,c=await r(),l=c.trim().length>0?c:t.join(` `).trim();(!s||!a||!l.trim())&&(console.error(`Usage: kb remember <title> --category <cat> [--tags tag1,tag2]`),process.exit(1));let{curated:u}=await e(),d=await u.remember(s,l,a,o);console.log(`Stored curated entry`),console.log(` Path: ${d.path}`),console.log(` Category: ${a}`),o.length>0&&console.log(` Tags: ${o.join(`, `)}`)}},{name:`forget`,description:`Remove a curated entry`,usage:`kb forget <path> --reason <reason>`,run:async t=>{let r=n(t,`--reason`,``).trim(),i=t.shift()?.trim()??``;(!i||!r)&&(console.error(`Usage: kb forget <path> --reason <reason>`),process.exit(1));let{curated:a}=await e(),o=await a.forget(i,r);console.log(`Removed curated entry: ${o.path}`)}},{name:`read`,description:`Read a curated entry`,usage:`kb read <path>`,run:async t=>{let n=t.shift()?.trim()??``;n||(console.error(`Usage: kb read <path>`),process.exit(1));let{curated:r}=await e(),i=await r.read(n);console.log(i.title),console.log(`─`.repeat(60)),console.log(`Path: ${i.path}`),console.log(`Category: ${i.category}`),console.log(`Version: ${i.version}`),console.log(`Tags: ${i.tags.length>0?i.tags.join(`, `):`None`}`),console.log(``),console.log(i.content)}},{name:`list`,description:`List curated entries`,usage:`kb list [--category <cat>] [--tag <tag>]`,run:async t=>{let r=n(t,`--category`,``).trim()||void 0,i=n(t,`--tag`,``).trim()||void 0,{curated:a}=await e(),o=await a.list({category:r,tag:i});if(o.length===0){console.log(`No curated entries found.`);return}console.log(`Curated entries (${o.length})`),console.log(`─`.repeat(60));for(let e of o){console.log(e.path),console.log(` ${e.title}`),console.log(` Category: ${e.category} | Version: ${e.version}`),console.log(` Tags: ${e.tags.length>0?e.tags.join(`, `):`None`}`);let t=e.contentPreview.replace(/\s+/g,` `).trim();t&&console.log(` Preview: ${t}`),console.log(``)}}},{name:`update`,description:`Update a curated entry`,usage:`kb update <path> --reason <reason>`,run:async t=>{let i=n(t,`--reason`,``).trim(),a=t.shift()?.trim()??``,o=await r();(!a||!i||!o.trim())&&(console.error(`Usage: kb update <path> --reason <reason>`),process.exit(1));let{curated:s}=await e(),c=await s.update(a,o,i);console.log(`Updated curated entry`),console.log(` Path: ${c.path}`),console.log(` Version: ${c.version}`)}},{name:`compact`,description:`Compress text for context`,usage:`kb compact <query> [--path <file>] [--max-chars N] [--segmentation paragraph|sentence|line]`,run:async i=>{let o=t(i,`--max-chars`,3e3),s=n(i,`--path`,``).trim()||void 0,c=n(i,`--segmentation`,`paragraph`),l=i.join(` `).trim(),u=s?void 0:await r();(!l||!s&&!u?.trim())&&(console.error(`Usage: kb compact <query> --path <file> OR cat file | kb compact <query>`),process.exit(1));let{embedder:d}=await e(),f=await a(d,{text:u,path:s,query:l,maxChars:o,segmentation:c});console.log(`Compressed ${f.originalChars} chars to ${f.compressedChars} chars`),console.log(`Ratio: ${(f.ratio*100).toFixed(1)}% | Segments: ${f.segmentsKept}/${f.segmentsTotal}`),console.log(``),console.log(f.text)}}];export{o as knowledgeCommands};
2
+ //# sourceMappingURL=knowledge.js.map
@@ -1,3 +1,7 @@
1
- import type { Command } from '../types.js';
2
- export declare const searchCommands: Command[];
1
+ import { Command } from "../types.js";
2
+
3
+ //#region packages/cli/src/commands/search.d.ts
4
+ declare const searchCommands: Command[];
5
+ //#endregion
6
+ export { searchCommands };
3
7
  //# sourceMappingURL=search.d.ts.map