@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 +1,2 @@
1
- import{createHash as p}from"node:crypto";function l(s,...e){return`${s}_${p("sha256").update(e.join("|")).digest("hex").slice(0,12)}`}async function I(s,e){const{action:t}=e;switch(t){case"find_nodes":{const r=await s.findNodes({type:e.nodeType,namePattern:e.namePattern,sourcePath:e.sourcePath,limit:e.limit});return{action:t,nodes:r,summary:`Found ${r.length} node(s)${e.nodeType?` of type "${e.nodeType}"`:""}${e.namePattern?` matching "${e.namePattern}"`:""}`}}case"find_edges":{const r=await s.findEdges({type:e.edgeType,fromId:e.fromId,toId:e.toId,limit:e.limit});return{action:t,edges:r,summary:`Found ${r.length} edge(s)${e.edgeType?` of type "${e.edgeType}"`:""}`}}case"neighbors":{if(!e.nodeId)return{action:t,summary:"Error: nodeId is required for neighbors action"};const r=await s.getNeighbors(e.nodeId,{edgeType:e.edgeType,direction:e.direction,limit:e.limit});return{action:t,nodes:r.nodes,edges:r.edges,summary:`Found ${r.nodes.length} neighbor(s) and ${r.edges.length} edge(s) for node "${e.nodeId}"`}}case"traverse":{if(!e.nodeId)return{action:t,summary:"Error: nodeId is required for traverse action"};const r=await s.traverse(e.nodeId,{edgeType:e.edgeType,maxDepth:e.maxDepth,direction:e.direction,limit:e.limit});return{action:t,nodes:r.nodes,edges:r.edges,summary:`Traversed ${r.nodes.length} node(s) and ${r.edges.length} edge(s) from "${e.nodeId}" (depth=${e.maxDepth??2})`}}case"stats":{const r=await s.getStats();return{action:t,stats:r,summary:`Graph: ${r.nodeCount} nodes, ${r.edgeCount} edges. Types: ${Object.entries(r.nodeTypes).map(([a,n])=>`${a}(${n})`).join(", ")||"none"}`}}case"add":{let r=0,a=0;if(e.nodes&&e.nodes.length>0){const n=e.nodes.map(d=>({id:d.id??l("node",d.type,d.name),type:d.type,name:d.name,properties:d.properties??{},sourceRecordId:d.sourceRecordId,sourcePath:d.sourcePath,createdAt:new Date().toISOString()}));await s.upsertNodes(n),r=n.length}if(e.edges&&e.edges.length>0){const n=e.edges.map(d=>({id:d.id??l("edge",d.fromId,d.toId,d.type),fromId:d.fromId,toId:d.toId,type:d.type,weight:d.weight,properties:d.properties}));await s.upsertEdges(n),a=n.length}return{action:t,nodesAdded:r,edgesAdded:a,summary:`Added ${r} node(s) and ${a} edge(s) to the graph`}}case"delete":{if(e.nodeId)return await s.deleteNode(e.nodeId),{action:t,deleted:1,summary:`Deleted node "${e.nodeId}" and its edges`};if(e.sourcePath){const r=await s.deleteBySourcePath(e.sourcePath);return{action:t,deleted:r,summary:`Deleted ${r} node(s) from source "${e.sourcePath}"`}}return{action:t,summary:"Error: nodeId or sourcePath required for delete action"}}case"clear":{const r=await s.getStats();return await s.clear(),{action:t,deleted:r.nodeCount,summary:`Cleared graph: removed ${r.nodeCount} node(s) and ${r.edgeCount} edge(s)`}}default:return{action:t,summary:`Unknown action: ${t}`}}}async function $(s,e,t){const r=t?.hops??1,a=t?.maxPerHit??5,n=[];for(const d of e)try{const y=await s.findNodes({sourcePath:d.sourcePath}),u=[],c=[],i=new Set,m=new Set;for(const g of y.slice(0,a))if(!i.has(g.id)&&(i.add(g.id),u.push(g),r>0)){const h=await s.traverse(g.id,{maxDepth:r,edgeType:t?.edgeType,limit:a});for(const o of h.nodes)i.has(o.id)||(i.add(o.id),u.push(o));for(const o of h.edges)m.has(o.id)||(m.add(o.id),c.push(o))}n.push({recordId:d.recordId,score:d.score,sourcePath:d.sourcePath,graphContext:{nodes:u,edges:c}})}catch{n.push({recordId:d.recordId,score:d.score,sourcePath:d.sourcePath,graphContext:{nodes:[],edges:[]}})}return n}export{$ as graphAugmentSearch,I as graphQuery};
1
+ import{createHash as e}from"node:crypto";function t(t,...n){return`${t}_${e(`sha256`).update(n.join(`|`)).digest(`hex`).slice(0,12)}`}async function n(e,n){let{action:r}=n;switch(r){case`find_nodes`:{let t=await e.findNodes({type:n.nodeType,namePattern:n.namePattern,sourcePath:n.sourcePath,limit:n.limit});return{action:r,nodes:t,summary:`Found ${t.length} node(s)${n.nodeType?` of type "${n.nodeType}"`:``}${n.namePattern?` matching "${n.namePattern}"`:``}`}}case`find_edges`:{let t=await e.findEdges({type:n.edgeType,fromId:n.fromId,toId:n.toId,limit:n.limit});return{action:r,edges:t,summary:`Found ${t.length} edge(s)${n.edgeType?` of type "${n.edgeType}"`:``}`}}case`neighbors`:{if(!n.nodeId)return{action:r,summary:`Error: nodeId is required for neighbors action`};let t=await e.getNeighbors(n.nodeId,{edgeType:n.edgeType,direction:n.direction,limit:n.limit});return{action:r,nodes:t.nodes,edges:t.edges,summary:`Found ${t.nodes.length} neighbor(s) and ${t.edges.length} edge(s) for node "${n.nodeId}"`}}case`traverse`:{if(!n.nodeId)return{action:r,summary:`Error: nodeId is required for traverse action`};let t=await e.traverse(n.nodeId,{edgeType:n.edgeType,maxDepth:n.maxDepth,direction:n.direction,limit:n.limit});return{action:r,nodes:t.nodes,edges:t.edges,summary:`Traversed ${t.nodes.length} node(s) and ${t.edges.length} edge(s) from "${n.nodeId}" (depth=${n.maxDepth??2})`}}case`stats`:{let t=await e.getStats();return{action:r,stats:t,summary:`Graph: ${t.nodeCount} nodes, ${t.edgeCount} edges. Types: ${Object.entries(t.nodeTypes).map(([e,t])=>`${e}(${t})`).join(`, `)||`none`}`}}case`add`:{let i=0,a=0;if(n.nodes&&n.nodes.length>0){let r=n.nodes.map(e=>({id:e.id??t(`node`,e.type,e.name),type:e.type,name:e.name,properties:e.properties??{},sourceRecordId:e.sourceRecordId,sourcePath:e.sourcePath,createdAt:new Date().toISOString()}));await e.upsertNodes(r),i=r.length}if(n.edges&&n.edges.length>0){let r=n.edges.map(e=>({id:e.id??t(`edge`,e.fromId,e.toId,e.type),fromId:e.fromId,toId:e.toId,type:e.type,weight:e.weight,properties:e.properties}));await e.upsertEdges(r),a=r.length}return{action:r,nodesAdded:i,edgesAdded:a,summary:`Added ${i} node(s) and ${a} edge(s) to the graph`}}case`delete`:if(n.nodeId)return await e.deleteNode(n.nodeId),{action:r,deleted:1,summary:`Deleted node "${n.nodeId}" and its edges`};if(n.sourcePath){let t=await e.deleteBySourcePath(n.sourcePath);return{action:r,deleted:t,summary:`Deleted ${t} node(s) from source "${n.sourcePath}"`}}return{action:r,summary:`Error: nodeId or sourcePath required for delete action`};case`clear`:{let t=await e.getStats();return await e.clear(),{action:r,deleted:t.nodeCount,summary:`Cleared graph: removed ${t.nodeCount} node(s) and ${t.edgeCount} edge(s)`}}default:return{action:r,summary:`Unknown action: ${r}`}}}async function r(e,t,n){let r=n?.hops??1,i=n?.maxPerHit??5,a=[];for(let o of t)try{let t=await e.findNodes({sourcePath:o.sourcePath}),s=[],c=[],l=new Set,u=new Set;for(let a of t.slice(0,i))if(!l.has(a.id)&&(l.add(a.id),s.push(a),r>0)){let t=await e.traverse(a.id,{maxDepth:r,edgeType:n?.edgeType,limit:i});for(let e of t.nodes)l.has(e.id)||(l.add(e.id),s.push(e));for(let e of t.edges)u.has(e.id)||(u.add(e.id),c.push(e))}a.push({recordId:o.recordId,score:o.score,sourcePath:o.sourcePath,graphContext:{nodes:s,edges:c}})}catch{a.push({recordId:o.recordId,score:o.score,sourcePath:o.sourcePath,graphContext:{nodes:[],edges:[]}})}return a}export{r as graphAugmentSearch,n as graphQuery};
2
+ //# sourceMappingURL=graph-query.js.map
@@ -0,0 +1,26 @@
1
+ //#region packages/tools/src/guide.d.ts
2
+ /**
3
+ * Tool discovery — recommends MCP tools and workflows for a given goal.
4
+ *
5
+ * Uses keyword matching against predefined workflow templates.
6
+ * No embeddings required — pure string matching for instant results.
7
+ */
8
+ interface GuideRecommendation {
9
+ tool: string;
10
+ reason: string;
11
+ order: number;
12
+ suggestedArgs?: Record<string, unknown>;
13
+ }
14
+ interface GuideResult {
15
+ workflow: string;
16
+ description: string;
17
+ tools: GuideRecommendation[];
18
+ alternativeWorkflows: string[];
19
+ }
20
+ /**
21
+ * Match a goal description to the best workflow and return tool recommendations.
22
+ */
23
+ declare function guide(goal: string, maxRecommendations?: number): GuideResult;
24
+ //#endregion
25
+ export { GuideRecommendation, GuideResult, guide };
26
+ //# sourceMappingURL=guide.d.ts.map
@@ -0,0 +1,2 @@
1
+ const e=[{name:`onboard`,description:`First-time codebase exploration and understanding`,keywords:[`onboard`,`new project`,`understand`,`explore`,`first time`,`getting started`,`learn`,`overview`],tools:[{tool:`status`,reason:`Check index health and record count`,order:1},{tool:`onboard`,reason:`Run all analysis tools in one command`,order:2,suggestedArgs:{path:`.`}},{tool:`search`,reason:`Find specific topics of interest`,order:3},{tool:`graph`,reason:`Explore module relationships`,order:4,suggestedArgs:{action:`stats`}}]},{name:`audit`,description:`Assess project health, quality, and structure`,keywords:[`audit`,`health`,`quality`,`assess`,`review project`,`check quality`,`code quality`,`tech debt`],tools:[{tool:`status`,reason:`Check index freshness`,order:1},{tool:`audit`,reason:`Unified audit report with score and recommendations`,order:2,suggestedArgs:{detail:`summary`}},{tool:`check`,reason:`Typecheck + lint validation`,order:3},{tool:`health`,reason:`Detailed health checks on package.json, tsconfig, etc.`,order:4}]},{name:`bugfix`,description:`Diagnose and fix a bug or failing test`,keywords:[`bug`,`fix`,`debug`,`error`,`failing`,`broken`,`crash`,`wrong`,`issue`,`problem`,`not working`],tools:[{tool:`parse_output`,reason:`Parse error output from build tools (tsc, vitest, biome)`,order:1},{tool:`symbol`,reason:`Find definition and all references of the failing symbol`,order:2},{tool:`trace`,reason:`Trace call chain backward from the failure point`,order:3,suggestedArgs:{direction:`backward`}},{tool:`search`,reason:`Search for related patterns or similar fixes`,order:4},{tool:`test_run`,reason:`Re-run tests after fix`,order:5}]},{name:`implement`,description:`Add a new feature or implement a change`,keywords:[`implement`,`add feature`,`new feature`,`build`,`create`,`add`,`develop`,`write code`],tools:[{tool:`scope_map`,reason:`Generate a reading plan for affected files`,order:1},{tool:`search`,reason:`Find related patterns and prior art`,order:2},{tool:`find`,reason:`Find usage examples of similar patterns`,order:3,suggestedArgs:{mode:`examples`}},{tool:`check`,reason:`Validate after implementation`,order:4},{tool:`test_run`,reason:`Run tests to verify`,order:5},{tool:`blast_radius`,reason:`Check impact of changes`,order:6}]},{name:`refactor`,description:`Restructure or clean up existing code`,keywords:[`refactor`,`restructure`,`clean up`,`reorganize`,`rename`,`move`,`extract`,`DRY`,`dead code`],tools:[{tool:`dead_symbols`,reason:`Find unused exports to remove`,order:1},{tool:`symbol`,reason:`Find all references before renaming`,order:2},{tool:`blast_radius`,reason:`Assess impact before making changes`,order:3},{tool:`rename`,reason:`Safe cross-file rename`,order:4},{tool:`check`,reason:`Validate after refactoring`,order:5},{tool:`test_run`,reason:`Ensure no regressions`,order:6}]},{name:`search`,description:`Find specific code, patterns, or information`,keywords:[`find`,`search`,`where`,`locate`,`look for`,`grep`,`which file`,`how does`],tools:[{tool:`search`,reason:`Hybrid semantic + keyword search`,order:1},{tool:`find`,reason:`Federated search with glob and regex`,order:2},{tool:`symbol`,reason:`Resolve a specific symbol definition and references`,order:3},{tool:`graph`,reason:`Explore entity relationships`,order:4,suggestedArgs:{action:`neighbors`}}]},{name:`context`,description:`Compress or manage context for efficient LLM interaction`,keywords:[`context`,`compress`,`summarize`,`too long`,`token`,`budget`,`reduce`,`compact`],tools:[{tool:`file_summary`,reason:`Quick structural overview without reading full file`,order:1},{tool:`compact`,reason:`Compress file to relevant sections`,order:2,suggestedArgs:{segmentation:`paragraph`}},{tool:`digest`,reason:`Compress multiple sources into budgeted summary`,order:3},{tool:`stratum_card`,reason:`Generate reusable context cards`,order:4}]},{name:`memory`,description:`Manage persistent knowledge across sessions`,keywords:[`memory`,`remember`,`persist`,`save`,`recall`,`decision`,`convention`,`session`,`checkpoint`],tools:[{tool:`list`,reason:`See all stored knowledge entries`,order:1},{tool:`search`,reason:`Search curated knowledge`,order:2,suggestedArgs:{origin:`curated`}},{tool:`remember`,reason:`Store a new decision or pattern`,order:3},{tool:`checkpoint`,reason:`Save/restore session progress`,order:4},{tool:`stash`,reason:`Temporary key-value storage within session`,order:5}]},{name:`validate`,description:`Run checks, tests, and validation`,keywords:[`validate`,`check`,`test`,`lint`,`typecheck`,`verify`,`CI`,`pass`,`run tests`],tools:[{tool:`check`,reason:`Typecheck + lint in one call`,order:1,suggestedArgs:{detail:`errors`}},{tool:`test_run`,reason:`Run tests with structured output`,order:2},{tool:`health`,reason:`Project health assessment`,order:3}]},{name:`analyze`,description:`Deep analysis of codebase structure, dependencies, or patterns`,keywords:[`analyze`,`dependency`,`structure`,`pattern`,`architecture`,`diagram`,`entry point`,`import`],tools:[{tool:`analyze_structure`,reason:`Project structure overview`,order:1},{tool:`analyze_dependencies`,reason:`Dependency graph and analysis`,order:2},{tool:`analyze_patterns`,reason:`Detect code patterns and conventions`,order:3},{tool:`analyze_entry_points`,reason:`Find handlers, exports, and entry points`,order:4},{tool:`analyze_diagram`,reason:`Generate Mermaid diagrams`,order:5}]}];function t(t,n=5){let r=t.toLowerCase(),i=e.map(e=>{let t=0;for(let n of e.keywords)r.includes(n)&&(t+=n.includes(` `)?2:1);return{workflow:e,score:t}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score),a=e.find(e=>e.name===`search`)??e[0],o=i[0]?.workflow??a,s=i.slice(1,4).map(e=>e.workflow.name).filter(e=>e!==o.name);return{workflow:o.name,description:o.description,tools:o.tools.slice(0,n),alternativeWorkflows:s}}export{t as guide};
2
+ //# sourceMappingURL=guide.js.map
@@ -1,14 +1,17 @@
1
- export interface HealthCheck {
2
- name: string;
3
- status: 'pass' | 'warn' | 'fail';
4
- message: string;
1
+ //#region packages/tools/src/health.d.ts
2
+ interface HealthCheck {
3
+ name: string;
4
+ status: 'pass' | 'warn' | 'fail';
5
+ message: string;
5
6
  }
6
- export interface HealthResult {
7
- path: string;
8
- checks: HealthCheck[];
9
- score: number;
10
- summary: string;
7
+ interface HealthResult {
8
+ path: string;
9
+ checks: HealthCheck[];
10
+ score: number;
11
+ summary: string;
11
12
  }
12
13
  /** Run project health checks on a directory. */
13
- export declare function health(rootPath?: string): HealthResult;
14
+ declare function health(rootPath?: string): HealthResult;
15
+ //#endregion
16
+ export { HealthCheck, HealthResult, health };
14
17
  //# sourceMappingURL=health.d.ts.map
@@ -1 +1,3 @@
1
- import{existsSync as n,readFileSync as p}from"node:fs";import{join as o,resolve as w}from"node:path";function N(d){const a=w(d??process.cwd()),s=[],g=o(a,"package.json");if(n(g)){s.push({name:"package.json",status:"pass",message:"Found"});try{const e=JSON.parse(p(g,"utf-8"));e.name?s.push({name:"package.name",status:"pass",message:e.name}):s.push({name:"package.name",status:"warn",message:"Missing package name"});const i=e.scripts??{};for(const t of["build","test","lint"])i[t]?s.push({name:`script:${t}`,status:"pass",message:i[t]}):s.push({name:`script:${t}`,status:"warn",message:`No "${t}" script defined`});e.type==="module"?s.push({name:"esm",status:"pass",message:'ESM ("type": "module")'}):e.type==="commonjs"?s.push({name:"esm",status:"pass",message:'CJS ("type": "commonjs")'}):s.push({name:"esm",status:"warn",message:'No "type" field \u2014 defaults to CJS'}),e.engines?.node?s.push({name:"engines.node",status:"pass",message:e.engines.node}):s.push({name:"engines.node",status:"warn",message:"No Node.js engine constraint"})}catch{s.push({name:"package.json",status:"fail",message:"Failed to parse package.json"})}}else s.push({name:"package.json",status:"fail",message:"Missing \u2014 not a Node.js project"});const f=o(a,"tsconfig.json");n(f)?s.push({name:"tsconfig.json",status:"pass",message:"Found"}):s.push({name:"tsconfig.json",status:"warn",message:"Missing"});const l=o(a,".gitignore");if(n(l)){const e=p(l,"utf-8"),i=e.includes("node_modules"),t=e.includes("dist");i&&t?s.push({name:".gitignore",status:"pass",message:"Includes node_modules and dist"}):s.push({name:".gitignore",status:"warn",message:`Missing: ${i?"":"node_modules "}${t?"":"dist"}`.trim()})}else s.push({name:".gitignore",status:"warn",message:"Missing"});const r=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock"].find(e=>n(o(a,e)));r?s.push({name:"lockfile",status:"pass",message:r}):s.push({name:"lockfile",status:"warn",message:"No lock file found"});const h=o(a,"README.md");if(n(h)){const e=p(h,"utf-8").length;s.push({name:"README.md",status:e>100?"pass":"warn",message:e>100?`Found (${e} chars)`:"Found but very short"})}else s.push({name:"README.md",status:"warn",message:"Missing"});n(o(a,"LICENSE"))||n(o(a,"LICENSE.md"))?s.push({name:"LICENSE",status:"pass",message:"Found"}):s.push({name:"LICENSE",status:"warn",message:"Missing"});const m=s.length,u=s.filter(e=>e.status==="pass").length,c=s.filter(e=>e.status==="fail").length,k=Math.round(u/m*100),j=c>0?`${c} critical issue(s), ${m-u-c} warning(s)`:m-u>0?`${m-u} warning(s)`:"All checks passed";return{path:a,checks:s,score:k,summary:j}}export{N as health};
1
+ import{extname as e,join as t,relative as n,resolve as r}from"node:path";import{existsSync as i,readFileSync as a,readdirSync as o,statSync as s}from"node:fs";function c(e){let n=r(e??process.cwd()),o=[],c=t(n,`package.json`);if(i(c)){o.push({name:`package.json`,status:`pass`,message:`Found`});try{let e=JSON.parse(a(c,`utf-8`));e.name?o.push({name:`package.name`,status:`pass`,message:e.name}):o.push({name:`package.name`,status:`warn`,message:`Missing package name`});let t=e.scripts??{};for(let e of[`build`,`test`,`lint`])t[e]?o.push({name:`script:${e}`,status:`pass`,message:t[e]}):o.push({name:`script:${e}`,status:`warn`,message:`No "${e}" script defined`});e.type===`module`?o.push({name:`esm`,status:`pass`,message:`ESM ("type": "module")`}):e.type===`commonjs`?o.push({name:`esm`,status:`pass`,message:`CJS ("type": "commonjs")`}):o.push({name:`esm`,status:`warn`,message:`No "type" field defaults to CJS`}),e.engines?.node?o.push({name:`engines.node`,status:`pass`,message:e.engines.node}):o.push({name:`engines.node`,status:`warn`,message:`No Node.js engine constraint`})}catch{o.push({name:`package.json`,status:`fail`,message:`Failed to parse package.json`})}}else o.push({name:`package.json`,status:`fail`,message:`Missing not a Node.js project`});let f=t(n,`tsconfig.json`);i(f)?o.push({name:`tsconfig.json`,status:`pass`,message:`Found`}):o.push({name:`tsconfig.json`,status:`warn`,message:`Missing`});let p=t(n,`.gitignore`);if(i(p)){let e=a(p,`utf-8`),t=e.includes(`node_modules`),n=e.includes(`dist`);t&&n?o.push({name:`.gitignore`,status:`pass`,message:`Includes node_modules and dist`}):o.push({name:`.gitignore`,status:`warn`,message:`Missing: ${t?``:`node_modules `}${n?``:`dist`}`.trim()})}else o.push({name:`.gitignore`,status:`warn`,message:`Missing`});let h=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`].find(e=>i(t(n,e)));h?o.push({name:`lockfile`,status:`pass`,message:h}):o.push({name:`lockfile`,status:`warn`,message:`No lock file found`});let g=t(n,`README.md`);if(i(g)){let e=a(g,`utf-8`).length;o.push({name:`README.md`,status:e>100?`pass`:`warn`,message:e>100?`Found (${e} chars)`:`Found but very short`})}else o.push({name:`README.md`,status:`warn`,message:`Missing`});if(i(t(n,`LICENSE`))||i(t(n,`LICENSE.md`))?o.push({name:`LICENSE`,status:`pass`,message:`Found`}):o.push({name:`LICENSE`,status:`warn`,message:`Missing`}),i(f))try{let e=a(f,`utf-8`).replace(/\/\/.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``);JSON.parse(e).compilerOptions?.strict===!0?o.push({name:`typescript.strict`,status:`pass`,message:`strict: true`}):o.push({name:`typescript.strict`,status:`warn`,message:`strict mode not enabled in tsconfig.json`})}catch{}if(i(c))try{let e=JSON.parse(a(c,`utf-8`));e.exports?o.push({name:`package.exports`,status:`pass`,message:`Has exports field`}):e.workspaces||i(t(n,`pnpm-workspace.yaml`))||o.push({name:`package.exports`,status:`warn`,message:`Missing — consider adding exports field for explicit public API`});let r=l(n,e);r.length>0&&u(n,r,o)}catch{}let _=t(n,`dist`),v=t(n,`src`);if(i(_)&&i(v))try{let e=s(_).mtimeMs;d(v)>e?o.push({name:`build.freshness`,status:`warn`,message:`Source files are newer than dist/ — rebuild may be needed`}):o.push({name:`build.freshness`,status:`pass`,message:`Build output is fresh`})}catch{}if(i(v)){let e=m(v);if(e.length===0)o.push({name:`circular_deps`,status:`pass`,message:`No circular imports detected`});else{let t=e.slice(0,3).map(e=>e.join(` → `));o.push({name:`circular_deps`,status:`warn`,message:`${e.length} circular import(s): ${t.join(`; `)}${e.length>3?` (+${e.length-3} more)`:``}`})}}let y=o.length,b=o.filter(e=>e.status===`pass`).length,x=o.filter(e=>e.status===`fail`).length;return{path:n,checks:o,score:y>0?Math.round(b/y*100):0,summary:x>0?`${x} critical issue(s), ${y-b-x} warning(s)`:y-b>0?`${y-b} warning(s)`:`All checks passed`}}function l(e,n){let r=[];Array.isArray(n.workspaces)?r.push(...n.workspaces):n.workspaces&&typeof n.workspaces==`object`&&Array.isArray(n.workspaces.packages)&&r.push(...n.workspaces.packages);let s=t(e,`pnpm-workspace.yaml`);if(i(s)){let e=a(s,`utf-8`);for(let t of e.split(`
2
+ `)){let e=t.match(/^\s*-\s+['"]?([^'"#\s]+)['"]?\s*$/);e&&r.push(e[1])}}let c=[];for(let n of r)if(n.endsWith(`/*`)||n.endsWith(`/**`)){let r=t(e,n.replace(/\/\*+$/,``));if(i(r))try{for(let e of o(r,{withFileTypes:!0}))e.isDirectory()&&i(t(r,e.name,`package.json`))&&c.push(t(r,e.name))}catch{}}else{let r=t(e,n);i(t(r,`package.json`))&&c.push(r)}return c}function u(e,n,r){let i=0,o=0,s=new Map;for(let e of n)try{let n=JSON.parse(a(t(e,`package.json`),`utf-8`));n.scripts?.test||i++,!n.exports&&!n.main&&o++;let r={...n.dependencies,...n.devDependencies};for(let e of Object.values(r))if(typeof e==`string`&&e.startsWith(`workspace:`)){let t=e.startsWith(`workspace:*`)?`workspace:*`:e.startsWith(`workspace:^`)?`workspace:^`:`workspace:~`;s.set(t,(s.get(t)??0)+1)}}catch{}if(i>0?r.push({name:`workspace.test-scripts`,status:`warn`,message:`${i}/${n.length} workspace packages missing test script`}):r.push({name:`workspace.test-scripts`,status:`pass`,message:`All ${n.length} workspace packages have test scripts`}),o>0?r.push({name:`workspace.exports`,status:`warn`,message:`${o}/${n.length} packages missing exports field`}):n.length>0&&r.push({name:`workspace.exports`,status:`pass`,message:`All ${n.length} packages have exports or main field`}),s.size>1){let e=[...s.entries()].map(([e,t])=>`${e} (${t})`).join(`, `);r.push({name:`workspace.protocol`,status:`warn`,message:`Mixed workspace protocols: ${e} — consider standardizing`})}else if(s.size===1){let[e]=s.keys();r.push({name:`workspace.protocol`,status:`pass`,message:`Consistent workspace protocol: ${e}`})}}function d(e){let n=0;try{for(let r of o(e,{withFileTypes:!0})){if(r.name.startsWith(`.`)||r.name===`node_modules`)continue;let i=t(e,r.name);n=r.isDirectory()?Math.max(n,d(i)):Math.max(n,s(i).mtimeMs)}}catch{}return n}const f=/(?:import|export)\s+.*?from\s+['"](\.[^'"]+)['"]/g,p=new Set([`.ts`,`.tsx`,`.mts`]);function m(e){let t=new Map;h(e,e,t);let n=[],r=new Set,i=new Set;function a(e,o){if(i.has(e)){let t=o.indexOf(e);t>=0&&n.push(o.slice(t).concat(e));return}if(!r.has(e)){r.add(e),i.add(e),o.push(e);for(let n of t.get(e)??[])a(n,o);o.pop(),i.delete(e)}}for(let e of t.keys())a(e,[]);return n}function h(r,i,c){let l;try{l=o(r)}catch{return}for(let o of l){if(o.startsWith(`.`)||o===`node_modules`||o===`__tests__`)continue;let l=t(r,o);try{if(s(l).isDirectory())h(l,i,c);else if(p.has(e(o))){let e=n(i,l).replace(/\\/g,`/`),t=a(l,`utf-8`),o=[];for(let e of t.matchAll(f)){let t=e[1],n=g(r,t,i);n&&o.push(n)}c.set(e,o)}}catch{}}}function g(e,t,i){let a=r(e,t);for(let e of[`.ts`,`.tsx`,`.mts`,`.js`,`.mjs`,``])return n(i,e?a.replace(/\.[^.]+$/,``)+e:a).replace(/\\/g,`/`).replace(/\.js$/,`.ts`).replace(/\.mjs$/,`.mts`);return null}export{c as health};
3
+ //# sourceMappingURL=health.js.map
@@ -1,23 +1,26 @@
1
+ //#region packages/tools/src/http-request.d.ts
1
2
  /**
2
3
  * kb_http — Make HTTP requests for API testing and debugging.
3
4
  */
4
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
5
- export interface HttpRequestOptions {
6
- url: string;
7
- method?: HttpMethod;
8
- headers?: Record<string, string>;
9
- body?: string;
10
- timeout?: number;
5
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
6
+ interface HttpRequestOptions {
7
+ url: string;
8
+ method?: HttpMethod;
9
+ headers?: Record<string, string>;
10
+ body?: string;
11
+ timeout?: number;
11
12
  }
12
- export interface HttpRequestResult {
13
- status: number;
14
- statusText: string;
15
- headers: Record<string, string>;
16
- body: string;
17
- durationMs: number;
18
- contentType: string;
19
- sizeBytes: number;
20
- truncated: boolean;
13
+ interface HttpRequestResult {
14
+ status: number;
15
+ statusText: string;
16
+ headers: Record<string, string>;
17
+ body: string;
18
+ durationMs: number;
19
+ contentType: string;
20
+ sizeBytes: number;
21
+ truncated: boolean;
21
22
  }
22
- export declare function httpRequest(options: HttpRequestOptions): Promise<HttpRequestResult>;
23
+ declare function httpRequest(options: HttpRequestOptions): Promise<HttpRequestResult>;
24
+ //#endregion
25
+ export { HttpMethod, HttpRequestOptions, HttpRequestResult, httpRequest };
23
26
  //# sourceMappingURL=http-request.d.ts.map
@@ -1 +1,2 @@
1
- import{headTailTruncate as E}from"./truncation.js";const u=5e4,R=15e3;async function H(d){const{url:n,method:s="GET",headers:l={},body:h,timeout:T=R}=d,o=new URL(n);if(o.protocol!=="http:"&&o.protocol!=="https:")throw new Error(`Unsupported protocol: ${o.protocol} \u2014 only http/https allowed`);const a=new AbortController,g=setTimeout(()=>a.abort(),T),y=Date.now();let t;try{t=await fetch(n,{method:s,headers:{"User-Agent":"kb-http/1.0",...l},body:s!=="GET"&&s!=="HEAD"?h:void 0,signal:a.signal,redirect:"follow"})}finally{clearTimeout(g)}const f=Date.now()-y,r=await t.text(),i=t.headers.get("content-type")??"";let e=r;if(i.includes("json"))try{e=JSON.stringify(JSON.parse(r),null,2)}catch{}let c=!1;e.length>u&&(e=E(e,u),c=!0);const p={};return t.headers.forEach((m,b)=>{p[b]=m}),{status:t.status,statusText:t.statusText,headers:p,body:e,durationMs:f,contentType:i,sizeBytes:r.length,truncated:c}}export{H as httpRequest};
1
+ import{headTailTruncate as e}from"./truncation.js";const t=5e4;async function n(n){let{url:r,method:i=`GET`,headers:a={},body:o,timeout:s=15e3}=n,c=new URL(r);if(c.protocol!==`http:`&&c.protocol!==`https:`)throw Error(`Unsupported protocol: ${c.protocol} only http/https allowed`);let l=c.hostname;if(l===`169.254.169.254`||l===`metadata.google.internal`||l.startsWith(`fd`)||/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(l)||l===`0.0.0.0`||l===`[::]`)throw Error(`Blocked request to private/metadata address: ${l}`);let u=new AbortController,d=setTimeout(()=>u.abort(),s),f=Date.now(),p;try{p=await fetch(r,{method:i,headers:{"User-Agent":`kb-http/1.0`,...a},body:i!==`GET`&&i!==`HEAD`?o:void 0,signal:u.signal,redirect:`follow`})}finally{clearTimeout(d)}let m=Date.now()-f,h=await p.text(),g=p.headers.get(`content-type`)??``,_=h;if(g.includes(`json`))try{_=JSON.stringify(JSON.parse(h),null,2)}catch{}let v=!1;_.length>t&&(_=e(_,t),v=!0);let y={};return p.headers.forEach((e,t)=>{y[t]=e}),{status:p.status,statusText:p.statusText,headers:y,body:_,durationMs:m,contentType:g,sizeBytes:h.length,truncated:v}}export{n as httpRequest};
2
+ //# sourceMappingURL=http-request.js.map
@@ -1,49 +1,54 @@
1
- export { type BatchOperation, type BatchOptions, type BatchResult, batch, } from './batch.js';
2
- export { type ChangelogEntry, type ChangelogFormat, type ChangelogOptions, type ChangelogResult, changelog, formatChangelog, } from './changelog.js';
3
- export { type CheckOptions, type CheckResult, check } from './check.js';
4
- export { type Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave, } from './checkpoint.js';
5
- export { type CodemodChange, type CodemodOptions, type CodemodResult, type CodemodRule, codemod, } from './codemod.js';
6
- export { type CompactOptions, type CompactResult, compact } from './compact.js';
7
- export { dataTransform, type TransformOptions, type TransformResult, } from './data-transform.js';
8
- export { type DeadSymbol, type DeadSymbolOptions, type DeadSymbolResult, findDeadSymbols, } from './dead-symbols.js';
9
- export { type DelegateOptions, type DelegateResult, delegate, delegateListModels, } from './delegate.js';
10
- export { type DiffChange, type DiffFile, type DiffHunk, type DiffParseOptions, diffParse, } from './diff-parse.js';
11
- export { type DigestFieldEntry, type DigestOptions, type DigestResult, type DigestSource, digest, } from './digest.js';
12
- export { type EncodeOperation, type EncodeOptions, type EncodeResult, encode, } from './encode.js';
13
- export { type EnvInfoOptions, type EnvInfoResult, envInfo, } from './env-info.js';
14
- export { type EvalOptions, type EvalResult, evaluate } from './eval.js';
15
- export { type EvidenceEntry, type EvidenceMapAction, type EvidenceMapResult, type EvidenceMapState, type EvidenceStatus, evidenceMap, type ForgeTier, type GateDecision, type GateResult, type UnknownType, } from './evidence-map.js';
16
- export { type FileSummaryOptions, type FileSummaryResult, fileSummary, } from './file-summary.js';
17
- export { type FindOptions, type FindResult, type FindResults, find } from './find.js';
18
- export { type Example, type FindExamplesOptions, type FindExamplesResult, findExamples, } from './find-examples.js';
19
- export { type ClassifyTrigger, type ForgeClassifyCeremony, type ForgeClassifyOptions, type ForgeClassifyResult, forgeClassify, type TypedUnknownSeed, } from './forge-classify.js';
20
- export { type ConstraintRef, type ForgeGroundOptions, type ForgeGroundResult, forgeGround, } from './forge-ground.js';
21
- export { type GitContextOptions, type GitContextResult, gitContext, } from './git-context.js';
22
- export { type GraphAugmentedResult, type GraphAugmentOptions, type GraphQueryOptions, type GraphQueryResult, graphAugmentSearch, graphQuery, } from './graph-query.js';
23
- export { type HealthCheck, type HealthResult, health, } from './health.js';
24
- export { type HttpMethod, type HttpRequestOptions, type HttpRequestResult, httpRequest, } from './http-request.js';
25
- export { type LaneDiffEntry, type LaneDiffResult, type LaneMergeResult, type LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus, } from './lane.js';
26
- export { analyzeFile, type FileMetrics, type MeasureOptions, type MeasureResult, measure, } from './measure.js';
27
- export { type OnboardMode, type OnboardOptions, type OnboardResult, type OnboardStepResult, onboard, } from './onboard.js';
28
- export { type ParsedError, type ParsedGitStatus, type ParsedOutput, type ParsedTestResult, type ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest, } from './parse-output.js';
29
- export { type ManagedProcess, processList, processLogs, processStart, processStatus, processStop, } from './process-manager.js';
30
- export { type QueueItem, type QueueState, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush, } from './queue.js';
31
- export { type RegexTestOptions, type RegexTestResult, regexTest, } from './regex-test.js';
32
- export { type RenameChange, type RenameOptions, type RenameResult, rename, } from './rename.js';
33
- export { type ReplayEntry, type ReplayOptions, replayAppend, replayCapture, replayClear, replayList, replayTrim, } from './replay.js';
34
- export { type SchemaValidateOptions, type SchemaValidateResult, schemaValidate, type ValidationError, } from './schema-validate.js';
35
- export { type ScopeMapEntry, type ScopeMapOptions, type ScopeMapResult, scopeMap, } from './scope-map.js';
36
- export { type Snippet, type SnippetAction, type SnippetOptions, type SnippetResult, snippet, } from './snippet.js';
37
- export { type StashEntry, stashClear, stashDelete, stashGet, stashList, stashSet, } from './stash.js';
38
- export { type StratumCard, type StratumCardOptions, type StratumCardResult, stratumCard, } from './stratum-card.js';
39
- export { type SymbolInfo, type SymbolOptions, symbol } from './symbol.js';
40
- export { classifyExitCode, type TestRunOptions, type TestRunResult, testRun } from './test-run.js';
41
- export { cosineSimilarity, estimateTokens, segment, } from './text-utils.js';
42
- export { type TimeOptions, type TimeResult, timeUtils, } from './time-utils.js';
43
- export { type TraceNode, type TraceOptions, type TraceResult, trace } from './trace.js';
44
- export { headTailTruncate, paragraphTruncate } from './truncation.js';
45
- export { type WatchEvent, type WatchHandle, type WatchOptions, watchList, watchStart, watchStop, } from './watch.js';
46
- export { type WebFetchMode, type WebFetchOptions, type WebFetchResult, webFetch, } from './web-fetch.js';
47
- export { parseSearchResults, type WebSearchOptions, type WebSearchResult, type WebSearchResultItem, webSearch, } from './web-search.js';
48
- export { addToWorkset, deleteWorkset, getWorkset, listWorksets, removeFromWorkset, saveWorkset, type Workset, } from './workset.js';
49
- //# sourceMappingURL=index.d.ts.map
1
+ import { KBError, KBErrorCode, KBNextHint, KBResponse, KBResponseMeta, errorResponse, okResponse } from "./response-envelope.js";
2
+ import { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit } from "./audit.js";
3
+ import { BatchOperation, BatchOptions, BatchResult, batch } from "./batch.js";
4
+ import { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog } from "./changelog.js";
5
+ import { ParsedError, ParsedGitStatus, ParsedOutput, ParsedTestResult, ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest } from "./parse-output.js";
6
+ import { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult } from "./check.js";
7
+ import { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave } from "./checkpoint.js";
8
+ import { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod } from "./codemod.js";
9
+ import { FileCache, FileCacheEntry, FileCacheStats } from "./file-cache.js";
10
+ import { CompactOptions, CompactResult, compact } from "./compact.js";
11
+ import { TransformOptions, TransformResult, dataTransform } from "./data-transform.js";
12
+ import { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols } from "./dead-symbols.js";
13
+ import { DelegateOptions, DelegateResult, delegate, delegateListModels } from "./delegate.js";
14
+ import { DiffChange, DiffFile, DiffHunk, DiffParseOptions, diffParse } from "./diff-parse.js";
15
+ import { DigestFieldEntry, DigestOptions, DigestResult, DigestSource, digest } from "./digest.js";
16
+ import { EncodeOperation, EncodeOptions, EncodeResult, encode } from "./encode.js";
17
+ import { EnvInfoOptions, EnvInfoResult, envInfo } from "./env-info.js";
18
+ import { EvalOptions, EvalResult, evaluate } from "./eval.js";
19
+ import { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, UnknownType, evidenceMap } from "./evidence-map.js";
20
+ import { FileSummaryOptions, FileSummaryResult, fileSummary } from "./file-summary.js";
21
+ import { Example, FindExamplesOptions, FindExamplesResult, findExamples } from "./find-examples.js";
22
+ import { FindOptions, FindResult, FindResults, find } from "./find.js";
23
+ import { ClassifyTrigger, ForgeClassifyCeremony, ForgeClassifyOptions, ForgeClassifyResult, TypedUnknownSeed, forgeClassify } from "./forge-classify.js";
24
+ import { ScopeMapEntry, ScopeMapOptions, ScopeMapResult, scopeMap } from "./scope-map.js";
25
+ import { ConstraintRef, ForgeGroundOptions, ForgeGroundResult, forgeGround } from "./forge-ground.js";
26
+ import { GitContextOptions, GitContextResult, gitContext } from "./git-context.js";
27
+ import { GraphAugmentOptions, GraphAugmentedResult, GraphQueryOptions, GraphQueryResult, graphAugmentSearch, graphQuery } from "./graph-query.js";
28
+ import { GuideRecommendation, GuideResult, guide } from "./guide.js";
29
+ import { HealthCheck, HealthResult, health } from "./health.js";
30
+ import { HttpMethod, HttpRequestOptions, HttpRequestResult, httpRequest } from "./http-request.js";
31
+ import { LaneDiffEntry, LaneDiffResult, LaneMergeResult, LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus } from "./lane.js";
32
+ import { FileMetrics, MeasureOptions, MeasureResult, analyzeFile, measure } from "./measure.js";
33
+ import { OnboardMode, OnboardOptions, OnboardResult, OnboardStepResult, onboard } from "./onboard.js";
34
+ import { resolvePath } from "./path-resolver.js";
35
+ import { ManagedProcess, processList, processLogs, processStart, processStatus, processStop } from "./process-manager.js";
36
+ import { QueueItem, QueueState, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush } from "./queue.js";
37
+ import { RegexTestOptions, RegexTestResult, regexTest } from "./regex-test.js";
38
+ import { RenameChange, RenameOptions, RenameResult, rename } from "./rename.js";
39
+ import { ReplayEntry, ReplayOptions, replayAppend, replayCapture, replayClear, replayList, replayTrim } from "./replay.js";
40
+ import { SchemaValidateOptions, SchemaValidateResult, ValidationError, schemaValidate } from "./schema-validate.js";
41
+ import { Snippet, SnippetAction, SnippetOptions, SnippetResult, snippet } from "./snippet.js";
42
+ import { StashEntry, stashClear, stashDelete, stashGet, stashList, stashSet } from "./stash.js";
43
+ import { StratumCard, StratumCardOptions, StratumCardResult, stratumCard } from "./stratum-card.js";
44
+ import { SymbolInfo, SymbolOptions, symbol } from "./symbol.js";
45
+ import { TestRunOptions, TestRunResult, classifyExitCode, testRun } from "./test-run.js";
46
+ import { cosineSimilarity, estimateTokens, segment } from "./text-utils.js";
47
+ import { TimeOptions, TimeResult, timeUtils } from "./time-utils.js";
48
+ import { TraceNode, TraceOptions, TraceResult, trace } from "./trace.js";
49
+ import { headTailTruncate, paragraphTruncate, truncateToTokenBudget } from "./truncation.js";
50
+ import { WatchEvent, WatchHandle, WatchOptions, watchList, watchStart, watchStop } from "./watch.js";
51
+ import { WebFetchMode, WebFetchOptions, WebFetchResult, webFetch } from "./web-fetch.js";
52
+ import { WebSearchOptions, WebSearchResult, WebSearchResultItem, parseSearchResults, webSearch } from "./web-search.js";
53
+ import { Workset, addToWorkset, deleteWorkset, getWorkset, listWorksets, removeFromWorkset, saveWorkset } from "./workset.js";
54
+ export { type AuditCheck, type AuditData, type AuditOptions, type AuditRecommendation, type BatchOperation, type BatchOptions, type BatchResult, type ChangelogEntry, type ChangelogFormat, type ChangelogOptions, type ChangelogResult, type CheckOptions, type CheckResult, type CheckSummaryResult, type Checkpoint, type ClassifyTrigger, type CodemodChange, type CodemodOptions, type CodemodResult, type CodemodRule, type CompactOptions, type CompactResult, type ConstraintRef, type DeadSymbol, type DeadSymbolOptions, type DeadSymbolResult, type DelegateOptions, type DelegateResult, type DiffChange, type DiffFile, type DiffHunk, type DiffParseOptions, type DigestFieldEntry, type DigestOptions, type DigestResult, type DigestSource, type EncodeOperation, type EncodeOptions, type EncodeResult, type EnvInfoOptions, type EnvInfoResult, type EvalOptions, type EvalResult, type EvidenceEntry, type EvidenceMapAction, type EvidenceMapResult, type EvidenceMapState, type EvidenceStatus, type Example, FileCache, type FileCacheEntry, type FileCacheStats, type FileMetrics, type FileSummaryOptions, type FileSummaryResult, type FindExamplesOptions, type FindExamplesResult, type FindOptions, type FindResult, type FindResults, type ForgeClassifyCeremony, type ForgeClassifyOptions, type ForgeClassifyResult, type ForgeGroundOptions, type ForgeGroundResult, type ForgeTier, type GateDecision, type GateResult, type GitContextOptions, type GitContextResult, type GraphAugmentOptions, type GraphAugmentedResult, type GraphQueryOptions, type GraphQueryResult, type GuideRecommendation, type GuideResult, type HealthCheck, type HealthResult, type HttpMethod, type HttpRequestOptions, type HttpRequestResult, type KBError, type KBErrorCode, type KBNextHint, type KBResponse, type KBResponseMeta, type LaneDiffEntry, type LaneDiffResult, type LaneMergeResult, type LaneMeta, type ManagedProcess, type MeasureOptions, type MeasureResult, type OnboardMode, type OnboardOptions, type OnboardResult, type OnboardStepResult, type ParsedError, type ParsedGitStatus, type ParsedOutput, type ParsedTestResult, type ParsedTestSummary, type QueueItem, type QueueState, type RegexTestOptions, type RegexTestResult, type RenameChange, type RenameOptions, type RenameResult, type ReplayEntry, type ReplayOptions, type SchemaValidateOptions, type SchemaValidateResult, type ScopeMapEntry, type ScopeMapOptions, type ScopeMapResult, type Snippet, type SnippetAction, type SnippetOptions, type SnippetResult, type StashEntry, type StratumCard, type StratumCardOptions, type StratumCardResult, type SymbolInfo, type SymbolOptions, type TestRunOptions, type TestRunResult, type TimeOptions, type TimeResult, type TraceNode, type TraceOptions, type TraceResult, type TransformOptions, type TransformResult, type TypedUnknownSeed, type UnknownType, type ValidationError, type WatchEvent, type WatchHandle, type WatchOptions, type WebFetchMode, type WebFetchOptions, type WebFetchResult, type WebSearchOptions, type WebSearchResult, type WebSearchResultItem, type Workset, addToWorkset, analyzeFile, audit, batch, changelog, check, checkpointLatest, checkpointList, checkpointLoad, checkpointSave, classifyExitCode, codemod, compact, cosineSimilarity, dataTransform, delegate, delegateListModels, deleteWorkset, diffParse, digest, encode, envInfo, errorResponse, estimateTokens, evaluate, evidenceMap, fileSummary, find, findDeadSymbols, findExamples, forgeClassify, forgeGround, formatChangelog, getWorkset, gitContext, graphAugmentSearch, graphQuery, guide, headTailTruncate, health, httpRequest, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus, listWorksets, measure, okResponse, onboard, paragraphTruncate, parseBiome, parseGitStatus, parseOutput, parseSearchResults, parseTsc, parseVitest, processList, processLogs, processStart, processStatus, processStop, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush, regexTest, removeFromWorkset, rename, replayAppend, replayCapture, replayClear, replayList, replayTrim, resolvePath, saveWorkset, schemaValidate, scopeMap, segment, snippet, stashClear, stashDelete, stashGet, stashList, stashSet, stratumCard, summarizeCheckResult, symbol, testRun, timeUtils, trace, truncateToTokenBudget, watchList, watchStart, watchStop, webFetch, webSearch };
@@ -1 +1 @@
1
- import{batch as p}from"./batch.js";import{changelog as r,formatChangelog as s}from"./changelog.js";import{check as y}from"./check.js";import{checkpointLatest as i,checkpointList as l,checkpointLoad as u,checkpointSave as m}from"./checkpoint.js";import{codemod as c}from"./codemod.js";import{compact as h}from"./compact.js";import{dataTransform as R}from"./data-transform.js";import{findDeadSymbols as O}from"./dead-symbols.js";import{delegate as C,delegateListModels as E}from"./delegate.js";import{diffParse as F}from"./diff-parse.js";import{digest as b}from"./digest.js";import{encode as M}from"./encode.js";import{envInfo as W}from"./env-info.js";import{evaluate as L}from"./eval.js";import{evidenceMap as P}from"./evidence-map.js";import{fileSummary as H}from"./file-summary.js";import{find as I}from"./find.js";import{findExamples as V}from"./find-examples.js";import{forgeClassify as U}from"./forge-classify.js";import{forgeGround as z}from"./forge-ground.js";import{gitContext as J}from"./git-context.js";import{graphAugmentSearch as X,graphQuery as Y}from"./graph-query.js";import{health as _}from"./health.js";import{httpRequest as ee}from"./http-request.js";import{laneCreate as pe,laneDiff as oe,laneDiscard as re,laneList as se,laneMerge as ae,laneStatus as ye}from"./lane.js";import{analyzeFile as ie,measure as le}from"./measure.js";import{onboard as me}from"./onboard.js";import{parseBiome as ce,parseGitStatus as de,parseOutput as he,parseTsc as xe,parseVitest as Re}from"./parse-output.js";import{processList as Oe,processLogs as Se,processStart as Ce,processStatus as Ee,processStop as Te}from"./process-manager.js";import{queueClear as De,queueCreate as be,queueDelete as ke,queueDone as Me,queueFail as ve,queueGet as We,queueList as Ge,queueNext as Le,queuePush as qe}from"./queue.js";import{regexTest as we}from"./regex-test.js";import{rename as Ae}from"./rename.js";import{replayAppend as Qe,replayCapture as Ve,replayClear as Be,replayList as Ue,replayTrim as Ne}from"./replay.js";import{schemaValidate as je}from"./schema-validate.js";import{scopeMap as Ke}from"./scope-map.js";import{snippet as Ye}from"./snippet.js";import{stashClear as _e,stashDelete as $e,stashGet as et,stashList as tt,stashSet as pt}from"./stash.js";import{stratumCard as rt}from"./stratum-card.js";import{symbol as at}from"./symbol.js";import{classifyExitCode as nt,testRun as it}from"./test-run.js";import{cosineSimilarity as ut,estimateTokens as mt,segment as ft}from"./text-utils.js";import{timeUtils as dt}from"./time-utils.js";import{trace as xt}from"./trace.js";import{headTailTruncate as gt,paragraphTruncate as Ot}from"./truncation.js";import{watchList as Ct,watchStart as Et,watchStop as Tt}from"./watch.js";import{webFetch as Dt}from"./web-fetch.js";import{parseSearchResults as kt,webSearch as Mt}from"./web-search.js";import{addToWorkset as Wt,deleteWorkset as Gt,getWorkset as Lt,listWorksets as qt,removeFromWorkset as Pt,saveWorkset as wt}from"./workset.js";export{Wt as addToWorkset,ie as analyzeFile,p as batch,r as changelog,y as check,i as checkpointLatest,l as checkpointList,u as checkpointLoad,m as checkpointSave,nt as classifyExitCode,c as codemod,h as compact,ut as cosineSimilarity,R as dataTransform,C as delegate,E as delegateListModels,Gt as deleteWorkset,F as diffParse,b as digest,M as encode,W as envInfo,mt as estimateTokens,L as evaluate,P as evidenceMap,H as fileSummary,I as find,O as findDeadSymbols,V as findExamples,U as forgeClassify,z as forgeGround,s as formatChangelog,Lt as getWorkset,J as gitContext,X as graphAugmentSearch,Y as graphQuery,gt as headTailTruncate,_ as health,ee as httpRequest,pe as laneCreate,oe as laneDiff,re as laneDiscard,se as laneList,ae as laneMerge,ye as laneStatus,qt as listWorksets,le as measure,me as onboard,Ot as paragraphTruncate,ce as parseBiome,de as parseGitStatus,he as parseOutput,kt as parseSearchResults,xe as parseTsc,Re as parseVitest,Oe as processList,Se as processLogs,Ce as processStart,Ee as processStatus,Te as processStop,De as queueClear,be as queueCreate,ke as queueDelete,Me as queueDone,ve as queueFail,We as queueGet,Ge as queueList,Le as queueNext,qe as queuePush,we as regexTest,Pt as removeFromWorkset,Ae as rename,Qe as replayAppend,Ve as replayCapture,Be as replayClear,Ue as replayList,Ne as replayTrim,wt as saveWorkset,je as schemaValidate,Ke as scopeMap,ft as segment,Ye as snippet,_e as stashClear,$e as stashDelete,et as stashGet,tt as stashList,pt as stashSet,rt as stratumCard,at as symbol,it as testRun,dt as timeUtils,xt as trace,Ct as watchList,Et as watchStart,Tt as watchStop,Dt as webFetch,Mt as webSearch};
1
+ import{parseBiome as e,parseGitStatus as t,parseOutput as n,parseTsc as r,parseVitest as i}from"./parse-output.js";import{check as a,summarizeCheckResult as o}from"./check.js";import{findDeadSymbols as s}from"./dead-symbols.js";import{health as c}from"./health.js";import{resolvePath as l}from"./path-resolver.js";import{cosineSimilarity as u,estimateTokens as d,segment as f}from"./text-utils.js";import{errorResponse as p,okResponse as m}from"./response-envelope.js";import{audit as h}from"./audit.js";import{batch as g}from"./batch.js";import{changelog as _,formatChangelog as v}from"./changelog.js";import{checkpointLatest as y,checkpointList as b,checkpointLoad as x,checkpointSave as S}from"./checkpoint.js";import{codemod as C}from"./codemod.js";import{compact as w}from"./compact.js";import{dataTransform as T}from"./data-transform.js";import{delegate as E,delegateListModels as D}from"./delegate.js";import{diffParse as O}from"./diff-parse.js";import{digest as k}from"./digest.js";import{encode as A}from"./encode.js";import{envInfo as j}from"./env-info.js";import{evaluate as M}from"./eval.js";import{evidenceMap as N}from"./evidence-map.js";import{FileCache as P}from"./file-cache.js";import{fileSummary as F}from"./file-summary.js";import{findExamples as I}from"./find-examples.js";import{find as L}from"./find.js";import{forgeClassify as R}from"./forge-classify.js";import{scopeMap as z}from"./scope-map.js";import{forgeGround as B}from"./forge-ground.js";import{gitContext as V}from"./git-context.js";import{graphAugmentSearch as H,graphQuery as U}from"./graph-query.js";import{guide as W}from"./guide.js";import{headTailTruncate as G,paragraphTruncate as K,truncateToTokenBudget as q}from"./truncation.js";import{httpRequest as J}from"./http-request.js";import{laneCreate as Y,laneDiff as X,laneDiscard as Z,laneList as Q,laneMerge as $,laneStatus as ee}from"./lane.js";import{analyzeFile as te,measure as ne}from"./measure.js";import{onboard as re}from"./onboard.js";import{processList as ie,processLogs as ae,processStart as oe,processStatus as se,processStop as ce}from"./process-manager.js";import{queueClear as le,queueCreate as ue,queueDelete as de,queueDone as fe,queueFail as pe,queueGet as me,queueList as he,queueNext as ge,queuePush as _e}from"./queue.js";import{regexTest as ve}from"./regex-test.js";import{rename as ye}from"./rename.js";import{replayAppend as be,replayCapture as xe,replayClear as Se,replayList as Ce,replayTrim as we}from"./replay.js";import{schemaValidate as Te}from"./schema-validate.js";import{snippet as Ee}from"./snippet.js";import{stashClear as De,stashDelete as Oe,stashGet as ke,stashList as Ae,stashSet as je}from"./stash.js";import{stratumCard as Me}from"./stratum-card.js";import{symbol as Ne}from"./symbol.js";import{classifyExitCode as Pe,testRun as Fe}from"./test-run.js";import{timeUtils as Ie}from"./time-utils.js";import{trace as Le}from"./trace.js";import{watchList as Re,watchStart as ze,watchStop as Be}from"./watch.js";import{webFetch as Ve}from"./web-fetch.js";import{parseSearchResults as He,webSearch as Ue}from"./web-search.js";import{addToWorkset as We,deleteWorkset as Ge,getWorkset as Ke,listWorksets as qe,removeFromWorkset as Je,saveWorkset as Ye}from"./workset.js";export{P as FileCache,We as addToWorkset,te as analyzeFile,h as audit,g as batch,_ as changelog,a as check,y as checkpointLatest,b as checkpointList,x as checkpointLoad,S as checkpointSave,Pe as classifyExitCode,C as codemod,w as compact,u as cosineSimilarity,T as dataTransform,E as delegate,D as delegateListModels,Ge as deleteWorkset,O as diffParse,k as digest,A as encode,j as envInfo,p as errorResponse,d as estimateTokens,M as evaluate,N as evidenceMap,F as fileSummary,L as find,s as findDeadSymbols,I as findExamples,R as forgeClassify,B as forgeGround,v as formatChangelog,Ke as getWorkset,V as gitContext,H as graphAugmentSearch,U as graphQuery,W as guide,G as headTailTruncate,c as health,J as httpRequest,Y as laneCreate,X as laneDiff,Z as laneDiscard,Q as laneList,$ as laneMerge,ee as laneStatus,qe as listWorksets,ne as measure,m as okResponse,re as onboard,K as paragraphTruncate,e as parseBiome,t as parseGitStatus,n as parseOutput,He as parseSearchResults,r as parseTsc,i as parseVitest,ie as processList,ae as processLogs,oe as processStart,se as processStatus,ce as processStop,le as queueClear,ue as queueCreate,de as queueDelete,fe as queueDone,pe as queueFail,me as queueGet,he as queueList,ge as queueNext,_e as queuePush,ve as regexTest,Je as removeFromWorkset,ye as rename,be as replayAppend,xe as replayCapture,Se as replayClear,Ce as replayList,we as replayTrim,l as resolvePath,Ye as saveWorkset,Te as schemaValidate,z as scopeMap,f as segment,Ee as snippet,De as stashClear,Oe as stashDelete,ke as stashGet,Ae as stashList,je as stashSet,Me as stratumCard,o as summarizeCheckResult,Ne as symbol,Fe as testRun,Ie as timeUtils,Le as trace,q as truncateToTokenBudget,Re as watchList,ze as watchStart,Be as watchStop,Ve as webFetch,Ue as webSearch};
@@ -1,39 +1,42 @@
1
- export interface LaneMeta {
2
- name: string;
3
- createdAt: string;
4
- sourceFiles: string[];
5
- rootPath: string;
1
+ //#region packages/tools/src/lane.d.ts
2
+ interface LaneMeta {
3
+ name: string;
4
+ createdAt: string;
5
+ sourceFiles: string[];
6
+ rootPath: string;
6
7
  }
7
- export interface LaneDiffEntry {
8
- file: string;
9
- status: 'modified' | 'added' | 'deleted' | 'unchanged';
10
- diff?: string;
8
+ interface LaneDiffEntry {
9
+ file: string;
10
+ status: 'modified' | 'added' | 'deleted' | 'unchanged';
11
+ diff?: string;
11
12
  }
12
- export interface LaneDiffResult {
13
- name: string;
14
- entries: LaneDiffEntry[];
15
- modified: number;
16
- added: number;
17
- deleted: number;
13
+ interface LaneDiffResult {
14
+ name: string;
15
+ entries: LaneDiffEntry[];
16
+ modified: number;
17
+ added: number;
18
+ deleted: number;
18
19
  }
19
- export interface LaneMergeResult {
20
- name: string;
21
- filesMerged: number;
22
- files: string[];
20
+ interface LaneMergeResult {
21
+ name: string;
22
+ filesMerged: number;
23
+ files: string[];
23
24
  }
24
25
  /**
25
26
  * Create an isolated lane by copying specified files into `.kb-state/lanes/<name>/`.
26
27
  * Files are stored with their relative paths preserved.
27
28
  */
28
- export declare function laneCreate(name: string, files: string[], cwd?: string): LaneMeta;
29
+ declare function laneCreate(name: string, files: string[], cwd?: string): LaneMeta;
29
30
  /** List all active lanes. */
30
- export declare function laneList(cwd?: string): LaneMeta[];
31
+ declare function laneList(cwd?: string): LaneMeta[];
31
32
  /** Get the status of a lane — which files are modified, added, deleted. */
32
- export declare function laneStatus(name: string, cwd?: string): LaneDiffResult;
33
+ declare function laneStatus(name: string, cwd?: string): LaneDiffResult;
33
34
  /** Generate a unified diff for modified files in a lane. */
34
- export declare function laneDiff(name: string, cwd?: string): LaneDiffResult;
35
+ declare function laneDiff(name: string, cwd?: string): LaneDiffResult;
35
36
  /** Merge lane files back to the original locations. */
36
- export declare function laneMerge(name: string, cwd?: string): LaneMergeResult;
37
+ declare function laneMerge(name: string, cwd?: string): LaneMergeResult;
37
38
  /** Discard a lane entirely. */
38
- export declare function laneDiscard(name: string, cwd?: string): boolean;
39
+ declare function laneDiscard(name: string, cwd?: string): boolean;
40
+ //#endregion
41
+ export { LaneDiffEntry, LaneDiffResult, LaneMergeResult, LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus };
39
42
  //# sourceMappingURL=lane.d.ts.map
@@ -1,7 +1,7 @@
1
- import{cpSync as F,existsSync as u,mkdirSync as S,readdirSync as E,readFileSync as g,rmSync as P,statSync as R,writeFileSync as A}from"node:fs";import{join as l,relative as v,resolve as h}from"node:path";const N=".kb-state/lanes",L=".lane-meta.json";function w(n){return h(n??process.cwd(),N)}function p(n,r){const s=w(r),i=h(s,n);if(!i.startsWith(h(s)))throw new Error(`Invalid lane name: "${n}"`);return i}function x(n,r){const s=l(p(n,r),L);if(!u(s))throw new Error(`Lane "${n}" does not exist`);return JSON.parse(g(s,"utf-8"))}function I(n,r,s){const i=s??process.cwd(),o=p(n,s);if(u(o))throw new Error(`Lane "${n}" already exists`);S(o,{recursive:!0});const e=[];for(const t of r){const a=h(i,t);if(!u(a))throw new Error(`Source file does not exist: ${t}`);const c=v(i,a).replace(/\\/g,"/"),d=l(o,c);S(l(d,".."),{recursive:!0}),F(a,d),e.push(c)}const f={name:n,createdAt:new Date().toISOString(),sourceFiles:e,rootPath:i};return A(l(o,L),`${JSON.stringify(f,null,2)}
2
- `,"utf-8"),f}function J(n){const r=w(n);if(!u(r))return[];const s=E(r),i=[];for(const o of s){const e=l(r,o,L);u(e)&&i.push(JSON.parse(g(e,"utf-8")))}return i}function k(n,r){const s=x(n,r),i=p(n,r),o=s.rootPath,e=[];for(const t of s.sourceFiles){const a=h(o,t),c=l(i,t);if(!u(c)){e.push({file:t,status:"deleted"});continue}if(!u(a)){e.push({file:t,status:"added"});continue}const d=g(a,"utf-8"),m=g(c,"utf-8");d===m?e.push({file:t,status:"unchanged"}):e.push({file:t,status:"modified"})}const f=y(i);for(const t of f)s.sourceFiles.includes(t)||e.push({file:t,status:"added"});return{name:n,entries:e,modified:e.filter(t=>t.status==="modified").length,added:e.filter(t=>t.status==="added").length,deleted:e.filter(t=>t.status==="deleted").length}}function _(n,r){const s=x(n,r),i=p(n,r),o=s.rootPath,e=[],f=new Set(s.sourceFiles);for(const t of y(i))f.add(t);for(const t of f){const a=h(o,t),c=l(i,t),d=u(a),m=u(c);if(!m&&d){e.push({file:t,status:"deleted"});continue}if(m&&!d){const $=g(c,"utf-8");e.push({file:t,status:"added",diff:$.split(`
3
- `).map(b=>`+${b}`).join(`
4
- `)});continue}if(!m||!d)continue;const M=g(a,"utf-8"),D=g(c,"utf-8");M===D?e.push({file:t,status:"unchanged"}):e.push({file:t,status:"modified",diff:j(M,D)})}return{name:n,entries:e,modified:e.filter(t=>t.status==="modified").length,added:e.filter(t=>t.status==="added").length,deleted:e.filter(t=>t.status==="deleted").length}}function T(n,r){const s=x(n,r),i=p(n,r),o=s.rootPath,e=[],f=new Set(s.sourceFiles);for(const t of y(i))f.add(t);for(const t of f){const a=l(i,t);if(!u(a))continue;const c=h(o,t);S(l(c,".."),{recursive:!0}),F(a,c),e.push(t)}return P(i,{recursive:!0,force:!0}),{name:n,filesMerged:e.length,files:e}}function W(n,r){const s=p(n,r);return u(s)?(P(s,{recursive:!0,force:!0}),!0):!1}function y(n){const r=[];function s(i){for(const o of E(i)){if(o===L)continue;const e=l(i,o);R(e).isDirectory()?s(e):r.push(v(n,e).replace(/\\/g,"/"))}}return u(n)&&s(n),r.sort()}function j(n,r){const s=n.split(`
5
- `),i=r.split(`
6
- `),o=[],e=Math.max(s.length,i.length);for(let f=0;f<e;f++){const t=s[f],a=i[f];t===a?o.push(` ${t??""}`):(t!==void 0&&o.push(`-${t}`),a!==void 0&&o.push(`+${a}`))}return o.join(`
7
- `)}export{I as laneCreate,_ as laneDiff,W as laneDiscard,J as laneList,T as laneMerge,k as laneStatus};
1
+ import{join as e,relative as t,resolve as n}from"node:path";import{cpSync as r,existsSync as i,mkdirSync as a,readFileSync as o,readdirSync as s,rmSync as c,statSync as l,writeFileSync as u}from"node:fs";const d=`.lane-meta.json`;function f(e){return n(e??process.cwd(),`.kb-state/lanes`)}function p(e,t){let r=f(t),i=n(r,e);if(!i.startsWith(n(r)))throw Error(`Invalid lane name: "${e}"`);return i}function m(t,n){let r=e(p(t,n),d);if(!i(r))throw Error(`Lane "${t}" does not exist`);try{return JSON.parse(o(r,`utf-8`))}catch{throw Error(`Lane "${t}" has corrupted metadata`)}}function h(o,s,c){let l=c??process.cwd(),f=p(o,c);if(i(f))throw Error(`Lane "${o}" already exists`);a(f,{recursive:!0});let m=[];for(let o of s){let s=n(l,o);if(!i(s))throw Error(`Source file does not exist: ${o}`);let c=t(l,s).replace(/\\/g,`/`),u=e(f,c);a(e(u,`..`),{recursive:!0}),r(s,u),m.push(c)}let h={name:o,createdAt:new Date().toISOString(),sourceFiles:m,rootPath:l};return u(e(f,d),`${JSON.stringify(h,null,2)}\n`,`utf-8`),h}function g(t){let n=f(t);if(!i(n))return[];let r=s(n),a=[];for(let t of r){let r=e(n,t,d);if(i(r))try{a.push(JSON.parse(o(r,`utf-8`)))}catch{}}return a}function _(t,r){let a=m(t,r),s=p(t,r),c=a.rootPath,l=[];for(let t of a.sourceFiles){let r=n(c,t),a=e(s,t);if(!i(a)){l.push({file:t,status:`deleted`});continue}if(!i(r)){l.push({file:t,status:`added`});continue}o(r,`utf-8`)===o(a,`utf-8`)?l.push({file:t,status:`unchanged`}):l.push({file:t,status:`modified`})}let u=x(s);for(let e of u)a.sourceFiles.includes(e)||l.push({file:e,status:`added`});return{name:t,entries:l,modified:l.filter(e=>e.status===`modified`).length,added:l.filter(e=>e.status===`added`).length,deleted:l.filter(e=>e.status===`deleted`).length}}function v(t,r){let a=m(t,r),s=p(t,r),c=a.rootPath,l=[],u=new Set(a.sourceFiles);for(let e of x(s))u.add(e);for(let t of u){let r=n(c,t),a=e(s,t),u=i(r),d=i(a);if(!d&&u){l.push({file:t,status:`deleted`});continue}if(d&&!u){let e=o(a,`utf-8`);l.push({file:t,status:`added`,diff:e.split(`
2
+ `).map(e=>`+${e}`).join(`
3
+ `)});continue}if(!d||!u)continue;let f=o(r,`utf-8`),p=o(a,`utf-8`);f===p?l.push({file:t,status:`unchanged`}):l.push({file:t,status:`modified`,diff:S(f,p)})}return{name:t,entries:l,modified:l.filter(e=>e.status===`modified`).length,added:l.filter(e=>e.status===`added`).length,deleted:l.filter(e=>e.status===`deleted`).length}}function y(t,o){let s=m(t,o),l=p(t,o),u=s.rootPath,d=[],f=new Set(s.sourceFiles);for(let e of x(l))f.add(e);for(let t of f){let o=e(l,t);if(!i(o))continue;let s=n(u,t);a(e(s,`..`),{recursive:!0}),r(o,s),d.push(t)}return c(l,{recursive:!0,force:!0}),{name:t,filesMerged:d.length,files:d}}function b(e,t){let n=p(e,t);return i(n)?(c(n,{recursive:!0,force:!0}),!0):!1}function x(n){let r=[];function a(i){for(let o of s(i)){if(o===d)continue;let s=e(i,o);l(s).isDirectory()?a(s):r.push(t(n,s).replace(/\\/g,`/`))}}return i(n)&&a(n),r.sort()}function S(e,t){let n=e.split(`
4
+ `),r=t.split(`
5
+ `),i=[],a=Math.max(n.length,r.length);for(let e=0;e<a;e++){let t=n[e],a=r[e];t===a?i.push(` ${t??``}`):(t!==void 0&&i.push(`-${t}`),a!==void 0&&i.push(`+${a}`))}return i.join(`
6
+ `)}export{h as laneCreate,v as laneDiff,b as laneDiscard,g as laneList,y as laneMerge,_ as laneStatus};
7
+ //# sourceMappingURL=lane.js.map
@@ -1,38 +1,41 @@
1
+ //#region packages/tools/src/measure.d.ts
1
2
  /**
2
3
  * kb_measure — Code complexity and size metrics.
3
4
  */
4
- export interface MeasureOptions {
5
- path: string;
6
- extensions?: string[];
5
+ interface MeasureOptions {
6
+ path: string;
7
+ extensions?: string[];
7
8
  }
8
- export interface FileMetrics {
9
- path: string;
10
- lines: {
11
- total: number;
12
- code: number;
13
- blank: number;
14
- comment: number;
15
- };
16
- complexity: number;
17
- functions: number;
18
- imports: number;
19
- exports: number;
9
+ interface FileMetrics {
10
+ path: string;
11
+ lines: {
12
+ total: number;
13
+ code: number;
14
+ blank: number;
15
+ comment: number;
16
+ };
17
+ complexity: number;
18
+ functions: number;
19
+ imports: number;
20
+ exports: number;
20
21
  }
21
- export interface MeasureResult {
22
- files: FileMetrics[];
23
- summary: {
24
- totalFiles: number;
25
- totalLines: number;
26
- totalCodeLines: number;
27
- avgComplexity: number;
28
- maxComplexity: {
29
- file: string;
30
- value: number;
31
- };
32
- totalFunctions: number;
22
+ interface MeasureResult {
23
+ files: FileMetrics[];
24
+ summary: {
25
+ totalFiles: number;
26
+ totalLines: number;
27
+ totalCodeLines: number;
28
+ avgComplexity: number;
29
+ maxComplexity: {
30
+ file: string;
31
+ value: number;
33
32
  };
33
+ totalFunctions: number;
34
+ };
34
35
  }
35
- export declare function measure(options: MeasureOptions): MeasureResult;
36
+ declare function measure(options: MeasureOptions): MeasureResult;
36
37
  /** Exported for unit testing */
37
- export declare function analyzeFile(path: string, content: string): FileMetrics;
38
+ declare function analyzeFile(path: string, content: string): FileMetrics;
39
+ //#endregion
40
+ export { FileMetrics, MeasureOptions, MeasureResult, analyzeFile, measure };
38
41
  //# sourceMappingURL=measure.d.ts.map
@@ -1,2 +1,3 @@
1
- import{readdirSync as h,readFileSync as x,statSync as p}from"node:fs";import{extname as b,join as d,relative as y}from"node:path";const F=new Set(["node_modules",".git","dist","build","coverage",".turbo","cdk.out",".cache"]),C=[/\bif\s*\(/g,/\belse\s+if\b/g,/\bfor\s*\(/g,/\bwhile\s*\(/g,/\bcase\s+/g,/\bcatch\s*\(/g,/&&/g,/\|\|/g,/\?\?/g];function R(r){const{path:s,extensions:o=[".ts",".tsx",".js",".jsx"]}=r,t=M(s,o).map(e=>{const n=x(e,"utf8");return w(y(process.cwd(),e),n)});t.sort((e,n)=>n.complexity-e.complexity);const i=t.reduce((e,n)=>e+n.lines.total,0),l=t.reduce((e,n)=>e+n.lines.code,0),u=t.reduce((e,n)=>e+n.complexity,0),f=t.reduce((e,n)=>e+n.functions,0),m=t[0]??{path:"",complexity:0};return{files:t,summary:{totalFiles:t.length,totalLines:i,totalCodeLines:l,avgComplexity:t.length>0?Math.round(u/t.length*10)/10:0,maxComplexity:{file:m.path,value:m.complexity},totalFunctions:f}}}function w(r,s){const o=s.split(`
2
- `);let a=0,t=0,i=!1;for(const g of o){const c=g.trim();if(c===""){a++;continue}if(i){t++,c.includes("*/")&&(i=!1);continue}if(c.startsWith("//")){t++;continue}c.startsWith("/*")&&(t++,i=!c.includes("*/"))}let l=1;for(const g of C){const c=s.match(g);c&&(l+=c.length)}const u=s.match(/\bfunction\b/g)?.length??0,f=s.match(/=>\s*[{(]/g)?.length??0,m=u+f,e=s.match(/^\s*import\s/gm)?.length??0,n=s.match(/^\s*export\s/gm)?.length??0;return{path:r,lines:{total:o.length,code:o.length-a-t,blank:a,comment:t},complexity:l,functions:m,imports:e,exports:n}}function M(r,s){try{if(p(r).isFile())return[r]}catch{throw new Error(`Path not found: ${r}`)}const o=[];function a(t){for(const i of h(t)){if(F.has(i))continue;const l=d(t,i);p(l).isDirectory()?a(l):s.includes(b(i).toLowerCase())&&o.push(l)}}return a(r),o.sort(),o}export{w as analyzeFile,R as measure};
1
+ import{extname as e,join as t,relative as n}from"node:path";import{readFileSync as r,readdirSync as i,statSync as a}from"node:fs";const o=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`cdk.out`,`.cache`]),s=[/\bif\s*\(/g,/\belse\s+if\b/g,/\bfor\s*\(/g,/\bwhile\s*\(/g,/\bcase\s+/g,/\bcatch\s*\(/g,/&&/g,/\|\|/g,/\?\?/g];function c(e){let{path:t,extensions:i=[`.ts`,`.tsx`,`.js`,`.jsx`]}=e,a=u(t,i).map(e=>{let t=r(e,`utf8`);return l(n(process.cwd(),e),t)});a.sort((e,t)=>t.complexity-e.complexity);let o=a.reduce((e,t)=>e+t.lines.total,0),s=a.reduce((e,t)=>e+t.lines.code,0),c=a.reduce((e,t)=>e+t.complexity,0),d=a.reduce((e,t)=>e+t.functions,0),f=a[0]??{path:``,complexity:0};return{files:a,summary:{totalFiles:a.length,totalLines:o,totalCodeLines:s,avgComplexity:a.length>0?Math.round(c/a.length*10)/10:0,maxComplexity:{file:f.path,value:f.complexity},totalFunctions:d}}}function l(e,t){let n=t.split(`
2
+ `),r=0,i=0,a=!1;for(let e of n){let t=e.trim();if(t===``){r++;continue}if(a){i++,t.includes(`*/`)&&(a=!1);continue}if(t.startsWith(`//`)){i++;continue}t.startsWith(`/*`)&&(i++,a=!t.includes(`*/`))}let o=1;for(let e of s){let n=t.match(e);n&&(o+=n.length)}let c=(t.match(/\bfunction\b/g)?.length??0)+(t.match(/=>\s*[{(]/g)?.length??0),l=t.match(/^\s*import\s/gm)?.length??0,u=t.match(/^\s*export\s/gm)?.length??0;return{path:e,lines:{total:n.length,code:n.length-r-i,blank:r,comment:i},complexity:o,functions:c,imports:l,exports:u}}function u(n,r){try{if(a(n).isFile())return[n]}catch{throw Error(`Path not found: ${n}`)}let s=[];function c(n){for(let l of i(n)){if(o.has(l))continue;let i=t(n,l);a(i).isDirectory()?c(i):r.includes(e(l).toLowerCase())&&s.push(i)}}return c(n),s.sort(),s}export{l as analyzeFile,c as measure};
3
+ //# sourceMappingURL=measure.js.map