@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.
Files changed (120) hide show
  1. package/README.md +11 -10
  2. package/README.zh-CN.md +11 -10
  3. package/package.json +16 -22
  4. package/src-next/__tests__/bin.test.ts +128 -0
  5. package/src-next/__tests__/dead-decl.guard.test.ts +39 -0
  6. package/src-next/__tests__/floor.guard.test.ts +69 -0
  7. package/src-next/__tests__/issue-body.guard.test.ts +66 -0
  8. package/src-next/__tests__/phase-suffix.guard.test.ts +72 -0
  9. package/src-next/__tests__/smoke.integration.test.ts +185 -0
  10. package/src-next/__tests__/support/strip-comments.ts +99 -0
  11. package/src-next/__tests__/zero-dep.test.ts +94 -0
  12. package/src-next/bin.ts +61 -0
  13. package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +256 -0
  14. package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +165 -0
  15. package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +190 -0
  16. package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +106 -0
  17. package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +240 -0
  18. package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +165 -0
  19. package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +190 -0
  20. package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +100 -0
  21. package/src-next/contract/__tests__/declare.test.ts +481 -0
  22. package/src-next/contract/__tests__/doc.test.ts +527 -0
  23. package/src-next/contract/__tests__/dockey.guard.test.ts +58 -0
  24. package/src-next/contract/__tests__/edge-conditions.guard.test.ts +81 -0
  25. package/src-next/contract/__tests__/frontmatter.test.ts +164 -0
  26. package/src-next/contract/__tests__/judge.test.ts +1111 -0
  27. package/src-next/contract/__tests__/lint.test.ts +324 -0
  28. package/src-next/contract/__tests__/project.test.ts +460 -0
  29. package/src-next/contract/__tests__/structure-pin.test.ts +186 -0
  30. package/src-next/contract/__tests__/translate.test.ts +96 -0
  31. package/src-next/contract/declare.ts +1071 -0
  32. package/src-next/contract/doc.ts +816 -0
  33. package/src-next/contract/frontmatter.ts +233 -0
  34. package/src-next/contract/home-extractors.ts +397 -0
  35. package/src-next/contract/invariants.ts +1413 -0
  36. package/src-next/contract/judge.ts +151 -0
  37. package/src-next/contract/lint.ts +239 -0
  38. package/src-next/contract/project.ts +656 -0
  39. package/src-next/contract/skill-anatomy.ts +301 -0
  40. package/src-next/contract/translate.ts +113 -0
  41. package/src-next/face/__tests__/board-view.test.ts +1151 -0
  42. package/src-next/face/__tests__/capsule.test.ts +300 -0
  43. package/src-next/face/__tests__/channel-closure.guard.test.ts +129 -0
  44. package/src-next/face/__tests__/cli.test.ts +4897 -0
  45. package/src-next/face/__tests__/face.test.ts +289 -0
  46. package/src-next/face/__tests__/graph-view.test.ts +61 -0
  47. package/src-next/face/__tests__/host.test.ts +24 -0
  48. package/src-next/face/__tests__/install-rows.guard.test.ts +58 -0
  49. package/src-next/face/__tests__/negation.ts +6 -0
  50. package/src-next/face/__tests__/preview.test.ts +374 -0
  51. package/src-next/face/__tests__/projection.test.ts +303 -0
  52. package/src-next/face/__tests__/repo-root.guard.test.ts +120 -0
  53. package/src-next/face/__tests__/termination.test.ts +650 -0
  54. package/src-next/face/__tests__/words.guard.test.ts +93 -0
  55. package/src-next/face/artifacts.ts +248 -0
  56. package/src-next/face/board-view.ts +652 -0
  57. package/src-next/face/capsule.ts +163 -0
  58. package/src-next/face/cli.ts +1028 -0
  59. package/src-next/face/declare.ts +323 -0
  60. package/src-next/face/gate.ts +171 -0
  61. package/src-next/face/graph-view.ts +74 -0
  62. package/src-next/face/host.ts +302 -0
  63. package/src-next/face/lifecycle.ts +725 -0
  64. package/src-next/face/preview.ts +151 -0
  65. package/src-next/face/projection.ts +285 -0
  66. package/src-next/face/route-render.ts +185 -0
  67. package/src-next/face/termination.ts +573 -0
  68. package/src-next/face/words.ts +314 -0
  69. package/src-next/infra/__tests__/infra.test.ts +333 -0
  70. package/src-next/infra/__tests__/root.test.ts +56 -0
  71. package/src-next/infra/config.ts +42 -0
  72. package/src-next/infra/doc-roots.ts +29 -0
  73. package/src-next/infra/git.ts +39 -0
  74. package/src-next/infra/process.ts +34 -0
  75. package/src-next/infra/root.ts +73 -0
  76. package/src-next/infra/runtime.ts +132 -0
  77. package/src-next/infra/workspace.ts +322 -0
  78. package/src-next/render/__tests__/render.test.ts +550 -0
  79. package/src-next/render/__tests__/skeleton.test.ts +684 -0
  80. package/src-next/render/brief.ts +121 -0
  81. package/src-next/render/issue-body.ts +162 -0
  82. package/src-next/render/skeleton.ts +502 -0
  83. package/src-next/render/templates.ts +645 -0
  84. package/src-next/session/__tests__/graph.test.ts +277 -0
  85. package/src-next/session/__tests__/handoff-plane.guard.test.ts +48 -0
  86. package/src-next/session/__tests__/handoff-schema.test.ts +310 -0
  87. package/src-next/session/__tests__/ledger.test.ts +745 -0
  88. package/src-next/session/__tests__/next.test.ts +460 -0
  89. package/src-next/session/__tests__/preflight.test.ts +545 -0
  90. package/src-next/session/__tests__/round-naming.test.ts +142 -0
  91. package/src-next/session/__tests__/run.test.ts +1026 -0
  92. package/src-next/session/__tests__/wave-line-phase.guard.test.ts +49 -0
  93. package/src-next/session/__tests__/wave.test.ts +476 -0
  94. package/src-next/session/faces.ts +110 -0
  95. package/src-next/session/graph.ts +411 -0
  96. package/src-next/session/handoff-schema.ts +373 -0
  97. package/src-next/session/ledger.ts +1076 -0
  98. package/src-next/session/next.ts +293 -0
  99. package/src-next/session/preflight.ts +271 -0
  100. package/src-next/session/round-naming.ts +84 -0
  101. package/src-next/session/run.ts +610 -0
  102. package/src-next/session/state.ts +30 -0
  103. package/src-next/session/wave.ts +139 -0
  104. package/templates/report/issue-body.json +17 -65
  105. package/dist/chunks/branch.mjs +0 -480
  106. package/dist/chunks/docs.mjs +0 -253
  107. package/dist/chunks/task.mjs +0 -913
  108. package/dist/cli.mjs +0 -5457
  109. package/dist/documents/schema/add-phase-protocol.json +0 -126
  110. package/dist/documents/schema/overall.json +0 -361
  111. package/dist/documents/schema/phase-spec.json +0 -145
  112. package/dist/documents/schema/plan.json +0 -191
  113. package/dist/documents/schema/skill-anatomy.json +0 -233
  114. package/dist/resources/harness-registry.json +0 -49
  115. package/dist/shared/cdd-engine.liioziig.mjs +0 -184
  116. package/templates/engine-config.json +0 -302
  117. package/templates/schema/cache-profile-schema.json +0 -23
  118. package/templates/schema/docs-handoff-schema.json +0 -129
  119. package/templates/schema/task-handoff-schema.json +0 -332
  120. package/templates/template-contract.json +0 -231
@@ -0,0 +1,139 @@
1
+ // packages/cdd-engine/src-next/session/wave.ts
2
+ // T24 (v1.21 — the three-verb unified wave gate) — the task-face dispatch
3
+ // pre-flight as ONE gate method. The retired split check (the implement-only
4
+ // strict-wave check + the phase lock) converges into `WaveGate.vet(requested,
5
+ // verb)`: implement / review / fix share the same single wave gate — a
6
+ // half-wave review or a half-wave fix is structurally blocked exactly like a
7
+ // half-wave implement.
8
+ //
9
+ // The gate's only read face is `open = frontier(closedWaves())` — the derived
10
+ // wave over the ledger's C5 closure set (ledger.ts, the same closure predicate as
11
+ // the lifecycle's #markTerminal). The two judgments:
12
+ // 1. requested ≠ open → the split/subset BLOCK (dispatch the full derived wave,
13
+ // with the wave-board hint);
14
+ // 2. the open wave's phase ≠ verb → the wrong-phase BLOCK (run the matching phase).
15
+ // (v1.28 — the heterogeneous-phase row RETIRED: the wave-unitary ledger has ONE row
16
+ // per wave, so mixed per-task phases are structurally impossible — a per-task phase
17
+ // read was the T26 regression {16,22,24} exposed (the row key `16` never matched
18
+ // `{wave:"16,22,24"}`), not a mixed-phase anomaly.)
19
+ // The verdict wording renders the wave-gate vocabulary rows (face/words.ts — the
20
+ // gate's prompt wording rides the word table, never a literal restate). BLOCK
21
+ // messages and the verdict shape are data here; the CLI face renders them.
22
+ //
23
+ // Module-level exports are types / the class — zero behavior-carrying bare
24
+ // functions (the plan's zero-bare-function discipline).
25
+
26
+ import type { Words } from "../face/words.ts";
27
+ import type { DispatchPhase } from "./faces.ts";
28
+ import type { TaskGraph } from "./graph.ts";
29
+ import type { Ledger } from "./ledger.ts";
30
+
31
+ /** The verdict kinds — the named gate rows (the BLOCK reason each carries). */
32
+ export type WaveGateReason = "split" | "wrong-phase";
33
+
34
+ /** One open-wave task's phase row — every member carries the WAVE's single phase
35
+ * (the wave-unitary read: one ledger row per wave; a per-task read would miss the
36
+ * wave row — `16` ≠ `16,22,24` — the T26 migration regression). */
37
+ export interface WavePhaseRow {
38
+ /** The task id. */
39
+ task: number;
40
+ /** The wave's open phase (null = a closed/held wave — no open round on record). */
41
+ phase: DispatchPhase | null;
42
+ }
43
+
44
+ /** The wave-gate verdict — approved or one of the three named BLOCK rows. */
45
+ export interface WaveVerdict {
46
+ /** Whether the gate approves the dispatch (the requested wave = the open wave,
47
+ * the wave's phase = the requested verb). */
48
+ ok: boolean;
49
+ /** The BLOCK reason kind (present when ok is false). */
50
+ reason?: WaveGateReason;
51
+ /** The rendered BLOCK message (the vocabulary row, verbatim-filled). */
52
+ message?: string;
53
+ /** The derived open wave — frontier(closedWaves), ascending (both the split hint
54
+ * and the CLI's progress-marking read this). */
55
+ open: readonly number[];
56
+ /** The open wave's member phases — every task carries the WAVE's single phase
57
+ * (the wave-unitary display: one ledger row per wave, never a per-task read). */
58
+ phases?: readonly WavePhaseRow[];
59
+ }
60
+
61
+ /**
62
+ * WaveGate — the three-verb unified wave gate (implement / review / fix share the
63
+ * single gate). One OOP method: vet(requested, verb) judges the request against
64
+ * the derived open wave + the ledger's per-task phases; the CLI calls it before
65
+ * ANY task-face dispatch, never a variant gate per verb.
66
+ */
67
+ export class WaveGate {
68
+ /** vet(requested, verb, graph, ledger, words) — the three-verb gate: the verdict
69
+ * row the CLI renders (ok → dispatch; a reason + message → the BLOCK face). */
70
+ vet(
71
+ requested: ReadonlySet<number>,
72
+ verb: "implement" | "review" | "fix",
73
+ graph: TaskGraph,
74
+ ledger: Ledger,
75
+ words: Words,
76
+ ): WaveVerdict {
77
+ const closed = ledger.closedWaves();
78
+ const open = [...graph.frontier(closed)].sort((a, b) => a - b);
79
+ const asked = [...requested].sort((a, b) => a - b);
80
+ const requestedKey = asked.join(",");
81
+ const openKey = open.join(",");
82
+ const wordsGate = words.waveGateWords();
83
+ const exact = asked.length === open.length && asked.every((id, index) => id === open[index]);
84
+
85
+ // 1. The split/subset BLOCK — requested ≠ open: a `--tasks` set that splits or
86
+ // mismatches the derived wave is refused for ANY verb (a subset never reorders
87
+ // the wave, never half-approves it). The full-wave hint rides the message.
88
+ if (!exact) {
89
+ return {
90
+ ok: false,
91
+ reason: "split",
92
+ message: this.#fill(wordsGate.split, { requested: requestedKey, open: openKey }),
93
+ open,
94
+ phases: this.#phasesOf(ledger, open),
95
+ };
96
+ }
97
+
98
+ // 2. The open wave's phase — the single phase of the wave's own row (wave-unitary:
99
+ // one ledger row per wave, so every member shares the phase; a per-task read
100
+ // never matches the wave row — the T26 migration regression).
101
+ const phases = this.#phasesOf(ledger, open);
102
+ const phase = phases[0]?.phase ?? null;
103
+ if (phase !== verb) {
104
+ return {
105
+ ok: false,
106
+ reason: "wrong-phase",
107
+ message: this.#fill(wordsGate.wrongPhase, { phase: phase ?? "held" }),
108
+ open,
109
+ phases,
110
+ };
111
+ }
112
+ return { ok: true, open, phases };
113
+ }
114
+
115
+ /** The open wave's per-task phases — every member resolves the WAVE row's single
116
+ * phase (implement → review → fix → re-review → closure; null = no open round). */
117
+ #phasesOf(ledger: Ledger, open: readonly number[]): readonly WavePhaseRow[] {
118
+ const waveKey = open.join(",");
119
+ const phase = this.#phaseOf(ledger, waveKey);
120
+ return open.map((task) => ({ task, phase }));
121
+ }
122
+
123
+ /** The ledger-derived open phase of ONE wave row — the SINGLE source (D26): the
124
+ * wave gate and the lifecycle's frame frontier both read this one method
125
+ * (`Ledger#waveLinePhase`), never a per-consumer copy. The wave-unitary read: the
126
+ * same C5 round-pair derivation over the wave's own row key (the per-task read
127
+ * never matched a `{wave:"16,22,24"}` row — the fix). The D16/T11 revision
128
+ * precheck lives in the ledger method (a drifted BRIEF reopens at review; same +
129
+ * pending fix stays at fix). */
130
+ #phaseOf(ledger: Ledger, waveKey: string): DispatchPhase | null {
131
+ return ledger.waveLinePhase(waveKey);
132
+ }
133
+
134
+ /** The raw fill of one placeholder template — the noun-slot substitution
135
+ * ({requested} / {open} / {phase} / {map}); every slot defined, unknown braces kept. */
136
+ #fill(template: string, slots: Record<string, string>): string {
137
+ return template.replace(/\{(\w+)\}/g, (whole, name: string) => slots[name] ?? whole);
138
+ }
139
+ }
@@ -1,67 +1,26 @@
1
1
  {
2
2
  "components": [
3
- "osuperpowers (general)",
3
+ "kairos (general)",
4
4
  "cdd-engine",
5
- "osuperpowers:brainstorming",
6
- "osuperpowers:writing-single-spec",
7
- "osuperpowers:writing-overall-spec",
8
- "osuperpowers:writing-phase-spec",
9
- "osuperpowers:writing-plans",
10
- "osuperpowers:cli-driven-development",
11
- "osuperpowers:report-issues",
12
- "osuperpowers:finishing"
5
+ "kairos:cdd-design",
6
+ "kairos:cdd-spec-writer",
7
+ "kairos:cdd-plan",
8
+ "kairos:cdd-dev",
9
+ "kairos:cdd-report",
10
+ "kairos:cdd-close"
13
11
  ],
14
- "severities": [
15
- "blocker",
16
- "warn",
17
- "nit"
18
- ],
19
- "metaFields": [
20
- { "key": "skill", "label": "Skill" },
21
- { "key": "step", "label": "Step" }
22
- ],
23
- "sectionLabels": {
24
- "bug": {
25
- "en": {
26
- "context": "## Context",
27
- "problem": "## Problem",
28
- "impact": "## Impact",
29
- "suggestedFix": "## Suggested fix"
30
- },
31
- "zh": {
32
- "context": "## 背景",
33
- "problem": "## 问题",
34
- "impact": "## 影响",
35
- "suggestedFix": "## 建议修复"
36
- }
37
- },
38
- "enhancement": {
39
- "en": {
40
- "context": "## Context",
41
- "problem": "## Current behavior",
42
- "impact": "## Desired behavior",
43
- "suggestedFix": "## Suggested approach"
44
- },
45
- "zh": {
46
- "context": "## 背景",
47
- "problem": "## 当前行为",
48
- "impact": "## 期望行为",
49
- "suggestedFix": "## 建议方案"
50
- }
51
- }
52
- },
53
12
  "formFieldDefs": {
54
13
  "bug_report": {
55
14
  "frontmatter": {
56
15
  "name": "Bug report",
57
- "description": "Report a bug found while using osuperpowers skills (dogfood)",
58
- "labels": ["bug", "osuperpowers"]
16
+ "description": "Report a bug found while using kairos skills (dogfood)",
17
+ "labels": ["bug", "kairos"]
59
18
  },
60
19
  "body": [
61
20
  {
62
21
  "type": "markdown",
63
22
  "attributes": {
64
- "value": "Use this template to report bugs found during dogfood use of osuperpowers skills.\n"
23
+ "value": "Use this template to report bugs found during dogfood use of kairos skills.\n"
65
24
  }
66
25
  },
67
26
  {
@@ -78,8 +37,8 @@
78
37
  "id": "context",
79
38
  "attributes": {
80
39
  "label": "Context",
81
- "description": "Dogfood session context: date, harness, which osuperpowers skills were in use",
82
- "placeholder": "Date: YYYY-MM-DD, Harness: claude-code, Skills: cli-driven-development, writing-plans"
40
+ "description": "Dogfood session context: date, harness, which kairos skills were in use",
41
+ "placeholder": "Date: YYYY-MM-DD, Harness: claude-code, Skills: cdd-dev, cdd-plan"
83
42
  },
84
43
  "validations": { "required": true }
85
44
  },
@@ -125,14 +84,14 @@
125
84
  "enhancement": {
126
85
  "frontmatter": {
127
86
  "name": "Enhancement",
128
- "description": "Suggest an improvement to osuperpowers skills or workflow",
129
- "labels": ["enhancement", "osuperpowers"]
87
+ "description": "Suggest an improvement to kairos skills or workflow",
88
+ "labels": ["enhancement", "kairos"]
130
89
  },
131
90
  "body": [
132
91
  {
133
92
  "type": "markdown",
134
93
  "attributes": {
135
- "value": "Use this template to suggest improvements found during dogfood use of osuperpowers skills.\n"
94
+ "value": "Use this template to suggest improvements found during dogfood use of kairos skills.\n"
136
95
  }
137
96
  },
138
97
  {
@@ -149,8 +108,8 @@
149
108
  "id": "context",
150
109
  "attributes": {
151
110
  "label": "Context",
152
- "description": "Dogfood session context: date, harness, which osuperpowers skills were in use",
153
- "placeholder": "Date: YYYY-MM-DD, Harness: claude-code, Skills: cli-driven-development"
111
+ "description": "Dogfood session context: date, harness, which kairos skills were in use",
112
+ "placeholder": "Date: YYYY-MM-DD, Harness: claude-code, Skills: cdd-dev"
154
113
  },
155
114
  "validations": { "required": true }
156
115
  },
@@ -193,12 +152,5 @@
193
152
  }
194
153
  ]
195
154
  }
196
- },
197
- "reportDef": {
198
- "labels": ["osuperpowers", "cdd-engine"]
199
- },
200
- "masterDef": {
201
- "sessionTitle": "## Session",
202
- "harnessRow": "- Harness: <harness>"
203
155
  }
204
156
  }