@ambystech/ambykit 1.3.1 → 1.6.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.
- package/CHANGELOG.md +131 -1
- package/README.md +9 -0
- package/dist/cli/activity.d.ts +5 -1
- package/dist/cli/activity.js +22 -8
- package/dist/cli/activity.js.map +1 -1
- package/dist/cli/add.js +12 -5
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/analyze.js +68 -4
- package/dist/cli/analyze.js.map +1 -1
- package/dist/cli/base-command.js +6 -0
- package/dist/cli/base-command.js.map +1 -1
- package/dist/cli/check.js +18 -3
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/dashboard.d.ts +4 -1
- package/dist/cli/dashboard.js +47 -15
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/directive.d.ts +7 -0
- package/dist/cli/directive.js +43 -0
- package/dist/cli/directive.js.map +1 -0
- package/dist/cli/fleet.d.ts +16 -0
- package/dist/cli/fleet.js +472 -0
- package/dist/cli/fleet.js.map +1 -0
- package/dist/cli/graph.d.ts +13 -0
- package/dist/cli/graph.js +40 -0
- package/dist/cli/graph.js.map +1 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/io/fsops.d.ts +4 -0
- package/dist/cli/io/fsops.js +62 -0
- package/dist/cli/io/fsops.js.map +1 -1
- package/dist/cli/lane.d.ts +0 -2
- package/dist/cli/lane.js +9 -104
- package/dist/cli/lane.js.map +1 -1
- package/dist/cli/mcp.d.ts +21 -0
- package/dist/cli/mcp.js +27 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/run-budget.d.ts +18 -0
- package/dist/cli/run-budget.js +75 -0
- package/dist/cli/run-budget.js.map +1 -0
- package/dist/cli/run-control.d.ts +28 -0
- package/dist/cli/run-control.js +139 -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-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 +89 -0
- package/dist/cli/run-launch.js.map +1 -0
- package/dist/cli/run-loop.d.ts +37 -0
- package/dist/cli/run-loop.js +150 -0
- package/dist/cli/run-loop.js.map +1 -0
- package/dist/cli/run-merger.d.ts +12 -0
- package/dist/cli/run-merger.js +88 -0
- package/dist/cli/run-merger.js.map +1 -0
- package/dist/cli/run-plan.d.ts +28 -0
- package/dist/cli/run-plan.js +49 -0
- package/dist/cli/run-plan.js.map +1 -0
- package/dist/cli/run-process.d.ts +39 -0
- package/dist/cli/run-process.js +99 -0
- package/dist/cli/run-process.js.map +1 -0
- package/dist/cli/run-protocol-prompts.d.ts +7 -0
- package/dist/cli/run-protocol-prompts.js +36 -0
- package/dist/cli/run-protocol-prompts.js.map +1 -0
- package/dist/cli/run-protocol.d.ts +10 -0
- package/dist/cli/run-protocol.js +99 -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 +66 -0
- package/dist/cli/run-script.js.map +1 -0
- package/dist/cli/run-session.d.ts +60 -0
- package/dist/cli/run-session.js +21 -0
- package/dist/cli/run-session.js.map +1 -0
- package/dist/cli/run-supervisor.d.ts +20 -0
- package/dist/cli/run-supervisor.js +144 -0
- package/dist/cli/run-supervisor.js.map +1 -0
- package/dist/cli/run.d.ts +73 -0
- package/dist/cli/run.js +363 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.js +31 -5
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/trace.d.ts +14 -0
- package/dist/cli/trace.js +89 -0
- package/dist/cli/trace.js.map +1 -0
- package/dist/cli/ui/dashboard/feature-chart.js +15 -2
- package/dist/cli/ui/dashboard/feature-chart.js.map +1 -1
- package/dist/cli/ui/dashboard/feature-view.js +11 -1
- package/dist/cli/ui/dashboard/feature-view.js.map +1 -1
- 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 +50 -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/graph-view.d.ts +44 -0
- package/dist/cli/ui/dashboard/graph-view.js +78 -0
- package/dist/cli/ui/dashboard/graph-view.js.map +1 -0
- package/dist/cli/ui/dashboard/help-overlay.d.ts +1 -1
- package/dist/cli/ui/dashboard/help-overlay.js +20 -0
- package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
- package/dist/cli/ui/dashboard/quality-view.d.ts +8 -0
- package/dist/cli/ui/dashboard/quality-view.js +31 -0
- package/dist/cli/ui/dashboard/quality-view.js.map +1 -0
- package/dist/cli/ui/dashboard/story-detail.d.ts +1 -1
- package/dist/cli/ui/dashboard/story-detail.js +10 -3
- package/dist/cli/ui/dashboard/story-detail.js.map +1 -1
- package/dist/cli/ui/dashboard/tokens.d.ts +26 -0
- package/dist/cli/ui/dashboard/tokens.js +26 -0
- package/dist/cli/ui/dashboard/tokens.js.map +1 -1
- 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 +26 -8
- package/dist/cli/ui/interactive/fullscreen.js.map +1 -1
- 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 +27 -1
- package/dist/cli/ui/interactive/overview.js +111 -0
- package/dist/cli/ui/interactive/overview.js.map +1 -1
- package/dist/cli/ui/tool-options.d.ts +3 -2
- package/dist/cli/ui/tool-options.js +3 -3
- package/dist/cli/ui/tool-options.js.map +1 -1
- package/dist/cli/update.d.ts +1 -1
- package/dist/cli/update.js +8 -3
- package/dist/cli/update.js.map +1 -1
- package/dist/core/activity.d.ts +15 -2
- package/dist/core/activity.js +19 -4
- package/dist/core/activity.js.map +1 -1
- package/dist/core/analyze.d.ts +80 -2
- package/dist/core/analyze.js +200 -61
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/checkouts.js +2 -0
- package/dist/core/checkouts.js.map +1 -1
- package/dist/core/config.d.ts +31 -1
- package/dist/core/config.js +50 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/dashboard.d.ts +4 -0
- package/dist/core/dashboard.js +5 -3
- package/dist/core/dashboard.js.map +1 -1
- package/dist/core/decisions.d.ts +60 -0
- package/dist/core/decisions.js +231 -0
- package/dist/core/decisions.js.map +1 -0
- package/dist/core/emit.d.ts +16 -1
- package/dist/core/emit.js +49 -5
- package/dist/core/emit.js.map +1 -1
- package/dist/core/features.js +6 -1
- package/dist/core/features.js.map +1 -1
- package/dist/core/fleet/claims.d.ts +45 -0
- package/dist/core/fleet/claims.js +85 -0
- package/dist/core/fleet/claims.js.map +1 -0
- package/dist/core/fleet/directives.d.ts +56 -0
- package/dist/core/fleet/directives.js +99 -0
- package/dist/core/fleet/directives.js.map +1 -0
- package/dist/core/fleet/flow-input.d.ts +6 -0
- package/dist/core/fleet/flow-input.js +35 -0
- package/dist/core/fleet/flow-input.js.map +1 -0
- package/dist/core/fleet/index.d.ts +9 -0
- package/dist/core/fleet/index.js +10 -0
- package/dist/core/fleet/index.js.map +1 -0
- package/dist/core/fleet/lane-status.d.ts +39 -0
- package/dist/core/fleet/lane-status.js +63 -0
- package/dist/core/fleet/lane-status.js.map +1 -0
- package/dist/core/fleet/lock.d.ts +23 -0
- package/dist/core/fleet/lock.js +103 -0
- package/dist/core/fleet/lock.js.map +1 -0
- package/dist/core/fleet/notes.d.ts +31 -0
- package/dist/core/fleet/notes.js +56 -0
- package/dist/core/fleet/notes.js.map +1 -0
- package/dist/core/fleet/run-flow.d.ts +157 -0
- package/dist/core/fleet/run-flow.js +205 -0
- package/dist/core/fleet/run-flow.js.map +1 -0
- package/dist/core/fleet/runs.d.ts +46 -0
- package/dist/core/fleet/runs.js +182 -0
- package/dist/core/fleet/runs.js.map +1 -0
- package/dist/core/fleet/types.d.ts +63 -0
- package/dist/core/fleet/types.js +11 -0
- package/dist/core/fleet/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/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 +51 -0
- package/dist/core/graph-format.js +99 -0
- package/dist/core/graph-format.js.map +1 -0
- package/dist/core/graph-paths.d.ts +27 -0
- package/dist/core/graph-paths.js +94 -0
- package/dist/core/graph-paths.js.map +1 -0
- package/dist/core/graph-scope.d.ts +7 -0
- package/dist/core/graph-scope.js +31 -0
- package/dist/core/graph-scope.js.map +1 -0
- package/dist/core/graph-types.d.ts +55 -0
- package/dist/core/graph-types.js +6 -0
- package/dist/core/graph-types.js.map +1 -0
- package/dist/core/graph.d.ts +14 -0
- package/dist/core/graph.js +144 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +13 -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/markers.d.ts +44 -0
- package/dist/core/markers.js +139 -0
- package/dist/core/markers.js.map +1 -0
- package/dist/core/merge-json.d.ts +15 -0
- package/dist/core/merge-json.js +46 -0
- package/dist/core/merge-json.js.map +1 -0
- package/dist/core/moved-targets.d.ts +23 -0
- package/dist/core/moved-targets.js +23 -0
- package/dist/core/moved-targets.js.map +1 -0
- package/dist/core/overview-types.d.ts +27 -1
- package/dist/core/overview-types.js.map +1 -1
- package/dist/core/overview.d.ts +1 -1
- package/dist/core/overview.js +91 -74
- package/dist/core/overview.js.map +1 -1
- package/dist/core/path-guard.d.ts +5 -0
- package/dist/core/path-guard.js +9 -0
- package/dist/core/path-guard.js.map +1 -0
- package/dist/core/paths.d.ts +2 -0
- package/dist/core/paths.js +4 -0
- package/dist/core/paths.js.map +1 -1
- package/dist/core/query.d.ts +91 -0
- package/dist/core/query.js +197 -0
- package/dist/core/query.js.map +1 -0
- package/dist/core/report.d.ts +36 -0
- package/dist/core/report.js +62 -0
- package/dist/core/report.js.map +1 -0
- package/dist/core/rules.js +3 -0
- package/dist/core/rules.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 +51 -0
- package/dist/core/run-launch-plan.js +27 -0
- package/dist/core/run-launch-plan.js.map +1 -0
- package/dist/core/run-prompt.d.ts +47 -0
- package/dist/core/run-prompt.js +37 -0
- package/dist/core/run-prompt.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-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 +59 -0
- package/dist/core/runners.js +60 -0
- package/dist/core/runners.js.map +1 -0
- package/dist/core/scaffold.d.ts +2 -2
- package/dist/core/scaffold.js +3 -1
- package/dist/core/scaffold.js.map +1 -1
- package/dist/core/subagents.d.ts +29 -0
- package/dist/core/subagents.js +52 -0
- package/dist/core/subagents.js.map +1 -0
- package/dist/core/tasks-edit.d.ts +34 -0
- package/dist/core/tasks-edit.js +115 -0
- package/dist/core/tasks-edit.js.map +1 -0
- package/dist/core/test-design.d.ts +94 -0
- package/dist/core/test-design.js +325 -0
- package/dist/core/test-design.js.map +1 -0
- package/dist/core/trace-cite.d.ts +16 -0
- package/dist/core/trace-cite.js +24 -0
- package/dist/core/trace-cite.js.map +1 -0
- package/dist/core/trace-coverage.d.ts +8 -0
- package/dist/core/trace-coverage.js +40 -0
- package/dist/core/trace-coverage.js.map +1 -0
- package/dist/core/trace-design.d.ts +6 -0
- package/dist/core/trace-design.js +16 -0
- package/dist/core/trace-design.js.map +1 -0
- package/dist/core/trace-io.d.ts +14 -0
- package/dist/core/trace-io.js +97 -0
- package/dist/core/trace-io.js.map +1 -0
- package/dist/core/trace-requirements.d.ts +9 -0
- package/dist/core/trace-requirements.js +27 -0
- package/dist/core/trace-requirements.js.map +1 -0
- package/dist/core/trace-tests.d.ts +7 -0
- package/dist/core/trace-tests.js +27 -0
- package/dist/core/trace-tests.js.map +1 -0
- package/dist/core/trace-types.d.ts +81 -0
- package/dist/core/trace-types.js +3 -0
- package/dist/core/trace-types.js.map +1 -0
- package/dist/core/trace.d.ts +18 -0
- package/dist/core/trace.js +109 -0
- package/dist/core/trace.js.map +1 -0
- package/dist/core/types.d.ts +50 -1
- package/dist/emitters/antigravity-cli.d.ts +4 -0
- package/dist/emitters/antigravity-cli.js +8 -0
- package/dist/emitters/antigravity-cli.js.map +1 -1
- package/dist/emitters/antigravity.d.ts +6 -0
- package/dist/emitters/antigravity.js +8 -0
- package/dist/emitters/antigravity.js.map +1 -1
- package/dist/emitters/base-emitter.d.ts +28 -0
- package/dist/emitters/base-emitter.js +41 -1
- package/dist/emitters/base-emitter.js.map +1 -1
- package/dist/emitters/claude.d.ts +12 -2
- package/dist/emitters/claude.js +34 -5
- package/dist/emitters/claude.js.map +1 -1
- package/dist/emitters/copilot-cli.d.ts +7 -1
- package/dist/emitters/copilot-cli.js +9 -0
- package/dist/emitters/copilot-cli.js.map +1 -1
- package/dist/emitters/copilot.d.ts +5 -0
- package/dist/emitters/copilot.js +23 -1
- package/dist/emitters/copilot.js.map +1 -1
- package/dist/emitters/cursor.d.ts +3 -0
- package/dist/emitters/cursor.js +8 -1
- package/dist/emitters/cursor.js.map +1 -1
- package/dist/emitters/index.d.ts +10 -3
- package/dist/emitters/index.js +6 -6
- package/dist/emitters/index.js.map +1 -1
- package/dist/emitters/opencode.d.ts +8 -0
- package/dist/emitters/opencode.js +23 -0
- package/dist/emitters/opencode.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/protocol.d.ts +44 -0
- package/dist/mcp/protocol.js +114 -0
- package/dist/mcp/protocol.js.map +1 -0
- package/dist/mcp/registry.d.ts +40 -0
- package/dist/mcp/registry.js +44 -0
- package/dist/mcp/registry.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +14 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/common.d.ts +12 -0
- package/dist/mcp/tools/common.js +12 -0
- package/dist/mcp/tools/common.js.map +1 -0
- package/dist/mcp/tools/fleet.d.ts +10 -0
- package/dist/mcp/tools/fleet.js +102 -0
- package/dist/mcp/tools/fleet.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +3 -0
- package/dist/mcp/tools/index.js +13 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/read.d.ts +6 -0
- package/dist/mcp/tools/read.js +62 -0
- package/dist/mcp/tools/read.js.map +1 -0
- package/dist/mcp/tools/write.d.ts +6 -0
- package/dist/mcp/tools/write.js +34 -0
- package/dist/mcp/tools/write.js.map +1 -0
- package/dist/plugins/api.d.ts +39 -0
- package/dist/plugins/api.js +28 -0
- package/dist/plugins/api.js.map +1 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +35 -0
- package/dist/plugins/loader.js +117 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manifest.d.ts +21 -0
- package/dist/plugins/manifest.js +53 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/registry.d.ts +36 -0
- package/dist/plugins/registry.js +30 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/report.d.ts +9 -0
- package/dist/plugins/report.js +19 -0
- package/dist/plugins/report.js.map +1 -0
- package/dist/plugins/semver.d.ts +23 -0
- package/dist/plugins/semver.js +106 -0
- package/dist/plugins/semver.js.map +1 -0
- package/dist/plugins/session.d.ts +18 -0
- package/dist/plugins/session.js +22 -0
- package/dist/plugins/session.js.map +1 -0
- package/dist/testkit/contract.d.ts +33 -0
- package/dist/testkit/contract.js +118 -0
- package/dist/testkit/contract.js.map +1 -0
- package/dist/testkit/index.d.ts +15 -0
- package/dist/testkit/index.js +15 -0
- package/dist/testkit/index.js.map +1 -0
- package/docs/architecture.md +33 -5
- package/docs/artifacts/decision-record.md +54 -0
- package/docs/artifacts/tasks.md +37 -0
- package/docs/artifacts/tests.md +43 -0
- package/docs/cli-reference.md +255 -6
- package/docs/concepts/mcp-server.md +93 -0
- package/docs/contributing.md +9 -0
- package/docs/index.md +1 -1
- package/docs/plugin-api.md +124 -0
- package/docs/plugin-split.md +55 -0
- package/docs/plugin-trust.md +51 -0
- package/docs/tool-compatibility.md +71 -6
- package/docs/workflow.md +37 -5
- package/package.json +5 -2
- package/src/agents/worker.md +37 -0
- package/src/prompts/converge.md +8 -3
- package/src/prompts/decide.md +31 -0
- package/src/prompts/implement.md +15 -7
- package/src/prompts/revise.md +4 -2
- package/src/prompts/run.md +100 -0
- package/src/prompts/tasks.md +13 -3
- package/src/roles/security.md +17 -0
- package/src/templates/adr.md +29 -0
- package/src/templates/tasks.md +6 -0
- package/src/templates/tests.md +29 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DependencyGraph } from "./graph-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* FR-009: narrow a graph to one feature and its direct neighbours, in both directions (features it
|
|
4
|
+
* depends on and features that depend on it). `ref` matches the feature directory, its number or its
|
|
5
|
+
* display ref. Returns null when no feature matches. Pure; the input is not changed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function scopeToFeature(graph: DependencyGraph, ref: string): DependencyGraph | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FR-009: narrow a graph to one feature and its direct neighbours, in both directions (features it
|
|
3
|
+
* depends on and features that depend on it). `ref` matches the feature directory, its number or its
|
|
4
|
+
* display ref. Returns null when no feature matches. Pure; the input is not changed.
|
|
5
|
+
*/
|
|
6
|
+
export function scopeToFeature(graph, ref) {
|
|
7
|
+
const features = new Map();
|
|
8
|
+
for (const n of graph.nodes)
|
|
9
|
+
features.set(n.feature, { dir: n.feature, ref: n.ref });
|
|
10
|
+
const numberOf = (dir) => /^(\d+)/.exec(dir)?.[1] ?? dir;
|
|
11
|
+
const focus = [...features.values()].filter((f) => f.dir === ref || f.ref === ref || numberOf(f.dir) === ref);
|
|
12
|
+
if (focus.length === 0)
|
|
13
|
+
return null;
|
|
14
|
+
const keep = new Set(focus.map((f) => f.dir));
|
|
15
|
+
for (const e of graph.featureEdges) {
|
|
16
|
+
if (keep.has(e.from))
|
|
17
|
+
keep.add(e.to);
|
|
18
|
+
if (focus.some((f) => f.dir === e.to))
|
|
19
|
+
keep.add(e.from);
|
|
20
|
+
}
|
|
21
|
+
const nodes = graph.nodes.filter((n) => keep.has(n.feature));
|
|
22
|
+
const kept = new Set(nodes.map((n) => n.key));
|
|
23
|
+
return {
|
|
24
|
+
nodes,
|
|
25
|
+
edges: graph.edges.filter((e) => kept.has(e.from) && kept.has(e.to)),
|
|
26
|
+
featureEdges: graph.featureEdges.filter((e) => keep.has(e.from) && keep.has(e.to)),
|
|
27
|
+
broken: graph.broken.filter((b) => kept.has(b.from)),
|
|
28
|
+
cycles: graph.cycles.filter((c) => c.stories.every((s) => kept.has(s))),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=graph-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-scope.js","sourceRoot":"","sources":["../../src/core/graph-scope.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAsB,EAAE,GAAW;IAChE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwC,CAAC;IACjE,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK;QAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACrF,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;IACzE,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,QAAQ,CAAC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CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClF,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature 023: the shared dependency graph (types). Pure data, no behaviour. See `graph.ts` for
|
|
3
|
+
* `buildGraph`, `graph-paths.ts` for buildable/critical-path, `graph-format.ts` for text/JSON/Mermaid.
|
|
4
|
+
*/
|
|
5
|
+
/** `depends-on` = needs that story done first; `blocked-by` = something external blocks it. A story may use both. */
|
|
6
|
+
export type EdgeKind = "depends-on" | "blocked-by";
|
|
7
|
+
/** Why a dependency does not resolve (FR-004). */
|
|
8
|
+
export type BrokenReason = "unknown-story" | "unknown-feature";
|
|
9
|
+
export interface StoryNode {
|
|
10
|
+
/** Collision-safe internal key: `<feature dir>:<canonical story id>`, e.g. `905-top:US1`. */
|
|
11
|
+
key: string;
|
|
12
|
+
/** Display ID qualified by the feature's display ref, e.g. `905:US-1` (the directory name when two features share a number). */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Feature directory, e.g. `905-top`. */
|
|
15
|
+
feature: string;
|
|
16
|
+
/** Feature display ref, e.g. `905`. */
|
|
17
|
+
ref: string;
|
|
18
|
+
/** Story ID as written, e.g. `US-1`. */
|
|
19
|
+
story: string;
|
|
20
|
+
title: string;
|
|
21
|
+
status: string;
|
|
22
|
+
priority: string;
|
|
23
|
+
}
|
|
24
|
+
/** `from` depends on / is blocked by `to`. Both ends are node keys. */
|
|
25
|
+
export interface StoryEdge {
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
kind: EdgeKind;
|
|
29
|
+
}
|
|
30
|
+
/** Derived (FR-002): feature `from` depends on feature `to`; `via` records the story edges that cause it. Ends are feature dirs. */
|
|
31
|
+
export interface FeatureEdge {
|
|
32
|
+
from: string;
|
|
33
|
+
to: string;
|
|
34
|
+
via: StoryEdge[];
|
|
35
|
+
}
|
|
36
|
+
/** A dependency that names something that does not exist (FR-004): `from` is a node key, `to` is the reference as written. */
|
|
37
|
+
export interface BrokenEdge {
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
kind: EdgeKind;
|
|
41
|
+
reason: BrokenReason;
|
|
42
|
+
}
|
|
43
|
+
/** A dependency cycle (FR-005): node keys in dependency order; a self-dependency is a cycle of one. */
|
|
44
|
+
export interface GraphCycle {
|
|
45
|
+
stories: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface DependencyGraph {
|
|
48
|
+
/** Sorted by feature directory, then story number. */
|
|
49
|
+
nodes: StoryNode[];
|
|
50
|
+
/** Grouped by `from` node (in node order), each node's edges in declaration order, depends-on before blocked-by. */
|
|
51
|
+
edges: StoryEdge[];
|
|
52
|
+
featureEdges: FeatureEdge[];
|
|
53
|
+
broken: BrokenEdge[];
|
|
54
|
+
cycles: GraphCycle[];
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-types.js","sourceRoot":"","sources":["../../src/core/graph-types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DependencyGraph } from "./graph-types.js";
|
|
2
|
+
import type { FeatureSnapshot } from "./overview-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parse a dependency as stored on a story (`US1`, or `014US2` for a cross-feature `014:US-2`).
|
|
5
|
+
* `ref` is the target feature's number, or null when the dependency stays inside the story's feature.
|
|
6
|
+
* The single definition of the cross-feature syntax; nothing else resolves dependencies.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseDependencyRef(dep: string): {
|
|
9
|
+
ref: string | null;
|
|
10
|
+
local: string;
|
|
11
|
+
};
|
|
12
|
+
/** Collision-safe node key: story ids restart per feature, and two features can share a number. */
|
|
13
|
+
export declare function nodeKey(featureDir: string, canonicalId: string): string;
|
|
14
|
+
export declare function buildGraph(features: FeatureSnapshot[]): DependencyGraph;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { canonicalStoryId } from "./dashboard.js";
|
|
2
|
+
import { compareFeatureDirs } from "./features.js";
|
|
3
|
+
/**
|
|
4
|
+
* Feature 023: the one place that turns the stories of every feature into a dependency graph (FR-001).
|
|
5
|
+
* Pure: a function of `FeatureSnapshot[]`, no filesystem, no mutation of its input, same output for the
|
|
6
|
+
* same specs whatever order the features arrive in (FR-006). `analyze`, the dashboard, `ambykit graph`
|
|
7
|
+
* and later the run scheduler and the MCP server all read dependencies from here (FR-011).
|
|
8
|
+
*/
|
|
9
|
+
const QUALIFIED = /^(\d+)[:/]?(US\d+)$/;
|
|
10
|
+
/**
|
|
11
|
+
* Parse a dependency as stored on a story (`US1`, or `014US2` for a cross-feature `014:US-2`).
|
|
12
|
+
* `ref` is the target feature's number, or null when the dependency stays inside the story's feature.
|
|
13
|
+
* The single definition of the cross-feature syntax; nothing else resolves dependencies.
|
|
14
|
+
*/
|
|
15
|
+
export function parseDependencyRef(dep) {
|
|
16
|
+
const canonical = canonicalStoryId(dep);
|
|
17
|
+
const m = QUALIFIED.exec(canonical);
|
|
18
|
+
return m ? { ref: m[1] ?? null, local: m[2] ?? canonical } : { ref: null, local: canonical };
|
|
19
|
+
}
|
|
20
|
+
/** Collision-safe node key: story ids restart per feature, and two features can share a number. */
|
|
21
|
+
export function nodeKey(featureDir, canonicalId) {
|
|
22
|
+
return `${featureDir}:${canonicalId}`;
|
|
23
|
+
}
|
|
24
|
+
export function buildGraph(features) {
|
|
25
|
+
const sorted = [...features].sort((a, b) => compareFeatureDirs(a.dir, b.dir));
|
|
26
|
+
const nodes = [];
|
|
27
|
+
const byKey = new Map();
|
|
28
|
+
for (const f of sorted) {
|
|
29
|
+
for (const s of f.stories) {
|
|
30
|
+
const key = nodeKey(f.dir, s.id);
|
|
31
|
+
if (byKey.has(key))
|
|
32
|
+
continue; // a story id written twice in one spec: the first one wins
|
|
33
|
+
const node = {
|
|
34
|
+
key,
|
|
35
|
+
id: `${f.displayRef}:${s.displayId}`,
|
|
36
|
+
feature: f.dir,
|
|
37
|
+
ref: f.displayRef,
|
|
38
|
+
story: s.displayId,
|
|
39
|
+
title: s.title,
|
|
40
|
+
status: s.status,
|
|
41
|
+
priority: s.priority,
|
|
42
|
+
};
|
|
43
|
+
nodes.push(node);
|
|
44
|
+
byKey.set(key, node);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// A `NNN:US-#` reference targets the first feature carrying that number (same rule the dashboard used).
|
|
48
|
+
const featureByRef = new Map();
|
|
49
|
+
for (const f of sorted)
|
|
50
|
+
if (!featureByRef.has(f.ref))
|
|
51
|
+
featureByRef.set(f.ref, f);
|
|
52
|
+
const edges = [];
|
|
53
|
+
const broken = [];
|
|
54
|
+
const done = new Set();
|
|
55
|
+
for (const f of sorted) {
|
|
56
|
+
for (const s of f.stories) {
|
|
57
|
+
const from = nodeKey(f.dir, s.id);
|
|
58
|
+
if (done.has(from))
|
|
59
|
+
continue;
|
|
60
|
+
done.add(from);
|
|
61
|
+
const declared = [
|
|
62
|
+
["depends-on", s.dependsOn],
|
|
63
|
+
["blocked-by", s.blockedBy],
|
|
64
|
+
];
|
|
65
|
+
for (const [kind, deps] of declared) {
|
|
66
|
+
const seen = new Set();
|
|
67
|
+
for (const dep of deps) {
|
|
68
|
+
if (seen.has(dep))
|
|
69
|
+
continue;
|
|
70
|
+
seen.add(dep);
|
|
71
|
+
const { ref, local } = parseDependencyRef(dep);
|
|
72
|
+
const target = ref === null ? f : featureByRef.get(ref);
|
|
73
|
+
if (!target) {
|
|
74
|
+
broken.push({ from, to: dep, kind, reason: "unknown-feature" });
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const to = nodeKey(target.dir, local);
|
|
78
|
+
if (byKey.has(to))
|
|
79
|
+
edges.push({ from, to, kind });
|
|
80
|
+
else
|
|
81
|
+
broken.push({ from, to: dep, kind, reason: "unknown-story" });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return { nodes, edges, featureEdges: featureEdgesOf(edges, byKey), broken, cycles: cyclesOf(nodes, edges) };
|
|
87
|
+
}
|
|
88
|
+
/** FR-002: feature A depends on feature B when a story of A has an edge to a story of B; both kinds count. */
|
|
89
|
+
function featureEdgesOf(edges, byKey) {
|
|
90
|
+
const grouped = new Map();
|
|
91
|
+
for (const e of edges) {
|
|
92
|
+
const from = byKey.get(e.from)?.feature;
|
|
93
|
+
const to = byKey.get(e.to)?.feature;
|
|
94
|
+
if (!from || !to || from === to)
|
|
95
|
+
continue;
|
|
96
|
+
const id = `${from}\u0000${to}`;
|
|
97
|
+
const entry = grouped.get(id) ?? { from, to, via: [] };
|
|
98
|
+
entry.via.push({ ...e });
|
|
99
|
+
grouped.set(id, entry);
|
|
100
|
+
}
|
|
101
|
+
return [...grouped.values()].sort((a, b) => compareFeatureDirs(a.from, b.from) || compareFeatureDirs(a.to, b.to));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* FR-005: each dependency cycle as the ordered keys on it (a self-dependency is a cycle of one). One
|
|
105
|
+
* depth-first pass; a back edge to a node still on the stack closes a cycle.
|
|
106
|
+
*/
|
|
107
|
+
function cyclesOf(nodes, edges) {
|
|
108
|
+
const next = new Map();
|
|
109
|
+
for (const e of edges) {
|
|
110
|
+
const list = next.get(e.from) ?? [];
|
|
111
|
+
if (!list.includes(e.to))
|
|
112
|
+
list.push(e.to);
|
|
113
|
+
next.set(e.from, list);
|
|
114
|
+
}
|
|
115
|
+
const color = new Map(); // absent = unseen, 1 = on stack, 2 = finished
|
|
116
|
+
const stack = [];
|
|
117
|
+
const cycles = [];
|
|
118
|
+
const known = new Set();
|
|
119
|
+
const visit = (key) => {
|
|
120
|
+
color.set(key, 1);
|
|
121
|
+
stack.push(key);
|
|
122
|
+
for (const to of next.get(key) ?? []) {
|
|
123
|
+
const c = color.get(to);
|
|
124
|
+
if (c === 1) {
|
|
125
|
+
const stories = stack.slice(stack.indexOf(to));
|
|
126
|
+
const id = [...stories].sort().join("\u0000");
|
|
127
|
+
if (!known.has(id)) {
|
|
128
|
+
known.add(id);
|
|
129
|
+
cycles.push({ stories });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else if (c === undefined) {
|
|
133
|
+
visit(to);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
stack.pop();
|
|
137
|
+
color.set(key, 2);
|
|
138
|
+
};
|
|
139
|
+
for (const n of nodes)
|
|
140
|
+
if (!color.has(n.key))
|
|
141
|
+
visit(n.key);
|
|
142
|
+
return cycles;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/core/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAYnD;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAA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AC,CAAC,CAAC,GAAG,CAAC;YAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,6 +6,19 @@ export * from "./dashboard.js";
|
|
|
6
6
|
export * from "./rules.js";
|
|
7
7
|
export * from "./scaffold.js";
|
|
8
8
|
export * from "./analyze.js";
|
|
9
|
+
export * from "./test-design.js";
|
|
9
10
|
export * from "./git.js";
|
|
10
11
|
export * from "./worktree.js";
|
|
11
12
|
export * from "./roles.js";
|
|
13
|
+
export * from "./graph-types.js";
|
|
14
|
+
export * from "./graph.js";
|
|
15
|
+
export * from "./graph-paths.js";
|
|
16
|
+
export * from "./graph-scope.js";
|
|
17
|
+
export * from "./graph-format.js";
|
|
18
|
+
export * from "./trace-types.js";
|
|
19
|
+
export * from "./trace-requirements.js";
|
|
20
|
+
export * from "./trace-cite.js";
|
|
21
|
+
export * from "./trace-tests.js";
|
|
22
|
+
export * from "./trace-design.js";
|
|
23
|
+
export * from "./trace.js";
|
|
24
|
+
export * from "./trace-io.js";
|
package/dist/core/index.js
CHANGED
|
@@ -6,7 +6,20 @@ export * from "./dashboard.js";
|
|
|
6
6
|
export * from "./rules.js";
|
|
7
7
|
export * from "./scaffold.js";
|
|
8
8
|
export * from "./analyze.js";
|
|
9
|
+
export * from "./test-design.js";
|
|
9
10
|
export * from "./git.js";
|
|
10
11
|
export * from "./worktree.js";
|
|
11
12
|
export * from "./roles.js";
|
|
13
|
+
export * from "./graph-types.js";
|
|
14
|
+
export * from "./graph.js";
|
|
15
|
+
export * from "./graph-paths.js";
|
|
16
|
+
export * from "./graph-scope.js";
|
|
17
|
+
export * from "./graph-format.js";
|
|
18
|
+
export * from "./trace-types.js";
|
|
19
|
+
export * from "./trace-requirements.js";
|
|
20
|
+
export * from "./trace-cite.js";
|
|
21
|
+
export * from "./trace-tests.js";
|
|
22
|
+
export * from "./trace-design.js";
|
|
23
|
+
export * from "./trace.js";
|
|
24
|
+
export * from "./trace-io.js";
|
|
12
25
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The check-off-aware lane merge (feature 015 FR-019), extracted from `ambykit lane merge` so that command
|
|
3
|
+
* and `ambykit run` (feature 028, FR-011) share one implementation. Lanes are merged one at a time in name
|
|
4
|
+
* order. A `tasks.md` conflict that is only about check-offs is resolved; any other conflict aborts that
|
|
5
|
+
* merge, leaves the lane intact and is reported (FR-012). Git side effects only; no output.
|
|
6
|
+
*/
|
|
7
|
+
export type LaneMergeKind = "merged" | "nothing" | "dirty" | "conflict";
|
|
8
|
+
export interface LaneMergeResult {
|
|
9
|
+
lane: string;
|
|
10
|
+
result: LaneMergeKind;
|
|
11
|
+
detail?: string;
|
|
12
|
+
}
|
|
13
|
+
export type MergeLanesOutcome = {
|
|
14
|
+
ok: true;
|
|
15
|
+
lanes: LaneMergeResult[]; /** Lanes asked for that exist; empty means the feature has none. */
|
|
16
|
+
found: number;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
kind: "not-checked-out" | "dirty-checkout" | "no-lane";
|
|
20
|
+
error: string; /** The checkout, for `dirty-checkout`. */
|
|
21
|
+
path?: string;
|
|
22
|
+
};
|
|
23
|
+
/** The feature's branch and (when checked out somewhere) the checkout holding it. */
|
|
24
|
+
export declare function featureBranch(root: string, feature: string): {
|
|
25
|
+
branch: string;
|
|
26
|
+
checkout: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
/** Merge a feature's lanes (all, or the one `laneArg` names) into its checkout. */
|
|
29
|
+
export declare function mergeLanes(root: string, feature: string, laneArg?: string): MergeLanesOutcome;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { branchExists, git, gitWithInput, isDirty, isMerged, worktreeList } from "./git.js";
|
|
4
|
+
import { matchLane, mergeCheckoffs } from "./lanes.js";
|
|
5
|
+
import { findWorktree, laneWorktrees } from "./worktree.js";
|
|
6
|
+
/** The feature's branch and (when checked out somewhere) the checkout holding it. */
|
|
7
|
+
export function featureBranch(root, feature) {
|
|
8
|
+
const worktrees = worktreeList(root);
|
|
9
|
+
const wt = findWorktree(root, feature, worktrees);
|
|
10
|
+
if (wt?.branch)
|
|
11
|
+
return { branch: wt.branch, checkout: wt.path };
|
|
12
|
+
if (!branchExists(root, feature))
|
|
13
|
+
return null;
|
|
14
|
+
const holder = worktrees.find((w) => w.branch === feature);
|
|
15
|
+
return { branch: feature, checkout: holder?.path ?? null };
|
|
16
|
+
}
|
|
17
|
+
function hasMergeHead(cwd) {
|
|
18
|
+
try {
|
|
19
|
+
git(cwd, ["rev-parse", "-q", "--verify", "MERGE_HEAD"]);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function abortMerge(cwd) {
|
|
27
|
+
try {
|
|
28
|
+
git(cwd, ["merge", "--abort"]);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
/* nothing to abort */
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Auto-resolve a tasks.md conflict that is only about check-offs. False when it is more than that. */
|
|
35
|
+
function resolveCheckoffs(checkout, tasksRel) {
|
|
36
|
+
const stage = (n) => {
|
|
37
|
+
try {
|
|
38
|
+
return gitWithInput(checkout, ["show", `:${n}:${tasksRel}`], "").toString("utf8");
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const merged = mergeCheckoffs(stage(1), stage(2), stage(3));
|
|
45
|
+
if (merged === null)
|
|
46
|
+
return false;
|
|
47
|
+
writeFileSync(join(checkout, tasksRel), merged, "utf8");
|
|
48
|
+
git(checkout, ["add", tasksRel]);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
/** Merge a feature's lanes (all, or the one `laneArg` names) into its checkout. */
|
|
52
|
+
export function mergeLanes(root, feature, laneArg) {
|
|
53
|
+
const worktrees = worktreeList(root);
|
|
54
|
+
const fb = featureBranch(root, feature);
|
|
55
|
+
if (!fb || !fb.checkout) {
|
|
56
|
+
return { ok: false, kind: "not-checked-out", error: `${feature} is not checked out anywhere — check out its branch (or \`ambykit worktree ${feature}\`) first.` };
|
|
57
|
+
}
|
|
58
|
+
const checkout = fb.checkout;
|
|
59
|
+
if (isDirty(checkout)) {
|
|
60
|
+
return { ok: false, kind: "dirty-checkout", path: checkout, error: `${checkout} has uncommitted changes — commit or stash them before merging lanes.` };
|
|
61
|
+
}
|
|
62
|
+
const all = laneWorktrees(root, worktrees)
|
|
63
|
+
.filter((l) => l.feature === feature)
|
|
64
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
65
|
+
let lanes = all;
|
|
66
|
+
if (laneArg) {
|
|
67
|
+
const name = matchLane(feature, all.map((l) => l.name), laneArg);
|
|
68
|
+
if (!name)
|
|
69
|
+
return { ok: false, kind: "no-lane", error: `No lane '${laneArg}' for ${feature}. Lanes: ${all.map((l) => l.name).join(", ") || "(none)"}` };
|
|
70
|
+
lanes = all.filter((l) => l.name === name);
|
|
71
|
+
}
|
|
72
|
+
const tasksRel = `specs/${feature}/tasks.md`;
|
|
73
|
+
const report = [];
|
|
74
|
+
for (const l of lanes) {
|
|
75
|
+
if (existsSync(l.worktree.path) && isDirty(l.worktree.path)) {
|
|
76
|
+
report.push({ lane: l.name, result: "dirty", detail: "has uncommitted changes — commit first" });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (isMerged(root, l.name, fb.branch)) {
|
|
80
|
+
report.push({ lane: l.name, result: "nothing" });
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
git(checkout, ["merge", "--no-ff", "--no-commit", l.name]);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
const unmerged = git(checkout, ["diff", "--name-only", "--diff-filter=U"]).split(/\r?\n/).filter(Boolean);
|
|
88
|
+
const resolved = unmerged.length === 1 && unmerged[0] === tasksRel ? resolveCheckoffs(checkout, tasksRel) : false;
|
|
89
|
+
if (!resolved) {
|
|
90
|
+
abortMerge(checkout);
|
|
91
|
+
report.push({
|
|
92
|
+
lane: l.name,
|
|
93
|
+
result: "conflict",
|
|
94
|
+
detail: unmerged.length > 0 ? `conflicts in ${unmerged.join(", ")} — merge it by hand` : "merge failed",
|
|
95
|
+
});
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (hasMergeHead(checkout))
|
|
100
|
+
git(checkout, ["commit", "-q", "-m", `Merge lane ${l.name}`]);
|
|
101
|
+
report.push({ lane: l.name, result: "merged" });
|
|
102
|
+
}
|
|
103
|
+
return { ok: true, lanes: report, found: lanes.length };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=lane-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lane-merge.js","sourceRoot":"","sources":["../../src/core/lane-merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAqB5D,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,OAAe;IACzD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAClD,IAAI,EAAE,EAAE,MAAM;QAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,E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AAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-line markers and per-phase Verify lines (feature 020). Pure and IO-free: `parseTasks` calls
|
|
3
|
+
* `parseMarkers` on the text after the task id, and `parsePhases` reads the Verify line of each phase.
|
|
4
|
+
* Markers are the trailing segment of a task line, after the `(file/path)` group, so a reason that
|
|
5
|
+
* contains parentheses or backticks can never be read as file ownership.
|
|
6
|
+
*/
|
|
7
|
+
/** Result of cutting the trailing markers off a task line's text. */
|
|
8
|
+
export interface ParsedMarkers {
|
|
9
|
+
/** The line text before the first marker (the input, untouched, when there is none). */
|
|
10
|
+
body: string;
|
|
11
|
+
/** BLOCKED reason(s) joined with ` | `; `""` = marker present with no reason. Undefined = not blocked. */
|
|
12
|
+
blocked?: string;
|
|
13
|
+
/** DEVIATION note(s) joined with ` | `. */
|
|
14
|
+
deviation?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Cut `⚠ BLOCKED: <reason>` and `↪ DEVIATION: <note>` (glyphs optional) off the end of a task line.
|
|
18
|
+
* A marker's text runs to the next marker or the end of the line. Several markers of one kind are
|
|
19
|
+
* joined with ` | `. Keywords inside backtick code spans are ignored, so prose that documents the
|
|
20
|
+
* syntax is not read as a marker.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseMarkers(rest: string): ParsedMarkers;
|
|
23
|
+
/** N from a `## Phase N` heading text, else the 1-based `##` ordinal (the rule `parseTasks` always used). */
|
|
24
|
+
export declare function phaseNumber(heading: string, ordinal: number): number;
|
|
25
|
+
export type VerifyResult = "passed" | "failed" | "unverified";
|
|
26
|
+
/** The Verify line of one phase (feature 020 FR-005). */
|
|
27
|
+
export interface PhaseVerify {
|
|
28
|
+
/** Same numbering as `TaskLine.phase`. */
|
|
29
|
+
phase: number;
|
|
30
|
+
/** Heading text after `## `. */
|
|
31
|
+
title: string;
|
|
32
|
+
/** Task lines in the phase; a phase is only verifiable when this is above zero. */
|
|
33
|
+
tasks: number;
|
|
34
|
+
/** The check, without its result suffix; undefined when the phase has no Verify line. */
|
|
35
|
+
check?: string;
|
|
36
|
+
/** Last recorded result; undefined = no result recorded yet. */
|
|
37
|
+
result?: VerifyResult;
|
|
38
|
+
/** Reason after `✗ failed:`; may be empty. */
|
|
39
|
+
why?: string;
|
|
40
|
+
/** Further Verify lines in the same phase; only the first is used. */
|
|
41
|
+
duplicates: number;
|
|
42
|
+
}
|
|
43
|
+
/** Per-phase Verify lines of a tasks.md body, numbered exactly as `parseTasks` numbers phases. */
|
|
44
|
+
export declare function parsePhases(content: string): PhaseVerify[];
|