@oscaner-skills/cdd-engine 4.2.0 → 4.3.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 +38 -9
- package/README.zh-CN.md +43 -9
- package/dist/contract/completion-criterion.js +351 -0
- package/dist/contract/declare.js +181 -43
- package/dist/contract/doc.js +84 -271
- package/dist/contract/frontmatter.js +2 -1
- package/dist/contract/home-extractors.js +49 -316
- package/dist/contract/invariants.js +400 -296
- package/dist/contract/judge.js +74 -49
- package/dist/contract/lint.js +3 -2
- package/dist/contract/liveness-signal.js +103 -0
- package/dist/contract/markdown-document.js +410 -0
- package/dist/contract/markdown-tree-types.js +6 -0
- package/dist/contract/markdown-tree.js +137 -0
- package/dist/contract/project.js +1 -1
- package/dist/contract/rules.js +106 -0
- package/dist/contract/selector-engine.js +332 -0
- package/dist/contract/selector-spec.js +74 -0
- package/dist/contract/skill-anatomy.js +29 -1
- package/dist/contract/task-block-grammar.js +285 -0
- package/dist/contract/task-blocks.js +65 -0
- package/dist/contract/translate.js +21 -0
- package/dist/contract/wave-width.js +15 -0
- package/dist/face/board-view.js +401 -131
- package/dist/face/capsule.js +66 -89
- package/dist/face/cli.js +116 -35
- package/dist/face/declare.js +36 -18
- package/dist/face/gate.js +117 -40
- package/dist/face/init.js +1 -1
- package/dist/face/lifecycle.js +540 -123
- package/dist/face/preview.js +43 -10
- package/dist/face/route-render.js +51 -21
- package/dist/face/termination.js +135 -261
- package/dist/face/words.js +134 -12
- package/dist/infra/atomic.js +15 -0
- package/dist/infra/git.js +25 -0
- package/dist/infra/proc.js +150 -0
- package/dist/infra/round-log.js +104 -0
- package/dist/infra/runtime.js +16 -4
- package/dist/infra/workspace.js +7 -2
- package/dist/render/brief.js +15 -17
- package/dist/render/skeleton.js +41 -28
- package/dist/render/templates.js +128 -84
- package/dist/session/faces.js +47 -20
- package/dist/session/graph.js +13 -37
- package/dist/session/handoff-schema.js +16 -8
- package/dist/session/inflight.js +282 -0
- package/dist/session/ledger.js +581 -136
- package/dist/session/line-identity.js +33 -0
- package/dist/session/next.js +138 -80
- package/dist/session/preflight.js +276 -68
- package/dist/session/round-naming.js +56 -8
- package/dist/session/run.js +317 -78
- package/dist/session/wave.js +94 -14
- package/package.json +13 -3
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
// packages/cdd-engine/src-next/contract/selector-engine.ts
|
|
2
|
+
// P21 §7.5 — the SELECTOR EVALUATION of the tree: `from` a parent selector (or the
|
|
3
|
+
// document root), `walk` one of the nine structural surfaces, apply `match`, then
|
|
4
|
+
// the `when` guard. A selector answers WHERE, never WHAT — the engine returns
|
|
5
|
+
// resolved nodes and the judgment plane decides what they mean.
|
|
6
|
+
//
|
|
7
|
+
// The engine reads the document index (markdown-document.ts) and the block parse
|
|
8
|
+
// (task-block-grammar.ts); it owns no parse of its own, so a selector can never
|
|
9
|
+
// drift from the structure the other two classes read.
|
|
10
|
+
var _a;
|
|
11
|
+
import { MarkdownDocument } from "./markdown-document.js";
|
|
12
|
+
/**
|
|
13
|
+
* SelectorEngine — the composable locator face: one evaluation per declared
|
|
14
|
+
* selector over the document index. Stateless after construction; every read is
|
|
15
|
+
* pure, so one engine serves the parse face and the judgment face alike.
|
|
16
|
+
*
|
|
17
|
+
* Rule zero (over the 200-line class limit): the nine walks stay one class because
|
|
18
|
+
* they share the candidate / match / guard machinery and each is a pure read of the
|
|
19
|
+
* same index — a per-surface split would only move surface area.
|
|
20
|
+
*/
|
|
21
|
+
export class SelectorEngine {
|
|
22
|
+
#document;
|
|
23
|
+
#blocks;
|
|
24
|
+
constructor(document, blocks) {
|
|
25
|
+
this.#document = document;
|
|
26
|
+
this.#blocks = blocks;
|
|
27
|
+
}
|
|
28
|
+
/** The first node matching the selector — null when nothing matches (the
|
|
29
|
+
* presence read). */
|
|
30
|
+
resolve(selector) {
|
|
31
|
+
return this.#candidates(selector)[0] ?? null;
|
|
32
|
+
}
|
|
33
|
+
/** Every node matching the selector, in document order. */
|
|
34
|
+
occurrences(selector) {
|
|
35
|
+
return this.#candidates(selector);
|
|
36
|
+
}
|
|
37
|
+
/** The cell rows of the selector's row matches (the parse face's table read). */
|
|
38
|
+
rows(selector) {
|
|
39
|
+
return this.#candidates(selector).map((candidate) => candidate.cells ?? []);
|
|
40
|
+
}
|
|
41
|
+
/** The table of the section under one heading (a heading line or a heading
|
|
42
|
+
* prefix) — the section-scoped table read the doc parsers and the strategies
|
|
43
|
+
* use. A GFM table ends at a blank line, but a SECTION's table may be split by
|
|
44
|
+
* interior blank lines (the repository's own Phase / Issue inventories are): the
|
|
45
|
+
* section span is the table's boundary, so the section's first table and the
|
|
46
|
+
* headerless continuation runs in it are read as ONE record — header from the
|
|
47
|
+
* first table, body rows concatenated in document order. A separately-headed
|
|
48
|
+
* table is its own table, never blended into this read. Null when the section
|
|
49
|
+
* carries no table. */
|
|
50
|
+
tableUnder(heading) {
|
|
51
|
+
const parents = this.#candidates({ from: "root", walk: "heading", match: heading });
|
|
52
|
+
return _a.#mergeTables(this.#tablesInScope(parents));
|
|
53
|
+
}
|
|
54
|
+
/** The list items whose first child is itself a list — the doubled-marker shape
|
|
55
|
+
* (`- - x`): the outer item carries a nested list and no own prose. A thematic
|
|
56
|
+
* break (`- - -`) parses as a separator, never as a list item, so it is exempt by
|
|
57
|
+
* construction. One node per source line (a nested stack on one line is one
|
|
58
|
+
* doubled-marker fact). */
|
|
59
|
+
doubledMarkerItems() {
|
|
60
|
+
const out = [];
|
|
61
|
+
const seen = new Set();
|
|
62
|
+
for (const node of this.#document.collect("listItem")) {
|
|
63
|
+
const [first] = node.children ?? [];
|
|
64
|
+
if (first?.type !== "list")
|
|
65
|
+
continue;
|
|
66
|
+
const span = MarkdownDocument.spanOf(node);
|
|
67
|
+
if (span === null || seen.has(span.start))
|
|
68
|
+
continue;
|
|
69
|
+
seen.add(span.start);
|
|
70
|
+
const text = this.#document.line(span.start).trim();
|
|
71
|
+
out.push({
|
|
72
|
+
text,
|
|
73
|
+
bare: this.#document.bareOf(span.start),
|
|
74
|
+
lines: [text],
|
|
75
|
+
line: span.start,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** The `## Dependency graph` edges of the document, in document order. */
|
|
81
|
+
edges() {
|
|
82
|
+
return this.#edgeCandidates()
|
|
83
|
+
.filter((candidate) => candidate.edgeClass !== undefined)
|
|
84
|
+
.map((candidate) => {
|
|
85
|
+
const match = /^P(\d+(?:\.\d+)*)\s*->\s*P(\d+(?:\.\d+)*)/.exec(candidate.text);
|
|
86
|
+
return {
|
|
87
|
+
from: `P${match?.[1]}`,
|
|
88
|
+
to: `P${match?.[2]}`,
|
|
89
|
+
hard: candidate.edgeClass !== "soft",
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Whether a text conforms to a selector's match face (the section/registry
|
|
94
|
+
* conformance read — the same match semantics the walks apply). */
|
|
95
|
+
matches(selector, text) {
|
|
96
|
+
return _a.#matchesText(selector.walk, selector.match, text, undefined);
|
|
97
|
+
}
|
|
98
|
+
// -------------------------------------------------------------------------
|
|
99
|
+
// selector evaluation
|
|
100
|
+
// -------------------------------------------------------------------------
|
|
101
|
+
/** The matched candidates of one selector — resolve the parent scope, walk it,
|
|
102
|
+
* then apply the match, the column guard and the `when` guard. */
|
|
103
|
+
#candidates(selector) {
|
|
104
|
+
const parents = selector.from === "root" ? null : this.#candidates(selector.from);
|
|
105
|
+
if (parents !== null && parents.length === 0)
|
|
106
|
+
return [];
|
|
107
|
+
const walked = this.#walk(selector.walk, parents);
|
|
108
|
+
const matched = walked.filter((candidate) => _a.#matchesText(selector.walk, selector.match, candidate.text, candidate.edgeClass));
|
|
109
|
+
return this.#guard(_a.#inColumn(matched, selector.column), selector.when);
|
|
110
|
+
}
|
|
111
|
+
/** The walk over one structural surface, scoped to the parents' line spans when
|
|
112
|
+
* a parent selector was given. */
|
|
113
|
+
#walk(walk, parents) {
|
|
114
|
+
switch (walk) {
|
|
115
|
+
case "frontmatter":
|
|
116
|
+
return this.#walkFrontMatter();
|
|
117
|
+
case "heading":
|
|
118
|
+
return this.#walkHeadings(parents);
|
|
119
|
+
case "table":
|
|
120
|
+
case "row":
|
|
121
|
+
return this.#walkTables(parents);
|
|
122
|
+
case "cell":
|
|
123
|
+
return this.#walkCells(parents);
|
|
124
|
+
case "list":
|
|
125
|
+
return _a.#inScope(this.#listCandidates(), parents);
|
|
126
|
+
case "taskField":
|
|
127
|
+
return _a.#inScope(this.#blocks.fieldCandidates(), parents);
|
|
128
|
+
case "taskStep":
|
|
129
|
+
return _a.#inScope(this.#blocks.stepCandidates(), parents);
|
|
130
|
+
case "graphEdge":
|
|
131
|
+
return _a.#inScope(this.#edgeCandidates(), parents);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** The `when` guard — the walk's "which of these" refinement. */
|
|
135
|
+
#guard(candidates, when) {
|
|
136
|
+
switch (when) {
|
|
137
|
+
case undefined:
|
|
138
|
+
return candidates;
|
|
139
|
+
case "first":
|
|
140
|
+
return candidates.slice(0, 1);
|
|
141
|
+
case "last":
|
|
142
|
+
return candidates.slice(-1);
|
|
143
|
+
case "tableBody":
|
|
144
|
+
return candidates.filter((candidate) => candidate.header !== true);
|
|
145
|
+
case "inTaskBlock":
|
|
146
|
+
return candidates.filter((candidate) => this.#isTaskScoped(candidate));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** Whether a candidate sits inside a `### Task N:` block (the `inTaskBlock`
|
|
150
|
+
* guard's structural fact, read off the block ranges). */
|
|
151
|
+
#isTaskScoped(candidate) {
|
|
152
|
+
return this.#blocks
|
|
153
|
+
.tasks()
|
|
154
|
+
.some((block) => candidate.from >= block.range.start && candidate.to <= block.range.end);
|
|
155
|
+
}
|
|
156
|
+
/** Restrict candidates to the parents' line spans. */
|
|
157
|
+
static #inScope(candidates, parents) {
|
|
158
|
+
if (parents === null)
|
|
159
|
+
return candidates;
|
|
160
|
+
return candidates.filter((candidate) => parents.some((parent) => candidate.from >= parent.from && candidate.to <= parent.to));
|
|
161
|
+
}
|
|
162
|
+
/** The column guard: a cell locator judges only the cell at its declared ordinal. */
|
|
163
|
+
static #inColumn(candidates, column) {
|
|
164
|
+
if (column === undefined)
|
|
165
|
+
return candidates;
|
|
166
|
+
return candidates.filter((candidate) => candidate.column === column);
|
|
167
|
+
}
|
|
168
|
+
/** The match face: a literal (exact line, or a heading anchor's line prefix), a
|
|
169
|
+
* RegExp over the raw line, and — for the graphEdge walk — the edge-class
|
|
170
|
+
* literal (`hard` / `soft`). */
|
|
171
|
+
static #matchesText(walk, match, text, edgeClass) {
|
|
172
|
+
if (match === undefined)
|
|
173
|
+
return true;
|
|
174
|
+
if (match instanceof RegExp)
|
|
175
|
+
return match.test(text);
|
|
176
|
+
if (walk === "graphEdge" && (match === "hard" || match === "soft"))
|
|
177
|
+
return edgeClass === match;
|
|
178
|
+
if (walk === "frontmatter")
|
|
179
|
+
return text === match;
|
|
180
|
+
if (walk === "heading")
|
|
181
|
+
return text === match || text.startsWith(match);
|
|
182
|
+
return text === match || text.startsWith(match);
|
|
183
|
+
}
|
|
184
|
+
/** Merge one section's table with the headerless continuation runs inside it —
|
|
185
|
+
* the base is the first HEADED table, and only a headerless record (a blank-line
|
|
186
|
+
* detached continuation run) is folded in. A separately-headed table is its own
|
|
187
|
+
* read and is never blended into the section's one record. */
|
|
188
|
+
static #mergeTables(tables) {
|
|
189
|
+
const base = tables.find((table) => table.header !== null) ?? tables[0];
|
|
190
|
+
if (base === undefined)
|
|
191
|
+
return null;
|
|
192
|
+
const rows = [
|
|
193
|
+
...base.body,
|
|
194
|
+
...tables
|
|
195
|
+
.filter((table) => table !== base && table.header === null)
|
|
196
|
+
.flatMap((table) => table.body),
|
|
197
|
+
].sort((left, right) => left.from - right.from);
|
|
198
|
+
const body = rows.map((row) => [...(row.cells ?? [])]);
|
|
199
|
+
return { header: base.header?.cells ?? null, body };
|
|
200
|
+
}
|
|
201
|
+
// -------------------------------------------------------------------------
|
|
202
|
+
// the walks
|
|
203
|
+
// -------------------------------------------------------------------------
|
|
204
|
+
#walkFrontMatter() {
|
|
205
|
+
return this.#document.frontMatterKeys().map((entry) => ({
|
|
206
|
+
text: entry.key,
|
|
207
|
+
bare: entry.key,
|
|
208
|
+
lines: [this.#document.line(entry.line)],
|
|
209
|
+
line: entry.line,
|
|
210
|
+
from: entry.line,
|
|
211
|
+
to: entry.line,
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
#walkHeadings(parents) {
|
|
215
|
+
const out = this.#document.headingScopes().map((heading) => ({
|
|
216
|
+
text: heading.text,
|
|
217
|
+
bare: this.#document.bareOf(heading.line),
|
|
218
|
+
lines: [heading.text],
|
|
219
|
+
line: heading.line,
|
|
220
|
+
from: heading.from,
|
|
221
|
+
to: heading.to,
|
|
222
|
+
}));
|
|
223
|
+
return _a.#inScope(out, parents);
|
|
224
|
+
}
|
|
225
|
+
/** The table rows of the addressed tables — the header row plus the body rows
|
|
226
|
+
* (the `row` walk drops the header under its `tableBody` guard). */
|
|
227
|
+
#walkTables(parents) {
|
|
228
|
+
const out = [];
|
|
229
|
+
for (const table of this.#tablesInScope(parents)) {
|
|
230
|
+
// A row candidate carries the TABLE's span, so a child walk scoped to a row
|
|
231
|
+
// still knows which table it belongs to (the row's own line is `line`).
|
|
232
|
+
for (const row of [table.header, ...table.body]) {
|
|
233
|
+
if (row === null)
|
|
234
|
+
continue;
|
|
235
|
+
out.push({ ...row, from: table.from, to: table.to });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return out;
|
|
239
|
+
}
|
|
240
|
+
#walkCells(parents) {
|
|
241
|
+
const out = [];
|
|
242
|
+
if (parents?.every((parent) => parent.cells !== undefined)) {
|
|
243
|
+
for (const parent of parents) {
|
|
244
|
+
out.push(..._a.#cellsOf(parent));
|
|
245
|
+
}
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
for (const table of this.#tablesInScope(null)) {
|
|
249
|
+
for (const row of [table.header, ...table.body]) {
|
|
250
|
+
if (row === null)
|
|
251
|
+
continue;
|
|
252
|
+
out.push(..._a.#cellsOf(row));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return _a.#inScope(out, parents);
|
|
256
|
+
}
|
|
257
|
+
/** The cells of one row candidate as cell candidates (the row's cells are read
|
|
258
|
+
* from the mdast cell nodes — never a `|` split) — each carrying its 1-based
|
|
259
|
+
* column ordinal so a cell locator can be column-precise. */
|
|
260
|
+
static #cellsOf(row) {
|
|
261
|
+
return (row.cells ?? []).map((cell, index) => ({
|
|
262
|
+
text: cell,
|
|
263
|
+
bare: cell,
|
|
264
|
+
lines: row.lines,
|
|
265
|
+
line: row.line,
|
|
266
|
+
cells: row.cells,
|
|
267
|
+
column: index + 1,
|
|
268
|
+
from: row.from,
|
|
269
|
+
to: row.to,
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
/** The list-item candidates — one per source line of every list item. */
|
|
273
|
+
#listCandidates() {
|
|
274
|
+
const out = [];
|
|
275
|
+
for (const node of this.#document.collect("listItem")) {
|
|
276
|
+
const span = MarkdownDocument.spanOf(node);
|
|
277
|
+
if (span === null)
|
|
278
|
+
continue;
|
|
279
|
+
for (let line = span.start; line <= span.end; line += 1) {
|
|
280
|
+
const text = this.#document.line(line).trim();
|
|
281
|
+
if (text === "")
|
|
282
|
+
continue;
|
|
283
|
+
out.push({
|
|
284
|
+
text,
|
|
285
|
+
bare: this.#document.bareOf(line),
|
|
286
|
+
lines: [text],
|
|
287
|
+
line,
|
|
288
|
+
from: span.start,
|
|
289
|
+
to: span.end,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return out;
|
|
294
|
+
}
|
|
295
|
+
/** The graph surface's candidates — one per non-empty body line of a dependency
|
|
296
|
+
* graph section (the repo's graph rows live in a code fence, so the fence lines
|
|
297
|
+
* are skipped and the edge/legend lines are the nodes). A `P<n> -> P<m>` line is
|
|
298
|
+
* classified as a hard or soft edge; a legend/prose line stays unclassified (its
|
|
299
|
+
* shape is the legend element's own declared pattern). */
|
|
300
|
+
#edgeCandidates() {
|
|
301
|
+
const out = [];
|
|
302
|
+
for (const section of this.#document.sections()) {
|
|
303
|
+
if (!/^## Dependency graph/.test(section.text.trim()))
|
|
304
|
+
continue;
|
|
305
|
+
for (let index = 0; index < section.lines.length; index += 1) {
|
|
306
|
+
const text = (section.lines[index] ?? "").trim();
|
|
307
|
+
if (text === "" || /^```/.test(text))
|
|
308
|
+
continue;
|
|
309
|
+
const line = section.line + index + 1;
|
|
310
|
+
const arrow = /^P\d+(\.\d+)*\s*->\s*P\d+(\.\d+)*/.test(text);
|
|
311
|
+
out.push({
|
|
312
|
+
text,
|
|
313
|
+
bare: text,
|
|
314
|
+
lines: [text],
|
|
315
|
+
line,
|
|
316
|
+
from: section.line,
|
|
317
|
+
to: section.line + section.lines.length,
|
|
318
|
+
...(arrow
|
|
319
|
+
? { edgeClass: /\bsoft\b/.test(text.slice(text.indexOf("->"))) ? "soft" : "hard" }
|
|
320
|
+
: {}),
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return out;
|
|
325
|
+
}
|
|
326
|
+
/** The tables scoped to a parent selection — a parent heading's span, or every
|
|
327
|
+
* table when no parent was given. */
|
|
328
|
+
#tablesInScope(parents) {
|
|
329
|
+
return this.#document.tablesInScope(parents);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
_a = SelectorEngine;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// packages/cdd-engine/src-next/contract/selector-spec.ts
|
|
2
|
+
// P21 §7.5 — the selector constructors. A registry element declares its LOCATION
|
|
3
|
+
// as a `Selector` (markdown-tree.ts): where the element lives in a conforming
|
|
4
|
+
// document, never what it means. This module is the one place those queries are
|
|
5
|
+
// built, so a composed query (a cell inside a row inside a table) reads as one
|
|
6
|
+
// expression at the declaration row instead of a nested object literal.
|
|
7
|
+
//
|
|
8
|
+
// The constructors are data factories: they return plain `Selector` values and
|
|
9
|
+
// hold no state, so a declaration row stays flat declared data (the registry is
|
|
10
|
+
// still the single knowledge source). The module imports the selector TYPES only
|
|
11
|
+
// — the tree's runtime never depends on the declaration face.
|
|
12
|
+
/**
|
|
13
|
+
* SelectorSpec — the selector factory face. One static per walk; every factory
|
|
14
|
+
* takes the walk's scope (a parent selector or the document root) plus its match
|
|
15
|
+
* and guard, and returns the composed `Selector`.
|
|
16
|
+
*/
|
|
17
|
+
// biome-ignore lint/complexity/noStaticOnlyClass: the plan-mandated static factory face — the zero-bare-function discipline admits no standalone builder functions.
|
|
18
|
+
export class SelectorSpec {
|
|
19
|
+
/** The document root scope — a walk that starts at the whole document. */
|
|
20
|
+
static ROOT = "root";
|
|
21
|
+
/** A front-matter key locator: the declared key name, located in the head block. */
|
|
22
|
+
static frontmatter(key) {
|
|
23
|
+
return { from: SelectorSpec.ROOT, walk: "frontmatter", match: key };
|
|
24
|
+
}
|
|
25
|
+
/** A heading locator — a literal heading line (or a heading-prefix RegExp),
|
|
26
|
+
* optionally scoped under a parent selector. */
|
|
27
|
+
static heading(match, from = SelectorSpec.ROOT) {
|
|
28
|
+
return { from, walk: "heading", match };
|
|
29
|
+
}
|
|
30
|
+
/** The body rows of the table under a section heading scope. */
|
|
31
|
+
static table(from = SelectorSpec.ROOT, match) {
|
|
32
|
+
return match === undefined ? { from, walk: "table" } : { from, walk: "table", match };
|
|
33
|
+
}
|
|
34
|
+
/** The rows of a table selection — `tableBody` drops the column-header row. */
|
|
35
|
+
static row(from, match, when = "tableBody") {
|
|
36
|
+
const selector = { from, walk: "row", when };
|
|
37
|
+
return match === undefined ? selector : { ...selector, match };
|
|
38
|
+
}
|
|
39
|
+
/** The cells of a row selection (a cell-level value token). `column` is the
|
|
40
|
+
* 1-based ordinal of the cell inside its row — the column guard that keeps an
|
|
41
|
+
* element from judging a sibling column whose value shares its shape. */
|
|
42
|
+
static cell(from, match, column) {
|
|
43
|
+
const selector = { from, walk: "cell", match };
|
|
44
|
+
return column === undefined ? selector : { ...selector, column };
|
|
45
|
+
}
|
|
46
|
+
/** The list items of a scope (the bullet surfaces: constraint deltas, legends). */
|
|
47
|
+
static list(from = SelectorSpec.ROOT, match, when) {
|
|
48
|
+
const selector = when === undefined ? { from, walk: "list" } : { from, walk: "list", when };
|
|
49
|
+
return match === undefined ? selector : { ...selector, match };
|
|
50
|
+
}
|
|
51
|
+
/** One task block's reserved field (the `#### Key` section) — the field heading
|
|
52
|
+
* line and its value lines. */
|
|
53
|
+
static taskField(match, from = SelectorSpec.ROOT, when) {
|
|
54
|
+
const selector = when === undefined ? { from, walk: "taskField" } : { from, walk: "taskField", when };
|
|
55
|
+
return { ...selector, match };
|
|
56
|
+
}
|
|
57
|
+
/** One task block's step leaf. */
|
|
58
|
+
static taskStep(match, when) {
|
|
59
|
+
const selector = when === undefined
|
|
60
|
+
? { from: SelectorSpec.ROOT, walk: "taskStep" }
|
|
61
|
+
: { from: SelectorSpec.ROOT, walk: "taskStep", when };
|
|
62
|
+
return match === undefined ? selector : { ...selector, match };
|
|
63
|
+
}
|
|
64
|
+
/** One dependency-graph edge — a `hard` / `soft` class literal or a line RegExp. */
|
|
65
|
+
static graphEdge(match) {
|
|
66
|
+
return match === undefined
|
|
67
|
+
? { from: SelectorSpec.ROOT, walk: "graphEdge" }
|
|
68
|
+
: { from: SelectorSpec.ROOT, walk: "graphEdge", match };
|
|
69
|
+
}
|
|
70
|
+
/** The walk of a selector (the declaration face's introspection read). */
|
|
71
|
+
static walkOf(selector) {
|
|
72
|
+
return selector.walk;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -15,6 +15,34 @@
|
|
|
15
15
|
//
|
|
16
16
|
// Module-level exports are type definitions + the declared contract constant —
|
|
17
17
|
// zero behavior-carrying bare functions (the plan's zero-bare-function discipline).
|
|
18
|
+
/** The four self-review questions — registered ONCE here (§7.1), the contract plane's
|
|
19
|
+
* single home: the `cdd-spec-writer` and `cdd-plan` `self-review` nodes POINT at this
|
|
20
|
+
* registry and never restate its body, so the consumer surface carries no second copy
|
|
21
|
+
* to drift. Registration only: no digraph fact, no node and no growth-boundary
|
|
22
|
+
* crossing — `cdd-design` gains nothing (its charter/sync path dispatches no round,
|
|
23
|
+
* so its self-check is a session obligation rather than a node). */
|
|
24
|
+
export const SELF_REVIEW_OBLIGATIONS = [
|
|
25
|
+
{
|
|
26
|
+
id: "evidence-before-assertion",
|
|
27
|
+
question: "Evidence before assertion",
|
|
28
|
+
body: "Run the command and read its whole output before claiming completion — an uncommitted artifact is not a finished one.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "two-axis-self-check",
|
|
32
|
+
question: "Two-axis self-check",
|
|
33
|
+
body: "Judge the work on both axes: it follows the repository's existing standards, and it matches the specification the work was authored against.",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "fix-in-round",
|
|
37
|
+
question: "Fix what the self-check finds, in this round",
|
|
38
|
+
body: "A defect the self-check surfaces is fixed on the spot — recording it is not handling it.",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "self-check-is-not-review",
|
|
42
|
+
question: "A self-check never replaces the review",
|
|
43
|
+
body: "The downstream review still has to happen: the self-check removes noise, it does not grant approval.",
|
|
44
|
+
},
|
|
45
|
+
];
|
|
18
46
|
/** The section-heading registry — the strict `## `/`### ` allowlist (public +
|
|
19
47
|
* conditional sections + the node-name heading grammar). */
|
|
20
48
|
const SECTION_REGISTRY = {
|
|
@@ -129,7 +157,7 @@ export const SKILL_ANATOMY = {
|
|
|
129
157
|
loopShapeRule: "the five-chain unified skeleton — every loop-family skill digraph carries the shared NEXT-LOOP hub; the hub carries TWO out-edges (the `until next is terminal` self-loop · the `no next` BLOCKED face) and NO handoff-* terminal — its closure routes through the engine's next face (the dissolved handoff, D33) (digraph↔Node Definitions↔text-reference consistency, shared node names must never drift)",
|
|
130
158
|
enderShapeRule: "the explicit no-self-loop exceptions — cdd-close ends at the finish semantic gate + terminal, cdd-report is a one-shot toolchain, cdd-design is a forked-routing one-pass flow; a NEXT-LOOP self-loop in any of them is a shape violation",
|
|
131
159
|
edgeConditionRule: "decision edges carry explicit condition labels — the NEXT-LOOP hub's out-edges ARE the pinned loop conditions (`until next is terminal` → self-loop · `no next` → BLOCKED) and every edge out of a decision node is condition-labeled; an unlabeled decision edge, a bare NEXT-LOOP self-loop, or a NEXT-LOOP out-edge count/condition that deviates from the pinned shape is a shape violation (the edge-zero-state-label rule retired v1.20)",
|
|
132
|
-
routeFactRule: "next
|
|
160
|
+
routeFactRule: "the `next:` face renders through the word table's template rows — a pipeline `ref` renders the `route to {ref} skill` instruction phrase, a `literal` a cdd command string, a `done` the bare terminal word; a full cdd command string never follows the next: token on a line; BLOCKED/TIMEOUT carry no next line and are not consumed as next steps",
|
|
133
161
|
},
|
|
134
162
|
// The engine-lexicon pinned condition words (the v1.20 word-table pin) — the phrase
|
|
135
163
|
// set the digraph's loop/closure decision edges may carry: the NEXT-LOOP phrases +
|