@oscaner-skills/cdd-engine 2.0.0 → 3.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.
Files changed (127) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +2 -2
  3. package/{src-next/bin.ts → dist/bin.js} +18 -21
  4. package/dist/contract/declare.js +998 -0
  5. package/dist/contract/doc.js +565 -0
  6. package/dist/contract/frontmatter.js +209 -0
  7. package/dist/contract/home-extractors.js +379 -0
  8. package/dist/contract/invariants.js +1030 -0
  9. package/dist/contract/judge.js +109 -0
  10. package/dist/contract/lint.js +206 -0
  11. package/dist/contract/project.js +371 -0
  12. package/dist/contract/skill-anatomy.js +156 -0
  13. package/dist/contract/translate.js +85 -0
  14. package/dist/face/artifacts.js +189 -0
  15. package/dist/face/board-view.js +522 -0
  16. package/dist/face/capsule.js +141 -0
  17. package/dist/face/cli.js +891 -0
  18. package/dist/face/declare.js +241 -0
  19. package/dist/face/gate.js +158 -0
  20. package/dist/face/graph-view.js +66 -0
  21. package/dist/face/host.js +211 -0
  22. package/dist/face/lifecycle.js +603 -0
  23. package/dist/face/preview.js +136 -0
  24. package/dist/face/projection.js +259 -0
  25. package/dist/face/route-render.js +162 -0
  26. package/dist/face/termination.js +482 -0
  27. package/dist/face/words.js +220 -0
  28. package/{src-next/infra/config.ts → dist/infra/config.js} +19 -24
  29. package/dist/infra/doc-roots.js +19 -0
  30. package/dist/infra/git.js +37 -0
  31. package/dist/infra/process.js +22 -0
  32. package/dist/infra/root.js +62 -0
  33. package/dist/infra/runtime.js +85 -0
  34. package/dist/infra/workspace.js +276 -0
  35. package/dist/render/brief.js +82 -0
  36. package/dist/render/issue-body.js +129 -0
  37. package/dist/render/skeleton.js +434 -0
  38. package/dist/render/templates.js +520 -0
  39. package/dist/session/faces.js +38 -0
  40. package/dist/session/graph.js +309 -0
  41. package/dist/session/handoff-schema.js +295 -0
  42. package/dist/session/ledger.js +762 -0
  43. package/dist/session/next.js +211 -0
  44. package/dist/session/preflight.js +194 -0
  45. package/dist/session/round-naming.js +73 -0
  46. package/dist/session/run.js +441 -0
  47. package/dist/session/state.js +8 -0
  48. package/dist/session/wave.js +92 -0
  49. package/package.json +8 -7
  50. package/templates/report/issue-body.json +0 -46
  51. package/src-next/__tests__/bin.test.ts +0 -128
  52. package/src-next/__tests__/smoke.integration.test.ts +0 -202
  53. package/src-next/__tests__/zero-dep.test.ts +0 -134
  54. package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +0 -238
  55. package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +0 -153
  56. package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +0 -173
  57. package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +0 -89
  58. package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +0 -225
  59. package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +0 -155
  60. package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +0 -175
  61. package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +0 -85
  62. package/src-next/contract/__tests__/declare.test.ts +0 -242
  63. package/src-next/contract/__tests__/doc.test.ts +0 -358
  64. package/src-next/contract/__tests__/judge.test.ts +0 -873
  65. package/src-next/contract/__tests__/lint.test.ts +0 -314
  66. package/src-next/contract/__tests__/project.test.ts +0 -419
  67. package/src-next/contract/__tests__/translate.test.ts +0 -96
  68. package/src-next/contract/declare.ts +0 -983
  69. package/src-next/contract/doc.ts +0 -753
  70. package/src-next/contract/invariants.ts +0 -1268
  71. package/src-next/contract/judge.ts +0 -142
  72. package/src-next/contract/lint.ts +0 -275
  73. package/src-next/contract/project.ts +0 -596
  74. package/src-next/contract/skill-anatomy.ts +0 -273
  75. package/src-next/contract/translate.ts +0 -113
  76. package/src-next/face/__tests__/board-view.test.ts +0 -948
  77. package/src-next/face/__tests__/capsule.test.ts +0 -276
  78. package/src-next/face/__tests__/channel-closure.guard.test.ts +0 -102
  79. package/src-next/face/__tests__/cli.test.ts +0 -4643
  80. package/src-next/face/__tests__/face.test.ts +0 -289
  81. package/src-next/face/__tests__/graph-view.test.ts +0 -61
  82. package/src-next/face/__tests__/host.test.ts +0 -24
  83. package/src-next/face/__tests__/negation.ts +0 -6
  84. package/src-next/face/__tests__/projection.test.ts +0 -301
  85. package/src-next/face/__tests__/sync-runner.test.ts +0 -70
  86. package/src-next/face/__tests__/words.guard.test.ts +0 -93
  87. package/src-next/face/artifacts.ts +0 -195
  88. package/src-next/face/board-view.ts +0 -662
  89. package/src-next/face/capsule.ts +0 -149
  90. package/src-next/face/cli.ts +0 -819
  91. package/src-next/face/declare.ts +0 -326
  92. package/src-next/face/gate.ts +0 -170
  93. package/src-next/face/graph-view.ts +0 -74
  94. package/src-next/face/host.ts +0 -326
  95. package/src-next/face/lifecycle.ts +0 -700
  96. package/src-next/face/projection.ts +0 -282
  97. package/src-next/face/route-render.ts +0 -160
  98. package/src-next/face/words.ts +0 -296
  99. package/src-next/infra/__tests__/infra.test.ts +0 -287
  100. package/src-next/infra/git.ts +0 -39
  101. package/src-next/infra/process.ts +0 -34
  102. package/src-next/infra/runtime.ts +0 -185
  103. package/src-next/infra/workspace.ts +0 -232
  104. package/src-next/render/__tests__/render.test.ts +0 -499
  105. package/src-next/render/__tests__/skeleton.test.ts +0 -466
  106. package/src-next/render/brief.ts +0 -121
  107. package/src-next/render/issue-body.ts +0 -159
  108. package/src-next/render/skeleton.ts +0 -437
  109. package/src-next/render/templates.ts +0 -650
  110. package/src-next/session/__tests__/graph.test.ts +0 -270
  111. package/src-next/session/__tests__/handoff-plane.guard.test.ts +0 -48
  112. package/src-next/session/__tests__/handoff-schema.test.ts +0 -310
  113. package/src-next/session/__tests__/ledger.test.ts +0 -744
  114. package/src-next/session/__tests__/next.test.ts +0 -368
  115. package/src-next/session/__tests__/preflight.test.ts +0 -491
  116. package/src-next/session/__tests__/run.test.ts +0 -1014
  117. package/src-next/session/__tests__/wave-line-phase.guard.test.ts +0 -49
  118. package/src-next/session/__tests__/wave.test.ts +0 -469
  119. package/src-next/session/faces.ts +0 -110
  120. package/src-next/session/graph.ts +0 -411
  121. package/src-next/session/handoff-schema.ts +0 -373
  122. package/src-next/session/ledger.ts +0 -1004
  123. package/src-next/session/next.ts +0 -192
  124. package/src-next/session/preflight.ts +0 -240
  125. package/src-next/session/run.ts +0 -606
  126. package/src-next/session/state.ts +0 -30
  127. package/src-next/session/wave.ts +0 -139
@@ -0,0 +1,211 @@
1
+ // packages/cdd-engine/src-next/face/host.ts
2
+ // T21 — the harness-contract typed surface: the harness-contract JSON's data-plane
3
+ // home as one typed constant module. The new tree reads zero config files — the
4
+ // host-adaptation contract (host detection · dispatch · refs) lives here and is
5
+ // imported, never parsed:
6
+ //
7
+ // · HOSTS — the per-harness rows (cli / invoke / promptForm / output / ship /
8
+ // detect / install). The host-marker closure is single-sourced HERE: the
9
+ // detect rows are the only copy of the marker env keys (the channel audit derives
10
+ // the env whitelist from them — never a second declaration). The promptForm
11
+ // column (§3.5) is the prompt-position semantics data contract — how the
12
+ // skill-ref enters the child prompt (ref-prefixed | plain).
13
+ // · DISPATCH — the dispatch table: the skill-ref each dispatch face resolves
14
+ // to. M1 supersede (P5): the implement slot names the upstream
15
+ // `mattpocock-skills:implement` skill; the fix face carries no skill ref (its
16
+ // fix discipline lives as the FIX_SHELL typed instructions).
17
+ // · REFS — the per-harness slash reference forms (claude/cursor use the
18
+ // `/namespace:skill` form; pi the flat `/skill:<bare>` form — the pi flat
19
+ // namespace has no namespace-qualification syntax).
20
+ // · HostDetect — the module-level host judgment (the detection's single home):
21
+ // the dispatch face's detectHost delegates here; the work face's Capsule wiring
22
+ // reads the same judgment over process.env.
23
+ //
24
+ // P5 lands here: the forbidden parallel-sub-agents prose is deleted from the review
25
+ // dispatch rows (the task/branch rows carry their ref only) and the review
26
+ // criteria — the URC spec/plan axes + the writing-plans self-check + the
27
+ // verification-evidence duty — land in render/templates.ts (the axes guide's
28
+ // typed home). The `mattpocock-skills:implement` ref key is registered here.
29
+ //
30
+ // Module-level exports are types / the declared constant data — zero behavior-
31
+ // carrying bare functions (the plan's zero-bare-function discipline).
32
+ /** The per-harness install banners — the kairos self-install + the upstream plugin
33
+ * install commands. The `packages/kairos/README.md` upstream dependency table (and
34
+ * its zh mirror) renders from these rows; the engine-suite gate
35
+ * (face/__tests__/install-rows.guard.test.ts) pins each README row's Claude Code cell
36
+ * to `INSTALL_ROWS[key].join(";")` and the row key set to these keys — a README
37
+ * install-command drift fails there, never silently. */
38
+ export const INSTALL_ROWS = {
39
+ kairos: [
40
+ "claude plugin marketplace add oscaner/skills",
41
+ "claude plugin install kairos@oscaner-skills",
42
+ ],
43
+ superpowers: [
44
+ "claude plugin marketplace add obra/superpowers-marketplace",
45
+ "claude plugin install superpowers@superpowers-marketplace",
46
+ ],
47
+ "mattpocock-skills": [
48
+ "claude plugin marketplace add mattpocock/skills",
49
+ "claude plugin install mattpocock-skills@mattpocock",
50
+ ],
51
+ impeccable: [
52
+ "claude plugin marketplace add pbakaus/impeccable",
53
+ "claude plugin install impeccable@impeccable",
54
+ ],
55
+ };
56
+ /** The per-harness host rows — claude / cursor / pi adaptation facts. */
57
+ export const HOSTS = {
58
+ claude: {
59
+ promptForm: "ref-prefixed",
60
+ cli: "claude",
61
+ invoke: "-p --output-format text --dangerously-skip-permissions",
62
+ output: "text",
63
+ ship: "full",
64
+ detect: { env: "CLAUDE_CODE_SESSION_ID", aiAgentPrefix: "claude-code" },
65
+ install: INSTALL_ROWS,
66
+ capabilities: { parallel: true },
67
+ },
68
+ cursor: {
69
+ promptForm: "ref-prefixed",
70
+ cli: "cursor-agent",
71
+ invoke: "--print --output-format text --force",
72
+ output: "text",
73
+ ship: "full",
74
+ detect: { env: "CURSOR_TRACE_ID" },
75
+ install: {
76
+ kairos: "pending",
77
+ superpowers: "pending",
78
+ "mattpocock-skills": "pending",
79
+ impeccable: "pending",
80
+ },
81
+ capabilities: { parallel: "pending" },
82
+ },
83
+ pi: {
84
+ promptForm: "ref-prefixed",
85
+ cli: "pi",
86
+ invoke: "-p --mode text",
87
+ output: "text",
88
+ ship: "full",
89
+ detect: { env: "AI_AGENT", value: "pi" },
90
+ install: {
91
+ kairos: ["pi install npm:@oscaner-skills/kairos"],
92
+ superpowers: ["pi install git:github.com/obra/superpowers"],
93
+ "mattpocock-skills": ["pi install git:github.com/mattpocock/skills"],
94
+ impeccable: ["npx impeccable install --providers=pi --scope=global -y"],
95
+ },
96
+ capabilities: { parallel: "pending" },
97
+ },
98
+ };
99
+ /** The dispatch table — the phase/type → skill-ref resolution. The implement slot
100
+ * is the M1 supersede (P5): it names the upstream `mattpocock-skills:implement`
101
+ * skill. The fix face carries no skill ref (its fix discipline rides the FIX_SHELL
102
+ * typed instructions). The REVIEW rows are the task/branch ref keys only (the
103
+ * spec/plan rows' URC review criteria migrated to the template plane's REVIEWS at
104
+ * the v1.8 closeout — their single typed home; the parallel-sub-agents note prose
105
+ * is deleted — P5 forbidden text). */
106
+ export const DISPATCH = {
107
+ implement: "mattpocock-skills:implement",
108
+ review: {
109
+ wave: { ref: "mattpocock-skills:code-review" },
110
+ branch: { ref: "mattpocock-skills:code-review" },
111
+ },
112
+ };
113
+ /** The reference table — every `<pkg>:<skill>` cross-skill reference key and its
114
+ * per-harness slash form: claude/cursor use `/namespace:skill`, pi the flat
115
+ * `/skill:<bare>` form. The `mattpocock-skills:implement` key is registered here
116
+ * (P5 — the implement dispatch's first-class refs-domain entry). */
117
+ export const REFS = {
118
+ "superpowers:brainstorming": {
119
+ claude: "/superpowers:brainstorming",
120
+ cursor: "/superpowers:brainstorming",
121
+ pi: "/skill:brainstorming",
122
+ },
123
+ "superpowers:writing-plans": {
124
+ claude: "/superpowers:writing-plans",
125
+ cursor: "/superpowers:writing-plans",
126
+ pi: "/skill:writing-plans",
127
+ },
128
+ "superpowers:finishing-a-development-branch": {
129
+ claude: "/superpowers:finishing-a-development-branch",
130
+ cursor: "/superpowers:finishing-a-development-branch",
131
+ pi: "/skill:finishing-a-development-branch",
132
+ },
133
+ "mattpocock-skills:implement": {
134
+ claude: "/mattpocock-skills:implement",
135
+ cursor: "/mattpocock-skills:implement",
136
+ pi: "/skill:implement",
137
+ },
138
+ "mattpocock-skills:code-review": {
139
+ claude: "/mattpocock-skills:code-review",
140
+ cursor: "/mattpocock-skills:code-review",
141
+ pi: "/skill:code-review",
142
+ },
143
+ "mattpocock-skills:grilling": {
144
+ claude: "/mattpocock-skills:grilling",
145
+ cursor: "/mattpocock-skills:grilling",
146
+ pi: "/skill:grilling",
147
+ },
148
+ "kairos:cdd-design": {
149
+ claude: "/kairos:cdd-design",
150
+ cursor: "/kairos:cdd-design",
151
+ pi: "/skill:cdd-design",
152
+ },
153
+ "kairos:cdd-spec-writer": {
154
+ claude: "/kairos:cdd-spec-writer",
155
+ cursor: "/kairos:cdd-spec-writer",
156
+ pi: "/skill:cdd-spec-writer",
157
+ },
158
+ "kairos:cdd-plan": {
159
+ claude: "/kairos:cdd-plan",
160
+ cursor: "/kairos:cdd-plan",
161
+ pi: "/skill:cdd-plan",
162
+ },
163
+ "kairos:cdd-dev": { claude: "/kairos:cdd-dev", cursor: "/kairos:cdd-dev", pi: "/skill:cdd-dev" },
164
+ "kairos:cdd-close": {
165
+ claude: "/kairos:cdd-close",
166
+ cursor: "/kairos:cdd-close",
167
+ pi: "/skill:cdd-close",
168
+ },
169
+ "kairos:cdd-report": {
170
+ claude: "/kairos:cdd-report",
171
+ cursor: "/kairos:cdd-report",
172
+ pi: "/skill:cdd-report",
173
+ },
174
+ };
175
+ /** The typed harness contract — one constant: hosts + dispatch + refs (the single
176
+ * harness-adaptation truth; zero `_doc`/`$schema` prose). */
177
+ export const HOST_CONTRACT = {
178
+ hosts: HOSTS,
179
+ dispatch: DISPATCH,
180
+ refs: REFS,
181
+ };
182
+ /** HostDetect — the module-level host judgment (the detection's single home). The
183
+ * input is the inline structural env view — no cross-import (the host plane
184
+ * must stay import-clean toward the dispatch face). */
185
+ // biome-ignore lint/complexity/noStaticOnlyClass: the module-level host-detect surface — the zero-bare-function discipline admits no standalone predicate functions.
186
+ export class HostDetect {
187
+ /** detect(env) — the first host detect row that matches, in the pinned order
188
+ * `claude` → `cursor` → `pi` (specific markers first, the generic AI_AGENT
189
+ * last). One row detects by its primary marker (a session env, presence/enum —
190
+ * a UUID CLAUDE_CODE_SESSION_ID is claude by presence) or by the AI_AGENT
191
+ * prefix (AI_AGENT=claude-code-…); no match returns `""`. */
192
+ static detect(env) {
193
+ for (const id of ["claude", "cursor", "pi"]) {
194
+ const detect = HOSTS[id].detect;
195
+ if (detect.env !== undefined && detect.env !== "") {
196
+ const marker = env[detect.env];
197
+ if (marker !== undefined && marker.length > 0) {
198
+ if (detect.value !== undefined && marker !== detect.value)
199
+ continue;
200
+ return id;
201
+ }
202
+ }
203
+ if (detect.aiAgentPrefix !== undefined && detect.aiAgentPrefix.length > 0) {
204
+ const agent = env.AI_AGENT;
205
+ if (agent !== undefined && agent.length > 0 && agent.startsWith(detect.aiAgentPrefix))
206
+ return id;
207
+ }
208
+ }
209
+ return "";
210
+ }
211
+ }