@oscaner-skills/cdd-engine 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/{src-next/bin.ts → dist/bin.js} +18 -21
  2. package/dist/contract/declare.js +998 -0
  3. package/dist/contract/doc.js +565 -0
  4. package/dist/contract/frontmatter.js +209 -0
  5. package/dist/contract/home-extractors.js +379 -0
  6. package/dist/contract/invariants.js +1030 -0
  7. package/dist/contract/judge.js +109 -0
  8. package/dist/contract/lint.js +206 -0
  9. package/dist/contract/project.js +371 -0
  10. package/dist/contract/skill-anatomy.js +156 -0
  11. package/dist/contract/translate.js +85 -0
  12. package/dist/face/artifacts.js +189 -0
  13. package/dist/face/board-view.js +522 -0
  14. package/dist/face/capsule.js +141 -0
  15. package/dist/face/cli.js +891 -0
  16. package/dist/face/declare.js +241 -0
  17. package/dist/face/gate.js +158 -0
  18. package/dist/face/graph-view.js +66 -0
  19. package/dist/face/host.js +211 -0
  20. package/dist/face/lifecycle.js +603 -0
  21. package/dist/face/preview.js +136 -0
  22. package/dist/face/projection.js +259 -0
  23. package/dist/face/route-render.js +162 -0
  24. package/dist/face/termination.js +482 -0
  25. package/dist/face/words.js +220 -0
  26. package/{src-next/infra/config.ts → dist/infra/config.js} +19 -24
  27. package/{src-next/infra/doc-roots.ts → dist/infra/doc-roots.js} +3 -13
  28. package/dist/infra/git.js +37 -0
  29. package/dist/infra/process.js +22 -0
  30. package/{src-next/infra/root.ts → dist/infra/root.js} +25 -36
  31. package/dist/infra/runtime.js +85 -0
  32. package/dist/infra/workspace.js +276 -0
  33. package/dist/render/brief.js +82 -0
  34. package/dist/render/issue-body.js +129 -0
  35. package/dist/render/skeleton.js +434 -0
  36. package/dist/render/templates.js +520 -0
  37. package/dist/session/faces.js +38 -0
  38. package/dist/session/graph.js +309 -0
  39. package/dist/session/handoff-schema.js +295 -0
  40. package/dist/session/ledger.js +762 -0
  41. package/dist/session/next.js +211 -0
  42. package/dist/session/preflight.js +194 -0
  43. package/dist/session/round-naming.js +73 -0
  44. package/dist/session/run.js +441 -0
  45. package/dist/session/state.js +8 -0
  46. package/dist/session/wave.js +92 -0
  47. package/package.json +5 -5
  48. package/src-next/__tests__/bin.test.ts +0 -128
  49. package/src-next/__tests__/dead-decl.guard.test.ts +0 -39
  50. package/src-next/__tests__/floor.guard.test.ts +0 -69
  51. package/src-next/__tests__/issue-body.guard.test.ts +0 -66
  52. package/src-next/__tests__/phase-suffix.guard.test.ts +0 -72
  53. package/src-next/__tests__/smoke.integration.test.ts +0 -185
  54. package/src-next/__tests__/support/strip-comments.ts +0 -99
  55. package/src-next/__tests__/zero-dep.test.ts +0 -94
  56. package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +0 -256
  57. package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +0 -165
  58. package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +0 -190
  59. package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +0 -106
  60. package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +0 -240
  61. package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +0 -165
  62. package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +0 -190
  63. package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +0 -100
  64. package/src-next/contract/__tests__/declare.test.ts +0 -481
  65. package/src-next/contract/__tests__/doc.test.ts +0 -527
  66. package/src-next/contract/__tests__/dockey.guard.test.ts +0 -58
  67. package/src-next/contract/__tests__/edge-conditions.guard.test.ts +0 -81
  68. package/src-next/contract/__tests__/frontmatter.test.ts +0 -164
  69. package/src-next/contract/__tests__/judge.test.ts +0 -1111
  70. package/src-next/contract/__tests__/lint.test.ts +0 -324
  71. package/src-next/contract/__tests__/project.test.ts +0 -460
  72. package/src-next/contract/__tests__/structure-pin.test.ts +0 -186
  73. package/src-next/contract/__tests__/translate.test.ts +0 -96
  74. package/src-next/contract/declare.ts +0 -1071
  75. package/src-next/contract/doc.ts +0 -816
  76. package/src-next/contract/frontmatter.ts +0 -233
  77. package/src-next/contract/home-extractors.ts +0 -397
  78. package/src-next/contract/invariants.ts +0 -1413
  79. package/src-next/contract/judge.ts +0 -151
  80. package/src-next/contract/lint.ts +0 -239
  81. package/src-next/contract/project.ts +0 -656
  82. package/src-next/contract/skill-anatomy.ts +0 -301
  83. package/src-next/contract/translate.ts +0 -113
  84. package/src-next/face/__tests__/board-view.test.ts +0 -1151
  85. package/src-next/face/__tests__/capsule.test.ts +0 -300
  86. package/src-next/face/__tests__/channel-closure.guard.test.ts +0 -129
  87. package/src-next/face/__tests__/cli.test.ts +0 -4897
  88. package/src-next/face/__tests__/face.test.ts +0 -289
  89. package/src-next/face/__tests__/graph-view.test.ts +0 -61
  90. package/src-next/face/__tests__/host.test.ts +0 -24
  91. package/src-next/face/__tests__/install-rows.guard.test.ts +0 -58
  92. package/src-next/face/__tests__/negation.ts +0 -6
  93. package/src-next/face/__tests__/preview.test.ts +0 -374
  94. package/src-next/face/__tests__/projection.test.ts +0 -303
  95. package/src-next/face/__tests__/repo-root.guard.test.ts +0 -120
  96. package/src-next/face/__tests__/termination.test.ts +0 -650
  97. package/src-next/face/__tests__/words.guard.test.ts +0 -93
  98. package/src-next/face/artifacts.ts +0 -248
  99. package/src-next/face/board-view.ts +0 -652
  100. package/src-next/face/capsule.ts +0 -163
  101. package/src-next/face/cli.ts +0 -1028
  102. package/src-next/face/declare.ts +0 -323
  103. package/src-next/face/gate.ts +0 -171
  104. package/src-next/face/graph-view.ts +0 -74
  105. package/src-next/face/host.ts +0 -302
  106. package/src-next/face/lifecycle.ts +0 -725
  107. package/src-next/face/preview.ts +0 -151
  108. package/src-next/face/projection.ts +0 -285
  109. package/src-next/face/route-render.ts +0 -185
  110. package/src-next/face/termination.ts +0 -573
  111. package/src-next/face/words.ts +0 -314
  112. package/src-next/infra/__tests__/infra.test.ts +0 -333
  113. package/src-next/infra/__tests__/root.test.ts +0 -56
  114. package/src-next/infra/git.ts +0 -39
  115. package/src-next/infra/process.ts +0 -34
  116. package/src-next/infra/runtime.ts +0 -132
  117. package/src-next/infra/workspace.ts +0 -322
  118. package/src-next/render/__tests__/render.test.ts +0 -550
  119. package/src-next/render/__tests__/skeleton.test.ts +0 -684
  120. package/src-next/render/brief.ts +0 -121
  121. package/src-next/render/issue-body.ts +0 -162
  122. package/src-next/render/skeleton.ts +0 -502
  123. package/src-next/render/templates.ts +0 -645
  124. package/src-next/session/__tests__/graph.test.ts +0 -277
  125. package/src-next/session/__tests__/handoff-plane.guard.test.ts +0 -48
  126. package/src-next/session/__tests__/handoff-schema.test.ts +0 -310
  127. package/src-next/session/__tests__/ledger.test.ts +0 -745
  128. package/src-next/session/__tests__/next.test.ts +0 -460
  129. package/src-next/session/__tests__/preflight.test.ts +0 -545
  130. package/src-next/session/__tests__/round-naming.test.ts +0 -142
  131. package/src-next/session/__tests__/run.test.ts +0 -1026
  132. package/src-next/session/__tests__/wave-line-phase.guard.test.ts +0 -49
  133. package/src-next/session/__tests__/wave.test.ts +0 -476
  134. package/src-next/session/faces.ts +0 -110
  135. package/src-next/session/graph.ts +0 -411
  136. package/src-next/session/handoff-schema.ts +0 -373
  137. package/src-next/session/ledger.ts +0 -1076
  138. package/src-next/session/next.ts +0 -293
  139. package/src-next/session/preflight.ts +0 -271
  140. package/src-next/session/round-naming.ts +0 -84
  141. package/src-next/session/run.ts +0 -610
  142. package/src-next/session/state.ts +0 -30
  143. package/src-next/session/wave.ts +0 -139
@@ -1,289 +0,0 @@
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
- reviews: "tasks-1-review-1.json",
110
- }),
111
- ).toEqual([
112
- "status: CHANGES_REQUESTED · blocker: 1 · handoff: /h.json",
113
- `next: fix --reviews 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> --reviews <f>`
142
- expect(
143
- capsule.emit(
144
- "CHANGES_REQUESTED",
145
- "1",
146
- "/h.json",
147
- { kind: "fix", reviews: "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 --reviews 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
- });
@@ -1,61 +0,0 @@
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
- });
@@ -1,24 +0,0 @@
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
- });
@@ -1,58 +0,0 @@
1
- // packages/cdd-engine/src-next/face/__tests__/install-rows.guard.test.ts
2
- // T13 ⑦ (spec §3.3 ⑦) — the INSTALL_ROWS ↔ README gate. `face/host.ts`'s
3
- // `INSTALL_ROWS` docstring declared "the README upstream dependency table renders
4
- // from these rows", but no consumer actually read them for the README — a vacuous
5
- // claim. This gate makes the claim true: it pins the `packages/kairos/README.md`
6
- // upstream dependency table (and its zh mirror) to `INSTALL_ROWS` —
7
- // · the table's row key set equals the `INSTALL_ROWS` key set;
8
- // · each row's Claude Code cell equals `INSTALL_ROWS[key].join(";")` (the declared
9
- // install banners, semicolon-joined — the README's cell shape).
10
- // A README install-command drift fails here, never silently.
11
- // Domicile: engine suite (§3.6 — the engine-internal ⑦ fact, single-sourced at host.ts).
12
-
13
- import { readFileSync } from "node:fs";
14
- import { fileURLToPath } from "node:url";
15
- import { describe, expect, it } from "vitest";
16
-
17
- import { INSTALL_ROWS } from "../host.ts";
18
-
19
- const README_ROOT = fileURLToPath(new URL("../../../../kairos/", import.meta.url));
20
- const read = (rel: string): string => readFileSync(`${README_ROOT}/${rel}`, "utf8");
21
-
22
- /** The upstream dependency table's rows keyed by package name — the Claude Code cell
23
- * (2nd column) of each `| <pkg> | … | … | … |` row, backticks stripped. The header +
24
- * separator rows are skipped (their first cell is not a registered package key). */
25
- const tableRows = (src: string): Map<string, string> => {
26
- const rows = new Map<string, string>();
27
- for (const line of src.split("\n")) {
28
- const cells = line.split("|").map((cell) => cell.trim());
29
- // A `| a | b | c | d |` row splits into ["", "a", "b", "c", "d", ""].
30
- if (cells.length < 6) continue;
31
- const key = cells[1]!;
32
- if (!(key in INSTALL_ROWS)) continue;
33
- rows.set(key, cells[2]!.replace(/`/g, ""));
34
- }
35
- return rows;
36
- };
37
-
38
- describe("INSTALL_ROWS ↔ the kairos README upstream dependency table (spec §3.3 ⑦)", () => {
39
- it("the declared docstring claim holds — the table's key set equals the INSTALL_ROWS key set", () => {
40
- for (const rel of ["README.md", "README.zh-CN.md"]) {
41
- const keys = [...tableRows(read(rel)).keys()].sort();
42
- expect(keys, `${rel}: the install table's package rows must match INSTALL_ROWS`).toEqual(
43
- Object.keys(INSTALL_ROWS).sort(),
44
- );
45
- }
46
- });
47
-
48
- it("each table row's Claude Code cell equals the INSTALL_ROWS banners (semicolon-joined)", () => {
49
- for (const rel of ["README.md", "README.zh-CN.md"]) {
50
- const rows = tableRows(read(rel));
51
- for (const [key, banners] of Object.entries(INSTALL_ROWS)) {
52
- expect(rows.get(key), `${rel}: row "${key}" renders from INSTALL_ROWS["${key}"]`).toBe(
53
- banners.join(";"),
54
- );
55
- }
56
- }
57
- });
58
- });
@@ -1,6 +0,0 @@
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(/^-+/, "")}`;