@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,118 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { loadCommandSpecs } from "../core/command-spec.js";
|
|
3
|
+
import { escapesProject } from "../core/path-guard.js";
|
|
4
|
+
const SURFACES = new Set(["commands", "skills", "workflows", "none"]);
|
|
5
|
+
function rowProblems(row) {
|
|
6
|
+
if (!row || typeof row !== "object")
|
|
7
|
+
return ["the row is not an object"];
|
|
8
|
+
const r = row;
|
|
9
|
+
const out = [];
|
|
10
|
+
for (const k of ["target", "commandDir", "fileTemplate", "sourceUrl"]) {
|
|
11
|
+
if (typeof r[k] !== "string" || r[k] === "")
|
|
12
|
+
out.push(`${k} must be a non-empty string`);
|
|
13
|
+
}
|
|
14
|
+
if (typeof r["commandSurface"] !== "string" || !SURFACES.has(r["commandSurface"]))
|
|
15
|
+
out.push(`commandSurface must be one of ${[...SURFACES].join(", ")}`);
|
|
16
|
+
if (!Array.isArray(r["frontmatterKeys"]) || !r["frontmatterKeys"].every((k) => typeof k === "string"))
|
|
17
|
+
out.push("frontmatterKeys must be an array of strings");
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
const norm = (p) => posix.normalize(p.replaceAll("\\", "/")).replace(/^\.\//, "").replace(/\/$/, "");
|
|
21
|
+
/** The leading frontmatter keys of a command file, in order. YAML (`---` block) or TOML (top-level `key =`). */
|
|
22
|
+
export function frontmatterKeys(path, contents) {
|
|
23
|
+
const lines = contents.replaceAll("\r\n", "\n").split("\n");
|
|
24
|
+
if (path.endsWith(".toml")) {
|
|
25
|
+
const keys = [];
|
|
26
|
+
let open = null;
|
|
27
|
+
for (const line of lines) {
|
|
28
|
+
if (open) {
|
|
29
|
+
if (line.includes(open))
|
|
30
|
+
open = null;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const m = /^([A-Za-z0-9_.-]+)\s*=\s*(.*)$/.exec(line);
|
|
34
|
+
if (!m)
|
|
35
|
+
continue;
|
|
36
|
+
keys.push(m[1]);
|
|
37
|
+
const value = m[2];
|
|
38
|
+
const delim = value.startsWith("'''") ? "'''" : value.startsWith('"""') ? '"""' : null;
|
|
39
|
+
if (delim && !value.slice(3).includes(delim))
|
|
40
|
+
open = delim;
|
|
41
|
+
}
|
|
42
|
+
return keys;
|
|
43
|
+
}
|
|
44
|
+
if (lines[0]?.trim() !== "---")
|
|
45
|
+
return [];
|
|
46
|
+
const keys = [];
|
|
47
|
+
for (const line of lines.slice(1)) {
|
|
48
|
+
if (line.trim() === "---")
|
|
49
|
+
return keys;
|
|
50
|
+
const m = /^([A-Za-z0-9_-]+):/.exec(line);
|
|
51
|
+
if (m)
|
|
52
|
+
keys.push(m[1]);
|
|
53
|
+
}
|
|
54
|
+
return keys;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Compare an emitter's output with a matrix row. Returns every difference (empty = the contract holds).
|
|
58
|
+
* `specs` defaults to the shipped phase prompts.
|
|
59
|
+
*/
|
|
60
|
+
export function checkEmitterContract(target, row, specs = loadCommandSpecs()) {
|
|
61
|
+
if (row === null || row === undefined) {
|
|
62
|
+
return [{ kind: "missing-row", message: `No matrix row for target '${target.id}'. Record the host's documented paths and frontmatter keys as a row before the contract can be checked.` }];
|
|
63
|
+
}
|
|
64
|
+
const bad = rowProblems(row);
|
|
65
|
+
if (bad.length > 0)
|
|
66
|
+
return [{ kind: "invalid-row", message: `The matrix row is invalid: ${bad.join("; ")}.` }];
|
|
67
|
+
const failures = [];
|
|
68
|
+
const emitter = target.emitter;
|
|
69
|
+
if (row.target !== target.id)
|
|
70
|
+
failures.push({ kind: "target", message: `The row is for target '${row.target}', but the target is '${target.id}'.` });
|
|
71
|
+
if (row.commandSurface !== emitter.commandSurface) {
|
|
72
|
+
failures.push({ kind: "surface", message: `commandSurface is '${emitter.commandSurface}', the row says '${row.commandSurface}'.` });
|
|
73
|
+
}
|
|
74
|
+
if (norm(row.commandDir) !== norm(emitter.commandDir)) {
|
|
75
|
+
failures.push({ kind: "dir", message: `commandDir is '${emitter.commandDir}', the row says '${row.commandDir}'.` });
|
|
76
|
+
}
|
|
77
|
+
let files;
|
|
78
|
+
try {
|
|
79
|
+
const ctx = { projectName: "contract-kit", specs, manageRules: false };
|
|
80
|
+
files = emitter.emit(specs, ctx);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return [...failures, { kind: "emit-threw", message: `emit() threw: ${err instanceof Error ? err.message : String(err)}` }];
|
|
84
|
+
}
|
|
85
|
+
for (const f of files) {
|
|
86
|
+
if (f.scope === "project" && escapesProject(f.path))
|
|
87
|
+
failures.push({ kind: "escapes", message: `'${f.path}' is outside the project.` });
|
|
88
|
+
}
|
|
89
|
+
const expected = row.commandSurface === "none" ? [] : specs.map((s) => posix.join(norm(row.commandDir), row.fileTemplate.replaceAll("<phase>", s.id)));
|
|
90
|
+
const emitted = new Set(files.map((f) => norm(f.path)));
|
|
91
|
+
for (const path of expected) {
|
|
92
|
+
if (!emitted.has(norm(path)))
|
|
93
|
+
failures.push({ kind: "missing-file", message: `Expected file '${path}' (from the row's fileTemplate) was not emitted.` });
|
|
94
|
+
}
|
|
95
|
+
const expectedSet = new Set(expected.map(norm));
|
|
96
|
+
for (const f of files) {
|
|
97
|
+
if (!expectedSet.has(norm(f.path)))
|
|
98
|
+
failures.push({ kind: "unexpected-file", message: `Emitted '${f.path}', which the row does not describe.` });
|
|
99
|
+
}
|
|
100
|
+
const groups = new Map();
|
|
101
|
+
for (const f of files) {
|
|
102
|
+
if (!expectedSet.has(norm(f.path)))
|
|
103
|
+
continue;
|
|
104
|
+
const actual = frontmatterKeys(f.path, f.contents);
|
|
105
|
+
if (actual.join("\0") === row.frontmatterKeys.join("\0"))
|
|
106
|
+
continue;
|
|
107
|
+
const label = JSON.stringify(actual);
|
|
108
|
+
groups.set(label, [...(groups.get(label) ?? []), f.path]);
|
|
109
|
+
}
|
|
110
|
+
for (const [actual, paths] of groups) {
|
|
111
|
+
failures.push({
|
|
112
|
+
kind: "frontmatter",
|
|
113
|
+
message: `${paths.length} command file(s) (e.g. '${paths[0]}') have frontmatter keys ${actual}, the row says ${JSON.stringify(row.frontmatterKeys)}.`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return failures;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/testkit/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA+BvD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtE,SAAS,WAAW,CAAC,GAAY;IAC/B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACzE,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,CAAU,EAAE,CAAC;QAC/E,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC3F,CAAC;IACD,IAAI,OAAO,CAAC,CAAC,gBAAgB,CAAC,KAAK,QAAQ,IAAI,CAAC,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,2BAA2B,KAAK,CAAC,CAAC,CAAC,4BAA4B,MAAM,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG;SACtJ,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plugin contract test kit (feature 027, EXPERIMENTAL in 1.6), published as
|
|
3
|
+
* `@ambystech/ambykit/testkit`. It uses nothing outside the package.
|
|
4
|
+
*/
|
|
5
|
+
import type { TargetDef } from "../emitters/index.js";
|
|
6
|
+
import { type MatrixRow } from "./contract.js";
|
|
7
|
+
export { checkEmitterContract, frontmatterKeys } from "./contract.js";
|
|
8
|
+
export type { ContractFailure, MatrixRow } from "./contract.js";
|
|
9
|
+
export { createPluginApi } from "../plugins/api.js";
|
|
10
|
+
export type { PluginApi } from "../plugins/api.js";
|
|
11
|
+
/**
|
|
12
|
+
* Throws one error listing every difference between the emitter and its matrix row, so it works under any
|
|
13
|
+
* test runner (`expect(() => …).not.toThrow()`, `node:test`, or a bare script).
|
|
14
|
+
*/
|
|
15
|
+
export declare function assertEmitterContract(target: TargetDef, row: MatrixRow | null | undefined): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { checkEmitterContract } from "./contract.js";
|
|
2
|
+
export { checkEmitterContract, frontmatterKeys } from "./contract.js";
|
|
3
|
+
export { createPluginApi } from "../plugins/api.js";
|
|
4
|
+
/**
|
|
5
|
+
* Throws one error listing every difference between the emitter and its matrix row, so it works under any
|
|
6
|
+
* test runner (`expect(() => …).not.toThrow()`, `node:test`, or a bare script).
|
|
7
|
+
*/
|
|
8
|
+
export function assertEmitterContract(target, row) {
|
|
9
|
+
const failures = checkEmitterContract(target, row);
|
|
10
|
+
if (failures.length === 0)
|
|
11
|
+
return;
|
|
12
|
+
throw new Error(`Target '${target.id}' does not match its matrix row (${failures.length} difference${failures.length === 1 ? "" : "s"}):\n` +
|
|
13
|
+
failures.map((f) => ` - ${f.message}`).join("\n"));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testkit/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAwC,MAAM,eAAe,CAAC;AAE3F,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,GAAiC;IACxF,MAAM,QAAQ,GAAsB,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClC,MAAM,IAAI,KAAK,CACb,WAAW,MAAM,CAAC,EAAE,oCAAoC,QAAQ,CAAC,MAAM,cAAc,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM;QACzH,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACrD,CAAC;AACJ,CAAC"}
|
package/docs/architecture.md
CHANGED
|
@@ -21,7 +21,7 @@ src/prompts/ ── neutral phase CommandSpecs (constitution → implement)
|
|
|
21
21
|
├── .github/skills/amby-*/SKILL.md (CopilotCliEmitter)
|
|
22
22
|
├── .opencode/commands/*.md (OpenCodeEmitter)
|
|
23
23
|
├── .cursor/commands/*.md + rules (CursorEmitter / CursorCliEmitter)
|
|
24
|
-
├── .agents/
|
|
24
|
+
├── .agents/skills/amby-*/SKILL.md (CodexEmitter, AntigravityEmitter / AntigravityCliEmitter)
|
|
25
25
|
└── AGENTS.md (+ CLAUDE.md bridge) (shared rules layer)
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -33,19 +33,35 @@ templates and can customize them.
|
|
|
33
33
|
An abstract class holding all shared state and behavior; each tool is a thin subclass.
|
|
34
34
|
|
|
35
35
|
- **Properties:** `toolId`, `displayName`, `commandDir`, `rulesFile`, `commandSurface`
|
|
36
|
-
(`'commands' | 'skills' | 'workflows' | 'none'`), `supportsAgents
|
|
37
|
-
`mcpConfigScope` (`'project' | 'user'`), `mcpTopLevelKey`.
|
|
36
|
+
(`'commands' | 'skills' | 'workflows' | 'none'`), `supportsAgents`.
|
|
38
37
|
- **Template method** `emit(specs, ctx): EmittedFile[]` — orchestrates: resolve target dir → render
|
|
39
|
-
rules file → render each phase prompt **via `commandSurface`** →
|
|
40
|
-
|
|
38
|
+
rules file → render each phase prompt **via `commandSurface`** → collect files. Subclasses don't
|
|
39
|
+
re-implement orchestration. MCP setup is a separate, opt-in hook (below), so `emit` is unchanged.
|
|
41
40
|
- **Overridable hooks:** `commandFrontmatter(spec)`, `commandPath(spec)`, `rulesContent(ctx)`,
|
|
42
|
-
`
|
|
41
|
+
`mcpFiles(ctx)` and `mcpSkipReason()`. Defaults live in the base; a subclass overrides only its
|
|
42
|
+
differences. `buildEmittedFiles` calls `mcpFiles` only when `config.mcp.enabled`; a target whose per-server
|
|
43
|
+
entry shape is not verified in the compatibility matrix returns no files and a reason, which `sync`
|
|
44
|
+
prints. The files use `merge: "json"`, which splices the single `ambykit` server entry into the tool's JSON
|
|
45
|
+
config and leaves every other key as written (`src/core/merge-json.ts`).
|
|
43
46
|
- **Reuse subclasses:** `CursorCliEmitter` (`commandSurface: 'none'`) and `AntigravityCliEmitter`
|
|
44
47
|
reuse a sibling's output; VS Code extension targets resolve to their base tool's emitter unchanged
|
|
45
48
|
via the **target→emitter map** in the registry.
|
|
46
49
|
|
|
47
50
|
Adding a tool = one subclass + a compatibility-matrix row + a snapshot test.
|
|
48
51
|
|
|
52
|
+
## Plugins
|
|
53
|
+
|
|
54
|
+
`src/plugins/` lets a project add targets without changing the core (feature 027, experimental). Config lists
|
|
55
|
+
`plugins: { "<package>": "<exact version>" }`; `sync`, `check` and `add` call `loadPluginSession`, which returns
|
|
56
|
+
`undefined` without importing anything when no plugin is listed. With plugins, `loader.ts` (the only side-effecting
|
|
57
|
+
module) reads `<project>/node_modules/<package>/package.json`, requires the installed version to equal the pin
|
|
58
|
+
and the declared `ambykit.pluginApi` range (`semver.ts`) to contain `PLUGIN_API_VERSION`, imports the entry, calls
|
|
59
|
+
it with the extension points if it is a factory, and validates the shape (never `instanceof`). `registry.ts` merges
|
|
60
|
+
the plugin targets after the built-in `TARGETS`; a clashing id is reported, never overridden. The registry is passed
|
|
61
|
+
to `getTarget`, `emittersForTargets`, `sharedOutputs` and `buildEmittedFiles`, which also refuses any project-scope
|
|
62
|
+
path that leaves the project. `src/testkit/` is the published contract kit (`@ambystech/ambykit/testkit`).
|
|
63
|
+
See [`plugin-api.md`](./plugin-api.md) and [`plugin-trust.md`](./plugin-trust.md).
|
|
64
|
+
|
|
49
65
|
## `BaseCommand`
|
|
50
66
|
|
|
51
67
|
The CLI verbs mirror the same pattern. An abstract `BaseCommand` holds project/`.amby/` discovery,
|
|
@@ -54,6 +70,18 @@ config load/save, emitter resolution, tool detection, logging, error handling, a
|
|
|
54
70
|
Subclasses: `InitCommand`, `AddCommand`, `SyncCommand`, `CheckCommand`, `RestoreCommand`,
|
|
55
71
|
`UpgradeCommand`, `DashboardCommand`.
|
|
56
72
|
|
|
73
|
+
## One dependency graph
|
|
74
|
+
|
|
75
|
+
Story and feature dependencies are read once and resolved once. `parseStories` reads the `depends-on` and
|
|
76
|
+
`blocked-by` lines; `buildGraph` (`src/core/graph.ts`) turns every feature's stories into one pure,
|
|
77
|
+
deterministic graph of story nodes, story edges (`depends-on` and `blocked-by` kept apart), feature edges
|
|
78
|
+
derived from them, broken edges and cycles. `analyze`, the dashboard's attention list and story detail,
|
|
79
|
+
`ambykit graph`, and later the run scheduler and the MCP server all read dependencies from that graph and
|
|
80
|
+
never parse specs themselves; a guard test keeps it that way. Questions asked of the graph (which stories
|
|
81
|
+
are buildable, what blocks a story, the critical path) live in `graph-paths.ts`, and the text, JSON and
|
|
82
|
+
Mermaid formats in `graph-format.ts`. The interactive graph view loads only on the interactive dashboard,
|
|
83
|
+
through a dynamic import, so one-shot and `--json` output stay inside the 1-second budget.
|
|
84
|
+
|
|
57
85
|
## Non-destructive rules merge (brownfield)
|
|
58
86
|
|
|
59
87
|
Generated **command** files are AmbyKit's alone and are overwritten. **Rules files** (`AGENTS.md`,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Artifact: decision records (`.amby/decisions/ADR-###.md`)
|
|
2
|
+
|
|
3
|
+
A **decision record** captures one decision that outlives a feature: the context, what was decided, the
|
|
4
|
+
alternatives rejected and the consequences. Written by `/amby.decide`, cited anywhere as `ADR-###`, and
|
|
5
|
+
checked by `ambykit analyze` at zero model tokens. Nothing is created at `init`; the folder appears with the
|
|
6
|
+
first decision, and a project that never records one sees no change.
|
|
7
|
+
|
|
8
|
+
## Files
|
|
9
|
+
|
|
10
|
+
- `.amby/decisions/ADR-###.md`, one record per file. The file name is the id with no slug, so two branches
|
|
11
|
+
that take the same number collide in git (an add/add conflict) instead of silently coexisting. The title lives
|
|
12
|
+
in the frontmatter.
|
|
13
|
+
- `.amby/decisions/README.md`, the index: one row per record, `| ADR-### | title | status |`. The prompt patches
|
|
14
|
+
it in place. A row whose file was deleted stays as a tombstone, so a number is never reused.
|
|
15
|
+
- `.amby/templates/adr.md`, the template (installed write-if-absent, so you can customize it).
|
|
16
|
+
|
|
17
|
+
## Format
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
---
|
|
21
|
+
id: ADR-004
|
|
22
|
+
title: Store the fleet state as files
|
|
23
|
+
status: accepted # proposed | accepted | superseded | deprecated
|
|
24
|
+
date: 2026-11-16
|
|
25
|
+
feature: 025-mcp-server # optional
|
|
26
|
+
principle: 3 # optional: constitution principle it relates to
|
|
27
|
+
conflicts: [] # principle numbers it conflicts with; must be empty to accept
|
|
28
|
+
supersedes: ADR-002 # optional
|
|
29
|
+
superseded-by: # set on the OLD record when replaced
|
|
30
|
+
---
|
|
31
|
+
## Context / ## Decision / ## Alternatives / ## Consequences
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **Number** = highest of the record files and the index rows, plus one, three digits.
|
|
35
|
+
- **Conflict**: a decision that conflicts with a constitution principle is written `proposed` with `conflicts`
|
|
36
|
+
filled, and a person decides. `accepted` with a non-empty `conflicts` is an error.
|
|
37
|
+
- **Supersede**: `/amby.decide --supersede ADR-###` sets `supersedes` on the new record and `status: superseded`
|
|
38
|
+
plus `superseded-by` on the old one. Both sides must agree. The old record's body is never edited.
|
|
39
|
+
- **Wording-only edits** keep the `id` and `status`.
|
|
40
|
+
- **Citing**: write `ADR-###` in specs, plans, the constitution or other records. Assistants load only the cited
|
|
41
|
+
records plus the index, never the whole folder.
|
|
42
|
+
|
|
43
|
+
## Checks
|
|
44
|
+
|
|
45
|
+
`ambykit analyze` adds a `decisions` section (text and `--json`) only when records or citations exist.
|
|
46
|
+
Errors (exit status 1): `duplicate-id`, `dangling-citation` (a cited `ADR-###` with no record, found in
|
|
47
|
+
`specs/**/*.md`, the constitution and the records), `supersede-mismatch`, `supersede-cycle`,
|
|
48
|
+
`accepted-with-conflict`, `invalid-record`. Warning: `index-drift` (a record missing from the index).
|
|
49
|
+
|
|
50
|
+
## Security reviewer role
|
|
51
|
+
|
|
52
|
+
`ambykit init` installs a seventh read-only role, `.amby/roles/security.md`, used as
|
|
53
|
+
`/amby.review <artifact> --as security`. It reports findings by stable ID with a severity and a fix. It never
|
|
54
|
+
edits and never creates a record; where a choice is durable it suggests running `/amby.decide`.
|
package/docs/artifacts/tasks.md
CHANGED
|
@@ -15,6 +15,43 @@ An ordered, dependency-aware checklist that turns the plan into executable work.
|
|
|
15
15
|
- **`[US#]`** — the user story this task serves (enables story-level progress roll-up).
|
|
16
16
|
- **description (file path)** — what to do and where.
|
|
17
17
|
|
|
18
|
+
### Blocked and deviation markers
|
|
19
|
+
|
|
20
|
+
A task that cannot proceed carries `⚠ BLOCKED: <reason>` as the **last segment** of its line, after the
|
|
21
|
+
path group; a task done differently than planned may carry `↪ DEVIATION: <note>` beside it. The glyphs
|
|
22
|
+
are optional (`BLOCKED:` and `DEVIATION:` read the same), and a marker's text runs to the next marker or
|
|
23
|
+
the end of the line, so a reason can contain parentheses or backticks without being read as a file path.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
- [ ] [T012] [US2] Call the billing API (src/billing.ts) ⚠ BLOCKED: waiting on the API key ↪ DEVIATION: used a stub
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Markers never change a task's checkbox, ID, `[P]` or declared paths. A `BLOCKED` task with no reason is
|
|
30
|
+
still blocked and is reported as missing one; a checked task that still has `⚠ BLOCKED:` is reported as
|
|
31
|
+
inconsistent. Remove the marker when the block is resolved. Text inside backticks is never read as a marker,
|
|
32
|
+
so documentation can show the syntax.
|
|
33
|
+
|
|
34
|
+
### Verify lines
|
|
35
|
+
|
|
36
|
+
Each phase ends with one plain-text `**Verify:**` line: the check the implementer runs before passing the
|
|
37
|
+
phase checkpoint. After a run the result is written on that same line as a suffix: `✓ passed`,
|
|
38
|
+
`✗ failed: <why>` or `? unverified` (for a check that needs a person or an external step). The glyphs are
|
|
39
|
+
optional, so `passed`, `failed: <why>` and `unverified` read the same. A Verify line holds one result; a
|
|
40
|
+
later run overwrites it, so an old failure is never shown as current. A phase checkpoint is not passed
|
|
41
|
+
while its Verify line is `failed`. When a phase is built in parallel lanes, record its result after the
|
|
42
|
+
phase's lanes are merged, not while neighbouring lanes are open: an edit on a Verify line next to a lane's
|
|
43
|
+
check-off makes the merge conflict in `tasks.md`.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
**Verify:** `npm run typecheck && npx vitest run test/core/markers.test.ts` ✓ passed
|
|
47
|
+
**Verify:** `npm test` ✗ failed: 3 tests in test/cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Test design
|
|
51
|
+
|
|
52
|
+
`/amby.tasks` also writes `tests.md` in the same phase: one test case per acceptance criterion, decided
|
|
53
|
+
before any code. See [the tests artifact](./tests.md).
|
|
54
|
+
|
|
18
55
|
## Phase grouping
|
|
19
56
|
|
|
20
57
|
Tasks are grouped so structure precedes features:
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Artifact: `tests.md`
|
|
2
|
+
|
|
3
|
+
The **test design** of a feature: one case per acceptance criterion, written *before* the code. Produced by
|
|
4
|
+
`/amby.tasks` in the same phase as `tasks.md`; read by `/amby.implement`, `/amby.converge` and
|
|
5
|
+
`ambykit analyze`. It holds cases, not test code: the tests themselves are still written while implementing.
|
|
6
|
+
|
|
7
|
+
## Format
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
---
|
|
11
|
+
feature: 021-test-design
|
|
12
|
+
---
|
|
13
|
+
## Cases
|
|
14
|
+
- [TC-001] [US-1#2] [FR-003] auto — vague criterion is flagged → a ## Flags entry, no invented case
|
|
15
|
+
- [TC-002] [US-1#3] [FR-002] manual:human-judgment — draft spec stops → it says the spec must be ready first; verify: run /amby.tasks on a draft spec; record: the converge notes
|
|
16
|
+
## Uncovered
|
|
17
|
+
- FR-009: deliberately uncovered — documentation only
|
|
18
|
+
uncovered: FR-010 — covered by another feature's tests
|
|
19
|
+
## Flags
|
|
20
|
+
- US-2#3: too vague to test — no observable outcome
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **`TC-###`** — case id: highest existing + 1, never reused or renumbered. Obsolete cases keep their id.
|
|
24
|
+
- **`US-n#k`** — the criterion the case covers: the *k*-th acceptance bullet of story *n*. **`FR-###`** — the requirement(s) it covers.
|
|
25
|
+
- **Decision** — `auto` by default. A manual case needs a reason from a fixed list (`human-judgment`,
|
|
26
|
+
`external-system`, `visual-check`, `one-off`) and says how it is verified and where the result goes
|
|
27
|
+
(`verify:` and `record:`).
|
|
28
|
+
- **At most 15 cases per story**; a story that needs more is split.
|
|
29
|
+
- **Uncovered** — a requirement no case covers is listed with a reason, in either spelling above.
|
|
30
|
+
- **Flags** — a criterion too vague to test is flagged, and no case is invented for it.
|
|
31
|
+
- **Refresh** — when a criterion changes, `/amby.revise` marks the cases that cite it `[stale]`, and a cited
|
|
32
|
+
criterion that was removed marks them `[obsolete]` (never deleted). Re-running `/amby.tasks` patches only those.
|
|
33
|
+
- **Skip** — a file whose only content line is `skipped: <reason>` records a deliberate skip.
|
|
34
|
+
|
|
35
|
+
Name the tests in code with the qualified requirement id, for example `it("021:FR-003: …")`, so a coverage
|
|
36
|
+
check can match them to the design. Case ids stay in `tests.md`.
|
|
37
|
+
|
|
38
|
+
## Checks
|
|
39
|
+
|
|
40
|
+
`ambykit analyze` reads each feature's `tests.md` at zero model tokens and reports, as warnings that never change
|
|
41
|
+
the exit status: unknown ids, requirements with no case and no reason, criteria with neither case nor flag,
|
|
42
|
+
duplicate case ids, bad or missing manual reasons, more than 15 cases for a story, and `[stale]` cases. A
|
|
43
|
+
project without any `tests.md` is analyzed exactly as before.
|