@oscaner-skills/cdd-engine 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +9 -8
  2. package/README.zh-CN.md +9 -8
  3. package/package.json +15 -22
  4. package/src-next/__tests__/bin.test.ts +128 -0
  5. package/src-next/__tests__/smoke.integration.test.ts +202 -0
  6. package/src-next/__tests__/zero-dep.test.ts +134 -0
  7. package/src-next/bin.ts +61 -0
  8. package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +238 -0
  9. package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +153 -0
  10. package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +173 -0
  11. package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +89 -0
  12. package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +225 -0
  13. package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +155 -0
  14. package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +175 -0
  15. package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +85 -0
  16. package/src-next/contract/__tests__/declare.test.ts +242 -0
  17. package/src-next/contract/__tests__/doc.test.ts +358 -0
  18. package/src-next/contract/__tests__/judge.test.ts +873 -0
  19. package/src-next/contract/__tests__/lint.test.ts +314 -0
  20. package/src-next/contract/__tests__/project.test.ts +419 -0
  21. package/src-next/contract/__tests__/translate.test.ts +96 -0
  22. package/src-next/contract/declare.ts +983 -0
  23. package/src-next/contract/doc.ts +753 -0
  24. package/src-next/contract/invariants.ts +1268 -0
  25. package/src-next/contract/judge.ts +142 -0
  26. package/src-next/contract/lint.ts +275 -0
  27. package/src-next/contract/project.ts +596 -0
  28. package/src-next/contract/skill-anatomy.ts +273 -0
  29. package/src-next/contract/translate.ts +113 -0
  30. package/src-next/face/__tests__/board-view.test.ts +948 -0
  31. package/src-next/face/__tests__/capsule.test.ts +276 -0
  32. package/src-next/face/__tests__/channel-closure.guard.test.ts +102 -0
  33. package/src-next/face/__tests__/cli.test.ts +4643 -0
  34. package/src-next/face/__tests__/face.test.ts +289 -0
  35. package/src-next/face/__tests__/graph-view.test.ts +61 -0
  36. package/src-next/face/__tests__/host.test.ts +24 -0
  37. package/src-next/face/__tests__/negation.ts +6 -0
  38. package/src-next/face/__tests__/projection.test.ts +301 -0
  39. package/src-next/face/__tests__/sync-runner.test.ts +70 -0
  40. package/src-next/face/__tests__/words.guard.test.ts +93 -0
  41. package/src-next/face/artifacts.ts +195 -0
  42. package/src-next/face/board-view.ts +662 -0
  43. package/src-next/face/capsule.ts +149 -0
  44. package/src-next/face/cli.ts +819 -0
  45. package/src-next/face/declare.ts +326 -0
  46. package/src-next/face/gate.ts +170 -0
  47. package/src-next/face/graph-view.ts +74 -0
  48. package/src-next/face/host.ts +326 -0
  49. package/src-next/face/lifecycle.ts +700 -0
  50. package/src-next/face/projection.ts +282 -0
  51. package/src-next/face/route-render.ts +160 -0
  52. package/src-next/face/words.ts +296 -0
  53. package/src-next/infra/__tests__/infra.test.ts +287 -0
  54. package/src-next/infra/config.ts +42 -0
  55. package/src-next/infra/git.ts +39 -0
  56. package/src-next/infra/process.ts +34 -0
  57. package/src-next/infra/runtime.ts +185 -0
  58. package/src-next/infra/workspace.ts +232 -0
  59. package/src-next/render/__tests__/render.test.ts +499 -0
  60. package/src-next/render/__tests__/skeleton.test.ts +466 -0
  61. package/src-next/render/brief.ts +121 -0
  62. package/src-next/render/issue-body.ts +159 -0
  63. package/src-next/render/skeleton.ts +437 -0
  64. package/src-next/render/templates.ts +650 -0
  65. package/src-next/session/__tests__/graph.test.ts +270 -0
  66. package/src-next/session/__tests__/handoff-plane.guard.test.ts +48 -0
  67. package/src-next/session/__tests__/handoff-schema.test.ts +310 -0
  68. package/src-next/session/__tests__/ledger.test.ts +744 -0
  69. package/src-next/session/__tests__/next.test.ts +368 -0
  70. package/src-next/session/__tests__/preflight.test.ts +491 -0
  71. package/src-next/session/__tests__/run.test.ts +1014 -0
  72. package/src-next/session/__tests__/wave-line-phase.guard.test.ts +49 -0
  73. package/src-next/session/__tests__/wave.test.ts +469 -0
  74. package/src-next/session/faces.ts +110 -0
  75. package/src-next/session/graph.ts +411 -0
  76. package/src-next/session/handoff-schema.ts +373 -0
  77. package/src-next/session/ledger.ts +1004 -0
  78. package/src-next/session/next.ts +192 -0
  79. package/src-next/session/preflight.ts +240 -0
  80. package/src-next/session/run.ts +606 -0
  81. package/src-next/session/state.ts +30 -0
  82. package/src-next/session/wave.ts +139 -0
  83. package/templates/report/issue-body.json +18 -20
  84. package/dist/chunks/branch.mjs +0 -480
  85. package/dist/chunks/docs.mjs +0 -253
  86. package/dist/chunks/task.mjs +0 -913
  87. package/dist/cli.mjs +0 -5457
  88. package/dist/documents/schema/add-phase-protocol.json +0 -126
  89. package/dist/documents/schema/overall.json +0 -361
  90. package/dist/documents/schema/phase-spec.json +0 -145
  91. package/dist/documents/schema/plan.json +0 -191
  92. package/dist/documents/schema/skill-anatomy.json +0 -233
  93. package/dist/resources/harness-registry.json +0 -49
  94. package/dist/shared/cdd-engine.liioziig.mjs +0 -184
  95. package/templates/engine-config.json +0 -302
  96. package/templates/schema/cache-profile-schema.json +0 -23
  97. package/templates/schema/docs-handoff-schema.json +0 -129
  98. package/templates/schema/task-handoff-schema.json +0 -332
  99. package/templates/template-contract.json +0 -231
@@ -0,0 +1,289 @@
1
+ // packages/cdd-engine/src-next/face/__tests__/face.test.ts
2
+ // T10 Words + Capsule suite (design spec §1.2 / §3.2):
3
+ // · the word table — the three families served by one instance (the capsule
4
+ // station words, the guard ban words, the locale rows), with zero second
5
+ // tables — the capsule's every emitted word is
6
+ // looked up on the same Words instance;
7
+ // · the byte pin — Capsule#emit renders the `status · blocker · handoff` line
8
+ // and the optional `next:` line byte-stably (every route row rendered);
9
+ // · the word-face comparison — the v1 emitted face is byte-identical to the
10
+ // existing consumed word face (status · blocker · handoff · next:) — same
11
+ // words, no re-judgment: a steady state, not a compatibility shim;
12
+ // · the locale face (T19) — the word table's locale columns: the locale key set
13
+ // (the langs projection source), the issue-label rows (one per finding type ×
14
+ // segment) + the charter anchor rows (the P7 canonicalize data — charter.*), and
15
+ // the machine-face immunity — the capsule words carry zero locale aliases (the
16
+ // machine surface is English-constant, never localized).
17
+ // The type assertion at the bottom pins the T8 run seam (CapsuleFace) — the
18
+ // interaction point the lifecycle attaches.
19
+
20
+ import { describe, expect, it } from "vitest";
21
+ import { Translator } from "../../contract/translate.ts";
22
+ import { FIX_READBACK_SUFFIX } from "../../session/next.ts";
23
+ import type { CapsuleFace } from "../../session/run.ts";
24
+ import { Capsule } from "../capsule.ts";
25
+ import { CAPSULE_WORDS, GUARD_BAN_WORDS, Words } from "../words.ts";
26
+
27
+ const words = new Words();
28
+ const capsule = new Capsule(words);
29
+
30
+ describe("the word table — one table, three families", () => {
31
+ it("the capsule family — the pinned keys, the stations, the status vocabulary", () => {
32
+ expect(words.capsuleKeys()).toEqual(["status", "blocker", "handoff"]);
33
+ expect(words.capsuleSeparator()).toBe(" · ");
34
+ expect(words.statusVocab()).toEqual([
35
+ "APPROVED",
36
+ "BLOCKED",
37
+ "CHANGES_REQUESTED",
38
+ "REVIEW_FIX",
39
+ "TIMEOUT",
40
+ ]);
41
+ expect(words.station("next")).toBe("next:");
42
+ expect(words.station("blocked")).toBe("CDD_BLOCKED:");
43
+ expect(words.station("warn")).toBe("CDD_WARN:");
44
+ expect(words.station("cliMissing")).toBe("CDD_CLI_MISSING:");
45
+ expect(words.routeWord("done")).toBe("done");
46
+ expect(words.routeWord("review")).toBe("review");
47
+ expect(words.routeWord("fix")).toBe("fix");
48
+ expect(words.routeWord("implement")).toBe("implement");
49
+ });
50
+
51
+ it("the guard family — the STALE / GATE / shape ban rows, one flat scan set", () => {
52
+ expect(words.guardBanWords("stale").length).toBeGreaterThan(0);
53
+ expect(words.guardBanWords("gate").length).toBeGreaterThan(0);
54
+ expect(words.guardBanWords("shape").length).toBeGreaterThan(0);
55
+ expect(words.guardBanTokens()).toEqual(
56
+ [...GUARD_BAN_WORDS.stale, ...GUARD_BAN_WORDS.gate, ...GUARD_BAN_WORDS.shape].map(
57
+ (row) => row.token,
58
+ ),
59
+ );
60
+ // the flat set carries no duplicate ban token — every family row is unique
61
+ const tokens = words.guardBanTokens();
62
+ expect(new Set(tokens).size).toBe(tokens.length);
63
+ });
64
+
65
+ it("the capsule carries zero second table — every emitted word rides this instance", () => {
66
+ const emitted = capsule.emit("APPROVED", "0", "/ws/tasks-1-implement.json", {
67
+ kind: "review",
68
+ });
69
+ // the emitted keys ARE the table's keys, in the table's order — no parallel list
70
+ const keysOf = emitted[0]
71
+ .split(words.capsuleSeparator())
72
+ .map((cell) => cell.slice(0, cell.indexOf(": ")));
73
+ expect(keysOf).toEqual([...words.capsuleKeys()]);
74
+ // the only station word in the output is the table's own `next:`
75
+ expect(emitted[1].split(" ")[0]).toBe(words.station("next"));
76
+ expect(Object.values(CAPSULE_WORDS.stations).length).toBe(4);
77
+ });
78
+ });
79
+
80
+ describe("the capsule byte pin — the single output face", () => {
81
+ it("renders the capsule line byte-stably (status · blocker · handoff)", () => {
82
+ expect(capsule.emit("APPROVED", "0", "/ws/tasks-1-implement.json")).toEqual([
83
+ "status: APPROVED · blocker: 0 · handoff: /ws/tasks-1-implement.json",
84
+ ]);
85
+ expect(capsule.emit("BLOCKED", "1", "/ws/branch-review-a1b2c3d..e4f5g6h-r1.json")).toEqual([
86
+ "status: BLOCKED · blocker: 1 · handoff: /ws/branch-review-a1b2c3d..e4f5g6h-r1.json",
87
+ ]);
88
+ });
89
+
90
+ it("renders the `next:` line per the C5 route row (each kind, only present facts)", () => {
91
+ expect(capsule.emit("APPROVED", "0", "/h.json", { kind: "done" })).toEqual([
92
+ "status: APPROVED · blocker: 0 · handoff: /h.json",
93
+ "next: done",
94
+ ]);
95
+ expect(capsule.emit("APPROVED", "0", "/h.json", { kind: "next-wave", tasks: "7,9" })).toEqual([
96
+ "status: APPROVED · blocker: 0 · handoff: /h.json",
97
+ // P4.1 T4 — the complete executable literal; the absent target seeds the
98
+ // `<plan>` placeholder (the crash-resume's own seed convention)
99
+ "next: implement --plan <plan> --tasks 7,9",
100
+ ]);
101
+ expect(capsule.emit("REVIEW_FIX", "0", "/h.json", { kind: "review" })).toEqual([
102
+ "status: REVIEW_FIX · blocker: 0 · handoff: /h.json",
103
+ // the bare review fallback (no target — the type discriminator is absent)
104
+ "next: review",
105
+ ]);
106
+ expect(
107
+ capsule.emit("CHANGES_REQUESTED", "1", "/h.json", {
108
+ kind: "fix",
109
+ findings: "tasks-1-review-1.json",
110
+ }),
111
+ ).toEqual([
112
+ "status: CHANGES_REQUESTED · blocker: 1 · handoff: /h.json",
113
+ `next: fix --findings tasks-1-review-1.json ${FIX_READBACK_SUFFIX}`,
114
+ ]);
115
+ // a fix route without its input renders the bare classifier
116
+ expect(capsule.emit("CHANGES_REQUESTED", "1", "/h.json", { kind: "fix" })).toEqual([
117
+ "status: CHANGES_REQUESTED · blocker: 1 · handoff: /h.json",
118
+ "next: fix",
119
+ ]);
120
+ // the soft-cap message rides verbatim — the user-adjudication station
121
+ expect(
122
+ capsule.emit("BLOCKED", "0", "/h.json", {
123
+ kind: "soft-cap",
124
+ message: "BLOCKED: review-cycle-cap — user adjudicates",
125
+ }),
126
+ ).toEqual([
127
+ "status: BLOCKED · blocker: 0 · handoff: /h.json",
128
+ "next: BLOCKED: review-cycle-cap — user adjudicates",
129
+ ]);
130
+ });
131
+
132
+ it("renders the complete executable `next:` literal with the frame's RouteTarget (P4.1 T4)", () => {
133
+ const target = { type: "wave", id: "1,2", plan: "docs/kairos/plans/p.md" } as const;
134
+ // a re-review of a wave — `review --type wave --tasks {tasks} --plan <path>`
135
+ // (the review carries no commit ref; parse needs type + tasks, the
136
+ // runtime-required --plan rides the frame's plan fact — find #7)
137
+ expect(capsule.emit("REVIEW_FIX", "0", "/h.json", { kind: "review" }, target)).toEqual([
138
+ "status: REVIEW_FIX · blocker: 0 · handoff: /h.json",
139
+ "next: review --type wave --tasks 1,2 --plan docs/kairos/plans/p.md",
140
+ ]);
141
+ // the one-way fix hop — `fix --type wave --tasks {tasks} --plan <p> --findings <f>`
142
+ expect(
143
+ capsule.emit(
144
+ "CHANGES_REQUESTED",
145
+ "1",
146
+ "/h.json",
147
+ { kind: "fix", findings: "tasks-1,2-review-1.json" },
148
+ target,
149
+ ),
150
+ ).toEqual([
151
+ "status: CHANGES_REQUESTED · blocker: 1 · handoff: /h.json",
152
+ `next: fix --type wave --tasks 1,2 --plan docs/kairos/plans/p.md --findings tasks-1,2-review-1.json ${FIX_READBACK_SUFFIX}`,
153
+ ]);
154
+ // the other target types render their discriminator arg — branch (the
155
+ // workspace --plan only — the review judges the live tree, no range rides the
156
+ // command · the scope anchor BASE_BRANCH is engine-injected at dispatch)
157
+ expect(
158
+ capsule.emit(
159
+ "REVIEW_FIX",
160
+ "0",
161
+ "/h.json",
162
+ { kind: "review" },
163
+ { type: "branch", id: "branch", plan: "docs/kairos/plans/p.md" },
164
+ ),
165
+ ).toEqual([
166
+ "status: REVIEW_FIX · blocker: 0 · handoff: /h.json",
167
+ "next: review --type branch --plan docs/kairos/plans/p.md",
168
+ ]);
169
+ expect(
170
+ capsule.emit(
171
+ "REVIEW_FIX",
172
+ "0",
173
+ "/h.json",
174
+ { kind: "review" },
175
+ { type: "spec", id: "docs/kairos/specs/x-design.md" },
176
+ ),
177
+ ).toEqual([
178
+ "status: REVIEW_FIX · blocker: 0 · handoff: /h.json",
179
+ "next: review --type spec --spec docs/kairos/specs/x-design.md",
180
+ ]);
181
+ // implement renders NO `--type` — the single-type wave verb (the declaration's
182
+ // `parsed.args.type ?? "wave"` default unchanged; the plan rides the plan path)
183
+ expect(
184
+ capsule.emit("APPROVED", "0", "/h.json", { kind: "next-wave", tasks: "1,2" }, target),
185
+ ).toEqual([
186
+ "status: APPROVED · blocker: 0 · handoff: /h.json",
187
+ "next: implement --plan docs/kairos/plans/p.md --tasks 1,2",
188
+ ]);
189
+ });
190
+
191
+ it("a caller-rendered next text rides verbatim; absent next emits no second line", () => {
192
+ expect(capsule.emit("APPROVED", "0", "/h.json", "put /h.json back")).toEqual([
193
+ "status: APPROVED · blocker: 0 · handoff: /h.json",
194
+ "next: put /h.json back",
195
+ ]);
196
+ expect(capsule.emit("BLOCKED", "engine over budget", "/h.json")).toEqual([
197
+ "status: BLOCKED · blocker: engine over budget · handoff: /h.json",
198
+ ]);
199
+ expect(capsule.emit("TIMEOUT", "0", "/h.json", null)).toEqual([
200
+ "status: TIMEOUT · blocker: 0 · handoff: /h.json",
201
+ ]);
202
+ });
203
+
204
+ it("the blocker cell carries a count or a reason text — the cell stays a plain string", () => {
205
+ expect(capsule.emit("BLOCKED", "CDD_BLOCKED: resolve the finding", "/h.json")[0]).toBe(
206
+ "status: BLOCKED · blocker: CDD_BLOCKED: resolve the finding · handoff: /h.json",
207
+ );
208
+ });
209
+ });
210
+
211
+ describe("the word-face comparison — v1 face vs the existing consumed face", () => {
212
+ it("the v1 emitted word face is byte-identical to the existing consumed face (same words, no re-judgment)", () => {
213
+ // The existing machine face consumers grep / route on — the steady vocabulary
214
+ // (status · blocker · handoff · next:). v1 keeps the same four words: a rename
215
+ // breaks this literal pin — a steady state, never a compatibility shim.
216
+ expect(capsule.emit("APPROVED", "0", "/ws/tasks-1-implement.json")[0]).toBe(
217
+ "status: APPROVED · blocker: 0 · handoff: /ws/tasks-1-implement.json",
218
+ );
219
+ // the four word cells of the face, in the emitted order — the existing consumed
220
+ // order the comparison keys on
221
+ expect([...words.capsuleKeys(), words.station("next")]).toEqual([
222
+ "status",
223
+ "blocker",
224
+ "handoff",
225
+ "next:",
226
+ ]);
227
+ });
228
+ });
229
+
230
+ describe("the T8 run seam — the capsule plugs into the lifecycle interaction point", () => {
231
+ it("Capsule satisfies the CapsuleFace contact (attachCapsule's type)", () => {
232
+ // Compile-time pin — fails under `tsc --noEmit` if the capsule's emit surface
233
+ // drifts from the seam the run attaches (status · blocker · handoff · next).
234
+ const seam: CapsuleFace = capsule;
235
+ const lines = seam.emit("APPROVED", "0", "/ws/tasks-1-implement.json", { kind: "done" });
236
+ expect(lines).toEqual([
237
+ "status: APPROVED · blocker: 0 · handoff: /ws/tasks-1-implement.json",
238
+ "next: done",
239
+ ]);
240
+ });
241
+ });
242
+
243
+ describe("the locale face — the word-table locale columns (T19, the P7 translation data)", () => {
244
+ it("the locale key set — the langs projection source (the declared language keys)", () => {
245
+ expect(words.localeKeys()).toEqual(["en", "zh"]);
246
+ });
247
+
248
+ it("the issue-label rows — one per finding type × segment (the label values ride the rows)", () => {
249
+ expect(words.localeRow("bug.context")).toEqual({ en: "## Context", zh: "## 场景" });
250
+ expect(words.localeRow("bug.problem")?.en).toBe("## Problem");
251
+ expect(words.localeRow("enhancement.problem")?.en).toBe("## Gap");
252
+ expect(words.localeRow("chore.suggestedFix")?.zh).toBe("## 建议方向");
253
+ expect(words.localeRow("bug.bogus")).toBeNull();
254
+ });
255
+
256
+ it("the charter rows — the P7 canonicalize data (the zh knowledge's single home)", () => {
257
+ expect(words.localeRow("charter.group-leaf")).toEqual({ en: "group", zh: "组" });
258
+ expect(words.localeRow("charter.upstream-endorsements")).toEqual({
259
+ en: "Upstream Endorsements",
260
+ zh: "上游先例背书",
261
+ });
262
+ expect(words.localeRow("charter.bogus")).toBeNull();
263
+ });
264
+
265
+ it("the whole translation data flows from the one table — localeRows is the flat face", () => {
266
+ const flat = words.localeRows();
267
+ // the declared locale matrix: 3 finding types × 4 segments = 12 issue-label rows
268
+ // + 2 charter anchor rows = 14, all single-sourced
269
+ expect(flat.length).toBe(14);
270
+ // every row's canonical is the en face and carries a zh alias (the two-locale steady face)
271
+ for (const row of flat) {
272
+ expect(row.en.length).toBeGreaterThan(0);
273
+ expect(row.zh?.length ?? 0).toBeGreaterThan(0);
274
+ }
275
+ });
276
+
277
+ it("the machine-face immunity — the capsule words carry zero locale aliases (never localized)", () => {
278
+ const translator = new Translator(words);
279
+ // the capsule machine words are not translation rows: canonicalize over the
280
+ // machine surface is identity (no registered alias span) — the machine face is
281
+ // English-constant.
282
+ expect(translator.canonicalize(words.station("next"))).toBe("next:");
283
+ expect(translator.canonicalize(words.station("blocked"))).toBe("CDD_BLOCKED:");
284
+ expect(translator.localize("status", "zh")).toBeNull();
285
+ expect(translator.localize("APPROVED", "zh")).toBeNull();
286
+ // the byte pin stays English — the capsule emits the machine words verbatim
287
+ expect(capsule.emit("APPROVED", "0", "/h.json", { kind: "done" })[1]).toBe("next: done");
288
+ });
289
+ });
@@ -0,0 +1,61 @@
1
+ // packages/cdd-engine/src-next/face/__tests__/graph-view.test.ts
2
+ // P4.1 T7 — find #6 closeout (user 2026-10-09: "W1 fits the agent mindset better"): the
3
+ // wave board's labels start at W1 and ascend per derived wave — the label = the wave
4
+ // index + 1 with no zero-padding (the display layer only; the wave derivation itself
5
+ // is unchanged). The plan's execution-order labels (W1–W4) must match the board's
6
+ // derived labels verbatim (one label convention — the plan cites the board's derived labels).
7
+
8
+ import { describe, expect, it } from "vitest";
9
+ import type { TaskGraphReport } from "../../session/graph.ts";
10
+ import { GraphView, PROGRESS_LEGEND, PROGRESS_MARKERS } from "../graph-view.ts";
11
+
12
+ /** A board fixture — derived waves whose labels the execution order mirrors
13
+ * (the P4.1 plan's W1 = {T1,T2} → W2 = {T3,T4} → W3 = {T5} → W4 = {T6,T7}). */
14
+ const board = (waves: readonly (readonly number[])[], done: readonly number[]): string => {
15
+ const report: TaskGraphReport = {
16
+ edges: {},
17
+ waves,
18
+ done,
19
+ current: waves.find((wave) => wave.some((id) => !done.includes(id))) ?? null,
20
+ pending: waves.flat().filter((id) => !done.includes(id)),
21
+ };
22
+ return new GraphView().render(report, "graph: docs/kairos/plans/p.md");
23
+ };
24
+
25
+ describe("GraphView — the wave-board labels (find #6 · W1-first ordering · no zero-padding)", () => {
26
+ it("labels the waves W1, W2, … — the derived wave index + 1, zero no-padding", () => {
27
+ const out = board([[1, 2], [3], [4, 5]], [1]);
28
+ expect(out).toContain("W1 T1✔ · T2▶ ← in-flight");
29
+ expect(out).toContain("W2 T3○");
30
+ expect(out).toContain("W3 T4○ · T5○");
31
+ // the zero-based display is retired — no W0 anywhere
32
+ expect(out).not.toContain("W0");
33
+ });
34
+
35
+ it("renders the plan's execution-order labels verbatim — W1..W4 for the four derived waves", () => {
36
+ const out = board([[1, 2], [3, 4], [5], [6, 7]], [1, 2, 3, 4, 5]);
37
+ for (const label of ["W1 T1✔ · T2✔", "W2 T3✔ · T4✔", "W3 T5✔", "W4 T6▶ · T7▶"]) {
38
+ expect(out).toContain(label);
39
+ }
40
+ expect(out).toContain("wave board:");
41
+ expect(out).toContain("progress: ✔ done · ▶ current wave · ○ pending");
42
+ });
43
+
44
+ it("a ten-wave board pads nothing — W10 renders naturally, never W010", () => {
45
+ const waves = Array.from({ length: 10 }, (_, index) => [index + 1]);
46
+ const out = board(waves, waves.flat().slice(0, 9));
47
+ expect(out).toContain("W10 T10▶ ← in-flight");
48
+ expect(out).not.toContain("W010");
49
+ });
50
+ });
51
+
52
+ describe("the shared progress-marker vocabulary (board ⇄ graph, one home)", () => {
53
+ it("PROGRESS_MARKERS is the single glyph set both faces render — ✔/▶/○", () => {
54
+ expect(PROGRESS_MARKERS).toEqual({ done: "✔", current: "▶", pending: "○" });
55
+ });
56
+
57
+ it("the two legend tails differ only by the scope word (`current` vs `current wave`)", () => {
58
+ expect(PROGRESS_LEGEND.board).toBe("progress: ✔ done · ▶ current · ○ pending");
59
+ expect(PROGRESS_LEGEND.graph).toBe("progress: ✔ done · ▶ current wave · ○ pending");
60
+ });
61
+ });
@@ -0,0 +1,24 @@
1
+ // packages/cdd-engine/src-next/face/__tests__/host.test.ts
2
+ // T21 harness-contract suite — the typed host-adaptation data plane (T25 added):
3
+ // · the capabilities per-harness declaration — one typed data column per host
4
+ // row (claude = the measured parallel sub-agent face, true; cursor/pi = the
5
+ // not-yet-exercised pending marker — the per-tested stance), zero prose.
6
+ // The ordered skill chains self-test (T25) was retired with the ordered-chain data
7
+ // plane (P5 — zero consumers; the per-harness slash rendering is REFS-owned,
8
+ // audited by the guard's checkChannels derivation).
9
+
10
+ import { describe, expect, it } from "vitest";
11
+ import { HOSTS } from "../host.ts";
12
+
13
+ describe("the capabilities per-harness declaration (T25)", () => {
14
+ it("every host row carries the capabilities column — claude the measured parallel face, cursor/pi the pending marker", () => {
15
+ expect(HOSTS.claude.capabilities.parallel).toBe(true);
16
+ expect(HOSTS.cursor.capabilities.parallel).toBe("pending");
17
+ expect(HOSTS.pi.capabilities.parallel).toBe("pending");
18
+ // the column is a typed row on every host — zero missing declarations
19
+ for (const id of ["claude", "cursor", "pi"] as const) {
20
+ expect(typeof HOSTS[id].capabilities).toBe("object");
21
+ expect("parallel" in HOSTS[id].capabilities).toBe(true);
22
+ }
23
+ });
24
+ });
@@ -0,0 +1,6 @@
1
+ // packages/cdd-engine/src-next/face/__tests__/negation.ts
2
+ // Shared test helper: the retired negated bool spellings are composed from the
3
+ // declared positive flags at runtime — the literal tokens never appear in the
4
+ // tree or in test files (the zero-consumption pin). The cli and projection
5
+ // suites share this synthesizer so the composition stays identical.
6
+ export const negatedOf = (flag: string) => `--no-${flag.replace(/^-+/, "")}`;