@ambystech/ambykit 1.6.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +154 -1
- 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,64 @@
|
|
|
1
|
+
// The per-file reader dispatcher (030:FR-021, 026:D-9). Every reader of a spec.md or tasks.md goes through here, so
|
|
2
|
+
// history readers (burndown blobs, `git show <branch>:…`) see the right format per revision. Format is decided from the
|
|
3
|
+
// content of each file, never from the project.
|
|
4
|
+
import { parseStories, parseTasks } from "../dashboard.js";
|
|
5
|
+
import { parsePhases } from "../markers.js";
|
|
6
|
+
import { detectSpecFormat, detectTasksFormat } from "./detect.js";
|
|
7
|
+
import { LEGACY_REFUSED_KIND, activeTally, legacyRefusedMessage, refuseLegacy } from "./legacy.js";
|
|
8
|
+
import { readSpecMeta } from "./meta.js";
|
|
9
|
+
import { readSpecV2 } from "./read-spec.js";
|
|
10
|
+
import { readTasksV2 } from "./read-tasks.js";
|
|
11
|
+
/** Whether 1.x files are refused: the `LEGACY_READING` switch, or the setting a test injects (035:FR-002). Never the version. */
|
|
12
|
+
function refusesLegacy(ctx) {
|
|
13
|
+
return refuseLegacy(ctx?.legacyReading);
|
|
14
|
+
}
|
|
15
|
+
/** Record the format of a read file, when the caller named it, in the explicit or the running command's tally. */
|
|
16
|
+
function tally(ctx, format) {
|
|
17
|
+
if (!ctx?.file)
|
|
18
|
+
return;
|
|
19
|
+
(ctx.tally ?? activeTally())?.record(ctx.file, format);
|
|
20
|
+
}
|
|
21
|
+
const refused = (file) => ({ file, line: 1, severity: "error", kind: LEGACY_REFUSED_KIND, message: legacyRefusedMessage(file) });
|
|
22
|
+
/** Read a spec.md: stories, feature meta, feature-level depends-on and the issues found. */
|
|
23
|
+
export function readSpec(feature, text, ctx) {
|
|
24
|
+
const detected = detectSpecFormat(text);
|
|
25
|
+
if (detected.format === 2) {
|
|
26
|
+
const v2 = readSpecV2(feature, text, ctx?.file ?? "spec.md", detected.marker);
|
|
27
|
+
tally(ctx, 2);
|
|
28
|
+
return v2;
|
|
29
|
+
}
|
|
30
|
+
tally(ctx, 1);
|
|
31
|
+
if (refusesLegacy(ctx))
|
|
32
|
+
return { format: 1, stories: [], meta: {}, dependsOn: [], issues: [refused(ctx?.file ?? "spec.md")] };
|
|
33
|
+
const issues = [];
|
|
34
|
+
return { format: 1, stories: parseStories(text, feature), meta: readSpecMeta(text), dependsOn: [], issues };
|
|
35
|
+
}
|
|
36
|
+
/** Read a tasks.md: task lines, phase Verify data and the issues found. */
|
|
37
|
+
export function readTasks(text, ctx) {
|
|
38
|
+
const detected = detectTasksFormat(text);
|
|
39
|
+
if (detected.format === 2) {
|
|
40
|
+
const v2 = readTasksV2(text, ctx?.file ?? "tasks.md", detected.marker);
|
|
41
|
+
tally(ctx, 2);
|
|
42
|
+
return v2;
|
|
43
|
+
}
|
|
44
|
+
tally(ctx, 1);
|
|
45
|
+
if (refusesLegacy(ctx))
|
|
46
|
+
return { format: 1, tasks: [], phases: [], issues: [refused(ctx?.file ?? "tasks.md")] };
|
|
47
|
+
const issues = [];
|
|
48
|
+
return { format: 1, tasks: parseTasks(text), phases: parsePhases(text), issues };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The 1.x readers, forced: what the shipped parsers return whatever the file contains. `migrate` uses them to compute the
|
|
52
|
+
* "before" model it must reproduce (030:FR-024); nothing else should.
|
|
53
|
+
*/
|
|
54
|
+
export function readSpecV1(feature, text) {
|
|
55
|
+
return parseStories(text, feature);
|
|
56
|
+
}
|
|
57
|
+
export function readTasksV1(text) {
|
|
58
|
+
return { tasks: parseTasks(text), phases: parsePhases(text) };
|
|
59
|
+
}
|
|
60
|
+
/** Convenience for callers that only need the phases. */
|
|
61
|
+
export function readPhases(text, ctx) {
|
|
62
|
+
return readTasks(text, ctx).phases;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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E,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC;IAChH,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,IAAY;IACtD,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;AAChE,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,GAAa;IACpD,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FormatIssue } from "./model.js";
|
|
2
|
+
export interface Frontmatter {
|
|
3
|
+
/** Parsed mapping; `{}` when absent or broken. */
|
|
4
|
+
data: Record<string, unknown>;
|
|
5
|
+
/** Raw YAML text between the fences, or "" when there is none. */
|
|
6
|
+
raw: string;
|
|
7
|
+
/** 1-based first YAML line and the line of the closing `---`; 0 when there is no frontmatter. */
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
/** Whole text split on `\n` or `\r\n`. */
|
|
11
|
+
lines: string[];
|
|
12
|
+
/** A well-formed `---` block exists (even if its YAML is broken). */
|
|
13
|
+
present: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Parse YAML, turning a failure into a located issue (1-based, offset from `baseLine`) instead of a throw. */
|
|
16
|
+
export declare function parseYaml(src: string, baseLine: number, where: string, file: string, issues: FormatIssue[]): unknown;
|
|
17
|
+
/** Split and parse `---` frontmatter. An unclosed or unparseable block adds an issue and yields no data. */
|
|
18
|
+
export declare function readFrontmatter(text: string, file: string, issues: FormatIssue[]): Frontmatter;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import matter from "gray-matter";
|
|
2
|
+
const yamlEngine = matter.engines.yaml;
|
|
3
|
+
/** Parse YAML, turning a failure into a located issue (1-based, offset from `baseLine`) instead of a throw. */
|
|
4
|
+
export function parseYaml(src, baseLine, where, file, issues) {
|
|
5
|
+
try {
|
|
6
|
+
return yamlEngine.parse(src);
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
const err = e;
|
|
10
|
+
const mark = err.mark?.line;
|
|
11
|
+
issues.push({
|
|
12
|
+
file,
|
|
13
|
+
line: baseLine + (typeof mark === "number" ? mark : 0),
|
|
14
|
+
severity: "error",
|
|
15
|
+
kind: "bad-yaml",
|
|
16
|
+
message: `${where}: invalid YAML (${String(err.reason ?? err.message).split("\n")[0]})`,
|
|
17
|
+
});
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Split and parse `---` frontmatter. An unclosed or unparseable block adds an issue and yields no data. */
|
|
22
|
+
export function readFrontmatter(text, file, issues) {
|
|
23
|
+
const lines = text.split(/\r?\n/);
|
|
24
|
+
const none = { data: {}, raw: "", start: 0, end: 0, lines, present: false };
|
|
25
|
+
if (lines[0] !== "---")
|
|
26
|
+
return none;
|
|
27
|
+
const close = lines.indexOf("---", 1);
|
|
28
|
+
if (close === -1) {
|
|
29
|
+
issues.push({ file, line: 1, severity: "error", kind: "frontmatter-unclosed", message: "frontmatter is not closed with ---" });
|
|
30
|
+
return none;
|
|
31
|
+
}
|
|
32
|
+
const raw = lines.slice(1, close).join("\n");
|
|
33
|
+
const parsed = parseYaml(raw, 2, "frontmatter", file, issues);
|
|
34
|
+
const data = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
35
|
+
return { data, raw, start: 2, end: close + 1, lines, present: true };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/core/spec-format/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,MAAM,UAAU,GAAI,MAA0E,CAAC,OAAO,CAAC,IAAI,CAAC;AAgB5G,+GAA+G;AAC/G,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,QAAgB,EAAE,KAAa,EAAE,IAAY,EAAE,MAAqB;IACzG,IAAI,CAAC;QACH,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAoE,CAAC;QACjF,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI;YACJ,IAAI,EAAE,QAAQ,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACtD,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,GAAG,KAAK,mBAAmB,MAAM,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;SACxF,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,4GAA4G;AAC5G,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAY,EAAE,MAA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
|
2
|
+
/** Environment switch: `AMBYKIT_LEGACY_WARNING=0` silences the warning. */
|
|
3
|
+
export declare const LEGACY_ENV = "AMBYKIT_LEGACY_WARNING";
|
|
4
|
+
/** Stable issue kind the dispatcher returns for a 1.x file it refuses to read. */
|
|
5
|
+
export declare const LEGACY_REFUSED_KIND = "legacy-format-refused";
|
|
6
|
+
export type LegacyReading = "on" | "off";
|
|
7
|
+
/**
|
|
8
|
+
* Whether 1.x files are still read (035:FR-002, decision D-8). "on" until 035's go decision is accepted (T012) and T080 flips it;
|
|
9
|
+
* `legacyOffProblems` lists what the decision record must hold before "off" is allowed.
|
|
10
|
+
*/
|
|
11
|
+
export declare const LEGACY_READING: LegacyReading;
|
|
12
|
+
/** Start collecting the formats of every file read through the dispatcher; returns the tally. */
|
|
13
|
+
export declare function beginTally(): FormatTally;
|
|
14
|
+
/** The tally readers record into when the caller passes none, or null outside a command run. */
|
|
15
|
+
export declare function activeTally(): FormatTally | null;
|
|
16
|
+
export declare function endTally(): void;
|
|
17
|
+
/** Config and environment decide whether the warning is shown: `legacyWarning: false` or `AMBYKIT_LEGACY_WARNING=0` silences it. */
|
|
18
|
+
export declare function legacyEnabled(config: {
|
|
19
|
+
legacyWarning?: boolean;
|
|
20
|
+
} | undefined, env?: Record<string, string | undefined>): boolean;
|
|
21
|
+
/** The one line printed per run (C-5). */
|
|
22
|
+
export declare function legacyWarningLine(count: number): string;
|
|
23
|
+
/** True when 1.x files are refused instead of read (030:FR-013, 035:FR-002). The setting is injected in tests. */
|
|
24
|
+
export declare function refuseLegacy(reading?: LegacyReading): boolean;
|
|
25
|
+
/** The title of feature 035's go-decision record in `.amby/decisions/` (035:FR-001). */
|
|
26
|
+
export declare const LEGACY_DECISION_TITLE = "End 1.x reading in 2.1";
|
|
27
|
+
/**
|
|
28
|
+
* The conditions the go decision records, one line each: `- **<condition>:** met, <YYYY-MM-DD>, <evidence>` (035:FR-001, D-1, D-6).
|
|
29
|
+
* T010 drafts the record with these lines and T011 extends the test; the line shape here is the minimum both rely on.
|
|
30
|
+
*/
|
|
31
|
+
export declare const LEGACY_DECISION_CONDITIONS: readonly ["Gate wording", "Adoption window", "No open migrate data-loss defect", "Documented path"];
|
|
32
|
+
/**
|
|
33
|
+
* What stops `LEGACY_READING` from being "off": the go-decision record (its text, or undefined when none exists) must be
|
|
34
|
+
* `status: accepted` and record every condition as met, with a date and evidence. Empty while reading stays "on".
|
|
35
|
+
*/
|
|
36
|
+
export declare function legacyOffProblems(reading: LegacyReading, decision: string | undefined): string[];
|
|
37
|
+
/** Feature directories that have a file on the 1.x format in the tally, in the order first seen. */
|
|
38
|
+
export declare function legacyFeatures(tally: FormatTally | null): string[];
|
|
39
|
+
/** The refusal message, naming the file (FR-013). */
|
|
40
|
+
export declare function legacyRefusedMessage(file: string): string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Reading 1.x files in 2.x (030:FR-012, FR-013, FR-019; 035:FR-002). While `LEGACY_READING` is "on" a 1.x spec or task file
|
|
2
|
+
// is read exactly as before, and the CLI prints ONE concise line per run saying how many files use the old format and how to
|
|
3
|
+
// migrate. When it is "off" the dispatcher refuses to read them. The switch is explicit, not a version gate, so a version bump
|
|
4
|
+
// alone can never end 1.x reading: it goes "off" only with the accepted go decision of feature 035 (a test enforces that).
|
|
5
|
+
import { FormatTally } from "./model.js";
|
|
6
|
+
/** Environment switch: `AMBYKIT_LEGACY_WARNING=0` silences the warning. */
|
|
7
|
+
export const LEGACY_ENV = "AMBYKIT_LEGACY_WARNING";
|
|
8
|
+
/** Stable issue kind the dispatcher returns for a 1.x file it refuses to read. */
|
|
9
|
+
export const LEGACY_REFUSED_KIND = "legacy-format-refused";
|
|
10
|
+
/**
|
|
11
|
+
* Whether 1.x files are still read (035:FR-002, decision D-8). "on" until 035's go decision is accepted (T012) and T080 flips it;
|
|
12
|
+
* `legacyOffProblems` lists what the decision record must hold before "off" is allowed.
|
|
13
|
+
*/
|
|
14
|
+
export const LEGACY_READING = "on";
|
|
15
|
+
let active = null;
|
|
16
|
+
/** Start collecting the formats of every file read through the dispatcher; returns the tally. */
|
|
17
|
+
export function beginTally() {
|
|
18
|
+
active = new FormatTally();
|
|
19
|
+
return active;
|
|
20
|
+
}
|
|
21
|
+
/** The tally readers record into when the caller passes none, or null outside a command run. */
|
|
22
|
+
export function activeTally() {
|
|
23
|
+
return active;
|
|
24
|
+
}
|
|
25
|
+
export function endTally() {
|
|
26
|
+
active = null;
|
|
27
|
+
}
|
|
28
|
+
/** Config and environment decide whether the warning is shown: `legacyWarning: false` or `AMBYKIT_LEGACY_WARNING=0` silences it. */
|
|
29
|
+
export function legacyEnabled(config, env = process.env) {
|
|
30
|
+
if (config?.legacyWarning === false)
|
|
31
|
+
return false;
|
|
32
|
+
const v = env[LEGACY_ENV];
|
|
33
|
+
return !(v === "0" || v?.toLowerCase() === "false");
|
|
34
|
+
}
|
|
35
|
+
/** The one line printed per run (C-5). */
|
|
36
|
+
export function legacyWarningLine(count) {
|
|
37
|
+
return `${count} file${count === 1 ? "" : "s"} use${count === 1 ? "s" : ""} the 1.x spec format (read as before). Run \`ambykit migrate\` to upgrade; support ends in 2.1.`;
|
|
38
|
+
}
|
|
39
|
+
/** True when 1.x files are refused instead of read (030:FR-013, 035:FR-002). The setting is injected in tests. */
|
|
40
|
+
export function refuseLegacy(reading = LEGACY_READING) {
|
|
41
|
+
return reading === "off";
|
|
42
|
+
}
|
|
43
|
+
/** The title of feature 035's go-decision record in `.amby/decisions/` (035:FR-001). */
|
|
44
|
+
export const LEGACY_DECISION_TITLE = "End 1.x reading in 2.1";
|
|
45
|
+
/**
|
|
46
|
+
* The conditions the go decision records, one line each: `- **<condition>:** met, <YYYY-MM-DD>, <evidence>` (035:FR-001, D-1, D-6).
|
|
47
|
+
* T010 drafts the record with these lines and T011 extends the test; the line shape here is the minimum both rely on.
|
|
48
|
+
*/
|
|
49
|
+
export const LEGACY_DECISION_CONDITIONS = ["Gate wording", "Adoption window", "No open migrate data-loss defect", "Documented path"];
|
|
50
|
+
/**
|
|
51
|
+
* What stops `LEGACY_READING` from being "off": the go-decision record (its text, or undefined when none exists) must be
|
|
52
|
+
* `status: accepted` and record every condition as met, with a date and evidence. Empty while reading stays "on".
|
|
53
|
+
*/
|
|
54
|
+
export function legacyOffProblems(reading, decision) {
|
|
55
|
+
if (reading === "on")
|
|
56
|
+
return [];
|
|
57
|
+
if (decision === undefined)
|
|
58
|
+
return [`no decision record titled '${LEGACY_DECISION_TITLE}' in .amby/decisions/`];
|
|
59
|
+
const problems = [];
|
|
60
|
+
const status = /^status:[ \t]*(\S+)/m.exec(decision)?.[1];
|
|
61
|
+
if (status !== "accepted")
|
|
62
|
+
problems.push(`the decision record is '${status ?? "without a status"}', not 'accepted'`);
|
|
63
|
+
for (const c of LEGACY_DECISION_CONDITIONS) {
|
|
64
|
+
const m = new RegExp("^\\s*[-*]\\s*\\*\\*" + c + ":\\*\\*[ \\t]*(.*)$", "mi").exec(decision);
|
|
65
|
+
const v = m?.[1]?.trim() ?? "";
|
|
66
|
+
if (v === "")
|
|
67
|
+
problems.push(`the decision records no '${c}'`);
|
|
68
|
+
else if (!/^met\b/i.test(v))
|
|
69
|
+
problems.push(`'${c}' is '${v}', not met`);
|
|
70
|
+
else if (!/\d{4}-\d{2}-\d{2}/.test(v))
|
|
71
|
+
problems.push(`'${c}' has no date`);
|
|
72
|
+
else if (v.replace(/^met\b/i, "").replace(/\d{4}-\d{2}-\d{2}/, "").replace(/[,;:\s]/g, "") === "")
|
|
73
|
+
problems.push(`'${c}' has no evidence`);
|
|
74
|
+
}
|
|
75
|
+
return problems;
|
|
76
|
+
}
|
|
77
|
+
/** Feature directories that have a file on the 1.x format in the tally, in the order first seen. */
|
|
78
|
+
export function legacyFeatures(tally) {
|
|
79
|
+
const dirs = [];
|
|
80
|
+
for (const file of tally?.v1 ?? []) {
|
|
81
|
+
const dir = /^specs\/([^/]+)\//.exec(file)?.[1];
|
|
82
|
+
if (dir && !dirs.includes(dir))
|
|
83
|
+
dirs.push(dir);
|
|
84
|
+
}
|
|
85
|
+
return dirs.sort();
|
|
86
|
+
}
|
|
87
|
+
/** The refusal message, naming the file (FR-013). */
|
|
88
|
+
export function legacyRefusedMessage(file) {
|
|
89
|
+
return `${file} uses the 1.x spec format, which this version no longer reads; migrate it with AmbyKit 2.0 (\`npx @ambystech/ambykit@2.0 migrate\`).`;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../src/core/spec-format/legacy.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAC5H,6HAA6H;AAC7H,+HAA+H;AAC/H,2HAA2H;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAEnD,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAI3D;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAqB,CAAC;AAEpD,IAAI,MAAM,GAAuB,IAAI,CAAC;AAEtC,iGAAiG;AACjG,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,WAAW;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAED,oIAAoI;AACpI,MAAM,UAAU,aAAa,CAAC,MAA+C,EAAE,GAAG,GAAuC,OAAO,CAAC,GAAG;IAClI,IAAI,MAAM,EAAE,aAAa,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC,CAA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AAO,GAAG,IAAI,sIAAsI,CAAC;AACvJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import matter from "gray-matter";
|
|
2
|
+
/** Feature meta from the spec frontmatter; identical in 1.x and v2. Broken YAML is reported by the v2 reader, not here. */
|
|
3
|
+
export function readSpecMeta(text) {
|
|
4
|
+
let data = {};
|
|
5
|
+
try {
|
|
6
|
+
data = (matter(text).data ?? {});
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
/* reported as a FormatIssue by the v2 reader */
|
|
10
|
+
}
|
|
11
|
+
const s = (v) => (v === undefined || v === null ? undefined : String(v));
|
|
12
|
+
const meta = {};
|
|
13
|
+
const feature = s(data["feature"]);
|
|
14
|
+
const title = s(data["title"]);
|
|
15
|
+
const status = s(data["status"]);
|
|
16
|
+
if (feature !== undefined)
|
|
17
|
+
meta.feature = feature;
|
|
18
|
+
if (title !== undefined)
|
|
19
|
+
meta.title = title;
|
|
20
|
+
if (status !== undefined)
|
|
21
|
+
meta.status = status;
|
|
22
|
+
return meta;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/core/spec-format/meta.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,2HAA2H;AAC3H,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,IAAI,GAA4B,EAAE,CAAC;IACvC,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,gDAAgD;IAClD,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAU,EAAsB,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACtG,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS;QAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAClD,IAAI,KAAK,KAAK,SAAS;QAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5C,IAAI,MAAM,KAAK,SAAS;QAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type { StoryProgress, TaskLine } from "../dashboard.js";
|
|
2
|
+
export type { PhaseVerify, VerifyResult } from "../markers.js";
|
|
3
|
+
import type { PhaseVerify } from "../markers.js";
|
|
4
|
+
import type { StoryProgress, TaskLine } from "../dashboard.js";
|
|
5
|
+
/** Spec format of one file: 1 = the 1.x bullets and trailing groups, 2 = frontmatter and yaml blocks. */
|
|
6
|
+
export type Format = 1 | 2;
|
|
7
|
+
/** A located problem in structured data. Errors never guess; warnings flag drift and legacy leftovers. */
|
|
8
|
+
export interface FormatIssue {
|
|
9
|
+
/** Project-relative when known (`specs/030-x/tasks.md`), else the bare file name. */
|
|
10
|
+
file: string;
|
|
11
|
+
/** 1-based line in that file (1 when unknown). */
|
|
12
|
+
line: number;
|
|
13
|
+
severity: "error" | "warning";
|
|
14
|
+
/** Stable machine kind, e.g. `bad-yaml`, `unknown-status`, `legacy-format-refused`. */
|
|
15
|
+
kind: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SpecMeta {
|
|
19
|
+
feature?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SpecRead {
|
|
24
|
+
format: Format;
|
|
25
|
+
stories: StoryProgress[];
|
|
26
|
+
meta: SpecMeta;
|
|
27
|
+
/** Feature-level `depends-on` (v2 frontmatter), as written; empty for 1.x. */
|
|
28
|
+
dependsOn: string[];
|
|
29
|
+
issues: FormatIssue[];
|
|
30
|
+
}
|
|
31
|
+
export interface TasksRead {
|
|
32
|
+
format: Format;
|
|
33
|
+
tasks: TaskLine[];
|
|
34
|
+
phases: PhaseVerify[];
|
|
35
|
+
issues: FormatIssue[];
|
|
36
|
+
}
|
|
37
|
+
/** Counts files per format so the CLI edge can print one legacy warning per run (030:FR-012). */
|
|
38
|
+
export declare class FormatTally {
|
|
39
|
+
readonly v1: Set<string>;
|
|
40
|
+
readonly v2: Set<string>;
|
|
41
|
+
record(file: string, format: Format): void;
|
|
42
|
+
}
|
|
43
|
+
export interface ReadCtx {
|
|
44
|
+
/** Project-relative file name, used in issues and the tally. Without it a read is not tallied. */
|
|
45
|
+
file?: string;
|
|
46
|
+
/** Where to record the format; defaults to the tally of the running command (see `beginTally`). */
|
|
47
|
+
tally?: FormatTally;
|
|
48
|
+
/** Whether 1.x files are read (tests inject it); default is the `LEGACY_READING` switch (035:FR-002). */
|
|
49
|
+
legacyReading?: "on" | "off";
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Counts files per format so the CLI edge can print one legacy warning per run (030:FR-012). */
|
|
2
|
+
export class FormatTally {
|
|
3
|
+
v1 = new Set();
|
|
4
|
+
v2 = new Set();
|
|
5
|
+
record(file, format) {
|
|
6
|
+
(format === 1 ? this.v1 : this.v2).add(file);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/core/spec-format/model.ts"],"names":[],"mappings":"AA6CA,iGAAiG;AACjG,MAAM,OAAO,WAAW;IACb,EAAE,GAAG,IAAI,GAAG,EAAU,CAAC;IACvB,EAAE,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,CAAC,IAAY,EAAE,MAAc;QACjC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SpecRead } from "./model.js";
|
|
2
|
+
/** The five canonical statuses. Any other string is read as written, with a warning (026 "What 027 may assume"). */
|
|
3
|
+
export declare const KNOWN_STATUSES: readonly ["draft", "ready", "in-progress", "blocked", "done"];
|
|
4
|
+
export declare function readSpecV2(feature: string, text: string, file: string, marker: boolean): SpecRead;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// v2 spec reader (030:FR-001, FR-003, FR-004, FR-019). Story metadata lives in frontmatter `stories:`; headings keep titles.
|
|
2
|
+
// Errors carry file:line and are never guessed around; warnings flag drift and legacy leftovers. The result is the same
|
|
3
|
+
// `StoryProgress` the 1.x parser returns, so nothing downstream changes shape (026:D-1).
|
|
4
|
+
import { canonicalStoryId, parseStories } from "../dashboard.js";
|
|
5
|
+
import { readFrontmatter } from "./frontmatter.js";
|
|
6
|
+
import { readSpecMeta } from "./meta.js";
|
|
7
|
+
/** The five canonical statuses. Any other string is read as written, with a warning (026 "What 027 may assume"). */
|
|
8
|
+
export const KNOWN_STATUSES = ["draft", "ready", "in-progress", "blocked", "done"];
|
|
9
|
+
const KNOWN = new Set(KNOWN_STATUSES);
|
|
10
|
+
const STORY_KEYS = new Set(["id", "priority", "status", "depends-on", "blocked-by"]);
|
|
11
|
+
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12
|
+
export function readSpecV2(feature, text, file, marker) {
|
|
13
|
+
const issues = [];
|
|
14
|
+
const warn = (line, kind, message) => void issues.push({ file, line, severity: "warning", kind, message });
|
|
15
|
+
const err = (line, kind, message) => void issues.push({ file, line, severity: "error", kind, message });
|
|
16
|
+
const fm = readFrontmatter(text, file, issues);
|
|
17
|
+
const lines = fm.lines;
|
|
18
|
+
// headings (and any leftover 1.x bullets of a dual-written file) via the shipped parser
|
|
19
|
+
const heads = parseStories(text, feature);
|
|
20
|
+
if (!marker)
|
|
21
|
+
warn(1, "missing-format-marker", "story data found without `format: 2` in the frontmatter; read as format 2 (add the marker)");
|
|
22
|
+
const lineOfEntry = (id) => {
|
|
23
|
+
if (!fm.present)
|
|
24
|
+
return 1;
|
|
25
|
+
const re = new RegExp(`^\\s*-?\\s*id:\\s*["']?${esc(id)}["']?\\s*$`);
|
|
26
|
+
const i = lines.findIndex((l, k) => k >= fm.start - 1 && k < fm.end && re.test(l));
|
|
27
|
+
return i === -1 ? fm.start : i + 1;
|
|
28
|
+
};
|
|
29
|
+
const entries = new Map();
|
|
30
|
+
const list = Array.isArray(fm.data["stories"]) ? fm.data["stories"] : [];
|
|
31
|
+
list.forEach((raw, i) => {
|
|
32
|
+
const e = raw;
|
|
33
|
+
if (!e || typeof e !== "object" || typeof e["id"] !== "string" || !/^US-?\d+$/i.test(e["id"])) {
|
|
34
|
+
err(fm.start || 1, "bad-story-entry", `stories[${i}]: needs an \`id\` like US-1`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const id = e["id"];
|
|
38
|
+
const key = canonicalStoryId(id);
|
|
39
|
+
if (entries.has(key))
|
|
40
|
+
err(lineOfEntry(id), "duplicate-story", `duplicate story id ${id} in frontmatter`);
|
|
41
|
+
for (const k of ["depends-on", "blocked-by"]) {
|
|
42
|
+
if (e[k] !== undefined && !Array.isArray(e[k]))
|
|
43
|
+
err(lineOfEntry(id), "not-a-list", `${id}: \`${k}\` must be a list`);
|
|
44
|
+
}
|
|
45
|
+
for (const k of Object.keys(e)) {
|
|
46
|
+
if (!STORY_KEYS.has(k))
|
|
47
|
+
warn(lineOfEntry(id), "unknown-key", `${id}: unknown key \`${k}\` ignored`);
|
|
48
|
+
}
|
|
49
|
+
if (e["status"] !== undefined && !KNOWN.has(String(e["status"]).toLowerCase())) {
|
|
50
|
+
warn(lineOfEntry(id), "unknown-status", `${id}: status \`${String(e["status"])}\` is not one of ${KNOWN_STATUSES.join("|")}`);
|
|
51
|
+
}
|
|
52
|
+
entries.set(key, e);
|
|
53
|
+
});
|
|
54
|
+
const stories = heads.map((head) => {
|
|
55
|
+
const e = entries.get(head.id);
|
|
56
|
+
const headRe = new RegExp(`^#{2,4}\\s+${esc(head.displayId)}\\b`);
|
|
57
|
+
const headLine = lines.findIndex((l) => headRe.test(l)) + 1;
|
|
58
|
+
if (!e) {
|
|
59
|
+
const hasBullets = head.status !== "" || head.dependsOn.length > 0 || head.blockedBy.length > 0;
|
|
60
|
+
warn(headLine || 1, "story-not-in-frontmatter", hasBullets
|
|
61
|
+
? `${head.displayId} is not in frontmatter stories; read from its 1.x bullets`
|
|
62
|
+
: `${head.displayId} has no metadata in frontmatter stories`);
|
|
63
|
+
return head;
|
|
64
|
+
}
|
|
65
|
+
entries.delete(head.id);
|
|
66
|
+
const asList = (v) => (Array.isArray(v) ? v.map((x) => canonicalStoryId(String(x))) : []);
|
|
67
|
+
const fmStatus = e["status"] === undefined ? "" : String(e["status"]).toLowerCase();
|
|
68
|
+
const fmDeps = asList(e["depends-on"]);
|
|
69
|
+
const fmBlk = asList(e["blocked-by"]);
|
|
70
|
+
const fmPri = e["priority"] === undefined ? head.priority : String(e["priority"]).toUpperCase();
|
|
71
|
+
// dual-write and stale headings: leftover 1.x data that disagrees with the frontmatter (frontmatter wins)
|
|
72
|
+
const drift = [];
|
|
73
|
+
if (head.status && head.status !== fmStatus)
|
|
74
|
+
drift.push(`status ${head.status} vs ${fmStatus}`);
|
|
75
|
+
if (head.dependsOn.length && head.dependsOn.join() !== fmDeps.join())
|
|
76
|
+
drift.push("depends-on");
|
|
77
|
+
if (head.blockedBy.length && head.blockedBy.join() !== fmBlk.join())
|
|
78
|
+
drift.push("blocked-by");
|
|
79
|
+
if (e["priority"] !== undefined && head.priority && head.priority !== fmPri)
|
|
80
|
+
drift.push(`priority ${head.priority} vs ${fmPri}`);
|
|
81
|
+
if (drift.length)
|
|
82
|
+
warn(headLine || 1, "v1-data-disagrees", `${head.displayId}: 1.x data disagrees with frontmatter (${drift.join(", ")}); frontmatter wins`);
|
|
83
|
+
return { ...head, priority: fmPri, status: fmStatus, dependsOn: fmDeps, blockedBy: fmBlk };
|
|
84
|
+
});
|
|
85
|
+
for (const e of entries.values()) {
|
|
86
|
+
err(lineOfEntry(e.id), "story-without-heading", `frontmatter story ${e.id} has no heading in the body`);
|
|
87
|
+
}
|
|
88
|
+
// feature-level depends-on: a list of feature numbers or directory names, as written
|
|
89
|
+
let dependsOn = [];
|
|
90
|
+
const raw = fm.data["depends-on"];
|
|
91
|
+
if (raw !== undefined) {
|
|
92
|
+
if (!Array.isArray(raw) || raw.some((x) => typeof x !== "string" && typeof x !== "number")) {
|
|
93
|
+
const at = lines.findIndex((l, k) => k >= fm.start - 1 && k < fm.end && /^depends-on\s*:/.test(l));
|
|
94
|
+
err(at === -1 ? fm.start : at + 1, "not-a-list", "feature-level `depends-on` must be a list of feature numbers or names");
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
dependsOn = raw.map((x) => String(x));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { format: 2, stories, meta: readSpecMeta(text), dependsOn, issues };
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=read-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-spec.js","sourceRoot":"","sources":["../../../src/core/spec-format/read-spec.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,wHAAwH;AACxH,yFAAyF;AACzF,OAAO,EAAE,gBAAgB,EAAE,Y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