@oscaner-skills/cdd-engine 1.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 +11 -10
- package/README.zh-CN.md +11 -10
- package/package.json +16 -22
- package/src-next/__tests__/bin.test.ts +128 -0
- 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 +185 -0
- package/src-next/__tests__/support/strip-comments.ts +99 -0
- package/src-next/__tests__/zero-dep.test.ts +94 -0
- package/src-next/bin.ts +61 -0
- package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +256 -0
- package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +165 -0
- package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +190 -0
- package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +106 -0
- package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +240 -0
- package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +165 -0
- package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +190 -0
- package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +100 -0
- package/src-next/contract/__tests__/declare.test.ts +481 -0
- package/src-next/contract/__tests__/doc.test.ts +527 -0
- 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 +1111 -0
- package/src-next/contract/__tests__/lint.test.ts +324 -0
- package/src-next/contract/__tests__/project.test.ts +460 -0
- package/src-next/contract/__tests__/structure-pin.test.ts +186 -0
- package/src-next/contract/__tests__/translate.test.ts +96 -0
- package/src-next/contract/declare.ts +1071 -0
- package/src-next/contract/doc.ts +816 -0
- package/src-next/contract/frontmatter.ts +233 -0
- package/src-next/contract/home-extractors.ts +397 -0
- package/src-next/contract/invariants.ts +1413 -0
- package/src-next/contract/judge.ts +151 -0
- package/src-next/contract/lint.ts +239 -0
- package/src-next/contract/project.ts +656 -0
- package/src-next/contract/skill-anatomy.ts +301 -0
- package/src-next/contract/translate.ts +113 -0
- package/src-next/face/__tests__/board-view.test.ts +1151 -0
- package/src-next/face/__tests__/capsule.test.ts +300 -0
- package/src-next/face/__tests__/channel-closure.guard.test.ts +129 -0
- package/src-next/face/__tests__/cli.test.ts +4897 -0
- package/src-next/face/__tests__/face.test.ts +289 -0
- package/src-next/face/__tests__/graph-view.test.ts +61 -0
- package/src-next/face/__tests__/host.test.ts +24 -0
- package/src-next/face/__tests__/install-rows.guard.test.ts +58 -0
- package/src-next/face/__tests__/negation.ts +6 -0
- package/src-next/face/__tests__/preview.test.ts +374 -0
- package/src-next/face/__tests__/projection.test.ts +303 -0
- 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/__tests__/words.guard.test.ts +93 -0
- package/src-next/face/artifacts.ts +248 -0
- package/src-next/face/board-view.ts +652 -0
- package/src-next/face/capsule.ts +163 -0
- package/src-next/face/cli.ts +1028 -0
- package/src-next/face/declare.ts +323 -0
- package/src-next/face/gate.ts +171 -0
- package/src-next/face/graph-view.ts +74 -0
- package/src-next/face/host.ts +302 -0
- package/src-next/face/lifecycle.ts +725 -0
- package/src-next/face/preview.ts +151 -0
- package/src-next/face/projection.ts +285 -0
- package/src-next/face/route-render.ts +185 -0
- package/src-next/face/termination.ts +573 -0
- package/src-next/face/words.ts +314 -0
- package/src-next/infra/__tests__/infra.test.ts +333 -0
- package/src-next/infra/__tests__/root.test.ts +56 -0
- package/src-next/infra/config.ts +42 -0
- package/src-next/infra/doc-roots.ts +29 -0
- package/src-next/infra/git.ts +39 -0
- package/src-next/infra/process.ts +34 -0
- package/src-next/infra/root.ts +73 -0
- package/src-next/infra/runtime.ts +132 -0
- package/src-next/infra/workspace.ts +322 -0
- package/src-next/render/__tests__/render.test.ts +550 -0
- package/src-next/render/__tests__/skeleton.test.ts +684 -0
- package/src-next/render/brief.ts +121 -0
- package/src-next/render/issue-body.ts +162 -0
- package/src-next/render/skeleton.ts +502 -0
- package/src-next/render/templates.ts +645 -0
- package/src-next/session/__tests__/graph.test.ts +277 -0
- package/src-next/session/__tests__/handoff-plane.guard.test.ts +48 -0
- package/src-next/session/__tests__/handoff-schema.test.ts +310 -0
- package/src-next/session/__tests__/ledger.test.ts +745 -0
- package/src-next/session/__tests__/next.test.ts +460 -0
- package/src-next/session/__tests__/preflight.test.ts +545 -0
- package/src-next/session/__tests__/round-naming.test.ts +142 -0
- package/src-next/session/__tests__/run.test.ts +1026 -0
- package/src-next/session/__tests__/wave-line-phase.guard.test.ts +49 -0
- package/src-next/session/__tests__/wave.test.ts +476 -0
- package/src-next/session/faces.ts +110 -0
- package/src-next/session/graph.ts +411 -0
- package/src-next/session/handoff-schema.ts +373 -0
- package/src-next/session/ledger.ts +1076 -0
- package/src-next/session/next.ts +293 -0
- package/src-next/session/preflight.ts +271 -0
- package/src-next/session/round-naming.ts +84 -0
- package/src-next/session/run.ts +610 -0
- package/src-next/session/state.ts +30 -0
- package/src-next/session/wave.ts +139 -0
- package/templates/report/issue-body.json +17 -65
- package/dist/chunks/branch.mjs +0 -480
- package/dist/chunks/docs.mjs +0 -253
- package/dist/chunks/task.mjs +0 -913
- package/dist/cli.mjs +0 -5457
- package/dist/documents/schema/add-phase-protocol.json +0 -126
- package/dist/documents/schema/overall.json +0 -361
- package/dist/documents/schema/phase-spec.json +0 -145
- package/dist/documents/schema/plan.json +0 -191
- package/dist/documents/schema/skill-anatomy.json +0 -233
- package/dist/resources/harness-registry.json +0 -49
- package/dist/shared/cdd-engine.liioziig.mjs +0 -184
- package/templates/engine-config.json +0 -302
- package/templates/schema/cache-profile-schema.json +0 -23
- package/templates/schema/docs-handoff-schema.json +0 -129
- package/templates/schema/task-handoff-schema.json +0 -332
- package/templates/template-contract.json +0 -231
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// packages/cdd-engine/src-next/contract/__tests__/frontmatter.test.ts
|
|
2
|
+
// T1 test suite for the front-matter head extraction chain (contract/frontmatter.ts):
|
|
3
|
+
// · the `---` fence split — the head/body boundary, the no-fence fallback;
|
|
4
|
+
// · the non-scalar downgrade — a list value reads null through the accessor;
|
|
5
|
+
// · the RAW channel — the extracted value equals the source string verbatim;
|
|
6
|
+
// · the twelve declared getters map the §2.3 key set.
|
|
7
|
+
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
9
|
+
import { FrontMatterExtractor, FrontMatterHead } from "../frontmatter.ts";
|
|
10
|
+
|
|
11
|
+
/** The full §2.1 plan-shaped front matter — every one of the twelve declared keys. */
|
|
12
|
+
const FULL_HEAD = [
|
|
13
|
+
"---",
|
|
14
|
+
"title: 引擎文档工具(Engine Doc-Tooling)— 测试 Plan",
|
|
15
|
+
"doc-type: plan",
|
|
16
|
+
"version: v0.9",
|
|
17
|
+
"date: 2026-10-17",
|
|
18
|
+
"spec: docs/kairos/specs/2026-10-10-engine-doc-tooling-p10-design.md",
|
|
19
|
+
"parent-program: docs/kairos/specs/2026-10-10-engine-doc-tooling-overall.md",
|
|
20
|
+
"parent-version: v2.46",
|
|
21
|
+
"depends-on: P9",
|
|
22
|
+
"base: develop",
|
|
23
|
+
"status: Draft",
|
|
24
|
+
'author: "[human] · Claude Opus 5(…)"',
|
|
25
|
+
"issues: close all issues",
|
|
26
|
+
"---",
|
|
27
|
+
"## Design",
|
|
28
|
+
"body prose",
|
|
29
|
+
].join("\n");
|
|
30
|
+
|
|
31
|
+
describe("FrontMatterExtractor.split — the fence split", () => {
|
|
32
|
+
it("splits a fenced head from the body at the second `---` fence", () => {
|
|
33
|
+
const { head, body } = FrontMatterExtractor.split(FULL_HEAD);
|
|
34
|
+
expect(body).toBe("## Design\nbody prose");
|
|
35
|
+
expect(head.title).toBe("引擎文档工具(Engine Doc-Tooling)— 测试 Plan");
|
|
36
|
+
expect(head.docType).toBe("plan");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("returns a null head and the original content when no opening fence is on line zero", () => {
|
|
40
|
+
const content = "no fence here\nbody line";
|
|
41
|
+
const { head, body } = FrontMatterExtractor.split(content);
|
|
42
|
+
expect(body).toBe(content);
|
|
43
|
+
expect(head.title).toBeNull();
|
|
44
|
+
for (const key of [
|
|
45
|
+
"title",
|
|
46
|
+
"doc-type",
|
|
47
|
+
"version",
|
|
48
|
+
"date",
|
|
49
|
+
"status",
|
|
50
|
+
"author",
|
|
51
|
+
"spec",
|
|
52
|
+
"parent-program",
|
|
53
|
+
"parent-version",
|
|
54
|
+
"depends-on",
|
|
55
|
+
"base",
|
|
56
|
+
"issues",
|
|
57
|
+
])
|
|
58
|
+
expect(head.value(key)).toBeNull();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("returns a null head and the original content when the closing fence is missing", () => {
|
|
62
|
+
const content = "---\ntitle: dangling\nbody line";
|
|
63
|
+
const { head, body } = FrontMatterExtractor.split(content);
|
|
64
|
+
expect(body).toBe(content);
|
|
65
|
+
expect(head.value("title")).toBeNull();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("returns a null head and the original content when the fenced block is not a YAML record", () => {
|
|
69
|
+
const content = "---\n- a\n- b\n---\nbody line";
|
|
70
|
+
const { head, body } = FrontMatterExtractor.split(content);
|
|
71
|
+
expect(body).toBe(content);
|
|
72
|
+
expect(head.value("title")).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("returns a null head and the original content when the fenced YAML fails to parse", () => {
|
|
76
|
+
const content = "---\n: bad : yaml\n---\nbody line";
|
|
77
|
+
const { head, body } = FrontMatterExtractor.split(content);
|
|
78
|
+
expect(body).toBe(content);
|
|
79
|
+
expect(head.value("title")).toBeNull();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("carries the typed parse error with its position for the fill-class failure (D1 · #341 — a `[`-led value is a YAML flow sequence)", () => {
|
|
83
|
+
const content = "---\nauthor: [human] · Claude Opus 5\ndoc-type: phase-spec\n---\nbody";
|
|
84
|
+
const { head, body } = FrontMatterExtractor.split(content);
|
|
85
|
+
// the failure never collapses into a bare null head — the error rides along
|
|
86
|
+
expect(body).toBe(content);
|
|
87
|
+
expect(head.value("doc-type")).toBeNull();
|
|
88
|
+
const err = head.parseError;
|
|
89
|
+
expect(err).not.toBeNull();
|
|
90
|
+
expect(err?.line).toBe(1);
|
|
91
|
+
expect(err?.column).toBeGreaterThan(0);
|
|
92
|
+
expect(err?.reason).toContain("Unexpected scalar");
|
|
93
|
+
// the source excerpt is the offending front-matter line itself
|
|
94
|
+
expect(err?.source).toBe("author: [human] · Claude Opus 5");
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe("FrontMatterHead.value — the typed accessor", () => {
|
|
99
|
+
const { head } = FrontMatterExtractor.split(FULL_HEAD);
|
|
100
|
+
|
|
101
|
+
it("reads every declared scalar key through value(key)", () => {
|
|
102
|
+
expect(head.value("title")).toBe("引擎文档工具(Engine Doc-Tooling)— 测试 Plan");
|
|
103
|
+
expect(head.value("version")).toBe("v0.9");
|
|
104
|
+
expect(head.value("depends-on")).toBe("P9");
|
|
105
|
+
expect(head.value("base")).toBe("develop");
|
|
106
|
+
expect(head.value("issues")).toBe("close all issues");
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("downgrades a non-scalar YAML value to null (a list is not a head fact)", () => {
|
|
110
|
+
const { head: listHead } = FrontMatterExtractor.split(
|
|
111
|
+
"---\ntitle: test\nissues:\n - a\n - b\n---\nbody",
|
|
112
|
+
);
|
|
113
|
+
expect(listHead.value("issues")).toBeNull();
|
|
114
|
+
expect(listHead.value("title")).toBe("test");
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("downgrades a non-string scalar (a bare number) to null", () => {
|
|
118
|
+
const { head: numberHead } = FrontMatterExtractor.split("---\nversion: 2.46\n---\nbody");
|
|
119
|
+
expect(numberHead.value("version")).toBeNull();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe("the RAW channel — extraction matches the source verbatim", () => {
|
|
124
|
+
it("reads a bracket-led author value byte-for-byte from the source string", () => {
|
|
125
|
+
const { head } = FrontMatterExtractor.split(FULL_HEAD);
|
|
126
|
+
expect(head.author).toBe("[human] · Claude Opus 5(…)");
|
|
127
|
+
expect(head.value("author")).toBe(head.author);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe("the twelve declared getters (§2.3 key set)", () => {
|
|
132
|
+
const { head } = FrontMatterExtractor.split(FULL_HEAD);
|
|
133
|
+
|
|
134
|
+
it("exposes the kebab keys through the getter surface", () => {
|
|
135
|
+
expect(head.title).toBe("引擎文档工具(Engine Doc-Tooling)— 测试 Plan");
|
|
136
|
+
expect(head.docType).toBe("plan");
|
|
137
|
+
expect(head.version).toBe("v0.9");
|
|
138
|
+
expect(head.date).toBe("2026-10-17");
|
|
139
|
+
expect(head.status).toBe("Draft");
|
|
140
|
+
expect(head.author).toBe("[human] · Claude Opus 5(…)");
|
|
141
|
+
expect(head.spec).toBe("docs/kairos/specs/2026-10-10-engine-doc-tooling-p10-design.md");
|
|
142
|
+
expect(head.parentProgram).toBe("docs/kairos/specs/2026-10-10-engine-doc-tooling-overall.md");
|
|
143
|
+
expect(head.parentVersion).toBe("v2.46");
|
|
144
|
+
expect(head.dependsOn).toBe("P9");
|
|
145
|
+
expect(head.base).toBe("develop");
|
|
146
|
+
expect(head.issues).toBe("close all issues");
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("reads null for every getter on an empty head", () => {
|
|
150
|
+
const empty = new FrontMatterHead(null);
|
|
151
|
+
expect(empty.title).toBeNull();
|
|
152
|
+
expect(empty.docType).toBeNull();
|
|
153
|
+
expect(empty.version).toBeNull();
|
|
154
|
+
expect(empty.date).toBeNull();
|
|
155
|
+
expect(empty.status).toBeNull();
|
|
156
|
+
expect(empty.author).toBeNull();
|
|
157
|
+
expect(empty.spec).toBeNull();
|
|
158
|
+
expect(empty.parentProgram).toBeNull();
|
|
159
|
+
expect(empty.parentVersion).toBeNull();
|
|
160
|
+
expect(empty.dependsOn).toBeNull();
|
|
161
|
+
expect(empty.base).toBeNull();
|
|
162
|
+
expect(empty.issues).toBeNull();
|
|
163
|
+
});
|
|
164
|
+
});
|