@vpxa/kb 0.1.13 → 0.1.16

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 (490) hide show
  1. package/README.md +65 -12
  2. package/package.json +14 -7
  3. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -21
  4. package/packages/analyzers/dist/blast-radius-analyzer.js +5 -12
  5. package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -28
  6. package/packages/analyzers/dist/dependency-analyzer.js +6 -9
  7. package/packages/analyzers/dist/diagram-generator.d.ts +12 -9
  8. package/packages/analyzers/dist/diagram-generator.js +2 -4
  9. package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -36
  10. package/packages/analyzers/dist/entry-point-analyzer.js +4 -6
  11. package/packages/analyzers/dist/index.d.ts +12 -14
  12. package/packages/analyzers/dist/index.js +1 -1
  13. package/packages/analyzers/dist/knowledge-producer.d.ts +34 -26
  14. package/packages/analyzers/dist/knowledge-producer.js +17 -15
  15. package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -11
  16. package/packages/analyzers/dist/pattern-analyzer.js +2 -5
  17. package/packages/analyzers/dist/regex-call-graph.d.ts +6 -13
  18. package/packages/analyzers/dist/regex-call-graph.js +1 -1
  19. package/packages/analyzers/dist/structure-analyzer.d.ts +13 -10
  20. package/packages/analyzers/dist/structure-analyzer.js +2 -4
  21. package/packages/analyzers/dist/symbol-analyzer.d.ts +13 -9
  22. package/packages/analyzers/dist/symbol-analyzer.js +9 -13
  23. package/packages/analyzers/dist/ts-call-graph.d.ts +16 -14
  24. package/packages/analyzers/dist/ts-call-graph.js +1 -1
  25. package/packages/analyzers/dist/types.d.ts +82 -80
  26. package/packages/analyzers/dist/types.js +1 -0
  27. package/packages/chunker/dist/call-graph-extractor.d.ts +15 -12
  28. package/packages/chunker/dist/call-graph-extractor.js +1 -1
  29. package/packages/chunker/dist/chunker-factory.d.ts +16 -4
  30. package/packages/chunker/dist/chunker-factory.js +1 -1
  31. package/packages/chunker/dist/chunker.interface.d.ts +8 -5
  32. package/packages/chunker/dist/chunker.interface.js +1 -0
  33. package/packages/chunker/dist/code-chunker.d.ts +16 -13
  34. package/packages/chunker/dist/code-chunker.js +11 -14
  35. package/packages/chunker/dist/extractors/call-extractor.d.ts +24 -0
  36. package/packages/chunker/dist/extractors/call-extractor.js +1 -0
  37. package/packages/chunker/dist/extractors/entry-point-detector.d.ts +14 -0
  38. package/packages/chunker/dist/extractors/entry-point-detector.js +1 -0
  39. package/packages/chunker/dist/extractors/import-extractor.d.ts +14 -0
  40. package/packages/chunker/dist/extractors/import-extractor.js +1 -0
  41. package/packages/chunker/dist/extractors/pattern-detector.d.ts +14 -0
  42. package/packages/chunker/dist/extractors/pattern-detector.js +1 -0
  43. package/packages/chunker/dist/extractors/scope-resolver.d.ts +26 -0
  44. package/packages/chunker/dist/extractors/scope-resolver.js +1 -0
  45. package/packages/chunker/dist/extractors/symbol-extractor.d.ts +14 -0
  46. package/packages/chunker/dist/extractors/symbol-extractor.js +1 -0
  47. package/packages/chunker/dist/extractors/types.d.ts +36 -0
  48. package/packages/chunker/dist/extractors/types.js +1 -0
  49. package/packages/chunker/dist/generic-chunker.d.ts +14 -11
  50. package/packages/chunker/dist/generic-chunker.js +5 -5
  51. package/packages/chunker/dist/index.d.ts +19 -8
  52. package/packages/chunker/dist/index.js +1 -1
  53. package/packages/chunker/dist/markdown-chunker.d.ts +16 -13
  54. package/packages/chunker/dist/markdown-chunker.js +3 -10
  55. package/packages/chunker/dist/wasm/languages.d.ts +18 -0
  56. package/packages/chunker/dist/wasm/languages.js +1 -0
  57. package/packages/chunker/dist/wasm/query-executor.d.ts +70 -0
  58. package/packages/chunker/dist/wasm/query-executor.js +1 -0
  59. package/packages/chunker/dist/wasm/runtime.d.ts +44 -0
  60. package/packages/chunker/dist/wasm/runtime.js +1 -0
  61. package/packages/chunker/dist/wasm/types.d.ts +84 -0
  62. package/packages/chunker/dist/wasm/types.js +1 -0
  63. package/packages/chunker/dist/wasm-chunker.d.ts +23 -0
  64. package/packages/chunker/dist/wasm-chunker.js +6 -0
  65. package/packages/chunker/src/queries/go/calls.scm +11 -0
  66. package/packages/chunker/src/queries/go/entry-points.scm +20 -0
  67. package/packages/chunker/src/queries/go/imports.scm +6 -0
  68. package/packages/chunker/src/queries/go/patterns.scm +25 -0
  69. package/packages/chunker/src/queries/go/symbols.scm +26 -0
  70. package/packages/chunker/src/queries/java/calls.scm +10 -0
  71. package/packages/chunker/src/queries/java/entry-points.scm +27 -0
  72. package/packages/chunker/src/queries/java/imports.scm +11 -0
  73. package/packages/chunker/src/queries/java/patterns.scm +27 -0
  74. package/packages/chunker/src/queries/java/symbols.scm +28 -0
  75. package/packages/chunker/src/queries/javascript/calls.scm +21 -0
  76. package/packages/chunker/src/queries/javascript/entry-points.scm +31 -0
  77. package/packages/chunker/src/queries/javascript/imports.scm +32 -0
  78. package/packages/chunker/src/queries/javascript/patterns.scm +28 -0
  79. package/packages/chunker/src/queries/javascript/symbols.scm +52 -0
  80. package/packages/chunker/src/queries/python/calls.scm +11 -0
  81. package/packages/chunker/src/queries/python/entry-points.scm +21 -0
  82. package/packages/chunker/src/queries/python/imports.scm +14 -0
  83. package/packages/chunker/src/queries/python/patterns.scm +25 -0
  84. package/packages/chunker/src/queries/python/symbols.scm +17 -0
  85. package/packages/chunker/src/queries/rust/calls.scm +20 -0
  86. package/packages/chunker/src/queries/rust/entry-points.scm +7 -0
  87. package/packages/chunker/src/queries/rust/imports.scm +26 -0
  88. package/packages/chunker/src/queries/rust/patterns.scm +18 -0
  89. package/packages/chunker/src/queries/rust/symbols.scm +73 -0
  90. package/packages/chunker/src/queries/typescript/calls.scm +21 -0
  91. package/packages/chunker/src/queries/typescript/entry-points.scm +48 -0
  92. package/packages/chunker/src/queries/typescript/imports.scm +35 -0
  93. package/packages/chunker/src/queries/typescript/patterns.scm +47 -0
  94. package/packages/chunker/src/queries/typescript/symbols.scm +79 -0
  95. package/packages/chunker/wasm/tree-sitter-go.wasm +0 -0
  96. package/packages/chunker/wasm/tree-sitter-java.wasm +0 -0
  97. package/packages/chunker/wasm/tree-sitter-javascript.wasm +0 -0
  98. package/packages/chunker/wasm/tree-sitter-python.wasm +0 -0
  99. package/packages/chunker/wasm/tree-sitter-rust.wasm +0 -0
  100. package/packages/chunker/wasm/tree-sitter-typescript.wasm +0 -0
  101. package/packages/chunker/wasm/tree-sitter.wasm +0 -0
  102. package/packages/cli/dist/commands/analyze.d.ts +6 -3
  103. package/packages/cli/dist/commands/analyze.js +2 -3
  104. package/packages/cli/dist/commands/context-cmds.d.ts +6 -3
  105. package/packages/cli/dist/commands/context-cmds.js +1 -1
  106. package/packages/cli/dist/commands/environment.d.ts +6 -3
  107. package/packages/cli/dist/commands/environment.js +1 -2
  108. package/packages/cli/dist/commands/execution.d.ts +6 -3
  109. package/packages/cli/dist/commands/execution.js +1 -1
  110. package/packages/cli/dist/commands/graph.d.ts +6 -3
  111. package/packages/cli/dist/commands/graph.js +5 -6
  112. package/packages/cli/dist/commands/init/adapters.d.ts +28 -0
  113. package/packages/cli/dist/commands/init/adapters.js +1 -0
  114. package/packages/cli/dist/commands/init/config.d.ts +10 -0
  115. package/packages/cli/dist/commands/init/config.js +3 -0
  116. package/packages/cli/dist/commands/init/constants.d.ts +18 -0
  117. package/packages/cli/dist/commands/init/constants.js +1 -0
  118. package/packages/cli/dist/commands/init/curated.d.ts +7 -0
  119. package/packages/cli/dist/commands/init/curated.js +1 -0
  120. package/packages/cli/dist/commands/init/global.d.ts +34 -0
  121. package/packages/cli/dist/commands/init/global.js +5 -0
  122. package/packages/cli/dist/commands/init/index.d.ts +28 -0
  123. package/packages/cli/dist/commands/init/index.js +5 -0
  124. package/packages/cli/dist/commands/init/scaffold.d.ts +23 -0
  125. package/packages/cli/dist/commands/init/scaffold.js +1 -0
  126. package/packages/cli/dist/commands/init/templates.d.ts +9 -0
  127. package/packages/cli/dist/commands/init/templates.js +165 -0
  128. package/packages/cli/dist/commands/knowledge.d.ts +6 -3
  129. package/packages/cli/dist/commands/knowledge.js +1 -1
  130. package/packages/cli/dist/commands/search.d.ts +6 -3
  131. package/packages/cli/dist/commands/search.js +1 -8
  132. package/packages/cli/dist/commands/system.d.ts +6 -3
  133. package/packages/cli/dist/commands/system.js +4 -7
  134. package/packages/cli/dist/commands/workspace.d.ts +6 -3
  135. package/packages/cli/dist/commands/workspace.js +1 -2
  136. package/packages/cli/dist/context.d.ts +7 -5
  137. package/packages/cli/dist/context.js +1 -1
  138. package/packages/cli/dist/helpers.d.ts +51 -48
  139. package/packages/cli/dist/helpers.js +5 -5
  140. package/packages/cli/dist/index.d.ts +4 -2
  141. package/packages/cli/dist/index.js +2 -2
  142. package/packages/cli/dist/kb-init.d.ts +48 -51
  143. package/packages/cli/dist/kb-init.js +1 -1
  144. package/packages/cli/dist/types.d.ts +8 -6
  145. package/packages/cli/dist/types.js +1 -0
  146. package/packages/core/dist/constants.d.ts +58 -34
  147. package/packages/core/dist/constants.js +1 -1
  148. package/packages/core/dist/content-detector.d.ts +8 -8
  149. package/packages/core/dist/content-detector.js +1 -1
  150. package/packages/core/dist/errors.d.ts +15 -13
  151. package/packages/core/dist/errors.js +1 -1
  152. package/packages/core/dist/global-registry.d.ts +62 -0
  153. package/packages/core/dist/global-registry.js +1 -0
  154. package/packages/core/dist/index.d.ts +7 -6
  155. package/packages/core/dist/index.js +1 -1
  156. package/packages/core/dist/logger.d.ts +19 -8
  157. package/packages/core/dist/logger.js +1 -1
  158. package/packages/core/dist/types.d.ts +107 -92
  159. package/packages/core/dist/types.js +1 -0
  160. package/packages/embeddings/dist/embedder.interface.d.ts +22 -20
  161. package/packages/embeddings/dist/embedder.interface.js +1 -0
  162. package/packages/embeddings/dist/index.d.ts +3 -3
  163. package/packages/embeddings/dist/index.js +1 -1
  164. package/packages/embeddings/dist/onnx-embedder.d.ts +21 -23
  165. package/packages/embeddings/dist/onnx-embedder.js +1 -1
  166. package/packages/enterprise-bridge/dist/cache.d.ts +28 -0
  167. package/packages/enterprise-bridge/dist/cache.js +1 -0
  168. package/packages/enterprise-bridge/dist/er-client.d.ts +37 -0
  169. package/packages/enterprise-bridge/dist/er-client.js +1 -0
  170. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +62 -0
  171. package/packages/enterprise-bridge/dist/evolution-collector.js +1 -0
  172. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  173. package/packages/enterprise-bridge/dist/index.js +1 -0
  174. package/packages/enterprise-bridge/dist/policy-store.d.ts +45 -0
  175. package/packages/enterprise-bridge/dist/policy-store.js +1 -0
  176. package/packages/enterprise-bridge/dist/push-adapter.d.ts +23 -0
  177. package/packages/enterprise-bridge/dist/push-adapter.js +1 -0
  178. package/packages/enterprise-bridge/dist/result-merger.d.ts +14 -0
  179. package/packages/enterprise-bridge/dist/result-merger.js +1 -0
  180. package/packages/enterprise-bridge/dist/types.d.ts +81 -0
  181. package/packages/enterprise-bridge/dist/types.js +1 -0
  182. package/packages/indexer/dist/file-hasher.d.ts +5 -3
  183. package/packages/indexer/dist/file-hasher.js +1 -1
  184. package/packages/indexer/dist/filesystem-crawler.d.ts +23 -21
  185. package/packages/indexer/dist/filesystem-crawler.js +1 -1
  186. package/packages/indexer/dist/graph-extractor.d.ts +9 -13
  187. package/packages/indexer/dist/graph-extractor.js +1 -1
  188. package/packages/indexer/dist/incremental-indexer.d.ts +49 -44
  189. package/packages/indexer/dist/incremental-indexer.js +1 -1
  190. package/packages/indexer/dist/index.d.ts +5 -5
  191. package/packages/indexer/dist/index.js +1 -1
  192. package/packages/server/dist/api.d.ts +3 -8
  193. package/packages/server/dist/api.js +1 -1
  194. package/packages/server/dist/config.d.ts +6 -3
  195. package/packages/server/dist/config.js +1 -1
  196. package/packages/server/dist/cross-workspace.d.ts +43 -0
  197. package/packages/server/dist/cross-workspace.js +1 -0
  198. package/packages/server/dist/curated-manager.d.ts +80 -78
  199. package/packages/server/dist/curated-manager.js +5 -10
  200. package/packages/server/dist/index.d.ts +1 -2
  201. package/packages/server/dist/index.js +1 -1
  202. package/packages/server/dist/replay-interceptor.d.ts +6 -7
  203. package/packages/server/dist/replay-interceptor.js +1 -1
  204. package/packages/server/dist/resources/resources.d.ts +7 -4
  205. package/packages/server/dist/resources/resources.js +2 -2
  206. package/packages/server/dist/server.d.ts +37 -25
  207. package/packages/server/dist/server.js +1 -1
  208. package/packages/server/dist/tools/analyze.tools.d.ts +14 -11
  209. package/packages/server/dist/tools/analyze.tools.js +1 -3
  210. package/packages/server/dist/tools/audit.tool.d.ts +8 -5
  211. package/packages/server/dist/tools/audit.tool.js +1 -4
  212. package/packages/server/dist/tools/bridge.tools.d.ts +34 -0
  213. package/packages/server/dist/tools/bridge.tools.js +15 -0
  214. package/packages/server/dist/tools/evolution.tools.d.ts +7 -0
  215. package/packages/server/dist/tools/evolution.tools.js +5 -0
  216. package/packages/server/dist/tools/forge.tools.d.ts +13 -12
  217. package/packages/server/dist/tools/forge.tools.js +10 -13
  218. package/packages/server/dist/tools/forget.tool.d.ts +7 -4
  219. package/packages/server/dist/tools/forget.tool.js +1 -7
  220. package/packages/server/dist/tools/graph.tool.d.ts +7 -4
  221. package/packages/server/dist/tools/graph.tool.js +4 -5
  222. package/packages/server/dist/tools/list.tool.d.ts +7 -4
  223. package/packages/server/dist/tools/list.tool.js +2 -8
  224. package/packages/server/dist/tools/lookup.tool.d.ts +7 -4
  225. package/packages/server/dist/tools/lookup.tool.js +2 -9
  226. package/packages/server/dist/tools/onboard.tool.d.ts +8 -5
  227. package/packages/server/dist/tools/onboard.tool.js +2 -2
  228. package/packages/server/dist/tools/policy.tools.d.ts +7 -0
  229. package/packages/server/dist/tools/policy.tools.js +2 -0
  230. package/packages/server/dist/tools/produce.tool.d.ts +6 -3
  231. package/packages/server/dist/tools/produce.tool.js +2 -2
  232. package/packages/server/dist/tools/read.tool.d.ts +7 -4
  233. package/packages/server/dist/tools/read.tool.js +2 -6
  234. package/packages/server/dist/tools/reindex.tool.d.ts +10 -7
  235. package/packages/server/dist/tools/reindex.tool.js +3 -2
  236. package/packages/server/dist/tools/remember.tool.d.ts +8 -4
  237. package/packages/server/dist/tools/remember.tool.js +3 -5
  238. package/packages/server/dist/tools/replay.tool.d.ts +6 -3
  239. package/packages/server/dist/tools/replay.tool.js +2 -6
  240. package/packages/server/dist/tools/search.tool.d.ts +10 -5
  241. package/packages/server/dist/tools/search.tool.js +6 -22
  242. package/packages/server/dist/tools/status.tool.d.ts +12 -4
  243. package/packages/server/dist/tools/status.tool.js +2 -3
  244. package/packages/server/dist/tools/toolkit.tools.d.ts +36 -35
  245. package/packages/server/dist/tools/toolkit.tools.js +20 -24
  246. package/packages/server/dist/tools/update.tool.d.ts +7 -4
  247. package/packages/server/dist/tools/update.tool.js +1 -6
  248. package/packages/server/dist/tools/utility.tools.d.ts +15 -15
  249. package/packages/server/dist/tools/utility.tools.js +10 -23
  250. package/packages/server/dist/version-check.d.ts +5 -2
  251. package/packages/server/dist/version-check.js +1 -1
  252. package/packages/store/dist/graph-store.interface.d.ts +89 -87
  253. package/packages/store/dist/graph-store.interface.js +1 -0
  254. package/packages/store/dist/index.d.ts +6 -6
  255. package/packages/store/dist/index.js +1 -1
  256. package/packages/store/dist/lance-store.d.ts +37 -31
  257. package/packages/store/dist/lance-store.js +1 -1
  258. package/packages/store/dist/sqlite-graph-store.d.ts +43 -47
  259. package/packages/store/dist/sqlite-graph-store.js +13 -13
  260. package/packages/store/dist/store-factory.d.ts +11 -8
  261. package/packages/store/dist/store-factory.js +1 -1
  262. package/packages/store/dist/store.interface.d.ts +47 -47
  263. package/packages/store/dist/store.interface.js +1 -0
  264. package/packages/tools/dist/audit.d.ts +61 -62
  265. package/packages/tools/dist/audit.js +4 -5
  266. package/packages/tools/dist/batch.d.ts +20 -18
  267. package/packages/tools/dist/batch.js +1 -1
  268. package/packages/tools/dist/changelog.d.ts +29 -27
  269. package/packages/tools/dist/changelog.js +2 -2
  270. package/packages/tools/dist/check.d.ts +42 -39
  271. package/packages/tools/dist/check.js +2 -2
  272. package/packages/tools/dist/checkpoint.d.ts +17 -15
  273. package/packages/tools/dist/checkpoint.js +1 -2
  274. package/packages/tools/dist/codemod.d.ts +35 -33
  275. package/packages/tools/dist/codemod.js +2 -2
  276. package/packages/tools/dist/compact.d.ts +34 -38
  277. package/packages/tools/dist/compact.js +2 -2
  278. package/packages/tools/dist/data-transform.d.ts +10 -8
  279. package/packages/tools/dist/data-transform.js +1 -1
  280. package/packages/tools/dist/dead-symbols.d.ts +29 -26
  281. package/packages/tools/dist/dead-symbols.js +2 -2
  282. package/packages/tools/dist/delegate.d.ts +26 -24
  283. package/packages/tools/dist/delegate.js +1 -5
  284. package/packages/tools/dist/diff-parse.d.ts +24 -22
  285. package/packages/tools/dist/diff-parse.js +3 -3
  286. package/packages/tools/dist/digest.d.ts +43 -46
  287. package/packages/tools/dist/digest.js +4 -5
  288. package/packages/tools/dist/dogfood-log.d.ts +49 -0
  289. package/packages/tools/dist/dogfood-log.js +2 -0
  290. package/packages/tools/dist/encode.d.ts +11 -9
  291. package/packages/tools/dist/encode.js +1 -1
  292. package/packages/tools/dist/env-info.d.ts +25 -23
  293. package/packages/tools/dist/env-info.js +1 -1
  294. package/packages/tools/dist/eval.d.ts +13 -11
  295. package/packages/tools/dist/eval.js +2 -3
  296. package/packages/tools/dist/evidence-map.d.ts +64 -62
  297. package/packages/tools/dist/evidence-map.js +2 -3
  298. package/packages/tools/dist/file-cache.d.ts +41 -0
  299. package/packages/tools/dist/file-cache.js +3 -0
  300. package/packages/tools/dist/file-summary.d.ts +50 -30
  301. package/packages/tools/dist/file-summary.js +2 -2
  302. package/packages/tools/dist/file-walk.d.ts +6 -4
  303. package/packages/tools/dist/file-walk.js +1 -1
  304. package/packages/tools/dist/find-examples.d.ts +26 -22
  305. package/packages/tools/dist/find-examples.js +3 -3
  306. package/packages/tools/dist/find.d.ts +39 -41
  307. package/packages/tools/dist/find.js +1 -1
  308. package/packages/tools/dist/forge-classify.d.ts +35 -39
  309. package/packages/tools/dist/forge-classify.js +2 -2
  310. package/packages/tools/dist/forge-ground.d.ts +58 -61
  311. package/packages/tools/dist/forge-ground.js +1 -1
  312. package/packages/tools/dist/git-context.d.ts +22 -20
  313. package/packages/tools/dist/git-context.js +3 -3
  314. package/packages/tools/dist/graph-query.d.ts +75 -79
  315. package/packages/tools/dist/graph-query.js +1 -1
  316. package/packages/tools/dist/guide.d.ts +14 -12
  317. package/packages/tools/dist/guide.js +1 -1
  318. package/packages/tools/dist/health.d.ts +13 -11
  319. package/packages/tools/dist/health.js +2 -2
  320. package/packages/tools/dist/http-request.d.ts +20 -18
  321. package/packages/tools/dist/http-request.js +1 -1
  322. package/packages/tools/dist/index.d.ts +55 -53
  323. package/packages/tools/dist/index.js +1 -1
  324. package/packages/tools/dist/lane.d.ts +28 -26
  325. package/packages/tools/dist/lane.js +6 -7
  326. package/packages/tools/dist/measure.d.ts +34 -30
  327. package/packages/tools/dist/measure.js +2 -2
  328. package/packages/tools/dist/onboard.d.ts +29 -27
  329. package/packages/tools/dist/onboard.js +17 -41
  330. package/packages/tools/dist/parse-output.d.ts +48 -46
  331. package/packages/tools/dist/parse-output.js +2 -2
  332. package/packages/tools/dist/path-resolver.d.ts +4 -2
  333. package/packages/tools/dist/path-resolver.js +1 -1
  334. package/packages/tools/dist/process-manager.d.ts +18 -16
  335. package/packages/tools/dist/process-manager.js +1 -1
  336. package/packages/tools/dist/queue.d.ts +28 -26
  337. package/packages/tools/dist/queue.js +1 -2
  338. package/packages/tools/dist/regex-test.d.ts +26 -24
  339. package/packages/tools/dist/regex-test.js +1 -1
  340. package/packages/tools/dist/rename.d.ts +28 -26
  341. package/packages/tools/dist/rename.js +2 -2
  342. package/packages/tools/dist/replay.d.ts +33 -31
  343. package/packages/tools/dist/replay.js +4 -6
  344. package/packages/tools/dist/response-envelope.d.ts +32 -30
  345. package/packages/tools/dist/response-envelope.js +1 -1
  346. package/packages/tools/dist/schema-validate.d.ts +15 -13
  347. package/packages/tools/dist/schema-validate.js +1 -1
  348. package/packages/tools/dist/scope-map.d.ts +45 -48
  349. package/packages/tools/dist/scope-map.js +1 -1
  350. package/packages/tools/dist/snippet.d.ts +26 -25
  351. package/packages/tools/dist/snippet.js +1 -1
  352. package/packages/tools/dist/stash.d.ts +13 -11
  353. package/packages/tools/dist/stash.js +1 -2
  354. package/packages/tools/dist/stratum-card.d.ts +27 -28
  355. package/packages/tools/dist/stratum-card.js +3 -5
  356. package/packages/tools/dist/symbol.d.ts +31 -26
  357. package/packages/tools/dist/symbol.js +3 -3
  358. package/packages/tools/dist/test-run.d.ts +19 -16
  359. package/packages/tools/dist/test-run.js +2 -2
  360. package/packages/tools/dist/text-utils.d.ts +6 -4
  361. package/packages/tools/dist/text-utils.js +2 -2
  362. package/packages/tools/dist/time-utils.d.ts +15 -13
  363. package/packages/tools/dist/time-utils.js +1 -1
  364. package/packages/tools/dist/trace.d.ts +26 -21
  365. package/packages/tools/dist/trace.js +2 -2
  366. package/packages/tools/dist/truncation.d.ts +6 -4
  367. package/packages/tools/dist/truncation.js +6 -13
  368. package/packages/tools/dist/watch.d.ts +28 -26
  369. package/packages/tools/dist/watch.js +1 -1
  370. package/packages/tools/dist/web-fetch.d.ts +35 -33
  371. package/packages/tools/dist/web-fetch.js +6 -12
  372. package/packages/tools/dist/web-search.d.ts +16 -14
  373. package/packages/tools/dist/web-search.js +1 -1
  374. package/packages/tools/dist/workset.d.ts +19 -17
  375. package/packages/tools/dist/workset.js +1 -2
  376. package/packages/tui/dist/App-CYLNJLr6.js +2 -0
  377. package/packages/tui/dist/App.d.ts +11 -6
  378. package/packages/tui/dist/App.js +1 -450
  379. package/packages/tui/dist/CuratedPanel-sYdZAICX.js +2 -0
  380. package/packages/tui/dist/LogPanel-DtMnoyXT.js +3 -0
  381. package/packages/tui/dist/SearchPanel-DREo6zgt.js +2 -0
  382. package/packages/tui/dist/StatusPanel-2ex8fLOO.js +2 -0
  383. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  384. package/packages/tui/dist/devtools-DUyj952l.js +7 -0
  385. package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +28 -0
  386. package/packages/tui/dist/index-B9VpfVPP.d.ts +13 -0
  387. package/packages/tui/dist/index.d.ts +3 -19
  388. package/packages/tui/dist/index.js +1 -476
  389. package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +316 -0
  390. package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -6
  391. package/packages/tui/dist/panels/CuratedPanel.js +1 -371
  392. package/packages/tui/dist/panels/LogPanel.d.ts +7 -3
  393. package/packages/tui/dist/panels/LogPanel.js +1 -449
  394. package/packages/tui/dist/panels/SearchPanel.d.ts +14 -8
  395. package/packages/tui/dist/panels/SearchPanel.js +1 -372
  396. package/packages/tui/dist/panels/StatusPanel.d.ts +11 -6
  397. package/packages/tui/dist/panels/StatusPanel.js +1 -371
  398. package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +150 -0
  399. package/scaffold/adapters/claude-code.mjs +20 -0
  400. package/scaffold/adapters/copilot.mjs +320 -0
  401. package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  402. package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +21 -0
  403. package/scaffold/copilot/agents/Documenter.agent.md +42 -0
  404. package/scaffold/copilot/agents/Orchestrator.agent.md +104 -0
  405. package/scaffold/copilot/agents/Planner.agent.md +54 -0
  406. package/scaffold/copilot/agents/Refactor.agent.md +36 -0
  407. package/scaffold/copilot/agents/Researcher-Alpha.agent.md +20 -0
  408. package/scaffold/copilot/agents/Researcher-Beta.agent.md +20 -0
  409. package/scaffold/copilot/agents/Researcher-Delta.agent.md +20 -0
  410. package/scaffold/copilot/agents/Researcher-Gamma.agent.md +20 -0
  411. package/scaffold/definitions/agents.mjs +165 -0
  412. package/scaffold/definitions/bodies.mjs +292 -0
  413. package/scaffold/definitions/hooks.mjs +43 -0
  414. package/scaffold/definitions/models.mjs +56 -0
  415. package/scaffold/definitions/plugins.mjs +24 -0
  416. package/scaffold/definitions/prompts.mjs +145 -0
  417. package/scaffold/definitions/protocols.mjs +322 -0
  418. package/scaffold/definitions/tools.mjs +176 -0
  419. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  420. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +21 -0
  421. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +12 -0
  422. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +12 -0
  423. package/scaffold/general/agents/Debugger.agent.md +31 -0
  424. package/scaffold/general/agents/Documenter.agent.md +42 -0
  425. package/scaffold/general/agents/Explorer.agent.md +50 -0
  426. package/scaffold/general/agents/Frontend.agent.md +29 -0
  427. package/scaffold/general/agents/Implementer.agent.md +31 -0
  428. package/scaffold/general/agents/Orchestrator.agent.md +104 -0
  429. package/scaffold/general/agents/Planner.agent.md +55 -0
  430. package/scaffold/general/agents/README.md +57 -0
  431. package/scaffold/general/agents/Refactor.agent.md +36 -0
  432. package/scaffold/general/agents/Researcher-Alpha.agent.md +20 -0
  433. package/scaffold/general/agents/Researcher-Beta.agent.md +20 -0
  434. package/scaffold/general/agents/Researcher-Delta.agent.md +20 -0
  435. package/scaffold/general/agents/Researcher-Gamma.agent.md +20 -0
  436. package/scaffold/general/agents/Security.agent.md +42 -0
  437. package/scaffold/general/agents/_shared/adr-protocol.md +91 -0
  438. package/scaffold/general/agents/_shared/architect-reviewer-base.md +50 -0
  439. package/scaffold/general/agents/_shared/code-agent-base.md +88 -0
  440. package/scaffold/general/agents/_shared/code-reviewer-base.md +54 -0
  441. package/scaffold/general/agents/_shared/decision-protocol.md +27 -0
  442. package/scaffold/general/agents/_shared/forge-protocol.md +46 -0
  443. package/scaffold/general/agents/_shared/researcher-base.md +61 -0
  444. package/scaffold/general/agents/templates/adr-template.md +27 -0
  445. package/scaffold/general/agents/templates/execution-state.md +25 -0
  446. package/scaffold/general/prompts/ask.prompt.md +20 -0
  447. package/scaffold/general/prompts/debug.prompt.md +25 -0
  448. package/scaffold/general/prompts/design.prompt.md +22 -0
  449. package/scaffold/general/prompts/implement.prompt.md +26 -0
  450. package/scaffold/general/prompts/plan.prompt.md +24 -0
  451. package/scaffold/general/prompts/review.prompt.md +31 -0
  452. package/scaffold/generate.mjs +74 -0
  453. package/skills/adr-skill/SKILL.md +329 -0
  454. package/skills/adr-skill/assets/templates/adr-madr.md +89 -0
  455. package/skills/adr-skill/assets/templates/adr-readme.md +20 -0
  456. package/skills/adr-skill/assets/templates/adr-simple.md +46 -0
  457. package/skills/adr-skill/references/adr-conventions.md +95 -0
  458. package/skills/adr-skill/references/examples.md +193 -0
  459. package/skills/adr-skill/references/review-checklist.md +77 -0
  460. package/skills/adr-skill/references/template-variants.md +52 -0
  461. package/skills/adr-skill/scripts/bootstrap_adr.js +259 -0
  462. package/skills/adr-skill/scripts/new_adr.js +391 -0
  463. package/skills/adr-skill/scripts/set_adr_status.js +169 -0
  464. package/skills/brainstorming/SKILL.md +259 -0
  465. package/skills/brainstorming/scripts/frame-template.html +365 -0
  466. package/skills/brainstorming/scripts/helper.js +216 -0
  467. package/skills/brainstorming/scripts/server.cjs +9 -0
  468. package/skills/brainstorming/scripts/server.src.cjs +249 -0
  469. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  470. package/skills/brainstorming/visual-companion.md +430 -0
  471. package/skills/c4-architecture/SKILL.md +295 -0
  472. package/skills/c4-architecture/references/advanced-patterns.md +552 -0
  473. package/skills/c4-architecture/references/c4-syntax.md +492 -0
  474. package/skills/c4-architecture/references/common-mistakes.md +437 -0
  475. package/skills/knowledge-base/SKILL.md +100 -10
  476. package/skills/lesson-learned/SKILL.md +105 -0
  477. package/skills/lesson-learned/references/anti-patterns.md +55 -0
  478. package/skills/lesson-learned/references/se-principles.md +109 -0
  479. package/skills/requirements-clarity/SKILL.md +324 -0
  480. package/skills/session-handoff/SKILL.md +189 -0
  481. package/skills/session-handoff/references/handoff-template.md +139 -0
  482. package/skills/session-handoff/references/resume-checklist.md +80 -0
  483. package/skills/session-handoff/scripts/check_staleness.js +269 -0
  484. package/skills/session-handoff/scripts/create_handoff.js +299 -0
  485. package/skills/session-handoff/scripts/list_handoffs.js +113 -0
  486. package/skills/session-handoff/scripts/validate_handoff.js +241 -0
  487. package/packages/chunker/dist/treesitter-chunker.d.ts +0 -47
  488. package/packages/chunker/dist/treesitter-chunker.js +0 -8
  489. package/packages/cli/dist/commands/init.d.ts +0 -10
  490. package/packages/cli/dist/commands/init.js +0 -308
@@ -0,0 +1,193 @@
1
+ # ADR Examples
2
+
3
+ These are filled-out examples showing the same decision at two levels of detail. Use these as reference when drafting ADRs — never leave placeholder text in a real ADR.
4
+
5
+ ## Short Version (Simple Template)
6
+
7
+ ```markdown
8
+ ---
9
+ status: accepted
10
+ date: 2025-06-15
11
+ decision-makers: Sarah Chen, Joel
12
+ ---
13
+
14
+ # Use SQLite for local development database
15
+
16
+ ## Context and Problem Statement
17
+
18
+ Our integration tests require a database but currently hit a shared PostgreSQL instance, causing flaky tests from concurrent writes and slow CI (3+ minute setup per run). We need a fast, isolated database for local dev and CI that doesn't require infrastructure provisioning.
19
+
20
+ ## Decision
21
+
22
+ Use SQLite (via better-sqlite3) for local development and CI test runs. Production remains on PostgreSQL. We'll use a thin data-access layer that abstracts the database engine, tested against both SQLite and PostgreSQL in CI.
23
+
24
+ Non-goals: we are NOT migrating production to SQLite or building a full ORM abstraction.
25
+
26
+ ## Consequences
27
+
28
+ - Good, because CI setup drops from 3+ minutes to ~2 seconds (no DB provisioning)
29
+ - Good, because tests are fully isolated — no shared state between runs
30
+ - Good, because developers can run the full test suite offline
31
+ - Bad, because we must maintain compatibility between SQLite and PostgreSQL SQL dialects
32
+ - Bad, because some PostgreSQL-specific features (JSONB operators, array columns) can't be tested locally
33
+
34
+ ## Implementation Plan
35
+
36
+ - **Affected paths**: `src/db/client.ts` (new abstraction layer), `src/db/sqlite-client.ts` (new), `src/db/pg-client.ts` (refactored from current inline usage), `tests/setup.ts`, `package.json`
37
+ - **Dependencies**: add `better-sqlite3@11.x` and `@types/better-sqlite3@7.x` as devDependencies; no production dependency changes
38
+ - **Patterns to follow**: existing repository pattern in `src/db/repositories/` — all queries go through repository methods, never raw SQL in business logic
39
+ - **Patterns to avoid**: do not import `better-sqlite3` or `pg` directly outside `src/db/`; do not use PostgreSQL-specific SQL (JSONB operators, `ANY()`, array literals) in shared queries
40
+
41
+ ### Verification
42
+
43
+ - [ ] `npm test` passes with `DB_ENGINE=sqlite` (default for test env)
44
+ - [ ] `npm test` passes with `DB_ENGINE=postgres` against a real PostgreSQL instance
45
+ - [ ] No imports of `better-sqlite3` or `pg` outside `src/db/`
46
+ - [ ] CI pipeline total time under 90 seconds (was 5+ minutes)
47
+ - [ ] `src/db/client.ts` exports a unified interface used by all repositories
48
+
49
+ ## Alternatives Considered
50
+
51
+ - Docker PostgreSQL per CI run: Reliable parity, but adds 90s+ startup and requires Docker-in-Docker on CI.
52
+ - In-memory PostgreSQL (pg-mem): Good API compatibility, but incomplete support for our schema (triggers, CTEs) and unmaintained.
53
+
54
+ ## More Information
55
+
56
+ - Follow-up: create weekly CI job running full suite against real PostgreSQL (#348)
57
+ - Revisit trigger: if dialect-drift bugs exceed 2 per quarter, reconsider Docker PostgreSQL approach
58
+ ```
59
+
60
+ ## Long Version (MADR Template)
61
+
62
+ The same decision with full options analysis:
63
+
64
+ ```markdown
65
+ ---
66
+ status: accepted
67
+ date: 2025-06-15
68
+ decision-makers: Sarah Chen, Joel
69
+ consulted: Alex (DBA), Platform team
70
+ informed: Frontend team, QA
71
+ ---
72
+
73
+ # Use SQLite for local development database
74
+
75
+ ## Context and Problem Statement
76
+
77
+ Our integration tests require a database but currently hit a shared PostgreSQL instance. This causes two problems:
78
+
79
+ 1. Flaky tests from concurrent writes (multiple developers and CI jobs sharing one DB)
80
+ 2. Slow CI — each run spends 3+ minutes provisioning and seeding the database
81
+
82
+ How can we provide a fast, isolated database for local development and CI without sacrificing confidence in production compatibility?
83
+
84
+ Related: [Use PostgreSQL for production](2025-05-01-use-postgresql-for-production.md) — this decision must not compromise production database choice.
85
+
86
+ ## Decision Drivers
87
+
88
+ - CI speed: current 3+ minute DB setup is the bottleneck in our 5-minute pipeline
89
+ - Test isolation: zero shared state between parallel test runs
90
+ - Production parity: must catch SQL dialect issues before they hit production
91
+ - Developer experience: should work offline, no external dependencies for `npm test`
92
+ - Maintenance cost: solution should not require a dedicated owner
93
+
94
+ ## Considered Options
95
+
96
+ - SQLite via better-sqlite3
97
+ - Docker PostgreSQL per CI run
98
+ - In-memory PostgreSQL (pg-mem)
99
+
100
+ ## Decision Outcome
101
+
102
+ Chosen option: "SQLite via better-sqlite3", because it eliminates the CI bottleneck (2s vs 3+ min), provides full isolation, works offline, and has minimal maintenance cost. The dialect-drift risk is mitigated by a weekly CI job against real PostgreSQL.
103
+
104
+ ### Consequences
105
+
106
+ - Good, because CI database setup drops from 3+ minutes to ~2 seconds
107
+ - Good, because each test run is fully isolated (file-based DB, no shared state)
108
+ - Good, because developers can run the full test suite offline with zero infrastructure
109
+ - Bad, because we must maintain a data-access abstraction layer to paper over SQL dialect differences
110
+ - Bad, because PostgreSQL-specific features (JSONB operators, array columns, advisory locks) cannot be tested locally
111
+ - Neutral, because the abstraction layer adds ~200 lines of code but also makes future DB migrations easier
112
+
113
+ ## Implementation Plan
114
+
115
+ - **Affected paths**:
116
+ - `src/db/client.ts` — new: unified database interface (DatabaseClient type + factory function)
117
+ - `src/db/sqlite-client.ts` — new: SQLite implementation of DatabaseClient
118
+ - `src/db/pg-client.ts` — refactor: extract current inline pg usage into DatabaseClient implementation
119
+ - `src/db/repositories/*.ts` — update: use DatabaseClient instead of direct pg calls
120
+ - `tests/setup.ts` — update: initialize SQLite by default, read `DB_ENGINE` env var
121
+ - `tests/fixtures/seed.sql` — update: ensure all seed SQL is dialect-neutral
122
+ - `.env.test` — new: `DB_ENGINE=sqlite`
123
+ - `.github/workflows/ci.yml` — update: remove PostgreSQL service container from main CI
124
+ - `package.json` — add devDependencies
125
+ - **Dependencies**: add `better-sqlite3@11.x`, `@types/better-sqlite3@7.x` as devDependencies
126
+ - **Patterns to follow**:
127
+ - Repository pattern in `src/db/repositories/` — all database access goes through repository methods
128
+ - Use parameterized queries exclusively (no string interpolation)
129
+ - Reference implementation: `src/db/repositories/users.ts` for the expected style
130
+ - **Patterns to avoid**:
131
+ - Do NOT import `better-sqlite3` or `pg` directly outside `src/db/`
132
+ - Do NOT use PostgreSQL-specific SQL in shared queries: no `JSONB` operators (`->`, `->>`), no `ANY(ARRAY[...])`, no `ON CONFLICT ... DO UPDATE`
133
+ - Do NOT use SQLite-specific SQL either — keep queries portable
134
+ - **Configuration**: `DB_ENGINE` env var (`sqlite` | `postgres`), defaults to `sqlite` in test, `postgres` in production
135
+ - **Migration steps**:
136
+ 1. Create `DatabaseClient` interface and SQLite implementation
137
+ 2. Refactor existing pg code into pg implementation
138
+ 3. Update repositories one at a time (each can be a separate PR)
139
+ 4. Update test setup last, once all repositories use the abstraction
140
+ 5. Remove PostgreSQL service container from CI workflow
141
+
142
+ ### Verification
143
+
144
+ - [ ] `DB_ENGINE=sqlite npm test` passes (all integration tests)
145
+ - [ ] `DB_ENGINE=postgres npm test` passes against a real PostgreSQL 16 instance
146
+ - [ ] `grep -r "from 'better-sqlite3'" src/ --include='*.ts' | grep -v 'src/db/'` returns no results
147
+ - [ ] `grep -r "from 'pg'" src/ --include='*.ts' | grep -v 'src/db/'` returns no results
148
+ - [ ] CI pipeline completes in under 90 seconds (measured on main branch)
149
+ - [ ] `src/db/client.ts` exports `DatabaseClient` interface and `createClient()` factory
150
+ - [ ] `.env.test` sets `DB_ENGINE=sqlite`
151
+ - [ ] Weekly PostgreSQL compatibility CI job exists in `.github/workflows/`
152
+
153
+ ## Pros and Cons of the Options
154
+
155
+ ### SQLite via better-sqlite3
156
+
157
+ [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) — synchronous SQLite bindings for Node.js.
158
+
159
+ - Good, because zero infrastructure — just an npm dependency
160
+ - Good, because synchronous API makes test setup/teardown trivial
161
+ - Good, because file-based DBs enable parallelism (one file per test worker)
162
+ - Neutral, because requires a thin abstraction layer (~200 LOC)
163
+ - Bad, because SQL dialect differences (no JSONB, different date handling, no arrays)
164
+ - Bad, because does not exercise PostgreSQL-specific query plans or extensions
165
+
166
+ ### Docker PostgreSQL per CI run
167
+
168
+ Spin up a fresh PostgreSQL container for each CI job.
169
+
170
+ - Good, because perfect production parity — same engine, same version
171
+ - Good, because no abstraction layer needed
172
+ - Bad, because adds 90+ seconds to every CI run (image pull + startup + healthcheck)
173
+ - Bad, because requires Docker-in-Docker on CI, adding complexity and security surface
174
+ - Bad, because developers need Docker running locally for `npm test`
175
+
176
+ ### In-memory PostgreSQL (pg-mem)
177
+
178
+ [pg-mem](https://github.com/oguimbal/pg-mem) — in-memory PostgreSQL emulator for testing.
179
+
180
+ - Good, because better SQL compatibility than SQLite
181
+ - Good, because no infrastructure needed
182
+ - Bad, because incomplete support for our schema features (triggers, CTEs, lateral joins)
183
+ - Bad, because last published release is 8+ months old — maintenance risk
184
+ - Bad, because debugging failures requires understanding pg-mem's emulation quirks
185
+
186
+ ## More Information
187
+
188
+ - Follow-up task: create data-access abstraction layer — #347
189
+ - Follow-up task: set up weekly PostgreSQL CI job — #348
190
+ - Related: [Use PostgreSQL for production](2025-05-01-use-postgresql-for-production.md)
191
+ - Revisit trigger: if dialect-drift bugs exceed 2 per quarter, reconsider Docker PostgreSQL approach
192
+ - Code references: after implementation, key files will have `// ADR: 2025-06-15-use-sqlite-for-test-database` comments at entry points
193
+ ```
@@ -0,0 +1,77 @@
1
+ # ADR Review Checklist
2
+
3
+ Use this checklist in Phase 3 to validate an ADR before finalizing. The goal: **could a coding agent read this ADR and start implementing the decision immediately, without asking any clarifying questions?**
4
+
5
+ ## Agent-Readiness Checks
6
+
7
+ ### Context & Problem
8
+
9
+ - [ ] A reader with no prior context can understand why this decision exists
10
+ - [ ] The trigger is clear (what changed, broke, or is about to break)
11
+ - [ ] No tribal knowledge is assumed — acronyms are defined, systems are named explicitly
12
+ - [ ] Links to relevant issues, PRs, or prior ADRs are included
13
+
14
+ ### Decision
15
+
16
+ - [ ] The decision is specific enough to act on (not "use a better approach" but "use X for Y")
17
+ - [ ] Scope is bounded — what's in AND what's out (non-goals)
18
+ - [ ] Constraints are explicit and measurable where possible (e.g., "< 200ms p95" not "fast enough")
19
+
20
+ ### Consequences
21
+
22
+ - [ ] Each consequence is concrete and actionable, not aspirational
23
+ - [ ] Follow-up tasks are identified (migrations, config changes, documentation, new tests)
24
+ - [ ] Risks are stated with mitigation strategies or acceptance rationale
25
+ - [ ] No consequence is a disguised restatement of the decision
26
+
27
+ ### Implementation Plan
28
+
29
+ - [ ] Affected files/directories are named explicitly (not "the database code" but "src/db/client.ts")
30
+ - [ ] Dependencies to add/remove are specified with version constraints
31
+ - [ ] Patterns to follow reference existing code (not abstract descriptions)
32
+ - [ ] Patterns to avoid are stated (what NOT to do)
33
+ - [ ] Configuration changes are listed (env vars, config files, feature flags)
34
+ - [ ] If replacing something, migration steps are described
35
+
36
+ ### Verification
37
+
38
+ - [ ] Criteria are checkboxes, not prose
39
+ - [ ] Each criterion is testable — an agent could write a test or run a command to check it
40
+ - [ ] Criteria cover both "it works" (functional) and "it's done right" (structural/architectural)
41
+ - [ ] No criterion is vague ("it performs well" → "p95 latency < 200ms under 100 concurrent requests")
42
+
43
+ ### Options (MADR template)
44
+
45
+ - [ ] At least two options were genuinely considered (not just "do the thing" vs "do nothing")
46
+ - [ ] Each option has real pros AND cons (not a straw-man comparison)
47
+ - [ ] The justification for the chosen option references specific drivers or tradeoffs
48
+ - [ ] Rejected options explain WHY they were rejected, not just what they are
49
+
50
+ ### Meta
51
+
52
+ - [ ] Status is set correctly (usually `proposed` for new ADRs)
53
+ - [ ] Date is set
54
+ - [ ] Decision-makers are listed
55
+ - [ ] Title is a verb phrase describing the decision (not the problem)
56
+ - [ ] Filename follows repo conventions
57
+
58
+ ## Quick Scoring
59
+
60
+ Count the checked items. This isn't a gate — it's a conversation tool.
61
+
62
+ - **All checked**: Ship it.
63
+ - **1–3 unchecked**: Discuss the gaps with the human. Most can be fixed in a minute.
64
+ - **4+ unchecked**: The ADR needs more work. Go back to Phase 1 for the fuzzy areas.
65
+
66
+ ## Common Failure Modes
67
+
68
+ | Symptom | Root Cause | Fix |
69
+ | ------------------------------------------ | -------------------------------------- | ----------------------------------------------------------- |
70
+ | "Improve performance" as a consequence | Vague intent | Ask: "improve which metric, by how much, measured how?" |
71
+ | Only one option listed | Decision already made, ADR is post-hoc | Ask: "what did you reject and why?" — capture the reasoning |
72
+ | Context reads like a solution pitch | Skipped problem framing | Rewrite context as the problem, move solution to Decision |
73
+ | Consequences are all positive | Cherry-picking | Ask: "what gets harder? what's the maintenance cost?" |
74
+ | "We decided to use X" with no why | Missing justification | Ask: "why X over Y?" — the 'over Y' forces comparison |
75
+ | Implementation Plan says "update the code" | Too abstract | Ask: "which files, which functions, what pattern?" |
76
+ | Verification says "it works" | Not testable | Ask: "what command would you run to prove it works?" |
77
+ | No affected paths listed | Implementation Plan is hand-wavy | Agent should scan the codebase and propose specific paths |
@@ -0,0 +1,52 @@
1
+ # Template Variants
2
+
3
+ This skill ships two templates in `assets/templates/`.
4
+
5
+ ## Simple
6
+
7
+ File: `assets/templates/adr-simple.md`
8
+
9
+ Use this when:
10
+
11
+ - The decision is straightforward (one clear winner, minimal tradeoffs)
12
+ - You mainly need "why, what, consequences, how to implement"
13
+ - Alternatives are few and can be dismissed in a sentence each
14
+ - Speed matters more than exhaustive comparison
15
+
16
+ Sections: Context and Problem Statement → Decision → Consequences → Implementation Plan → Verification → Alternatives Considered (optional) → More Information (optional).
17
+
18
+ ## MADR (Options-Heavy)
19
+
20
+ File: `assets/templates/adr-madr.md`
21
+
22
+ Use this when:
23
+
24
+ - You have multiple real options and want to document structured tradeoffs
25
+ - You need to capture decision drivers explicitly (what criteria mattered)
26
+ - The decision is likely to be revisited and the comparison needs to survive
27
+ - Stakeholders need to see the reasoning process, not just the outcome
28
+
29
+ Sections: Context and Problem Statement → Decision Drivers (optional) → Considered Options → Decision Outcome → Consequences → Implementation Plan → Verification → Pros and Cons of the Options (optional) → More Information (optional).
30
+
31
+ This template aligns with [MADR 4.0](https://adr.github.io/madr/) and extends it with agent-first sections.
32
+
33
+ ## Both Templates Share
34
+
35
+ - **YAML front matter** for metadata (status, date, decision-makers, consulted, informed)
36
+ - **Implementation Plan** — affected paths, dependencies, patterns to follow/avoid, configuration, migration steps. This is what makes the ADR an executable spec for agents.
37
+ - **Verification as checkboxes** — testable criteria an agent can validate after implementation
38
+ - **Agent-first framing**: placeholder text prompts you to be specific, measurable, and self-contained
39
+ - **"More Information" section** for cross-links, follow-ups, and revisit triggers
40
+ - **"Neutral, because..."** as a third argument category alongside Good and Bad
41
+
42
+ ## Choosing Between Them
43
+
44
+ | Signal | Use Simple | Use MADR |
45
+ | ------------------------ | --------------- | ------------ |
46
+ | Number of real options | 1–2 | 3+ |
47
+ | Team size affected | Small / solo | Cross-team |
48
+ | Reversibility | Easily reversed | Hard to undo |
49
+ | Expected lifetime | Months | Years |
50
+ | Needs stakeholder review | No | Yes |
51
+
52
+ When in doubt, start with Simple. You can always expand to MADR if the discussion reveals more complexity.
@@ -0,0 +1,259 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bootstrap ADRs in a repo:
4
+ * - create ADR directory
5
+ * - create adr/README.md (index) using a template
6
+ * - create first ADR: "Adopt architecture decision records"
7
+ */
8
+
9
+ const fs = require('node:fs');
10
+ const path = require('node:path');
11
+
12
+ function die(msg) {
13
+ process.stderr.write(`${msg}\n`);
14
+ process.exit(1);
15
+ }
16
+
17
+ function parseArgs(argv) {
18
+ const out = {
19
+ repoRoot: '.',
20
+ dir: 'adr',
21
+ forceIndex: false,
22
+ indexFile: null,
23
+ firstTitle: 'Adopt architecture decision records',
24
+ firstStatus: 'accepted',
25
+ deciders: '',
26
+ technicalStory: '',
27
+ strategy: 'date',
28
+ json: false,
29
+ };
30
+
31
+ for (let i = 2; i < argv.length; i++) {
32
+ const a = argv[i];
33
+ const next = () => {
34
+ if (i + 1 >= argv.length) die(`Missing value for ${a}`);
35
+ return argv[++i];
36
+ };
37
+
38
+ if (a === '--repo-root') out.repoRoot = next();
39
+ else if (a === '--dir') out.dir = next();
40
+ else if (a === '--force-index') out.forceIndex = true;
41
+ else if (a === '--index-file') out.indexFile = next();
42
+ else if (a === '--first-title') out.firstTitle = next();
43
+ else if (a === '--first-status') out.firstStatus = next();
44
+ else if (a === '--deciders') out.deciders = next();
45
+ else if (a === '--technical-story') out.technicalStory = next();
46
+ else if (a === '--strategy') out.strategy = next();
47
+ else if (a === '--json') out.json = true;
48
+ else if (a === '--help' || a === '-h') {
49
+ process.stdout.write(
50
+ [
51
+ 'Usage: node bootstrap_adr.js [options]',
52
+ '',
53
+ 'Options:',
54
+ ' --repo-root <path> Repo root (default: .)',
55
+ ' --dir <path> ADR directory (default: adr)',
56
+ ' --index-file <path> Override index file path (relative to repo root unless absolute)',
57
+ ' --force-index Overwrite index file if it exists',
58
+ ' --first-title <text> Title for initial ADR',
59
+ ' --first-status <text> Status for initial ADR (default: accepted)',
60
+ ' --strategy date|slug|auto Filename strategy for initial ADR (default: date)',
61
+ ' --json Output machine-readable JSON (default: off)',
62
+ '',
63
+ ].join('\n'),
64
+ );
65
+ process.exit(0);
66
+ } else {
67
+ die(`Unknown arg: ${a}`);
68
+ }
69
+ }
70
+
71
+ if (!['auto', 'date', 'slug'].includes(out.strategy)) die(`Invalid --strategy: ${out.strategy}`);
72
+ return out;
73
+ }
74
+
75
+ function loadReadmeTemplate() {
76
+ const skillRoot = path.resolve(__dirname, '..');
77
+ const templatePath = path.join(skillRoot, 'assets', 'templates', 'adr-readme.md');
78
+ if (!fs.existsSync(templatePath)) die(`README template not found: ${templatePath}`);
79
+ return fs.readFileSync(templatePath, 'utf8');
80
+ }
81
+
82
+ function writeIndex(indexFile, adrDirName, { force }) {
83
+ if (fs.existsSync(indexFile) && !force) return;
84
+ const content = loadReadmeTemplate().replaceAll('{ADR_DIR}', adrDirName);
85
+ fs.mkdirSync(path.dirname(indexFile), { recursive: true });
86
+ fs.writeFileSync(indexFile, `${content.trimEnd()}\n`, 'utf8');
87
+ }
88
+
89
+ function slugify(text) {
90
+ const t = String(text || '')
91
+ .trim()
92
+ .toLowerCase();
93
+ const noQuotes = t.replace(/['"`]/g, '');
94
+ const dashed = noQuotes.replace(/[^a-z0-9]+/g, '-').replace(/-{2,}/g, '-');
95
+ const trimmed = dashed.replace(/^-+/, '').replace(/-+$/, '');
96
+ return trimmed || 'decision';
97
+ }
98
+
99
+ function toPosix(p) {
100
+ return p.split(path.sep).join('/');
101
+ }
102
+
103
+ function generateFirstAdr({ title, status, date, deciders, adrDir }) {
104
+ const deciderLine = deciders
105
+ ? String(deciders)
106
+ .split(',')
107
+ .map((s) => s.trim())
108
+ .filter(Boolean)
109
+ .join(', ')
110
+ : '';
111
+
112
+ return `---
113
+ status: ${status}
114
+ date: ${date}
115
+ decision-makers: ${deciderLine}
116
+ ---
117
+
118
+ # ${title}
119
+
120
+ ## Context and Problem Statement
121
+
122
+ Architecture decisions in this project are made implicitly — through code, conversations, and tribal knowledge. When a new contributor (human or AI agent) joins the codebase, there is no record of *why* things are built the way they are. This makes it hard to:
123
+
124
+ - Understand whether a pattern is intentional or accidental
125
+ - Know if a past decision still applies or has been superseded
126
+ - Avoid relitigating decisions that were already carefully considered
127
+
128
+ We need a lightweight, version-controlled way to capture decisions where the code lives.
129
+
130
+ ## Decision
131
+
132
+ Adopt Architecture Decision Records (ADRs) using the MADR 4.0 format, stored in \`${adrDir}/\`.
133
+
134
+ Conventions:
135
+ - One ADR per file, named \`YYYY-MM-DD-title-with-dashes.md\`
136
+ - New ADRs start as \`proposed\`, move to \`accepted\` or \`rejected\`
137
+ - Superseded ADRs link to their replacement
138
+ - ADRs are written to be self-contained — a coding agent should be able to read one and implement the decision without further context
139
+
140
+ ## Consequences
141
+
142
+ * Good, because decisions are discoverable and version-controlled alongside the code
143
+ * Good, because new contributors (human or agent) can understand the "why" behind architecture choices
144
+ * Good, because the team builds a shared decision log that prevents relitigating settled questions
145
+ * Bad, because writing ADRs takes time — though a good ADR saves more time than it costs
146
+ * Neutral, because ADRs require periodic review to mark outdated decisions as deprecated or superseded
147
+
148
+ ## Alternatives Considered
149
+
150
+ * No formal records: Continue making decisions in conversations and code comments. Rejected because context is lost and decisions get relitigated.
151
+ * Wiki or Notion pages: Capture decisions outside the repo. Rejected because they drift out of sync with the code and are not version-controlled.
152
+ * Lightweight RFCs: More heavyweight process with formal review cycles. Rejected as overkill for most decisions — ADRs can scale up to RFC-level detail when needed.
153
+ `;
154
+ }
155
+
156
+ function updateIndexFile(indexFile, { relLink, title, status, date }) {
157
+ if (!fs.existsSync(indexFile)) return;
158
+ const content = fs.readFileSync(indexFile, 'utf8');
159
+ if (content.includes(relLink)) return;
160
+
161
+ const entryLine = `- [${title}](${relLink}) (${status}, ${date})`;
162
+
163
+ // Append after "## ADRs" heading if found, otherwise append at end
164
+ const normalized = content.replace(/\r\n/g, '\n');
165
+ const lines = normalized.split('\n');
166
+ const headingIdx = lines.findIndex((l) => /^##\s+ADRs\s*$/i.test(l));
167
+
168
+ if (headingIdx !== -1) {
169
+ // Insert after the heading (and any blank line after it)
170
+ let insertAt = headingIdx + 1;
171
+ while (insertAt < lines.length && lines[insertAt].trim() === '') insertAt++;
172
+ lines.splice(insertAt, 0, entryLine);
173
+ } else {
174
+ lines.push(entryLine);
175
+ }
176
+
177
+ fs.writeFileSync(indexFile, lines.join('\n'), 'utf8');
178
+ }
179
+
180
+ function main() {
181
+ const args = parseArgs(process.argv);
182
+
183
+ const repoRoot = path.resolve(process.cwd(), args.repoRoot);
184
+ if (!fs.existsSync(repoRoot)) die(`Repo root does not exist: ${repoRoot}`);
185
+
186
+ const adrDir = path.resolve(repoRoot, args.dir);
187
+ fs.mkdirSync(adrDir, { recursive: true });
188
+
189
+ const indexFile = args.indexFile
190
+ ? path.isAbsolute(args.indexFile)
191
+ ? args.indexFile
192
+ : path.resolve(repoRoot, args.indexFile)
193
+ : path.join(adrDir, 'README.md');
194
+
195
+ const indexExistedBefore = fs.existsSync(indexFile);
196
+ writeIndex(indexFile, args.dir, { force: args.forceIndex });
197
+ const indexWritten = fs.existsSync(indexFile) && (!indexExistedBefore || args.forceIndex);
198
+
199
+ // Create the first ADR as a filled-out decision (not a blank template).
200
+ const relIndex = path.isAbsolute(indexFile) ? path.relative(repoRoot, indexFile) : indexFile;
201
+ const today = new Date().toISOString().slice(0, 10);
202
+
203
+ const firstAdrContent = generateFirstAdr({
204
+ title: args.firstTitle,
205
+ status: args.firstStatus,
206
+ date: today,
207
+ deciders: args.deciders,
208
+ adrDir: args.dir,
209
+ });
210
+
211
+ // Determine filename using same logic as new_adr.js
212
+ const strategy = args.strategy === 'auto' ? 'date' : args.strategy;
213
+ let firstAdrFilename;
214
+ if (strategy === 'date') {
215
+ firstAdrFilename = `${today}-${slugify(args.firstTitle)}.md`;
216
+ } else {
217
+ firstAdrFilename = `${slugify(args.firstTitle)}.md`;
218
+ }
219
+ const firstAdrPath = path.join(adrDir, firstAdrFilename);
220
+ fs.writeFileSync(firstAdrPath, `${firstAdrContent.trimEnd()}\n`, 'utf8');
221
+
222
+ // Update index
223
+ const relLink = toPosix(path.relative(path.dirname(indexFile), firstAdrPath));
224
+ updateIndexFile(indexFile, {
225
+ relLink,
226
+ title: args.firstTitle,
227
+ status: args.firstStatus,
228
+ date: today,
229
+ });
230
+
231
+ if (args.json) {
232
+ const payload = {
233
+ repoRoot,
234
+ adrDir,
235
+ adrDirRelPath: toPosix(path.relative(repoRoot, adrDir)),
236
+ indexPath: indexFile,
237
+ indexRelPath: toPosix(relIndex),
238
+ indexExistedBefore,
239
+ indexWritten,
240
+ firstAdr: {
241
+ createdAdrPath: firstAdrPath,
242
+ createdAdrRelPath: toPosix(path.relative(repoRoot, firstAdrPath)),
243
+ title: args.firstTitle,
244
+ status: args.firstStatus,
245
+ strategy,
246
+ date: today,
247
+ },
248
+ date: today,
249
+ };
250
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
251
+ return;
252
+ }
253
+
254
+ process.stdout.write(`${firstAdrPath}\n`);
255
+ process.stdout.write(`Bootstrapped ADRs at ${adrDir} (${today})\n`);
256
+ process.stdout.write(`Index: ${indexFile}\n`);
257
+ }
258
+
259
+ main();