@oscaner-skills/cdd-engine 4.13.0 → 4.15.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/dist/contract/census.js +134 -0
- package/dist/contract/pins.js +893 -0
- package/dist/contract/review-criteria.js +332 -0
- package/dist/face/board-view.js +88 -13
- package/dist/face/capsule.js +7 -5
- package/dist/face/cli.js +69 -25
- package/dist/face/declare.js +1 -1
- package/dist/face/lifecycle.js +333 -31
- package/dist/face/preview.js +6 -4
- package/dist/face/words.js +21 -0
- package/dist/render/templates.js +499 -121
- package/dist/session/handoff-schema.js +137 -5
- package/dist/session/ledger.js +7 -9
- package/dist/session/round-artifacts.js +10 -0
- package/dist/session/run.js +5 -3
- package/package.json +1 -1
package/dist/face/cli.js
CHANGED
|
@@ -768,7 +768,7 @@ export class Cli {
|
|
|
768
768
|
scene.briefPath = this.#gate.renderBrief(scene, parsed, text, doc);
|
|
769
769
|
}
|
|
770
770
|
const statuses = [];
|
|
771
|
-
const { step: dispatch, harness } = await this.#dispatchOf(scene, parsed, recovery
|
|
771
|
+
const { step: dispatch, harness } = await this.#dispatchOf(scene, parsed, recovery !== null, artifacts);
|
|
772
772
|
const run = new Lifecycle({
|
|
773
773
|
face: scene.face,
|
|
774
774
|
state: scene.state,
|
|
@@ -832,11 +832,20 @@ export class Cli {
|
|
|
832
832
|
// derivation), and the early return means no write point below ever runs
|
|
833
833
|
// (`renderBrief` skipped above, `#bookkeep`/`#reject` never reached).
|
|
834
834
|
if (parsed.dryRun) {
|
|
835
|
-
// The
|
|
836
|
-
//
|
|
837
|
-
//
|
|
838
|
-
//
|
|
839
|
-
|
|
835
|
+
// The three pre-dispatch gates — carrier-integrity, dispatch-input and
|
|
836
|
+
// artifact-identity — are PURE reads (a digest comparison, the layout's supplied
|
|
837
|
+
// cells + the matrix's names + the strict sidecar schema), so the preview asks
|
|
838
|
+
// the SAME judgments the real dispatch applies, in the same order, and prints
|
|
839
|
+
// the first refusal verbatim — a dry run that stayed silent here would forecast
|
|
840
|
+
// a dispatch the real run refuses. `mode: "preview"` is the dispatch-input
|
|
841
|
+
// gate's ONE weaker (permissive) arm: a brief it would render itself is answered
|
|
842
|
+
// by its naming line, never by an existence read; every other cell is judged
|
|
843
|
+
// identically.
|
|
844
|
+
const refused = harness === null
|
|
845
|
+
? null
|
|
846
|
+
: (harness.carrierRefusal(frame) ??
|
|
847
|
+
harness.inputRefusal(frame, "preview") ??
|
|
848
|
+
harness.artifactRefusal(frame));
|
|
840
849
|
const preview = new Preview({ scene, words: this.#words });
|
|
841
850
|
if (refused !== null) {
|
|
842
851
|
for (const line of preview.artifactBlock(verb, refused))
|
|
@@ -921,18 +930,20 @@ export class Cli {
|
|
|
921
930
|
async #dispatchOf(scene, parsed, recovered, artifacts) {
|
|
922
931
|
if (this.#dispatch !== null)
|
|
923
932
|
return { step: this.#dispatch, harness: null };
|
|
924
|
-
const harness =
|
|
933
|
+
const harness = this.#lifecycleOf(scene, parsed, artifacts);
|
|
925
934
|
// The abort fold already ran at the composition root's `--recover` judgment
|
|
926
|
-
// (`#recoverRun`) when
|
|
927
|
-
//
|
|
928
|
-
if (recovered
|
|
935
|
+
// (`#recoverRun`) when `recovered`; the injected/default face keeps its own fold
|
|
936
|
+
// here, so the takeover always precedes this dispatch's own record.
|
|
937
|
+
if (!recovered && !parsed.dryRun && parsed.args.recover === "true") {
|
|
929
938
|
await harness.foldAbort();
|
|
930
939
|
}
|
|
931
|
-
// The harness itself rides back so the `--dry-run` branch can ask it the
|
|
932
|
-
//
|
|
933
|
-
//
|
|
934
|
-
//
|
|
935
|
-
//
|
|
940
|
+
// The harness itself rides back so the `--dry-run` branch can ask it the three
|
|
941
|
+
// pre-dispatch gates' PURE reads — the carrier-integrity judgment, then the
|
|
942
|
+
// dispatch-input judgment, then the artifact-identity one, the order this face's own
|
|
943
|
+
// dispatch applies them in (the same judgments `step()` applies), and the preview can
|
|
944
|
+
// print the real run's refusal instead of forecasting a dispatch it would refuse. The
|
|
945
|
+
// injected `#dispatch` seam has no harness — a hermetic caller already replaced the
|
|
946
|
+
// whole dispatch, so there is no gate to ask.
|
|
936
947
|
return { step: harness.step(), harness };
|
|
937
948
|
}
|
|
938
949
|
/** The `--recover` judgment (spec §2.1①–③) — the two legs, judged in order and
|
|
@@ -949,13 +960,16 @@ export class Cli {
|
|
|
949
960
|
* and `implement --recover` take leg ① only (never a reopen), wave lines likewise
|
|
950
961
|
* (their reopen face stays P29's brief-drift). */
|
|
951
962
|
async #recoverRun(verb, type, scene, parsed, inflight, artifacts) {
|
|
952
|
-
|
|
963
|
+
// The fold rides a throwaway harness: this judgment runs BEFORE the wave brief is
|
|
964
|
+
// rendered, and the DISPATCHING harness must be built afterwards (its scene snapshot
|
|
965
|
+
// carries `briefPath` — the dispatch-input gate reads it). `foldAbort` touches only
|
|
966
|
+
// the in-flight record and the ledger, so a pre-brief instance is enough.
|
|
953
967
|
const stale = (await inflight.staleState()) !== null;
|
|
954
968
|
if (stale)
|
|
955
|
-
await
|
|
969
|
+
await this.#lifecycleOf(scene, parsed, artifacts).foldAbort();
|
|
956
970
|
const reopened = await this.#reopenLeg(verb, type, scene, inflight);
|
|
957
971
|
if (stale || reopened)
|
|
958
|
-
return { kind: "allowed"
|
|
972
|
+
return { kind: "allowed" };
|
|
959
973
|
return { kind: "blocked", message: RECOVER_NOTHING };
|
|
960
974
|
}
|
|
961
975
|
/** The reopen leg (spec §2.3) — its three conditions judged here, and the stamp
|
|
@@ -989,9 +1003,14 @@ export class Cli {
|
|
|
989
1003
|
const latest = Math.max(...completed);
|
|
990
1004
|
return ledger.supersedeReview(identity.key, latest, latest + 1);
|
|
991
1005
|
}
|
|
992
|
-
/** The invocation's lifecycle harness — the production dispatch face,
|
|
993
|
-
*
|
|
994
|
-
*
|
|
1006
|
+
/** The invocation's lifecycle harness — the production dispatch face, built at the
|
|
1007
|
+
* point of use and never held across the brief render. The scene snapshot it copies
|
|
1008
|
+
* carries `briefPath`, which `CliGate#renderBrief` writes and the dispatch-input gate
|
|
1009
|
+
* reads, so the dispatching instance must be built AFTER the brief lands — building
|
|
1010
|
+
* it earlier snapshots `briefPath: null` and refuses every dispatch. The `--recover`
|
|
1011
|
+
* abort fold (the takeover that precedes the stamp, spec §2.1④) therefore rides its
|
|
1012
|
+
* own throwaway instance in `#recoverRun`: it touches only the in-flight record and
|
|
1013
|
+
* the ledger, so a pre-brief instance is enough. */
|
|
995
1014
|
#lifecycleOf(scene, parsed, artifacts) {
|
|
996
1015
|
return new CliLifecycle({
|
|
997
1016
|
env: process.env,
|
|
@@ -1008,6 +1027,8 @@ export class Cli {
|
|
|
1008
1027
|
baseBranch: this.#baseBranchOf(scene),
|
|
1009
1028
|
specLink: scene.specLink,
|
|
1010
1029
|
overallLink: scene.overallLink,
|
|
1030
|
+
program: scene.program,
|
|
1031
|
+
docType: scene.docType,
|
|
1011
1032
|
},
|
|
1012
1033
|
reviews: parsed.paths.reviews,
|
|
1013
1034
|
// The explicit takeover flag (`--recover`): the ONLY path that displaces a
|
|
@@ -1019,8 +1040,13 @@ export class Cli {
|
|
|
1019
1040
|
}
|
|
1020
1041
|
/** The branch scope anchor (BASE_BRANCH) — the base artifact's branch name read
|
|
1021
1042
|
* from the line's own workspace (`base.json`, the same `base get` source the CLI
|
|
1022
|
-
* writes). "" when the artifact is absent or malformed
|
|
1023
|
-
*
|
|
1043
|
+
* writes). "" when the artifact is absent or malformed.
|
|
1044
|
+
*
|
|
1045
|
+
* WAS: the empty slot was dropped and the wave / branch review silently fell back
|
|
1046
|
+
* to judging the live tree. NOW: P38 §2.3 reversal ④ — `BASE_BRANCH` is required on
|
|
1047
|
+
* every wave / branch face, so an empty value is `empty-value` at the
|
|
1048
|
+
* dispatch-input gate: the round stops before the child exists (the recovery is
|
|
1049
|
+
* `cdd base set`, the orchestrator's action, never the gate's). */
|
|
1024
1050
|
#baseBranchOf(scene) {
|
|
1025
1051
|
const name = this.#matrix.render({ domain: "workspace", tasks: null }, "base");
|
|
1026
1052
|
const read = scene.workspace.readJson(name);
|
|
@@ -1238,10 +1264,22 @@ export class Cli {
|
|
|
1238
1264
|
const identityPath = identityRead?.kind === "ok" ? identityRead.path : null;
|
|
1239
1265
|
// The spec link is the SAME read's path rebased to repoRoot-relative (D46 · T3), so
|
|
1240
1266
|
// every round-context path token speaks ONE basis (the child spawns at cwd = the
|
|
1241
|
-
// repo root) and the anchor and the frontier can never name two documents.
|
|
1242
|
-
|
|
1267
|
+
// repo root) and the anchor and the frontier can never name two documents. The wave
|
|
1268
|
+
// line reads it on the same rule as the plan / branch lines (P37 §4.1): a code
|
|
1269
|
+
// review that cannot open the phase contract is the constructive blind spot the
|
|
1270
|
+
// phase closes.
|
|
1271
|
+
if (type === "plan" || type === "branch" || type === "wave") {
|
|
1243
1272
|
specLink = identityPath === null ? null : root.relativize(identityPath);
|
|
1244
1273
|
}
|
|
1274
|
+
// P37 §4.1 — the wave line's charter anchor. The two anchors are judged
|
|
1275
|
+
// INDEPENDENTLY: the spec anchor follows the identity document's own resolution
|
|
1276
|
+
// (a single-spec resolves fine and owns no `program:` by design), the charter
|
|
1277
|
+
// anchor follows that document's `program:` alone. Coupling them would strip a
|
|
1278
|
+
// single-spec phase's spec anchor — the blind spot this phase closes.
|
|
1279
|
+
if (type === "wave" && identityPath !== null && specDoc?.program != null) {
|
|
1280
|
+
const overallEntry = index.overallOf(specDoc.program);
|
|
1281
|
+
overallLink = overallEntry === null ? null : root.relativize(overallEntry.path);
|
|
1282
|
+
}
|
|
1245
1283
|
// The pipeline frontier's four declared cells (§11) — the composition root's ONE
|
|
1246
1284
|
// collection point. The identity word + path come from the document index's read
|
|
1247
1285
|
// (never the argv `--type` spelling): every non-plan declared document owns the
|
|
@@ -1270,6 +1308,12 @@ export class Cli {
|
|
|
1270
1308
|
briefPath: null,
|
|
1271
1309
|
specLink,
|
|
1272
1310
|
overallLink,
|
|
1311
|
+
// P38 §2.1 — the two DECLARED cells the dispatch-input gate reads instead of
|
|
1312
|
+
// parsing a document at dispatch: the identity document's `program:` literal
|
|
1313
|
+
// and its `doc-type:` shape, taken from the SAME index entry `specLink` and
|
|
1314
|
+
// `overallLink` were resolved from (one read, three facts).
|
|
1315
|
+
program: specDoc?.program ?? null,
|
|
1316
|
+
docType: specDoc?.docType ?? null,
|
|
1273
1317
|
},
|
|
1274
1318
|
artifacts,
|
|
1275
1319
|
};
|
package/dist/face/declare.js
CHANGED
|
@@ -168,7 +168,7 @@ export const CLI_COMMANDS = [
|
|
|
168
168
|
{
|
|
169
169
|
name: "fix",
|
|
170
170
|
description: "fix review findings — wave | branch | phase-spec | overall | plan | single-spec",
|
|
171
|
-
example: "cdd fix --type wave --tasks 1 --reviews tasks-1-review-1.json",
|
|
171
|
+
example: "cdd fix --type wave --tasks 1 --reviews .kairos/cdd/<slug>/tasks-1-review-1.json",
|
|
172
172
|
keys: [
|
|
173
173
|
{ key: "type", required: true },
|
|
174
174
|
{ key: "tasks" },
|