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.
- checksums.yaml +4 -4
- data/Brewfile +42 -0
- data/agents/bb8-resolver.md +49 -0
- data/agents/c3po-operator.md +4 -0
- data/agents/chewie-verifier.md +85 -0
- data/agents/hansolo-reviewer.md +20 -15
- data/agents/lando-broker.md +81 -19
- data/agents/leah-researcher.md +6 -6
- data/agents/luke-backend.md +41 -20
- data/agents/{palpatine-planner.md → luthen-rael-planner.md} +15 -13
- data/agents/palpatine-risk-assessor.md +112 -0
- data/agents/r2d2-mechanic.md +5 -1
- data/agents/rey-frontend.md +38 -19
- data/agents/yoda-writer.md +7 -7
- data/evals/cases/chewie-verifier/verify-medium/fail/plan/plan.md +7 -0
- data/evals/cases/chewie-verifier/verify-medium/fail/plan/pull-requests.md +10 -0
- data/evals/cases/chewie-verifier/verify-medium/fail/plan/spec.md +5 -0
- data/evals/cases/chewie-verifier/verify-medium/fail/plan/verification/1/final.png +0 -0
- data/evals/cases/chewie-verifier/verify-medium/fail/plan/verification/1/report.md +7 -0
- data/evals/cases/chewie-verifier/verify-medium/fail/repo/bin/greet +1 -0
- data/evals/cases/chewie-verifier/verify-medium/fail/run.json +1 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/plan/plan.md +7 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/plan/pull-requests.md +10 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/plan/spec.md +5 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/plan/verification/1/final.png +0 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/plan/verification/1/report.md +14 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/plan/verification/1/step-01.png +0 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/repo/bin/greet +1 -0
- data/evals/cases/chewie-verifier/verify-medium/pass/run.json +1 -0
- data/evals/cases/chewie-verifier/verify-medium.yml +48 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/implementation-plan.md +5 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/plan.md +3 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/pull-requests.md +12 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/plan/spec.md +5 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/repo/lib/cart.rb +10 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/repo/spec/cart_spec.rb +9 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/fail/run.json +1 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/implementation-plan.md +5 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/plan.md +3 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/pull-requests.md +15 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/plan/spec.md +5 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/repo/lib/cart.rb +10 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/repo/spec/cart_spec.rb +9 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum/pass/run.json +1 -0
- data/evals/cases/hansolo-reviewer/coverage-minimum.yml +76 -0
- data/evals/cases/luthen-rael-planner/plan-deep/fail/plan/plan.md +8 -0
- data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/plan.md +2 -2
- data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep.yml +1 -1
- data/evals/cases/luthen-rael-planner/plan-fast/fail/plan/plan.md +12 -0
- data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/plan.md +2 -2
- data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast.yml +1 -1
- data/evals/cases/palpatine-risk-assessor/risk-medium/fail/plan/plan.md +20 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/fail/plan/pull-requests.md +5 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/fail/plan/spec.md +5 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/fail/repo/db/migrate/20261020120000_drop_legacy_email.rb +5 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/fail/run.json +1 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/pass/plan/plan.md +25 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/pass/plan/pull-requests.md +5 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/pass/plan/spec.md +5 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/pass/repo/db/migrate/20261020120000_drop_legacy_email.rb +5 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium/pass/run.json +1 -0
- data/evals/cases/palpatine-risk-assessor/risk-medium.yml +47 -0
- data/evals/cases/yoda-writer/spec-medium/pass/plan/spec.md +1 -1
- data/lib/openlanes/adapters/base.rb +18 -4
- data/lib/openlanes/adapters/capabilities.rb +29 -0
- data/lib/openlanes/adapters/claude.rb +14 -11
- data/lib/openlanes/adapters/codex.rb +9 -0
- data/lib/openlanes/adapters/pi.rb +10 -0
- data/lib/openlanes/adapters/stream.rb +145 -1
- data/lib/openlanes/adapters.rb +7 -0
- data/lib/openlanes/agents/agent.rb +4 -3
- data/lib/openlanes/agents/roster.rb +14 -2
- data/lib/openlanes/agents/routing.rb +43 -3
- data/lib/openlanes/apps/definition.rb +152 -0
- data/lib/openlanes/apps/framing.rb +114 -0
- data/lib/openlanes/apps/listing.rb +60 -0
- data/lib/openlanes/apps/ports.rb +168 -0
- data/lib/openlanes/apps/probe.rb +63 -0
- data/lib/openlanes/apps/process_spec.rb +39 -0
- data/lib/openlanes/apps/runner.rb +174 -0
- data/lib/openlanes/apps/status.rb +62 -0
- data/lib/openlanes/apps/supervisor.rb +277 -0
- data/lib/openlanes/apps/watcher.rb +50 -0
- data/lib/openlanes/apps.rb +41 -0
- data/lib/openlanes/cli/api/api.rb +10 -0
- data/lib/openlanes/cli/api/subcommands/docs.rb +63 -0
- data/lib/openlanes/cli/app/app.rb +31 -0
- data/lib/openlanes/cli/app/subcommands/start.rb +114 -0
- data/lib/openlanes/cli/app/subcommands/status.rb +38 -0
- data/lib/openlanes/cli/app/subcommands/stop.rb +44 -0
- data/lib/openlanes/cli/base.rb +89 -16
- data/lib/openlanes/cli/coverage/coverage.rb +68 -0
- data/lib/openlanes/cli/create/create.rb +11 -265
- data/lib/openlanes/cli/eval/eval.rb +4 -1
- data/lib/openlanes/cli/init/init.rb +39 -2
- data/lib/openlanes/cli/linear/subcommands/import.rb +1 -1
- data/lib/openlanes/cli/linear/subcommands/projects.rb +1 -1
- data/lib/openlanes/cli/list_plans/list_plans.rb +8 -2
- data/lib/openlanes/cli/mail/subcommands/ack.rb +52 -0
- data/lib/openlanes/cli/mail/subcommands/render.rb +31 -0
- data/lib/openlanes/cli/mail/subcommands/send.rb +26 -0
- data/lib/openlanes/cli/resync/subcommands/dirs.rb +53 -12
- data/lib/openlanes/cli/resync/subcommands/prs.rb +8 -69
- data/lib/openlanes/cli/review/review.rb +72 -0
- data/lib/openlanes/cli/run/run.rb +22 -486
- data/lib/openlanes/cli/setup/setup.rb +51 -0
- data/lib/openlanes/cli/start/start.rb +7 -51
- data/lib/openlanes/cli/state/state.rb +1 -1
- data/lib/openlanes/cli/state/subcommands/resume.rb +61 -0
- data/lib/openlanes/cli/state/subcommands/sign.rb +1 -1
- data/lib/openlanes/cli/unblock/unblock.rb +11 -205
- data/lib/openlanes/cli/web/web.rb +84 -8
- data/lib/openlanes/cli/worktree/worktree.rb +1 -1
- data/lib/openlanes/cli/worktree/worktree_prune.rb +77 -0
- data/lib/openlanes/cli.rb +37 -2
- data/lib/openlanes/coverage/cobertura.rb +49 -0
- data/lib/openlanes/coverage/config.rb +194 -0
- data/lib/openlanes/coverage/istanbul.rb +31 -0
- data/lib/openlanes/coverage/lcov.rb +38 -0
- data/lib/openlanes/coverage/report.rb +71 -0
- data/lib/openlanes/coverage/simplecov.rb +70 -0
- data/lib/openlanes/coverage.rb +33 -0
- data/lib/openlanes/engine/agent_locks.rb +231 -0
- data/lib/openlanes/engine/arbitration.rb +25 -0
- data/lib/openlanes/engine/board.rb +36 -5
- data/lib/openlanes/engine/conversions.rb +160 -0
- data/lib/openlanes/engine/coverage_gate.rb +217 -0
- data/lib/openlanes/engine/dispatcher.rb +1175 -117
- data/lib/openlanes/engine/event_journal/replay.rb +96 -0
- data/lib/openlanes/engine/event_journal.rb +148 -0
- data/lib/openlanes/engine/extensions.rb +271 -0
- data/lib/openlanes/engine/merging.rb +459 -0
- data/lib/openlanes/engine/narrator.rb +6 -6
- data/lib/openlanes/engine/plan_locks.rb +114 -0
- data/lib/openlanes/engine/pr_outcomes.rb +161 -0
- data/lib/openlanes/engine/pr_watch.rb +83 -0
- data/lib/openlanes/engine/progress_log.rb +12 -120
- data/lib/openlanes/engine/quality_question.rb +125 -0
- data/lib/openlanes/engine/rebase.rb +200 -0
- data/lib/openlanes/engine/run_workflow.rb +776 -0
- data/lib/openlanes/engine/runner.rb +186 -15
- data/lib/openlanes/engine/start_workflow.rb +77 -0
- data/lib/openlanes/engine/state_file.rb +101 -34
- data/lib/openlanes/engine/tally.rb +1 -1
- data/lib/openlanes/engine/verification/app_session.rb +104 -0
- data/lib/openlanes/engine/verification/driver.rb +314 -0
- data/lib/openlanes/engine/verification/outcome.rb +516 -0
- data/lib/openlanes/engine/verification/report.rb +95 -0
- data/lib/openlanes/engine/verification/round.rb +100 -0
- data/lib/openlanes/engine/verification/screenshots.rb +120 -0
- data/lib/openlanes/engine/verification.rb +57 -0
- data/lib/openlanes/engine.rb +30 -1
- data/lib/openlanes/execution/boundary.rb +212 -0
- data/lib/openlanes/execution/child.rb +4 -2
- data/lib/openlanes/execution/clock.rb +36 -6
- data/lib/openlanes/execution/control.rb +32 -0
- data/lib/openlanes/execution/executor.rb +114 -35
- data/lib/openlanes/execution/process_start.rb +63 -0
- data/lib/openlanes/execution/prompt.rb +223 -34
- data/lib/openlanes/execution/transcript.rb +159 -8
- data/lib/openlanes/execution.rb +21 -0
- data/lib/openlanes/lifecycle/adoption.rb +25 -8
- data/lib/openlanes/lifecycle/aging.rb +166 -0
- data/lib/openlanes/lifecycle/allocator.rb +216 -0
- data/lib/openlanes/lifecycle/brief.rb +32 -2
- data/lib/openlanes/lifecycle/completion.rb +12 -6
- data/lib/openlanes/lifecycle/create_workflow.rb +272 -0
- data/lib/openlanes/lifecycle/creator.rb +17 -13
- data/lib/openlanes/lifecycle/lanes.rb +1 -1
- data/lib/openlanes/lifecycle/resync.rb +170 -42
- data/lib/openlanes/lifecycle/unblock_workflow.rb +234 -0
- data/lib/openlanes/lifecycle/unblocker.rb +76 -2
- data/lib/openlanes/lifecycle.rb +37 -1
- data/lib/openlanes/linear/mapping.rb +4 -1
- data/lib/openlanes/linear/unit.rb +1 -1
- data/lib/openlanes/live/chat.rb +60 -11
- data/lib/openlanes/live/choice_converter.rb +166 -0
- data/lib/openlanes/live/choice_judge.rb +109 -0
- data/lib/openlanes/live/claims.rb +9 -1
- data/lib/openlanes/live/command.rb +13 -10
- data/lib/openlanes/live/commands.rb +217 -30
- data/lib/openlanes/live/copilot/slash.rb +82 -0
- data/lib/openlanes/live/copilot.rb +38 -4
- data/lib/openlanes/live/event_bus/base.rb +52 -0
- data/lib/openlanes/live/event_bus/memory_bus.rb +14 -0
- data/lib/openlanes/live/event_bus/redis_bus.rb +10 -0
- data/lib/openlanes/live/event_bus/transaction.rb +27 -0
- data/lib/openlanes/live/event_bus.rb +29 -0
- data/lib/openlanes/live/interviewer.rb +146 -0
- data/lib/openlanes/live/keys.rb +56 -0
- data/lib/openlanes/live/mail.rb +143 -0
- data/lib/openlanes/live/memory_store.rb +12 -1
- data/lib/openlanes/live/news.rb +61 -0
- data/lib/openlanes/live/node.rb +20 -0
- data/lib/openlanes/live/outage.rb +225 -0
- data/lib/openlanes/live/outage_report.rb +89 -0
- data/lib/openlanes/live/publisher.rb +42 -2
- data/lib/openlanes/live/run_record.rb +39 -1
- data/lib/openlanes/live/run_state.rb +19 -2
- data/lib/openlanes/live/session.rb +31 -3
- data/lib/openlanes/live/snapshot.rb +103 -42
- data/lib/openlanes/live/stations.rb +4 -4
- data/lib/openlanes/live/store.rb +18 -1
- data/lib/openlanes/live/subscriber.rb +22 -2
- data/lib/openlanes/live.rb +66 -1
- data/lib/openlanes/plans/blocked_file.rb +117 -0
- data/lib/openlanes/plans/choices.rb +228 -0
- data/lib/openlanes/plans/dependencies.rb +304 -0
- data/lib/openlanes/plans/feature.rb +75 -16
- data/lib/openlanes/plans/journal.rb +169 -0
- data/lib/openlanes/plans/last_known_state.rb +82 -0
- data/lib/openlanes/plans/lock.rb +171 -0
- data/lib/openlanes/plans/mailbox.rb +145 -4
- data/lib/openlanes/plans/plan_state.rb +590 -9
- data/lib/openlanes/plans/pull_request_machine.rb +163 -0
- data/lib/openlanes/plans/review_label.rb +139 -0
- data/lib/openlanes/plans/spec.rb +239 -3
- data/lib/openlanes/plans/state_machine.rb +63 -30
- data/lib/openlanes/plans/status.rb +60 -11
- data/lib/openlanes/plans/subject.rb +4 -0
- data/lib/openlanes/plans/tree.rb +101 -10
- data/lib/openlanes/plans/verdict.rb +124 -0
- data/lib/openlanes/plans.rb +19 -0
- data/lib/openlanes/presentation/api_docs.rb +76 -0
- data/lib/openlanes/presentation/documentation.rb +105 -12
- data/lib/openlanes/presentation/pr_changes.rb +90 -0
- data/lib/openlanes/presentation/reporter.rb +64 -5
- data/lib/openlanes/presentation.rb +20 -1
- data/lib/openlanes/setup/check.rb +16 -0
- data/lib/openlanes/setup/machine.rb +179 -0
- data/lib/openlanes/setup.rb +34 -0
- data/lib/openlanes/support/clock.rb +57 -0
- data/lib/openlanes/support/config.rb +318 -6
- data/lib/openlanes/support/log.rb +206 -0
- data/lib/openlanes/support/refusal.rb +15 -0
- data/lib/openlanes/support/runtime.rb +61 -0
- data/lib/openlanes/support/spawner.rb +51 -0
- data/lib/openlanes/support/ui.rb +39 -24
- data/lib/openlanes/vcs/ci_gate.rb +31 -0
- data/lib/openlanes/vcs/github.rb +362 -12
- data/lib/openlanes/vcs/label_migration.rb +132 -0
- data/lib/openlanes/vcs/label_sync.rb +75 -0
- data/lib/openlanes/vcs/publisher.rb +226 -8
- data/lib/openlanes/vcs/refresh.rb +337 -0
- data/lib/openlanes/vcs/rename_date.rb +83 -0
- data/lib/openlanes/vcs/review.rb +66 -0
- data/lib/openlanes/vcs/worktree.rb +167 -6
- data/lib/openlanes/vcs.rb +18 -0
- data/lib/openlanes/version.rb +1 -1
- data/lib/openlanes/web/admin_auth.rb +104 -0
- data/lib/openlanes/web/app.rb +115 -16
- data/lib/openlanes/web/context.rb +15 -9
- data/lib/openlanes/web/demo.rb +29 -14
- data/lib/openlanes/web/demo_board.rb +63 -5
- data/lib/openlanes/web/events.rb +86 -7
- data/lib/openlanes/web/launcher.rb +69 -7
- data/lib/openlanes/web/listen.rb +133 -0
- data/lib/openlanes/web/plan_files.rb +136 -0
- data/lib/openlanes/web/request_log.rb +108 -0
- data/lib/openlanes/web/server.rb +29 -10
- data/lib/openlanes/web.rb +6 -4
- data/lib/openlanes.rb +45 -7
- data/openlanes.gemspec +9 -4
- data/schemas/journal-event.schema.json +72 -0
- data/schemas/plan-state.schema.json +163 -2
- data/skills/openlanes/SKILL.md +2 -2
- data/skills/openlanes-documents/SKILL.md +4 -4
- data/skills/openlanes-documents/references/blocked-template.md +2 -2
- data/skills/openlanes-documents/references/closing-templates.md +1 -1
- data/skills/openlanes-documents/references/plan-template.md +12 -4
- data/skills/openlanes-documents/references/retroactive-spec.md +1 -1
- data/skills/openlanes-run/SKILL.md +5 -5
- data/skills/openlanes-spec/SKILL.md +1 -1
- data/skills/openlanes-status/SKILL.md +1 -1
- data/web/dist/assets/{index-BFPI-zXI.js → index-690ayLS4.js} +2 -2
- data/web/dist/assets/index-6ZmW4slI.js +199 -0
- data/web/dist/assets/{index-bpsFIpXE.js → index-B5KzlXp1.js} +2 -2
- data/web/dist/assets/{index-DtA46i32.js → index-BAo_v9bU.js} +2 -2
- data/web/dist/assets/{index-CnJfB0l2.js → index-BDm7g-xG.js} +2 -2
- data/web/dist/assets/{index-DXgeajd6.js → index-BFH9bC7v.js} +2 -2
- data/web/dist/assets/{index-DH0gDlee.js → index-BVHPV7z4.js} +2 -2
- data/web/dist/assets/{index-DaSjQ-H4.js → index-B_CPqjnA.js} +2 -2
- data/web/dist/assets/{index-Dbxvk-EC.js → index-BhwBH5ct.js} +2 -2
- data/web/dist/assets/{index-6MZkmh3k.js → index-Bq5AdwEt.js} +2 -2
- data/web/dist/assets/{index-B5CKJPm-.js → index-CAW6ClM2.js} +2 -2
- data/web/dist/assets/index-Cp86u27u.css +1 -0
- data/web/dist/assets/{index-CnvkZu5Y.js → index-Culm4pMO.js} +2 -2
- data/web/dist/assets/{index-IqD8mBos.js → index-DElDJfp1.js} +2 -2
- data/web/dist/assets/{index-C3zc4gFe.js → index-Dja7osNW.js} +2 -2
- data/web/dist/assets/{index-C2jwoWVV.js → index-DjhU3FzU.js} +2 -2
- data/web/dist/assets/{index-pvJi-JJO.js → index-Dutbxj4o.js} +2 -2
- data/web/dist/assets/{index-BF6QYroq.js → index-RkDhPMDt.js} +2 -2
- data/web/dist/assets/{index-DbueqOK5.js → index-_mptZjlC.js} +2 -2
- data/web/dist/index.html +2 -2
- data/web/src/api/fixtures/board.json +203 -28
- metadata +1053 -889
- data/bin/factory-e2e +0 -157
- data/bin/plan-number +0 -164
- data/bin/setup +0 -26
- data/evals/cases/palpatine-planner/plan-deep/fail/plan/plan.md +0 -8
- data/evals/cases/palpatine-planner/plan-fast/fail/plan/plan.md +0 -12
- data/web/dist/assets/index-BYJCWlk0.js +0 -198
- data/web/dist/assets/index-CjInBi5X.css +0 -1
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/fail/plan/plan-backend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/fail/plan/spec.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/fail/run.json +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/plan-backend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/plan-frontend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/plan/spec.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-deep/pass/run.json +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/plan/plan-backend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/plan/plan-frontend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/plan/spec.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/fail/run.json +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/plan-backend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/plan-frontend.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/plan/spec.md +0 -0
- /data/evals/cases/{palpatine-planner → luthen-rael-planner}/plan-fast/pass/run.json +0 -0
- /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
|
-
|
|
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
|
|
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
|
-
"--
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
# @
|
|
264
|
-
|
|
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
|