@cleocode/cleo 2026.6.7 → 2026.6.8

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
@@ -9680,7 +9680,7 @@ var init_operations_registry = __esm({
9680
9680
  gateway: "mutate",
9681
9681
  domain: "docs",
9682
9682
  operation: "add",
9683
- description: "docs.add (mutate) \u2014 attach a local file or URL to a CLEO owner entity (task, session, observation)",
9683
+ description: "docs.add (mutate) \u2014 attach a local file, URL, or inline content to a CLEO owner entity (task, session, observation)",
9684
9684
  tier: 1,
9685
9685
  idempotent: false,
9686
9686
  sessionRequired: false,
@@ -9704,6 +9704,12 @@ var init_operations_registry = __esm({
9704
9704
  required: false,
9705
9705
  description: "Remote URL to attach"
9706
9706
  },
9707
+ {
9708
+ name: "content",
9709
+ type: "string",
9710
+ required: false,
9711
+ description: "Inline document body (T10965); mutually exclusive with file/url"
9712
+ },
9707
9713
  {
9708
9714
  name: "desc",
9709
9715
  type: "string",
@@ -11410,7 +11416,8 @@ var init_provenance = __esm({
11410
11416
  "superseded-by",
11411
11417
  "related-task",
11412
11418
  "linked-decision",
11413
- "derived-from"
11419
+ "derived-from",
11420
+ "shares-topic"
11414
11421
  ];
11415
11422
  DOC_LIFECYCLE_STATUSES = [
11416
11423
  "active",
@@ -11485,6 +11492,41 @@ var init_provenance = __esm({
11485
11492
  }
11486
11493
  });
11487
11494
 
11495
+ // packages/contracts/src/docs/read.ts
11496
+ import { z as z8 } from "zod";
11497
+ var docFrontmatterSchema, docBodySchema, docReadResponseSchema;
11498
+ var init_read = __esm({
11499
+ "packages/contracts/src/docs/read.ts"() {
11500
+ "use strict";
11501
+ docFrontmatterSchema = z8.object({
11502
+ slug: z8.string(),
11503
+ kind: z8.string().nullable(),
11504
+ title: z8.string().nullable(),
11505
+ summary: z8.string().nullable(),
11506
+ lifecycleStatus: z8.string(),
11507
+ docVersion: z8.number().int(),
11508
+ ownerVersion: z8.string().nullable(),
11509
+ supersedes: z8.string().nullable(),
11510
+ supersededBy: z8.string().nullable(),
11511
+ topics: z8.array(z8.string()).readonly(),
11512
+ relatedTasks: z8.array(z8.string()).readonly(),
11513
+ sha256: z8.string(),
11514
+ createdAt: z8.string()
11515
+ });
11516
+ docBodySchema = z8.object({
11517
+ encoding: z8.enum(["utf-8", "base64"]),
11518
+ text: z8.string().optional(),
11519
+ base64: z8.string().optional(),
11520
+ sizeBytes: z8.number().int().nonnegative(),
11521
+ mimeType: z8.string().nullable()
11522
+ });
11523
+ docReadResponseSchema = z8.object({
11524
+ frontmatter: docFrontmatterSchema,
11525
+ body: docBodySchema
11526
+ });
11527
+ }
11528
+ });
11529
+
11488
11530
  // packages/contracts/src/engine-result.ts
11489
11531
  var init_engine_result = __esm({
11490
11532
  "packages/contracts/src/engine-result.ts"() {
@@ -11640,72 +11682,72 @@ var init_errors = __esm({
11640
11682
  });
11641
11683
 
11642
11684
  // packages/contracts/src/evidence-atom-schema.ts
11643
- import { z as z8 } from "zod";
11685
+ import { z as z9 } from "zod";
11644
11686
  var commitAtomSchema, filesAtomSchema, testRunAtomSchema, toolAtomSchema, urlAtomSchema, noteAtomSchema, decisionAtomSchema, prAtomSchema, locDropAtomSchema, callsiteCoverageAtomSchema, AC_UUID_REGEX, AC_ALIAS_REGEX, SATISFIES_TASK_ID_REGEX, SATISFIES_VERSION_PIN_REGEX, satisfiesAtomSchema, EvidenceAtomSchema, GATE_EVIDENCE_REQUIREMENTS, ATOM_EXAMPLES;
11645
11687
  var init_evidence_atom_schema = __esm({
11646
11688
  "packages/contracts/src/evidence-atom-schema.ts"() {
11647
11689
  "use strict";
11648
- commitAtomSchema = z8.object({
11649
- kind: z8.literal("commit"),
11650
- sha: z8.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
11690
+ commitAtomSchema = z9.object({
11691
+ kind: z9.literal("commit"),
11692
+ sha: z9.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
11651
11693
  });
11652
- filesAtomSchema = z8.object({
11653
- kind: z8.literal("files"),
11654
- paths: z8.array(z8.string().min(1)).min(1, "files atom requires at least one path")
11694
+ filesAtomSchema = z9.object({
11695
+ kind: z9.literal("files"),
11696
+ paths: z9.array(z9.string().min(1)).min(1, "files atom requires at least one path")
11655
11697
  });
11656
- testRunAtomSchema = z8.object({
11657
- kind: z8.literal("test-run"),
11658
- path: z8.string().min(1, "test-run atom requires a non-empty path")
11698
+ testRunAtomSchema = z9.object({
11699
+ kind: z9.literal("test-run"),
11700
+ path: z9.string().min(1, "test-run atom requires a non-empty path")
11659
11701
  });
11660
- toolAtomSchema = z8.object({
11661
- kind: z8.literal("tool"),
11662
- tool: z8.string().min(1, "tool atom requires a non-empty tool name")
11702
+ toolAtomSchema = z9.object({
11703
+ kind: z9.literal("tool"),
11704
+ tool: z9.string().min(1, "tool atom requires a non-empty tool name")
11663
11705
  });
11664
- urlAtomSchema = z8.object({
11665
- kind: z8.literal("url"),
11666
- url: z8.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
11706
+ urlAtomSchema = z9.object({
11707
+ kind: z9.literal("url"),
11708
+ url: z9.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
11667
11709
  });
11668
- noteAtomSchema = z8.object({
11669
- kind: z8.literal("note"),
11670
- note: z8.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
11710
+ noteAtomSchema = z9.object({
11711
+ kind: z9.literal("note"),
11712
+ note: z9.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
11671
11713
  });
11672
- decisionAtomSchema = z8.object({
11673
- kind: z8.literal("decision"),
11674
- decisionId: z8.string().min(1, "decision atom requires a non-empty decision ID")
11714
+ decisionAtomSchema = z9.object({
11715
+ kind: z9.literal("decision"),
11716
+ decisionId: z9.string().min(1, "decision atom requires a non-empty decision ID")
11675
11717
  });
11676
- prAtomSchema = z8.object({
11677
- kind: z8.literal("pr"),
11678
- prNumber: z8.number().int().positive("pr atom requires a positive integer PR number")
11718
+ prAtomSchema = z9.object({
11719
+ kind: z9.literal("pr"),
11720
+ prNumber: z9.number().int().positive("pr atom requires a positive integer PR number")
11679
11721
  });
11680
- locDropAtomSchema = z8.object({
11681
- kind: z8.literal("loc-drop"),
11682
- fromLines: z8.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
11683
- toLines: z8.number().int().nonnegative("loc-drop toLines must be \u2265 0")
11722
+ locDropAtomSchema = z9.object({
11723
+ kind: z9.literal("loc-drop"),
11724
+ fromLines: z9.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
11725
+ toLines: z9.number().int().nonnegative("loc-drop toLines must be \u2265 0")
11684
11726
  });
11685
- callsiteCoverageAtomSchema = z8.object({
11686
- kind: z8.literal("callsite-coverage"),
11687
- symbolName: z8.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
11688
- relativeSourcePath: z8.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
11727
+ callsiteCoverageAtomSchema = z9.object({
11728
+ kind: z9.literal("callsite-coverage"),
11729
+ symbolName: z9.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
11730
+ relativeSourcePath: z9.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
11689
11731
  });
11690
11732
  AC_UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[45][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
11691
11733
  AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
11692
11734
  SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
11693
11735
  SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
11694
- satisfiesAtomSchema = z8.object({
11695
- kind: z8.literal("satisfies"),
11736
+ satisfiesAtomSchema = z9.object({
11737
+ kind: z9.literal("satisfies"),
11696
11738
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
11697
- targetTaskId: z8.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
11739
+ targetTaskId: z9.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
11698
11740
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
11699
- targetAcId: z8.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
11741
+ targetAcId: z9.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
11700
11742
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
11701
- targetAcAlias: z8.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
11743
+ targetAcAlias: z9.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
11702
11744
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
11703
- versionPin: z8.string().regex(
11745
+ versionPin: z9.string().regex(
11704
11746
  SATISFIES_VERSION_PIN_REGEX,
11705
11747
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
11706
11748
  ).optional()
11707
11749
  });
11708
- EvidenceAtomSchema = z8.discriminatedUnion("kind", [
11750
+ EvidenceAtomSchema = z9.discriminatedUnion("kind", [
11709
11751
  commitAtomSchema,
11710
11752
  filesAtomSchema,
11711
11753
  testRunAtomSchema,
@@ -11752,58 +11794,58 @@ var init_evidence_atom_schema = __esm({
11752
11794
  });
11753
11795
 
11754
11796
  // packages/contracts/src/evidence-record-schema.ts
11755
- import { z as z9 } from "zod";
11797
+ import { z as z10 } from "zod";
11756
11798
  var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
11757
11799
  var init_evidence_record_schema = __esm({
11758
11800
  "packages/contracts/src/evidence-record-schema.ts"() {
11759
11801
  "use strict";
11760
- evidenceBaseSchema = z9.object({
11802
+ evidenceBaseSchema = z10.object({
11761
11803
  /** Identity string of the agent that produced this record. */
11762
- agentIdentity: z9.string().min(1),
11804
+ agentIdentity: z10.string().min(1),
11763
11805
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
11764
- attachmentSha256: z9.string().length(64),
11806
+ attachmentSha256: z10.string().length(64),
11765
11807
  /** ISO 8601 timestamp at which the action ran. */
11766
- ranAt: z9.string().datetime(),
11808
+ ranAt: z10.string().datetime(),
11767
11809
  /** Wall-clock duration of the action in milliseconds. */
11768
- durationMs: z9.number().nonnegative()
11810
+ durationMs: z10.number().nonnegative()
11769
11811
  });
11770
11812
  implDiffRecordSchema = evidenceBaseSchema.extend({
11771
- kind: z9.literal("impl-diff"),
11772
- phase: z9.literal("implement"),
11773
- filesChanged: z9.array(z9.string().min(1)).min(1),
11774
- linesAdded: z9.number().int().nonnegative(),
11775
- linesRemoved: z9.number().int().nonnegative()
11813
+ kind: z10.literal("impl-diff"),
11814
+ phase: z10.literal("implement"),
11815
+ filesChanged: z10.array(z10.string().min(1)).min(1),
11816
+ linesAdded: z10.number().int().nonnegative(),
11817
+ linesRemoved: z10.number().int().nonnegative()
11776
11818
  });
11777
11819
  validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
11778
- kind: z9.literal("validate-spec-check"),
11779
- phase: z9.literal("validate"),
11780
- reqIdsChecked: z9.array(z9.string().min(1)).min(1),
11781
- passed: z9.boolean(),
11782
- details: z9.string().min(1)
11820
+ kind: z10.literal("validate-spec-check"),
11821
+ phase: z10.literal("validate"),
11822
+ reqIdsChecked: z10.array(z10.string().min(1)).min(1),
11823
+ passed: z10.boolean(),
11824
+ details: z10.string().min(1)
11783
11825
  });
11784
11826
  testOutputRecordSchema = evidenceBaseSchema.extend({
11785
- kind: z9.literal("test-output"),
11786
- phase: z9.literal("test"),
11787
- command: z9.string().min(1),
11788
- exitCode: z9.number().int(),
11789
- testsPassed: z9.number().int().nonnegative(),
11790
- testsFailed: z9.number().int().nonnegative()
11827
+ kind: z10.literal("test-output"),
11828
+ phase: z10.literal("test"),
11829
+ command: z10.string().min(1),
11830
+ exitCode: z10.number().int(),
11831
+ testsPassed: z10.number().int().nonnegative(),
11832
+ testsFailed: z10.number().int().nonnegative()
11791
11833
  });
11792
11834
  lintReportRecordSchema = evidenceBaseSchema.extend({
11793
- kind: z9.literal("lint-report"),
11794
- phase: z9.enum(["implement", "test"]),
11795
- tool: z9.string().min(1),
11796
- passed: z9.boolean(),
11797
- warnings: z9.number().int().nonnegative(),
11798
- errors: z9.number().int().nonnegative()
11835
+ kind: z10.literal("lint-report"),
11836
+ phase: z10.enum(["implement", "test"]),
11837
+ tool: z10.string().min(1),
11838
+ passed: z10.boolean(),
11839
+ warnings: z10.number().int().nonnegative(),
11840
+ errors: z10.number().int().nonnegative()
11799
11841
  });
11800
11842
  commandOutputRecordSchema = evidenceBaseSchema.extend({
11801
- kind: z9.literal("command-output"),
11802
- phase: z9.enum(["implement", "validate", "test"]),
11803
- cmd: z9.string().min(1),
11804
- exitCode: z9.number().int()
11843
+ kind: z10.literal("command-output"),
11844
+ phase: z10.enum(["implement", "validate", "test"]),
11845
+ cmd: z10.string().min(1),
11846
+ exitCode: z10.number().int()
11805
11847
  });
11806
- evidenceRecordSchema = z9.discriminatedUnion("kind", [
11848
+ evidenceRecordSchema = z10.discriminatedUnion("kind", [
11807
11849
  implDiffRecordSchema,
11808
11850
  validateSpecCheckRecordSchema,
11809
11851
  testOutputRecordSchema,
@@ -12363,7 +12405,7 @@ var init_status_registry = __esm({
12363
12405
  });
12364
12406
 
12365
12407
  // packages/contracts/src/workgraph.ts
12366
- import { z as z10 } from "zod";
12408
+ import { z as z11 } from "zod";
12367
12409
  var E_WORKGRAPH_PARENT_TYPE_MATRIX, taskTypeSchema, taskPrioritySchema, taskStatusSchema, verificationGateSchema, workGraphRelationKindSchema, workGraphTraversalDirectionSchema, workGraphEdgeDirectionSchema, paginationParamsSchema, workGraphNodeSchema, workGraphEdgeSchema, workGraphHierarchyEdgeSchema, workGraphPageInfoSchema, workGraphRollupCountsSchema, workGraphSubtreePercentagesSchema, workGraphProjectionMismatchSchema, workGraphReadyFrontierTaskSchema, workGraphRelationEdgeSchema, workGraphDependencyEdgeSchema, workGraphOmissionReasonSchema, workGraphContextBudgetSchema, workGraphOmissionSchema, workGraphDirectEdgeSchema, workGraphContextPackParamsSchema, workGraphSliceParamsSchema, workGraphSliceSchema, workGraphReadinessParamsSchema, workGraphReadinessResultSchema, workGraphContextPackSchema, workGraphScaffoldValidateParamsSchema, workGraphScaffoldValidationIssueSchema, workGraphScaffoldValidateResultSchema, workGraphScaffoldApplyParamsSchema, workGraphScaffoldApplyResultSchema, workGraphPlanningDocParamsSchema, workGraphPlanningDocSchema, tasksTraverseParamsSchema, tasksTraverseResultSchema, tasksTreeParamsSchema, tasksTreeResultSchema, tasksRollupParamsSchema, tasksRollupResultSchema, tasksFrontierParamsSchema, tasksFrontierResultSchema, tasksWorkGraphAuditParamsSchema, tasksWorkGraphAuditResultSchema;
12368
12410
  var init_workgraph = __esm({
12369
12411
  "packages/contracts/src/workgraph.ts"() {
@@ -12371,10 +12413,10 @@ var init_workgraph = __esm({
12371
12413
  init_enums();
12372
12414
  init_status_registry();
12373
12415
  E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
12374
- taskTypeSchema = z10.enum(["saga", "epic", "task", "subtask"]);
12375
- taskPrioritySchema = z10.enum(["critical", "high", "medium", "low"]);
12376
- taskStatusSchema = z10.enum(TASK_STATUSES);
12377
- verificationGateSchema = z10.enum([
12416
+ taskTypeSchema = z11.enum(["saga", "epic", "task", "subtask"]);
12417
+ taskPrioritySchema = z11.enum(["critical", "high", "medium", "low"]);
12418
+ taskStatusSchema = z11.enum(TASK_STATUSES);
12419
+ verificationGateSchema = z11.enum([
12378
12420
  "implemented",
12379
12421
  "testsPassed",
12380
12422
  "qaPassed",
@@ -12383,7 +12425,7 @@ var init_workgraph = __esm({
12383
12425
  "documented",
12384
12426
  "nexusImpact"
12385
12427
  ]);
12386
- workGraphRelationKindSchema = z10.enum([
12428
+ workGraphRelationKindSchema = z11.enum([
12387
12429
  "contains",
12388
12430
  "depends_on",
12389
12431
  "blocks",
@@ -12391,317 +12433,317 @@ var init_workgraph = __esm({
12391
12433
  "groups",
12392
12434
  "satisfies"
12393
12435
  ]);
12394
- workGraphTraversalDirectionSchema = z10.enum([
12436
+ workGraphTraversalDirectionSchema = z11.enum([
12395
12437
  "ancestors",
12396
12438
  "descendants",
12397
12439
  "upstream",
12398
12440
  "downstream"
12399
12441
  ]);
12400
- workGraphEdgeDirectionSchema = z10.enum(["out", "in", "both"]);
12401
- paginationParamsSchema = z10.object({
12402
- cursor: z10.string().min(1).optional(),
12403
- limit: z10.number().int().positive().max(500).optional()
12442
+ workGraphEdgeDirectionSchema = z11.enum(["out", "in", "both"]);
12443
+ paginationParamsSchema = z11.object({
12444
+ cursor: z11.string().min(1).optional(),
12445
+ limit: z11.number().int().positive().max(500).optional()
12404
12446
  });
12405
- workGraphNodeSchema = z10.object({
12406
- id: z10.string().min(1),
12447
+ workGraphNodeSchema = z11.object({
12448
+ id: z11.string().min(1),
12407
12449
  type: taskTypeSchema,
12408
- title: z10.string(),
12450
+ title: z11.string(),
12409
12451
  status: taskStatusSchema,
12410
12452
  priority: taskPrioritySchema,
12411
- parentId: z10.string().min(1).optional()
12453
+ parentId: z11.string().min(1).optional()
12412
12454
  });
12413
- workGraphEdgeSchema = z10.object({
12414
- fromId: z10.string().min(1),
12415
- toId: z10.string().min(1),
12455
+ workGraphEdgeSchema = z11.object({
12456
+ fromId: z11.string().min(1),
12457
+ toId: z11.string().min(1),
12416
12458
  kind: workGraphRelationKindSchema
12417
12459
  });
12418
- workGraphHierarchyEdgeSchema = z10.object({
12419
- fromId: z10.string().min(1),
12420
- toId: z10.string().min(1),
12421
- kind: z10.literal("contains")
12460
+ workGraphHierarchyEdgeSchema = z11.object({
12461
+ fromId: z11.string().min(1),
12462
+ toId: z11.string().min(1),
12463
+ kind: z11.literal("contains")
12422
12464
  }).strict();
12423
- workGraphPageInfoSchema = z10.object({
12424
- nextCursor: z10.string().min(1).optional(),
12425
- hasMore: z10.boolean()
12426
- });
12427
- workGraphRollupCountsSchema = z10.object({
12428
- total: z10.number().int().nonnegative(),
12429
- byStatus: z10.partialRecord(taskStatusSchema, z10.number().int().nonnegative()),
12430
- byType: z10.partialRecord(taskTypeSchema, z10.number().int().nonnegative())
12431
- });
12432
- workGraphSubtreePercentagesSchema = z10.object({
12433
- done: z10.number().nonnegative(),
12434
- active: z10.number().nonnegative(),
12435
- blocked: z10.number().nonnegative(),
12436
- pending: z10.number().nonnegative(),
12437
- cancelled: z10.number().nonnegative()
12438
- });
12439
- workGraphProjectionMismatchSchema = z10.object({
12440
- field: z10.string().min(1),
12441
- expected: z10.number().int().nonnegative(),
12442
- actual: z10.number().int().nonnegative()
12465
+ workGraphPageInfoSchema = z11.object({
12466
+ nextCursor: z11.string().min(1).optional(),
12467
+ hasMore: z11.boolean()
12468
+ });
12469
+ workGraphRollupCountsSchema = z11.object({
12470
+ total: z11.number().int().nonnegative(),
12471
+ byStatus: z11.partialRecord(taskStatusSchema, z11.number().int().nonnegative()),
12472
+ byType: z11.partialRecord(taskTypeSchema, z11.number().int().nonnegative())
12473
+ });
12474
+ workGraphSubtreePercentagesSchema = z11.object({
12475
+ done: z11.number().nonnegative(),
12476
+ active: z11.number().nonnegative(),
12477
+ blocked: z11.number().nonnegative(),
12478
+ pending: z11.number().nonnegative(),
12479
+ cancelled: z11.number().nonnegative()
12480
+ });
12481
+ workGraphProjectionMismatchSchema = z11.object({
12482
+ field: z11.string().min(1),
12483
+ expected: z11.number().int().nonnegative(),
12484
+ actual: z11.number().int().nonnegative()
12443
12485
  });
12444
12486
  workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
12445
- role: z10.string().min(1).optional(),
12446
- dependencyBlockers: z10.array(z10.object({ taskId: z10.string().min(1), status: taskStatusSchema })),
12447
- gateBlockers: z10.array(z10.object({ gate: verificationGateSchema }))
12487
+ role: z11.string().min(1).optional(),
12488
+ dependencyBlockers: z11.array(z11.object({ taskId: z11.string().min(1), status: taskStatusSchema })),
12489
+ gateBlockers: z11.array(z11.object({ gate: verificationGateSchema }))
12448
12490
  });
12449
12491
  workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
12450
- source: z10.literal("relation"),
12451
- relationType: z10.enum(TASK_RELATION_TYPES),
12452
- reason: z10.string().min(1).optional()
12492
+ source: z11.literal("relation"),
12493
+ relationType: z11.enum(TASK_RELATION_TYPES),
12494
+ reason: z11.string().min(1).optional()
12453
12495
  });
12454
12496
  workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
12455
- source: z10.literal("dependency"),
12456
- kind: z10.literal("depends_on")
12497
+ source: z11.literal("dependency"),
12498
+ kind: z11.literal("depends_on")
12457
12499
  });
12458
- workGraphOmissionReasonSchema = z10.enum([
12500
+ workGraphOmissionReasonSchema = z11.enum([
12459
12501
  "budget_exceeded",
12460
12502
  "not_requested",
12461
12503
  "not_available",
12462
12504
  "redacted",
12463
12505
  "truncated"
12464
12506
  ]);
12465
- workGraphContextBudgetSchema = z10.object({
12466
- tokenBudget: z10.number().int().nonnegative(),
12467
- estimatedTokens: z10.number().int().nonnegative(),
12468
- remainingTokens: z10.number().int().nonnegative(),
12469
- truncated: z10.boolean()
12470
- });
12471
- workGraphOmissionSchema = z10.object({
12472
- path: z10.string().min(1),
12507
+ workGraphContextBudgetSchema = z11.object({
12508
+ tokenBudget: z11.number().int().nonnegative(),
12509
+ estimatedTokens: z11.number().int().nonnegative(),
12510
+ remainingTokens: z11.number().int().nonnegative(),
12511
+ truncated: z11.boolean()
12512
+ });
12513
+ workGraphOmissionSchema = z11.object({
12514
+ path: z11.string().min(1),
12473
12515
  reason: workGraphOmissionReasonSchema,
12474
- message: z10.string().min(1),
12475
- estimatedTokens: z10.number().int().nonnegative().optional()
12516
+ message: z11.string().min(1),
12517
+ estimatedTokens: z11.number().int().nonnegative().optional()
12476
12518
  });
12477
- workGraphDirectEdgeSchema = z10.discriminatedUnion("source", [
12519
+ workGraphDirectEdgeSchema = z11.discriminatedUnion("source", [
12478
12520
  workGraphRelationEdgeSchema,
12479
12521
  workGraphDependencyEdgeSchema
12480
12522
  ]);
12481
12523
  workGraphContextPackParamsSchema = paginationParamsSchema.extend({
12482
- rootId: z10.string().min(1),
12483
- tokenBudget: z10.number().int().positive().optional(),
12484
- includeRelations: z10.boolean().optional(),
12485
- includeReadiness: z10.boolean().optional(),
12486
- includeRollup: z10.boolean().optional()
12524
+ rootId: z11.string().min(1),
12525
+ tokenBudget: z11.number().int().positive().optional(),
12526
+ includeRelations: z11.boolean().optional(),
12527
+ includeReadiness: z11.boolean().optional(),
12528
+ includeRollup: z11.boolean().optional()
12487
12529
  });
12488
12530
  workGraphSliceParamsSchema = paginationParamsSchema.extend({
12489
- rootId: z10.string().min(1),
12531
+ rootId: z11.string().min(1),
12490
12532
  direction: workGraphTraversalDirectionSchema.optional(),
12491
- maxDepth: z10.number().int().nonnegative().optional(),
12492
- includeRelations: z10.boolean().optional()
12533
+ maxDepth: z11.number().int().nonnegative().optional(),
12534
+ includeRelations: z11.boolean().optional()
12493
12535
  });
12494
- workGraphSliceSchema = z10.object({
12495
- rootId: z10.string().min(1),
12536
+ workGraphSliceSchema = z11.object({
12537
+ rootId: z11.string().min(1),
12496
12538
  direction: workGraphTraversalDirectionSchema,
12497
- nodes: z10.array(workGraphNodeSchema),
12498
- edges: z10.array(workGraphEdgeSchema),
12539
+ nodes: z11.array(workGraphNodeSchema),
12540
+ edges: z11.array(workGraphEdgeSchema),
12499
12541
  pageInfo: workGraphPageInfoSchema,
12500
- omissions: z10.array(workGraphOmissionSchema).optional()
12501
- });
12502
- workGraphReadinessParamsSchema = z10.object({
12503
- rootId: z10.string().min(1),
12504
- role: z10.string().min(1).optional(),
12505
- includeGateBlockers: z10.boolean().optional()
12506
- });
12507
- workGraphReadinessResultSchema = z10.object({
12508
- rootId: z10.string().min(1),
12509
- role: z10.string().min(1).optional(),
12510
- ready: z10.boolean(),
12511
- warnings: z10.array(z10.string()),
12512
- groups: z10.object({
12513
- ready: z10.array(workGraphReadyFrontierTaskSchema),
12514
- blocked: z10.array(workGraphReadyFrontierTaskSchema),
12515
- blockedBy: z10.array(
12516
- z10.discriminatedUnion("kind", [
12517
- z10.object({
12518
- kind: z10.literal("dependency"),
12519
- blockerId: z10.string().min(1),
12520
- blocks: z10.array(z10.string().min(1))
12542
+ omissions: z11.array(workGraphOmissionSchema).optional()
12543
+ });
12544
+ workGraphReadinessParamsSchema = z11.object({
12545
+ rootId: z11.string().min(1),
12546
+ role: z11.string().min(1).optional(),
12547
+ includeGateBlockers: z11.boolean().optional()
12548
+ });
12549
+ workGraphReadinessResultSchema = z11.object({
12550
+ rootId: z11.string().min(1),
12551
+ role: z11.string().min(1).optional(),
12552
+ ready: z11.boolean(),
12553
+ warnings: z11.array(z11.string()),
12554
+ groups: z11.object({
12555
+ ready: z11.array(workGraphReadyFrontierTaskSchema),
12556
+ blocked: z11.array(workGraphReadyFrontierTaskSchema),
12557
+ blockedBy: z11.array(
12558
+ z11.discriminatedUnion("kind", [
12559
+ z11.object({
12560
+ kind: z11.literal("dependency"),
12561
+ blockerId: z11.string().min(1),
12562
+ blocks: z11.array(z11.string().min(1))
12521
12563
  }),
12522
- z10.object({
12523
- kind: z10.literal("gate"),
12564
+ z11.object({
12565
+ kind: z11.literal("gate"),
12524
12566
  gate: verificationGateSchema,
12525
- blocks: z10.array(z10.string().min(1))
12567
+ blocks: z11.array(z11.string().min(1))
12526
12568
  })
12527
12569
  ])
12528
12570
  )
12529
12571
  })
12530
12572
  });
12531
- workGraphContextPackSchema = z10.object({
12532
- rootId: z10.string().min(1),
12533
- generatedAt: z10.string().min(1),
12573
+ workGraphContextPackSchema = z11.object({
12574
+ rootId: z11.string().min(1),
12575
+ generatedAt: z11.string().min(1),
12534
12576
  budget: workGraphContextBudgetSchema,
12535
12577
  slice: workGraphSliceSchema,
12536
- relationEdges: z10.object({
12537
- rootId: z10.string().min(1),
12578
+ relationEdges: z11.object({
12579
+ rootId: z11.string().min(1),
12538
12580
  direction: workGraphEdgeDirectionSchema,
12539
- edges: z10.array(workGraphDirectEdgeSchema)
12581
+ edges: z11.array(workGraphDirectEdgeSchema)
12540
12582
  }).optional(),
12541
12583
  readiness: workGraphReadinessResultSchema.optional(),
12542
- rollup: z10.lazy(() => tasksRollupResultSchema).optional(),
12543
- omissions: z10.array(workGraphOmissionSchema)
12544
- });
12545
- workGraphScaffoldValidateParamsSchema = z10.object({
12546
- rootId: z10.string().min(1),
12547
- nodes: z10.array(
12548
- z10.object({
12549
- id: z10.string().min(1),
12584
+ rollup: z11.lazy(() => tasksRollupResultSchema).optional(),
12585
+ omissions: z11.array(workGraphOmissionSchema)
12586
+ });
12587
+ workGraphScaffoldValidateParamsSchema = z11.object({
12588
+ rootId: z11.string().min(1),
12589
+ nodes: z11.array(
12590
+ z11.object({
12591
+ id: z11.string().min(1),
12550
12592
  type: taskTypeSchema,
12551
- parentId: z10.string().min(1).nullable().optional()
12593
+ parentId: z11.string().min(1).nullable().optional()
12552
12594
  })
12553
12595
  ),
12554
- edges: z10.array(workGraphDirectEdgeSchema).optional(),
12555
- dryRun: z10.boolean().optional()
12556
- });
12557
- workGraphScaffoldValidationIssueSchema = z10.object({
12558
- code: z10.string().min(1),
12559
- message: z10.string().min(1),
12560
- taskId: z10.string().min(1).optional(),
12561
- severity: z10.enum(["error", "warning"])
12562
- });
12563
- workGraphScaffoldValidateResultSchema = z10.object({
12564
- rootId: z10.string().min(1),
12565
- valid: z10.boolean(),
12566
- dryRun: z10.boolean(),
12567
- issues: z10.array(workGraphScaffoldValidationIssueSchema),
12568
- hierarchy: z10.object({
12569
- valid: z10.boolean(),
12570
- violations: z10.array(
12571
- z10.object({
12572
- code: z10.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
12573
- taskId: z10.string().min(1),
12596
+ edges: z11.array(workGraphDirectEdgeSchema).optional(),
12597
+ dryRun: z11.boolean().optional()
12598
+ });
12599
+ workGraphScaffoldValidationIssueSchema = z11.object({
12600
+ code: z11.string().min(1),
12601
+ message: z11.string().min(1),
12602
+ taskId: z11.string().min(1).optional(),
12603
+ severity: z11.enum(["error", "warning"])
12604
+ });
12605
+ workGraphScaffoldValidateResultSchema = z11.object({
12606
+ rootId: z11.string().min(1),
12607
+ valid: z11.boolean(),
12608
+ dryRun: z11.boolean(),
12609
+ issues: z11.array(workGraphScaffoldValidationIssueSchema),
12610
+ hierarchy: z11.object({
12611
+ valid: z11.boolean(),
12612
+ violations: z11.array(
12613
+ z11.object({
12614
+ code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
12615
+ taskId: z11.string().min(1),
12574
12616
  taskType: taskTypeSchema,
12575
- parentId: z10.string().min(1).nullable(),
12617
+ parentId: z11.string().min(1).nullable(),
12576
12618
  parentType: taskTypeSchema.optional(),
12577
- message: z10.string().min(1)
12619
+ message: z11.string().min(1)
12578
12620
  })
12579
12621
  )
12580
12622
  })
12581
12623
  });
12582
12624
  workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
12583
- apply: z10.boolean().optional()
12625
+ apply: z11.boolean().optional()
12584
12626
  });
12585
12627
  workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
12586
- applied: z10.boolean(),
12587
- nodesChanged: z10.number().int().nonnegative(),
12588
- edgesChanged: z10.number().int().nonnegative()
12589
- });
12590
- workGraphPlanningDocParamsSchema = z10.object({
12591
- rootId: z10.string().min(1),
12592
- audience: z10.enum(["agent", "maintainer"]),
12593
- tokenBudget: z10.number().int().positive().optional(),
12594
- includeRelations: z10.boolean().optional(),
12595
- includeReadiness: z10.boolean().optional(),
12596
- includeRollup: z10.boolean().optional()
12597
- });
12598
- workGraphPlanningDocSchema = z10.object({
12599
- rootId: z10.string().min(1),
12600
- generatedAt: z10.string().min(1),
12601
- audience: z10.enum(["agent", "maintainer"]),
12602
- title: z10.string().min(1),
12603
- content: z10.string(),
12604
- sections: z10.array(z10.string().min(1)),
12605
- estimatedTokens: z10.number().int().nonnegative(),
12606
- budget: z10.object({
12607
- tokenBudget: z10.number().int().positive(),
12608
- truncated: z10.boolean()
12628
+ applied: z11.boolean(),
12629
+ nodesChanged: z11.number().int().nonnegative(),
12630
+ edgesChanged: z11.number().int().nonnegative()
12631
+ });
12632
+ workGraphPlanningDocParamsSchema = z11.object({
12633
+ rootId: z11.string().min(1),
12634
+ audience: z11.enum(["agent", "maintainer"]),
12635
+ tokenBudget: z11.number().int().positive().optional(),
12636
+ includeRelations: z11.boolean().optional(),
12637
+ includeReadiness: z11.boolean().optional(),
12638
+ includeRollup: z11.boolean().optional()
12639
+ });
12640
+ workGraphPlanningDocSchema = z11.object({
12641
+ rootId: z11.string().min(1),
12642
+ generatedAt: z11.string().min(1),
12643
+ audience: z11.enum(["agent", "maintainer"]),
12644
+ title: z11.string().min(1),
12645
+ content: z11.string(),
12646
+ sections: z11.array(z11.string().min(1)),
12647
+ estimatedTokens: z11.number().int().nonnegative(),
12648
+ budget: z11.object({
12649
+ tokenBudget: z11.number().int().positive(),
12650
+ truncated: z11.boolean()
12609
12651
  }).optional()
12610
12652
  });
12611
12653
  tasksTraverseParamsSchema = paginationParamsSchema.extend({
12612
- rootId: z10.string().min(1),
12654
+ rootId: z11.string().min(1),
12613
12655
  direction: workGraphTraversalDirectionSchema,
12614
- maxDepth: z10.number().int().nonnegative().optional(),
12615
- includeRelations: z10.boolean().optional()
12656
+ maxDepth: z11.number().int().nonnegative().optional(),
12657
+ includeRelations: z11.boolean().optional()
12616
12658
  });
12617
- tasksTraverseResultSchema = z10.object({
12618
- rootId: z10.string().min(1),
12659
+ tasksTraverseResultSchema = z11.object({
12660
+ rootId: z11.string().min(1),
12619
12661
  direction: workGraphTraversalDirectionSchema,
12620
- nodes: z10.array(workGraphNodeSchema),
12621
- edges: z10.array(workGraphEdgeSchema),
12662
+ nodes: z11.array(workGraphNodeSchema),
12663
+ edges: z11.array(workGraphEdgeSchema),
12622
12664
  pageInfo: workGraphPageInfoSchema
12623
12665
  });
12624
12666
  tasksTreeParamsSchema = paginationParamsSchema.extend({
12625
- rootId: z10.string().min(1),
12626
- maxDepth: z10.number().int().nonnegative().optional()
12667
+ rootId: z11.string().min(1),
12668
+ maxDepth: z11.number().int().nonnegative().optional()
12627
12669
  });
12628
- tasksTreeResultSchema = z10.object({
12629
- rootId: z10.string().min(1),
12630
- nodes: z10.array(workGraphNodeSchema.extend({ depth: z10.number().int().positive() })),
12631
- edges: z10.array(workGraphHierarchyEdgeSchema),
12670
+ tasksTreeResultSchema = z11.object({
12671
+ rootId: z11.string().min(1),
12672
+ nodes: z11.array(workGraphNodeSchema.extend({ depth: z11.number().int().positive() })),
12673
+ edges: z11.array(workGraphHierarchyEdgeSchema),
12632
12674
  pageInfo: workGraphPageInfoSchema
12633
12675
  });
12634
- tasksRollupParamsSchema = z10.object({
12635
- rootId: z10.string().min(1),
12676
+ tasksRollupParamsSchema = z11.object({
12677
+ rootId: z11.string().min(1),
12636
12678
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
12637
12679
  });
12638
- tasksRollupResultSchema = z10.object({
12639
- rootId: z10.string().min(1),
12680
+ tasksRollupResultSchema = z11.object({
12681
+ rootId: z11.string().min(1),
12640
12682
  direct: workGraphRollupCountsSchema,
12641
12683
  subtree: workGraphRollupCountsSchema,
12642
- percentDenominator: z10.object({
12643
- basis: z10.literal("subtree-total"),
12644
- total: z10.number().int().nonnegative(),
12645
- description: z10.string().min(1)
12684
+ percentDenominator: z11.object({
12685
+ basis: z11.literal("subtree-total"),
12686
+ total: z11.number().int().nonnegative(),
12687
+ description: z11.string().min(1)
12646
12688
  }),
12647
12689
  percentages: workGraphSubtreePercentagesSchema,
12648
- staleProjection: z10.boolean(),
12649
- projectionMismatches: z10.array(workGraphProjectionMismatchSchema)
12650
- });
12651
- tasksFrontierParamsSchema = z10.object({
12652
- rootId: z10.string().min(1),
12653
- role: z10.string().min(1).optional()
12654
- });
12655
- tasksFrontierResultSchema = z10.object({
12656
- rootId: z10.string().min(1),
12657
- role: z10.string().min(1).optional(),
12658
- groups: z10.object({
12659
- ready: z10.array(workGraphReadyFrontierTaskSchema),
12660
- blocked: z10.array(workGraphReadyFrontierTaskSchema),
12661
- blockedBy: z10.array(
12662
- z10.discriminatedUnion("kind", [
12663
- z10.object({
12664
- kind: z10.literal("dependency"),
12665
- blockerId: z10.string().min(1),
12666
- blocks: z10.array(z10.string().min(1))
12690
+ staleProjection: z11.boolean(),
12691
+ projectionMismatches: z11.array(workGraphProjectionMismatchSchema)
12692
+ });
12693
+ tasksFrontierParamsSchema = z11.object({
12694
+ rootId: z11.string().min(1),
12695
+ role: z11.string().min(1).optional()
12696
+ });
12697
+ tasksFrontierResultSchema = z11.object({
12698
+ rootId: z11.string().min(1),
12699
+ role: z11.string().min(1).optional(),
12700
+ groups: z11.object({
12701
+ ready: z11.array(workGraphReadyFrontierTaskSchema),
12702
+ blocked: z11.array(workGraphReadyFrontierTaskSchema),
12703
+ blockedBy: z11.array(
12704
+ z11.discriminatedUnion("kind", [
12705
+ z11.object({
12706
+ kind: z11.literal("dependency"),
12707
+ blockerId: z11.string().min(1),
12708
+ blocks: z11.array(z11.string().min(1))
12667
12709
  }),
12668
- z10.object({
12669
- kind: z10.literal("gate"),
12710
+ z11.object({
12711
+ kind: z11.literal("gate"),
12670
12712
  gate: verificationGateSchema,
12671
- blocks: z10.array(z10.string().min(1))
12713
+ blocks: z11.array(z11.string().min(1))
12672
12714
  })
12673
12715
  ])
12674
12716
  )
12675
12717
  })
12676
12718
  });
12677
12719
  tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
12678
- rootId: z10.string().min(1),
12679
- maxDepth: z10.number().int().nonnegative().optional(),
12680
- includeRelations: z10.boolean().optional()
12681
- });
12682
- tasksWorkGraphAuditResultSchema = z10.object({
12683
- rootId: z10.string().min(1),
12684
- hierarchy: z10.object({
12685
- valid: z10.boolean(),
12686
- violations: z10.array(
12687
- z10.object({
12688
- code: z10.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
12689
- taskId: z10.string().min(1),
12720
+ rootId: z11.string().min(1),
12721
+ maxDepth: z11.number().int().nonnegative().optional(),
12722
+ includeRelations: z11.boolean().optional()
12723
+ });
12724
+ tasksWorkGraphAuditResultSchema = z11.object({
12725
+ rootId: z11.string().min(1),
12726
+ hierarchy: z11.object({
12727
+ valid: z11.boolean(),
12728
+ violations: z11.array(
12729
+ z11.object({
12730
+ code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
12731
+ taskId: z11.string().min(1),
12690
12732
  taskType: taskTypeSchema,
12691
- parentId: z10.string().min(1).nullable(),
12733
+ parentId: z11.string().min(1).nullable(),
12692
12734
  parentType: taskTypeSchema.optional(),
12693
- message: z10.string().min(1)
12735
+ message: z11.string().min(1)
12694
12736
  })
12695
12737
  )
12696
12738
  }),
12697
12739
  traversal: tasksTraverseResultSchema,
12698
12740
  frontier: tasksFrontierResultSchema,
12699
12741
  rollup: tasksRollupResultSchema,
12700
- relationEdges: z10.object({
12701
- rootId: z10.string().min(1),
12742
+ relationEdges: z11.object({
12743
+ rootId: z11.string().min(1),
12702
12744
  direction: workGraphEdgeDirectionSchema,
12703
- edges: z10.array(
12704
- z10.discriminatedUnion("source", [
12745
+ edges: z11.array(
12746
+ z11.discriminatedUnion("source", [
12705
12747
  workGraphRelationEdgeSchema,
12706
12748
  workGraphDependencyEdgeSchema
12707
12749
  ])
@@ -13083,31 +13125,31 @@ var init_peer = __esm({
13083
13125
  });
13084
13126
 
13085
13127
  // packages/contracts/src/release/evidence-atoms.ts
13086
- import { z as z11 } from "zod";
13128
+ import { z as z12 } from "zod";
13087
13129
  var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
13088
13130
  var init_evidence_atoms = __esm({
13089
13131
  "packages/contracts/src/release/evidence-atoms.ts"() {
13090
13132
  "use strict";
13091
- parsedPrEvidenceAtomSchema = z11.object({
13092
- kind: z11.literal("pr"),
13093
- prNumber: z11.number().int().positive()
13094
- });
13095
- prEvidenceStateModifierSchema = z11.object({
13096
- kind: z11.literal("state"),
13097
- value: z11.literal("MERGED")
13098
- });
13099
- ghPrViewSchema = z11.object({
13100
- state: z11.enum(["OPEN", "CLOSED", "MERGED"]),
13101
- mergedAt: z11.string().nullable(),
13102
- headRefOid: z11.string().optional(),
13103
- mergeable: z11.string().optional(),
13104
- statusCheckRollup: z11.array(
13105
- z11.object({
13106
- __typename: z11.string().optional(),
13107
- name: z11.string().optional(),
13108
- workflowName: z11.string().optional(),
13109
- conclusion: z11.string().nullable().optional(),
13110
- status: z11.string().optional()
13133
+ parsedPrEvidenceAtomSchema = z12.object({
13134
+ kind: z12.literal("pr"),
13135
+ prNumber: z12.number().int().positive()
13136
+ });
13137
+ prEvidenceStateModifierSchema = z12.object({
13138
+ kind: z12.literal("state"),
13139
+ value: z12.literal("MERGED")
13140
+ });
13141
+ ghPrViewSchema = z12.object({
13142
+ state: z12.enum(["OPEN", "CLOSED", "MERGED"]),
13143
+ mergedAt: z12.string().nullable(),
13144
+ headRefOid: z12.string().optional(),
13145
+ mergeable: z12.string().optional(),
13146
+ statusCheckRollup: z12.array(
13147
+ z12.object({
13148
+ __typename: z12.string().optional(),
13149
+ name: z12.string().optional(),
13150
+ workflowName: z12.string().optional(),
13151
+ conclusion: z12.string().nullable().optional(),
13152
+ status: z12.string().optional()
13111
13153
  }).passthrough()
13112
13154
  ).optional().default([])
13113
13155
  }).passthrough();
@@ -13120,7 +13162,7 @@ var init_evidence_atoms = __esm({
13120
13162
  });
13121
13163
 
13122
13164
  // packages/contracts/src/release/plan.ts
13123
- import { z as z12 } from "zod";
13165
+ import { z as z13 } from "zod";
13124
13166
  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;
13125
13167
  var init_plan = __esm({
13126
13168
  "packages/contracts/src/release/plan.ts"() {
@@ -13163,20 +13205,20 @@ var init_plan = __esm({
13163
13205
  ];
13164
13206
  IMPACT = ["major", "minor", "patch"];
13165
13207
  RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
13166
- ReleaseChannelSchema = z12.enum(RELEASE_CHANNEL);
13167
- ReleaseSchemeSchema = z12.enum(RELEASE_SCHEME);
13168
- ReleaseKindSchema = z12.enum(RELEASE_KIND);
13169
- ReleaseStatusSchema = z12.enum(RELEASE_STATUS);
13170
- GateStatusSchema = z12.enum(GATE_STATUS);
13171
- GateNameSchema = z12.enum(GATE_NAME);
13172
- PlatformTupleSchema = z12.enum(PLATFORM_TUPLE);
13173
- PublisherSchema = z12.enum(PUBLISHER);
13174
- TaskKindSchema = z12.enum(TASK_KIND);
13175
- ImpactSchema = z12.enum(IMPACT);
13176
- ResolvedSourceSchema = z12.enum(RESOLVED_SOURCE);
13177
- Iso8601 = z12.iso.datetime({ offset: true });
13178
- NonEmptyString = z12.string().min(1);
13179
- ReleasePlanTaskSchema = z12.object({
13208
+ ReleaseChannelSchema = z13.enum(RELEASE_CHANNEL);
13209
+ ReleaseSchemeSchema = z13.enum(RELEASE_SCHEME);
13210
+ ReleaseKindSchema = z13.enum(RELEASE_KIND);
13211
+ ReleaseStatusSchema = z13.enum(RELEASE_STATUS);
13212
+ GateStatusSchema = z13.enum(GATE_STATUS);
13213
+ GateNameSchema = z13.enum(GATE_NAME);
13214
+ PlatformTupleSchema = z13.enum(PLATFORM_TUPLE);
13215
+ PublisherSchema = z13.enum(PUBLISHER);
13216
+ TaskKindSchema = z13.enum(TASK_KIND);
13217
+ ImpactSchema = z13.enum(IMPACT);
13218
+ ResolvedSourceSchema = z13.enum(RESOLVED_SOURCE);
13219
+ Iso8601 = z13.iso.datetime({ offset: true });
13220
+ NonEmptyString = z13.string().min(1);
13221
+ ReleasePlanTaskSchema = z13.object({
13180
13222
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
13181
13223
  id: NonEmptyString,
13182
13224
  /** Conventional-commit-aligned task classification. */
@@ -13184,20 +13226,20 @@ var init_plan = __esm({
13184
13226
  /** SemVer impact classification. */
13185
13227
  impact: ImpactSchema,
13186
13228
  /** Human-readable changelog line for this task. */
13187
- userFacingSummary: z12.string(),
13229
+ userFacingSummary: z13.string(),
13188
13230
  /**
13189
13231
  * ADR-051 evidence atoms attesting the task's gate results. Format is
13190
13232
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
13191
13233
  * accepts empty arrays so legacy plans validate; `cleo release plan`
13192
13234
  * enforces non-empty via R-301.
13193
13235
  */
13194
- evidenceAtoms: z12.array(NonEmptyString),
13236
+ evidenceAtoms: z13.array(NonEmptyString),
13195
13237
  /** IVTR phase at plan time — informational only per R-316. */
13196
- ivtrPhaseAtPlan: z12.string().optional(),
13238
+ ivtrPhaseAtPlan: z13.string().optional(),
13197
13239
  /** Epic this task rolls up to, locked at plan time per R-303. */
13198
13240
  epicAncestor: NonEmptyString
13199
13241
  });
13200
- ReleaseGateSchema = z12.object({
13242
+ ReleaseGateSchema = z13.object({
13201
13243
  /** Canonical gate name. */
13202
13244
  name: GateNameSchema,
13203
13245
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -13207,11 +13249,11 @@ var init_plan = __esm({
13207
13249
  /** ISO-8601 timestamp the gate was last verified. */
13208
13250
  lastVerifiedAt: Iso8601,
13209
13251
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
13210
- resolvedCommand: z12.string().optional(),
13252
+ resolvedCommand: z13.string().optional(),
13211
13253
  /** Provenance of the resolved command. Optional for unresolved gates. */
13212
13254
  resolvedSource: ResolvedSourceSchema.optional()
13213
13255
  });
13214
- ReleasePlatformMatrixEntrySchema = z12.object({
13256
+ ReleasePlatformMatrixEntrySchema = z13.object({
13215
13257
  /** Target platform tuple. */
13216
13258
  platform: PlatformTupleSchema,
13217
13259
  /** Distribution backend. */
@@ -13219,47 +13261,47 @@ var init_plan = __esm({
13219
13261
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
13220
13262
  package: NonEmptyString,
13221
13263
  /** Whether to run the GHA smoke job for this matrix entry. */
13222
- smoke: z12.boolean().default(true).optional()
13264
+ smoke: z13.boolean().default(true).optional()
13223
13265
  });
13224
- ReleasePreflightSummarySchema = z12.object({
13266
+ ReleasePreflightSummarySchema = z13.object({
13225
13267
  /** True if esbuild externals are out of sync with package.json. */
13226
- esbuildExternalsDrift: z12.boolean(),
13268
+ esbuildExternalsDrift: z13.boolean(),
13227
13269
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
13228
- lockfileDrift: z12.boolean(),
13270
+ lockfileDrift: z13.boolean(),
13229
13271
  /** True if all epic children are in terminal lifecycle states. */
13230
- epicCompletenessClean: z12.boolean(),
13272
+ epicCompletenessClean: z13.boolean(),
13231
13273
  /** True if no task appears in multiple in-flight release plans. */
13232
- doubleListingClean: z12.boolean(),
13274
+ doubleListingClean: z13.boolean(),
13233
13275
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
13234
- preflightWarnings: z12.array(z12.string()).default([]).optional()
13276
+ preflightWarnings: z13.array(z13.string()).default([]).optional()
13235
13277
  });
13236
- ReleasePlanChangelogSchema = z12.object({
13278
+ ReleasePlanChangelogSchema = z13.object({
13237
13279
  /** `kind=feat` tasks. */
13238
- features: z12.array(NonEmptyString).default([]),
13280
+ features: z13.array(NonEmptyString).default([]),
13239
13281
  /** `kind=fix` or `kind=hotfix` tasks. */
13240
- fixes: z12.array(NonEmptyString).default([]),
13282
+ fixes: z13.array(NonEmptyString).default([]),
13241
13283
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
13242
- chores: z12.array(NonEmptyString).default([]),
13284
+ chores: z13.array(NonEmptyString).default([]),
13243
13285
  /** `kind=breaking` or `kind=revert` tasks. */
13244
- breaking: z12.array(NonEmptyString).default([])
13286
+ breaking: z13.array(NonEmptyString).default([])
13245
13287
  });
13246
- ReleasePlanMetaSchema = z12.object({
13288
+ ReleasePlanMetaSchema = z13.object({
13247
13289
  /** True if this is the project's first ever release. */
13248
- firstEverRelease: z12.boolean().optional(),
13290
+ firstEverRelease: z13.boolean().optional(),
13249
13291
  /** Canonical tool names that could not be resolved at plan time. */
13250
- unresolvedTools: z12.array(z12.string()).optional(),
13292
+ unresolvedTools: z13.array(z13.string()).optional(),
13251
13293
  /** Project archetype detected at plan time. */
13252
- archetype: z12.string().optional()
13253
- }).catchall(z12.unknown());
13254
- ReleasePlanSchema = z12.object({
13294
+ archetype: z13.string().optional()
13295
+ }).catchall(z13.unknown());
13296
+ ReleasePlanSchema = z13.object({
13255
13297
  /** Schema URL for this plan version. */
13256
- $schema: z12.string().optional(),
13298
+ $schema: z13.string().optional(),
13257
13299
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
13258
13300
  version: NonEmptyString,
13259
13301
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
13260
13302
  resolvedVersion: NonEmptyString,
13261
13303
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
13262
- suffixApplied: z12.boolean(),
13304
+ suffixApplied: z13.boolean(),
13263
13305
  /** Versioning scheme governing `version` / `resolvedVersion`. */
13264
13306
  scheme: ReleaseSchemeSchema,
13265
13307
  /** npm dist-tag channel for this release. */
@@ -13276,27 +13318,27 @@ var init_plan = __esm({
13276
13318
  * Version of the previous release on the same channel. MUST be `null` only
13277
13319
  * for first-ever releases (R-300, enforced at the verb layer).
13278
13320
  */
13279
- previousVersion: z12.string().nullable(),
13321
+ previousVersion: z13.string().nullable(),
13280
13322
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
13281
- previousTag: z12.string().nullable(),
13323
+ previousTag: z13.string().nullable(),
13282
13324
  /** ISO-8601 timestamp the previous release was published. */
13283
13325
  previousShippedAt: Iso8601.nullable(),
13284
13326
  /** Tasks rolled into this release. */
13285
- tasks: z12.array(ReleasePlanTaskSchema),
13327
+ tasks: z13.array(ReleasePlanTaskSchema),
13286
13328
  /** Bucketed changelog. */
13287
13329
  changelog: ReleasePlanChangelogSchema,
13288
13330
  /** Per-gate verification status. */
13289
- gates: z12.array(ReleaseGateSchema),
13331
+ gates: z13.array(ReleaseGateSchema),
13290
13332
  /** Platform / publisher matrix. */
13291
- platformMatrix: z12.array(ReleasePlatformMatrixEntrySchema),
13333
+ platformMatrix: z13.array(ReleasePlatformMatrixEntrySchema),
13292
13334
  /** Preflight summary from `cleo release plan`. */
13293
13335
  preflightSummary: ReleasePreflightSummarySchema,
13294
13336
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
13295
- workflowRunUrl: z12.string().nullable(),
13337
+ workflowRunUrl: z13.string().nullable(),
13296
13338
  /** URL of the bump PR (populated by `cleo release open`). */
13297
- prUrl: z12.string().nullable(),
13339
+ prUrl: z13.string().nullable(),
13298
13340
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
13299
- mergeCommitSha: z12.string().nullable(),
13341
+ mergeCommitSha: z13.string().nullable(),
13300
13342
  /** Current FSM state per R-302. */
13301
13343
  status: ReleaseStatusSchema,
13302
13344
  /** Informational / forward-compat metadata. */
@@ -13352,52 +13394,52 @@ var init_session2 = __esm({
13352
13394
  });
13353
13395
 
13354
13396
  // packages/contracts/src/session-journal.ts
13355
- import { z as z13 } from "zod";
13397
+ import { z as z14 } from "zod";
13356
13398
  var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
13357
13399
  var init_session_journal = __esm({
13358
13400
  "packages/contracts/src/session-journal.ts"() {
13359
13401
  "use strict";
13360
13402
  SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
13361
- sessionJournalDoctorSummarySchema = z13.object({
13403
+ sessionJournalDoctorSummarySchema = z14.object({
13362
13404
  /** `true` when zero noise patterns were detected. */
13363
- isClean: z13.boolean(),
13405
+ isClean: z14.boolean(),
13364
13406
  /** Total number of noise findings across all patterns. */
13365
- findingsCount: z13.number().int().nonnegative(),
13407
+ findingsCount: z14.number().int().nonnegative(),
13366
13408
  /** Pattern names that were detected (empty when isClean). */
13367
- patterns: z13.array(z13.string()),
13409
+ patterns: z14.array(z14.string()),
13368
13410
  /** Total brain entries scanned. `0` = empty or unavailable. */
13369
- totalScanned: z13.number().int().nonnegative()
13411
+ totalScanned: z14.number().int().nonnegative()
13370
13412
  });
13371
- sessionJournalDebriefSummarySchema = z13.object({
13413
+ sessionJournalDebriefSummarySchema = z14.object({
13372
13414
  /** First 200 characters of the session end note (if provided). */
13373
- noteExcerpt: z13.string().max(200).optional(),
13415
+ noteExcerpt: z14.string().max(200).optional(),
13374
13416
  /** Number of tasks completed during the session. */
13375
- tasksCompletedCount: z13.number().int().nonnegative(),
13417
+ tasksCompletedCount: z14.number().int().nonnegative(),
13376
13418
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
13377
- tasksFocused: z13.array(z13.string()).max(5).optional()
13419
+ tasksFocused: z14.array(z14.string()).max(5).optional()
13378
13420
  });
13379
- sessionJournalEntrySchema = z13.object({
13421
+ sessionJournalEntrySchema = z14.object({
13380
13422
  // Identity
13381
13423
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
13382
- schemaVersion: z13.literal(SESSION_JOURNAL_SCHEMA_VERSION),
13424
+ schemaVersion: z14.literal(SESSION_JOURNAL_SCHEMA_VERSION),
13383
13425
  /** ISO 8601 timestamp when the entry was written. */
13384
- timestamp: z13.string(),
13426
+ timestamp: z14.string(),
13385
13427
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
13386
- sessionId: z13.string(),
13428
+ sessionId: z14.string(),
13387
13429
  /** Event type that triggered this journal entry. */
13388
- eventType: z13.enum(["session_start", "session_end", "observation", "decision", "error"]),
13430
+ eventType: z14.enum(["session_start", "session_end", "observation", "decision", "error"]),
13389
13431
  // Session metadata (set on session_start / session_end)
13390
13432
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
13391
- agentIdentifier: z13.string().optional(),
13433
+ agentIdentifier: z14.string().optional(),
13392
13434
  /** Provider adapter ID active for this session. */
13393
- providerId: z13.string().optional(),
13435
+ providerId: z14.string().optional(),
13394
13436
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
13395
- scope: z13.string().optional(),
13437
+ scope: z14.string().optional(),
13396
13438
  // Session-end fields
13397
13439
  /** Duration of the session in seconds (session_end only). */
13398
- duration: z13.number().int().nonnegative().optional(),
13440
+ duration: z14.number().int().nonnegative().optional(),
13399
13441
  /** Task IDs (not titles) completed during the session. */
13400
- tasksCompleted: z13.array(z13.string()).optional(),
13442
+ tasksCompleted: z14.array(z14.string()).optional(),
13401
13443
  // Doctor summary (T1262 absorbed)
13402
13444
  /** Compact result of `scanBrainNoise` run at session-end. */
13403
13445
  doctorSummary: sessionJournalDoctorSummarySchema.optional(),
@@ -13406,7 +13448,7 @@ var init_session_journal = __esm({
13406
13448
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
13407
13449
  // Optional hash chain
13408
13450
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
13409
- prevEntryHash: z13.string().optional()
13451
+ prevEntryHash: z14.string().optional()
13410
13452
  });
13411
13453
  }
13412
13454
  });
@@ -13419,52 +13461,52 @@ var init_task = __esm({
13419
13461
  });
13420
13462
 
13421
13463
  // packages/contracts/src/task-evidence.ts
13422
- import { z as z14 } from "zod";
13464
+ import { z as z15 } from "zod";
13423
13465
  var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
13424
13466
  var init_task_evidence = __esm({
13425
13467
  "packages/contracts/src/task-evidence.ts"() {
13426
13468
  "use strict";
13427
- fileEvidenceSchema = z14.object({
13428
- kind: z14.literal("file"),
13429
- sha256: z14.string().length(64),
13430
- timestamp: z14.string().datetime(),
13431
- path: z14.string().min(1),
13432
- mime: z14.string().optional(),
13433
- description: z14.string().optional()
13434
- });
13435
- logEvidenceSchema = z14.object({
13436
- kind: z14.literal("log"),
13437
- sha256: z14.string().length(64),
13438
- timestamp: z14.string().datetime(),
13439
- source: z14.string().min(1),
13440
- description: z14.string().optional()
13441
- });
13442
- screenshotEvidenceSchema = z14.object({
13443
- kind: z14.literal("screenshot"),
13444
- sha256: z14.string().length(64),
13445
- timestamp: z14.string().datetime(),
13446
- mime: z14.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
13447
- description: z14.string().optional()
13448
- });
13449
- testOutputEvidenceSchema = z14.object({
13450
- kind: z14.literal("test-output"),
13451
- sha256: z14.string().length(64),
13452
- timestamp: z14.string().datetime(),
13453
- passed: z14.number().int().nonnegative(),
13454
- failed: z14.number().int().nonnegative(),
13455
- skipped: z14.number().int().nonnegative(),
13456
- exitCode: z14.number().int(),
13457
- description: z14.string().optional()
13458
- });
13459
- commandOutputEvidenceSchema = z14.object({
13460
- kind: z14.literal("command-output"),
13461
- sha256: z14.string().length(64),
13462
- timestamp: z14.string().datetime(),
13463
- cmd: z14.string().min(1),
13464
- exitCode: z14.number().int(),
13465
- description: z14.string().optional()
13466
- });
13467
- taskEvidenceSchema = z14.discriminatedUnion("kind", [
13469
+ fileEvidenceSchema = z15.object({
13470
+ kind: z15.literal("file"),
13471
+ sha256: z15.string().length(64),
13472
+ timestamp: z15.string().datetime(),
13473
+ path: z15.string().min(1),
13474
+ mime: z15.string().optional(),
13475
+ description: z15.string().optional()
13476
+ });
13477
+ logEvidenceSchema = z15.object({
13478
+ kind: z15.literal("log"),
13479
+ sha256: z15.string().length(64),
13480
+ timestamp: z15.string().datetime(),
13481
+ source: z15.string().min(1),
13482
+ description: z15.string().optional()
13483
+ });
13484
+ screenshotEvidenceSchema = z15.object({
13485
+ kind: z15.literal("screenshot"),
13486
+ sha256: z15.string().length(64),
13487
+ timestamp: z15.string().datetime(),
13488
+ mime: z15.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
13489
+ description: z15.string().optional()
13490
+ });
13491
+ testOutputEvidenceSchema = z15.object({
13492
+ kind: z15.literal("test-output"),
13493
+ sha256: z15.string().length(64),
13494
+ timestamp: z15.string().datetime(),
13495
+ passed: z15.number().int().nonnegative(),
13496
+ failed: z15.number().int().nonnegative(),
13497
+ skipped: z15.number().int().nonnegative(),
13498
+ exitCode: z15.number().int(),
13499
+ description: z15.string().optional()
13500
+ });
13501
+ commandOutputEvidenceSchema = z15.object({
13502
+ kind: z15.literal("command-output"),
13503
+ sha256: z15.string().length(64),
13504
+ timestamp: z15.string().datetime(),
13505
+ cmd: z15.string().min(1),
13506
+ exitCode: z15.number().int(),
13507
+ description: z15.string().optional()
13508
+ });
13509
+ taskEvidenceSchema = z15.discriminatedUnion("kind", [
13468
13510
  fileEvidenceSchema,
13469
13511
  logEvidenceSchema,
13470
13512
  screenshotEvidenceSchema,
@@ -13475,12 +13517,12 @@ var init_task_evidence = __esm({
13475
13517
  });
13476
13518
 
13477
13519
  // packages/contracts/src/tasks/archive.ts
13478
- import { z as z15 } from "zod";
13520
+ import { z as z16 } from "zod";
13479
13521
  var ArchiveReason, ARCHIVE_REASON_VALUES;
13480
13522
  var init_archive = __esm({
13481
13523
  "packages/contracts/src/tasks/archive.ts"() {
13482
13524
  "use strict";
13483
- ArchiveReason = z15.enum([
13525
+ ArchiveReason = z16.enum([
13484
13526
  "verified",
13485
13527
  "reconciled",
13486
13528
  "superseded",
@@ -13493,47 +13535,47 @@ var init_archive = __esm({
13493
13535
  });
13494
13536
 
13495
13537
  // packages/contracts/src/tasks.ts
13496
- import { z as z16 } from "zod";
13538
+ import { z as z17 } from "zod";
13497
13539
  var taskMutationWarningSeveritySchema, taskMutationWarningSchema, taskMutationDryRunSummarySchema, taskMutationTaskRecordSchema, taskMutationEnvelopeSchema, completionTaskStatusSchema, completionCriterionKindSchema, completionCriterionStatusSchema, completionBlockerReasonSchema, completionStaleReasonSchema, completionProjectionRepairErrorCodeSchema, completionCriterionWaiverSchema, completionCriterionReplacementSchema, completionCriterionEvaluationSchema, unsatisfiedCompletionCriterionSchema, completionTotalsSchema, completionContextPackSchema, completionEvaluationSchema, completionExplanationSchema, completionListParamsSchema, completionListResultSchema, completionEvaluateParamsSchema, completionProjectionRepairErrorSchema, completionProjectionRepairParamsSchema, completionProjectionRepairResultSchema;
13498
13540
  var init_tasks2 = __esm({
13499
13541
  "packages/contracts/src/tasks.ts"() {
13500
13542
  "use strict";
13501
13543
  init_status_registry();
13502
- taskMutationWarningSeveritySchema = z16.enum(["info", "warning"]);
13503
- taskMutationWarningSchema = z16.object({
13504
- code: z16.string().min(1),
13505
- message: z16.string().min(1),
13544
+ taskMutationWarningSeveritySchema = z17.enum(["info", "warning"]);
13545
+ taskMutationWarningSchema = z17.object({
13546
+ code: z17.string().min(1),
13547
+ message: z17.string().min(1),
13506
13548
  severity: taskMutationWarningSeveritySchema.optional(),
13507
- taskId: z16.string().min(1).optional(),
13508
- field: z16.string().min(1).optional(),
13509
- index: z16.number().int().nonnegative().optional()
13510
- });
13511
- taskMutationDryRunSummarySchema = z16.object({
13512
- dryRun: z16.literal(true),
13513
- wouldCreate: z16.number().int().nonnegative(),
13514
- wouldUpdate: z16.number().int().nonnegative(),
13515
- wouldDelete: z16.number().int().nonnegative(),
13516
- wouldAffect: z16.number().int().nonnegative(),
13517
- validatedCount: z16.number().int().nonnegative(),
13518
- insertedCount: z16.literal(0),
13519
- updatedCount: z16.literal(0),
13520
- deletedCount: z16.literal(0),
13521
- warnings: z16.array(taskMutationWarningSchema)
13522
- });
13523
- taskMutationTaskRecordSchema = z16.object({ id: z16.string().min(1) }).passthrough();
13524
- taskMutationEnvelopeSchema = z16.object({
13525
- dryRun: z16.boolean().optional(),
13526
- created: z16.array(taskMutationTaskRecordSchema),
13527
- updated: z16.array(taskMutationTaskRecordSchema),
13528
- deleted: z16.array(taskMutationTaskRecordSchema),
13529
- affectedCount: z16.number().int().nonnegative(),
13530
- mutationWarnings: z16.array(taskMutationWarningSchema),
13549
+ taskId: z17.string().min(1).optional(),
13550
+ field: z17.string().min(1).optional(),
13551
+ index: z17.number().int().nonnegative().optional()
13552
+ });
13553
+ taskMutationDryRunSummarySchema = z17.object({
13554
+ dryRun: z17.literal(true),
13555
+ wouldCreate: z17.number().int().nonnegative(),
13556
+ wouldUpdate: z17.number().int().nonnegative(),
13557
+ wouldDelete: z17.number().int().nonnegative(),
13558
+ wouldAffect: z17.number().int().nonnegative(),
13559
+ validatedCount: z17.number().int().nonnegative(),
13560
+ insertedCount: z17.literal(0),
13561
+ updatedCount: z17.literal(0),
13562
+ deletedCount: z17.literal(0),
13563
+ warnings: z17.array(taskMutationWarningSchema)
13564
+ });
13565
+ taskMutationTaskRecordSchema = z17.object({ id: z17.string().min(1) }).passthrough();
13566
+ taskMutationEnvelopeSchema = z17.object({
13567
+ dryRun: z17.boolean().optional(),
13568
+ created: z17.array(taskMutationTaskRecordSchema),
13569
+ updated: z17.array(taskMutationTaskRecordSchema),
13570
+ deleted: z17.array(taskMutationTaskRecordSchema),
13571
+ affectedCount: z17.number().int().nonnegative(),
13572
+ mutationWarnings: z17.array(taskMutationWarningSchema),
13531
13573
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
13532
13574
  });
13533
- completionTaskStatusSchema = z16.enum(TASK_STATUSES);
13534
- completionCriterionKindSchema = z16.enum(["text", "evidence_bound", "child_task"]);
13535
- completionCriterionStatusSchema = z16.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
13536
- completionBlockerReasonSchema = z16.enum([
13575
+ completionTaskStatusSchema = z17.enum(TASK_STATUSES);
13576
+ completionCriterionKindSchema = z17.enum(["text", "evidence_bound", "child_task"]);
13577
+ completionCriterionStatusSchema = z17.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
13578
+ completionBlockerReasonSchema = z17.enum([
13537
13579
  "missing_evidence_binding",
13538
13580
  "child_not_done",
13539
13581
  "child_cancelled_requires_waiver",
@@ -13541,68 +13583,68 @@ var init_tasks2 = __esm({
13541
13583
  "child_missing",
13542
13584
  "done_parent_stale"
13543
13585
  ]);
13544
- completionStaleReasonSchema = z16.enum(["done_parent_has_unsatisfied_criteria"]);
13545
- completionProjectionRepairErrorCodeSchema = z16.enum([
13586
+ completionStaleReasonSchema = z17.enum(["done_parent_has_unsatisfied_criteria"]);
13587
+ completionProjectionRepairErrorCodeSchema = z17.enum([
13546
13588
  "projection_not_stale",
13547
13589
  "criteria_missing",
13548
13590
  "binding_target_missing",
13549
13591
  "repair_conflict"
13550
13592
  ]);
13551
- completionCriterionWaiverSchema = z16.object({
13552
- criterionAcId: z16.string().min(1),
13553
- childTaskId: z16.string().min(1),
13554
- reason: z16.string().min(1),
13555
- actor: z16.string().min(1),
13556
- waivedAt: z16.string().min(1)
13557
- });
13558
- completionCriterionReplacementSchema = z16.object({
13559
- criterionAcId: z16.string().min(1),
13560
- originalChildTaskId: z16.string().min(1),
13561
- replacementChildTaskId: z16.string().min(1),
13562
- reason: z16.string().min(1),
13563
- actor: z16.string().min(1),
13564
- replacedAt: z16.string().min(1)
13565
- });
13566
- completionCriterionEvaluationSchema = z16.object({
13567
- acId: z16.string().min(1),
13568
- alias: z16.string().min(1),
13569
- text: z16.string(),
13593
+ completionCriterionWaiverSchema = z17.object({
13594
+ criterionAcId: z17.string().min(1),
13595
+ childTaskId: z17.string().min(1),
13596
+ reason: z17.string().min(1),
13597
+ actor: z17.string().min(1),
13598
+ waivedAt: z17.string().min(1)
13599
+ });
13600
+ completionCriterionReplacementSchema = z17.object({
13601
+ criterionAcId: z17.string().min(1),
13602
+ originalChildTaskId: z17.string().min(1),
13603
+ replacementChildTaskId: z17.string().min(1),
13604
+ reason: z17.string().min(1),
13605
+ actor: z17.string().min(1),
13606
+ replacedAt: z17.string().min(1)
13607
+ });
13608
+ completionCriterionEvaluationSchema = z17.object({
13609
+ acId: z17.string().min(1),
13610
+ alias: z17.string().min(1),
13611
+ text: z17.string(),
13570
13612
  kind: completionCriterionKindSchema,
13571
13613
  status: completionCriterionStatusSchema,
13572
13614
  reason: completionBlockerReasonSchema.optional(),
13573
- targetTaskId: z16.string().min(1).optional(),
13615
+ targetTaskId: z17.string().min(1).optional(),
13574
13616
  targetTaskStatus: completionTaskStatusSchema.optional(),
13575
13617
  waiver: completionCriterionWaiverSchema.optional(),
13576
13618
  replacement: completionCriterionReplacementSchema.optional(),
13577
13619
  replacementTaskStatus: completionTaskStatusSchema.optional(),
13578
- evidenceBindings: z16.number().int().nonnegative()
13620
+ evidenceBindings: z17.number().int().nonnegative()
13579
13621
  });
13580
13622
  unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
13581
- status: z16.literal("unsatisfied"),
13623
+ status: z17.literal("unsatisfied"),
13582
13624
  reason: completionBlockerReasonSchema
13583
13625
  });
13584
- completionTotalsSchema = z16.object({
13585
- criteria: z16.number().int().nonnegative(),
13586
- satisfied: z16.number().int().nonnegative(),
13587
- unsatisfied: z16.number().int().nonnegative(),
13588
- waived: z16.number().int().nonnegative(),
13589
- replaced: z16.number().int().nonnegative()
13590
- });
13591
- completionContextPackSchema = z16.object({
13592
- taskId: z16.string().min(1),
13593
- generatedAt: z16.string().min(1),
13594
- source: z16.literal("audit_log"),
13595
- window: z16.object({
13596
- limit: z16.number().int().positive(),
13597
- since: z16.string().min(1).optional(),
13598
- relationDepth: z16.number().int().nonnegative(),
13599
- relatedTaskIds: z16.array(z16.string().min(1))
13626
+ completionTotalsSchema = z17.object({
13627
+ criteria: z17.number().int().nonnegative(),
13628
+ satisfied: z17.number().int().nonnegative(),
13629
+ unsatisfied: z17.number().int().nonnegative(),
13630
+ waived: z17.number().int().nonnegative(),
13631
+ replaced: z17.number().int().nonnegative()
13632
+ });
13633
+ completionContextPackSchema = z17.object({
13634
+ taskId: z17.string().min(1),
13635
+ generatedAt: z17.string().min(1),
13636
+ source: z17.literal("audit_log"),
13637
+ window: z17.object({
13638
+ limit: z17.number().int().positive(),
13639
+ since: z17.string().min(1).optional(),
13640
+ relationDepth: z17.number().int().nonnegative(),
13641
+ relatedTaskIds: z17.array(z17.string().min(1))
13600
13642
  }),
13601
- events: z16.array(
13602
- z16.object({
13603
- id: z16.string().min(1),
13604
- timestamp: z16.string().min(1),
13605
- action: z16.enum([
13643
+ events: z17.array(
13644
+ z17.object({
13645
+ id: z17.string().min(1),
13646
+ timestamp: z17.string().min(1),
13647
+ action: z17.enum([
13606
13648
  "task_completed",
13607
13649
  "task_reopened",
13608
13650
  "task_cancelled",
@@ -13610,77 +13652,77 @@ var init_tasks2 = __esm({
13610
13652
  "task_reparented",
13611
13653
  "ac_projection_rebuilt"
13612
13654
  ]),
13613
- taskId: z16.string().min(1),
13614
- relation: z16.enum(["self", "parent", "child", "sibling", "related"]),
13615
- actor: z16.string().min(1),
13616
- details: z16.record(z16.string(), z16.unknown()).optional(),
13617
- before: z16.record(z16.string(), z16.unknown()).optional(),
13618
- after: z16.record(z16.string(), z16.unknown()).optional()
13655
+ taskId: z17.string().min(1),
13656
+ relation: z17.enum(["self", "parent", "child", "sibling", "related"]),
13657
+ actor: z17.string().min(1),
13658
+ details: z17.record(z17.string(), z17.unknown()).optional(),
13659
+ before: z17.record(z17.string(), z17.unknown()).optional(),
13660
+ after: z17.record(z17.string(), z17.unknown()).optional()
13619
13661
  })
13620
13662
  ),
13621
- summary: z16.object({
13622
- totalEvents: z16.number().int().nonnegative(),
13623
- byAction: z16.record(z16.string(), z16.number().int().nonnegative()),
13624
- byRelation: z16.record(z16.string(), z16.number().int().nonnegative()),
13625
- latestEventAt: z16.string().nullable()
13663
+ summary: z17.object({
13664
+ totalEvents: z17.number().int().nonnegative(),
13665
+ byAction: z17.record(z17.string(), z17.number().int().nonnegative()),
13666
+ byRelation: z17.record(z17.string(), z17.number().int().nonnegative()),
13667
+ latestEventAt: z17.string().nullable()
13626
13668
  })
13627
13669
  });
13628
- completionEvaluationSchema = z16.object({
13629
- taskId: z16.string().min(1),
13670
+ completionEvaluationSchema = z17.object({
13671
+ taskId: z17.string().min(1),
13630
13672
  taskStatus: completionTaskStatusSchema,
13631
- ready: z16.boolean(),
13632
- stale: z16.boolean(),
13633
- staleReasons: z16.array(completionStaleReasonSchema),
13673
+ ready: z17.boolean(),
13674
+ stale: z17.boolean(),
13675
+ staleReasons: z17.array(completionStaleReasonSchema),
13634
13676
  contextPack: completionContextPackSchema.optional(),
13635
- satisfied: z16.array(completionCriterionEvaluationSchema),
13636
- unsatisfied: z16.array(unsatisfiedCompletionCriterionSchema),
13637
- waived: z16.array(completionCriterionEvaluationSchema),
13638
- replaced: z16.array(completionCriterionEvaluationSchema),
13677
+ satisfied: z17.array(completionCriterionEvaluationSchema),
13678
+ unsatisfied: z17.array(unsatisfiedCompletionCriterionSchema),
13679
+ waived: z17.array(completionCriterionEvaluationSchema),
13680
+ replaced: z17.array(completionCriterionEvaluationSchema),
13639
13681
  totals: completionTotalsSchema
13640
13682
  });
13641
- completionExplanationSchema = z16.object({
13642
- taskId: z16.string().min(1),
13643
- ready: z16.boolean(),
13644
- stale: z16.boolean(),
13645
- summary: z16.string(),
13683
+ completionExplanationSchema = z17.object({
13684
+ taskId: z17.string().min(1),
13685
+ ready: z17.boolean(),
13686
+ stale: z17.boolean(),
13687
+ summary: z17.string(),
13646
13688
  contextPack: completionContextPackSchema.optional(),
13647
- blockers: z16.array(completionCriterionEvaluationSchema)
13689
+ blockers: z17.array(completionCriterionEvaluationSchema)
13648
13690
  });
13649
- completionListParamsSchema = z16.object({
13650
- taskId: z16.string().min(1),
13691
+ completionListParamsSchema = z17.object({
13692
+ taskId: z17.string().min(1),
13651
13693
  status: completionCriterionStatusSchema.optional(),
13652
13694
  kind: completionCriterionKindSchema.optional()
13653
13695
  });
13654
- completionListResultSchema = z16.object({
13655
- taskId: z16.string().min(1),
13656
- criteria: z16.array(completionCriterionEvaluationSchema),
13696
+ completionListResultSchema = z17.object({
13697
+ taskId: z17.string().min(1),
13698
+ criteria: z17.array(completionCriterionEvaluationSchema),
13657
13699
  totals: completionTotalsSchema
13658
13700
  });
13659
- completionEvaluateParamsSchema = z16.object({
13660
- taskId: z16.string().min(1),
13661
- includeContext: z16.boolean().optional(),
13662
- limit: z16.number().int().positive().optional(),
13663
- since: z16.string().min(1).optional(),
13664
- relationDepth: z16.number().int().nonnegative().optional()
13701
+ completionEvaluateParamsSchema = z17.object({
13702
+ taskId: z17.string().min(1),
13703
+ includeContext: z17.boolean().optional(),
13704
+ limit: z17.number().int().positive().optional(),
13705
+ since: z17.string().min(1).optional(),
13706
+ relationDepth: z17.number().int().nonnegative().optional()
13665
13707
  });
13666
- completionProjectionRepairErrorSchema = z16.object({
13708
+ completionProjectionRepairErrorSchema = z17.object({
13667
13709
  code: completionProjectionRepairErrorCodeSchema,
13668
- message: z16.string().min(1),
13669
- taskId: z16.string().min(1),
13670
- acId: z16.string().min(1).optional(),
13671
- evidenceAtomId: z16.string().min(1).optional()
13710
+ message: z17.string().min(1),
13711
+ taskId: z17.string().min(1),
13712
+ acId: z17.string().min(1).optional(),
13713
+ evidenceAtomId: z17.string().min(1).optional()
13672
13714
  });
13673
- completionProjectionRepairParamsSchema = z16.object({
13674
- taskId: z16.string().min(1),
13675
- dryRun: z16.boolean().optional()
13715
+ completionProjectionRepairParamsSchema = z17.object({
13716
+ taskId: z17.string().min(1),
13717
+ dryRun: z17.boolean().optional()
13676
13718
  });
13677
- completionProjectionRepairResultSchema = z16.object({
13678
- taskId: z16.string().min(1),
13679
- repaired: z16.boolean(),
13680
- dryRun: z16.boolean(),
13681
- staleBefore: z16.boolean(),
13682
- staleAfter: z16.boolean(),
13683
- errors: z16.array(completionProjectionRepairErrorSchema)
13719
+ completionProjectionRepairResultSchema = z17.object({
13720
+ taskId: z17.string().min(1),
13721
+ repaired: z17.boolean(),
13722
+ dryRun: z17.boolean(),
13723
+ staleBefore: z17.boolean(),
13724
+ staleAfter: z17.boolean(),
13725
+ errors: z17.array(completionProjectionRepairErrorSchema)
13684
13726
  });
13685
13727
  }
13686
13728
  });
@@ -14191,7 +14233,7 @@ var init_taxonomy = __esm({
14191
14233
  });
14192
14234
 
14193
14235
  // packages/contracts/src/templates/manifest.ts
14194
- import { z as z17 } from "zod";
14236
+ import { z as z18 } from "zod";
14195
14237
  var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
14196
14238
  var init_manifest2 = __esm({
14197
14239
  "packages/contracts/src/templates/manifest.ts"() {
@@ -14212,85 +14254,85 @@ var init_manifest2 = __esm({
14212
14254
  "tool-resolver",
14213
14255
  "literal"
14214
14256
  ];
14215
- PlaceholderSpecSchema = z17.object({
14257
+ PlaceholderSpecSchema = z18.object({
14216
14258
  /**
14217
14259
  * Placeholder identifier as it appears in the template body
14218
14260
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
14219
14261
  */
14220
- name: z17.string().min(1, "placeholder name must be non-empty"),
14262
+ name: z18.string().min(1, "placeholder name must be non-empty"),
14221
14263
  /** Resolver source the installer consults for this placeholder. */
14222
- source: z17.enum(PLACEHOLDER_SOURCES),
14264
+ source: z18.enum(PLACEHOLDER_SOURCES),
14223
14265
  /**
14224
14266
  * Path expression evaluated against `source` (e.g. `engines.node` against
14225
14267
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
14226
14268
  * For `literal` source, this MAY be the literal value's identifier.
14227
14269
  */
14228
- sourcePath: z17.string().min(1, "placeholder sourcePath must be non-empty"),
14270
+ sourcePath: z18.string().min(1, "placeholder sourcePath must be non-empty"),
14229
14271
  /**
14230
14272
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
14231
14273
  * `null` is permitted to explicitly mark "no default — failure required".
14232
14274
  */
14233
- defaultValue: z17.union([z17.string(), z17.number(), z17.boolean(), z17.null()]).optional()
14275
+ defaultValue: z18.union([z18.string(), z18.number(), z18.boolean(), z18.null()]).optional()
14234
14276
  });
14235
- TemplateManifestEntrySchema = z17.object({
14277
+ TemplateManifestEntrySchema = z18.object({
14236
14278
  /** Stable identifier for this template entry. */
14237
- id: z17.string().min(1, "id must be non-empty"),
14279
+ id: z18.string().min(1, "id must be non-empty"),
14238
14280
  /** Category of file this template represents. */
14239
- kind: z17.enum(TEMPLATE_KINDS),
14281
+ kind: z18.enum(TEMPLATE_KINDS),
14240
14282
  /** Repo-relative path of the template source file. */
14241
- sourcePath: z17.string().min(1, "sourcePath must be non-empty"),
14283
+ sourcePath: z18.string().min(1, "sourcePath must be non-empty"),
14242
14284
  /** Project-relative path where the rendered template installs. */
14243
- installPath: z17.string().min(1, "installPath must be non-empty"),
14285
+ installPath: z18.string().min(1, "installPath must be non-empty"),
14244
14286
  /** Substitution strategy the installer applies to `sourcePath`. */
14245
- substitution: z17.enum(TEMPLATE_SUBSTITUTIONS),
14287
+ substitution: z18.enum(TEMPLATE_SUBSTITUTIONS),
14246
14288
  /** Declared placeholders this template requires. May be empty. */
14247
- placeholders: z17.array(PlaceholderSpecSchema),
14289
+ placeholders: z18.array(PlaceholderSpecSchema),
14248
14290
  /** Reconciliation policy on upgrade. */
14249
- updateStrategy: z17.enum(TEMPLATE_UPDATE_STRATEGIES)
14291
+ updateStrategy: z18.enum(TEMPLATE_UPDATE_STRATEGIES)
14250
14292
  });
14251
14293
  }
14252
14294
  });
14253
14295
 
14254
14296
  // packages/contracts/src/validator/index.ts
14255
- import { z as z18 } from "zod";
14297
+ import { z as z19 } from "zod";
14256
14298
  var VALIDATOR_ID_REGEX, validatorFindingSchema, validatorAttestationSchema, validatorRejectionSchema, validatorVerdictSchema;
14257
14299
  var init_validator = __esm({
14258
14300
  "packages/contracts/src/validator/index.ts"() {
14259
14301
  "use strict";
14260
14302
  VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
14261
- validatorFindingSchema = z18.object({
14262
- acId: z18.string().min(1, "acId must be non-empty"),
14263
- status: z18.enum(["pass", "fail", "inconclusive"]),
14264
- reasoning: z18.string().min(1, "reasoning must be non-empty"),
14265
- evidenceRefs: z18.array(z18.string()).optional(),
14266
- checkedAt: z18.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
14267
- });
14268
- validatorAttestationSchema = z18.object({
14269
- verdict: z18.literal("attest"),
14270
- taskId: z18.string().min(1),
14271
- validatorId: z18.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
14272
- findings: z18.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
14303
+ validatorFindingSchema = z19.object({
14304
+ acId: z19.string().min(1, "acId must be non-empty"),
14305
+ status: z19.enum(["pass", "fail", "inconclusive"]),
14306
+ reasoning: z19.string().min(1, "reasoning must be non-empty"),
14307
+ evidenceRefs: z19.array(z19.string()).optional(),
14308
+ checkedAt: z19.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
14309
+ });
14310
+ validatorAttestationSchema = z19.object({
14311
+ verdict: z19.literal("attest"),
14312
+ taskId: z19.string().min(1),
14313
+ validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
14314
+ findings: z19.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
14273
14315
  (findings) => findings.every((f) => f.status === "pass"),
14274
14316
  'attestation requires every finding to have status="pass"'
14275
14317
  ),
14276
- summary: z18.string().optional(),
14277
- attestedAt: z18.string().min(1),
14278
- schemaVersion: z18.literal("1")
14279
- });
14280
- validatorRejectionSchema = z18.object({
14281
- verdict: z18.literal("reject"),
14282
- taskId: z18.string().min(1),
14283
- validatorId: z18.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
14284
- findings: z18.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
14318
+ summary: z19.string().optional(),
14319
+ attestedAt: z19.string().min(1),
14320
+ schemaVersion: z19.literal("1")
14321
+ });
14322
+ validatorRejectionSchema = z19.object({
14323
+ verdict: z19.literal("reject"),
14324
+ taskId: z19.string().min(1),
14325
+ validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
14326
+ findings: z19.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
14285
14327
  (findings) => findings.some((f) => f.status !== "pass"),
14286
14328
  'rejection requires at least one finding with status "fail" or "inconclusive"'
14287
14329
  ),
14288
- summary: z18.string().min(1, "rejection summary must be non-empty"),
14289
- remediationHints: z18.array(z18.string()).optional(),
14290
- rejectedAt: z18.string().min(1),
14291
- schemaVersion: z18.literal("1")
14330
+ summary: z19.string().min(1, "rejection summary must be non-empty"),
14331
+ remediationHints: z19.array(z19.string()).optional(),
14332
+ rejectedAt: z19.string().min(1),
14333
+ schemaVersion: z19.literal("1")
14292
14334
  });
14293
- validatorVerdictSchema = z18.discriminatedUnion("verdict", [
14335
+ validatorVerdictSchema = z19.discriminatedUnion("verdict", [
14294
14336
  validatorAttestationSchema,
14295
14337
  validatorRejectionSchema
14296
14338
  ]);
@@ -14314,6 +14356,7 @@ var init_src2 = __esm({
14314
14356
  init_identity();
14315
14357
  init_operations_registry();
14316
14358
  init_provenance();
14359
+ init_read();
14317
14360
  init_docs_taxonomy();
14318
14361
  init_engine_result();
14319
14362
  init_enums();
@@ -19190,6 +19233,7 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19190
19233
  ownerId,
19191
19234
  file: filePath,
19192
19235
  url,
19236
+ content: inlineContent,
19193
19237
  desc: description,
19194
19238
  labels: rawLabels,
19195
19239
  attachedBy: rawAttachedBy,
@@ -19201,13 +19245,23 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19201
19245
  if (!ownerId) {
19202
19246
  return lafsError("E_INVALID_INPUT", "ownerId is required", "add");
19203
19247
  }
19204
- if (!filePath && !url) {
19248
+ const hasContent = typeof inlineContent === "string";
19249
+ const sourceCount = (filePath ? 1 : 0) + (url ? 1 : 0) + (hasContent ? 1 : 0);
19250
+ if (sourceCount === 0) {
19205
19251
  return lafsError(
19206
19252
  "E_INVALID_INPUT",
19207
- "Provide either a file path (positional or --file) or --url",
19253
+ "Provide a file path (positional or --file), --url, or --content <text>",
19208
19254
  "add"
19209
19255
  );
19210
19256
  }
19257
+ if (sourceCount > 1) {
19258
+ return lafsError(
19259
+ "E_INVALID_INPUT",
19260
+ "--file, --url, and --content are mutually exclusive \u2014 provide exactly one source",
19261
+ "add",
19262
+ 'Use `cleo docs add <owner> ./file.md` OR `--url <url>` OR `--content "<text>"` (not more than one).'
19263
+ );
19264
+ }
19211
19265
  let slug;
19212
19266
  if (rawSlug !== void 0) {
19213
19267
  let candidate = rawSlug;
@@ -19544,6 +19598,126 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19544
19598
  "add"
19545
19599
  );
19546
19600
  }
19601
+ if (hasContent) {
19602
+ const bytes = Buffer.from(inlineContent, "utf-8");
19603
+ if (type2 !== void 0) {
19604
+ let registry;
19605
+ try {
19606
+ registry = DocKindRegistry.load(getProjectRoot5());
19607
+ } catch {
19608
+ registry = void 0;
19609
+ }
19610
+ const check = validateDocBody(type2, inlineContent, registry);
19611
+ if (!check.ok) {
19612
+ const missingList = check.missing.join(", ");
19613
+ if (strictMode === true) {
19614
+ if (slug !== void 0) releaseReservedSlug(slug);
19615
+ return lafsError(
19616
+ "E_DOC_SCHEMA_MISMATCH",
19617
+ `body for kind '${type2}' is missing required section(s): ${missingList}`,
19618
+ "add",
19619
+ `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.`,
19620
+ { kind: type2, missing: check.missing, strict: true }
19621
+ );
19622
+ }
19623
+ pushWarning({
19624
+ code: "W_DOC_SCHEMA_MISMATCH",
19625
+ message: `body for kind '${type2}' is missing required section(s): ${missingList}. Add '--strict' to fail on schema violations.`
19626
+ });
19627
+ }
19628
+ }
19629
+ const mime = "text/markdown";
19630
+ const attachment = {
19631
+ kind: "blob",
19632
+ mime,
19633
+ ...description ? { description } : {},
19634
+ ...labels ? { labels } : {}
19635
+ };
19636
+ let meta;
19637
+ try {
19638
+ meta = await store.put(
19639
+ bytes,
19640
+ attachment,
19641
+ ownerType,
19642
+ ownerId,
19643
+ attachedBy,
19644
+ void 0,
19645
+ extras
19646
+ );
19647
+ } catch (err) {
19648
+ if (slug !== void 0) releaseReservedSlug(slug);
19649
+ if (err instanceof SlugCollisionError) {
19650
+ return {
19651
+ success: false,
19652
+ error: {
19653
+ code: "E_SLUG_RESERVED",
19654
+ message: SLUG_COLLISION_GUIDANCE.replaceAll("{slug}", err.slug ?? ""),
19655
+ fix: `cleo docs update ${err.slug ?? "<slug>"} --content "..."`,
19656
+ details: {
19657
+ suggestions: err.suggestions,
19658
+ aliases: ["E_SLUG_TAKEN"]
19659
+ }
19660
+ }
19661
+ };
19662
+ }
19663
+ throw err;
19664
+ }
19665
+ if (adrNumber !== void 0 && slug !== void 0) consumeReservedSlug(slug);
19666
+ const blobName = slug ?? meta.sha256.slice(0, 12);
19667
+ let backend = "llmtxt";
19668
+ try {
19669
+ const blobMirror = createAttachmentBlobStore(getProjectRoot5());
19670
+ const mirrorResult = await blobMirror.put(ownerId, {
19671
+ name: blobName,
19672
+ data: new Uint8Array(bytes),
19673
+ contentType: mime
19674
+ });
19675
+ backend = mirrorResult.backend;
19676
+ } catch {
19677
+ backend = await currentAttachmentBackend();
19678
+ }
19679
+ import("@cleocode/core/internal").then(
19680
+ ({ ensureLlmtxtNode }) => ensureLlmtxtNode(getProjectRoot5(), meta.sha256, `${ownerType}:${ownerId}`, blobName)
19681
+ ).catch(() => {
19682
+ });
19683
+ const contentPayload = {
19684
+ kind: "doc-attachment",
19685
+ attachmentId: meta.id,
19686
+ ownerId,
19687
+ addedAt: (/* @__PURE__ */ new Date()).toISOString(),
19688
+ ...slug !== void 0 ? { slug } : {},
19689
+ ...type2 !== void 0 ? { type: type2 } : {}
19690
+ };
19691
+ emitDocAttachmentObservation(contentPayload, getProjectRoot5());
19692
+ try {
19693
+ writeAuditEntry(getProjectRoot5(), {
19694
+ op: "docs.add",
19695
+ slug,
19696
+ type: type2,
19697
+ attachmentId: meta.id,
19698
+ sha256: meta.sha256,
19699
+ ownerId,
19700
+ summary: `Added inline doc '${slug ?? meta.sha256.slice(0, 12)}'${type2 ? ` of type '${type2}'` : ""} for owner ${ownerId}`
19701
+ });
19702
+ } catch {
19703
+ }
19704
+ return lafsSuccess(
19705
+ {
19706
+ attachmentId: meta.id,
19707
+ sha256: meta.sha256,
19708
+ refCount: meta.refCount,
19709
+ kind: "blob",
19710
+ ownerId,
19711
+ ownerType,
19712
+ // Cast: core returns 'llmtxt'|'legacy'; contracts uses 'legacy'|'llmstxt-v2' (T1529)
19713
+ attachmentBackend: backend,
19714
+ ...slug !== void 0 ? { slug } : {},
19715
+ ...type2 !== void 0 ? { type: type2 } : {},
19716
+ ...adrNumber !== void 0 ? { adrNumber } : {}
19717
+ },
19718
+ "add"
19719
+ );
19720
+ }
19547
19721
  if (url) {
19548
19722
  const attachment = {
19549
19723
  kind: "url",
@@ -28233,8 +28407,8 @@ async function loadPlaybookByName(name) {
28233
28407
  return null;
28234
28408
  }
28235
28409
  try {
28236
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28237
- const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot58();
28410
+ const { getProjectRoot: getProjectRoot59 } = await import("@cleocode/core/internal");
28411
+ const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot59();
28238
28412
  const resolved = resolvePlaybook(name, {
28239
28413
  projectRoot,
28240
28414
  globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
@@ -28278,8 +28452,8 @@ async function acquireDb() {
28278
28452
  async function buildDefaultDispatcher() {
28279
28453
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
28280
28454
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await import("@cleocode/runtime/gateway");
28281
- const { getProjectRoot: getProjectRoot58, createToolGuard, runSkillNodeOrSpawn } = await import("@cleocode/core/internal");
28282
- const projectRoot = getProjectRoot58();
28455
+ const { getProjectRoot: getProjectRoot59, createToolGuard, runSkillNodeOrSpawn } = await import("@cleocode/core/internal");
28456
+ const projectRoot = getProjectRoot59();
28283
28457
  const tools = createToolGuard({ allowedRoots: [projectRoot] });
28284
28458
  const spawn5 = async (input2) => {
28285
28459
  const result = await orchestrateSpawnExecute2(
@@ -28476,8 +28650,8 @@ var init_playbook2 = __esm({
28476
28650
  projectRoot = __playbookRuntimeOverrides.projectRoot;
28477
28651
  } else {
28478
28652
  try {
28479
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28480
- projectRoot = getProjectRoot58();
28653
+ const { getProjectRoot: getProjectRoot59 } = await import("@cleocode/core/internal");
28654
+ projectRoot = getProjectRoot59();
28481
28655
  } catch {
28482
28656
  projectRoot = void 0;
28483
28657
  }
@@ -28541,14 +28715,14 @@ var init_playbook2 = __esm({
28541
28715
  const dispatcher = await buildDefaultDispatcher();
28542
28716
  let result;
28543
28717
  try {
28544
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28718
+ const { getProjectRoot: getProjectRoot59 } = await import("@cleocode/core/internal");
28545
28719
  const opts = {
28546
28720
  db,
28547
28721
  playbook: parsed.definition,
28548
28722
  playbookHash: parsed.sourceHash,
28549
28723
  initialContext,
28550
28724
  dispatcher,
28551
- projectRoot: getProjectRoot58()
28725
+ projectRoot: getProjectRoot59()
28552
28726
  };
28553
28727
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
28554
28728
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -35258,11 +35432,11 @@ var init_security = __esm({
35258
35432
  });
35259
35433
 
35260
35434
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
35261
- function createSanitizer(getProjectRoot58) {
35435
+ function createSanitizer(getProjectRoot59) {
35262
35436
  return async (req, next) => {
35263
35437
  if (req.params) {
35264
35438
  try {
35265
- const root = getProjectRoot58 ? getProjectRoot58() : void 0;
35439
+ const root = getProjectRoot59 ? getProjectRoot59() : void 0;
35266
35440
  req.params = sanitizeParams(req.params, root, {
35267
35441
  domain: req.domain,
35268
35442
  operation: req.operation
@@ -41093,9 +41267,9 @@ var init_backup = __esm({
41093
41267
  async run({ args }) {
41094
41268
  const scope = args.scope;
41095
41269
  const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
41096
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
41270
+ const { getProjectRoot: getProjectRoot59 } = await import("@cleocode/core");
41097
41271
  const includesProject = scope === "project" || scope === "all";
41098
- const projectRoot = includesProject ? getProjectRoot58() : void 0;
41272
+ const projectRoot = includesProject ? getProjectRoot59() : void 0;
41099
41273
  let passphrase;
41100
41274
  if (args.encrypt === true) {
41101
41275
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -41171,12 +41345,12 @@ var init_backup = __esm({
41171
41345
  },
41172
41346
  async run({ args }) {
41173
41347
  const bundlePath = args.bundle;
41174
- const { getProjectRoot: getProjectRoot58, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
41348
+ const { getProjectRoot: getProjectRoot59, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
41175
41349
  const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
41176
41350
  const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
41177
41351
  const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
41178
41352
  const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
41179
- const projectRoot = getProjectRoot58();
41353
+ const projectRoot = getProjectRoot59();
41180
41354
  if (args.force !== true) {
41181
41355
  const existing = checkForExistingData(projectRoot, getCleoHome6());
41182
41356
  if (existing.length > 0) {
@@ -47234,14 +47408,19 @@ var init_graph2 = __esm({
47234
47408
  format: {
47235
47409
  type: "string",
47236
47410
  description: "Output format: json (default) | dot."
47411
+ },
47412
+ backlinks: {
47413
+ type: "boolean",
47414
+ description: "Hydrate the persisted docs_wikilinks backlink graph (T11826) \u2014 adds bidirectional shares-topic doc\u2194doc edges and any persisted backlinks not surfaced by the on-the-fly BFS. Obsidian-grade graph on existing data."
47237
47415
  }
47238
47416
  },
47239
47417
  async run({ args }) {
47240
47418
  const root = String(args.root);
47241
47419
  const depth = parseDepth(args.depth);
47242
47420
  const format = parseFormat(args.format);
47421
+ const hydrateWikilinks = Boolean(args.backlinks);
47243
47422
  try {
47244
- const graph = await buildDocProvenanceGraph({ root, depth });
47423
+ const graph = await buildDocProvenanceGraph({ root, depth, hydrateWikilinks });
47245
47424
  const payload = { ...graph };
47246
47425
  if (format === "dot") {
47247
47426
  payload["dot"] = renderProvenanceGraphAsDot(graph);
@@ -48062,6 +48241,7 @@ __export(docs_exports, {
48062
48241
  import { appendFile, mkdir as mkdir3, readdir, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
48063
48242
  import { dirname as dirname8, isAbsolute as isAbsolute2, join as join21, resolve as resolve5 } from "node:path";
48064
48243
  import { pushWarning as pushWarning3 } from "@cleocode/core";
48244
+ import { createDocsReadModel as createDocsReadModel2 } from "@cleocode/core/docs/docs-read-model";
48065
48245
  import {
48066
48246
  CleoError as CleoError4,
48067
48247
  CounterMismatchError,
@@ -48081,6 +48261,15 @@ async function dispatchDocsRaw(gateway, operation, params) {
48081
48261
  handleRawError(response, { command: "docs", operation: `docs.${operation}` });
48082
48262
  return response.data;
48083
48263
  }
48264
+ async function readDocBodyFromStdin() {
48265
+ if (process.stdin.isTTY) return "";
48266
+ process.stdin.setEncoding("utf-8");
48267
+ let buf = "";
48268
+ for await (const chunk of process.stdin) {
48269
+ buf += chunk;
48270
+ }
48271
+ return buf.replace(/\r?\n$/, "");
48272
+ }
48084
48273
  async function getScriptNames(projectRoot) {
48085
48274
  const scriptsDir = join21(projectRoot, "scripts");
48086
48275
  try {
@@ -48231,7 +48420,7 @@ var init_docs3 = __esm({
48231
48420
  addCommand6 = defineCommand({
48232
48421
  meta: {
48233
48422
  name: "add",
48234
- description: 'Attach a local file or remote URL to a CLEO entity (task, session, observation). Owner type is inferred from the ID prefix: T### \u2192 task, ses_* \u2192 session, O-* \u2192 observation. Use --slug to set a human-friendly alias (unique per project) (T9636).\n\nPositional arguments:\n <owner-id> Owner entity ID (T###, ses_*, O-*) \u2014 required\n [file] Local file path to attach \u2014 optional when --url is set\n\nNamed arguments:\n --url <url> Remote URL to attach (instead of a local file)\n --desc <text> Free-text description of this attachment\n --labels <csv> Comma-separated labels (e.g. rfc,spec)\n --attached-by <name> Agent identity that created the attachment (default: "human")\n --slug <kebab> Human-friendly alias, unique per project (T9636)\n --title <text> Human-readable title \u2014 REQUIRED for --type adr when --slug is omitted (T10360)\n --type <kind> Taxonomy classification \u2014 run `cleo docs schema` for kinds\n --allow-similar Bypass the slug-similarity warn \u2014 every bypass is audited\n to .cleo/audit/similar-bypass.jsonl (T10361)\n --strict Enforce body-schema (requiredSections) \u2014 fail with\n E_DOC_SCHEMA_MISMATCH instead of warning (T10160)\n' + docsOutputFlagHelp + "\n\nValidation behaviors:\n \u2022 Unknown flags \u2192 E_UNKNOWN_FLAG with did-you-mean suggestions (T10359)\n \u2022 Slug collision \u2192 E_SLUG_RESERVED + 3 alternative slugs (T10386)\n \u2022 Near-duplicate slug \u2192 W_SLUG_SIMILAR warning unless --allow-similar (T10361)\n \u2022 For --type adr without --slug, slug auto-allocates as `adr-NNN-<kebab-title>` via the\n central allocator (T10360 \u2014 closes T10153). --title is required in this case."
48423
+ description: "Attach a local file or remote URL to a CLEO entity (task, session, observation). Owner type is inferred from the ID prefix: T### \u2192 task, ses_* \u2192 session, O-* \u2192 observation. Use --slug to set a human-friendly alias (unique per project) (T9636).\n\nPositional arguments:\n <owner-id> Owner entity ID (T###, ses_*, O-*) \u2014 required\n [file] Local file path to attach \u2014 optional when --url/--content is set\n\nNamed arguments:\n --url <url> Remote URL to attach (instead of a local file)\n --content <text> Inline document body \u2014 author without a file (T10965); '-' reads stdin\n --desc <text> Free-text description of this attachment\n --labels <csv> Comma-separated labels (e.g. rfc,spec)\n --attached-by <name> Agent identity that created the attachment (default: \"human\")\n --slug <kebab> Human-friendly alias, unique per project (T9636)\n --title <text> Human-readable title \u2014 REQUIRED for --type adr when --slug is omitted (T10360)\n --type <kind> Taxonomy classification \u2014 run `cleo docs schema` for kinds\n --allow-similar Bypass the slug-similarity warn \u2014 every bypass is audited\n to .cleo/audit/similar-bypass.jsonl (T10361)\n --strict Enforce body-schema (requiredSections) \u2014 fail with\n E_DOC_SCHEMA_MISMATCH instead of warning (T10160)\n" + docsOutputFlagHelp + "\n\nValidation behaviors:\n \u2022 Unknown flags \u2192 E_UNKNOWN_FLAG with did-you-mean suggestions (T10359)\n \u2022 Slug collision \u2192 E_SLUG_RESERVED + 3 alternative slugs (T10386)\n \u2022 Near-duplicate slug \u2192 W_SLUG_SIMILAR warning unless --allow-similar (T10361)\n \u2022 For --type adr without --slug, slug auto-allocates as `adr-NNN-<kebab-title>` via the\n central allocator (T10360 \u2014 closes T10153). --title is required in this case."
48235
48424
  },
48236
48425
  args: {
48237
48426
  "owner-id": {
@@ -48248,6 +48437,10 @@ var init_docs3 = __esm({
48248
48437
  type: "string",
48249
48438
  description: "Remote URL to attach (instead of a local file)"
48250
48439
  },
48440
+ content: {
48441
+ type: "string",
48442
+ description: "Inline document body \u2014 author a doc without a pre-existing file (T10965). Pass '-' to read the body from stdin. Mutually exclusive with the file positional and --url."
48443
+ },
48251
48444
  desc: {
48252
48445
  type: "string",
48253
48446
  description: "Free-text description of this attachment"
@@ -48300,14 +48493,27 @@ var init_docs3 = __esm({
48300
48493
  const ownerId = args["owner-id"];
48301
48494
  const fileArg = args.file ?? void 0;
48302
48495
  const url = args.url ?? void 0;
48496
+ const contentArg = typeof args.content === "string" ? args.content : void 0;
48303
48497
  const allowSimilar = args["allow-similar"] === true;
48304
- if (!fileArg && !url) {
48305
- cliError("provide a file path (positional argument) or --url <url>", 6, {
48498
+ const sourceCount = (fileArg ? 1 : 0) + (url ? 1 : 0) + (contentArg !== void 0 ? 1 : 0);
48499
+ if (sourceCount === 0) {
48500
+ cliError("provide a file path (positional), --url <url>, or --content <text>", 6, {
48501
+ name: "E_VALIDATION",
48502
+ fix: 'Example: cleo docs add T123 docs/rfc.md --desc "RFC draft" \u2014 or \u2014 cleo docs add T123 --content "# Note" --slug my-note'
48503
+ });
48504
+ process.exit(6);
48505
+ }
48506
+ if (sourceCount > 1) {
48507
+ cliError("the file positional, --url, and --content are mutually exclusive", 6, {
48306
48508
  name: "E_VALIDATION",
48307
- fix: 'Example: cleo docs add T123 docs/rfc.md --desc "RFC draft" \u2014 or \u2014 cleo docs add T123 --url https://example.com/spec'
48509
+ fix: "Pass exactly one source: a file path, --url <url>, or --content <text>."
48308
48510
  });
48309
48511
  process.exit(6);
48310
48512
  }
48513
+ let content = contentArg;
48514
+ if (content === "-") {
48515
+ content = await readDocBodyFromStdin();
48516
+ }
48311
48517
  if (args.type === "adr" && !args.slug && !args.title) {
48312
48518
  cliError(
48313
48519
  "--title <text> is required when --type adr is used without --slug \u2014 the allocator needs a title to assemble adr-NNN-<kebab-title>",
@@ -48427,6 +48633,7 @@ var init_docs3 = __esm({
48427
48633
  ownerId,
48428
48634
  ...resolvedFile ? { file: resolvedFile } : {},
48429
48635
  ...url ? { url } : {},
48636
+ ...content !== void 0 ? { content } : {},
48430
48637
  ...args.desc ? { desc: args.desc } : {},
48431
48638
  ...args.labels ? { labels: args.labels } : {},
48432
48639
  ...args["attached-by"] ? { attachedBy: args["attached-by"] } : {},
@@ -48541,14 +48748,26 @@ var init_docs3 = __esm({
48541
48748
  fetchCommand = defineCommand({
48542
48749
  meta: {
48543
48750
  name: "fetch",
48544
- description: "Retrieve attachment metadata and bytes by attachment ID (att_*) or SHA-256 hex. Files <= 1 MB are returned base64-encoded inline; larger files report the storage path only. Output flags: --json and --output envelope|id|table|count|silent are accepted consistently."
48751
+ description: "Retrieve attachment metadata and bytes by slug, attachment ID (att_*), or SHA-256 hex. Files <= 1 MB are returned base64-encoded inline; larger files report the storage path only. Pass --content (alias --decoded) to emit the decoded UTF-8 document body to stdout instead of the LAFS envelope \u2014 the agent-friendly shortcut over piping bytesBase64 through base64 -d (T10970). Output flags: --json and --output envelope|id|table|count|silent are accepted consistently."
48545
48752
  },
48546
48753
  args: {
48547
48754
  "attachment-ref": {
48548
48755
  type: "positional",
48549
- description: "Attachment ID (att_*) or SHA-256 hex",
48756
+ description: "Slug, attachment ID (att_*), or SHA-256 hex",
48550
48757
  required: true
48551
48758
  },
48759
+ // T10970 — decoded-text content mode. An explicit opt-out from the
48760
+ // default envelope contract (ADR-086) that streams the raw UTF-8 body
48761
+ // to stdout, mirroring the other text-payload commands (export,
48762
+ // llm-output, view --render markdown).
48763
+ content: {
48764
+ type: "boolean",
48765
+ description: "Emit the decoded UTF-8 document body to stdout instead of the LAFS envelope (text docs only). Replaces the `--field /data/bytesBase64 | base64 -d` two-step (T10970)."
48766
+ },
48767
+ decoded: {
48768
+ type: "boolean",
48769
+ description: "Alias for --content (T10970)."
48770
+ },
48552
48771
  // T9922 — MVI record projection opt-out flags (surfaced for --help).
48553
48772
  verbose: {
48554
48773
  type: "boolean",
@@ -48561,11 +48780,35 @@ var init_docs3 = __esm({
48561
48780
  ...docsOutputArgs
48562
48781
  },
48563
48782
  async run({ args }) {
48783
+ const ref = String(args["attachment-ref"]);
48784
+ if (args.content === true || args.decoded === true) {
48785
+ const model = createDocsReadModel2();
48786
+ const result = await model.fetchDecoded(ref);
48787
+ if (!result.ok) {
48788
+ if (result.reason === "not-found") {
48789
+ cliError(`Doc not found: ${ref}`, 4 /* NOT_FOUND */, {
48790
+ name: "E_NOT_FOUND",
48791
+ fix: "List available docs with: cleo docs list"
48792
+ });
48793
+ } else {
48794
+ cliError(`Content not retrievable: ${ref}`, 4 /* NOT_FOUND */, {
48795
+ name: "E_NOT_FOUND",
48796
+ fix: "The doc metadata exists but its blob may be missing. Try: cleo docs publish <slug>"
48797
+ });
48798
+ }
48799
+ process.exit(4 /* NOT_FOUND */);
48800
+ }
48801
+ process.stdout.write(result.content);
48802
+ if (!result.content.endsWith("\n")) {
48803
+ process.stdout.write("\n");
48804
+ }
48805
+ return;
48806
+ }
48564
48807
  await dispatchFromCli(
48565
48808
  "query",
48566
48809
  "docs",
48567
48810
  "fetch",
48568
- { attachmentRef: args["attachment-ref"] },
48811
+ { attachmentRef: ref },
48569
48812
  { command: "docs fetch" }
48570
48813
  );
48571
48814
  }
@@ -50859,6 +51102,78 @@ var init_doctor_release_readiness = __esm({
50859
51102
  }
50860
51103
  });
50861
51104
 
51105
+ // packages/cleo/src/cli/commands/doctor-repair.ts
51106
+ var doctor_repair_exports = {};
51107
+ __export(doctor_repair_exports, {
51108
+ doctorRepairCommand: () => doctorRepairCommand
51109
+ });
51110
+ import { getLogger as getLogger20, getProjectRoot as getProjectRoot41 } from "@cleocode/core";
51111
+ import { repairMalformedDbs } from "@cleocode/core/store/repair-malformed-dbs.js";
51112
+ var doctorRepairCommand;
51113
+ var init_doctor_repair = __esm({
51114
+ "packages/cleo/src/cli/commands/doctor-repair.ts"() {
51115
+ "use strict";
51116
+ init_src2();
51117
+ init_define_cli_command();
51118
+ init_renderers();
51119
+ doctorRepairCommand = defineCommand({
51120
+ meta: {
51121
+ name: "repair",
51122
+ description: "Detect malformed CLEO databases (PRAGMA quick_check) and restore each from its freshest validated snapshot via the recovery pipeline (quarantine \u2192 restore \u2192 verify). Defaults to every present DB; use --role to narrow, --dry-run to plan without mutating."
51123
+ },
51124
+ args: {
51125
+ role: {
51126
+ type: "string",
51127
+ description: `Repair only this DB role (one of: ${DB_INVENTORY.map((e) => e.role).join(", ")})`,
51128
+ default: ""
51129
+ },
51130
+ "dry-run": {
51131
+ type: "boolean",
51132
+ description: "Detect + plan only \u2014 report what would be repaired without quarantining/restoring",
51133
+ default: false
51134
+ }
51135
+ },
51136
+ run({ args }) {
51137
+ const roleArg = typeof args.role === "string" ? args.role.trim() : "";
51138
+ const dryRun = args["dry-run"] === true;
51139
+ if (roleArg.length > 0 && !DB_INVENTORY.some((e) => e.role === roleArg)) {
51140
+ const validRoles = DB_INVENTORY.map((e) => e.role).join(", ");
51141
+ cliError(
51142
+ `Unknown DB role "${roleArg}". Valid roles: ${validRoles}.`,
51143
+ 6 /* VALIDATION_ERROR */,
51144
+ {
51145
+ name: "E_VALIDATION",
51146
+ fix: "Run `cleo doctor repair --help` for the list of valid roles."
51147
+ },
51148
+ { command: "doctor repair" }
51149
+ );
51150
+ process.exitCode = 6 /* VALIDATION_ERROR */;
51151
+ return;
51152
+ }
51153
+ const result = repairMalformedDbs({
51154
+ projectRoot: getProjectRoot41(),
51155
+ roles: roleArg.length > 0 ? [roleArg] : void 0,
51156
+ dryRun,
51157
+ logger: getLogger20("doctor-repair")
51158
+ });
51159
+ for (const r of result.roles) {
51160
+ if (!r.healthy) {
51161
+ humanInfo(` [${r.action.toUpperCase()}] ${r.role} \u2014 ${r.detail}`);
51162
+ }
51163
+ }
51164
+ const verb = dryRun ? "would repair" : "repaired";
51165
+ cliOutput(result, {
51166
+ command: "doctor repair",
51167
+ message: result.malformedCount === 0 ? `All ${result.roles.length} inspected DB(s) healthy \u2014 nothing to repair.` : `${result.malformedCount} malformed DB(s): ${verb} ${result.repairedCount}, ${result.failedCount} failed.`
51168
+ });
51169
+ if (result.failedCount > 0) {
51170
+ process.exitCode = 1 /* GENERAL_ERROR */;
51171
+ }
51172
+ }
51173
+ });
51174
+ }
51175
+ });
51176
+
50862
51177
  // packages/cleo/src/cli/progress.ts
50863
51178
  import { stderr } from "node:process";
50864
51179
  function createSelfUpdateProgress(enabled) {
@@ -50996,7 +51311,7 @@ import { join as join23 } from "node:path";
50996
51311
  import {
50997
51312
  ensureGlobalAgentRegistryDb,
50998
51313
  getGlobalAgentRegistryNativeDb,
50999
- getProjectRoot as getProjectRoot41,
51314
+ getProjectRoot as getProjectRoot42,
51000
51315
  installAgentFromCant
51001
51316
  } from "@cleocode/core/internal";
51002
51317
  function sha256Hex(bytes) {
@@ -51184,7 +51499,7 @@ var init_migrate_agents_v2 = __esm({
51184
51499
  }
51185
51500
  },
51186
51501
  async run({ args }) {
51187
- const projectRoot = getProjectRoot41();
51502
+ const projectRoot = getProjectRoot42();
51188
51503
  const verbose = args.quiet !== true;
51189
51504
  if (verbose) {
51190
51505
  humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
@@ -51228,7 +51543,7 @@ __export(doctor_exports, {
51228
51543
  });
51229
51544
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
51230
51545
  import { join as join24 } from "node:path";
51231
- import { getProjectRoot as getProjectRoot42, pushWarning as pushWarning5 } from "@cleocode/core";
51546
+ import { getProjectRoot as getProjectRoot43, pushWarning as pushWarning5 } from "@cleocode/core";
51232
51547
  import { renderInvariantAuditLines } from "@cleocode/core/doctor/invariant-audit-render.js";
51233
51548
  import {
51234
51549
  quarantineRogueCleoDir,
@@ -51350,6 +51665,7 @@ var init_doctor = __esm({
51350
51665
  init_doctor_legacy_backups();
51351
51666
  init_doctor_projects();
51352
51667
  init_doctor_release_readiness();
51668
+ init_doctor_repair();
51353
51669
  init_migrate_agents_v2();
51354
51670
  FIXTURE_ID_PATTERNS = [/^E\d+$/, /^T\d+EP$/];
51355
51671
  FIXTURE_TITLE_KEYWORDS = [
@@ -51369,6 +51685,8 @@ var init_doctor = __esm({
51369
51685
  "exodus-residue": doctorExodusResidueCommand,
51370
51686
  // T11837 / Saga T11242 / Epic T11833 — read-only exodus health report
51371
51687
  "exodus-health": doctorExodusCommand,
51688
+ // T11829 / Saga T11242 / Epic T11833 — DHQ-060 malformed-DB repair entry point
51689
+ repair: doctorRepairCommand,
51372
51690
  // T10458 / Saga T10431 / Epic T10436 — Release-readiness preflight
51373
51691
  "release-readiness": doctorReleaseReadinessCommand
51374
51692
  },
@@ -51573,7 +51891,7 @@ var init_doctor = __esm({
51573
51891
  const { join: pathJoin } = await import("node:path");
51574
51892
  const { existsSync: existsSync22 } = await import("node:fs");
51575
51893
  const { detectAndHealCoreWorktreeLeak } = await import("@cleocode/worktree");
51576
- const projectRoot = getProjectRoot42();
51894
+ const projectRoot = getProjectRoot43();
51577
51895
  let gitRoot = projectRoot;
51578
51896
  try {
51579
51897
  gitRoot = execFile2("git", ["rev-parse", "--show-toplevel"], {
@@ -51625,7 +51943,7 @@ var init_doctor = __esm({
51625
51943
  }
51626
51944
  if (args.brain) {
51627
51945
  const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
51628
- const projectRoot = getProjectRoot42();
51946
+ const projectRoot = getProjectRoot43();
51629
51947
  const dashboard = await computeBrainHealthDashboard(projectRoot);
51630
51948
  cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
51631
51949
  if (dashboard.hasP0Failure) {
@@ -51634,7 +51952,7 @@ var init_doctor = __esm({
51634
51952
  return;
51635
51953
  }
51636
51954
  if (args["scan-test-fixtures-in-prod"]) {
51637
- const projectRoot = getProjectRoot42();
51955
+ const projectRoot = getProjectRoot43();
51638
51956
  const matches = await scanTestFixturesInProd(projectRoot);
51639
51957
  const dryRun = args["dry-run"] !== false && args.quarantine !== true;
51640
51958
  const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
@@ -51722,7 +52040,7 @@ var init_doctor = __esm({
51722
52040
  progress.complete("Comprehensive diagnostics complete");
51723
52041
  } else if (args["scan-rogue-cleo-dirs"]) {
51724
52042
  progress.step(0, "Scanning for rogue .cleo/ directories");
51725
- const projectRoot = getProjectRoot42();
52043
+ const projectRoot = getProjectRoot43();
51726
52044
  const reports = scanRogueCleoDirs(projectRoot);
51727
52045
  progress.complete(
51728
52046
  `Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
@@ -51731,7 +52049,7 @@ var init_doctor = __esm({
51731
52049
  } else if (args["quarantine-rogue-cleo-dirs"]) {
51732
52050
  const isDryRun = args["dry-run"] === true;
51733
52051
  progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
51734
- const projectRoot = getProjectRoot42();
52052
+ const projectRoot = getProjectRoot43();
51735
52053
  const reports = scanRogueCleoDirs(projectRoot);
51736
52054
  if (reports.length === 0) {
51737
52055
  progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
@@ -51785,7 +52103,7 @@ var init_doctor = __esm({
51785
52103
  const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
51786
52104
  const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
51787
52105
  const cleoHome = getCleoHome6();
51788
- const projectRoot = getProjectRoot42();
52106
+ const projectRoot = getProjectRoot43();
51789
52107
  const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
51790
52108
  const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
51791
52109
  const isDryRun = args["dry-run"] === true;
@@ -51818,7 +52136,7 @@ var init_doctor = __esm({
51818
52136
  } else if (args["audit-worktree-orphans"]) {
51819
52137
  progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
51820
52138
  const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
51821
- const projectRoot = getProjectRoot42();
52139
+ const projectRoot = getProjectRoot43();
51822
52140
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
51823
52141
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
51824
52142
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -51875,7 +52193,7 @@ var init_doctor = __esm({
51875
52193
  `${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
51876
52194
  );
51877
52195
  const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
51878
- const projectRoot = getProjectRoot42();
52196
+ const projectRoot = getProjectRoot43();
51879
52197
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
51880
52198
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
51881
52199
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -51954,7 +52272,7 @@ var init_doctor = __esm({
51954
52272
  `${isDryRun ? "[DRY RUN] " : ""}Migrating .cleo/worktree-include \u2192 .worktreeinclude`
51955
52273
  );
51956
52274
  const { migrateWorktreeIncludeFile } = await import("@cleocode/core");
51957
- const projectRoot = getProjectRoot42();
52275
+ const projectRoot = getProjectRoot43();
51958
52276
  const result = await migrateWorktreeIncludeFile(projectRoot, { dryRun: isDryRun });
51959
52277
  progress.complete(`Migration ${result.action}`);
51960
52278
  cliOutput(result, { command: "doctor", operation: "doctor.migrate-worktree-include" });
@@ -51973,7 +52291,7 @@ var init_doctor = __esm({
51973
52291
  const stepLabel = isFocusedAlias ? "Auditing Saga hierarchy for ADR-073 invariants" : "Walking central INVARIANTS_REGISTRY";
51974
52292
  progress.step(0, stepLabel);
51975
52293
  const { auditInvariantRegistry } = await import("@cleocode/core/doctor/invariant-audit.js");
51976
- const projectRoot = getProjectRoot42();
52294
+ const projectRoot = getProjectRoot43();
51977
52295
  const result = await auditInvariantRegistry(projectRoot, { adrFilter });
51978
52296
  const operation = isFocusedAlias ? "doctor.audit-sagas" : "doctor.audit-invariants";
51979
52297
  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`;
@@ -51995,7 +52313,7 @@ var init_doctor = __esm({
51995
52313
  { command: "doctor", operation: "admin.health" }
51996
52314
  );
51997
52315
  try {
51998
- const projectRoot = getProjectRoot42();
52316
+ const projectRoot = getProjectRoot43();
51999
52317
  const conflicts = readMigrationConflicts(projectRoot);
52000
52318
  if (conflicts.length > 0) {
52001
52319
  progress.complete(
@@ -52026,7 +52344,7 @@ var init_doctor = __esm({
52026
52344
  progress.complete("Health check complete");
52027
52345
  }
52028
52346
  try {
52029
- const projectRoot = getProjectRoot42();
52347
+ const projectRoot = getProjectRoot43();
52030
52348
  const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
52031
52349
  const sagaAudit = await auditSagaHierarchy(projectRoot);
52032
52350
  if (sagaAudit.sagas.length === 0) {
@@ -53612,7 +53930,7 @@ var go_exports = {};
53612
53930
  __export(go_exports, {
53613
53931
  goCommand: () => goCommand
53614
53932
  });
53615
- import { getProjectRoot as getProjectRoot43, go } from "@cleocode/core";
53933
+ import { getProjectRoot as getProjectRoot44, go } from "@cleocode/core";
53616
53934
  var goCommand;
53617
53935
  var init_go = __esm({
53618
53936
  "packages/cleo/src/cli/commands/go.ts"() {
@@ -53637,7 +53955,7 @@ var init_go = __esm({
53637
53955
  }
53638
53956
  },
53639
53957
  async run({ args }) {
53640
- const projectRoot = getProjectRoot43();
53958
+ const projectRoot = getProjectRoot44();
53641
53959
  const result = await go.cleoGo({
53642
53960
  sagaId: typeof args.saga === "string" && args.saga.length > 0 ? args.saga : void 0,
53643
53961
  headless: args.headless === true,
@@ -53654,7 +53972,7 @@ var goal_exports = {};
53654
53972
  __export(goal_exports, {
53655
53973
  goalCommand: () => goalCommand
53656
53974
  });
53657
- import { getProjectRoot as getProjectRoot44, goal } from "@cleocode/core";
53975
+ import { getProjectRoot as getProjectRoot45, goal } from "@cleocode/core";
53658
53976
  function resolveGoalKind(task) {
53659
53977
  if (typeof task === "string" && task.length > 0) {
53660
53978
  if (!isValidGoalTargetTaskId(task)) {
@@ -53701,7 +54019,7 @@ var init_goal2 = __esm({
53701
54019
  }
53702
54020
  const record = await goal.createGoal(
53703
54021
  { goalKind: kindResult.kind, intent, turnBudget: resolveTurnBudget(args.turns) },
53704
- getProjectRoot44()
54022
+ getProjectRoot45()
53705
54023
  );
53706
54024
  cliOutput(record, { command: "goal set", operation: "goal.set" });
53707
54025
  }
@@ -53712,7 +54030,7 @@ var init_goal2 = __esm({
53712
54030
  description: "Show the current agent's active goal (per-agent scoped)."
53713
54031
  },
53714
54032
  async run() {
53715
- const record = await goal.getActiveGoal(getProjectRoot44());
54033
+ const record = await goal.getActiveGoal(getProjectRoot45());
53716
54034
  cliOutput(record ?? { active: null }, { command: "goal status", operation: "goal.status" });
53717
54035
  }
53718
54036
  });
@@ -53734,7 +54052,7 @@ var init_goal2 = __esm({
53734
54052
  });
53735
54053
  return;
53736
54054
  }
53737
- const cwd = getProjectRoot44();
54055
+ const cwd = getProjectRoot45();
53738
54056
  const parent = await goal.getActiveGoal(cwd);
53739
54057
  if (!parent) {
53740
54058
  cliError(
@@ -53782,7 +54100,7 @@ var init_goal2 = __esm({
53782
54100
  });
53783
54101
  return;
53784
54102
  }
53785
- const cwd = getProjectRoot44();
54103
+ const cwd = getProjectRoot45();
53786
54104
  const result = await goal.advanceGoalWithPersist(goalId, { cwd });
53787
54105
  if (!result) {
53788
54106
  cliError(`Goal '${goalId}' not found.`, 4 /* NOT_FOUND */, { name: "E_NOT_FOUND" });
@@ -53807,7 +54125,7 @@ var init_goal2 = __esm({
53807
54125
  });
53808
54126
  return;
53809
54127
  }
53810
- const cwd = getProjectRoot44();
54128
+ const cwd = getProjectRoot45();
53811
54129
  const active = await goal.getActiveGoal(cwd);
53812
54130
  if (!active) {
53813
54131
  cliError(
@@ -54796,7 +55114,7 @@ var hygiene_exports = {};
54796
55114
  __export(hygiene_exports, {
54797
55115
  hygieneCommand: () => hygieneCommand
54798
55116
  });
54799
- import { getProjectRoot as getProjectRoot45 } from "@cleocode/core";
55117
+ import { getProjectRoot as getProjectRoot46 } from "@cleocode/core";
54800
55118
  import { runSpawnReadinessHygieneCli } from "@cleocode/core/hygiene/validate-spawn-readiness.js";
54801
55119
  var hygieneCommand;
54802
55120
  var init_hygiene = __esm({
@@ -54825,7 +55143,7 @@ var init_hygiene = __esm({
54825
55143
  }
54826
55144
  },
54827
55145
  async run({ args }) {
54828
- const projectRoot = args["project-root"] || getProjectRoot45() || process.cwd();
55146
+ const projectRoot = args["project-root"] || getProjectRoot46() || process.cwd();
54829
55147
  const worktreePath = args["worktree-path"];
54830
55148
  await runSpawnReadinessHygieneCli(projectRoot, worktreePath);
54831
55149
  }
@@ -55988,7 +56306,7 @@ var llm_cost_exports = {};
55988
56306
  __export(llm_cost_exports, {
55989
56307
  costCommand: () => costCommand
55990
56308
  });
55991
- import { getProjectRoot as getProjectRoot46 } from "@cleocode/core/internal";
56309
+ import { getProjectRoot as getProjectRoot47 } from "@cleocode/core/internal";
55992
56310
  import { computeCost } from "@cleocode/core/llm/usage-pricing";
55993
56311
  function resolveSessionId(raw) {
55994
56312
  if (raw === "current") {
@@ -56061,7 +56379,7 @@ var init_llm_cost = __esm({
56061
56379
  process.exit(6);
56062
56380
  }
56063
56381
  const sessionId = resolveSessionId(rawSessionId);
56064
- const projectRoot = getProjectRoot46(process.cwd());
56382
+ const projectRoot = getProjectRoot47(process.cwd());
56065
56383
  let breakdown;
56066
56384
  try {
56067
56385
  breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
@@ -57635,7 +57953,7 @@ var memory_exports = {};
57635
57953
  __export(memory_exports, {
57636
57954
  memoryCommand: () => memoryCommand
57637
57955
  });
57638
- import { getProjectRoot as getProjectRoot47 } from "@cleocode/core";
57956
+ import { getProjectRoot as getProjectRoot48 } from "@cleocode/core";
57639
57957
  import {
57640
57958
  getBrainDb as getBrainDb2,
57641
57959
  getDreamStatus,
@@ -58568,7 +58886,7 @@ var init_memory3 = __esm({
58568
58886
  },
58569
58887
  args: {},
58570
58888
  async run() {
58571
- const root = getProjectRoot47();
58889
+ const root = getProjectRoot48();
58572
58890
  try {
58573
58891
  const result = await runConsolidation(root);
58574
58892
  cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
@@ -58592,7 +58910,7 @@ var init_memory3 = __esm({
58592
58910
  }
58593
58911
  },
58594
58912
  async run({ args }) {
58595
- const root = getProjectRoot47();
58913
+ const root = getProjectRoot48();
58596
58914
  if (args.status) {
58597
58915
  try {
58598
58916
  const status = await getDreamStatus(root);
@@ -58629,7 +58947,7 @@ var init_memory3 = __esm({
58629
58947
  }
58630
58948
  },
58631
58949
  async run({ args }) {
58632
- const root = getProjectRoot47();
58950
+ const root = getProjectRoot48();
58633
58951
  try {
58634
58952
  const { runObserver, runReflector } = await import("@cleocode/core/memory");
58635
58953
  const observerResult = await runObserver(root, args.session, {
@@ -58669,7 +58987,7 @@ var init_memory3 = __esm({
58669
58987
  }
58670
58988
  },
58671
58989
  async run({ args }) {
58672
- const root = getProjectRoot47();
58990
+ const root = getProjectRoot48();
58673
58991
  try {
58674
58992
  await getBrainDb2(root);
58675
58993
  const { totalDuplicateRows, groups } = await scanDuplicateEntries();
@@ -58715,7 +59033,7 @@ var init_memory3 = __esm({
58715
59033
  async run({ args }) {
58716
59034
  const sourceDir = args.from;
58717
59035
  const isDryRun = !!args["dry-run"];
58718
- const projectRoot = getProjectRoot47();
59036
+ const projectRoot = getProjectRoot48();
58719
59037
  try {
58720
59038
  const result = await importMemoryFiles({
58721
59039
  sourceDir,
@@ -58866,7 +59184,7 @@ var init_memory3 = __esm({
58866
59184
  },
58867
59185
  args: {},
58868
59186
  async run() {
58869
- const root = getProjectRoot47();
59187
+ const root = getProjectRoot48();
58870
59188
  try {
58871
59189
  await getBrainDb2(root);
58872
59190
  const result = await getTierStats(root);
@@ -58909,7 +59227,7 @@ var init_memory3 = __esm({
58909
59227
  }
58910
59228
  },
58911
59229
  async run({ args }) {
58912
- const root = getProjectRoot47();
59230
+ const root = getProjectRoot48();
58913
59231
  const targetTier = args.to;
58914
59232
  const reason = args.reason;
58915
59233
  const validTiers = ["medium", "long"];
@@ -58975,7 +59293,7 @@ var init_memory3 = __esm({
58975
59293
  }
58976
59294
  },
58977
59295
  async run({ args }) {
58978
- const root = getProjectRoot47();
59296
+ const root = getProjectRoot48();
58979
59297
  const targetTier = args.to;
58980
59298
  const reason = args.reason;
58981
59299
  const validTiers = ["short", "medium"];
@@ -59438,7 +59756,7 @@ var migrate_claude_mem_exports = {};
59438
59756
  __export(migrate_claude_mem_exports, {
59439
59757
  migrateClaudeMemCommand: () => migrateClaudeMemCommand
59440
59758
  });
59441
- import { getProjectRoot as getProjectRoot48, migrateClaudeMem } from "@cleocode/core/internal";
59759
+ import { getProjectRoot as getProjectRoot49, migrateClaudeMem } from "@cleocode/core/internal";
59442
59760
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
59443
59761
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
59444
59762
  var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
@@ -59501,7 +59819,7 @@ var init_migrate_claude_mem = __esm({
59501
59819
  }
59502
59820
  },
59503
59821
  async run({ args }) {
59504
- const root = getProjectRoot48();
59822
+ const root = getProjectRoot49();
59505
59823
  try {
59506
59824
  const result = await migrateClaudeMem(root, {
59507
59825
  sourcePath: args.source,
@@ -59550,7 +59868,7 @@ var init_migrate_claude_mem = __esm({
59550
59868
  }
59551
59869
  },
59552
59870
  async run({ args }) {
59553
- const projectRoot = getProjectRoot48();
59871
+ const projectRoot = getProjectRoot49();
59554
59872
  try {
59555
59873
  const db = await getDb2(projectRoot);
59556
59874
  const rcasdFlag = Boolean(args.rcasd);
@@ -59668,7 +59986,7 @@ __export(nexus_exports, {
59668
59986
  import { appendFile as appendFile2, mkdir as mkdir4 } from "node:fs/promises";
59669
59987
  import { homedir as homedir5 } from "node:os";
59670
59988
  import path4 from "node:path";
59671
- import { getProjectRoot as getProjectRoot49 } from "@cleocode/core";
59989
+ import { getProjectRoot as getProjectRoot50 } from "@cleocode/core";
59672
59990
  import { getSymbolImpact } from "@cleocode/core/nexus";
59673
59991
  import { runNexusAnalysis } from "@cleocode/core/nexus/analyze-orchestrator.js";
59674
59992
  import { exportNexusGraph } from "@cleocode/core/nexus/export.js";
@@ -59783,7 +60101,7 @@ var init_nexus3 = __esm({
59783
60101
  async run({ args }) {
59784
60102
  applyJsonFlag2(args.json);
59785
60103
  const projectIdOverride = args["project-id"];
59786
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60104
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
59787
60105
  const startTime = Date.now();
59788
60106
  try {
59789
60107
  const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
@@ -60298,7 +60616,7 @@ var init_nexus3 = __esm({
60298
60616
  applyJsonFlag2(args.json);
60299
60617
  const startTime = Date.now();
60300
60618
  const projectIdOverride = args["project-id"];
60301
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60619
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
60302
60620
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60303
60621
  const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
60304
60622
  const durationMs = Date.now() - startTime;
@@ -60342,7 +60660,7 @@ var init_nexus3 = __esm({
60342
60660
  applyJsonFlag2(args.json);
60343
60661
  const startTime = Date.now();
60344
60662
  const projectIdOverride = args["project-id"];
60345
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60663
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
60346
60664
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60347
60665
  const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
60348
60666
  const durationMs = Date.now() - startTime;
@@ -60385,7 +60703,7 @@ var init_nexus3 = __esm({
60385
60703
  void appendDeprecationTelemetry("nexus.context", "cleo graph context");
60386
60704
  const startTime = Date.now();
60387
60705
  const projectIdOverride = args["project-id"];
60388
- const repoPath = getProjectRoot49();
60706
+ const repoPath = getProjectRoot50();
60389
60707
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60390
60708
  const limit = parseInt(args.limit, 10);
60391
60709
  const symbolName = args.symbol;
@@ -60448,7 +60766,7 @@ var init_nexus3 = __esm({
60448
60766
  const startTime = Date.now();
60449
60767
  const whyFlag = !!args.why;
60450
60768
  const projectIdOverride = args["project-id"];
60451
- const repoPath = getProjectRoot49();
60769
+ const repoPath = getProjectRoot50();
60452
60770
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60453
60771
  const maxDepth = Math.min(parseInt(args.depth, 10), 5);
60454
60772
  const symbolName = args.symbol;
@@ -60520,7 +60838,7 @@ var init_nexus3 = __esm({
60520
60838
  const projectIdOverride = args["project-id"];
60521
60839
  const isIncremental = !!args.incremental;
60522
60840
  const ctx = getFormatContext();
60523
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60841
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
60524
60842
  humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
60525
60843
  if (!isIncremental) humanInfo("[nexus] Clearing existing index for project...");
60526
60844
  try {
@@ -60623,7 +60941,7 @@ var init_nexus3 = __esm({
60623
60941
  async run({ args }) {
60624
60942
  applyJsonFlag2(args.json);
60625
60943
  const startTime = Date.now();
60626
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60944
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
60627
60945
  const name = args.name;
60628
60946
  const response = await dispatchRaw("mutate", "nexus", "projects.register", {
60629
60947
  path: repoPath,
@@ -60981,7 +61299,7 @@ var init_nexus3 = __esm({
60981
61299
  applyJsonFlag2(args.json);
60982
61300
  const startTime = Date.now();
60983
61301
  const projectIdOverride = args["project-id"];
60984
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61302
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
60985
61303
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60986
61304
  const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
60987
61305
  repoPath,
@@ -61087,7 +61405,7 @@ var init_nexus3 = __esm({
61087
61405
  async run({ args }) {
61088
61406
  applyJsonFlag2(args.json);
61089
61407
  const startTime = Date.now();
61090
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61408
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
61091
61409
  const projectIdOverride = args["project-id"];
61092
61410
  const beforeRef = args.before ?? "HEAD~1";
61093
61411
  const afterRef = args.after ?? "HEAD";
@@ -61205,7 +61523,7 @@ var init_nexus3 = __esm({
61205
61523
  applyJsonFlag2(args.json);
61206
61524
  const startTime = Date.now();
61207
61525
  const projectIdOverride = args["project-id"];
61208
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61526
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
61209
61527
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
61210
61528
  const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
61211
61529
  const durationMs = Date.now() - startTime;
@@ -61261,7 +61579,7 @@ var init_nexus3 = __esm({
61261
61579
  const startTime = Date.now();
61262
61580
  const routeSymbol = args.routeSymbol;
61263
61581
  const projectIdOverride = args["project-id"];
61264
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61582
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
61265
61583
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
61266
61584
  const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
61267
61585
  const durationMs = Date.now() - startTime;
@@ -61651,7 +61969,7 @@ var init_nexus3 = __esm({
61651
61969
  async run({ args }) {
61652
61970
  applyJsonFlag2(args.json);
61653
61971
  const startTime = Date.now();
61654
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61972
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
61655
61973
  const projectIdOverride = args["project-id"];
61656
61974
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
61657
61975
  const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
@@ -61755,7 +62073,7 @@ var init_nexus3 = __esm({
61755
62073
  async run({ args }) {
61756
62074
  applyJsonFlag2(args.json);
61757
62075
  const startTime = Date.now();
61758
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
62076
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot50();
61759
62077
  const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
61760
62078
  const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
61761
62079
  projectId,
@@ -61836,7 +62154,7 @@ var init_nexus3 = __esm({
61836
62154
  const isIncremental = !!args.incremental;
61837
62155
  try {
61838
62156
  const result = await runNexusWiki({
61839
- projectRoot: getProjectRoot49(),
62157
+ projectRoot: getProjectRoot50(),
61840
62158
  outputDir,
61841
62159
  communityFilter,
61842
62160
  incremental: isIncremental
@@ -62186,7 +62504,7 @@ __export(orchestrate_exports, {
62186
62504
  });
62187
62505
  import { execFileSync as execFileSync3 } from "node:child_process";
62188
62506
  import { orchestration } from "@cleocode/core";
62189
- import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot50 } from "@cleocode/core/internal";
62507
+ import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot51 } from "@cleocode/core/internal";
62190
62508
  function formatRollupTable(rollup) {
62191
62509
  const waves = "waves" in rollup ? rollup.waves : [rollup];
62192
62510
  const lines = [];
@@ -62329,7 +62647,7 @@ var init_orchestrate3 = __esm({
62329
62647
  },
62330
62648
  async run({ args }) {
62331
62649
  const rateWindowHours = args.window !== void 0 ? Number.parseFloat(String(args.window)) : void 0;
62332
- const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot50(), {
62650
+ const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot51(), {
62333
62651
  ...rateWindowHours !== void 0 && Number.isFinite(rateWindowHours) && rateWindowHours > 0 ? { rateWindowHours } : {}
62334
62652
  });
62335
62653
  cliOutput(metrics, {
@@ -64534,7 +64852,7 @@ var refresh_memory_exports = {};
64534
64852
  __export(refresh_memory_exports, {
64535
64853
  refreshMemoryCommand: () => refreshMemoryCommand
64536
64854
  });
64537
- import { getProjectRoot as getProjectRoot51 } from "@cleocode/core";
64855
+ import { getProjectRoot as getProjectRoot52 } from "@cleocode/core";
64538
64856
  var refreshMemoryCommand;
64539
64857
  var init_refresh_memory = __esm({
64540
64858
  "packages/cleo/src/cli/commands/refresh-memory.ts"() {
@@ -64547,7 +64865,7 @@ var init_refresh_memory = __esm({
64547
64865
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
64548
64866
  },
64549
64867
  async run() {
64550
- const projectDir = getProjectRoot51();
64868
+ const projectDir = getProjectRoot52();
64551
64869
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
64552
64870
  const result = await writeMemoryBridge(projectDir);
64553
64871
  if (result.written) {
@@ -66074,7 +66392,7 @@ import fs3 from "node:fs";
66074
66392
  import path5 from "node:path";
66075
66393
  import {
66076
66394
  CleoError as CleoError8,
66077
- getProjectRoot as getProjectRoot52,
66395
+ getProjectRoot as getProjectRoot53,
66078
66396
  getTaskAccessor as getTaskAccessor3,
66079
66397
  parseConflictReport,
66080
66398
  setAtPath
@@ -66095,7 +66413,7 @@ var init_restore = __esm({
66095
66413
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
66096
66414
  },
66097
66415
  async run() {
66098
- const projectRoot = getProjectRoot52();
66416
+ const projectRoot = getProjectRoot53();
66099
66417
  const reportPath = path5.join(projectRoot, CLEO_DIR_NAME3, RESTORE_CONFLICTS_MD);
66100
66418
  if (!fs3.existsSync(reportPath)) {
66101
66419
  humanLine("No pending restore conflicts. Nothing to finalize.");
@@ -67017,8 +67335,8 @@ var init_saga = __esm({
67017
67335
  }
67018
67336
  },
67019
67337
  async run({ args }) {
67020
- const { sagas: sagas2, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
67021
- const projectRoot = getProjectRoot58();
67338
+ const { sagas: sagas2, getProjectRoot: getProjectRoot59 } = await import("@cleocode/core");
67339
+ const projectRoot = getProjectRoot59();
67022
67340
  const sagaId = typeof args.sagaId === "string" && args.sagaId.length > 0 ? args.sagaId : void 0;
67023
67341
  const result = await sagas2.sagaNext(projectRoot, { sagaId });
67024
67342
  cliOutput(result.success ? result.data : result, { command: "saga", operation: "saga.next" });
@@ -68760,7 +69078,7 @@ var sequence_exports = {};
68760
69078
  __export(sequence_exports, {
68761
69079
  sequenceCommand: () => sequenceCommand
68762
69080
  });
68763
- import { getProjectRoot as getProjectRoot53 } from "@cleocode/core/internal";
69081
+ import { getProjectRoot as getProjectRoot54 } from "@cleocode/core/internal";
68764
69082
  var showCommand13, checkCommand7, repairCommand2, sequenceCommand;
68765
69083
  var init_sequence = __esm({
68766
69084
  "packages/cleo/src/cli/commands/sequence.ts"() {
@@ -68796,7 +69114,7 @@ var init_sequence = __esm({
68796
69114
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
68797
69115
  async run() {
68798
69116
  const { repairSequence } = await import("@cleocode/core/internal");
68799
- const projectRoot = getProjectRoot53();
69117
+ const projectRoot = getProjectRoot54();
68800
69118
  const repair = await repairSequence(projectRoot);
68801
69119
  const result = {
68802
69120
  repaired: repair.repaired,
@@ -69251,8 +69569,8 @@ var init_session4 = __esm({
69251
69569
  "audit-scope": { type: "string", description: "Audit log scope (global|local)" }
69252
69570
  },
69253
69571
  async run({ args }) {
69254
- const { detectSessionDrift, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
69255
- const projectRoot = await getProjectRoot58();
69572
+ const { detectSessionDrift, getProjectRoot: getProjectRoot59 } = await import("@cleocode/core");
69573
+ const projectRoot = await getProjectRoot59();
69256
69574
  const scope = args["audit-scope"] === "local" ? "local" : "global";
69257
69575
  const report = await detectSessionDrift({ projectRoot, auditScope: scope });
69258
69576
  cliOutput(report, { command: "session drift", operation: "session.drift" });
@@ -71949,13 +72267,13 @@ var init_telemetry2 = __esm({
71949
72267
  // packages/cleo/src/cli/commands/templates/lib.ts
71950
72268
  import { readFileSync as readFileSync15 } from "node:fs";
71951
72269
  import { isAbsolute as isAbsolute3, resolve as resolve8 } from "node:path";
71952
- import { getProjectRoot as getProjectRoot54 } from "@cleocode/core";
72270
+ import { getProjectRoot as getProjectRoot55 } from "@cleocode/core";
71953
72271
  import { resolveSourcePathAbsolute } from "@cleocode/core/templates/registry";
71954
72272
  function resolveProjectRoot6(raw) {
71955
72273
  if (typeof raw === "string" && raw.length > 0) {
71956
72274
  return isAbsolute3(raw) ? raw : resolve8(process.cwd(), raw);
71957
72275
  }
71958
- return getProjectRoot54();
72276
+ return getProjectRoot55();
71959
72277
  }
71960
72278
  function readTemplateSource(entry) {
71961
72279
  const sourceAbsolute = resolveSourcePathAbsolute(entry);
@@ -72739,7 +73057,7 @@ __export(token_exports, {
72739
73057
  tokenCommand: () => tokenCommand
72740
73058
  });
72741
73059
  import { readFileSync as readFileSync19 } from "node:fs";
72742
- import { getProjectRoot as getProjectRoot55, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
73060
+ import { getProjectRoot as getProjectRoot56, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
72743
73061
  function readPayload(args, textKey, fileKey) {
72744
73062
  const text = args[textKey];
72745
73063
  const file = args[fileKey];
@@ -72903,7 +73221,7 @@ var init_token = __esm({
72903
73221
  domain: args.domain,
72904
73222
  operation: args.operation
72905
73223
  };
72906
- const result = args.record ? await recordTokenExchange2(getProjectRoot55(), input2) : await measureTokenExchange(input2);
73224
+ const result = args.record ? await recordTokenExchange2(getProjectRoot56(), input2) : await measureTokenExchange(input2);
72907
73225
  cliOutput(result, {
72908
73226
  command: "token",
72909
73227
  operation: args.record ? "admin.token.record" : "token.estimate"
@@ -72939,7 +73257,7 @@ __export(transcript_exports, {
72939
73257
  });
72940
73258
  import { homedir as homedir6 } from "node:os";
72941
73259
  import { join as join34 } from "node:path";
72942
- import { getProjectRoot as getProjectRoot56 } from "@cleocode/core";
73260
+ import { getProjectRoot as getProjectRoot57 } from "@cleocode/core";
72943
73261
  import {
72944
73262
  parseDurationMs,
72945
73263
  pruneTranscripts,
@@ -72969,7 +73287,7 @@ var init_transcript = __esm({
72969
73287
  async run({ args }) {
72970
73288
  if (args.pending) {
72971
73289
  try {
72972
- const projectRoot = getProjectRoot56();
73290
+ const projectRoot = getProjectRoot57();
72973
73291
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
72974
73292
  const pending = await scanPendingTranscripts(projectRoot);
72975
73293
  cliOutput(
@@ -73066,7 +73384,7 @@ var init_transcript = __esm({
73066
73384
  async run({ args }) {
73067
73385
  const tier = args.tier ?? "warm";
73068
73386
  const dryRun = args["dry-run"] ?? false;
73069
- const projectRoot = getProjectRoot56();
73387
+ const projectRoot = getProjectRoot57();
73070
73388
  try {
73071
73389
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
73072
73390
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -73178,7 +73496,7 @@ var init_transcript = __esm({
73178
73496
  const dryRun = args["dry-run"] ?? false;
73179
73497
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
73180
73498
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
73181
- const projectRoot = getProjectRoot56();
73499
+ const projectRoot = getProjectRoot57();
73182
73500
  try {
73183
73501
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
73184
73502
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -74653,9 +74971,9 @@ var init_workgraph2 = __esm({
74653
74971
  },
74654
74972
  async run({ args }) {
74655
74973
  const { generatePlanningDoc } = await import("@cleocode/core/workgraph");
74656
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
74974
+ const { getProjectRoot: getProjectRoot59 } = await import("@cleocode/core");
74657
74975
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
74658
- const projectRoot = getProjectRoot58();
74976
+ const projectRoot = getProjectRoot59();
74659
74977
  const audience = String(args.audience) === "agent" ? "agent" : "maintainer";
74660
74978
  const result = await generatePlanningDoc(projectRoot, {
74661
74979
  sagaId: String(args.sagaId),
@@ -74672,9 +74990,9 @@ var init_workgraph2 = __esm({
74672
74990
  async run() {
74673
74991
  const { validateWorkGraphStructure } = await import("@cleocode/core/workgraph");
74674
74992
  const { taskList: taskList2 } = await import("@cleocode/core/internal");
74675
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
74993
+ const { getProjectRoot: getProjectRoot59 } = await import("@cleocode/core");
74676
74994
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
74677
- const projectRoot = getProjectRoot58();
74995
+ const projectRoot = getProjectRoot59();
74678
74996
  const listResult = await taskList2(projectRoot, { limit: 5e3 });
74679
74997
  const tasks = listResult.success ? listResult.data?.tasks ?? [] : [];
74680
74998
  const nodes = tasks.map((t) => ({
@@ -74693,9 +75011,9 @@ var init_workgraph2 = __esm({
74693
75011
  description: "One-shot saga-to-saga workgraph dashboard (tracking checklist)"
74694
75012
  },
74695
75013
  async run() {
74696
- const { sagas: sagas2, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
75014
+ const { sagas: sagas2, getProjectRoot: getProjectRoot59 } = await import("@cleocode/core");
74697
75015
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
74698
- const projectRoot = getProjectRoot58();
75016
+ const projectRoot = getProjectRoot59();
74699
75017
  const listResult = await sagas2.sagaList(projectRoot);
74700
75018
  if (!listResult.success) {
74701
75019
  cliOutput2(listResult, { command: "workgraph", operation: "workgraph.status" });
@@ -74761,7 +75079,7 @@ __export(worktree_exports, {
74761
75079
  worktreeCommand: () => worktreeCommand
74762
75080
  });
74763
75081
  import readline4 from "node:readline";
74764
- import { getProjectRoot as getProjectRoot57, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
75082
+ import { getProjectRoot as getProjectRoot58, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
74765
75083
  async function promptYesNo2(question) {
74766
75084
  return new Promise((resolve11) => {
74767
75085
  const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
@@ -74866,7 +75184,7 @@ var init_worktree3 = __esm({
74866
75184
  const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
74867
75185
  const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
74868
75186
  const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
74869
- const projectRoot = getProjectRoot57();
75187
+ const projectRoot = getProjectRoot58();
74870
75188
  const listResult = await listWorktrees2({
74871
75189
  projectRoot,
74872
75190
  ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
@@ -75463,6 +75781,12 @@ var COMMAND_MANIFEST = [
75463
75781
  description: "Pre-flight release readiness check \u2014 lint matrix + changelog + changeset + npm OIDC + tag-trigger sanity (T10458)",
75464
75782
  load: async () => (await Promise.resolve().then(() => (init_doctor_release_readiness(), doctor_release_readiness_exports))).doctorReleaseReadinessCommand
75465
75783
  },
75784
+ {
75785
+ exportName: "doctorRepairCommand",
75786
+ name: "repair",
75787
+ description: "Detect malformed CLEO databases (PRAGMA quick_check) and restore each from its ",
75788
+ load: async () => (await Promise.resolve().then(() => (init_doctor_repair(), doctor_repair_exports))).doctorRepairCommand
75789
+ },
75466
75790
  {
75467
75791
  exportName: "doctorCommand",
75468
75792
  name: "doctor",
@@ -76515,8 +76839,8 @@ async function runStartupMaintenance() {
76515
76839
  detectAndRemoveLegacyGlobalFiles,
76516
76840
  detectAndRemoveStrayProjectNexus,
76517
76841
  getGlobalSalt,
76518
- getLogger: getLogger20,
76519
- getProjectRoot: getProjectRoot58,
76842
+ getLogger: getLogger21,
76843
+ getProjectRoot: getProjectRoot59,
76520
76844
  isCleanupMarkerSet,
76521
76845
  migrateSignaldockToConduit,
76522
76846
  needsSignaldockToConduitMigration,
@@ -76525,7 +76849,7 @@ async function runStartupMaintenance() {
76525
76849
  } = await import("@cleocode/core/internal");
76526
76850
  let projectRootForCleanup = "";
76527
76851
  try {
76528
- projectRootForCleanup = getProjectRoot58();
76852
+ projectRootForCleanup = getProjectRoot59();
76529
76853
  } catch {
76530
76854
  }
76531
76855
  if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
@@ -76541,11 +76865,11 @@ async function runStartupMaintenance() {
76541
76865
  }
76542
76866
  setCleanupMarker(CLI_VERSION, projectRootForCleanup);
76543
76867
  }
76544
- const _startupLog = getLogger20("cli-startup");
76868
+ const _startupLog = getLogger21("cli-startup");
76545
76869
  const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
76546
76870
  if (!isInitInvocation) {
76547
76871
  try {
76548
- const _projectRootForMigration = getProjectRoot58();
76872
+ const _projectRootForMigration = getProjectRoot59();
76549
76873
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
76550
76874
  const migrationResult = await migrateSignaldockToConduit(_projectRootForMigration);
76551
76875
  if (migrationResult.status === "failed") {