openlanes 3.0.1 → 3.1.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 (319) hide show
  1. checksums.yaml +4 -4
  2. data/Brewfile +42 -0
  3. data/agents/bb8-resolver.md +49 -0
  4. data/agents/c3po-operator.md +4 -0
  5. data/agents/chewie-verifier.md +85 -0
  6. data/agents/hansolo-reviewer.md +20 -15
  7. data/agents/lando-broker.md +81 -19
  8. data/agents/leah-researcher.md +6 -6
  9. data/agents/luke-backend.md +41 -20
  10. data/agents/{palpatine-planner.md → luthen-rael-planner.md} +15 -13
  11. data/agents/palpatine-risk-assessor.md +112 -0
  12. data/agents/r2d2-mechanic.md +5 -1
  13. data/agents/rey-frontend.md +38 -19
  14. data/agents/yoda-writer.md +7 -7
  15. data/evals/cases/chewie-verifier/verify-medium/fail/plan/plan.md +7 -0
  16. data/evals/cases/chewie-verifier/verify-medium/fail/plan/pull-requests.md +10 -0
  17. data/evals/cases/chewie-verifier/verify-medium/fail/plan/spec.md +5 -0
  18. data/evals/cases/chewie-verifier/verify-medium/fail/plan/verification/1/final.png +0 -0
  19. data/evals/cases/chewie-verifier/verify-medium/fail/plan/verification/1/report.md +7 -0
  20. data/evals/cases/chewie-verifier/verify-medium/fail/repo/bin/greet +1 -0
  21. data/evals/cases/chewie-verifier/verify-medium/fail/run.json +1 -0
  22. data/evals/cases/chewie-verifier/verify-medium/pass/plan/plan.md +7 -0
  23. data/evals/cases/chewie-verifier/verify-medium/pass/plan/pull-requests.md +10 -0
  24. data/evals/cases/chewie-verifier/verify-medium/pass/plan/spec.md +5 -0
  25. data/evals/cases/chewie-verifier/verify-medium/pass/plan/verification/1/final.png +0 -0
  26. data/evals/cases/chewie-verifier/verify-medium/pass/plan/verification/1/report.md +14 -0
  27. data/evals/cases/chewie-verifier/verify-medium/pass/plan/verification/1/step-01.png +0 -0
  28. data/evals/cases/chewie-verifier/verify-medium/pass/repo/bin/greet +1 -0
  29. data/evals/cases/chewie-verifier/verify-medium/pass/run.json +1 -0
  30. data/evals/cases/chewie-verifier/verify-medium.yml +48 -0
  31. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/implementation-plan.md +5 -0
  32. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/plan.md +3 -0
  33. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/pull-requests.md +12 -0
  34. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/spec.md +5 -0
  35. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/repo/lib/cart.rb +10 -0
  36. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/repo/spec/cart_spec.rb +9 -0
  37. data/evals/cases/hansolo-reviewer/coverage-minimum/fail/run.json +1 -0
  38. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/implementation-plan.md +5 -0
  39. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/plan.md +3 -0
  40. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/pull-requests.md +15 -0
  41. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/spec.md +5 -0
  42. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/repo/lib/cart.rb +10 -0
  43. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/repo/spec/cart_spec.rb +9 -0
  44. data/evals/cases/hansolo-reviewer/coverage-minimum/pass/run.json +1 -0
  45. data/evals/cases/hansolo-reviewer/coverage-minimum.yml +76 -0
  46. data/evals/cases/luthen-rael-planner/plan-deep/fail/plan/plan.md +8 -0
  47. data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/plan.md +2 -2
  48. data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep.yml +1 -1
  49. data/evals/cases/luthen-rael-planner/plan-fast/fail/plan/plan.md +12 -0
  50. data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/plan.md +2 -2
  51. data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast.yml +1 -1
  52. data/evals/cases/palpatine-risk-assessor/risk-medium/fail/plan/plan.md +20 -0
  53. data/evals/cases/palpatine-risk-assessor/risk-medium/fail/plan/pull-requests.md +5 -0
  54. data/evals/cases/palpatine-risk-assessor/risk-medium/fail/plan/spec.md +5 -0
  55. data/evals/cases/palpatine-risk-assessor/risk-medium/fail/repo/db/migrate/20261020120000_drop_legacy_email.rb +5 -0
  56. data/evals/cases/palpatine-risk-assessor/risk-medium/fail/run.json +1 -0
  57. data/evals/cases/palpatine-risk-assessor/risk-medium/pass/plan/plan.md +25 -0
  58. data/evals/cases/palpatine-risk-assessor/risk-medium/pass/plan/pull-requests.md +5 -0
  59. data/evals/cases/palpatine-risk-assessor/risk-medium/pass/plan/spec.md +5 -0
  60. data/evals/cases/palpatine-risk-assessor/risk-medium/pass/repo/db/migrate/20261020120000_drop_legacy_email.rb +5 -0
  61. data/evals/cases/palpatine-risk-assessor/risk-medium/pass/run.json +1 -0
  62. data/evals/cases/palpatine-risk-assessor/risk-medium.yml +47 -0
  63. data/evals/cases/yoda-writer/spec-medium/pass/plan/spec.md +1 -1
  64. data/lib/openlanes/adapters/base.rb +18 -4
  65. data/lib/openlanes/adapters/capabilities.rb +29 -0
  66. data/lib/openlanes/adapters/claude.rb +14 -11
  67. data/lib/openlanes/adapters/codex.rb +9 -0
  68. data/lib/openlanes/adapters/pi.rb +10 -0
  69. data/lib/openlanes/adapters/stream.rb +145 -1
  70. data/lib/openlanes/adapters.rb +7 -0
  71. data/lib/openlanes/agents/agent.rb +4 -3
  72. data/lib/openlanes/agents/roster.rb +14 -2
  73. data/lib/openlanes/agents/routing.rb +43 -3
  74. data/lib/openlanes/apps/definition.rb +152 -0
  75. data/lib/openlanes/apps/framing.rb +114 -0
  76. data/lib/openlanes/apps/listing.rb +60 -0
  77. data/lib/openlanes/apps/ports.rb +168 -0
  78. data/lib/openlanes/apps/probe.rb +63 -0
  79. data/lib/openlanes/apps/process_spec.rb +39 -0
  80. data/lib/openlanes/apps/runner.rb +174 -0
  81. data/lib/openlanes/apps/status.rb +62 -0
  82. data/lib/openlanes/apps/supervisor.rb +277 -0
  83. data/lib/openlanes/apps/watcher.rb +50 -0
  84. data/lib/openlanes/apps.rb +41 -0
  85. data/lib/openlanes/cli/api/api.rb +10 -0
  86. data/lib/openlanes/cli/api/subcommands/docs.rb +63 -0
  87. data/lib/openlanes/cli/app/app.rb +31 -0
  88. data/lib/openlanes/cli/app/subcommands/start.rb +114 -0
  89. data/lib/openlanes/cli/app/subcommands/status.rb +38 -0
  90. data/lib/openlanes/cli/app/subcommands/stop.rb +44 -0
  91. data/lib/openlanes/cli/base.rb +89 -16
  92. data/lib/openlanes/cli/coverage/coverage.rb +68 -0
  93. data/lib/openlanes/cli/create/create.rb +11 -265
  94. data/lib/openlanes/cli/eval/eval.rb +4 -1
  95. data/lib/openlanes/cli/init/init.rb +39 -2
  96. data/lib/openlanes/cli/linear/subcommands/import.rb +1 -1
  97. data/lib/openlanes/cli/linear/subcommands/projects.rb +1 -1
  98. data/lib/openlanes/cli/list_plans/list_plans.rb +8 -2
  99. data/lib/openlanes/cli/mail/subcommands/ack.rb +52 -0
  100. data/lib/openlanes/cli/mail/subcommands/render.rb +31 -0
  101. data/lib/openlanes/cli/mail/subcommands/send.rb +26 -0
  102. data/lib/openlanes/cli/resync/subcommands/dirs.rb +53 -12
  103. data/lib/openlanes/cli/resync/subcommands/prs.rb +8 -69
  104. data/lib/openlanes/cli/review/review.rb +72 -0
  105. data/lib/openlanes/cli/run/run.rb +22 -486
  106. data/lib/openlanes/cli/setup/setup.rb +51 -0
  107. data/lib/openlanes/cli/start/start.rb +7 -51
  108. data/lib/openlanes/cli/state/state.rb +1 -1
  109. data/lib/openlanes/cli/state/subcommands/resume.rb +61 -0
  110. data/lib/openlanes/cli/state/subcommands/sign.rb +1 -1
  111. data/lib/openlanes/cli/unblock/unblock.rb +11 -205
  112. data/lib/openlanes/cli/web/web.rb +84 -8
  113. data/lib/openlanes/cli/worktree/worktree.rb +1 -1
  114. data/lib/openlanes/cli/worktree/worktree_prune.rb +77 -0
  115. data/lib/openlanes/cli.rb +37 -2
  116. data/lib/openlanes/coverage/cobertura.rb +49 -0
  117. data/lib/openlanes/coverage/config.rb +194 -0
  118. data/lib/openlanes/coverage/istanbul.rb +31 -0
  119. data/lib/openlanes/coverage/lcov.rb +38 -0
  120. data/lib/openlanes/coverage/report.rb +71 -0
  121. data/lib/openlanes/coverage/simplecov.rb +70 -0
  122. data/lib/openlanes/coverage.rb +33 -0
  123. data/lib/openlanes/engine/agent_locks.rb +231 -0
  124. data/lib/openlanes/engine/arbitration.rb +25 -0
  125. data/lib/openlanes/engine/board.rb +36 -5
  126. data/lib/openlanes/engine/conversions.rb +160 -0
  127. data/lib/openlanes/engine/coverage_gate.rb +217 -0
  128. data/lib/openlanes/engine/dispatcher.rb +1175 -117
  129. data/lib/openlanes/engine/event_journal/replay.rb +96 -0
  130. data/lib/openlanes/engine/event_journal.rb +148 -0
  131. data/lib/openlanes/engine/extensions.rb +271 -0
  132. data/lib/openlanes/engine/merging.rb +459 -0
  133. data/lib/openlanes/engine/narrator.rb +6 -6
  134. data/lib/openlanes/engine/plan_locks.rb +114 -0
  135. data/lib/openlanes/engine/pr_outcomes.rb +161 -0
  136. data/lib/openlanes/engine/pr_watch.rb +83 -0
  137. data/lib/openlanes/engine/progress_log.rb +12 -120
  138. data/lib/openlanes/engine/quality_question.rb +125 -0
  139. data/lib/openlanes/engine/rebase.rb +200 -0
  140. data/lib/openlanes/engine/run_workflow.rb +776 -0
  141. data/lib/openlanes/engine/runner.rb +186 -15
  142. data/lib/openlanes/engine/start_workflow.rb +77 -0
  143. data/lib/openlanes/engine/state_file.rb +101 -34
  144. data/lib/openlanes/engine/tally.rb +1 -1
  145. data/lib/openlanes/engine/verification/app_session.rb +104 -0
  146. data/lib/openlanes/engine/verification/driver.rb +314 -0
  147. data/lib/openlanes/engine/verification/outcome.rb +516 -0
  148. data/lib/openlanes/engine/verification/report.rb +95 -0
  149. data/lib/openlanes/engine/verification/round.rb +100 -0
  150. data/lib/openlanes/engine/verification/screenshots.rb +120 -0
  151. data/lib/openlanes/engine/verification.rb +57 -0
  152. data/lib/openlanes/engine.rb +30 -1
  153. data/lib/openlanes/execution/boundary.rb +212 -0
  154. data/lib/openlanes/execution/child.rb +4 -2
  155. data/lib/openlanes/execution/clock.rb +36 -6
  156. data/lib/openlanes/execution/control.rb +32 -0
  157. data/lib/openlanes/execution/executor.rb +114 -35
  158. data/lib/openlanes/execution/process_start.rb +63 -0
  159. data/lib/openlanes/execution/prompt.rb +223 -34
  160. data/lib/openlanes/execution/transcript.rb +159 -8
  161. data/lib/openlanes/execution.rb +21 -0
  162. data/lib/openlanes/lifecycle/adoption.rb +25 -8
  163. data/lib/openlanes/lifecycle/aging.rb +166 -0
  164. data/lib/openlanes/lifecycle/allocator.rb +216 -0
  165. data/lib/openlanes/lifecycle/brief.rb +32 -2
  166. data/lib/openlanes/lifecycle/completion.rb +12 -6
  167. data/lib/openlanes/lifecycle/create_workflow.rb +272 -0
  168. data/lib/openlanes/lifecycle/creator.rb +17 -13
  169. data/lib/openlanes/lifecycle/lanes.rb +1 -1
  170. data/lib/openlanes/lifecycle/resync.rb +170 -42
  171. data/lib/openlanes/lifecycle/unblock_workflow.rb +234 -0
  172. data/lib/openlanes/lifecycle/unblocker.rb +76 -2
  173. data/lib/openlanes/lifecycle.rb +37 -1
  174. data/lib/openlanes/linear/mapping.rb +4 -1
  175. data/lib/openlanes/linear/unit.rb +1 -1
  176. data/lib/openlanes/live/chat.rb +60 -11
  177. data/lib/openlanes/live/choice_converter.rb +166 -0
  178. data/lib/openlanes/live/choice_judge.rb +109 -0
  179. data/lib/openlanes/live/claims.rb +9 -1
  180. data/lib/openlanes/live/command.rb +13 -10
  181. data/lib/openlanes/live/commands.rb +217 -30
  182. data/lib/openlanes/live/copilot/slash.rb +82 -0
  183. data/lib/openlanes/live/copilot.rb +38 -4
  184. data/lib/openlanes/live/event_bus/base.rb +52 -0
  185. data/lib/openlanes/live/event_bus/memory_bus.rb +14 -0
  186. data/lib/openlanes/live/event_bus/redis_bus.rb +10 -0
  187. data/lib/openlanes/live/event_bus/transaction.rb +27 -0
  188. data/lib/openlanes/live/event_bus.rb +29 -0
  189. data/lib/openlanes/live/interviewer.rb +146 -0
  190. data/lib/openlanes/live/keys.rb +56 -0
  191. data/lib/openlanes/live/mail.rb +143 -0
  192. data/lib/openlanes/live/memory_store.rb +12 -1
  193. data/lib/openlanes/live/news.rb +61 -0
  194. data/lib/openlanes/live/node.rb +20 -0
  195. data/lib/openlanes/live/outage.rb +225 -0
  196. data/lib/openlanes/live/outage_report.rb +89 -0
  197. data/lib/openlanes/live/publisher.rb +42 -2
  198. data/lib/openlanes/live/run_record.rb +39 -1
  199. data/lib/openlanes/live/run_state.rb +19 -2
  200. data/lib/openlanes/live/session.rb +31 -3
  201. data/lib/openlanes/live/snapshot.rb +103 -42
  202. data/lib/openlanes/live/stations.rb +4 -4
  203. data/lib/openlanes/live/store.rb +18 -1
  204. data/lib/openlanes/live/subscriber.rb +22 -2
  205. data/lib/openlanes/live.rb +66 -1
  206. data/lib/openlanes/plans/blocked_file.rb +117 -0
  207. data/lib/openlanes/plans/choices.rb +228 -0
  208. data/lib/openlanes/plans/dependencies.rb +304 -0
  209. data/lib/openlanes/plans/feature.rb +75 -16
  210. data/lib/openlanes/plans/journal.rb +169 -0
  211. data/lib/openlanes/plans/last_known_state.rb +82 -0
  212. data/lib/openlanes/plans/lock.rb +171 -0
  213. data/lib/openlanes/plans/mailbox.rb +145 -4
  214. data/lib/openlanes/plans/plan_state.rb +590 -9
  215. data/lib/openlanes/plans/pull_request_machine.rb +163 -0
  216. data/lib/openlanes/plans/review_label.rb +139 -0
  217. data/lib/openlanes/plans/spec.rb +239 -3
  218. data/lib/openlanes/plans/state_machine.rb +63 -30
  219. data/lib/openlanes/plans/status.rb +60 -11
  220. data/lib/openlanes/plans/subject.rb +4 -0
  221. data/lib/openlanes/plans/tree.rb +101 -10
  222. data/lib/openlanes/plans/verdict.rb +124 -0
  223. data/lib/openlanes/plans.rb +19 -0
  224. data/lib/openlanes/presentation/api_docs.rb +76 -0
  225. data/lib/openlanes/presentation/documentation.rb +105 -12
  226. data/lib/openlanes/presentation/pr_changes.rb +90 -0
  227. data/lib/openlanes/presentation/reporter.rb +64 -5
  228. data/lib/openlanes/presentation.rb +20 -1
  229. data/lib/openlanes/setup/check.rb +16 -0
  230. data/lib/openlanes/setup/machine.rb +179 -0
  231. data/lib/openlanes/setup.rb +34 -0
  232. data/lib/openlanes/support/clock.rb +57 -0
  233. data/lib/openlanes/support/config.rb +318 -6
  234. data/lib/openlanes/support/log.rb +206 -0
  235. data/lib/openlanes/support/refusal.rb +15 -0
  236. data/lib/openlanes/support/runtime.rb +61 -0
  237. data/lib/openlanes/support/spawner.rb +51 -0
  238. data/lib/openlanes/support/ui.rb +39 -24
  239. data/lib/openlanes/vcs/ci_gate.rb +31 -0
  240. data/lib/openlanes/vcs/github.rb +362 -12
  241. data/lib/openlanes/vcs/label_migration.rb +132 -0
  242. data/lib/openlanes/vcs/label_sync.rb +75 -0
  243. data/lib/openlanes/vcs/publisher.rb +226 -8
  244. data/lib/openlanes/vcs/refresh.rb +337 -0
  245. data/lib/openlanes/vcs/rename_date.rb +83 -0
  246. data/lib/openlanes/vcs/review.rb +66 -0
  247. data/lib/openlanes/vcs/worktree.rb +167 -6
  248. data/lib/openlanes/vcs.rb +18 -0
  249. data/lib/openlanes/version.rb +1 -1
  250. data/lib/openlanes/web/admin_auth.rb +104 -0
  251. data/lib/openlanes/web/app.rb +115 -16
  252. data/lib/openlanes/web/context.rb +15 -9
  253. data/lib/openlanes/web/demo.rb +29 -14
  254. data/lib/openlanes/web/demo_board.rb +63 -5
  255. data/lib/openlanes/web/events.rb +86 -7
  256. data/lib/openlanes/web/launcher.rb +69 -7
  257. data/lib/openlanes/web/listen.rb +133 -0
  258. data/lib/openlanes/web/plan_files.rb +136 -0
  259. data/lib/openlanes/web/request_log.rb +108 -0
  260. data/lib/openlanes/web/server.rb +29 -10
  261. data/lib/openlanes/web.rb +6 -4
  262. data/lib/openlanes.rb +45 -7
  263. data/openlanes.gemspec +9 -4
  264. data/schemas/journal-event.schema.json +72 -0
  265. data/schemas/plan-state.schema.json +163 -2
  266. data/skills/openlanes/SKILL.md +2 -2
  267. data/skills/openlanes-documents/SKILL.md +4 -4
  268. data/skills/openlanes-documents/references/blocked-template.md +2 -2
  269. data/skills/openlanes-documents/references/closing-templates.md +1 -1
  270. data/skills/openlanes-documents/references/plan-template.md +12 -4
  271. data/skills/openlanes-documents/references/retroactive-spec.md +1 -1
  272. data/skills/openlanes-run/SKILL.md +5 -5
  273. data/skills/openlanes-spec/SKILL.md +1 -1
  274. data/skills/openlanes-status/SKILL.md +1 -1
  275. data/web/dist/assets/{index-BFPI-zXI.js → index-690ayLS4.js} +2 -2
  276. data/web/dist/assets/index-6ZmW4slI.js +199 -0
  277. data/web/dist/assets/{index-bpsFIpXE.js → index-B5KzlXp1.js} +2 -2
  278. data/web/dist/assets/{index-DtA46i32.js → index-BAo_v9bU.js} +2 -2
  279. data/web/dist/assets/{index-CnJfB0l2.js → index-BDm7g-xG.js} +2 -2
  280. data/web/dist/assets/{index-DXgeajd6.js → index-BFH9bC7v.js} +2 -2
  281. data/web/dist/assets/{index-DH0gDlee.js → index-BVHPV7z4.js} +2 -2
  282. data/web/dist/assets/{index-DaSjQ-H4.js → index-B_CPqjnA.js} +2 -2
  283. data/web/dist/assets/{index-Dbxvk-EC.js → index-BhwBH5ct.js} +2 -2
  284. data/web/dist/assets/{index-6MZkmh3k.js → index-Bq5AdwEt.js} +2 -2
  285. data/web/dist/assets/{index-B5CKJPm-.js → index-CAW6ClM2.js} +2 -2
  286. data/web/dist/assets/index-Cp86u27u.css +1 -0
  287. data/web/dist/assets/{index-CnvkZu5Y.js → index-Culm4pMO.js} +2 -2
  288. data/web/dist/assets/{index-IqD8mBos.js → index-DElDJfp1.js} +2 -2
  289. data/web/dist/assets/{index-C3zc4gFe.js → index-Dja7osNW.js} +2 -2
  290. data/web/dist/assets/{index-C2jwoWVV.js → index-DjhU3FzU.js} +2 -2
  291. data/web/dist/assets/{index-pvJi-JJO.js → index-Dutbxj4o.js} +2 -2
  292. data/web/dist/assets/{index-BF6QYroq.js → index-RkDhPMDt.js} +2 -2
  293. data/web/dist/assets/{index-DbueqOK5.js → index-_mptZjlC.js} +2 -2
  294. data/web/dist/index.html +2 -2
  295. data/web/src/api/fixtures/board.json +203 -28
  296. metadata +1053 -889
  297. data/bin/factory-e2e +0 -157
  298. data/bin/plan-number +0 -164
  299. data/bin/setup +0 -26
  300. data/evals/cases/palpatine-planner/plan-deep/fail/plan/plan.md +0 -8
  301. data/evals/cases/palpatine-planner/plan-fast/fail/plan/plan.md +0 -12
  302. data/web/dist/assets/index-BYJCWlk0.js +0 -198
  303. data/web/dist/assets/index-CjInBi5X.css +0 -1
  304. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/fail/plan/plan-backend.md +0 -0
  305. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/fail/plan/spec.md +0 -0
  306. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/fail/run.json +0 -0
  307. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/plan-backend.md +0 -0
  308. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/plan-frontend.md +0 -0
  309. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/spec.md +0 -0
  310. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/run.json +0 -0
  311. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/plan/plan-backend.md +0 -0
  312. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/plan/plan-frontend.md +0 -0
  313. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/plan/spec.md +0 -0
  314. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/run.json +0 -0
  315. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/plan-backend.md +0 -0
  316. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/plan-frontend.md +0 -0
  317. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/spec.md +0 -0
  318. /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/run.json +0 -0
  319. /data/exe/{depot → ol} +0 -0
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "tmpdir"
4
-
5
3
  module OpenLanes
6
4
  module CLI
7
5
  # `openlanes run` — drive the specialist agents until the tree settles.
@@ -16,12 +14,9 @@ module OpenLanes
16
14
  desc: "Seconds before one agent is abandoned; only tightens an agent's own clock " \
17
15
  "(default: the agent's own, else 900)"
18
16
  option :agent, desc: "Only run this one agent"
19
- # `--prompt` shorter than this that names an existing file is read.
20
- PROMPT_PATH_LIMIT = 80
21
-
22
17
  option :prompt,
23
18
  desc: "Extra instructions appended to the agent's prompt (only with --agent); " \
24
- "a path to an existing text file under #{PROMPT_PATH_LIMIT} characters is read instead"
19
+ "a path to an existing text file under #{Engine::RunWorkflow::PROMPT_PATH_LIMIT} characters is read instead"
25
20
  option :skip,
26
21
  desc: "Never assign this agent; its plans wait, the rest of the pipeline runs. " \
27
22
  "Comma separated for several"
@@ -53,7 +48,7 @@ module OpenLanes
53
48
  default: true,
54
49
  desc: "With --isolation worktree, a finished branch is pushed and its pull request " \
55
50
  "opened as soon as it lands, titled [NNN.MM](X). --no-git-push turns that off and leaves it uncommitted."
56
- option :log, desc: "Append progress to this file (default: a per-project file under the system temp dir)"
51
+ log_options
57
52
  option :redis_url,
58
53
  desc: "Redis for the live board, its commands and plan claims shared with other machines " \
59
54
  "(default: .openlanes.yml redis_url, else $REDIS_URL, else #{Live::DEFAULT_URL})"
@@ -67,7 +62,16 @@ module OpenLanes
67
62
  desc: "Open the control room in the browser; --no-open only prints its URL"
68
63
  option :port,
69
64
  default: OpenLanes::Web::DEFAULT_PORT.to_s,
70
- desc: "Port the control room listens on, on 127.0.0.1"
65
+ desc: "Port the control room listens on"
66
+ listen_options
67
+ option :ignore_bombs,
68
+ type: :boolean,
69
+ default: false,
70
+ desc: "Work on while a 💣 stands: a plan others wait on, blocked too long, halts nothing this run"
71
+ option :stay,
72
+ type: :boolean,
73
+ default: false,
74
+ desc: "Stay up past fixed points with --no-web, for a control room served apart by `openlanes web`"
71
75
  option :until_settled,
72
76
  type: :boolean,
73
77
  default: false,
@@ -82,495 +86,27 @@ module OpenLanes
82
86
  "--rounds 3 # …capping every agent at three rounds per plan",
83
87
  "--plan 005,006,007 # only the plans a batch step just created",
84
88
  "--no-web # headless: no control room, no browser; ends when the tree settles",
85
- "--until-settled # with the control room, but ending when the tree settles"
89
+ "--no-web --stay # headless, but up for a page `openlanes web` serves on its own",
90
+ "--until-settled # with the control room, but ending when the tree settles",
91
+ "--ignore-bombs # keep working while a 💣 stands",
92
+ "-I --admin-credentials admin:s3cret # the control room on every interface, behind a login"
86
93
  ]
87
94
 
88
- # Option precedence, quietest to loudest: the built-in default, then
89
- # `.openlanes.yml` (`jobs`, and the `commands.run` section), then the flag
90
- # actually typed. {Base.default_params} has already folded the file in.
91
- #
92
95
  # @param options [Hash]
93
96
  # @return [void]
94
97
  def call(**options)
95
- if options[:prompt] && !options[:agent]
96
- refuse("--prompt only works with --agent: it speaks to one agent, and without " \
97
- "that restriction every agent in the round would hear it.",
98
- 64)
99
- end
100
-
101
- tree = tree_for(options)
102
- root = options[:root] || File.dirname(tree.dir)
103
- agents = OpenLanes::Agents.registry
104
- agents = filtered(agents, options[:agent]) if options[:agent]
105
- agents = skipped(agents, options[:skip], options[:agent]) if options[:skip]
106
- plans = options[:plan] ? scoped(tree, options[:plan]) : nil
107
- assignable!(agents, tree, plans, options[:agent]) if options[:agent]
108
-
109
- isolation = options.fetch(:isolation, "worktree").to_sym
110
- jobs = (options[:jobs] || UI.default_jobs).to_i
111
- timeout = options[:timeout]&.to_i
112
-
113
- if isolation == :worktree && !OpenLanes::Vcs.worktree(root:).repository?
114
- refuse("#{root} is not a git repository, so plans cannot be isolated.\n\n" \
115
- "Run with --isolation shared to work in one tree, serially.",
116
- 66)
117
- end
118
-
119
- # Set before the loop starts, not after: `UI.animate?` (and therefore
120
- # whether a round prints anything at all) is read the whole time the
121
- # loop runs, not just when `report` prints its closing summary.
122
- quiet?(options)
123
- UI.log_path = options[:log] || Engine::ProgressLog.default_path(root)
124
- startup("Progress", UI.log_path)
125
- credentials_warning if !dry_run?(options) && !quiet?(options)
126
- spec_warning(tree, plans) unless quiet?(options)
127
-
128
- # The state file is what a harness that dies leaves for the next one.
129
- # It sits in .plans/ so a reboot keeps it, and it is ignored by name
130
- # so it never rides along in a commit. Editing somebody's .gitignore
131
- # is announced, the once it happens. The runner drops the file on a
132
- # dry run, which is why it can be built unconditionally.
133
- state = Engine.state_file(tree)
134
- if !dry_run?(options) && Engine::StateFile.ensure_ignored!(root) && !quiet?(options)
135
- info("Added #{Engine::StateFile::IGNORE.join(" and ")} to .gitignore: the run keeps its state there.")
136
- end
137
-
138
- # Control files from a previous run would otherwise be read as orders
139
- # to this one. Progress goes to STDERR as lines; the web view (plan 004)
140
- # is what will draw the board and take kill, extend and stop.
141
- Execution::Control.reset!
142
-
143
- live = live_for(root:, tree:, agents:, options:)
144
- web = web_for(live, root:, tree:, options:)
145
- runner = Engine.runner(
146
- tree:,
147
- agents:,
148
- isolation:,
149
- jobs:,
150
- plans:,
151
- state:,
152
- worktree: (OpenLanes::Vcs.worktree(root:) if isolation == :worktree),
153
- rounds: options[:rounds]&.to_i,
154
- executor: Execution.executor(root:,
155
- timeout:,
156
- dry_run: dry_run?(options),
157
- instructions: instructions_from(options[:prompt]),
158
- model: options[:model],
159
- max_tokens: options[:max_tokens]&.to_i,
160
- lean: !options[:user_config]),
161
- dry_run: dry_run?(options),
162
- publisher: publisher_for(root, isolation, options),
163
- on_board: live&.on_board,
164
- claims: live&.claims,
165
- **staying(options, web)
166
- )
167
- startup_box(options)
168
-
169
- # The terminal hears the run as it happens, one appended line per
170
- # event, whether or not a control room is up: the page is the board,
171
- # and the terminal is its log. Nothing here redraws, so nothing can
172
- # draw over a box or over another line.
173
- narrator = UI.tap_log(Engine::Narrator.new) unless quiet?(options)
174
- started = UI.monotonic
175
- attempts = begin
176
- Execution.on_interrupt(signals:) { runner.call { |dispatcher| live&.attach(dispatcher) } }
177
- ensure
178
- UI.untap_log(narrator) if narrator
179
- live&.close
180
- web&.stop
181
- end
182
- finish(runner, attempts, options, seconds: UI.monotonic - started)
98
+ tree = tree_for(options)
99
+ listen = listen_for(options)
100
+ options = options.merge(quiet: quiet?(options), listen:, credentials: credentials_for(options, listen))
101
+ exit(unwrap(workflow(tree, options).call))
183
102
  end
184
103
 
185
104
  private
186
105
 
187
- # What the runner is told about idling past its fixed points. With its
188
- # control room up the engine stays, since the page can answer a blocked
189
- # plan or create the next one at any moment, and a run that had ended
190
- # would leave the page talking to nobody. Headless, or with
191
- # `--until-settled`, it ends at the first fixed point.
192
- #
193
- # @param options [Hash]
194
- # @param web [OpenLanes::Web::Launcher, nil] the control room, when it came up
195
- # @return [Hash] `stay:` and `rescan:` for {Engine::Runner}, or nothing
196
- def staying(options, web)
197
- return {} if web.nil? || options[:until_settled]
198
-
199
- @stays = "The engine stays up with its control room: Stop All Local or Ctrl-C ends it."
200
- { stay: true, rescan: Engine::Dispatcher::RESCAN }
201
- end
202
-
203
- # Signals that stop the run gracefully, the way the first Ctrl-C does.
204
- # TERM too: a run with its control room stays up like a service, and a
205
- # service manager stops a service that way.
206
- #
207
- # @return [Array<String>]
208
- def signals = %w[INT TERM]
209
-
210
- # The closing report, and the exit status: 1 when any attempt failed.
211
- #
212
- # @param runner [OpenLanes::Engine::Runner]
213
- # @param attempts [Array<OpenLanes::Engine::Runner::Attempt>]
214
- # @param options [Hash]
215
- # @param seconds [Float]
216
- # @return [void]
217
- def finish(runner, attempts, options, seconds:)
218
- report(runner, attempts, options, seconds:)
219
- exit(failures(attempts).empty? ? 0 : 1)
220
- end
221
-
222
- # Where the browser is sent once the control room answers.
223
- #
224
- # @param web [OpenLanes::Web::Launcher]
225
- # @param _tree [OpenLanes::Plans::Tree]
226
- # @return [String]
227
- def browser_url(web, _tree) = web.url
228
-
229
- # A live board this run cannot do without. `run` goes on headless, and
230
- # {Start}, whose page is its only way in, refuses instead.
231
- #
232
- # @param message [String] why there is no board
233
- # @param options [Hash]
234
- # @return [nil]
235
- def without_live(message, options)
236
- return nil if quiet?(options)
237
-
238
- warn("#{message}\n\nThe run goes on without the live board: no page, no commands from it, and no " \
239
- "plan claims shared with other machines. Start redis-server, or pass --redis-url.")
240
- nil
241
- end
242
-
243
- # @param web [OpenLanes::Web::Launcher] one that did not answer
244
- # @param _live [OpenLanes::Live::Session]
245
- # @param options [Hash]
246
- # @return [nil]
247
- def without_web(web, _live, options)
248
- return nil if quiet?(options)
249
-
250
- warn("The control room did not answer on #{web.url}, so the run goes on without it. Its log: #{web.log}")
251
- nil
252
- end
253
-
254
- # The live board (W6, W13, W26), when this run has one: not on a dry
255
- # run, which must leave nothing behind, and not without Redis, where
256
- # the run goes on exactly as it did before there was a page. Either
257
- # way it is said once, so a page that never updates is not a mystery.
258
- #
259
- # @param root [String]
260
106
  # @param tree [OpenLanes::Plans::Tree]
261
- # @param agents [OpenLanes::Agents::Registry]
262
107
  # @param options [Hash]
263
- # @param live [Boolean] false runs without Redis at all, for the
264
- # headless flags a later command adds
265
- # @return [OpenLanes::Live::Session, nil]
266
- def live_for(root:, tree:, agents:, options:, live: true)
267
- return nil unless live
268
-
269
- if dry_run?(options)
270
- warn("Dry run: the live board is off, so nothing is published to Redis and no plan is claimed.") unless quiet?(options)
271
- return nil
272
- end
273
-
274
- config = Config.current
275
- store = Live.connect(Live.redis_url(option: options[:redis_url], config:))
276
- Live.session(store:, root:, tree:, agents:, project: config.project).tap do |session|
277
- startup("Live board", session.described)
278
- end
279
- rescue Live::Unavailable => e
280
- without_live(e.message, options)
281
- end
282
-
283
- # The control room (W1, W7): `openlanes web` as its own process beside
284
- # the engine, reading the board this run publishes. Only with a live
285
- # board to read, so a dry run, a run without Redis and `--no-web` all
286
- # stay headless. A server that does not come up is reported and left
287
- # out; the run is the agents' work, and the page is a view of it.
288
- #
289
- # @param live [OpenLanes::Live::Session, nil]
290
- # @param root [String]
291
- # @param tree [OpenLanes::Plans::Tree]
292
- # @param options [Hash]
293
- # @return [OpenLanes::Web::Launcher, nil] running, for the run to stop
294
- def web_for(live, root:, tree:, options:)
295
- return nil if live.nil? || options[:web] == false
296
-
297
- web = OpenLanes::Web.launcher(root:,
298
- plans_dir: tree.dir,
299
- port: options[:port] || OpenLanes::Web::DEFAULT_PORT,
300
- redis_url: live.store.url).start
301
- unless web.ready?
302
- web.stop
303
- return without_web(web, live, options)
304
- end
305
-
306
- startup("Control room", web.url)
307
- OpenLanes::Web.open(browser_url(web, tree)) unless options[:open] == false
308
- web
309
- end
310
-
311
- # One line of the startup box, kept until {#startup_box} draws it.
312
- #
313
- # @param label [String]
314
- # @param value [String, Array<String>] parts a narrow box may break between
315
- # @return [void]
316
- def startup(label, value) = (@startup ||= []) << [label, value]
317
-
318
- # Where the run writes, what it publishes to, and where its page is:
319
- # one Info box, drawn once all three are known. Each used to be a box
320
- # of its own, three frames for three lines. A line that does not apply
321
- # (no Redis, no control room) is left out, not drawn empty.
322
- #
323
- # @param options [Hash]
324
- # @return [void]
325
- def startup_box(options)
326
- return if quiet?(options) || @startup.to_a.empty?
327
-
328
- info([UI.labelled(@startup), @stays].compact.join("\n\n"))
329
- end
330
-
331
- # The attempts list, padded into columns.
332
- #
333
- # Tabs used to separate these, which put every column on the next
334
- # multiple of eight: one agent's name a character longer than the
335
- # next one's pushed its round and mark a whole stop to the right, so
336
- # nothing under `luke-backend` and `yoda-writer` lined up. Widths come
337
- # from the rows themselves, so the columns are as narrow as the run
338
- # allows and still square.
339
- #
340
- # @param attempts [Array<OpenLanes::Engine::Runner::Attempt>]
341
- # @return [Array<String>] one line per attempt, indented by two
342
- def attempt_lines(attempts)
343
- rows = attempts.map { |a| [a.ordinal.to_s, a.agent.to_s, "[R:#{a.round}]", mark(a), a.note.to_s] }
344
- widths = rows.transpose.map { |column| column.map { |cell| UI.display_width(cell) }.max.to_i }
345
- rows.map do |cells|
346
- # The note is last and is left as it is: padding the final column
347
- # only adds trailing whitespace a copy-paste then carries.
348
- last = cells.size - 1
349
- " #{cells.each_with_index.map { |cell, i| i == last ? cell : UI.fit(cell, widths[i] + 2) }.join}"
350
- end
351
- end
352
-
353
- # @param attempt [OpenLanes::Engine::Runner::Attempt]
354
- # @return [String] what the attempt did to its plan's state
355
- def mark(attempt)
356
- return "FAIL" unless attempt.ok
357
- return "#{attempt.from} -> #{attempt.to}" if attempt.advanced?
358
-
359
- "no change"
360
- end
361
-
362
- # `--prompt` takes the instructions themselves or a file holding them.
363
- # A short argument naming an existing file is read; anything else is
364
- # the text, so a sentence that happens to match a filename in the
365
- # project is not silently swapped for that file once it is long enough
366
- # to be a sentence.
367
- #
368
- # @param prompt [String, nil]
369
- # @return [String, nil]
370
- def instructions_from(prompt)
371
- return prompt unless prompt && prompt.length < PROMPT_PATH_LIMIT && File.file?(typed_path(prompt))
372
-
373
- File.read(typed_path(prompt))
374
- end
375
-
376
- # @param agents [OpenLanes::Agents::Registry]
377
- # @param name [String]
378
- # @return [OpenLanes::Agents::Registry] holding only the agent named — the
379
- # restriction has to reach assignments, not just chaining, or a flag
380
- # like `--prompt` aimed at one agent leaks to the whole round
381
- def filtered(agents, name)
382
- agents.find(name) or
383
- refuse("No agent called #{name}.\n\nKnown: #{agents.all.map(&:name).join(", ")}", 65)
384
- agents.only(name)
385
- end
386
-
387
- # Each name is checked against the full roster, not the possibly
388
- # already-restricted one, so `--skip` misspelled is a refusal rather
389
- # than a silent no-op — the same reasoning `--plan` applies to numbers.
390
- #
391
- # @param agents [OpenLanes::Agents::Registry]
392
- # @param text [String] comma-separated agent names
393
- # @param restricted [String, nil] what `--agent` asked for, if anything
394
- # @return [OpenLanes::Agents::Registry] without the agents named
395
- def skipped(agents, text, restricted)
396
- roster = OpenLanes::Agents.registry
397
- names = text.split(",").map(&:strip).reject(&:empty?)
398
- names.each do |name|
399
- roster.find(name) or
400
- refuse("No agent called #{name}.\n\nKnown: #{roster.all.map(&:name).join(", ")}", 65)
401
- next unless name == restricted
402
-
403
- refuse("--agent #{name} and --skip #{name} contradict each other: " \
404
- "one asks for only this agent, the other for anything but.",
405
- 64)
406
- end
407
- agents.without(*names)
408
- end
409
-
410
- # A spec.md whose frontmatter does not parse routes as if it had none:
411
- # lane full, every override dropped. An eval agent's unquoted backtick
412
- # sent a quick-lane rename to research that way, and said nothing.
413
- # {Plans::Spec#problems} already knew; say it before agents are assigned.
414
- #
415
- # @param tree [OpenLanes::Plans::Tree]
416
- # @param plans [Array<OpenLanes::Plans::Ordinal>, nil] the --plan ordinals, nil for all
417
- # @return [void]
418
- def spec_warning(tree, plans)
419
- lines = tree.subjects.filter_map { |subject|
420
- ordinal = subject.feature.ordinal
421
- next if plans && !plans.include?(ordinal)
422
-
423
- problems = Plans::Spec.for(subject).problems
424
- "#{ordinal}: #{problems.join("; ")}" unless problems.empty?
425
- }
426
- return if lines.empty?
427
-
428
- warn("spec.md frontmatter ignored in part, so these plans route on defaults:\n" \
429
- "#{lines.join("\n")}")
430
- end
431
-
432
- # `--plan` names the whole point of scoping: a skill that just minted
433
- # N folders hands off exactly those, not the tree. A typo'd or already-
434
- # settled number silently running the whole tree instead is the failure
435
- # this exists to prevent, so an unknown one is refused rather than
436
- # dropped.
437
- #
438
- # @param tree [OpenLanes::Plans::Tree]
439
- # @param text [String]
440
- # @return [Array<OpenLanes::Plans::Ordinal>]
441
- def scoped(tree, text)
442
- known = tree.subjects.map { |s| s.feature.ordinal }
443
- text.split(",").map(&:strip).reject(&:empty?).map { |token|
444
- ordinal = Plans::Ordinal.parse(token)
445
- unless ordinal && known.include?(ordinal)
446
- refuse("No plan #{token} in #{tree.dir}.\n\n" \
447
- "Known: #{known.join(", ")}",
448
- 66)
449
- end
450
- ordinal
451
- }
452
- end
453
-
454
- # `--agent` narrowing the round to nobody used to exit 0 in silence —
455
- # "0 plans addressed", green box, no hint that the agent named simply
456
- # does not handle any in-scope plan's state. Someone who typed both an
457
- # agent and a plan meant them to meet, so a pairing that cannot happen
458
- # is refused up front with the agent that would actually take each plan.
459
- #
460
- # @param agents [OpenLanes::Agents::Registry] already narrowed to the one agent
461
- # @param tree [OpenLanes::Plans::Tree]
462
- # @param plans [Array<OpenLanes::Plans::Ordinal>, nil]
463
- # @param name [String]
464
- # @return [void]
465
- def assignable!(agents, tree, plans, name)
466
- agent = agents.find(name)
467
- active = tree.subjects.select { |s|
468
- (plans.nil? || plans.include?(s.feature.ordinal)) &&
469
- !Plans::StateMachine::SETTLED.include?(s.status.key)
470
- }
471
- return if active.empty? || active.any? { |s| agent.handles?(s.status) }
472
-
473
- roster = OpenLanes::Agents.registry
474
- lines = active.map { |s|
475
- takers = OpenLanes::Agents::Routing.filter(roster.for_status(s.status), s).map(&:name)
476
- verb = takers.size == 1 ? "takes" : "take"
477
- " #{s.feature.ordinal} is #{s.status.emoji} #{s.status.label}" \
478
- "#{" - #{takers.join(" and ")} #{verb} it" unless takers.empty?}"
479
- }
480
- handled = agent.handles.map { |k| OpenLanes::Plans::STATUS_BY_KEY[k]&.then { |st| "#{st.emoji} #{st.label}" } || k }
481
- refuse("#{name} handles #{handled.join(", ")}, and no plan in scope is there:\n\n" \
482
- "#{lines.join("\n")}\n\nName the agent that takes these states, or drop --agent.",
483
- 65)
484
- end
485
-
486
- # @param attempts [Array<OpenLanes::Engine::Runner::Attempt>]
487
- # @return [Array<OpenLanes::Engine::Runner::Attempt>]
488
- def failures(attempts) = attempts.reject(&:ok)
489
-
490
- # The attempts and the bill, one blank line before each part that has
491
- # anything in it. `puts []` prints an empty line, so a run with no
492
- # attempts used to open its report with two blank lines and a third
493
- # before the tally.
494
- #
495
- # @param attempts [Array<OpenLanes::Engine::Runner::Attempt>]
496
- # @param tally [String, nil] nil prints none
497
- # @return [void]
498
- def puts_report(attempts, tally)
499
- lines = attempt_lines(attempts)
500
- puts("", *lines) unless lines.empty?
501
- puts("", tally) if tally
502
- end
503
-
504
- # The one thing this harness does that leaves the machine — pushing a
505
- # branch and opening its pull request — so it takes one more thing to
506
- # turn on than everything else here: not being a dry run is not enough,
507
- # isolation has to actually give each plan a branch of its own too.
508
- #
509
- # `nil` is how {Runner} is told to leave a finished worktree alone; it
510
- # is what `--no-git-push` asks for, and what a shared tree gets
511
- # by construction, since there is no separate branch there to push.
512
- #
513
- # @param root [String]
514
- # @param isolation [Symbol]
515
- # @param options [Hash]
516
- # @return [OpenLanes::Vcs::Publisher, nil]
517
- def publisher_for(root, isolation, options)
518
- if isolation != :worktree || options[:git_push] == false
519
- unless quiet?(options)
520
- warn("No pull request will be opened (#{isolation == :worktree ? "--no-git-push" : "--isolation shared"}), " \
521
- "so a finished build stays at 🟡 Building:\n🟢 Ready for Review needs an open pull request, and hansolo-reviewer reviews one.")
522
- end
523
- return nil
524
- end
525
-
526
- Vcs.publisher(root:, dry_run: dry_run?(options))
527
- end
528
-
529
- # One line per attempt: the plan, who ran, which of that agent's rounds
530
- # it was, what moved, and the note. There is no round header any more
531
- # because the loop has no rounds of its own: each agent counts its own
532
- # per plan, so two agents on one plan can be on different numbers.
533
- #
534
- # @param runner [OpenLanes::Engine::Runner]
535
- # @param attempts [Array<OpenLanes::Engine::Runner::Attempt>]
536
- # @param options [Hash]
537
- # @param seconds [Float] wall clock for the whole loop
538
- # @return [void]
539
- def report(runner, attempts, options, seconds: 0.0)
540
- # What the run cost, on STDOUT with the attempts it belongs to, so a run
541
- # redirected to a file keeps its bill. A dry run spent nothing and gets
542
- # none of this.
543
- puts_report(attempts, (Engine.tally(attempts:, seconds:).render unless dry_run?(options)))
544
-
545
- return if quiet?(options)
546
-
547
- if Execution::Control.quit?
548
- warn("Stopped from the keyboard — q. Unfinished plans keep their state; " \
549
- "re-run to resume where they stand.")
550
- end
551
-
552
- advanced = attempts.count(&:advanced?)
553
- blocked = runner.blocked
554
- summary = ["#{attempts.size} invocation#{"s" unless attempts.size == 1}", "#{advanced} advanced"]
555
- summary << (runner.isolated? ? "#{runner.jobs} at a time, one worktree each" : "serial, shared tree")
556
- summary << "#{blocked.size} blocked" unless blocked.empty?
557
- summary << "#{failures(attempts).size} failed" unless failures(attempts).empty?
558
-
559
- if dry_run?(options)
560
- warn("Dry run — no agent was invoked.\n#{summary.join(" · ")}\n\nRe-run without --dry-run.")
561
- elsif failures(attempts).empty?
562
- success("#{summary.join(" · ")}#{"\n\nEvery plan is done or deliberately parked." if runner.settled?}")
563
- else
564
- error("#{summary.join(" · ")}\n\n#{failures(attempts).map { |f| "#{f.ordinal} #{f.agent}: #{f.note}" }.join("\n")}")
565
- end
566
-
567
- return if blocked.empty?
568
-
569
- warn("#{blocked.size} plan#{"s" unless blocked.size == 1} need a human decision:\n" +
570
- blocked.map { |b| " #{b.feature.ordinal} #{b.status.emoji} #{b.feature.title} — see blocked.md" }.join("\n") +
571
- "\n\nWrite the answers into blocked.md, then: openlanes unblock " \
572
- "#{blocked.map { |b| b.feature.ordinal }.join(",")}")
573
- end
108
+ # @return [OpenLanes::Engine::RunWorkflow]
109
+ def workflow(tree, options) = Engine.run(tree:, origin:, **options)
574
110
  end
575
111
  end
576
112
  end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenLanes
4
+ module CLI
5
+ # `openlanes setup` — get this machine ready to run the factory: the
6
+ # gem's `Brewfile`, then the claude CLI, `gh auth` and Redis.
7
+ #
8
+ # Standalone, since a machine is ready or not whichever directory it
9
+ # was asked from.
10
+ class Setup < Base
11
+ standalone!
12
+ desc "Install the tools openlanes needs (brew bundle) and check claude, gh auth and Redis"
13
+
14
+ dry_run_option "Install nothing; list what would be installed and run the checks"
15
+ option :redis_url, desc: "Redis to check (default: .openlanes.yml redis_url, else $REDIS_URL, else #{Live::DEFAULT_URL})"
16
+
17
+ example [
18
+ " # install what is missing, then check",
19
+ "-n # list what would be installed, change nothing"
20
+ ]
21
+
22
+ # @param options [Hash]
23
+ # @return [void]
24
+ def call(**options)
25
+ quiet?(options)
26
+ machine = machine(options)
27
+ outcome = machine.call(dry_run: dry_run?(options))
28
+ preview(machine, outcome) if dry_run?(options)
29
+ $stdout.write(OpenLanes::Setup.render(outcome.checks))
30
+ refuse("This machine is not ready: run each fix above, then openlanes setup again.", 69) unless outcome.ok?
31
+ end
32
+
33
+ private
34
+
35
+ # A named seam, so a spec can stand in for brew, gh and Redis.
36
+ #
37
+ # @param options [Hash]
38
+ # @return [OpenLanes::Setup::Machine]
39
+ def machine(options) = OpenLanes::Setup.machine(redis_url: options[:redis_url])
40
+
41
+ # @return [void]
42
+ def preview(machine, outcome)
43
+ install = outcome.missing.empty? ? "nothing" : outcome.missing.join(", ")
44
+ warn("Dry run — nothing was installed.\n" \
45
+ "Would install: #{install}\n" \
46
+ "#{"Would run: #{machine.bundle_command.join(" ")}\n" unless outcome.missing.empty?}" \
47
+ "Checks: #{outcome.checks.map(&:name).join(", ")}")
48
+ end
49
+ end
50
+ end
51
+ end