@oscaner-skills/cdd-engine 3.1.0 → 4.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.
- package/README.md +9 -1
- package/README.zh-CN.md +10 -2
- package/dist/contract/declare.js +52 -59
- package/dist/contract/doc.js +31 -35
- package/dist/contract/frontmatter.js +10 -13
- package/dist/contract/invariants.js +172 -96
- package/dist/contract/judge.js +6 -3
- package/dist/contract/lint.js +4 -3
- package/dist/contract/project.js +15 -15
- package/dist/face/board-view.js +203 -242
- package/dist/face/cli.js +164 -56
- package/dist/face/declare.js +5 -6
- package/dist/face/host.js +1 -1
- package/dist/face/lifecycle.js +80 -79
- package/dist/face/preview.js +1 -1
- package/dist/face/termination.js +6 -0
- package/dist/face/words.js +29 -2
- package/dist/infra/doc-roots.js +1 -0
- package/dist/infra/runtime.js +4 -13
- package/dist/infra/slug-index.js +325 -0
- package/dist/infra/workspace.js +3 -76
- package/dist/render/skeleton.js +21 -30
- package/dist/render/templates.js +48 -23
- package/dist/session/handoff-schema.js +85 -73
- package/dist/session/ledger.js +24 -16
- package/dist/session/next.js +1 -1
- package/dist/session/preflight.js +27 -24
- package/dist/session/round-naming.js +2 -2
- package/dist/session/run.js +14 -14
- package/dist/session/wave.js +30 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,10 +32,18 @@ Global option: `--dry-run` — preview the next dispatch step and its expected a
|
|
|
32
32
|
| `base` | `cdd base set\|get` | Read/write the `base.json` artifact (single CDD `--plan` target) |
|
|
33
33
|
| `schema` | `cdd schema get <type>` | Print the canonical doc-structure schema (discovery-only, zero enforcement) |
|
|
34
34
|
| `issue` | `cdd issue render` | Render an aggregate issue body from stdin findings (pure rendering, zero enforcement) |
|
|
35
|
-
| `board` | `cdd board <
|
|
35
|
+
| `board` | `cdd board --plan <path> / --spec <path>` | Render the entry document's progress board (overall/spec/plan/wave/branch; pure read, zero enforcement) |
|
|
36
36
|
|
|
37
37
|
Use `cdd <command> --help` for a command's full option list (for example `cdd review --tasks` / `--spec` / `--plan` / `--round`).
|
|
38
38
|
|
|
39
|
+
## Migration
|
|
40
|
+
|
|
41
|
+
Document identity is the front-matter `slug:` key. This retired the file-name-derived identity: a **major breaking** change with **zero dual-read** — the retired keys are simply not read, and the retired entry form is not accepted.
|
|
42
|
+
|
|
43
|
+
- **Board entry is a document path.** `cdd board --plan <path>` / `cdd board --spec <path>` replace the retired positional-slug form.
|
|
44
|
+
- **Identity is declared, not derived.** A document is keyed by the `slug:` its front matter carries — the file name carries no identity meaning at all. The retired path keys are no longer read (leaving one in place is inert, not an error); a plan's program chain resolves through the identity document sharing its `slug:` — a phase-spec's `program:` names its overall, while an overall or single-spec is its own chain root.
|
|
45
|
+
- **Per-run workspaces follow the key.** The `.kairos/cdd/<slug>/` directory is keyed by the plan document's `slug:`. A directory left under a retired file-name-derived key is **not reused** by any run — no run resumes or migrates it. A reporting session's ledger scan still reads its records, so delete it by hand once you no longer need that history.
|
|
46
|
+
|
|
39
47
|
## Development
|
|
40
48
|
|
|
41
49
|
The package lives in the [Oscaner/skills](https://github.com/Oscaner/skills) monorepo at `packages/cdd-engine` (TypeScript, emitted with `tsc -p tsconfig.build.json`, tested with vitest; tests are colocated at `src-next/**/__tests__/**/*.test.ts`).
|
package/README.zh-CN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @oscaner-skills/cdd-engine
|
|
2
2
|
|
|
3
|
-
> 🔗 **Mirror 同步声明**:本文件(`README.zh-CN.md`)是英文源 [README.md](README.md) 的同步中文 **mirror**——顶层章节集合逐条一致,节点按位置一一对应;本文为对外宣讲面的中文口径,语义以英文源为准。**同步时间戳**:2026-
|
|
3
|
+
> 🔗 **Mirror 同步声明**:本文件(`README.zh-CN.md`)是英文源 [README.md](README.md) 的同步中文 **mirror**——顶层章节集合逐条一致,节点按位置一一对应;本文为对外宣讲面的中文口径,语义以英文源为准。**同步时间戳**:2026-10-21。
|
|
4
4
|
|
|
5
5
|
[English](README.md) | [中文](README.zh-CN.md)
|
|
6
6
|
|
|
@@ -34,10 +34,18 @@ npm install @oscaner-skills/cdd-engine
|
|
|
34
34
|
| `base` | `cdd base set\|get` | 读写 `base.json` 产物(单一 CDD `--plan` 目标) |
|
|
35
35
|
| `schema` | `cdd schema get <type>` | 打印 canonical 文档结构 schema(发现型、零执法) |
|
|
36
36
|
| `issue` | `cdd issue render` | 依据 stdin 发现渲染聚合 issue 正文(纯渲染、零执法) |
|
|
37
|
-
| `board` | `cdd board <
|
|
37
|
+
| `board` | `cdd board --plan <path> / --spec <path>` | 渲染入口文档的进度板(overall/spec/plan/wave/branch;纯读、零执法) |
|
|
38
38
|
|
|
39
39
|
用 `cdd <command> --help` 查看某命令的完整选项列表(例如 `cdd review --tasks` / `--spec` / `--plan` / `--round`)。
|
|
40
40
|
|
|
41
|
+
## 迁移
|
|
42
|
+
|
|
43
|
+
文档身份即 front-matter 的 `slug:` 键。这退役了「按文件名推演文档身份」:属于 **major breaking** 变更,且**零双读**——旧键不再被读取,旧入口形也不再被接受。
|
|
44
|
+
|
|
45
|
+
- **board 入口改为文档路径**:`cdd board --plan <path>` / `cdd board --spec <path>` 取代退役的 positional slug 形。
|
|
46
|
+
- **身份是声明出来的,不是推演出来的**:文档由 front-matter 所写的 `slug:` 定位,文件名不承载任何身份含义。旧路径键不再被读取(留着是惰性的,不报错);plan 的程序链经「与它同 slug 的身份文档」解析——phase-spec 的 `program:` 指向其 overall,而 overall / single-spec 自身即链根。
|
|
47
|
+
- **按 run 的工作区随键走**:`.kairos/cdd/<slug>/` 目录以 plan 文档的 `slug:` 为键。遗留在旧键命名下的目录**不复用**——没有 run 会续用或迁移它。但报告会话的台账扫描仍会读其记录,故在不再需要那段历史时手动删除。
|
|
48
|
+
|
|
41
49
|
## 开发说明
|
|
42
50
|
|
|
43
51
|
包位于 [Oscaner/skills](https://github.com/Oscaner/skills) monorepo 的 `packages/cdd-engine`(TypeScript,`tsc -p tsconfig.build.json` 发布构建,vitest 测试;测试与源码同地放置于 `src-next/**/__tests__/**/*.test.ts`)。
|
package/dist/contract/declare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/cdd-engine/src-next/contract/declare.ts
|
|
2
2
|
// T2 — the element-registry declaration (the design spec's single-declaration root).
|
|
3
3
|
//
|
|
4
|
-
// Each doc type (overall
|
|
4
|
+
// Each doc type (overall / plan / phase-spec / single-spec) carries one typed
|
|
5
5
|
// element registry:
|
|
6
6
|
// flat declared data, one row per element — anchor token · presence · value
|
|
7
7
|
// pattern · ref kind · home surface. The registry is simultaneously the
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// The element lines are enumerated from the methodology skeleton semantics (the
|
|
14
14
|
// machine skeleton of each doc type as pinned by the four repo schema JSONs,
|
|
15
15
|
// read as steady contract data) — freshly declared anchors, never cut from the
|
|
16
|
-
// old tree's sources. Counts stand at overall
|
|
16
|
+
// old tree's sources. Counts stand at overall 43 / plan 28 / phase-spec 27 /
|
|
17
17
|
// single-spec 16, each within the post-frontmatter band (single-spec below 20 —
|
|
18
18
|
// the lightweight-scaffold charter) and each element carrying all five fields
|
|
19
19
|
// (a completeness contract enforced by the array shape below and by the test
|
|
@@ -33,8 +33,7 @@ const REF_KIND_VALUES = [
|
|
|
33
33
|
"markdown-link",
|
|
34
34
|
"phase-id",
|
|
35
35
|
"issue-ref",
|
|
36
|
-
"
|
|
37
|
-
"parent-program",
|
|
36
|
+
"slug-ref",
|
|
38
37
|
"task-id",
|
|
39
38
|
];
|
|
40
39
|
const HOME_VALUES = [
|
|
@@ -50,11 +49,20 @@ const HOME_VALUES = [
|
|
|
50
49
|
"conditional",
|
|
51
50
|
];
|
|
52
51
|
export const DOC_TYPE_VALUES = [
|
|
53
|
-
"overall
|
|
52
|
+
"overall",
|
|
54
53
|
"plan",
|
|
55
54
|
"phase-spec",
|
|
56
55
|
"single-spec",
|
|
57
56
|
];
|
|
57
|
+
/** The legal `slug:` value shape (spec §2.1) — 1–128 characters, an alphanumeric
|
|
58
|
+
* first character, then alphanumerics / `.` / `_` / `-`. The pattern rejects the
|
|
59
|
+
* directory-escape values (`.` / `..`, path separators, whitespace) and the
|
|
60
|
+
* Windows reserved characters at the value surface, because a slug doubles as a
|
|
61
|
+
* workspace directory name. One declared constant — the `slug:` identity rows and
|
|
62
|
+
* the phase-spec `program:` reference share the same value domain, and the
|
|
63
|
+
* identity index (`SlugIndex.isLegalSlug`) compiles this SAME source string, so
|
|
64
|
+
* the shape judgment has one grammar (this module is the leaf both planes read). */
|
|
65
|
+
export const SLUG_VALUE_PATTERN = "^(?=.{1,128}$)[A-Za-z0-9][A-Za-z0-9._-]*$";
|
|
58
66
|
/**
|
|
59
67
|
* The registry guards — the runtime contract that narrows an unknown candidate
|
|
60
68
|
* to a registry element or a full element registry. A static predicate class
|
|
@@ -99,9 +107,9 @@ export class RegistryGuard {
|
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
// ---------------------------------------------------------------------------
|
|
102
|
-
// overall
|
|
110
|
+
// overall — the charter section surface
|
|
103
111
|
// ---------------------------------------------------------------------------
|
|
104
|
-
const
|
|
112
|
+
const OVERALL_ELEMENTS = [
|
|
105
113
|
// Header block — YAML front-matter keys (a frontmatter-home anchor IS the
|
|
106
114
|
// front-matter key name; the value patterns are scalar shapes, §2.3).
|
|
107
115
|
{
|
|
@@ -132,6 +140,13 @@ const OVERALL_SPEC_ELEMENTS = [
|
|
|
132
140
|
refKind: "none",
|
|
133
141
|
home: "frontmatter",
|
|
134
142
|
},
|
|
143
|
+
{
|
|
144
|
+
anchor: "slug",
|
|
145
|
+
presence: "required",
|
|
146
|
+
valuePattern: SLUG_VALUE_PATTERN,
|
|
147
|
+
refKind: "none",
|
|
148
|
+
home: "frontmatter",
|
|
149
|
+
},
|
|
135
150
|
{
|
|
136
151
|
anchor: "status",
|
|
137
152
|
presence: "required",
|
|
@@ -156,7 +171,7 @@ const OVERALL_SPEC_ELEMENTS = [
|
|
|
156
171
|
},
|
|
157
172
|
{
|
|
158
173
|
anchor: "## File paths",
|
|
159
|
-
presence: "
|
|
174
|
+
presence: "optional",
|
|
160
175
|
valuePattern: "^## File paths$",
|
|
161
176
|
refKind: "none",
|
|
162
177
|
home: "section",
|
|
@@ -329,7 +344,7 @@ const OVERALL_SPEC_ELEMENTS = [
|
|
|
329
344
|
anchor: "Design spec cell",
|
|
330
345
|
presence: "required",
|
|
331
346
|
valuePattern: "^(\\[[^\\]]+\\]\\([^)]+\\)|P\\d+(\\.\\d+)*-design|Done|\\[Pending\\])$",
|
|
332
|
-
refKind: "
|
|
347
|
+
refKind: "none",
|
|
333
348
|
home: "table",
|
|
334
349
|
},
|
|
335
350
|
{
|
|
@@ -364,7 +379,7 @@ const OVERALL_SPEC_ELEMENTS = [
|
|
|
364
379
|
// File paths artifact table.
|
|
365
380
|
{
|
|
366
381
|
anchor: "File path row",
|
|
367
|
-
presence: "
|
|
382
|
+
presence: "optional",
|
|
368
383
|
valuePattern: "^\\| [^|]+ \\| `[^`]+` \\|$",
|
|
369
384
|
refKind: "none",
|
|
370
385
|
home: "table",
|
|
@@ -402,7 +417,7 @@ const OVERALL_SPEC_ELEMENTS = [
|
|
|
402
417
|
anchor: "Design claim token",
|
|
403
418
|
presence: "conditional",
|
|
404
419
|
valuePattern: "^P\\d+(\\.\\d+)*-design$",
|
|
405
|
-
refKind: "
|
|
420
|
+
refKind: "phase-id",
|
|
406
421
|
home: "table",
|
|
407
422
|
},
|
|
408
423
|
{
|
|
@@ -449,31 +464,10 @@ const PLAN_ELEMENTS = [
|
|
|
449
464
|
home: "frontmatter",
|
|
450
465
|
},
|
|
451
466
|
{
|
|
452
|
-
anchor: "
|
|
453
|
-
presence: "required",
|
|
454
|
-
valuePattern: "^.+$",
|
|
455
|
-
refKind: "spec-ref",
|
|
456
|
-
home: "frontmatter",
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
anchor: "parent-program",
|
|
467
|
+
anchor: "slug",
|
|
460
468
|
presence: "required",
|
|
461
|
-
valuePattern:
|
|
462
|
-
refKind: "
|
|
463
|
-
home: "frontmatter",
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
anchor: "parent-version",
|
|
467
|
-
presence: "optional",
|
|
468
|
-
valuePattern: "^v\\d+\\.\\d+$",
|
|
469
|
-
refKind: "version-lineage",
|
|
470
|
-
home: "frontmatter",
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
anchor: "depends-on",
|
|
474
|
-
presence: "optional",
|
|
475
|
-
valuePattern: "^.+$",
|
|
476
|
-
refKind: "phase-id",
|
|
469
|
+
valuePattern: SLUG_VALUE_PATTERN,
|
|
470
|
+
refKind: "none",
|
|
477
471
|
home: "frontmatter",
|
|
478
472
|
},
|
|
479
473
|
{
|
|
@@ -661,8 +655,7 @@ const PLAN_ELEMENTS = [
|
|
|
661
655
|
const PHASE_SPEC_ELEMENTS = [
|
|
662
656
|
// Header block — YAML front-matter keys (the frontmatter-home anchor IS the
|
|
663
657
|
// key name). The old line-scan phase-id fallback is retired — its anchor never
|
|
664
|
-
// appeared in any document literal and it had zero consumers
|
|
665
|
-
// reference class rides the plan `depends-on` row.
|
|
658
|
+
// appeared in any document literal and it had zero consumers.
|
|
666
659
|
{
|
|
667
660
|
anchor: "title",
|
|
668
661
|
presence: "required",
|
|
@@ -692,24 +685,31 @@ const PHASE_SPEC_ELEMENTS = [
|
|
|
692
685
|
home: "frontmatter",
|
|
693
686
|
},
|
|
694
687
|
{
|
|
695
|
-
anchor: "
|
|
688
|
+
anchor: "slug",
|
|
696
689
|
presence: "required",
|
|
697
|
-
valuePattern:
|
|
690
|
+
valuePattern: SLUG_VALUE_PATTERN,
|
|
698
691
|
refKind: "none",
|
|
699
692
|
home: "frontmatter",
|
|
700
693
|
},
|
|
701
694
|
{
|
|
702
|
-
anchor: "
|
|
695
|
+
anchor: "program",
|
|
703
696
|
presence: "required",
|
|
704
|
-
valuePattern:
|
|
697
|
+
valuePattern: SLUG_VALUE_PATTERN,
|
|
698
|
+
refKind: "slug-ref",
|
|
699
|
+
home: "frontmatter",
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
anchor: "status",
|
|
703
|
+
presence: "required",
|
|
704
|
+
valuePattern: "^(Draft|Approved|Plan pending|Shipped)$",
|
|
705
705
|
refKind: "none",
|
|
706
706
|
home: "frontmatter",
|
|
707
707
|
},
|
|
708
708
|
{
|
|
709
|
-
anchor: "
|
|
709
|
+
anchor: "author",
|
|
710
710
|
presence: "required",
|
|
711
711
|
valuePattern: "^.+$",
|
|
712
|
-
refKind: "
|
|
712
|
+
refKind: "none",
|
|
713
713
|
home: "frontmatter",
|
|
714
714
|
},
|
|
715
715
|
{
|
|
@@ -719,13 +719,6 @@ const PHASE_SPEC_ELEMENTS = [
|
|
|
719
719
|
refKind: "version-lineage",
|
|
720
720
|
home: "frontmatter",
|
|
721
721
|
},
|
|
722
|
-
{
|
|
723
|
-
anchor: "depends-on",
|
|
724
|
-
presence: "required",
|
|
725
|
-
valuePattern: "^.+$",
|
|
726
|
-
refKind: "none",
|
|
727
|
-
home: "frontmatter",
|
|
728
|
-
},
|
|
729
722
|
// The double-layer design body.
|
|
730
723
|
{
|
|
731
724
|
anchor: "## Design",
|
|
@@ -865,10 +858,10 @@ const PHASE_SPEC_ELEMENTS = [
|
|
|
865
858
|
// The fourth doc type — the repair/ruling-oriented free-form document (the
|
|
866
859
|
// 2026-09-28-cdd-review-contract-fix "single-spec" form). Deliberately lighter
|
|
867
860
|
// than phase-spec: a front-matter key set (title / doc-type / version / date /
|
|
868
|
-
// status / author /
|
|
861
|
+
// status / author / issues), four prose body sections and the
|
|
869
862
|
// change-history lineage. No `### N.` double-layer outline (the free-form has no
|
|
870
|
-
// numbered design groups), no
|
|
871
|
-
//
|
|
863
|
+
// numbered design groups), no `program:` key (a single-spec is an independent
|
|
864
|
+
// program — it names no parent overall). The fixed section sequence runs in
|
|
872
865
|
// document order.
|
|
873
866
|
const SINGLE_SPEC_ELEMENTS = [
|
|
874
867
|
// Header block — YAML front-matter keys (the frontmatter-home anchor IS the
|
|
@@ -903,21 +896,21 @@ const SINGLE_SPEC_ELEMENTS = [
|
|
|
903
896
|
home: "frontmatter",
|
|
904
897
|
},
|
|
905
898
|
{
|
|
906
|
-
anchor: "
|
|
899
|
+
anchor: "slug",
|
|
907
900
|
presence: "required",
|
|
908
|
-
valuePattern:
|
|
901
|
+
valuePattern: SLUG_VALUE_PATTERN,
|
|
909
902
|
refKind: "none",
|
|
910
903
|
home: "frontmatter",
|
|
911
904
|
},
|
|
912
905
|
{
|
|
913
|
-
anchor: "
|
|
906
|
+
anchor: "status",
|
|
914
907
|
presence: "required",
|
|
915
|
-
valuePattern: "
|
|
908
|
+
valuePattern: "^(Draft|Approved|In progress|Complete)$",
|
|
916
909
|
refKind: "none",
|
|
917
910
|
home: "frontmatter",
|
|
918
911
|
},
|
|
919
912
|
{
|
|
920
|
-
anchor: "
|
|
913
|
+
anchor: "author",
|
|
921
914
|
presence: "required",
|
|
922
915
|
valuePattern: "^.+$",
|
|
923
916
|
refKind: "none",
|
|
@@ -991,7 +984,7 @@ const SINGLE_SPEC_ELEMENTS = [
|
|
|
991
984
|
];
|
|
992
985
|
/** The four declared registries — the judge's judgment data and the projection surfaces' derivation source. */
|
|
993
986
|
export const declaredRegistries = {
|
|
994
|
-
|
|
987
|
+
overall: { docType: "overall", elements: OVERALL_ELEMENTS },
|
|
995
988
|
plan: { docType: "plan", elements: PLAN_ELEMENTS },
|
|
996
989
|
"phase-spec": { docType: "phase-spec", elements: PHASE_SPEC_ELEMENTS },
|
|
997
990
|
"single-spec": { docType: "single-spec", elements: SINGLE_SPEC_ELEMENTS },
|
package/dist/contract/doc.js
CHANGED
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
// · projection — each class consumes the derived projection face (project.ts):
|
|
18
18
|
// the slices (parse regexes) and the shape (section skeleton) of
|
|
19
19
|
// its own doc type are the locating data every extraction walks.
|
|
20
|
-
// · chain root — the
|
|
21
|
-
// scalars `
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
// never to a DocType method.
|
|
20
|
+
// · chain root — the chain anchors of the document (the phase-spec head
|
|
21
|
+
// scalars `program:` / `parent-version:` and the overall's
|
|
22
|
+
// Phase-inventory rows as the chain's anchor set) are extracted
|
|
23
|
+
// into a ChainRoot and LEFT as an interface — the resolution
|
|
24
|
+
// judgment belongs to the cross-doc-chain / slug-ref
|
|
25
|
+
// invariants, never to a DocType method. A plan carries no
|
|
26
|
+
// chain key: its ownership chain is implied by the identity
|
|
27
|
+
// document sharing its `slug:` (zero second declaration).
|
|
26
28
|
//
|
|
27
29
|
// Module-level exports are types / the class family / one composition root — zero
|
|
28
30
|
// behavior-carrying bare functions (the plan's zero-bare-function discipline).
|
|
@@ -309,7 +311,7 @@ export class DocType extends MarkdownPrimitives {
|
|
|
309
311
|
* graph, and exposes the Phase-inventory rows as the chain's anchor set.
|
|
310
312
|
*/
|
|
311
313
|
export class OverallDocType extends DocType {
|
|
312
|
-
docTypeName = "overall
|
|
314
|
+
docTypeName = "overall";
|
|
313
315
|
parse(lines, head = null) {
|
|
314
316
|
const title = head?.title ?? "";
|
|
315
317
|
const sections = this.sections(lines);
|
|
@@ -322,19 +324,17 @@ export class OverallDocType extends DocType {
|
|
|
322
324
|
const graphEdges = this.#graphEdges(sections);
|
|
323
325
|
const phases = this.#phaseRows(tables["Phase inventory"]);
|
|
324
326
|
return {
|
|
325
|
-
docType: "overall
|
|
327
|
+
docType: "overall",
|
|
326
328
|
head,
|
|
327
329
|
title,
|
|
328
330
|
sections,
|
|
329
331
|
tables,
|
|
330
332
|
graphEdges,
|
|
331
333
|
chain: {
|
|
332
|
-
docType: "overall
|
|
333
|
-
|
|
334
|
-
specLink: null,
|
|
334
|
+
docType: "overall",
|
|
335
|
+
programLink: null,
|
|
335
336
|
parentTokens: [],
|
|
336
337
|
phases,
|
|
337
|
-
dependsOn: null,
|
|
338
338
|
},
|
|
339
339
|
};
|
|
340
340
|
}
|
|
@@ -411,8 +411,9 @@ export class OverallDocType extends DocType {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
/**
|
|
414
|
-
* The plan doc type — parses the head
|
|
415
|
-
*
|
|
414
|
+
* The plan doc type — parses the head and the `### Task N:` task blocks. A plan
|
|
415
|
+
* carries no chain key of its own: its ownership chain is implied by the identity
|
|
416
|
+
* document sharing its `slug:` (the same-slug Class-A arm).
|
|
416
417
|
*/
|
|
417
418
|
export class PlanDocType extends DocType {
|
|
418
419
|
docTypeName = "plan";
|
|
@@ -428,17 +429,15 @@ export class PlanDocType extends DocType {
|
|
|
428
429
|
chain: this.chainRoot(head),
|
|
429
430
|
};
|
|
430
431
|
}
|
|
431
|
-
/** The plan's cross-doc chain root — the
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
chainRoot(
|
|
432
|
+
/** The plan's cross-doc chain root — the degraded face: the plan declares no
|
|
433
|
+
* parent/spec key (the same-slug identity document is its chain), so it carries
|
|
434
|
+
* no chain anchor at all. */
|
|
435
|
+
chainRoot(_head) {
|
|
435
436
|
return {
|
|
436
437
|
docType: "plan",
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
parentTokens: head === null || head.parentVersion === null ? [] : [head.parentVersion],
|
|
438
|
+
programLink: null,
|
|
439
|
+
parentTokens: [],
|
|
440
440
|
phases: [],
|
|
441
|
-
dependsOn: head?.dependsOn ?? null,
|
|
442
441
|
};
|
|
443
442
|
}
|
|
444
443
|
}
|
|
@@ -509,16 +508,15 @@ export class PhaseSpecDocType extends DocType {
|
|
|
509
508
|
close();
|
|
510
509
|
return groups;
|
|
511
510
|
}
|
|
512
|
-
/** The phase-spec's cross-doc chain root: the
|
|
513
|
-
* `parent-version:`
|
|
511
|
+
/** The phase-spec's cross-doc chain root: the `program:` slug reference plus the
|
|
512
|
+
* `parent-version:` lineage tokens. The reference is a SLUG (the parent
|
|
513
|
+
* overall's `slug:`), so it never rides the file-path resolution faces. */
|
|
514
514
|
chainRoot(head) {
|
|
515
515
|
return {
|
|
516
516
|
docType: "phase-spec",
|
|
517
|
-
|
|
518
|
-
specLink: null,
|
|
517
|
+
programLink: head === null || head.program === null ? null : { target: head.program },
|
|
519
518
|
parentTokens: head === null || head.parentVersion === null ? [] : [head.parentVersion],
|
|
520
519
|
phases: [],
|
|
521
|
-
dependsOn: head?.dependsOn ?? null,
|
|
522
520
|
};
|
|
523
521
|
}
|
|
524
522
|
}
|
|
@@ -526,7 +524,7 @@ export class PhaseSpecDocType extends DocType {
|
|
|
526
524
|
* The single-spec doc type — parses the header five-tuple surface and the prose
|
|
527
525
|
* section surface. A single-spec carries no parent overall and no `### N.`
|
|
528
526
|
* design outline, so the parse degrades the chain root to its null-link face
|
|
529
|
-
* (
|
|
527
|
+
* (no chain anchor rides the head).
|
|
530
528
|
*/
|
|
531
529
|
export class SingleSpecDocType extends DocType {
|
|
532
530
|
docTypeName = "single-spec";
|
|
@@ -540,16 +538,14 @@ export class SingleSpecDocType extends DocType {
|
|
|
540
538
|
chain: this.chainRoot(head),
|
|
541
539
|
};
|
|
542
540
|
}
|
|
543
|
-
/** The single-spec chain root — the degraded face: no
|
|
544
|
-
*
|
|
545
|
-
chainRoot(
|
|
541
|
+
/** The single-spec chain root — the degraded face: no program link and no
|
|
542
|
+
* lineage token (the independent-program shape). */
|
|
543
|
+
chainRoot(_head) {
|
|
546
544
|
return {
|
|
547
545
|
docType: "single-spec",
|
|
548
|
-
|
|
549
|
-
specLink: null,
|
|
546
|
+
programLink: null,
|
|
550
547
|
parentTokens: [],
|
|
551
548
|
phases: [],
|
|
552
|
-
dependsOn: head?.dependsOn ?? null,
|
|
553
549
|
};
|
|
554
550
|
}
|
|
555
551
|
}
|
|
@@ -558,7 +554,7 @@ export class SingleSpecDocType extends DocType {
|
|
|
558
554
|
// ---------------------------------------------------------------------------
|
|
559
555
|
/** The composed doc-type parsers — the judge's ctx-loading parsers (one per doc key). */
|
|
560
556
|
export const docTypeParsers = {
|
|
561
|
-
|
|
557
|
+
overall: new OverallDocType("overall"),
|
|
562
558
|
plan: new PlanDocType("plan"),
|
|
563
559
|
"phase-spec": new PhaseSpecDocType("phase-spec"),
|
|
564
560
|
"single-spec": new SingleSpecDocType("single-spec"),
|
|
@@ -71,6 +71,15 @@ export class FrontMatterHead {
|
|
|
71
71
|
get docType() {
|
|
72
72
|
return this.value("doc-type");
|
|
73
73
|
}
|
|
74
|
+
/** The document identity key (`slug:`) — the identity index's grouping fact,
|
|
75
|
+
* never derived from the file name. */
|
|
76
|
+
get slug() {
|
|
77
|
+
return this.value("slug");
|
|
78
|
+
}
|
|
79
|
+
/** The phase-spec's program slug reference (`program:`) — a slug, not a path. */
|
|
80
|
+
get program() {
|
|
81
|
+
return this.value("program");
|
|
82
|
+
}
|
|
74
83
|
/** The version token (`version:`, the `v<major>.<minor>` form). */
|
|
75
84
|
get version() {
|
|
76
85
|
return this.value("version");
|
|
@@ -87,22 +96,10 @@ export class FrontMatterHead {
|
|
|
87
96
|
get author() {
|
|
88
97
|
return this.value("author");
|
|
89
98
|
}
|
|
90
|
-
/** The
|
|
91
|
-
get spec() {
|
|
92
|
-
return this.value("spec");
|
|
93
|
-
}
|
|
94
|
-
/** The Class-B parent-overall target path (`parent-program:`). */
|
|
95
|
-
get parentProgram() {
|
|
96
|
-
return this.value("parent-program");
|
|
97
|
-
}
|
|
98
|
-
/** The Class-B version token (`parent-version:`, the `v<major>.<minor>` form). */
|
|
99
|
+
/** The program version token (`parent-version:`, the `v<major>.<minor>` form). */
|
|
99
100
|
get parentVersion() {
|
|
100
101
|
return this.value("parent-version");
|
|
101
102
|
}
|
|
102
|
-
/** The `depends-on:` front-matter key value. */
|
|
103
|
-
get dependsOn() {
|
|
104
|
-
return this.value("depends-on");
|
|
105
|
-
}
|
|
106
103
|
/** The plan base-line value (`base:`). */
|
|
107
104
|
get base() {
|
|
108
105
|
return this.value("base");
|