@oscaner-skills/cdd-engine 3.0.0 → 3.1.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/{src-next/bin.ts → dist/bin.js} +18 -21
- package/dist/contract/declare.js +998 -0
- package/dist/contract/doc.js +565 -0
- package/dist/contract/frontmatter.js +209 -0
- package/dist/contract/home-extractors.js +379 -0
- package/dist/contract/invariants.js +1030 -0
- package/dist/contract/judge.js +109 -0
- package/dist/contract/lint.js +206 -0
- package/dist/contract/project.js +371 -0
- package/dist/contract/skill-anatomy.js +156 -0
- package/dist/contract/translate.js +85 -0
- package/dist/face/artifacts.js +189 -0
- package/dist/face/board-view.js +522 -0
- package/dist/face/capsule.js +149 -0
- package/dist/face/cli.js +893 -0
- package/dist/face/declare.js +241 -0
- package/dist/face/gate.js +158 -0
- package/dist/face/graph-view.js +66 -0
- package/dist/face/host.js +211 -0
- package/dist/face/lifecycle.js +702 -0
- package/dist/face/preview.js +136 -0
- package/dist/face/projection.js +259 -0
- package/dist/face/route-render.js +162 -0
- package/dist/face/termination.js +504 -0
- package/dist/face/words.js +258 -0
- package/{src-next/infra/config.ts → dist/infra/config.js} +19 -24
- package/{src-next/infra/doc-roots.ts → dist/infra/doc-roots.js} +3 -13
- package/dist/infra/git.js +37 -0
- package/dist/infra/process.js +22 -0
- package/{src-next/infra/root.ts → dist/infra/root.js} +25 -36
- package/dist/infra/runtime.js +85 -0
- package/dist/infra/workspace.js +276 -0
- package/dist/render/brief.js +82 -0
- package/dist/render/issue-body.js +129 -0
- package/dist/render/skeleton.js +434 -0
- package/dist/render/templates.js +520 -0
- package/dist/session/faces.js +38 -0
- package/dist/session/graph.js +309 -0
- package/dist/session/handoff-schema.js +295 -0
- package/dist/session/ledger.js +762 -0
- package/dist/session/next.js +211 -0
- package/dist/session/preflight.js +194 -0
- package/dist/session/round-naming.js +73 -0
- package/dist/session/run.js +453 -0
- package/dist/session/state.js +8 -0
- package/dist/session/wave.js +92 -0
- package/package.json +5 -5
- package/src-next/__tests__/bin.test.ts +0 -128
- package/src-next/__tests__/dead-decl.guard.test.ts +0 -39
- package/src-next/__tests__/floor.guard.test.ts +0 -69
- package/src-next/__tests__/issue-body.guard.test.ts +0 -66
- package/src-next/__tests__/phase-suffix.guard.test.ts +0 -72
- package/src-next/__tests__/smoke.integration.test.ts +0 -185
- package/src-next/__tests__/support/strip-comments.ts +0 -99
- package/src-next/__tests__/zero-dep.test.ts +0 -94
- package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +0 -256
- package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +0 -165
- package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +0 -190
- package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +0 -106
- package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +0 -240
- package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +0 -165
- package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +0 -190
- package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +0 -100
- package/src-next/contract/__tests__/declare.test.ts +0 -481
- package/src-next/contract/__tests__/doc.test.ts +0 -527
- package/src-next/contract/__tests__/dockey.guard.test.ts +0 -58
- package/src-next/contract/__tests__/edge-conditions.guard.test.ts +0 -81
- package/src-next/contract/__tests__/frontmatter.test.ts +0 -164
- package/src-next/contract/__tests__/judge.test.ts +0 -1111
- package/src-next/contract/__tests__/lint.test.ts +0 -324
- package/src-next/contract/__tests__/project.test.ts +0 -460
- package/src-next/contract/__tests__/structure-pin.test.ts +0 -186
- package/src-next/contract/__tests__/translate.test.ts +0 -96
- package/src-next/contract/declare.ts +0 -1071
- package/src-next/contract/doc.ts +0 -816
- package/src-next/contract/frontmatter.ts +0 -233
- package/src-next/contract/home-extractors.ts +0 -397
- package/src-next/contract/invariants.ts +0 -1413
- package/src-next/contract/judge.ts +0 -151
- package/src-next/contract/lint.ts +0 -239
- package/src-next/contract/project.ts +0 -656
- package/src-next/contract/skill-anatomy.ts +0 -301
- package/src-next/contract/translate.ts +0 -113
- package/src-next/face/__tests__/board-view.test.ts +0 -1151
- package/src-next/face/__tests__/capsule.test.ts +0 -300
- package/src-next/face/__tests__/channel-closure.guard.test.ts +0 -129
- package/src-next/face/__tests__/cli.test.ts +0 -4897
- package/src-next/face/__tests__/face.test.ts +0 -289
- package/src-next/face/__tests__/graph-view.test.ts +0 -61
- package/src-next/face/__tests__/host.test.ts +0 -24
- package/src-next/face/__tests__/install-rows.guard.test.ts +0 -58
- package/src-next/face/__tests__/negation.ts +0 -6
- package/src-next/face/__tests__/preview.test.ts +0 -374
- package/src-next/face/__tests__/projection.test.ts +0 -303
- package/src-next/face/__tests__/repo-root.guard.test.ts +0 -120
- package/src-next/face/__tests__/termination.test.ts +0 -650
- package/src-next/face/__tests__/words.guard.test.ts +0 -93
- package/src-next/face/artifacts.ts +0 -248
- package/src-next/face/board-view.ts +0 -652
- package/src-next/face/capsule.ts +0 -163
- package/src-next/face/cli.ts +0 -1028
- package/src-next/face/declare.ts +0 -323
- package/src-next/face/gate.ts +0 -171
- package/src-next/face/graph-view.ts +0 -74
- package/src-next/face/host.ts +0 -302
- package/src-next/face/lifecycle.ts +0 -725
- package/src-next/face/preview.ts +0 -151
- package/src-next/face/projection.ts +0 -285
- package/src-next/face/route-render.ts +0 -185
- package/src-next/face/termination.ts +0 -573
- package/src-next/face/words.ts +0 -314
- package/src-next/infra/__tests__/infra.test.ts +0 -333
- package/src-next/infra/__tests__/root.test.ts +0 -56
- package/src-next/infra/git.ts +0 -39
- package/src-next/infra/process.ts +0 -34
- package/src-next/infra/runtime.ts +0 -132
- package/src-next/infra/workspace.ts +0 -322
- package/src-next/render/__tests__/render.test.ts +0 -550
- package/src-next/render/__tests__/skeleton.test.ts +0 -684
- package/src-next/render/brief.ts +0 -121
- package/src-next/render/issue-body.ts +0 -162
- package/src-next/render/skeleton.ts +0 -502
- package/src-next/render/templates.ts +0 -645
- package/src-next/session/__tests__/graph.test.ts +0 -277
- package/src-next/session/__tests__/handoff-plane.guard.test.ts +0 -48
- package/src-next/session/__tests__/handoff-schema.test.ts +0 -310
- package/src-next/session/__tests__/ledger.test.ts +0 -745
- package/src-next/session/__tests__/next.test.ts +0 -460
- package/src-next/session/__tests__/preflight.test.ts +0 -545
- package/src-next/session/__tests__/round-naming.test.ts +0 -142
- package/src-next/session/__tests__/run.test.ts +0 -1026
- package/src-next/session/__tests__/wave-line-phase.guard.test.ts +0 -49
- package/src-next/session/__tests__/wave.test.ts +0 -476
- package/src-next/session/faces.ts +0 -110
- package/src-next/session/graph.ts +0 -411
- package/src-next/session/handoff-schema.ts +0 -373
- package/src-next/session/ledger.ts +0 -1076
- package/src-next/session/next.ts +0 -293
- package/src-next/session/preflight.ts +0 -271
- package/src-next/session/round-naming.ts +0 -84
- package/src-next/session/run.ts +0 -610
- package/src-next/session/state.ts +0 -30
- package/src-next/session/wave.ts +0 -139
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// packages/cdd-engine/src-next/face/__tests__/repo-root.guard.test.ts
|
|
2
|
-
// P9 T7 (spec §2.9) — the STRUCTURAL pin. It guards the conversion point, not
|
|
3
|
-
// the spawn: the engine production code must read the working directory exactly
|
|
4
|
-
// ONCE and resolve it to the repo root exactly ONCE. The historical lesson is
|
|
5
|
-
// that a single source + a single conversion point alone did not hold — the pin
|
|
6
|
-
// was dropped alongside them, so a stray second `process.cwd()` (or a second
|
|
7
|
-
// repo-root conversion) could re-seam the resolution silently. This guard fails
|
|
8
|
-
// the moment a second site appears.
|
|
9
|
-
//
|
|
10
|
-
// The pin stands apart from the BEHAVIOR pin (cli.test.ts's spawn-cwd behavior
|
|
11
|
-
// pin — the child is constructed with `call.cwd === repoRoot`): the structural
|
|
12
|
-
// pin guards the conversion point (§2.4/§2.9), the behavior pin guards the
|
|
13
|
-
// spawn cwd — two different facts, two separate pins.
|
|
14
|
-
//
|
|
15
|
-
// The scan reads the engine's OWN source face (the src-next production tree,
|
|
16
|
-
// `__tests__/` excluded — test fixtures spawn with their own `cwd` argv and are
|
|
17
|
-
// not production conversion points). Comments are stripped before the count so a
|
|
18
|
-
// docstring mentioning the symbol never builds a hit; string literals are NOT
|
|
19
|
-
// stripped (a `process.cwd()` inside a string would be a real defect). The
|
|
20
|
-
// stripper (shared with the retired-plane guard — `__tests__/support/strip-comments
|
|
21
|
-
// .ts`, F4) is string/template/regex-aware so a `//` inside a string, or a
|
|
22
|
-
// backtick-bearing regex literal, never truncates or desyncs the scan.
|
|
23
|
-
//
|
|
24
|
-
// Zero module-level bare functions — the walk/count helpers are `const`
|
|
25
|
-
// (the plan's zero-`function`-declaration discipline).
|
|
26
|
-
|
|
27
|
-
import { readdirSync, readFileSync } from "node:fs";
|
|
28
|
-
import path from "node:path";
|
|
29
|
-
import { fileURLToPath } from "node:url";
|
|
30
|
-
import { describe, expect, it } from "vitest";
|
|
31
|
-
import { stripComments } from "../../__tests__/support/strip-comments.ts";
|
|
32
|
-
|
|
33
|
-
/** The src-next plane root — the engine's own source face (the scan set). */
|
|
34
|
-
const SRC_ROOT = fileURLToPath(new URL("../../", import.meta.url));
|
|
35
|
-
|
|
36
|
-
/** The two tokens the structural pin counts, each pinned to exactly ONE hit:
|
|
37
|
-
* the working-directory read (`process.cwd()`) and the root conversion (the
|
|
38
|
-
* `.topLevel(` member-call form — receiver-agnostic, so a conversion through a
|
|
39
|
-
* renamed or destructured receiver still builds a hit; the method DEFINITION
|
|
40
|
-
* `async topLevel(` has no leading dot and stays outside the count). */
|
|
41
|
-
const PINNED = [
|
|
42
|
-
{ token: "process.cwd()", label: "the working-directory read" },
|
|
43
|
-
{ token: ".topLevel(", label: "the repo-root conversion" },
|
|
44
|
-
] as const;
|
|
45
|
-
|
|
46
|
-
/** Walk the production tree collecting `.ts` files under `__tests__` excluded
|
|
47
|
-
* (the test plane is not the production conversion face). */
|
|
48
|
-
const collectProductionTs = (dir: string, out: string[]): void => {
|
|
49
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
50
|
-
if (entry.isDirectory()) {
|
|
51
|
-
if (entry.name === "__tests__") continue;
|
|
52
|
-
collectProductionTs(path.join(dir, entry.name), out);
|
|
53
|
-
} else if (entry.name.endsWith(".ts")) {
|
|
54
|
-
out.push(path.join(dir, entry.name));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/** Every `file:line` hit of one token over the production face (comments stripped). */
|
|
60
|
-
const hitsOf = (token: string): string[] => {
|
|
61
|
-
const files: string[] = [];
|
|
62
|
-
collectProductionTs(SRC_ROOT, files);
|
|
63
|
-
const hits: string[] = [];
|
|
64
|
-
for (const file of files) {
|
|
65
|
-
const lines = stripComments(readFileSync(file, "utf8")).split("\n");
|
|
66
|
-
for (let index = 0; index < lines.length; index += 1) {
|
|
67
|
-
if (lines[index]!.includes(token)) hits.push(`${path.relative(SRC_ROOT, file)}:${index + 1}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return hits;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
describe("the structural pin — the engine resolves the repo root through exactly one conversion point (spec §2.9)", () => {
|
|
74
|
-
for (const { token, label } of PINNED) {
|
|
75
|
-
it(`${label} occurs exactly once on the engine production face — ${token}`, () => {
|
|
76
|
-
const hits = hitsOf(token);
|
|
77
|
-
// The pin is a count of ONE: zero hits would strand the resolution (no
|
|
78
|
-
// conversion at all), a second hit would re-seam it. Either way the guard
|
|
79
|
-
// is the machine check the spec's single-conversion invariant rides on.
|
|
80
|
-
expect(hits, `"${token}" must occur exactly once (found ${hits.length})`).toHaveLength(1);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
describe("the structural pin's comment stripper — strings are counted, comments are not", () => {
|
|
86
|
-
it("counts a token inside a string literal but not one inside a line comment", () => {
|
|
87
|
-
// The header's contract, pinned behaviorally: a symbol inside a string is a
|
|
88
|
-
// real occurrence (the defect the guard exists to catch); a comment is not.
|
|
89
|
-
expect(stripComments('const a = "process.cwd()";').includes("process.cwd()")).toBe(true);
|
|
90
|
-
expect(stripComments("// process.cwd()").includes("process.cwd()")).toBe(false);
|
|
91
|
-
expect(stripComments("/* .topLevel( in prose */").includes(".topLevel(")).toBe(false);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("does not let a `//` inside a string literal truncate the line (a real token after it still counts)", () => {
|
|
95
|
-
// The regression the stripper's string-awareness closes: a naive `//`-strip
|
|
96
|
-
// would drop everything after the in-string `//`, silently missing the real
|
|
97
|
-
// conversion call on the same line.
|
|
98
|
-
const line = 'const note = "see // the cwd"; const c = process.cwd();';
|
|
99
|
-
expect(stripComments(line).includes("process.cwd()")).toBe(true);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("does not let a backtick-bearing regex literal desync the scan (later real tokens still count)", () => {
|
|
103
|
-
// A non-regex-aware tracker reads the backtick inside `/`+[^`]*`/` as a
|
|
104
|
-
// template-literal opener and swallows the rest of the file as a string,
|
|
105
|
-
// falsely reporting following comment tokens (or missing real ones).
|
|
106
|
-
const source = [
|
|
107
|
-
"const r = /`+[^`\\n]*`+/g;",
|
|
108
|
-
"// process.cwd()",
|
|
109
|
-
"const c = process.cwd();",
|
|
110
|
-
].join("\n");
|
|
111
|
-
const stripped = stripComments(source);
|
|
112
|
-
expect(stripped.split("\n")[1]!.includes("process.cwd()")).toBe(false);
|
|
113
|
-
expect(stripped.split("\n")[2]!.includes("process.cwd()")).toBe(true);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it("preserves line count so a reported hit line stays true", () => {
|
|
117
|
-
const source = ["const a = 1;", "/* x", "y */", "// z", "const b = 2;"].join("\n");
|
|
118
|
-
expect(stripComments(source).split("\n")).toHaveLength(5);
|
|
119
|
-
});
|
|
120
|
-
});
|