@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,14 @@
1
+ //#region packages/tools/src/path-resolver.d.ts
2
+ /**
3
+ * Shared path resolver for MCP tools (E-014).
4
+ * Provides consistent path resolution across all tools.
5
+ */
6
+ /**
7
+ * Resolve a user-supplied path to an absolute path.
8
+ * - Absolute paths are returned as-is
9
+ * - Relative paths are resolved against the server's cwd
10
+ * - '.' and empty/undefined default to cwd
11
+ */
12
+ declare function resolvePath(input?: string): string;
13
+ //#endregion
14
+ export { resolvePath };
@@ -0,0 +1 @@
1
+ import{isAbsolute as e,resolve as t}from"node:path";function n(n){return!n||n===`.`?process.cwd():e(n)?n:t(process.cwd(),n)}export{n as resolvePath};
@@ -0,0 +1,20 @@
1
+ //#region packages/tools/src/process-manager.d.ts
2
+ interface ManagedProcess {
3
+ id: string;
4
+ command: string;
5
+ args: string[];
6
+ pid?: number;
7
+ status: 'running' | 'stopped' | 'error';
8
+ startedAt: string;
9
+ exitCode?: number;
10
+ logs: string[];
11
+ }
12
+ declare function processStart(id: string, command: string, args?: string[], options?: {
13
+ cwd?: string;
14
+ }): ManagedProcess;
15
+ declare function processStop(id: string): ManagedProcess | undefined;
16
+ declare function processStatus(id: string): ManagedProcess | undefined;
17
+ declare function processList(): ManagedProcess[];
18
+ declare function processLogs(id: string, tail?: number): string[];
19
+ //#endregion
20
+ export { ManagedProcess, processList, processLogs, processStart, processStatus, processStop };
@@ -0,0 +1 @@
1
+ import{spawn as e}from"node:child_process";const t=new Map;function n(n,r,i=[],a){if(t.has(n))throw Error(`Process "${n}" is already running. Stop it first.`);if(t.size>=20)throw Error(`Too many managed processes (max 20). Stop some first.`);let o=/[;|&`$(){}[\]!<>\\]/,s=[r,...i].join(` `);if(o.test(s))throw Error(`Command contains disallowed shell metacharacters`);let c=e(s,{cwd:a?.cwd??process.cwd(),shell:!0,stdio:[`ignore`,`pipe`,`pipe`]}),l={id:n,command:r,args:i,pid:c.pid??void 0,status:`running`,startedAt:new Date().toISOString(),logs:[]},u=e=>{let t=e.toString().split(/\r?\n/).filter(Boolean);l.logs.push(...t),l.logs.length>200&&(l.logs=l.logs.slice(-200))};return c.stdout?.on(`data`,u),c.stderr?.on(`data`,u),c.on(`exit`,e=>{l.status=e===0?`stopped`:`error`,l.exitCode=e??void 0,setTimeout(()=>t.delete(n),3e4)}),c.on(`error`,e=>{l.status=`error`,l.logs.push(`[error] ${e.message}`)}),t.set(n,{proc:c,info:l}),l}function r(e){let n=t.get(e);if(!n)return;n.proc.kill(`SIGTERM`);let r=setTimeout(()=>{try{n.proc.kill(`SIGKILL`)}catch{}},5e3);return n.proc.once(`exit`,()=>clearTimeout(r)),n.info.status=`stopped`,t.delete(e),n.info}function i(e){return t.get(e)?.info}function a(){return[...t.values()].map(e=>e.info)}function o(e,n){let r=t.get(e);return r?n?r.info.logs.slice(-n):r.info.logs:[]}export{a as processList,o as processLogs,n as processStart,i as processStatus,r as processStop};
@@ -0,0 +1,40 @@
1
+ //#region packages/tools/src/queue.d.ts
2
+ interface QueueItem {
3
+ id: string;
4
+ title: string;
5
+ status: 'pending' | 'in-progress' | 'done' | 'failed';
6
+ data?: unknown;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ error?: string;
10
+ }
11
+ interface QueueState {
12
+ name: string;
13
+ items: QueueItem[];
14
+ }
15
+ /** Create a new named queue. */
16
+ declare function queueCreate(name: string, cwd?: string): QueueState;
17
+ /** Push an item onto a queue. Creates the queue if it doesn't exist. */
18
+ declare function queuePush(name: string, title: string, data?: unknown, cwd?: string): QueueItem;
19
+ /** Take the next pending item from a queue and mark it in-progress. */
20
+ declare function queueNext(name: string, cwd?: string): QueueItem | null;
21
+ /** Mark a queue item as done. */
22
+ declare function queueDone(name: string, id: string, cwd?: string): QueueItem;
23
+ /** Mark a queue item as failed with an error message. */
24
+ declare function queueFail(name: string, id: string, error: string, cwd?: string): QueueItem;
25
+ /** Get the current state of a queue. */
26
+ declare function queueGet(name: string, cwd?: string): QueueState | null;
27
+ /** List all queues with their item counts. */
28
+ declare function queueList(cwd?: string): Array<{
29
+ name: string;
30
+ pending: number;
31
+ done: number;
32
+ failed: number;
33
+ total: number;
34
+ }>;
35
+ /** Clear completed items from a queue. */
36
+ declare function queueClear(name: string, cwd?: string): number;
37
+ /** Delete a queue entirely. */
38
+ declare function queueDelete(name: string, cwd?: string): boolean;
39
+ //#endregion
40
+ export { QueueItem, QueueState, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush };
@@ -0,0 +1 @@
1
+ import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{AIKIT_PATHS as o}from"../../core/dist/index.js";const s=o.state;function c(e){return t(e??process.cwd(),s,`queue.json`)}function l(e){let t=c(e);if(!n(t))return{};try{return JSON.parse(i(t,`utf-8`))}catch{return{}}}function u(t,i){let o=c(i),s=e(o);n(s)||r(s,{recursive:!0}),a(o,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function d(){return`q_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,6)}`}function f(e,t){let n=l(t);if(n[e])throw Error(`Queue "${e}" already exists`);let r={name:e,items:[]};return n[e]=r,u(n,t),r}function p(e,t,n,r){let i=l(r);i[e]||(i[e]={name:e,items:[]});let a=new Date().toISOString(),o={id:d(),title:t,status:`pending`,data:n,createdAt:a,updatedAt:a};if(i[e].items.length>=500)throw Error(`Queue "${e}" has reached the maximum of 500 items. Clear completed items with queue({ action: "clear" }) before adding more.`);return i[e].items.push(o),u(i,r),o}function m(e,t){let n=l(t),r=n[e];if(!r)throw Error(`Queue "${e}" does not exist`);let i=r.items.find(e=>e.status===`pending`);return i?(i.status=`in-progress`,i.updatedAt=new Date().toISOString(),u(n,t),i):null}function h(e,t,n){let r=l(n),i=r[e];if(!i)throw Error(`Queue "${e}" does not exist`);let a=i.items.find(e=>e.id===t);if(!a)throw Error(`Item "${t}" not found in queue "${e}"`);return a.status=`done`,a.updatedAt=new Date().toISOString(),u(r,n),a}function g(e,t,n,r){let i=l(r),a=i[e];if(!a)throw Error(`Queue "${e}" does not exist`);let o=a.items.find(e=>e.id===t);if(!o)throw Error(`Item "${t}" not found in queue "${e}"`);return o.status=`failed`,o.error=n,o.updatedAt=new Date().toISOString(),u(i,r),o}function _(e,t){return l(t)[e]??null}function v(e){let t=l(e);return Object.values(t).map(e=>({name:e.name,pending:e.items.filter(e=>e.status===`pending`).length,done:e.items.filter(e=>e.status===`done`).length,failed:e.items.filter(e=>e.status===`failed`).length,total:e.items.length}))}function y(e,t){let n=l(t),r=n[e];if(!r)throw Error(`Queue "${e}" does not exist`);let i=r.items.length;r.items=r.items.filter(e=>e.status===`pending`||e.status===`in-progress`);let a=i-r.items.length;return u(n,t),a}function b(e,t){let n=l(t);return n[e]?(delete n[e],u(n,t),!0):!1}export{y as queueClear,f as queueCreate,b as queueDelete,h as queueDone,g as queueFail,_ as queueGet,v as queueList,m as queueNext,p as queuePush};
@@ -0,0 +1,33 @@
1
+ //#region packages/tools/src/regex-test.d.ts
2
+ /**
3
+ * aikit_regex_test — Test regex patterns against sample strings.
4
+ */
5
+ interface RegexTestOptions {
6
+ pattern: string;
7
+ flags?: string;
8
+ testStrings: string[];
9
+ mode?: 'match' | 'replace' | 'split';
10
+ replacement?: string;
11
+ }
12
+ interface RegexMatchInfo {
13
+ full: string;
14
+ groups: (string | undefined)[];
15
+ index: number;
16
+ }
17
+ interface RegexTestStringResult {
18
+ input: string;
19
+ matched: boolean;
20
+ matches?: RegexMatchInfo[];
21
+ replaced?: string;
22
+ split?: string[];
23
+ }
24
+ interface RegexTestResult {
25
+ pattern: string;
26
+ flags: string;
27
+ results: RegexTestStringResult[];
28
+ valid: boolean;
29
+ error?: string;
30
+ }
31
+ declare function regexTest(options: RegexTestOptions): RegexTestResult;
32
+ //#endregion
33
+ export { RegexMatchInfo, RegexTestOptions, RegexTestResult, RegexTestStringResult, regexTest };
@@ -0,0 +1 @@
1
+ function e(e){let{pattern:t,flags:n=``,testStrings:r,mode:i=`match`,replacement:a=``}=e;try{let e=new RegExp(t,n);return{pattern:t,flags:n,results:r.map(r=>{let o=e.test(r);switch(i){case`match`:{let e=n.includes(`g`)?n:`${n}g`;return{input:r,matched:o,matches:[...r.matchAll(new RegExp(t,e))].map(e=>({full:e[0],groups:[...e.slice(1)],index:e.index??0}))}}case`replace`:return{input:r,matched:o,replaced:r.replace(new RegExp(t,n),a)};default:return{input:r,matched:o,split:r.split(new RegExp(t,n))}}}),valid:!0}}catch(e){return{pattern:t,flags:n,results:[],valid:!1,error:e.message}}}export{e as regexTest};
@@ -0,0 +1,8 @@
1
+ //#region packages/tools/src/regex-utils.d.ts
2
+ /**
3
+ * Escape special regular-expression characters in a string so it can be
4
+ * embedded safely inside a `new RegExp(...)` expression.
5
+ */
6
+ declare function escapeRegExp(value: string): string;
7
+ //#endregion
8
+ export { escapeRegExp };
@@ -0,0 +1 @@
1
+ function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}export{e as escapeRegExp};
@@ -0,0 +1,31 @@
1
+ //#region packages/tools/src/rename.d.ts
2
+ interface RenameOptions {
3
+ /** Symbol to rename */
4
+ oldName: string;
5
+ /** New symbol name */
6
+ newName: string;
7
+ /** Root directory to search in */
8
+ rootPath: string;
9
+ /** File extensions to process (default: .ts, .tsx, .js, .jsx) */
10
+ extensions?: string[];
11
+ /** Glob patterns to exclude */
12
+ exclude?: string[];
13
+ /** Dry run — don't write changes */
14
+ dryRun?: boolean;
15
+ }
16
+ interface RenameChange {
17
+ path: string;
18
+ line: number;
19
+ before: string;
20
+ after: string;
21
+ }
22
+ interface RenameResult {
23
+ oldName: string;
24
+ newName: string;
25
+ changes: RenameChange[];
26
+ filesModified: number;
27
+ dryRun: boolean;
28
+ }
29
+ declare function rename(options: RenameOptions): Promise<RenameResult>;
30
+ //#endregion
31
+ export { RenameChange, RenameOptions, RenameResult, rename };
@@ -0,0 +1,2 @@
1
+ import{escapeRegExp as e}from"./regex-utils.js";import{DEFAULT_TOOL_EXTENSIONS 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,`/`)}function c(t){return RegExp(`(^|[^A-Za-z0-9_$])(${e(t)})(?=[^A-Za-z0-9_$]|$)`,`g`)}async function l(e){let{oldName:l,newName:u,rootPath:d,extensions:f=t,exclude:p=[],dryRun:m=!1}=e;if(!l.trim())throw Error(`oldName must not be empty`);let h=c(l),g=await n(d,f,p),_=[],v=0,y=[];for(let e of g){let t=await i(e,`utf-8`),n=t.split(/\r?\n/),r=!1;for(let t=0;t<n.length;t++){let i=n[t];h.lastIndex=0;let a=i.replace(h,(e,t)=>(r=!0,`${t}${u}`));i!==a&&(n[t]=a,_.push({path:s(o(d,e)),line:t+1,before:i,after:a}))}r&&(v+=1,m||(y.push({path:e,content:t}),await a(e,n.join(`
2
+ `),`utf-8`)))}return!m&&y.length>0&&r(`rename`,y,`rename: ${l} → ${u}, ${v} files`),{oldName:l,newName:u,changes:_,filesModified:v,dryRun:m}}export{l as rename};
@@ -0,0 +1,59 @@
1
+ //#region packages/tools/src/replay.d.ts
2
+ /**
3
+ * Replay — append-only audit trail of tool/CLI invocations.
4
+ *
5
+ * Captures tool name, arguments (redacted), duration, and result summary
6
+ * to `.aikit-state/replay.jsonl`. Used by `aikit replay` CLI, `aikit_replay` MCP tool,
7
+ * and the TUI log panel.
8
+ */
9
+ interface ReplayEntry {
10
+ /** ISO timestamp */
11
+ ts: string;
12
+ /** Source: 'mcp' | 'cli' */
13
+ source: 'mcp' | 'cli';
14
+ /** Tool or command name */
15
+ tool: string;
16
+ /** Redacted input summary (first 200 chars of JSON) */
17
+ input: string;
18
+ /** Duration in milliseconds */
19
+ durationMs: number;
20
+ /** Result status */
21
+ status: 'ok' | 'error';
22
+ /** Short result summary (first 200 chars) */
23
+ output: string;
24
+ }
25
+ interface ReplayOptions {
26
+ /** Max entries to return (default: 20) */
27
+ last?: number;
28
+ /** Filter by tool name */
29
+ tool?: string;
30
+ /** Filter by source */
31
+ source?: 'mcp' | 'cli';
32
+ /** Filter entries after this ISO timestamp */
33
+ since?: string;
34
+ }
35
+ /**
36
+ * Append a replay entry to the audit log.
37
+ * Creates the state directory if it doesn't exist.
38
+ */
39
+ declare function replayAppend(entry: ReplayEntry): void;
40
+ /**
41
+ * Read replay entries with optional filters.
42
+ */
43
+ declare function replayList(opts?: ReplayOptions): ReplayEntry[];
44
+ /**
45
+ * Trim the replay log to MAX_ENTRIES, keeping the most recent.
46
+ * Async to avoid blocking the event loop on large logs.
47
+ */
48
+ declare function replayTrim(): Promise<number>;
49
+ /**
50
+ * Clear the entire replay log.
51
+ */
52
+ declare function replayClear(): void;
53
+ /**
54
+ * Helper: create a replay entry from a tool invocation.
55
+ * Use as a wrapper around tool execution.
56
+ */
57
+ declare function replayCapture(source: 'mcp' | 'cli', tool: string, input: unknown, fn: () => Promise<unknown>): Promise<unknown>;
58
+ //#endregion
59
+ export { ReplayEntry, ReplayOptions, replayAppend, replayCapture, replayClear, replayList, replayTrim };
@@ -0,0 +1,4 @@
1
+ import{readFile as e,writeFile as t}from"node:fs/promises";import{dirname as n,resolve as r}from"node:path";import{appendFileSync as i,mkdirSync as a,readFileSync as o,writeFileSync as s}from"node:fs";import{AIKIT_PATHS as c}from"../../core/dist/index.js";const l=5e3;let u=0;function d(){return r(process.cwd(),c.state,`replay.jsonl`)}function f(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function p(e){let t=d();a(n(t),{recursive:!0});let r={...e,input:f(e.input,200),output:f(e.output,200)};i(t,`${JSON.stringify(r)}\n`,`utf-8`),u++,u>=100&&(u=0,h().catch(()=>{}))}function m(e={}){let t=d(),n;try{n=o(t,`utf-8`)}catch{return[]}let r=n.trim().split(`
2
+ `).filter(Boolean),i=[];for(let e of r)try{i.push(JSON.parse(e))}catch{}if(e.tool&&(i=i.filter(t=>t.tool===e.tool)),e.source&&(i=i.filter(t=>t.source===e.source)),e.since){let t=e.since;i=i.filter(e=>e.ts>=t)}let a=e.last??20;return i.slice(-a)}async function h(){let n=d(),r;try{r=await e(n,`utf-8`)}catch{return 0}let i=r.trim().split(`
3
+ `).filter(Boolean);if(i.length<=l)return 0;let a=i.length-l;return await t(n,`${i.slice(-l).join(`
4
+ `)}\n`,`utf-8`),a}function g(){let e=d();try{s(e,``,`utf-8`)}catch{}}function _(e,t,n,r){let i=Date.now();return r().then(r=>(p({ts:new Date().toISOString(),source:e,tool:t,input:typeof n==`string`?n:JSON.stringify(n),durationMs:Date.now()-i,status:`ok`,output:typeof r==`string`?r:JSON.stringify(r??``)}),r)).catch(r=>{throw p({ts:new Date().toISOString(),source:e,tool:t,input:typeof n==`string`?n:JSON.stringify(n),durationMs:Date.now()-i,status:`error`,output:r instanceof Error?r.message:String(r)}),r})}export{p as replayAppend,_ as replayCapture,g as replayClear,m as replayList,h as replayTrim};
@@ -0,0 +1,43 @@
1
+ //#region packages/tools/src/response-envelope.d.ts
2
+ /**
3
+ * Standardized response envelope for KB tools (E-009).
4
+ * New tools should return KBResponse<T>. Existing tools can adopt gradually.
5
+ */
6
+ interface KBNextHint {
7
+ tool: string;
8
+ reason: string;
9
+ suggested_args?: Record<string, unknown>;
10
+ }
11
+ interface KBError {
12
+ code: KBErrorCode;
13
+ category: 'input' | 'runtime' | 'dependency' | 'timeout' | 'not_found';
14
+ retryable: boolean;
15
+ message: string;
16
+ suggestion?: string;
17
+ }
18
+ type KBErrorCode = 'SYMBOL_NOT_FOUND' | 'INDEX_STALE' | 'TREE_SITTER_UNAVAILABLE' | 'PARSE_FAILED' | 'BUDGET_EXCEEDED' | 'PATH_NOT_FOUND' | 'EMBEDDING_COLD_START' | 'ANALYSIS_FAILED';
19
+ interface KBResponseMeta {
20
+ durationMs: number;
21
+ tokensEstimate: number;
22
+ detail: 'summary' | 'errors' | 'full';
23
+ cached: boolean;
24
+ truncated: boolean;
25
+ caveats?: string[];
26
+ }
27
+ interface KBResponse<T> {
28
+ ok: boolean;
29
+ tool: string;
30
+ summary: string;
31
+ data?: T;
32
+ meta: KBResponseMeta;
33
+ next?: KBNextHint[];
34
+ error?: KBError;
35
+ }
36
+ /** Create a success response. */
37
+ declare function okResponse<T>(tool: string, summary: string, data: T, meta: Partial<KBResponseMeta> & {
38
+ durationMs: number;
39
+ }, next?: KBNextHint[]): KBResponse<T>;
40
+ /** Create an error response. */
41
+ declare function errorResponse(tool: string, error: KBError, durationMs: number): KBResponse<never>;
42
+ //#endregion
43
+ export { KBError, KBErrorCode, KBNextHint, KBResponse, KBResponseMeta, errorResponse, okResponse };
@@ -0,0 +1 @@
1
+ import{estimateTokens as e}from"./text-utils.js";function t(t,n,r,i,a){let o=typeof r==`string`?r:JSON.stringify(r);return{ok:!0,tool:t,summary:n,data:r,meta:{durationMs:i.durationMs,tokensEstimate:i.tokensEstimate??e(o),detail:i.detail??`summary`,cached:i.cached??!1,truncated:i.truncated??!1,...i.caveats?.length?{caveats:i.caveats}:{}},next:a}}function n(t,n,r){return{ok:!1,tool:t,summary:n.message,meta:{durationMs:r,tokensEstimate:e(n.message),detail:`summary`,cached:!1,truncated:!1},error:n}}export{n as errorResponse,t as okResponse};
@@ -0,0 +1,22 @@
1
+ //#region packages/tools/src/restore-points.d.ts
2
+ interface RestorePoint {
3
+ id: string;
4
+ timestamp: string;
5
+ operation: 'codemod' | 'rename' | 'forget';
6
+ files: Array<{
7
+ path: string;
8
+ content: string;
9
+ }>;
10
+ description: string;
11
+ }
12
+ /** Create a restore point before a destructive operation */
13
+ declare function createRestorePoint(operation: RestorePoint['operation'], files: Array<{
14
+ path: string;
15
+ content: string;
16
+ }>, description: string): string;
17
+ /** List all restore points (newest first) */
18
+ declare function listRestorePoints(): RestorePoint[];
19
+ /** Restore files from a restore point, returns list of restored paths */
20
+ declare function restoreFromPoint(id: string): Promise<string[]>;
21
+ //#endregion
22
+ export { RestorePoint, createRestorePoint, listRestorePoints, restoreFromPoint };
@@ -0,0 +1 @@
1
+ import{writeFile as e}from"node:fs/promises";import{dirname as t,join as n}from"node:path";import{existsSync as r,mkdirSync as i,readFileSync as a,readdirSync as o,unlinkSync as s,writeFileSync as c}from"node:fs";import{AIKIT_PATHS as l}from"../../core/dist/index.js";const u=l.restorePoints;function d(){let e=n(process.cwd(),u);return r(e)||i(e,{recursive:!0}),e}function f(e,t,r){let i=d(),a=`${Date.now()}-${e}`,l={id:a,timestamp:new Date().toISOString(),operation:e,files:t,description:r};c(n(i,`${a}.json`),`${JSON.stringify(l,null,2)}\n`,`utf-8`);let u=o(i).filter(e=>e.endsWith(`.json`)).sort();for(;u.length>50;){let e=u.shift();if(!e)break;try{s(n(i,e))}catch{}}return a}function p(){let e=n(process.cwd(),u);return r(e)?o(e).filter(e=>e.endsWith(`.json`)).sort().reverse().map(t=>JSON.parse(a(n(e,t),`utf-8`))):[]}async function m(o){let s=n(n(process.cwd(),u),`${o}.json`);if(!r(s))throw Error(`Restore point not found: ${o}`);let c=JSON.parse(a(s,`utf-8`)),l=[];for(let n of c.files){let a=t(n.path);r(a)||i(a,{recursive:!0}),await e(n.path,n.content,`utf-8`),l.push(n.path)}return l}export{f as createRestorePoint,p as listRestorePoints,m as restoreFromPoint};
@@ -0,0 +1,25 @@
1
+ //#region packages/tools/src/schema-validate.d.ts
2
+ /**
3
+ * aikit_schema_validate — Validate data against a JSON Schema (core subset).
4
+ *
5
+ * Supports: type, required, properties, additionalProperties, items,
6
+ * enum, const, pattern, minimum, maximum, minLength, maxLength,
7
+ * minItems, maxItems.
8
+ */
9
+ interface SchemaValidateOptions {
10
+ data: unknown;
11
+ schema: Record<string, unknown>;
12
+ }
13
+ interface ValidationError {
14
+ path: string;
15
+ message: string;
16
+ expected?: string;
17
+ received?: string;
18
+ }
19
+ interface SchemaValidateResult {
20
+ valid: boolean;
21
+ errors: ValidationError[];
22
+ }
23
+ declare function schemaValidate(options: SchemaValidateOptions): SchemaValidateResult;
24
+ //#endregion
25
+ export { SchemaValidateOptions, SchemaValidateResult, ValidationError, schemaValidate };
@@ -0,0 +1 @@
1
+ function e(e){let n=[];return t(e.data,e.schema,`$`,n),{valid:n.length===0,errors:n}}function t(e,i,a,o){if(`type`in i){let t=i.type;if(!n(e,t)){o.push({path:a,message:`Expected type "${t}"`,expected:t,received:r(e)});return}}if(`enum`in i){let t=i.enum;t.some(t=>JSON.stringify(t)===JSON.stringify(e))||o.push({path:a,message:`Must be one of: ${JSON.stringify(t)}`,received:JSON.stringify(e)})}if(`const`in i&&JSON.stringify(e)!==JSON.stringify(i.const)&&o.push({path:a,message:`Must equal ${JSON.stringify(i.const)}`,received:JSON.stringify(e)}),typeof e==`string`&&(`minLength`in i&&e.length<i.minLength&&o.push({path:a,message:`String too short (min: ${i.minLength})`,received:`length ${e.length}`}),`maxLength`in i&&e.length>i.maxLength&&o.push({path:a,message:`String too long (max: ${i.maxLength})`,received:`length ${e.length}`}),`pattern`in i&&!new RegExp(i.pattern).test(e)&&o.push({path:a,message:`Does not match pattern: ${i.pattern}`})),typeof e==`number`&&(`minimum`in i&&e<i.minimum&&o.push({path:a,message:`Below minimum (${i.minimum})`,received:String(e)}),`maximum`in i&&e>i.maximum&&o.push({path:a,message:`Above maximum (${i.maximum})`,received:String(e)})),Array.isArray(e)&&(`minItems`in i&&e.length<i.minItems&&o.push({path:a,message:`Too few items (min: ${i.minItems})`,received:`length ${e.length}`}),`maxItems`in i&&e.length>i.maxItems&&o.push({path:a,message:`Too many items (max: ${i.maxItems})`,received:`length ${e.length}`}),`items`in i))for(let n=0;n<e.length;n++)t(e[n],i.items,`${a}[${n}]`,o);if(e&&typeof e==`object`&&!Array.isArray(e)){let n=e;if(`required`in i)for(let e of i.required)e in n||o.push({path:`${a}.${e}`,message:`Required property missing`});if(`properties`in i){let e=i.properties;for(let[r,i]of Object.entries(e))r in n&&t(n[r],i,`${a}.${r}`,o)}if(`additionalProperties`in i&&i.additionalProperties===!1){let e=Object.keys(i.properties??{});for(let t of Object.keys(n))e.includes(t)||o.push({path:`${a}.${t}`,message:`Additional property not allowed`})}}}function n(e,t){switch(t){case`string`:return typeof e==`string`;case`number`:return typeof e==`number`&&!Number.isNaN(e);case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`null`:return e===null;case`array`:return Array.isArray(e);case`object`:return typeof e==`object`&&!!e&&!Array.isArray(e);default:return!0}}function r(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}export{e as schemaValidate};
@@ -0,0 +1,51 @@
1
+ import { ContentType, KnowledgeOrigin } from "../../core/dist/index.js";
2
+ import { IEmbedder } from "../../embeddings/dist/index.js";
3
+ import { IKnowledgeStore } from "../../store/dist/index.js";
4
+
5
+ //#region packages/tools/src/scope-map.d.ts
6
+ interface ScopeMapOptions {
7
+ /** Description of the task to scope */
8
+ task: string;
9
+ /** Maximum number of files to include (default: 15) */
10
+ maxFiles?: number;
11
+ /** Group results by directory (default: true) */
12
+ groupByDirectory?: boolean;
13
+ /** Filter by content type */
14
+ contentType?: ContentType;
15
+ /** Filter by origin */
16
+ origin?: KnowledgeOrigin;
17
+ }
18
+ interface ScopeMapEntry {
19
+ /** File path */
20
+ path: string;
21
+ /** Why this file is relevant (derived from matched chunks) */
22
+ reason: string;
23
+ /** Estimated token count (chars / 4 approximation) */
24
+ estimatedTokens: number;
25
+ /** Relevance score (0-1) */
26
+ relevance: number;
27
+ /** Line ranges to focus on */
28
+ focusRanges: Array<{
29
+ start: number;
30
+ end: number;
31
+ heading?: string;
32
+ }>;
33
+ }
34
+ interface ScopeMapResult {
35
+ /** The task that was analyzed */
36
+ task: string;
37
+ /** Prioritized file list */
38
+ files: ScopeMapEntry[];
39
+ /** Total estimated tokens across all files */
40
+ totalEstimatedTokens: number;
41
+ /** Suggested reading order (file paths) */
42
+ readingOrder: string[];
43
+ /** Suggested compact/file_summary commands to reduce context */
44
+ compactCommands: string[];
45
+ }
46
+ /**
47
+ * Generate a task-scoped reading plan.
48
+ */
49
+ declare function scopeMap(embedder: IEmbedder, store: IKnowledgeStore, options: ScopeMapOptions): Promise<ScopeMapResult>;
50
+ //#endregion
51
+ export { ScopeMapEntry, ScopeMapOptions, ScopeMapResult, scopeMap };
@@ -0,0 +1 @@
1
+ function e(e){return Math.ceil(e.length/4)}async function t(t,n,r){let{task:i,maxFiles:a=15,contentType:o,origin:s}=r,c=await t.embed(i),l={limit:a*3,contentType:o,origin:s},u=await n.search(c,l),d=new Map;for(let e of u){let t=e.record.sourcePath,n=d.get(t);n?(n.chunks.push(e),n.totalChars+=e.record.content.length,n.maxScore=Math.max(n.maxScore,e.score)):d.set(t,{chunks:[e],totalChars:e.record.content.length,maxScore:e.score})}let f=[...d.entries()].sort(([,e],[,t])=>t.maxScore-e.maxScore).slice(0,a).map(([e,{chunks:t,maxScore:n}])=>{let r=t.sort((e,t)=>e.record.startLine-t.record.startLine).map(e=>({start:e.record.startLine,end:e.record.endLine,heading:e.record.headingPath})),i=t.sort((e,t)=>t.score-e.score)[0];return{path:e,reason:i.record.headingPath?`Matches: ${i.record.headingPath}`:`Contains relevant ${i.record.contentType} content`,estimatedTokens:0,relevance:n,focusRanges:r}});for(let t of f){let n=d.get(t.path);n&&(t.estimatedTokens=e(n.chunks.map(e=>e.record.content).join(``)))}let p=f.reduce((e,t)=>e+t.estimatedTokens,0),m=[...f].sort((e,t)=>{let n=e.path.includes(`config`)||e.path.includes(`types`)?-1:0,r=t.path.includes(`config`)||t.path.includes(`types`)?-1:0;return n===r?t.relevance-e.relevance:n-r}).map(e=>e.path),h=[];for(let e of f)e.estimatedTokens<=100?h.push(`aikit_file_summary({ path: "${e.path}" }) → ~${e.estimatedTokens} tokens`):h.push(`aikit_compact({ path: "${e.path}", query: "${i}" }) → ~${Math.ceil(e.estimatedTokens/5)} tokens`);return{task:i,files:f,totalEstimatedTokens:p,readingOrder:m,compactCommands:h}}export{t as scopeMap};
@@ -0,0 +1,35 @@
1
+ //#region packages/tools/src/snippet.d.ts
2
+ /**
3
+ * aikit_snippet — Persistent code template storage with search.
4
+ */
5
+ interface Snippet {
6
+ name: string;
7
+ language: string;
8
+ code: string;
9
+ tags: string[];
10
+ created: string;
11
+ updated: string;
12
+ }
13
+ type SnippetAction = 'save' | 'get' | 'list' | 'search' | 'delete';
14
+ interface SnippetOptions {
15
+ action: SnippetAction;
16
+ name?: string;
17
+ language?: string;
18
+ code?: string;
19
+ tags?: string[];
20
+ query?: string;
21
+ }
22
+ type SnippetResult = Snippet | {
23
+ snippets: SnippetSummary[];
24
+ } | {
25
+ deleted: boolean;
26
+ };
27
+ interface SnippetSummary {
28
+ name: string;
29
+ language: string;
30
+ tags: string[];
31
+ updated: string;
32
+ }
33
+ declare function snippet(options: SnippetOptions): SnippetResult;
34
+ //#endregion
35
+ export { Snippet, SnippetAction, SnippetOptions, SnippetResult, snippet };
@@ -0,0 +1 @@
1
+ import{join as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,unlinkSync as a,writeFileSync as o}from"node:fs";import{AIKIT_PATHS as s}from"../../core/dist/index.js";const c=()=>e(process.cwd(),s.state,`snippets`);function l(){let e=c();return t(e)||n(e,{recursive:!0}),e}function u(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);if(!t)throw Error(`Invalid snippet name`);return t}function d(n){switch(n.action){case`save`:{if(!n.name||!n.code)throw Error(`name and code required for save`);let i=e(l(),`${u(n.name)}.json`),a=null;if(t(i))try{a=JSON.parse(r(i,`utf8`))}catch{a=null}let s=new Date().toISOString(),c={name:n.name,language:n.language??`text`,code:n.code,tags:n.tags??[],created:a?.created??s,updated:s};return o(i,JSON.stringify(c,null,2)),c}case`get`:{if(!n.name)throw Error(`name required for get`);let i=e(c(),`${u(n.name)}.json`);if(!t(i))throw Error(`Snippet not found: ${n.name}`);try{return JSON.parse(r(i,`utf8`))}catch{throw Error(`Snippet corrupted: ${n.name}`)}}case`list`:{let t=l();return{snippets:i(t).filter(e=>e.endsWith(`.json`)).flatMap(n=>{try{let i=JSON.parse(r(e(t,n),`utf8`));return[{name:i.name,language:i.language,tags:i.tags,updated:i.updated}]}catch{return[]}})}}case`search`:{if(!n.query)throw Error(`query required for search`);let t=n.query.toLowerCase(),a=l();return{snippets:i(a).filter(e=>e.endsWith(`.json`)).flatMap(t=>{try{return[JSON.parse(r(e(a,t),`utf8`))]}catch{return[]}}).filter(e=>e.name.toLowerCase().includes(t)||e.tags.some(e=>e.toLowerCase().includes(t))||e.language.toLowerCase().includes(t)||e.code.toLowerCase().includes(t)).map(e=>({name:e.name,language:e.language,tags:e.tags,updated:e.updated}))}}case`delete`:{if(!n.name)throw Error(`name required for delete`);let r=e(c(),`${u(n.name)}.json`);return t(r)?(a(r),{deleted:!0}):{deleted:!1}}default:throw Error(`Unknown action: ${n.action}`)}}export{d as snippet};
@@ -0,0 +1,14 @@
1
+ //#region packages/tools/src/stash.d.ts
2
+ interface StashEntry {
3
+ key: string;
4
+ value: unknown;
5
+ type: string;
6
+ storedAt: string;
7
+ }
8
+ declare function stashSet(key: string, value: unknown, cwd?: string): StashEntry;
9
+ declare function stashGet(key: string, cwd?: string): StashEntry | undefined;
10
+ declare function stashList(cwd?: string): StashEntry[];
11
+ declare function stashDelete(key: string, cwd?: string): boolean;
12
+ declare function stashClear(cwd?: string): number;
13
+ //#endregion
14
+ export { StashEntry, stashClear, stashDelete, stashGet, stashList, stashSet };
@@ -0,0 +1 @@
1
+ import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{AIKIT_PATHS as o}from"../../core/dist/index.js";const s=o.state;function c(e){return t(e??process.cwd(),s,`stash.json`)}function l(e){let t=c(e);if(!n(t))return{};try{let e=i(t,`utf-8`);return JSON.parse(e)}catch{return{}}}function u(t,i){let o=c(i),s=e(o);n(s)||r(s,{recursive:!0}),a(o,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function d(e,t,n){let r=l(n),i={key:e,value:t,type:typeof t,storedAt:new Date().toISOString()};return r[e]=i,u(r,n),i}function f(e,t){return l(t)[e]}function p(e){return Object.values(l(e))}function m(e,t){let n=l(t);return e in n?(delete n[e],u(n,t),!0):!1}function h(e){let t=l(e),n=Object.keys(t).length;return u({},e),n}export{h as stashClear,m as stashDelete,f as stashGet,p as stashList,d as stashSet};
@@ -0,0 +1,30 @@
1
+ import { FileCache } from "./file-cache.js";
2
+ import { IEmbedder } from "../../embeddings/dist/index.js";
3
+
4
+ //#region packages/tools/src/stratum-card.d.ts
5
+ interface StratumCardOptions {
6
+ files: string[];
7
+ query: string;
8
+ tier?: 'T1' | 'T2';
9
+ maxContentChars?: number;
10
+ /** Optional file cache — avoids redundant reads and eliminates double-read with fileSummary */
11
+ cache?: FileCache;
12
+ }
13
+ interface StratumCard {
14
+ path: string;
15
+ tier: 'T1' | 'T2';
16
+ card: string;
17
+ unknowns: string[];
18
+ riskTier: 'low' | 'medium' | 'high';
19
+ tokenEstimate: number;
20
+ originalTokenEstimate: number;
21
+ }
22
+ interface StratumCardResult {
23
+ cards: StratumCard[];
24
+ totalTokenEstimate: number;
25
+ totalOriginalTokenEstimate: number;
26
+ compressionRatio: number;
27
+ }
28
+ declare function stratumCard(embedder: IEmbedder, options: StratumCardOptions): Promise<StratumCardResult>;
29
+ //#endregion
30
+ export { StratumCard, StratumCardOptions, StratumCardResult, stratumCard };
@@ -0,0 +1,4 @@
1
+ import{cosineSimilarity as e,estimateTokens as t,segment as n}from"./text-utils.js";import{fileSummary as r}from"./file-summary.js";import{readFile as i}from"node:fs/promises";import{basename as a,extname as o,relative as s}from"node:path";async function c(e,n){let{files:a,query:o,tier:s=`T1`,maxContentChars:c=800}=n,{cache:f}=n,h=s===`T2`?await e.embedQuery(o):null,g=await Promise.all(a.map(async n=>{try{let a=f?(await f.get(n)).content:await i(n,`utf-8`),o=t(a);if(a.includes(`\0`))return l(n,s,`binary`,`binary file`,o);if(a.trim().length===0){let e=u({displayPath:d(n),tier:s,role:`empty`,deps:[],exports:[],unknowns:[],riskTier:`low`});return{path:n,tier:s,card:e,unknowns:[],riskTier:`low`,tokenEstimate:t(e),originalTokenEstimate:o}}let g=await r({path:n,content:a}),y=p(n,g),x=m(a,g),S=_(n,g),C=v(g),w=[...new Set(g.exports)].slice(0,5),T=u({displayPath:d(n),tier:s,role:y,deps:C,exports:w,unknowns:x,riskTier:S});if(s===`T2`&&h){let t=await b(e,h,a,c);t.length>0&&(T=`${T}\nCONTEXT:\n${t}`)}return{path:n,tier:s,card:T,unknowns:x,riskTier:S,tokenEstimate:t(T),originalTokenEstimate:o}}catch(e){let t=e.code===`ENOENT`?`file missing`:`unreadable file`;return l(n,s,e.code===`ENOENT`?`missing`:`unreadable`,t,0)}})),y=g.reduce((e,t)=>e+t.tokenEstimate,0),x=g.reduce((e,t)=>e+t.originalTokenEstimate,0);return{cards:g,totalTokenEstimate:y,totalOriginalTokenEstimate:x,compressionRatio:x===0?0:y/x}}function l(e,n,r,i,a){let o=u({displayPath:d(e),tier:n,role:r,deps:[],exports:[],unknowns:[i],riskTier:`low`});return{path:e,tier:n,card:o,unknowns:[i],riskTier:`low`,tokenEstimate:t(o),originalTokenEstimate:a}}function u(e){let{displayPath:t,tier:n,role:r,deps:i,exports:a,unknowns:o,riskTier:s}=e;return[`[${n}: ${t}]`,`ROLE: ${r}`,`DEPS: ${f(i)}`,`EXPORTS: ${f(a)}`,`UNKNOWNS: ${f(o,`; `)}`,`RISK: ${s}`].join(`
2
+ `)}function d(e){let t=s(process.cwd(),e).replace(/\\/g,`/`);return!t||t.startsWith(`..`)?a(e):t}function f(e,t=`, `){return e.length>0?e.join(t):`none`}function p(e,t){let n=a(e),r=o(n).toLowerCase();return[`.json`,`.yaml`,`.yml`,`.env`].includes(r)||/config|settings/i.test(n)?`configuration`:/types?\.ts$|\.d\.ts$/i.test(n)?`type-definitions`:/schema/i.test(n)?`schema`:/test|spec/i.test(n)?`test`:/index\.[jt]sx?$/i.test(n)?`barrel-export`:/handler|controller|route/i.test(n)?`entry-point`:/model|entity/i.test(n)?`data-model`:/util|helper/i.test(n)?`utility`:/service|provider/i.test(n)?`service`:t.classes.length>0?`class-module`:t.interfaces.length>2?`type-definitions`:`implementation`}function m(e,t){let n=[],r=new Set;for(let t of e.matchAll(/\/\/\s*(TODO|FIXME|HACK|XXX)\s*:?\s*(.+)?$/gm))h(n,r,`${t[1]}: ${(t[2]??``).trim()}`.trim().replace(/:\s*$/,``));g(e)&&h(n,r,`exported any usage`);for(let e of v(t))h(n,r,`cross-package import: ${e}`);return n.slice(0,3)}function h(e,t,n){e.length>=3||!n||t.has(n)||(t.add(n),e.push(n))}function g(e){return[/export\s+(?:async\s+)?function\s+\w+[^\n{;]*\bany\b/g,/export\s+interface\s+\w+[\s\S]*?\{[\s\S]*?\bany\b[\s\S]*?\}/g,/export\s+type\s+\w+\s*=.*\bany\b/g,/export\s+const\s+\w+[^\n=]*\bany\b/g].some(t=>t.test(e))}function _(e,t){return/auth|token|permission|secret|credential|encrypt/i.test(e)?`high`:/types?\.ts$|schema|contract|\.d\.ts$/i.test(a(e))||t.exports.length>10?`medium`:`low`}function v(e){return e.imports.map(y).filter(e=>!!e).filter(e=>!e.startsWith(`./`)&&!e.startsWith(`../`)).slice(0,3)}function y(e){let t=e.match(/from\s+['"]([^'"]+)['"]/);if(t)return t[1];let n=e.match(/^import\s+['"]([^'"]+)['"]/);return n?n[1]:null}async function b(t,r,i,a){if(a<=0)return``;let o=n(i,`paragraph`);if(o.length===0)return``;let s=await Promise.all(o.map(async(n,i)=>({index:i,text:n,score:e(r,await t.embed(n))}))),c=[],l=0;for(let e of s.sort((e,t)=>t.score-e.score)){let t=a-l;if(t<=0)break;if(e.text.length<=t){c.push({index:e.index,text:e.text}),l+=e.text.length;continue}c.length===0&&(c.push({index:e.index,text:e.text.slice(0,t).trimEnd()}),l=a);break}return c.sort((e,t)=>e.index-t.index).map(e=>e.text).filter(e=>e.length>0).join(`
3
+
4
+ `)}export{c as stratumCard};
@@ -0,0 +1,45 @@
1
+ import { IEmbedder } from "../../embeddings/dist/index.js";
2
+ import { IGraphStore, IKnowledgeStore } from "../../store/dist/index.js";
3
+
4
+ //#region packages/tools/src/symbol.d.ts
5
+ interface SymbolGraphContext {
6
+ /** Module that defines this symbol */
7
+ definingModule?: string;
8
+ /** Modules that import the file containing this symbol */
9
+ importedByModules: string[];
10
+ /** Symbols defined in the same module */
11
+ siblingSymbols: string[];
12
+ }
13
+ interface SymbolInfo {
14
+ name: string;
15
+ definedIn?: {
16
+ path: string;
17
+ line: number;
18
+ kind: string;
19
+ signature?: string;
20
+ };
21
+ importedBy: Array<{
22
+ path: string;
23
+ line: number;
24
+ importStatement: string;
25
+ }>;
26
+ referencedIn: Array<{
27
+ path: string;
28
+ line: number;
29
+ context: string;
30
+ scope?: string;
31
+ }>;
32
+ /** Graph-derived context (when graph store available) */
33
+ graphContext?: SymbolGraphContext;
34
+ }
35
+ interface SymbolOptions {
36
+ /** Symbol name to look up */
37
+ name: string;
38
+ /** Limit results */
39
+ limit?: number;
40
+ /** Optional graph store for enriching results */
41
+ graphStore?: IGraphStore;
42
+ }
43
+ declare function symbol(embedder: IEmbedder, store: IKnowledgeStore, options: SymbolOptions): Promise<SymbolInfo>;
44
+ //#endregion
45
+ export { SymbolGraphContext, SymbolInfo, SymbolOptions, symbol };
@@ -0,0 +1,3 @@
1
+ import{escapeRegExp as e}from"./regex-utils.js";import{extname as t}from"node:path";import{SUPPORTED_EXTENSIONS as n,WasmRuntime as r,extractSymbols as i,resolveScopes as a}from"../../chunker/dist/index.js";async function o(o,s,c){let{name:l,limit:u=20,graphStore:d}=c,f=o.embedQuery?.bind(o)??o.embed.bind(o),p=[`export function ${l}`,`export class ${l}`,`export const ${l}`,`export interface ${l}`,`export type ${l}`,`export enum ${l}`].join(` | `),m=await s.search(await f(p),{limit:u*2}),h=RegExp(`^export\\s+(?:default\\s+)?(?:async\\s+)?(?:function|class|const|let|interface|type|enum)\\s+${e(l)}\\b`,`m`),g;for(let e of m){if(!h.test(e.record.content))continue;let a=e.record.content.match(/export\s+(?:default\s+)?(?:async\s+)?(\w+)/)?.[1]??`unknown`;g={path:e.record.sourcePath,line:e.record.startLine,kind:a};let o=t(e.record.sourcePath);if(r.get()&&n.has(o))try{let t=(await i(e.record.content,o,e.record.sourcePath)).find(e=>e.name===l&&e.exported);t&&(g.kind=t.kind,t.signature&&(g.signature=t.signature))}catch{}break}let _=RegExp(`import\\s+.*\\b${e(l)}\\b.*from\\s+`,`m`),v=await s.search(await f(`import ${l} from`),{limit:u*3}),y=[],b=new Set;for(let e of v){let t=e.record.content.split(`
2
+ `);for(let n=0;n<t.length;n++){let r=t[n];if(!_.test(r))continue;let i=`${e.record.sourcePath}:${r.trim()}`;b.has(i)||(b.add(i),y.push({path:e.record.sourcePath,line:e.record.startLine+n,importStatement:r.trim()}))}}let x=RegExp(`\\b${e(l)}\\b`),S=await s.search(await f(l),{limit:u*3}),C=[],w=new Set;for(let e of S){if(C.length>=u)break;if(g&&e.record.sourcePath===g.path)continue;let i=e.record.content.split(`
3
+ `);for(let o=0;o<i.length;o++){let s=i[o];if(!x.test(s)||_.test(s))continue;let c=`${e.record.sourcePath}:${e.record.startLine+o}`;if(w.has(c))continue;w.add(c);let l,u=t(e.record.sourcePath);if(r.get()&&n.has(u))try{let t=await a(e.record.content,u,o+1);t.length>0&&(l=t[0].name)}catch{}C.push({path:e.record.sourcePath,line:e.record.startLine+o,context:s.trim().slice(0,120),scope:l});break}}let T;if(d)try{let e={importedByModules:[],siblingSymbols:[]},t=await d.findNodes({namePattern:l});if(t.length>0){let n=t[0];n.sourcePath?e.definingModule=n.sourcePath:g&&(e.definingModule=g.path);let r=await d.getNeighbors(n.id,{direction:`incoming`,edgeType:`imports`});for(let t of r.nodes)e.importedByModules.push(t.sourcePath??t.name);if(e.definingModule){let t=await d.findNodes({sourcePath:e.definingModule});for(let n of t)n.name!==l&&n.type!==`module`&&e.siblingSymbols.push(`${n.type}:${n.name}`);e.siblingSymbols=e.siblingSymbols.slice(0,15)}}(e.definingModule||e.importedByModules.length>0||e.siblingSymbols.length>0)&&(T=e)}catch{}return{name:l,definedIn:g,importedBy:y.slice(0,u),referencedIn:C.slice(0,u),graphContext:T}}export{o as symbol};
@@ -0,0 +1,13 @@
1
+ import { OnboardMode, OnboardStepResult } from "./onboard.js";
2
+
3
+ //#region packages/tools/src/synthesis-engine.d.ts
4
+ declare function buildSynthesisGuide(steps: OnboardStepResult[], mode: OnboardMode, projectName: string, dataMap: Map<string, Record<string, unknown>>): string;
5
+ /**
6
+ * Build a compact code-map.md showing module relationships with call edges.
7
+ * Uses TypeScript compiler API call graph when available, falls back to
8
+ * import-based dependency graph for non-TS projects.
9
+ * Designed to be LLM-consumable (~10-50KB).
10
+ */
11
+ declare function buildCodeMap(dataMap: Map<string, Record<string, unknown>>, projectName: string, callGraph: Map<string, Map<string, string[]>> | null): string;
12
+ //#endregion
13
+ export { buildCodeMap, buildSynthesisGuide };
@@ -0,0 +1,6 @@
1
+ import{getPackageKey as e,isTestPath as t,resolveExtensionlessPath as n}from"./onboard-utils.js";const r={structure:`Project Structure`,dependencies:`Dependencies`,"entry-points":`Entry Points`,symbols:`Symbols`,patterns:`Patterns`,diagram:`C4 Container Diagram`,"code-map":`Code Map (Module Graph)`,"config-values":`Configuration Values`,"synthesis-guide":`Synthesis Guide`};function i(e,t,n,i){let a=[`Analysis baselines for **${n}** have been generated.`];t===`generate`?a.push("Individual results are in the sibling `.md` and `.json` files in this directory.",``):a.push(`Results are stored in the KB vector store.`,``);let o=i.get(`symbols`),s=i.get(`dependencies`),c=i.get(`patterns`),l=i.get(`entry-points`),u=o?.totalCount??0,d=o?.exportedCount??0,f=s?.totalImports??0,p=l?.total??0,m=(c?.patterns??[]).map(e=>e.pattern),h=m.some(e=>e.startsWith(`Spring`)),g=m.includes(`AWS CDK`)||m.includes(`CDK IaC`),_=m.includes(`Maven`),v=m.includes(`Serverless`)||p>3,y=s?.external?Object.keys(s.external):[],b=y.some(e=>[`express`,`fastify`,`next`,`react`,`vitest`,`jest`].includes(e))||f>0,x=y.some(e=>[`turbo`,`lerna`,`nx`].includes(e))||m.includes(`Monorepo`);if(a.push(`### Project Profile`,``),a.push(`- **${u} symbols** (${d} exported), **${f} imports**, **${p} entry ${p===1?`point`:`points`}**`),m.length>0&&a.push(`- **Detected**: ${m.slice(0,8).join(`, `)}`),a.push(``),u===0&&f===0&&p===0)return a.push(`> **Note:** This project appears to be empty or contains no analyzable source code.`,`> Run onboard again after adding source files.`),a.join(`
2
+ `);let S=e.filter(e=>e.status===`success`),C=e.filter(e=>e.status===`failed`);a.push(`### Completed Analyses`,``);for(let e of S){let n=r[e.name]??e.name,i=e.output.length>1e3?`${Math.round(e.output.length/1024)}KB`:`${e.output.length}B`;t===`generate`?a.push(`- ✓ [${n}](./${e.name}.md) (${i})`):a.push(`- ✓ ${n} (${i})`)}if(C.length>0){a.push(``,`### Failed Analyses`,``);for(let e of C)a.push(`- ✗ ${e.name}: ${e.error}`)}a.push(``,`### Recommended Reading Order`,``,"1. **Start with** `synthesis-guide.md` (this file) → `entry-points.md` → `patterns.md`","2. **Module graph** via `code-map.md` — cross-package call edges with function names","3. **Architecture** via `diagram.md` (C4 Container) → `dependencies.md`","4. **Browse structure** via `structure.md` for file layout","5. **API surface** via `symbols.md` — file paths + exported symbols (capped at 80KB)","6. **Reference**: `config-values.md` (config reference)",``,`> **Size guidance:** Total output is ~`);let w=S.reduce((e,t)=>e+t.output.length,0)/1024;return a[a.length-1]+=`${Math.round(w)}KB. Focus on code-map.md + entry-points.md + diagram.md (~${Math.round((S.find(e=>e.name===`code-map`)?.output.length??0)/1024+(S.find(e=>e.name===`entry-points`)?.output.length??0)/1024+(S.find(e=>e.name===`diagram`)?.output.length??0)/1024)}KB) for maximum signal-to-token ratio.`,a.push(``,`### Synthesize Knowledge`,``,"Produce the following `aikit_remember` entries:",``),a.push("1. **Architecture Summary** (category: `architecture`)"),x?(a.push(` - Package boundaries, dependency graph between packages`),a.push(` - Shared vs service-specific code`)):v?(a.push(` - Lambda functions, triggers, event flow`),a.push(` - Infrastructure patterns (queues, tables, APIs)`)):h?(a.push(` - Controller → Service → Repository layers`),a.push(` - Spring configuration and profiles`)):(a.push(` - Layer structure, dependency flow`),a.push(` - Key design decisions`)),a.push(``),a.push("2. **Domain Model** (category: `architecture`)"),a.push(` - Key entities/types and their relationships`),a.push(` - Data flow from entry points through processing`),a.push(``),a.push("3. **Conventions** (category: `conventions`)"),a.push(` - Naming patterns, file organization, testing approach`),g&&a.push(` - CDK construct patterns and stack organization`),b&&a.push(` - Build tooling, package manager, module system`),_&&a.push(` - Maven module structure, dependency management`),a.push(``,`### Using KB Tools`,``,`This project has a KB MCP server with tools for search, analysis, memory, and more.`,"`aikit init` has already created `.github/copilot-instructions.md` and `AGENTS.md` with the complete tool reference.","If not, run `npx @vpxa/aikit init` to generate them.",``,`**Workflow pattern — use on every task:**`,``,"```",`aikit_search({ query: "your task keywords" }) # Recall prior decisions`,`aikit_scope_map({ task: "what you are doing" }) # Get a reading plan`,`# ... do the work ...`,`aikit_check({}) # Typecheck + lint`,`aikit_test_run({}) # Run tests`,`aikit_remember({ title: "What I learned", category: "decisions" }) # Persist`,"```"),a.join(`
3
+ `)}function a(r,i,a){let o=r.get(`dependencies`),s=r.get(`symbols`),c=r.get(`entry-points`),l=[`## Code Map: ${i}\n`];if(!o&&!s)return l.push(`No dependency or symbol data available.`),l.join(`
4
+ `);let u=o?.reverseGraph??{},d=s?.symbols??[],f=c?.entryPoints??[],p=new Map;for(let e of d){if(!e.exported)continue;let n=e.filePath.replace(/\\/g,`/`);if(t(n))continue;let r=p.get(n);r?r.push({name:e.name,kind:e.kind}):p.set(n,[{name:e.name,kind:e.kind}])}let m=new Map;for(let[e,r]of Object.entries(u)){let i=n(e.replace(/\\/g,`/`),p),a=r.map(e=>e.replace(/\\/g,`/`)).filter(e=>!t(e));if(a.length===0)continue;let o=m.get(i);if(o)for(let e of a)o.add(e);else m.set(i,new Set(a))}let h=new Map;for(let e of f)h.set(e.filePath.replace(/\\/g,`/`),{name:e.name,trigger:e.trigger});let g=new Map,_=new Map;if(a)for(let[n,r]of a){if(t(n))continue;let i=e(n);for(let[a,o]of r){if(t(a)||i===e(a))continue;let r=g.get(n);r||(r=new Map,g.set(n,r)),r.set(a,o);let s=_.get(a),c={file:n,symbols:o};s?s.push(c):_.set(a,[c])}}let v=new Set;for(let e of h.keys())v.add(e);for(let e of g.keys())v.add(e);for(let e of _.keys())v.add(e);if(!a)for(let e of p.keys()){let t=m.get(e);t&&t.size>=3&&v.add(e)}let y=new Map;for(let t of v){let n=e(t),r=y.get(n);r?r.push(t):y.set(n,[t])}let b=[...y.entries()].sort((e,t)=>e[0].localeCompare(t[0])),x=a?`AST call graph`:`import analysis`,S=a?`, ${g.size} cross-package callers`:``;l.push(`**${v.size} key modules** (${x}${S})\n`),l.push(`**Legend:** ⚡ Entry point | 📤 Exports | → Calls (outgoing) | ← Called by (incoming) | ➡ Used by (import)
5
+ `);for(let[e,n]of b){n.sort(),l.push(`### ${e}/\n`);for(let r of n){let n=p.get(r),i=h.get(r),o=g.get(r),s=_.get(r),c=m.get(r),u=r.startsWith(`${e}/`)?r.slice(e.length+1):r;if(l.push(`**${u}**`),i&&l.push(` ⚡ Entry: \`${i.name}\`${i.trigger?` (${i.trigger})`:``}`),n&&n.length>0){let e=n.slice(0,8).map(e=>`${e.name}`).join(`, `),t=n.length>8?` (+${n.length-8})`:``;l.push(` 📤 ${e}${t}`)}if(o&&o.size>0){let t=[...o.entries()].sort((e,t)=>t[1].length-e[1].length);for(let[n,r]of t.slice(0,4)){let t=n.startsWith(`${e}/`)?n.slice(e.length+1):n;l.push(` → ${t}: ${r.slice(0,5).join(`, `)}${r.length>5?`…`:``}`)}t.length>4&&l.push(` → +${t.length-4} more targets`)}if(s&&s.length>0){for(let t of s.slice(0,4)){let n=t.file.startsWith(`${e}/`)?t.file.slice(e.length+1):t.file;l.push(` ← ${n}: ${t.symbols.slice(0,4).join(`, `)}${t.symbols.length>4?`…`:``}`)}s.length>4&&l.push(` ← +${s.length-4} more callers`)}else if(!a&&c&&c.size>0){let e=[...c].filter(e=>!t(e));e.length<=3?l.push(` ➡ Used by: ${e.join(`, `)}`):l.push(` ➡ Used by: ${e.slice(0,3).join(`, `)} (+${e.length-3} more)`)}l.push(``)}}return l.join(`
6
+ `)}export{a as buildCodeMap,i as buildSynthesisGuide};