@smartergpt/lexrunner 1.0.0 → 1.3.0

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 (1433) hide show
  1. package/CHANGELOG.md +109 -1
  2. package/LICENSE.md +110 -0
  3. package/README.mcp.md +89 -17
  4. package/README.md +133 -1012
  5. package/dist/adapters-r7_TjMwo.d.ts +333 -0
  6. package/dist/{api-7H7SJZIX.js → api-QBPBKYOC.js} +1 -1
  7. package/dist/{audit-2TZ2LU72.js → audit-5ZUBPZZX.js} +2 -2
  8. package/dist/{autopilot-AL5F5AUS.js → autopilot-JXO4MZ6H.js} +7 -6
  9. package/dist/{chunk-UZFYNSMJ.js → chunk-26SCN2LJ.js} +445 -136
  10. package/{src/monitoring/metrics.ts → dist/chunk-AXOAVRTU.js} +35 -100
  11. package/dist/{chunk-GTP4OHD7.js → chunk-R4DWK6FE.js} +2 -2
  12. package/dist/chunk-TPVORFSN.js +629 -0
  13. package/dist/{chunk-2ESYSVXG.js → chunk-V3BU2VDU.js} +7 -17
  14. package/dist/{chunk-Q6Y524KH.js → chunk-VAGHAQT2.js} +5 -179
  15. package/dist/{chunk-4RVZNLD4.js → chunk-WFN4JTZI.js} +0 -88
  16. package/dist/chunk-WSJEPY7T.js +5633 -0
  17. package/dist/cli.cjs +56133 -33969
  18. package/dist/cli.d.ts +6045 -259
  19. package/dist/cli.js +31588 -15155
  20. package/dist/{commandValidator-AT5OYZFC.js → commandValidator-LVEMJTZP.js} +2 -2
  21. package/dist/{constraints-M52FVL2X.js → constraints-V4VWCWR5.js} +2 -2
  22. package/dist/errors/index.cjs +879 -0
  23. package/dist/errors/index.d.ts +121 -0
  24. package/dist/errors/index.js +73 -0
  25. package/dist/frames/index.cjs +11992 -0
  26. package/dist/frames/index.d.ts +278 -0
  27. package/dist/frames/index.js +51 -0
  28. package/dist/{gateMapping-E5MGNJH5.js → gateMapping-R3RJYKMS.js} +1 -1
  29. package/dist/hooks/events.cjs +288 -0
  30. package/dist/hooks/events.d.ts +497 -0
  31. package/dist/hooks/events.js +242 -0
  32. package/dist/{jsonEnvelope-R4SWKX2N.js → jsonEnvelope-K2U5CWKU.js} +1 -1
  33. package/dist/{mergeTreeSimulator-X4BA647P.js → mergeTreeSimulator-QCFSOU25.js} +1 -1
  34. package/dist/package-schemas/behavior-rule.cjs +61 -0
  35. package/{.smartergpt/schemas/behavior-rule.schema.d.ts → dist/package-schemas/behavior-rule.d.ts} +8 -6
  36. package/dist/package-schemas/behavior-rule.js +35 -0
  37. package/dist/package-schemas/execution-plan-v1.cjs +69 -0
  38. package/{.smartergpt/schemas → dist/package-schemas}/execution-plan-v1.d.ts +7 -5
  39. package/dist/package-schemas/execution-plan-v1.js +42 -0
  40. package/dist/package-schemas/gates.cjs +45 -0
  41. package/{.smartergpt/schemas/gates.schema.d.ts → dist/package-schemas/gates.d.ts} +7 -5
  42. package/dist/package-schemas/gates.js +19 -0
  43. package/dist/package-schemas/runner-scope.cjs +50 -0
  44. package/{.smartergpt/schemas/runner.scope.schema.d.ts → dist/package-schemas/runner-scope.d.ts} +8 -6
  45. package/dist/package-schemas/runner-scope.js +24 -0
  46. package/dist/package-schemas/runner-stack.cjs +46 -0
  47. package/{.smartergpt/schemas/runner.stack.schema.d.ts → dist/package-schemas/runner-stack.d.ts} +7 -5
  48. package/dist/package-schemas/runner-stack.js +20 -0
  49. package/dist/{planDiff-QOK6KNB7.js → planDiff-IHLFNZUT.js} +1 -1
  50. package/dist/{planHistory-DQRSB2Y7.js → planHistory-GLRI356L.js} +1 -1
  51. package/dist/{planReview-7VB3OYKZ.js → planReview-UUMCGZJ6.js} +4 -3
  52. package/dist/{planViewer-UIPOSRVW.js → planViewer-TRSQVMH4.js} +4 -3
  53. package/dist/{sarif-XIREI5B5.js → sarif-2C6RKOUX.js} +1 -1
  54. package/dist/sdk/index.cjs +556 -0
  55. package/dist/sdk/index.d.ts +1277 -0
  56. package/dist/sdk/index.js +503 -0
  57. package/dist/{security-YDLHSMVY.js → security-OE4VLUFK.js} +2 -2
  58. package/dist/{signing-JJJOUGCW.js → signing-KLZYZZMP.js} +1 -1
  59. package/dist/types-CYMIAhy8.d.ts +266 -0
  60. package/dist/{verify-SCUHB3SA.js → verify-3UVMA62I.js} +1 -1
  61. package/mcp-server.mjs +402 -385
  62. package/package.json +52 -22
  63. package/.changes/ci-debug-added.txt +0 -1
  64. package/.changeset/tsconfig-solution-build.md +0 -5
  65. package/.editorconfig +0 -9
  66. package/.env.example +0 -8
  67. package/.github/COST_EFFICIENCY.md +0 -60
  68. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -28
  69. package/.github/ISSUE_TEMPLATE/epic.yml +0 -123
  70. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  71. package/.github/ISSUE_TEMPLATE/issue-A1-gate-input-validation.md +0 -380
  72. package/.github/ISSUE_TEMPLATE/issue-B1-scope-validation.md +0 -509
  73. package/.github/ISSUE_TEMPLATE/issue-C1-command-whitelist.md +0 -463
  74. package/.github/ISSUE_TEMPLATE/subtask.yml +0 -153
  75. package/.github/PULL_REQUEST_TEMPLATE.md +0 -9
  76. package/.github/copilot-instructions-old.md +0 -429
  77. package/.github/copilot-instructions.md +0 -33
  78. package/.github/instructions/tests.instructions.md +0 -10
  79. package/.github/workflows/auto-delete-merged-branches.yml +0 -103
  80. package/.github/workflows/benchmarks.yml +0 -72
  81. package/.github/workflows/ci-debug.yml +0 -33
  82. package/.github/workflows/ci.yml +0 -167
  83. package/.github/workflows/cli-smoke-test.yml +0 -345
  84. package/.github/workflows/copilot-setup-steps.yml +0 -20
  85. package/.github/workflows/frame-emission-gate.yml +0 -242
  86. package/.github/workflows/project-auto.yml +0 -24
  87. package/.github/workflows/release.yml +0 -260
  88. package/.github/workflows/slow-cli-tests.yml +0 -37
  89. package/.github/workflows/tag-guard.yml +0 -44
  90. package/.husky/pre-commit +0 -1
  91. package/.nvmrc +0 -2
  92. package/.prettierignore +0 -28
  93. package/.prettierrc.json +0 -10
  94. package/.smartergpt/CONTROL_DECK_VISION.md +0 -226
  95. package/.smartergpt/allowed-commands.json +0 -41
  96. package/.smartergpt/allowed-commands.strict.json +0 -56
  97. package/.smartergpt/deliverables/.live.md +0 -426
  98. package/.smartergpt/deliverables/ISSUE_STATUS_2025-12-28.md +0 -193
  99. package/.smartergpt/deliverables/_research/snapshot-contract-feedback/ADR_DISCUSSION.md +0 -379
  100. package/.smartergpt/deliverables/_research/snapshot-contract-feedback/Answer_claude-haiku.md +0 -109
  101. package/.smartergpt/deliverables/_research/snapshot-contract-feedback/Answer_gemini-flash.md +0 -42
  102. package/.smartergpt/deliverables/_research/snapshot-contract-feedback/Answer_gpt-codex-mini.md +0 -19
  103. package/.smartergpt/deliverables/_research/snapshot-contract-feedback/Answer_raptor-mini.md +0 -37
  104. package/.smartergpt/deliverables/_research/snapshot-contract-feedback/Question.md +0 -37
  105. package/.smartergpt/deliverables/merge-weave-04469e41-24ba-4ed5-b0ff-13c7ea12858d.ndjson +0 -2
  106. package/.smartergpt/deps.yml +0 -3
  107. package/.smartergpt/docs/fanout-templates.md +0 -213
  108. package/.smartergpt/docs/merge-weave-interventions.md +0 -261
  109. package/.smartergpt/docs/test-fix-patterns.md +0 -240
  110. package/.smartergpt/fanout-templates.yml +0 -263
  111. package/.smartergpt/gates.yml +0 -9
  112. package/.smartergpt/intent.md +0 -1
  113. package/.smartergpt/issues/QOL-001-analysis-script-filtering.md +0 -36
  114. package/.smartergpt/issues/QOL-002-log-retention-policy.md +0 -92
  115. package/.smartergpt/issues/QOL-003-realtime-console-feedback.md +0 -44
  116. package/.smartergpt/issues/QOL-004-governance-report-cli.md +0 -44
  117. package/.smartergpt/issues/QOL-005-schema-versioning.md +0 -46
  118. package/.smartergpt/issues/QOL-006-debug-verbose-mode.md +0 -45
  119. package/.smartergpt/issues/QOL-COMPLETION-REPORT.md +0 -359
  120. package/.smartergpt/issues/QOL-REVIEW-SUMMARY.md +0 -111
  121. package/.smartergpt/issues/QOL-ROADMAP.md +0 -71
  122. package/.smartergpt/merge-policy.yml +0 -41
  123. package/.smartergpt/merge-weave-policy.yml +0 -255
  124. package/.smartergpt/o1.json +0 -0
  125. package/.smartergpt/o2.json +0 -0
  126. package/.smartergpt/personas/eager-pm.md +0 -123
  127. package/.smartergpt/personas/example.md +0 -81
  128. package/.smartergpt/personas/senior-dev.md +0 -107
  129. package/.smartergpt/profile.yml +0 -2
  130. package/.smartergpt/prompts/create-project.md +0 -112
  131. package/.smartergpt/prompts/idea.md +0 -64
  132. package/.smartergpt/pull-request-template.md +0 -25
  133. package/.smartergpt/schemas/behavior-rule.schema.js +0 -56
  134. package/.smartergpt/schemas/behavior-rule.schema.json +0 -105
  135. package/.smartergpt/schemas/behavior-rule.schema.ts +0 -60
  136. package/.smartergpt/schemas/execution-plan-v1.js +0 -22
  137. package/.smartergpt/schemas/execution-plan-v1.json +0 -113
  138. package/.smartergpt/schemas/execution-plan-v1.ts +0 -32
  139. package/.smartergpt/schemas/execution-plan.schema.json +0 -116
  140. package/.smartergpt/schemas/feature-spec-v0.d.ts +0 -13
  141. package/.smartergpt/schemas/feature-spec-v0.js +0 -12
  142. package/.smartergpt/schemas/feature-spec-v0.json +0 -58
  143. package/.smartergpt/schemas/feature-spec-v0.ts +0 -16
  144. package/.smartergpt/schemas/feature-spec.schema.json +0 -111
  145. package/.smartergpt/schemas/gates.schema.js +0 -20
  146. package/.smartergpt/schemas/gates.schema.json +0 -47
  147. package/.smartergpt/schemas/gates.schema.ts +0 -26
  148. package/.smartergpt/schemas/idea.schema.json +0 -81
  149. package/.smartergpt/schemas/runner.scope.schema.js +0 -28
  150. package/.smartergpt/schemas/runner.scope.schema.json +0 -75
  151. package/.smartergpt/schemas/runner.scope.schema.ts +0 -36
  152. package/.smartergpt/schemas/runner.stack.schema.js +0 -21
  153. package/.smartergpt/schemas/runner.stack.schema.json +0 -51
  154. package/.smartergpt/schemas/runner.stack.schema.ts +0 -27
  155. package/.smartergpt/scope.yml +0 -11
  156. package/.smartergpt/stack.yml +0 -16
  157. package/.smartergpt/test-fix-patterns.yml +0 -106
  158. package/.tool-versions +0 -13
  159. package/AGENTS.md +0 -402
  160. package/CLAUDE.md +0 -484
  161. package/CONTRIBUTING.md +0 -345
  162. package/EAGER_PM_FANOUT_ANALYSIS.md +0 -283
  163. package/FAQ.md +0 -292
  164. package/FIXTURE_LIBRARY_SUMMARY.md +0 -327
  165. package/IMPLEMENTATION_SUMMARY.md +0 -222
  166. package/LICENSE +0 -21
  167. package/MANUAL_TEST_GUIDE.md +0 -229
  168. package/MCP-ALIGNMENT-SUMMARY.md +0 -261
  169. package/MCP-CONFIG.md +0 -125
  170. package/MERGE_WEAVE_QUICKSTART.md +0 -450
  171. package/MERGE_WEAVE_SUMMARY.md +0 -259
  172. package/MERGE_WEAVE_USAGE_GUIDE.md +0 -368
  173. package/TEST_INFRASTRUCTURE_ASSESSMENT.md +0 -225
  174. package/bootstrap-lexrunner.sh +0 -396
  175. package/dist/api-U3X2WA6D.js +0 -15
  176. package/dist/audit-5HH5BMKI.js +0 -60
  177. package/dist/audit-6K5K333I.js +0 -60
  178. package/dist/audit-DYQWS57J.js +0 -60
  179. package/dist/audit-JBWZ2GZ2.js +0 -60
  180. package/dist/audit-SJF3434D.js +0 -60
  181. package/dist/audit-TICGGVX5.js +0 -60
  182. package/dist/audit-YOBB27PY.js +0 -60
  183. package/dist/autopilot-3GAVXWWC.js +0 -45
  184. package/dist/autopilot-43NOYVQA.js +0 -45
  185. package/dist/autopilot-4UA3OWLU.js +0 -45
  186. package/dist/autopilot-54TK5CCG.js +0 -45
  187. package/dist/autopilot-5BHC2UQT.js +0 -45
  188. package/dist/autopilot-ABZUCVGY.js +0 -45
  189. package/dist/autopilot-ACJZP47Y.js +0 -45
  190. package/dist/autopilot-BO67FWUC.js +0 -45
  191. package/dist/autopilot-BR6W4GEX.js +0 -45
  192. package/dist/autopilot-FOR2UKRY.js +0 -45
  193. package/dist/autopilot-GDTTXHEQ.js +0 -45
  194. package/dist/autopilot-GEAMFZBM.js +0 -45
  195. package/dist/autopilot-HDMBRZE6.js +0 -45
  196. package/dist/autopilot-IKI2Y6S4.js +0 -44
  197. package/dist/autopilot-ILTBWWOL.js +0 -46
  198. package/dist/autopilot-KI3MXIFI.js +0 -44
  199. package/dist/autopilot-LWNPZC3J.js +0 -45
  200. package/dist/autopilot-LXPJ4ZXF.js +0 -45
  201. package/dist/autopilot-MDIFIONK.js +0 -46
  202. package/dist/autopilot-NW3LDP6M.js +0 -45
  203. package/dist/autopilot-OKTSCG35.js +0 -45
  204. package/dist/autopilot-OR5PF5PD.js +0 -45
  205. package/dist/autopilot-PE65SBGN.js +0 -45
  206. package/dist/autopilot-PW7I4B6W.js +0 -45
  207. package/dist/autopilot-QMLBL5P6.js +0 -45
  208. package/dist/autopilot-QSN6ZU5O.js +0 -45
  209. package/dist/autopilot-R7EZJOGI.js +0 -46
  210. package/dist/autopilot-T544CPPD.js +0 -44
  211. package/dist/autopilot-TNQB6VGJ.js +0 -44
  212. package/dist/autopilot-UVIYCR6K.js +0 -45
  213. package/dist/autopilot-W3ZTTSH3.js +0 -45
  214. package/dist/autopilot-XPKWOFXO.js +0 -44
  215. package/dist/autopilot-XRX4QWRM.js +0 -44
  216. package/dist/autopilot-Y3BAGNI5.js +0 -44
  217. package/dist/autopilot-ZE64XW2K.js +0 -44
  218. package/dist/chunk-2VR554P7.js +0 -668
  219. package/dist/chunk-37DOWIVT.js +0 -1084
  220. package/dist/chunk-3DU2DWUP.js +0 -400
  221. package/dist/chunk-3DVXIZFM.js +0 -11166
  222. package/dist/chunk-3FABZF4V.js +0 -811
  223. package/dist/chunk-4GEC4HC3.js +0 -11221
  224. package/dist/chunk-5CGWZH5X.js +0 -340
  225. package/dist/chunk-5QKWKK4M.js +0 -11794
  226. package/dist/chunk-5Z3XHND7.js +0 -11755
  227. package/dist/chunk-6YC2VSLE.js +0 -11252
  228. package/dist/chunk-7C4K2SHD.js +0 -668
  229. package/dist/chunk-ANXY4RGA.js +0 -11091
  230. package/dist/chunk-ASHKNUBR.js +0 -11312
  231. package/dist/chunk-B3OYDPOP.js +0 -11793
  232. package/dist/chunk-DBH7SQ2S.js +0 -1084
  233. package/dist/chunk-DEI7A5B4.js +0 -11449
  234. package/dist/chunk-EQKFCZLH.js +0 -9823
  235. package/dist/chunk-FAIJPBT5.js +0 -40
  236. package/dist/chunk-FDDKUDXR.js +0 -11166
  237. package/dist/chunk-FEAR6ETG.js +0 -438
  238. package/dist/chunk-FXL74C73.js +0 -523
  239. package/dist/chunk-GLJEDX4L.js +0 -10247
  240. package/dist/chunk-HIHH7IVO.js +0 -10557
  241. package/dist/chunk-I3VXUVCB.js +0 -10474
  242. package/dist/chunk-I6BIFVWI.js +0 -10519
  243. package/dist/chunk-I72TRUTJ.js +0 -1084
  244. package/dist/chunk-J5B5KT2F.js +0 -368
  245. package/dist/chunk-JMTULZ66.js +0 -11743
  246. package/dist/chunk-JXIQ7HCK.js +0 -11166
  247. package/dist/chunk-K6HVPBDP.js +0 -10692
  248. package/dist/chunk-KBT5Y666.js +0 -521
  249. package/dist/chunk-LETPROKG.js +0 -11092
  250. package/dist/chunk-LLMY2BZF.js +0 -1084
  251. package/dist/chunk-NMNL4US2.js +0 -1084
  252. package/dist/chunk-O2XRP7JK.js +0 -10247
  253. package/dist/chunk-OGPWLFFO.js +0 -11201
  254. package/dist/chunk-OQJUWTZV.js +0 -51
  255. package/dist/chunk-PJRWPLQ6.js +0 -669
  256. package/dist/chunk-PYRVUCJR.js +0 -370
  257. package/dist/chunk-QF7DM5VW.js +0 -106
  258. package/dist/chunk-QGM4M3NI.js +0 -37
  259. package/dist/chunk-QIIELFTL.js +0 -1107
  260. package/dist/chunk-QUW6N7GR.js +0 -10264
  261. package/dist/chunk-QZASNLQX.js +0 -11223
  262. package/dist/chunk-RMN4IAWO.js +0 -11808
  263. package/dist/chunk-RN5NHU37.js +0 -11465
  264. package/dist/chunk-RNG3RILO.js +0 -11755
  265. package/dist/chunk-RSA6DEB4.js +0 -9748
  266. package/dist/chunk-RURYWSMX.js +0 -10524
  267. package/dist/chunk-SUEXK5U7.js +0 -11201
  268. package/dist/chunk-TVUF55OH.js +0 -11807
  269. package/dist/chunk-U62I2R2D.js +0 -434
  270. package/dist/chunk-UNZBDSEU.js +0 -11166
  271. package/dist/chunk-VP37GLU6.js +0 -1084
  272. package/dist/chunk-W6WDKBWO.js +0 -11453
  273. package/dist/chunk-XBKUFNVF.js +0 -10745
  274. package/dist/chunk-XOLVQTIE.js +0 -670
  275. package/dist/chunk-YABA7DB6.js +0 -11091
  276. package/dist/chunk-YWCJX5KL.js +0 -10557
  277. package/dist/chunk-Z5GP7FSR.js +0 -309
  278. package/dist/chunk-ZBT3DATZ.js +0 -296
  279. package/dist/chunk-ZDBAZXUQ.js +0 -11201
  280. package/dist/chunk-ZEMABYS4.js +0 -92
  281. package/dist/chunk-ZOA4HT7P.js +0 -662
  282. package/dist/cli.d.cts +0 -2709
  283. package/dist/commandValidator-42OUDFZ4.js +0 -140
  284. package/dist/commandValidator-7LQHTYL5.js +0 -140
  285. package/dist/commandValidator-DH3CX2OW.js +0 -140
  286. package/dist/commandValidator-GCQC7H4A.js +0 -140
  287. package/dist/commandValidator-K6VWB6O3.js +0 -140
  288. package/dist/commandValidator-L6WNDBYB.js +0 -129
  289. package/dist/commandValidator-O3KSNXD2.js +0 -140
  290. package/dist/commandValidator-ZHMUA5RQ.js +0 -140
  291. package/dist/dist-CSOR2BL2.js +0 -1144
  292. package/dist/dist-PKOIS5NZ.js +0 -1144
  293. package/dist/fileAnalysis-3VMDDJ6I.js +0 -9
  294. package/dist/fileAnalysis-4QLHUT44.js +0 -9
  295. package/dist/fileAnalysis-H6M2Z7ZC.js +0 -9
  296. package/dist/fileAnalysis-HMI7IL6S.js +0 -9
  297. package/dist/fileAnalysis-JHABOPUQ.js +0 -9
  298. package/dist/mergeTreeSimulator-ATOPJ3DU.js +0 -11
  299. package/dist/mergeTreeSimulator-AYUK4TZT.js +0 -11
  300. package/dist/mergeTreeSimulator-BBWJUQBK.js +0 -11
  301. package/dist/mergeTreeSimulator-DJJDRB5N.js +0 -11
  302. package/dist/planDiff-37QHCPKO.js +0 -109
  303. package/dist/planDiff-BQHIUARB.js +0 -109
  304. package/dist/planDiff-RXR4CWFS.js +0 -109
  305. package/dist/planDiff-W2BTH2MU.js +0 -109
  306. package/dist/planHistory-4J3Q6AJ3.js +0 -126
  307. package/dist/planHistory-GLCXP6AB.js +0 -126
  308. package/dist/planHistory-SMNRLEKG.js +0 -126
  309. package/dist/planHistory-UO4WZ6GO.js +0 -126
  310. package/dist/planReview-7BWVLABC.js +0 -377
  311. package/dist/planReview-FAIBIAE6.js +0 -377
  312. package/dist/planReview-FXQBDNKJ.js +0 -376
  313. package/dist/planReview-HO4YYETA.js +0 -377
  314. package/dist/planReview-I26EKCUK.js +0 -376
  315. package/dist/planReview-JBOAJHSU.js +0 -377
  316. package/dist/planReview-SCNZWC6B.js +0 -376
  317. package/dist/planReview-TU7LMZIY.js +0 -376
  318. package/dist/planViewer-2YZCPVDM.js +0 -155
  319. package/dist/planViewer-72WZFUTU.js +0 -154
  320. package/dist/planViewer-G546TVHV.js +0 -154
  321. package/dist/planViewer-I7ZHNJQF.js +0 -150
  322. package/dist/planViewer-IRXHOY5U.js +0 -155
  323. package/dist/planViewer-IX2ICW45.js +0 -154
  324. package/dist/planViewer-PDWPUOP6.js +0 -155
  325. package/dist/planViewer-PEOADAGZ.js +0 -155
  326. package/dist/planViewer-PFYDEG6V.js +0 -150
  327. package/dist/planViewer-V2JUKV7Q.js +0 -154
  328. package/dist/sarif-46TKOOJZ.js +0 -9
  329. package/dist/sarif-63JKTFFI.js +0 -9
  330. package/dist/sarif-CIYIWUNC.js +0 -9
  331. package/dist/sarif-OGAGDL6B.js +0 -9
  332. package/dist/security-3V6FKJDA.js +0 -423
  333. package/dist/security-4JMEUM56.js +0 -423
  334. package/dist/security-QHPEWY5G.js +0 -423
  335. package/dist/security-V2LAL5TP.js +0 -415
  336. package/dist/security-WTASK6T6.js +0 -423
  337. package/dist/security-XE4GHVJD.js +0 -423
  338. package/dist/security-XLXM3UHT.js +0 -423
  339. package/dist/security-ZDAEZF7D.js +0 -423
  340. package/dist/signing-3EI734L4.js +0 -14
  341. package/dist/signing-5G7K6JXJ.js +0 -14
  342. package/dist/signing-7DK7SABM.js +0 -14
  343. package/dist/signing-OAJ3MXGA.js +0 -14
  344. package/dist/verify-5F6PUXUQ.js +0 -62
  345. package/dist/verify-5ILURHV2.js +0 -62
  346. package/dist/verify-MRDZJUGO.js +0 -62
  347. package/dist/verify-YZRHN2D3.js +0 -62
  348. package/docs/1.0.0-vertical-slice.md +0 -214
  349. package/docs/ADR-007-INTEGRATION-SUMMARY.md +0 -232
  350. package/docs/ALIASING_FOR_LEXRUNNER.md +0 -709
  351. package/docs/ALIASING_FOR_RUNNER.md +0 -552
  352. package/docs/AX.md +0 -317
  353. package/docs/CHECKPOINT_RESUME.md +0 -208
  354. package/docs/CLI_VERBS.md +0 -219
  355. package/docs/CONFLICT_DETECTION.md +0 -198
  356. package/docs/DISCIPLINED_FAILURE.md +0 -224
  357. package/docs/ENVIRONMENT_QUALITY.md +0 -155
  358. package/docs/ERROR_CODES.md +0 -528
  359. package/docs/EVENT_SCHEMA.md +0 -659
  360. package/docs/EXE-012-investigation-summary.md +0 -300
  361. package/docs/GATE_ATTESTATION_GUIDE.md +0 -237
  362. package/docs/JSON_OUTPUT_SCHEMAS.md +0 -347
  363. package/docs/LEXRUNNER_ALIASING.md +0 -444
  364. package/docs/LEX_INTEGRATION.md +0 -83
  365. package/docs/LEX_PUBLIC_API.md +0 -306
  366. package/docs/LICENSING.md +0 -119
  367. package/docs/MCP-CLI-PARITY.md +0 -410
  368. package/docs/MCP-MIGRATION.md +0 -258
  369. package/docs/MCP-PARITY.md +0 -234
  370. package/docs/MEMORY_TOOLS.md +0 -278
  371. package/docs/MERGE_WEAVE_SETUP.md +0 -643
  372. package/docs/MIGRATION_v0.1.md +0 -760
  373. package/docs/NAMING_CONVENTIONS.md +0 -82
  374. package/docs/PERSONA_FOUNDATION.md +0 -124
  375. package/docs/PHASE3_MEMORY_GUIDE.md +0 -122
  376. package/docs/PLAN_LOCK.md +0 -114
  377. package/docs/README.md +0 -289
  378. package/docs/RUNNER_LIFECYCLE.md +0 -257
  379. package/docs/SAFETY_MECHANISMS.md +0 -325
  380. package/docs/SECURITY_IMPLEMENTATION.md +0 -535
  381. package/docs/TERMS.md +0 -34
  382. package/docs/TOKEN_TRACKING.md +0 -162
  383. package/docs/WORKFLOW_GUIDANCE.md +0 -277
  384. package/docs/adr/ADR-000-product-naming-and-branding.md +0 -115
  385. package/docs/adr/ADR-001-plan-json-frozen-input.md +0 -68
  386. package/docs/adr/ADR-002-two-track-separation.md +0 -84
  387. package/docs/adr/ADR-003-gate-uniform-execution.md +0 -69
  388. package/docs/adr/ADR-004-runner-state-model.md +0 -75
  389. package/docs/adr/ADR-005-merge-pyramid-ordering.md +0 -87
  390. package/docs/adr/ADR-006-schema-versioning-semver.md +0 -81
  391. package/docs/adr/ADR-007-task-snapshot-contract.md +0 -503
  392. package/docs/adr/ADR-008-lex-packaging.md +0 -243
  393. package/docs/adr/ADR-009-ax-test-output-adapters.md +0 -440
  394. package/docs/adr/README.md +0 -32
  395. package/docs/advanced-cli.md +0 -436
  396. package/docs/agent-stall-detection.md +0 -278
  397. package/docs/architecture/executors.md +0 -190
  398. package/docs/architecture.md +0 -316
  399. package/docs/attestation/AX-SHARED-PLEDGE.md +0 -83
  400. package/docs/attestation/AX-SHARED-PLEDGE_v1.0.0.md +0 -99
  401. package/docs/attestation/AX-SHARED-PLEDGE_v1.0.0_VERIFICATION.md +0 -115
  402. package/docs/attestation/Lex_Guff_Version_Contract_Pact_v1.0.0.md +0 -181
  403. package/docs/attestation/README.md +0 -87
  404. package/docs/attestation/ax_pledge_2025-12-02.ots +0 -0
  405. package/docs/attestation/ax_pledge_timestamp_response.tsr +0 -0
  406. package/docs/attestation/copilot_summarization_2025-12-01.ots +0 -0
  407. package/docs/attestation/copilot_summarization_2025-12-01_VERIFICATION.md +0 -100
  408. package/docs/attestation/copilot_summarization_behavior_observation_2025-12-01.md +0 -85
  409. package/docs/attestation/copilot_summarization_screenshot_2025-12-01.png +0 -0
  410. package/docs/attestation/employment_separation_2025-11-26.ots +0 -0
  411. package/docs/attestation/employment_timestamp_response.tsr +0 -0
  412. package/docs/attestation/freetsa_cacert.pem +0 -45
  413. package/docs/attestation/freetsa_tsa.crt +0 -45
  414. package/docs/attestation/lex_employment_separation_2025-11-26.md +0 -85
  415. package/docs/attestation/lex_employment_separation_2025-11-26_VERIFICATION.md +0 -126
  416. package/docs/attestation/patent/2025-12-07-shadow-governance-pct-draft.md +0 -350
  417. package/docs/attestation/patent/2025-12-07-shadow-governance-pct-draft.md.ots +0 -0
  418. package/docs/attestation/patent/2025-12-07-shadow-governance-pct-draft_VERIFICATION.md +0 -130
  419. package/docs/attestation/patent/README.md +0 -75
  420. package/docs/attestation/patent/fig1_write_path.svg +0 -58
  421. package/docs/attestation/patent/fig2_read_normalize_rollup.svg +0 -92
  422. package/docs/attestation/timestamp_response.tsr +0 -0
  423. package/docs/attribution-README.md +0 -264
  424. package/docs/audit-compliance.md +0 -283
  425. package/docs/audit-outputs.md +0 -1213
  426. package/docs/audit-sdk.md +0 -1134
  427. package/docs/autopilot-levels.md +0 -368
  428. package/docs/autopilot.md +0 -288
  429. package/docs/ci-cd-integration.md +0 -580
  430. package/docs/ci-integration-guide.md +0 -369
  431. package/docs/ci-version-validation.md +0 -198
  432. package/docs/cli-mcp-weave-reporting.md +0 -462
  433. package/docs/cli.md +0 -2262
  434. package/docs/cluster-gates-rollback.md +0 -222
  435. package/docs/command-creation-guide.md +0 -485
  436. package/docs/command-whitelist.md +0 -490
  437. package/docs/commands/idea.md +0 -253
  438. package/docs/config.md +0 -245
  439. package/docs/conflict-clustering.md +0 -225
  440. package/docs/conflict-predictor.md +0 -359
  441. package/docs/context-diet.md +0 -249
  442. package/docs/counter-examples.md +0 -199
  443. package/docs/create-project.md +0 -211
  444. package/docs/deliverables-generator.md +0 -299
  445. package/docs/deliverables-management.md +0 -474
  446. package/docs/dependency-parser.md +0 -354
  447. package/docs/determinism.md +0 -299
  448. package/docs/diffgraph-planner.md +0 -1211
  449. package/docs/dogfood/README.md +0 -33
  450. package/docs/dogfood/wave-3-results.md +0 -303
  451. package/docs/dogfood-merge-weave-script.md +0 -224
  452. package/docs/enterprise-onboarding.md +0 -291
  453. package/docs/environment-variables.md +0 -625
  454. package/docs/error-recovery.md +0 -466
  455. package/docs/errors.md +0 -288
  456. package/docs/executor-authoring.md +0 -854
  457. package/docs/executor-decoupling.md +0 -410
  458. package/docs/front-end-capture-pipeline.md +0 -312
  459. package/docs/gate-report-examples.md +0 -380
  460. package/docs/gates.md +0 -319
  461. package/docs/github-automation.md +0 -128
  462. package/docs/governance-metrics.md +0 -368
  463. package/docs/integrations/README.md +0 -588
  464. package/docs/interactive-plan-review.md +0 -493
  465. package/docs/issue-orchestration.md +0 -256
  466. package/docs/lex_ax_session_key_rememberings_v0.1.md +0 -195
  467. package/docs/lexrunner-v1-summary.md +0 -246
  468. package/docs/lexrunner-v2-contract.md +0 -404
  469. package/docs/lexrunner-v2-migration-plan.md +0 -388
  470. package/docs/lexrunner-v2-salvage-map.md +0 -355
  471. package/docs/lexsona-rules.md +0 -154
  472. package/docs/merge-weave-analysis.md +0 -403
  473. package/docs/merge-weave-quickstart.md +0 -770
  474. package/docs/merge-weave-state-machine.md +0 -390
  475. package/docs/migration-guide.md +0 -529
  476. package/docs/monitoring-examples.md +0 -470
  477. package/docs/monitoring-implementation.md +0 -252
  478. package/docs/orchestration.md +0 -234
  479. package/docs/performance-scale.md +0 -359
  480. package/docs/plan-generation.md +0 -407
  481. package/docs/profile-resolution.md +0 -455
  482. package/docs/prompts.md +0 -427
  483. package/docs/quickstart.md +0 -546
  484. package/docs/release-process.md +0 -310
  485. package/docs/sample-prompts/merge-weave/cli-merge-weave-kickoff.md +0 -274
  486. package/docs/sample-prompts/merge-weave/mcp-merge-weave-kickoff.md +0 -480
  487. package/docs/sample-prompts/merge-weave/standalone-merge-weave-kickoff.md +0 -237
  488. package/docs/schemas.md +0 -359
  489. package/docs/scope-validation.md +0 -444
  490. package/docs/security/rotation-guide.md +0 -325
  491. package/docs/specs/Meeting_Control_Stack_Concept_v0.1.0.md +0 -417
  492. package/docs/specs/git-feature-flag-redesign.md +0 -321
  493. package/docs/specs/lex-pr-brief-behavior.md +0 -269
  494. package/docs/specs/smartergpt-structure-v1.md +0 -705
  495. package/docs/specs/task-brief-v0.1.md +0 -224
  496. package/docs/store-architecture.md +0 -61
  497. package/docs/templates/CONTRIBUTING-merge-weave-section.md +0 -33
  498. package/docs/templates/gates.example.yml +0 -109
  499. package/docs/templates/plan.example.json +0 -77
  500. package/docs/thesis/00-EVOLUTION-NOTES.md +0 -383
  501. package/docs/thesis/01-CORE-THESIS.md +0 -285
  502. package/docs/thesis/02-TURN-COST.md +0 -498
  503. package/docs/thesis/03-PERMISSION-TO-FAIL.md +0 -581
  504. package/docs/thesis/04-CROSS-MODEL-CONTINUITY.md +0 -517
  505. package/docs/thesis/05-RULE-FILE-SPEC.md +0 -732
  506. package/docs/thesis/06-CAPABILITY-TIERS.md +0 -723
  507. package/docs/thesis/07-ROBERT-FIELD-REPORT.md +0 -433
  508. package/docs/thesis/08-IMPLEMENTATION-GUIDE.md +0 -1093
  509. package/docs/thesis/09-METRICS-AND-TELEMETRY.md +0 -793
  510. package/docs/thesis/10-FAILURE-MODES.md +0 -716
  511. package/docs/thesis/README.md +0 -151
  512. package/docs/thesis/lex_governance-collab_systems_paper_draft.md +0 -952
  513. package/docs/thesis/lex_governance-collab_systems_paper_draft.pdf +0 -0
  514. package/docs/tool-grounded/READINESS_ANALYSIS.md +0 -527
  515. package/docs/tool-grounded/enforcement.md +0 -361
  516. package/docs/tool-grounded/tool-grounded-a-view-from-the-inside.md +0 -437
  517. package/docs/tool-grounded/tool-grounded-prompt.md +0 -122
  518. package/docs/tool-grounded/tool-grounded-run-centric.md +0 -474
  519. package/docs/troubleshooting-planner.md +0 -910
  520. package/docs/troubleshooting.md +0 -745
  521. package/docs/tutorials/README.md +0 -201
  522. package/docs/tutorials/diffgraph-planner/01-simple-stack.md +0 -460
  523. package/docs/tutorials/diffgraph-planner/02-diamond-pattern.md +0 -431
  524. package/docs/tutorials/diffgraph-planner/03-large-batch.md +0 -525
  525. package/docs/tutorials/diffgraph-planner/04-fixing-cycles.md +0 -526
  526. package/docs/tutorials/diffgraph-planner/05-hybrid-workflow.md +0 -555
  527. package/docs/tutorials/quick-merge-pyramid.md +0 -364
  528. package/docs/tutorials/video-scripts/01-getting-started.md +0 -286
  529. package/docs/tutorials/video-scripts/02-understanding-dependencies.md +0 -376
  530. package/docs/weave-contract.md +0 -116
  531. package/docs/weave-execution-log.md +0 -153
  532. package/docs/workflows/README.md +0 -139
  533. package/docs/workflows/enterprise.md +0 -545
  534. package/docs/workflows/small-team.md +0 -398
  535. package/docs/workflows/solo-developer.md +0 -419
  536. package/dogfood-merge-weave.sh +0 -122
  537. package/examples/README.md +0 -22
  538. package/examples/WORKING_EXAMPLE.md +0 -309
  539. package/examples/analyze-pr-files.js +0 -100
  540. package/examples/autopilot-level4-example.md +0 -234
  541. package/examples/cluster-gates-demo.sh +0 -178
  542. package/examples/complete-security-workflow.ts +0 -248
  543. package/examples/error-recovery/README.md +0 -202
  544. package/examples/executor-manifest.example.yaml +0 -81
  545. package/examples/front-end-capture-pipeline/README.md +0 -99
  546. package/examples/front-end-capture-pipeline/create-project-example.sh +0 -83
  547. package/examples/front-end-capture-pipeline/idea-dark-mode.json +0 -14
  548. package/examples/front-end-capture-pipeline/idea-example.sh +0 -57
  549. package/examples/front-end-capture-pipeline/manual-test-checklist.md +0 -426
  550. package/examples/gates/README.md +0 -165
  551. package/examples/gates/lint-gate.sh +0 -40
  552. package/examples/gates/lint-gate.ts +0 -99
  553. package/examples/gates/test-runner.ts +0 -113
  554. package/examples/gates/vuln-scanner.ts +0 -95
  555. package/examples/github-integration/README.md +0 -111
  556. package/examples/github-integration/example-plan.json +0 -95
  557. package/examples/performance-config.md +0 -388
  558. package/examples/profile-setup/.gitignore.template +0 -66
  559. package/examples/profile-setup/.smartergpt-example/README.md +0 -190
  560. package/examples/profile-setup/.smartergpt.local-example/README.md +0 -365
  561. package/examples/profile-setup/README.md +0 -492
  562. package/examples/profile-setup/cross-repo-prompts/README.md +0 -606
  563. package/examples/safety-framework-demo.ts +0 -130
  564. package/examples/safety-mechanisms-example.ts +0 -191
  565. package/examples/sample-plan.json +0 -87
  566. package/examples/sample-stack.yml +0 -66
  567. package/examples/sarif/README.md +0 -224
  568. package/examples/scope-validation-demo.ts +0 -199
  569. package/examples/security-integration.ts +0 -293
  570. package/examples/token-tracking-example.ts +0 -71
  571. package/executors/senior-dev/ARCHITECTURE.md +0 -182
  572. package/executors/senior-dev/MEMORY_INTEGRATION.md +0 -236
  573. package/executors/senior-dev/QUICK_START.md +0 -145
  574. package/executors/senior-dev/README.md +0 -76
  575. package/executors/senior-dev/examples/sample-review-session.md +0 -228
  576. package/executors/senior-dev/executor-manifest.yaml +0 -79
  577. package/executors/senior-dev/prompts/code-review.prompt.md +0 -78
  578. package/executors/senior-dev/prompts/mentorship-feedback.prompt.md +0 -97
  579. package/executors/senior-dev/prompts/pattern-recognition.prompt.md +0 -80
  580. package/executors/senior-dev/prompts/pr-analysis.prompt.md +0 -75
  581. package/executors/senior-dev/scripts/capture-review-frame.sh +0 -129
  582. package/executors/senior-dev/scripts/prepare-review-context.sh +0 -61
  583. package/executors/senior-dev/scripts/recall-context.sh +0 -87
  584. package/lexrunner-launcher.sh +0 -12
  585. package/mcp-config-example.json +0 -14
  586. package/merge-weave-current-prs.md +0 -170
  587. package/merge-weave-dogfood.json +0 -46
  588. package/merge-weave-plan.json +0 -56
  589. package/procedures/merge-weave-main.yaml +0 -90
  590. package/procedures/pr-review.yaml +0 -68
  591. package/project/README.md +0 -50
  592. package/prompts/tool-grounded-mode.md +0 -185
  593. package/scripts/README.md +0 -354
  594. package/scripts/analyze-governance-logs.mjs +0 -51
  595. package/scripts/benchmark-ci.ts +0 -339
  596. package/scripts/check-determinism.sh +0 -23
  597. package/scripts/check-license-compliance.mjs +0 -319
  598. package/scripts/check-release-drift.mjs +0 -81
  599. package/scripts/ci-debug.sh +0 -24
  600. package/scripts/ci-smoke.mjs +0 -304
  601. package/scripts/create-sample-repo.sh +0 -245
  602. package/scripts/dogfood-merge-weave.sh +0 -552
  603. package/scripts/gen_mcp_servers.py +0 -252
  604. package/scripts/generate-executor-manifest-schema.ts +0 -30
  605. package/scripts/generate-flake-schema.ts +0 -32
  606. package/scripts/generate-gate-schema.ts +0 -32
  607. package/scripts/generate-plan-schema.ts +0 -30
  608. package/scripts/generate-run-schemas.ts +0 -69
  609. package/scripts/load-prompt.mjs +0 -147
  610. package/scripts/merge-weave-wrapper.sh +0 -445
  611. package/scripts/merge-weave.sh +0 -489
  612. package/scripts/metrics-template.ts +0 -134
  613. package/scripts/package-lex.sh +0 -267
  614. package/scripts/quick-start-merge-weave.sh +0 -218
  615. package/scripts/release-prepare.ts +0 -350
  616. package/scripts/rotate-secrets-example.ts +0 -134
  617. package/scripts/test-lexsona-shadow.mjs +0 -100
  618. package/scripts/validate-manifests.ts +0 -188
  619. package/scripts/verify-audit-phase2.js +0 -175
  620. package/src/ai/README.md +0 -456
  621. package/src/ai/conflictStrategy.ts +0 -223
  622. package/src/ai/conflictStrategyCache.ts +0 -164
  623. package/src/ai/conflictStrategyPrompt.ts +0 -128
  624. package/src/ai/conflictStrategySchema.ts +0 -165
  625. package/src/ai/heuristicFallback.ts +0 -162
  626. package/src/ai/index.ts +0 -64
  627. package/src/ai/riskScoring.ts +0 -174
  628. package/src/aliases/index.ts +0 -16
  629. package/src/aliases/resolver.ts +0 -212
  630. package/src/audit/context.ts +0 -284
  631. package/src/audit/emitter.ts +0 -685
  632. package/src/audit/events.ts +0 -210
  633. package/src/audit/gateMatrix.ts +0 -158
  634. package/src/audit/index.ts +0 -44
  635. package/src/audit/manifest.ts +0 -78
  636. package/src/audit/profiles.ts +0 -93
  637. package/src/audit/redaction.ts +0 -216
  638. package/src/audit/sarif.ts +0 -213
  639. package/src/audit/schema/events.ts +0 -366
  640. package/src/audit/schema/manifest.ts +0 -47
  641. package/src/audit/schema.ts +0 -159
  642. package/src/audit/sdk/index.ts +0 -145
  643. package/src/audit/sdk/types.ts +0 -88
  644. package/src/audit/sidecar.ts +0 -111
  645. package/src/audit/signing.ts +0 -521
  646. package/src/autopilot/README.md +0 -113
  647. package/src/autopilot/artifacts.ts +0 -287
  648. package/src/autopilot/base.ts +0 -132
  649. package/src/autopilot/deliverables.ts +0 -392
  650. package/src/autopilot/index.ts +0 -29
  651. package/src/autopilot/level1.ts +0 -187
  652. package/src/autopilot/level2.ts +0 -262
  653. package/src/autopilot/level3.ts +0 -263
  654. package/src/autopilot/level4.ts +0 -393
  655. package/src/autopilot/safety/README.md +0 -512
  656. package/src/autopilot/safety/SafetyFramework.ts +0 -634
  657. package/src/autopilot/safety/index.ts +0 -16
  658. package/src/autopilot/types.ts +0 -250
  659. package/src/budget/index.ts +0 -56
  660. package/src/budget/manager.ts +0 -547
  661. package/src/budget/schema.ts +0 -305
  662. package/src/budget/tracker.ts +0 -155
  663. package/src/cache/issue-cache.ts +0 -150
  664. package/src/cli/command-map.ts +0 -221
  665. package/src/cli/commands/gate/test.ts +0 -214
  666. package/src/cli/exitHandler.ts +0 -98
  667. package/src/cli/flags.ts +0 -123
  668. package/src/cli/formatSuggestions.ts +0 -202
  669. package/src/cli/formatters.ts +0 -294
  670. package/src/cli/jsonEnvelope.ts +0 -152
  671. package/src/cli/output.ts +0 -61
  672. package/src/cli/runnerLifecycle.ts +0 -118
  673. package/src/cli-audit.ts +0 -76
  674. package/src/cli-security.ts +0 -114
  675. package/src/cli.ts +0 -1231
  676. package/src/commands/audit/index.ts +0 -5
  677. package/src/commands/audit/verify.ts +0 -87
  678. package/src/commands/autopilot.ts +0 -131
  679. package/src/commands/budget.ts +0 -327
  680. package/src/commands/bulkOps.ts +0 -204
  681. package/src/commands/completion.ts +0 -287
  682. package/src/commands/config/validate.ts +0 -428
  683. package/src/commands/config.ts +0 -368
  684. package/src/commands/counterExamples.ts +0 -104
  685. package/src/commands/create-project.ts +0 -338
  686. package/src/commands/discover.ts +0 -192
  687. package/src/commands/doctor.ts +0 -436
  688. package/src/commands/execute.ts +0 -558
  689. package/src/commands/explain.ts +0 -157
  690. package/src/commands/fanout-analyze.ts +0 -684
  691. package/src/commands/fanout-harvest.ts +0 -328
  692. package/src/commands/fanout-monitor.ts +0 -224
  693. package/src/commands/gateAttest.ts +0 -95
  694. package/src/commands/gateImport.ts +0 -142
  695. package/src/commands/gateImportChecks.ts +0 -208
  696. package/src/commands/gateReport.ts +0 -184
  697. package/src/commands/governanceCleanup.ts +0 -171
  698. package/src/commands/governanceReport.ts +0 -497
  699. package/src/commands/guards.ts +0 -50
  700. package/src/commands/idea.ts +0 -281
  701. package/src/commands/init.ts +0 -414
  702. package/src/commands/issues.ts +0 -165
  703. package/src/commands/merge.ts +0 -677
  704. package/src/commands/mergeOrder.ts +0 -68
  705. package/src/commands/metrics.ts +0 -232
  706. package/src/commands/migrateProfile.ts +0 -187
  707. package/src/commands/orchestrate/analyze-issues.ts +0 -203
  708. package/src/commands/orchestrate/assign-batch.ts +0 -204
  709. package/src/commands/orchestrate/generate-deliverables.ts +0 -66
  710. package/src/commands/orchestrate/pinToolchain.ts +0 -102
  711. package/src/commands/orchestrate/plan-batch.ts +0 -119
  712. package/src/commands/orchestrate/predict-conflicts.ts +0 -210
  713. package/src/commands/orchestrate.ts +0 -186
  714. package/src/commands/plan.ts +0 -403
  715. package/src/commands/planDiff.ts +0 -56
  716. package/src/commands/planReview.ts +0 -112
  717. package/src/commands/planViewer.ts +0 -180
  718. package/src/commands/preview-constraints.ts +0 -97
  719. package/src/commands/query.ts +0 -313
  720. package/src/commands/report.ts +0 -56
  721. package/src/commands/retry.ts +0 -60
  722. package/src/commands/schema.ts +0 -128
  723. package/src/commands/security.ts +0 -140
  724. package/src/commands/seniorDev.ts +0 -326
  725. package/src/commands/status.ts +0 -97
  726. package/src/commands/tokenReport.ts +0 -167
  727. package/src/commands/validation.ts +0 -66
  728. package/src/commands/weave-checkpoints.ts +0 -145
  729. package/src/commands/weave-fanout.ts +0 -273
  730. package/src/commands/weave-policy.ts +0 -277
  731. package/src/commands/weave.ts +0 -518
  732. package/src/config/localOverlay.ts +0 -167
  733. package/src/config/pathResolver.ts +0 -106
  734. package/src/config/profileResolver.ts +0 -194
  735. package/src/config/promptsResolver.ts +0 -312
  736. package/src/config/rulesResolver.ts +0 -257
  737. package/src/config/schemas.ts +0 -142
  738. package/src/core/bootstrap.ts +0 -287
  739. package/src/core/enterprise.ts +0 -453
  740. package/src/core/errorRecovery.ts +0 -509
  741. package/src/core/githubPlan.ts +0 -282
  742. package/src/core/inputs.ts +0 -314
  743. package/src/core/multiRepoPlan.ts +0 -353
  744. package/src/core/plan.ts +0 -106
  745. package/src/core/snapshot.ts +0 -189
  746. package/src/errors/adapters.ts +0 -897
  747. package/src/errors/index.ts +0 -231
  748. package/src/executionState.ts +0 -356
  749. package/src/executors/README_FRAME_CONTRACT.md +0 -446
  750. package/src/executors/frameContract.ts +0 -270
  751. package/src/executors/guardrailEnforcement.ts +0 -294
  752. package/src/executors/seniorDev/core.ts +0 -548
  753. package/src/executors/seniorDev/index.ts +0 -30
  754. package/src/executors/seniorDev/types.ts +0 -176
  755. package/src/executors/toolBudget.ts +0 -194
  756. package/src/fanout/analyzer.ts +0 -735
  757. package/src/fanout/github-adapter.ts +0 -262
  758. package/src/fanout/harvest.ts +0 -517
  759. package/src/fanout/monitor.ts +0 -350
  760. package/src/fanout/types.ts +0 -428
  761. package/src/frames/controller.ts +0 -160
  762. package/src/frames/emitter.ts +0 -455
  763. package/src/frames/index.ts +0 -58
  764. package/src/frames/storage.ts +0 -203
  765. package/src/frames/types.ts +0 -258
  766. package/src/gates/checkRunConverter.ts +0 -91
  767. package/src/gates/test/adapters/errors.ts +0 -32
  768. package/src/gates/test/adapters/index.ts +0 -36
  769. package/src/gates/test/adapters/interface.ts +0 -63
  770. package/src/gates/test/adapters/jest-json.ts +0 -370
  771. package/src/gates/test/adapters/junit-xml.ts +0 -400
  772. package/src/gates/test/adapters/registry.ts +0 -149
  773. package/src/gates/test/adapters/vitest-json.ts +0 -339
  774. package/src/gates/test/enrichment/failureId.ts +0 -74
  775. package/src/gates/test/enrichment/index.ts +0 -25
  776. package/src/gates/test/enrichment/nextActions.ts +0 -322
  777. package/src/gates/test/enrichment/rerunTemplates.ts +0 -105
  778. package/src/gates/test/enrichment/signature.ts +0 -58
  779. package/src/gates/test/enrichment/stackParser.ts +0 -149
  780. package/src/gates/test/enrichment/types.ts +0 -67
  781. package/src/gates/test/formatters/markdown.spec.ts +0 -942
  782. package/src/gates/test/formatters/markdown.ts +0 -296
  783. package/src/gates/test/index.ts +0 -54
  784. package/src/gates/test/schema.spec.ts +0 -372
  785. package/src/gates/test/schema.ts +0 -327
  786. package/src/gates/validator.ts +0 -92
  787. package/src/gates.ts +0 -1022
  788. package/src/git/operations.ts +0 -592
  789. package/src/git/parseRemote.ts +0 -22
  790. package/src/github/api.ts +0 -584
  791. package/src/github/batch-ops.ts +0 -215
  792. package/src/github/client.ts +0 -647
  793. package/src/github/contextDiet.ts +0 -205
  794. package/src/github/diffHunks.ts +0 -285
  795. package/src/github/index.ts +0 -11
  796. package/src/github/minimalContext.ts +0 -212
  797. package/src/github/minimalContextClient.ts +0 -105
  798. package/src/github/symbolMap.ts +0 -370
  799. package/src/github/types.ts +0 -166
  800. package/src/governance/index.ts +0 -42
  801. package/src/governance/mcpStatus.ts +0 -258
  802. package/src/governance/timeoutAdjustment.ts +0 -149
  803. package/src/governance/turnCostSummary.ts +0 -182
  804. package/src/hooks/events.ts +0 -374
  805. package/src/hooks/index.ts +0 -8
  806. package/src/hostility/checks.ts +0 -408
  807. package/src/hostility/index.ts +0 -108
  808. package/src/hostility/score.ts +0 -143
  809. package/src/interactive/planDiff.ts +0 -168
  810. package/src/interactive/planHistory.ts +0 -205
  811. package/src/interactive/planReview.ts +0 -531
  812. package/src/learning/counter-example.ts +0 -174
  813. package/src/learning/prompts.ts +0 -107
  814. package/src/learning/storage.ts +0 -230
  815. package/src/lexsona/client.ts +0 -367
  816. package/src/lexsona/index.ts +0 -44
  817. package/src/lexsona/logger.ts +0 -408
  818. package/src/lexsona/types.ts +0 -177
  819. package/src/mcp/DEPRECATED.md +0 -33
  820. package/src/mcp/server.ts +0 -3587
  821. package/src/mcp/types/guided-response.ts +0 -95
  822. package/src/mcp/types.ts +0 -468
  823. package/src/mcp/workflow/state-machine.ts +0 -277
  824. package/src/mergeEligibility.ts +0 -355
  825. package/src/mergeOrder.ts +0 -170
  826. package/src/metrics/export.ts +0 -472
  827. package/src/metrics/index.ts +0 -35
  828. package/src/metrics/turncost.ts +0 -284
  829. package/src/monitoring/README.md +0 -222
  830. package/src/monitoring/audit.ts +0 -98
  831. package/src/monitoring/cache.ts +0 -121
  832. package/src/monitoring/dashboards/grafana-dashboard.json +0 -172
  833. package/src/monitoring/errorRecovery.ts +0 -334
  834. package/src/monitoring/errors.ts +0 -105
  835. package/src/monitoring/fileLogger.ts +0 -194
  836. package/src/monitoring/hallucinations.ts +0 -45
  837. package/src/monitoring/health.ts +0 -171
  838. package/src/monitoring/index.ts +0 -16
  839. package/src/monitoring/lock.ts +0 -158
  840. package/src/monitoring/logger.ts +0 -178
  841. package/src/monitoring/profiler.ts +0 -156
  842. package/src/monitoring/tokenLogger.ts +0 -141
  843. package/src/orchestrate/analyzer.ts +0 -461
  844. package/src/orchestrate/index.ts +0 -6
  845. package/src/orchestrate/types.ts +0 -65
  846. package/src/orchestration/README.md +0 -480
  847. package/src/orchestration/agentAssigner.ts +0 -206
  848. package/src/orchestration/batchPlanner.ts +0 -201
  849. package/src/orchestration/conflictClustering.ts +0 -344
  850. package/src/orchestration/conflictGraph.ts +0 -63
  851. package/src/orchestration/conflictPredictor.ts +0 -170
  852. package/src/orchestration/deliverablesGenerator.ts +0 -345
  853. package/src/orchestration/determinism.ts +0 -232
  854. package/src/orchestration/index.ts +0 -45
  855. package/src/orchestration/mergeTreeSimulator.ts +0 -137
  856. package/src/orchestration/mis.ts +0 -123
  857. package/src/orchestration/toolchainManifest.ts +0 -169
  858. package/src/orchestration/types.ts +0 -103
  859. package/src/performance.README.md +0 -99
  860. package/src/performance.ts +0 -279
  861. package/src/planner/README.md +0 -215
  862. package/src/planner/dependencyParser.ts +0 -404
  863. package/src/planner/dependencyScoring.ts +0 -346
  864. package/src/planner/fileAnalysis.ts +0 -693
  865. package/src/planner/index.ts +0 -41
  866. package/src/planner/scopeValidator.ts +0 -308
  867. package/src/planner/types.ts +0 -80
  868. package/src/planner/validation.ts +0 -493
  869. package/src/preview/constraints.ts +0 -333
  870. package/src/procedures/index.ts +0 -47
  871. package/src/procedures/loader.ts +0 -252
  872. package/src/procedures/schema.ts +0 -191
  873. package/src/procedures/stateMachine.ts +0 -160
  874. package/src/procedures/types.ts +0 -178
  875. package/src/receipts/emit.ts +0 -354
  876. package/src/receipts/index.ts +0 -48
  877. package/src/receipts/schema.ts +0 -227
  878. package/src/report/aggregate.ts +0 -160
  879. package/src/runs/artifacts.ts +0 -315
  880. package/src/runs/attribution.ts +0 -132
  881. package/src/runs/context.ts +0 -54
  882. package/src/runs/decisions.ts +0 -407
  883. package/src/runs/enforcement.ts +0 -395
  884. package/src/runs/failures.ts +0 -517
  885. package/src/runs/index.ts +0 -141
  886. package/src/runs/manager.ts +0 -910
  887. package/src/runs/statusBuilder.ts +0 -233
  888. package/src/runs/storage.ts +0 -290
  889. package/src/runs/types.ts +0 -216
  890. package/src/schema/flakeReport.ts +0 -74
  891. package/src/schema/gateMapping.ts +0 -107
  892. package/src/schema/gateReport.ts +0 -236
  893. package/src/schema/weaveLock.ts +0 -51
  894. package/src/schema.ts +0 -313
  895. package/src/schemas/executorManifest.ts +0 -204
  896. package/src/schemas/feature-spec-v0.ts +0 -40
  897. package/src/schemas/persona.ts +0 -162
  898. package/src/schemas/project.ts +0 -91
  899. package/src/schemas/runCentric.ts +0 -402
  900. package/src/schemas/task-contract.ts +0 -626
  901. package/src/schemas/vacuumReadyPrompt.ts +0 -128
  902. package/src/sdk/index.ts +0 -113
  903. package/src/sdk/parser.ts +0 -101
  904. package/src/sdk/query.ts +0 -315
  905. package/src/sdk/validator.ts +0 -114
  906. package/src/security/README.md +0 -496
  907. package/src/security/authentication.ts +0 -173
  908. package/src/security/authorization.ts +0 -348
  909. package/src/security/commandValidator.ts +0 -195
  910. package/src/security/compliance.ts +0 -688
  911. package/src/security/index.ts +0 -85
  912. package/src/security/policy.ts +0 -399
  913. package/src/security/sarif.ts +0 -179
  914. package/src/security/scanning.ts +0 -362
  915. package/src/security/secrets.ts +0 -520
  916. package/src/shared/git/index.ts +0 -30
  917. package/src/shared/git/runGit.ts +0 -281
  918. package/src/shared/git/runtime.ts +0 -66
  919. package/src/snapshot/builder.ts +0 -229
  920. package/src/snapshot/index.ts +0 -8
  921. package/src/store/CONTRACT.md +0 -189
  922. package/src/store/README.md +0 -22
  923. package/src/store/index.ts +0 -99
  924. package/src/store/inmemory/index.ts +0 -10
  925. package/src/store/inmemory/run-store.ts +0 -268
  926. package/src/store/postgres/.gitkeep +0 -0
  927. package/src/store/run-store.ts +0 -405
  928. package/src/store/sqlite/index.ts +0 -7
  929. package/src/store/sqlite/run-store.ts +0 -525
  930. package/src/store/sqlite/schema.sql +0 -67
  931. package/src/telemetry/frames.ts +0 -179
  932. package/src/telemetry/index.ts +0 -5
  933. package/src/tiers/index.ts +0 -34
  934. package/src/tiers/metrics.ts +0 -156
  935. package/src/tiers/schema.ts +0 -95
  936. package/src/tiers/suggest.ts +0 -183
  937. package/src/types/guardrails.ts +0 -452
  938. package/src/types/index.ts +0 -42
  939. package/src/util/canonicalJson.ts +0 -29
  940. package/src/util/colorControl.ts +0 -46
  941. package/src/util/envUtils.ts +0 -139
  942. package/src/util/hash.ts +0 -69
  943. package/src/util/lockHash.ts +0 -90
  944. package/src/util/minHeap.ts +0 -108
  945. package/src/util/progress.ts +0 -89
  946. package/src/util/tokenEstimator.ts +0 -55
  947. package/src/utils/fingerprint.ts +0 -105
  948. package/src/utils/paths.ts +0 -209
  949. package/src/utils/tokens.ts +0 -151
  950. package/src/utils/validation.ts +0 -53
  951. package/src/verification/diff-applier.ts +0 -60
  952. package/src/verification/engine-verifier.ts +0 -171
  953. package/src/verification/errors.ts +0 -30
  954. package/src/verification/index.ts +0 -13
  955. package/src/weave/audit/index.ts +0 -17
  956. package/src/weave/audit/logger.ts +0 -206
  957. package/src/weave/authority/evaluator.ts +0 -660
  958. package/src/weave/authority/index.ts +0 -30
  959. package/src/weave/authority/schema.ts +0 -292
  960. package/src/weave/checkpoint/index.ts +0 -7
  961. package/src/weave/checkpoint/storage.ts +0 -223
  962. package/src/weave/checkpoint/types.ts +0 -121
  963. package/src/weave/checkpoint/utils.ts +0 -207
  964. package/src/weave/clusterGates.ts +0 -366
  965. package/src/weave/draftPR.ts +0 -214
  966. package/src/weave/executor/d1-executor.ts +0 -822
  967. package/src/weave/executor/d2-executor.ts +0 -381
  968. package/src/weave/executor/index.ts +0 -24
  969. package/src/weave/executor/types.ts +0 -135
  970. package/src/weave/fanout/generator.ts +0 -186
  971. package/src/weave/fanout/index.ts +0 -51
  972. package/src/weave/fanout/loader.ts +0 -134
  973. package/src/weave/fanout/matcher.ts +0 -239
  974. package/src/weave/fanout/schema.ts +0 -178
  975. package/src/weave/frameHelper.ts +0 -126
  976. package/src/weave/gateFailureHandler.ts +0 -405
  977. package/src/weave/index.ts +0 -89
  978. package/src/weave/lockFile.ts +0 -193
  979. package/src/weave/mergeHelpers.ts +0 -377
  980. package/src/weave/mergeWeaveSequential.ts +0 -282
  981. package/src/weave/metrics/calculator.ts +0 -362
  982. package/src/weave/metrics/index.ts +0 -44
  983. package/src/weave/metrics/logger.ts +0 -291
  984. package/src/weave/metrics/schema.ts +0 -505
  985. package/src/weave/planner/index.ts +0 -23
  986. package/src/weave/planner/planner.ts +0 -411
  987. package/src/weave/planner/types.ts +0 -181
  988. package/src/weave/policy/index.ts +0 -63
  989. package/src/weave/policy/loader.ts +0 -148
  990. package/src/weave/policy/schema.ts +0 -290
  991. package/src/weave/post-merge-checks.ts +0 -220
  992. package/src/weave/preflightConflicts.ts +0 -375
  993. package/src/weave/receiptHelper.ts +0 -287
  994. package/src/weave/recovery.ts +0 -232
  995. package/src/weave/resolutionGuidance.ts +0 -173
  996. package/src/weave/stateMachine.ts +0 -426
  997. package/src/weave/testfix/applier.ts +0 -195
  998. package/src/weave/testfix/index.ts +0 -18
  999. package/src/weave/testfix/loader.ts +0 -116
  1000. package/src/weave/testfix/matcher.ts +0 -158
  1001. package/src/weave/testfix/schema.ts +0 -218
  1002. package/src/weave/types.ts +0 -305
  1003. package/src/weave/utils/copilot-completion.ts +0 -76
  1004. package/test-mcp-dogfood.mjs +0 -128
  1005. package/test-mcp.mjs +0 -116
  1006. package/tests/README.md +0 -155
  1007. package/tests/advanced-cli-e2e.spec.ts +0 -218
  1008. package/tests/agentAssigner.spec.ts +0 -261
  1009. package/tests/ai-conflict-strategy-cache.spec.ts +0 -254
  1010. package/tests/ai-conflict-strategy-risk.spec.ts +0 -287
  1011. package/tests/ai-conflict-strategy-schema.spec.ts +0 -252
  1012. package/tests/ai-conflict-strategy.spec.ts +0 -442
  1013. package/tests/aliases/resolver.spec.ts +0 -238
  1014. package/tests/audit/context.spec.ts +0 -283
  1015. package/tests/audit/emitter.spec.ts +0 -347
  1016. package/tests/audit/gateMatrix.spec.ts +0 -335
  1017. package/tests/audit/integration.spec.ts +0 -236
  1018. package/tests/audit/redaction.spec.ts +0 -290
  1019. package/tests/audit/sarif-integration.spec.ts +0 -303
  1020. package/tests/audit/sarif.spec.ts +0 -458
  1021. package/tests/audit/schema-events.spec.ts +0 -421
  1022. package/tests/audit/schema.spec.ts +0 -434
  1023. package/tests/audit/sdk-integration.spec.ts +0 -598
  1024. package/tests/audit/sdk.spec.ts +0 -318
  1025. package/tests/audit/signing-integration.spec.ts +0 -276
  1026. package/tests/audit/signing.spec.ts +0 -350
  1027. package/tests/audit-signing.spec.ts +0 -406
  1028. package/tests/audit-verify-cli.spec.ts +0 -176
  1029. package/tests/autopilot-e2e-level3-4.spec.ts +0 -741
  1030. package/tests/autopilot-integration.spec.ts +0 -274
  1031. package/tests/autopilot-level1.spec.ts +0 -449
  1032. package/tests/autopilot-level2.spec.ts +0 -188
  1033. package/tests/autopilot-level3.spec.ts +0 -266
  1034. package/tests/autopilot-level4.spec.ts +0 -454
  1035. package/tests/autopilot.spec.ts +0 -379
  1036. package/tests/ax-error-adapters.spec.ts +0 -580
  1037. package/tests/batch-planner.spec.ts +0 -500
  1038. package/tests/benchmark-infrastructure.spec.ts +0 -445
  1039. package/tests/benchmarks/README.md +0 -103
  1040. package/tests/benchmarks/baselines/baseline.json +0 -127
  1041. package/tests/benchmarks/core/dependencyResolver.bench.ts +0 -128
  1042. package/tests/benchmarks/core/planParser.bench.ts +0 -114
  1043. package/tests/benchmarks/core/topologicalSort.bench.ts +0 -102
  1044. package/tests/benchmarks/index.ts +0 -36
  1045. package/tests/benchmarks/io/fileOperations.bench.ts +0 -132
  1046. package/tests/benchmarks/io/gitOperations.bench.ts +0 -99
  1047. package/tests/benchmarks/utils/graphGenerator.ts +0 -201
  1048. package/tests/benchmarks/utils/reporter.ts +0 -231
  1049. package/tests/benchmarks/workflows/endToEnd.bench.ts +0 -132
  1050. package/tests/bootstrap.test.ts +0 -319
  1051. package/tests/budget-tracker.spec.ts +0 -279
  1052. package/tests/bulkOps.spec.ts +0 -166
  1053. package/tests/bulletproof-determinism.test.ts +0 -223
  1054. package/tests/canonicalJson.test.ts +0 -130
  1055. package/tests/checkRunConverter.spec.ts +0 -357
  1056. package/tests/cli/commands/gate/test.spec.ts +0 -564
  1057. package/tests/cli/emit-frames-flag.spec.ts +0 -117
  1058. package/tests/cli/exitHandler.spec.ts +0 -314
  1059. package/tests/cli/flags.spec.ts +0 -223
  1060. package/tests/cli/formatters.spec.ts +0 -513
  1061. package/tests/cli/output.spec.ts +0 -221
  1062. package/tests/cli-autopilot.spec.ts +0 -170
  1063. package/tests/cli-budget-guards.spec.ts +0 -210
  1064. package/tests/cli-color-control.spec.ts +0 -334
  1065. package/tests/cli-deliverables-generator.spec.ts +0 -185
  1066. package/tests/cli-determinism.spec.ts +0 -496
  1067. package/tests/cli-init-enterprise.spec.ts +0 -294
  1068. package/tests/cli-init-json.spec.ts +0 -154
  1069. package/tests/cli-init-local.spec.ts +0 -159
  1070. package/tests/cli-json-envelope.spec.ts +0 -140
  1071. package/tests/cli-json.spec.ts +0 -408
  1072. package/tests/cli-orchestrate-plan-batch.spec.ts +0 -329
  1073. package/tests/cli-orchestrate.spec.ts +0 -231
  1074. package/tests/cli-plan-generation.spec.ts +0 -367
  1075. package/tests/cli-plan-review.spec.ts +0 -300
  1076. package/tests/cli-progress.spec.ts +0 -193
  1077. package/tests/cli-ux-enhancements.spec.ts +0 -213
  1078. package/tests/cliJsonPurity.spec.ts +0 -437
  1079. package/tests/cliSuggestDeps.spec.ts +0 -360
  1080. package/tests/cluster-gates-rollback.spec.ts +0 -353
  1081. package/tests/command-validator-integration.spec.ts +0 -305
  1082. package/tests/command-validator.spec.ts +0 -380
  1083. package/tests/commands/autopilot.spec.ts +0 -124
  1084. package/tests/commands/config-validate.spec.ts +0 -301
  1085. package/tests/commands/config.spec.ts +0 -311
  1086. package/tests/commands/create-project.spec.ts +0 -90
  1087. package/tests/commands/doctor.spec.ts +0 -57
  1088. package/tests/commands/execute.spec.ts +0 -293
  1089. package/tests/commands/gateAttest.spec.ts +0 -172
  1090. package/tests/commands/gateImport.spec.ts +0 -176
  1091. package/tests/commands/gateReport.spec.ts +0 -130
  1092. package/tests/commands/guards.spec.ts +0 -114
  1093. package/tests/commands/idea.spec.ts +0 -177
  1094. package/tests/commands/merge.spec.ts +0 -166
  1095. package/tests/commands/plan.spec.ts +0 -123
  1096. package/tests/commands/query.spec.ts +0 -294
  1097. package/tests/commands/report.spec.ts +0 -54
  1098. package/tests/commands/retry.spec.ts +0 -300
  1099. package/tests/commands/schema.spec.ts +0 -136
  1100. package/tests/commands/validation.spec.ts +0 -229
  1101. package/tests/completion.spec.ts +0 -133
  1102. package/tests/config-inspect.spec.ts +0 -202
  1103. package/tests/conflictClustering-e2e.spec.ts +0 -278
  1104. package/tests/conflictClustering.spec.ts +0 -550
  1105. package/tests/conflictGraph.spec.ts +0 -126
  1106. package/tests/conflictPredictor.spec.ts +0 -238
  1107. package/tests/deliverables-generator.spec.ts +0 -329
  1108. package/tests/deliverables.spec.ts +0 -381
  1109. package/tests/dependencyParser-github.spec.ts +0 -244
  1110. package/tests/dependencyParser.spec.ts +0 -386
  1111. package/tests/dependencyScoring.spec.ts +0 -668
  1112. package/tests/deterministic-applicable.test.ts +0 -156
  1113. package/tests/deterministic-build.test.ts +0 -172
  1114. package/tests/deterministic-simple.test.ts +0 -32
  1115. package/tests/discover-suggest-integration.spec.ts +0 -340
  1116. package/tests/dogfood-merge-weave-script.spec.ts +0 -150
  1117. package/tests/e2e/planner.spec.ts +0 -596
  1118. package/tests/e2e-comprehensive.test.ts +0 -500
  1119. package/tests/e2e-determinism.test.ts +0 -293
  1120. package/tests/e2e-synthetic-6pr-weave.spec.ts +0 -329
  1121. package/tests/enterprise-init.spec.ts +0 -350
  1122. package/tests/envUtils.spec.ts +0 -267
  1123. package/tests/error-handling.test.ts +0 -104
  1124. package/tests/error-recovery.spec.ts +0 -451
  1125. package/tests/execution-plan-v1.test.ts +0 -257
  1126. package/tests/executionState-loadGateResults.spec.ts +0 -267
  1127. package/tests/executionState.test.ts +0 -169
  1128. package/tests/executors/README.md +0 -100
  1129. package/tests/executors/frameContract-integration.spec.ts +0 -324
  1130. package/tests/executors/frameContract.spec.ts +0 -531
  1131. package/tests/executors/guardrailEnforcement.spec.ts +0 -424
  1132. package/tests/executors/lifecycle.spec.ts +0 -313
  1133. package/tests/executors/toolBudget.spec.ts +0 -473
  1134. package/tests/feature-spec-v0.test.ts +0 -145
  1135. package/tests/fileAnalysis.spec.ts +0 -946
  1136. package/tests/fingerprint.spec.ts +0 -100
  1137. package/tests/fixtures/README.md +0 -380
  1138. package/tests/fixtures/deliverables/batch-example-plan.json +0 -62
  1139. package/tests/fixtures/executors/README.md +0 -57
  1140. package/tests/fixtures/executors/index.ts +0 -9
  1141. package/tests/fixtures/executors/mock-executor.ts +0 -204
  1142. package/tests/fixtures/executors/registry.ts +0 -51
  1143. package/tests/fixtures/executors/types.ts +0 -95
  1144. package/tests/fixtures/fixtures.spec.ts +0 -307
  1145. package/tests/fixtures/gates/configs.ts +0 -234
  1146. package/tests/fixtures/gates/results.ts +0 -234
  1147. package/tests/fixtures/harvest-bundle-fixture.json +0 -87
  1148. package/tests/fixtures/index.ts +0 -219
  1149. package/tests/fixtures/invalid/plans.ts +0 -178
  1150. package/tests/fixtures/jest/all-passing.json +0 -71
  1151. package/tests/fixtures/jest/snapshot-failures.json +0 -66
  1152. package/tests/fixtures/jest/some-failing.json +0 -100
  1153. package/tests/fixtures/jest/with-location.json +0 -84
  1154. package/tests/fixtures/junit/cdata-messages.xml +0 -29
  1155. package/tests/fixtures/junit/multiple-suites.xml +0 -30
  1156. package/tests/fixtures/junit/single-suite.xml +0 -17
  1157. package/tests/fixtures/junit/with-errors.xml +0 -19
  1158. package/tests/fixtures/junit/with-skipped.xml +0 -18
  1159. package/tests/fixtures/npm-audit.json +0 -32
  1160. package/tests/fixtures/plan.bad-schema.json +0 -5
  1161. package/tests/fixtures/plan.bad-unknown-dep.json +0 -10
  1162. package/tests/fixtures/plan.ci-gates.json +0 -36
  1163. package/tests/fixtures/plan.complex-cycle.json +0 -22
  1164. package/tests/fixtures/plan.cycle.json +0 -14
  1165. package/tests/fixtures/plan.deep-chain.json +0 -95
  1166. package/tests/fixtures/plan.dogfood-execute.json +0 -36
  1167. package/tests/fixtures/plan.gates.json +0 -30
  1168. package/tests/fixtures/plan.integration-pyramid.json +0 -56
  1169. package/tests/fixtures/plan.orphans.json +0 -22
  1170. package/tests/fixtures/plan.parallel.json +0 -30
  1171. package/tests/fixtures/plan.tiny.json +0 -18
  1172. package/tests/fixtures/plan.wide-parallel.json +0 -75
  1173. package/tests/fixtures/plan.with-failures.json +0 -26
  1174. package/tests/fixtures/plan.with-vuln.json +0 -25
  1175. package/tests/fixtures/planner/cross-module.json +0 -101
  1176. package/tests/fixtures/planner/cycle-error.json +0 -56
  1177. package/tests/fixtures/planner/diamond-pattern.json +0 -74
  1178. package/tests/fixtures/planner/empty-repo.json +0 -9
  1179. package/tests/fixtures/planner/file-overlap-heavy.json +0 -110
  1180. package/tests/fixtures/planner/invalid-pr.json +0 -25
  1181. package/tests/fixtures/planner/merge-conflicts.json +0 -42
  1182. package/tests/fixtures/planner/mixed-deps.json +0 -101
  1183. package/tests/fixtures/planner/self-dependency.json +0 -24
  1184. package/tests/fixtures/planner/simple-stack.json +0 -79
  1185. package/tests/fixtures/planner/single-pr.json +0 -25
  1186. package/tests/fixtures/planner/stale-pr.json +0 -40
  1187. package/tests/fixtures/plans/complex.ts +0 -201
  1188. package/tests/fixtures/plans/diamond.ts +0 -115
  1189. package/tests/fixtures/plans/linear.ts +0 -74
  1190. package/tests/fixtures/plans/simple.ts +0 -61
  1191. package/tests/fixtures/prs/basic.ts +0 -175
  1192. package/tests/fixtures/prs/withDeps.ts +0 -197
  1193. package/tests/fixtures/scan-results-clean.sarif +0 -15
  1194. package/tests/fixtures/scan-results.sarif +0 -74
  1195. package/tests/fixtures/scenarios/mergeWorkflows.ts +0 -300
  1196. package/tests/fixtures/scenarios/syntheticWeave.ts +0 -351
  1197. package/tests/fixtures/snapshot/package.json +0 -5
  1198. package/tests/fixtures/snapshot/sample.ts +0 -21
  1199. package/tests/fixtures/utils/cleanup.ts +0 -81
  1200. package/tests/fixtures/utils/mockGitHub.ts +0 -219
  1201. package/tests/fixtures/utils/tempDir.ts +0 -109
  1202. package/tests/fixtures/verification/expected-verification.json +0 -16
  1203. package/tests/fixtures/verification/receipt.json +0 -31
  1204. package/tests/fixtures/verification/snapshot.json +0 -44
  1205. package/tests/fixtures/vitest/all-passing.json +0 -67
  1206. package/tests/fixtures/vitest/complex-nested-suites.json +0 -98
  1207. package/tests/fixtures/vitest/some-failing.json +0 -98
  1208. package/tests/fixtures/vitest/with-coverage.json +0 -97
  1209. package/tests/fixtures-usage-examples.spec.ts +0 -304
  1210. package/tests/flakeReport.spec.ts +0 -267
  1211. package/tests/frames/ci-gate-integration.spec.ts +0 -331
  1212. package/tests/frames/controller.spec.ts +0 -165
  1213. package/tests/frames/emitter.spec.ts +0 -371
  1214. package/tests/frames/idempotency.spec.ts +0 -177
  1215. package/tests/frames/storage.spec.ts +0 -346
  1216. package/tests/frames/types.spec.ts +0 -249
  1217. package/tests/frames/v2-schema-integration.spec.ts +0 -435
  1218. package/tests/gate-working-directory.spec.ts +0 -204
  1219. package/tests/gateMapping.spec.ts +0 -161
  1220. package/tests/gateReportIntegration.spec.ts +0 -175
  1221. package/tests/gateReportValidation.spec.ts +0 -452
  1222. package/tests/gates/test/adapters/jest-json.spec.ts +0 -372
  1223. package/tests/gates/test/adapters/junit-xml.spec.ts +0 -421
  1224. package/tests/gates/test/adapters/registry.spec.ts +0 -376
  1225. package/tests/gates/test/adapters/vitest-json.spec.ts +0 -455
  1226. package/tests/gates/test/enrichment/failureId.spec.ts +0 -131
  1227. package/tests/gates/test/enrichment/nextActions.spec.ts +0 -365
  1228. package/tests/gates/test/enrichment/rerunTemplates.spec.ts +0 -187
  1229. package/tests/gates/test/enrichment/signature.spec.ts +0 -163
  1230. package/tests/gates/test/enrichment/stackParser.spec.ts +0 -203
  1231. package/tests/gates/turncost-integration.spec.ts +0 -221
  1232. package/tests/gates/validation-integration.spec.ts +0 -147
  1233. package/tests/gates/validator.spec.ts +0 -200
  1234. package/tests/gates.test.ts +0 -255
  1235. package/tests/gatesWithPolicy.hostilityTimeoutAdjustment.spec.ts +0 -156
  1236. package/tests/git-operations-receipts.spec.ts +0 -121
  1237. package/tests/git-operations.test.ts +0 -152
  1238. package/tests/git-runtime.spec.ts +0 -175
  1239. package/tests/github-api.labels.spec.ts +0 -21
  1240. package/tests/github-api.test.ts +0 -85
  1241. package/tests/github-context-diet.spec.ts +0 -441
  1242. package/tests/github-diff-hunks.spec.ts +0 -387
  1243. package/tests/github-integration.spec.ts +0 -774
  1244. package/tests/github-minimal-context.spec.ts +0 -338
  1245. package/tests/github-symbol-map.spec.ts +0 -414
  1246. package/tests/githubClient.spec.ts +0 -123
  1247. package/tests/governance/mcpStatus.spec.ts +0 -276
  1248. package/tests/governance/timeoutAdjustment.spec.ts +0 -149
  1249. package/tests/governance/turnCostSummary.spec.ts +0 -188
  1250. package/tests/governance-retention.spec.ts +0 -151
  1251. package/tests/governance-wrapper-delegation.spec.ts +0 -148
  1252. package/tests/guardrails.spec.ts +0 -860
  1253. package/tests/hash.test.ts +0 -83
  1254. package/tests/helpers/cli.ts +0 -23
  1255. package/tests/helpers/getStd.ts +0 -1
  1256. package/tests/helpers/makeGate.ts +0 -19
  1257. package/tests/helpers/plannerTestHelpers.ts +0 -314
  1258. package/tests/hooks/events.spec.ts +0 -518
  1259. package/tests/hostility/checks.spec.ts +0 -295
  1260. package/tests/hostility/integration.spec.ts +0 -123
  1261. package/tests/hostility/score.spec.ts +0 -175
  1262. package/tests/init.spec.ts +0 -270
  1263. package/tests/integration/hipaa-encryption.spec.ts +0 -148
  1264. package/tests/integration/lex-smoke-test.spec.ts +0 -328
  1265. package/tests/integration-e2e.test.ts +0 -244
  1266. package/tests/integration-matrix.test.ts +0 -409
  1267. package/tests/interPRConflicts.spec.ts +0 -254
  1268. package/tests/interactive-plan-history.spec.ts +0 -255
  1269. package/tests/interactive-plan-review.spec.ts +0 -287
  1270. package/tests/issue-analyzer.spec.ts +0 -593
  1271. package/tests/lexsona-integration.spec.ts +0 -311
  1272. package/tests/localOverlay.spec.ts +0 -203
  1273. package/tests/lockHash.spec.ts +0 -167
  1274. package/tests/mcp-auth-errors.spec.ts +0 -190
  1275. package/tests/mcp-contracts.spec.ts +0 -290
  1276. package/tests/mcp-gates-external-plan.spec.ts +0 -146
  1277. package/tests/mcp-granular-tools.spec.ts +0 -208
  1278. package/tests/mcp-runstore-integration.spec.ts +0 -334
  1279. package/tests/mcp-scope-integration.spec.ts +0 -318
  1280. package/tests/mcp-task-handoff.spec.ts +0 -320
  1281. package/tests/mcp-workflow-guide.spec.ts +0 -53
  1282. package/tests/mcp.test.ts +0 -151
  1283. package/tests/merge-conflict-detection.spec.ts +0 -260
  1284. package/tests/mergeEligibility.test.ts +0 -201
  1285. package/tests/mergeLockHash.spec.ts +0 -158
  1286. package/tests/mergeOrder-with-fixtures.spec.ts +0 -215
  1287. package/tests/mergeOrder.test.ts +0 -108
  1288. package/tests/mergeTreeSimulator.spec.ts +0 -145
  1289. package/tests/metrics/export.spec.ts +0 -446
  1290. package/tests/metrics/turncost.spec.ts +0 -309
  1291. package/tests/metrics-template.spec.ts +0 -137
  1292. package/tests/migrateProfile.spec.ts +0 -254
  1293. package/tests/mis.spec.ts +0 -202
  1294. package/tests/monitoring-audit.spec.ts +0 -181
  1295. package/tests/monitoring-cache.spec.ts +0 -331
  1296. package/tests/monitoring-error-recovery.spec.ts +0 -236
  1297. package/tests/monitoring-errors.spec.ts +0 -193
  1298. package/tests/monitoring-fileLogger.spec.ts +0 -319
  1299. package/tests/monitoring-health.spec.ts +0 -152
  1300. package/tests/monitoring-lock.spec.ts +0 -308
  1301. package/tests/monitoring-logger.spec.ts +0 -157
  1302. package/tests/monitoring-metrics.spec.ts +0 -158
  1303. package/tests/monitoring-profiler.spec.ts +0 -197
  1304. package/tests/orchestration-determinism.spec.ts +0 -204
  1305. package/tests/parseRemote.spec.ts +0 -25
  1306. package/tests/pathResolver.spec.ts +0 -122
  1307. package/tests/paths.spec.ts +0 -68
  1308. package/tests/performance.spec.ts +0 -322
  1309. package/tests/pipeline-determinism.spec.ts +0 -597
  1310. package/tests/plan-tier-integration.spec.ts +0 -184
  1311. package/tests/precedence-resolution.spec.ts +0 -682
  1312. package/tests/preflightConflicts.spec.ts +0 -205
  1313. package/tests/procedures/keystone-policy.spec.ts +0 -296
  1314. package/tests/procedures/loader.spec.ts +0 -585
  1315. package/tests/procedures/pr-review.spec.ts +0 -321
  1316. package/tests/profileResolver.spec.ts +0 -375
  1317. package/tests/progress-indicators.spec.ts +0 -139
  1318. package/tests/promptsResolver.spec.ts +0 -443
  1319. package/tests/public-api.spec.ts +0 -272
  1320. package/tests/query.spec.ts +0 -170
  1321. package/tests/receipts.spec.ts +0 -463
  1322. package/tests/release-prepare.spec.ts +0 -268
  1323. package/tests/report.test.ts +0 -335
  1324. package/tests/resolutionGuidance.spec.ts +0 -160
  1325. package/tests/rotate-secrets-example.spec.ts +0 -198
  1326. package/tests/rulesResolver.spec.ts +0 -232
  1327. package/tests/runGit.spec.ts +0 -229
  1328. package/tests/runner-lifecycle-integration.spec.ts +0 -283
  1329. package/tests/runs/artifacts.spec.ts +0 -367
  1330. package/tests/runs/decisions.spec.ts +0 -495
  1331. package/tests/runs/enforcement.spec.ts +0 -555
  1332. package/tests/runs/failures.spec.ts +0 -554
  1333. package/tests/runs/manager-runstore-integration.spec.ts +0 -455
  1334. package/tests/runs/manager.spec.ts +0 -678
  1335. package/tests/runs-manager.spec.ts +0 -485
  1336. package/tests/safety-acceptance.spec.ts +0 -278
  1337. package/tests/safety-enhanced.spec.ts +0 -329
  1338. package/tests/safety-framework.spec.ts +0 -427
  1339. package/tests/safety-guards-integration.spec.ts +0 -213
  1340. package/tests/safety-integration.spec.ts +0 -278
  1341. package/tests/sarif-parser.spec.ts +0 -148
  1342. package/tests/schema.test.ts +0 -88
  1343. package/tests/schemas/behavior-rule.spec.ts +0 -366
  1344. package/tests/schemas/executorManifest.spec.ts +0 -441
  1345. package/tests/schemas/persona-integration.spec.ts +0 -62
  1346. package/tests/schemas/persona.spec.ts +0 -172
  1347. package/tests/schemas/project.spec.ts +0 -247
  1348. package/tests/schemas/run-store.spec.ts +0 -553
  1349. package/tests/schemas/runCentric.spec.ts +0 -463
  1350. package/tests/schemas/vacuumReadyPrompt.spec.ts +0 -515
  1351. package/tests/scope-github-auto-detection.spec.ts +0 -200
  1352. package/tests/scopeValidator.spec.ts +0 -497
  1353. package/tests/security-authentication.spec.ts +0 -42
  1354. package/tests/security-authorization.spec.ts +0 -350
  1355. package/tests/security-cli.spec.ts +0 -264
  1356. package/tests/security-compliance.spec.ts +0 -334
  1357. package/tests/security-policy.spec.ts +0 -295
  1358. package/tests/security-scanning.spec.ts +0 -349
  1359. package/tests/security-secrets.spec.ts +0 -401
  1360. package/tests/store/create-run-store.spec.ts +0 -185
  1361. package/tests/store/inmemory/run-store.spec.ts +0 -533
  1362. package/tests/store/sqlite/run-store.spec.ts +0 -849
  1363. package/tests/telemetry/frames.spec.ts +0 -120
  1364. package/tests/tiers.spec.ts +0 -466
  1365. package/tests/token-usage.spec.ts +0 -309
  1366. package/tests/toolchain-manifest.spec.ts +0 -145
  1367. package/tests/unified-budget.spec.ts +0 -713
  1368. package/tests/unit/cache/issue-cache.spec.ts +0 -131
  1369. package/tests/unit/fanout/analyzer-integration.spec.ts +0 -398
  1370. package/tests/unit/fanout/analyzer.spec.ts +0 -605
  1371. package/tests/unit/fanout/github-adapter.spec.ts +0 -203
  1372. package/tests/unit/fanout/harvest.spec.ts +0 -93
  1373. package/tests/unit/fanout/monitor.spec.ts +0 -297
  1374. package/tests/unit/fanout/types.spec.ts +0 -308
  1375. package/tests/unit/github/batch-ops.spec.ts +0 -179
  1376. package/tests/unit/learning/counter-example.spec.ts +0 -168
  1377. package/tests/unit/learning/storage.spec.ts +0 -154
  1378. package/tests/unit/preview/constraints.spec.ts +0 -429
  1379. package/tests/unit/runs/attribution.spec.ts +0 -204
  1380. package/tests/unit/schemas/task-contract.spec.ts +0 -483
  1381. package/tests/unit/snapshot/builder.spec.ts +0 -389
  1382. package/tests/unit/verification/engine-verifier.spec.ts +0 -279
  1383. package/tests/unit/weave/authority-evaluator.spec.ts +0 -404
  1384. package/tests/unit/weave/authority-schema.spec.ts +0 -199
  1385. package/tests/unit/weave/auto-undraft-integration.spec.ts +0 -349
  1386. package/tests/unit/weave/copilot-completion.spec.ts +0 -182
  1387. package/tests/unit/weave/d1-executor.spec.ts +0 -269
  1388. package/tests/unit/weave/d2-executor.spec.ts +0 -334
  1389. package/tests/unit/weave/fanout-generator.spec.ts +0 -365
  1390. package/tests/unit/weave/fanout-matcher.spec.ts +0 -320
  1391. package/tests/unit/weave/fanout-schema.spec.ts +0 -221
  1392. package/tests/unit/weave/mergeWeaveSequential.spec.ts +0 -268
  1393. package/tests/unit/weave/metrics-calculator.spec.ts +0 -212
  1394. package/tests/unit/weave/metrics-logger.spec.ts +0 -233
  1395. package/tests/unit/weave/metrics-schema.spec.ts +0 -383
  1396. package/tests/unit/weave/multi-repo-plan.spec.ts +0 -221
  1397. package/tests/unit/weave/planner.spec.ts +0 -227
  1398. package/tests/unit/weave/post-merge-checks.spec.ts +0 -342
  1399. package/tests/unit/weave/recovery.spec.ts +0 -306
  1400. package/tests/unit/weave/testfix/applier.spec.ts +0 -364
  1401. package/tests/unit/weave/testfix/e2e.spec.ts +0 -273
  1402. package/tests/unit/weave/testfix/integration.spec.ts +0 -128
  1403. package/tests/unit/weave/testfix/matcher.spec.ts +0 -321
  1404. package/tests/unit/weave/testfix/schema.spec.ts +0 -298
  1405. package/tests/utils/fingerprint.spec.ts +0 -251
  1406. package/tests/utils/paths.spec.ts +0 -284
  1407. package/tests/utils/tokens.spec.ts +0 -210
  1408. package/tests/utils/validation.spec.ts +0 -215
  1409. package/tests/utils-validation.spec.ts +0 -80
  1410. package/tests/validate-manifests.spec.ts +0 -231
  1411. package/tests/validation.spec.ts +0 -501
  1412. package/tests/vuln-gate.spec.ts +0 -341
  1413. package/tests/weave/adr007-integration.spec.ts +0 -309
  1414. package/tests/weave/checkpoint/cli-integration.spec.ts +0 -118
  1415. package/tests/weave/checkpoint/storage.spec.ts +0 -302
  1416. package/tests/weave/checkpoint/utils.spec.ts +0 -223
  1417. package/tests/weave/frameHelper.spec.ts +0 -423
  1418. package/tests/weave/gateFailureHandler.spec.ts +0 -249
  1419. package/tests/weave/lockFile.spec.ts +0 -387
  1420. package/tests/weave/mergeHelpers.spec.ts +0 -173
  1421. package/tests/weave/receiptHelper.spec.ts +0 -261
  1422. package/tests/weave/stateMachine.spec.ts +0 -436
  1423. package/tests/weave-contract.test.ts +0 -517
  1424. package/tests/weave-e2e.spec.ts +0 -279
  1425. package/tests/weaveLock.spec.ts +0 -136
  1426. package/tests/workflow-state-machine.spec.ts +0 -274
  1427. package/tests/write-protection.spec.ts +0 -213
  1428. package/tsconfig.json +0 -18
  1429. package/tsup.config.ts +0 -12
  1430. package/vitest.benchmark.config.ts +0 -17
  1431. package/vitest.config.ts +0 -28
  1432. package/vitest.git.config.ts +0 -12
  1433. package/vitest.slow-cli.config.ts +0 -28
package/docs/cli.md DELETED
@@ -1,2262 +0,0 @@
1
- # CLI Reference
2
-
3
- Complete reference for the lexrunner command-line interface, including all subcommands, options, and JSON output schemas.
4
-
5
- > **📖 See Also**:
6
- >
7
- > - [Merge-Weave Quickstart](./merge-weave-quickstart.md) - End-to-end guide for merge-weave operations
8
- > - [Autopilot Levels](./autopilot-levels.md) - Comprehensive guide to automation levels 0-4
9
- > - [Advanced CLI Features](./advanced-cli.md) - Power user tools and interactive modes
10
- > - [Command Creation Guide](./command-creation-guide.md) - How to add new commands to the CLI
11
-
12
- ## Architecture
13
-
14
- The lexrunner CLI uses a **modular command architecture** that provides:
15
-
16
- - **Maintainability**: Each command lives in its own module under `src/commands/`
17
- - **Testability**: Business logic separated from CLI registration
18
- - **Consistency**: Shared utilities for output, flags, and exit handling
19
- - **Extensibility**: Easy to add new commands following established patterns
20
-
21
- ### Command Registration Flow
22
-
23
- ```
24
- ┌─────────────────┐
25
- │ src/cli.ts │ Entry point, parses global flags
26
- └────────┬────────┘
27
- │ registerCommands()
28
-
29
- ┌─────────────────────────────────────────────┐
30
- │ src/commands/ │
31
- │ ├── init.ts → registerInitCommand │
32
- │ ├── plan.ts → registerPlanCommand │
33
- │ ├── execute.ts → registerExecuteCmd │
34
- │ ├── merge.ts → registerMergeCmd │
35
- │ └── ... │
36
- └─────────────────────────────────────────────┘
37
-
38
- ↓ Each command registers with Commander
39
- ┌─────────────────┐
40
- │ Commander.js │ Handles argument parsing & dispatch
41
- └────────┬────────┘
42
-
43
- ↓ .action() handler
44
- ┌─────────────────────────────────────────────┐
45
- │ Business Logic (pure functions) │
46
- │ • Separated from CLI concerns │
47
- │ • Unit testable │
48
- │ • Returns typed results │
49
- └─────────────────────────────────────────────┘
50
-
51
-
52
- ┌─────────────────────────────────────────────┐
53
- │ Shared Utilities │
54
- │ • src/cli/output.js (JSON output) │
55
- │ • src/cli/flags.js (global flags) │
56
- │ • src/cli/exitHandler.js (error handling) │
57
- └─────────────────────────────────────────────┘
58
- ```
59
-
60
- ### Command Module Pattern
61
-
62
- Each command module exports a single registration function:
63
-
64
- ```typescript
65
- // src/commands/myCommand.ts
66
- import { Command } from "commander";
67
-
68
- export function registerMyCommandCommand(program: Command): void {
69
- program
70
- .command("my-command")
71
- .description("Command description")
72
- .action(async (args, options) => {
73
- // Thin wrapper - delegates to business logic
74
- const result = await executeMyCommand(args, options);
75
- handleOutput(result, options);
76
- });
77
- }
78
-
79
- // Pure, testable business logic
80
- async function executeMyCommand(args, options) {
81
- // All logic here
82
- }
83
- ```
84
-
85
- **Key Principles:**
86
-
87
- - **Separation of Concerns**: CLI registration separate from business logic
88
- - **Pure Functions**: Business logic has no side effects (testable)
89
- - **Consistent Output**: All commands support `--json` and human-readable formats
90
- - **Error Handling**: Use `throwExit()` from `src/cli/exitHandler.js`
91
-
92
- ### Shared Utilities
93
-
94
- #### Output (`src/cli/output.js`)
95
-
96
- ```typescript
97
- import { writeJsonOutput } from '../cli/output.js';
98
-
99
- // Canonical JSON output to stdout
100
- writeJsonOutput({ success: true, items: [...] });
101
- ```
102
-
103
- #### Exit Handling (`src/cli/exitHandler.js`)
104
-
105
- ```typescript
106
- import { throwExit, CLIExitSignal } from "../cli/exitHandler.js";
107
-
108
- // Graceful exit with error message
109
- throwExit(new Error("Operation failed"), 1);
110
-
111
- // Exit with success
112
- throw new CLIExitSignal(0, "Operation complete");
113
- ```
114
-
115
- #### Global Flags (`src/cli/flags.js`)
116
-
117
- ```typescript
118
- import { parseGlobalFlags } from "../cli/flags.js";
119
-
120
- // Access global flags (--json, --no-color, etc.)
121
- const globalOpts = parseGlobalFlags(process.argv);
122
- ```
123
-
124
- ### Adding New Commands
125
-
126
- See the **[Command Creation Guide](./command-creation-guide.md)** for:
127
-
128
- - Step-by-step command creation
129
- - Templates and examples
130
- - Testing patterns
131
- - Documentation requirements
132
- - Complete checklist
133
-
134
- Quick reference:
135
-
136
- 1. Create `src/commands/myCommand.ts`
137
- 2. Export `registerMyCommandCommand(program: Command)`
138
- 3. Register in `src/cli.ts`
139
- 4. Add tests in `tests/commands/myCommand.spec.ts`
140
- 5. Update this file (`docs/cli.md`) with command reference
141
-
142
- ---
143
-
144
- ## Global Options
145
-
146
- ```bash
147
- lex-pr [options] [command]
148
-
149
- Options:
150
- -V, --version Output the version number
151
- --no-color Disable ANSI color codes in output
152
- --json Enable JSON output mode (implies --no-color)
153
- --log-format <fmt> Log output format: 'json' or 'human' (default: 'human')
154
- -h, --help Display help for command
155
- ```
156
-
157
- ### Output Control Flags
158
-
159
- #### `--no-color`
160
-
161
- Unconditionally disables ANSI escape codes in output, regardless of TTY detection.
162
-
163
- **Use cases:**
164
-
165
- - Force plain text output when piping to tools that don't handle ANSI codes
166
- - Debugging in environments where color codes interfere with output
167
- - CI/CD pipelines where color codes are not needed
168
-
169
- **Example:**
170
-
171
- ```bash
172
- lex-pr --no-color config:inspect
173
- ```
174
-
175
- #### `--json`
176
-
177
- Enables JSON output mode and automatically disables colors. This flag:
178
-
179
- - Forces JSON output to stdout for supported commands
180
- - Disables ANSI color codes (implies `--no-color`)
181
- - Suppresses human-friendly decorations (emojis, tips, progress indicators)
182
- - Uses plain text prefixes in error messages (e.g., `[lex-pr]` instead of ❌)
183
-
184
- **Use cases:**
185
-
186
- - Machine-readable output for automation and scripting
187
- - Clean JSON output for piping to `jq` or other JSON processors
188
- - CI/CD pipelines and automated testing
189
-
190
- **Example:**
191
-
192
- ```bash
193
- lex-pr --json plan > plan.json
194
- ```
195
-
196
- **Note:** The `--json` flag can be used either globally or at the command level:
197
-
198
- ```bash
199
- # Global flag (affects all output)
200
- lex-pr --json plan
201
-
202
- # Command-level flag (some commands support this)
203
- lex-pr plan --json
204
- ```
205
-
206
- ## Configuration Precedence
207
-
208
- Configuration values are resolved in the following order (highest to lowest priority):
209
-
210
- 1. **Command-line flags** (`--out ./custom-dir`)
211
- 2. **Environment variables** (`LEX_PR_OUT_DIR=./custom-dir`)
212
- 3. **Configuration files** (`.smartergpt/config.json`)
213
- 4. **Built-in defaults**
214
-
215
- ### Environment Variables
216
-
217
- | Variable | Description | Default |
218
- | -------------------- | --------------------------------------------- | -------------------- |
219
- | `LEX_PR_OUT_DIR` | Default output directory for artifacts | `.smartergpt/runner` |
220
- | `LEX_PR_MAX_WORKERS` | Maximum parallel gate execution | `1` |
221
- | `LEX_PR_TIMEOUT` | Default gate timeout in seconds | `300` |
222
- | `NO_COLOR` | Disable ANSI color codes when set (any value) | unset |
223
- | `LOG_FORMAT` | Log output format: 'json' or 'human' | `human` |
224
-
225
- ## Commands
226
-
227
- ### `init`
228
-
229
- Initialize lexrunner workspace with interactive setup wizard.
230
-
231
- ```bash
232
- lex-pr init [options]
233
-
234
- Options:
235
- --force Overwrite existing configuration files
236
- --non-interactive Run without prompts (use environment variables)
237
- --github-token <token> GitHub token for authentication
238
- --profile-dir <dir> Profile directory (default: .smartergpt.local)
239
- -h, --help Display help for command
240
- ```
241
-
242
- #### What Gets Created
243
-
244
- The init command creates a complete workspace configuration:
245
-
246
- ```
247
- .smartergpt.local/
248
- ├── profile.yml # Profile metadata (role: local)
249
- ├── intent.md # Project goals and scope
250
- ├── scope.yml # PR discovery rules
251
- ├── deps.yml # Dependency relationships
252
- ├── gates.yml # Quality gates configuration
253
- └── pull-request-template.md # PR template with dependency syntax
254
- ```
255
-
256
- #### Interactive Setup
257
-
258
- When run without `--non-interactive`, the wizard will:
259
-
260
- 1. Detect project type (Node.js, Python, Rust, Go, etc.)
261
- 2. Prompt for GitHub token (optional)
262
- 3. Validate repository access if token provided
263
- 4. Create workspace configuration files
264
- 5. Display next steps
265
-
266
- #### Examples
267
-
268
- ```bash
269
- # Interactive setup with prompts
270
- lex-pr init
271
-
272
- # Non-interactive setup (use environment variables)
273
- export GITHUB_TOKEN=your_token_here
274
- lex-pr init --non-interactive
275
-
276
- # Force overwrite existing configuration
277
- lex-pr init --force
278
-
279
- # Use custom profile directory
280
- lex-pr init --profile-dir .smartergpt.custom
281
-
282
- # Provide GitHub token via CLI
283
- lex-pr init --github-token ghp_your_token_here
284
- ```
285
-
286
- #### Environment Variables
287
-
288
- | Variable | Description | Used When |
289
- | -------------- | ---------------------------- | -------------------- |
290
- | `GITHUB_TOKEN` | GitHub personal access token | Token authentication |
291
- | `GH_TOKEN` | Alternative GitHub token | Token authentication |
292
-
293
- #### Exit Codes
294
-
295
- - `0`: Initialization successful
296
- - `1`: Initialization failed (general error)
297
- - `2`: Write protection error (tried to write to read-only profile)
298
-
299
- #### Profile Directory Selection
300
-
301
- The init command automatically selects the appropriate profile directory:
302
-
303
- 1. If `--profile-dir` is specified, uses that directory
304
- 2. If `.smartergpt` exists (tracked example), uses `.smartergpt.local`
305
- 3. Otherwise, uses `.smartergpt.local` for new setups
306
-
307
- This ensures local development work doesn't overwrite tracked example configurations.
308
-
309
- #### See Also
310
-
311
- - [Quickstart Guide](./quickstart.md) - Complete onboarding workflow
312
- - [Profile Resolution](./profile-resolution.md) - Understanding profile directories
313
- - `lex-pr doctor` - Validate environment after initialization
314
-
315
- ---
316
-
317
- ### `schema validate`
318
-
319
- Validate plan.json files against the schema with enhanced cycle detection and diagnostics.
320
-
321
- ```bash
322
- lex-pr schema validate [options] [file]
323
-
324
- Arguments:
325
- file Path to plan.json file
326
-
327
- Options:
328
- --json Output machine-readable JSON errors
329
- --verbose Show detailed diagnostics (layers, warnings, full dependency graph)
330
- -h, --help Display help for command
331
- ```
332
-
333
- #### Validation Checks
334
-
335
- The validator performs comprehensive checks:
336
-
337
- 1. **Schema validation** - Ensures plan follows correct structure
338
- 2. **Cycle detection** - Identifies circular dependencies with full path details
339
- 3. **Orphan detection** - Warns about items with no dependencies/dependents
340
- 4. **Reference validation** - Ensures all dependencies exist
341
- 5. **Self-dependency detection** - Catches items depending on themselves
342
- 6. **Topology analysis** - Computes merge layers and identifies bottlenecks
343
-
344
- #### Examples
345
-
346
- ```bash
347
- # Basic validation with human-readable output
348
- lex-pr schema validate plan.json
349
-
350
- # Detailed validation with layer information
351
- lex-pr schema validate plan.json --verbose
352
-
353
- # Validate with JSON output for CI
354
- lex-pr schema validate --json plan.json
355
-
356
- # Example output (human-readable):
357
- === Plan Validation Report ===
358
-
359
- ❌ Errors:
360
-
361
- Dependency cycle detected in plan
362
-
363
- Cycle path: feat-a → feat-b → feat-c → feat-a
364
-
365
- Dependency chain:
366
- feat-a depends on feat-b
367
- feat-b depends on feat-c
368
- feat-c depends on feat-a
369
-
370
- Suggestion: Consider removing the dependency from 'feat-c' to 'feat-a' to break the cycle
371
-
372
- ❌ Plan has 1 error(s) that must be fixed
373
-
374
- # Example verbose output:
375
- === Plan Validation Report ===
376
-
377
- Nodes: 6 items
378
- Edges: 4 dependencies
379
-
380
- Layers (topological sort):
381
- Layer 0: feat-a, feat-b, feat-f
382
- Layer 1: feat-c, feat-d
383
- Layer 2: feat-e
384
-
385
- ⚠️ Warnings:
386
-
387
- Item 'feat-f' has no dependencies and no dependents (orphan)
388
- Suggestion: Consider if these items should have dependencies or dependents.
389
-
390
- ✅ Plan is valid and ready for execution
391
- ```
392
-
393
- #### JSON Output Schema
394
-
395
- **Success Response:**
396
-
397
- ```json
398
- {
399
- "valid": true,
400
- "errors": [],
401
- "warnings": [],
402
- "diagnostics": {
403
- "nodes": 5,
404
- "edges": 4,
405
- "layers": [
406
- { "level": 0, "prs": ["feat-a", "feat-b"] },
407
- { "level": 1, "prs": ["feat-c"] }
408
- ],
409
- "orphans": []
410
- }
411
- }
412
- ```
413
-
414
- **Error Response (Cycle):**
415
-
416
- ```json
417
- {
418
- "valid": false,
419
- "errors": [
420
- {
421
- "type": "cycle",
422
- "message": "Dependency cycle detected in plan\n\nCycle path: feat-a → feat-b → feat-a\n\nDependency chain:\n feat-a depends on feat-b\n feat-b depends on feat-a",
423
- "details": {
424
- "cyclePath": ["feat-a", "feat-b", "feat-a"]
425
- },
426
- "suggestion": "Consider removing the dependency from 'feat-b' to 'feat-a' to break the cycle"
427
- }
428
- ],
429
- "warnings": [],
430
- "diagnostics": {
431
- "nodes": 2,
432
- "edges": 2,
433
- "layers": [],
434
- "orphans": []
435
- }
436
- }
437
- ```
438
-
439
- **Warning Response (Orphans):**
440
-
441
- ```json
442
- {
443
- "valid": true,
444
- "errors": [],
445
- "warnings": [
446
- {
447
- "type": "orphan",
448
- "message": "2 items have no dependencies and no dependents (orphans): orphan-1, orphan-2",
449
- "affectedPRs": ["orphan-1", "orphan-2"],
450
- "suggestion": "Consider if these items should have dependencies or dependents. Use labels to mark intentional orphans."
451
- }
452
- ],
453
- "diagnostics": {
454
- "nodes": 4,
455
- "edges": 1,
456
- "layers": [
457
- { "level": 0, "prs": ["feat-a", "orphan-1", "orphan-2"] },
458
- { "level": 1, "prs": ["feat-b"] }
459
- ],
460
- "orphans": ["orphan-1", "orphan-2"]
461
- }
462
- }
463
- ```
464
-
465
- **Error Types:**
466
-
467
- - `cycle` - Circular dependency detected
468
- - `invalid-ref` - Reference to non-existent item
469
- - `self-dependency` - Item depends on itself
470
-
471
- **Warning Types:**
472
-
473
- - `orphan` - Item has no dependencies and no dependents
474
- - `large-layer` - Layer has too many items (potential merge conflicts)
475
-
476
- **Exit Codes:**
477
-
478
- - `0`: Validation successful (may have warnings)
479
- - `1`: Validation failed with errors or system error
480
- - `2`: Validation failed
481
-
482
- ---
483
-
484
- ### `plan`
485
-
486
- Generate merge plan from workspace configuration or GitHub PRs with automatic dependency discovery.
487
-
488
- ```bash
489
- lex-pr plan [options]
490
-
491
- Options:
492
- --out <dir> Output directory for artifacts (default: ".smartergpt/runner")
493
- --json Output canonical plan JSON to stdout only
494
- --dry-run Validate inputs and show what would be written
495
- --from-github Auto-discover PRs from GitHub API with dependency detection
496
- --suggest-deps Generate dependency suggestions from file analysis
497
- --threshold <float> Confidence threshold for suggestions (0.0-1.0, default: 0.3)
498
- --no-suggestions Disable file-based dependency suggestions
499
- --query <query> GitHub search query (e.g., 'is:open label:stack:*')
500
- --labels <labels> Filter PRs by comma-separated labels
501
- --exclude-labels <l> Exclude PRs with labels (comma-separated)
502
- --include-drafts Include draft PRs in the plan
503
- --exclude-prs <numbers> Exclude specific PRs by comma-separated PR numbers
504
- --github-token <token> GitHub API token (or use GITHUB_TOKEN env var)
505
- --owner <owner> GitHub repository owner (auto-detected from git remote)
506
- --repo <repo> GitHub repository name (auto-detected from git remote)
507
- --required-gates <gates> Comma-separated list of required gates (default: lint,typecheck,test)
508
- --max-workers <n> Maximum parallel workers for execution (default: 2)
509
- --target <branch> Target branch for merging PRs (default: repo default branch)
510
- --validate Validate plan after generation (cycles, orphans, refs)
511
- --validate-cycles Enable dependency cycle detection (default: true)
512
- --optimize Optimize plan for parallel execution
513
- --format <type> Output format: json|markdown|dot (default: json)
514
- --output <file> Output file path (alternative to --out, for single file)
515
- -h, --help Display help for command
516
- ```
517
-
518
- #### Plan Generation Modes
519
-
520
- **1. GitHub Auto-Discovery Mode (Recommended)**
521
-
522
- Generate plan from GitHub PRs with automatic dependency detection:
523
-
524
- ```bash
525
- # Basic auto-discovery with dependency parsing
526
- lex-pr plan --from-github
527
-
528
- # With file-based dependency suggestions
529
- lex-pr plan --from-github --suggest-deps --threshold=0.7
530
-
531
- # Filter by labels
532
- lex-pr plan --from-github --labels "ready-to-merge,stack:feature"
533
-
534
- # Exclude certain labels
535
- lex-pr plan --from-github --exclude-labels "wip,draft"
536
- ```
537
-
538
- **What auto-discovery does:**
539
-
540
- 1. Fetches open PRs from GitHub
541
- 2. Parses `Depends-on:` footers from PR descriptions
542
- 3. Analyzes file changes to suggest implicit dependencies (if `--suggest-deps`)
543
- 4. Validates dependency graph (detects cycles, orphans)
544
- 5. Computes merge layers using topological sort
545
- 6. Generates deterministic `plan.json`
546
-
547
- **2. Dependency Suggestions Only**
548
-
549
- Generate file-based dependency suggestions without creating a plan:
550
-
551
- ```bash
552
- # High-confidence suggestions (≥0.7)
553
- lex-pr plan --suggest-deps --threshold=0.7
554
-
555
- # Output as markdown for review
556
- lex-pr plan --suggest-deps --format=markdown > suggestions.md
557
-
558
- # JSON format for automation
559
- lex-pr plan --suggest-deps --format=json | jq '.suggestions'
560
- ```
561
-
562
- **3. Configuration Files Mode (Default)**
563
-
564
- ```bash
565
- # Generate from .smartergpt/ configuration files
566
- lex-pr plan
567
- ```
568
-
569
- #### Dependency Syntax
570
-
571
- The planner recognizes these dependency formats in PR descriptions:
572
-
573
- ```markdown
574
- # Single dependency
575
-
576
- Depends-on: #123
577
-
578
- # Multiple dependencies
579
-
580
- Depends-on: #123, #456, #789
581
-
582
- # Cross-repo references
583
-
584
- Depends-on: owner/repo#123
585
-
586
- # Alternative keywords (aliases)
587
-
588
- Depends: #123
589
- Requires: #456
590
- ```
591
-
592
- **Note:** `Closes`, `Fixes`, and `Resolves` are GitHub keywords for closing issues and are **not** treated as dependencies.
593
-
594
- #### File-Based Heuristics
595
-
596
- When `--suggest-deps` is used, the planner analyzes file changes to suggest dependencies:
597
-
598
- | Heuristic | Confidence Range | Description |
599
- | ----------------------- | ---------------- | -------------------------------- |
600
- | **Shared files** | 0.6 - 1.0 | Both PRs modify the same files |
601
- | **Directory proximity** | 0.3 - 0.8 | PRs work in the same directories |
602
- | **Test overlap** | 0.5 - 0.85 | PRs test the same modules |
603
-
604
- **Threshold guidelines:**
605
-
606
- - `≥0.8`: Very high confidence, almost always valid
607
- - `≥0.7`: High confidence, recommended for hybrid workflow
608
- - `≥0.5`: Medium confidence, requires manual review
609
- - `<0.5`: Low confidence, likely false positive
610
-
611
- #### Examples
612
-
613
- ```bash
614
- # Generate plan with default output directory
615
- lex-pr plan
616
-
617
- # Generate plan to custom directory
618
- lex-pr plan --out ./my-artifacts
619
-
620
- # JSON-only output for piping/processing
621
- lex-pr plan --json
622
-
623
- # Validate inputs without writing files
624
- lex-pr plan --dry-run
625
-
626
- # GitHub mode: Auto-discover and generate plan
627
- lex-pr plan --from-github --github-token $GITHUB_TOKEN
628
-
629
- # Custom policy configuration
630
- lex-pr plan --from-github \
631
- --required-gates "lint,test,security-scan" \
632
- --max-workers 4 \
633
- --target develop
634
-
635
- # Optimize and validate plan
636
- lex-pr plan --from-github --optimize --validate-cycles
637
-
638
- # Search for specific PRs
639
- lex-pr plan --from-github \
640
- --query "is:open label:stack:*" \
641
- --labels "priority-high"
642
- ```
643
-
644
- #### Dependency Validation and Optimization
645
-
646
- The plan command automatically validates dependencies when using `--from-github`:
647
-
648
- - **Cycle Detection**: Detects circular dependencies between PRs (enabled by default with `--validate-cycles` or `--validate`)
649
- - **Orphan Detection**: Warns about PRs with no dependencies/dependents
650
- - **Reference Validation**: Ensures all dependencies exist in the plan
651
- - **Optimization**: Shows parallelization levels with `--optimize` flag
652
-
653
- ```bash
654
- # Full validation (recommended)
655
- lex-pr plan --from-github --validate
656
-
657
- # Show optimization levels and merge layers
658
- lex-pr plan --from-github --optimize
659
-
660
- # Disable cycle detection (not recommended)
661
- lex-pr plan --from-github --validate-cycles=false
662
- ```
663
-
664
- Example output with `--optimize`:
665
-
666
- ```
667
- ✓ Auto-discovered 5 PRs from GitHub
668
- ✓ Parsed dependencies: 3 explicit, 1 implicit
669
- ✓ Dependency validation passed (no cycles detected)
670
- ✓ Plan optimized for parallel execution: 3 layers
671
- Layer 0: PR-100 (ready to merge)
672
- Layer 1: PR-101, PR-102 (after PR-100, parallel)
673
- Layer 2: PR-103, PR-104 (after Layer 1, parallel)
674
- ```
675
-
676
- #### Exit Codes
677
-
678
- - `0`: Plan generated successfully
679
- - `1`: Plan generation failed (general error)
680
- - `2`: Validation failed (cycles, invalid refs, orphans)
681
-
682
- #### See Also
683
-
684
- - **[Diffgraph Planner Guide](./diffgraph-planner.md)** - Complete feature documentation
685
- - **[Troubleshooting](./troubleshooting-planner.md)** - Common errors and solutions
686
- - **[Dependency Parser](./dependency-parser.md)** - Parser documentation
687
- - **[Tutorials](./tutorials/diffgraph-planner/)** - Step-by-step guides
688
- - `lex-pr schema validate` - Validate existing plan
689
- - `lex-pr merge-order` - Review merge layers
690
-
691
- ---
692
-
693
- #### JSON Output Schema (`--json` flag)
694
-
695
- **Success Response:**
696
-
697
- ```json
698
- {
699
- "schemaVersion": "1.0.0",
700
- "target": "main",
701
- "policy": {
702
- "requiredGates": ["string"],
703
- "optionalGates": ["string"],
704
- "maxWorkers": 1,
705
- "retries": {},
706
- "overrides": {},
707
- "blockOn": ["string"],
708
- "mergeRule": {
709
- "type": "strict-required"
710
- }
711
- },
712
- "items": [
713
- {
714
- "name": "string",
715
- "deps": ["string"],
716
- "gates": [
717
- {
718
- "name": "string",
719
- "run": "string",
720
- "cwd": "string",
721
- "env": {},
722
- "runtime": "local|container|ci-service",
723
- "container": {
724
- "image": "string",
725
- "entrypoint": ["string"],
726
- "mounts": [
727
- {
728
- "source": "string",
729
- "target": "string",
730
- "type": "bind|volume"
731
- }
732
- ]
733
- },
734
- "artifacts": ["string"]
735
- }
736
- ]
737
- }
738
- ]
739
- }
740
- ```
741
-
742
- **Deterministic Guarantees:**
743
-
744
- - Keys sorted alphabetically at all levels
745
- - Arrays maintain stable ordering (deps sorted, items by name)
746
- - No runtime timestamps or random values
747
- - Cross-platform identical output
748
-
749
- **Exit Codes:**
750
-
751
- - `0`: Plan generated successfully
752
- - `1`: System error (filesystem, permissions)
753
- - `2`: Configuration validation failed
754
-
755
- ---
756
-
757
- ### `merge-order`
758
-
759
- Compute dependency levels and merge order using Kahn's algorithm.
760
-
761
- ```bash
762
- lex-pr merge-order [options] [file]
763
-
764
- Arguments:
765
- file Path to plan.json file (alternative to --plan)
766
-
767
- Options:
768
- --plan <file> Path to plan.json file
769
- --json Output JSON format
770
- -h, --help Display help for command
771
- ```
772
-
773
- #### Examples
774
-
775
- ```bash
776
- # Human-readable merge order
777
- lex-pr merge-order plan.json
778
-
779
- # JSON output for automation
780
- lex-pr merge-order --json plan.json
781
-
782
- # Using --plan flag
783
- lex-pr merge-order --plan ./configs/plan.json
784
- ```
785
-
786
- #### JSON Output Schema (`--json` flag)
787
-
788
- **Success Response:**
789
-
790
- ```json
791
- {
792
- "levels": [
793
- ["item-a", "item-c"], // Level 0: No dependencies
794
- ["item-b"], // Level 1: Depends on level 0
795
- ["item-d"] // Level 2: Depends on level 1
796
- ],
797
- "totalItems": 4,
798
- "maxParallelism": 2
799
- }
800
- ```
801
-
802
- **Human-Readable Output:**
803
-
804
- ```
805
- Merge Order (3 levels):
806
- Level 0: item-a, item-c
807
- Level 1: item-b
808
- Level 2: item-d
809
-
810
- Total items: 4, Max parallelism: 2
811
- ```
812
-
813
- **Exit Codes:**
814
-
815
- - `0`: Merge order computed successfully
816
- - `1`: System error (file not readable)
817
- - `2`: Dependency cycle or unknown dependency detected
818
-
819
- ---
820
-
821
- ### `orchestrate:predict-conflicts`
822
-
823
- Predict merge conflicts using conflict graphs, Maximal Independent Set (MIS) computation, and git merge-tree simulation.
824
-
825
- ```bash
826
- lex-pr orchestrate:predict-conflicts [options]
827
-
828
- Options:
829
- --prs <numbers> Comma-separated list of PR numbers (e.g., 166,167,168) [required]
830
- --base <branch> Base branch for conflict analysis (default: "main")
831
- --skip-merge-tree Skip git merge-tree simulation
832
- -h, --help Display help for command
833
- ```
834
-
835
- #### Algorithm Overview
836
-
837
- 1. **Conflict Graph**: Build undirected graph where nodes are PRs and edges represent shared files
838
- 2. **MIS Computation**: Use greedy algorithm to find Maximal Independent Set (PRs with no conflicts)
839
- 3. **Merge Simulation**: Run `git merge-tree` to validate predicted conflicts
840
-
841
- **Greedy MIS Algorithm:**
842
-
843
- - Sort nodes by degree (fewest conflicts first), then by PR number
844
- - Greedily select nodes that don't conflict with already selected nodes
845
- - Result: Maximum set of PRs that can merge in parallel
846
-
847
- #### Examples
848
-
849
- ```bash
850
- # Predict conflicts for specific PRs (human-readable)
851
- lex-pr orchestrate:predict-conflicts --prs 166,167,168
852
-
853
- # JSON output for automation
854
- lex-pr --json orchestrate:predict-conflicts --prs 166,167,168
855
-
856
- # Skip merge-tree simulation (faster, file-based analysis only)
857
- lex-pr orchestrate:predict-conflicts --prs 166,167,168 --skip-merge-tree
858
-
859
- # Custom base branch
860
- lex-pr orchestrate:predict-conflicts --prs 100,101,102 --base develop
861
- ```
862
-
863
- #### JSON Output Schema (`--json` flag)
864
-
865
- **Success Response:**
866
-
867
- ```json
868
- {
869
- "analyzedAt": "2025-10-13T02:00:00Z",
870
- "baseBranch": "main",
871
- "conflictGraph": {
872
- "nodes": ["166", "167", "168"],
873
- "edges": [
874
- {
875
- "from": "166",
876
- "to": "167",
877
- "sharedFiles": ["src/cli.ts"]
878
- },
879
- {
880
- "from": "167",
881
- "to": "168",
882
- "sharedFiles": ["src/gates.ts"]
883
- }
884
- ]
885
- },
886
- "misBatches": [
887
- {
888
- "id": "mis-1",
889
- "prs": ["166", "168"],
890
- "reason": "No shared files"
891
- },
892
- {
893
- "id": "mis-2",
894
- "prs": ["167"],
895
- "reason": "Conflicts with #166 and #168"
896
- }
897
- ],
898
- "mergeTreeSimulation": {
899
- "166-168": {
900
- "status": "clean",
901
- "conflicts": []
902
- },
903
- "166-167": {
904
- "status": "conflict",
905
- "conflicts": [
906
- {
907
- "file": "src/cli.ts",
908
- "lines": "125-140",
909
- "type": "both-modified"
910
- }
911
- ]
912
- }
913
- },
914
- "recommendations": {
915
- "safeBatch": ["166", "168"],
916
- "sequential": ["167"]
917
- }
918
- }
919
- ```
920
-
921
- **Human-Readable Output:**
922
-
923
- ```
924
- 🔍 Conflict Analysis
925
- ============================================================
926
-
927
- 📊 Conflict Graph:
928
- - #166 ↔ #167: src/cli.ts
929
- - #167 ↔ #168: src/gates.ts
930
-
931
- 🔀 MIS Batches (safe parallel groups):
932
- - mis-1: [#166, #168]
933
- No shared files
934
- - mis-2: [#167]
935
- Conflicts with #166 and #168
936
-
937
- 🧪 git merge-tree Simulation:
938
- - #166 + #168: ✅ Clean merge
939
- - #166 + #167: ❌ Conflict
940
- ↳ src/cli.ts (both-modified)
941
-
942
- 💡 Recommendations:
943
- ✓ Safe parallel batch: #166, #168
944
- ⚠ Merge sequentially: #167
945
- ```
946
-
947
- **Exit Codes:**
948
-
949
- - `0`: Conflict analysis completed successfully
950
- - `1`: Missing required parameters or system error
951
-
952
- #### Use Cases
953
-
954
- - **Batch Planning**: Determine which PRs can be merged in parallel
955
- - **Conflict Avoidance**: Identify potential conflicts before merging
956
- - **Optimization**: Maximize parallelism in merge pyramid execution
957
- - **CI/CD Integration**: Automate conflict detection in merge workflows
958
-
959
- ---
960
-
961
- ### `plan-review`
962
-
963
- Interactively review and edit a plan with human-in-the-loop validation.
964
-
965
- ```bash
966
- lex-pr plan-review [options] [file]
967
-
968
- Arguments:
969
- file Path to plan.json file (alternative to --plan)
970
-
971
- Options:
972
- --plan <file> Path to plan.json file
973
- --non-interactive Non-interactive mode (auto-approve)
974
- --profile-dir <dir> Profile directory for history tracking
975
- --save-history Save plan versions to history
976
- --output <file> Output file for approved/modified plan
977
- -h, --help Display help for command
978
- ```
979
-
980
- #### Features
981
-
982
- - **Interactive Review**: View plan summary, dependency graph, and merge order
983
- - **Plan Editing**: Add/remove items, modify dependencies, change target branch
984
- - **Validation**: Automatic validation of dependencies and cycles during editing
985
- - **Approval Workflow**: Approve or reject plans with optional reason
986
- - **History Tracking**: Save plan versions with metadata for audit trail
987
- - **Diff View**: See changes made during interactive session
988
-
989
- #### Examples
990
-
991
- ```bash
992
- # Interactive review with prompts
993
- lex-pr plan-review plan.json
994
-
995
- # Auto-approve in non-interactive mode
996
- lex-pr plan-review plan.json --non-interactive
997
-
998
- # Review and save to new file
999
- lex-pr plan-review plan.json --output approved-plan.json
1000
-
1001
- # Review with history tracking
1002
- lex-pr plan-review plan.json --save-history --profile-dir .smartergpt.local
1003
- ```
1004
-
1005
- #### Interactive Options
1006
-
1007
- When running in interactive mode, you'll see:
1008
-
1009
- 1. **Plan Summary**: Items count, target branch, dependencies overview
1010
- 2. **Dependency Graph**: ASCII visualization of item dependencies
1011
- 3. **Merge Order**: Computed execution levels
1012
-
1013
- Then you can choose:
1014
-
1015
- - `[a]` Approve plan - Accept the plan as-is
1016
- - `[r]` Reject plan - Reject with optional reason
1017
- - `[e]` Edit plan - Interactively modify the plan
1018
- - `[v]` View plan details - See full JSON
1019
- - `[d]` Show diff - Compare original vs modified
1020
- - `[q]` Quit without saving
1021
-
1022
- #### Edit Operations
1023
-
1024
- When editing, you can:
1025
-
1026
- - Add new items with dependencies
1027
- - Remove items (validated against dependents)
1028
- - Modify item dependencies (cycle detection)
1029
- - Change target branch
1030
- - Gates editing (planned for future release)
1031
-
1032
- #### Exit Codes
1033
-
1034
- - `0`: Plan approved
1035
- - `1`: Plan rejected or operation failed
1036
-
1037
- ---
1038
-
1039
- ### `plan-diff`
1040
-
1041
- Compare two plans and show differences.
1042
-
1043
- ```bash
1044
- lex-pr plan-diff [options] <plan1> <plan2>
1045
-
1046
- Arguments:
1047
- plan1 First plan file
1048
- plan2 Second plan file
1049
-
1050
- Options:
1051
- --json Output JSON format
1052
- -h, --help Display help for command
1053
- ```
1054
-
1055
- #### Examples
1056
-
1057
- ```bash
1058
- # Human-readable diff
1059
- lex-pr plan-diff plan-v1.json plan-v2.json
1060
-
1061
- # JSON output for automation
1062
- lex-pr plan-diff plan-v1.json plan-v2.json --json
1063
- ```
1064
-
1065
- #### Human-Readable Output
1066
-
1067
- ```
1068
- 📊 Plan Comparison
1069
-
1070
- Plan 1: plan-v1.json
1071
- Plan 2: plan-v2.json
1072
-
1073
- Target Branch: main → develop
1074
-
1075
- Added Items:
1076
- + feature-d
1077
- deps: feature-b
1078
- gates: 2
1079
-
1080
- Removed Items:
1081
- - feature-c
1082
-
1083
- Modified Items:
1084
- ~ feature-b
1085
- deps: [feature-a] → [feature-a, feature-x]
1086
- ```
1087
-
1088
- #### JSON Output Schema
1089
-
1090
- ```json
1091
- {
1092
- "targetChanged": true,
1093
- "originalTarget": "main",
1094
- "modifiedTarget": "develop",
1095
- "addedItems": [
1096
- {
1097
- "name": "feature-d",
1098
- "deps": ["feature-b"],
1099
- "gates": []
1100
- }
1101
- ],
1102
- "removedItems": [
1103
- {
1104
- "name": "feature-c",
1105
- "deps": ["feature-a"],
1106
- "gates": []
1107
- }
1108
- ],
1109
- "modifiedItems": [
1110
- {
1111
- "name": "feature-b",
1112
- "originalDeps": ["feature-a"],
1113
- "modifiedDeps": ["feature-a", "feature-x"],
1114
- "originalGatesCount": 1,
1115
- "modifiedGatesCount": 2
1116
- }
1117
- ],
1118
- "hasChanges": true
1119
- }
1120
- ```
1121
-
1122
- #### Exit Codes
1123
-
1124
- - `0`: No changes detected (plans are identical)
1125
- - `1`: Changes detected or comparison successful
1126
-
1127
- ---
1128
-
1129
- ### `execute`
1130
-
1131
- Execute plan with policy-aware gate running and status tracking.
1132
-
1133
- ```bash
1134
- lex-pr execute [options] [file]
1135
-
1136
- Arguments:
1137
- file Path to plan.json file (alternative to --plan)
1138
-
1139
- Options:
1140
- --plan <file> Path to plan.json file
1141
- --artifact-dir <dir> Output directory for artifacts (default: "./artifacts")
1142
- --timeout <ms> Gate timeout in milliseconds (default: "30000")
1143
- --dry-run Validate plan and show execution order without running gates
1144
- --json Output results in JSON format
1145
- --status-table Generate status table for PR comments
1146
- --max-level <level> Maximum autopilot level (0-4) (default: "0")
1147
- --open-pr Open pull requests for integration branches (Level 3+)
1148
- --close-superseded Close superseded PRs after integration (Level 4)
1149
- --comment-template <path> Path to PR comment template (Level 2+)
1150
- --branch-prefix <prefix> Prefix for integration branch names (default: "integration/")
1151
- -h, --help Display help for command
1152
- ```
1153
-
1154
- > **📖 Autopilot Levels**: See [Autopilot Levels](./autopilot-levels.md) for details on automation levels 0-4.
1155
-
1156
- #### Examples
1157
-
1158
- ```bash
1159
- # Execute entire plan
1160
- lex-pr execute plan.json
1161
-
1162
- # Execute specific item only
1163
- lex-pr execute --only-item item-a plan.json
1164
-
1165
- # JSON output for monitoring
1166
- lex-pr execute --json plan.json
1167
-
1168
- # Execute plan with vulnerability scanning
1169
- lex-pr execute plan-with-vuln.json
1170
- ```
1171
-
1172
- #### Built-in Gates
1173
-
1174
- ##### Vulnerability Gate (`vuln`)
1175
-
1176
- The `vuln` gate is a special built-in gate that scans for security vulnerabilities using artifact-based detection:
1177
-
1178
- - **Artifact Detection**: Automatically looks for `scan-results.sarif` (SARIF 2.1.0 format) or `npm-audit.json` in the item's artifact directory
1179
- - **Policy Enforcement**: Applies thresholds from `plan.policy.security`
1180
- - **Deterministic Output**: Provides consistent, structured vulnerability counts
1181
-
1182
- **Policy Configuration:**
1183
-
1184
- ```json
1185
- {
1186
- "policy": {
1187
- "requiredGates": ["vuln"],
1188
- "security": {
1189
- "blockCritical": true,
1190
- "blockHigh": true,
1191
- "maxMedium": 5,
1192
- "maxLow": 10
1193
- }
1194
- }
1195
- }
1196
- ```
1197
-
1198
- **Example Gate:**
1199
-
1200
- ```json
1201
- {
1202
- "gates": [
1203
- {
1204
- "name": "vuln",
1205
- "run": "trivy fs --format sarif --output scan-results.sarif ."
1206
- }
1207
- ]
1208
- }
1209
- ```
1210
-
1211
- **Supported Scanners:**
1212
-
1213
- - Trivy: `trivy fs --format sarif`
1214
- - Snyk: `snyk test --sarif`
1215
- - CodeQL: `codeql database analyze --format=sarif-latest`
1216
- - npm audit: `npm audit --json > npm-audit.json`
1217
-
1218
- See [Gate Report Examples](./gate-report-examples.md#vulnerability-gate-vuln) for detailed output examples.
1219
-
1220
- #### JSON Output Schema (`--json` flag)
1221
-
1222
- **Success Response:**
1223
-
1224
- ```json
1225
- {
1226
- "executionId": "string", // Unique execution identifier
1227
- "startedAt": "2024-01-15T10:30:00Z",
1228
- "completedAt": "2024-01-15T10:35:00Z",
1229
- "status": "completed|failed|running",
1230
- "totalItems": 4,
1231
- "completedItems": 4,
1232
- "failedItems": 0,
1233
- "items": [
1234
- {
1235
- "name": "item-a",
1236
- "status": "pass|fail|blocked|skipped|retrying",
1237
- "gates": [
1238
- {
1239
- "gate": "test",
1240
- "status": "pass|fail|blocked|skipped|retrying",
1241
- "exitCode": 0,
1242
- "duration": 1500, // milliseconds
1243
- "stdout": "string",
1244
- "stderr": "string",
1245
- "artifacts": ["coverage.json"],
1246
- "attempts": 1,
1247
- "lastAttempt": "2024-01-15T10:32:00Z"
1248
- }
1249
- ],
1250
- "blockedBy": [], // Items that blocked this one
1251
- "eligibleForMerge": true
1252
- }
1253
- ]
1254
- }
1255
- ```
1256
-
1257
- **Exit Codes:**
1258
-
1259
- - `0`: All gates passed successfully
1260
- - `1`: System error during execution
1261
- - `2`: One or more gates failed
1262
-
1263
- ---
1264
-
1265
- ### `merge`
1266
-
1267
- Execute merge pyramid with git operations. Supports dry-run preview, conflict detection, and resumable execution.
1268
-
1269
- ```bash
1270
- lex-pr merge [options]
1271
-
1272
- Options:
1273
- --plan <file> Path to plan.json file (default: "plan.json")
1274
- --dry-run Show what would be merged without executing (default: true)
1275
- --execute Actually perform merge operations
1276
- --resume [runId] Resume execution from weave-lock.json (optional: specific run ID)
1277
- --cleanup Clean up integration branches after execution
1278
- --force Force execution even if same lock hash exists
1279
- --json Output JSON format
1280
- --batch Enable batch mode for multiple items
1281
- --filter <query> Filter items using query language
1282
- --levels <levels> Comma-separated list of levels to merge
1283
- --items <items> Comma-separated list of items to merge
1284
- --max-level <level> Maximum autopilot level (0-4) (default: "0")
1285
- --open-pr Open pull requests for integration branches (Level 3+)
1286
- --close-superseded Close superseded PRs after integration (Level 4)
1287
- --comment-template <path> Path to PR comment template (Level 2+)
1288
- --branch-prefix <prefix> Prefix for integration branch names (default: "integration/")
1289
- --skip-preflight Skip preflight conflict detection in dry-run mode
1290
- --fail-on-preflight-conflict Exit with error if preflight conflict detection finds conflicts
1291
- --track-turncost Track Turn Cost metrics during execution (coordination overhead)
1292
- -h, --help Display help for command
1293
- ```
1294
-
1295
- > **📖 Quick Start**: See [Merge-Weave Quickstart](./merge-weave-quickstart.md) for an end-to-end walkthrough with examples.
1296
- >
1297
- > **📖 Autopilot Levels**: See [Autopilot Levels](./autopilot-levels.md) for details on automation levels 0-4.
1298
-
1299
- #### Basic Examples
1300
-
1301
- ```bash
1302
- # Dry-run: preview merge operations (default)
1303
- lex-pr merge
1304
-
1305
- # Dry-run with explicit flag
1306
- lex-pr merge --plan ./plan.json --dry-run --json
1307
-
1308
- # Execute merge pyramid
1309
- lex-pr merge --execute
1310
-
1311
- # Execute and clean up integration branches
1312
- lex-pr merge --execute --cleanup
1313
-
1314
- # Resume from previous execution
1315
- lex-pr merge --resume
1316
-
1317
- # Force execution even if already executed
1318
- lex-pr merge --execute --force
1319
- ```
1320
-
1321
- #### Batch Operations
1322
-
1323
- ```bash
1324
- # Merge specific items only
1325
- lex-pr merge --batch --items "pr-123,pr-456" --execute
1326
-
1327
- # Merge specific dependency levels
1328
- lex-pr merge --batch --levels "1,2" --execute
1329
-
1330
- # Merge items matching a query
1331
- lex-pr merge --batch --filter "level eq 1" --execute
1332
- ```
1333
-
1334
- #### Conflict Detection
1335
-
1336
- ```bash
1337
- # Skip preflight conflict detection
1338
- lex-pr merge --skip-preflight
1339
-
1340
- # Fail if conflicts detected in dry-run
1341
- lex-pr merge --fail-on-preflight-conflict
1342
-
1343
- # Execute even if conflicts detected
1344
- lex-pr merge --execute # Will pause on conflicts for manual resolution
1345
- ```
1346
-
1347
- #### State Management
1348
-
1349
- The merge command uses a lock file (`weave-lock.json`) for idempotency and resumability:
1350
-
1351
- - **Lock Hash**: Computed from `plan.json` + PR head commits
1352
- - **Idempotency**: Duplicate runs with same lock hash are skipped (use `--force` to override)
1353
- - **Resume**: Failed executions can be resumed with `--resume`
1354
-
1355
- **Lock File Example:**
1356
-
1357
- ```json
1358
- {
1359
- "lockHash": "abc123de",
1360
- "planHash": "def456gh",
1361
- "prHeads": [
1362
- { "name": "feature/auth", "sha": "a1b2c3d4" },
1363
- { "name": "feature/api", "sha": "e5f6g7h8" }
1364
- ],
1365
- "timestamp": "2024-12-13T02:00:00Z",
1366
- "status": "completed"
1367
- }
1368
- ```
1369
-
1370
- #### Preflight Conflict Detection
1371
-
1372
- Enabled by default in dry-run mode. Uses `git merge-tree` to simulate merges without modifying the working tree.
1373
-
1374
- **Benefits:**
1375
-
1376
- - Detects conflicts early before actual merge execution
1377
- - No working tree modifications
1378
- - Fast simulation of merge operations
1379
-
1380
- **Example Dry-Run Output with Conflicts:**
1381
-
1382
- ```json
1383
- {
1384
- "mode": "dry-run",
1385
- "lockHash": "abc123de",
1386
- "preflight": {
1387
- "enabled": true,
1388
- "conflictsDetected": 2,
1389
- "items": [
1390
- {
1391
- "id": "feature-ui",
1392
- "branch": "feature/ui",
1393
- "conflicts": ["src/components/Header.tsx", "src/styles/main.css"]
1394
- }
1395
- ]
1396
- },
1397
- "warnings": ["feature-ui has 2 potential conflicts. Review and resolve before executing."]
1398
- }
1399
- ```
1400
-
1401
- #### Turn Cost Tracking
1402
-
1403
- Track coordination overhead during merge-weave operations:
1404
-
1405
- ```bash
1406
- lex-pr merge --execute --track-turncost
1407
- ```
1408
-
1409
- **Components:**
1410
-
1411
- - **Latency (L)**: Total execution time
1412
- - **Renegotiation (R)**: Conflicts requiring manual resolution
1413
- - **Token Bloat (T)**: Token usage overhead (future)
1414
- - **Attention (A)**: Context switches during execution
1415
-
1416
- **Weighted Score**: `λL + γC + ρR + τT + αA`
1417
-
1418
- See [Governance Metrics](./governance-metrics.md) for details on Turn Cost calculation.
1419
-
1420
- #### Exit Codes
1421
-
1422
- - `0`: Success (merge completed or dry-run successful)
1423
- - `1`: Merge failed or conflicts detected (with `--fail-on-preflight-conflict`)
1424
- - `2`: Configuration or validation error
1425
-
1426
- #### See Also
1427
-
1428
- - [Merge-Weave Quickstart](./merge-weave-quickstart.md) - Complete walkthrough with troubleshooting
1429
- - [Merge-Weave State Machine](./merge-weave-state-machine.md) - Execution state transitions
1430
- - [Advanced CLI Features](./advanced-cli.md) - Advanced merge-weave options
1431
- - [Autopilot Levels](./autopilot-levels.md) - Automated PR creation and management
1432
-
1433
- ---
1434
-
1435
- ### `status`
1436
-
1437
- Show current execution status and merge eligibility.
1438
-
1439
- ```bash
1440
- lex-pr status [options] [file]
1441
-
1442
- Arguments:
1443
- file Path to plan.json file (alternative to --plan)
1444
-
1445
- Options:
1446
- --plan <file> Path to plan.json file
1447
- --json Output JSON format
1448
- --state-dir <dir> Directory containing execution state (default: ".smartergpt/runner")
1449
- -h, --help Display help for command
1450
- ```
1451
-
1452
- #### Examples
1453
-
1454
- ```bash
1455
- # Show human-readable status
1456
- lex-pr status plan.json
1457
-
1458
- # JSON status for dashboards
1459
- lex-pr status --json plan.json
1460
- ```
1461
-
1462
- #### JSON Output Schema (`--json` flag)
1463
-
1464
- **Success Response:**
1465
-
1466
- ```json
1467
- {
1468
- "executionStatus": "not_started|running|completed|failed",
1469
- "lastUpdated": "2024-01-15T10:35:00Z",
1470
- "summary": {
1471
- "totalItems": 4,
1472
- "passedItems": 2,
1473
- "failedItems": 1,
1474
- "blockedItems": 1,
1475
- "eligibleForMerge": 2
1476
- },
1477
- "items": [
1478
- {
1479
- "name": "item-a",
1480
- "status": "pass",
1481
- "eligibleForMerge": true,
1482
- "gatesSummary": {
1483
- "total": 2,
1484
- "passed": 2,
1485
- "failed": 0
1486
- }
1487
- }
1488
- ]
1489
- }
1490
- ```
1491
-
1492
- **Exit Codes:**
1493
-
1494
- - `0`: Status retrieved successfully
1495
- - `1`: System error (state files not readable)
1496
- - `2`: No execution state found
1497
-
1498
- ---
1499
-
1500
- ### `report`
1501
-
1502
- Aggregate gate reports from directory of JSON files.
1503
-
1504
- ```bash
1505
- lex-pr report [options] <dir>
1506
-
1507
- Arguments:
1508
- dir Directory containing gate report JSON files
1509
-
1510
- Options:
1511
- --out <format> Output format: json|md (default: "json")
1512
- --validate Validate reports against schema before aggregating
1513
- -h, --help Display help for command
1514
- ```
1515
-
1516
- #### Examples
1517
-
1518
- ```bash
1519
- # JSON summary of gate results
1520
- lex-pr report ./gate-results
1521
-
1522
- # Markdown report for humans
1523
- lex-pr report --out md ./gate-results
1524
-
1525
- # Validate reports first
1526
- lex-pr report --validate ./gate-results
1527
- ```
1528
-
1529
- #### JSON Output Schema (`--out json`)
1530
-
1531
- **Success Response:**
1532
-
1533
- ```json
1534
- {
1535
- "summary": {
1536
- "totalReports": 8,
1537
- "totalItems": 4,
1538
- "totalGates": 12,
1539
- "passedGates": 10,
1540
- "failedGates": 2,
1541
- "allGreen": false
1542
- },
1543
- "items": [
1544
- {
1545
- "name": "item-a",
1546
- "gates": [
1547
- {
1548
- "name": "test",
1549
- "status": "pass",
1550
- "duration_ms": 1500,
1551
- "started_at": "2024-01-15T10:30:00Z"
1552
- }
1553
- ],
1554
- "summary": {
1555
- "totalGates": 3,
1556
- "passedGates": 3,
1557
- "failedGates": 0
1558
- }
1559
- }
1560
- ]
1561
- }
1562
- ```
1563
-
1564
- **Markdown Output (`--out md`):**
1565
-
1566
- ```markdown
1567
- # Gate Execution Report
1568
-
1569
- ## Summary
1570
-
1571
- - **Total Items**: 4
1572
- - **Total Gates**: 12
1573
- - **Passed**: 10 ✅
1574
- - **Failed**: 2 ❌
1575
- - **Overall Status**: ❌ FAILED
1576
-
1577
- ## Item Results
1578
-
1579
- ### item-a ✅
1580
-
1581
- - test: ✅ PASS (1.5s)
1582
- - lint: ✅ PASS (0.8s)
1583
- - build: ✅ PASS (12.3s)
1584
- ```
1585
-
1586
- **Exit Codes:**
1587
-
1588
- - `0`: All gates passed (allGreen: true)
1589
- - `1`: System error (directory not readable, invalid reports)
1590
- - `2`: One or more gates failed
1591
-
1592
- ---
1593
-
1594
- ### `doctor`
1595
-
1596
- Environment and configuration sanity checks.
1597
-
1598
- ```bash
1599
- lex-pr doctor [options]
1600
-
1601
- Options:
1602
- --json Output JSON format
1603
- -h, --help Display help for command
1604
- ```
1605
-
1606
- #### Examples
1607
-
1608
- ```bash
1609
- # Human-readable environment check
1610
- lex-pr doctor
1611
-
1612
- # JSON output for automation
1613
- lex-pr doctor --json
1614
- ```
1615
-
1616
- #### JSON Output Schema (`--json` flag)
1617
-
1618
- **Success Response:**
1619
-
1620
- ```json
1621
- {
1622
- "status": "healthy|warning|error",
1623
- "timestamp": "2024-01-15T10:30:00Z",
1624
- "checks": [
1625
- {
1626
- "name": "node_version",
1627
- "status": "pass|warn|fail",
1628
- "message": "Node.js 20.10.0 (OK)",
1629
- "expected": ">=18.0.0",
1630
- "actual": "20.10.0"
1631
- },
1632
- {
1633
- "name": "config_files",
1634
- "status": "pass",
1635
- "message": "All configuration files found",
1636
- "details": [".smartergpt/intent.md: ✓", ".smartergpt/scope.yml: ✓"]
1637
- }
1638
- ],
1639
- "summary": {
1640
- "totalChecks": 5,
1641
- "passed": 4,
1642
- "warnings": 1,
1643
- "failures": 0
1644
- }
1645
- }
1646
- ```
1647
-
1648
- **Exit Codes:**
1649
-
1650
- - `0`: All checks passed or warnings only
1651
- - `1`: System error during checks
1652
- - `2`: One or more critical checks failed
1653
-
1654
- ## Deterministic Output Requirements
1655
-
1656
- All CLI commands with `--json` output must guarantee:
1657
-
1658
- 1. **Stable key ordering**: All JSON objects have keys sorted alphabetically
1659
- 2. **Consistent formatting**: Use 2-space indentation, no trailing whitespace
1660
- 3. **Reproducible timestamps**: Avoid runtime timestamps except where semantically required
1661
- 4. **Sorted arrays**: Dependencies, items, errors sorted by name/path
1662
- 5. **Cross-platform consistency**: Same inputs produce identical outputs on Windows/macOS/Linux
1663
-
1664
- ### Verification
1665
-
1666
- ```bash
1667
- # Determinism check - should be byte-identical
1668
- npm run build && npm run format
1669
- git diff --exit-code # Must be clean
1670
-
1671
- # Cross-platform verification
1672
- lex-pr plan --json > output1.json
1673
- lex-pr plan --json > output2.json
1674
- cmp output1.json output2.json # Should be identical
1675
- ```
1676
-
1677
- ---
1678
-
1679
- ## CLI Conventions
1680
-
1681
- This section documents internal patterns for CLI development. Follow these conventions to ensure consistent behavior across all commands.
1682
-
1683
- ### Exit Handling
1684
-
1685
- **Core Principle**: Never call `process.exit()` directly. Use `throwExit()` or throw `CLIExitSignal` instead.
1686
-
1687
- #### The CLIExitSignal Pattern
1688
-
1689
- The CLI uses a custom error class for all exits:
1690
-
1691
- ```typescript
1692
- class CLIExitSignal extends Error {
1693
- exitCode: number;
1694
-
1695
- constructor(code: number, message?: string) {
1696
- super(message ?? `CLI exited with code ${code}`);
1697
- this.exitCode = code;
1698
- }
1699
- }
1700
-
1701
- const throwExit = (code: number): never => {
1702
- throw new CLIExitSignal(code);
1703
- };
1704
- ```
1705
-
1706
- **Why**: This approach allows:
1707
-
1708
- - Centralized exit handling in the main error handler
1709
- - Proper cleanup of resources before exit
1710
- - Testability (errors can be caught in tests)
1711
- - Consistent error formatting
1712
-
1713
- #### Commander Exit Override
1714
-
1715
- All Commander exits are intercepted centrally:
1716
-
1717
- ```typescript
1718
- program.exitOverride((err: CommanderError) => {
1719
- // Help/version often exit with code 0; normalize through CLIExitSignal
1720
- throw new CLIExitSignal(err.exitCode ?? 1, err.message);
1721
- });
1722
- ```
1723
-
1724
- **Why**: Commander's default exit behavior calls `process.exit()` directly. Overriding ensures:
1725
-
1726
- - All exits go through the same path
1727
- - Help/version commands work correctly with exit code 0
1728
- - No bypassing of error handlers
1729
-
1730
- #### Exit Code Discipline
1731
-
1732
- Use the standard exit codes consistently:
1733
-
1734
- ```typescript
1735
- throwExit(0); // Success
1736
- throwExit(1); // System/infrastructure errors
1737
- throwExit(2); // User/validation errors
1738
- ```
1739
-
1740
- **Examples**:
1741
-
1742
- ✅ **Correct**:
1743
-
1744
- ```typescript
1745
- try {
1746
- const plan = loadPlan(planPath);
1747
- // ... process plan
1748
- throwExit(0);
1749
- } catch (e) {
1750
- if (e instanceof SchemaValidationError) {
1751
- console.error(`Validation failed: ${e.message}`);
1752
- throwExit(2); // User can fix this
1753
- }
1754
- console.error(`Unexpected error: ${e.message}`);
1755
- throwExit(1); // System error
1756
- }
1757
- ```
1758
-
1759
- ❌ **Incorrect**:
1760
-
1761
- ```typescript
1762
- // DON'T: Direct process.exit
1763
- process.exit(1);
1764
-
1765
- // DON'T: Throw generic errors for exit
1766
- throw new Error("exit");
1767
-
1768
- // DON'T: Return exit codes
1769
- return 1;
1770
- ```
1771
-
1772
- ### JSON Purity
1773
-
1774
- **Core Principle**: Keep stdout clean for JSON output. All diagnostics, progress messages, and errors go to stderr.
1775
-
1776
- #### Output Stream Configuration
1777
-
1778
- Configure Commander to use explicit streams:
1779
-
1780
- ```typescript
1781
- program.configureOutput({
1782
- writeOut: (str) => process.stdout.write(str),
1783
- writeErr: (str) => process.stderr.write(str),
1784
- });
1785
- ```
1786
-
1787
- **Why**: This ensures:
1788
-
1789
- - Help/version output goes to stderr (Commander default)
1790
- - stdout remains pure for JSON or data output
1791
- - Pipeable commands work correctly
1792
-
1793
- #### JSON Mode Discipline
1794
-
1795
- Commands with `--json` flag must follow strict rules:
1796
-
1797
- ```typescript
1798
- let jsonModeActive = false;
1799
-
1800
- command.action(async (opts) => {
1801
- const previousJsonMode = jsonModeActive;
1802
- jsonModeActive = !!opts.json;
1803
-
1804
- try {
1805
- if (opts.json) {
1806
- // ONLY write JSON to stdout, nothing else
1807
- process.stdout.write(canonicalJSONStringify(result));
1808
- return;
1809
- }
1810
-
1811
- // Human-readable output
1812
- console.log("✓ Success!");
1813
- console.log(summary);
1814
- } finally {
1815
- jsonModeActive = previousJsonMode;
1816
- }
1817
- });
1818
- ```
1819
-
1820
- **Rules for JSON mode**:
1821
-
1822
- 1. **No console.log** in JSON mode - use `process.stdout.write()` directly
1823
- 2. **No progress messages** - suppress all diagnostics in JSON mode
1824
- 3. **No emojis or formatting** - JSON only
1825
- 4. **Always use canonicalJSONStringify** - ensures deterministic output
1826
-
1827
- **Examples**:
1828
-
1829
- ✅ **Correct**:
1830
-
1831
- ```typescript
1832
- if (opts.json) {
1833
- // Pure JSON to stdout
1834
- process.stdout.write(canonicalJSONStringify({ status: "ok", data }));
1835
- return;
1836
- }
1837
-
1838
- // Human mode: rich output to stdout/stderr
1839
- console.log("✓ Operation complete");
1840
- console.error("ℹ️ Note: Some items were skipped");
1841
- ```
1842
-
1843
- ❌ **Incorrect**:
1844
-
1845
- ```typescript
1846
- if (opts.json) {
1847
- console.log("Processing..."); // DON'T: breaks JSON purity
1848
- console.log(JSON.stringify(data)); // DON'T: use canonicalJSONStringify
1849
- console.error(JSON.stringify(error)); // DON'T: errors to stderr, not JSON mixed in
1850
- }
1851
- ```
1852
-
1853
- #### Diagnostic Output
1854
-
1855
- Even in normal mode, separate data from diagnostics:
1856
-
1857
- ```typescript
1858
- // Diagnostics and progress → stderr
1859
- console.error("🔍 Analyzing plan...");
1860
- console.error(`Found ${items.length} items`);
1861
-
1862
- // Final output → stdout
1863
- console.log(canonicalJSONStringify(result));
1864
- ```
1865
-
1866
- **Why**: Allows users to pipe output while still seeing progress:
1867
-
1868
- ```bash
1869
- lex-pr plan --json > plan.json # Progress visible, JSON piped
1870
- ```
1871
-
1872
- ### Output Modes
1873
-
1874
- #### Canonical JSON Output
1875
-
1876
- Always use `canonicalJSONStringify()` for JSON output:
1877
-
1878
- ```typescript
1879
- import { canonicalJSONStringify } from "./util/canonicalJson.js";
1880
-
1881
- // Automatically includes trailing newline
1882
- process.stdout.write(canonicalJSONStringify(data));
1883
- ```
1884
-
1885
- **Note**: Import path shown is from `src/` directory. Adjust relative path based on your file location. Use `.js` extension in imports even for TypeScript source files (required for ES modules - TypeScript doesn't rewrite extensions).
1886
-
1887
- **Why**: Ensures deterministic output:
1888
-
1889
- - Keys sorted alphabetically at all levels
1890
- - Consistent 2-space indentation
1891
- - Always includes trailing newline
1892
- - Same output every time (no timestamps, no random ordering)
1893
-
1894
- #### Human-Readable Output
1895
-
1896
- For human output, use rich formatting:
1897
-
1898
- ```typescript
1899
- console.log("\n✓ Plan generated successfully\n");
1900
- console.log(`📁 Output: ${planPath}`);
1901
- console.log(`📊 Items: ${items.length}`);
1902
- console.log("");
1903
- console.log(generatePlanSummary(plan));
1904
- ```
1905
-
1906
- **Guidelines**:
1907
-
1908
- - Use emojis for visual clarity
1909
- - Include spacing for readability
1910
- - Provide actionable next steps
1911
- - Use colors (via chalk) sparingly
1912
-
1913
- ### Error Handling Patterns
1914
-
1915
- #### The exitWith() Helper
1916
-
1917
- Use the `exitWith()` helper for consistent error handling:
1918
-
1919
- ```typescript
1920
- function exitWith(e: unknown, schemaCode = "ESCHEMA") {
1921
- // Let CLIExitSignal propagate - don't treat it as an error
1922
- if (e instanceof CLIExitSignal) {
1923
- throw e;
1924
- }
1925
-
1926
- const err: any = e;
1927
-
1928
- // Schema-specific error handling
1929
- if (err?.code === schemaCode && Array.isArray(err.issues)) {
1930
- console.log(JSON.stringify({ errors: err.issues }, null, 2));
1931
- console.error(err.message);
1932
- throwExit(2);
1933
- }
1934
-
1935
- // Handle known validation errors (exit 2)
1936
- if (
1937
- e instanceof SchemaValidationError ||
1938
- e instanceof CycleError ||
1939
- e instanceof UnknownDependencyError ||
1940
- e instanceof WriteProtectionError ||
1941
- e instanceof AutopilotConfigError
1942
- ) {
1943
- console.error(`\n❌ Error: ${err.message}\n`);
1944
-
1945
- // Add contextual help based on error type
1946
- // e.g., for WriteProtectionError: suggest using local profile
1947
- // e.g., for CycleError: suggest checking dependency declarations
1948
-
1949
- throwExit(2);
1950
- }
1951
-
1952
- // Handle system errors (exit 1)
1953
- console.error(`\n❌ Unexpected error: ${err.message}\n`);
1954
- throwExit(1);
1955
- }
1956
- ```
1957
-
1958
- **Note**: Simplified example. See `src/cli.ts` for the full implementation with contextual error messages.
1959
-
1960
- **Usage**:
1961
-
1962
- ```typescript
1963
- try {
1964
- const plan = await generatePlan();
1965
- process.stdout.write(canonicalJSONStringify(plan));
1966
- } catch (error) {
1967
- exitWith(error);
1968
- }
1969
- ```
1970
-
1971
- #### Error Context
1972
-
1973
- Provide helpful context in error messages:
1974
-
1975
- ```typescript
1976
- if (e instanceof WriteProtectionError) {
1977
- console.error(`\n❌ Error: ${e.message}\n`);
1978
- console.error("💡 Tip: Use a local profile directory for development:");
1979
- console.error(" lex-pr init --profile-dir .smartergpt.local\n");
1980
- throwExit(2);
1981
- }
1982
- ```
1983
-
1984
- ### Testing CLI Commands
1985
-
1986
- Write tests that verify exit behavior:
1987
-
1988
- ```typescript
1989
- import { describe, it, expect } from "vitest";
1990
- import { CLIExitSignal } from "../src/cli.js";
1991
-
1992
- describe("CLI exit codes", () => {
1993
- it("should throw CLIExitSignal on validation error", () => {
1994
- // Test that validation errors throw CLIExitSignal with code 2
1995
- expect(() => {
1996
- throw new CLIExitSignal(2, "Validation failed");
1997
- }).toThrow(CLIExitSignal);
1998
- });
1999
-
2000
- it("should have correct exit code in signal", () => {
2001
- const signal = new CLIExitSignal(2, "Validation error");
2002
- expect(signal.exitCode).toBe(2);
2003
- });
2004
- });
2005
- ```
2006
-
2007
- **Note**: Testing the full CLI requires mocking process.exit or using child processes. The above shows testing the CLIExitSignal class itself.
2008
-
2009
- ### Summary
2010
-
2011
- **Key Takeaways**:
2012
-
2013
- 1. **Exit Discipline**: Always use `throwExit()` or throw `CLIExitSignal`, never `process.exit()`
2014
- 2. **JSON Purity**: stdout for data, stderr for diagnostics - configure Commander explicitly
2015
- 3. **Deterministic Output**: Use `canonicalJSONStringify()` for all JSON output
2016
- 4. **Error Codes**: 0 = success, 1 = system error, 2 = user error
2017
- 5. **Stream Separation**: Commander's `configureOutput()` ensures help/errors don't pollute stdout
2018
-
2019
- **Related Documentation**:
2020
-
2021
- - [Error Taxonomy](./errors.md) - Complete error code reference
2022
- - [Deterministic Output](#deterministic-output-requirements) - JSON output guarantees
2023
- - Source: `src/cli.ts` - See `CLIExitSignal`, `throwExit()`, `exitWith()`
2024
-
2025
- ---
2026
-
2027
- ## Advanced Commands
2028
-
2029
- ### `view`
2030
-
2031
- Interactive plan viewer with keyboard navigation and filtering.
2032
-
2033
- ```bash
2034
- lex-pr view [options] [file]
2035
-
2036
- Arguments:
2037
- file Path to plan.json file (alternative to --plan)
2038
-
2039
- Options:
2040
- --plan <file> Path to plan.json file
2041
- --filter <text> Initial filter text
2042
- --no-deps Hide dependencies by default
2043
- --no-gates Hide gates by default
2044
- -h, --help Display help for command
2045
- ```
2046
-
2047
- **Keyboard Navigation:**
2048
-
2049
- - `↑/↓` - Navigate items
2050
- - `/` - Enter filter mode
2051
- - `d` - Toggle dependencies
2052
- - `g` - Toggle gates
2053
- - `q` - Quit
2054
-
2055
- #### Examples
2056
-
2057
- ```bash
2058
- # Open interactive viewer
2059
- lex-pr view plan.json
2060
-
2061
- # Start with a filter
2062
- lex-pr view plan.json --filter "feature"
2063
-
2064
- # Hide gates by default
2065
- lex-pr view plan.json --no-gates
2066
- ```
2067
-
2068
- ---
2069
-
2070
- ### `query`
2071
-
2072
- Advanced query and analysis of plan using SQL-like syntax.
2073
-
2074
- ```bash
2075
- lex-pr query [file] [query] [options]
2076
-
2077
- Arguments:
2078
- file Path to plan.json file (alternative to --plan)
2079
- query Query string (e.g., 'level eq 1', 'name contains feature')
2080
-
2081
- Options:
2082
- --plan <file> Path to plan.json file
2083
- --format <fmt> Output format: json, table, csv (default: "table")
2084
- --output <file> Output file (default: stdout)
2085
- --stats Show plan statistics
2086
- --roots Show root nodes (no dependencies)
2087
- --leaves Show leaf nodes (no dependents)
2088
- --level <level> Filter by merge level
2089
- -h, --help Display help for command
2090
- ```
2091
-
2092
- **Query Syntax:**
2093
-
2094
- ```
2095
- field operator value [AND field operator value]
2096
- ```
2097
-
2098
- **Operators:** `eq`, `ne`, `contains`, `in`, `gt`, `lt`, `gte`, `lte`
2099
-
2100
- **Fields:** `name`, `level`, `depsCount`, `gatesCount`, `dependentsCount`
2101
-
2102
- #### Examples
2103
-
2104
- ```bash
2105
- # Find all items at merge level 1
2106
- lex-pr query plan.json "level eq 1"
2107
-
2108
- # Find items with specific name pattern
2109
- lex-pr query plan.json "name contains feature"
2110
-
2111
- # Find items with more than 2 dependencies
2112
- lex-pr query plan.json "depsCount gt 2"
2113
-
2114
- # Complex queries with AND
2115
- lex-pr query plan.json "level eq 1 AND depsCount eq 0"
2116
-
2117
- # Show plan statistics
2118
- lex-pr query plan.json --stats
2119
-
2120
- # Output as JSON
2121
- lex-pr query plan.json "level eq 1" --format json
2122
-
2123
- # Save to file
2124
- lex-pr query plan.json --roots --output roots.json --format json
2125
- ```
2126
-
2127
- ---
2128
-
2129
- ### `retry`
2130
-
2131
- Retry failed gates with selective filtering.
2132
-
2133
- ```bash
2134
- lex-pr retry [options]
2135
-
2136
- Options:
2137
- --state-dir <dir> State directory (default: ".smartergpt/runner")
2138
- --filter <text> Filter items/gates to retry
2139
- --items <items> Comma-separated list of items to retry
2140
- --dry-run Show what would be retried without executing
2141
- --json Output JSON format
2142
- -h, --help Display help for command
2143
- ```
2144
-
2145
- #### Examples
2146
-
2147
- ```bash
2148
- # Show all failed gates
2149
- lex-pr retry --dry-run
2150
-
2151
- # Retry all failed gates
2152
- lex-pr retry
2153
-
2154
- # Retry specific items
2155
- lex-pr retry --items "item1,item2"
2156
-
2157
- # Retry with filter
2158
- lex-pr retry --filter "integration"
2159
-
2160
- # JSON output
2161
- lex-pr retry --json
2162
- ```
2163
-
2164
- ---
2165
-
2166
- ### `completion`
2167
-
2168
- Generate shell completion scripts for bash and zsh.
2169
-
2170
- ```bash
2171
- lex-pr completion [shell] [options]
2172
-
2173
- Arguments:
2174
- shell Shell type: bash, zsh (default: "bash")
2175
-
2176
- Options:
2177
- --install Show installation instructions
2178
- -h, --help Display help for command
2179
- ```
2180
-
2181
- #### Examples
2182
-
2183
- ```bash
2184
- # Generate bash completion
2185
- lex-pr completion bash
2186
-
2187
- # Generate zsh completion
2188
- lex-pr completion zsh
2189
-
2190
- # Show installation instructions
2191
- lex-pr completion bash --install
2192
- ```
2193
-
2194
- **Installation:**
2195
-
2196
- For bash:
2197
-
2198
- ```bash
2199
- # Add to ~/.bashrc
2200
- eval "$(lex-pr completion bash)"
2201
- ```
2202
-
2203
- For zsh:
2204
-
2205
- ```bash
2206
- # Add to ~/.zshrc
2207
- eval "$(lex-pr completion zsh)"
2208
- ```
2209
-
2210
- ---
2211
-
2212
- ### Enhanced `merge` Options
2213
-
2214
- The `merge` command now supports batch operations:
2215
-
2216
- ```bash
2217
- lex-pr merge [options]
2218
-
2219
- Additional Batch Options:
2220
- --batch Enable batch mode for multiple items
2221
- --filter <query> Filter items using query language
2222
- --levels <levels> Comma-separated list of levels to merge
2223
- --items <items> Comma-separated list of items to merge
2224
- ```
2225
-
2226
- #### Batch Examples
2227
-
2228
- ```bash
2229
- # Merge specific items
2230
- lex-pr merge plan.json --batch --items "item1,item2" --execute
2231
-
2232
- # Merge all items at specific levels
2233
- lex-pr merge plan.json --batch --levels "1,2" --execute
2234
-
2235
- # Merge items matching a query
2236
- lex-pr merge plan.json --batch --filter "level eq 1" --execute
2237
- ```
2238
-
2239
- ---
2240
-
2241
- ## Error Handling
2242
-
2243
- All commands follow consistent error handling:
2244
-
2245
- - **Exit code 0**: Success
2246
- - **Exit code 1**: System/infrastructure errors
2247
- - **Exit code 2**: User/validation errors
2248
-
2249
- JSON error responses use consistent format:
2250
-
2251
- ```json
2252
- {
2253
- "error": true,
2254
- "code": "ERROR_CODE",
2255
- "message": "Human-readable error message",
2256
- "details": {
2257
- // Command-specific error context
2258
- }
2259
- }
2260
- ```
2261
-
2262
- See [Error Taxonomy](./errors.md) for complete error code reference.