@cleocode/cleo 2026.5.112 → 2026.5.113

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/cli/index.js CHANGED
@@ -1219,7 +1219,6 @@ var init_tree = __esm({
1219
1219
  // packages/animations/src/render/index.ts
1220
1220
  var init_render = __esm({
1221
1221
  "packages/animations/src/render/index.ts"() {
1222
- "use strict";
1223
1222
  init_legend();
1224
1223
  init_tree();
1225
1224
  }
@@ -1337,6 +1336,7 @@ var init_spinner_handle = __esm({
1337
1336
  var init_src = __esm({
1338
1337
  "packages/animations/src/index.ts"() {
1339
1338
  init_animate_context();
1339
+ init_render();
1340
1340
  init_spinner_handle();
1341
1341
  }
1342
1342
  });
@@ -1740,6 +1740,63 @@ var init_cli_category = __esm({
1740
1740
  }
1741
1741
  });
1742
1742
 
1743
+ // packages/contracts/src/config/manifest.ts
1744
+ import { z as z4 } from "zod";
1745
+ var PROJECT_INFO_MANIFEST, PROJECT_CONTEXT_MANIFEST, CLEO_CONFIG_MANIFEST, GLOBAL_CLEO_CONFIG_MANIFEST, CONFIG_MANIFEST_ENTRIES, configManifestEntrySchema;
1746
+ var init_manifest = __esm({
1747
+ "packages/contracts/src/config/manifest.ts"() {
1748
+ "use strict";
1749
+ PROJECT_INFO_MANIFEST = {
1750
+ id: "project-info",
1751
+ scope: "metadata",
1752
+ path: ".cleo/project-info.json",
1753
+ mergePrecedence: 0,
1754
+ driftDetection: "schema-validate"
1755
+ };
1756
+ PROJECT_CONTEXT_MANIFEST = {
1757
+ id: "project-context",
1758
+ scope: "metadata",
1759
+ path: ".cleo/project-context.json",
1760
+ mergePrecedence: 0,
1761
+ driftDetection: "staleness-gate"
1762
+ };
1763
+ CLEO_CONFIG_MANIFEST = {
1764
+ id: "cleo-config-project",
1765
+ scope: "project",
1766
+ path: ".cleo/config.json",
1767
+ mergePrecedence: 20,
1768
+ driftDetection: "schema-validate"
1769
+ };
1770
+ GLOBAL_CLEO_CONFIG_MANIFEST = {
1771
+ id: "cleo-config-global",
1772
+ scope: "global",
1773
+ path: "~/.cleo/config.json",
1774
+ mergePrecedence: 10,
1775
+ driftDetection: "schema-validate"
1776
+ };
1777
+ CONFIG_MANIFEST_ENTRIES = Object.freeze([
1778
+ PROJECT_INFO_MANIFEST,
1779
+ PROJECT_CONTEXT_MANIFEST,
1780
+ GLOBAL_CLEO_CONFIG_MANIFEST,
1781
+ CLEO_CONFIG_MANIFEST
1782
+ ]);
1783
+ configManifestEntrySchema = z4.object({
1784
+ id: z4.string().min(1),
1785
+ scope: z4.union([z4.literal("global"), z4.literal("project"), z4.literal("metadata")]),
1786
+ path: z4.string().min(1),
1787
+ schema: z4.unknown().optional(),
1788
+ mergePrecedence: z4.number().int().nonnegative(),
1789
+ driftDetection: z4.union([
1790
+ z4.literal("schema-validate"),
1791
+ z4.literal("staleness-gate"),
1792
+ z4.literal("value-diff"),
1793
+ z4.literal("none")
1794
+ ]),
1795
+ defaults: z4.record(z4.string(), z4.unknown()).optional()
1796
+ });
1797
+ }
1798
+ });
1799
+
1743
1800
  // packages/contracts/src/credentials.ts
1744
1801
  var init_credentials = __esm({
1745
1802
  "packages/contracts/src/credentials.ts"() {
@@ -9688,6 +9745,100 @@ var init_operations_registry = __esm({
9688
9745
  }
9689
9746
  });
9690
9747
 
9748
+ // packages/contracts/src/docs/provenance.ts
9749
+ import { z as z5 } from "zod";
9750
+ var PROVENANCE_NODE_KINDS, PROVENANCE_EDGE_RELATIONS, DOC_LIFECYCLE_STATUSES, provenanceNodeKindSchema, provenanceEdgeRelationSchema, docLifecycleStatusSchema, provenanceNodeBaseFields, provenanceDocNodeSchema, provenanceTaskNodeSchema, provenanceDecisionNodeSchema, provenanceSessionNodeSchema, provenanceMemoryNodeSchema, provenanceNodeSchema, provenanceEdgeSchema, docProvenanceResponseSchema;
9751
+ var init_provenance = __esm({
9752
+ "packages/contracts/src/docs/provenance.ts"() {
9753
+ "use strict";
9754
+ PROVENANCE_NODE_KINDS = [
9755
+ "doc",
9756
+ "task",
9757
+ "decision",
9758
+ "session",
9759
+ "memory"
9760
+ ];
9761
+ PROVENANCE_EDGE_RELATIONS = [
9762
+ "attached-to",
9763
+ "supersedes",
9764
+ "superseded-by",
9765
+ "related-task",
9766
+ "linked-decision",
9767
+ "derived-from"
9768
+ ];
9769
+ DOC_LIFECYCLE_STATUSES = [
9770
+ "active",
9771
+ "superseded",
9772
+ "archived",
9773
+ "draft"
9774
+ ];
9775
+ provenanceNodeKindSchema = z5.enum(PROVENANCE_NODE_KINDS);
9776
+ provenanceEdgeRelationSchema = z5.enum(PROVENANCE_EDGE_RELATIONS);
9777
+ docLifecycleStatusSchema = z5.enum(DOC_LIFECYCLE_STATUSES);
9778
+ provenanceNodeBaseFields = {
9779
+ id: z5.string().min(1),
9780
+ title: z5.string().min(1),
9781
+ metadata: z5.record(z5.string(), z5.unknown()).optional()
9782
+ };
9783
+ provenanceDocNodeSchema = z5.object({
9784
+ ...provenanceNodeBaseFields,
9785
+ kind: z5.literal("doc"),
9786
+ slug: z5.string().min(1),
9787
+ docKind: z5.string().min(1),
9788
+ lifecycleStatus: docLifecycleStatusSchema,
9789
+ publishedAt: z5.string().min(1),
9790
+ supersededAt: z5.string().min(1).optional(),
9791
+ summary: z5.string().optional()
9792
+ });
9793
+ provenanceTaskNodeSchema = z5.object({
9794
+ ...provenanceNodeBaseFields,
9795
+ kind: z5.literal("task"),
9796
+ taskType: z5.enum(["saga", "epic", "task", "subtask"]),
9797
+ status: z5.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
9798
+ });
9799
+ provenanceDecisionNodeSchema = z5.object({
9800
+ ...provenanceNodeBaseFields,
9801
+ kind: z5.literal("decision"),
9802
+ outcome: z5.enum(["proposed", "accepted", "rejected", "superseded"]),
9803
+ decidedAt: z5.string().min(1)
9804
+ });
9805
+ provenanceSessionNodeSchema = z5.object({
9806
+ ...provenanceNodeBaseFields,
9807
+ kind: z5.literal("session"),
9808
+ startedAt: z5.string().min(1),
9809
+ endedAt: z5.string().min(1).optional()
9810
+ });
9811
+ provenanceMemoryNodeSchema = z5.object({
9812
+ ...provenanceNodeBaseFields,
9813
+ kind: z5.literal("memory"),
9814
+ memoryType: z5.enum(["observation", "pattern", "decision", "diary"]),
9815
+ recordedAt: z5.string().min(1)
9816
+ });
9817
+ provenanceNodeSchema = z5.discriminatedUnion("kind", [
9818
+ provenanceDocNodeSchema,
9819
+ provenanceTaskNodeSchema,
9820
+ provenanceDecisionNodeSchema,
9821
+ provenanceSessionNodeSchema,
9822
+ provenanceMemoryNodeSchema
9823
+ ]);
9824
+ provenanceEdgeSchema = z5.object({
9825
+ relation: provenanceEdgeRelationSchema,
9826
+ from: z5.string().min(1),
9827
+ fromKind: provenanceNodeKindSchema,
9828
+ to: z5.string().min(1),
9829
+ toKind: provenanceNodeKindSchema,
9830
+ addedAt: z5.string().min(1),
9831
+ summary: z5.string().optional()
9832
+ });
9833
+ docProvenanceResponseSchema = z5.object({
9834
+ nodes: z5.array(provenanceNodeSchema).readonly(),
9835
+ edges: z5.array(provenanceEdgeSchema).readonly(),
9836
+ totalNodes: z5.number().int().nonnegative(),
9837
+ totalEdges: z5.number().int().nonnegative()
9838
+ });
9839
+ }
9840
+ });
9841
+
9691
9842
  // packages/contracts/src/docs-taxonomy.ts
9692
9843
  import { readFileSync } from "node:fs";
9693
9844
  import { join } from "node:path";
@@ -9762,6 +9913,24 @@ function validateExtensionEntry(raw, source, index) {
9762
9913
  source
9763
9914
  );
9764
9915
  }
9916
+ let requiredSections;
9917
+ if (obj.requiredSections !== void 0) {
9918
+ if (!Array.isArray(obj.requiredSections)) {
9919
+ throw new DocKindConfigError(`${where}: 'requiredSections' must be an array`, source);
9920
+ }
9921
+ const sections = [];
9922
+ for (let i = 0; i < obj.requiredSections.length; i++) {
9923
+ const item = obj.requiredSections[i];
9924
+ if (typeof item !== "string" || item.length === 0) {
9925
+ throw new DocKindConfigError(
9926
+ `${where}: 'requiredSections[${i}]' must be a non-empty string`,
9927
+ source
9928
+ );
9929
+ }
9930
+ sections.push(item);
9931
+ }
9932
+ requiredSections = sections;
9933
+ }
9765
9934
  return {
9766
9935
  kind,
9767
9936
  label,
@@ -9769,7 +9938,8 @@ function validateExtensionEntry(raw, source, index) {
9769
9938
  defaultOwnerKind,
9770
9939
  publishDir,
9771
9940
  requiresEntityId,
9772
- ...entityIdPattern !== void 0 ? { entityIdPattern } : {}
9941
+ ...entityIdPattern !== void 0 ? { entityIdPattern } : {},
9942
+ ...requiredSections !== void 0 ? { requiredSections } : {}
9773
9943
  };
9774
9944
  }
9775
9945
  function compileExtension(ext, source) {
@@ -9792,6 +9962,7 @@ function compileExtension(ext, source) {
9792
9962
  publishDir: ext.publishDir,
9793
9963
  requiresEntityId: ext.requiresEntityId,
9794
9964
  ...entityIdPattern !== void 0 ? { entityIdPattern } : {},
9965
+ ...ext.requiredSections !== void 0 ? { requiredSections: ext.requiredSections } : {},
9795
9966
  isExtension: true
9796
9967
  };
9797
9968
  }
@@ -9828,7 +9999,8 @@ var init_docs_taxonomy = __esm({
9828
9999
  defaultOwnerKind: "task",
9829
10000
  publishDir: "docs/adr",
9830
10001
  requiresEntityId: true,
9831
- entityIdPattern: /^adr-\d{3,4}-[a-z0-9-]+$/
10002
+ entityIdPattern: /^adr-\d{3,4}-[a-z0-9-]+$/,
10003
+ requiredSections: ["Status", "Date", "Context", "Decision", "Consequences"]
9832
10004
  },
9833
10005
  {
9834
10006
  kind: "spec",
@@ -9836,7 +10008,8 @@ var init_docs_taxonomy = __esm({
9836
10008
  description: "Technical specification",
9837
10009
  defaultOwnerKind: "task",
9838
10010
  publishDir: "docs/spec",
9839
- requiresEntityId: false
10011
+ requiresEntityId: false,
10012
+ requiredSections: ["Goal", "Non-Goals", "Requirements", "Out-of-Scope"]
9840
10013
  },
9841
10014
  {
9842
10015
  kind: "research",
@@ -9844,7 +10017,8 @@ var init_docs_taxonomy = __esm({
9844
10017
  description: "Investigation / research note",
9845
10018
  defaultOwnerKind: "task",
9846
10019
  publishDir: "docs/research",
9847
- requiresEntityId: false
10020
+ requiresEntityId: false,
10021
+ requiredSections: ["Question", "Findings", "Sources"]
9848
10022
  },
9849
10023
  {
9850
10024
  kind: "handoff",
@@ -9852,7 +10026,8 @@ var init_docs_taxonomy = __esm({
9852
10026
  description: "Session / agent handoff",
9853
10027
  defaultOwnerKind: "session",
9854
10028
  publishDir: "docs/handoff",
9855
- requiresEntityId: false
10029
+ requiresEntityId: false,
10030
+ requiredSections: ["Context", "State", "Next-Steps"]
9856
10031
  },
9857
10032
  {
9858
10033
  kind: "note",
@@ -9860,7 +10035,8 @@ var init_docs_taxonomy = __esm({
9860
10035
  description: "Agent observation / informal note",
9861
10036
  defaultOwnerKind: "observation",
9862
10037
  publishDir: "docs/note",
9863
- requiresEntityId: false
10038
+ requiresEntityId: false,
10039
+ requiredSections: []
9864
10040
  },
9865
10041
  {
9866
10042
  kind: "llm-readme",
@@ -9868,7 +10044,8 @@ var init_docs_taxonomy = __esm({
9868
10044
  description: "Machine-readable README (llms.txt)",
9869
10045
  defaultOwnerKind: "project",
9870
10046
  publishDir: ".",
9871
- requiresEntityId: false
10047
+ requiresEntityId: false,
10048
+ requiredSections: []
9872
10049
  },
9873
10050
  {
9874
10051
  kind: "changeset",
@@ -9877,7 +10054,8 @@ var init_docs_taxonomy = __esm({
9877
10054
  defaultOwnerKind: "task",
9878
10055
  publishDir: ".changeset",
9879
10056
  requiresEntityId: true,
9880
- entityIdPattern: /^t\d+-[a-z0-9-]+$/
10057
+ entityIdPattern: /^t\d+-[a-z0-9-]+$/,
10058
+ requiredSections: []
9881
10059
  },
9882
10060
  {
9883
10061
  kind: "release-note",
@@ -9886,7 +10064,8 @@ var init_docs_taxonomy = __esm({
9886
10064
  defaultOwnerKind: "project",
9887
10065
  publishDir: "docs/release",
9888
10066
  requiresEntityId: true,
9889
- entityIdPattern: /^v\d{4}\.\d+\.\d+(-[a-z0-9-]+)?$/
10067
+ entityIdPattern: /^v\d{4}\.\d+\.\d+(-[a-z0-9-]+)?$/,
10068
+ requiredSections: ["Changes", "Migration"]
9890
10069
  },
9891
10070
  {
9892
10071
  kind: "plan",
@@ -9894,7 +10073,8 @@ var init_docs_taxonomy = __esm({
9894
10073
  description: "Epic / saga decomposition plan",
9895
10074
  defaultOwnerKind: "task",
9896
10075
  publishDir: "docs/plan",
9897
- requiresEntityId: false
10076
+ requiresEntityId: false,
10077
+ requiredSections: ["Goal", "Steps", "Owners"]
9898
10078
  },
9899
10079
  {
9900
10080
  kind: "rcasd",
@@ -9903,7 +10083,8 @@ var init_docs_taxonomy = __esm({
9903
10083
  defaultOwnerKind: "task",
9904
10084
  publishDir: ".cleo/rcasd",
9905
10085
  requiresEntityId: true,
9906
- entityIdPattern: /^t\d+(-.+)?$/
10086
+ entityIdPattern: /^t\d+(-.+)?$/,
10087
+ requiredSections: ["Root-Cause", "Action", "Schedule", "Detection"]
9907
10088
  }
9908
10089
  ];
9909
10090
  BUILTIN_DOC_KIND_VALUES = Object.freeze(
@@ -10080,9 +10261,11 @@ var init_engine_result = __esm({
10080
10261
  });
10081
10262
 
10082
10263
  // packages/contracts/src/enums.ts
10264
+ var TASK_SEVERITIES;
10083
10265
  var init_enums = __esm({
10084
10266
  "packages/contracts/src/enums.ts"() {
10085
10267
  "use strict";
10268
+ TASK_SEVERITIES = ["P0", "P1", "P2", "P3"];
10086
10269
  }
10087
10270
  });
10088
10271
 
@@ -10213,54 +10396,54 @@ var init_errors = __esm({
10213
10396
  });
10214
10397
 
10215
10398
  // packages/contracts/src/evidence-atom-schema.ts
10216
- import { z as z4 } from "zod";
10399
+ import { z as z6 } from "zod";
10217
10400
  var commitAtomSchema, filesAtomSchema, testRunAtomSchema, toolAtomSchema, urlAtomSchema, noteAtomSchema, decisionAtomSchema, prAtomSchema, locDropAtomSchema, callsiteCoverageAtomSchema, EvidenceAtomSchema, GATE_EVIDENCE_REQUIREMENTS;
10218
10401
  var init_evidence_atom_schema = __esm({
10219
10402
  "packages/contracts/src/evidence-atom-schema.ts"() {
10220
10403
  "use strict";
10221
- commitAtomSchema = z4.object({
10222
- kind: z4.literal("commit"),
10223
- sha: z4.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
10404
+ commitAtomSchema = z6.object({
10405
+ kind: z6.literal("commit"),
10406
+ sha: z6.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
10224
10407
  });
10225
- filesAtomSchema = z4.object({
10226
- kind: z4.literal("files"),
10227
- paths: z4.array(z4.string().min(1)).min(1, "files atom requires at least one path")
10408
+ filesAtomSchema = z6.object({
10409
+ kind: z6.literal("files"),
10410
+ paths: z6.array(z6.string().min(1)).min(1, "files atom requires at least one path")
10228
10411
  });
10229
- testRunAtomSchema = z4.object({
10230
- kind: z4.literal("test-run"),
10231
- path: z4.string().min(1, "test-run atom requires a non-empty path")
10412
+ testRunAtomSchema = z6.object({
10413
+ kind: z6.literal("test-run"),
10414
+ path: z6.string().min(1, "test-run atom requires a non-empty path")
10232
10415
  });
10233
- toolAtomSchema = z4.object({
10234
- kind: z4.literal("tool"),
10235
- tool: z4.string().min(1, "tool atom requires a non-empty tool name")
10416
+ toolAtomSchema = z6.object({
10417
+ kind: z6.literal("tool"),
10418
+ tool: z6.string().min(1, "tool atom requires a non-empty tool name")
10236
10419
  });
10237
- urlAtomSchema = z4.object({
10238
- kind: z4.literal("url"),
10239
- url: z4.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
10420
+ urlAtomSchema = z6.object({
10421
+ kind: z6.literal("url"),
10422
+ url: z6.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
10240
10423
  });
10241
- noteAtomSchema = z4.object({
10242
- kind: z4.literal("note"),
10243
- note: z4.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
10424
+ noteAtomSchema = z6.object({
10425
+ kind: z6.literal("note"),
10426
+ note: z6.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
10244
10427
  });
10245
- decisionAtomSchema = z4.object({
10246
- kind: z4.literal("decision"),
10247
- decisionId: z4.string().min(1, "decision atom requires a non-empty decision ID")
10428
+ decisionAtomSchema = z6.object({
10429
+ kind: z6.literal("decision"),
10430
+ decisionId: z6.string().min(1, "decision atom requires a non-empty decision ID")
10248
10431
  });
10249
- prAtomSchema = z4.object({
10250
- kind: z4.literal("pr"),
10251
- prNumber: z4.number().int().positive("pr atom requires a positive integer PR number")
10432
+ prAtomSchema = z6.object({
10433
+ kind: z6.literal("pr"),
10434
+ prNumber: z6.number().int().positive("pr atom requires a positive integer PR number")
10252
10435
  });
10253
- locDropAtomSchema = z4.object({
10254
- kind: z4.literal("loc-drop"),
10255
- fromLines: z4.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
10256
- toLines: z4.number().int().nonnegative("loc-drop toLines must be \u2265 0")
10436
+ locDropAtomSchema = z6.object({
10437
+ kind: z6.literal("loc-drop"),
10438
+ fromLines: z6.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
10439
+ toLines: z6.number().int().nonnegative("loc-drop toLines must be \u2265 0")
10257
10440
  });
10258
- callsiteCoverageAtomSchema = z4.object({
10259
- kind: z4.literal("callsite-coverage"),
10260
- symbolName: z4.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
10261
- relativeSourcePath: z4.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
10441
+ callsiteCoverageAtomSchema = z6.object({
10442
+ kind: z6.literal("callsite-coverage"),
10443
+ symbolName: z6.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
10444
+ relativeSourcePath: z6.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
10262
10445
  });
10263
- EvidenceAtomSchema = z4.discriminatedUnion("kind", [
10446
+ EvidenceAtomSchema = z6.discriminatedUnion("kind", [
10264
10447
  commitAtomSchema,
10265
10448
  filesAtomSchema,
10266
10449
  testRunAtomSchema,
@@ -10293,58 +10476,58 @@ var init_evidence_atom_schema = __esm({
10293
10476
  });
10294
10477
 
10295
10478
  // packages/contracts/src/evidence-record-schema.ts
10296
- import { z as z5 } from "zod";
10479
+ import { z as z7 } from "zod";
10297
10480
  var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
10298
10481
  var init_evidence_record_schema = __esm({
10299
10482
  "packages/contracts/src/evidence-record-schema.ts"() {
10300
10483
  "use strict";
10301
- evidenceBaseSchema = z5.object({
10484
+ evidenceBaseSchema = z7.object({
10302
10485
  /** Identity string of the agent that produced this record. */
10303
- agentIdentity: z5.string().min(1),
10486
+ agentIdentity: z7.string().min(1),
10304
10487
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
10305
- attachmentSha256: z5.string().length(64),
10488
+ attachmentSha256: z7.string().length(64),
10306
10489
  /** ISO 8601 timestamp at which the action ran. */
10307
- ranAt: z5.string().datetime(),
10490
+ ranAt: z7.string().datetime(),
10308
10491
  /** Wall-clock duration of the action in milliseconds. */
10309
- durationMs: z5.number().nonnegative()
10492
+ durationMs: z7.number().nonnegative()
10310
10493
  });
10311
10494
  implDiffRecordSchema = evidenceBaseSchema.extend({
10312
- kind: z5.literal("impl-diff"),
10313
- phase: z5.literal("implement"),
10314
- filesChanged: z5.array(z5.string().min(1)).min(1),
10315
- linesAdded: z5.number().int().nonnegative(),
10316
- linesRemoved: z5.number().int().nonnegative()
10495
+ kind: z7.literal("impl-diff"),
10496
+ phase: z7.literal("implement"),
10497
+ filesChanged: z7.array(z7.string().min(1)).min(1),
10498
+ linesAdded: z7.number().int().nonnegative(),
10499
+ linesRemoved: z7.number().int().nonnegative()
10317
10500
  });
10318
10501
  validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
10319
- kind: z5.literal("validate-spec-check"),
10320
- phase: z5.literal("validate"),
10321
- reqIdsChecked: z5.array(z5.string().min(1)).min(1),
10322
- passed: z5.boolean(),
10323
- details: z5.string().min(1)
10502
+ kind: z7.literal("validate-spec-check"),
10503
+ phase: z7.literal("validate"),
10504
+ reqIdsChecked: z7.array(z7.string().min(1)).min(1),
10505
+ passed: z7.boolean(),
10506
+ details: z7.string().min(1)
10324
10507
  });
10325
10508
  testOutputRecordSchema = evidenceBaseSchema.extend({
10326
- kind: z5.literal("test-output"),
10327
- phase: z5.literal("test"),
10328
- command: z5.string().min(1),
10329
- exitCode: z5.number().int(),
10330
- testsPassed: z5.number().int().nonnegative(),
10331
- testsFailed: z5.number().int().nonnegative()
10509
+ kind: z7.literal("test-output"),
10510
+ phase: z7.literal("test"),
10511
+ command: z7.string().min(1),
10512
+ exitCode: z7.number().int(),
10513
+ testsPassed: z7.number().int().nonnegative(),
10514
+ testsFailed: z7.number().int().nonnegative()
10332
10515
  });
10333
10516
  lintReportRecordSchema = evidenceBaseSchema.extend({
10334
- kind: z5.literal("lint-report"),
10335
- phase: z5.enum(["implement", "test"]),
10336
- tool: z5.string().min(1),
10337
- passed: z5.boolean(),
10338
- warnings: z5.number().int().nonnegative(),
10339
- errors: z5.number().int().nonnegative()
10517
+ kind: z7.literal("lint-report"),
10518
+ phase: z7.enum(["implement", "test"]),
10519
+ tool: z7.string().min(1),
10520
+ passed: z7.boolean(),
10521
+ warnings: z7.number().int().nonnegative(),
10522
+ errors: z7.number().int().nonnegative()
10340
10523
  });
10341
10524
  commandOutputRecordSchema = evidenceBaseSchema.extend({
10342
- kind: z5.literal("command-output"),
10343
- phase: z5.enum(["implement", "validate", "test"]),
10344
- cmd: z5.string().min(1),
10345
- exitCode: z5.number().int()
10525
+ kind: z7.literal("command-output"),
10526
+ phase: z7.enum(["implement", "validate", "test"]),
10527
+ cmd: z7.string().min(1),
10528
+ exitCode: z7.number().int()
10346
10529
  });
10347
- evidenceRecordSchema = z5.discriminatedUnion("kind", [
10530
+ evidenceRecordSchema = z7.discriminatedUnion("kind", [
10348
10531
  implDiffRecordSchema,
10349
10532
  validateSpecCheckRecordSchema,
10350
10533
  testOutputRecordSchema,
@@ -10368,6 +10551,302 @@ var init_graph = __esm({
10368
10551
  }
10369
10552
  });
10370
10553
 
10554
+ // packages/contracts/src/invariants/adr-056-release.ts
10555
+ var ARCHIVE_REASON_MODULE, RELEASE_INVARIANTS_REGISTRY_MODULE, RELEASE_COMMIT_MSG_HOOK, ADR_056_INVARIANTS;
10556
+ var init_adr_056_release = __esm({
10557
+ "packages/contracts/src/invariants/adr-056-release.ts"() {
10558
+ "use strict";
10559
+ ARCHIVE_REASON_MODULE = "packages/contracts/src/tasks/archive.ts";
10560
+ RELEASE_INVARIANTS_REGISTRY_MODULE = "packages/core/src/release/invariants/registry.ts";
10561
+ RELEASE_COMMIT_MSG_HOOK = "scripts/hooks/commit-msg-release-lint.mjs";
10562
+ ADR_056_INVARIANTS = Object.freeze([
10563
+ {
10564
+ adr: "ADR-056",
10565
+ code: "D1",
10566
+ name: "Database topology: keep per-domain split",
10567
+ description: "CLEO retains the six per-domain SQLite databases (tasks, brain, conduit, nexus, signaldock, telemetry) documented in DATABASE-ERDS.md. Consolidation is rejected to preserve per-DB WAL throughput, per-DB rollback granularity, and avoid single-writer contention during multi-agent waves.",
10568
+ severity: "info",
10569
+ // D1 is a topology decision; the absence of consolidation is its only
10570
+ // enforcement surface. No runtime guard, no lint script.
10571
+ runtimeGate: null,
10572
+ lintRule: null,
10573
+ doctorAudit: null,
10574
+ tests: []
10575
+ },
10576
+ {
10577
+ adr: "ADR-056",
10578
+ code: "D2",
10579
+ name: "Store-layer naming convention",
10580
+ description: "New always-on store-layer domains MUST use the kebab-case pair `packages/core/src/store/<domain>-schema.ts` (Drizzle defs) + `packages/core/src/store/<domain>-sqlite.ts` (open/init/CRUD). Opt-in / isolated domains MAY use the folder variant `packages/core/src/<domain>/{schema,sqlite}.ts` (currently telemetry only).",
10581
+ severity: "info",
10582
+ // D2 is a naming-convention decision; enforced by code review and the
10583
+ // ADR-073/ADR-056 doctor audit. No runtime guard.
10584
+ runtimeGate: null,
10585
+ lintRule: null,
10586
+ doctorAudit: null,
10587
+ tests: []
10588
+ },
10589
+ {
10590
+ adr: "ADR-056",
10591
+ code: "D3",
10592
+ name: "Migration runner SSoT under migration-manager.ts",
10593
+ description: "All six SQLite databases MUST be initialized via `packages/core/src/migration/migration-manager.ts` (`migrateWithRetry()` + `reconcileJournal()`). Per-DB bespoke runners are prohibited for new domains. Rust Diesel migrations for cloud signaldock-storage MUST NOT touch the local SQLite signaldock.db at runtime.",
10594
+ severity: "info",
10595
+ // D3 is enforced by the absence of bespoke runners — every domain's
10596
+ // `<domain>-sqlite.ts` open path delegates to migration-manager. No
10597
+ // single runtime guard; per-DB chokepoints are the enforcement surface.
10598
+ runtimeGate: null,
10599
+ lintRule: null,
10600
+ doctorAudit: null,
10601
+ tests: []
10602
+ },
10603
+ {
10604
+ adr: "ADR-056",
10605
+ code: "D4",
10606
+ name: "archiveReason 6-value enum with tombstone semantics",
10607
+ description: "The tasks.archive_reason column is constrained to exactly six values (verified, reconciled, superseded, shadowed, cancelled, completed-unverified) via SQLite CHECK constraint AND Zod z.enum validation. Writing 'completed-unverified' from non-migration code MUST throw E_ARCHIVE_REASON_TOMBSTONE \u2014 the tombstone is reserved for the T1408 backfill migration only.",
10608
+ severity: "error",
10609
+ runtimeGate: {
10610
+ module: ARCHIVE_REASON_MODULE,
10611
+ functionName: "assertArchiveReason"
10612
+ },
10613
+ lintRule: null,
10614
+ doctorAudit: null,
10615
+ tests: ["packages/contracts/src/tasks/__tests__/archive.test.ts"]
10616
+ },
10617
+ {
10618
+ adr: "ADR-056",
10619
+ code: "D5",
10620
+ name: "Post-release reconciliation: registry-driven cleo verify --release",
10621
+ description: "Post-release reconciliation flows through the executable invariants registry at packages/core/src/release/invariants/registry.ts. Customers register via registerInvariant() and the CLI runs every entry on `cleo verify --release <tag>`. First customer: archive-reason-invariant.ts (stamps verified tasks done; creates follow-up tasks for unverified references).",
10622
+ severity: "warning",
10623
+ runtimeGate: {
10624
+ module: RELEASE_INVARIANTS_REGISTRY_MODULE,
10625
+ functionName: "runInvariants"
10626
+ },
10627
+ lintRule: null,
10628
+ doctorAudit: null,
10629
+ tests: ["packages/core/src/release/invariants/__tests__/archive-reason-invariant.test.ts"]
10630
+ },
10631
+ {
10632
+ adr: "ADR-056",
10633
+ code: "D6",
10634
+ name: "Commit-message lint for release commits",
10635
+ description: "Every commit whose subject matches `^(chore|feat)\\(release\\):` MUST contain at least one `T\\d+` task reference in the commit body. Enforced by scripts/hooks/commit-msg-release-lint.mjs (T1410). Bypass via CLEO_OWNER_OVERRIDE=1 with audited justification.",
10636
+ severity: "info",
10637
+ // D6 is a CI-hook concern. The hook itself is the enforcement surface
10638
+ // — represented here via lintRule for cross-reference rendering.
10639
+ runtimeGate: null,
10640
+ lintRule: {
10641
+ lintScript: RELEASE_COMMIT_MSG_HOOK
10642
+ },
10643
+ doctorAudit: null,
10644
+ tests: []
10645
+ }
10646
+ ]);
10647
+ }
10648
+ });
10649
+
10650
+ // packages/contracts/src/invariants/adr-070-orchestration.ts
10651
+ var THIN_AGENT_MODULE, SESSIONS_MODULE, WORKTREE_CREATE_MODULE, CT_ORCHESTRATOR_SKILL, VALIDATE_SPAWN_MODULE, SKILL_VALIDATOR_TESTS, ADR_070_INVARIANTS, ADR_070_INVARIANT_COUNT;
10652
+ var init_adr_070_orchestration = __esm({
10653
+ "packages/contracts/src/invariants/adr-070-orchestration.ts"() {
10654
+ "use strict";
10655
+ THIN_AGENT_MODULE = "packages/core/src/orchestration/thin-agent.ts";
10656
+ SESSIONS_MODULE = "packages/core/src/sessions/index.ts";
10657
+ WORKTREE_CREATE_MODULE = "packages/worktree/src/worktree-create.ts";
10658
+ CT_ORCHESTRATOR_SKILL = "packages/skills/skills/ct-orchestrator/SKILL.md";
10659
+ VALIDATE_SPAWN_MODULE = "packages/core/src/orchestration/validate-spawn.ts";
10660
+ SKILL_VALIDATOR_TESTS = "packages/core/src/skills/orchestrator/__tests__/validator.test.ts";
10661
+ ADR_070_INVARIANTS = Object.freeze([
10662
+ {
10663
+ adr: "ADR-070",
10664
+ code: "ORC-001",
10665
+ name: "Orchestrator is the HITL interface",
10666
+ description: "The Orchestrator (Cleo) is the single subagent that talks to the human operator. It plans, decomposes, and delegates \u2014 it never produces line-level implementation. Source-of-truth lives in ct-orchestrator/SKILL.md row ORC-001 and is injected into the Orchestrator prompt at spawn time. UNENFORCED at the dispatch layer: this is a prompt-time invariant with no runtime guard today.",
10667
+ severity: "warning",
10668
+ runtimeGate: null,
10669
+ lintRule: null,
10670
+ doctorAudit: null,
10671
+ tests: [CT_ORCHESTRATOR_SKILL]
10672
+ },
10673
+ {
10674
+ adr: "ADR-070",
10675
+ code: "ORC-002",
10676
+ name: "Orchestrator MUST NOT write or edit code",
10677
+ description: "Every line of code is written by a spawned subagent. The Orchestrator delegates implementation work via cleo orchestrate spawn / delegate_task. UNENFORCED at the dispatch layer: this is a prompt-time invariant \u2014 there is no runtime gate that blocks the Orchestrator from calling Edit/Write, so the contract is held by the ct-orchestrator skill text.",
10678
+ severity: "warning",
10679
+ runtimeGate: null,
10680
+ lintRule: null,
10681
+ doctorAudit: null,
10682
+ tests: [CT_ORCHESTRATOR_SKILL]
10683
+ },
10684
+ {
10685
+ adr: "ADR-070",
10686
+ code: "ORC-003",
10687
+ name: "Orchestrator MUST NOT read full source files",
10688
+ description: "Orchestrator reads only pipeline manifests, task envelopes, and rolled-up phase summaries returned by Phase Leads. Workers read code; the Orchestrator reads summaries. UNENFORCED at the dispatch layer \u2014 held by the ct-orchestrator skill text and reinforced by ORC-005 budget pressure.",
10689
+ severity: "warning",
10690
+ runtimeGate: null,
10691
+ lintRule: null,
10692
+ doctorAudit: null,
10693
+ tests: [CT_ORCHESTRATOR_SKILL]
10694
+ },
10695
+ {
10696
+ adr: "ADR-070",
10697
+ code: "ORC-004",
10698
+ name: "Dependency-ordered spawning",
10699
+ description: "Spawns within a wave are ordered by task.depends \u2014 a Worker MUST NOT be dispatched until its declared dependencies are status=done. Surfaced by validateSpawnReadiness via V_MISSING_DEP / V_UNMET_DEP codes; surfaced by the skill-orchestrator validator via the ORC-004_DEPENDENCY_ORDER warning emitted from packages/core/src/skills/orchestrator/validator.ts. Tier: warning because the validator surfaces ordering issues but does not throw \u2014 workers can still proceed if the operator overrides.",
10700
+ severity: "warning",
10701
+ runtimeGate: {
10702
+ module: VALIDATE_SPAWN_MODULE,
10703
+ functionName: "validateSpawnReadiness"
10704
+ },
10705
+ lintRule: null,
10706
+ doctorAudit: null,
10707
+ tests: [
10708
+ "packages/core/src/orchestration/__tests__/validate-spawn.test.ts",
10709
+ SKILL_VALIDATOR_TESTS
10710
+ ]
10711
+ },
10712
+ {
10713
+ adr: "ADR-070",
10714
+ code: "ORC-005",
10715
+ name: "Orchestrator context budget \u2248 10 K tokens",
10716
+ description: "The Orchestrator MUST keep its working context under ~10 K tokens; delegate at 80 %. Surfaced by cleo orchestrate context (estimateContext) and by the skill-orchestrator validator (ORC-005_NO_MANIFEST / ORC-005_EMPTY_MANIFEST). UNENFORCED as a hard gate \u2014 the budget is advisory, surfaced to the Orchestrator as a warning so the human operator can intervene.",
10717
+ severity: "warning",
10718
+ runtimeGate: {
10719
+ module: "packages/core/src/orchestration/context.ts",
10720
+ functionName: "estimateContext"
10721
+ },
10722
+ lintRule: null,
10723
+ doctorAudit: null,
10724
+ tests: ["packages/core/src/orchestration/__tests__/"]
10725
+ },
10726
+ {
10727
+ adr: "ADR-070",
10728
+ code: "ORC-006",
10729
+ name: "Worker scope \u2264 3 files per spawn",
10730
+ description: "Cross-file reasoning quality degrades beyond ~3 files for a single Worker. Enforced at spawn-time by validateSpawnReadiness \u2014 V_ATOMIC_SCOPE_MISSING when task.files is empty, V_ATOMIC_SCOPE_TOO_LARGE when files.length > MAX_WORKER_FILES (currently 3). Spawn-prompt builder injects a Worker Budget Constraints section so the Worker sees the budget inline. Tier: error because the gate refuses to spawn an over-scoped Worker.",
10731
+ severity: "error",
10732
+ runtimeGate: {
10733
+ module: VALIDATE_SPAWN_MODULE,
10734
+ functionName: "validateSpawnReadiness"
10735
+ },
10736
+ lintRule: null,
10737
+ doctorAudit: null,
10738
+ tests: [
10739
+ "packages/core/src/orchestration/__tests__/validate-spawn.test.ts",
10740
+ "packages/core/src/orchestration/__tests__/spawn-prompt.test.ts"
10741
+ ]
10742
+ },
10743
+ {
10744
+ adr: "ADR-070",
10745
+ code: "ORC-007",
10746
+ name: "All work traced to an Epic",
10747
+ description: "Every Task and Subtask MUST attach to a parent Epic (directly or transitively). No orphan work \u2014 orphans are filed against the ADR-066 acceptance-criteria gate and surface via cleo find. UNENFORCED at the dispatch layer; the parent-id requirement is materialised through cleo add validation rather than a single ORC-named guard. R6 doctor audit should walk the task graph to surface orphans.",
10748
+ severity: "warning",
10749
+ runtimeGate: null,
10750
+ lintRule: null,
10751
+ doctorAudit: null,
10752
+ tests: [CT_ORCHESTRATOR_SKILL]
10753
+ },
10754
+ {
10755
+ adr: "ADR-070",
10756
+ code: "ORC-008",
10757
+ name: "Zero architectural decisions during execution",
10758
+ description: "Architectural choices MUST be pre-decided via RCASD consensus or HITL \u2014 never inside a worker session. UNENFORCED at the dispatch layer: this is a behavioural invariant held by the ct-orchestrator skill text plus the ADR-066 acceptance criterion that every task must declare its architecture-relevant decisions before spawn.",
10759
+ severity: "warning",
10760
+ runtimeGate: null,
10761
+ lintRule: null,
10762
+ doctorAudit: null,
10763
+ tests: [CT_ORCHESTRATOR_SKILL]
10764
+ },
10765
+ {
10766
+ adr: "ADR-070",
10767
+ code: "ORC-009",
10768
+ name: "Manifest-mediated handoffs",
10769
+ description: "Orchestrator reads only the key_findings field of pipeline_manifest rows when reconciling worker output. Subagents read the full task description and supporting files. UNENFORCED at the dispatch layer: the contract is held by the ct-orchestrator skill text and reinforced by ORC-003 + ORC-005 budget pressure.",
10770
+ severity: "warning",
10771
+ runtimeGate: null,
10772
+ lintRule: null,
10773
+ doctorAudit: null,
10774
+ tests: [CT_ORCHESTRATOR_SKILL]
10775
+ },
10776
+ {
10777
+ adr: "ADR-070",
10778
+ code: "ORC-010",
10779
+ name: "Lead-interposition required for Epic-child Workers",
10780
+ description: "A Worker spawn against a Task whose parent is type=epic MUST be preceded by a Lead spawn for the same Task (ADR-083 \xA72.4 / \xA76). The intended runtime gate (composeSpawnPayload throwing E_LEAD_REQUIRED_FOR_EPIC_CHILD) is FILED but UNSHIPPED \u2014 tracked under T10278. Registered here as a warning + runtimeGate:null so the gap is visible in the R6 doctor audit.",
10781
+ severity: "warning",
10782
+ runtimeGate: null,
10783
+ lintRule: null,
10784
+ doctorAudit: null,
10785
+ tests: []
10786
+ },
10787
+ {
10788
+ adr: "ADR-070",
10789
+ code: "ORC-011",
10790
+ name: "Orchestrator-depth cap at 3",
10791
+ description: "Recursive Orchestrator spawns (Cleo \u2192 sub-Orchestrator \u2192 sub-Orchestrator \u2192 \u2026) MUST stop at depth 3 (ADR-083 \xA72.2 + \xA72.4). The intended runtime gate (composeSpawnPayload throwing E_ORCHESTRATOR_DEPTH_EXCEEDED) is FILED but UNSHIPPED \u2014 tracked under T10279. Registered here as a warning + runtimeGate:null so the gap is visible in the R6 doctor audit.",
10792
+ severity: "warning",
10793
+ runtimeGate: null,
10794
+ lintRule: null,
10795
+ doctorAudit: null,
10796
+ tests: []
10797
+ },
10798
+ {
10799
+ adr: "ADR-070",
10800
+ code: "ORC-012",
10801
+ name: "Thin-agent inversion-of-control",
10802
+ description: "Workers MUST NOT spawn other subagents. The spawn-capable tools (Agent / Task / TaskCreate) are stripped from the Worker tool list at .cant compile time, and any survivor at spawn time triggers ThinAgentViolationError \u2192 E_THIN_AGENT_VIOLATION (exit 68). The only ORC rule with a hard-enforced dispatch-time gate today.",
10803
+ severity: "error",
10804
+ runtimeGate: {
10805
+ module: THIN_AGENT_MODULE,
10806
+ functionName: "enforceThinAgent"
10807
+ },
10808
+ lintRule: null,
10809
+ doctorAudit: null,
10810
+ tests: [
10811
+ "packages/core/src/orchestration/__tests__/thin-agent.test.ts",
10812
+ "packages/cant/src/__tests__/hierarchy.test.ts"
10813
+ ]
10814
+ },
10815
+ {
10816
+ adr: "ADR-070",
10817
+ code: "ORC-013",
10818
+ name: "Worktree provisioning at canonical XDG location",
10819
+ description: "Every agent worktree MUST be created under <cleoHome>/worktrees/<projectHash>/<taskId>/ (ADR-055 + Council D009). createWorktree throws E_WT_LOCATION_FORBIDDEN before any git worktree add call when the computed path falls outside the canonical root. CI gate lint-worktree-location.mjs enforces the same invariant on every PR. The single-most-load-bearing orchestration guard after ORC-012.",
10820
+ severity: "error",
10821
+ runtimeGate: {
10822
+ module: WORKTREE_CREATE_MODULE,
10823
+ functionName: "assertCanonicalWorktreeLocation"
10824
+ },
10825
+ lintRule: {
10826
+ lintScript: "scripts/lint-worktree-location.mjs"
10827
+ },
10828
+ doctorAudit: null,
10829
+ tests: ["packages/worktree/src/__tests__/"]
10830
+ },
10831
+ {
10832
+ adr: "ADR-070",
10833
+ code: "ORC-014",
10834
+ name: "Lead-bypass detection at session end",
10835
+ description: "A Lead session (CLEO_AGENT_ROLE=lead) that ends with tasks_completed > 0 AND delegate_task_count = 0 is rejected with LeadBypassDetectedError \u2192 E_LEAD_BYPASS_DETECTED (exit 107). Leads MUST fan out work to Workers; a Lead that did the work itself defeats the three-tier topology. Override via CLEO_OWNER_OVERRIDE=1 (audited to force-bypass.jsonl).",
10836
+ severity: "error",
10837
+ runtimeGate: {
10838
+ module: SESSIONS_MODULE,
10839
+ functionName: "endSession"
10840
+ },
10841
+ lintRule: null,
10842
+ doctorAudit: null,
10843
+ tests: ["packages/core/src/sessions/__tests__/"]
10844
+ }
10845
+ ]);
10846
+ ADR_070_INVARIANT_COUNT = ADR_070_INVARIANTS.length;
10847
+ }
10848
+ });
10849
+
10371
10850
  // packages/contracts/src/invariants/adr-073-saga.ts
10372
10851
  var SAGA_ENFORCEMENT_MODULE, SAGA_ENFORCEMENT_TESTS, ADR_073_INVARIANTS;
10373
10852
  var init_adr_073_saga = __esm({
@@ -10495,7 +10974,11 @@ function buildKey(invariant) {
10495
10974
  return `${invariant.adr}.${invariant.code}`;
10496
10975
  }
10497
10976
  function buildRegistry() {
10498
- const entries = [...ADR_073_INVARIANTS];
10977
+ const entries = [
10978
+ ...ADR_073_INVARIANTS,
10979
+ ...ADR_056_INVARIANTS,
10980
+ ...ADR_070_INVARIANTS
10981
+ ];
10499
10982
  const record = {};
10500
10983
  for (const entry of entries) {
10501
10984
  const key = buildKey(entry);
@@ -10510,7 +10993,11 @@ var INVARIANTS_REGISTRY;
10510
10993
  var init_invariants = __esm({
10511
10994
  "packages/contracts/src/invariants/index.ts"() {
10512
10995
  "use strict";
10996
+ init_adr_056_release();
10997
+ init_adr_070_orchestration();
10513
10998
  init_adr_073_saga();
10999
+ init_adr_056_release();
11000
+ init_adr_070_orchestration();
10514
11001
  init_adr_073_saga();
10515
11002
  INVARIANTS_REGISTRY = buildRegistry();
10516
11003
  }
@@ -11322,31 +11809,31 @@ var init_peer = __esm({
11322
11809
  });
11323
11810
 
11324
11811
  // packages/contracts/src/release/evidence-atoms.ts
11325
- import { z as z6 } from "zod";
11812
+ import { z as z8 } from "zod";
11326
11813
  var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
11327
11814
  var init_evidence_atoms = __esm({
11328
11815
  "packages/contracts/src/release/evidence-atoms.ts"() {
11329
11816
  "use strict";
11330
- parsedPrEvidenceAtomSchema = z6.object({
11331
- kind: z6.literal("pr"),
11332
- prNumber: z6.number().int().positive()
11333
- });
11334
- prEvidenceStateModifierSchema = z6.object({
11335
- kind: z6.literal("state"),
11336
- value: z6.literal("MERGED")
11337
- });
11338
- ghPrViewSchema = z6.object({
11339
- state: z6.enum(["OPEN", "CLOSED", "MERGED"]),
11340
- mergedAt: z6.string().nullable(),
11341
- headRefOid: z6.string().optional(),
11342
- mergeable: z6.string().optional(),
11343
- statusCheckRollup: z6.array(
11344
- z6.object({
11345
- __typename: z6.string().optional(),
11346
- name: z6.string().optional(),
11347
- workflowName: z6.string().optional(),
11348
- conclusion: z6.string().nullable().optional(),
11349
- status: z6.string().optional()
11817
+ parsedPrEvidenceAtomSchema = z8.object({
11818
+ kind: z8.literal("pr"),
11819
+ prNumber: z8.number().int().positive()
11820
+ });
11821
+ prEvidenceStateModifierSchema = z8.object({
11822
+ kind: z8.literal("state"),
11823
+ value: z8.literal("MERGED")
11824
+ });
11825
+ ghPrViewSchema = z8.object({
11826
+ state: z8.enum(["OPEN", "CLOSED", "MERGED"]),
11827
+ mergedAt: z8.string().nullable(),
11828
+ headRefOid: z8.string().optional(),
11829
+ mergeable: z8.string().optional(),
11830
+ statusCheckRollup: z8.array(
11831
+ z8.object({
11832
+ __typename: z8.string().optional(),
11833
+ name: z8.string().optional(),
11834
+ workflowName: z8.string().optional(),
11835
+ conclusion: z8.string().nullable().optional(),
11836
+ status: z8.string().optional()
11350
11837
  }).passthrough()
11351
11838
  ).optional().default([])
11352
11839
  }).passthrough();
@@ -11359,7 +11846,7 @@ var init_evidence_atoms = __esm({
11359
11846
  });
11360
11847
 
11361
11848
  // packages/contracts/src/release/plan.ts
11362
- import { z as z7 } from "zod";
11849
+ import { z as z9 } from "zod";
11363
11850
  var RELEASE_CHANNEL, RELEASE_SCHEME, RELEASE_KIND, RELEASE_STATUS, GATE_STATUS, GATE_NAME, PLATFORM_TUPLE, PUBLISHER, TASK_KIND, IMPACT, RESOLVED_SOURCE, ReleaseChannelSchema, ReleaseSchemeSchema, ReleaseKindSchema, ReleaseStatusSchema, GateStatusSchema, GateNameSchema, PlatformTupleSchema, PublisherSchema, TaskKindSchema, ImpactSchema, ResolvedSourceSchema, Iso8601, NonEmptyString, ReleasePlanTaskSchema, ReleaseGateSchema, ReleasePlatformMatrixEntrySchema, ReleasePreflightSummarySchema, ReleasePlanChangelogSchema, ReleasePlanMetaSchema, ReleasePlanSchema;
11364
11851
  var init_plan = __esm({
11365
11852
  "packages/contracts/src/release/plan.ts"() {
@@ -11402,20 +11889,20 @@ var init_plan = __esm({
11402
11889
  ];
11403
11890
  IMPACT = ["major", "minor", "patch"];
11404
11891
  RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
11405
- ReleaseChannelSchema = z7.enum(RELEASE_CHANNEL);
11406
- ReleaseSchemeSchema = z7.enum(RELEASE_SCHEME);
11407
- ReleaseKindSchema = z7.enum(RELEASE_KIND);
11408
- ReleaseStatusSchema = z7.enum(RELEASE_STATUS);
11409
- GateStatusSchema = z7.enum(GATE_STATUS);
11410
- GateNameSchema = z7.enum(GATE_NAME);
11411
- PlatformTupleSchema = z7.enum(PLATFORM_TUPLE);
11412
- PublisherSchema = z7.enum(PUBLISHER);
11413
- TaskKindSchema = z7.enum(TASK_KIND);
11414
- ImpactSchema = z7.enum(IMPACT);
11415
- ResolvedSourceSchema = z7.enum(RESOLVED_SOURCE);
11416
- Iso8601 = z7.iso.datetime({ offset: true });
11417
- NonEmptyString = z7.string().min(1);
11418
- ReleasePlanTaskSchema = z7.object({
11892
+ ReleaseChannelSchema = z9.enum(RELEASE_CHANNEL);
11893
+ ReleaseSchemeSchema = z9.enum(RELEASE_SCHEME);
11894
+ ReleaseKindSchema = z9.enum(RELEASE_KIND);
11895
+ ReleaseStatusSchema = z9.enum(RELEASE_STATUS);
11896
+ GateStatusSchema = z9.enum(GATE_STATUS);
11897
+ GateNameSchema = z9.enum(GATE_NAME);
11898
+ PlatformTupleSchema = z9.enum(PLATFORM_TUPLE);
11899
+ PublisherSchema = z9.enum(PUBLISHER);
11900
+ TaskKindSchema = z9.enum(TASK_KIND);
11901
+ ImpactSchema = z9.enum(IMPACT);
11902
+ ResolvedSourceSchema = z9.enum(RESOLVED_SOURCE);
11903
+ Iso8601 = z9.iso.datetime({ offset: true });
11904
+ NonEmptyString = z9.string().min(1);
11905
+ ReleasePlanTaskSchema = z9.object({
11419
11906
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
11420
11907
  id: NonEmptyString,
11421
11908
  /** Conventional-commit-aligned task classification. */
@@ -11423,20 +11910,20 @@ var init_plan = __esm({
11423
11910
  /** SemVer impact classification. */
11424
11911
  impact: ImpactSchema,
11425
11912
  /** Human-readable changelog line for this task. */
11426
- userFacingSummary: z7.string(),
11913
+ userFacingSummary: z9.string(),
11427
11914
  /**
11428
11915
  * ADR-051 evidence atoms attesting the task's gate results. Format is
11429
11916
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
11430
11917
  * accepts empty arrays so legacy plans validate; `cleo release plan`
11431
11918
  * enforces non-empty via R-301.
11432
11919
  */
11433
- evidenceAtoms: z7.array(NonEmptyString),
11920
+ evidenceAtoms: z9.array(NonEmptyString),
11434
11921
  /** IVTR phase at plan time — informational only per R-316. */
11435
- ivtrPhaseAtPlan: z7.string().optional(),
11922
+ ivtrPhaseAtPlan: z9.string().optional(),
11436
11923
  /** Epic this task rolls up to, locked at plan time per R-303. */
11437
11924
  epicAncestor: NonEmptyString
11438
11925
  });
11439
- ReleaseGateSchema = z7.object({
11926
+ ReleaseGateSchema = z9.object({
11440
11927
  /** Canonical gate name. */
11441
11928
  name: GateNameSchema,
11442
11929
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -11446,11 +11933,11 @@ var init_plan = __esm({
11446
11933
  /** ISO-8601 timestamp the gate was last verified. */
11447
11934
  lastVerifiedAt: Iso8601,
11448
11935
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
11449
- resolvedCommand: z7.string().optional(),
11936
+ resolvedCommand: z9.string().optional(),
11450
11937
  /** Provenance of the resolved command. Optional for unresolved gates. */
11451
11938
  resolvedSource: ResolvedSourceSchema.optional()
11452
11939
  });
11453
- ReleasePlatformMatrixEntrySchema = z7.object({
11940
+ ReleasePlatformMatrixEntrySchema = z9.object({
11454
11941
  /** Target platform tuple. */
11455
11942
  platform: PlatformTupleSchema,
11456
11943
  /** Distribution backend. */
@@ -11458,47 +11945,47 @@ var init_plan = __esm({
11458
11945
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
11459
11946
  package: NonEmptyString,
11460
11947
  /** Whether to run the GHA smoke job for this matrix entry. */
11461
- smoke: z7.boolean().default(true).optional()
11948
+ smoke: z9.boolean().default(true).optional()
11462
11949
  });
11463
- ReleasePreflightSummarySchema = z7.object({
11950
+ ReleasePreflightSummarySchema = z9.object({
11464
11951
  /** True if esbuild externals are out of sync with package.json. */
11465
- esbuildExternalsDrift: z7.boolean(),
11952
+ esbuildExternalsDrift: z9.boolean(),
11466
11953
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
11467
- lockfileDrift: z7.boolean(),
11954
+ lockfileDrift: z9.boolean(),
11468
11955
  /** True if all epic children are in terminal lifecycle states. */
11469
- epicCompletenessClean: z7.boolean(),
11956
+ epicCompletenessClean: z9.boolean(),
11470
11957
  /** True if no task appears in multiple in-flight release plans. */
11471
- doubleListingClean: z7.boolean(),
11958
+ doubleListingClean: z9.boolean(),
11472
11959
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
11473
- preflightWarnings: z7.array(z7.string()).default([]).optional()
11960
+ preflightWarnings: z9.array(z9.string()).default([]).optional()
11474
11961
  });
11475
- ReleasePlanChangelogSchema = z7.object({
11962
+ ReleasePlanChangelogSchema = z9.object({
11476
11963
  /** `kind=feat` tasks. */
11477
- features: z7.array(NonEmptyString).default([]),
11964
+ features: z9.array(NonEmptyString).default([]),
11478
11965
  /** `kind=fix` or `kind=hotfix` tasks. */
11479
- fixes: z7.array(NonEmptyString).default([]),
11966
+ fixes: z9.array(NonEmptyString).default([]),
11480
11967
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
11481
- chores: z7.array(NonEmptyString).default([]),
11968
+ chores: z9.array(NonEmptyString).default([]),
11482
11969
  /** `kind=breaking` or `kind=revert` tasks. */
11483
- breaking: z7.array(NonEmptyString).default([])
11970
+ breaking: z9.array(NonEmptyString).default([])
11484
11971
  });
11485
- ReleasePlanMetaSchema = z7.object({
11972
+ ReleasePlanMetaSchema = z9.object({
11486
11973
  /** True if this is the project's first ever release. */
11487
- firstEverRelease: z7.boolean().optional(),
11974
+ firstEverRelease: z9.boolean().optional(),
11488
11975
  /** Canonical tool names that could not be resolved at plan time. */
11489
- unresolvedTools: z7.array(z7.string()).optional(),
11976
+ unresolvedTools: z9.array(z9.string()).optional(),
11490
11977
  /** Project archetype detected at plan time. */
11491
- archetype: z7.string().optional()
11492
- }).catchall(z7.unknown());
11493
- ReleasePlanSchema = z7.object({
11978
+ archetype: z9.string().optional()
11979
+ }).catchall(z9.unknown());
11980
+ ReleasePlanSchema = z9.object({
11494
11981
  /** Schema URL for this plan version. */
11495
- $schema: z7.string().optional(),
11982
+ $schema: z9.string().optional(),
11496
11983
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
11497
11984
  version: NonEmptyString,
11498
11985
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
11499
11986
  resolvedVersion: NonEmptyString,
11500
11987
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
11501
- suffixApplied: z7.boolean(),
11988
+ suffixApplied: z9.boolean(),
11502
11989
  /** Versioning scheme governing `version` / `resolvedVersion`. */
11503
11990
  scheme: ReleaseSchemeSchema,
11504
11991
  /** npm dist-tag channel for this release. */
@@ -11515,27 +12002,27 @@ var init_plan = __esm({
11515
12002
  * Version of the previous release on the same channel. MUST be `null` only
11516
12003
  * for first-ever releases (R-300, enforced at the verb layer).
11517
12004
  */
11518
- previousVersion: z7.string().nullable(),
12005
+ previousVersion: z9.string().nullable(),
11519
12006
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
11520
- previousTag: z7.string().nullable(),
12007
+ previousTag: z9.string().nullable(),
11521
12008
  /** ISO-8601 timestamp the previous release was published. */
11522
12009
  previousShippedAt: Iso8601.nullable(),
11523
12010
  /** Tasks rolled into this release. */
11524
- tasks: z7.array(ReleasePlanTaskSchema),
12011
+ tasks: z9.array(ReleasePlanTaskSchema),
11525
12012
  /** Bucketed changelog. */
11526
12013
  changelog: ReleasePlanChangelogSchema,
11527
12014
  /** Per-gate verification status. */
11528
- gates: z7.array(ReleaseGateSchema),
12015
+ gates: z9.array(ReleaseGateSchema),
11529
12016
  /** Platform / publisher matrix. */
11530
- platformMatrix: z7.array(ReleasePlatformMatrixEntrySchema),
12017
+ platformMatrix: z9.array(ReleasePlatformMatrixEntrySchema),
11531
12018
  /** Preflight summary from `cleo release plan`. */
11532
12019
  preflightSummary: ReleasePreflightSummarySchema,
11533
12020
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
11534
- workflowRunUrl: z7.string().nullable(),
12021
+ workflowRunUrl: z9.string().nullable(),
11535
12022
  /** URL of the bump PR (populated by `cleo release open`). */
11536
- prUrl: z7.string().nullable(),
12023
+ prUrl: z9.string().nullable(),
11537
12024
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
11538
- mergeCommitSha: z7.string().nullable(),
12025
+ mergeCommitSha: z9.string().nullable(),
11539
12026
  /** Current FSM state per R-302. */
11540
12027
  status: ReleaseStatusSchema,
11541
12028
  /** Informational / forward-compat metadata. */
@@ -11591,52 +12078,52 @@ var init_session2 = __esm({
11591
12078
  });
11592
12079
 
11593
12080
  // packages/contracts/src/session-journal.ts
11594
- import { z as z8 } from "zod";
12081
+ import { z as z10 } from "zod";
11595
12082
  var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
11596
12083
  var init_session_journal = __esm({
11597
12084
  "packages/contracts/src/session-journal.ts"() {
11598
12085
  "use strict";
11599
12086
  SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
11600
- sessionJournalDoctorSummarySchema = z8.object({
12087
+ sessionJournalDoctorSummarySchema = z10.object({
11601
12088
  /** `true` when zero noise patterns were detected. */
11602
- isClean: z8.boolean(),
12089
+ isClean: z10.boolean(),
11603
12090
  /** Total number of noise findings across all patterns. */
11604
- findingsCount: z8.number().int().nonnegative(),
12091
+ findingsCount: z10.number().int().nonnegative(),
11605
12092
  /** Pattern names that were detected (empty when isClean). */
11606
- patterns: z8.array(z8.string()),
12093
+ patterns: z10.array(z10.string()),
11607
12094
  /** Total brain entries scanned. `0` = empty or unavailable. */
11608
- totalScanned: z8.number().int().nonnegative()
12095
+ totalScanned: z10.number().int().nonnegative()
11609
12096
  });
11610
- sessionJournalDebriefSummarySchema = z8.object({
12097
+ sessionJournalDebriefSummarySchema = z10.object({
11611
12098
  /** First 200 characters of the session end note (if provided). */
11612
- noteExcerpt: z8.string().max(200).optional(),
12099
+ noteExcerpt: z10.string().max(200).optional(),
11613
12100
  /** Number of tasks completed during the session. */
11614
- tasksCompletedCount: z8.number().int().nonnegative(),
12101
+ tasksCompletedCount: z10.number().int().nonnegative(),
11615
12102
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
11616
- tasksFocused: z8.array(z8.string()).max(5).optional()
12103
+ tasksFocused: z10.array(z10.string()).max(5).optional()
11617
12104
  });
11618
- sessionJournalEntrySchema = z8.object({
12105
+ sessionJournalEntrySchema = z10.object({
11619
12106
  // Identity
11620
12107
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
11621
- schemaVersion: z8.literal(SESSION_JOURNAL_SCHEMA_VERSION),
12108
+ schemaVersion: z10.literal(SESSION_JOURNAL_SCHEMA_VERSION),
11622
12109
  /** ISO 8601 timestamp when the entry was written. */
11623
- timestamp: z8.string(),
12110
+ timestamp: z10.string(),
11624
12111
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
11625
- sessionId: z8.string(),
12112
+ sessionId: z10.string(),
11626
12113
  /** Event type that triggered this journal entry. */
11627
- eventType: z8.enum(["session_start", "session_end", "observation", "decision", "error"]),
12114
+ eventType: z10.enum(["session_start", "session_end", "observation", "decision", "error"]),
11628
12115
  // Session metadata (set on session_start / session_end)
11629
12116
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
11630
- agentIdentifier: z8.string().optional(),
12117
+ agentIdentifier: z10.string().optional(),
11631
12118
  /** Provider adapter ID active for this session. */
11632
- providerId: z8.string().optional(),
12119
+ providerId: z10.string().optional(),
11633
12120
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
11634
- scope: z8.string().optional(),
12121
+ scope: z10.string().optional(),
11635
12122
  // Session-end fields
11636
12123
  /** Duration of the session in seconds (session_end only). */
11637
- duration: z8.number().int().nonnegative().optional(),
12124
+ duration: z10.number().int().nonnegative().optional(),
11638
12125
  /** Task IDs (not titles) completed during the session. */
11639
- tasksCompleted: z8.array(z8.string()).optional(),
12126
+ tasksCompleted: z10.array(z10.string()).optional(),
11640
12127
  // Doctor summary (T1262 absorbed)
11641
12128
  /** Compact result of `scanBrainNoise` run at session-end. */
11642
12129
  doctorSummary: sessionJournalDoctorSummarySchema.optional(),
@@ -11645,7 +12132,7 @@ var init_session_journal = __esm({
11645
12132
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
11646
12133
  // Optional hash chain
11647
12134
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
11648
- prevEntryHash: z8.string().optional()
12135
+ prevEntryHash: z10.string().optional()
11649
12136
  });
11650
12137
  }
11651
12138
  });
@@ -11665,52 +12152,52 @@ var init_task = __esm({
11665
12152
  });
11666
12153
 
11667
12154
  // packages/contracts/src/task-evidence.ts
11668
- import { z as z9 } from "zod";
12155
+ import { z as z11 } from "zod";
11669
12156
  var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
11670
12157
  var init_task_evidence = __esm({
11671
12158
  "packages/contracts/src/task-evidence.ts"() {
11672
12159
  "use strict";
11673
- fileEvidenceSchema = z9.object({
11674
- kind: z9.literal("file"),
11675
- sha256: z9.string().length(64),
11676
- timestamp: z9.string().datetime(),
11677
- path: z9.string().min(1),
11678
- mime: z9.string().optional(),
11679
- description: z9.string().optional()
11680
- });
11681
- logEvidenceSchema = z9.object({
11682
- kind: z9.literal("log"),
11683
- sha256: z9.string().length(64),
11684
- timestamp: z9.string().datetime(),
11685
- source: z9.string().min(1),
11686
- description: z9.string().optional()
11687
- });
11688
- screenshotEvidenceSchema = z9.object({
11689
- kind: z9.literal("screenshot"),
11690
- sha256: z9.string().length(64),
11691
- timestamp: z9.string().datetime(),
11692
- mime: z9.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
11693
- description: z9.string().optional()
11694
- });
11695
- testOutputEvidenceSchema = z9.object({
11696
- kind: z9.literal("test-output"),
11697
- sha256: z9.string().length(64),
11698
- timestamp: z9.string().datetime(),
11699
- passed: z9.number().int().nonnegative(),
11700
- failed: z9.number().int().nonnegative(),
11701
- skipped: z9.number().int().nonnegative(),
11702
- exitCode: z9.number().int(),
11703
- description: z9.string().optional()
11704
- });
11705
- commandOutputEvidenceSchema = z9.object({
11706
- kind: z9.literal("command-output"),
11707
- sha256: z9.string().length(64),
11708
- timestamp: z9.string().datetime(),
11709
- cmd: z9.string().min(1),
11710
- exitCode: z9.number().int(),
11711
- description: z9.string().optional()
11712
- });
11713
- taskEvidenceSchema = z9.discriminatedUnion("kind", [
12160
+ fileEvidenceSchema = z11.object({
12161
+ kind: z11.literal("file"),
12162
+ sha256: z11.string().length(64),
12163
+ timestamp: z11.string().datetime(),
12164
+ path: z11.string().min(1),
12165
+ mime: z11.string().optional(),
12166
+ description: z11.string().optional()
12167
+ });
12168
+ logEvidenceSchema = z11.object({
12169
+ kind: z11.literal("log"),
12170
+ sha256: z11.string().length(64),
12171
+ timestamp: z11.string().datetime(),
12172
+ source: z11.string().min(1),
12173
+ description: z11.string().optional()
12174
+ });
12175
+ screenshotEvidenceSchema = z11.object({
12176
+ kind: z11.literal("screenshot"),
12177
+ sha256: z11.string().length(64),
12178
+ timestamp: z11.string().datetime(),
12179
+ mime: z11.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
12180
+ description: z11.string().optional()
12181
+ });
12182
+ testOutputEvidenceSchema = z11.object({
12183
+ kind: z11.literal("test-output"),
12184
+ sha256: z11.string().length(64),
12185
+ timestamp: z11.string().datetime(),
12186
+ passed: z11.number().int().nonnegative(),
12187
+ failed: z11.number().int().nonnegative(),
12188
+ skipped: z11.number().int().nonnegative(),
12189
+ exitCode: z11.number().int(),
12190
+ description: z11.string().optional()
12191
+ });
12192
+ commandOutputEvidenceSchema = z11.object({
12193
+ kind: z11.literal("command-output"),
12194
+ sha256: z11.string().length(64),
12195
+ timestamp: z11.string().datetime(),
12196
+ cmd: z11.string().min(1),
12197
+ exitCode: z11.number().int(),
12198
+ description: z11.string().optional()
12199
+ });
12200
+ taskEvidenceSchema = z11.discriminatedUnion("kind", [
11714
12201
  fileEvidenceSchema,
11715
12202
  logEvidenceSchema,
11716
12203
  screenshotEvidenceSchema,
@@ -11721,12 +12208,12 @@ var init_task_evidence = __esm({
11721
12208
  });
11722
12209
 
11723
12210
  // packages/contracts/src/tasks/archive.ts
11724
- import { z as z10 } from "zod";
12211
+ import { z as z12 } from "zod";
11725
12212
  var ArchiveReason, ARCHIVE_REASON_VALUES;
11726
12213
  var init_archive = __esm({
11727
12214
  "packages/contracts/src/tasks/archive.ts"() {
11728
12215
  "use strict";
11729
- ArchiveReason = z10.enum([
12216
+ ArchiveReason = z12.enum([
11730
12217
  "verified",
11731
12218
  "reconciled",
11732
12219
  "superseded",
@@ -11738,6 +12225,67 @@ var init_archive = __esm({
11738
12225
  }
11739
12226
  });
11740
12227
 
12228
+ // packages/contracts/src/templates/manifest.ts
12229
+ import { z as z13 } from "zod";
12230
+ var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
12231
+ var init_manifest2 = __esm({
12232
+ "packages/contracts/src/templates/manifest.ts"() {
12233
+ "use strict";
12234
+ TEMPLATE_KINDS = ["workflow", "config", "agent", "skill", "provider", "doc"];
12235
+ TEMPLATE_SUBSTITUTIONS = ["regex-tmpl", "static", "json-merge"];
12236
+ TEMPLATE_UPDATE_STRATEGIES = [
12237
+ "overwrite-on-bump",
12238
+ "diff-prompt",
12239
+ "immutable",
12240
+ "manifest-merge"
12241
+ ];
12242
+ PLACEHOLDER_SOURCES = [
12243
+ "project-context",
12244
+ "project-info",
12245
+ ".cleo/config",
12246
+ "~/.cleo/config",
12247
+ "tool-resolver",
12248
+ "literal"
12249
+ ];
12250
+ PlaceholderSpecSchema = z13.object({
12251
+ /**
12252
+ * Placeholder identifier as it appears in the template body
12253
+ * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
12254
+ */
12255
+ name: z13.string().min(1, "placeholder name must be non-empty"),
12256
+ /** Resolver source the installer consults for this placeholder. */
12257
+ source: z13.enum(PLACEHOLDER_SOURCES),
12258
+ /**
12259
+ * Path expression evaluated against `source` (e.g. `engines.node` against
12260
+ * `project-context`, `defaults.branchModel` against `.cleo/config`).
12261
+ * For `literal` source, this MAY be the literal value's identifier.
12262
+ */
12263
+ sourcePath: z13.string().min(1, "placeholder sourcePath must be non-empty"),
12264
+ /**
12265
+ * Fallback value used when `source[sourcePath]` resolves to `undefined`.
12266
+ * `null` is permitted to explicitly mark "no default — failure required".
12267
+ */
12268
+ defaultValue: z13.union([z13.string(), z13.number(), z13.boolean(), z13.null()]).optional()
12269
+ });
12270
+ TemplateManifestEntrySchema = z13.object({
12271
+ /** Stable identifier for this template entry. */
12272
+ id: z13.string().min(1, "id must be non-empty"),
12273
+ /** Category of file this template represents. */
12274
+ kind: z13.enum(TEMPLATE_KINDS),
12275
+ /** Repo-relative path of the template source file. */
12276
+ sourcePath: z13.string().min(1, "sourcePath must be non-empty"),
12277
+ /** Project-relative path where the rendered template installs. */
12278
+ installPath: z13.string().min(1, "installPath must be non-empty"),
12279
+ /** Substitution strategy the installer applies to `sourcePath`. */
12280
+ substitution: z13.enum(TEMPLATE_SUBSTITUTIONS),
12281
+ /** Declared placeholders this template requires. May be empty. */
12282
+ placeholders: z13.array(PlaceholderSpecSchema),
12283
+ /** Reconciliation policy on upgrade. */
12284
+ updateStrategy: z13.enum(TEMPLATE_UPDATE_STRATEGIES)
12285
+ });
12286
+ }
12287
+ });
12288
+
11741
12289
  // packages/contracts/src/index.ts
11742
12290
  var init_src2 = __esm({
11743
12291
  "packages/contracts/src/index.ts"() {
@@ -11747,10 +12295,12 @@ var init_src2 = __esm({
11747
12295
  init_branch_lock();
11748
12296
  init_changesets();
11749
12297
  init_cli_category();
12298
+ init_manifest();
11750
12299
  init_credentials();
11751
12300
  init_db_inventory2();
11752
12301
  init_identity();
11753
12302
  init_operations_registry();
12303
+ init_provenance();
11754
12304
  init_docs_taxonomy();
11755
12305
  init_engine_result();
11756
12306
  init_enums();
@@ -11777,6 +12327,7 @@ var init_src2 = __esm({
11777
12327
  init_task();
11778
12328
  init_task_evidence();
11779
12329
  init_archive();
12330
+ init_manifest2();
11780
12331
  }
11781
12332
  });
11782
12333
 
@@ -16450,7 +17001,10 @@ var init_diagnostics = __esm({
16450
17001
  // packages/cleo/src/dispatch/domains/docs.ts
16451
17002
  import { readFile } from "node:fs/promises";
16452
17003
  import { resolve as resolve2 } from "node:path";
17004
+ import { pushWarning } from "@cleocode/core";
16453
17005
  import {
17006
+ AUTO_TOKEN,
17007
+ allocateAutoSlugForDispatch,
16454
17008
  createAttachmentStore,
16455
17009
  createAttachmentStoreV2,
16456
17010
  generateDocsLlmsTxt,
@@ -16462,6 +17016,7 @@ import {
16462
17016
  reserveSlugForDispatch,
16463
17017
  resolveAttachmentBackend,
16464
17018
  SlugCollisionError,
17019
+ validateDocBody,
16465
17020
  writeChangesetEntry
16466
17021
  } from "@cleocode/core/internal";
16467
17022
  function getDocKindRegistry() {
@@ -16938,7 +17493,8 @@ var init_docs2 = __esm({
16938
17493
  labels: rawLabels,
16939
17494
  attachedBy: rawAttachedBy,
16940
17495
  slug: rawSlug,
16941
- type: rawType
17496
+ type: rawType,
17497
+ strict: strictMode
16942
17498
  } = params;
16943
17499
  if (!ownerId) {
16944
17500
  return lafsError("E_INVALID_INPUT", "ownerId is required", "add");
@@ -16952,11 +17508,19 @@ var init_docs2 = __esm({
16952
17508
  }
16953
17509
  let slug;
16954
17510
  if (rawSlug !== void 0) {
16955
- const check = validateSlug(rawSlug);
17511
+ let candidate = rawSlug;
17512
+ if (typeof candidate === "string" && candidate.includes(AUTO_TOKEN)) {
17513
+ const allocated = await allocateAutoSlugForDispatch(getProjectRoot5(), {
17514
+ kind: typeof rawType === "string" ? rawType : "",
17515
+ rawSlug: candidate
17516
+ });
17517
+ candidate = allocated.resolvedSlug;
17518
+ }
17519
+ const check = validateSlug(candidate);
16956
17520
  if (!check.valid) {
16957
17521
  return lafsError("E_INVALID_SLUG", check.reason, "add");
16958
17522
  }
16959
- slug = rawSlug;
17523
+ slug = candidate;
16960
17524
  }
16961
17525
  let type2;
16962
17526
  if (rawType !== void 0) {
@@ -17109,6 +17673,36 @@ var init_docs2 = __esm({
17109
17673
  } catch {
17110
17674
  return lafsError("E_FILE_ERROR", `Cannot read file: ${absPath}`, "add");
17111
17675
  }
17676
+ if (type2 !== void 0) {
17677
+ const bodyText = bytes.toString("utf-8");
17678
+ let registry;
17679
+ try {
17680
+ registry = DocKindRegistry.load(getProjectRoot5());
17681
+ } catch {
17682
+ registry = void 0;
17683
+ }
17684
+ const check = validateDocBody(type2, bodyText, registry);
17685
+ if (!check.ok) {
17686
+ const missingList = check.missing.join(", ");
17687
+ if (strictMode === true) {
17688
+ return lafsError(
17689
+ "E_DOC_SCHEMA_MISMATCH",
17690
+ `body for kind '${type2}' is missing required section(s): ${missingList}`,
17691
+ "add",
17692
+ `Add the missing H2 section(s) \u2014 '## ${check.missing[0] ?? ""}' \u2014 then retry. Pass --strict=false (default) to surface as an advisory warning instead of an error.`,
17693
+ {
17694
+ kind: type2,
17695
+ missing: check.missing,
17696
+ strict: true
17697
+ }
17698
+ );
17699
+ }
17700
+ pushWarning({
17701
+ code: "W_DOC_SCHEMA_MISMATCH",
17702
+ message: `body for kind '${type2}' is missing required section(s): ${missingList}. Add '--strict' to fail on schema violations.`
17703
+ });
17704
+ }
17705
+ }
17112
17706
  const mime = mimeFromPath(absPath);
17113
17707
  const attachment = {
17114
17708
  kind: "local-file",
@@ -25630,8 +26224,8 @@ async function loadPlaybookByName(name) {
25630
26224
  return null;
25631
26225
  }
25632
26226
  try {
25633
- const { getProjectRoot: getProjectRoot48 } = await import("@cleocode/core/internal");
25634
- const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot48();
26227
+ const { getProjectRoot: getProjectRoot53 } = await import("@cleocode/core/internal");
26228
+ const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot53();
25635
26229
  const resolved = resolvePlaybook(name, {
25636
26230
  projectRoot,
25637
26231
  globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
@@ -25675,8 +26269,8 @@ async function acquireDb() {
25675
26269
  async function buildDefaultDispatcher() {
25676
26270
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
25677
26271
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
25678
- const { getProjectRoot: getProjectRoot48 } = await import("@cleocode/core/internal");
25679
- const projectRoot = getProjectRoot48();
26272
+ const { getProjectRoot: getProjectRoot53 } = await import("@cleocode/core/internal");
26273
+ const projectRoot = getProjectRoot53();
25680
26274
  return {
25681
26275
  async dispatch(input2) {
25682
26276
  try {
@@ -25866,8 +26460,8 @@ var init_playbook2 = __esm({
25866
26460
  projectRoot = __playbookRuntimeOverrides.projectRoot;
25867
26461
  } else {
25868
26462
  try {
25869
- const { getProjectRoot: getProjectRoot48 } = await import("@cleocode/core/internal");
25870
- projectRoot = getProjectRoot48();
26463
+ const { getProjectRoot: getProjectRoot53 } = await import("@cleocode/core/internal");
26464
+ projectRoot = getProjectRoot53();
25871
26465
  } catch {
25872
26466
  projectRoot = void 0;
25873
26467
  }
@@ -25931,14 +26525,14 @@ var init_playbook2 = __esm({
25931
26525
  const dispatcher = await buildDefaultDispatcher();
25932
26526
  let result;
25933
26527
  try {
25934
- const { getProjectRoot: getProjectRoot48 } = await import("@cleocode/core/internal");
26528
+ const { getProjectRoot: getProjectRoot53 } = await import("@cleocode/core/internal");
25935
26529
  const opts = {
25936
26530
  db,
25937
26531
  playbook: parsed.definition,
25938
26532
  playbookHash: parsed.sourceHash,
25939
26533
  initialContext,
25940
26534
  dispatcher,
25941
- projectRoot: getProjectRoot48()
26535
+ projectRoot: getProjectRoot53()
25942
26536
  };
25943
26537
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
25944
26538
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -28158,7 +28752,7 @@ import {
28158
28752
  verifyProvenance
28159
28753
  } from "@cleocode/core/internal";
28160
28754
  var log2, ProvenanceHandler;
28161
- var init_provenance = __esm({
28755
+ var init_provenance2 = __esm({
28162
28756
  "packages/cleo/src/dispatch/domains/provenance.ts"() {
28163
28757
  "use strict";
28164
28758
  init_base();
@@ -31281,7 +31875,7 @@ var init_domains = __esm({
31281
31875
  init_orchestrate2();
31282
31876
  init_pipeline3();
31283
31877
  init_playbook2();
31284
- init_provenance();
31878
+ init_provenance2();
31285
31879
  init_release2();
31286
31880
  init_sentient2();
31287
31881
  init_session3();
@@ -31726,11 +32320,11 @@ var init_security = __esm({
31726
32320
  });
31727
32321
 
31728
32322
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
31729
- function createSanitizer(getProjectRoot48) {
32323
+ function createSanitizer(getProjectRoot53) {
31730
32324
  return async (req, next) => {
31731
32325
  if (req.params) {
31732
32326
  try {
31733
- const root = getProjectRoot48 ? getProjectRoot48() : void 0;
32327
+ const root = getProjectRoot53 ? getProjectRoot53() : void 0;
31734
32328
  req.params = sanitizeParams(req.params, root, {
31735
32329
  domain: req.domain,
31736
32330
  operation: req.operation
@@ -32389,6 +32983,7 @@ var addCommand;
32389
32983
  var init_add = __esm({
32390
32984
  "packages/cleo/src/cli/commands/add.ts"() {
32391
32985
  "use strict";
32986
+ init_src2();
32392
32987
  init_dist();
32393
32988
  init_cli();
32394
32989
  init_renderers();
@@ -32565,6 +33160,20 @@ For 2+ tasks at once: cleo add-batch --file tasks.json (single transaction, atom
32565
33160
  await showUsage(cmd);
32566
33161
  return;
32567
33162
  }
33163
+ if (args.severity !== void 0 && !TASK_SEVERITIES.includes(args.severity)) {
33164
+ const valid = TASK_SEVERITIES.join(", ");
33165
+ cliError(
33166
+ `severity must be one of: ${valid} \u2014 got '${args.severity}'`,
33167
+ 6,
33168
+ {
33169
+ name: "E_INVALID_SEVERITY_VALUE",
33170
+ fix: `Pass --severity with one of: ${valid}`
33171
+ },
33172
+ { operation: "tasks.add" }
33173
+ );
33174
+ process.exit(6);
33175
+ return;
33176
+ }
32568
33177
  const params = { title: args.title };
32569
33178
  if (args.status !== void 0) params["status"] = args.status;
32570
33179
  if (args.priority !== void 0) params["priority"] = args.priority;
@@ -35841,8 +36450,8 @@ var init_consent = __esm({
35841
36450
  /* webpackIgnore: true */
35842
36451
  "@cleocode/core/config.js"
35843
36452
  );
35844
- const getConfigValue2 = configMod.getConfigValue;
35845
- const setConfigValue2 = configMod.setConfigValue;
36453
+ const getConfigValue3 = configMod.getConfigValue;
36454
+ const setConfigValue3 = configMod.setConfigValue;
35846
36455
  const { addSuppression, removeSuppression, isSuppressed } = await import(
35847
36456
  /* webpackIgnore: true */
35848
36457
  "@cleocode/core/llm/credential-removal.js"
@@ -35851,7 +36460,7 @@ var init_consent = __esm({
35851
36460
  const SOURCE_ID = "claude-code";
35852
36461
  const PROVIDER = "anthropic";
35853
36462
  if (showStatus) {
35854
- const resolved = await getConfigValue2(CONSENT_KEY);
36463
+ const resolved = await getConfigValue3(CONSENT_KEY);
35855
36464
  const consentEnabled = resolved.value === true;
35856
36465
  const suppressed = isSuppressed(PROVIDER, SOURCE_ID);
35857
36466
  const result2 = {
@@ -35871,7 +36480,7 @@ var init_consent = __esm({
35871
36480
  return;
35872
36481
  }
35873
36482
  if (enableClaudeCode) {
35874
- await setConfigValue2(CONSENT_KEY, true, void 0, { global: true });
36483
+ await setConfigValue3(CONSENT_KEY, true, void 0, { global: true });
35875
36484
  const suppressionChanged2 = removeSuppression(PROVIDER, SOURCE_ID);
35876
36485
  const result2 = {
35877
36486
  action: "enabled",
@@ -35887,7 +36496,7 @@ var init_consent = __esm({
35887
36496
  });
35888
36497
  return;
35889
36498
  }
35890
- await setConfigValue2(CONSENT_KEY, false, void 0, { global: true });
36499
+ await setConfigValue3(CONSENT_KEY, false, void 0, { global: true });
35891
36500
  const wasAlreadySuppressed = isSuppressed(PROVIDER, SOURCE_ID);
35892
36501
  addSuppression(PROVIDER, SOURCE_ID);
35893
36502
  const suppressionChanged = !wasAlreadySuppressed;
@@ -37148,9 +37757,9 @@ var init_backup = __esm({
37148
37757
  async run({ args }) {
37149
37758
  const scope = args.scope;
37150
37759
  const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
37151
- const { getProjectRoot: getProjectRoot48 } = await import("@cleocode/core");
37760
+ const { getProjectRoot: getProjectRoot53 } = await import("@cleocode/core");
37152
37761
  const includesProject = scope === "project" || scope === "all";
37153
- const projectRoot = includesProject ? getProjectRoot48() : void 0;
37762
+ const projectRoot = includesProject ? getProjectRoot53() : void 0;
37154
37763
  let passphrase;
37155
37764
  if (args.encrypt === true) {
37156
37765
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -37226,12 +37835,12 @@ var init_backup = __esm({
37226
37835
  },
37227
37836
  async run({ args }) {
37228
37837
  const bundlePath = args.bundle;
37229
- const { getProjectRoot: getProjectRoot48, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
37838
+ const { getProjectRoot: getProjectRoot53, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
37230
37839
  const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
37231
37840
  const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
37232
37841
  const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
37233
37842
  const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
37234
- const projectRoot = getProjectRoot48();
37843
+ const projectRoot = getProjectRoot53();
37235
37844
  if (args.force !== true) {
37236
37845
  const existing = checkForExistingData(projectRoot, getCleoHome6());
37237
37846
  if (existing.length > 0) {
@@ -37835,7 +38444,7 @@ __export(briefing_exports, {
37835
38444
  });
37836
38445
  import { existsSync as existsSync9, readFileSync as readFileSync10 } from "node:fs";
37837
38446
  import { join as join11 } from "node:path";
37838
- import { pushWarning } from "@cleocode/core";
38447
+ import { pushWarning as pushWarning2 } from "@cleocode/core";
37839
38448
  import { resolveLegacyCleoDir } from "@cleocode/paths";
37840
38449
  function resolveInjectionTemplatePath() {
37841
38450
  const xdgConfig = resolveLegacyCleoDir(process.env["XDG_CONFIG_HOME"]);
@@ -37867,7 +38476,7 @@ function renderForAdapter(sectionName, content, format) {
37867
38476
  async function runBriefingInject(sectionName, formatStr) {
37868
38477
  const templatePath = resolveInjectionTemplatePath();
37869
38478
  if (!existsSync9(templatePath)) {
37870
- pushWarning({
38479
+ pushWarning2({
37871
38480
  code: "W_TEMPLATE_INJECT_FAILED",
37872
38481
  message: `CLEO-INJECTION.md not found at ${templatePath}`
37873
38482
  });
@@ -37887,7 +38496,7 @@ async function runBriefingInject(sectionName, formatStr) {
37887
38496
  const section = extractSection(content, sectionName);
37888
38497
  if (section === null) {
37889
38498
  const available = INJECTION_SECTION_NAMES.join(", ");
37890
- pushWarning({
38499
+ pushWarning2({
37891
38500
  code: "W_TEMPLATE_INJECT_FAILED",
37892
38501
  message: `Section "${sectionName}" not found in CLEO-INJECTION.md.`
37893
38502
  });
@@ -37908,7 +38517,7 @@ async function runBriefingInject(sectionName, formatStr) {
37908
38517
  const adapterName = formatStr.slice("adapter:".length);
37909
38518
  if (!ADAPTER_FORMATS.includes(adapterName)) {
37910
38519
  const supported = ADAPTER_FORMATS.join(", ");
37911
- pushWarning({
38520
+ pushWarning2({
37912
38521
  code: "W_TEMPLATE_INJECT_FAILED",
37913
38522
  message: `Unknown adapter format "${adapterName}".`
37914
38523
  });
@@ -40310,71 +40919,479 @@ var init_conduit3 = __esm({
40310
40919
  }
40311
40920
  });
40312
40921
 
40313
- // packages/cleo/src/cli/commands/config.ts
40314
- var config_exports = {};
40315
- __export(config_exports, {
40316
- configCommand: () => configCommand
40922
+ // packages/cleo/src/cli/commands/config/drift-check.ts
40923
+ import { getProjectRoot as getProjectRoot31 } from "@cleocode/core";
40924
+ import { checkDrift } from "@cleocode/core/config/registry";
40925
+ function parseDriftScope(raw) {
40926
+ const value = raw ?? "project";
40927
+ if (value === "global" || value === "project" || value === "metadata") {
40928
+ return value;
40929
+ }
40930
+ return null;
40931
+ }
40932
+ var configDriftCheckCommand;
40933
+ var init_drift_check = __esm({
40934
+ "packages/cleo/src/cli/commands/config/drift-check.ts"() {
40935
+ "use strict";
40936
+ init_src2();
40937
+ init_define_cli_command();
40938
+ init_renderers();
40939
+ configDriftCheckCommand = defineCommand({
40940
+ meta: {
40941
+ name: "drift-check",
40942
+ description: "Check a scoped config file for drift (default scope: project; metadata covers project-info/project-context)"
40943
+ },
40944
+ args: {
40945
+ scope: {
40946
+ type: "string",
40947
+ description: "Scope to check: global | project | metadata (default project)",
40948
+ default: "project"
40949
+ },
40950
+ json: {
40951
+ type: "boolean",
40952
+ description: "Output as JSON"
40953
+ }
40954
+ },
40955
+ async run({ args }) {
40956
+ const scope = parseDriftScope(args["scope"]);
40957
+ if (scope === null) {
40958
+ cliError(
40959
+ `config drift-check failed: invalid --scope (must be global|project|metadata)`,
40960
+ 1 /* GENERAL_ERROR */,
40961
+ { name: "E_CONFIG_DRIFT_CHECK_FAILED" }
40962
+ );
40963
+ process.exit(1 /* GENERAL_ERROR */);
40964
+ return;
40965
+ }
40966
+ let driftResult;
40967
+ try {
40968
+ const projectRoot = getProjectRoot31();
40969
+ driftResult = await checkDrift(scope, projectRoot);
40970
+ } catch (err) {
40971
+ const message = err instanceof Error ? err.message : String(err);
40972
+ cliError(`config drift-check failed: ${message}`, 1 /* GENERAL_ERROR */, {
40973
+ name: "E_CONFIG_DRIFT_CHECK_FAILED"
40974
+ });
40975
+ process.exit(1 /* GENERAL_ERROR */);
40976
+ return;
40977
+ }
40978
+ const result = {
40979
+ scope,
40980
+ drift: driftResult.drift,
40981
+ ...driftResult.reason !== void 0 ? { reason: driftResult.reason } : {}
40982
+ };
40983
+ cliOutput(result, {
40984
+ command: "config-drift-check",
40985
+ operation: "config.drift-check"
40986
+ });
40987
+ if (driftResult.drift) {
40988
+ process.exit(6 /* VALIDATION_ERROR */);
40989
+ }
40990
+ }
40991
+ });
40992
+ }
40317
40993
  });
40318
- import { CleoError as CleoError2, formatError as formatError4, loadConfig as loadConfig2 } from "@cleocode/core";
40319
- var PRESET_DESCRIPTIONS, getCommand2, setCommand, setPresetCommand, presetsCommand, listCommand7, configCommand;
40320
- var init_config2 = __esm({
40321
- "packages/cleo/src/cli/commands/config.ts"() {
40994
+
40995
+ // packages/cleo/src/cli/commands/config/get.ts
40996
+ import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
40997
+ import { getConfigValue } from "@cleocode/core/config/registry";
40998
+ function parseResolveScope(raw) {
40999
+ const value = raw ?? "merged";
41000
+ if (value === "global" || value === "project" || value === "merged") {
41001
+ return value;
41002
+ }
41003
+ return null;
41004
+ }
41005
+ var configGetCommand;
41006
+ var init_get = __esm({
41007
+ "packages/cleo/src/cli/commands/config/get.ts"() {
40322
41008
  "use strict";
40323
- init_dist();
40324
- init_cli();
41009
+ init_src2();
41010
+ init_define_cli_command();
40325
41011
  init_renderers();
40326
- PRESET_DESCRIPTIONS = {
40327
- strict: "Block on missing AC, require session notes, enforce lifecycle pipeline.",
40328
- standard: "Warn on missing AC, optional session notes, advisory lifecycle pipeline.",
40329
- minimal: "No AC checking, no session requirement, lifecycle pipeline off."
40330
- };
40331
- getCommand2 = defineCommand({
40332
- meta: { name: "get", description: "Get a configuration value" },
41012
+ configGetCommand = defineCommand({
41013
+ meta: {
41014
+ name: "get",
41015
+ description: "Read a single config value by dot-separated key (default scope: merged)"
41016
+ },
40333
41017
  args: {
40334
41018
  key: {
40335
41019
  type: "positional",
40336
- description: "Configuration key to retrieve",
40337
- required: true
41020
+ required: true,
41021
+ description: "Dot-separated key path (e.g. release.branchModel)"
41022
+ },
41023
+ scope: {
41024
+ type: "string",
41025
+ description: "Cascade scope to read: global | project | merged (default merged)",
41026
+ default: "merged"
41027
+ },
41028
+ json: {
41029
+ type: "boolean",
41030
+ description: "Output as JSON"
40338
41031
  }
40339
41032
  },
40340
41033
  async run({ args }) {
40341
- await dispatchFromCli(
40342
- "query",
40343
- "admin",
40344
- "config.show",
40345
- { key: args.key },
40346
- { command: "config" }
40347
- );
41034
+ const key = String(args["key"] ?? "").trim();
41035
+ if (key.length === 0) {
41036
+ cliError(`config get failed: <key> is required`, 2 /* INVALID_INPUT */, {
41037
+ name: "E_CONFIG_GET_FAILED"
41038
+ });
41039
+ process.exit(2 /* INVALID_INPUT */);
41040
+ return;
41041
+ }
41042
+ const scope = parseResolveScope(args["scope"]);
41043
+ if (scope === null) {
41044
+ cliError(
41045
+ `config get failed: invalid --scope (must be global|project|merged)`,
41046
+ 1 /* GENERAL_ERROR */,
41047
+ { name: "E_CONFIG_GET_FAILED" }
41048
+ );
41049
+ process.exit(1 /* GENERAL_ERROR */);
41050
+ return;
41051
+ }
41052
+ let value;
41053
+ try {
41054
+ const projectRoot = getProjectRoot32();
41055
+ value = await getConfigValue(key, { scope, projectRoot });
41056
+ } catch (err) {
41057
+ const message = err instanceof Error ? err.message : String(err);
41058
+ cliError(`config get failed: ${message}`, 1 /* GENERAL_ERROR */, {
41059
+ name: "E_CONFIG_GET_FAILED"
41060
+ });
41061
+ process.exit(1 /* GENERAL_ERROR */);
41062
+ return;
41063
+ }
41064
+ if (value === void 0) {
41065
+ cliError(`config get failed: key "${key}" not found`, 4 /* NOT_FOUND */, {
41066
+ name: "E_NOT_FOUND",
41067
+ details: { key, scope }
41068
+ });
41069
+ process.exit(4 /* NOT_FOUND */);
41070
+ return;
41071
+ }
41072
+ const result = { scope, key, value };
41073
+ cliOutput(result, {
41074
+ command: "config-get",
41075
+ operation: "config.get"
41076
+ });
40348
41077
  }
40349
41078
  });
40350
- setCommand = defineCommand({
40351
- meta: { name: "set", description: "Set a configuration value" },
41079
+ }
41080
+ });
41081
+
41082
+ // packages/cleo/src/cli/commands/config/set.ts
41083
+ import { getProjectRoot as getProjectRoot33, parseConfigValue, setConfigValue } from "@cleocode/core";
41084
+ import { validateConfig as validateConfig2 } from "@cleocode/core/config/registry";
41085
+ function parseWriteScope(raw) {
41086
+ const value = raw ?? "project";
41087
+ if (value === "global" || value === "project") {
41088
+ return value;
41089
+ }
41090
+ return null;
41091
+ }
41092
+ function coerceValue(raw, typeFlag) {
41093
+ if (typeFlag === void 0) return parseConfigValue(raw);
41094
+ if (typeFlag === "string") return raw;
41095
+ if (typeFlag === "number") return coerceNumber(raw);
41096
+ if (typeFlag === "boolean") return coerceBoolean(raw);
41097
+ if (typeFlag === "json") return coerceJson(raw);
41098
+ throw new Error(`--type must be one of: string | number | boolean | json (got "${typeFlag}")`);
41099
+ }
41100
+ function coerceNumber(raw) {
41101
+ const n = Number(raw);
41102
+ if (Number.isNaN(n)) {
41103
+ throw new Error(`--type number cannot coerce "${raw}"`);
41104
+ }
41105
+ return n;
41106
+ }
41107
+ function coerceBoolean(raw) {
41108
+ const lower = raw.toLowerCase();
41109
+ if (lower === "true") return true;
41110
+ if (lower === "false") return false;
41111
+ throw new Error(`--type boolean accepts only "true"/"false" (got "${raw}")`);
41112
+ }
41113
+ function coerceJson(raw) {
41114
+ try {
41115
+ return JSON.parse(raw);
41116
+ } catch (err) {
41117
+ const msg = err instanceof Error ? err.message : String(err);
41118
+ throw new Error(`--type json failed to parse: ${msg}`);
41119
+ }
41120
+ }
41121
+ var configSetCommand;
41122
+ var init_set = __esm({
41123
+ "packages/cleo/src/cli/commands/config/set.ts"() {
41124
+ "use strict";
41125
+ init_src2();
41126
+ init_define_cli_command();
41127
+ init_renderers();
41128
+ configSetCommand = defineCommand({
41129
+ meta: {
41130
+ name: "set",
41131
+ description: "Write a value into project or global .cleo/config.json"
41132
+ },
40352
41133
  args: {
40353
41134
  key: {
40354
41135
  type: "positional",
40355
- description: "Configuration key to set",
40356
- required: true
41136
+ required: true,
41137
+ description: "Dot-separated key path"
40357
41138
  },
40358
41139
  value: {
40359
41140
  type: "positional",
40360
- description: "Value to assign",
40361
- required: true
41141
+ required: true,
41142
+ description: "Raw value (string). Use --type to coerce explicitly."
40362
41143
  },
40363
- global: {
41144
+ scope: {
41145
+ type: "string",
41146
+ description: "Where to write: project | global (default project)",
41147
+ default: "project"
41148
+ },
41149
+ type: {
41150
+ type: "string",
41151
+ description: "Explicit value type: string | number | boolean | json"
41152
+ },
41153
+ json: {
40364
41154
  type: "boolean",
40365
- description: "Set in global config instead of project config"
41155
+ description: "Output as JSON"
40366
41156
  }
40367
41157
  },
40368
41158
  async run({ args }) {
40369
- await dispatchFromCli(
40370
- "mutate",
40371
- "admin",
40372
- "config.set",
40373
- { key: args.key, value: args.value },
40374
- { command: "config" }
40375
- );
41159
+ const key = String(args["key"] ?? "").trim();
41160
+ if (key.length === 0) {
41161
+ cliError(`config set failed: <key> is required`, 2 /* INVALID_INPUT */, {
41162
+ name: "E_CONFIG_SET_FAILED"
41163
+ });
41164
+ process.exit(2 /* INVALID_INPUT */);
41165
+ return;
41166
+ }
41167
+ const rawValue = String(args["value"] ?? "");
41168
+ const scope = parseWriteScope(args["scope"]);
41169
+ if (scope === null) {
41170
+ cliError(
41171
+ `config set failed: invalid --scope (must be global|project)`,
41172
+ 1 /* GENERAL_ERROR */,
41173
+ { name: "E_CONFIG_SET_FAILED" }
41174
+ );
41175
+ process.exit(1 /* GENERAL_ERROR */);
41176
+ return;
41177
+ }
41178
+ const typeFlag = args["type"];
41179
+ let coerced;
41180
+ try {
41181
+ coerced = coerceValue(rawValue, typeFlag);
41182
+ } catch (err) {
41183
+ const message = err instanceof Error ? err.message : String(err);
41184
+ cliError(`config set failed: ${message}`, 2 /* INVALID_INPUT */, {
41185
+ name: "E_CONFIG_SET_FAILED"
41186
+ });
41187
+ process.exit(2 /* INVALID_INPUT */);
41188
+ return;
41189
+ }
41190
+ let written;
41191
+ let validate;
41192
+ try {
41193
+ const projectRoot = getProjectRoot33();
41194
+ written = await setConfigValue(key, coerced, projectRoot, {
41195
+ global: scope === "global"
41196
+ });
41197
+ validate = await validateConfig2(scope, projectRoot);
41198
+ } catch (err) {
41199
+ const message = err instanceof Error ? err.message : String(err);
41200
+ cliError(`config set failed: ${message}`, 1 /* GENERAL_ERROR */, {
41201
+ name: "E_CONFIG_SET_FAILED"
41202
+ });
41203
+ process.exit(1 /* GENERAL_ERROR */);
41204
+ return;
41205
+ }
41206
+ const result = {
41207
+ scope: written.scope,
41208
+ key: written.key,
41209
+ value: written.value,
41210
+ validate
41211
+ };
41212
+ cliOutput(result, {
41213
+ command: "config-set",
41214
+ operation: "config.set"
41215
+ });
41216
+ if (!validate.ok) {
41217
+ process.exit(6 /* VALIDATION_ERROR */);
41218
+ }
40376
41219
  }
40377
41220
  });
41221
+ }
41222
+ });
41223
+
41224
+ // packages/cleo/src/cli/commands/config/show.ts
41225
+ import { getProjectRoot as getProjectRoot34 } from "@cleocode/core";
41226
+ import {
41227
+ resolveCleoConfig
41228
+ } from "@cleocode/core/config/registry";
41229
+ function parseResolveScope2(raw) {
41230
+ const value = raw ?? "merged";
41231
+ if (value === "global" || value === "project" || value === "merged") {
41232
+ return value;
41233
+ }
41234
+ return null;
41235
+ }
41236
+ var configShowCommand;
41237
+ var init_show = __esm({
41238
+ "packages/cleo/src/cli/commands/config/show.ts"() {
41239
+ "use strict";
41240
+ init_src2();
41241
+ init_define_cli_command();
41242
+ init_renderers();
41243
+ configShowCommand = defineCommand({
41244
+ meta: {
41245
+ name: "show",
41246
+ description: "Print the resolved CleoConfig envelope (default scope: merged)"
41247
+ },
41248
+ args: {
41249
+ scope: {
41250
+ type: "string",
41251
+ description: "Cascade scope to read: global | project | merged (default merged)",
41252
+ default: "merged"
41253
+ },
41254
+ json: {
41255
+ type: "boolean",
41256
+ description: "Output as JSON"
41257
+ }
41258
+ },
41259
+ async run({ args }) {
41260
+ const scope = parseResolveScope2(args["scope"]);
41261
+ if (scope === null) {
41262
+ cliError(
41263
+ `config show failed: invalid --scope (must be global|project|merged)`,
41264
+ 1 /* GENERAL_ERROR */,
41265
+ { name: "E_CONFIG_SHOW_FAILED" }
41266
+ );
41267
+ process.exit(1 /* GENERAL_ERROR */);
41268
+ return;
41269
+ }
41270
+ try {
41271
+ const projectRoot = getProjectRoot34();
41272
+ const config = await resolveCleoConfig({ scope, projectRoot });
41273
+ const result = { scope, config };
41274
+ cliOutput(result, {
41275
+ command: "config-show",
41276
+ operation: "config.show"
41277
+ });
41278
+ } catch (err) {
41279
+ const message = err instanceof Error ? err.message : String(err);
41280
+ cliError(`config show failed: ${message}`, 1 /* GENERAL_ERROR */, {
41281
+ name: "E_CONFIG_SHOW_FAILED"
41282
+ });
41283
+ process.exit(1 /* GENERAL_ERROR */);
41284
+ }
41285
+ }
41286
+ });
41287
+ }
41288
+ });
41289
+
41290
+ // packages/cleo/src/cli/commands/config/validate.ts
41291
+ import { getProjectRoot as getProjectRoot35 } from "@cleocode/core";
41292
+ import { validateConfig as validateConfig3 } from "@cleocode/core/config/registry";
41293
+ function parseValidateScope(raw) {
41294
+ const value = raw ?? "project";
41295
+ if (value === "global" || value === "project") {
41296
+ return value;
41297
+ }
41298
+ return null;
41299
+ }
41300
+ var configValidateCommand;
41301
+ var init_validate2 = __esm({
41302
+ "packages/cleo/src/cli/commands/config/validate.ts"() {
41303
+ "use strict";
41304
+ init_src2();
41305
+ init_define_cli_command();
41306
+ init_renderers();
41307
+ configValidateCommand = defineCommand({
41308
+ meta: {
41309
+ name: "validate",
41310
+ description: "Validate a scoped config file against its schema (default scope: project)"
41311
+ },
41312
+ args: {
41313
+ scope: {
41314
+ type: "string",
41315
+ description: "Scope to validate: global | project (default project)",
41316
+ default: "project"
41317
+ },
41318
+ json: {
41319
+ type: "boolean",
41320
+ description: "Output as JSON"
41321
+ }
41322
+ },
41323
+ async run({ args }) {
41324
+ const scope = parseValidateScope(args["scope"]);
41325
+ if (scope === null) {
41326
+ cliError(
41327
+ `config validate failed: invalid --scope (must be global|project)`,
41328
+ 1 /* GENERAL_ERROR */,
41329
+ { name: "E_CONFIG_VALIDATE_FAILED" }
41330
+ );
41331
+ process.exit(1 /* GENERAL_ERROR */);
41332
+ return;
41333
+ }
41334
+ let validate;
41335
+ try {
41336
+ const projectRoot = getProjectRoot35();
41337
+ validate = await validateConfig3(scope, projectRoot);
41338
+ } catch (err) {
41339
+ const message = err instanceof Error ? err.message : String(err);
41340
+ cliError(`config validate failed: ${message}`, 1 /* GENERAL_ERROR */, {
41341
+ name: "E_CONFIG_VALIDATE_FAILED"
41342
+ });
41343
+ process.exit(1 /* GENERAL_ERROR */);
41344
+ return;
41345
+ }
41346
+ const result = {
41347
+ scope,
41348
+ ok: validate.ok,
41349
+ issues: validate.issues
41350
+ };
41351
+ cliOutput(result, {
41352
+ command: "config-validate",
41353
+ operation: "config.validate"
41354
+ });
41355
+ if (!validate.ok) {
41356
+ process.exit(6 /* VALIDATION_ERROR */);
41357
+ }
41358
+ }
41359
+ });
41360
+ }
41361
+ });
41362
+
41363
+ // packages/cleo/src/cli/commands/config/index.ts
41364
+ var init_config2 = __esm({
41365
+ "packages/cleo/src/cli/commands/config/index.ts"() {
41366
+ "use strict";
41367
+ init_drift_check();
41368
+ init_get();
41369
+ init_set();
41370
+ init_show();
41371
+ init_validate2();
41372
+ }
41373
+ });
41374
+
41375
+ // packages/cleo/src/cli/commands/config.ts
41376
+ var config_exports = {};
41377
+ __export(config_exports, {
41378
+ configCommand: () => configCommand
41379
+ });
41380
+ import { CleoError as CleoError2, loadConfig as loadConfig2 } from "@cleocode/core";
41381
+ var PRESET_DESCRIPTIONS, setPresetCommand, presetsCommand, listCommand7, configCommand;
41382
+ var init_config3 = __esm({
41383
+ "packages/cleo/src/cli/commands/config.ts"() {
41384
+ "use strict";
41385
+ init_dist();
41386
+ init_cli();
41387
+ init_define_cli_command();
41388
+ init_renderers();
41389
+ init_config2();
41390
+ PRESET_DESCRIPTIONS = {
41391
+ strict: "Block on missing AC, require session notes, enforce lifecycle pipeline.",
41392
+ standard: "Warn on missing AC, optional session notes, advisory lifecycle pipeline.",
41393
+ minimal: "No AC checking, no session requirement, lifecycle pipeline off."
41394
+ };
40378
41395
  setPresetCommand = defineCommand({
40379
41396
  meta: {
40380
41397
  name: "set-preset",
@@ -40416,7 +41433,7 @@ var init_config2 = __esm({
40416
41433
  cliOutput({ config: resolved }, { command: "config" });
40417
41434
  } catch (err) {
40418
41435
  if (err instanceof CleoError2) {
40419
- cliError(formatError4(err), err.code, { name: "E_CONFIG_LOAD" });
41436
+ cliError(`config list failed: ${err.message}`, err.code, { name: "E_CONFIG_LOAD" });
40420
41437
  process.exit(err.code);
40421
41438
  }
40422
41439
  throw err;
@@ -40424,10 +41441,16 @@ var init_config2 = __esm({
40424
41441
  }
40425
41442
  });
40426
41443
  configCommand = defineCommand({
40427
- meta: { name: "config", description: "Configuration management" },
41444
+ meta: {
41445
+ name: "config",
41446
+ description: "CleoConfig SSoT registry surface (show, get, set, validate, drift-check) + legacy presets/list"
41447
+ },
40428
41448
  subCommands: {
40429
- get: getCommand2,
40430
- set: setCommand,
41449
+ show: configShowCommand,
41450
+ get: configGetCommand,
41451
+ set: configSetCommand,
41452
+ validate: configValidateCommand,
41453
+ "drift-check": configDriftCheckCommand,
40431
41454
  "set-preset": setPresetCommand,
40432
41455
  presets: presetsCommand,
40433
41456
  list: listCommand7
@@ -42697,7 +43720,7 @@ import { dirname as dirname7, join as join19, normalize, resolve as resolve4 } f
42697
43720
  import { fileURLToPath as fileURLToPath4 } from "node:url";
42698
43721
  import {
42699
43722
  createAttachmentStore as createAttachmentStore5,
42700
- getProjectRoot as getProjectRoot31,
43723
+ getProjectRoot as getProjectRoot36,
42701
43724
  searchAllProjectDocs
42702
43725
  } from "@cleocode/core/internal";
42703
43726
  function getViewerAssetsDir() {
@@ -42757,7 +43780,7 @@ async function serveStatic(res, assetsDir, relPath) {
42757
43780
  }
42758
43781
  }
42759
43782
  function buildViewerHandler(opts = {}) {
42760
- const projectRoot = opts.projectRoot ?? getProjectRoot31();
43783
+ const projectRoot = opts.projectRoot ?? getProjectRoot36();
42761
43784
  const assetsDir = getViewerAssetsDir();
42762
43785
  const store = createAttachmentStore5();
42763
43786
  return async (req, res) => {
@@ -42935,7 +43958,7 @@ import { spawn } from "node:child_process";
42935
43958
  import { open as fsOpen } from "node:fs/promises";
42936
43959
  import { join as join20 } from "node:path";
42937
43960
  import { fileURLToPath as fileURLToPath5 } from "node:url";
42938
- import { getCleoHome as getCleoHome3, getProjectRoot as getProjectRoot32 } from "@cleocode/core";
43961
+ import { getCleoHome as getCleoHome3, getProjectRoot as getProjectRoot37 } from "@cleocode/core";
42939
43962
  function getCleoBinPath() {
42940
43963
  const thisFile = fileURLToPath5(import.meta.url);
42941
43964
  return join20(thisFile, "..", "..", "index.js");
@@ -42986,7 +44009,7 @@ async function spawnDetachedServer(opts) {
42986
44009
  detached: true,
42987
44010
  stdio,
42988
44011
  env: { ...process.env, [DETACHED_CHILD_ENV]: "1" },
42989
- cwd: getProjectRoot32()
44012
+ cwd: getProjectRoot37()
42990
44013
  });
42991
44014
  child.unref();
42992
44015
  if (handle) await handle.close();
@@ -43138,7 +44161,7 @@ var init_docs_viewer = __esm({
43138
44161
  pid: process.pid,
43139
44162
  port: handle.port,
43140
44163
  host: handle.host,
43141
- projectRoot: getProjectRoot32(),
44164
+ projectRoot: getProjectRoot37(),
43142
44165
  startedAt: Date.now()
43143
44166
  };
43144
44167
  await writeViewerPidFile(record);
@@ -43426,7 +44449,7 @@ import {
43426
44449
  detectStrayCleoDb as detectStrayCleoDb2,
43427
44450
  exportDocument,
43428
44451
  getAgentOutputsAbsolute,
43429
- getProjectRoot as getProjectRoot33,
44452
+ getProjectRoot as getProjectRoot38,
43430
44453
  listDocVersions,
43431
44454
  makeClassifierForScanRoot,
43432
44455
  mergeDocs,
@@ -43584,6 +44607,10 @@ var init_docs3 = __esm({
43584
44607
  "allow-similar": {
43585
44608
  type: "boolean",
43586
44609
  description: "Bypass the T10361 slug-similarity check. Use when you really do mean to add a new doc with a near-duplicate slug (e.g. intentional fork). Every bypass is logged to .cleo/audit/similar-bypass.jsonl."
44610
+ },
44611
+ strict: {
44612
+ type: "boolean",
44613
+ description: "Enforce body-schema validation against the kind's requiredSections (T10160). When set, a missing H2 section fails the write with E_DOC_SCHEMA_MISMATCH. Default (advisory) surfaces missing sections as a W_DOC_SCHEMA_MISMATCH warning."
43587
44614
  }
43588
44615
  },
43589
44616
  async run({ args, rawArgs }) {
@@ -43635,7 +44662,7 @@ var init_docs3 = __esm({
43635
44662
  resolvedFile = resolveWorktreeFilePath(String(fileArg), routing);
43636
44663
  }
43637
44664
  if (args.slug && args.type) {
43638
- const projectRoot = await getProjectRoot33();
44665
+ const projectRoot = await getProjectRoot38();
43639
44666
  let warnThreshold = DEFAULT_SIMILARITY_THRESHOLD;
43640
44667
  let mode = DEFAULT_SIMILARITY_MODE;
43641
44668
  try {
@@ -43724,7 +44751,8 @@ var init_docs3 = __esm({
43724
44751
  ...args.labels ? { labels: args.labels } : {},
43725
44752
  ...args["attached-by"] ? { attachedBy: args["attached-by"] } : {},
43726
44753
  ...args.slug ? { slug: args.slug } : {},
43727
- ...args.type ? { type: args.type } : {}
44754
+ ...args.type ? { type: args.type } : {},
44755
+ ...args.strict === true ? { strict: true } : {}
43728
44756
  },
43729
44757
  { command: "docs add" }
43730
44758
  );
@@ -43935,7 +44963,7 @@ var init_docs3 = __esm({
43935
44963
  const taskId = String(args.task);
43936
44964
  const includeAttachments = args["include-attachments"] !== false;
43937
44965
  const includeMemoryRefs = args["include-memory-refs"] === true;
43938
- const projectRoot = getProjectRoot33();
44966
+ const projectRoot = getProjectRoot38();
43939
44967
  try {
43940
44968
  const result = await exportDocument({
43941
44969
  taskId,
@@ -44001,7 +45029,7 @@ var init_docs3 = __esm({
44001
45029
  }
44002
45030
  },
44003
45031
  async run({ args }) {
44004
- const projectRoot = getProjectRoot33();
45032
+ const projectRoot = getProjectRoot38();
44005
45033
  const limit = args.limit ? Number.parseInt(String(args.limit), 10) : 10;
44006
45034
  try {
44007
45035
  const result = args.owner ? await searchDocs2(String(args.query), {
@@ -44057,7 +45085,7 @@ var init_docs3 = __esm({
44057
45085
  }
44058
45086
  },
44059
45087
  async run({ args }) {
44060
- const projectRoot = getProjectRoot33();
45088
+ const projectRoot = getProjectRoot38();
44061
45089
  const rawStrategy = args.strategy ?? "three-way";
44062
45090
  const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
44063
45091
  try {
@@ -44106,7 +45134,7 @@ var init_docs3 = __esm({
44106
45134
  }
44107
45135
  },
44108
45136
  async run({ args }) {
44109
- const projectRoot = getProjectRoot33();
45137
+ const projectRoot = getProjectRoot38();
44110
45138
  const fmt = args.format ?? "mermaid";
44111
45139
  try {
44112
45140
  const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
@@ -44175,7 +45203,7 @@ var init_docs3 = __esm({
44175
45203
  }
44176
45204
  },
44177
45205
  async run({ args }) {
44178
- const projectRoot = getProjectRoot33();
45206
+ const projectRoot = getProjectRoot38();
44179
45207
  try {
44180
45208
  const result = await rankDocs({
44181
45209
  ownerId: String(args.for),
@@ -44213,7 +45241,7 @@ var init_docs3 = __esm({
44213
45241
  }
44214
45242
  },
44215
45243
  async run({ args }) {
44216
- const projectRoot = getProjectRoot33();
45244
+ const projectRoot = getProjectRoot38();
44217
45245
  try {
44218
45246
  const result = await listDocVersions({
44219
45247
  ownerId: String(args.for),
@@ -44256,7 +45284,7 @@ var init_docs3 = __esm({
44256
45284
  }
44257
45285
  },
44258
45286
  async run({ args }) {
44259
- const projectRoot = getProjectRoot33();
45287
+ const projectRoot = getProjectRoot38();
44260
45288
  try {
44261
45289
  const result = await publishDocs({
44262
45290
  ownerId: String(args.for),
@@ -44380,7 +45408,7 @@ var init_docs3 = __esm({
44380
45408
  },
44381
45409
  async run({ args }) {
44382
45410
  if (args.from) {
44383
- const projectRoot = getProjectRoot33();
45411
+ const projectRoot = getProjectRoot38();
44384
45412
  const ownerId = args.for ?? void 0;
44385
45413
  if (!ownerId) {
44386
45414
  cliError(
@@ -44447,7 +45475,7 @@ var init_docs3 = __esm({
44447
45475
  }
44448
45476
  },
44449
45477
  async run() {
44450
- const projectRoot = getProjectRoot33();
45478
+ const projectRoot = getProjectRoot38();
44451
45479
  try {
44452
45480
  const result = await statusDocs({ projectRoot });
44453
45481
  cliOutput(result, { command: "docs status", operation: "docs.status" });
@@ -44532,7 +45560,7 @@ var init_docs3 = __esm({
44532
45560
  }
44533
45561
  },
44534
45562
  async run({ args }) {
44535
- const projectRoot = getProjectRoot33();
45563
+ const projectRoot = getProjectRoot38();
44536
45564
  const dirArg = String(args.dir);
44537
45565
  const scanRoot = isAbsolute2(dirArg) ? dirArg : resolve5(projectRoot, dirArg);
44538
45566
  const dryRun = args["dry-run"] === true;
@@ -44606,7 +45634,7 @@ var init_docs3 = __esm({
44606
45634
  }
44607
45635
  },
44608
45636
  async run({ args }) {
44609
- const projectRoot = getProjectRoot33();
45637
+ const projectRoot = getProjectRoot38();
44610
45638
  const { registry, configError } = loadCliRegistry(projectRoot);
44611
45639
  const kinds = registry.list().map(toWireKind);
44612
45640
  const extensionsCount = kinds.filter((k) => k.isExtension).length;
@@ -44650,7 +45678,7 @@ var init_docs3 = __esm({
44650
45678
  }
44651
45679
  },
44652
45680
  async run({ args }) {
44653
- const projectRoot = getProjectRoot33();
45681
+ const projectRoot = getProjectRoot38();
44654
45682
  const { registry, configError } = loadCliRegistry(projectRoot);
44655
45683
  const kinds = registry.list().map(toWireKind);
44656
45684
  let counts2;
@@ -44733,7 +45761,7 @@ var doctor_db_substrate_exports = {};
44733
45761
  __export(doctor_db_substrate_exports, {
44734
45762
  doctorDbSubstrateCommand: () => doctorDbSubstrateCommand
44735
45763
  });
44736
- import { getProjectRoot as getProjectRoot34, pushWarning as pushWarning2 } from "@cleocode/core";
45764
+ import { getProjectRoot as getProjectRoot39, pushWarning as pushWarning3 } from "@cleocode/core";
44737
45765
  import { surveyDbSubstrate, surveyFleetDbSubstrate } from "@cleocode/core/doctor/db-substrate.js";
44738
45766
  function pushSubstrateWarnings(result) {
44739
45767
  for (const warning of result.warnings) {
@@ -44745,7 +45773,7 @@ function pushSubstrateWarnings(result) {
44745
45773
  if (warning.kind === "orphan-project-root") {
44746
45774
  context["parentWorkspace"] = warning.parentWorkspace ?? null;
44747
45775
  }
44748
- pushWarning2({
45776
+ pushWarning3({
44749
45777
  code: warning.kind === "orphan-project-root" ? "W_DB_SUBSTRATE_ORPHAN_PROJECT_ROOT" : "W_DB_SUBSTRATE_NESTED_NEXUS_DUPLICATE",
44750
45778
  message: warning.kind === "orphan-project-root" ? `Orphan project-root .cleo/ at ${warning.path} (T9550 regression class \u2014 review then remove)` + (warning.parentWorkspace ? ` \u2014 attributed to workspace: ${warning.parentWorkspace}` : "") : `Nested-nexus duplicate at ${warning.path} (structural duplicate of the canonical flat layout)`,
44751
45779
  severity: "warn",
@@ -44756,7 +45784,7 @@ function pushSubstrateWarnings(result) {
44756
45784
  for (const [role, entry] of Object.entries(projectSurvey.dbs)) {
44757
45785
  if (entry.pragmaDrift === null || entry.pragmaDrift.length === 0) continue;
44758
45786
  for (const drift of entry.pragmaDrift) {
44759
- pushWarning2({
45787
+ pushWarning3({
44760
45788
  code: "W_DB_SUBSTRATE_PRAGMA_DRIFT",
44761
45789
  message: `Pragma drift on ${role} (${entry.filePath}): expected ${drift.pragma}=${drift.expected}, actual=${drift.actual ?? "<unmeasurable>"}`,
44762
45790
  severity: "warn",
@@ -44773,7 +45801,7 @@ function pushSubstrateWarnings(result) {
44773
45801
  }
44774
45802
  for (const report of result.crossDbOrphans) {
44775
45803
  if (report.skipped || report.orphanCount === 0) continue;
44776
- pushWarning2({
45804
+ pushWarning3({
44777
45805
  code: `W_DB_SUBSTRATE_CROSS_DB_${report.invariant}`,
44778
45806
  message: `${report.invariant}: ${report.orphanCount} orphan row${report.orphanCount === 1 ? "" : "s"} \u2014 ${report.description}. ${report.suggestedFix}`,
44779
45807
  severity: "warn",
@@ -44790,7 +45818,7 @@ function pushPerDbWarnings(result) {
44790
45818
  for (const projectSurvey of result.projects) {
44791
45819
  for (const [role, dbEntry] of Object.entries(projectSurvey.dbs)) {
44792
45820
  if (dbEntry.quarantinedTo !== null) {
44793
- pushWarning2({
45821
+ pushWarning3({
44794
45822
  code: "W_DB_SUBSTRATE_AUTO_QUARANTINED",
44795
45823
  message: `Auto-quarantined corrupt ${role} DB at ${dbEntry.filePath} \u2192 ${dbEntry.quarantinedTo}. Recover via: cleo backup recover ${role}`,
44796
45824
  severity: "warn",
@@ -44803,7 +45831,7 @@ function pushPerDbWarnings(result) {
44803
45831
  });
44804
45832
  }
44805
45833
  if (dbEntry.timedOut) {
44806
- pushWarning2({
45834
+ pushWarning3({
44807
45835
  code: "W_DB_SUBSTRATE_INTEGRITY_TIMEOUT",
44808
45836
  message: `integrity_check on ${role} DB at ${dbEntry.filePath} took ${dbEntry.integrityCheckMs}ms \u2014 slow substrate flagged for operator attention`,
44809
45837
  severity: "warn",
@@ -44866,7 +45894,7 @@ var init_doctor_db_substrate = __esm({
44866
45894
  const result = isFleet ? surveyFleetDbSubstrate(
44867
45895
  typeof args["fleet-root"] === "string" && args["fleet-root"].length > 0 ? args["fleet-root"] : DEFAULT_FLEET_ROOT,
44868
45896
  options
44869
- ) : surveyDbSubstrate(getProjectRoot34(), options);
45897
+ ) : surveyDbSubstrate(getProjectRoot39(), options);
44870
45898
  pushSubstrateWarnings(result);
44871
45899
  pushPerDbWarnings(result);
44872
45900
  cliOutput(result, {
@@ -44886,7 +45914,7 @@ var doctor_legacy_backups_exports = {};
44886
45914
  __export(doctor_legacy_backups_exports, {
44887
45915
  doctorLegacyBackupsCommand: () => doctorLegacyBackupsCommand
44888
45916
  });
44889
- import { getProjectRoot as getProjectRoot35 } from "@cleocode/core";
45917
+ import { getProjectRoot as getProjectRoot40 } from "@cleocode/core";
44890
45918
  import { pruneLegacyBackups, scanLegacyBackups } from "@cleocode/core/doctor/legacy-backups.js";
44891
45919
  function parsePositiveInt(raw, fallback) {
44892
45920
  if (raw === void 0 || raw === null) return fallback;
@@ -44930,7 +45958,7 @@ var init_doctor_legacy_backups = __esm({
44930
45958
  async run({ args }) {
44931
45959
  const softRetentionDays = parsePositiveInt(args["soft-retention-days"], 30);
44932
45960
  const hardRetentionDays = parsePositiveInt(args["hard-retention-days"], 90);
44933
- const projectRoot = getProjectRoot35();
45961
+ const projectRoot = getProjectRoot40();
44934
45962
  let result;
44935
45963
  if (args.prune === true) {
44936
45964
  const dryRun = args["dry-run"] !== false;
@@ -45233,7 +46261,7 @@ __export(migrate_agents_v2_exports, {
45233
46261
  import { createHash as createHash2 } from "node:crypto";
45234
46262
  import { appendFileSync as appendFileSync2, existsSync as existsSync14, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync14 } from "node:fs";
45235
46263
  import { join as join22 } from "node:path";
45236
- import { getProjectRoot as getProjectRoot36, installAgentFromCant } from "@cleocode/core/internal";
46264
+ import { getProjectRoot as getProjectRoot41, installAgentFromCant } from "@cleocode/core/internal";
45237
46265
  import { openCleoDb as openCleoDb2 } from "@cleocode/core/store/open-cleo-db";
45238
46266
  function sha256Hex(bytes) {
45239
46267
  return createHash2("sha256").update(bytes).digest("hex");
@@ -45420,7 +46448,7 @@ var init_migrate_agents_v2 = __esm({
45420
46448
  }
45421
46449
  },
45422
46450
  async run({ args }) {
45423
- const projectRoot = getProjectRoot36();
46451
+ const projectRoot = getProjectRoot41();
45424
46452
  const verbose = args.quiet !== true;
45425
46453
  if (verbose) {
45426
46454
  humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
@@ -45464,7 +46492,8 @@ __export(doctor_exports, {
45464
46492
  });
45465
46493
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
45466
46494
  import { join as join23 } from "node:path";
45467
- import { getProjectRoot as getProjectRoot37, pushWarning as pushWarning3 } from "@cleocode/core";
46495
+ import { getProjectRoot as getProjectRoot42, pushWarning as pushWarning4 } from "@cleocode/core";
46496
+ import { renderInvariantAuditLines } from "@cleocode/core/doctor/invariant-audit-render.js";
45468
46497
  import {
45469
46498
  quarantineRogueCleoDir,
45470
46499
  scanRogueCleoDirs
@@ -45565,6 +46594,11 @@ Provider Hook Matrix (CAAMP ${caampVersion} canonical taxonomy)
45565
46594
  humanLine(`Coverage: ${coverageParts.join(", ")}
45566
46595
  `);
45567
46596
  }
46597
+ function renderInvariantAuditHuman(result) {
46598
+ for (const line of renderInvariantAuditLines(result)) {
46599
+ humanLine(line);
46600
+ }
46601
+ }
45568
46602
  var FIXTURE_ID_PATTERNS, FIXTURE_TITLE_KEYWORDS, doctorCommand2;
45569
46603
  var init_doctor = __esm({
45570
46604
  "packages/cleo/src/cli/commands/doctor.ts"() {
@@ -45686,13 +46720,36 @@ var init_doctor = __esm({
45686
46720
  * auto-close drift. Read-only; non-zero exit when any I-invariant
45687
46721
  * fails so the check is CI-gateable.
45688
46722
  *
46723
+ * As of T10340 (R6), `--audit-sagas` is a focused alias on top of
46724
+ * `--audit-invariants` — it filters the registry walk to ADR-073
46725
+ * only. The implementation re-uses the central walker so the two
46726
+ * surfaces stay in lock-step.
46727
+ *
45689
46728
  * @task T10119
46729
+ * @task T10340
45690
46730
  * @saga T10113
45691
46731
  * @epic T10209
45692
46732
  */
45693
46733
  "audit-sagas": {
45694
46734
  type: "boolean",
45695
- description: "Audit every Saga for ADR-073 \xA71.2 invariant violations (I5/I7/depth) + auto-close drift (T10119)"
46735
+ description: "Audit every Saga for ADR-073 \xA71.2 invariant violations (I5/I7/depth) + auto-close drift \u2014 focused alias on top of --audit-invariants (T10119, T10340)"
46736
+ },
46737
+ /**
46738
+ * T10340: walk the central `INVARIANTS_REGISTRY` and audit every
46739
+ * registered invariant against the project's current state.
46740
+ *
46741
+ * Output groups violations by ADR + severity and includes an
46742
+ * actionable repair command per violation. Supports `--json` for
46743
+ * machine consumption. Exit code is non-zero when any
46744
+ * `severity:'error'` violation is observed.
46745
+ *
46746
+ * @task T10340 — R6
46747
+ * @epic T10327 — E-INVARIANT-REGISTRY-SSOT
46748
+ * @saga T10326 — SG-SUBSTRATE-RECONCILIATION
46749
+ */
46750
+ "audit-invariants": {
46751
+ type: "boolean",
46752
+ description: "Walk the central INVARIANTS_REGISTRY and audit every registered invariant \u2014 groups by ADR + severity with repair commands (T10340 / Saga T10326 R6)"
45696
46753
  },
45697
46754
  /**
45698
46755
  * T9983: migrate the worktree-include file location from
@@ -45759,7 +46816,7 @@ var init_doctor = __esm({
45759
46816
  try {
45760
46817
  if (args.brain) {
45761
46818
  const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
45762
- const projectRoot = getProjectRoot37();
46819
+ const projectRoot = getProjectRoot42();
45763
46820
  const dashboard = await computeBrainHealthDashboard(projectRoot);
45764
46821
  cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
45765
46822
  if (dashboard.hasP0Failure) {
@@ -45768,7 +46825,7 @@ var init_doctor = __esm({
45768
46825
  return;
45769
46826
  }
45770
46827
  if (args["scan-test-fixtures-in-prod"]) {
45771
- const projectRoot = getProjectRoot37();
46828
+ const projectRoot = getProjectRoot42();
45772
46829
  const matches = await scanTestFixturesInProd(projectRoot);
45773
46830
  const dryRun = args["dry-run"] !== false && args.quarantine !== true;
45774
46831
  const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
@@ -45856,7 +46913,7 @@ var init_doctor = __esm({
45856
46913
  progress.complete("Comprehensive diagnostics complete");
45857
46914
  } else if (args["scan-rogue-cleo-dirs"]) {
45858
46915
  progress.step(0, "Scanning for rogue .cleo/ directories");
45859
- const projectRoot = getProjectRoot37();
46916
+ const projectRoot = getProjectRoot42();
45860
46917
  const reports = scanRogueCleoDirs(projectRoot);
45861
46918
  progress.complete(
45862
46919
  `Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
@@ -45865,7 +46922,7 @@ var init_doctor = __esm({
45865
46922
  } else if (args["quarantine-rogue-cleo-dirs"]) {
45866
46923
  const isDryRun = args["dry-run"] === true;
45867
46924
  progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
45868
- const projectRoot = getProjectRoot37();
46925
+ const projectRoot = getProjectRoot42();
45869
46926
  const reports = scanRogueCleoDirs(projectRoot);
45870
46927
  if (reports.length === 0) {
45871
46928
  progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
@@ -45919,7 +46976,7 @@ var init_doctor = __esm({
45919
46976
  const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
45920
46977
  const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
45921
46978
  const cleoHome = getCleoHome6();
45922
- const projectRoot = getProjectRoot37();
46979
+ const projectRoot = getProjectRoot42();
45923
46980
  const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
45924
46981
  const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
45925
46982
  const isDryRun = args["dry-run"] === true;
@@ -45952,7 +47009,7 @@ var init_doctor = __esm({
45952
47009
  } else if (args["audit-worktree-orphans"]) {
45953
47010
  progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
45954
47011
  const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
45955
- const projectRoot = getProjectRoot37();
47012
+ const projectRoot = getProjectRoot42();
45956
47013
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
45957
47014
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
45958
47015
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -45966,7 +47023,7 @@ var init_doctor = __esm({
45966
47023
  const legacyOrphans = legacyScanResult.orphans;
45967
47024
  const totalAnomalies = comprehensive.count;
45968
47025
  if (legacyScanResult.softWarnMessage) {
45969
- pushWarning3({
47026
+ pushWarning4({
45970
47027
  code: "W_DOCTOR_SCAN_SOFT_WARN",
45971
47028
  message: legacyScanResult.softWarnMessage,
45972
47029
  severity: "warn"
@@ -45974,7 +47031,7 @@ var init_doctor = __esm({
45974
47031
  }
45975
47032
  if (legacyScanResult.isPartial) {
45976
47033
  const reason = legacyScanResult.partialReason === "timeout" ? `timed out after ${timeoutSecs}s (use --timeout <seconds> to adjust)` : `per-level entry cap of ${maxEntriesPerLevel} exceeded (use --max-entries-per-level <n> to adjust)`;
45977
- pushWarning3({
47034
+ pushWarning4({
45978
47035
  code: "W_DOCTOR_SCAN_PARTIAL",
45979
47036
  message: `legacy orphan scan is PARTIAL \u2014 ${reason}. Results may be incomplete.`,
45980
47037
  severity: "warn",
@@ -46009,7 +47066,7 @@ var init_doctor = __esm({
46009
47066
  `${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
46010
47067
  );
46011
47068
  const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
46012
- const projectRoot = getProjectRoot37();
47069
+ const projectRoot = getProjectRoot42();
46013
47070
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
46014
47071
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
46015
47072
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -46018,7 +47075,7 @@ var init_doctor = __esm({
46018
47075
  maxEntriesPerLevel: Number.isFinite(maxEntriesPerLevel) ? maxEntriesPerLevel : 500
46019
47076
  });
46020
47077
  if (scanResult.softWarnMessage) {
46021
- pushWarning3({
47078
+ pushWarning4({
46022
47079
  code: "W_DOCTOR_SCAN_SOFT_WARN",
46023
47080
  message: scanResult.softWarnMessage,
46024
47081
  severity: "warn"
@@ -46026,7 +47083,7 @@ var init_doctor = __esm({
46026
47083
  }
46027
47084
  if (scanResult.isPartial) {
46028
47085
  const reason = scanResult.partialReason === "timeout" ? `timed out after ${timeoutSecs}s (use --timeout <seconds> to adjust)` : `per-level entry cap of ${maxEntriesPerLevel} exceeded (use --max-entries-per-level <n> to adjust)`;
46029
- pushWarning3({
47086
+ pushWarning4({
46030
47087
  code: "W_DOCTOR_SCAN_PARTIAL",
46031
47088
  message: `orphan scan is PARTIAL \u2014 ${reason}. Only orphans found before abort will be pruned.`,
46032
47089
  severity: "warn",
@@ -46088,7 +47145,7 @@ var init_doctor = __esm({
46088
47145
  `${isDryRun ? "[DRY RUN] " : ""}Migrating .cleo/worktree-include \u2192 .worktreeinclude`
46089
47146
  );
46090
47147
  const { migrateWorktreeIncludeFile } = await import("@cleocode/core");
46091
- const projectRoot = getProjectRoot37();
47148
+ const projectRoot = getProjectRoot42();
46092
47149
  const result = await migrateWorktreeIncludeFile(projectRoot, { dryRun: isDryRun });
46093
47150
  progress.complete(`Migration ${result.action}`);
46094
47151
  cliOutput(result, { command: "doctor", operation: "doctor.migrate-worktree-include" });
@@ -46101,15 +47158,22 @@ var init_doctor = __esm({
46101
47158
  if (checkResult.details?.["orphans"] && checkResult.details["orphans"].length > 0 && (process.exitCode === void 0 || process.exitCode === 0)) {
46102
47159
  process.exitCode = 2;
46103
47160
  }
46104
- } else if (args["audit-sagas"]) {
46105
- progress.step(0, "Auditing Saga hierarchy for ADR-073 invariants");
46106
- const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
46107
- const projectRoot = getProjectRoot37();
46108
- const result = await auditSagaHierarchy(projectRoot);
46109
- const summary = `Saga audit complete \u2014 ${result.sagas.length} saga(s) inspected, ${result.count} invariant violation(s), ${result.driftCount} drift warning(s)`;
47161
+ } else if (args["audit-invariants"] || args["audit-sagas"]) {
47162
+ const isFocusedAlias = args["audit-sagas"] === true && args["audit-invariants"] !== true;
47163
+ const adrFilter = isFocusedAlias ? "ADR-073" : void 0;
47164
+ const stepLabel = isFocusedAlias ? "Auditing Saga hierarchy for ADR-073 invariants" : "Walking central INVARIANTS_REGISTRY";
47165
+ progress.step(0, stepLabel);
47166
+ const { auditInvariantRegistry } = await import("@cleocode/core/doctor/invariant-audit.js");
47167
+ const projectRoot = getProjectRoot42();
47168
+ const result = await auditInvariantRegistry(projectRoot, { adrFilter });
47169
+ const operation = isFocusedAlias ? "doctor.audit-sagas" : "doctor.audit-invariants";
47170
+ const summary = `Invariant audit complete \u2014 ${result.totalCount} entries walked, ${result.errorCount} error / ${result.warningCount} warning / ${result.infoCount} info violation(s), ${result.notApplicableCount} not-applicable, ${result.documentedCount} documented`;
46110
47171
  progress.complete(summary);
46111
- cliOutput(result, { command: "doctor", operation: "doctor.audit-sagas" });
46112
- if (result.count > 0 && (process.exitCode === void 0 || process.exitCode === 0)) {
47172
+ if (isHuman && args.json !== true) {
47173
+ renderInvariantAuditHuman(result);
47174
+ }
47175
+ cliOutput(result, { command: "doctor", operation });
47176
+ if (result.errorCount > 0 && (process.exitCode === void 0 || process.exitCode === 0)) {
46113
47177
  process.exitCode = 2;
46114
47178
  }
46115
47179
  } else {
@@ -46122,7 +47186,7 @@ var init_doctor = __esm({
46122
47186
  { command: "doctor", operation: "admin.health" }
46123
47187
  );
46124
47188
  try {
46125
- const projectRoot = getProjectRoot37();
47189
+ const projectRoot = getProjectRoot42();
46126
47190
  const conflicts = readMigrationConflicts(projectRoot);
46127
47191
  if (conflicts.length > 0) {
46128
47192
  progress.complete(
@@ -46153,7 +47217,7 @@ var init_doctor = __esm({
46153
47217
  progress.complete("Health check complete");
46154
47218
  }
46155
47219
  try {
46156
- const projectRoot = getProjectRoot37();
47220
+ const projectRoot = getProjectRoot42();
46157
47221
  const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
46158
47222
  const sagaAudit = await auditSagaHierarchy(projectRoot);
46159
47223
  if (sagaAudit.sagas.length === 0) {
@@ -48365,7 +49429,7 @@ import { join as join26 } from "node:path";
48365
49429
  import { fileURLToPath as fileURLToPath6 } from "node:url";
48366
49430
  import {
48367
49431
  CleoError as CleoError4,
48368
- formatError as formatError5,
49432
+ formatError as formatError4,
48369
49433
  getWorkflowTemplatesDir as getCoreWorkflowTemplatesDir,
48370
49434
  initProject as initProject2,
48371
49435
  scaffoldWorkflows
@@ -48485,7 +49549,7 @@ var init_init = __esm({
48485
49549
  );
48486
49550
  } catch (err) {
48487
49551
  if (err instanceof CleoError4) {
48488
- cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
49552
+ cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
48489
49553
  process.exit(err.code);
48490
49554
  }
48491
49555
  throw err;
@@ -49300,7 +50364,7 @@ var llm_cost_exports = {};
49300
50364
  __export(llm_cost_exports, {
49301
50365
  costCommand: () => costCommand
49302
50366
  });
49303
- import { getProjectRoot as getProjectRoot38 } from "@cleocode/core/internal";
50367
+ import { getProjectRoot as getProjectRoot43 } from "@cleocode/core/internal";
49304
50368
  import { computeCost } from "@cleocode/core/llm/usage-pricing";
49305
50369
  function resolveSessionId(raw) {
49306
50370
  if (raw === "current") {
@@ -49373,7 +50437,7 @@ var init_llm_cost = __esm({
49373
50437
  process.exit(6);
49374
50438
  }
49375
50439
  const sessionId = resolveSessionId(rawSessionId);
49376
- const projectRoot = getProjectRoot38(process.cwd());
50440
+ const projectRoot = getProjectRoot43(process.cwd());
49377
50441
  let breakdown;
49378
50442
  try {
49379
50443
  breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
@@ -50014,7 +51078,7 @@ var llm_exports = {};
50014
51078
  __export(llm_exports, {
50015
51079
  llmCommand: () => llmCommand
50016
51080
  });
50017
- import { pushWarning as pushWarning4 } from "@cleocode/core";
51081
+ import { pushWarning as pushWarning5 } from "@cleocode/core";
50018
51082
  async function getListProviders() {
50019
51083
  const { listProviders } = await import(
50020
51084
  /* webpackIgnore: true */
@@ -50145,7 +51209,7 @@ var init_llm3 = __esm({
50145
51209
  apiKey = envValue;
50146
51210
  source = "env";
50147
51211
  } else if (typeof a["api-key"] === "string" && a["api-key"]) {
50148
- pushWarning4({
51212
+ pushWarning5({
50149
51213
  code: "W_DEPRECATED_FLAG",
50150
51214
  message: API_KEY_FLAG_DEPRECATION,
50151
51215
  deprecated: "--api-key=<value>",
@@ -50575,7 +51639,7 @@ async function readStdin() {
50575
51639
  });
50576
51640
  }
50577
51641
  var showCommand7, listCommand13, findCommand4, statsCommand3, appendCommand, archiveCommand2, manifestCommand;
50578
- var init_manifest = __esm({
51642
+ var init_manifest3 = __esm({
50579
51643
  "packages/cleo/src/cli/commands/manifest.ts"() {
50580
51644
  "use strict";
50581
51645
  init_dist();
@@ -50920,7 +51984,7 @@ var memory_exports = {};
50920
51984
  __export(memory_exports, {
50921
51985
  memoryCommand: () => memoryCommand
50922
51986
  });
50923
- import { getProjectRoot as getProjectRoot39 } from "@cleocode/core";
51987
+ import { getProjectRoot as getProjectRoot44 } from "@cleocode/core";
50924
51988
  import {
50925
51989
  getBrainDb as getBrainDb2,
50926
51990
  getDreamStatus,
@@ -51844,7 +52908,7 @@ var init_memory3 = __esm({
51844
52908
  },
51845
52909
  args: {},
51846
52910
  async run() {
51847
- const root = getProjectRoot39();
52911
+ const root = getProjectRoot44();
51848
52912
  try {
51849
52913
  const result = await runConsolidation(root);
51850
52914
  cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
@@ -51868,7 +52932,7 @@ var init_memory3 = __esm({
51868
52932
  }
51869
52933
  },
51870
52934
  async run({ args }) {
51871
- const root = getProjectRoot39();
52935
+ const root = getProjectRoot44();
51872
52936
  if (args.status) {
51873
52937
  try {
51874
52938
  const status = await getDreamStatus(root);
@@ -51905,7 +52969,7 @@ var init_memory3 = __esm({
51905
52969
  }
51906
52970
  },
51907
52971
  async run({ args }) {
51908
- const root = getProjectRoot39();
52972
+ const root = getProjectRoot44();
51909
52973
  try {
51910
52974
  const { runObserver, runReflector } = await import("@cleocode/core/memory");
51911
52975
  const observerResult = await runObserver(root, args.session, {
@@ -51945,7 +53009,7 @@ var init_memory3 = __esm({
51945
53009
  }
51946
53010
  },
51947
53011
  async run({ args }) {
51948
- const root = getProjectRoot39();
53012
+ const root = getProjectRoot44();
51949
53013
  try {
51950
53014
  await getBrainDb2(root);
51951
53015
  const { totalDuplicateRows, groups } = await scanDuplicateEntries();
@@ -51991,7 +53055,7 @@ var init_memory3 = __esm({
51991
53055
  async run({ args }) {
51992
53056
  const sourceDir = args.from;
51993
53057
  const isDryRun = !!args["dry-run"];
51994
- const projectRoot = getProjectRoot39();
53058
+ const projectRoot = getProjectRoot44();
51995
53059
  try {
51996
53060
  const result = await importMemoryFiles({
51997
53061
  sourceDir,
@@ -52142,7 +53206,7 @@ var init_memory3 = __esm({
52142
53206
  },
52143
53207
  args: {},
52144
53208
  async run() {
52145
- const root = getProjectRoot39();
53209
+ const root = getProjectRoot44();
52146
53210
  try {
52147
53211
  await getBrainDb2(root);
52148
53212
  const result = await getTierStats(root);
@@ -52185,7 +53249,7 @@ var init_memory3 = __esm({
52185
53249
  }
52186
53250
  },
52187
53251
  async run({ args }) {
52188
- const root = getProjectRoot39();
53252
+ const root = getProjectRoot44();
52189
53253
  const targetTier = args.to;
52190
53254
  const reason = args.reason;
52191
53255
  const validTiers = ["medium", "long"];
@@ -52251,7 +53315,7 @@ var init_memory3 = __esm({
52251
53315
  }
52252
53316
  },
52253
53317
  async run({ args }) {
52254
- const root = getProjectRoot39();
53318
+ const root = getProjectRoot44();
52255
53319
  const targetTier = args.to;
52256
53320
  const reason = args.reason;
52257
53321
  const validTiers = ["short", "medium"];
@@ -52711,7 +53775,7 @@ var migrate_claude_mem_exports = {};
52711
53775
  __export(migrate_claude_mem_exports, {
52712
53776
  migrateClaudeMemCommand: () => migrateClaudeMemCommand
52713
53777
  });
52714
- import { getProjectRoot as getProjectRoot40, migrateClaudeMem } from "@cleocode/core/internal";
53778
+ import { getProjectRoot as getProjectRoot45, migrateClaudeMem } from "@cleocode/core/internal";
52715
53779
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
52716
53780
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
52717
53781
  var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
@@ -52774,7 +53838,7 @@ var init_migrate_claude_mem = __esm({
52774
53838
  }
52775
53839
  },
52776
53840
  async run({ args }) {
52777
- const root = getProjectRoot40();
53841
+ const root = getProjectRoot45();
52778
53842
  try {
52779
53843
  const result = await migrateClaudeMem(root, {
52780
53844
  sourcePath: args.source,
@@ -52823,7 +53887,7 @@ var init_migrate_claude_mem = __esm({
52823
53887
  }
52824
53888
  },
52825
53889
  async run({ args }) {
52826
- const projectRoot = getProjectRoot40();
53890
+ const projectRoot = getProjectRoot45();
52827
53891
  try {
52828
53892
  const db = await getDb2(projectRoot);
52829
53893
  const rcasdFlag = Boolean(args.rcasd);
@@ -52927,7 +53991,7 @@ __export(nexus_exports, {
52927
53991
  import { appendFile as appendFile2, mkdir as mkdir3 } from "node:fs/promises";
52928
53992
  import { homedir as homedir5 } from "node:os";
52929
53993
  import path4 from "node:path";
52930
- import { getProjectRoot as getProjectRoot41 } from "@cleocode/core";
53994
+ import { getProjectRoot as getProjectRoot46 } from "@cleocode/core";
52931
53995
  import { getSymbolImpact } from "@cleocode/core/nexus";
52932
53996
  import { runNexusAnalysis } from "@cleocode/core/nexus/analyze-orchestrator.js";
52933
53997
  import { exportNexusGraph } from "@cleocode/core/nexus/export.js";
@@ -53042,7 +54106,7 @@ var init_nexus3 = __esm({
53042
54106
  async run({ args }) {
53043
54107
  applyJsonFlag2(args.json);
53044
54108
  const projectIdOverride = args["project-id"];
53045
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
54109
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
53046
54110
  const startTime = Date.now();
53047
54111
  try {
53048
54112
  const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
@@ -53557,7 +54621,7 @@ var init_nexus3 = __esm({
53557
54621
  applyJsonFlag2(args.json);
53558
54622
  const startTime = Date.now();
53559
54623
  const projectIdOverride = args["project-id"];
53560
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
54624
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
53561
54625
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53562
54626
  const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
53563
54627
  const durationMs = Date.now() - startTime;
@@ -53601,7 +54665,7 @@ var init_nexus3 = __esm({
53601
54665
  applyJsonFlag2(args.json);
53602
54666
  const startTime = Date.now();
53603
54667
  const projectIdOverride = args["project-id"];
53604
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
54668
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
53605
54669
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53606
54670
  const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
53607
54671
  const durationMs = Date.now() - startTime;
@@ -53644,7 +54708,7 @@ var init_nexus3 = __esm({
53644
54708
  void appendDeprecationTelemetry("nexus.context", "cleo graph context");
53645
54709
  const startTime = Date.now();
53646
54710
  const projectIdOverride = args["project-id"];
53647
- const repoPath = getProjectRoot41();
54711
+ const repoPath = getProjectRoot46();
53648
54712
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53649
54713
  const limit = parseInt(args.limit, 10);
53650
54714
  const symbolName = args.symbol;
@@ -53707,7 +54771,7 @@ var init_nexus3 = __esm({
53707
54771
  const startTime = Date.now();
53708
54772
  const whyFlag = !!args.why;
53709
54773
  const projectIdOverride = args["project-id"];
53710
- const repoPath = getProjectRoot41();
54774
+ const repoPath = getProjectRoot46();
53711
54775
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53712
54776
  const maxDepth = Math.min(parseInt(args.depth, 10), 5);
53713
54777
  const symbolName = args.symbol;
@@ -53779,7 +54843,7 @@ var init_nexus3 = __esm({
53779
54843
  const projectIdOverride = args["project-id"];
53780
54844
  const isIncremental = !!args.incremental;
53781
54845
  const ctx = getFormatContext();
53782
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
54846
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
53783
54847
  humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
53784
54848
  if (!isIncremental) humanInfo("[nexus] Clearing existing index for project...");
53785
54849
  try {
@@ -53882,7 +54946,7 @@ var init_nexus3 = __esm({
53882
54946
  async run({ args }) {
53883
54947
  applyJsonFlag2(args.json);
53884
54948
  const startTime = Date.now();
53885
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
54949
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
53886
54950
  const name = args.name;
53887
54951
  const response = await dispatchRaw("mutate", "nexus", "projects.register", {
53888
54952
  path: repoPath,
@@ -54240,7 +55304,7 @@ var init_nexus3 = __esm({
54240
55304
  applyJsonFlag2(args.json);
54241
55305
  const startTime = Date.now();
54242
55306
  const projectIdOverride = args["project-id"];
54243
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
55307
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
54244
55308
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54245
55309
  const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
54246
55310
  repoPath,
@@ -54346,7 +55410,7 @@ var init_nexus3 = __esm({
54346
55410
  async run({ args }) {
54347
55411
  applyJsonFlag2(args.json);
54348
55412
  const startTime = Date.now();
54349
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
55413
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
54350
55414
  const projectIdOverride = args["project-id"];
54351
55415
  const beforeRef = args.before ?? "HEAD~1";
54352
55416
  const afterRef = args.after ?? "HEAD";
@@ -54464,7 +55528,7 @@ var init_nexus3 = __esm({
54464
55528
  applyJsonFlag2(args.json);
54465
55529
  const startTime = Date.now();
54466
55530
  const projectIdOverride = args["project-id"];
54467
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
55531
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
54468
55532
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54469
55533
  const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
54470
55534
  const durationMs = Date.now() - startTime;
@@ -54520,7 +55584,7 @@ var init_nexus3 = __esm({
54520
55584
  const startTime = Date.now();
54521
55585
  const routeSymbol = args.routeSymbol;
54522
55586
  const projectIdOverride = args["project-id"];
54523
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
55587
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
54524
55588
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54525
55589
  const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
54526
55590
  const durationMs = Date.now() - startTime;
@@ -54910,7 +55974,7 @@ var init_nexus3 = __esm({
54910
55974
  async run({ args }) {
54911
55975
  applyJsonFlag2(args.json);
54912
55976
  const startTime = Date.now();
54913
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
55977
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
54914
55978
  const projectIdOverride = args["project-id"];
54915
55979
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54916
55980
  const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
@@ -55014,7 +56078,7 @@ var init_nexus3 = __esm({
55014
56078
  async run({ args }) {
55015
56079
  applyJsonFlag2(args.json);
55016
56080
  const startTime = Date.now();
55017
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot41();
56081
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot46();
55018
56082
  const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
55019
56083
  const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
55020
56084
  projectId,
@@ -55095,7 +56159,7 @@ var init_nexus3 = __esm({
55095
56159
  const isIncremental = !!args.incremental;
55096
56160
  try {
55097
56161
  const result = await runNexusWiki({
55098
- projectRoot: getProjectRoot41(),
56162
+ projectRoot: getProjectRoot46(),
55099
56163
  outputDir,
55100
56164
  communityFilter,
55101
56165
  incremental: isIncremental
@@ -56346,7 +57410,7 @@ __export(otel_exports, {
56346
57410
  import {
56347
57411
  CleoError as CleoError5,
56348
57412
  clearOtelData,
56349
- formatError as formatError6,
57413
+ formatError as formatError5,
56350
57414
  getOtelSessions,
56351
57415
  getOtelSpawns,
56352
57416
  getOtelStatus,
@@ -56367,7 +57431,7 @@ var init_otel = __esm({
56367
57431
  cliOutput(result, { command: "otel" });
56368
57432
  } catch (err) {
56369
57433
  if (err instanceof CleoError5) {
56370
- cliError(formatError6(err), err.code, { name: "E_INTERNAL" });
57434
+ cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
56371
57435
  process.exit(err.code);
56372
57436
  }
56373
57437
  throw err;
@@ -56382,7 +57446,7 @@ var init_otel = __esm({
56382
57446
  cliOutput(result, { command: "otel" });
56383
57447
  } catch (err) {
56384
57448
  if (err instanceof CleoError5) {
56385
- cliError(formatError6(err), err.code, { name: "E_INTERNAL" });
57449
+ cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
56386
57450
  process.exit(err.code);
56387
57451
  }
56388
57452
  throw err;
@@ -56410,7 +57474,7 @@ var init_otel = __esm({
56410
57474
  cliOutput(result, { command: "otel" });
56411
57475
  } catch (err) {
56412
57476
  if (err instanceof CleoError5) {
56413
- cliError(formatError6(err), err.code, { name: "E_INTERNAL" });
57477
+ cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
56414
57478
  process.exit(err.code);
56415
57479
  }
56416
57480
  throw err;
@@ -56438,7 +57502,7 @@ var init_otel = __esm({
56438
57502
  cliOutput(result, { command: "otel" });
56439
57503
  } catch (err) {
56440
57504
  if (err instanceof CleoError5) {
56441
- cliError(formatError6(err), err.code, { name: "E_INTERNAL" });
57505
+ cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
56442
57506
  process.exit(err.code);
56443
57507
  }
56444
57508
  throw err;
@@ -56466,7 +57530,7 @@ var init_otel = __esm({
56466
57530
  cliOutput(result, { command: "otel" });
56467
57531
  } catch (err) {
56468
57532
  if (err instanceof CleoError5) {
56469
- cliError(formatError6(err), err.code, { name: "E_INTERNAL" });
57533
+ cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
56470
57534
  process.exit(err.code);
56471
57535
  }
56472
57536
  throw err;
@@ -56481,7 +57545,7 @@ var init_otel = __esm({
56481
57545
  cliOutput(result, { command: "otel" });
56482
57546
  } catch (err) {
56483
57547
  if (err instanceof CleoError5) {
56484
- cliError(formatError6(err), err.code, { name: "E_INTERNAL" });
57548
+ cliError(formatError5(err), err.code, { name: "E_INTERNAL" });
56485
57549
  process.exit(err.code);
56486
57550
  }
56487
57551
  throw err;
@@ -56515,7 +57579,7 @@ var phase_exports = {};
56515
57579
  __export(phase_exports, {
56516
57580
  phaseCommand: () => phaseCommand
56517
57581
  });
56518
- var showCommand9, listCommand15, setCommand2, startCommand6, completeCommand3, advanceCommand2, renameCommand, deleteCommand2, phaseCommand;
57582
+ var showCommand9, listCommand15, setCommand, startCommand6, completeCommand3, advanceCommand2, renameCommand, deleteCommand2, phaseCommand;
56519
57583
  var init_phase = __esm({
56520
57584
  "packages/cleo/src/cli/commands/phase.ts"() {
56521
57585
  "use strict";
@@ -56541,7 +57605,7 @@ var init_phase = __esm({
56541
57605
  await dispatchFromCli("query", "pipeline", "phase.list", {}, { command: "phase" });
56542
57606
  }
56543
57607
  });
56544
- setCommand2 = defineCommand({
57608
+ setCommand = defineCommand({
56545
57609
  meta: { name: "set", description: "Set current phase" },
56546
57610
  args: {
56547
57611
  slug: {
@@ -56694,7 +57758,7 @@ var init_phase = __esm({
56694
57758
  subCommands: {
56695
57759
  show: showCommand9,
56696
57760
  list: listCommand15,
56697
- set: setCommand2,
57761
+ set: setCommand,
56698
57762
  start: startCommand6,
56699
57763
  complete: completeCommand3,
56700
57764
  advance: advanceCommand2,
@@ -57042,7 +58106,7 @@ __export(provenance_exports, {
57042
58106
  provenanceCommand: () => provenanceCommand
57043
58107
  });
57044
58108
  var backfillCommand3, verifyCommand2, provenanceCommand;
57045
- var init_provenance2 = __esm({
58109
+ var init_provenance3 = __esm({
57046
58110
  "packages/cleo/src/cli/commands/provenance.ts"() {
57047
58111
  "use strict";
57048
58112
  init_dist();
@@ -57522,7 +58586,7 @@ var refresh_memory_exports = {};
57522
58586
  __export(refresh_memory_exports, {
57523
58587
  refreshMemoryCommand: () => refreshMemoryCommand
57524
58588
  });
57525
- import { getProjectRoot as getProjectRoot42 } from "@cleocode/core";
58589
+ import { getProjectRoot as getProjectRoot47 } from "@cleocode/core";
57526
58590
  var refreshMemoryCommand;
57527
58591
  var init_refresh_memory = __esm({
57528
58592
  "packages/cleo/src/cli/commands/refresh-memory.ts"() {
@@ -57535,7 +58599,7 @@ var init_refresh_memory = __esm({
57535
58599
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
57536
58600
  },
57537
58601
  async run() {
57538
- const projectDir = getProjectRoot42();
58602
+ const projectDir = getProjectRoot47();
57539
58603
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
57540
58604
  const result = await writeMemoryBridge(projectDir);
57541
58605
  if (result.written) {
@@ -58936,7 +60000,7 @@ import fs3 from "node:fs";
58936
60000
  import path5 from "node:path";
58937
60001
  import {
58938
60002
  CleoError as CleoError7,
58939
- getProjectRoot as getProjectRoot43,
60003
+ getProjectRoot as getProjectRoot48,
58940
60004
  getTaskAccessor as getTaskAccessor3,
58941
60005
  parseConflictReport,
58942
60006
  setAtPath
@@ -58957,7 +60021,7 @@ var init_restore = __esm({
58957
60021
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
58958
60022
  },
58959
60023
  async run() {
58960
- const projectRoot = getProjectRoot43();
60024
+ const projectRoot = getProjectRoot48();
58961
60025
  const reportPath = path5.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
58962
60026
  if (!fs3.existsSync(reportPath)) {
58963
60027
  humanLine("No pending restore conflicts. Nothing to finalize.");
@@ -59889,6 +60953,7 @@ var schema_exports = {};
59889
60953
  __export(schema_exports, {
59890
60954
  schemaCommand: () => schemaCommand2
59891
60955
  });
60956
+ import { getInputContract } from "@cleocode/core";
59892
60957
  import { describeOperation } from "@cleocode/lafs";
59893
60958
  function resolveOperationDef(operationArg) {
59894
60959
  const dotIdx = operationArg.indexOf(".");
@@ -59936,6 +61001,16 @@ var init_schema = __esm({
59936
61001
  type: "boolean",
59937
61002
  description: "Include usage examples in output (default: false)",
59938
61003
  default: false
61004
+ },
61005
+ input: {
61006
+ type: "boolean",
61007
+ description: "Return the JSON Schema (draft-07) for the operation input payload, from OperationInputContract.schema (T9918)",
61008
+ default: false
61009
+ },
61010
+ examples: {
61011
+ type: "boolean",
61012
+ description: "Return canned example payloads from OperationInputContract.examples \u2014 pipeline: `cleo schema <op> --examples | jq '.examples[0].value' | cleo <verb> --params -` (T9918)",
61013
+ default: false
59939
61014
  }
59940
61015
  },
59941
61016
  async run({ args, cmd }) {
@@ -59946,6 +61021,8 @@ var init_schema = __esm({
59946
61021
  const format = args.format ?? "json";
59947
61022
  const includeGates = args["include-gates"] !== false;
59948
61023
  const includeExamples = args["include-examples"] === true;
61024
+ const wantInput = args.input === true;
61025
+ const wantExamples = args.examples === true;
59949
61026
  if (format === "human") {
59950
61027
  setFormatContext({ format: "human", source: "flag", quiet: false });
59951
61028
  }
@@ -59962,6 +61039,57 @@ var init_schema = __esm({
59962
61039
  process.exit(4);
59963
61040
  return;
59964
61041
  }
61042
+ if (wantInput || wantExamples) {
61043
+ const contract = getInputContract(args.operation);
61044
+ if (contract === null) {
61045
+ cliOutput(
61046
+ {
61047
+ operation: args.operation,
61048
+ schema: null,
61049
+ examples: []
61050
+ },
61051
+ {
61052
+ command: "schema",
61053
+ operation: `schema.${args.operation}`,
61054
+ message: `No OperationInputContract registered for ${args.operation}`,
61055
+ extensions: {
61056
+ hint: `No OperationInputContract registered for ${args.operation}. Use plain flag-based invocation.`
61057
+ }
61058
+ }
61059
+ );
61060
+ return;
61061
+ }
61062
+ if (wantInput) {
61063
+ cliOutput(
61064
+ {
61065
+ operation: contract.operation,
61066
+ schema: contract.schema
61067
+ },
61068
+ {
61069
+ command: "schema",
61070
+ operation: `schema.${args.operation}`,
61071
+ message: `Input schema for ${contract.operation}`
61072
+ }
61073
+ );
61074
+ return;
61075
+ }
61076
+ cliOutput(
61077
+ {
61078
+ operation: contract.operation,
61079
+ examples: contract.examples.map((ex) => ({
61080
+ name: ex.name,
61081
+ value: ex.value,
61082
+ ...ex.description !== void 0 ? { description: ex.description } : {}
61083
+ }))
61084
+ },
61085
+ {
61086
+ command: "schema",
61087
+ operation: `schema.${args.operation}`,
61088
+ message: `Examples for ${contract.operation}`
61089
+ }
61090
+ );
61091
+ return;
61092
+ }
59965
61093
  const schema2 = describeOperation(def, {
59966
61094
  includeGates,
59967
61095
  includeExamples
@@ -61448,7 +62576,7 @@ var sequence_exports = {};
61448
62576
  __export(sequence_exports, {
61449
62577
  sequenceCommand: () => sequenceCommand
61450
62578
  });
61451
- import { getProjectRoot as getProjectRoot44 } from "@cleocode/core/internal";
62579
+ import { getProjectRoot as getProjectRoot49 } from "@cleocode/core/internal";
61452
62580
  var showCommand12, checkCommand6, repairCommand2, sequenceCommand;
61453
62581
  var init_sequence = __esm({
61454
62582
  "packages/cleo/src/cli/commands/sequence.ts"() {
@@ -61484,7 +62612,7 @@ var init_sequence = __esm({
61484
62612
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
61485
62613
  async run() {
61486
62614
  const { repairSequence } = await import("@cleocode/core/internal");
61487
- const projectRoot = getProjectRoot44();
62615
+ const projectRoot = getProjectRoot49();
61488
62616
  const repair = await repairSequence(projectRoot);
61489
62617
  const result = {
61490
62618
  repaired: repair.repaired,
@@ -61939,8 +63067,8 @@ var init_session4 = __esm({
61939
63067
  "audit-scope": { type: "string", description: "Audit log scope (global|local)" }
61940
63068
  },
61941
63069
  async run({ args }) {
61942
- const { detectSessionDrift, getProjectRoot: getProjectRoot48 } = await import("@cleocode/core");
61943
- const projectRoot = await getProjectRoot48();
63070
+ const { detectSessionDrift, getProjectRoot: getProjectRoot53 } = await import("@cleocode/core");
63071
+ const projectRoot = await getProjectRoot53();
61944
63072
  const scope = args["audit-scope"] === "local" ? "local" : "global";
61945
63073
  const report = await detectSessionDrift({ projectRoot, auditScope: scope });
61946
63074
  cliOutput(report, { command: "session drift", operation: "session.drift" });
@@ -62642,7 +63770,7 @@ __export(show_exports, {
62642
63770
  showCommand: () => showCommand14
62643
63771
  });
62644
63772
  var showCommand14;
62645
- var init_show = __esm({
63773
+ var init_show2 = __esm({
62646
63774
  "packages/cleo/src/cli/commands/show.ts"() {
62647
63775
  "use strict";
62648
63776
  init_dist();
@@ -64476,23 +65604,23 @@ __export(telemetry_exports, {
64476
65604
  telemetryCommand: () => telemetryCommand
64477
65605
  });
64478
65606
  import { randomUUID as randomUUID6 } from "node:crypto";
64479
- import { getConfigValue, setConfigValue } from "@cleocode/core";
65607
+ import { getConfigValue as getConfigValue2, setConfigValue as setConfigValue2 } from "@cleocode/core";
64480
65608
  async function readTelemetryConfig() {
64481
- const enabledResolved = await getConfigValue("telemetry.enabled");
64482
- const periodResolved = await getConfigValue("telemetry.period");
64483
- const installIdResolved = await getConfigValue("telemetry.installId");
65609
+ const enabledResolved = await getConfigValue2("telemetry.enabled");
65610
+ const periodResolved = await getConfigValue2("telemetry.period");
65611
+ const installIdResolved = await getConfigValue2("telemetry.installId");
64484
65612
  const enabled = enabledResolved.value === true;
64485
65613
  const period = periodResolved.value === "monthly" ? "monthly" : "monthly";
64486
65614
  const installId = typeof installIdResolved.value === "string" ? installIdResolved.value : void 0;
64487
65615
  return { enabled, period, installId };
64488
65616
  }
64489
65617
  async function ensureInstallId() {
64490
- const existing = await getConfigValue("telemetry.installId");
65618
+ const existing = await getConfigValue2("telemetry.installId");
64491
65619
  if (typeof existing.value === "string" && existing.value.length > 0) {
64492
65620
  return existing.value;
64493
65621
  }
64494
65622
  const newId = randomUUID6();
64495
- await setConfigValue("telemetry.installId", newId, void 0, { global: true });
65623
+ await setConfigValue2("telemetry.installId", newId, void 0, { global: true });
64496
65624
  return newId;
64497
65625
  }
64498
65626
  var enableSub, disableSub, statusSub2, telemetryCommand;
@@ -64508,8 +65636,8 @@ var init_telemetry2 = __esm({
64508
65636
  description: "Enable anonymous skills-usage telemetry (default-on for new installs)"
64509
65637
  },
64510
65638
  async run() {
64511
- await setConfigValue("telemetry.enabled", true, void 0, { global: true });
64512
- await setConfigValue("telemetry.period", "monthly", void 0, { global: true });
65639
+ await setConfigValue2("telemetry.enabled", true, void 0, { global: true });
65640
+ await setConfigValue2("telemetry.period", "monthly", void 0, { global: true });
64513
65641
  const installId = await ensureInstallId();
64514
65642
  const config = await readTelemetryConfig();
64515
65643
  cliOutput(
@@ -64528,7 +65656,7 @@ var init_telemetry2 = __esm({
64528
65656
  description: "Disable anonymous skills-usage telemetry"
64529
65657
  },
64530
65658
  async run() {
64531
- await setConfigValue("telemetry.enabled", false, void 0, { global: true });
65659
+ await setConfigValue2("telemetry.enabled", false, void 0, { global: true });
64532
65660
  const config = await readTelemetryConfig();
64533
65661
  cliOutput(config, {
64534
65662
  command: "telemetry",
@@ -64706,7 +65834,7 @@ __export(token_exports, {
64706
65834
  tokenCommand: () => tokenCommand
64707
65835
  });
64708
65836
  import { readFileSync as readFileSync16 } from "node:fs";
64709
- import { getProjectRoot as getProjectRoot45, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
65837
+ import { getProjectRoot as getProjectRoot50, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
64710
65838
  function readPayload(args, textKey, fileKey) {
64711
65839
  const text = args[textKey];
64712
65840
  const file = args[fileKey];
@@ -64870,7 +65998,7 @@ var init_token = __esm({
64870
65998
  domain: args.domain,
64871
65999
  operation: args.operation
64872
66000
  };
64873
- const result = args.record ? await recordTokenExchange2(getProjectRoot45(), input2) : await measureTokenExchange(input2);
66001
+ const result = args.record ? await recordTokenExchange2(getProjectRoot50(), input2) : await measureTokenExchange(input2);
64874
66002
  cliOutput(result, {
64875
66003
  command: "token",
64876
66004
  operation: args.record ? "admin.token.record" : "token.estimate"
@@ -64906,7 +66034,7 @@ __export(transcript_exports, {
64906
66034
  });
64907
66035
  import { homedir as homedir6 } from "node:os";
64908
66036
  import { join as join30 } from "node:path";
64909
- import { getProjectRoot as getProjectRoot46 } from "@cleocode/core";
66037
+ import { getProjectRoot as getProjectRoot51 } from "@cleocode/core";
64910
66038
  import {
64911
66039
  parseDurationMs,
64912
66040
  pruneTranscripts,
@@ -64936,7 +66064,7 @@ var init_transcript = __esm({
64936
66064
  async run({ args }) {
64937
66065
  if (args.pending) {
64938
66066
  try {
64939
- const projectRoot = getProjectRoot46();
66067
+ const projectRoot = getProjectRoot51();
64940
66068
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
64941
66069
  const pending = await scanPendingTranscripts(projectRoot);
64942
66070
  cliOutput(
@@ -65033,7 +66161,7 @@ var init_transcript = __esm({
65033
66161
  async run({ args }) {
65034
66162
  const tier = args.tier ?? "warm";
65035
66163
  const dryRun = args["dry-run"] ?? false;
65036
- const projectRoot = getProjectRoot46();
66164
+ const projectRoot = getProjectRoot51();
65037
66165
  try {
65038
66166
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
65039
66167
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -65145,7 +66273,7 @@ var init_transcript = __esm({
65145
66273
  const dryRun = args["dry-run"] ?? false;
65146
66274
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
65147
66275
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
65148
- const projectRoot = getProjectRoot46();
66276
+ const projectRoot = getProjectRoot51();
65149
66277
  try {
65150
66278
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
65151
66279
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -65324,11 +66452,18 @@ var update_exports = {};
65324
66452
  __export(update_exports, {
65325
66453
  updateCommand: () => updateCommand2
65326
66454
  });
65327
- import { appendSignedSeverityAttestation as appendSignedSeverityAttestation2, parseAcceptanceCriteria as parseAcceptanceCriteria2 } from "@cleocode/core";
66455
+ import {
66456
+ appendSignedSeverityAttestation as appendSignedSeverityAttestation2,
66457
+ isPipelineTransitionForward,
66458
+ isValidPipelineStage,
66459
+ parseAcceptanceCriteria as parseAcceptanceCriteria2,
66460
+ TASK_PIPELINE_STAGES
66461
+ } from "@cleocode/core";
65328
66462
  var updateCommand2;
65329
66463
  var init_update = __esm({
65330
66464
  "packages/cleo/src/cli/commands/update.ts"() {
65331
66465
  "use strict";
66466
+ init_src2();
65332
66467
  init_dist();
65333
66468
  init_cli();
65334
66469
  init_renderers();
@@ -65540,6 +66675,58 @@ var init_update = __esm({
65540
66675
  await showUsage(cmd);
65541
66676
  return;
65542
66677
  }
66678
+ if (args.severity !== void 0 && !TASK_SEVERITIES.includes(args.severity)) {
66679
+ const valid = TASK_SEVERITIES.join(", ");
66680
+ cliError(
66681
+ `severity must be one of: ${valid} \u2014 got '${args.severity}'`,
66682
+ 6,
66683
+ {
66684
+ name: "E_INVALID_SEVERITY_VALUE",
66685
+ fix: `Pass --severity with one of: ${valid}`
66686
+ },
66687
+ { operation: "tasks.update" }
66688
+ );
66689
+ process.exit(6);
66690
+ return;
66691
+ }
66692
+ if (args["pipeline-stage"] !== void 0) {
66693
+ const requestedStage = String(args["pipeline-stage"]);
66694
+ if (!isValidPipelineStage(requestedStage)) {
66695
+ const valid = TASK_PIPELINE_STAGES.join(", ");
66696
+ cliError(
66697
+ `pipeline-stage must be one of: ${valid} \u2014 got '${requestedStage}'`,
66698
+ 6,
66699
+ {
66700
+ name: "E_INVALID_PIPELINE_STAGE",
66701
+ fix: `Pass --pipeline-stage with one of: ${valid}`
66702
+ },
66703
+ { operation: "tasks.update" }
66704
+ );
66705
+ process.exit(6);
66706
+ return;
66707
+ }
66708
+ const showResponse = await dispatchRaw("query", "tasks", "show", {
66709
+ taskId: args.taskId
66710
+ });
66711
+ const existingTask = showResponse.success ? showResponse.data : void 0;
66712
+ const currentStage = typeof existingTask?.["pipelineStage"] === "string" ? existingTask["pipelineStage"] : null;
66713
+ if (currentStage && !isPipelineTransitionForward(currentStage, requestedStage)) {
66714
+ const validForward = TASK_PIPELINE_STAGES.filter((s) => {
66715
+ return isPipelineTransitionForward(currentStage, s);
66716
+ }).join(", ");
66717
+ cliError(
66718
+ `pipeline-stage transition rejected: cannot move backward from '${currentStage}' to '${requestedStage}'. Pipeline stages are forward-only.`,
66719
+ 6,
66720
+ {
66721
+ name: "E_INVALID_PIPELINE_STAGE",
66722
+ fix: `Pass --pipeline-stage with a stage at or after '${currentStage}'. Valid forward stages: ${validForward}`
66723
+ },
66724
+ { operation: "tasks.update" }
66725
+ );
66726
+ process.exit(6);
66727
+ return;
66728
+ }
66729
+ }
65543
66730
  const params = { taskId: args.taskId };
65544
66731
  if (args.title !== void 0) params["title"] = args.title;
65545
66732
  if (args.status !== void 0) params["status"] = args.status;
@@ -65943,7 +67130,7 @@ __export(web_exports, {
65943
67130
  import { execFileSync as execFileSync3, spawn as spawn3 } from "node:child_process";
65944
67131
  import { mkdir as mkdir4, open, readFile as readFile6, rm, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
65945
67132
  import { join as join31 } from "node:path";
65946
- import { CleoError as CleoError11, formatError as formatError7, getCleoHome as getCleoHome5 } from "@cleocode/core";
67133
+ import { CleoError as CleoError11, formatError as formatError6, getCleoHome as getCleoHome5 } from "@cleocode/core";
65947
67134
  function getWebPaths() {
65948
67135
  const cleoHome = getCleoHome5();
65949
67136
  return {
@@ -66096,7 +67283,7 @@ var init_web = __esm({
66096
67283
  await startWebServer(Number.parseInt(args.port, 10), args.host);
66097
67284
  } catch (err) {
66098
67285
  if (err instanceof CleoError11) {
66099
- console.error(formatError7(err));
67286
+ console.error(formatError6(err));
66100
67287
  process.exit(err.code);
66101
67288
  }
66102
67289
  throw err;
@@ -66140,7 +67327,7 @@ var init_web = __esm({
66140
67327
  cliOutput({ stopped: true }, { command: "web", message: "CLEO Web UI stopped" });
66141
67328
  } catch (err) {
66142
67329
  if (err instanceof CleoError11) {
66143
- console.error(formatError7(err));
67330
+ console.error(formatError6(err));
66144
67331
  process.exit(err.code);
66145
67332
  }
66146
67333
  throw err;
@@ -66193,7 +67380,7 @@ var init_web = __esm({
66193
67380
  await startWebServer(Number.parseInt(args.port, 10), args.host);
66194
67381
  } catch (err) {
66195
67382
  if (err instanceof CleoError11) {
66196
- console.error(formatError7(err));
67383
+ console.error(formatError6(err));
66197
67384
  process.exit(err.code);
66198
67385
  }
66199
67386
  throw err;
@@ -66208,7 +67395,7 @@ var init_web = __esm({
66208
67395
  cliOutput(status, { command: "web" });
66209
67396
  } catch (err) {
66210
67397
  if (err instanceof CleoError11) {
66211
- console.error(formatError7(err));
67398
+ console.error(formatError6(err));
66212
67399
  process.exit(err.code);
66213
67400
  }
66214
67401
  throw err;
@@ -66241,7 +67428,7 @@ var init_web = __esm({
66241
67428
  cliOutput({ url }, { command: "web", message: `Open browser to: ${url}` });
66242
67429
  } catch (err) {
66243
67430
  if (err instanceof CleoError11) {
66244
- console.error(formatError7(err));
67431
+ console.error(formatError6(err));
66245
67432
  process.exit(err.code);
66246
67433
  }
66247
67434
  throw err;
@@ -66272,7 +67459,7 @@ __export(worktree_exports, {
66272
67459
  worktreeCommand: () => worktreeCommand
66273
67460
  });
66274
67461
  import readline4 from "node:readline";
66275
- import { getProjectRoot as getProjectRoot47, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
67462
+ import { getProjectRoot as getProjectRoot52, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
66276
67463
  async function promptYesNo2(question) {
66277
67464
  return new Promise((resolve7) => {
66278
67465
  const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
@@ -66377,7 +67564,7 @@ var init_worktree3 = __esm({
66377
67564
  const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
66378
67565
  const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
66379
67566
  const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
66380
- const projectRoot = getProjectRoot47();
67567
+ const projectRoot = getProjectRoot52();
66381
67568
  const listResult = await listWorktrees2({
66382
67569
  projectRoot,
66383
67570
  ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
@@ -66819,8 +68006,8 @@ var COMMAND_MANIFEST = [
66819
68006
  {
66820
68007
  exportName: "configCommand",
66821
68008
  name: "config",
66822
- description: "Configuration management",
66823
- load: async () => (await Promise.resolve().then(() => (init_config2(), config_exports))).configCommand
68009
+ description: "CleoConfig SSoT registry surface (show, get, set, validate, drift-check) + legacy presets/list",
68010
+ load: async () => (await Promise.resolve().then(() => (init_config3(), config_exports))).configCommand
66824
68011
  },
66825
68012
  {
66826
68013
  exportName: "consensusCommand",
@@ -67102,7 +68289,7 @@ var COMMAND_MANIFEST = [
67102
68289
  exportName: "manifestCommand",
67103
68290
  name: "manifest",
67104
68291
  description: "Manifest operations (pipeline_manifest table)",
67105
- load: async () => (await Promise.resolve().then(() => (init_manifest(), manifest_exports))).manifestCommand
68292
+ load: async () => (await Promise.resolve().then(() => (init_manifest3(), manifest_exports))).manifestCommand
67106
68293
  },
67107
68294
  {
67108
68295
  exportName: "mapCommand",
@@ -67192,7 +68379,7 @@ var COMMAND_MANIFEST = [
67192
68379
  exportName: "provenanceCommand",
67193
68380
  name: "provenance",
67194
68381
  description: "Provenance-graph maintenance: backfill, verify, repair",
67195
- load: async () => (await Promise.resolve().then(() => (init_provenance2(), provenance_exports))).provenanceCommand
68382
+ load: async () => (await Promise.resolve().then(() => (init_provenance3(), provenance_exports))).provenanceCommand
67196
68383
  },
67197
68384
  {
67198
68385
  exportName: "providerCommand",
@@ -67342,7 +68529,7 @@ var COMMAND_MANIFEST = [
67342
68529
  exportName: "showCommand",
67343
68530
  name: "show",
67344
68531
  description: "Show full task details by ID (returns complete task record with metadata, verification, lifecycle)",
67345
- load: async () => (await Promise.resolve().then(() => (init_show(), show_exports))).showCommand
68532
+ load: async () => (await Promise.resolve().then(() => (init_show2(), show_exports))).showCommand
67346
68533
  },
67347
68534
  {
67348
68535
  exportName: "skillCommand",
@@ -67895,7 +69082,7 @@ async function runStartupMaintenance() {
67895
69082
  detectAndRemoveStrayProjectNexus,
67896
69083
  getGlobalSalt,
67897
69084
  getLogger: getLogger21,
67898
- getProjectRoot: getProjectRoot48,
69085
+ getProjectRoot: getProjectRoot53,
67899
69086
  isCleanupMarkerSet,
67900
69087
  migrateSignaldockToConduit,
67901
69088
  needsSignaldockToConduitMigration,
@@ -67904,7 +69091,7 @@ async function runStartupMaintenance() {
67904
69091
  } = await import("@cleocode/core/internal");
67905
69092
  let projectRootForCleanup = "";
67906
69093
  try {
67907
- projectRootForCleanup = getProjectRoot48();
69094
+ projectRootForCleanup = getProjectRoot53();
67908
69095
  } catch {
67909
69096
  }
67910
69097
  if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
@@ -67924,7 +69111,7 @@ async function runStartupMaintenance() {
67924
69111
  const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
67925
69112
  if (!isInitInvocation) {
67926
69113
  try {
67927
- const _projectRootForMigration = getProjectRoot48();
69114
+ const _projectRootForMigration = getProjectRoot53();
67928
69115
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
67929
69116
  const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
67930
69117
  if (migrationResult.status === "failed") {