@vpxa/aikit 0.1.1

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 (649) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1207 -0
  3. package/bin/aikit.mjs +10 -0
  4. package/package.json +92 -0
  5. package/packages/aikit-client/dist/direct-client.d.ts +37 -0
  6. package/packages/aikit-client/dist/direct-client.js +1 -0
  7. package/packages/aikit-client/dist/index.d.ts +5 -0
  8. package/packages/aikit-client/dist/index.js +1 -0
  9. package/packages/aikit-client/dist/mcp-client.d.ts +19 -0
  10. package/packages/aikit-client/dist/mcp-client.js +4 -0
  11. package/packages/aikit-client/dist/parsers.d.ts +35 -0
  12. package/packages/aikit-client/dist/parsers.js +2 -0
  13. package/packages/aikit-client/dist/types.d.ts +62 -0
  14. package/packages/aikit-client/dist/types.js +1 -0
  15. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +19 -0
  16. package/packages/analyzers/dist/blast-radius-analyzer.js +6 -0
  17. package/packages/analyzers/dist/dependency-analyzer.d.ts +32 -0
  18. package/packages/analyzers/dist/dependency-analyzer.js +8 -0
  19. package/packages/analyzers/dist/diagram-generator.d.ts +16 -0
  20. package/packages/analyzers/dist/diagram-generator.js +2 -0
  21. package/packages/analyzers/dist/entry-point-analyzer.d.ts +40 -0
  22. package/packages/analyzers/dist/entry-point-analyzer.js +4 -0
  23. package/packages/analyzers/dist/index.d.ts +12 -0
  24. package/packages/analyzers/dist/index.js +1 -0
  25. package/packages/analyzers/dist/knowledge-producer.d.ts +40 -0
  26. package/packages/analyzers/dist/knowledge-producer.js +26 -0
  27. package/packages/analyzers/dist/pattern-analyzer.d.ts +15 -0
  28. package/packages/analyzers/dist/pattern-analyzer.js +2 -0
  29. package/packages/analyzers/dist/regex-call-graph.d.ts +10 -0
  30. package/packages/analyzers/dist/regex-call-graph.js +1 -0
  31. package/packages/analyzers/dist/structure-analyzer.d.ts +19 -0
  32. package/packages/analyzers/dist/structure-analyzer.js +4 -0
  33. package/packages/analyzers/dist/symbol-analyzer.d.ts +14 -0
  34. package/packages/analyzers/dist/symbol-analyzer.js +9 -0
  35. package/packages/analyzers/dist/ts-call-graph.d.ts +29 -0
  36. package/packages/analyzers/dist/ts-call-graph.js +1 -0
  37. package/packages/analyzers/dist/types.d.ts +110 -0
  38. package/packages/analyzers/dist/types.js +1 -0
  39. package/packages/chunker/dist/call-graph-extractor.d.ts +25 -0
  40. package/packages/chunker/dist/call-graph-extractor.js +1 -0
  41. package/packages/chunker/dist/chunker-factory.d.ts +19 -0
  42. package/packages/chunker/dist/chunker-factory.js +1 -0
  43. package/packages/chunker/dist/chunker.interface.d.ts +13 -0
  44. package/packages/chunker/dist/chunker.interface.js +1 -0
  45. package/packages/chunker/dist/code-chunker.d.ts +17 -0
  46. package/packages/chunker/dist/code-chunker.js +11 -0
  47. package/packages/chunker/dist/extractors/call-extractor.d.ts +24 -0
  48. package/packages/chunker/dist/extractors/call-extractor.js +1 -0
  49. package/packages/chunker/dist/extractors/entry-point-detector.d.ts +14 -0
  50. package/packages/chunker/dist/extractors/entry-point-detector.js +1 -0
  51. package/packages/chunker/dist/extractors/import-extractor.d.ts +14 -0
  52. package/packages/chunker/dist/extractors/import-extractor.js +1 -0
  53. package/packages/chunker/dist/extractors/pattern-detector.d.ts +14 -0
  54. package/packages/chunker/dist/extractors/pattern-detector.js +1 -0
  55. package/packages/chunker/dist/extractors/scope-resolver.d.ts +26 -0
  56. package/packages/chunker/dist/extractors/scope-resolver.js +1 -0
  57. package/packages/chunker/dist/extractors/symbol-extractor.d.ts +14 -0
  58. package/packages/chunker/dist/extractors/symbol-extractor.js +3 -0
  59. package/packages/chunker/dist/extractors/types.d.ts +44 -0
  60. package/packages/chunker/dist/extractors/types.js +1 -0
  61. package/packages/chunker/dist/generic-chunker.d.ts +15 -0
  62. package/packages/chunker/dist/generic-chunker.js +5 -0
  63. package/packages/chunker/dist/index.d.ts +19 -0
  64. package/packages/chunker/dist/index.js +1 -0
  65. package/packages/chunker/dist/markdown-chunker.d.ts +17 -0
  66. package/packages/chunker/dist/markdown-chunker.js +3 -0
  67. package/packages/chunker/dist/wasm/languages.d.ts +18 -0
  68. package/packages/chunker/dist/wasm/languages.js +1 -0
  69. package/packages/chunker/dist/wasm/query-executor.d.ts +70 -0
  70. package/packages/chunker/dist/wasm/query-executor.js +1 -0
  71. package/packages/chunker/dist/wasm/runtime.d.ts +44 -0
  72. package/packages/chunker/dist/wasm/runtime.js +1 -0
  73. package/packages/chunker/dist/wasm/types.d.ts +84 -0
  74. package/packages/chunker/dist/wasm/types.js +1 -0
  75. package/packages/chunker/dist/wasm-chunker.d.ts +23 -0
  76. package/packages/chunker/dist/wasm-chunker.js +6 -0
  77. package/packages/chunker/src/queries/go/calls.scm +11 -0
  78. package/packages/chunker/src/queries/go/entry-points.scm +20 -0
  79. package/packages/chunker/src/queries/go/imports.scm +6 -0
  80. package/packages/chunker/src/queries/go/patterns.scm +25 -0
  81. package/packages/chunker/src/queries/go/symbols.scm +26 -0
  82. package/packages/chunker/src/queries/java/calls.scm +10 -0
  83. package/packages/chunker/src/queries/java/entry-points.scm +27 -0
  84. package/packages/chunker/src/queries/java/imports.scm +11 -0
  85. package/packages/chunker/src/queries/java/patterns.scm +27 -0
  86. package/packages/chunker/src/queries/java/symbols.scm +28 -0
  87. package/packages/chunker/src/queries/javascript/calls.scm +21 -0
  88. package/packages/chunker/src/queries/javascript/entry-points.scm +31 -0
  89. package/packages/chunker/src/queries/javascript/imports.scm +32 -0
  90. package/packages/chunker/src/queries/javascript/patterns.scm +28 -0
  91. package/packages/chunker/src/queries/javascript/symbols.scm +52 -0
  92. package/packages/chunker/src/queries/python/calls.scm +11 -0
  93. package/packages/chunker/src/queries/python/entry-points.scm +21 -0
  94. package/packages/chunker/src/queries/python/imports.scm +14 -0
  95. package/packages/chunker/src/queries/python/patterns.scm +25 -0
  96. package/packages/chunker/src/queries/python/symbols.scm +17 -0
  97. package/packages/chunker/src/queries/rust/calls.scm +20 -0
  98. package/packages/chunker/src/queries/rust/entry-points.scm +7 -0
  99. package/packages/chunker/src/queries/rust/imports.scm +26 -0
  100. package/packages/chunker/src/queries/rust/patterns.scm +18 -0
  101. package/packages/chunker/src/queries/rust/symbols.scm +73 -0
  102. package/packages/chunker/src/queries/typescript/calls.scm +21 -0
  103. package/packages/chunker/src/queries/typescript/entry-points.scm +48 -0
  104. package/packages/chunker/src/queries/typescript/imports.scm +35 -0
  105. package/packages/chunker/src/queries/typescript/patterns.scm +47 -0
  106. package/packages/chunker/src/queries/typescript/symbols.scm +79 -0
  107. package/packages/chunker/wasm/tree-sitter-c.wasm +0 -0
  108. package/packages/chunker/wasm/tree-sitter-c_sharp.wasm +0 -0
  109. package/packages/chunker/wasm/tree-sitter-cpp.wasm +0 -0
  110. package/packages/chunker/wasm/tree-sitter-go.wasm +0 -0
  111. package/packages/chunker/wasm/tree-sitter-java.wasm +0 -0
  112. package/packages/chunker/wasm/tree-sitter-javascript.wasm +0 -0
  113. package/packages/chunker/wasm/tree-sitter-kotlin.wasm +0 -0
  114. package/packages/chunker/wasm/tree-sitter-php.wasm +0 -0
  115. package/packages/chunker/wasm/tree-sitter-python.wasm +0 -0
  116. package/packages/chunker/wasm/tree-sitter-ruby.wasm +0 -0
  117. package/packages/chunker/wasm/tree-sitter-rust.wasm +0 -0
  118. package/packages/chunker/wasm/tree-sitter-scala.wasm +0 -0
  119. package/packages/chunker/wasm/tree-sitter-swift.wasm +0 -0
  120. package/packages/chunker/wasm/tree-sitter-typescript.wasm +0 -0
  121. package/packages/chunker/wasm/tree-sitter.wasm +0 -0
  122. package/packages/cli/dist/aikit-init.d.ts +54 -0
  123. package/packages/cli/dist/aikit-init.js +1 -0
  124. package/packages/cli/dist/commands/analyze.d.ts +6 -0
  125. package/packages/cli/dist/commands/analyze.js +2 -0
  126. package/packages/cli/dist/commands/context-cmds.d.ts +6 -0
  127. package/packages/cli/dist/commands/context-cmds.js +1 -0
  128. package/packages/cli/dist/commands/environment.d.ts +6 -0
  129. package/packages/cli/dist/commands/environment.js +1 -0
  130. package/packages/cli/dist/commands/execution.d.ts +6 -0
  131. package/packages/cli/dist/commands/execution.js +1 -0
  132. package/packages/cli/dist/commands/flow.d.ts +6 -0
  133. package/packages/cli/dist/commands/flow.js +1 -0
  134. package/packages/cli/dist/commands/graph.d.ts +6 -0
  135. package/packages/cli/dist/commands/graph.js +6 -0
  136. package/packages/cli/dist/commands/init/adapters.d.ts +28 -0
  137. package/packages/cli/dist/commands/init/adapters.js +1 -0
  138. package/packages/cli/dist/commands/init/config.d.ts +10 -0
  139. package/packages/cli/dist/commands/init/config.js +3 -0
  140. package/packages/cli/dist/commands/init/constants.d.ts +41 -0
  141. package/packages/cli/dist/commands/init/constants.js +1 -0
  142. package/packages/cli/dist/commands/init/curated.d.ts +7 -0
  143. package/packages/cli/dist/commands/init/curated.js +1 -0
  144. package/packages/cli/dist/commands/init/frontmatter.d.ts +54 -0
  145. package/packages/cli/dist/commands/init/frontmatter.js +2 -0
  146. package/packages/cli/dist/commands/init/index.d.ts +36 -0
  147. package/packages/cli/dist/commands/init/index.js +5 -0
  148. package/packages/cli/dist/commands/init/manifest.d.ts +71 -0
  149. package/packages/cli/dist/commands/init/manifest.js +1 -0
  150. package/packages/cli/dist/commands/init/scaffold.d.ts +46 -0
  151. package/packages/cli/dist/commands/init/scaffold.js +1 -0
  152. package/packages/cli/dist/commands/init/templates.d.ts +9 -0
  153. package/packages/cli/dist/commands/init/templates.js +194 -0
  154. package/packages/cli/dist/commands/init/user.d.ts +61 -0
  155. package/packages/cli/dist/commands/init/user.js +5 -0
  156. package/packages/cli/dist/commands/knowledge.d.ts +6 -0
  157. package/packages/cli/dist/commands/knowledge.js +1 -0
  158. package/packages/cli/dist/commands/search.d.ts +6 -0
  159. package/packages/cli/dist/commands/search.js +1 -0
  160. package/packages/cli/dist/commands/system.d.ts +6 -0
  161. package/packages/cli/dist/commands/system.js +4 -0
  162. package/packages/cli/dist/commands/upgrade.d.ts +6 -0
  163. package/packages/cli/dist/commands/upgrade.js +1 -0
  164. package/packages/cli/dist/commands/workspace.d.ts +6 -0
  165. package/packages/cli/dist/commands/workspace.js +1 -0
  166. package/packages/cli/dist/context.d.ts +7 -0
  167. package/packages/cli/dist/context.js +1 -0
  168. package/packages/cli/dist/helpers.d.ts +55 -0
  169. package/packages/cli/dist/helpers.js +5 -0
  170. package/packages/cli/dist/index.d.ts +10 -0
  171. package/packages/cli/dist/index.js +3 -0
  172. package/packages/cli/dist/types.d.ts +9 -0
  173. package/packages/cli/dist/types.js +1 -0
  174. package/packages/core/dist/constants.d.ts +74 -0
  175. package/packages/core/dist/constants.js +1 -0
  176. package/packages/core/dist/content-detector.d.ts +13 -0
  177. package/packages/core/dist/content-detector.js +1 -0
  178. package/packages/core/dist/errors.d.ts +20 -0
  179. package/packages/core/dist/errors.js +1 -0
  180. package/packages/core/dist/global-registry.d.ts +63 -0
  181. package/packages/core/dist/global-registry.js +1 -0
  182. package/packages/core/dist/index.d.ts +7 -0
  183. package/packages/core/dist/index.js +1 -0
  184. package/packages/core/dist/logger.d.ts +32 -0
  185. package/packages/core/dist/logger.js +1 -0
  186. package/packages/core/dist/types.d.ts +133 -0
  187. package/packages/core/dist/types.js +1 -0
  188. package/packages/dashboard/dist/assets/index-BjA4YODs.js +21 -0
  189. package/packages/dashboard/dist/assets/index-BjA4YODs.js.map +1 -0
  190. package/packages/dashboard/dist/assets/index-CHpVij2M.css +1 -0
  191. package/packages/dashboard/dist/index.html +18 -0
  192. package/packages/elicitation/dist/build.d.ts +14 -0
  193. package/packages/elicitation/dist/build.js +1 -0
  194. package/packages/elicitation/dist/fields.d.ts +32 -0
  195. package/packages/elicitation/dist/fields.js +1 -0
  196. package/packages/elicitation/dist/index.d.ts +5 -0
  197. package/packages/elicitation/dist/index.js +1 -0
  198. package/packages/elicitation/dist/normalize.d.ts +15 -0
  199. package/packages/elicitation/dist/normalize.js +1 -0
  200. package/packages/elicitation/dist/types.d.ts +88 -0
  201. package/packages/elicitation/dist/types.js +1 -0
  202. package/packages/embeddings/dist/embedder.interface.d.ts +26 -0
  203. package/packages/embeddings/dist/embedder.interface.js +1 -0
  204. package/packages/embeddings/dist/index.d.ts +3 -0
  205. package/packages/embeddings/dist/index.js +1 -0
  206. package/packages/embeddings/dist/onnx-embedder.d.ts +22 -0
  207. package/packages/embeddings/dist/onnx-embedder.js +1 -0
  208. package/packages/enterprise-bridge/dist/cache.d.ts +28 -0
  209. package/packages/enterprise-bridge/dist/cache.js +1 -0
  210. package/packages/enterprise-bridge/dist/er-client.d.ts +37 -0
  211. package/packages/enterprise-bridge/dist/er-client.js +1 -0
  212. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +62 -0
  213. package/packages/enterprise-bridge/dist/evolution-collector.js +1 -0
  214. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  215. package/packages/enterprise-bridge/dist/index.js +1 -0
  216. package/packages/enterprise-bridge/dist/policy-store.d.ts +45 -0
  217. package/packages/enterprise-bridge/dist/policy-store.js +1 -0
  218. package/packages/enterprise-bridge/dist/push-adapter.d.ts +23 -0
  219. package/packages/enterprise-bridge/dist/push-adapter.js +1 -0
  220. package/packages/enterprise-bridge/dist/result-merger.d.ts +14 -0
  221. package/packages/enterprise-bridge/dist/result-merger.js +1 -0
  222. package/packages/enterprise-bridge/dist/types.d.ts +81 -0
  223. package/packages/enterprise-bridge/dist/types.js +1 -0
  224. package/packages/flows/dist/adapters/claude-plugin.d.ts +12 -0
  225. package/packages/flows/dist/adapters/claude-plugin.js +1 -0
  226. package/packages/flows/dist/adapters/copilot.d.ts +10 -0
  227. package/packages/flows/dist/adapters/copilot.js +1 -0
  228. package/packages/flows/dist/adapters/index.d.ts +11 -0
  229. package/packages/flows/dist/adapters/index.js +1 -0
  230. package/packages/flows/dist/adapters/native.d.ts +10 -0
  231. package/packages/flows/dist/adapters/native.js +1 -0
  232. package/packages/flows/dist/builtins.d.ts +16 -0
  233. package/packages/flows/dist/builtins.js +1 -0
  234. package/packages/flows/dist/foundation.d.ts +20 -0
  235. package/packages/flows/dist/foundation.js +11 -0
  236. package/packages/flows/dist/git.d.ts +34 -0
  237. package/packages/flows/dist/git.js +1 -0
  238. package/packages/flows/dist/index.d.ts +12 -0
  239. package/packages/flows/dist/index.js +1 -0
  240. package/packages/flows/dist/loader.d.ts +13 -0
  241. package/packages/flows/dist/loader.js +2 -0
  242. package/packages/flows/dist/registry.d.ts +23 -0
  243. package/packages/flows/dist/registry.js +1 -0
  244. package/packages/flows/dist/state-machine.d.ts +23 -0
  245. package/packages/flows/dist/state-machine.js +1 -0
  246. package/packages/flows/dist/symlinks.d.ts +17 -0
  247. package/packages/flows/dist/symlinks.js +1 -0
  248. package/packages/flows/dist/types.d.ts +112 -0
  249. package/packages/flows/dist/types.js +1 -0
  250. package/packages/indexer/dist/file-hasher.d.ts +13 -0
  251. package/packages/indexer/dist/file-hasher.js +1 -0
  252. package/packages/indexer/dist/filesystem-crawler.d.ts +29 -0
  253. package/packages/indexer/dist/filesystem-crawler.js +1 -0
  254. package/packages/indexer/dist/graph-extractor.d.ts +18 -0
  255. package/packages/indexer/dist/graph-extractor.js +1 -0
  256. package/packages/indexer/dist/hash-cache.d.ts +24 -0
  257. package/packages/indexer/dist/hash-cache.js +1 -0
  258. package/packages/indexer/dist/incremental-indexer.d.ts +56 -0
  259. package/packages/indexer/dist/incremental-indexer.js +1 -0
  260. package/packages/indexer/dist/index.d.ts +6 -0
  261. package/packages/indexer/dist/index.js +1 -0
  262. package/packages/present/dist/index.html +709 -0
  263. package/packages/server/dist/api.d.ts +3 -0
  264. package/packages/server/dist/api.js +1 -0
  265. package/packages/server/dist/auto-gc.d.ts +30 -0
  266. package/packages/server/dist/auto-gc.js +1 -0
  267. package/packages/server/dist/completions.d.ts +14 -0
  268. package/packages/server/dist/completions.js +1 -0
  269. package/packages/server/dist/config.d.ts +14 -0
  270. package/packages/server/dist/config.js +1 -0
  271. package/packages/server/dist/cross-workspace.d.ts +43 -0
  272. package/packages/server/dist/cross-workspace.js +1 -0
  273. package/packages/server/dist/curated-manager.d.ts +92 -0
  274. package/packages/server/dist/curated-manager.js +5 -0
  275. package/packages/server/dist/dashboard-static.d.ts +27 -0
  276. package/packages/server/dist/dashboard-static.js +1 -0
  277. package/packages/server/dist/elicitor.d.ts +18 -0
  278. package/packages/server/dist/elicitor.js +1 -0
  279. package/packages/server/dist/index.d.ts +1 -0
  280. package/packages/server/dist/index.js +1 -0
  281. package/packages/server/dist/mcp-logging.d.ts +11 -0
  282. package/packages/server/dist/mcp-logging.js +1 -0
  283. package/packages/server/dist/output-schemas.d.ts +242 -0
  284. package/packages/server/dist/output-schemas.js +1 -0
  285. package/packages/server/dist/prompts.d.ts +13 -0
  286. package/packages/server/dist/prompts.js +13 -0
  287. package/packages/server/dist/replay-interceptor.d.ts +23 -0
  288. package/packages/server/dist/replay-interceptor.js +1 -0
  289. package/packages/server/dist/resource-links.d.ts +34 -0
  290. package/packages/server/dist/resource-links.js +1 -0
  291. package/packages/server/dist/resources/curated-resources.d.ts +13 -0
  292. package/packages/server/dist/resources/curated-resources.js +2 -0
  293. package/packages/server/dist/resources/resource-notifier.d.ts +45 -0
  294. package/packages/server/dist/resources/resource-notifier.js +1 -0
  295. package/packages/server/dist/resources/resources.d.ts +8 -0
  296. package/packages/server/dist/resources/resources.js +2 -0
  297. package/packages/server/dist/sampling.d.ts +41 -0
  298. package/packages/server/dist/sampling.js +2 -0
  299. package/packages/server/dist/server.d.ts +47 -0
  300. package/packages/server/dist/server.js +3 -0
  301. package/packages/server/dist/structured-content-guard.d.ts +26 -0
  302. package/packages/server/dist/structured-content-guard.js +1 -0
  303. package/packages/server/dist/task-manager.d.ts +40 -0
  304. package/packages/server/dist/task-manager.js +1 -0
  305. package/packages/server/dist/tool-metadata.d.ts +38 -0
  306. package/packages/server/dist/tool-metadata.js +1 -0
  307. package/packages/server/dist/tool-prefix.d.ts +12 -0
  308. package/packages/server/dist/tool-prefix.js +1 -0
  309. package/packages/server/dist/tools/analyze.tools.d.ts +14 -0
  310. package/packages/server/dist/tools/analyze.tools.js +8 -0
  311. package/packages/server/dist/tools/audit.tool.d.ts +8 -0
  312. package/packages/server/dist/tools/audit.tool.js +1 -0
  313. package/packages/server/dist/tools/brainstorm.tool.d.ts +7 -0
  314. package/packages/server/dist/tools/brainstorm.tool.js +9 -0
  315. package/packages/server/dist/tools/bridge.tools.d.ts +34 -0
  316. package/packages/server/dist/tools/bridge.tools.js +15 -0
  317. package/packages/server/dist/tools/context.tools.d.ts +15 -0
  318. package/packages/server/dist/tools/context.tools.js +10 -0
  319. package/packages/server/dist/tools/evolution.tools.d.ts +7 -0
  320. package/packages/server/dist/tools/evolution.tools.js +5 -0
  321. package/packages/server/dist/tools/execution.tools.d.ts +14 -0
  322. package/packages/server/dist/tools/execution.tools.js +4 -0
  323. package/packages/server/dist/tools/flow.tools.d.ts +7 -0
  324. package/packages/server/dist/tools/flow.tools.js +1 -0
  325. package/packages/server/dist/tools/forge.tools.d.ts +13 -0
  326. package/packages/server/dist/tools/forge.tools.js +10 -0
  327. package/packages/server/dist/tools/forget.tool.d.ts +8 -0
  328. package/packages/server/dist/tools/forget.tool.js +1 -0
  329. package/packages/server/dist/tools/graph.tool.d.ts +7 -0
  330. package/packages/server/dist/tools/graph.tool.js +5 -0
  331. package/packages/server/dist/tools/infra.tools.d.ts +10 -0
  332. package/packages/server/dist/tools/infra.tools.js +5 -0
  333. package/packages/server/dist/tools/list.tool.d.ts +7 -0
  334. package/packages/server/dist/tools/list.tool.js +2 -0
  335. package/packages/server/dist/tools/lookup.tool.d.ts +7 -0
  336. package/packages/server/dist/tools/lookup.tool.js +3 -0
  337. package/packages/server/dist/tools/manipulation.tools.d.ts +10 -0
  338. package/packages/server/dist/tools/manipulation.tools.js +4 -0
  339. package/packages/server/dist/tools/onboard.tool.d.ts +9 -0
  340. package/packages/server/dist/tools/onboard.tool.js +2 -0
  341. package/packages/server/dist/tools/persistence.tools.d.ts +10 -0
  342. package/packages/server/dist/tools/persistence.tools.js +5 -0
  343. package/packages/server/dist/tools/policy.tools.d.ts +7 -0
  344. package/packages/server/dist/tools/policy.tools.js +3 -0
  345. package/packages/server/dist/tools/present/browser.d.ts +4 -0
  346. package/packages/server/dist/tools/present/browser.js +93 -0
  347. package/packages/server/dist/tools/present/helpers.d.ts +18 -0
  348. package/packages/server/dist/tools/present/helpers.js +1 -0
  349. package/packages/server/dist/tools/present/html.d.ts +18 -0
  350. package/packages/server/dist/tools/present/html.js +5 -0
  351. package/packages/server/dist/tools/present/index.d.ts +2 -0
  352. package/packages/server/dist/tools/present/index.js +1 -0
  353. package/packages/server/dist/tools/present/markdown.d.ts +17 -0
  354. package/packages/server/dist/tools/present/markdown.js +8 -0
  355. package/packages/server/dist/tools/present/templates.d.ts +14 -0
  356. package/packages/server/dist/tools/present/templates.js +472 -0
  357. package/packages/server/dist/tools/present/tool.d.ts +27 -0
  358. package/packages/server/dist/tools/present/tool.js +19 -0
  359. package/packages/server/dist/tools/present-blocks.d.ts +46 -0
  360. package/packages/server/dist/tools/present-blocks.js +27 -0
  361. package/packages/server/dist/tools/present-charts.d.ts +31 -0
  362. package/packages/server/dist/tools/present-charts.js +34 -0
  363. package/packages/server/dist/tools/present-theme.d.ts +14 -0
  364. package/packages/server/dist/tools/present-theme.js +395 -0
  365. package/packages/server/dist/tools/present-utils.d.ts +11 -0
  366. package/packages/server/dist/tools/present-utils.js +1 -0
  367. package/packages/server/dist/tools/present.tool.d.ts +2 -0
  368. package/packages/server/dist/tools/present.tool.js +1 -0
  369. package/packages/server/dist/tools/produce.tool.d.ts +7 -0
  370. package/packages/server/dist/tools/produce.tool.js +4 -0
  371. package/packages/server/dist/tools/read.tool.d.ts +7 -0
  372. package/packages/server/dist/tools/read.tool.js +2 -0
  373. package/packages/server/dist/tools/reindex.tool.d.ts +11 -0
  374. package/packages/server/dist/tools/reindex.tool.js +3 -0
  375. package/packages/server/dist/tools/remember.tool.d.ts +9 -0
  376. package/packages/server/dist/tools/remember.tool.js +4 -0
  377. package/packages/server/dist/tools/replay.tool.d.ts +6 -0
  378. package/packages/server/dist/tools/replay.tool.js +3 -0
  379. package/packages/server/dist/tools/restore.tool.d.ts +6 -0
  380. package/packages/server/dist/tools/restore.tool.js +3 -0
  381. package/packages/server/dist/tools/search.tool.d.ts +11 -0
  382. package/packages/server/dist/tools/search.tool.js +10 -0
  383. package/packages/server/dist/tools/status.tool.d.ts +20 -0
  384. package/packages/server/dist/tools/status.tool.js +3 -0
  385. package/packages/server/dist/tools/update.tool.d.ts +8 -0
  386. package/packages/server/dist/tools/update.tool.js +1 -0
  387. package/packages/server/dist/tools/utility.tools.d.ts +15 -0
  388. package/packages/server/dist/tools/utility.tools.js +13 -0
  389. package/packages/server/dist/version-check.d.ts +32 -0
  390. package/packages/server/dist/version-check.js +1 -0
  391. package/packages/store/dist/graph-store.interface.d.ts +118 -0
  392. package/packages/store/dist/graph-store.interface.js +1 -0
  393. package/packages/store/dist/index.d.ts +6 -0
  394. package/packages/store/dist/index.js +1 -0
  395. package/packages/store/dist/lance-store.d.ts +44 -0
  396. package/packages/store/dist/lance-store.js +1 -0
  397. package/packages/store/dist/sqlite-graph-store.d.ts +45 -0
  398. package/packages/store/dist/sqlite-graph-store.js +58 -0
  399. package/packages/store/dist/store-factory.d.ts +12 -0
  400. package/packages/store/dist/store-factory.js +1 -0
  401. package/packages/store/dist/store.interface.d.ts +54 -0
  402. package/packages/store/dist/store.interface.js +1 -0
  403. package/packages/tools/dist/audit.d.ts +65 -0
  404. package/packages/tools/dist/audit.js +6 -0
  405. package/packages/tools/dist/batch.d.ts +23 -0
  406. package/packages/tools/dist/batch.js +1 -0
  407. package/packages/tools/dist/changelog.d.ts +36 -0
  408. package/packages/tools/dist/changelog.js +2 -0
  409. package/packages/tools/dist/check.d.ts +48 -0
  410. package/packages/tools/dist/check.js +2 -0
  411. package/packages/tools/dist/checkpoint.d.ts +19 -0
  412. package/packages/tools/dist/checkpoint.js +1 -0
  413. package/packages/tools/dist/codemod.d.ts +39 -0
  414. package/packages/tools/dist/codemod.js +2 -0
  415. package/packages/tools/dist/compact.d.ts +41 -0
  416. package/packages/tools/dist/compact.js +3 -0
  417. package/packages/tools/dist/config-extractor.d.ts +9 -0
  418. package/packages/tools/dist/config-extractor.js +7 -0
  419. package/packages/tools/dist/data-transform.d.ts +12 -0
  420. package/packages/tools/dist/data-transform.js +1 -0
  421. package/packages/tools/dist/dead-symbols.d.ts +28 -0
  422. package/packages/tools/dist/dead-symbols.js +2 -0
  423. package/packages/tools/dist/delegate.d.ts +36 -0
  424. package/packages/tools/dist/delegate.js +1 -0
  425. package/packages/tools/dist/diagram-builder.d.ts +9 -0
  426. package/packages/tools/dist/diagram-builder.js +9 -0
  427. package/packages/tools/dist/diff-parse.d.ts +28 -0
  428. package/packages/tools/dist/diff-parse.js +3 -0
  429. package/packages/tools/dist/digest.d.ts +50 -0
  430. package/packages/tools/dist/digest.js +6 -0
  431. package/packages/tools/dist/dogfood-log.d.ts +49 -0
  432. package/packages/tools/dist/dogfood-log.js +2 -0
  433. package/packages/tools/dist/encode.d.ts +16 -0
  434. package/packages/tools/dist/encode.js +1 -0
  435. package/packages/tools/dist/env-info.d.ts +30 -0
  436. package/packages/tools/dist/env-info.js +1 -0
  437. package/packages/tools/dist/eval.d.ts +15 -0
  438. package/packages/tools/dist/eval.js +2 -0
  439. package/packages/tools/dist/evidence-map.d.ts +92 -0
  440. package/packages/tools/dist/evidence-map.js +2 -0
  441. package/packages/tools/dist/file-cache.d.ts +41 -0
  442. package/packages/tools/dist/file-cache.js +3 -0
  443. package/packages/tools/dist/file-summary.d.ts +52 -0
  444. package/packages/tools/dist/file-summary.js +2 -0
  445. package/packages/tools/dist/file-walk.d.ts +6 -0
  446. package/packages/tools/dist/file-walk.js +1 -0
  447. package/packages/tools/dist/find-examples.d.ts +29 -0
  448. package/packages/tools/dist/find-examples.js +3 -0
  449. package/packages/tools/dist/find.d.ts +49 -0
  450. package/packages/tools/dist/find.js +1 -0
  451. package/packages/tools/dist/forge-classify.d.ts +44 -0
  452. package/packages/tools/dist/forge-classify.js +2 -0
  453. package/packages/tools/dist/forge-ground.d.ts +61 -0
  454. package/packages/tools/dist/forge-ground.js +1 -0
  455. package/packages/tools/dist/git-context.d.ts +25 -0
  456. package/packages/tools/dist/git-context.js +3 -0
  457. package/packages/tools/dist/graph-query.d.ts +86 -0
  458. package/packages/tools/dist/graph-query.js +1 -0
  459. package/packages/tools/dist/guide.d.ts +25 -0
  460. package/packages/tools/dist/guide.js +1 -0
  461. package/packages/tools/dist/health.d.ts +16 -0
  462. package/packages/tools/dist/health.js +2 -0
  463. package/packages/tools/dist/http-request.d.ts +25 -0
  464. package/packages/tools/dist/http-request.js +1 -0
  465. package/packages/tools/dist/index.d.ts +57 -0
  466. package/packages/tools/dist/index.js +1 -0
  467. package/packages/tools/dist/lane.d.ts +41 -0
  468. package/packages/tools/dist/lane.js +6 -0
  469. package/packages/tools/dist/measure.d.ts +42 -0
  470. package/packages/tools/dist/measure.js +2 -0
  471. package/packages/tools/dist/onboard-utils.d.ts +12 -0
  472. package/packages/tools/dist/onboard-utils.js +1 -0
  473. package/packages/tools/dist/onboard.d.ts +50 -0
  474. package/packages/tools/dist/onboard.js +18 -0
  475. package/packages/tools/dist/parse-output.d.ts +82 -0
  476. package/packages/tools/dist/parse-output.js +2 -0
  477. package/packages/tools/dist/path-resolver.d.ts +14 -0
  478. package/packages/tools/dist/path-resolver.js +1 -0
  479. package/packages/tools/dist/process-manager.d.ts +20 -0
  480. package/packages/tools/dist/process-manager.js +1 -0
  481. package/packages/tools/dist/queue.d.ts +40 -0
  482. package/packages/tools/dist/queue.js +1 -0
  483. package/packages/tools/dist/regex-test.d.ts +33 -0
  484. package/packages/tools/dist/regex-test.js +1 -0
  485. package/packages/tools/dist/regex-utils.d.ts +8 -0
  486. package/packages/tools/dist/regex-utils.js +1 -0
  487. package/packages/tools/dist/rename.d.ts +31 -0
  488. package/packages/tools/dist/rename.js +2 -0
  489. package/packages/tools/dist/replay.d.ts +59 -0
  490. package/packages/tools/dist/replay.js +4 -0
  491. package/packages/tools/dist/response-envelope.d.ts +43 -0
  492. package/packages/tools/dist/response-envelope.js +1 -0
  493. package/packages/tools/dist/restore-points.d.ts +22 -0
  494. package/packages/tools/dist/restore-points.js +1 -0
  495. package/packages/tools/dist/schema-validate.d.ts +25 -0
  496. package/packages/tools/dist/schema-validate.js +1 -0
  497. package/packages/tools/dist/scope-map.d.ts +51 -0
  498. package/packages/tools/dist/scope-map.js +1 -0
  499. package/packages/tools/dist/snippet.d.ts +35 -0
  500. package/packages/tools/dist/snippet.js +1 -0
  501. package/packages/tools/dist/stash.d.ts +14 -0
  502. package/packages/tools/dist/stash.js +1 -0
  503. package/packages/tools/dist/stratum-card.d.ts +30 -0
  504. package/packages/tools/dist/stratum-card.js +4 -0
  505. package/packages/tools/dist/symbol.d.ts +45 -0
  506. package/packages/tools/dist/symbol.js +3 -0
  507. package/packages/tools/dist/synthesis-engine.d.ts +13 -0
  508. package/packages/tools/dist/synthesis-engine.js +6 -0
  509. package/packages/tools/dist/test-run.d.ts +28 -0
  510. package/packages/tools/dist/test-run.js +2 -0
  511. package/packages/tools/dist/text-utils.d.ts +24 -0
  512. package/packages/tools/dist/text-utils.js +2 -0
  513. package/packages/tools/dist/time-utils.d.ts +20 -0
  514. package/packages/tools/dist/time-utils.js +1 -0
  515. package/packages/tools/dist/trace.d.ts +29 -0
  516. package/packages/tools/dist/trace.js +2 -0
  517. package/packages/tools/dist/truncation.d.ts +33 -0
  518. package/packages/tools/dist/truncation.js +7 -0
  519. package/packages/tools/dist/watch.d.ts +32 -0
  520. package/packages/tools/dist/watch.js +1 -0
  521. package/packages/tools/dist/web-fetch.d.ts +47 -0
  522. package/packages/tools/dist/web-fetch.js +8 -0
  523. package/packages/tools/dist/web-search.d.ts +25 -0
  524. package/packages/tools/dist/web-search.js +1 -0
  525. package/packages/tools/dist/workset.d.ts +47 -0
  526. package/packages/tools/dist/workset.js +1 -0
  527. package/packages/tui/dist/App-DU2KEylW.js +2 -0
  528. package/packages/tui/dist/App.d.ts +13 -0
  529. package/packages/tui/dist/App.js +2 -0
  530. package/packages/tui/dist/CuratedPanel-BIamXLNy.js +2 -0
  531. package/packages/tui/dist/LogPanel-Bo8a8QXB.js +3 -0
  532. package/packages/tui/dist/SearchPanel-CpJGczAc.js +2 -0
  533. package/packages/tui/dist/StatusPanel-BAbUxyqQ.js +2 -0
  534. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  535. package/packages/tui/dist/devtools-DMOZMn70.js +7 -0
  536. package/packages/tui/dist/hooks/useKBClient.d.ts +9 -0
  537. package/packages/tui/dist/hooks/useKBClient.js +2 -0
  538. package/packages/tui/dist/hooks/usePolling.d.ts +8 -0
  539. package/packages/tui/dist/hooks/usePolling.js +2 -0
  540. package/packages/tui/dist/index-BXafekwr.d.ts +64 -0
  541. package/packages/tui/dist/index.d.ts +7 -0
  542. package/packages/tui/dist/index.js +2 -0
  543. package/packages/tui/dist/jsx-runtime-y6Gdq5PZ.js +294 -0
  544. package/packages/tui/dist/panels/CuratedPanel.d.ts +7 -0
  545. package/packages/tui/dist/panels/CuratedPanel.js +2 -0
  546. package/packages/tui/dist/panels/LogPanel.d.ts +7 -0
  547. package/packages/tui/dist/panels/LogPanel.js +2 -0
  548. package/packages/tui/dist/panels/SearchPanel.d.ts +7 -0
  549. package/packages/tui/dist/panels/SearchPanel.js +2 -0
  550. package/packages/tui/dist/panels/StatusPanel.d.ts +7 -0
  551. package/packages/tui/dist/panels/StatusPanel.js +2 -0
  552. package/packages/tui/dist/react-D__J1GQe.js +24 -0
  553. package/packages/tui/dist/useKBClient-C35iA4uG.js +2 -0
  554. package/packages/tui/dist/usePolling-BbjnRWgx.js +2 -0
  555. package/scaffold/README.md +192 -0
  556. package/scaffold/adapters/claude-code.mjs +56 -0
  557. package/scaffold/adapters/copilot.mjs +270 -0
  558. package/scaffold/definitions/agents.mjs +189 -0
  559. package/scaffold/definitions/bodies.mjs +487 -0
  560. package/scaffold/definitions/hooks.mjs +43 -0
  561. package/scaffold/definitions/models.mjs +56 -0
  562. package/scaffold/definitions/plugins.mjs +38 -0
  563. package/scaffold/definitions/prompts.mjs +145 -0
  564. package/scaffold/definitions/protocols.mjs +679 -0
  565. package/scaffold/definitions/tools.mjs +229 -0
  566. package/scaffold/flows/aikit-advanced/flow.json +60 -0
  567. package/scaffold/flows/aikit-advanced/skills/execute/SKILL.md +124 -0
  568. package/scaffold/flows/aikit-advanced/skills/plan/SKILL.md +100 -0
  569. package/scaffold/flows/aikit-advanced/skills/spec/SKILL.md +100 -0
  570. package/scaffold/flows/aikit-advanced/skills/task/SKILL.md +99 -0
  571. package/scaffold/flows/aikit-advanced/skills/verify/SKILL.md +122 -0
  572. package/scaffold/flows/aikit-basic/flow.json +36 -0
  573. package/scaffold/flows/aikit-basic/skills/assess/SKILL.md +82 -0
  574. package/scaffold/flows/aikit-basic/skills/implement/SKILL.md +105 -0
  575. package/scaffold/flows/aikit-basic/skills/verify/SKILL.md +96 -0
  576. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  577. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +21 -0
  578. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +12 -0
  579. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +12 -0
  580. package/scaffold/general/agents/Debugger.agent.md +34 -0
  581. package/scaffold/general/agents/Documenter.agent.md +53 -0
  582. package/scaffold/general/agents/Explorer.agent.md +63 -0
  583. package/scaffold/general/agents/Frontend.agent.md +29 -0
  584. package/scaffold/general/agents/Implementer.agent.md +33 -0
  585. package/scaffold/general/agents/Orchestrator.agent.md +149 -0
  586. package/scaffold/general/agents/Planner.agent.md +79 -0
  587. package/scaffold/general/agents/README.md +57 -0
  588. package/scaffold/general/agents/Refactor.agent.md +36 -0
  589. package/scaffold/general/agents/Researcher-Alpha.agent.md +20 -0
  590. package/scaffold/general/agents/Researcher-Beta.agent.md +20 -0
  591. package/scaffold/general/agents/Researcher-Delta.agent.md +20 -0
  592. package/scaffold/general/agents/Researcher-Gamma.agent.md +20 -0
  593. package/scaffold/general/agents/Security.agent.md +55 -0
  594. package/scaffold/general/agents/_shared/architect-reviewer-base.md +60 -0
  595. package/scaffold/general/agents/_shared/code-agent-base.md +262 -0
  596. package/scaffold/general/agents/_shared/code-reviewer-base.md +64 -0
  597. package/scaffold/general/agents/_shared/decision-protocol.md +27 -0
  598. package/scaffold/general/agents/_shared/forge-protocol.md +90 -0
  599. package/scaffold/general/agents/_shared/researcher-base.md +101 -0
  600. package/scaffold/general/agents/templates/adr-template.md +28 -0
  601. package/scaffold/general/agents/templates/execution-state.md +26 -0
  602. package/scaffold/general/prompts/ask.prompt.md +21 -0
  603. package/scaffold/general/prompts/debug.prompt.md +25 -0
  604. package/scaffold/general/prompts/design.prompt.md +23 -0
  605. package/scaffold/general/prompts/implement.prompt.md +26 -0
  606. package/scaffold/general/prompts/plan.prompt.md +25 -0
  607. package/scaffold/general/prompts/review.prompt.md +32 -0
  608. package/scaffold/general/skills/adr-skill/SKILL.md +329 -0
  609. package/scaffold/general/skills/adr-skill/assets/templates/adr-madr.md +89 -0
  610. package/scaffold/general/skills/adr-skill/assets/templates/adr-readme.md +20 -0
  611. package/scaffold/general/skills/adr-skill/assets/templates/adr-simple.md +46 -0
  612. package/scaffold/general/skills/adr-skill/references/adr-conventions.md +95 -0
  613. package/scaffold/general/skills/adr-skill/references/examples.md +193 -0
  614. package/scaffold/general/skills/adr-skill/references/review-checklist.md +77 -0
  615. package/scaffold/general/skills/adr-skill/references/template-variants.md +52 -0
  616. package/scaffold/general/skills/adr-skill/scripts/bootstrap_adr.js +259 -0
  617. package/scaffold/general/skills/adr-skill/scripts/new_adr.js +391 -0
  618. package/scaffold/general/skills/adr-skill/scripts/set_adr_status.js +169 -0
  619. package/scaffold/general/skills/aikit/SKILL.md +521 -0
  620. package/scaffold/general/skills/brainstorming/SKILL.md +259 -0
  621. package/scaffold/general/skills/brainstorming/scripts/frame-template.html +365 -0
  622. package/scaffold/general/skills/brainstorming/scripts/helper.js +216 -0
  623. package/scaffold/general/skills/brainstorming/scripts/server.cjs +9 -0
  624. package/scaffold/general/skills/brainstorming/scripts/server.src.cjs +249 -0
  625. package/scaffold/general/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  626. package/scaffold/general/skills/brainstorming/visual-companion.md +430 -0
  627. package/scaffold/general/skills/c4-architecture/SKILL.md +295 -0
  628. package/scaffold/general/skills/c4-architecture/references/advanced-patterns.md +552 -0
  629. package/scaffold/general/skills/c4-architecture/references/c4-syntax.md +492 -0
  630. package/scaffold/general/skills/c4-architecture/references/common-mistakes.md +437 -0
  631. package/scaffold/general/skills/lesson-learned/SKILL.md +105 -0
  632. package/scaffold/general/skills/lesson-learned/references/anti-patterns.md +55 -0
  633. package/scaffold/general/skills/lesson-learned/references/se-principles.md +109 -0
  634. package/scaffold/general/skills/multi-agents-development/SKILL.md +435 -0
  635. package/scaffold/general/skills/multi-agents-development/architecture-review-prompt.md +81 -0
  636. package/scaffold/general/skills/multi-agents-development/code-quality-review-prompt.md +91 -0
  637. package/scaffold/general/skills/multi-agents-development/implementer-prompt.md +93 -0
  638. package/scaffold/general/skills/multi-agents-development/parallel-dispatch-example.md +167 -0
  639. package/scaffold/general/skills/multi-agents-development/spec-review-prompt.md +81 -0
  640. package/scaffold/general/skills/present/SKILL.md +424 -0
  641. package/scaffold/general/skills/requirements-clarity/SKILL.md +324 -0
  642. package/scaffold/general/skills/session-handoff/SKILL.md +189 -0
  643. package/scaffold/general/skills/session-handoff/references/handoff-template.md +139 -0
  644. package/scaffold/general/skills/session-handoff/references/resume-checklist.md +80 -0
  645. package/scaffold/general/skills/session-handoff/scripts/check_staleness.js +269 -0
  646. package/scaffold/general/skills/session-handoff/scripts/create_handoff.js +299 -0
  647. package/scaffold/general/skills/session-handoff/scripts/list_handoffs.js +113 -0
  648. package/scaffold/general/skills/session-handoff/scripts/validate_handoff.js +241 -0
  649. package/scaffold/generate.mjs +82 -0
@@ -0,0 +1,54 @@
1
+ import { ContentType, IndexStats, KnowledgeOrigin, KnowledgeRecord, SearchResult, SourceType } from "../../core/dist/index.js";
2
+
3
+ //#region packages/store/src/store.interface.d.ts
4
+ /** Options for searching the store */
5
+ interface SearchOptions {
6
+ /** Maximum number of results to return */
7
+ limit?: number;
8
+ /** Minimum similarity score (0-1) */
9
+ minScore?: number;
10
+ /** Filter by content type */
11
+ contentType?: ContentType;
12
+ /** Filter by coarse source type (source, documentation, test, config, generated) */
13
+ sourceType?: SourceType;
14
+ /** Filter by origin */
15
+ origin?: KnowledgeOrigin;
16
+ /** Filter by category */
17
+ category?: string;
18
+ /** Filter by tags (any match) */
19
+ tags?: string[];
20
+ }
21
+ interface IKnowledgeStore {
22
+ /** Initialize the store (create tables, etc.) */
23
+ initialize(): Promise<void>;
24
+ /** Add or update records with their embedding vectors */
25
+ upsert(records: KnowledgeRecord[], vectors: Float32Array[]): Promise<void>;
26
+ /** Add or update records with priority over bulk indexing writes */
27
+ upsertInteractive(records: KnowledgeRecord[], vectors: Float32Array[]): Promise<void>;
28
+ /** Search by vector similarity */
29
+ search(queryVector: Float32Array, options?: SearchOptions): Promise<SearchResult[]>;
30
+ /** Get a specific record by ID */
31
+ getById(id: string): Promise<KnowledgeRecord | null>;
32
+ /** Delete records by source path (used during re-indexing) */
33
+ deleteBySourcePath(sourcePath: string): Promise<number>;
34
+ /** Delete a specific record by ID */
35
+ deleteById(id: string): Promise<boolean>;
36
+ /** Delete a specific record by ID with priority over bulk indexing writes */
37
+ deleteByIdInteractive(id: string): Promise<boolean>;
38
+ /** Get all records for a source path */
39
+ getBySourcePath(sourcePath: string): Promise<KnowledgeRecord[]>;
40
+ /** Get index statistics */
41
+ getStats(): Promise<IndexStats>;
42
+ /** List all unique source paths in the store */
43
+ listSourcePaths(): Promise<string[]>;
44
+ /** Create a full-text search index on the content column for keyword search */
45
+ createFtsIndex(): Promise<void>;
46
+ /** Full-text keyword search (requires FTS index) */
47
+ ftsSearch(query: string, options?: SearchOptions): Promise<SearchResult[]>;
48
+ /** Drop the backing table entirely — used for hard resets (e.g. dimension changes) */
49
+ dropTable(): Promise<void>;
50
+ /** Close the store connection */
51
+ close(): Promise<void>;
52
+ }
53
+ //#endregion
54
+ export { IKnowledgeStore, SearchOptions };
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,65 @@
1
+ import { KBResponse } from "./response-envelope.js";
2
+ import { IEmbedder } from "../../embeddings/dist/index.js";
3
+ import { IKnowledgeStore } from "../../store/dist/index.js";
4
+
5
+ //#region packages/tools/src/audit.d.ts
6
+ type AuditCheck = 'structure' | 'dependencies' | 'patterns' | 'health' | 'dead_symbols' | 'check' | 'entry_points';
7
+ interface AuditOptions {
8
+ /** Root path to audit (default: cwd) */
9
+ path?: string;
10
+ /** Which checks to run (default: all) */
11
+ checks?: AuditCheck[];
12
+ /** Detail level (default: 'summary') */
13
+ detail?: 'summary' | 'full';
14
+ }
15
+ interface AuditRecommendation {
16
+ priority: 'high' | 'medium' | 'low';
17
+ area: string;
18
+ message: string;
19
+ }
20
+ interface AuditData {
21
+ score: number;
22
+ structure?: {
23
+ files: number;
24
+ packages: number;
25
+ languages: Record<string, number>;
26
+ };
27
+ dependencies?: {
28
+ external: number;
29
+ internal: number;
30
+ };
31
+ patterns?: Array<{
32
+ name: string;
33
+ confidence: string;
34
+ count: number;
35
+ }>;
36
+ health?: {
37
+ score: number;
38
+ checks: number;
39
+ passed: number;
40
+ warned: number;
41
+ failed: number;
42
+ };
43
+ deadSymbols?: {
44
+ source: number;
45
+ docs: number;
46
+ };
47
+ entryPoints?: {
48
+ total: number;
49
+ types: Record<string, number>;
50
+ };
51
+ typecheck?: {
52
+ passed: boolean;
53
+ errorCount: number;
54
+ topErrors: string[];
55
+ };
56
+ lint?: {
57
+ passed: boolean;
58
+ errorCount: number;
59
+ topErrors: string[];
60
+ };
61
+ recommendations: AuditRecommendation[];
62
+ }
63
+ declare function audit(store: IKnowledgeStore, embedder: IEmbedder, options?: AuditOptions): Promise<KBResponse<AuditData>>;
64
+ //#endregion
65
+ export { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit };
@@ -0,0 +1,6 @@
1
+ import{check as e,summarizeCheckResult as t}from"./check.js";import{findDeadSymbols as n}from"./dead-symbols.js";import{health as r}from"./health.js";import{resolvePath as i}from"./path-resolver.js";import{errorResponse as a,okResponse as o}from"./response-envelope.js";import{DependencyAnalyzer as s,EntryPointAnalyzer as c,PatternAnalyzer as l,StructureAnalyzer as u}from"../../analyzers/dist/index.js";const d=[`structure`,`dependencies`,`patterns`,`health`,`dead_symbols`,`check`,`entry_points`];async function f(f,m,h={}){let g=Date.now(),_=i(h.path),v=h.checks??d,y=h.detail??`summary`,b=[],x={score:100,recommendations:b};try{let i=[];v.includes(`structure`)&&i.push((async()=>{let e=await new u().analyze(_,{format:`json`}),t=e.data;x.structure={files:t.stats?.totalFiles??e.meta.fileCount,packages:Array.isArray(t.packages)?t.packages.length:0,languages:t.stats?.languages??{}}})()),v.includes(`dependencies`)&&i.push((async()=>{let e=(await new s().analyze(_)).data,t=e.imports??[];x.dependencies={external:e.external?.length??t.filter(e=>e.isExternal).length,internal:e.internal?.length??t.filter(e=>!e.isExternal).length}})()),v.includes(`patterns`)&&i.push((async()=>{x.patterns=((await new l().analyze(_)).data.patterns??[]).map(e=>({name:e.pattern,confidence:e.confidence,count:e.locations.length}))})()),v.includes(`entry_points`)&&i.push((async()=>{let e=(await new c().analyze(_)).data,t=e.entryPoints??[],n={};for(let e of t)n[e.type]=(n[e.type]??0)+1;x.entryPoints={total:e.total??t.length,types:n}})()),v.includes(`health`)&&i.push((async()=>{let e=r(_);x.health={score:e.score,checks:e.checks.length,passed:e.checks.filter(e=>e.status===`pass`).length,warned:e.checks.filter(e=>e.status===`warn`).length,failed:e.checks.filter(e=>e.status===`fail`).length},e.score<70&&b.push({priority:`medium`,area:`health`,message:`Health score ${e.score}/100 — ${x.health.failed} failed checks`})})()),v.includes(`dead_symbols`)&&i.push((async()=>{let e=await n(m,f,{rootPath:_});x.deadSymbols={source:e.totalDeadSource,docs:e.totalDeadDocs},e.totalDeadSource>0&&b.push({priority:e.totalDeadSource>10?`high`:`medium`,area:`dead-code`,message:`${e.totalDeadSource} unused exports in source files`})})()),v.includes(`check`)&&i.push((async()=>{let n=t(await e({cwd:_}));x.typecheck={passed:n.tsc.passed,errorCount:n.tsc.errorCount,topErrors:n.tsc.topErrors},x.lint={passed:n.biome.passed,errorCount:n.biome.errorCount,topErrors:n.biome.topErrors},n.tsc.passed||b.push({priority:`high`,area:`type-safety`,message:`Fix ${n.tsc.errorCount} tsc error(s)`}),n.biome.passed||b.push({priority:`medium`,area:`lint`,message:`Fix ${n.biome.errorCount} lint error(s)`})})()),await Promise.all(i);let a=0;x.typecheck&&!x.typecheck.passed&&(a+=15),x.lint&&!x.lint.passed&&(a+=5),x.health&&x.health.score<80&&(a+=10),x.deadSymbols&&x.deadSymbols.source>10&&(a+=5),x.entryPoints&&x.entryPoints.total===0&&(a+=5),x.score=Math.max(0,100-a);let d={high:0,medium:1,low:2};b.sort((e,t)=>d[e.priority]-d[t.priority]);let h=p(x,y),S=[];return x.typecheck&&!x.typecheck.passed&&S.push({tool:`check`,reason:`Get full error details`,suggested_args:{detail:`errors`}}),x.deadSymbols&&x.deadSymbols.source>0&&S.push({tool:`dead_symbols`,reason:`See which exports are unused`,suggested_args:{root_path:_}}),o(`audit`,h,x,{durationMs:Date.now()-g,detail:y},S)}catch(e){return a(`audit`,{code:`ANALYSIS_FAILED`,category:`runtime`,retryable:!1,message:`Audit failed: ${e instanceof Error?e.message:String(e)}`},Date.now()-g)}}function p(e,t){let n=[];if(n.push(`## Audit Report — Score: ${e.score}/100\n`),e.structure&&n.push(`**Structure:** ${e.structure.files} files, ${e.structure.packages} packages, ${Object.keys(e.structure.languages).length} languages`),e.entryPoints){let t=Object.entries(e.entryPoints.types).map(([e,t])=>`${t} ${e}`).join(`, `);n.push(`**Entry Points:** ${e.entryPoints.total} (${t||`none`})`)}if(e.dependencies&&n.push(`**Dependencies:** ${e.dependencies.external} external, ${e.dependencies.internal} internal`),e.health&&n.push(`**Health:** ${e.health.score}/100 (${e.health.passed}✓ ${e.health.warned}⚠ ${e.health.failed}✗)`),e.deadSymbols&&n.push(`**Dead Symbols:** ${e.deadSymbols.source} in source (actionable), ${e.deadSymbols.docs} in docs`),e.typecheck){let t=e.typecheck.passed?`✓ passed`:`✗ ${e.typecheck.errorCount} errors`;n.push(`**Typecheck:** ${t}`)}if(e.lint){let t=e.lint.passed?`✓ passed`:`✗ ${e.lint.errorCount} errors`;n.push(`**Lint:** ${t}`)}if(e.recommendations.length>0){n.push(`
2
+ ### Recommendations
3
+ `);for(let t of e.recommendations){let e=t.priority===`high`?`🔴`:t.priority===`medium`?`🟡`:`🟢`;n.push(`${e} **${t.area}:** ${t.message}`)}}if(t===`full`&&e.patterns&&e.patterns.length>0){n.push(`
4
+ ### Patterns Detected
5
+ `),n.push(`| Pattern | Confidence | Count |`),n.push(`|---------|-----------|-------|`);for(let t of e.patterns)n.push(`| ${t.name} | ${t.confidence} | ${t.count} |`)}return n.join(`
6
+ `)}export{f as audit};
@@ -0,0 +1,23 @@
1
+ //#region packages/tools/src/batch.d.ts
2
+ interface BatchOperation {
3
+ /** Unique ID for this operation */
4
+ id: string;
5
+ /** Operation type */
6
+ type: string;
7
+ /** Arguments for the operation */
8
+ args: Record<string, unknown>;
9
+ }
10
+ interface BatchResult {
11
+ id: string;
12
+ status: 'success' | 'error';
13
+ result?: unknown;
14
+ error?: string;
15
+ durationMs: number;
16
+ }
17
+ interface BatchOptions {
18
+ /** Max concurrent operations (default: 4) */
19
+ concurrency?: number;
20
+ }
21
+ declare function batch(operations: BatchOperation[], executor: (op: BatchOperation) => Promise<unknown>, options?: BatchOptions): Promise<BatchResult[]>;
22
+ //#endregion
23
+ export { BatchOperation, BatchOptions, BatchResult, batch };
@@ -0,0 +1 @@
1
+ async function e(e,t,n={}){let r=Math.max(1,n.concurrency??4),i=[],a=[...e];async function o(e){let n=Date.now();try{let r=await t(e);return{id:e.id,status:`success`,result:r,durationMs:Date.now()-n}}catch(t){return{id:e.id,status:`error`,error:t instanceof Error?t.message:String(t),durationMs:Date.now()-n}}}for(;a.length>0;){let e=a.splice(0,r),t=await Promise.allSettled(e.map(e=>o(e)));for(let n=0;n<t.length;n++){let r=t[n];if(r.status===`fulfilled`){i.push(r.value);continue}i.push({id:e[n]?.id??`unknown`,status:`error`,error:r.reason instanceof Error?r.reason.message:`Promise rejected`,durationMs:0})}}return i}export{e as batch};
@@ -0,0 +1,36 @@
1
+ //#region packages/tools/src/changelog.d.ts
2
+ /**
3
+ * aikit_changelog — Generate a changelog from git history.
4
+ */
5
+ type ChangelogFormat = 'grouped' | 'chronological' | 'per-scope';
6
+ interface ChangelogOptions {
7
+ from: string;
8
+ to?: string;
9
+ format?: ChangelogFormat;
10
+ includeBreaking?: boolean;
11
+ cwd?: string;
12
+ }
13
+ interface ChangelogEntry {
14
+ hash: string;
15
+ type: string;
16
+ scope: string;
17
+ subject: string;
18
+ body: string;
19
+ author: string;
20
+ date: string;
21
+ breaking: boolean;
22
+ }
23
+ interface ChangelogResult {
24
+ entries: ChangelogEntry[];
25
+ markdown: string;
26
+ stats: {
27
+ total: number;
28
+ breaking: number;
29
+ types: Record<string, number>;
30
+ };
31
+ }
32
+ declare function changelog(options: ChangelogOptions): ChangelogResult;
33
+ /** Exported for testing */
34
+ declare function formatChangelog(entries: ChangelogEntry[], format: ChangelogFormat, includeBreaking: boolean): string;
35
+ //#endregion
36
+ export { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog };
@@ -0,0 +1,2 @@
1
+ import{execFileSync as e}from"node:child_process";const t=/^[a-zA-Z0-9_./\-~^@{}]+$/;function n(n){let{from:i,to:a=`HEAD`,format:o=`grouped`,includeBreaking:s=!0,cwd:c=process.cwd()}=n;if(!t.test(i))throw Error(`Invalid git ref: ${i}`);if(!t.test(a))throw Error(`Invalid git ref: ${a}`);let l;try{l=e(`git`,[`log`,`${i}..${a}`,`--format=%H%s%b%an%ai`],{cwd:c,encoding:`utf8`,maxBuffer:10*1024*1024,timeout:3e4})}catch{throw Error(`Git log failed. Ensure "${i}" and "${a}" are valid refs.`)}let u=l.split(``).map(e=>e.trim()).filter(Boolean).map(e=>{let[t=``,n=``,r=``,i=``,a=``]=e.split(``),o=n.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:t.slice(0,8),type:o?.[1]??`other`,scope:o?.[2]??``,subject:o?.[4]??n,body:r.trim(),author:i.trim(),date:a.trim().split(` `)[0],breaking:!!(o?.[3]||/BREAKING[\s-]CHANGE/i.test(r))}}),d={},f=0;for(let e of u)d[e.type]=(d[e.type]??0)+1,e.breaking&&f++;return{entries:u,markdown:r(u,o,s),stats:{total:u.length,breaking:f,types:d}}}function r(e,t,n){let r=[`# Changelog`,``];if(n){let t=e.filter(e=>e.breaking);if(t.length>0){r.push(`## Breaking Changes`,``);for(let e of t)r.push(`- ${e.subject} (${e.hash})`);r.push(``)}}if(t===`grouped`){let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);let n=[`feat`,`fix`,`refactor`,`perf`,`test`,`docs`,`chore`],i={feat:`Features`,fix:`Bug Fixes`,refactor:`Refactoring`,perf:`Performance`,test:`Tests`,docs:`Documentation`,chore:`Chores`,other:`Other`};for(let e of[...n,...Object.keys(t).filter(e=>!n.includes(e))])if(t[e]?.length){r.push(`## ${i[e]??e}`,``);for(let n of t[e]){let e=n.scope?`**${n.scope}:** `:``;r.push(`- ${e}${n.subject} (${n.hash})`)}r.push(``)}}else if(t===`chronological`)for(let t of e){let e=t.scope?`(${t.scope}) `:``;r.push(`- \`${t.date}\` ${t.type}: ${e}${t.subject} (${t.hash})`)}else{let t={};for(let n of e){let e=n.scope||`general`;t[e]||(t[e]=[]),t[e].push(n)}for(let[e,n]of Object.entries(t)){r.push(`## ${e}`,``);for(let e of n)r.push(`- ${e.type}: ${e.subject} (${e.hash})`);r.push(``)}}return r.join(`
2
+ `)}export{n as changelog,r as formatChangelog};
@@ -0,0 +1,48 @@
1
+ import { ParsedError } from "./parse-output.js";
2
+
3
+ //#region packages/tools/src/check.d.ts
4
+ interface CheckOptions {
5
+ /** Specific files to check (if empty, checks all) */
6
+ files?: string[];
7
+ /** Working directory */
8
+ cwd?: string;
9
+ /** Skip typecheck */
10
+ skipTypes?: boolean;
11
+ /** Skip lint */
12
+ skipLint?: boolean;
13
+ /** Detail level: summary (default, minimal), errors (parsed errors), full (includes raw) */
14
+ detail?: 'summary' | 'errors' | 'full';
15
+ }
16
+ interface CheckSummaryResult {
17
+ passed: boolean;
18
+ tsc: {
19
+ passed: boolean;
20
+ errorCount: number;
21
+ warningCount: number;
22
+ topErrors: string[];
23
+ };
24
+ biome: {
25
+ passed: boolean;
26
+ errorCount: number;
27
+ warningCount: number;
28
+ topErrors: string[];
29
+ };
30
+ }
31
+ interface CheckResult {
32
+ tsc: {
33
+ errors: ParsedError[];
34
+ passed: boolean;
35
+ raw?: string;
36
+ };
37
+ biome: {
38
+ errors: ParsedError[];
39
+ passed: boolean;
40
+ raw?: string;
41
+ };
42
+ passed: boolean;
43
+ }
44
+ declare function check(options?: CheckOptions): Promise<CheckResult>;
45
+ /** Produce a minimal summary for LLM consumption (~300 tokens) */
46
+ declare function summarizeCheckResult(result: CheckResult): CheckSummaryResult;
47
+ //#endregion
48
+ export { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult };
@@ -0,0 +1,2 @@
1
+ import{parseBiome as e,parseTsc as t}from"./parse-output.js";import{exec as n}from"node:child_process";import{readFile as r}from"node:fs/promises";import{join as i}from"node:path";import{promisify as a}from"node:util";const o=a(n);let s=0;function c(e){let t=e;return[t.stdout?.toString()??``,t.stderr?.toString()??``].filter(Boolean).join(`
2
+ `).trim()||t.message||`Command failed`}async function l(e={}){if(s>=2)throw Error(`Too many concurrent check runs (max 2). Try again later.`);s++;try{return await u(e)}finally{s--}}async function u(n){let a=n.cwd??process.cwd(),s={errors:[],passed:!0,raw:``},l={errors:[],passed:!0,raw:``};if(!n.skipTypes)try{let e=i(a,`package.json`),t=!1;try{t=!!JSON.parse(await r(e,`utf-8`)).scripts?.typecheck}catch{}if(t&&!n.files?.length)await o(`npx turbo run typecheck`,{cwd:a,timeout:12e4});else{let e=[`--noEmit`];n.files?.length&&e.push(...n.files),await o(`npx tsc ${e.join(` `)}`,{cwd:a,timeout:12e4})}}catch(e){s.raw=c(e),s.errors=t(s.raw),s.passed=s.errors.length===0}if(!n.skipLint)try{let e=[`check`];n.files?.length&&e.push(...n.files),await o(`npx biome ${e.join(` `)}`,{cwd:a,timeout:12e4})}catch(t){l.raw=c(t),l.errors=e(l.raw),l.passed=l.errors.length===0}let u=n.detail??`errors`,d={tsc:s,biome:l,passed:s.passed&&l.passed};return u===`full`?d:{tsc:{errors:s.errors,passed:s.passed},biome:{errors:l.errors,passed:l.passed},passed:d.passed}}function d(e){let t=e.tsc.errors.filter(e=>e.severity===`error`),n=e.tsc.errors.filter(e=>e.severity===`warning`),r=e.biome.errors.filter(e=>e.severity===`error`),i=e.biome.errors.filter(e=>e.severity===`warning`);return{passed:e.passed,tsc:{passed:e.tsc.passed,errorCount:t.length,warningCount:n.length,topErrors:t.slice(0,3).map(e=>`${e.file}:${e.line} — ${e.message}`)},biome:{passed:e.biome.passed,errorCount:r.length,warningCount:i.length,topErrors:r.slice(0,3).map(e=>`${e.file}:${e.line} — ${e.message}`)}}}export{l as check,d as summarizeCheckResult};
@@ -0,0 +1,19 @@
1
+ //#region packages/tools/src/checkpoint.d.ts
2
+ interface Checkpoint {
3
+ id: string;
4
+ label: string;
5
+ createdAt: string;
6
+ data: Record<string, unknown>;
7
+ files?: string[];
8
+ notes?: string;
9
+ }
10
+ declare function checkpointSave(label: string, data: Record<string, unknown>, options?: {
11
+ files?: string[];
12
+ notes?: string;
13
+ cwd?: string;
14
+ }): Checkpoint;
15
+ declare function checkpointLoad(id: string, cwd?: string): Checkpoint | undefined;
16
+ declare function checkpointList(cwd?: string): Checkpoint[];
17
+ declare function checkpointLatest(cwd?: string): Checkpoint | undefined;
18
+ //#endregion
19
+ export { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave };
@@ -0,0 +1 @@
1
+ import{resolve as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,writeFileSync as a}from"node:fs";import{AIKIT_PATHS as o}from"../../core/dist/index.js";const s=`${o.state}/checkpoints`;function c(r){let i=e(r??process.cwd(),s);return t(i)||n(i,{recursive:!0}),i}function l(t,n,r){let i=t.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`checkpoint`,o={id:`${Date.now()}-${i}`,label:t,createdAt:new Date().toISOString(),data:n,files:r?.files,notes:r?.notes};return a(e(c(r?.cwd),`${o.id}.json`),`${JSON.stringify(o,null,2)}\n`,`utf-8`),o}function u(n,i){let a=c(i),o=e(a,`${n}.json`);if(o.startsWith(e(a))&&t(o))try{return JSON.parse(r(o,`utf-8`))}catch{return}}function d(t){let n=c(t);return i(n).filter(e=>e.endsWith(`.json`)).flatMap(t=>{try{return[JSON.parse(r(e(n,t),`utf-8`))]}catch{return[]}}).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function f(e){return d(e)[0]}export{f as checkpointLatest,d as checkpointList,u as checkpointLoad,l as checkpointSave};
@@ -0,0 +1,39 @@
1
+ //#region packages/tools/src/codemod.d.ts
2
+ interface CodemodRule {
3
+ /** Description of what this rule does */
4
+ description: string;
5
+ /** Regex pattern to match (string form, will be compiled) */
6
+ pattern: string;
7
+ /** Replacement string (supports $1, $2 capture groups) */
8
+ replacement: string;
9
+ /** Optional: only apply to files matching this glob */
10
+ fileFilter?: string;
11
+ }
12
+ interface CodemodOptions {
13
+ /** Root directory to apply codemod in */
14
+ rootPath: string;
15
+ /** Rules to apply */
16
+ rules: CodemodRule[];
17
+ /** File extensions to process */
18
+ extensions?: string[];
19
+ /** Exclude patterns */
20
+ exclude?: string[];
21
+ /** Dry run */
22
+ dryRun?: boolean;
23
+ }
24
+ interface CodemodChange {
25
+ rule: string;
26
+ path: string;
27
+ line: number;
28
+ before: string;
29
+ after: string;
30
+ }
31
+ interface CodemodResult {
32
+ changes: CodemodChange[];
33
+ rulesApplied: number;
34
+ filesModified: number;
35
+ dryRun: boolean;
36
+ }
37
+ declare function codemod(options: CodemodOptions): Promise<CodemodResult>;
38
+ //#endregion
39
+ export { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod };
@@ -0,0 +1,2 @@
1
+ import{DEFAULT_TOOL_EXTENSIONS as e,matchesGlobPattern as t,walkFiles as n}from"./file-walk.js";import{createRestorePoint as r}from"./restore-points.js";import{readFile as i,writeFile as a}from"node:fs/promises";import{relative as o}from"node:path";function s(e){return e.replace(/\\/g,`/`)}async function c(c){let{rootPath:l,rules:u,extensions:d=e,exclude:f=[],dryRun:p=!1}=c,m=u.map(e=>({...e,regex:new RegExp(e.pattern,`g`)})),h=await n(l,d,f),g=[],_=new Set,v=0,y=[];for(let e of h){let n=s(o(l,e)),r=await i(e,`utf-8`),c=r.split(/\r?\n/),u=!1;for(let[e,r]of m.entries())if(!(r.fileFilter&&!t(n,r.fileFilter)))for(let t=0;t<c.length;t++){let i=c[t];r.regex.lastIndex=0;let a=i.replace(r.regex,r.replacement);i!==a&&(c[t]=a,u=!0,_.add(e),g.push({rule:r.description,path:n,line:t+1,before:i,after:a}))}u&&(v+=1,p||(y.push({path:e,content:r}),await a(e,c.join(`
2
+ `),`utf-8`)))}return!p&&y.length>0&&r(`codemod`,y,`codemod: ${u.length} rules, ${v} files`),{changes:g,rulesApplied:_.size,filesModified:v,dryRun:p}}export{c as codemod};
@@ -0,0 +1,41 @@
1
+ import { FileCache } from "./file-cache.js";
2
+ import { IEmbedder } from "../../embeddings/dist/index.js";
3
+
4
+ //#region packages/tools/src/compact.d.ts
5
+ interface CompactOptions {
6
+ /** The text to compress (at least one of text/path required) */
7
+ text?: string;
8
+ /** File path to read server-side — avoids read_file round-trip (at least one of text/path required) */
9
+ path?: string;
10
+ /** The focus query — what are we trying to understand? */
11
+ query: string;
12
+ /** Target output size in characters (default: 3000) */
13
+ maxChars?: number;
14
+ /** Token budget — when set, overrides maxChars (approx 4 chars per token) */
15
+ tokenBudget?: number;
16
+ /** Minimum similarity score to include a segment (0-1, default: 0.3) */
17
+ minScore?: number;
18
+ /** Segmentation strategy (default: 'paragraph') */
19
+ segmentation?: 'paragraph' | 'sentence' | 'line';
20
+ /** Optional file cache — use cached content instead of raw readFile */
21
+ cache?: FileCache;
22
+ }
23
+ interface CompactResult {
24
+ /** The compressed text */
25
+ text: string;
26
+ /** Original size in chars */
27
+ originalChars: number;
28
+ /** Compressed size in chars */
29
+ compressedChars: number;
30
+ /** Compression ratio (0-1, lower = more compressed) */
31
+ ratio: number;
32
+ /** Number of segments kept / total */
33
+ segmentsKept: number;
34
+ segmentsTotal: number;
35
+ }
36
+ /**
37
+ * Compress text by extracting segments most relevant to a query.
38
+ */
39
+ declare function compact(embedder: IEmbedder, options: CompactOptions): Promise<CompactResult>;
40
+ //#endregion
41
+ export { CompactOptions, CompactResult, compact };
@@ -0,0 +1,3 @@
1
+ import{bookendReorder as e,cosineSimilarity as t,segment as n}from"./text-utils.js";import{readFile as r,stat as i}from"node:fs/promises";async function a(a,o){let{query:s,maxChars:c=3e3,minScore:l=.3,segmentation:u=`paragraph`}=o,d=o.tokenBudget?o.tokenBudget*4:c,f;if(o.text)f=o.text;else if(o.path){let e;try{e=await i(o.path)}catch(e){let t=e.code;throw t===`ENOENT`?Error(`File not found: ${o.path}. Check the path and try again.`):t===`EACCES`||t===`EPERM`?Error(`Permission denied reading ${o.path}. The file exists but is not accessible.`):e}if(e.isDirectory())throw Error(`Path is a directory: ${o.path}. compact requires a file path, not a directory. Use analyze_structure or find to explore directories.`);if(e.size>1e7)throw Error(`File too large (${(e.size/1e6).toFixed(1)}MB). compact supports files up to 10MB. Consider splitting or using search instead.`);f=o.cache?(await o.cache.get(o.path)).content:await r(o.path,`utf-8`)}else throw Error(`Either "text" or "path" must be provided`);if(f.length<=d)return{text:f,originalChars:f.length,compressedChars:f.length,ratio:1,segmentsKept:1,segmentsTotal:1};let p=n(f,u);if(p.length===0)return{text:``,originalChars:f.length,compressedChars:0,ratio:0,segmentsKept:0,segmentsTotal:0};let m=await a.embed(s),h=[];for(let e=0;e<p.length;e++){let n=t(m,await a.embed(p[e]));h.push({text:p[e],score:n,index:e})}let g=h.filter(e=>e.score>=l).sort((e,t)=>t.score-e.score),_=[],v=0;for(let e of g){if(v+e.text.length>d){v===0&&(_.push({...e,text:e.text.slice(0,d)}),v=d);break}_.push(e),v+=e.text.length+2}let y=e(_.sort((e,t)=>t.score-e.score)).map(e=>e.text).join(`
2
+
3
+ `);return{text:y,originalChars:f.length,compressedChars:y.length,ratio:y.length/f.length,segmentsKept:_.length,segmentsTotal:p.length}}export{a as compact};
@@ -0,0 +1,9 @@
1
+ //#region packages/tools/src/config-extractor.d.ts
2
+ /**
3
+ * Configuration values extraction for onboard.
4
+ * Scans config files (.env, package.json, application.properties, etc.)
5
+ * and produces a Markdown summary with sensitive value masking.
6
+ */
7
+ declare function extractConfigValues(rootPath: string, projectName: string): Promise<string>;
8
+ //#endregion
9
+ export { extractConfigValues };
@@ -0,0 +1,7 @@
1
+ import{readFile as e,readdir as t}from"node:fs/promises";import{basename as n,join as r,relative as i}from"node:path";const a=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,`__pycache__`,`.venv`,`target`,`obj`,`.gradle`]),o=[{glob:/\.env(?:\.\w+)?$/,type:`env`},{glob:/\.env\.example$/,type:`env`},{glob:/package\.json$/,type:`package-json`},{glob:/^(?:app|config|settings|default)\.(?:json|ya?ml|toml)$/i,type:`config`},{glob:/docker-compose\.ya?ml$/,type:`docker`},{glob:/cdk\.json$/,type:`cdk`},{glob:/turbo\.json$/,type:`tooling`},{glob:/application\.(?:properties|ya?ml)$/i,type:`spring`},{glob:/settings\.py$/,type:`django`},{glob:/\.flaskenv$/,type:`env`},{glob:/appsettings\.(?:\w+\.)?json$/i,type:`dotnet`}];async function s(t,n){let r=[],a=await c(t),o=/kb\.config\.json$/;for(let n of a)try{let a=i(t,n).replace(/\\/g,`/`);if(o.test(a))continue;let s=await e(n,`utf-8`),c=l(n);if(a.split(`/`).length-1>1&&c===`tooling`)continue;let u=d(s,c);u.length>0&&r.push({file:a,type:c,values:u})}catch{}return p(r,n)}async function c(e){let n=[],i=async(e,s)=>{if(!(s>3))try{let c=await t(e,{withFileTypes:!0});for(let t of c){if(a.has(t.name))continue;let c=r(e,t.name);t.isDirectory()&&!t.name.startsWith(`.`)?await i(c,s+1):t.isFile()&&o.some(e=>e.glob.test(t.name))&&n.push(c)}}catch{}};return await i(e,0),n}function l(e){let t=n(e);for(let e of o)if(e.glob.test(t))return e.type;return`unknown`}const u=/(?:secret|password|token|key|api.?key|auth|credential|private)/i;function d(e,t){let n=[];if(t===`env`)for(let t of e.split(`
2
+ `)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r===-1)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim(),o=u.test(i);n.push({key:i,value:o?`***`:a,sensitive:o})}else if(t===`package-json`)try{let t=JSON.parse(e);if(t.scripts)for(let[e,r]of Object.entries(t.scripts))n.push({key:`scripts.${e}`,value:String(r),sensitive:!1});if(t.engines)for(let[e,r]of Object.entries(t.engines))n.push({key:`engines.${e}`,value:String(r),sensitive:!1})}catch{}else if(t===`spring`)for(let t of e.split(`
3
+ `)){let e=t.trim();if(!e||e.startsWith(`#`)||e.startsWith(`---`))continue;let r=e.match(/^([\w.[\]-]+)\s*[=:]\s*(.*)$/);if(r){let e=r[1],t=r[2].trim(),i=u.test(e);n.push({key:e,value:i?`***`:t,sensitive:i})}}else if(t===`json`||t===`config`||t===`cdk`||t===`tooling`||t===`dotnet`)try{f(JSON.parse(e),``,n,0)}catch{}else if(t===`django`)for(let t of e.split(`
4
+ `)){let e=t.match(/^([A-Z_][A-Z0-9_]*)\s*=\s*(.+)$/);if(e){let t=e[1],r=e[2].trim(),i=u.test(t);n.push({key:t,value:i?`***`:r.slice(0,100),sensitive:i})}}return n}function f(e,t,n,r){if(!(r>3)&&typeof e==`object`&&e&&!Array.isArray(e))for(let[i,a]of Object.entries(e)){let e=t?`${t}.${i}`:i;if(typeof a==`object`&&a&&!Array.isArray(a))f(a,e,n,r+1);else{let t=u.test(i),r=Array.isArray(a)?`[${a.length} items]`:String(a);n.push({key:e,value:t?`***`:r.slice(0,120),sensitive:t})}}}function p(e,t){let n=[];if(n.push(`## Configuration Values: ${t}\n`),e.length===0)return n.push(`No configuration files detected.`),n.join(`
5
+ `);n.push(`**${e.length} config files** found\n`);let r=new Map;for(let t of e)r.has(t.type)||r.set(t.type,[]),r.get(t.type)?.push(t);for(let[e,t]of r){if(e===`package-json`&&t.length>2){n.push(`### ${e}\n`);let r=t.find(e=>e.file===`package.json`);if(r){n.push(`#### ${r.file}\n`),n.push(`| Key | Value | Sensitive |`),n.push(`|-----|-------|-----------|`);for(let e of r.values.slice(0,50)){let t=e.value.replace(/\|/g,`\\|`);n.push(`| ${e.key} | ${t} | ${e.sensitive?`⚠️ yes`:`no`} |`)}n.push(``)}let i=t.filter(e=>e.file!==`package.json`);if(i.length>0){let e=new Map;for(let t of i)for(let n of t.values){let t=`${n.key}=${n.value}`;e.set(t,(e.get(t)??0)+1)}let t=Math.max(2,Math.floor(i.length*.5));n.push(`#### Sub-packages (${i.length} packages)\n`);let r=[...e.entries()].filter(([,e])=>e>=t).map(([e])=>{let[t,...n]=e.split(`=`);return{key:t,value:n.join(`=`)}});if(r.length>0){n.push(`**Common scripts** (shared by most sub-packages):
6
+ `),n.push(`| Key | Value |`),n.push(`|-----|-------|`);for(let e of r)n.push(`| ${e.key} | ${e.value.replace(/\|/g,`\\|`)} |`);n.push(``)}let a=new Map;for(let n of i){let r=n.values.filter(n=>{let r=`${n.key}=${n.value}`;return(e.get(r)??0)<t});if(r.length===0)continue;let i=r.map(e=>`${e.key}=${e.value}`).sort().join(`||`),o=a.get(i);o?o.files.push(n.file):a.set(i,{files:[n.file],entries:r.map(e=>({key:e.key,value:e.value}))})}for(let[,e]of a){e.files.length>1?n.push(`**${e.files.length} packages** (${e.files.map(e=>e.split(`/`).slice(-2,-1)[0]||e).join(`, `)}):`):n.push(`**${e.files[0]}**:`),n.push(`| Key | Value |`),n.push(`|-----|-------|`);for(let t of e.entries)n.push(`| ${t.key} | ${t.value.replace(/\|/g,`\\|`)} |`);n.push(``)}}continue}if(t.length>3){let r=t.map(e=>e.values.map(e=>`${e.key}=${e.value}`).sort().join(`||`)),i=r.sort((e,t)=>r.filter(e=>e===t).length-r.filter(t=>t===e).length)[0];if(r.filter(e=>e===i).length>2){n.push(`### ${e}\n`);let a=t[r.indexOf(i)],o=t.filter((e,t)=>r[t]===i).map(e=>e.file),s=t.filter((e,t)=>r[t]!==i);n.push(`**${o.length} identical files**: ${o.join(`, `)}\n`),n.push(`| Key | Value | Sensitive |`),n.push(`|-----|-------|-----------|`);for(let e of a.values.slice(0,30)){let t=e.value.replace(/\|/g,`\\|`);n.push(`| ${e.key} | ${t} | ${e.sensitive?`⚠️ yes`:`no`} |`)}n.push(``);for(let e of s){n.push(`#### ${e.file}\n`),n.push(`| Key | Value | Sensitive |`),n.push(`|-----|-------|-----------|`);for(let t of e.values.slice(0,30)){let e=t.value.replace(/\|/g,`\\|`);n.push(`| ${t.key} | ${e} | ${t.sensitive?`⚠️ yes`:`no`} |`)}n.push(``)}continue}}n.push(`### ${e}\n`);for(let e of t){n.push(`#### ${e.file}\n`),n.push(`| Key | Value | Sensitive |`),n.push(`|-----|-------|-----------|`);for(let t of e.values.slice(0,50)){let e=t.value.replace(/\|/g,`\\|`);n.push(`| ${t.key} | ${e} | ${t.sensitive?`⚠️ yes`:`no`} |`)}e.values.length>50&&n.push(`\n_...and ${e.values.length-50} more values._`),n.push(``)}}let i=e.reduce((e,t)=>e+t.values.filter(e=>e.sensitive).length,0);return i>0&&n.push(`\n**⚠️ ${i} sensitive values detected** (values masked).`),n.join(`
7
+ `)}export{s as extractConfigValues};
@@ -0,0 +1,12 @@
1
+ //#region packages/tools/src/data-transform.d.ts
2
+ interface TransformOptions {
3
+ input: unknown;
4
+ expression: string;
5
+ }
6
+ interface TransformResult {
7
+ output: unknown;
8
+ outputString: string;
9
+ }
10
+ declare function dataTransform(options: TransformOptions): TransformResult;
11
+ //#endregion
12
+ export { TransformOptions, TransformResult, dataTransform };
@@ -0,0 +1 @@
1
+ function e(e){let{input:o,expression:s}=e,c;if(typeof o==`string`)try{c=JSON.parse(o)}catch{throw Error(`Invalid JSON input`)}else c=o;let l;if(s===`.`)l=c;else if(s===`keys`)l=Object.keys(a(c));else if(s===`values`)l=Object.values(a(c));else if(s===`length`)l=Array.isArray(c)?c.length:Object.keys(a(c)).length;else if(s===`flatten`)l=i(c).flat();else if(s===`unique`)l=[...new Set(i(c))];else if(s===`sort`)l=[...i(c)].sort();else if(s===`reverse`)l=[...i(c)].reverse();else if(s.startsWith(`.`))l=r(c,s.slice(1));else if(s.startsWith(`map(`)&&s.endsWith(`)`)){let e=s.slice(4,-1).trim(),t=e.startsWith(`.`)?e.slice(1):e;l=i(c).map(e=>r(e,t))}else if(s.startsWith(`select(`)&&s.endsWith(`)`))l=t(i(c),s.slice(7,-1).trim());else if(s.startsWith(`group_by(`)&&s.endsWith(`)`)){let e=s.slice(9,-1).trim().replace(/^\./,``),t={};for(let n of i(c)){let i=String(r(n,e)??`null`);t[i]||(t[i]=[]),t[i].push(n)}l=t}else if(s.startsWith(`pick(`)&&s.endsWith(`)`)){let e=s.slice(5,-1).split(`,`).map(e=>e.trim().replace(/^\./,``)).filter(Boolean);l=Array.isArray(c)?i(c).map(t=>n(t,e)):n(c,e)}else throw Error(`Unsupported expression: ${s}. Supported: ., .path.to.field, keys, values, length, flatten, unique, sort, reverse, map(.field), select(.field == | != | > | < | >= | <= "value"), group_by(.field), pick(.a, .b)`);return{output:l,outputString:typeof l==`string`?l:JSON.stringify(l,null,2)??`null`}}function t(e,t){let n=t.match(/^\.?([\w.[\]]+)\s*(==|!=|>=|<=|>|<)\s*"?([^"]*)"?$/);if(!n)throw Error(`Unsupported select expression: ${t}`);let[,i,a,o]=n;return e.filter(e=>{let t=r(e,i),n=String(t);switch(a){case`==`:return n===o;case`!=`:return n!==o;case`>`:case`<`:case`>=`:case`<=`:{let e=Number(t),n=Number(o);return Number.isNaN(e)||Number.isNaN(n)?!1:a===`>`?e>n:a===`<`?e<n:a===`>=`?e>=n:e<=n}default:return!1}})}function n(e,t){let n={};for(let i of t)n[i]=r(e,i);return n}function r(e,t){if(!t)return e;let n=[...t.matchAll(/([^.[\]]+)|\[(\d+)\]/g)].map(e=>e[1]??Number.parseInt(e[2],10)),r=e;for(let e of n){if(r==null)return;if(typeof e==`number`){if(!Array.isArray(r))return;r=r[e];continue}if(typeof r!=`object`)return;r=r[e]}return r}function i(e){if(!Array.isArray(e))throw Error(`Operation requires an array input.`);return e}function a(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Operation requires an object input.`);return e}export{e as dataTransform};
@@ -0,0 +1,28 @@
1
+ import { IEmbedder } from "../../embeddings/dist/index.js";
2
+ import { IKnowledgeStore } from "../../store/dist/index.js";
3
+
4
+ //#region packages/tools/src/dead-symbols.d.ts
5
+ interface DeadSymbolOptions {
6
+ /** Root path to scope the search */
7
+ rootPath?: string;
8
+ /** Max symbols to scan (default: 100) */
9
+ limit?: number;
10
+ }
11
+ interface DeadSymbol {
12
+ name: string;
13
+ path: string;
14
+ line: number;
15
+ kind: string;
16
+ }
17
+ interface DeadSymbolResult {
18
+ /** Dead symbols in source files (.ts/.js/.tsx/.jsx) — actionable */
19
+ deadInSource: DeadSymbol[];
20
+ /** Dead symbols in documentation files (.md) — informational */
21
+ deadInDocs: DeadSymbol[];
22
+ totalExports: number;
23
+ totalDeadSource: number;
24
+ totalDeadDocs: number;
25
+ }
26
+ declare function findDeadSymbols(embedder: IEmbedder, store: IKnowledgeStore, options?: DeadSymbolOptions): Promise<DeadSymbolResult>;
27
+ //#endregion
28
+ export { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols };
@@ -0,0 +1,2 @@
1
+ import{escapeRegExp as e}from"./regex-utils.js";import{readFile as t}from"node:fs/promises";import{extname as n}from"node:path";import{SUPPORTED_EXTENSIONS as r,WasmRuntime as i,extractSymbols as a}from"../../chunker/dist/index.js";const o=new Set([`.md`,`.mdx`]);async function s(s,l,u={}){let{rootPath:d,limit:f=100}=u,p=await s.embed(`export function class const type interface enum`),m=await l.search(p,{limit:f*3}),h=/^export\s+(?:async\s+)?(?:function|class|const|let|interface|type|enum)\s+(\w+)/gm,g=[],_=new Map;for(let e of m){if(!c(e.record.sourcePath,d))continue;let t=_.get(e.record.sourcePath)??[];t.push(e),_.set(e.record.sourcePath,t)}let v=new Set;if(i.get())for(let[e]of _){let i=n(e);if(r.has(i))try{let n=await a(await t(e,`utf-8`),i,e);for(let t of n)t.exported&&g.push({name:t.name,path:e,line:t.line,kind:t.kind});v.add(e)}catch{}}for(let[e,t]of _)if(!v.has(e))for(let e of t){let t=e.record.content;h.lastIndex=0;for(let n of t.matchAll(h)){let r=n.index??0,i=t.slice(0,r).split(`
2
+ `).length-1,a=t.slice(r).match(/export\s+(?:async\s+)?(\w+)/);g.push({name:n[1],path:e.record.sourcePath,line:e.record.startLine+i,kind:a?.[1]??`unknown`})}}let y=new Map;for(let e of g){let t=`${e.path}:${e.name}`;y.has(t)||y.set(t,e)}let b=[];for(let t of y.values()){let n=e(t.name),r=RegExp(`import\\s+.*\\b${n}\\b.*from`,`m`),i=RegExp(`export\\s+\\{[^}]*\\b${n}\\b`,`m`),a=await l.ftsSearch(`import ${t.name}`,{limit:10}),o=a.some(e=>e.record.sourcePath!==t.path&&r.test(e.record.content)),s=a.some(e=>e.record.sourcePath!==t.path&&i.test(e.record.content));!o&&!s&&b.push(t)}let x=(e,t)=>e.path===t.path?e.line-t.line:e.path.localeCompare(t.path),S=[],C=[];for(let e of b){let t=n(e.path).toLowerCase();o.has(t)?C.push(e):S.push(e)}return S.sort(x),C.sort(x),{deadInSource:S,deadInDocs:C,totalExports:y.size,totalDeadSource:S.length,totalDeadDocs:C.length}}function c(e,t){if(!t)return!0;let n=l(t).replace(/\/+$/,``),r=l(e);return r===n||r.startsWith(`${n}/`)}function l(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``)}export{s as findDeadSymbols};
@@ -0,0 +1,36 @@
1
+ //#region packages/tools/src/delegate.d.ts
2
+ interface DelegateOptions {
3
+ /** The prompt / task to send to the local model. */
4
+ prompt: string;
5
+ /** Model to use (default: the first available model). */
6
+ model?: string;
7
+ /** Optional system prompt. */
8
+ system?: string;
9
+ /** Optional context to include before the prompt. */
10
+ context?: string;
11
+ /** Temperature (0-2, default: 0.3 for deterministic-ish output). */
12
+ temperature?: number;
13
+ /** Timeout in milliseconds (default: 120_000). */
14
+ timeout?: number;
15
+ /** Ollama base URL (default: http://localhost:11434). */
16
+ baseUrl?: string;
17
+ }
18
+ interface DelegateResult {
19
+ model: string;
20
+ response: string;
21
+ durationMs: number;
22
+ tokenCount?: number;
23
+ error?: string;
24
+ }
25
+ /**
26
+ * Check if Ollama is running and return available models.
27
+ */
28
+ declare function delegateListModels(baseUrl?: string): Promise<string[]>;
29
+ /**
30
+ * Delegate a task to a local Ollama model.
31
+ *
32
+ * Fails fast if Ollama is not running or no models are available.
33
+ */
34
+ declare function delegate(options: DelegateOptions): Promise<DelegateResult>;
35
+ //#endregion
36
+ export { DelegateOptions, DelegateResult, delegate, delegateListModels };
@@ -0,0 +1 @@
1
+ import{request as e}from"node:http";const t=`http://localhost:11434`;async function n(e=t){let n=await i(`${e}/api/tags`),r;try{r=JSON.parse(n)}catch{throw Error(`Ollama returned invalid JSON`)}return(r.models??[]).map(e=>e.name)}async function r(e){let r=e.baseUrl??t,i=e.timeout??12e4,o;try{o=await n(r)}catch{return{model:e.model??`unknown`,response:``,durationMs:0,error:`Ollama is not running at ${r}. Start it with: ollama serve`}}if(o.length===0)return{model:`none`,response:``,durationMs:0,error:`No Ollama models available. Pull one with: ollama pull qwen2.5-coder:7b`};let s=e.model??o[0];if(!o.includes(s))return{model:s,response:``,durationMs:0,error:`Model "${s}" not found. Available: ${o.join(`, `)}`};let c=``;e.context&&(c+=`<context>\n${e.context}\n</context>\n\n`),c+=e.prompt;let l=Date.now(),u=JSON.stringify({model:s,prompt:c,system:e.system,stream:!1,options:{temperature:e.temperature??.3}});try{let e=await a(`${r}/api/generate`,u,i),t=JSON.parse(e);return t.error?{model:s,response:``,durationMs:Date.now()-l,error:t.error}:{model:s,response:(t.response??``).trim(),durationMs:Date.now()-l,tokenCount:t.eval_count}}catch(e){return{model:s,response:``,durationMs:Date.now()-l,error:e instanceof Error?e.message:String(e)}}}function i(t){return new Promise((n,r)=>{let i=new URL(t),a=e({hostname:i.hostname,port:i.port,path:i.pathname,method:`GET`,timeout:5e3},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>n(Buffer.concat(t).toString(`utf-8`)))});a.on(`error`,r),a.on(`timeout`,()=>{a.destroy(),r(Error(`Connection timeout`))}),a.end()})}function a(t,n,r){return new Promise((i,a)=>{let o=new URL(t),s=e({hostname:o.hostname,port:o.port,path:o.pathname,method:`POST`,headers:{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(n)},timeout:r},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>i(Buffer.concat(t).toString(`utf-8`)))});s.on(`error`,a),s.on(`timeout`,()=>{s.destroy(),a(Error(`Ollama request timed out after ${r}ms`))}),s.write(n),s.end()})}export{r as delegate,n as delegateListModels};
@@ -0,0 +1,9 @@
1
+ //#region packages/tools/src/diagram-builder.d.ts
2
+ /**
3
+ * Architecture diagram generation for onboard.
4
+ * Produces C4 Container + Architectural Flow Mermaid diagrams
5
+ * from AST call graph and analyzer data.
6
+ */
7
+ declare function buildDiagrams(callGraph: Map<string, Map<string, string[]>>, dataMap: Map<string, Record<string, unknown>>, projectName: string): string;
8
+ //#endregion
9
+ export { buildDiagrams };
@@ -0,0 +1,9 @@
1
+ import{getPackageKey as e,isTestPath as t}from"./onboard-utils.js";function n(n,r,i){let a=r.get(`symbols`),o=r.get(`entry-points`),s=r.get(`dependencies`),c=new Map;for(let[r,i]of n)if(!t(r))for(let[n,a]of i){if(t(n))continue;let i=e(r),o=e(n);if(i===o)continue;let s=`${i}|${o}`;c.set(s,(c.get(s)??0)+a.length)}if(c.size===0)return`## Architecture Diagram
2
+
3
+ No cross-package dependencies detected.`;let l=new Set;for(let e of c.keys()){let[t,n]=e.split(`|`);l.add(t),l.add(n)}let u=new Map;if(a?.symbols)for(let n of a.symbols){if(!n.exported)continue;let r=n.filePath.replace(/\\/g,`/`);if(t(r))continue;let i=e(r);u.set(i,(u.get(i)??0)+1)}let d=new Map;if(o?.entryPoints)for(let t of o.entryPoints){let n=e(t.filePath.replace(/\\/g,`/`)),r=d.get(n);r?(r.count++,t.trigger&&r.triggers.add(t.trigger)):d.set(n,{count:1,triggers:new Set(t.trigger?[t.trigger]:[])})}let f=[];if(s?.external){let e=s.external,t={"client-dynamodb":{id:`dynamodb`,name:`DynamoDB`},"lib-dynamodb":{id:`dynamodb`,name:`DynamoDB`},"client-sqs":{id:`sqs`,name:`SQS`},"client-ses":{id:`ses`,name:`SES`},"client-sesv2":{id:`ses`,name:`SES`},"client-s3":{id:`s3`,name:`S3`},"client-eventbridge":{id:`eventbridge`,name:`EventBridge`},"client-sns":{id:`sns`,name:`SNS`},"client-secrets-manager":{id:`secrets`,name:`Secrets Manager`},"client-scheduler":{id:`scheduler`,name:`EventBridge Scheduler`},"client-apigatewaymanagementapi":{id:`apigw`,name:`API Gateway`},"client-cloudwatch":{id:`cloudwatch`,name:`CloudWatch`}},n=new Set;for(let r of Object.keys(e))for(let[e,i]of Object.entries(t))r.includes(e)&&!n.has(i.id)&&(n.add(i.id),f.push(i));f.sort((e,t)=>e.name.localeCompare(t.name))}let p=new Map;for(let e of[...l].sort()){let t=e.split(`/`)[0],n=p.get(t);n?n.push(e):p.set(t,[e])}let m=new Map;if(a?.symbols){let t=new Map;for(let n of a.symbols){let r=n.filePath.replace(/\\/g,`/`),i=e(r),a=r.match(/\.[^./]+$/)?.[0]||``;t.has(i)||t.set(i,new Map);let o=t.get(i);o.set(a,(o.get(a)??0)+1)}let n={".ts":`TypeScript`,".tsx":`TypeScript`,".js":`JavaScript`,".jsx":`JavaScript`,".java":`Java`,".kt":`Kotlin`,".scala":`Scala`,".py":`Python`,".go":`Go`,".rs":`Rust`,".cs":`C#`,".rb":`Ruby`,".php":`PHP`,".swift":`Swift`};for(let[e,r]of t){let t=``,i=0;for(let[e,n]of r)n>i&&(i=n,t=e);m.set(e,n[t]||`TypeScript`)}}let h=e=>e.replace(/[^a-zA-Z0-9]/g,`_`),g=[];g.push("```mermaid"),g.push(`C4Container`),g.push(` title C4 Container: ${i}`),g.push(``);let _=e=>{let t=[],n=d.get(e);n&&(t.push(`${n.count} handlers`),n.triggers.size>0&&t.push([...n.triggers].join(`, `)));let r=u.get(e);return r&&t.push(`${r} exports`),t.join(` · `)||``},v=e=>{let t=m.get(e)||`TypeScript`;if(e.startsWith(`infra`))return`CDK/${t}`;if(d.has(e)){let n=d.get(e);if(n?.triggers.has(`SQS`)||n?.triggers.has(`SNS`)||n?.triggers.has(`API Gateway`))return`Lambda/${t}`;if(n?.triggers.has(`HTTP Server`)||n?.triggers.has(`HTTP Endpoint`))return`Spring Boot/${t}`}return t};for(let[e,t]of[...p.entries()].sort()){let n=new Set([`com`,`org`,`net`,`io`,`dev`,`src`]).has(e)?i.charAt(0).toUpperCase()+i.slice(1):e.charAt(0).toUpperCase()+e.slice(1);if(t.length===1&&t[0]===e){let e=t[0];g.push(` Container(${h(e)}, "${e}", "${v(e)}", "${_(e)}")`)}else{g.push(` System_Boundary(${h(e)}_boundary, "${n}") {`);for(let e of t){let t=e.split(`/`).slice(1).join(`/`)||e;g.push(` Container(${h(e)}, "${t}", "${v(e)}", "${_(e)}")`)}g.push(` }`)}g.push(``)}if(f.length>0){for(let e of f)g.push(` System_Ext(ext_${e.id}, "${e.name}", "AWS")`);g.push(``)}let y=[...c.entries()].sort((e,t)=>t[1]-e[1]);for(let[e,t]of y.slice(0,30)){let[n,r]=e.split(`|`);g.push(` Rel(${h(n)}, ${h(r)}, "Uses", "${t} calls")`)}g.push("```");let b=`## C4 Container Diagram\n\n${g.join(`
4
+ `)}`,x=[];x.push("```mermaid"),x.push(`graph TB`);let S=new Set;for(let[,e]of d)for(let t of e.triggers)S.add(t);if(S.size>0){x.push(` subgraph Triggers["External Triggers"]`);for(let e of[...S].sort()){let t=`trigger_${e.replace(/[^a-zA-Z0-9]/g,`_`)}`;x.push(` ${t}(("${e}"))`)}x.push(` end`),x.push(``)}let C=[...l].filter(e=>d.has(e)).sort(),w=[...l].filter(e=>!d.has(e)).sort();if(C.length>0){x.push(` subgraph Services["Service Layer"]`);for(let e of C){let t=`flow_${h(e)}`,n=e.includes(`/`)?e.split(`/`).pop()??e:e,r=d.get(e);x.push(` ${t}["${n} (${r?.count??0} handlers)"]`)}x.push(` end`),x.push(``)}if(w.length>0){x.push(` subgraph Libraries["Shared Libraries"]`);for(let e of w){let t=`flow_${h(e)}`,n=e.includes(`/`)?e.split(`/`).pop()??e:e;x.push(` ${t}["${n}"]`)}x.push(` end`),x.push(``)}if(f.length>0){x.push(` subgraph External["AWS Services"]`);for(let e of f)x.push(` flow_ext_${e.id}[("${e.name}")]`);x.push(` end`),x.push(``)}for(let e of C){let t=d.get(e);if(!t)continue;let n=`flow_${h(e)}`;for(let e of t.triggers){let t=`trigger_${e.replace(/[^a-zA-Z0-9]/g,`_`)}`;x.push(` ${t} --> ${n}`)}}let T=y.filter(([e])=>{let[t,n]=e.split(`|`);return d.has(t)&&!d.has(n)});for(let[e,t]of T.slice(0,15)){let[n,r]=e.split(`|`);x.push(` flow_${h(n)} -->|${t}| flow_${h(r)}`)}let E=y.filter(([e])=>{let[t,n]=e.split(`|`);return!d.has(t)&&!d.has(n)});for(let[e,t]of E.slice(0,10)){let[n,r]=e.split(`|`);x.push(` flow_${h(n)} -->|${t}| flow_${h(r)}`)}x.push("```");let D=`## Architectural Flow\n\n${x.join(`
5
+ `)}`,O=[`# Architecture Diagrams: ${i}\n`];return O.push(b),O.push(D),O.join(`
6
+
7
+ ---
8
+
9
+ `)}export{n as buildDiagrams};
@@ -0,0 +1,28 @@
1
+ //#region packages/tools/src/diff-parse.d.ts
2
+ interface DiffFile {
3
+ path: string;
4
+ oldPath?: string;
5
+ status: 'added' | 'modified' | 'deleted' | 'renamed';
6
+ hunks: DiffHunk[];
7
+ additions: number;
8
+ deletions: number;
9
+ }
10
+ interface DiffHunk {
11
+ oldStart: number;
12
+ oldLines: number;
13
+ newStart: number;
14
+ newLines: number;
15
+ header: string;
16
+ changes: DiffChange[];
17
+ }
18
+ interface DiffChange {
19
+ type: 'add' | 'delete' | 'context';
20
+ line: number;
21
+ content: string;
22
+ }
23
+ interface DiffParseOptions {
24
+ diff: string;
25
+ }
26
+ declare function diffParse(options: DiffParseOptions): DiffFile[];
27
+ //#endregion
28
+ export { DiffChange, DiffFile, DiffHunk, DiffParseOptions, diffParse };
@@ -0,0 +1,3 @@
1
+ function e(e){let{diff:r}=e,i=r.split(/^diff --git /m).filter(Boolean);return i.length>0&&/^a\//.test(i[0])?t(i):n(r)}function t(e){let t=[];for(let n of e){let e=n.split(`
2
+ `),r=e[0]?.match(/a\/(.+?)\s+b\/(.+)/);if(!r)continue;let i=r[1],a=r[2],o=`modified`;n.includes(`new file mode`)?o=`added`:n.includes(`deleted file mode`)?o=`deleted`:i!==a&&(o=`renamed`);let s=[],c=0,l=0,u=null,d=0,f=0;for(let t of e){let e=t.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){u={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]},s.push(u),d=u.oldStart,f=u.newStart;continue}if(!(!u||t.startsWith(`\\`))){if(t.startsWith(`+`)&&!t.startsWith(`+++`)){u.changes.push({type:`add`,line:f,content:t.slice(1)}),c+=1,f+=1;continue}if(t.startsWith(`-`)&&!t.startsWith(`---`)){u.changes.push({type:`delete`,line:d,content:t.slice(1)}),l+=1,d+=1;continue}t.startsWith(` `)&&(u.changes.push({type:`context`,line:f,content:t.slice(1)}),d+=1,f+=1)}}t.push({path:a,oldPath:o===`renamed`?i:void 0,status:o,hunks:s,additions:c,deletions:l})}return t}function n(e){let t=[],n=e.split(`
3
+ `),r=0;for(;r<n.length;){let e=n[r]?.match(/^---\s+(?:a\/)?(.+)/),i=n[r+1]?.match(/^\+\+\+\s+(?:b\/)?(.+)/);if(!e||!i){r++;continue}let a=e[1].trim(),o=i[1].trim(),s=`modified`;a===`/dev/null`?s=`added`:o===`/dev/null`?s=`deleted`:a!==o&&(s=`renamed`),r+=2;let c=[],l=0,u=0;for(;r<n.length&&!n[r]?.startsWith(`--- `);){let e=n[r]?.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){let t={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]};c.push(t);let i=t.oldStart,a=t.newStart;for(r++;r<n.length;){let e=n[r];if(e?.startsWith(`@@`)||e?.startsWith(`--- `)||e?.startsWith(`diff `))break;if(e?.startsWith(`\\`)){r++;continue}if(e?.startsWith(`+`))t.changes.push({type:`add`,line:a,content:e.slice(1)}),l++,a++;else if(e?.startsWith(`-`))t.changes.push({type:`delete`,line:i,content:e.slice(1)}),u++,i++;else if(e?.startsWith(` `))t.changes.push({type:`context`,line:a,content:e.slice(1)}),i++,a++;else break;r++}}else r++}let d=s===`deleted`?a:o;t.push({path:d,oldPath:s===`renamed`?a:void 0,status:s,hunks:c,additions:l,deletions:u})}return t}export{e as diffParse};