@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.
Files changed (143) hide show
  1. package/{src-next/bin.ts → dist/bin.js} +18 -21
  2. package/dist/contract/declare.js +998 -0
  3. package/dist/contract/doc.js +565 -0
  4. package/dist/contract/frontmatter.js +209 -0
  5. package/dist/contract/home-extractors.js +379 -0
  6. package/dist/contract/invariants.js +1030 -0
  7. package/dist/contract/judge.js +109 -0
  8. package/dist/contract/lint.js +206 -0
  9. package/dist/contract/project.js +371 -0
  10. package/dist/contract/skill-anatomy.js +156 -0
  11. package/dist/contract/translate.js +85 -0
  12. package/dist/face/artifacts.js +189 -0
  13. package/dist/face/board-view.js +522 -0
  14. package/dist/face/capsule.js +149 -0
  15. package/dist/face/cli.js +893 -0
  16. package/dist/face/declare.js +241 -0
  17. package/dist/face/gate.js +158 -0
  18. package/dist/face/graph-view.js +66 -0
  19. package/dist/face/host.js +211 -0
  20. package/dist/face/lifecycle.js +702 -0
  21. package/dist/face/preview.js +136 -0
  22. package/dist/face/projection.js +259 -0
  23. package/dist/face/route-render.js +162 -0
  24. package/dist/face/termination.js +504 -0
  25. package/dist/face/words.js +258 -0
  26. package/{src-next/infra/config.ts → dist/infra/config.js} +19 -24
  27. package/{src-next/infra/doc-roots.ts → dist/infra/doc-roots.js} +3 -13
  28. package/dist/infra/git.js +37 -0
  29. package/dist/infra/process.js +22 -0
  30. package/{src-next/infra/root.ts → dist/infra/root.js} +25 -36
  31. package/dist/infra/runtime.js +85 -0
  32. package/dist/infra/workspace.js +276 -0
  33. package/dist/render/brief.js +82 -0
  34. package/dist/render/issue-body.js +129 -0
  35. package/dist/render/skeleton.js +434 -0
  36. package/dist/render/templates.js +520 -0
  37. package/dist/session/faces.js +38 -0
  38. package/dist/session/graph.js +309 -0
  39. package/dist/session/handoff-schema.js +295 -0
  40. package/dist/session/ledger.js +762 -0
  41. package/dist/session/next.js +211 -0
  42. package/dist/session/preflight.js +194 -0
  43. package/dist/session/round-naming.js +73 -0
  44. package/dist/session/run.js +453 -0
  45. package/dist/session/state.js +8 -0
  46. package/dist/session/wave.js +92 -0
  47. package/package.json +5 -5
  48. package/src-next/__tests__/bin.test.ts +0 -128
  49. package/src-next/__tests__/dead-decl.guard.test.ts +0 -39
  50. package/src-next/__tests__/floor.guard.test.ts +0 -69
  51. package/src-next/__tests__/issue-body.guard.test.ts +0 -66
  52. package/src-next/__tests__/phase-suffix.guard.test.ts +0 -72
  53. package/src-next/__tests__/smoke.integration.test.ts +0 -185
  54. package/src-next/__tests__/support/strip-comments.ts +0 -99
  55. package/src-next/__tests__/zero-dep.test.ts +0 -94
  56. package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +0 -256
  57. package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +0 -165
  58. package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +0 -190
  59. package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +0 -106
  60. package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +0 -240
  61. package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +0 -165
  62. package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +0 -190
  63. package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +0 -100
  64. package/src-next/contract/__tests__/declare.test.ts +0 -481
  65. package/src-next/contract/__tests__/doc.test.ts +0 -527
  66. package/src-next/contract/__tests__/dockey.guard.test.ts +0 -58
  67. package/src-next/contract/__tests__/edge-conditions.guard.test.ts +0 -81
  68. package/src-next/contract/__tests__/frontmatter.test.ts +0 -164
  69. package/src-next/contract/__tests__/judge.test.ts +0 -1111
  70. package/src-next/contract/__tests__/lint.test.ts +0 -324
  71. package/src-next/contract/__tests__/project.test.ts +0 -460
  72. package/src-next/contract/__tests__/structure-pin.test.ts +0 -186
  73. package/src-next/contract/__tests__/translate.test.ts +0 -96
  74. package/src-next/contract/declare.ts +0 -1071
  75. package/src-next/contract/doc.ts +0 -816
  76. package/src-next/contract/frontmatter.ts +0 -233
  77. package/src-next/contract/home-extractors.ts +0 -397
  78. package/src-next/contract/invariants.ts +0 -1413
  79. package/src-next/contract/judge.ts +0 -151
  80. package/src-next/contract/lint.ts +0 -239
  81. package/src-next/contract/project.ts +0 -656
  82. package/src-next/contract/skill-anatomy.ts +0 -301
  83. package/src-next/contract/translate.ts +0 -113
  84. package/src-next/face/__tests__/board-view.test.ts +0 -1151
  85. package/src-next/face/__tests__/capsule.test.ts +0 -300
  86. package/src-next/face/__tests__/channel-closure.guard.test.ts +0 -129
  87. package/src-next/face/__tests__/cli.test.ts +0 -4897
  88. package/src-next/face/__tests__/face.test.ts +0 -289
  89. package/src-next/face/__tests__/graph-view.test.ts +0 -61
  90. package/src-next/face/__tests__/host.test.ts +0 -24
  91. package/src-next/face/__tests__/install-rows.guard.test.ts +0 -58
  92. package/src-next/face/__tests__/negation.ts +0 -6
  93. package/src-next/face/__tests__/preview.test.ts +0 -374
  94. package/src-next/face/__tests__/projection.test.ts +0 -303
  95. package/src-next/face/__tests__/repo-root.guard.test.ts +0 -120
  96. package/src-next/face/__tests__/termination.test.ts +0 -650
  97. package/src-next/face/__tests__/words.guard.test.ts +0 -93
  98. package/src-next/face/artifacts.ts +0 -248
  99. package/src-next/face/board-view.ts +0 -652
  100. package/src-next/face/capsule.ts +0 -163
  101. package/src-next/face/cli.ts +0 -1028
  102. package/src-next/face/declare.ts +0 -323
  103. package/src-next/face/gate.ts +0 -171
  104. package/src-next/face/graph-view.ts +0 -74
  105. package/src-next/face/host.ts +0 -302
  106. package/src-next/face/lifecycle.ts +0 -725
  107. package/src-next/face/preview.ts +0 -151
  108. package/src-next/face/projection.ts +0 -285
  109. package/src-next/face/route-render.ts +0 -185
  110. package/src-next/face/termination.ts +0 -573
  111. package/src-next/face/words.ts +0 -314
  112. package/src-next/infra/__tests__/infra.test.ts +0 -333
  113. package/src-next/infra/__tests__/root.test.ts +0 -56
  114. package/src-next/infra/git.ts +0 -39
  115. package/src-next/infra/process.ts +0 -34
  116. package/src-next/infra/runtime.ts +0 -132
  117. package/src-next/infra/workspace.ts +0 -322
  118. package/src-next/render/__tests__/render.test.ts +0 -550
  119. package/src-next/render/__tests__/skeleton.test.ts +0 -684
  120. package/src-next/render/brief.ts +0 -121
  121. package/src-next/render/issue-body.ts +0 -162
  122. package/src-next/render/skeleton.ts +0 -502
  123. package/src-next/render/templates.ts +0 -645
  124. package/src-next/session/__tests__/graph.test.ts +0 -277
  125. package/src-next/session/__tests__/handoff-plane.guard.test.ts +0 -48
  126. package/src-next/session/__tests__/handoff-schema.test.ts +0 -310
  127. package/src-next/session/__tests__/ledger.test.ts +0 -745
  128. package/src-next/session/__tests__/next.test.ts +0 -460
  129. package/src-next/session/__tests__/preflight.test.ts +0 -545
  130. package/src-next/session/__tests__/round-naming.test.ts +0 -142
  131. package/src-next/session/__tests__/run.test.ts +0 -1026
  132. package/src-next/session/__tests__/wave-line-phase.guard.test.ts +0 -49
  133. package/src-next/session/__tests__/wave.test.ts +0 -476
  134. package/src-next/session/faces.ts +0 -110
  135. package/src-next/session/graph.ts +0 -411
  136. package/src-next/session/handoff-schema.ts +0 -373
  137. package/src-next/session/ledger.ts +0 -1076
  138. package/src-next/session/next.ts +0 -293
  139. package/src-next/session/preflight.ts +0 -271
  140. package/src-next/session/round-naming.ts +0 -84
  141. package/src-next/session/run.ts +0 -610
  142. package/src-next/session/state.ts +0 -30
  143. package/src-next/session/wave.ts +0 -139
@@ -1,163 +0,0 @@
1
- // packages/cdd-engine/src-next/face/capsule.ts
2
- // T10 — the single capsule face (design spec §3.2: the `status · blocker · handoff
3
- // · next:` word-face steady state). Capsule#emit renders the ALL-OP single stdout
4
- // face — the capsule the orchestrator greps / routes on without opening the handoff:
5
- //
6
- // status: <status> · blocker: <blocker> · handoff: <handoff>
7
- // next: <suggestion> (optional — the C5 route / a caller-rendered text)
8
- //
9
- // The byte face is v1-pinned: the key words (status · blocker · handoff) are
10
- // pin-enforced by the CapsuleKey type and the emit signature — a data-only change
11
- // cannot reshape them. What rides the injected Words table (the single word-table
12
- // instance) is the `·` separator, the `next:` station anchor and the route/status
13
- // vocabulary — a second table is excluded by construction. The `next:` value is
14
- // either a caller-rendered string or the C5 Route rendered through the route-word
15
- // table as a COMPLETE EXECUTABLE command (P4.1 T4 — the v1.39 semantic-literal
16
- // reversal): `implement --plan <path> --tasks 17` · `review --type spec --spec
17
- // <path>` · `fix --type spec --spec <path> --reviews <handoff> (read file back to
18
- // confirm)` · `done` (the bare terminal word) · the soft-cap message verbatim.
19
- // The argv is composed from the frame facts (the RouteTarget's type + id + plan)
20
- // through the argv-channel flag spellings (the same channel the CLI parse reads —
21
- // the render source is the declared channel, never a second hard-coded format
22
- // string); the type flag renders ONLY where the verb's type discriminates
23
- // (review/fix multi-type — implement is the single-type wave verb, so its literal
24
- // never carries `--type` — the declaration's `parsed.args.type ?? "wave"` default
25
- // semantics unchanged). The route-borne prose — the readback suffix · the soft-cap
26
- // message — rides declared constants from session/next.ts, rendered by reference,
27
- // never restated.
28
- //
29
- // D40 — the render delegates to the shared `RouteRenderer` (the ONE route →
30
- // `next:` literal face, also consumed by the board); the capsule adds only the
31
- // `done` face's doc-class discrimination (a spec doc's declared class decides the
32
- // pipeline entry — or the BLOCKED face when the declaration is absent, spec §12).
33
- //
34
- // The class satisfies the session/run.ts CapsuleFace seam (T8's interaction point) —
35
- // the capsule plugs into the lifecycle's attachCapsule contact, byte-identically.
36
- // Module-level exports are the class — zero behavior-carrying bare functions.
37
-
38
- import { type RepoPath, RepoRoot } from "../infra/root.ts";
39
- import type { RouteTarget } from "../session/faces.ts";
40
- import { NextStepRouter, type PipelineKey, type Route } from "../session/next.ts";
41
- import { BoardView } from "./board-view.ts";
42
- import { type RouteChannelRow, RouteRenderer } from "./route-render.ts";
43
- import type { CapsuleKey, Words } from "./words.ts";
44
-
45
- /** The argv-channel flag row the capsule's render reads — re-exported from the
46
- * shared renderer's row type (the capsule renders through the ONE RouteRenderer). */
47
- export type CapsuleChannelRow = RouteChannelRow;
48
-
49
- /**
50
- * Capsule — the single capsule output face. emit(status, blocker, handoff, next)
51
- * renders one round's facts into the byte-pinned `status · blocker · handoff` line
52
- * plus the optional `next:` line. The key words are the CapsuleKey literals the
53
- * kind loop renders (pin-enforced by the emit signature); the separator, station
54
- * and route/status words ride the injected Words instance. The complete executable
55
- * `next:` literal composes its full argv from the route + the additive optional
56
- * RouteTarget (the frame's own facts) through the argv-channel flag spellings
57
- * (P4.1 T4; same channel source parse reads — the 4-param signature stays
58
- * byte-pinned, the target is an optional 5th, the channel an optional 2nd).
59
- */
60
- export class Capsule {
61
- /** The single word table — the capsule's whole vocabulary source. */
62
- readonly #words: Words;
63
- /** The ONE route → `next:` literal renderer (D40 — shared with the board). */
64
- readonly #route: RouteRenderer;
65
- /** The repo-basis value object the doc-target ids + the `handoff:` cell resolve
66
- * through (T1 `RepoRoot` · D47 — the ONE conversion exit; `null` keeps a relative
67
- * id relative · the hermetic-test default). */
68
- readonly #root: RepoRoot | null;
69
-
70
- constructor(
71
- words: Words,
72
- channels: Readonly<Record<string, CapsuleChannelRow>> = {},
73
- host = "",
74
- root: RepoRoot | null = null,
75
- ) {
76
- this.#words = words;
77
- this.#root = root;
78
- this.#route = new RouteRenderer(words, channels, host, root);
79
- }
80
-
81
- /** emit(status, blocker, handoff, next, target) → the capsule stdout lines: the
82
- * pinned `status · blocker · handoff` capsule line, then the optional `next:`
83
- * line (a caller-rendered text, a C5 Route rendered as the complete executable
84
- * command, or null/absent → no line). The additive optional RouteTarget supplies
85
- * the frame's own type + id + plan for the executable literal (P4.1 T4); without
86
- * it the route renders its bare classifier fallbacks (the 4-param signature stays
87
- * byte-pinned). */
88
- emit(
89
- status: string,
90
- blocker: string,
91
- handoff: string,
92
- next?: Route | string | null,
93
- target?: RouteTarget | null,
94
- ): string[] {
95
- const words = this.#words;
96
- // The `handoff:` cell is a path value — normalized to the repoRoot-relative
97
- // shape through the ONE value object (D47 · the ONE basis; `handoffPath` sources
98
- // it absolute).
99
- const cells: Record<CapsuleKey, string> = {
100
- status,
101
- blocker,
102
- handoff: this.#rel(handoff),
103
- };
104
- const capsuleLine = words
105
- .capsuleKeys()
106
- .map((kind) => `${kind}: ${cells[kind]}`)
107
- .join(words.capsuleSeparator());
108
- const lines = [capsuleLine];
109
- if (next !== undefined && next !== null) {
110
- const text = typeof next === "string" ? next : this.#routeText(next, target);
111
- lines.push(`${words.station("next")} ${text}`);
112
- }
113
- return lines;
114
- }
115
-
116
- /** The route → `next:` text render — the shared RouteRenderer (D40) unless the
117
- * `done` face's doc-class discrimination fires (a spec doc's declared class decides
118
- * the pipeline entry — or the BLOCKED face when the declaration is absent, spec
119
- * §12 · D34). The capsule resolves the doc-class, then hands the resulting Route
120
- * (a `handoff` carrying the entry, or the bare `done`) to the same renderer. */
121
- #routeText(route: Route, target?: RouteTarget | null): string {
122
- if (route.kind === "done" && target != null) {
123
- const verdict = this.#docClassOf(target);
124
- if (verdict === "blocked") {
125
- return `${this.#words.station("blocked")} ${this.#words.routeWord("docType")}`;
126
- }
127
- // The declared doc-class (or a bare terminal) picks the pipeline entry — the
128
- // same resolver + renderer the board consumes.
129
- const key = verdict === "terminal" ? null : verdict;
130
- return this.#route.render(NextStepRouter.resolve({ kind: "done" }, key), target);
131
- }
132
- return this.#route.render(route, target);
133
- }
134
-
135
- /** The target → doc-class verdict of the unified next face — the doc-class
136
- * discrimination face (D33): the spec doc's class reads its DECLARED type (the
137
- * front-matter `doc-type:` key, spec §12 · D34 — BoardView.readDocType,
138
- * the one declaration reading face), never the filename suffix; the task-face
139
- * targets key by type. `blocked` — the key is missing (the caller
140
- * renders the BLOCKED face); `terminal` — no pipeline seam carries the declared
141
- * class (`single-spec`, the table's five keys exclude it — the bare word). */
142
- #docClassOf(target: RouteTarget): "blocked" | "terminal" | PipelineKey {
143
- if (target.type === "spec") {
144
- // The read face takes the value object + the repoRoot-relative id (T4 §2.2);
145
- // a `null` root (the hermetic default) keeps the value as its own basis. The
146
- // `#rel` branded return needs no cast here (F3).
147
- const declared = BoardView.readDocType(this.#root ?? new RepoRoot(""), this.#rel(target.id));
148
- return declared === null ? "blocked" : declared === "single-spec" ? "terminal" : declared;
149
- }
150
- if (target.type === "plan") return "plan";
151
- if (target.type === "wave") return "wave";
152
- return "branch";
153
- }
154
-
155
- /** One path value normalized to the branded repoRoot-relative `RepoPath` through
156
- * the ONE value object (D47); a `null` root (the hermetic default) passes the
157
- * value through as its own basis. The branded return type carries the §2.2 brand
158
- * to the read face (`BoardView.readDocType`) with NO call-site cast (branch-
159
- * review-1 F3). */
160
- #rel(value: string): RepoPath {
161
- return this.#root === null ? (value as RepoPath) : this.#root.relativize(value);
162
- }
163
- }