@ambystech/ambykit 1.6.0 → 2.0.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 +152 -2
- package/README.md +12 -8
- 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 +1 -1
- package/dist/cli/dashboard.js +55 -14
- 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 -111
- 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 -1
- package/dist/cli/lane.js +116 -5
- 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 +7 -0
- package/dist/cli/run-budget.js +42 -5
- package/dist/cli/run-budget.js.map +1 -1
- package/dist/cli/run-control.d.ts +12 -0
- package/dist/cli/run-control.js +24 -2
- package/dist/cli/run-control.js.map +1 -1
- package/dist/cli/run-files.d.ts +1 -1
- 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.js +2 -2
- package/dist/cli/run-gates.js.map +1 -1
- package/dist/cli/run-launch.js +22 -5
- package/dist/cli/run-launch.js.map +1 -1
- package/dist/cli/run-loop.d.ts +2 -0
- package/dist/cli/run-loop.js +51 -4
- package/dist/cli/run-loop.js.map +1 -1
- package/dist/cli/run-merger.d.ts +6 -0
- package/dist/cli/run-merger.js +40 -2
- package/dist/cli/run-merger.js.map +1 -1
- 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 +1 -1
- package/dist/cli/run-plan.js +24 -11
- package/dist/cli/run-plan.js.map +1 -1
- package/dist/cli/run-process.d.ts +6 -0
- package/dist/cli/run-process.js +17 -5
- package/dist/cli/run-process.js.map +1 -1
- package/dist/cli/run-protocol-prompts.d.ts +11 -1
- package/dist/cli/run-protocol-prompts.js +32 -5
- package/dist/cli/run-protocol-prompts.js.map +1 -1
- package/dist/cli/run-protocol.d.ts +8 -1
- package/dist/cli/run-protocol.js +35 -6
- package/dist/cli/run-protocol.js.map +1 -1
- package/dist/cli/run-script.js +3 -2
- package/dist/cli/run-script.js.map +1 -1
- package/dist/cli/run-session.d.ts +33 -0
- package/dist/cli/run-session.js.map +1 -1
- 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.js +26 -3
- package/dist/cli/run-supervisor.js.map +1 -1
- package/dist/cli/run.d.ts +11 -3
- package/dist/cli/run.js +86 -12
- package/dist/cli/run.js.map +1 -1
- 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-view.d.ts +1 -0
- package/dist/cli/ui/dashboard/fleet-view.js +1 -1
- package/dist/cli/ui/dashboard/fleet-view.js.map +1 -1
- package/dist/cli/ui/dashboard/help-overlay.d.ts +3 -1
- package/dist/cli/ui/dashboard/help-overlay.js +27 -5
- 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/interactive/fullscreen.js +13 -3
- 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/overview.d.ts +37 -2
- package/dist/cli/ui/interactive/overview.js +321 -31
- 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 +3 -0
- package/dist/core/config.js +10 -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/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/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/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-launch-plan.d.ts +2 -0
- package/dist/core/run-launch-plan.js +6 -1
- package/dist/core/run-launch-plan.js.map +1 -1
- package/dist/core/run-prompt.d.ts +43 -1
- package/dist/core/run-prompt.js +40 -4
- package/dist/core/run-prompt.js.map +1 -1
- 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-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/runners.d.ts +58 -3
- package/dist/core/runners.js +99 -13
- package/dist/core/runners.js.map +1 -1
- 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 +14 -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 +205 -12
- 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 +27 -6
- 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,199 @@
|
|
|
1
|
+
// Migrate safety (030:FR-006, FR-024, SC-010). A file `migrate` cannot convert provably is left untouched and listed
|
|
2
|
+
// with its reason; every conversion is read back through the real readers and must reproduce the model of the 1.x file.
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { readSpec, readSpecV1, readTasks, readTasksV1 } from "../spec-format/dispatch.js";
|
|
5
|
+
export const HEADING = /^#{2,4}\s+(US-?\d+)\s*[—–-]\s*(.+?)\s*$/;
|
|
6
|
+
export const RE_STATUS = /\*\*status:\*\*\s*([a-z-]+)/i;
|
|
7
|
+
export const RE_DEP = /\*\*depends-on:\*\*\s*(.+)$/i;
|
|
8
|
+
export const RE_BLK = /\*\*blocked-by:\*\*\s*(.+)$/i;
|
|
9
|
+
export const RE_PRI = /\*\*priority:\*\*\s*(P\d)/i;
|
|
10
|
+
export const BULLET = /^\s*[-*]\s+\*\*(status|depends-on|blocked-by|priority):\*\*/i;
|
|
11
|
+
export const TASK = /^\s*-\s*\[([ xX])\]\s*\[(T\d+)\]\s*(.*)$/;
|
|
12
|
+
export const VERIFY = /^\s*(?:-\s*)?\*\*Verify:\*\*\s*(.*?)\s*$/;
|
|
13
|
+
const FENCE = /^\s*(`{3,}|~{3,})/;
|
|
14
|
+
const skip = (kind, reason, fix) => ({ kind, reason, fix });
|
|
15
|
+
/** `\n`, `\r\n`, or null when the file mixes both. */
|
|
16
|
+
export function eolOf(text) {
|
|
17
|
+
const crlf = /\r\n/.test(text);
|
|
18
|
+
const bare = /(^|[^\r])\n/.test(text);
|
|
19
|
+
if (crlf && bare)
|
|
20
|
+
return null;
|
|
21
|
+
return crlf ? "\r\n" : "\n";
|
|
22
|
+
}
|
|
23
|
+
/** 0-based indexes of lines inside a code fence (backtick or tilde), fences included. */
|
|
24
|
+
export function fencedLines(lines) {
|
|
25
|
+
const set = new Set();
|
|
26
|
+
let open = null;
|
|
27
|
+
lines.forEach((l, i) => {
|
|
28
|
+
const m = FENCE.exec(l);
|
|
29
|
+
if (open) {
|
|
30
|
+
set.add(i);
|
|
31
|
+
if (m && (m[1] ?? "")[0] === open[0] && (m[1] ?? "").length >= open.length && l.trim() === m[1])
|
|
32
|
+
open = null;
|
|
33
|
+
}
|
|
34
|
+
else if (m) {
|
|
35
|
+
open = m[1] ?? null;
|
|
36
|
+
set.add(i);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return set;
|
|
40
|
+
}
|
|
41
|
+
/** Frontmatter bounds of a 1.x file: 0-based index of the closing `---` line, or -1 when none, or null when unclosed. */
|
|
42
|
+
export function frontmatterEnd(lines) {
|
|
43
|
+
if (lines[0] !== "---")
|
|
44
|
+
return -1;
|
|
45
|
+
const close = lines.indexOf("---", 1);
|
|
46
|
+
return close === -1 ? null : close;
|
|
47
|
+
}
|
|
48
|
+
const common = (text) => {
|
|
49
|
+
if (text.charCodeAt(0) === 0xfeff)
|
|
50
|
+
return skip("bom", "file starts with a byte-order mark", "save the file without a BOM, then run migrate again");
|
|
51
|
+
if (eolOf(text) === null)
|
|
52
|
+
return skip("mixed-eol", "mixed line endings (CRLF and LF)", "make the line endings consistent, then run migrate again");
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Pre-conversion scan of a 1.x spec.md (FR-006): BOM, mixed line endings, an unclosed frontmatter, story metadata that is
|
|
57
|
+
* prose or inside a code fence or repeated, a key the 1.x reader would not have read, and a conflicting priority.
|
|
58
|
+
*/
|
|
59
|
+
export function scanSpec(text) {
|
|
60
|
+
const c = common(text);
|
|
61
|
+
if (c)
|
|
62
|
+
return c;
|
|
63
|
+
const lines = text.split(/\r?\n/);
|
|
64
|
+
const fmEnd = frontmatterEnd(lines);
|
|
65
|
+
if (fmEnd === null)
|
|
66
|
+
return skip("frontmatter-unclosed", "frontmatter is not closed with ---", "close the frontmatter with a --- line");
|
|
67
|
+
const raw = fmEnd > 0 ? lines.slice(1, fmEnd).join("\n") : "";
|
|
68
|
+
if (/^stories\s*:/m.test(raw))
|
|
69
|
+
return skip("stories-key", "frontmatter has a `stories` key that is not a list; refusing to overwrite", "fix or remove the key");
|
|
70
|
+
const fenced = fencedLines(lines);
|
|
71
|
+
const seen = new Map();
|
|
72
|
+
let cur = null;
|
|
73
|
+
for (let i = fmEnd + 1; i < lines.length; i++) {
|
|
74
|
+
const line = lines[i] ?? "";
|
|
75
|
+
const h = HEADING.exec(line);
|
|
76
|
+
if (h) {
|
|
77
|
+
if (fenced.has(i))
|
|
78
|
+
return skip("fenced-heading", `story heading inside a code fence (line ${i + 1})`, "move the heading out of the fence or reword it");
|
|
79
|
+
const p = /\(priority:\s*(P\d)\)/i.exec(h[2] ?? "");
|
|
80
|
+
cur = { id: h[1] ?? "", priority: p ? (p[1] ?? "").toUpperCase() : "" };
|
|
81
|
+
seen.set(cur.id, new Set());
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!cur)
|
|
85
|
+
continue;
|
|
86
|
+
if (![RE_STATUS, RE_DEP, RE_BLK, RE_PRI].some((r) => r.test(line)))
|
|
87
|
+
continue;
|
|
88
|
+
if (fenced.has(i))
|
|
89
|
+
return skip("fenced-metadata", `story metadata inside a code fence (line ${i + 1})`, "reword or move the fenced example");
|
|
90
|
+
const b = BULLET.exec(line);
|
|
91
|
+
if (!b) {
|
|
92
|
+
return skip("prose-metadata", `story metadata inside prose, not a bullet (line ${i + 1}): moving it would change the sentence`, "put the metadata on its own bullet or reword the sentence");
|
|
93
|
+
}
|
|
94
|
+
const keys = [RE_STATUS, RE_DEP, RE_BLK, RE_PRI].filter((r) => r.test(line)).length;
|
|
95
|
+
if (keys !== 1)
|
|
96
|
+
return skip("multi-key-line", `line ${i + 1} carries more than one metadata key`, "put each key on its own bullet");
|
|
97
|
+
const kind = (b[1] ?? "").toLowerCase();
|
|
98
|
+
const set = seen.get(cur.id);
|
|
99
|
+
if (set.has(kind)) {
|
|
100
|
+
return skip("duplicate-bullet", `${cur.id} has two ${kind} bullets (line ${i + 1}); the 1.x reader keeps the last, which a move would hide`, `keep one ${kind} bullet`);
|
|
101
|
+
}
|
|
102
|
+
set.add(kind);
|
|
103
|
+
if (kind === "priority") {
|
|
104
|
+
const v = (RE_PRI.exec(line)?.[1] ?? "").toUpperCase();
|
|
105
|
+
if (cur.priority && cur.priority !== v) {
|
|
106
|
+
return skip("conflicting-priority", `${cur.id}: heading priority ${cur.priority} conflicts with bullet ${v} (line ${i + 1})`, "make the heading and the bullet agree");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
/** Pre-conversion scan of a 1.x tasks.md (FR-006): BOM, mixed endings, markup in a fence, two Verify lines, a repeated task id. */
|
|
113
|
+
export function scanTasks(text) {
|
|
114
|
+
const c = common(text);
|
|
115
|
+
if (c)
|
|
116
|
+
return c;
|
|
117
|
+
const lines = text.split(/\r?\n/);
|
|
118
|
+
const fenced = fencedLines(lines);
|
|
119
|
+
const phases = [];
|
|
120
|
+
for (let i = 0; i < lines.length; i++) {
|
|
121
|
+
const l = lines[i] ?? "";
|
|
122
|
+
const isHeading = /^##\s+/.test(l);
|
|
123
|
+
const tm = TASK.exec(l);
|
|
124
|
+
const isVerify = VERIFY.test(l);
|
|
125
|
+
if (fenced.has(i)) {
|
|
126
|
+
if (isHeading || tm || isVerify) {
|
|
127
|
+
return skip("fenced-markup", `task, phase or Verify markup inside a code fence (line ${i + 1})`, "reword or move the fenced example");
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (isHeading) {
|
|
132
|
+
phases.push({ verify: 0, ids: [] });
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const cur = phases[phases.length - 1];
|
|
136
|
+
if (!cur)
|
|
137
|
+
continue;
|
|
138
|
+
if (tm)
|
|
139
|
+
cur.ids.push(tm[2] ?? "");
|
|
140
|
+
else if (isVerify)
|
|
141
|
+
cur.verify += 1;
|
|
142
|
+
}
|
|
143
|
+
for (const [k, p] of phases.entries()) {
|
|
144
|
+
if (p.verify > 1)
|
|
145
|
+
return skip("duplicate-verify", `phase ${k + 1} has ${p.verify} Verify lines; migrating would have to pick one`, "keep one Verify line per phase");
|
|
146
|
+
if (new Set(p.ids).size !== p.ids.length) {
|
|
147
|
+
return skip("duplicate-task-id", `phase ${k + 1} repeats a task id; ownership keyed by id would be ambiguous`, "give every task in a phase its own id");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
/** Content hash used to detect an edit between read and write (FR-024). */
|
|
153
|
+
export function hashText(text) {
|
|
154
|
+
return createHash("sha256").update(text).digest("hex");
|
|
155
|
+
}
|
|
156
|
+
// ── read-back: the converted file must give the model of the 1.x file ─────────────────────────────
|
|
157
|
+
const stripGroup = (desc, t) => t.paths.length === 0 && t.pathIssue !== "glob" ? desc : desc.replace(/\s*\([^()]*\)\s*$/, "").trim();
|
|
158
|
+
const storyView = (s) => ({ id: s.id, title: s.title, priority: s.priority, status: s.status, dependsOn: s.dependsOn, blockedBy: s.blockedBy });
|
|
159
|
+
const taskView = (t, strip) => ({
|
|
160
|
+
id: t.id,
|
|
161
|
+
done: t.done,
|
|
162
|
+
story: t.story,
|
|
163
|
+
description: strip ? stripGroup(t.description, t) : t.description,
|
|
164
|
+
phase: t.phase,
|
|
165
|
+
parallel: t.parallel,
|
|
166
|
+
paths: t.paths,
|
|
167
|
+
pathIssue: t.pathIssue,
|
|
168
|
+
blocked: t.blocked,
|
|
169
|
+
deviation: t.deviation,
|
|
170
|
+
});
|
|
171
|
+
const phaseView = (p) => ({ phase: p.phase, title: p.title, tasks: p.tasks, check: p.check, result: p.result, why: p.why, duplicates: p.duplicates });
|
|
172
|
+
function diff(label, a, b, out) {
|
|
173
|
+
if (JSON.stringify(a) !== JSON.stringify(b))
|
|
174
|
+
out.push(`${label} differs`);
|
|
175
|
+
}
|
|
176
|
+
/** Differences between the 1.x spec model and the model the readers give for the converted text (empty = equal). */
|
|
177
|
+
export function specReadBack(feature, before, after) {
|
|
178
|
+
const out = [];
|
|
179
|
+
const a = readSpecV1(feature, before).map(storyView);
|
|
180
|
+
const r = readSpec(feature, after, { file: "spec.md" });
|
|
181
|
+
for (const i of r.issues)
|
|
182
|
+
if (i.severity === "error")
|
|
183
|
+
out.push(`${i.file}:${i.line} ${i.message}`);
|
|
184
|
+
diff("stories", a, r.stories.map(storyView), out);
|
|
185
|
+
return out;
|
|
186
|
+
}
|
|
187
|
+
/** Same for tasks.md: tasks (ownership included) and every phase's Verify data. */
|
|
188
|
+
export function tasksReadBack(before, after) {
|
|
189
|
+
const out = [];
|
|
190
|
+
const a = readTasksV1(before);
|
|
191
|
+
const r = readTasks(after, { file: "tasks.md" });
|
|
192
|
+
for (const i of r.issues)
|
|
193
|
+
if (i.severity === "error")
|
|
194
|
+
out.push(`${i.file}:${i.line} ${i.message}`);
|
|
195
|
+
diff("tasks", a.tasks.map((t) => taskView(t, true)), r.tasks.map((t) => taskView(t, false)), out);
|
|
196
|
+
diff("phases", a.phases.map(phaseView), r.phases.map(phaseView), out);
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety.js","sourceRoot":"","sources":["../../../src/core/migrate/safety.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,wHAAwH;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAU1F,MAAM,CAAC,MAAM,OAAO,GAAG,yCAAyC,CAAC;AACjE,MAAM,CAAC,MAAM,SAAS,GAA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AC,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type RecordStatus = "converted" | "unchanged" | "skipped";
|
|
2
|
+
/** One spec.md or tasks.md considered by a migrate run. */
|
|
3
|
+
export interface MigrateRecord {
|
|
4
|
+
feature: string;
|
|
5
|
+
file: "spec.md" | "tasks.md";
|
|
6
|
+
status: RecordStatus;
|
|
7
|
+
/** Why unchanged or skipped. */
|
|
8
|
+
reason?: string;
|
|
9
|
+
/** What to do about a skip. */
|
|
10
|
+
fix?: string;
|
|
11
|
+
/** Lines added and removed (converted files). */
|
|
12
|
+
add?: number;
|
|
13
|
+
del?: number;
|
|
14
|
+
/** Extra facts shown beside a conversion: minimal frontmatter added, headings stripped, transitional dual-write… */
|
|
15
|
+
notes?: string[];
|
|
16
|
+
/** Original and converted text, kept only to render `--diff`. */
|
|
17
|
+
before?: string;
|
|
18
|
+
after?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Lines added and removed between two texts, counted as a multiset so a moved line is neither. */
|
|
21
|
+
export declare function lineDelta(before: string, after: string): {
|
|
22
|
+
add: number;
|
|
23
|
+
del: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A unified diff (3 lines of context) of two texts. Longest-common-subsequence based, deterministic. Files whose line
|
|
27
|
+
* product is beyond a safe size get a one-line notice instead of a diff.
|
|
28
|
+
*/
|
|
29
|
+
export declare function unifiedDiff(path: string, before: string, after: string, context?: number): string;
|
|
30
|
+
export interface SummaryOptions {
|
|
31
|
+
dryRun?: boolean;
|
|
32
|
+
/** Append each converted file's unified diff. */
|
|
33
|
+
diff?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** The per-feature summary and totals. Deterministic: features and files in the order given. */
|
|
36
|
+
export declare function summarize(records: MigrateRecord[], opts?: SummaryOptions): string;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Migrate output (030:FR-007, FR-008): a per-feature summary of what changed (lines added and removed per file), what was
|
|
2
|
+
// skipped and the fix each skip needs, plus the unified diff of each change for `--diff`. Strings only, no filesystem.
|
|
3
|
+
/** Lines added and removed between two texts, counted as a multiset so a moved line is neither. */
|
|
4
|
+
export function lineDelta(before, after) {
|
|
5
|
+
const count = (t) => {
|
|
6
|
+
const m = new Map();
|
|
7
|
+
for (const l of t.split(/\r?\n/))
|
|
8
|
+
m.set(l, (m.get(l) ?? 0) + 1);
|
|
9
|
+
return m;
|
|
10
|
+
};
|
|
11
|
+
const a = count(before);
|
|
12
|
+
const b = count(after);
|
|
13
|
+
let add = 0;
|
|
14
|
+
let del = 0;
|
|
15
|
+
for (const [l, n] of b)
|
|
16
|
+
add += Math.max(0, n - (a.get(l) ?? 0));
|
|
17
|
+
for (const [l, n] of a)
|
|
18
|
+
del += Math.max(0, n - (b.get(l) ?? 0));
|
|
19
|
+
return { add, del };
|
|
20
|
+
}
|
|
21
|
+
const MAX_CELLS = 25_000_000;
|
|
22
|
+
/** Lines of a text; a final newline does not make an extra empty line. */
|
|
23
|
+
function toLines(t) {
|
|
24
|
+
const l = t.split(/\r?\n/);
|
|
25
|
+
if (l.length > 0 && l[l.length - 1] === "")
|
|
26
|
+
l.pop();
|
|
27
|
+
return l;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A unified diff (3 lines of context) of two texts. Longest-common-subsequence based, deterministic. Files whose line
|
|
31
|
+
* product is beyond a safe size get a one-line notice instead of a diff.
|
|
32
|
+
*/
|
|
33
|
+
export function unifiedDiff(path, before, after, context = 3) {
|
|
34
|
+
if (before === after)
|
|
35
|
+
return "";
|
|
36
|
+
const a = toLines(before);
|
|
37
|
+
const b = toLines(after);
|
|
38
|
+
if (a.length * b.length > MAX_CELLS)
|
|
39
|
+
return `--- a/${path}\n+++ b/${path}\n(diff too large to show: ${a.length} -> ${b.length} lines)`;
|
|
40
|
+
const n = a.length;
|
|
41
|
+
const m = b.length;
|
|
42
|
+
const w = m + 1;
|
|
43
|
+
const lcs = new Uint32Array((n + 1) * w);
|
|
44
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
45
|
+
for (let j = m - 1; j >= 0; j--) {
|
|
46
|
+
lcs[i * w + j] = a[i] === b[j] ? lcs[(i + 1) * w + j + 1] + 1 : Math.max(lcs[(i + 1) * w + j], lcs[i * w + j + 1]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const ops = [];
|
|
50
|
+
let i = 0;
|
|
51
|
+
let j = 0;
|
|
52
|
+
while (i < n || j < m) {
|
|
53
|
+
if (i < n && j < m && a[i] === b[j]) {
|
|
54
|
+
ops.push({ t: " ", line: a[i], ai: i, bi: j });
|
|
55
|
+
i++;
|
|
56
|
+
j++;
|
|
57
|
+
}
|
|
58
|
+
else if (i < n && (j === m || lcs[(i + 1) * w + j] >= lcs[i * w + j + 1])) {
|
|
59
|
+
ops.push({ t: "-", line: a[i], ai: i, bi: j });
|
|
60
|
+
i++;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
ops.push({ t: "+", line: b[j], ai: i, bi: j });
|
|
64
|
+
j++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const changeAt = ops.map((o, k) => (o.t === " " ? -1 : k)).filter((k) => k !== -1);
|
|
68
|
+
if (changeAt.length === 0)
|
|
69
|
+
return "";
|
|
70
|
+
// merge change positions into hunks with `context` lines on each side
|
|
71
|
+
const hunks = [];
|
|
72
|
+
for (const k of changeAt) {
|
|
73
|
+
const from = Math.max(0, k - context);
|
|
74
|
+
const to = Math.min(ops.length - 1, k + context);
|
|
75
|
+
const last = hunks[hunks.length - 1];
|
|
76
|
+
if (last && from <= last[1] + 1)
|
|
77
|
+
last[1] = Math.max(last[1], to);
|
|
78
|
+
else
|
|
79
|
+
hunks.push([from, to]);
|
|
80
|
+
}
|
|
81
|
+
const out = [`--- a/${path}`, `+++ b/${path}`];
|
|
82
|
+
for (const [from, to] of hunks) {
|
|
83
|
+
const slice = ops.slice(from, to + 1);
|
|
84
|
+
const first = slice[0];
|
|
85
|
+
const aStart = first.ai + 1;
|
|
86
|
+
const bStart = first.bi + 1;
|
|
87
|
+
const aLen = slice.filter((o) => o.t !== "+").length;
|
|
88
|
+
const bLen = slice.filter((o) => o.t !== "-").length;
|
|
89
|
+
out.push(`@@ -${aLen === 0 ? first.ai : aStart},${aLen} +${bLen === 0 ? first.bi : bStart},${bLen} @@`);
|
|
90
|
+
for (const o of slice)
|
|
91
|
+
out.push(`${o.t}${o.line}`);
|
|
92
|
+
}
|
|
93
|
+
return out.join("\n");
|
|
94
|
+
}
|
|
95
|
+
const pad = (s, n) => s + " ".repeat(Math.max(0, n - s.length));
|
|
96
|
+
/** The per-feature summary and totals. Deterministic: features and files in the order given. */
|
|
97
|
+
export function summarize(records, opts = {}) {
|
|
98
|
+
const out = [];
|
|
99
|
+
out.push(opts.dryRun ? "Dry run: nothing was written. This is what migrate would do." : "Migrated.");
|
|
100
|
+
const byFeature = new Map();
|
|
101
|
+
for (const r of records)
|
|
102
|
+
byFeature.set(r.feature, [...(byFeature.get(r.feature) ?? []), r]);
|
|
103
|
+
for (const [feature, recs] of byFeature) {
|
|
104
|
+
const converted = recs.filter((r) => r.status === "converted");
|
|
105
|
+
const add = converted.reduce((s, r) => s + (r.add ?? 0), 0);
|
|
106
|
+
const del = converted.reduce((s, r) => s + (r.del ?? 0), 0);
|
|
107
|
+
out.push("", `${feature}${converted.length > 0 ? ` (+${add} -${del})` : ""}`);
|
|
108
|
+
for (const r of recs) {
|
|
109
|
+
const label = pad(r.file, 9);
|
|
110
|
+
if (r.status === "converted") {
|
|
111
|
+
const notes = r.notes && r.notes.length > 0 ? ` (${r.notes.join("; ")})` : "";
|
|
112
|
+
out.push(` ${label}${opts.dryRun ? "would convert" : "converted"} +${r.add ?? 0} -${r.del ?? 0}${notes}`);
|
|
113
|
+
}
|
|
114
|
+
else if (r.status === "unchanged") {
|
|
115
|
+
out.push(` ${label}unchanged${r.reason ? ` (${r.reason})` : ""}`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
out.push(` ${label}SKIPPED untouched: ${r.reason ?? "not safe to convert"}`);
|
|
119
|
+
if (r.fix)
|
|
120
|
+
out.push(` ${" ".repeat(9)}fix: ${r.fix}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const by = (s) => records.filter((r) => r.status === s);
|
|
125
|
+
const total = by("converted");
|
|
126
|
+
const add = total.reduce((s, r) => s + (r.add ?? 0), 0);
|
|
127
|
+
const del = total.reduce((s, r) => s + (r.del ?? 0), 0);
|
|
128
|
+
out.push("", `Total: ${total.length} ${opts.dryRun ? "to convert" : "converted"}, ${by("unchanged").length} unchanged, ${by("skipped").length} skipped (left untouched) — +${add} -${del} lines`);
|
|
129
|
+
if (opts.diff) {
|
|
130
|
+
for (const r of total) {
|
|
131
|
+
if (r.before === undefined || r.after === undefined)
|
|
132
|
+
continue;
|
|
133
|
+
const d = unifiedDiff(`specs/${r.feature}/${r.file}`, r.before, r.after);
|
|
134
|
+
if (d)
|
|
135
|
+
out.push("", d);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return out.join("\n");
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../../src/core/migrate/summary.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAC1H,uHAAuH;AAuBvH,mGAAmG;AACnG,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,KAAa;IACrD,MAAM,KAAK,GAAG,CAAC,CAAS,EAAuB,EAAE;QAC/C,MAAM,CAAC,GAAG,IAAI,GAAG,EAAkB,CAAC;QACpC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;YAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GA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,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,GAAG,CAAC,IAAI,CACN,EAAE,EACF,UAAU,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,eAAe,EAAE,CAAC,SAAS,CAAC,CAAC,MAAM,gCAAgC,GAAG,KAAK,GAAG,QAAQ,CACpL,CAAC;IACF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS;gBAAE,SAAS;YAC9D,MAAM,CAAC,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;YACzE,IAAI,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1,18 +1,64 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Targets that moved out of the core into an official plugin (feature 027, FR-014). A project that still
|
|
3
|
-
* lists such a target gets a notice naming the package to install; nothing it already wrote is removed.
|
|
4
|
-
*
|
|
5
|
-
* Empty in 1.6: no built-in target is extracted yet. The mechanism ships first, and the first extraction
|
|
6
|
-
* follows once the API has been used (`docs/plugin-split.md`, plan open decision 3). When a target moves,
|
|
7
|
-
* add `"<id>": { package: "ambykit-emitter-<id>", since: "<release>" }` here and drop it from `TARGETS`.
|
|
8
|
-
*/
|
|
9
1
|
export interface MovedTarget {
|
|
10
2
|
/** The npm package that now provides the target. */
|
|
11
3
|
package: string;
|
|
12
4
|
/** The AmbyKit release that stopped bundling it. */
|
|
13
5
|
since: string;
|
|
6
|
+
/** The name `init` and `add` show for it (the plugin provides it once installed). */
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Targets still bundled that will move once their official plugin is published (feature 036, C-4): the id, and the
|
|
11
|
+
* package that will replace it. They keep working and get a deprecation notice; nothing is removed until the plugin ships.
|
|
12
|
+
*/
|
|
13
|
+
export interface DeprecatedTarget {
|
|
14
|
+
/** The npm package that will replace the built-in target. */
|
|
15
|
+
package: string;
|
|
14
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The 2.0 split as data (feature 036, T040): Antigravity (both harnesses) moves to the official plugin in `plugins/antigravity/`
|
|
19
|
+
* (owner decision, spec 036 C-1); the long-tail targets keep working and are announced as moving once their plugin is published (C-4).
|
|
20
|
+
* Always filled in, so docs, tests and the migration guide read one table.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PLANNED_MOVED_TARGETS: Readonly<Record<string, MovedTarget>>;
|
|
23
|
+
export declare const PLANNED_DEPRECATED_TARGETS: Readonly<Record<string, DeprecatedTarget>>;
|
|
24
|
+
/**
|
|
25
|
+
* THE SWITCH (spec 036, T040/T050). `false` while core still bundles the Antigravity emitters: a target in `MOVED_TARGETS` is treated
|
|
26
|
+
* as "no longer bundled", so turning the planned moves on before the emitters are removed would tell users to install a plugin for a
|
|
27
|
+
* target that still works. Task T050 removes the built-in Antigravity emitters from `TARGETS`, flips this to `true` in the same
|
|
28
|
+
* commit, and updates the pinned test (test/plugins/moved-switch.test.ts). Nothing else reads this constant.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SPLIT_ACTIVE = true;
|
|
31
|
+
/** What the commands consult. Empty until the switch is on; tests add entries to exercise the mechanism. */
|
|
15
32
|
export declare const MOVED_TARGETS: Record<string, MovedTarget>;
|
|
33
|
+
export declare const DEPRECATED_TARGETS: Record<string, DeprecatedTarget>;
|
|
34
|
+
/**
|
|
35
|
+
* What a target id is, for `init`, `add`, `check`, `update` and the docs check (feature 036, FR-001/FR-002):
|
|
36
|
+
* one answer to "is this core?".
|
|
37
|
+
* - `built-in`: bundled and not going away.
|
|
38
|
+
* - `deprecated`: bundled today, replaced by `package` once that plugin is published.
|
|
39
|
+
* - `moved`: no longer bundled; `package` provides it since `since`.
|
|
40
|
+
* - `unknown`: neither bundled nor known to have moved (a typo, or a plugin's own id).
|
|
41
|
+
*/
|
|
42
|
+
export type TargetStatus = {
|
|
43
|
+
state: "built-in";
|
|
44
|
+
} | {
|
|
45
|
+
state: "deprecated";
|
|
46
|
+
package: string;
|
|
47
|
+
} | {
|
|
48
|
+
state: "moved";
|
|
49
|
+
package: string;
|
|
50
|
+
since: string;
|
|
51
|
+
} | {
|
|
52
|
+
state: "unknown";
|
|
53
|
+
};
|
|
54
|
+
export interface TargetStatusSources {
|
|
55
|
+
/** The ids bundled with this AmbyKit (default: the built-in registry). */
|
|
56
|
+
bundled: readonly string[];
|
|
57
|
+
moved: Readonly<Record<string, MovedTarget>>;
|
|
58
|
+
deprecated: Readonly<Record<string, DeprecatedTarget>>;
|
|
59
|
+
}
|
|
60
|
+
/** Pure: the sources are parameters so tests can describe a future registry without touching the real one. */
|
|
61
|
+
export declare function targetStatus(id: string, sources?: TargetStatusSources): TargetStatus;
|
|
16
62
|
/** Where a moved target lives now, or undefined for a target that did not move. Pure. */
|
|
17
63
|
export declare function movedTarget(id: string, map?: Readonly<Record<string, MovedTarget>>): MovedTarget | undefined;
|
|
18
64
|
/**
|
|
@@ -21,3 +67,22 @@ export declare function movedTarget(id: string, map?: Readonly<Record<string, Mo
|
|
|
21
67
|
* reported. Pure.
|
|
22
68
|
*/
|
|
23
69
|
export declare function movedTargetNotices(ids: readonly string[], known: (id: string) => boolean, map?: Readonly<Record<string, MovedTarget>>): string[];
|
|
70
|
+
/**
|
|
71
|
+
* One line per configured target that is still bundled but will move once its official plugin is published (feature 036, FR-002,
|
|
72
|
+
* C-4). Nothing to do yet: the target keeps working and nothing is removed. Pure. Empty until the switch is on (`SPLIT_ACTIVE`).
|
|
73
|
+
*/
|
|
74
|
+
export declare function deprecatedTargetNotices(ids: readonly string[], map?: Readonly<Record<string, DeprecatedTarget>>): string[];
|
|
75
|
+
/**
|
|
76
|
+
* For `init` and `add`: a requested target that moved to a plugin which is not available here (feature 036, FR-006, FR-010). One
|
|
77
|
+
* message per target, the same install and config instructions as `sync`, and what to run after. The commands write nothing for it:
|
|
78
|
+
* AmbyKit never installs a package or edits config on its own. Pure.
|
|
79
|
+
*/
|
|
80
|
+
export declare function movedTargetRefusals(ids: readonly string[], known: (id: string) => boolean, map?: Readonly<Record<string, MovedTarget>>): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Entries for the `init` and `add` pickers (feature 036, FR-010): each moved target that is not available here, marked as an
|
|
83
|
+
* official plugin to install first. Empty when no target moved, so the pickers are unchanged. Pure.
|
|
84
|
+
*/
|
|
85
|
+
export declare function movedTargetChoices(known: (id: string) => boolean, map?: Readonly<Record<string, MovedTarget>>): {
|
|
86
|
+
value: string;
|
|
87
|
+
label: string;
|
|
88
|
+
}[];
|
|
@@ -1,4 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Targets that moved out of the core into an official plugin (feature 027, FR-014). A project that still
|
|
3
|
+
* lists such a target gets a notice naming the package to install; nothing it already wrote is removed.
|
|
4
|
+
*
|
|
5
|
+
* Empty in 1.6: no built-in target is extracted yet. The mechanism ships first, and the first extraction
|
|
6
|
+
* follows once the API has been used (`docs/plugin-split.md`, plan open decision 3). When a target moves,
|
|
7
|
+
* add `"<id>": { package: "ambykit-emitter-<id>", since: "<release>" }` here and drop it from `TARGETS`.
|
|
8
|
+
*/
|
|
9
|
+
import { TARGETS } from "../emitters/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* The 2.0 split as data (feature 036, T040): Antigravity (both harnesses) moves to the official plugin in `plugins/antigravity/`
|
|
12
|
+
* (owner decision, spec 036 C-1); the long-tail targets keep working and are announced as moving once their plugin is published (C-4).
|
|
13
|
+
* Always filled in, so docs, tests and the migration guide read one table.
|
|
14
|
+
*/
|
|
15
|
+
export const PLANNED_MOVED_TARGETS = {
|
|
16
|
+
antigravity: { package: "@ambystech/ambykit-emitter-antigravity", since: "2.0.0", displayName: "Antigravity (IDE)" },
|
|
17
|
+
"antigravity-cli": { package: "@ambystech/ambykit-emitter-antigravity", since: "2.0.0", displayName: "Antigravity CLI" },
|
|
18
|
+
};
|
|
19
|
+
export const PLANNED_DEPRECATED_TARGETS = Object.fromEntries(["gemini", "llxprt", "qwen", "kilo", "augment", "windsurf", "kiro"].map((id) => [id, { package: `@ambystech/ambykit-emitter-${id}` }]));
|
|
20
|
+
/**
|
|
21
|
+
* THE SWITCH (spec 036, T040/T050). `false` while core still bundles the Antigravity emitters: a target in `MOVED_TARGETS` is treated
|
|
22
|
+
* as "no longer bundled", so turning the planned moves on before the emitters are removed would tell users to install a plugin for a
|
|
23
|
+
* target that still works. Task T050 removes the built-in Antigravity emitters from `TARGETS`, flips this to `true` in the same
|
|
24
|
+
* commit, and updates the pinned test (test/plugins/moved-switch.test.ts). Nothing else reads this constant.
|
|
25
|
+
*/
|
|
26
|
+
export const SPLIT_ACTIVE = true;
|
|
27
|
+
/** What the commands consult. Empty until the switch is on; tests add entries to exercise the mechanism. */
|
|
28
|
+
export const MOVED_TARGETS = SPLIT_ACTIVE ? { ...PLANNED_MOVED_TARGETS } : {};
|
|
29
|
+
export const DEPRECATED_TARGETS = SPLIT_ACTIVE ? { ...PLANNED_DEPRECATED_TARGETS } : {};
|
|
30
|
+
/** Pure: the sources are parameters so tests can describe a future registry without touching the real one. */
|
|
31
|
+
export function targetStatus(id, sources = { bundled: TARGETS.map((t) => t.id), moved: MOVED_TARGETS, deprecated: DEPRECATED_TARGETS }) {
|
|
32
|
+
const moved = movedTarget(id, sources.moved);
|
|
33
|
+
if (moved)
|
|
34
|
+
return { state: "moved", package: moved.package, since: moved.since };
|
|
35
|
+
if (!sources.bundled.includes(id))
|
|
36
|
+
return { state: "unknown" };
|
|
37
|
+
if (Object.hasOwn(sources.deprecated, id))
|
|
38
|
+
return { state: "deprecated", package: sources.deprecated[id].package };
|
|
39
|
+
return { state: "built-in" };
|
|
40
|
+
}
|
|
2
41
|
/** Where a moved target lives now, or undefined for a target that did not move. Pure. */
|
|
3
42
|
export function movedTarget(id, map = MOVED_TARGETS) {
|
|
4
43
|
return Object.hasOwn(map, id) ? map[id] : undefined;
|
|
@@ -20,4 +59,43 @@ export function movedTargetNotices(ids, known, map = MOVED_TARGETS) {
|
|
|
20
59
|
}
|
|
21
60
|
return out;
|
|
22
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* One line per configured target that is still bundled but will move once its official plugin is published (feature 036, FR-002,
|
|
64
|
+
* C-4). Nothing to do yet: the target keeps working and nothing is removed. Pure. Empty until the switch is on (`SPLIT_ACTIVE`).
|
|
65
|
+
*/
|
|
66
|
+
export function deprecatedTargetNotices(ids, map = DEPRECATED_TARGETS) {
|
|
67
|
+
const out = [];
|
|
68
|
+
for (const id of ids) {
|
|
69
|
+
if (!Object.hasOwn(map, id))
|
|
70
|
+
continue;
|
|
71
|
+
out.push(`Target '${id}' is bundled for now and will move to the plugin ${map[id].package} once it is published. It keeps working; nothing to do yet.`);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* For `init` and `add`: a requested target that moved to a plugin which is not available here (feature 036, FR-006, FR-010). One
|
|
77
|
+
* message per target, the same install and config instructions as `sync`, and what to run after. The commands write nothing for it:
|
|
78
|
+
* AmbyKit never installs a package or edits config on its own. Pure.
|
|
79
|
+
*/
|
|
80
|
+
export function movedTargetRefusals(ids, known, map = MOVED_TARGETS) {
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const id of ids) {
|
|
83
|
+
if (known(id))
|
|
84
|
+
continue;
|
|
85
|
+
const moved = movedTarget(id, map);
|
|
86
|
+
if (!moved)
|
|
87
|
+
continue;
|
|
88
|
+
out.push(`Target '${id}' is an official plugin now (${moved.package}, since ${moved.since}), so it is not added. Install it first: \`npm install --save-exact ${moved.package}\`, list it under "plugins" in .amby/config.json with that exact version, then run \`ambykit add ${id}\`.`);
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Entries for the `init` and `add` pickers (feature 036, FR-010): each moved target that is not available here, marked as an
|
|
94
|
+
* official plugin to install first. Empty when no target moved, so the pickers are unchanged. Pure.
|
|
95
|
+
*/
|
|
96
|
+
export function movedTargetChoices(known, map = MOVED_TARGETS) {
|
|
97
|
+
return Object.entries(map)
|
|
98
|
+
.filter(([id]) => !known(id))
|
|
99
|
+
.map(([id, m]) => ({ value: id, label: `${m.displayName ?? id} (official plugin, install first: ${m.package})` }));
|
|
100
|
+
}
|
|
23
101
|
//# sourceMappingURL=moved-targets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moved-targets.js","sourceRoot":"","sources":["../../src/core/moved-targets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moved-targets.js","sourceRoot":"","sources":["../../src/core/moved-targets.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAoB/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0C;IAC1E,WAAW,EAAE,EAAE,OAAO,EAAE,wCAAwC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE;IACpH,iBAAiB,EAAE,EAAE,OAAO,EAAE,wCAAwC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE;CACzH,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAA+C,MAAM,CAAC,WAAW,CACtG,CAAC,QAAQ,EAAE,QAAQ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;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,GAAsB,EACtB,KAA8B,EAC9B,GAAG,GAA0C,aAAa;IAE1D,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,KAAK,CAAC,EAAE,CAAC;YAAE,SAAS;QACxB,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,GAAG,CAAC,IAAI,CACN,WAAW,EAAE,gCAAgC,KAAK,CAAC,OAAO,WAAW,KAAK,CAAC,KAAK,uEAAuE,KAAK,CAAC,OAAO,oGAAoG,EAAE,KAAK,CAChR,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAA8B,EAC9B,GAAG,GAA0C,aAAa;IAE1D,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;SACvB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;SAC5B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,WAAW,IAAI,EAAE,qCAAqC,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC;AACvH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StoryProgress, TaskLine } from "./dashboard.js";
|
|
2
2
|
import type { PhaseVerify } from "./markers.js";
|
|
3
|
+
import type { FormatIssue } from "./spec-format/model.js";
|
|
3
4
|
export type { PhaseVerify };
|
|
4
5
|
/**
|
|
5
6
|
* Value objects for the dashboard overview (feature 014). Plain and IO-free; produced by
|
|
@@ -49,6 +50,8 @@ export interface FeatureSnapshot {
|
|
|
49
50
|
ref: string;
|
|
50
51
|
displayRef: string;
|
|
51
52
|
stories: StoryProgress[];
|
|
53
|
+
/** Feature 030: feature-level `depends-on` from v2 frontmatter, as written (numbers or directory names). Absent for 1.x features. */
|
|
54
|
+
dependsOn?: string[];
|
|
52
55
|
tasks: TaskLine[] | null;
|
|
53
56
|
/** Feature 020: the Verify line of each phase of tasks.md; absent when there is no tasks.md. */
|
|
54
57
|
verify?: PhaseVerify[];
|
|
@@ -62,6 +65,8 @@ export interface FeatureSnapshot {
|
|
|
62
65
|
clarifications: Clarification[];
|
|
63
66
|
/** Feature 015: parallel lanes of this feature; absent when it has none. */
|
|
64
67
|
lanes?: LaneView[];
|
|
68
|
+
/** Feature 030: located problems found reading this feature's spec.md or tasks.md (v2 data). Absent when there are none. */
|
|
69
|
+
formatIssues?: FormatIssue[];
|
|
65
70
|
/** Feature 024: requirement coverage; absent when the feature has no requirements. `uncovered` feeds the quality view. */
|
|
66
71
|
coverage?: {
|
|
67
72
|
covered: number;
|
|
@@ -74,6 +79,8 @@ export interface FeatureSnapshot {
|
|
|
74
79
|
}
|
|
75
80
|
export interface Filters {
|
|
76
81
|
feature?: string;
|
|
82
|
+
/** Feature 032 (US-3): free-text search; matches a feature whose directory name or number contains it. */
|
|
83
|
+
search?: string;
|
|
77
84
|
status?: string;
|
|
78
85
|
}
|
|
79
86
|
export interface OverviewOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview-types.js","sourceRoot":"","sources":["../../src/core/overview-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"overview-types.js","sourceRoot":"","sources":["../../src/core/overview-types.ts"],"names":[],"mappings":"AAcA,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM;IACN,aAAa;IACb,OAAO;IACP,OAAO;IACP,SAAS;IACT,UAAU;IACV,OAAO;CACR,CAAC"}
|