@oscaner-skills/cdd-engine 3.0.1 → 4.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.
- 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/capsule.js +18 -10
- package/dist/face/cli.js +170 -60
- package/dist/face/declare.js +5 -6
- package/dist/face/host.js +1 -1
- package/dist/face/lifecycle.js +192 -92
- package/dist/face/preview.js +1 -1
- package/dist/face/termination.js +33 -5
- package/dist/face/words.js +73 -8
- 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 +84 -72
- 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 +28 -16
- package/dist/session/wave.js +30 -7
- package/package.json +1 -1
package/dist/face/capsule.js
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
// · next:` word-face steady state). Capsule#emit renders the ALL-OP single stdout
|
|
4
4
|
// face — the capsule the orchestrator greps / routes on without opening the handoff:
|
|
5
5
|
//
|
|
6
|
-
// status: <status> · blocker: <blocker> · handoff: <handoff>
|
|
6
|
+
// status: <status> · blocker: <blocker> · handoff: <handoff> (success statuses)
|
|
7
|
+
// status: <status> [· handoff: <crash>] (TIMEOUT / BLOCKED)
|
|
7
8
|
// next: <suggestion> (optional — the C5 route / a caller-rendered text)
|
|
8
9
|
//
|
|
10
|
+
// The key set is the word table's single source (`Words.capsuleKeys(status,
|
|
11
|
+
// withHandoff)`) — a failure status drops the blocker cell whose value would be a
|
|
12
|
+
// filler, and keeps the handoff cell only when the round wrote a crash record.
|
|
13
|
+
//
|
|
9
14
|
// The byte face is v1-pinned: the key words (status · blocker · handoff) are
|
|
10
15
|
// pin-enforced by the CapsuleKey type and the emit signature — a data-only change
|
|
11
16
|
// cannot reshape them. What rides the injected Words table (the single word-table
|
|
@@ -63,14 +68,17 @@ export class Capsule {
|
|
|
63
68
|
this.#root = root;
|
|
64
69
|
this.#route = new RouteRenderer(words, channels, host, root);
|
|
65
70
|
}
|
|
66
|
-
/** emit(status, blocker, handoff, next, target) → the capsule stdout
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
|
|
71
|
+
/** emit(status, blocker, handoff, next, target, withHandoff) → the capsule stdout
|
|
72
|
+
* lines: the status-class key set from the word table (a success status renders
|
|
73
|
+
* `status · blocker · handoff`; a failure status renders `status`, plus `handoff`
|
|
74
|
+
* only when the round wrote a crash record), then the optional `next:` line (a
|
|
75
|
+
* caller-rendered text, a C5 Route rendered as the complete executable command, or
|
|
76
|
+
* null/absent → no line). The additive optional RouteTarget supplies the frame's
|
|
77
|
+
* own type + id + plan for the executable literal (P4.1 T4); without it the route
|
|
78
|
+
* renders its bare classifier fallbacks (the 4-param signature stays byte-pinned).
|
|
79
|
+
* `withHandoff` is the caller's crash-record fact — the key set remains the table's
|
|
80
|
+
* single source (this render adds no status special case). */
|
|
81
|
+
emit(status, blocker, handoff, next, target, withHandoff = false) {
|
|
74
82
|
const words = this.#words;
|
|
75
83
|
// The `handoff:` cell is a path value — normalized to the repoRoot-relative
|
|
76
84
|
// shape through the ONE value object (D47 · the ONE basis; `handoffPath` sources
|
|
@@ -81,7 +89,7 @@ export class Capsule {
|
|
|
81
89
|
handoff: this.#rel(handoff),
|
|
82
90
|
};
|
|
83
91
|
const capsuleLine = words
|
|
84
|
-
.capsuleKeys()
|
|
92
|
+
.capsuleKeys(status, withHandoff)
|
|
85
93
|
.map((kind) => `${kind}: ${cells[kind]}`)
|
|
86
94
|
.join(words.capsuleSeparator());
|
|
87
95
|
const lines = [capsuleLine];
|
package/dist/face/cli.js
CHANGED
|
@@ -48,13 +48,13 @@ import { CommanderError } from "commander";
|
|
|
48
48
|
import { declaredRegistries } from "../contract/declare.js";
|
|
49
49
|
import { PlanDocType } from "../contract/doc.js";
|
|
50
50
|
import { FrontMatterExtractor } from "../contract/frontmatter.js";
|
|
51
|
-
import { FileExistenceInvariant } from "../contract/invariants.js";
|
|
52
51
|
import { Contract } from "../contract/judge.js";
|
|
53
52
|
import { Projector } from "../contract/project.js";
|
|
54
53
|
import { Translator } from "../contract/translate.js";
|
|
55
54
|
import { ConfigLoader } from "../infra/config.js";
|
|
56
55
|
import { GitClient } from "../infra/git.js";
|
|
57
56
|
import { RepoRoot } from "../infra/root.js";
|
|
57
|
+
import { SlugIndex } from "../infra/slug-index.js";
|
|
58
58
|
import { Workspace, WorkspaceRoot } from "../infra/workspace.js";
|
|
59
59
|
import { BriefRenderer } from "../render/brief.js";
|
|
60
60
|
import { IssueBodyRenderer } from "../render/issue-body.js";
|
|
@@ -254,37 +254,79 @@ export class Cli {
|
|
|
254
254
|
this.#exitCode = this.#artifacts.runIssue();
|
|
255
255
|
});
|
|
256
256
|
// the board observability command — a pure read (no preflight gate)
|
|
257
|
-
commandNode("board").action(async (
|
|
257
|
+
commandNode("board").action(async (_opts, command) => {
|
|
258
258
|
this.#exitCode = await this.#runBoard(command, this.#runInput(null, command));
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
-
/** `cdd board <
|
|
262
|
-
* zero preflight gate, zero tree writes, zero ledger
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
261
|
+
/** `cdd board --plan <path> / --spec <path>` — the entry document's progress board
|
|
262
|
+
* (spec §3.1): a PURE READ — zero preflight gate, zero tree writes, zero ledger
|
|
263
|
+
* writes, zero child dispatch. At least one path flag is required (missing →
|
|
264
|
+
* usage exit 2); each path resolves through the ONE identity index (`SlugIndex`
|
|
265
|
+
* scans every docRoot), so a path outside the docRoots or absent on disk is
|
|
266
|
+
* the not-found face (exit 2, zero doc reads, zero BLOCKED markers). Two flags
|
|
267
|
+
* naming different slugs are an argument conflict (exit 2, both values on
|
|
268
|
+
* stderr); two flags on one slug render ONE board shaped by the `--spec`
|
|
269
|
+
* document's `doc-type:`. The host is detected once for the pipeline-entry ref
|
|
270
|
+
* render (REFS[ref][host], the same judgment the capsule injects). */
|
|
270
271
|
async #runBoard(node, parsed) {
|
|
271
272
|
this.#assertDryRunScope(node, parsed.dryRun);
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
const planArg = parsed.args.plan;
|
|
274
|
+
const specArg = parsed.args.spec;
|
|
275
|
+
if (planArg === undefined && specArg === undefined)
|
|
276
|
+
this.#usage(node, "cdd board: pass --plan and/or --spec");
|
|
275
277
|
const repoRoot = await this.#rootOf();
|
|
276
278
|
if (repoRoot === null)
|
|
277
279
|
return 1;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
const root = new RepoRoot(repoRoot);
|
|
281
|
+
const planRel = planArg === undefined ? null : this.#relativizePath(root, planArg);
|
|
282
|
+
const specRel = specArg === undefined ? null : this.#relativizePath(root, specArg);
|
|
283
|
+
// The not-found face reads ZERO documents (spec §3.1): a path outside the two
|
|
284
|
+
// doc roots or absent on disk refuses BEFORE the identity scan — the scan is
|
|
285
|
+
// this face's only document-reading step, and it never runs for this verdict.
|
|
286
|
+
const planMissing = planRel !== null &&
|
|
287
|
+
(!SlugIndex.insideDocRoots(planRel) || !existsSync(root.resolve(planRel)));
|
|
288
|
+
const specMissing = specRel !== null &&
|
|
289
|
+
(!SlugIndex.insideDocRoots(specRel) || !existsSync(root.resolve(specRel)));
|
|
290
|
+
if (planMissing || specMissing)
|
|
291
|
+
return this.#boardNotFound([
|
|
292
|
+
planMissing ? `--plan ${planArg}` : null,
|
|
293
|
+
specMissing ? `--spec ${specArg}` : null,
|
|
294
|
+
]);
|
|
295
|
+
const index = SlugIndex.build(repoRoot);
|
|
296
|
+
const planEntry = planRel === null ? null : index.entryAt(planRel);
|
|
297
|
+
const specEntry = specRel === null ? null : index.entryAt(specRel);
|
|
298
|
+
const unmatched = [
|
|
299
|
+
planRel !== null && planEntry === null ? `--plan ${planArg}` : null,
|
|
300
|
+
specRel !== null && specEntry === null ? `--spec ${specArg}` : null,
|
|
301
|
+
].filter((part) => part !== null);
|
|
302
|
+
if (unmatched.length > 0)
|
|
303
|
+
return this.#boardNotFound(unmatched);
|
|
304
|
+
const planSlug = planEntry?.slug ?? null;
|
|
305
|
+
const specSlug = specEntry?.slug ?? null;
|
|
306
|
+
if (planEntry !== null &&
|
|
307
|
+
specEntry !== null &&
|
|
308
|
+
SlugIndex.isLegalSlug(planSlug) &&
|
|
309
|
+
SlugIndex.isLegalSlug(specSlug) &&
|
|
310
|
+
planSlug !== specSlug) {
|
|
311
|
+
this.#io.stderr(`cdd board: --plan slug "${planSlug}" conflicts with --spec slug "${specSlug}"\n`);
|
|
280
312
|
return 2;
|
|
281
313
|
}
|
|
314
|
+
const entry = specEntry ?? planEntry;
|
|
315
|
+
if (entry === null)
|
|
316
|
+
return 2;
|
|
282
317
|
const host = HostDetect.detect(process.env);
|
|
283
|
-
const board = BoardView.render(
|
|
318
|
+
const board = BoardView.render(index, entry, repoRoot, this.#words, host, ARGV_CHANNEL);
|
|
284
319
|
for (const line of board.lines)
|
|
285
320
|
this.#io.stdout(`${line}\n`);
|
|
286
321
|
return board.exitCode;
|
|
287
322
|
}
|
|
323
|
+
/** The board's not-found face (spec §3.1) — the ONE stderr line + exit 2 the
|
|
324
|
+
* pre-scan membership/existence probe and the post-scan entry lookup share. */
|
|
325
|
+
#boardNotFound(parts) {
|
|
326
|
+
const named = parts.filter((part) => part !== null);
|
|
327
|
+
this.#io.stderr(`cdd board: no docs match ${named.join(" and ")}\n`);
|
|
328
|
+
return 2;
|
|
329
|
+
}
|
|
288
330
|
/** The thin shell's run input — commander's parsed opts mapped to the domain
|
|
289
331
|
* run's consumption face (the parseArg-normalized values ride through verbatim:
|
|
290
332
|
* int-list → the comma string · enum → the value · sha → the short form · the
|
|
@@ -536,11 +578,12 @@ export class Cli {
|
|
|
536
578
|
// (dry-run) and rendered every mid-run closure as `next: done` (the per-step
|
|
537
579
|
// next was already consumed). The ledger-mirrored cursor above + markTerminal
|
|
538
580
|
// together keep one wave phase per invocation.
|
|
581
|
+
// The timeout counter's call site (§4.2): a round that was cut short lands, the
|
|
582
|
+
// count goes up by one — driven by the termination fact alone, never the status
|
|
583
|
+
// word (the counter's only production writer).
|
|
584
|
+
if (step.termination !== undefined)
|
|
585
|
+
scene.ledger.incrementTimeoutCount();
|
|
539
586
|
if (lastStatus === "BLOCKED" || lastStatus === "TIMEOUT") {
|
|
540
|
-
// The timeout counter's call site (§4.2): a TIMEOUT round lands, the count
|
|
541
|
-
// goes up by one — the counter's only production writer.
|
|
542
|
-
if (lastStatus === "TIMEOUT")
|
|
543
|
-
scene.ledger.incrementTimeoutCount();
|
|
544
587
|
for (const line of latest)
|
|
545
588
|
this.#io.stdout(`${line}\n`);
|
|
546
589
|
return 1;
|
|
@@ -576,9 +619,9 @@ export class Cli {
|
|
|
576
619
|
const harness = new CliLifecycle({
|
|
577
620
|
env: process.env,
|
|
578
621
|
sync: this.#sync,
|
|
579
|
-
config: this.#config,
|
|
580
622
|
template: this.#template,
|
|
581
623
|
io: this.#io,
|
|
624
|
+
words: this.#words,
|
|
582
625
|
scene: {
|
|
583
626
|
workspace: scene.workspace,
|
|
584
627
|
ledger: scene.ledger,
|
|
@@ -586,6 +629,7 @@ export class Cli {
|
|
|
586
629
|
briefPath: scene.briefPath,
|
|
587
630
|
baseBranch: this.#baseBranchOf(scene),
|
|
588
631
|
specLink: scene.specLink,
|
|
632
|
+
overallLink: scene.overallLink,
|
|
589
633
|
},
|
|
590
634
|
reviews: parsed.paths.reviews,
|
|
591
635
|
});
|
|
@@ -666,23 +710,45 @@ export class Cli {
|
|
|
666
710
|
const planPath = planRel === null ? null : root.resolve(planRel);
|
|
667
711
|
const specRel = parsed.paths.spec;
|
|
668
712
|
const specPath = specRel === null ? null : root.resolve(specRel);
|
|
713
|
+
// The identity index — the ONE slug judgment (spec §2.1/§2.2). The workspace
|
|
714
|
+
// key is the target document's declared `slug:`; the same index supplies the
|
|
715
|
+
// same-slug spec link and the duplicate gates.
|
|
716
|
+
const index = SlugIndex.build(repoRoot);
|
|
669
717
|
let slug;
|
|
670
718
|
let planText = null;
|
|
671
719
|
let specLink = null;
|
|
720
|
+
let overallLink = null;
|
|
672
721
|
let target = null;
|
|
673
722
|
switch (type) {
|
|
674
723
|
case "wave": {
|
|
675
724
|
if (planPath === null || planRel === null)
|
|
676
725
|
this.#usage(node, `cdd ${verb} --type wave: missing required --plan <path>`);
|
|
677
|
-
slug = Workspace.slugFromDoc(planPath);
|
|
678
726
|
planText = this.#artifacts.readText(node, root, planRel);
|
|
727
|
+
const resolved = this.#targetSlug(index, planRel, planText);
|
|
728
|
+
if (resolved === null)
|
|
729
|
+
return null;
|
|
730
|
+
slug = resolved;
|
|
679
731
|
break;
|
|
680
732
|
}
|
|
681
733
|
case "spec": {
|
|
682
|
-
if (specPath === null)
|
|
734
|
+
if (specPath === null || specRel === null)
|
|
683
735
|
this.#usage(node, `cdd ${verb} --type spec: missing required --spec <path>`);
|
|
684
|
-
slug
|
|
736
|
+
// An unreadable target declares no identity: the SAME slug carrier hard-refuses
|
|
737
|
+
// it (CDD_BLOCKED + exit 1, never a filename-derived key). The T7 null-verdict
|
|
738
|
+
// face covers the other shape — a document ON DISK that declares no
|
|
739
|
+
// `doc-type:` / `slug:`.
|
|
740
|
+
const resolved = this.#targetSlug(index, specRel, this.#readTarget(root, specRel));
|
|
741
|
+
if (resolved === null)
|
|
742
|
+
return null;
|
|
743
|
+
slug = resolved;
|
|
685
744
|
target = { kind: "spec", doc: specPath };
|
|
745
|
+
// The judged spec's own `program:` — the parent charter (INPUT_OVERALL) the
|
|
746
|
+
// spec-scope reviewer judges the phase against. A spec without `program:`
|
|
747
|
+
// (a single-spec) leaves the slot null; an off-disk target reads null here
|
|
748
|
+
// and the existing slug-ref invariant reports it (never a second reporter).
|
|
749
|
+
const specEntry = index.entryAt(specRel);
|
|
750
|
+
const overallEntry = specEntry?.program == null ? null : index.overallOf(specEntry.program);
|
|
751
|
+
overallLink = overallEntry === null ? null : root.relativize(overallEntry.path);
|
|
686
752
|
break;
|
|
687
753
|
}
|
|
688
754
|
case "plan":
|
|
@@ -690,29 +756,28 @@ export class Cli {
|
|
|
690
756
|
case "branch": {
|
|
691
757
|
// The plan-doc seam (shared by the plan + branch lines): the target plan
|
|
692
758
|
// must exist (a required fact for both — the branch review/fix faces carry
|
|
693
|
-
// `--plan`), its text is read ONCE, and the
|
|
694
|
-
// (the `
|
|
695
|
-
//
|
|
696
|
-
//
|
|
697
|
-
//
|
|
698
|
-
//
|
|
699
|
-
//
|
|
700
|
-
//
|
|
701
|
-
//
|
|
702
|
-
// (the audit target is the branch itself, its workspace identity is the plan
|
|
703
|
-
// path, and the review's scope anchor BASE_BRANCH is engine-injected from the
|
|
704
|
-
// base artifact) — both faces carry the plan + its spec anchor.
|
|
759
|
+
// `--plan`), its text is read ONCE, and the same-slug identity document
|
|
760
|
+
// (the index's `identityDoc` — never a path scalar) supplies the round
|
|
761
|
+
// context's extra read input. The link is rebased to repoRoot-relative
|
|
762
|
+
// (D46 · T3) so every round-context path token speaks ONE basis (the child
|
|
763
|
+
// is spawned at cwd = repoRoot). The plan review judges the plan doc; the
|
|
764
|
+
// branch line carries no commit identity (the audit target is the branch
|
|
765
|
+
// itself, its workspace identity is the plan path, and the review's scope
|
|
766
|
+
// anchor BASE_BRANCH is engine-injected from the base artifact) — both
|
|
767
|
+
// faces carry the plan + its same-slug spec anchor.
|
|
705
768
|
if (planPath === null || planRel === null)
|
|
706
769
|
this.#usage(node, `cdd ${verb} --type ${type}: missing required --plan <path>`);
|
|
707
|
-
slug = Workspace.slugFromDoc(planPath);
|
|
708
770
|
planText = this.#artifacts.readText(node, root, planRel);
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
771
|
+
const resolved = this.#targetSlug(index, planRel, planText);
|
|
772
|
+
if (resolved === null)
|
|
773
|
+
return null;
|
|
774
|
+
slug = resolved;
|
|
775
|
+
const specEntry = index.identityDoc(slug);
|
|
776
|
+
specLink = specEntry === null ? null : root.relativize(specEntry.path);
|
|
777
|
+
// The plan/branch line reads the same-slug identity document's `program:` —
|
|
778
|
+
// the parent charter (INPUT_OVERALL) the reviewer judges the plan against.
|
|
779
|
+
const overallEntry = specEntry?.program == null ? null : index.overallOf(specEntry.program);
|
|
780
|
+
overallLink = overallEntry === null ? null : root.relativize(overallEntry.path);
|
|
716
781
|
target = type === "plan" ? { kind: "plan", doc: planPath } : { kind: "branch" };
|
|
717
782
|
break;
|
|
718
783
|
}
|
|
@@ -740,8 +805,60 @@ export class Cli {
|
|
|
740
805
|
router: new NextStepRouter(),
|
|
741
806
|
briefPath: null,
|
|
742
807
|
specLink,
|
|
808
|
+
overallLink,
|
|
743
809
|
};
|
|
744
810
|
}
|
|
811
|
+
/** The dispatch target's workspace key — the document's declared `slug:`
|
|
812
|
+
* (spec §2.1 · §2.4). ONE read face shared by the three work verbs and `base`:
|
|
813
|
+
* an unreadable target, a missing `slug:`, an illegal value, or a slug the index
|
|
814
|
+
* judges duplicated (identity or plan) each render the CDD_BLOCKED station and
|
|
815
|
+
* return null (exit 1 at the caller — never the board's exit 2). The duplicate
|
|
816
|
+
* judgment reads the SAME `SlugIndex` the board renders, so the two faces never
|
|
817
|
+
* diverge (one fact, two carriers). The caller passes the document text it
|
|
818
|
+
* already holds — the identity read never opens the file a second time. */
|
|
819
|
+
#targetSlug(index, rel, content) {
|
|
820
|
+
// An unreadable target document declares no identity — the workspace key has
|
|
821
|
+
// no source, so the dispatch face refuses on the SAME carrier as a missing
|
|
822
|
+
// `slug:` (never a filename-derived directory).
|
|
823
|
+
if (content === null)
|
|
824
|
+
return this.#slugBlocked(`the target document ${rel} is unreadable — its declared \`slug:\` is the workspace key`);
|
|
825
|
+
const head = FrontMatterExtractor.split(content).head;
|
|
826
|
+
const parseError = head.parseError;
|
|
827
|
+
if (parseError !== null)
|
|
828
|
+
return this.#slugBlocked(this.#words
|
|
829
|
+
.routeWord("frontmatterParse")
|
|
830
|
+
.replace("{reason}", parseError.reason)
|
|
831
|
+
.replace("{line}", String(parseError.line))
|
|
832
|
+
.replace("{column}", String(parseError.column))
|
|
833
|
+
.replace("{source}", parseError.source));
|
|
834
|
+
// The four-way identity gate (present · legal · indexed · unique) is the ONE
|
|
835
|
+
// `SlugIndex` judgment the pre-flight gate also reads — this carrier supplies
|
|
836
|
+
// only the CDD_BLOCKED channel, never a second spelling of the rule.
|
|
837
|
+
const verdict = index.slugVerdict(rel, head.slug);
|
|
838
|
+
return verdict.kind === "accepted"
|
|
839
|
+
? verdict.slug
|
|
840
|
+
: this.#slugBlocked(this.#words.slugRefusal(verdict));
|
|
841
|
+
}
|
|
842
|
+
/** Read a dispatch target's text — null when the file is absent or unreadable.
|
|
843
|
+
* The null is NOT a degradation: every caller hands it to `#targetSlug`, which
|
|
844
|
+
* refuses the target on the slug carrier (CDD_BLOCKED + exit 1). A document
|
|
845
|
+
* that IS readable and declares no `doc-type:` / `slug:` is the separate
|
|
846
|
+
* T7 null-verdict shape. */
|
|
847
|
+
#readTarget(root, rel) {
|
|
848
|
+
try {
|
|
849
|
+
return readFileSync(root.resolve(rel), "utf8");
|
|
850
|
+
}
|
|
851
|
+
catch {
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
/** The dispatch-face critical stop carrier — the CDD_BLOCKED station + the
|
|
856
|
+
* reason row; the caller returns exit 1 (the CDD_BLOCKED channel carries
|
|
857
|
+
* dispatch hard gates only, never a board reject face). */
|
|
858
|
+
#slugBlocked(message) {
|
|
859
|
+
this.#io.stderr(`${this.#words.station("blocked")} ${message}\n`);
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
745
862
|
/** The input funnel — the ONE path normalization landing (T3 · §2.3): every
|
|
746
863
|
* path-typed argv value is relativized to the repo root EXACTLY once, here,
|
|
747
864
|
* before the scene or any downstream face reads it, so no face ever sees a raw
|
|
@@ -798,20 +915,6 @@ export class Cli {
|
|
|
798
915
|
}
|
|
799
916
|
return root;
|
|
800
917
|
}
|
|
801
|
-
/** The plan's `spec:` link target resolved to an ABSOLUTE path (D46) — the
|
|
802
|
-
* plan-review round context's `INPUT_SPEC` (the round-context exit relativizes it
|
|
803
|
-
* to repoRoot along with every other path token). The raw header form is markdown
|
|
804
|
-
* link-space (relative to the plan's own dir — the skeleton's form) or a repoRoot
|
|
805
|
-
* form; the resolution IS the doc-contract's own chain-link judgment, delegated
|
|
806
|
-
* to its ONE home (`FileExistenceInvariant.targetPath`) so a future contract
|
|
807
|
-
* change cannot silently diverge from this mirror (P9 branch-review-1 F8 — never
|
|
808
|
-
* a re-implemented chain). The fallback (neither reading exists) resolves against
|
|
809
|
-
* the plan's own dir — the link-space semantic — so the exit still receives an
|
|
810
|
-
* absolute path (the doc-contract's file-existence finding owns the truly-missing
|
|
811
|
-
* case). */
|
|
812
|
-
#resolveSpecLink(repoRoot, planPath, target) {
|
|
813
|
-
return FileExistenceInvariant.targetPath(repoRoot, planPath, target, (p) => existsSync(p));
|
|
814
|
-
}
|
|
815
918
|
// ---------------------------------------------------------------------------
|
|
816
919
|
// the pure commands — schema / issue / base
|
|
817
920
|
// ---------------------------------------------------------------------------
|
|
@@ -866,11 +969,18 @@ export class Cli {
|
|
|
866
969
|
// the work-command path argv: the stored artifact's path field speaks the ONE
|
|
867
970
|
// canonical shape (repoRoot-relative).
|
|
868
971
|
const planPath = this.#relativizePath(root, planArg);
|
|
972
|
+
// The workspace key is the plan document's `slug:` — the SAME resolution point
|
|
973
|
+
// (and rejection carrier) the work verbs use. `base` carries no pre-flight gate,
|
|
974
|
+
// so a missing / illegal / duplicated slug or an unreadable target stops HERE:
|
|
975
|
+
// CDD_BLOCKED + exit 1 (never a filename-derived key).
|
|
976
|
+
const slug = this.#targetSlug(SlugIndex.build(repoRoot), planPath, this.#readTarget(root, planPath));
|
|
977
|
+
if (slug === null)
|
|
978
|
+
return 1;
|
|
869
979
|
// The workspace is not built here (P11 · §4.2): `base set` builds it through
|
|
870
980
|
// `Workspace.writeJson`'s internal ensure, while the read-only `base get`
|
|
871
981
|
// creates nothing. The read rides `Workspace.readJson`, so the P9 read-time
|
|
872
982
|
// normalization covers `base.json` (the retired migration's job).
|
|
873
|
-
const workspace = new Workspace(new WorkspaceRoot(repoRoot, this.#config.handoffNamespace().workspaceRoot),
|
|
983
|
+
const workspace = new Workspace(new WorkspaceRoot(repoRoot, this.#config.handoffNamespace().workspaceRoot), slug);
|
|
874
984
|
if (parsed.leaf === "set")
|
|
875
985
|
return this.#artifacts.baseSet(node, parsed, planPath, workspace, root);
|
|
876
986
|
if (parsed.leaf === "get")
|
package/dist/face/declare.js
CHANGED
|
@@ -200,19 +200,18 @@ export const CLI_COMMANDS = [
|
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
name: "board",
|
|
203
|
-
description: "render the
|
|
204
|
-
example:
|
|
205
|
-
keys: [],
|
|
206
|
-
positionals: [{ key: "slug", required: true }],
|
|
203
|
+
description: "render the progress board from a --plan or --spec entry (overall/spec/plan/wave/branch)",
|
|
204
|
+
example: `cdd board --plan ${ENGINE_DOC_ROOTS.plans}/p3.md`,
|
|
205
|
+
keys: [{ key: "plan" }, { key: "spec" }],
|
|
207
206
|
},
|
|
208
207
|
];
|
|
209
208
|
/** The schema `<type>` vocabulary — the get leaf's ONE table (spec §5.3): the
|
|
210
|
-
* primary DocKey spellings (overall
|
|
209
|
+
* primary DocKey spellings (overall | plan | phase-spec | single-spec) plus
|
|
211
210
|
* the legacy `phaseSpec` alias row normalized to the kebab key. One normalizing
|
|
212
211
|
* vocabulary, never a second hand-written list — the builder's #parseTypeKey
|
|
213
212
|
* validates through it. */
|
|
214
213
|
export const SCHEMA_TYPE_KEYS = {
|
|
215
|
-
|
|
214
|
+
overall: "overall",
|
|
216
215
|
plan: "plan",
|
|
217
216
|
"phase-spec": "phase-spec",
|
|
218
217
|
"single-spec": "single-spec",
|
package/dist/face/host.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// `/namespace:skill` form; pi the flat `/skill:<bare>` form — the pi flat
|
|
19
19
|
// namespace has no namespace-qualification syntax).
|
|
20
20
|
// · HostDetect — the module-level host judgment (the detection's single home):
|
|
21
|
-
// the dispatch face's detectHost delegates here; the
|
|
21
|
+
// the dispatch face's detectHost delegates here; the delivery face's Capsule wiring
|
|
22
22
|
// reads the same judgment over process.env.
|
|
23
23
|
//
|
|
24
24
|
// P5 lands here: the forbidden parallel-sub-agents prose is deleted from the review
|