@oscaner-skills/cdd-engine 2.0.0 → 3.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.
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/package.json +4 -3
- package/src-next/__tests__/dead-decl.guard.test.ts +39 -0
- package/src-next/__tests__/floor.guard.test.ts +69 -0
- package/src-next/__tests__/issue-body.guard.test.ts +66 -0
- package/src-next/__tests__/phase-suffix.guard.test.ts +72 -0
- package/src-next/__tests__/smoke.integration.test.ts +60 -77
- package/src-next/__tests__/support/strip-comments.ts +99 -0
- package/src-next/__tests__/zero-dep.test.ts +6 -46
- package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +39 -21
- package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +40 -28
- package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +40 -23
- package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +38 -21
- package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +21 -6
- package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +22 -12
- package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +23 -8
- package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +21 -6
- package/src-next/contract/__tests__/declare.test.ts +251 -12
- package/src-next/contract/__tests__/doc.test.ts +214 -45
- package/src-next/contract/__tests__/dockey.guard.test.ts +58 -0
- package/src-next/contract/__tests__/edge-conditions.guard.test.ts +81 -0
- package/src-next/contract/__tests__/frontmatter.test.ts +164 -0
- package/src-next/contract/__tests__/judge.test.ts +410 -172
- package/src-next/contract/__tests__/lint.test.ts +49 -39
- package/src-next/contract/__tests__/project.test.ts +60 -19
- package/src-next/contract/__tests__/structure-pin.test.ts +186 -0
- package/src-next/contract/declare.ts +179 -91
- package/src-next/contract/doc.ts +227 -164
- package/src-next/contract/frontmatter.ts +233 -0
- package/src-next/contract/home-extractors.ts +397 -0
- package/src-next/contract/invariants.ts +214 -69
- package/src-next/contract/judge.ts +28 -19
- package/src-next/contract/lint.ts +5 -41
- package/src-next/contract/project.ts +103 -43
- package/src-next/contract/skill-anatomy.ts +39 -11
- package/src-next/face/__tests__/board-view.test.ts +318 -115
- package/src-next/face/__tests__/capsule.test.ts +49 -25
- package/src-next/face/__tests__/channel-closure.guard.test.ts +28 -1
- package/src-next/face/__tests__/cli.test.ts +1091 -837
- package/src-next/face/__tests__/face.test.ts +5 -5
- package/src-next/face/__tests__/install-rows.guard.test.ts +58 -0
- package/src-next/face/__tests__/preview.test.ts +374 -0
- package/src-next/face/__tests__/projection.test.ts +5 -3
- package/src-next/face/__tests__/repo-root.guard.test.ts +120 -0
- package/src-next/face/__tests__/termination.test.ts +650 -0
- package/src-next/face/artifacts.ts +90 -37
- package/src-next/face/board-view.ts +128 -138
- package/src-next/face/capsule.ts +30 -16
- package/src-next/face/cli.ts +306 -97
- package/src-next/face/declare.ts +15 -18
- package/src-next/face/gate.ts +19 -18
- package/src-next/face/host.ts +6 -30
- package/src-next/face/lifecycle.ts +213 -188
- package/src-next/face/preview.ts +151 -0
- package/src-next/face/projection.ts +4 -1
- package/src-next/face/route-render.ts +39 -14
- package/src-next/face/termination.ts +573 -0
- package/src-next/face/words.ts +20 -2
- package/src-next/infra/__tests__/infra.test.ts +49 -3
- package/src-next/infra/__tests__/root.test.ts +56 -0
- package/src-next/infra/doc-roots.ts +29 -0
- package/src-next/infra/root.ts +73 -0
- package/src-next/infra/runtime.ts +12 -65
- package/src-next/infra/workspace.ts +95 -5
- package/src-next/render/__tests__/render.test.ts +92 -41
- package/src-next/render/__tests__/skeleton.test.ts +282 -64
- package/src-next/render/issue-body.ts +5 -2
- package/src-next/render/skeleton.ts +155 -90
- package/src-next/render/templates.ts +51 -56
- package/src-next/session/__tests__/graph.test.ts +11 -4
- package/src-next/session/__tests__/ledger.test.ts +3 -2
- package/src-next/session/__tests__/next.test.ts +100 -8
- package/src-next/session/__tests__/preflight.test.ts +79 -25
- package/src-next/session/__tests__/round-naming.test.ts +142 -0
- package/src-next/session/__tests__/run.test.ts +140 -128
- package/src-next/session/__tests__/wave.test.ts +11 -4
- package/src-next/session/ledger.ts +96 -24
- package/src-next/session/next.ts +116 -15
- package/src-next/session/preflight.ts +41 -10
- package/src-next/session/round-naming.ts +84 -0
- package/src-next/session/run.ts +24 -20
- package/templates/report/issue-body.json +0 -46
- package/src-next/face/__tests__/sync-runner.test.ts +0 -70
|
@@ -17,6 +17,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
17
17
|
import { tmpdir } from "node:os";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
20
|
+
import { RepoRoot } from "../../infra/root.ts";
|
|
20
21
|
import type { RouteTarget } from "../../session/faces.ts";
|
|
21
22
|
import type { Route } from "../../session/next.ts";
|
|
22
23
|
import { FIX_READBACK_SUFFIX, PIPELINE_NEXT } from "../../session/next.ts";
|
|
@@ -57,7 +58,7 @@ const branch = {
|
|
|
57
58
|
/** One verb × type row of the coverage table — the route + the frame facts + the
|
|
58
59
|
* runtime-required flags of the type (the flags the CLI run would demand: the
|
|
59
60
|
* declared required keys + the type's scene rules — wave demands --plan, spec/plan
|
|
60
|
-
* their doc flags, branch the workspace --plan/--
|
|
61
|
+
* their doc flags, branch the workspace --plan/--reviews face). */
|
|
61
62
|
interface CoverageRow {
|
|
62
63
|
label: string;
|
|
63
64
|
route: Route;
|
|
@@ -98,30 +99,30 @@ const COVERAGE: readonly CoverageRow[] = [
|
|
|
98
99
|
},
|
|
99
100
|
{
|
|
100
101
|
label: "fix wave",
|
|
101
|
-
route: { kind: "fix",
|
|
102
|
+
route: { kind: "fix", reviews: "tasks-1-review-1.json" },
|
|
102
103
|
target: wave,
|
|
103
|
-
required: ["--type", "--tasks", "--plan", "--
|
|
104
|
+
required: ["--type", "--tasks", "--plan", "--reviews"],
|
|
104
105
|
},
|
|
105
106
|
{
|
|
106
107
|
label: "fix spec",
|
|
107
|
-
route: { kind: "fix",
|
|
108
|
+
route: { kind: "fix", reviews: "s1-review-1.json" },
|
|
108
109
|
target: spec,
|
|
109
|
-
required: ["--type", "--spec", "--
|
|
110
|
+
required: ["--type", "--spec", "--reviews"],
|
|
110
111
|
},
|
|
111
112
|
{
|
|
112
113
|
label: "fix plan",
|
|
113
|
-
route: { kind: "fix",
|
|
114
|
+
route: { kind: "fix", reviews: "p1-review-1.json" },
|
|
114
115
|
target: planT,
|
|
115
|
-
required: ["--type", "--plan", "--
|
|
116
|
+
required: ["--type", "--plan", "--reviews"],
|
|
116
117
|
},
|
|
117
118
|
{
|
|
118
119
|
// find #8 F1b — the branch fix carries the workspace-identity `--plan` plus the
|
|
119
|
-
// source review handoff `--
|
|
120
|
+
// source review handoff `--reviews` (the review judges the live tree — no
|
|
120
121
|
// re-declared base/head on the CLI)
|
|
121
122
|
label: "fix branch",
|
|
122
|
-
route: { kind: "fix",
|
|
123
|
+
route: { kind: "fix", reviews: "br1-review-1.json" },
|
|
123
124
|
target: branch,
|
|
124
|
-
required: ["--type", "--
|
|
125
|
+
required: ["--type", "--reviews", "--plan"],
|
|
125
126
|
},
|
|
126
127
|
];
|
|
127
128
|
|
|
@@ -175,9 +176,32 @@ describe("P4.1 T7 (find #7) — the next literal's required-flag coverage (parse
|
|
|
175
176
|
});
|
|
176
177
|
|
|
177
178
|
it("the fix route keeps the FIX_READBACK_SUFFIX verbatim", () => {
|
|
178
|
-
const literal = literalOf({ kind: "fix",
|
|
179
|
+
const literal = literalOf({ kind: "fix", reviews: "tasks-1-review-1.json" }, wave);
|
|
179
180
|
expect(literal).toContain(FIX_READBACK_SUFFIX);
|
|
180
181
|
});
|
|
182
|
+
|
|
183
|
+
it("D47 — the next: literal's embedded paths render repoRoot-relative (absolute target + findings)", () => {
|
|
184
|
+
// §2.13 — the ONE renderer normalizes every embedded path value to the repoRoot-
|
|
185
|
+
// relative shape; an absolute target path and an absolute review path both come
|
|
186
|
+
// out relative, and the repo root never appears in the literal.
|
|
187
|
+
const repo = "/tmp/d47-repo";
|
|
188
|
+
const capsule = new Capsule(new Words(), {}, "", new RepoRoot(repo));
|
|
189
|
+
const lines = capsule.emit(
|
|
190
|
+
"CHANGES_REQUESTED",
|
|
191
|
+
"1",
|
|
192
|
+
`${repo}/.kairos/cdd/p3/tasks-1-review-1.json`,
|
|
193
|
+
{ kind: "fix", reviews: `${repo}/.kairos/cdd/p3/tasks-1-review-1.json` },
|
|
194
|
+
{ type: "plan", id: `${repo}/docs/kairos/plans/p3.md` },
|
|
195
|
+
);
|
|
196
|
+
const literal = lines[1]!.slice("next: ".length);
|
|
197
|
+
expect(literal).toBe(
|
|
198
|
+
`fix --type plan --plan docs/kairos/plans/p3.md --reviews .kairos/cdd/p3/tasks-1-review-1.json ${FIX_READBACK_SUFFIX}`,
|
|
199
|
+
);
|
|
200
|
+
expect(literal).not.toContain(repo);
|
|
201
|
+
// The handoff: cell is the same basis — repoRoot-relative, never absolute.
|
|
202
|
+
expect(lines[0]).toContain("handoff: .kairos/cdd/p3/tasks-1-review-1.json");
|
|
203
|
+
expect(lines[0]).not.toContain(repo);
|
|
204
|
+
});
|
|
181
205
|
});
|
|
182
206
|
|
|
183
207
|
// ---------------------------------------------------------------------------
|
|
@@ -185,7 +209,7 @@ describe("P4.1 T7 (find #7) — the next literal's required-flag coverage (parse
|
|
|
185
209
|
// ---------------------------------------------------------------------------
|
|
186
210
|
|
|
187
211
|
/** The hermetic declaration repo — the spec docs the doc-class discrimination reads
|
|
188
|
-
* (spec §12 · D34: the declared
|
|
212
|
+
* (spec §12 · D34: the declared front-matter `doc-type:` key, never the filename). */
|
|
189
213
|
describe("Capsule — the `done` route's PIPELINE_NEXT doc-class lookup (D33 · the unified next face)", () => {
|
|
190
214
|
let repo: string;
|
|
191
215
|
|
|
@@ -197,27 +221,27 @@ describe("Capsule — the `done` route's PIPELINE_NEXT doc-class lookup (D33 ·
|
|
|
197
221
|
rmSync(repo, { recursive: true, force: true });
|
|
198
222
|
});
|
|
199
223
|
|
|
200
|
-
/** A spec doc on disk declaring its doc type (the
|
|
224
|
+
/** A spec doc on disk declaring its doc type (the front-matter head key). */
|
|
201
225
|
const declareSpec = (name: string, docType: string | null): RouteTarget => {
|
|
202
226
|
mkdirSync(path.dirname(path.join(repo, name)), { recursive: true });
|
|
203
|
-
const
|
|
227
|
+
const head =
|
|
204
228
|
docType === null
|
|
205
|
-
? ["
|
|
229
|
+
? ["---", "title: The doc", "version: v1.0", "status: Draft", "---"]
|
|
206
230
|
: [
|
|
207
|
-
"
|
|
208
|
-
"",
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
|
|
212
|
-
"",
|
|
231
|
+
"---",
|
|
232
|
+
"title: The doc",
|
|
233
|
+
"version: v1.0",
|
|
234
|
+
"status: Draft",
|
|
235
|
+
`doc-type: ${docType}`,
|
|
236
|
+
"---",
|
|
213
237
|
];
|
|
214
|
-
writeFileSync(path.join(repo, name),
|
|
238
|
+
writeFileSync(path.join(repo, name), [...head, ""].join("\n"), "utf8");
|
|
215
239
|
return { type: "spec", id: name } as const;
|
|
216
240
|
};
|
|
217
241
|
|
|
218
242
|
/** The done-text of a capsule emit for a host-injected capsule over the repo. */
|
|
219
243
|
const doneOf = (target?: RouteTarget, host = ""): string => {
|
|
220
|
-
const lines = new Capsule(new Words(), {}, host, repo).emit(
|
|
244
|
+
const lines = new Capsule(new Words(), {}, host, new RepoRoot(repo)).emit(
|
|
221
245
|
"APPROVED",
|
|
222
246
|
"0",
|
|
223
247
|
"/h.json",
|
|
@@ -249,10 +273,10 @@ describe("Capsule — the `done` route's PIPELINE_NEXT doc-class lookup (D33 ·
|
|
|
249
273
|
expect(doneOf(overall)).toBe("done");
|
|
250
274
|
});
|
|
251
275
|
|
|
252
|
-
it("a spec target declaring no
|
|
276
|
+
it("a spec target declaring no doc-type renders the BLOCKED face — zero filename-suffix fallback", () => {
|
|
253
277
|
const undeclared = declareSpec("docs/kairos/specs/prog-p8-design.md", null);
|
|
254
278
|
expect(doneOf(undeclared)).toBe(
|
|
255
|
-
"CDD_BLOCKED: the doc declares no
|
|
279
|
+
"CDD_BLOCKED: the doc declares no `doc-type:` key — add `doc-type: <overall-spec|phase-spec|single-spec|plan>` to the doc's front-matter (spec §12 · D34) and re-run",
|
|
256
280
|
);
|
|
257
281
|
});
|
|
258
282
|
|
|
@@ -14,13 +14,17 @@
|
|
|
14
14
|
// four, derived from the harness detect rows as the live single source;
|
|
15
15
|
// 3. the dispatch/refs derivation — every dispatch-slot ref is registered and
|
|
16
16
|
// every per-harness slash form derives (`pi` /skill:<bare>, claude/cursor
|
|
17
|
-
// /<ref>)
|
|
17
|
+
// /<ref>);
|
|
18
|
+
// 4. the pipeline-next refs closure (T13 ⑨) — every `PIPELINE_NEXT` ref-key entry
|
|
19
|
+
// is registered in REFS and derives its per-harness forms (the face-to-face
|
|
20
|
+
// handoff table × the ref table cross-closure).
|
|
18
21
|
//
|
|
19
22
|
// Zero module-level bare functions — the assertions read the typed exports with
|
|
20
23
|
// `const` helpers only (the P5 zero-`function`-declaration discipline).
|
|
21
24
|
|
|
22
25
|
import { describe, expect, it } from "vitest";
|
|
23
26
|
|
|
27
|
+
import { PIPELINE_NEXT } from "../../session/next.ts";
|
|
24
28
|
import { ARGV_CHANNEL, CLI_COMMANDS } from "../declare.ts";
|
|
25
29
|
import { DISPATCH, HOSTS, REFS } from "../host.ts";
|
|
26
30
|
|
|
@@ -99,4 +103,27 @@ describe("the dispatch/refs derivation — every dispatch-slot ref registered +
|
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
});
|
|
106
|
+
|
|
107
|
+
it("the PIPELINE_NEXT ref-key entries close over REFS (every handoff ref is registered + derives its forms)", () => {
|
|
108
|
+
// The face-to-face handoff table (session/next.ts PIPELINE_NEXT) routes each
|
|
109
|
+
// pipeline seam through a skill ref; every `{ kind: "ref" }` entry must name a
|
|
110
|
+
// registered REFS key and derive its per-harness slash forms — the same closure
|
|
111
|
+
// the dispatch leg enforces (a handoff ref absent from REFS renders the bare
|
|
112
|
+
// `done` word at the capsule's render, a silent mis-route).
|
|
113
|
+
const pipelineRefs = Object.values(PIPELINE_NEXT)
|
|
114
|
+
.filter((entry): entry is { kind: "ref"; ref: string } => entry.kind === "ref")
|
|
115
|
+
.map((entry) => entry.ref);
|
|
116
|
+
// The ref-shaped subset is non-empty (the phase-spec/plan/branch seams all route
|
|
117
|
+
// through refs; only the overall-spec seam is the `done` terminal + wave a literal).
|
|
118
|
+
expect(pipelineRefs.length).toBeGreaterThan(0);
|
|
119
|
+
for (const ref of pipelineRefs) {
|
|
120
|
+
const form = REFS[ref as keyof typeof REFS];
|
|
121
|
+
expect(form, `PIPELINE_NEXT names the registered ref key "${ref}"`).toBeDefined();
|
|
122
|
+
if (form === undefined) continue;
|
|
123
|
+
for (const id of ["claude", "cursor", "pi"] as const) {
|
|
124
|
+
const expected = id === "pi" ? `/skill:${ref.split(":")[1]}` : `/${ref}`;
|
|
125
|
+
expect(form[id], `PIPELINE_NEXT ref "${ref}" per-harness form for ${id}`).toBe(expected);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
102
129
|
});
|