@ambystech/ambykit 1.3.0 → 1.5.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 +125 -1
- package/README.md +16 -4
- package/dist/cli/activity.d.ts +5 -1
- package/dist/cli/activity.js +22 -8
- package/dist/cli/activity.js.map +1 -1
- package/dist/cli/add.js +12 -5
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/analyze.d.ts +1 -1
- package/dist/cli/analyze.js +83 -6
- package/dist/cli/analyze.js.map +1 -1
- package/dist/cli/base-command.js +12 -0
- package/dist/cli/base-command.js.map +1 -1
- package/dist/cli/check.js +36 -3
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/dashboard.js +3 -1
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/directive.d.ts +7 -0
- package/dist/cli/directive.js +43 -0
- package/dist/cli/directive.js.map +1 -0
- package/dist/cli/fleet.d.ts +16 -0
- package/dist/cli/fleet.js +472 -0
- package/dist/cli/fleet.js.map +1 -0
- package/dist/cli/graph.d.ts +13 -0
- package/dist/cli/graph.js +40 -0
- package/dist/cli/graph.js.map +1 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/io/fsops.d.ts +9 -0
- package/dist/cli/io/fsops.js +70 -1
- package/dist/cli/io/fsops.js.map +1 -1
- package/dist/cli/lane.d.ts +20 -0
- package/dist/cli/lane.js +396 -0
- package/dist/cli/lane.js.map +1 -0
- package/dist/cli/mcp.d.ts +21 -0
- package/dist/cli/mcp.js +27 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/sync.d.ts +9 -1
- package/dist/cli/sync.js +61 -7
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/trace.d.ts +14 -0
- package/dist/cli/trace.js +89 -0
- package/dist/cli/trace.js.map +1 -0
- package/dist/cli/ui/dashboard/feature-chart.js +15 -2
- package/dist/cli/ui/dashboard/feature-chart.js.map +1 -1
- package/dist/cli/ui/dashboard/feature-view.js +11 -1
- package/dist/cli/ui/dashboard/feature-view.js.map +1 -1
- package/dist/cli/ui/dashboard/graph-view.d.ts +44 -0
- package/dist/cli/ui/dashboard/graph-view.js +78 -0
- package/dist/cli/ui/dashboard/graph-view.js.map +1 -0
- package/dist/cli/ui/dashboard/help-overlay.d.ts +1 -1
- package/dist/cli/ui/dashboard/help-overlay.js +9 -0
- package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
- package/dist/cli/ui/dashboard/live-tokens.d.ts +221 -0
- package/dist/cli/ui/dashboard/live-tokens.js +221 -0
- package/dist/cli/ui/dashboard/live-tokens.js.map +1 -1
- package/dist/cli/ui/dashboard/quality-view.d.ts +8 -0
- package/dist/cli/ui/dashboard/quality-view.js +31 -0
- package/dist/cli/ui/dashboard/quality-view.js.map +1 -0
- package/dist/cli/ui/dashboard/story-detail.d.ts +1 -1
- package/dist/cli/ui/dashboard/story-detail.js +10 -3
- package/dist/cli/ui/dashboard/story-detail.js.map +1 -1
- package/dist/cli/ui/dashboard/tokens.d.ts +26 -0
- package/dist/cli/ui/dashboard/tokens.js +26 -0
- package/dist/cli/ui/dashboard/tokens.js.map +1 -1
- package/dist/cli/ui/dashboard/worktrees-panel.js +21 -3
- package/dist/cli/ui/dashboard/worktrees-panel.js.map +1 -1
- package/dist/cli/ui/interactive/live.js +3 -0
- package/dist/cli/ui/interactive/live.js.map +1 -1
- package/dist/cli/ui/interactive/overview.d.ts +13 -1
- package/dist/cli/ui/interactive/overview.js +62 -0
- package/dist/cli/ui/interactive/overview.js.map +1 -1
- package/dist/cli/ui/interactive/prompt.d.ts +17 -2
- package/dist/cli/ui/interactive/prompt.js +39 -9
- package/dist/cli/ui/interactive/prompt.js.map +1 -1
- package/dist/cli/ui/tool-options.d.ts +3 -2
- package/dist/cli/ui/tool-options.js +3 -3
- package/dist/cli/ui/tool-options.js.map +1 -1
- package/dist/cli/update.d.ts +1 -1
- package/dist/cli/update.js +8 -3
- package/dist/cli/update.js.map +1 -1
- package/dist/core/activity.d.ts +19 -2
- package/dist/core/activity.js +23 -7
- package/dist/core/activity.js.map +1 -1
- package/dist/core/agents.d.ts +1 -1
- package/dist/core/agents.js +9 -0
- package/dist/core/agents.js.map +1 -1
- package/dist/core/analyze.d.ts +86 -2
- package/dist/core/analyze.js +211 -63
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/checkouts.d.ts +11 -0
- package/dist/core/checkouts.js +84 -10
- package/dist/core/checkouts.js.map +1 -1
- package/dist/core/config.d.ts +28 -1
- package/dist/core/config.js +44 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/dashboard.d.ts +17 -0
- package/dist/core/dashboard.js +29 -1
- package/dist/core/dashboard.js.map +1 -1
- package/dist/core/decisions.d.ts +60 -0
- package/dist/core/decisions.js +231 -0
- package/dist/core/decisions.js.map +1 -0
- package/dist/core/emit.d.ts +21 -1
- package/dist/core/emit.js +93 -4
- package/dist/core/emit.js.map +1 -1
- package/dist/core/features.js +6 -1
- package/dist/core/features.js.map +1 -1
- package/dist/core/fleet/claims.d.ts +45 -0
- package/dist/core/fleet/claims.js +85 -0
- package/dist/core/fleet/claims.js.map +1 -0
- package/dist/core/fleet/directives.d.ts +56 -0
- package/dist/core/fleet/directives.js +99 -0
- package/dist/core/fleet/directives.js.map +1 -0
- package/dist/core/fleet/flow-input.d.ts +6 -0
- package/dist/core/fleet/flow-input.js +35 -0
- package/dist/core/fleet/flow-input.js.map +1 -0
- package/dist/core/fleet/index.d.ts +9 -0
- package/dist/core/fleet/index.js +10 -0
- package/dist/core/fleet/index.js.map +1 -0
- package/dist/core/fleet/lane-status.d.ts +39 -0
- package/dist/core/fleet/lane-status.js +63 -0
- package/dist/core/fleet/lane-status.js.map +1 -0
- package/dist/core/fleet/lock.d.ts +23 -0
- package/dist/core/fleet/lock.js +103 -0
- package/dist/core/fleet/lock.js.map +1 -0
- package/dist/core/fleet/notes.d.ts +31 -0
- package/dist/core/fleet/notes.js +56 -0
- package/dist/core/fleet/notes.js.map +1 -0
- package/dist/core/fleet/run-flow.d.ts +157 -0
- package/dist/core/fleet/run-flow.js +205 -0
- package/dist/core/fleet/run-flow.js.map +1 -0
- package/dist/core/fleet/runs.d.ts +46 -0
- package/dist/core/fleet/runs.js +182 -0
- package/dist/core/fleet/runs.js.map +1 -0
- package/dist/core/fleet/types.d.ts +63 -0
- package/dist/core/fleet/types.js +11 -0
- package/dist/core/fleet/types.js.map +1 -0
- package/dist/core/graph-format.d.ts +51 -0
- package/dist/core/graph-format.js +99 -0
- package/dist/core/graph-format.js.map +1 -0
- package/dist/core/graph-paths.d.ts +27 -0
- package/dist/core/graph-paths.js +94 -0
- package/dist/core/graph-paths.js.map +1 -0
- package/dist/core/graph-scope.d.ts +7 -0
- package/dist/core/graph-scope.js +31 -0
- package/dist/core/graph-scope.js.map +1 -0
- package/dist/core/graph-types.d.ts +55 -0
- package/dist/core/graph-types.js +6 -0
- package/dist/core/graph-types.js.map +1 -0
- package/dist/core/graph.d.ts +14 -0
- package/dist/core/graph.js +144 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/lanes.d.ts +116 -0
- package/dist/core/lanes.js +225 -0
- package/dist/core/lanes.js.map +1 -0
- package/dist/core/legacy.d.ts +10 -0
- package/dist/core/legacy.js +35 -0
- package/dist/core/legacy.js.map +1 -0
- package/dist/core/markers.d.ts +44 -0
- package/dist/core/markers.js +139 -0
- package/dist/core/markers.js.map +1 -0
- package/dist/core/merge-json.d.ts +15 -0
- package/dist/core/merge-json.js +46 -0
- package/dist/core/merge-json.js.map +1 -0
- package/dist/core/moved-targets.d.ts +23 -0
- package/dist/core/moved-targets.js +23 -0
- package/dist/core/moved-targets.js.map +1 -0
- package/dist/core/overview-types.d.ts +42 -2
- package/dist/core/overview-types.js.map +1 -1
- package/dist/core/overview.d.ts +1 -1
- package/dist/core/overview.js +93 -74
- package/dist/core/overview.js.map +1 -1
- package/dist/core/path-guard.d.ts +5 -0
- package/dist/core/path-guard.js +9 -0
- package/dist/core/path-guard.js.map +1 -0
- package/dist/core/paths.d.ts +2 -0
- package/dist/core/paths.js +4 -0
- package/dist/core/paths.js.map +1 -1
- package/dist/core/query.d.ts +91 -0
- package/dist/core/query.js +197 -0
- package/dist/core/query.js.map +1 -0
- package/dist/core/report.d.ts +36 -0
- package/dist/core/report.js +62 -0
- package/dist/core/report.js.map +1 -0
- package/dist/core/rules.js +5 -2
- package/dist/core/rules.js.map +1 -1
- package/dist/core/scaffold.d.ts +2 -2
- package/dist/core/scaffold.js +3 -1
- package/dist/core/scaffold.js.map +1 -1
- package/dist/core/subagents.d.ts +29 -0
- package/dist/core/subagents.js +52 -0
- package/dist/core/subagents.js.map +1 -0
- package/dist/core/tasks-edit.d.ts +34 -0
- package/dist/core/tasks-edit.js +115 -0
- package/dist/core/tasks-edit.js.map +1 -0
- package/dist/core/test-design.d.ts +94 -0
- package/dist/core/test-design.js +325 -0
- package/dist/core/test-design.js.map +1 -0
- package/dist/core/trace-cite.d.ts +16 -0
- package/dist/core/trace-cite.js +24 -0
- package/dist/core/trace-cite.js.map +1 -0
- package/dist/core/trace-coverage.d.ts +8 -0
- package/dist/core/trace-coverage.js +40 -0
- package/dist/core/trace-coverage.js.map +1 -0
- package/dist/core/trace-design.d.ts +6 -0
- package/dist/core/trace-design.js +16 -0
- package/dist/core/trace-design.js.map +1 -0
- package/dist/core/trace-io.d.ts +14 -0
- package/dist/core/trace-io.js +97 -0
- package/dist/core/trace-io.js.map +1 -0
- package/dist/core/trace-requirements.d.ts +9 -0
- package/dist/core/trace-requirements.js +27 -0
- package/dist/core/trace-requirements.js.map +1 -0
- package/dist/core/trace-tests.d.ts +7 -0
- package/dist/core/trace-tests.js +27 -0
- package/dist/core/trace-tests.js.map +1 -0
- package/dist/core/trace-types.d.ts +81 -0
- package/dist/core/trace-types.js +3 -0
- package/dist/core/trace-types.js.map +1 -0
- package/dist/core/trace.d.ts +18 -0
- package/dist/core/trace.js +109 -0
- package/dist/core/trace.js.map +1 -0
- package/dist/core/types.d.ts +48 -1
- package/dist/core/worktree.d.ts +8 -0
- package/dist/core/worktree.js +19 -1
- package/dist/core/worktree.js.map +1 -1
- package/dist/emitters/antigravity-cli.d.ts +7 -2
- package/dist/emitters/antigravity-cli.js +11 -2
- package/dist/emitters/antigravity-cli.js.map +1 -1
- package/dist/emitters/antigravity.d.ts +14 -9
- package/dist/emitters/antigravity.js +16 -10
- package/dist/emitters/antigravity.js.map +1 -1
- package/dist/emitters/augment.d.ts +14 -0
- package/dist/emitters/augment.js +20 -0
- package/dist/emitters/augment.js.map +1 -0
- package/dist/emitters/base-emitter.d.ts +34 -0
- package/dist/emitters/base-emitter.js +50 -3
- package/dist/emitters/base-emitter.js.map +1 -1
- package/dist/emitters/claude.d.ts +12 -2
- package/dist/emitters/claude.js +34 -5
- package/dist/emitters/claude.js.map +1 -1
- package/dist/emitters/codex.d.ts +2 -9
- package/dist/emitters/codex.js +2 -19
- package/dist/emitters/codex.js.map +1 -1
- package/dist/emitters/copilot-cli.d.ts +7 -3
- package/dist/emitters/copilot-cli.js +12 -8
- package/dist/emitters/copilot-cli.js.map +1 -1
- package/dist/emitters/copilot.d.ts +5 -0
- package/dist/emitters/copilot.js +23 -1
- package/dist/emitters/copilot.js.map +1 -1
- package/dist/emitters/cursor.d.ts +3 -0
- package/dist/emitters/cursor.js +8 -1
- package/dist/emitters/cursor.js.map +1 -1
- package/dist/emitters/gemini.d.ts +14 -0
- package/dist/emitters/gemini.js +19 -0
- package/dist/emitters/gemini.js.map +1 -0
- package/dist/emitters/index.d.ts +28 -2
- package/dist/emitters/index.js +55 -4
- package/dist/emitters/index.js.map +1 -1
- package/dist/emitters/kilo.d.ts +14 -0
- package/dist/emitters/kilo.js +17 -0
- package/dist/emitters/kilo.js.map +1 -0
- package/dist/emitters/kiro.d.ts +12 -0
- package/dist/emitters/kiro.js +14 -0
- package/dist/emitters/kiro.js.map +1 -0
- package/dist/emitters/llxprt.d.ts +13 -0
- package/dist/emitters/llxprt.js +18 -0
- package/dist/emitters/llxprt.js.map +1 -0
- package/dist/emitters/opencode.d.ts +8 -0
- package/dist/emitters/opencode.js +23 -0
- package/dist/emitters/opencode.js.map +1 -1
- package/dist/emitters/qwen.d.ts +15 -0
- package/dist/emitters/qwen.js +23 -0
- package/dist/emitters/qwen.js.map +1 -0
- package/dist/emitters/skills-emitter.d.ts +21 -0
- package/dist/emitters/skills-emitter.js +39 -0
- package/dist/emitters/skills-emitter.js.map +1 -0
- package/dist/emitters/toml-command-emitter.d.ts +29 -0
- package/dist/emitters/toml-command-emitter.js +69 -0
- package/dist/emitters/toml-command-emitter.js.map +1 -0
- package/dist/emitters/windsurf.d.ts +16 -0
- package/dist/emitters/windsurf.js +21 -0
- package/dist/emitters/windsurf.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/protocol.d.ts +44 -0
- package/dist/mcp/protocol.js +114 -0
- package/dist/mcp/protocol.js.map +1 -0
- package/dist/mcp/registry.d.ts +40 -0
- package/dist/mcp/registry.js +44 -0
- package/dist/mcp/registry.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +14 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/common.d.ts +12 -0
- package/dist/mcp/tools/common.js +12 -0
- package/dist/mcp/tools/common.js.map +1 -0
- package/dist/mcp/tools/fleet.d.ts +10 -0
- package/dist/mcp/tools/fleet.js +102 -0
- package/dist/mcp/tools/fleet.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +3 -0
- package/dist/mcp/tools/index.js +13 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/read.d.ts +6 -0
- package/dist/mcp/tools/read.js +62 -0
- package/dist/mcp/tools/read.js.map +1 -0
- package/dist/mcp/tools/write.d.ts +6 -0
- package/dist/mcp/tools/write.js +34 -0
- package/dist/mcp/tools/write.js.map +1 -0
- package/dist/plugins/api.d.ts +39 -0
- package/dist/plugins/api.js +28 -0
- package/dist/plugins/api.js.map +1 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +35 -0
- package/dist/plugins/loader.js +117 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manifest.d.ts +21 -0
- package/dist/plugins/manifest.js +53 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/registry.d.ts +36 -0
- package/dist/plugins/registry.js +30 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/report.d.ts +9 -0
- package/dist/plugins/report.js +19 -0
- package/dist/plugins/report.js.map +1 -0
- package/dist/plugins/semver.d.ts +23 -0
- package/dist/plugins/semver.js +106 -0
- package/dist/plugins/semver.js.map +1 -0
- package/dist/plugins/session.d.ts +18 -0
- package/dist/plugins/session.js +22 -0
- package/dist/plugins/session.js.map +1 -0
- package/dist/testkit/contract.d.ts +33 -0
- package/dist/testkit/contract.js +118 -0
- package/dist/testkit/contract.js.map +1 -0
- package/dist/testkit/index.d.ts +15 -0
- package/dist/testkit/index.js +15 -0
- package/dist/testkit/index.js.map +1 -0
- package/docs/architecture.md +34 -6
- package/docs/artifacts/decision-record.md +54 -0
- package/docs/artifacts/tasks.md +37 -0
- package/docs/artifacts/tests.md +43 -0
- package/docs/cli-reference.md +224 -7
- package/docs/concepts/mcp-server.md +93 -0
- package/docs/contributing.md +9 -0
- package/docs/index.md +2 -2
- package/docs/plugin-api.md +124 -0
- package/docs/plugin-split.md +55 -0
- package/docs/plugin-trust.md +51 -0
- package/docs/tool-compatibility.md +155 -18
- package/docs/workflow.md +66 -5
- package/package.json +5 -2
- package/src/agents/worker.md +37 -0
- package/src/prompts/converge.md +8 -3
- package/src/prompts/decide.md +31 -0
- package/src/prompts/implement.md +17 -8
- package/src/prompts/revise.md +4 -2
- package/src/prompts/run.md +100 -0
- package/src/prompts/tasks.md +16 -4
- package/src/roles/security.md +17 -0
- package/src/templates/adr.md +29 -0
- package/src/templates/tasks.md +8 -1
- package/src/templates/tests.md +29 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join as nativeJoin } from "node:path";
|
|
3
|
+
import { join } from "node:path/posix";
|
|
4
|
+
import { loadCommandSpecs } from "./command-spec.js";
|
|
5
|
+
import { getTarget } from "../emitters/index.js";
|
|
6
|
+
/** Where the Antigravity targets wrote phase commands before feature 018 (workflows, retired 2026-10-19). */
|
|
7
|
+
export const LEGACY_WORKFLOW_DIR = join(".agents", "workflows");
|
|
8
|
+
const GENERATED = "GENERATED by AmbyKit";
|
|
9
|
+
/**
|
|
10
|
+
* Stale, AmbyKit-generated Antigravity workflow files (feature 018, FR-005/FR-006): project-relative
|
|
11
|
+
* paths of `.agents/workflows/amby.<phase>.md` that exist **and** carry the generated notice. Empty
|
|
12
|
+
* unless an Antigravity target is selected, so other projects never see a message. A user's own
|
|
13
|
+
* workflow, a `.bak` left by Antigravity's migration, or a file with a non-phase name never matches.
|
|
14
|
+
*/
|
|
15
|
+
export function legacyWorkflowFiles(root, config) {
|
|
16
|
+
const antigravity = config.tools.some((id) => getTarget(id)?.emitter.toolId === "antigravity" || getTarget(id)?.emitter.toolId === "antigravity-cli");
|
|
17
|
+
if (!antigravity)
|
|
18
|
+
return [];
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const spec of loadCommandSpecs()) {
|
|
21
|
+
const rel = join(LEGACY_WORKFLOW_DIR, `${spec.name}.md`);
|
|
22
|
+
const abs = nativeJoin(root, rel);
|
|
23
|
+
if (!existsSync(abs))
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
if (readFileSync(abs, "utf8").includes(GENERATED))
|
|
27
|
+
out.push(rel);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// unreadable: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AAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/B,IAAI,CAAC;YACH,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-line markers and per-phase Verify lines (feature 020). Pure and IO-free: `parseTasks` calls
|
|
3
|
+
* `parseMarkers` on the text after the task id, and `parsePhases` reads the Verify line of each phase.
|
|
4
|
+
* Markers are the trailing segment of a task line, after the `(file/path)` group, so a reason that
|
|
5
|
+
* contains parentheses or backticks can never be read as file ownership.
|
|
6
|
+
*/
|
|
7
|
+
/** Result of cutting the trailing markers off a task line's text. */
|
|
8
|
+
export interface ParsedMarkers {
|
|
9
|
+
/** The line text before the first marker (the input, untouched, when there is none). */
|
|
10
|
+
body: string;
|
|
11
|
+
/** BLOCKED reason(s) joined with ` | `; `""` = marker present with no reason. Undefined = not blocked. */
|
|
12
|
+
blocked?: string;
|
|
13
|
+
/** DEVIATION note(s) joined with ` | `. */
|
|
14
|
+
deviation?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Cut `⚠ BLOCKED: <reason>` and `↪ DEVIATION: <note>` (glyphs optional) off the end of a task line.
|
|
18
|
+
* A marker's text runs to the next marker or the end of the line. Several markers of one kind are
|
|
19
|
+
* joined with ` | `. Keywords inside backtick code spans are ignored, so prose that documents the
|
|
20
|
+
* syntax is not read as a marker.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseMarkers(rest: string): ParsedMarkers;
|
|
23
|
+
/** N from a `## Phase N` heading text, else the 1-based `##` ordinal (the rule `parseTasks` always used). */
|
|
24
|
+
export declare function phaseNumber(heading: string, ordinal: number): number;
|
|
25
|
+
export type VerifyResult = "passed" | "failed" | "unverified";
|
|
26
|
+
/** The Verify line of one phase (feature 020 FR-005). */
|
|
27
|
+
export interface PhaseVerify {
|
|
28
|
+
/** Same numbering as `TaskLine.phase`. */
|
|
29
|
+
phase: number;
|
|
30
|
+
/** Heading text after `## `. */
|
|
31
|
+
title: string;
|
|
32
|
+
/** Task lines in the phase; a phase is only verifiable when this is above zero. */
|
|
33
|
+
tasks: number;
|
|
34
|
+
/** The check, without its result suffix; undefined when the phase has no Verify line. */
|
|
35
|
+
check?: string;
|
|
36
|
+
/** Last recorded result; undefined = no result recorded yet. */
|
|
37
|
+
result?: VerifyResult;
|
|
38
|
+
/** Reason after `✗ failed:`; may be empty. */
|
|
39
|
+
why?: string;
|
|
40
|
+
/** Further Verify lines in the same phase; only the first is used. */
|
|
41
|
+
duplicates: number;
|
|
42
|
+
}
|
|
43
|
+
/** Per-phase Verify lines of a tasks.md body, numbered exactly as `parseTasks` numbers phases. */
|
|
44
|
+
export declare function parsePhases(content: string): PhaseVerify[];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-line markers and per-phase Verify lines (feature 020). Pure and IO-free: `parseTasks` calls
|
|
3
|
+
* `parseMarkers` on the text after the task id, and `parsePhases` reads the Verify line of each phase.
|
|
4
|
+
* Markers are the trailing segment of a task line, after the `(file/path)` group, so a reason that
|
|
5
|
+
* contains parentheses or backticks can never be read as file ownership.
|
|
6
|
+
*/
|
|
7
|
+
const KEYWORD = /(?:(⚠|↪)\s*)?(?<![\w-])(BLOCKED|DEVIATION):/g;
|
|
8
|
+
/** `[start, end)` ranges covered by backtick code spans, so documented examples are not markers. */
|
|
9
|
+
function codeSpans(text) {
|
|
10
|
+
const spans = [];
|
|
11
|
+
let i = 0;
|
|
12
|
+
while (i < text.length) {
|
|
13
|
+
if (text[i] !== "`") {
|
|
14
|
+
i += 1;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
let run = 1;
|
|
18
|
+
while (text[i + run] === "`")
|
|
19
|
+
run += 1;
|
|
20
|
+
const fence = "`".repeat(run);
|
|
21
|
+
const close = text.indexOf(fence, i + run);
|
|
22
|
+
if (close === -1) {
|
|
23
|
+
i += run;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
spans.push([i, close + run]);
|
|
27
|
+
i = close + run;
|
|
28
|
+
}
|
|
29
|
+
return spans;
|
|
30
|
+
}
|
|
31
|
+
function findMarkers(text) {
|
|
32
|
+
const spans = codeSpans(text);
|
|
33
|
+
const inSpan = (pos) => spans.some(([a, b]) => pos >= a && pos < b);
|
|
34
|
+
const hits = [];
|
|
35
|
+
for (const m of text.matchAll(KEYWORD)) {
|
|
36
|
+
const start = m.index ?? 0;
|
|
37
|
+
if (inSpan(start) || inSpan(start + m[0].length - 1))
|
|
38
|
+
continue;
|
|
39
|
+
hits.push({
|
|
40
|
+
kind: (m[2] ?? "").toUpperCase() === "BLOCKED" ? "blocked" : "deviation",
|
|
41
|
+
start,
|
|
42
|
+
textStart: start + m[0].length,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return hits;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Cut `⚠ BLOCKED: <reason>` and `↪ DEVIATION: <note>` (glyphs optional) off the end of a task line.
|
|
49
|
+
* A marker's text runs to the next marker or the end of the line. Several markers of one kind are
|
|
50
|
+
* joined with ` | `. Keywords inside backtick code spans are ignored, so prose that documents the
|
|
51
|
+
* syntax is not read as a marker.
|
|
52
|
+
*/
|
|
53
|
+
export function parseMarkers(rest) {
|
|
54
|
+
const hits = findMarkers(rest);
|
|
55
|
+
const first = hits[0];
|
|
56
|
+
if (!first)
|
|
57
|
+
return { body: rest };
|
|
58
|
+
const blocked = [];
|
|
59
|
+
const deviation = [];
|
|
60
|
+
let sawBlocked = false;
|
|
61
|
+
let sawDeviation = false;
|
|
62
|
+
hits.forEach((h, i) => {
|
|
63
|
+
const end = hits[i + 1]?.start ?? rest.length;
|
|
64
|
+
const text = rest.slice(h.textStart, end).trim();
|
|
65
|
+
if (h.kind === "blocked") {
|
|
66
|
+
sawBlocked = true;
|
|
67
|
+
if (text)
|
|
68
|
+
blocked.push(text);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
sawDeviation = true;
|
|
72
|
+
if (text)
|
|
73
|
+
deviation.push(text);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const out = { body: rest.slice(0, first.start).trimEnd() };
|
|
77
|
+
if (sawBlocked)
|
|
78
|
+
out.blocked = blocked.join(" | ");
|
|
79
|
+
if (sawDeviation)
|
|
80
|
+
out.deviation = deviation.join(" | ");
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
/** N from a `## Phase N` heading text, else the 1-based `##` ordinal (the rule `parseTasks` always used). */
|
|
84
|
+
export function phaseNumber(heading, ordinal) {
|
|
85
|
+
const n = /^Phase\s+(\d+)/i.exec(heading);
|
|
86
|
+
return n ? Number(n[1]) : ordinal;
|
|
87
|
+
}
|
|
88
|
+
const VERIFY_LINE = /^\s*(?:-\s*)?\*\*Verify:\*\*\s*(.*?)\s*$/;
|
|
89
|
+
const RESULT_SUFFIX = /(?:^|\s)(✓\s*passed|passed|✗\s*failed(?::\s*.*)?|failed:\s*.*|\?\s*unverified|unverified)\s*$/i;
|
|
90
|
+
function splitResult(value) {
|
|
91
|
+
const m = RESULT_SUFFIX.exec(value);
|
|
92
|
+
if (!m || m.index === undefined)
|
|
93
|
+
return { check: value };
|
|
94
|
+
const token = m[1] ?? "";
|
|
95
|
+
const check = value.slice(0, m.index).trim();
|
|
96
|
+
if (/passed$/i.test(token))
|
|
97
|
+
return { check, result: "passed" };
|
|
98
|
+
if (/unverified$/i.test(token))
|
|
99
|
+
return { check, result: "unverified" };
|
|
100
|
+
return { check, result: "failed", why: (/failed:\s*(.*)$/i.exec(token)?.[1] ?? "").trim() };
|
|
101
|
+
}
|
|
102
|
+
/** Per-phase Verify lines of a tasks.md body, numbered exactly as `parseTasks` numbers phases. */
|
|
103
|
+
export function parsePhases(content) {
|
|
104
|
+
const taskRe = /^\s*-\s*\[[ xX]\]\s*\[T\d+\]/;
|
|
105
|
+
const phases = [];
|
|
106
|
+
let current = null;
|
|
107
|
+
let headings = 0;
|
|
108
|
+
for (const line of content.split(/\r?\n/)) {
|
|
109
|
+
const h = /^##\s+(.*)$/.exec(line);
|
|
110
|
+
if (h) {
|
|
111
|
+
headings += 1;
|
|
112
|
+
const title = (h[1] ?? "").trim();
|
|
113
|
+
current = { phase: phaseNumber(title, headings), title, tasks: 0, duplicates: 0 };
|
|
114
|
+
phases.push(current);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!current)
|
|
118
|
+
continue; // a Verify line outside any phase belongs to nothing
|
|
119
|
+
if (taskRe.test(line)) {
|
|
120
|
+
current.tasks += 1;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const v = VERIFY_LINE.exec(line);
|
|
124
|
+
if (!v)
|
|
125
|
+
continue;
|
|
126
|
+
if (current.check !== undefined) {
|
|
127
|
+
current.duplicates += 1;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const { check, result, why } = splitResult(v[1] ?? "");
|
|
131
|
+
current.check = check;
|
|
132
|
+
if (result)
|
|
133
|
+
current.result = result;
|
|
134
|
+
if (why !== undefined)
|
|
135
|
+
current.why = why;
|
|
136
|
+
}
|
|
137
|
+
return phases;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=markers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markers.js","sourceRoot":"","sources":["../../src/core/markers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH,MAAM,OAAO,GAAG,8CAA8C,CAAC;AAE/D,oGAAoG;AACpG,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,KAAK,GAA4B,EAAE,CAAC;IAC1C,IAAI,CAAC,GAAG,CAAC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,CAAC,CAAC;YACnB,SAAS;QACX,CAAC;QACD,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;YACxB,SAAS;QACX,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QACtB,IAAI,MAAM;YAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QACpC,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splice one named server entry into a JSON config file (feature 025, T060). Pure: text in, text out.
|
|
3
|
+
* It adds or replaces `<key>.<name>` and leaves every other key, and the order of keys, exactly as the
|
|
4
|
+
* user wrote them. A file that is not plain JSON (comments, trailing commas), or whose shape is not what
|
|
5
|
+
* the target documents, is left alone and reported: AmbyKit never rewrites a file it cannot round-trip
|
|
6
|
+
* (Principle 7).
|
|
7
|
+
*/
|
|
8
|
+
export type JsonMergePlan = {
|
|
9
|
+
action: "created" | "updated" | "unchanged";
|
|
10
|
+
contents: string;
|
|
11
|
+
} | {
|
|
12
|
+
action: "skipped";
|
|
13
|
+
reason: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function mergeJsonEntry(existing: string | null, key: string, name: string, entry: unknown): JsonMergePlan;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splice one named server entry into a JSON config file (feature 025, T060). Pure: text in, text out.
|
|
3
|
+
* It adds or replaces `<key>.<name>` and leaves every other key, and the order of keys, exactly as the
|
|
4
|
+
* user wrote them. A file that is not plain JSON (comments, trailing commas), or whose shape is not what
|
|
5
|
+
* the target documents, is left alone and reported: AmbyKit never rewrites a file it cannot round-trip
|
|
6
|
+
* (Principle 7).
|
|
7
|
+
*/
|
|
8
|
+
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
9
|
+
/** Key-order-independent form, so a user reordering our entry's keys does not read as a change. */
|
|
10
|
+
function canonical(v) {
|
|
11
|
+
if (Array.isArray(v))
|
|
12
|
+
return `[${v.map(canonical).join(",")}]`;
|
|
13
|
+
if (isObject(v))
|
|
14
|
+
return `{${Object.keys(v).sort().map((k) => `${JSON.stringify(k)}:${canonical(v[k])}`).join(",")}}`;
|
|
15
|
+
return JSON.stringify(v);
|
|
16
|
+
}
|
|
17
|
+
export function mergeJsonEntry(existing, key, name, entry) {
|
|
18
|
+
if (existing === null || existing.trim() === "") {
|
|
19
|
+
return { action: "created", contents: JSON.stringify({ [key]: { [name]: entry } }, null, 2) + "\n" };
|
|
20
|
+
}
|
|
21
|
+
const text = existing.charCodeAt(0) === 0xfeff ? existing.slice(1) : existing;
|
|
22
|
+
let root;
|
|
23
|
+
try {
|
|
24
|
+
root = JSON.parse(text);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return { action: "skipped", reason: "not plain JSON (comments or trailing commas?); left untouched" };
|
|
28
|
+
}
|
|
29
|
+
if (!isObject(root))
|
|
30
|
+
return { action: "skipped", reason: "top level is not a JSON object; left untouched" };
|
|
31
|
+
const group = root[key];
|
|
32
|
+
if (group !== undefined && !isObject(group))
|
|
33
|
+
return { action: "skipped", reason: `'${key}' is not an object; left untouched` };
|
|
34
|
+
if (group !== undefined && name in group && canonical(group[name]) === canonical(entry))
|
|
35
|
+
return { action: "unchanged", contents: existing };
|
|
36
|
+
const next = { ...root, [key]: { ...(group ?? {}), [name]: entry } };
|
|
37
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
38
|
+
const indent = /\n([ \t]+)"/.exec(text)?.[1] ?? " ";
|
|
39
|
+
let out = JSON.stringify(next, null, indent);
|
|
40
|
+
if (eol === "\r\n")
|
|
41
|
+
out = out.replace(/\n/g, "\r\n");
|
|
42
|
+
if (/\n\s*$/.test(text) || !/\n/.test(text))
|
|
43
|
+
out += eol;
|
|
44
|
+
return { action: "updated", contents: out };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=merge-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-json.js","sourceRoot":"","sources":["../../src/core/merge-json.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAExH,mGAAmG;AACnG,SAAS,SAAS,CAAC,CAAU;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC/D,IAAI,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACrH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAuB,EAAE,GAAW,EAAE,IAAY,EAAE,KAAc;I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AM,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;IACrE,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACrD,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,GAAG,KAAK,MAAM;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrD,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,GAAG,IAAI,GAAG,CAAC;IACxD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export interface MovedTarget {
|
|
10
|
+
/** The npm package that now provides the target. */
|
|
11
|
+
package: string;
|
|
12
|
+
/** The AmbyKit release that stopped bundling it. */
|
|
13
|
+
since: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const MOVED_TARGETS: Record<string, MovedTarget>;
|
|
16
|
+
/** Where a moved target lives now, or undefined for a target that did not move. Pure. */
|
|
17
|
+
export declare function movedTarget(id: string, map?: Readonly<Record<string, MovedTarget>>): MovedTarget | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* One notice per configured target that is no longer bundled and has moved. `known` says whether a target
|
|
20
|
+
* is available (built in, or from a plugin that loaded); a moved target that a plugin now provides is not
|
|
21
|
+
* reported. Pure.
|
|
22
|
+
*/
|
|
23
|
+
export declare function movedTargetNotices(ids: readonly string[], known: (id: string) => boolean, map?: Readonly<Record<string, MovedTarget>>): string[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const MOVED_TARGETS = {};
|
|
2
|
+
/** Where a moved target lives now, or undefined for a target that did not move. Pure. */
|
|
3
|
+
export function movedTarget(id, map = MOVED_TARGETS) {
|
|
4
|
+
return Object.hasOwn(map, id) ? map[id] : undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* One notice per configured target that is no longer bundled and has moved. `known` says whether a target
|
|
8
|
+
* is available (built in, or from a plugin that loaded); a moved target that a plugin now provides is not
|
|
9
|
+
* reported. Pure.
|
|
10
|
+
*/
|
|
11
|
+
export function movedTargetNotices(ids, known, map = MOVED_TARGETS) {
|
|
12
|
+
const out = [];
|
|
13
|
+
for (const id of ids) {
|
|
14
|
+
if (known(id))
|
|
15
|
+
continue;
|
|
16
|
+
const moved = movedTarget(id, map);
|
|
17
|
+
if (!moved)
|
|
18
|
+
continue;
|
|
19
|
+
out.push(`Target '${id}' moved to the plugin ${moved.package} (since ${moved.since}). Run \`npm install --save-exact ${moved.package}\` and list it under "plugins" in .amby/config.json with that exact version. Files already written for it are left in place.`);
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=moved-targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moved-targets.js","sourceRoot":"","sources":["../../src/core/moved-targets.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,aAAa,GAAgC,EAAE,CAAC;AAE7D,yFAAyF;AACzF,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,GAAG,GAA0C,aAAa;IAChG,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,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,yBAAyB,KAAK,CAAC,OAAO,WAAW,KAAK,CAAC,KAAK,qCAAqC,KAAK,CAAC,OAAO,8HAA8H,CAC1P,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { StoryProgress, TaskLine } from "./dashboard.js";
|
|
2
|
+
import type { PhaseVerify } from "./markers.js";
|
|
3
|
+
export type { PhaseVerify };
|
|
2
4
|
/**
|
|
3
5
|
* Value objects for the dashboard overview (feature 014). Plain and IO-free; produced by
|
|
4
6
|
* `features.ts`/`overview.ts`/`burndown.ts`, consumed by the renderers and `--json --overview`.
|
|
@@ -24,11 +26,21 @@ export interface Clarification {
|
|
|
24
26
|
*/
|
|
25
27
|
export interface Checkout {
|
|
26
28
|
root: string;
|
|
27
|
-
kind: "main" | "worktree";
|
|
29
|
+
kind: "main" | "worktree" | "lane";
|
|
28
30
|
branch?: string;
|
|
29
31
|
dirty?: boolean;
|
|
30
32
|
stale?: boolean;
|
|
31
33
|
}
|
|
34
|
+
/** One parallel lane of a feature (feature 015): its task progress, git state and manifest drift. */
|
|
35
|
+
export interface LaneView {
|
|
36
|
+
name: string;
|
|
37
|
+
phase: number;
|
|
38
|
+
index: number;
|
|
39
|
+
done: number;
|
|
40
|
+
total: number;
|
|
41
|
+
state: "clean" | "dirty" | "merged";
|
|
42
|
+
drift: string[];
|
|
43
|
+
}
|
|
32
44
|
/** Everything the dashboard knows about one `specs/NNN-slug/` directory. */
|
|
33
45
|
export interface FeatureSnapshot {
|
|
34
46
|
/** Source checkout (feature 017); absent ≡ the primary checkout. */
|
|
@@ -38,6 +50,8 @@ export interface FeatureSnapshot {
|
|
|
38
50
|
displayRef: string;
|
|
39
51
|
stories: StoryProgress[];
|
|
40
52
|
tasks: TaskLine[] | null;
|
|
53
|
+
/** Feature 020: the Verify line of each phase of tasks.md; absent when there is no tasks.md. */
|
|
54
|
+
verify?: PhaseVerify[];
|
|
41
55
|
artifacts: {
|
|
42
56
|
spec: boolean;
|
|
43
57
|
ui: boolean;
|
|
@@ -46,6 +60,17 @@ export interface FeatureSnapshot {
|
|
|
46
60
|
tasks: boolean;
|
|
47
61
|
};
|
|
48
62
|
clarifications: Clarification[];
|
|
63
|
+
/** Feature 015: parallel lanes of this feature; absent when it has none. */
|
|
64
|
+
lanes?: LaneView[];
|
|
65
|
+
/** Feature 024: requirement coverage; absent when the feature has no requirements. `uncovered` feeds the quality view. */
|
|
66
|
+
coverage?: {
|
|
67
|
+
covered: number;
|
|
68
|
+
total: number;
|
|
69
|
+
uncovered: {
|
|
70
|
+
id: string;
|
|
71
|
+
text: string;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
49
74
|
}
|
|
50
75
|
export interface Filters {
|
|
51
76
|
feature?: string;
|
|
@@ -75,10 +100,25 @@ export interface FeatureRow {
|
|
|
75
100
|
clarifications: number;
|
|
76
101
|
/** Source worktree (feature 017); absent for the primary checkout. */
|
|
77
102
|
checkout?: Checkout;
|
|
103
|
+
/** Feature 015: lanes, only when the feature has some. */
|
|
104
|
+
lanes?: LaneView[];
|
|
105
|
+
/** Feature 020: tasks carrying a BLOCKED marker; omitted when zero. */
|
|
106
|
+
blocked?: number;
|
|
107
|
+
/** Feature 020: Verify lines by state; omitted when the feature has none. */
|
|
108
|
+
verify?: {
|
|
109
|
+
verified: number;
|
|
110
|
+
failed: number;
|
|
111
|
+
missing: number;
|
|
112
|
+
};
|
|
113
|
+
/** Feature 024: covered over total requirements; omitted when the feature has no requirements. */
|
|
114
|
+
coverage?: {
|
|
115
|
+
covered: number;
|
|
116
|
+
total: number;
|
|
117
|
+
};
|
|
78
118
|
}
|
|
79
119
|
export interface AttentionItem {
|
|
80
120
|
key: string;
|
|
81
|
-
kind: "graph-problem" | "blocked" | "waiting";
|
|
121
|
+
kind: "graph-problem" | "blocked" | "waiting" | "task-blocked" | "verify-failed";
|
|
82
122
|
refs: string[];
|
|
83
123
|
reason: string;
|
|
84
124
|
}
|
|
@@ -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":"AAaA,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM;IACN,aAAa;IACb,OAAO;IACP,OAAO;IACP,SAAS;IACT,UAAU;IACV,OAAO;CACR,CAAC"}
|
package/dist/core/overview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { StoryProgress } from "./dashboard.js";
|
|
2
2
|
import { type AttentionItem, type FeatureRow, type FeatureSnapshot, type Filters, type Overview, type OverviewOptions, type ParseIssue, type Phase, type Status, type Summary } from "./overview-types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Compute the dashboard overview from feature snapshots (feature 014). Pure — no filesystem, no
|