@ambystech/ambykit 1.5.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +190 -1
- package/README.md +12 -7
- package/dist/cli/add.js +9 -0
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/analyze.js +25 -4
- package/dist/cli/analyze.js.map +1 -1
- package/dist/cli/base-command.d.ts +8 -0
- package/dist/cli/base-command.js +30 -0
- package/dist/cli/base-command.js.map +1 -1
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.js +38 -4
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/dashboard.d.ts +5 -2
- package/dist/cli/dashboard.js +95 -24
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/edit.d.ts +17 -0
- package/dist/cli/edit.js +71 -0
- package/dist/cli/edit.js.map +1 -0
- package/dist/cli/fleet.d.ts +2 -0
- package/dist/cli/fleet.js +23 -1
- package/dist/cli/fleet.js.map +1 -1
- package/dist/cli/index.d.ts +1 -5
- package/dist/cli/index.js +21 -109
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.js +9 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lane.d.ts +38 -3
- package/dist/cli/lane.js +124 -108
- package/dist/cli/lane.js.map +1 -1
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +111 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/mcp.d.ts +2 -0
- package/dist/cli/mcp.js +4 -0
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/migrate.d.ts +17 -0
- package/dist/cli/migrate.js +67 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/node-guard.d.ts +4 -0
- package/dist/cli/node-guard.js +12 -0
- package/dist/cli/node-guard.js.map +1 -0
- package/dist/cli/run-budget.d.ts +25 -0
- package/dist/cli/run-budget.js +112 -0
- package/dist/cli/run-budget.js.map +1 -0
- package/dist/cli/run-control.d.ts +40 -0
- package/dist/cli/run-control.js +161 -0
- package/dist/cli/run-control.js.map +1 -0
- package/dist/cli/run-files.d.ts +96 -0
- package/dist/cli/run-files.js +120 -0
- package/dist/cli/run-files.js.map +1 -0
- package/dist/cli/run-fleet-control.d.ts +16 -0
- package/dist/cli/run-fleet-control.js +23 -0
- package/dist/cli/run-fleet-control.js.map +1 -0
- package/dist/cli/run-fleet-loop.d.ts +77 -0
- package/dist/cli/run-fleet-loop.js +156 -0
- package/dist/cli/run-fleet-loop.js.map +1 -0
- package/dist/cli/run-fleet-merge.d.ts +22 -0
- package/dist/cli/run-fleet-merge.js +69 -0
- package/dist/cli/run-fleet-merge.js.map +1 -0
- package/dist/cli/run-fleet-prepare.d.ts +35 -0
- package/dist/cli/run-fleet-prepare.js +58 -0
- package/dist/cli/run-fleet-prepare.js.map +1 -0
- package/dist/cli/run-fleet.d.ts +28 -0
- package/dist/cli/run-fleet.js +382 -0
- package/dist/cli/run-fleet.js.map +1 -0
- package/dist/cli/run-gates.d.ts +25 -0
- package/dist/cli/run-gates.js +45 -0
- package/dist/cli/run-gates.js.map +1 -0
- package/dist/cli/run-launch.d.ts +17 -0
- package/dist/cli/run-launch.js +106 -0
- package/dist/cli/run-launch.js.map +1 -0
- package/dist/cli/run-loop.d.ts +39 -0
- package/dist/cli/run-loop.js +197 -0
- package/dist/cli/run-loop.js.map +1 -0
- package/dist/cli/run-merger.d.ts +18 -0
- package/dist/cli/run-merger.js +126 -0
- package/dist/cli/run-merger.js.map +1 -0
- package/dist/cli/run-phase-check.d.ts +32 -0
- package/dist/cli/run-phase-check.js +173 -0
- package/dist/cli/run-phase-check.js.map +1 -0
- package/dist/cli/run-plan.d.ts +28 -0
- package/dist/cli/run-plan.js +62 -0
- package/dist/cli/run-plan.js.map +1 -0
- package/dist/cli/run-process.d.ts +45 -0
- package/dist/cli/run-process.js +111 -0
- package/dist/cli/run-process.js.map +1 -0
- package/dist/cli/run-protocol-prompts.d.ts +17 -0
- package/dist/cli/run-protocol-prompts.js +63 -0
- package/dist/cli/run-protocol-prompts.js.map +1 -0
- package/dist/cli/run-protocol.d.ts +17 -0
- package/dist/cli/run-protocol.js +128 -0
- package/dist/cli/run-protocol.js.map +1 -0
- package/dist/cli/run-script.d.ts +11 -0
- package/dist/cli/run-script.js +67 -0
- package/dist/cli/run-script.js.map +1 -0
- package/dist/cli/run-session.d.ts +93 -0
- package/dist/cli/run-session.js +21 -0
- package/dist/cli/run-session.js.map +1 -0
- package/dist/cli/run-stages.d.ts +11 -0
- package/dist/cli/run-stages.js +34 -0
- package/dist/cli/run-stages.js.map +1 -0
- package/dist/cli/run-supervisor.d.ts +20 -0
- package/dist/cli/run-supervisor.js +167 -0
- package/dist/cli/run-supervisor.js.map +1 -0
- package/dist/cli/run.d.ts +81 -0
- package/dist/cli/run.js +437 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/sync.js +10 -5
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/ui/dashboard/empty-state.d.ts +5 -0
- package/dist/cli/ui/dashboard/empty-state.js +7 -0
- package/dist/cli/ui/dashboard/empty-state.js.map +1 -1
- package/dist/cli/ui/dashboard/filter-line.d.ts +13 -0
- package/dist/cli/ui/dashboard/filter-line.js +20 -0
- package/dist/cli/ui/dashboard/filter-line.js.map +1 -0
- package/dist/cli/ui/dashboard/fleet-tab.d.ts +25 -0
- package/dist/cli/ui/dashboard/fleet-tab.js +91 -0
- package/dist/cli/ui/dashboard/fleet-tab.js.map +1 -0
- package/dist/cli/ui/dashboard/fleet-tokens.d.ts +404 -0
- package/dist/cli/ui/dashboard/fleet-tokens.js +405 -0
- package/dist/cli/ui/dashboard/fleet-tokens.js.map +1 -0
- package/dist/cli/ui/dashboard/fleet-view.d.ts +51 -0
- package/dist/cli/ui/dashboard/fleet-view.js +211 -0
- package/dist/cli/ui/dashboard/fleet-view.js.map +1 -0
- package/dist/cli/ui/dashboard/help-overlay.d.ts +3 -1
- package/dist/cli/ui/dashboard/help-overlay.js +36 -3
- package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
- package/dist/cli/ui/dashboard/layout.d.ts +15 -0
- package/dist/cli/ui/dashboard/layout.js +22 -0
- package/dist/cli/ui/dashboard/layout.js.map +1 -1
- package/dist/cli/ui/dashboard/metrics-panel.d.ts +15 -0
- package/dist/cli/ui/dashboard/metrics-panel.js +143 -0
- package/dist/cli/ui/dashboard/metrics-panel.js.map +1 -0
- package/dist/cli/ui/dashboard/tab-bar.d.ts +14 -0
- package/dist/cli/ui/dashboard/tab-bar.js +37 -0
- package/dist/cli/ui/dashboard/tab-bar.js.map +1 -0
- package/dist/cli/ui/dashboard/tab-frame.d.ts +43 -0
- package/dist/cli/ui/dashboard/tab-frame.js +68 -0
- package/dist/cli/ui/dashboard/tab-frame.js.map +1 -0
- package/dist/cli/ui/dashboard/tab-tokens.d.ts +569 -0
- package/dist/cli/ui/dashboard/tab-tokens.js +570 -0
- package/dist/cli/ui/dashboard/tab-tokens.js.map +1 -0
- package/dist/cli/ui/icons.d.ts +22 -0
- package/dist/cli/ui/icons.js +17 -0
- package/dist/cli/ui/icons.js.map +1 -0
- package/dist/cli/ui/interactive/fleet-actions.d.ts +24 -0
- package/dist/cli/ui/interactive/fleet-actions.js +30 -0
- package/dist/cli/ui/interactive/fleet-actions.js.map +1 -0
- package/dist/cli/ui/interactive/fleet.d.ts +54 -0
- package/dist/cli/ui/interactive/fleet.js +98 -0
- package/dist/cli/ui/interactive/fleet.js.map +1 -0
- package/dist/cli/ui/interactive/fullscreen.js +38 -10
- package/dist/cli/ui/interactive/fullscreen.js.map +1 -1
- package/dist/cli/ui/interactive/list-filter.d.ts +25 -0
- package/dist/cli/ui/interactive/list-filter.js +38 -0
- package/dist/cli/ui/interactive/list-filter.js.map +1 -0
- package/dist/cli/ui/interactive/live.d.ts +8 -0
- package/dist/cli/ui/interactive/live.js +13 -0
- package/dist/cli/ui/interactive/live.js.map +1 -1
- package/dist/cli/ui/interactive/overview.d.ts +52 -3
- package/dist/cli/ui/interactive/overview.js +354 -15
- package/dist/cli/ui/interactive/overview.js.map +1 -1
- package/dist/cli/ui/interactive/tabs.d.ts +15 -0
- package/dist/cli/ui/interactive/tabs.js +27 -0
- package/dist/cli/ui/interactive/tabs.js.map +1 -0
- package/dist/cli/ui/tool-options.d.ts +5 -1
- package/dist/cli/ui/tool-options.js +9 -3
- package/dist/cli/ui/tool-options.js.map +1 -1
- package/dist/cli/update.js +13 -2
- package/dist/cli/update.js.map +1 -1
- package/dist/core/analyze.d.ts +11 -0
- package/dist/core/analyze.js +33 -3
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/burndown.d.ts +1 -1
- package/dist/core/burndown.js +2 -2
- package/dist/core/burndown.js.map +1 -1
- package/dist/core/checkouts.js +3 -2
- package/dist/core/checkouts.js.map +1 -1
- package/dist/core/config-schema.d.ts +45 -0
- package/dist/core/config-schema.js +63 -0
- package/dist/core/config-schema.js.map +1 -0
- package/dist/core/config.d.ts +6 -0
- package/dist/core/config.js +16 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/dashboard.js +3 -2
- package/dist/core/dashboard.js.map +1 -1
- package/dist/core/decisions.d.ts +12 -1
- package/dist/core/decisions.js +7 -2
- package/dist/core/decisions.js.map +1 -1
- package/dist/core/deprecation.d.ts +15 -0
- package/dist/core/deprecation.js +27 -0
- package/dist/core/deprecation.js.map +1 -0
- package/dist/core/features.js +11 -5
- package/dist/core/features.js.map +1 -1
- package/dist/core/fleet/fleet-text.d.ts +2 -0
- package/dist/core/fleet/fleet-text.js +41 -0
- package/dist/core/fleet/fleet-text.js.map +1 -0
- package/dist/core/fleet/fleet-view.d.ts +35 -0
- package/dist/core/fleet/fleet-view.js +43 -0
- package/dist/core/fleet/fleet-view.js.map +1 -0
- package/dist/core/fleet/fleets.d.ts +18 -0
- package/dist/core/fleet/fleets.js +64 -0
- package/dist/core/fleet/fleets.js.map +1 -0
- package/dist/core/fleet/flow-input.js +3 -4
- package/dist/core/fleet/flow-input.js.map +1 -1
- package/dist/core/fleet/index.d.ts +3 -0
- package/dist/core/fleet/index.js +3 -0
- package/dist/core/fleet/index.js.map +1 -1
- package/dist/core/fleet/runs.d.ts +18 -2
- package/dist/core/fleet/runs.js +67 -16
- package/dist/core/fleet/runs.js.map +1 -1
- package/dist/core/fleet-plan/budget.d.ts +18 -0
- package/dist/core/fleet-plan/budget.js +13 -0
- package/dist/core/fleet-plan/budget.js.map +1 -0
- package/dist/core/fleet-plan/contain.d.ts +10 -0
- package/dist/core/fleet-plan/contain.js +37 -0
- package/dist/core/fleet-plan/contain.js.map +1 -0
- package/dist/core/fleet-plan/format.d.ts +4 -0
- package/dist/core/fleet-plan/format.js +52 -0
- package/dist/core/fleet-plan/format.js.map +1 -0
- package/dist/core/fleet-plan/index.d.ts +7 -0
- package/dist/core/fleet-plan/index.js +8 -0
- package/dist/core/fleet-plan/index.js.map +1 -0
- package/dist/core/fleet-plan/order.d.ts +30 -0
- package/dist/core/fleet-plan/order.js +96 -0
- package/dist/core/fleet-plan/order.js.map +1 -0
- package/dist/core/fleet-plan/ownership.d.ts +12 -0
- package/dist/core/fleet-plan/ownership.js +36 -0
- package/dist/core/fleet-plan/ownership.js.map +1 -0
- package/dist/core/fleet-plan/plan.d.ts +23 -0
- package/dist/core/fleet-plan/plan.js +40 -0
- package/dist/core/fleet-plan/plan.js.map +1 -0
- package/dist/core/fleet-plan/read.d.ts +19 -0
- package/dist/core/fleet-plan/read.js +35 -0
- package/dist/core/fleet-plan/read.js.map +1 -0
- package/dist/core/fleet-plan/schedule.d.ts +15 -0
- package/dist/core/fleet-plan/schedule.js +27 -0
- package/dist/core/fleet-plan/schedule.js.map +1 -0
- package/dist/core/fleet-plan/select.d.ts +20 -0
- package/dist/core/fleet-plan/select.js +64 -0
- package/dist/core/fleet-plan/select.js.map +1 -0
- package/dist/core/fleet-plan/types.d.ts +123 -0
- package/dist/core/fleet-plan/types.js +2 -0
- package/dist/core/fleet-plan/types.js.map +1 -0
- package/dist/core/fleet-view/derive.d.ts +14 -0
- package/dist/core/fleet-view/derive.js +54 -0
- package/dist/core/fleet-view/derive.js.map +1 -0
- package/dist/core/fleet-view/group.d.ts +51 -0
- package/dist/core/fleet-view/group.js +73 -0
- package/dist/core/fleet-view/group.js.map +1 -0
- package/dist/core/fleet-view/json.d.ts +37 -0
- package/dist/core/fleet-view/json.js +25 -0
- package/dist/core/fleet-view/json.js.map +1 -0
- package/dist/core/fleet-view/read.d.ts +8 -0
- package/dist/core/fleet-view/read.js +44 -0
- package/dist/core/fleet-view/read.js.map +1 -0
- package/dist/core/fleet-view/types.d.ts +52 -0
- package/dist/core/fleet-view/types.js +2 -0
- package/dist/core/fleet-view/types.js.map +1 -0
- package/dist/core/graph-format.d.ts +2 -0
- package/dist/core/graph-format.js +4 -3
- package/dist/core/graph-format.js.map +1 -1
- package/dist/core/graph-types.d.ts +4 -0
- package/dist/core/graph.js +38 -1
- package/dist/core/graph.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/lane-merge.d.ts +29 -0
- package/dist/core/lane-merge.js +105 -0
- package/dist/core/lane-merge.js.map +1 -0
- package/dist/core/lanes.d.ts +53 -0
- package/dist/core/lanes.js +131 -0
- package/dist/core/lanes.js.map +1 -1
- package/dist/core/legacy.d.ts +2 -1
- package/dist/core/legacy.js +7 -2
- package/dist/core/legacy.js.map +1 -1
- package/dist/core/markers.d.ts +7 -0
- package/dist/core/markers.js +3 -2
- package/dist/core/markers.js.map +1 -1
- package/dist/core/metrics/cycle.d.ts +3 -0
- package/dist/core/metrics/cycle.js +47 -0
- package/dist/core/metrics/cycle.js.map +1 -0
- package/dist/core/metrics/gap.d.ts +9 -0
- package/dist/core/metrics/gap.js +35 -0
- package/dist/core/metrics/gap.js.map +1 -0
- package/dist/core/metrics/index.d.ts +21 -0
- package/dist/core/metrics/index.js +67 -0
- package/dist/core/metrics/index.js.map +1 -0
- package/dist/core/metrics/model.d.ts +23 -0
- package/dist/core/metrics/model.js +46 -0
- package/dist/core/metrics/model.js.map +1 -0
- package/dist/core/metrics/revisions.d.ts +22 -0
- package/dist/core/metrics/revisions.js +88 -0
- package/dist/core/metrics/revisions.js.map +1 -0
- package/dist/core/metrics/types.d.ts +74 -0
- package/dist/core/metrics/types.js +3 -0
- package/dist/core/metrics/types.js.map +1 -0
- package/dist/core/migrate/convert-spec.d.ts +19 -0
- package/dist/core/migrate/convert-spec.js +99 -0
- package/dist/core/migrate/convert-spec.js.map +1 -0
- package/dist/core/migrate/convert-tasks.d.ts +16 -0
- package/dist/core/migrate/convert-tasks.js +121 -0
- package/dist/core/migrate/convert-tasks.js.map +1 -0
- package/dist/core/migrate/run.d.ts +36 -0
- package/dist/core/migrate/run.js +178 -0
- package/dist/core/migrate/run.js.map +1 -0
- package/dist/core/migrate/safety.d.ts +33 -0
- package/dist/core/migrate/safety.js +199 -0
- package/dist/core/migrate/safety.js.map +1 -0
- package/dist/core/migrate/summary.d.ts +36 -0
- package/dist/core/migrate/summary.js +140 -0
- package/dist/core/migrate/summary.js.map +1 -0
- package/dist/core/moved-targets.d.ts +73 -8
- package/dist/core/moved-targets.js +79 -1
- package/dist/core/moved-targets.js.map +1 -1
- package/dist/core/overview-types.d.ts +7 -0
- package/dist/core/overview-types.js.map +1 -1
- package/dist/core/overview.js +4 -0
- package/dist/core/overview.js.map +1 -1
- package/dist/core/query.js +3 -2
- package/dist/core/query.js.map +1 -1
- package/dist/core/run-gate-actions.d.ts +51 -0
- package/dist/core/run-gate-actions.js +105 -0
- package/dist/core/run-gate-actions.js.map +1 -0
- package/dist/core/run-launch-plan.d.ts +53 -0
- package/dist/core/run-launch-plan.js +32 -0
- package/dist/core/run-launch-plan.js.map +1 -0
- package/dist/core/run-prompt.d.ts +89 -0
- package/dist/core/run-prompt.js +73 -0
- package/dist/core/run-prompt.js.map +1 -0
- package/dist/core/run-result.d.ts +42 -0
- package/dist/core/run-result.js +163 -0
- package/dist/core/run-result.js.map +1 -0
- package/dist/core/run-review.d.ts +50 -0
- package/dist/core/run-review.js +20 -0
- package/dist/core/run-review.js.map +1 -0
- package/dist/core/run-schedule.d.ts +23 -0
- package/dist/core/run-schedule.js +40 -0
- package/dist/core/run-schedule.js.map +1 -0
- package/dist/core/run-stability.d.ts +23 -0
- package/dist/core/run-stability.js +38 -0
- package/dist/core/run-stability.js.map +1 -0
- package/dist/core/run-supervise.d.ts +71 -0
- package/dist/core/run-supervise.js +61 -0
- package/dist/core/run-supervise.js.map +1 -0
- package/dist/core/runners.d.ts +114 -0
- package/dist/core/runners.js +146 -0
- package/dist/core/runners.js.map +1 -0
- package/dist/core/sibling-reads.d.ts +41 -0
- package/dist/core/sibling-reads.js +100 -0
- package/dist/core/sibling-reads.js.map +1 -0
- package/dist/core/spec-format/blocks.d.ts +19 -0
- package/dist/core/spec-format/blocks.js +58 -0
- package/dist/core/spec-format/blocks.js.map +1 -0
- package/dist/core/spec-format/detect.d.ts +14 -0
- package/dist/core/spec-format/detect.js +30 -0
- package/dist/core/spec-format/detect.js.map +1 -0
- package/dist/core/spec-format/dispatch.d.ts +13 -0
- package/dist/core/spec-format/dispatch.js +64 -0
- package/dist/core/spec-format/dispatch.js.map +1 -0
- package/dist/core/spec-format/frontmatter.d.ts +18 -0
- package/dist/core/spec-format/frontmatter.js +37 -0
- package/dist/core/spec-format/frontmatter.js.map +1 -0
- package/dist/core/spec-format/legacy.d.ts +40 -0
- package/dist/core/spec-format/legacy.js +91 -0
- package/dist/core/spec-format/legacy.js.map +1 -0
- package/dist/core/spec-format/meta.d.ts +3 -0
- package/dist/core/spec-format/meta.js +24 -0
- package/dist/core/spec-format/meta.js.map +1 -0
- package/dist/core/spec-format/model.d.ts +50 -0
- package/dist/core/spec-format/model.js +9 -0
- package/dist/core/spec-format/model.js.map +1 -0
- package/dist/core/spec-format/read-spec.d.ts +4 -0
- package/dist/core/spec-format/read-spec.js +102 -0
- package/dist/core/spec-format/read-spec.js.map +1 -0
- package/dist/core/spec-format/read-tasks.d.ts +2 -0
- package/dist/core/spec-format/read-tasks.js +146 -0
- package/dist/core/spec-format/read-tasks.js.map +1 -0
- package/dist/core/spec-format/write.d.ts +23 -0
- package/dist/core/spec-format/write.js +382 -0
- package/dist/core/spec-format/write.js.map +1 -0
- package/dist/core/subagents.js +0 -2
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/tasks-edit.d.ts +4 -1
- package/dist/core/tasks-edit.js +19 -6
- package/dist/core/tasks-edit.js.map +1 -1
- package/dist/core/types.d.ts +21 -0
- package/dist/emitters/index.d.ts +0 -4
- package/dist/emitters/index.js +0 -10
- package/dist/emitters/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins/api.d.ts +14 -8
- package/dist/plugins/api.js +9 -8
- package/dist/plugins/api.js.map +1 -1
- package/dist/plugins/index.d.ts +3 -2
- package/dist/plugins/index.js +3 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/loader.d.ts +8 -0
- package/dist/plugins/loader.js +36 -6
- package/dist/plugins/loader.js.map +1 -1
- package/dist/plugins/report.d.ts +1 -1
- package/dist/plugins/report.js +3 -4
- package/dist/plugins/report.js.map +1 -1
- package/dist/plugins/session.d.ts +1 -0
- package/dist/plugins/session.js +1 -1
- package/dist/plugins/session.js.map +1 -1
- package/dist/testkit/index.d.ts +1 -1
- package/docs/architecture.md +16 -1
- package/docs/artifacts/decision-record.md +15 -0
- package/docs/artifacts/spec.md +35 -6
- package/docs/artifacts/tasks.md +67 -16
- package/docs/cli-reference.md +274 -5
- package/docs/contributing.md +6 -0
- package/docs/migration.md +191 -0
- package/docs/plugin-api.md +21 -13
- package/docs/plugin-split.md +5 -3
- package/docs/plugin-trust.md +2 -2
- package/docs/plugins-release.md +105 -0
- package/docs/release.md +103 -0
- package/docs/stability.md +152 -0
- package/docs/tool-compatibility.md +41 -3
- package/docs/workflow.md +10 -6
- package/package.json +4 -2
- package/src/agents/worker.md +2 -1
- package/src/prompts/converge.md +2 -2
- package/src/prompts/implement.md +13 -11
- package/src/prompts/revise.md +5 -2
- package/src/prompts/run.md +7 -4
- package/src/prompts/specify.md +5 -3
- package/src/prompts/tasks.md +9 -8
- package/src/templates/spec.md +10 -4
- package/src/templates/tasks.md +35 -13
- package/dist/emitters/antigravity-cli.d.ts +0 -15
- package/dist/emitters/antigravity-cli.js +0 -20
- package/dist/emitters/antigravity-cli.js.map +0 -1
- package/dist/emitters/antigravity.d.ts +0 -20
- package/dist/emitters/antigravity.js +0 -24
- package/dist/emitters/antigravity.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pause, stop or resume a whole fleet (feature 031, FR-015, US-6). One directive per lane of every feature's run,
|
|
3
|
+
* written only through spec 025's core writer (no new protocol, D7). Each worker finishes its current task and obeys
|
|
4
|
+
* at its next report; the fleet's supervisors record the obeying exactly as 028 does for one run. Merged lanes get the
|
|
5
|
+
* directive too: they have nothing left to obey, but a supervisor holds the whole run (no new worker, review or next
|
|
6
|
+
* stage) only when every one of its lanes is paused or stopped, which includes a run between two stages whose lanes
|
|
7
|
+
* have all merged (the 2.0 dogfood: a paused fleet still started work).
|
|
8
|
+
*/
|
|
9
|
+
export type FleetAction = "pause" | "stop" | "resume";
|
|
10
|
+
export interface FleetControlResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
/** `<feature>:<lane>` of every directive written. */
|
|
13
|
+
written: string[];
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function controlFleet(root: string, fleet: string, action: FleetAction, now?: Date): FleetControlResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { shortLane } from "../core/activity.js";
|
|
2
|
+
import { readFleetRecord, readRun, writeDirective } from "../core/fleet/index.js";
|
|
3
|
+
export function controlFleet(root, fleet, action, now = new Date()) {
|
|
4
|
+
const record = readFleetRecord(root, fleet);
|
|
5
|
+
if (!record)
|
|
6
|
+
return { ok: false, written: [], error: `fleet '${fleet}' not found` };
|
|
7
|
+
const directive = action === "resume" ? "continue" : action;
|
|
8
|
+
const written = [];
|
|
9
|
+
for (const f of record.features) {
|
|
10
|
+
const run = f.run ? readRun(root, f.run) : null;
|
|
11
|
+
if (!run)
|
|
12
|
+
continue;
|
|
13
|
+
for (const lane of run.lanes) {
|
|
14
|
+
const short = shortLane(lane.lane);
|
|
15
|
+
const out = writeDirective(root, { feature: run.feature, lane: short, action: directive, run: run.run, now });
|
|
16
|
+
if (!out.ok)
|
|
17
|
+
return { ok: false, written, error: `${run.feature} ${short}: ${out.error}` };
|
|
18
|
+
written.push(`${run.feature}:${short}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return { ok: true, written };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=run-fleet-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-fleet-control.js","sourceRoot":"","sources":["../../src/cli/run-fleet-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAwB,MAAM,wBAAwB,CAAC;AAoBxG,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,KAAa,EAAE,MAAmB,EAAE,GAAG,GAAS,IAAI,IAAI,EAAE;IACnG,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,KAAK,aAAa,EAAE,CAAC;IACpF,MAAM,SAAS,GAAoB,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7E,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChD,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YAC7B,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;YAC9G,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,OAAO,IAAI,KAAK,KAAK,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC;YAC3F,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type FeatureMeter } from "../core/fleet-plan/budget.js";
|
|
2
|
+
import type { FleetFeature, FleetRecord } from "../core/fleet-plan/types.js";
|
|
3
|
+
import type { Outcome } from "./run-loop.js";
|
|
4
|
+
/**
|
|
5
|
+
* The fleet supervisor (feature 031): one tick loop above 028's per-feature `Supervisor`. Each feature keeps its own
|
|
6
|
+
* session, lanes, gates and merge (a `FeatureRun`); this loop owns what is shared: when a feature may start (what it
|
|
7
|
+
* waits for is done), containment (a paused feature holds its dependents, independent ones keep running), the
|
|
8
|
+
* fleet-wide budgets and the fleet record. It never calls a model and never touches git or processes itself:
|
|
9
|
+
* starting a feature, and everything about its lanes, is behind `FeatureRun` and `begin`, so tests drive it with
|
|
10
|
+
* fakes and a fake clock (Principle 5).
|
|
11
|
+
*/
|
|
12
|
+
/** One running feature, as the fleet loop sees it. */
|
|
13
|
+
export interface FeatureRun {
|
|
14
|
+
feature: string;
|
|
15
|
+
run: string;
|
|
16
|
+
/** Advance the feature's own supervisor one tick (028's `Supervisor.tick`). */
|
|
17
|
+
tick(): Promise<Outcome | null>;
|
|
18
|
+
/** Lanes with a live process: they occupy fleet-wide slots. */
|
|
19
|
+
runningLanes(): {
|
|
20
|
+
lane: string;
|
|
21
|
+
assistant: string;
|
|
22
|
+
}[];
|
|
23
|
+
/** Why the feature waits for a person (a paused, conflicting, escalated or failed lane), or null. */
|
|
24
|
+
needsPerson(): string | null;
|
|
25
|
+
meter(): FeatureMeter;
|
|
26
|
+
/** Begin a budget stop (nothing new starts; running lanes get a stop directive). */
|
|
27
|
+
stop(reason: string): void;
|
|
28
|
+
/** Save-and-exit: ask lanes to stop and leave state resumable. */
|
|
29
|
+
interrupt(): Outcome;
|
|
30
|
+
}
|
|
31
|
+
export type BeginResult = {
|
|
32
|
+
ok: true;
|
|
33
|
+
run: FeatureRun;
|
|
34
|
+
} | {
|
|
35
|
+
ok: false;
|
|
36
|
+
reason: string;
|
|
37
|
+
};
|
|
38
|
+
export interface FleetLoopDeps {
|
|
39
|
+
/** Merge what the feature waits for into its branch, prepare its lanes and start its run. A failure pauses only it. */
|
|
40
|
+
begin(feature: FleetFeature): Promise<BeginResult>;
|
|
41
|
+
/** Persist the fleet record after a change. */
|
|
42
|
+
save(record: FleetRecord): void;
|
|
43
|
+
say(line: string): void;
|
|
44
|
+
/** True when every runner of the fleet reports usage (a token ceiling is enforceable). */
|
|
45
|
+
reportsUsage: boolean;
|
|
46
|
+
}
|
|
47
|
+
export type FleetOutcomeKind = "done" | "budget" | "attention" | "interrupted";
|
|
48
|
+
export interface FleetOutcome {
|
|
49
|
+
kind: FleetOutcomeKind;
|
|
50
|
+
message: string;
|
|
51
|
+
}
|
|
52
|
+
export declare class FleetSupervisor {
|
|
53
|
+
readonly record: FleetRecord;
|
|
54
|
+
private readonly deps;
|
|
55
|
+
private readonly runs;
|
|
56
|
+
private stopReason;
|
|
57
|
+
private lastSaid;
|
|
58
|
+
constructor(record: FleetRecord, deps: FleetLoopDeps,
|
|
59
|
+
/** Runs adopted from an earlier session (`--continue-fleet`). */
|
|
60
|
+
adopted?: FeatureRun[]);
|
|
61
|
+
/** The lanes running in every feature other than `feature`: the fleet-wide slots (028's `Session.slots`). */
|
|
62
|
+
slotsFor(feature: string): {
|
|
63
|
+
lane: string;
|
|
64
|
+
assistant: string;
|
|
65
|
+
}[];
|
|
66
|
+
featureRun(feature: string): FeatureRun | undefined;
|
|
67
|
+
private say;
|
|
68
|
+
tick(): Promise<FleetOutcome | null>;
|
|
69
|
+
/** Save-and-exit for SIGINT/SIGTERM: every started feature stops its lanes and leaves resumable state. */
|
|
70
|
+
interrupt(): FleetOutcome;
|
|
71
|
+
}
|
|
72
|
+
/** Tick until the fleet ends or `interrupted()` is true. */
|
|
73
|
+
export declare function superviseFleet(sup: FleetSupervisor, opts: {
|
|
74
|
+
sleep: (ms: number) => Promise<void>;
|
|
75
|
+
interrupted: () => boolean;
|
|
76
|
+
tickMs: number;
|
|
77
|
+
}): Promise<FleetOutcome>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { heldFeatures } from "../core/fleet-plan/contain.js";
|
|
2
|
+
import { fleetBudgetDecision } from "../core/fleet-plan/budget.js";
|
|
3
|
+
import { startableFeatures } from "../core/fleet-plan/schedule.js";
|
|
4
|
+
const HOLDING = new Set(["stays", "rejected", "attention"]);
|
|
5
|
+
export class FleetSupervisor {
|
|
6
|
+
record;
|
|
7
|
+
deps;
|
|
8
|
+
runs = new Map();
|
|
9
|
+
stopReason;
|
|
10
|
+
lastSaid = new Map();
|
|
11
|
+
constructor(record, deps,
|
|
12
|
+
/** Runs adopted from an earlier session (`--continue-fleet`). */
|
|
13
|
+
adopted = []) {
|
|
14
|
+
this.record = record;
|
|
15
|
+
this.deps = deps;
|
|
16
|
+
for (const r of adopted)
|
|
17
|
+
this.runs.set(r.feature, r);
|
|
18
|
+
}
|
|
19
|
+
/** The lanes running in every feature other than `feature`: the fleet-wide slots (028's `Session.slots`). */
|
|
20
|
+
slotsFor(feature) {
|
|
21
|
+
return [...this.runs.entries()].filter(([f]) => f !== feature).flatMap(([, r]) => r.runningLanes());
|
|
22
|
+
}
|
|
23
|
+
featureRun(feature) {
|
|
24
|
+
return this.runs.get(feature);
|
|
25
|
+
}
|
|
26
|
+
say(feature, line) {
|
|
27
|
+
if (this.lastSaid.get(feature) === line)
|
|
28
|
+
return; // a waiting condition is announced once, not every tick
|
|
29
|
+
this.lastSaid.set(feature, line);
|
|
30
|
+
this.deps.say(line);
|
|
31
|
+
}
|
|
32
|
+
async tick() {
|
|
33
|
+
const rec = this.record;
|
|
34
|
+
let changed = false;
|
|
35
|
+
const set = (f, state, cause) => {
|
|
36
|
+
if (f.state !== state || f.cause !== cause) {
|
|
37
|
+
const was = f.state;
|
|
38
|
+
f.state = state;
|
|
39
|
+
if (cause === undefined)
|
|
40
|
+
delete f.cause;
|
|
41
|
+
else
|
|
42
|
+
f.cause = cause;
|
|
43
|
+
changed = true;
|
|
44
|
+
if (was !== state)
|
|
45
|
+
this.deps.say(`${f.feature}: ${state}${cause ? ` (${cause})` : ""}`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// 1. every started feature takes its own tick; its state follows what its supervisor and lanes report
|
|
49
|
+
for (const f of rec.features) {
|
|
50
|
+
const run = this.runs.get(f.feature);
|
|
51
|
+
if (!run || f.state === "done" || f.state === "skipped")
|
|
52
|
+
continue;
|
|
53
|
+
const out = await run.tick();
|
|
54
|
+
if (out?.kind === "done")
|
|
55
|
+
set(f, "done");
|
|
56
|
+
else if (out && HOLDING.has(out.kind))
|
|
57
|
+
set(f, "paused", out.message);
|
|
58
|
+
else {
|
|
59
|
+
const why = run.needsPerson();
|
|
60
|
+
if (why !== null && !this.stopReason)
|
|
61
|
+
set(f, "paused", why);
|
|
62
|
+
else
|
|
63
|
+
set(f, "running");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// 2. containment: a paused feature holds what waits for it; resuming releases (recomputed every tick)
|
|
67
|
+
const paused = new Set(rec.features.filter((f) => f.state === "paused").map((f) => f.feature));
|
|
68
|
+
const held = heldFeatures(rec.features, paused);
|
|
69
|
+
for (const f of rec.features) {
|
|
70
|
+
const by = held.get(f.feature);
|
|
71
|
+
if (f.heldBy !== by) {
|
|
72
|
+
if (by === undefined)
|
|
73
|
+
delete f.heldBy;
|
|
74
|
+
else
|
|
75
|
+
f.heldBy = by;
|
|
76
|
+
changed = true;
|
|
77
|
+
this.say(f.feature, by ? `${f.feature}: held while ${by} is paused` : `${f.feature}: released`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// 3. fleet-wide budgets over the features' meters
|
|
81
|
+
if (!this.stopReason) {
|
|
82
|
+
const meters = [...this.runs.values()].map((r) => r.meter());
|
|
83
|
+
const d = fleetBudgetDecision(rec.budgets, meters, this.deps.reportsUsage);
|
|
84
|
+
if (d.exceeded && d.reason) {
|
|
85
|
+
this.stopReason = d.reason;
|
|
86
|
+
const note = d.unenforced.length > 0 ? ` (${d.unenforced.join("; ")})` : "";
|
|
87
|
+
this.deps.say(`Fleet budget exceeded: ${d.reason}${note}. No new lanes start and running lanes are asked to stop.`);
|
|
88
|
+
for (const r of this.runs.values())
|
|
89
|
+
r.stop(d.reason);
|
|
90
|
+
rec.status = "paused";
|
|
91
|
+
changed = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (this.stopReason) {
|
|
95
|
+
if (changed)
|
|
96
|
+
this.deps.save(rec);
|
|
97
|
+
const running = [...this.runs.values()].some((r) => r.runningLanes().length > 0);
|
|
98
|
+
if (running)
|
|
99
|
+
return null;
|
|
100
|
+
return { kind: "budget", message: `Stopped: ${this.stopReason}. State is saved in ${rec.fleet}; continue with --continue-fleet=${rec.fleet} after raising the budget.` };
|
|
101
|
+
}
|
|
102
|
+
// 3b. start the features that may: nothing they wait for is outstanding and nothing holds them. A feature
|
|
103
|
+
// paused before it started (a merge conflict) is retried, so resolving it by hand lets the fleet carry on.
|
|
104
|
+
const retry = rec.features.filter((f) => f.state === "paused" && !this.runs.has(f.feature) && f.heldBy === undefined);
|
|
105
|
+
for (const f of [...startableFeatures(rec.features), ...retry]) {
|
|
106
|
+
const began = await this.deps.begin(f);
|
|
107
|
+
if (began.ok) {
|
|
108
|
+
this.runs.set(f.feature, began.run);
|
|
109
|
+
f.run = began.run.run;
|
|
110
|
+
set(f, "running");
|
|
111
|
+
changed = true;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
set(f, "paused", began.reason);
|
|
115
|
+
this.say(f.feature, `${f.feature}: not started — ${began.reason}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// 4. the record follows the features
|
|
119
|
+
const everyone = rec.features.every((f) => f.state === "done" || f.state === "skipped");
|
|
120
|
+
const next = everyone ? "done" : rec.features.some((f) => f.state === "paused") ? "waiting-person" : "active";
|
|
121
|
+
if (rec.status !== next) {
|
|
122
|
+
rec.status = next;
|
|
123
|
+
changed = true;
|
|
124
|
+
}
|
|
125
|
+
if (changed)
|
|
126
|
+
this.deps.save(rec);
|
|
127
|
+
if (everyone)
|
|
128
|
+
return { kind: "done", message: `Fleet ${rec.fleet} is done: ${rec.features.length} feature${rec.features.length === 1 ? "" : "s"} built (lanes merged into their feature branches).` };
|
|
129
|
+
// a deadlock guard: waiting features, nothing running, nothing paused and nothing startable cannot progress
|
|
130
|
+
const live = rec.features.some((f) => f.state === "running" || f.state === "paused");
|
|
131
|
+
if (!live && rec.features.some((f) => f.state === "waiting")) {
|
|
132
|
+
return { kind: "attention", message: `Fleet ${rec.fleet} cannot progress: ${rec.features.filter((f) => f.state === "waiting").map((f) => f.feature).join(", ")} wait for something that will not finish.` };
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
/** Save-and-exit for SIGINT/SIGTERM: every started feature stops its lanes and leaves resumable state. */
|
|
137
|
+
interrupt() {
|
|
138
|
+
for (const r of this.runs.values())
|
|
139
|
+
r.interrupt();
|
|
140
|
+
this.record.status = "paused";
|
|
141
|
+
this.deps.save(this.record);
|
|
142
|
+
return { kind: "interrupted", message: `Interrupted. State is saved in ${this.record.fleet}; continue with --continue-fleet=${this.record.fleet}.` };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** Tick until the fleet ends or `interrupted()` is true. */
|
|
146
|
+
export async function superviseFleet(sup, opts) {
|
|
147
|
+
for (;;) {
|
|
148
|
+
if (opts.interrupted())
|
|
149
|
+
return sup.interrupt();
|
|
150
|
+
const out = await sup.tick();
|
|
151
|
+
if (out)
|
|
152
|
+
return out;
|
|
153
|
+
await opts.sleep(opts.tickMs);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=run-fleet-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-fleet-loop.js","sourceRoot":"","sources":["../../src/cli/run-fleet-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAiDnE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AAE5D,MAAM,OAAO,eAAe;IAMf,MAAM;IACE,IAAI;IANN,IAAI,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC9C,UA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AAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,2CAA2C,EAAE,CAAC;QAC9M,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0GAA0G;IAC1G,SAAS;QACP,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,kCAAkC,IAAI,CAAC,MAAM,CAAC,KAAK,oCAAoC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IACvJ,CAAC;CACF;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAoB,EACpB,IAA0F;IAE1F,SAAS,CAAC;QACR,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO,GAAG,CAAC,SAAS,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC;QACpB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before a dependent feature starts (feature 031, FR-004, FR-007, D2), the feature it waits for is merged into
|
|
3
|
+
* its branch, so it builds on the merged result; "merged" means that feature's lanes are merged into its own
|
|
4
|
+
* branch (clarification C-1), never into `main`. A real conflict aborts that merge, leaves everything as it was
|
|
5
|
+
* and pauses only the dependent feature (FR-013): it is never auto-resolved (risk R2).
|
|
6
|
+
*/
|
|
7
|
+
export type MergeStep = {
|
|
8
|
+
ok: true;
|
|
9
|
+
merged: string[];
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
on: string;
|
|
13
|
+
reason: string;
|
|
14
|
+
files: string[];
|
|
15
|
+
};
|
|
16
|
+
/** Merge each finished feature in `on` into `feature`'s branch, in order. Stops at the first failure. */
|
|
17
|
+
export declare function mergeDependencies(root: string, feature: string, on: readonly string[]): MergeStep;
|
|
18
|
+
/**
|
|
19
|
+
* Prepared lanes branched from the feature before a dependency was merged into it: bring each lane up to the
|
|
20
|
+
* feature branch so its worker sees the dependency's work. Only the lanes' own checkouts change.
|
|
21
|
+
*/
|
|
22
|
+
export declare function syncLanesWithFeature(root: string, feature: string): MergeStep;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { featureBranch } from "../core/lane-merge.js";
|
|
2
|
+
import { git, isDirty, isMerged } from "../core/git.js";
|
|
3
|
+
import { laneRefs } from "../core/query.js";
|
|
4
|
+
function conflictFiles(cwd) {
|
|
5
|
+
try {
|
|
6
|
+
return git(cwd, ["diff", "--name-only", "--diff-filter=U"]).split(/\r?\n/).filter(Boolean);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** `git merge --no-edit <from>` in `cwd`. A conflict is aborted and reported with its files. */
|
|
13
|
+
function mergeInto(cwd, from) {
|
|
14
|
+
try {
|
|
15
|
+
git(cwd, ["merge", "--no-edit", from]);
|
|
16
|
+
return { ok: true };
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
const files = conflictFiles(cwd);
|
|
20
|
+
try {
|
|
21
|
+
git(cwd, ["merge", "--abort"]);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
/* nothing to abort */
|
|
25
|
+
}
|
|
26
|
+
return { ok: false, files, detail: err.message.split("\n")[0] ?? "merge failed" };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Merge each finished feature in `on` into `feature`'s branch, in order. Stops at the first failure. */
|
|
30
|
+
export function mergeDependencies(root, feature, on) {
|
|
31
|
+
const target = featureBranch(root, feature);
|
|
32
|
+
if (!target?.checkout)
|
|
33
|
+
return { ok: false, on: on[0] ?? "", reason: `${feature} is not checked out anywhere; create its worktree with \`ambykit worktree ${feature}\``, files: [] };
|
|
34
|
+
if (isDirty(target.checkout))
|
|
35
|
+
return { ok: false, on: on[0] ?? "", reason: `${target.checkout} has uncommitted changes; commit them first`, files: [] };
|
|
36
|
+
const merged = [];
|
|
37
|
+
for (const dep of on) {
|
|
38
|
+
const from = featureBranch(root, dep);
|
|
39
|
+
if (!from)
|
|
40
|
+
return { ok: false, on: dep, reason: `${dep} has no branch to merge`, files: [] };
|
|
41
|
+
if (isMerged(root, from.branch, target.branch))
|
|
42
|
+
continue; // already in
|
|
43
|
+
const r = mergeInto(target.checkout, from.branch);
|
|
44
|
+
if (!r.ok)
|
|
45
|
+
return { ok: false, on: dep, reason: `merging ${dep} into ${feature} conflicts${r.files.length ? ` in ${r.files.join(", ")}` : ""}; resolve it by hand, then continue the fleet`, files: r.files };
|
|
46
|
+
merged.push(dep);
|
|
47
|
+
}
|
|
48
|
+
return { ok: true, merged };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Prepared lanes branched from the feature before a dependency was merged into it: bring each lane up to the
|
|
52
|
+
* feature branch so its worker sees the dependency's work. Only the lanes' own checkouts change.
|
|
53
|
+
*/
|
|
54
|
+
export function syncLanesWithFeature(root, feature) {
|
|
55
|
+
const target = featureBranch(root, feature);
|
|
56
|
+
if (!target)
|
|
57
|
+
return { ok: true, merged: [] };
|
|
58
|
+
const merged = [];
|
|
59
|
+
for (const lane of laneRefs(root, feature)) {
|
|
60
|
+
if (isDirty(lane.root) || isMerged(root, target.branch, lane.name))
|
|
61
|
+
continue;
|
|
62
|
+
const r = mergeInto(lane.root, target.branch);
|
|
63
|
+
if (!r.ok)
|
|
64
|
+
return { ok: false, on: feature, reason: `bringing ${lane.name} up to ${feature} conflicts${r.files.length ? ` in ${r.files.join(", ")}` : ""}`, files: r.files };
|
|
65
|
+
merged.push(lane.name);
|
|
66
|
+
}
|
|
67
|
+
return { ok: true, merged };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=run-fleet-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-fleet-merge.js","sourceRoot":"","sources":["../../src/cli/run-fleet-merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAW5C,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,gGAAgG;AAChG,SAAS,SAAS,CAAC,GAAW,EAAE,IAAY;IAC1C,IAAI,CAAC;QACH,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QACvC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC;YACH,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,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AAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7K,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lane preparation for a fleet (feature 031, clarification C-2, risk R1). A feature the fleet runs needs its lanes
|
|
3
|
+
* (`ambykit lane`); the fleet prepares missing ones with the lane command itself (so there is one lane planner,
|
|
4
|
+
* 015's) and says so in the preview. When it cannot (no worktrees, no feature branch, path conflicts) it refuses
|
|
5
|
+
* with the exact `ambykit lane` command to run by hand, never half-starts.
|
|
6
|
+
*/
|
|
7
|
+
export interface PrepareResult {
|
|
8
|
+
feature: string;
|
|
9
|
+
ok: boolean;
|
|
10
|
+
/** Present when `ok` is false: why, with the command that fixes it. */
|
|
11
|
+
reason?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Runs one `ambykit lane` invocation and reports its exit code and error text. Replaceable in tests. */
|
|
14
|
+
export type LaneRunner = (cwd: string, positionals: string[], flags: Record<string, string | boolean>) => Promise<{
|
|
15
|
+
code: number;
|
|
16
|
+
err: string;
|
|
17
|
+
}>;
|
|
18
|
+
/** The real runner: the lane command in-process, with its console output captured so the fleet's output stays its own. */
|
|
19
|
+
export declare const runLaneCommand: LaneRunner;
|
|
20
|
+
/**
|
|
21
|
+
* Give a feature its worktree when it has none (031 FR-013: each feature has its own worktree), with the worktree
|
|
22
|
+
* command itself, so the fleet does not pause asking a person to run `ambykit worktree` (the 2.0 dogfood). A failure is
|
|
23
|
+
* returned with the command to run by hand.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ensureFeatureWorktree(root: string, feature: string): Promise<{
|
|
26
|
+
ok: true;
|
|
27
|
+
created: boolean;
|
|
28
|
+
} | {
|
|
29
|
+
ok: false;
|
|
30
|
+
reason: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function prepareLanes(root: string, features: readonly {
|
|
33
|
+
feature: string;
|
|
34
|
+
lanes: number;
|
|
35
|
+
}[], run?: LaneRunner): Promise<PrepareResult[]>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { featureBranch } from "../core/lane-merge.js";
|
|
2
|
+
import { LaneCommand } from "./lane.js";
|
|
3
|
+
import { WorktreeCommand } from "./worktree.js";
|
|
4
|
+
/** The real runner: the lane command in-process, with its console output captured so the fleet's output stays its own. */
|
|
5
|
+
export const runLaneCommand = async (cwd, positionals, flags) => {
|
|
6
|
+
const err = [];
|
|
7
|
+
const [log, error, warn] = [console.log, console.error, console.warn];
|
|
8
|
+
console.log = () => undefined;
|
|
9
|
+
console.error = (...a) => void err.push(a.join(" "));
|
|
10
|
+
console.warn = (...a) => void err.push(a.join(" "));
|
|
11
|
+
try {
|
|
12
|
+
const code = await new LaneCommand().run({ cwd, positionals, flags });
|
|
13
|
+
return { code, err: err.join("\n") };
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
[console.log, console.error, console.warn] = [log, error, warn];
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Give a feature its worktree when it has none (031 FR-013: each feature has its own worktree), with the worktree
|
|
21
|
+
* command itself, so the fleet does not pause asking a person to run `ambykit worktree` (the 2.0 dogfood). A failure is
|
|
22
|
+
* returned with the command to run by hand.
|
|
23
|
+
*/
|
|
24
|
+
export async function ensureFeatureWorktree(root, feature) {
|
|
25
|
+
if (featureBranch(root, feature)?.checkout)
|
|
26
|
+
return { ok: true, created: false };
|
|
27
|
+
const err = [];
|
|
28
|
+
const [log, error, warn] = [console.log, console.error, console.warn];
|
|
29
|
+
console.log = () => undefined;
|
|
30
|
+
console.error = (...a) => void err.push(a.join(" "));
|
|
31
|
+
console.warn = (...a) => void err.push(a.join(" "));
|
|
32
|
+
let code;
|
|
33
|
+
try {
|
|
34
|
+
code = await new WorktreeCommand().run({ cwd: root, positionals: [feature], flags: {} });
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
[console.log, console.error, console.warn] = [log, error, warn];
|
|
38
|
+
}
|
|
39
|
+
if (code === 0 && featureBranch(root, feature)?.checkout)
|
|
40
|
+
return { ok: true, created: true };
|
|
41
|
+
const detail = err.find((l) => l.trim().length > 0) ?? "the worktree command failed";
|
|
42
|
+
return { ok: false, reason: `${detail} Create it yourself with: ambykit worktree ${feature}` };
|
|
43
|
+
}
|
|
44
|
+
export async function prepareLanes(root, features, run = runLaneCommand) {
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const f of features) {
|
|
47
|
+
// `--next`: the feature's next stage, sequential tasks included (a feature's first tasks are often not [P])
|
|
48
|
+
const r = await run(root, [f.feature], { lanes: String(f.lanes), next: true });
|
|
49
|
+
if (r.code === 0)
|
|
50
|
+
out.push({ feature: f.feature, ok: true });
|
|
51
|
+
else {
|
|
52
|
+
const detail = r.err.split("\n").find((l) => l.trim().length > 0) ?? "the lane command failed";
|
|
53
|
+
out.push({ feature: f.feature, ok: false, reason: `${detail} Prepare the lanes yourself with: ambykit lane ${f.feature} --next --lanes=${f.lanes}` });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=run-fleet-prepare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-fleet-prepare.js","sourceRoot":"","sources":["../../src/cli/run-fleet-prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAm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ptions } from "./base-command.js";
|
|
3
|
+
import type { RunDeps } from "./run.js";
|
|
4
|
+
/**
|
|
5
|
+
* `ambykit run <f1> <f2> ...`, `--all-ready`, `--continue-fleet=<id>` (feature 031). A fleet is one `Session` per
|
|
6
|
+
* feature (028's, unchanged: its own run, lanes, gates and merge) driven by one `FleetSupervisor`. This file is the
|
|
7
|
+
* edge: it reads the project through spec 030's reader (`readFleetInput`), shows the plan, and wires the real
|
|
8
|
+
* sessions, lane preparation and dependency merges behind the loop's interfaces. Its stability is `run`'s (`src/core/run-stability.ts`).
|
|
9
|
+
*/
|
|
10
|
+
export interface FleetIo {
|
|
11
|
+
info(m: string): void;
|
|
12
|
+
warn(m: string): void;
|
|
13
|
+
error(m: string, hint?: string): void;
|
|
14
|
+
success(m: string): void;
|
|
15
|
+
}
|
|
16
|
+
export type FleetDeps = RunDeps;
|
|
17
|
+
export declare const flagList: (opts: CliOptions, name: string) => string[];
|
|
18
|
+
export type FleetEntry = number | {
|
|
19
|
+
single: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function runFleet(root: string, args: string[], opts: CliOptions, deps: FleetDeps, io: FleetIo): Promise<FleetEntry>;
|
|
22
|
+
/**
|
|
23
|
+
* Re-plan a resumed fleet (FR-018): the order, waits and ownership come from the new plan; progress (state, run)
|
|
24
|
+
* stays. Returns what changed since the fleet was planned, per feature, from the stored fingerprints.
|
|
25
|
+
*/
|
|
26
|
+
/** The budgets a continued fleet's --max-* flags changed, as "wall-clock 120 → 240 minutes". */
|
|
27
|
+
export declare function changedBudgets(before: FleetBudgets, after: FleetBudgets): string[];
|
|
28
|
+
export declare function replan(record: FleetRecord, plan: FleetPlan): string[];
|