@cleocode/cleo 2026.6.7 → 2026.6.9

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();
@@ -18922,6 +18965,7 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
18922
18965
  refCount: doc.refCount,
18923
18966
  ...doc.slug ? { slug: doc.slug } : {},
18924
18967
  ...doc.kind ? { type: doc.kind } : {},
18968
+ ...doc.displayNumber !== null ? { displayNumber: doc.displayNumber } : {},
18925
18969
  ownerId: doc.ownerId,
18926
18970
  ownerType: doc.ownerType
18927
18971
  }));
@@ -18970,7 +19014,8 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
18970
19014
  // Surface the real attachment ref_count (T11572) — see project-scope note.
18971
19015
  refCount: doc.refCount,
18972
19016
  ...doc.slug ? { slug: doc.slug } : {},
18973
- ...doc.kind ? { type: doc.kind } : {}
19017
+ ...doc.kind ? { type: doc.kind } : {},
19018
+ ...doc.displayNumber !== null ? { displayNumber: doc.displayNumber } : {}
18974
19019
  }));
18975
19020
  projectedOwner.sort(
18976
19021
  (a, b) => comparator(
@@ -19173,7 +19218,8 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19173
19218
  createdAt: doc.createdAt,
19174
19219
  refCount: 0,
19175
19220
  ...doc.slug ? { slug: doc.slug } : {},
19176
- ...doc.kind ? { type: doc.kind } : {}
19221
+ ...doc.kind ? { type: doc.kind } : {},
19222
+ ...doc.displayNumber !== null ? { displayNumber: doc.displayNumber } : {}
19177
19223
  },
19178
19224
  path: storagePath,
19179
19225
  sizeBytes: contentBytes.length,
@@ -19190,6 +19236,7 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19190
19236
  ownerId,
19191
19237
  file: filePath,
19192
19238
  url,
19239
+ content: inlineContent,
19193
19240
  desc: description,
19194
19241
  labels: rawLabels,
19195
19242
  attachedBy: rawAttachedBy,
@@ -19201,13 +19248,23 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19201
19248
  if (!ownerId) {
19202
19249
  return lafsError("E_INVALID_INPUT", "ownerId is required", "add");
19203
19250
  }
19204
- if (!filePath && !url) {
19251
+ const hasContent = typeof inlineContent === "string";
19252
+ const sourceCount = (filePath ? 1 : 0) + (url ? 1 : 0) + (hasContent ? 1 : 0);
19253
+ if (sourceCount === 0) {
19205
19254
  return lafsError(
19206
19255
  "E_INVALID_INPUT",
19207
- "Provide either a file path (positional or --file) or --url",
19256
+ "Provide a file path (positional or --file), --url, or --content <text>",
19208
19257
  "add"
19209
19258
  );
19210
19259
  }
19260
+ if (sourceCount > 1) {
19261
+ return lafsError(
19262
+ "E_INVALID_INPUT",
19263
+ "--file, --url, and --content are mutually exclusive \u2014 provide exactly one source",
19264
+ "add",
19265
+ 'Use `cleo docs add <owner> ./file.md` OR `--url <url>` OR `--content "<text>"` (not more than one).'
19266
+ );
19267
+ }
19211
19268
  let slug;
19212
19269
  if (rawSlug !== void 0) {
19213
19270
  let candidate = rawSlug;
@@ -19544,6 +19601,126 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
19544
19601
  "add"
19545
19602
  );
19546
19603
  }
19604
+ if (hasContent) {
19605
+ const bytes = Buffer.from(inlineContent, "utf-8");
19606
+ if (type2 !== void 0) {
19607
+ let registry;
19608
+ try {
19609
+ registry = DocKindRegistry.load(getProjectRoot5());
19610
+ } catch {
19611
+ registry = void 0;
19612
+ }
19613
+ const check = validateDocBody(type2, inlineContent, registry);
19614
+ if (!check.ok) {
19615
+ const missingList = check.missing.join(", ");
19616
+ if (strictMode === true) {
19617
+ if (slug !== void 0) releaseReservedSlug(slug);
19618
+ return lafsError(
19619
+ "E_DOC_SCHEMA_MISMATCH",
19620
+ `body for kind '${type2}' is missing required section(s): ${missingList}`,
19621
+ "add",
19622
+ `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.`,
19623
+ { kind: type2, missing: check.missing, strict: true }
19624
+ );
19625
+ }
19626
+ pushWarning({
19627
+ code: "W_DOC_SCHEMA_MISMATCH",
19628
+ message: `body for kind '${type2}' is missing required section(s): ${missingList}. Add '--strict' to fail on schema violations.`
19629
+ });
19630
+ }
19631
+ }
19632
+ const mime = "text/markdown";
19633
+ const attachment = {
19634
+ kind: "blob",
19635
+ mime,
19636
+ ...description ? { description } : {},
19637
+ ...labels ? { labels } : {}
19638
+ };
19639
+ let meta;
19640
+ try {
19641
+ meta = await store.put(
19642
+ bytes,
19643
+ attachment,
19644
+ ownerType,
19645
+ ownerId,
19646
+ attachedBy,
19647
+ void 0,
19648
+ extras
19649
+ );
19650
+ } catch (err) {
19651
+ if (slug !== void 0) releaseReservedSlug(slug);
19652
+ if (err instanceof SlugCollisionError) {
19653
+ return {
19654
+ success: false,
19655
+ error: {
19656
+ code: "E_SLUG_RESERVED",
19657
+ message: SLUG_COLLISION_GUIDANCE.replaceAll("{slug}", err.slug ?? ""),
19658
+ fix: `cleo docs update ${err.slug ?? "<slug>"} --content "..."`,
19659
+ details: {
19660
+ suggestions: err.suggestions,
19661
+ aliases: ["E_SLUG_TAKEN"]
19662
+ }
19663
+ }
19664
+ };
19665
+ }
19666
+ throw err;
19667
+ }
19668
+ if (adrNumber !== void 0 && slug !== void 0) consumeReservedSlug(slug);
19669
+ const blobName = slug ?? meta.sha256.slice(0, 12);
19670
+ let backend = "llmtxt";
19671
+ try {
19672
+ const blobMirror = createAttachmentBlobStore(getProjectRoot5());
19673
+ const mirrorResult = await blobMirror.put(ownerId, {
19674
+ name: blobName,
19675
+ data: new Uint8Array(bytes),
19676
+ contentType: mime
19677
+ });
19678
+ backend = mirrorResult.backend;
19679
+ } catch {
19680
+ backend = await currentAttachmentBackend();
19681
+ }
19682
+ import("@cleocode/core/internal").then(
19683
+ ({ ensureLlmtxtNode }) => ensureLlmtxtNode(getProjectRoot5(), meta.sha256, `${ownerType}:${ownerId}`, blobName)
19684
+ ).catch(() => {
19685
+ });
19686
+ const contentPayload = {
19687
+ kind: "doc-attachment",
19688
+ attachmentId: meta.id,
19689
+ ownerId,
19690
+ addedAt: (/* @__PURE__ */ new Date()).toISOString(),
19691
+ ...slug !== void 0 ? { slug } : {},
19692
+ ...type2 !== void 0 ? { type: type2 } : {}
19693
+ };
19694
+ emitDocAttachmentObservation(contentPayload, getProjectRoot5());
19695
+ try {
19696
+ writeAuditEntry(getProjectRoot5(), {
19697
+ op: "docs.add",
19698
+ slug,
19699
+ type: type2,
19700
+ attachmentId: meta.id,
19701
+ sha256: meta.sha256,
19702
+ ownerId,
19703
+ summary: `Added inline doc '${slug ?? meta.sha256.slice(0, 12)}'${type2 ? ` of type '${type2}'` : ""} for owner ${ownerId}`
19704
+ });
19705
+ } catch {
19706
+ }
19707
+ return lafsSuccess(
19708
+ {
19709
+ attachmentId: meta.id,
19710
+ sha256: meta.sha256,
19711
+ refCount: meta.refCount,
19712
+ kind: "blob",
19713
+ ownerId,
19714
+ ownerType,
19715
+ // Cast: core returns 'llmtxt'|'legacy'; contracts uses 'legacy'|'llmstxt-v2' (T1529)
19716
+ attachmentBackend: backend,
19717
+ ...slug !== void 0 ? { slug } : {},
19718
+ ...type2 !== void 0 ? { type: type2 } : {},
19719
+ ...adrNumber !== void 0 ? { adrNumber } : {}
19720
+ },
19721
+ "add"
19722
+ );
19723
+ }
19547
19724
  if (url) {
19548
19725
  const attachment = {
19549
19726
  kind: "url",
@@ -28233,8 +28410,8 @@ async function loadPlaybookByName(name) {
28233
28410
  return null;
28234
28411
  }
28235
28412
  try {
28236
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28237
- const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot58();
28413
+ const { getProjectRoot: getProjectRoot60 } = await import("@cleocode/core/internal");
28414
+ const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot60();
28238
28415
  const resolved = resolvePlaybook(name, {
28239
28416
  projectRoot,
28240
28417
  globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
@@ -28278,8 +28455,8 @@ async function acquireDb() {
28278
28455
  async function buildDefaultDispatcher() {
28279
28456
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
28280
28457
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await import("@cleocode/runtime/gateway");
28281
- const { getProjectRoot: getProjectRoot58, createToolGuard, runSkillNodeOrSpawn } = await import("@cleocode/core/internal");
28282
- const projectRoot = getProjectRoot58();
28458
+ const { getProjectRoot: getProjectRoot60, createToolGuard, runSkillNodeOrSpawn } = await import("@cleocode/core/internal");
28459
+ const projectRoot = getProjectRoot60();
28283
28460
  const tools = createToolGuard({ allowedRoots: [projectRoot] });
28284
28461
  const spawn5 = async (input2) => {
28285
28462
  const result = await orchestrateSpawnExecute2(
@@ -28476,8 +28653,8 @@ var init_playbook2 = __esm({
28476
28653
  projectRoot = __playbookRuntimeOverrides.projectRoot;
28477
28654
  } else {
28478
28655
  try {
28479
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28480
- projectRoot = getProjectRoot58();
28656
+ const { getProjectRoot: getProjectRoot60 } = await import("@cleocode/core/internal");
28657
+ projectRoot = getProjectRoot60();
28481
28658
  } catch {
28482
28659
  projectRoot = void 0;
28483
28660
  }
@@ -28541,14 +28718,14 @@ var init_playbook2 = __esm({
28541
28718
  const dispatcher = await buildDefaultDispatcher();
28542
28719
  let result;
28543
28720
  try {
28544
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28721
+ const { getProjectRoot: getProjectRoot60 } = await import("@cleocode/core/internal");
28545
28722
  const opts = {
28546
28723
  db,
28547
28724
  playbook: parsed.definition,
28548
28725
  playbookHash: parsed.sourceHash,
28549
28726
  initialContext,
28550
28727
  dispatcher,
28551
- projectRoot: getProjectRoot58()
28728
+ projectRoot: getProjectRoot60()
28552
28729
  };
28553
28730
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
28554
28731
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -35258,11 +35435,11 @@ var init_security = __esm({
35258
35435
  });
35259
35436
 
35260
35437
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
35261
- function createSanitizer(getProjectRoot58) {
35438
+ function createSanitizer(getProjectRoot60) {
35262
35439
  return async (req, next) => {
35263
35440
  if (req.params) {
35264
35441
  try {
35265
- const root = getProjectRoot58 ? getProjectRoot58() : void 0;
35442
+ const root = getProjectRoot60 ? getProjectRoot60() : void 0;
35266
35443
  req.params = sanitizeParams(req.params, root, {
35267
35444
  domain: req.domain,
35268
35445
  operation: req.operation
@@ -41093,9 +41270,9 @@ var init_backup = __esm({
41093
41270
  async run({ args }) {
41094
41271
  const scope = args.scope;
41095
41272
  const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
41096
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
41273
+ const { getProjectRoot: getProjectRoot60 } = await import("@cleocode/core");
41097
41274
  const includesProject = scope === "project" || scope === "all";
41098
- const projectRoot = includesProject ? getProjectRoot58() : void 0;
41275
+ const projectRoot = includesProject ? getProjectRoot60() : void 0;
41099
41276
  let passphrase;
41100
41277
  if (args.encrypt === true) {
41101
41278
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -41171,12 +41348,12 @@ var init_backup = __esm({
41171
41348
  },
41172
41349
  async run({ args }) {
41173
41350
  const bundlePath = args.bundle;
41174
- const { getProjectRoot: getProjectRoot58, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
41351
+ const { getProjectRoot: getProjectRoot60, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
41175
41352
  const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
41176
41353
  const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
41177
41354
  const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
41178
41355
  const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
41179
- const projectRoot = getProjectRoot58();
41356
+ const projectRoot = getProjectRoot60();
41180
41357
  if (args.force !== true) {
41181
41358
  const existing = checkForExistingData(projectRoot, getCleoHome6());
41182
41359
  if (existing.length > 0) {
@@ -47234,14 +47411,19 @@ var init_graph2 = __esm({
47234
47411
  format: {
47235
47412
  type: "string",
47236
47413
  description: "Output format: json (default) | dot."
47414
+ },
47415
+ backlinks: {
47416
+ type: "boolean",
47417
+ 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
47418
  }
47238
47419
  },
47239
47420
  async run({ args }) {
47240
47421
  const root = String(args.root);
47241
47422
  const depth = parseDepth(args.depth);
47242
47423
  const format = parseFormat(args.format);
47424
+ const hydrateWikilinks = Boolean(args.backlinks);
47243
47425
  try {
47244
- const graph = await buildDocProvenanceGraph({ root, depth });
47426
+ const graph = await buildDocProvenanceGraph({ root, depth, hydrateWikilinks });
47245
47427
  const payload = { ...graph };
47246
47428
  if (format === "dot") {
47247
47429
  payload["dot"] = renderProvenanceGraphAsDot(graph);
@@ -47267,6 +47449,89 @@ var init_graph2 = __esm({
47267
47449
  }
47268
47450
  });
47269
47451
 
47452
+ // packages/cleo/src/cli/commands/docs/set-alias.ts
47453
+ import { CleoError as CleoError4, getProjectRoot as getProjectRoot37, setDisplayAlias } from "@cleocode/core/internal";
47454
+ var setAliasCommand;
47455
+ var init_set_alias = __esm({
47456
+ "packages/cleo/src/cli/commands/docs/set-alias.ts"() {
47457
+ "use strict";
47458
+ init_src2();
47459
+ init_define_cli_command();
47460
+ init_renderers();
47461
+ setAliasCommand = defineCommand({
47462
+ meta: {
47463
+ name: "set-alias",
47464
+ description: "Assign an explicit display-alias number to a doc, decoupled from its slug (e.g. `cleo docs set-alias adr-051-override-patterns 091`). The number must be unique among type=adr docs. Pass --clear to remove an existing alias (revert to the slug-derived number)."
47465
+ },
47466
+ args: {
47467
+ slug: {
47468
+ type: "positional",
47469
+ description: "Canonical doc slug to alias (e.g. adr-051-override-patterns). Required.",
47470
+ required: true
47471
+ },
47472
+ number: {
47473
+ type: "positional",
47474
+ description: "The display-alias number to assign (positive integer). Omit with --clear.",
47475
+ required: false
47476
+ },
47477
+ clear: {
47478
+ type: "boolean",
47479
+ description: "Clear any existing alias instead of setting one (revert to slug-derived)."
47480
+ }
47481
+ },
47482
+ async run({ args }) {
47483
+ const slug = String(args.slug);
47484
+ const clear = Boolean(args.clear);
47485
+ let displayAlias;
47486
+ if (clear) {
47487
+ displayAlias = null;
47488
+ } else {
47489
+ const raw = args.number;
47490
+ if (raw === void 0 || raw === null || String(raw).trim() === "") {
47491
+ cliError(
47492
+ "a positive integer <number> is required (or pass --clear to remove the alias)",
47493
+ 6 /* VALIDATION_ERROR */,
47494
+ { name: "E_VALIDATION" }
47495
+ );
47496
+ process.exit(6 /* VALIDATION_ERROR */);
47497
+ return;
47498
+ }
47499
+ const parsed = Number.parseInt(String(raw), 10);
47500
+ if (!Number.isInteger(parsed) || parsed < 1) {
47501
+ cliError(
47502
+ `<number> must be a positive integer (got '${String(raw)}')`,
47503
+ 6 /* VALIDATION_ERROR */,
47504
+ { name: "E_VALIDATION" }
47505
+ );
47506
+ process.exit(6 /* VALIDATION_ERROR */);
47507
+ return;
47508
+ }
47509
+ displayAlias = parsed;
47510
+ }
47511
+ try {
47512
+ const result = await setDisplayAlias(getProjectRoot37(), { slug, displayAlias });
47513
+ cliOutput(result, { command: "docs set-alias", operation: "docs.set-alias" });
47514
+ } catch (err) {
47515
+ if (err instanceof CleoError4) {
47516
+ cliError(err.message, err.code, {
47517
+ name: typeof err.details?.["code"] === "string" ? err.details["code"] : "E_DOCS_SET_ALIAS",
47518
+ ...err.fix ? { fix: err.fix } : {},
47519
+ ...err.details ? { details: err.details } : {}
47520
+ });
47521
+ process.exit(err.code);
47522
+ return;
47523
+ }
47524
+ const message = err instanceof Error ? err.message : String(err);
47525
+ cliError(`docs set-alias failed: ${message}`, 1 /* GENERAL_ERROR */, {
47526
+ name: "E_DOCS_SET_ALIAS_FAILED"
47527
+ });
47528
+ process.exit(1 /* GENERAL_ERROR */);
47529
+ }
47530
+ }
47531
+ });
47532
+ }
47533
+ });
47534
+
47270
47535
  // packages/cleo/src/viewer/pidfile.ts
47271
47536
  import { mkdir, readFile as readFile3, unlink, writeFile } from "node:fs/promises";
47272
47537
  import { dirname as dirname6, join as join18 } from "node:path";
@@ -47376,7 +47641,7 @@ import { dirname as dirname7, join as join19, normalize, resolve as resolve4 } f
47376
47641
  import { fileURLToPath as fileURLToPath4 } from "node:url";
47377
47642
  import {
47378
47643
  createAttachmentStore as createAttachmentStore4,
47379
- getProjectRoot as getProjectRoot37,
47644
+ getProjectRoot as getProjectRoot38,
47380
47645
  searchAllProjectDocs as searchAllProjectDocs2
47381
47646
  } from "@cleocode/core/internal";
47382
47647
  function getViewerAssetsDir() {
@@ -47436,7 +47701,7 @@ async function serveStatic(res, assetsDir, relPath) {
47436
47701
  }
47437
47702
  }
47438
47703
  function buildViewerHandler(opts = {}) {
47439
- const projectRoot = opts.projectRoot ?? getProjectRoot37();
47704
+ const projectRoot = opts.projectRoot ?? getProjectRoot38();
47440
47705
  const assetsDir = getViewerAssetsDir();
47441
47706
  const store = createAttachmentStore4();
47442
47707
  return async (req, res) => {
@@ -48062,15 +48327,16 @@ __export(docs_exports, {
48062
48327
  import { appendFile, mkdir as mkdir3, readdir, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
48063
48328
  import { dirname as dirname8, isAbsolute as isAbsolute2, join as join21, resolve as resolve5 } from "node:path";
48064
48329
  import { pushWarning as pushWarning3 } from "@cleocode/core";
48330
+ import { createDocsReadModel as createDocsReadModel2 } from "@cleocode/core/docs/docs-read-model";
48065
48331
  import {
48066
- CleoError as CleoError4,
48332
+ CleoError as CleoError5,
48067
48333
  CounterMismatchError,
48068
48334
  checkSlugSimilarity,
48069
48335
  DEFAULT_SIMILARITY_MODE,
48070
48336
  DEFAULT_SIMILARITY_THRESHOLD,
48071
48337
  detectStrayCleoDb as detectStrayCleoDb2,
48072
48338
  getAgentOutputsAbsolute,
48073
- getProjectRoot as getProjectRoot38,
48339
+ getProjectRoot as getProjectRoot39,
48074
48340
  readJson,
48075
48341
  resolveWorktreeFilePath,
48076
48342
  resolveWorktreeRouting as resolveWorktreeRouting4
@@ -48081,6 +48347,15 @@ async function dispatchDocsRaw(gateway, operation, params) {
48081
48347
  handleRawError(response, { command: "docs", operation: `docs.${operation}` });
48082
48348
  return response.data;
48083
48349
  }
48350
+ async function readDocBodyFromStdin() {
48351
+ if (process.stdin.isTTY) return "";
48352
+ process.stdin.setEncoding("utf-8");
48353
+ let buf = "";
48354
+ for await (const chunk of process.stdin) {
48355
+ buf += chunk;
48356
+ }
48357
+ return buf.replace(/\r?\n$/, "");
48358
+ }
48084
48359
  async function getScriptNames(projectRoot) {
48085
48360
  const scriptsDir = join21(projectRoot, "scripts");
48086
48361
  try {
@@ -48216,6 +48491,7 @@ var init_docs3 = __esm({
48216
48491
  init_renderers();
48217
48492
  init_audit3();
48218
48493
  init_graph2();
48494
+ init_set_alias();
48219
48495
  init_docs_viewer();
48220
48496
  docsOutputFlagHelp = " --json Emit the canonical LAFS JSON envelope (also accepted as a global flag)\n --output <mode> Re-render the result as envelope|id|table|count|silent (also accepted as a global flag)";
48221
48497
  docsOutputArgs = {
@@ -48231,7 +48507,7 @@ var init_docs3 = __esm({
48231
48507
  addCommand6 = defineCommand({
48232
48508
  meta: {
48233
48509
  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."
48510
+ 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
48511
  },
48236
48512
  args: {
48237
48513
  "owner-id": {
@@ -48248,6 +48524,10 @@ var init_docs3 = __esm({
48248
48524
  type: "string",
48249
48525
  description: "Remote URL to attach (instead of a local file)"
48250
48526
  },
48527
+ content: {
48528
+ type: "string",
48529
+ 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."
48530
+ },
48251
48531
  desc: {
48252
48532
  type: "string",
48253
48533
  description: "Free-text description of this attachment"
@@ -48300,14 +48580,27 @@ var init_docs3 = __esm({
48300
48580
  const ownerId = args["owner-id"];
48301
48581
  const fileArg = args.file ?? void 0;
48302
48582
  const url = args.url ?? void 0;
48583
+ const contentArg = typeof args.content === "string" ? args.content : void 0;
48303
48584
  const allowSimilar = args["allow-similar"] === true;
48304
- if (!fileArg && !url) {
48305
- cliError("provide a file path (positional argument) or --url <url>", 6, {
48585
+ const sourceCount = (fileArg ? 1 : 0) + (url ? 1 : 0) + (contentArg !== void 0 ? 1 : 0);
48586
+ if (sourceCount === 0) {
48587
+ cliError("provide a file path (positional), --url <url>, or --content <text>", 6, {
48588
+ name: "E_VALIDATION",
48589
+ fix: 'Example: cleo docs add T123 docs/rfc.md --desc "RFC draft" \u2014 or \u2014 cleo docs add T123 --content "# Note" --slug my-note'
48590
+ });
48591
+ process.exit(6);
48592
+ }
48593
+ if (sourceCount > 1) {
48594
+ cliError("the file positional, --url, and --content are mutually exclusive", 6, {
48306
48595
  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'
48596
+ fix: "Pass exactly one source: a file path, --url <url>, or --content <text>."
48308
48597
  });
48309
48598
  process.exit(6);
48310
48599
  }
48600
+ let content = contentArg;
48601
+ if (content === "-") {
48602
+ content = await readDocBodyFromStdin();
48603
+ }
48311
48604
  if (args.type === "adr" && !args.slug && !args.title) {
48312
48605
  cliError(
48313
48606
  "--title <text> is required when --type adr is used without --slug \u2014 the allocator needs a title to assemble adr-NNN-<kebab-title>",
@@ -48342,7 +48635,7 @@ var init_docs3 = __esm({
48342
48635
  resolvedFile = resolveWorktreeFilePath(String(fileArg), routing);
48343
48636
  }
48344
48637
  if (args.slug && args.type) {
48345
- const projectRoot = await getProjectRoot38();
48638
+ const projectRoot = await getProjectRoot39();
48346
48639
  let warnThreshold = DEFAULT_SIMILARITY_THRESHOLD;
48347
48640
  let mode = DEFAULT_SIMILARITY_MODE;
48348
48641
  try {
@@ -48427,6 +48720,7 @@ var init_docs3 = __esm({
48427
48720
  ownerId,
48428
48721
  ...resolvedFile ? { file: resolvedFile } : {},
48429
48722
  ...url ? { url } : {},
48723
+ ...content !== void 0 ? { content } : {},
48430
48724
  ...args.desc ? { desc: args.desc } : {},
48431
48725
  ...args.labels ? { labels: args.labels } : {},
48432
48726
  ...args["attached-by"] ? { attachedBy: args["attached-by"] } : {},
@@ -48541,14 +48835,26 @@ var init_docs3 = __esm({
48541
48835
  fetchCommand = defineCommand({
48542
48836
  meta: {
48543
48837
  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."
48838
+ 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
48839
  },
48546
48840
  args: {
48547
48841
  "attachment-ref": {
48548
48842
  type: "positional",
48549
- description: "Attachment ID (att_*) or SHA-256 hex",
48843
+ description: "Slug, attachment ID (att_*), or SHA-256 hex",
48550
48844
  required: true
48551
48845
  },
48846
+ // T10970 — decoded-text content mode. An explicit opt-out from the
48847
+ // default envelope contract (ADR-086) that streams the raw UTF-8 body
48848
+ // to stdout, mirroring the other text-payload commands (export,
48849
+ // llm-output, view --render markdown).
48850
+ content: {
48851
+ type: "boolean",
48852
+ 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)."
48853
+ },
48854
+ decoded: {
48855
+ type: "boolean",
48856
+ description: "Alias for --content (T10970)."
48857
+ },
48552
48858
  // T9922 — MVI record projection opt-out flags (surfaced for --help).
48553
48859
  verbose: {
48554
48860
  type: "boolean",
@@ -48561,11 +48867,35 @@ var init_docs3 = __esm({
48561
48867
  ...docsOutputArgs
48562
48868
  },
48563
48869
  async run({ args }) {
48870
+ const ref = String(args["attachment-ref"]);
48871
+ if (args.content === true || args.decoded === true) {
48872
+ const model = createDocsReadModel2();
48873
+ const result = await model.fetchDecoded(ref);
48874
+ if (!result.ok) {
48875
+ if (result.reason === "not-found") {
48876
+ cliError(`Doc not found: ${ref}`, 4 /* NOT_FOUND */, {
48877
+ name: "E_NOT_FOUND",
48878
+ fix: "List available docs with: cleo docs list"
48879
+ });
48880
+ } else {
48881
+ cliError(`Content not retrievable: ${ref}`, 4 /* NOT_FOUND */, {
48882
+ name: "E_NOT_FOUND",
48883
+ fix: "The doc metadata exists but its blob may be missing. Try: cleo docs publish <slug>"
48884
+ });
48885
+ }
48886
+ process.exit(4 /* NOT_FOUND */);
48887
+ }
48888
+ process.stdout.write(result.content);
48889
+ if (!result.content.endsWith("\n")) {
48890
+ process.stdout.write("\n");
48891
+ }
48892
+ return;
48893
+ }
48564
48894
  await dispatchFromCli(
48565
48895
  "query",
48566
48896
  "docs",
48567
48897
  "fetch",
48568
- { attachmentRef: args["attachment-ref"] },
48898
+ { attachmentRef: ref },
48569
48899
  { command: "docs fetch" }
48570
48900
  );
48571
48901
  }
@@ -48722,7 +49052,7 @@ var init_docs3 = __esm({
48722
49052
  const taskId = String(args.task);
48723
49053
  const includeAttachments = args["include-attachments"] !== false;
48724
49054
  const includeMemoryRefs = args["include-memory-refs"] === true;
48725
- const projectRoot = getProjectRoot38();
49055
+ const projectRoot = getProjectRoot39();
48726
49056
  try {
48727
49057
  const result = await dispatchDocsRaw("query", "llm-output", {
48728
49058
  mode: "task-export",
@@ -48793,7 +49123,7 @@ var init_docs3 = __esm({
48793
49123
  },
48794
49124
  async run({ args }) {
48795
49125
  const forId = String(args.for);
48796
- const projectRoot = getProjectRoot38();
49126
+ const projectRoot = getProjectRoot39();
48797
49127
  try {
48798
49128
  const result = await dispatchDocsRaw("query", "llm-output", {
48799
49129
  for: forId,
@@ -48870,7 +49200,7 @@ var init_docs3 = __esm({
48870
49200
  },
48871
49201
  async run({ args }) {
48872
49202
  const forId = String(args.for);
48873
- const projectRoot = getProjectRoot38();
49203
+ const projectRoot = getProjectRoot39();
48874
49204
  try {
48875
49205
  const result = await dispatchDocsRaw("query", "llm-output", {
48876
49206
  for: forId,
@@ -49096,7 +49426,7 @@ var init_docs3 = __esm({
49096
49426
  }
49097
49427
  },
49098
49428
  async run({ args }) {
49099
- const projectRoot = getProjectRoot38();
49429
+ const projectRoot = getProjectRoot39();
49100
49430
  const rawStrategy = args.strategy ?? "three-way";
49101
49431
  const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
49102
49432
  try {
@@ -49676,7 +50006,7 @@ var init_docs3 = __esm({
49676
50006
  });
49677
50007
  if (args.strict && anyDrift) process.exit(2);
49678
50008
  } catch (err) {
49679
- if (err instanceof CleoError4) {
50009
+ if (err instanceof CleoError5) {
49680
50010
  cliError(err.message, err.code, { name: "E_DOCS_CHECK_FAILED" });
49681
50011
  process.exit(err.code);
49682
50012
  }
@@ -49762,7 +50092,7 @@ var init_docs3 = __esm({
49762
50092
  process.exit(result.status === "error" ? 2 : 1);
49763
50093
  }
49764
50094
  } catch (err) {
49765
- if (err instanceof CleoError4) {
50095
+ if (err instanceof CleoError5) {
49766
50096
  cliError(err.message, err.code, { name: "E_DOCS_SYNC_FAILED" });
49767
50097
  process.exit(err.code);
49768
50098
  }
@@ -49829,7 +50159,7 @@ var init_docs3 = __esm({
49829
50159
  );
49830
50160
  }
49831
50161
  } catch (err) {
49832
- if (err instanceof CleoError4) {
50162
+ if (err instanceof CleoError5) {
49833
50163
  cliError(err.message, err.code, { name: "E_DOCS_GAP_CHECK_FAILED" });
49834
50164
  process.exit(err.code);
49835
50165
  }
@@ -49866,7 +50196,7 @@ var init_docs3 = __esm({
49866
50196
  }
49867
50197
  },
49868
50198
  async run({ args }) {
49869
- const projectRoot = getProjectRoot38();
50199
+ const projectRoot = getProjectRoot39();
49870
50200
  const dirArg = String(args.dir);
49871
50201
  const scanRoot = isAbsolute2(dirArg) ? dirArg : resolve5(projectRoot, dirArg);
49872
50202
  const dryRun = args["dry-run"] === true;
@@ -49928,7 +50258,7 @@ var init_docs3 = __esm({
49928
50258
  }
49929
50259
  },
49930
50260
  async run({ args }) {
49931
- const projectRoot = getProjectRoot38();
50261
+ const projectRoot = getProjectRoot39();
49932
50262
  const { registry, configError } = loadCliRegistry(projectRoot);
49933
50263
  const kinds = registry.list().map(toWireKind);
49934
50264
  const extensionsCount = kinds.filter((k) => k.isExtension).length;
@@ -49983,7 +50313,7 @@ var init_docs3 = __esm({
49983
50313
  deprecated: "docs list-types",
49984
50314
  replacement: "docs schema"
49985
50315
  });
49986
- const projectRoot = getProjectRoot38();
50316
+ const projectRoot = getProjectRoot39();
49987
50317
  const { registry, configError } = loadCliRegistry(projectRoot);
49988
50318
  const kinds = registry.list().map(toWireKind);
49989
50319
  const extensionsCount = kinds.filter((k) => k.isExtension).length;
@@ -50044,6 +50374,8 @@ var init_docs3 = __esm({
50044
50374
  merge: mergeCommand,
50045
50375
  // T10164 — DocProvenanceResponse-typed graph (`--root <slug>|<taskId>`).
50046
50376
  graph: graphCommand,
50377
+ // T11875 — display-alias assignment (`set-alias <slug> <number>`), decoupled from slug.
50378
+ "set-alias": setAliasCommand,
50047
50379
  // Legacy aliases (use `query` for new work — retained for backward compatibility)
50048
50380
  search: searchCommand,
50049
50381
  find: findCommand3,
@@ -50077,7 +50409,7 @@ var doctor_db_substrate_exports = {};
50077
50409
  __export(doctor_db_substrate_exports, {
50078
50410
  doctorDbSubstrateCommand: () => doctorDbSubstrateCommand
50079
50411
  });
50080
- import { getProjectRoot as getProjectRoot39, pushWarning as pushWarning4 } from "@cleocode/core";
50412
+ import { getProjectRoot as getProjectRoot40, pushWarning as pushWarning4 } from "@cleocode/core";
50081
50413
  import { surveyDbSubstrate, surveyFleetDbSubstrate } from "@cleocode/core/doctor/db-substrate.js";
50082
50414
  function pushSubstrateWarnings(result) {
50083
50415
  for (const warning of result.warnings) {
@@ -50210,7 +50542,7 @@ var init_doctor_db_substrate = __esm({
50210
50542
  const result = isFleet ? surveyFleetDbSubstrate(
50211
50543
  typeof args["fleet-root"] === "string" && args["fleet-root"].length > 0 ? args["fleet-root"] : DEFAULT_FLEET_ROOT,
50212
50544
  options
50213
- ) : surveyDbSubstrate(getProjectRoot39(), options);
50545
+ ) : surveyDbSubstrate(getProjectRoot40(), options);
50214
50546
  pushSubstrateWarnings(result);
50215
50547
  pushPerDbWarnings(result);
50216
50548
  cliOutput(result, {
@@ -50382,7 +50714,7 @@ var doctor_legacy_backups_exports = {};
50382
50714
  __export(doctor_legacy_backups_exports, {
50383
50715
  doctorLegacyBackupsCommand: () => doctorLegacyBackupsCommand
50384
50716
  });
50385
- import { getProjectRoot as getProjectRoot40 } from "@cleocode/core";
50717
+ import { getProjectRoot as getProjectRoot41 } from "@cleocode/core";
50386
50718
  import { pruneLegacyBackups, scanLegacyBackups } from "@cleocode/core/doctor/legacy-backups.js";
50387
50719
  function parsePositiveInt(raw, fallback) {
50388
50720
  if (raw === void 0 || raw === null) return fallback;
@@ -50426,7 +50758,7 @@ var init_doctor_legacy_backups = __esm({
50426
50758
  async run({ args }) {
50427
50759
  const softRetentionDays = parsePositiveInt(args["soft-retention-days"], 30);
50428
50760
  const hardRetentionDays = parsePositiveInt(args["hard-retention-days"], 90);
50429
- const projectRoot = getProjectRoot40();
50761
+ const projectRoot = getProjectRoot41();
50430
50762
  let result;
50431
50763
  if (args.prune === true) {
50432
50764
  const dryRun = args["dry-run"] !== false;
@@ -50859,6 +51191,78 @@ var init_doctor_release_readiness = __esm({
50859
51191
  }
50860
51192
  });
50861
51193
 
51194
+ // packages/cleo/src/cli/commands/doctor-repair.ts
51195
+ var doctor_repair_exports = {};
51196
+ __export(doctor_repair_exports, {
51197
+ doctorRepairCommand: () => doctorRepairCommand
51198
+ });
51199
+ import { getLogger as getLogger20, getProjectRoot as getProjectRoot42 } from "@cleocode/core";
51200
+ import { repairMalformedDbs } from "@cleocode/core/store/repair-malformed-dbs.js";
51201
+ var doctorRepairCommand;
51202
+ var init_doctor_repair = __esm({
51203
+ "packages/cleo/src/cli/commands/doctor-repair.ts"() {
51204
+ "use strict";
51205
+ init_src2();
51206
+ init_define_cli_command();
51207
+ init_renderers();
51208
+ doctorRepairCommand = defineCommand({
51209
+ meta: {
51210
+ name: "repair",
51211
+ 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."
51212
+ },
51213
+ args: {
51214
+ role: {
51215
+ type: "string",
51216
+ description: `Repair only this DB role (one of: ${DB_INVENTORY.map((e) => e.role).join(", ")})`,
51217
+ default: ""
51218
+ },
51219
+ "dry-run": {
51220
+ type: "boolean",
51221
+ description: "Detect + plan only \u2014 report what would be repaired without quarantining/restoring",
51222
+ default: false
51223
+ }
51224
+ },
51225
+ run({ args }) {
51226
+ const roleArg = typeof args.role === "string" ? args.role.trim() : "";
51227
+ const dryRun = args["dry-run"] === true;
51228
+ if (roleArg.length > 0 && !DB_INVENTORY.some((e) => e.role === roleArg)) {
51229
+ const validRoles = DB_INVENTORY.map((e) => e.role).join(", ");
51230
+ cliError(
51231
+ `Unknown DB role "${roleArg}". Valid roles: ${validRoles}.`,
51232
+ 6 /* VALIDATION_ERROR */,
51233
+ {
51234
+ name: "E_VALIDATION",
51235
+ fix: "Run `cleo doctor repair --help` for the list of valid roles."
51236
+ },
51237
+ { command: "doctor repair" }
51238
+ );
51239
+ process.exitCode = 6 /* VALIDATION_ERROR */;
51240
+ return;
51241
+ }
51242
+ const result = repairMalformedDbs({
51243
+ projectRoot: getProjectRoot42(),
51244
+ roles: roleArg.length > 0 ? [roleArg] : void 0,
51245
+ dryRun,
51246
+ logger: getLogger20("doctor-repair")
51247
+ });
51248
+ for (const r of result.roles) {
51249
+ if (!r.healthy) {
51250
+ humanInfo(` [${r.action.toUpperCase()}] ${r.role} \u2014 ${r.detail}`);
51251
+ }
51252
+ }
51253
+ const verb = dryRun ? "would repair" : "repaired";
51254
+ cliOutput(result, {
51255
+ command: "doctor repair",
51256
+ 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.`
51257
+ });
51258
+ if (result.failedCount > 0) {
51259
+ process.exitCode = 1 /* GENERAL_ERROR */;
51260
+ }
51261
+ }
51262
+ });
51263
+ }
51264
+ });
51265
+
50862
51266
  // packages/cleo/src/cli/progress.ts
50863
51267
  import { stderr } from "node:process";
50864
51268
  function createSelfUpdateProgress(enabled) {
@@ -50996,7 +51400,7 @@ import { join as join23 } from "node:path";
50996
51400
  import {
50997
51401
  ensureGlobalAgentRegistryDb,
50998
51402
  getGlobalAgentRegistryNativeDb,
50999
- getProjectRoot as getProjectRoot41,
51403
+ getProjectRoot as getProjectRoot43,
51000
51404
  installAgentFromCant
51001
51405
  } from "@cleocode/core/internal";
51002
51406
  function sha256Hex(bytes) {
@@ -51184,7 +51588,7 @@ var init_migrate_agents_v2 = __esm({
51184
51588
  }
51185
51589
  },
51186
51590
  async run({ args }) {
51187
- const projectRoot = getProjectRoot41();
51591
+ const projectRoot = getProjectRoot43();
51188
51592
  const verbose = args.quiet !== true;
51189
51593
  if (verbose) {
51190
51594
  humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
@@ -51228,7 +51632,7 @@ __export(doctor_exports, {
51228
51632
  });
51229
51633
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
51230
51634
  import { join as join24 } from "node:path";
51231
- import { getProjectRoot as getProjectRoot42, pushWarning as pushWarning5 } from "@cleocode/core";
51635
+ import { getProjectRoot as getProjectRoot44, pushWarning as pushWarning5 } from "@cleocode/core";
51232
51636
  import { renderInvariantAuditLines } from "@cleocode/core/doctor/invariant-audit-render.js";
51233
51637
  import {
51234
51638
  quarantineRogueCleoDir,
@@ -51350,6 +51754,7 @@ var init_doctor = __esm({
51350
51754
  init_doctor_legacy_backups();
51351
51755
  init_doctor_projects();
51352
51756
  init_doctor_release_readiness();
51757
+ init_doctor_repair();
51353
51758
  init_migrate_agents_v2();
51354
51759
  FIXTURE_ID_PATTERNS = [/^E\d+$/, /^T\d+EP$/];
51355
51760
  FIXTURE_TITLE_KEYWORDS = [
@@ -51369,6 +51774,8 @@ var init_doctor = __esm({
51369
51774
  "exodus-residue": doctorExodusResidueCommand,
51370
51775
  // T11837 / Saga T11242 / Epic T11833 — read-only exodus health report
51371
51776
  "exodus-health": doctorExodusCommand,
51777
+ // T11829 / Saga T11242 / Epic T11833 — DHQ-060 malformed-DB repair entry point
51778
+ repair: doctorRepairCommand,
51372
51779
  // T10458 / Saga T10431 / Epic T10436 — Release-readiness preflight
51373
51780
  "release-readiness": doctorReleaseReadinessCommand
51374
51781
  },
@@ -51573,7 +51980,7 @@ var init_doctor = __esm({
51573
51980
  const { join: pathJoin } = await import("node:path");
51574
51981
  const { existsSync: existsSync22 } = await import("node:fs");
51575
51982
  const { detectAndHealCoreWorktreeLeak } = await import("@cleocode/worktree");
51576
- const projectRoot = getProjectRoot42();
51983
+ const projectRoot = getProjectRoot44();
51577
51984
  let gitRoot = projectRoot;
51578
51985
  try {
51579
51986
  gitRoot = execFile2("git", ["rev-parse", "--show-toplevel"], {
@@ -51625,7 +52032,7 @@ var init_doctor = __esm({
51625
52032
  }
51626
52033
  if (args.brain) {
51627
52034
  const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
51628
- const projectRoot = getProjectRoot42();
52035
+ const projectRoot = getProjectRoot44();
51629
52036
  const dashboard = await computeBrainHealthDashboard(projectRoot);
51630
52037
  cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
51631
52038
  if (dashboard.hasP0Failure) {
@@ -51634,7 +52041,7 @@ var init_doctor = __esm({
51634
52041
  return;
51635
52042
  }
51636
52043
  if (args["scan-test-fixtures-in-prod"]) {
51637
- const projectRoot = getProjectRoot42();
52044
+ const projectRoot = getProjectRoot44();
51638
52045
  const matches = await scanTestFixturesInProd(projectRoot);
51639
52046
  const dryRun = args["dry-run"] !== false && args.quarantine !== true;
51640
52047
  const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
@@ -51722,7 +52129,7 @@ var init_doctor = __esm({
51722
52129
  progress.complete("Comprehensive diagnostics complete");
51723
52130
  } else if (args["scan-rogue-cleo-dirs"]) {
51724
52131
  progress.step(0, "Scanning for rogue .cleo/ directories");
51725
- const projectRoot = getProjectRoot42();
52132
+ const projectRoot = getProjectRoot44();
51726
52133
  const reports = scanRogueCleoDirs(projectRoot);
51727
52134
  progress.complete(
51728
52135
  `Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
@@ -51731,7 +52138,7 @@ var init_doctor = __esm({
51731
52138
  } else if (args["quarantine-rogue-cleo-dirs"]) {
51732
52139
  const isDryRun = args["dry-run"] === true;
51733
52140
  progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
51734
- const projectRoot = getProjectRoot42();
52141
+ const projectRoot = getProjectRoot44();
51735
52142
  const reports = scanRogueCleoDirs(projectRoot);
51736
52143
  if (reports.length === 0) {
51737
52144
  progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
@@ -51785,7 +52192,7 @@ var init_doctor = __esm({
51785
52192
  const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
51786
52193
  const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
51787
52194
  const cleoHome = getCleoHome6();
51788
- const projectRoot = getProjectRoot42();
52195
+ const projectRoot = getProjectRoot44();
51789
52196
  const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
51790
52197
  const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
51791
52198
  const isDryRun = args["dry-run"] === true;
@@ -51818,7 +52225,7 @@ var init_doctor = __esm({
51818
52225
  } else if (args["audit-worktree-orphans"]) {
51819
52226
  progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
51820
52227
  const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
51821
- const projectRoot = getProjectRoot42();
52228
+ const projectRoot = getProjectRoot44();
51822
52229
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
51823
52230
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
51824
52231
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -51875,7 +52282,7 @@ var init_doctor = __esm({
51875
52282
  `${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
51876
52283
  );
51877
52284
  const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
51878
- const projectRoot = getProjectRoot42();
52285
+ const projectRoot = getProjectRoot44();
51879
52286
  const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
51880
52287
  const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
51881
52288
  const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
@@ -51954,7 +52361,7 @@ var init_doctor = __esm({
51954
52361
  `${isDryRun ? "[DRY RUN] " : ""}Migrating .cleo/worktree-include \u2192 .worktreeinclude`
51955
52362
  );
51956
52363
  const { migrateWorktreeIncludeFile } = await import("@cleocode/core");
51957
- const projectRoot = getProjectRoot42();
52364
+ const projectRoot = getProjectRoot44();
51958
52365
  const result = await migrateWorktreeIncludeFile(projectRoot, { dryRun: isDryRun });
51959
52366
  progress.complete(`Migration ${result.action}`);
51960
52367
  cliOutput(result, { command: "doctor", operation: "doctor.migrate-worktree-include" });
@@ -51973,7 +52380,7 @@ var init_doctor = __esm({
51973
52380
  const stepLabel = isFocusedAlias ? "Auditing Saga hierarchy for ADR-073 invariants" : "Walking central INVARIANTS_REGISTRY";
51974
52381
  progress.step(0, stepLabel);
51975
52382
  const { auditInvariantRegistry } = await import("@cleocode/core/doctor/invariant-audit.js");
51976
- const projectRoot = getProjectRoot42();
52383
+ const projectRoot = getProjectRoot44();
51977
52384
  const result = await auditInvariantRegistry(projectRoot, { adrFilter });
51978
52385
  const operation = isFocusedAlias ? "doctor.audit-sagas" : "doctor.audit-invariants";
51979
52386
  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 +52402,7 @@ var init_doctor = __esm({
51995
52402
  { command: "doctor", operation: "admin.health" }
51996
52403
  );
51997
52404
  try {
51998
- const projectRoot = getProjectRoot42();
52405
+ const projectRoot = getProjectRoot44();
51999
52406
  const conflicts = readMigrationConflicts(projectRoot);
52000
52407
  if (conflicts.length > 0) {
52001
52408
  progress.complete(
@@ -52026,7 +52433,7 @@ var init_doctor = __esm({
52026
52433
  progress.complete("Health check complete");
52027
52434
  }
52028
52435
  try {
52029
- const projectRoot = getProjectRoot42();
52436
+ const projectRoot = getProjectRoot44();
52030
52437
  const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
52031
52438
  const sagaAudit = await auditSagaHierarchy(projectRoot);
52032
52439
  if (sagaAudit.sagas.length === 0) {
@@ -53612,7 +54019,7 @@ var go_exports = {};
53612
54019
  __export(go_exports, {
53613
54020
  goCommand: () => goCommand
53614
54021
  });
53615
- import { getProjectRoot as getProjectRoot43, go } from "@cleocode/core";
54022
+ import { getProjectRoot as getProjectRoot45, go } from "@cleocode/core";
53616
54023
  var goCommand;
53617
54024
  var init_go = __esm({
53618
54025
  "packages/cleo/src/cli/commands/go.ts"() {
@@ -53637,7 +54044,7 @@ var init_go = __esm({
53637
54044
  }
53638
54045
  },
53639
54046
  async run({ args }) {
53640
- const projectRoot = getProjectRoot43();
54047
+ const projectRoot = getProjectRoot45();
53641
54048
  const result = await go.cleoGo({
53642
54049
  sagaId: typeof args.saga === "string" && args.saga.length > 0 ? args.saga : void 0,
53643
54050
  headless: args.headless === true,
@@ -53654,7 +54061,7 @@ var goal_exports = {};
53654
54061
  __export(goal_exports, {
53655
54062
  goalCommand: () => goalCommand
53656
54063
  });
53657
- import { getProjectRoot as getProjectRoot44, goal } from "@cleocode/core";
54064
+ import { getProjectRoot as getProjectRoot46, goal } from "@cleocode/core";
53658
54065
  function resolveGoalKind(task) {
53659
54066
  if (typeof task === "string" && task.length > 0) {
53660
54067
  if (!isValidGoalTargetTaskId(task)) {
@@ -53701,7 +54108,7 @@ var init_goal2 = __esm({
53701
54108
  }
53702
54109
  const record = await goal.createGoal(
53703
54110
  { goalKind: kindResult.kind, intent, turnBudget: resolveTurnBudget(args.turns) },
53704
- getProjectRoot44()
54111
+ getProjectRoot46()
53705
54112
  );
53706
54113
  cliOutput(record, { command: "goal set", operation: "goal.set" });
53707
54114
  }
@@ -53712,7 +54119,7 @@ var init_goal2 = __esm({
53712
54119
  description: "Show the current agent's active goal (per-agent scoped)."
53713
54120
  },
53714
54121
  async run() {
53715
- const record = await goal.getActiveGoal(getProjectRoot44());
54122
+ const record = await goal.getActiveGoal(getProjectRoot46());
53716
54123
  cliOutput(record ?? { active: null }, { command: "goal status", operation: "goal.status" });
53717
54124
  }
53718
54125
  });
@@ -53734,7 +54141,7 @@ var init_goal2 = __esm({
53734
54141
  });
53735
54142
  return;
53736
54143
  }
53737
- const cwd = getProjectRoot44();
54144
+ const cwd = getProjectRoot46();
53738
54145
  const parent = await goal.getActiveGoal(cwd);
53739
54146
  if (!parent) {
53740
54147
  cliError(
@@ -53782,7 +54189,7 @@ var init_goal2 = __esm({
53782
54189
  });
53783
54190
  return;
53784
54191
  }
53785
- const cwd = getProjectRoot44();
54192
+ const cwd = getProjectRoot46();
53786
54193
  const result = await goal.advanceGoalWithPersist(goalId, { cwd });
53787
54194
  if (!result) {
53788
54195
  cliError(`Goal '${goalId}' not found.`, 4 /* NOT_FOUND */, { name: "E_NOT_FOUND" });
@@ -53807,7 +54214,7 @@ var init_goal2 = __esm({
53807
54214
  });
53808
54215
  return;
53809
54216
  }
53810
- const cwd = getProjectRoot44();
54217
+ const cwd = getProjectRoot46();
53811
54218
  const active = await goal.getActiveGoal(cwd);
53812
54219
  if (!active) {
53813
54220
  cliError(
@@ -54796,7 +55203,7 @@ var hygiene_exports = {};
54796
55203
  __export(hygiene_exports, {
54797
55204
  hygieneCommand: () => hygieneCommand
54798
55205
  });
54799
- import { getProjectRoot as getProjectRoot45 } from "@cleocode/core";
55206
+ import { getProjectRoot as getProjectRoot47 } from "@cleocode/core";
54800
55207
  import { runSpawnReadinessHygieneCli } from "@cleocode/core/hygiene/validate-spawn-readiness.js";
54801
55208
  var hygieneCommand;
54802
55209
  var init_hygiene = __esm({
@@ -54825,7 +55232,7 @@ var init_hygiene = __esm({
54825
55232
  }
54826
55233
  },
54827
55234
  async run({ args }) {
54828
- const projectRoot = args["project-root"] || getProjectRoot45() || process.cwd();
55235
+ const projectRoot = args["project-root"] || getProjectRoot47() || process.cwd();
54829
55236
  const worktreePath = args["worktree-path"];
54830
55237
  await runSpawnReadinessHygieneCli(projectRoot, worktreePath);
54831
55238
  }
@@ -55000,7 +55407,7 @@ import { existsSync as existsSync16, readFileSync as readFileSync14 } from "node
55000
55407
  import { join as join27 } from "node:path";
55001
55408
  import { fileURLToPath as fileURLToPath5 } from "node:url";
55002
55409
  import {
55003
- CleoError as CleoError5,
55410
+ CleoError as CleoError6,
55004
55411
  getWorkflowTemplatesDir as getCoreWorkflowTemplatesDir,
55005
55412
  initProject as initProject2,
55006
55413
  pushWarning as pushWarning6,
@@ -55140,7 +55547,7 @@ var init_init = __esm({
55140
55547
  { command: "init" }
55141
55548
  );
55142
55549
  } catch (err) {
55143
- if (err instanceof CleoError5) {
55550
+ if (err instanceof CleoError6) {
55144
55551
  cliError(`init failed: ${err.message}`, err.code, { name: "E_INTERNAL" });
55145
55552
  process.exit(err.code);
55146
55553
  }
@@ -55988,7 +56395,7 @@ var llm_cost_exports = {};
55988
56395
  __export(llm_cost_exports, {
55989
56396
  costCommand: () => costCommand
55990
56397
  });
55991
- import { getProjectRoot as getProjectRoot46 } from "@cleocode/core/internal";
56398
+ import { getProjectRoot as getProjectRoot48 } from "@cleocode/core/internal";
55992
56399
  import { computeCost } from "@cleocode/core/llm/usage-pricing";
55993
56400
  function resolveSessionId(raw) {
55994
56401
  if (raw === "current") {
@@ -56061,7 +56468,7 @@ var init_llm_cost = __esm({
56061
56468
  process.exit(6);
56062
56469
  }
56063
56470
  const sessionId = resolveSessionId(rawSessionId);
56064
- const projectRoot = getProjectRoot46(process.cwd());
56471
+ const projectRoot = getProjectRoot48(process.cwd());
56065
56472
  let breakdown;
56066
56473
  try {
56067
56474
  breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
@@ -57635,7 +58042,7 @@ var memory_exports = {};
57635
58042
  __export(memory_exports, {
57636
58043
  memoryCommand: () => memoryCommand
57637
58044
  });
57638
- import { getProjectRoot as getProjectRoot47 } from "@cleocode/core";
58045
+ import { getProjectRoot as getProjectRoot49 } from "@cleocode/core";
57639
58046
  import {
57640
58047
  getBrainDb as getBrainDb2,
57641
58048
  getDreamStatus,
@@ -58568,7 +58975,7 @@ var init_memory3 = __esm({
58568
58975
  },
58569
58976
  args: {},
58570
58977
  async run() {
58571
- const root = getProjectRoot47();
58978
+ const root = getProjectRoot49();
58572
58979
  try {
58573
58980
  const result = await runConsolidation(root);
58574
58981
  cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
@@ -58592,7 +58999,7 @@ var init_memory3 = __esm({
58592
58999
  }
58593
59000
  },
58594
59001
  async run({ args }) {
58595
- const root = getProjectRoot47();
59002
+ const root = getProjectRoot49();
58596
59003
  if (args.status) {
58597
59004
  try {
58598
59005
  const status = await getDreamStatus(root);
@@ -58629,7 +59036,7 @@ var init_memory3 = __esm({
58629
59036
  }
58630
59037
  },
58631
59038
  async run({ args }) {
58632
- const root = getProjectRoot47();
59039
+ const root = getProjectRoot49();
58633
59040
  try {
58634
59041
  const { runObserver, runReflector } = await import("@cleocode/core/memory");
58635
59042
  const observerResult = await runObserver(root, args.session, {
@@ -58669,7 +59076,7 @@ var init_memory3 = __esm({
58669
59076
  }
58670
59077
  },
58671
59078
  async run({ args }) {
58672
- const root = getProjectRoot47();
59079
+ const root = getProjectRoot49();
58673
59080
  try {
58674
59081
  await getBrainDb2(root);
58675
59082
  const { totalDuplicateRows, groups } = await scanDuplicateEntries();
@@ -58715,7 +59122,7 @@ var init_memory3 = __esm({
58715
59122
  async run({ args }) {
58716
59123
  const sourceDir = args.from;
58717
59124
  const isDryRun = !!args["dry-run"];
58718
- const projectRoot = getProjectRoot47();
59125
+ const projectRoot = getProjectRoot49();
58719
59126
  try {
58720
59127
  const result = await importMemoryFiles({
58721
59128
  sourceDir,
@@ -58866,7 +59273,7 @@ var init_memory3 = __esm({
58866
59273
  },
58867
59274
  args: {},
58868
59275
  async run() {
58869
- const root = getProjectRoot47();
59276
+ const root = getProjectRoot49();
58870
59277
  try {
58871
59278
  await getBrainDb2(root);
58872
59279
  const result = await getTierStats(root);
@@ -58909,7 +59316,7 @@ var init_memory3 = __esm({
58909
59316
  }
58910
59317
  },
58911
59318
  async run({ args }) {
58912
- const root = getProjectRoot47();
59319
+ const root = getProjectRoot49();
58913
59320
  const targetTier = args.to;
58914
59321
  const reason = args.reason;
58915
59322
  const validTiers = ["medium", "long"];
@@ -58975,7 +59382,7 @@ var init_memory3 = __esm({
58975
59382
  }
58976
59383
  },
58977
59384
  async run({ args }) {
58978
- const root = getProjectRoot47();
59385
+ const root = getProjectRoot49();
58979
59386
  const targetTier = args.to;
58980
59387
  const reason = args.reason;
58981
59388
  const validTiers = ["short", "medium"];
@@ -59438,7 +59845,7 @@ var migrate_claude_mem_exports = {};
59438
59845
  __export(migrate_claude_mem_exports, {
59439
59846
  migrateClaudeMemCommand: () => migrateClaudeMemCommand
59440
59847
  });
59441
- import { getProjectRoot as getProjectRoot48, migrateClaudeMem } from "@cleocode/core/internal";
59848
+ import { getProjectRoot as getProjectRoot50, migrateClaudeMem } from "@cleocode/core/internal";
59442
59849
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
59443
59850
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
59444
59851
  var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
@@ -59501,7 +59908,7 @@ var init_migrate_claude_mem = __esm({
59501
59908
  }
59502
59909
  },
59503
59910
  async run({ args }) {
59504
- const root = getProjectRoot48();
59911
+ const root = getProjectRoot50();
59505
59912
  try {
59506
59913
  const result = await migrateClaudeMem(root, {
59507
59914
  sourcePath: args.source,
@@ -59550,7 +59957,7 @@ var init_migrate_claude_mem = __esm({
59550
59957
  }
59551
59958
  },
59552
59959
  async run({ args }) {
59553
- const projectRoot = getProjectRoot48();
59960
+ const projectRoot = getProjectRoot50();
59554
59961
  try {
59555
59962
  const db = await getDb2(projectRoot);
59556
59963
  const rcasdFlag = Boolean(args.rcasd);
@@ -59668,7 +60075,7 @@ __export(nexus_exports, {
59668
60075
  import { appendFile as appendFile2, mkdir as mkdir4 } from "node:fs/promises";
59669
60076
  import { homedir as homedir5 } from "node:os";
59670
60077
  import path4 from "node:path";
59671
- import { getProjectRoot as getProjectRoot49 } from "@cleocode/core";
60078
+ import { getProjectRoot as getProjectRoot51 } from "@cleocode/core";
59672
60079
  import { getSymbolImpact } from "@cleocode/core/nexus";
59673
60080
  import { runNexusAnalysis } from "@cleocode/core/nexus/analyze-orchestrator.js";
59674
60081
  import { exportNexusGraph } from "@cleocode/core/nexus/export.js";
@@ -59783,7 +60190,7 @@ var init_nexus3 = __esm({
59783
60190
  async run({ args }) {
59784
60191
  applyJsonFlag2(args.json);
59785
60192
  const projectIdOverride = args["project-id"];
59786
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60193
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
59787
60194
  const startTime = Date.now();
59788
60195
  try {
59789
60196
  const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
@@ -60298,7 +60705,7 @@ var init_nexus3 = __esm({
60298
60705
  applyJsonFlag2(args.json);
60299
60706
  const startTime = Date.now();
60300
60707
  const projectIdOverride = args["project-id"];
60301
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60708
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
60302
60709
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60303
60710
  const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
60304
60711
  const durationMs = Date.now() - startTime;
@@ -60342,7 +60749,7 @@ var init_nexus3 = __esm({
60342
60749
  applyJsonFlag2(args.json);
60343
60750
  const startTime = Date.now();
60344
60751
  const projectIdOverride = args["project-id"];
60345
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60752
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
60346
60753
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60347
60754
  const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
60348
60755
  const durationMs = Date.now() - startTime;
@@ -60385,7 +60792,7 @@ var init_nexus3 = __esm({
60385
60792
  void appendDeprecationTelemetry("nexus.context", "cleo graph context");
60386
60793
  const startTime = Date.now();
60387
60794
  const projectIdOverride = args["project-id"];
60388
- const repoPath = getProjectRoot49();
60795
+ const repoPath = getProjectRoot51();
60389
60796
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60390
60797
  const limit = parseInt(args.limit, 10);
60391
60798
  const symbolName = args.symbol;
@@ -60448,7 +60855,7 @@ var init_nexus3 = __esm({
60448
60855
  const startTime = Date.now();
60449
60856
  const whyFlag = !!args.why;
60450
60857
  const projectIdOverride = args["project-id"];
60451
- const repoPath = getProjectRoot49();
60858
+ const repoPath = getProjectRoot51();
60452
60859
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60453
60860
  const maxDepth = Math.min(parseInt(args.depth, 10), 5);
60454
60861
  const symbolName = args.symbol;
@@ -60520,7 +60927,7 @@ var init_nexus3 = __esm({
60520
60927
  const projectIdOverride = args["project-id"];
60521
60928
  const isIncremental = !!args.incremental;
60522
60929
  const ctx = getFormatContext();
60523
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
60930
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
60524
60931
  humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
60525
60932
  if (!isIncremental) humanInfo("[nexus] Clearing existing index for project...");
60526
60933
  try {
@@ -60623,7 +61030,7 @@ var init_nexus3 = __esm({
60623
61030
  async run({ args }) {
60624
61031
  applyJsonFlag2(args.json);
60625
61032
  const startTime = Date.now();
60626
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61033
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
60627
61034
  const name = args.name;
60628
61035
  const response = await dispatchRaw("mutate", "nexus", "projects.register", {
60629
61036
  path: repoPath,
@@ -60981,7 +61388,7 @@ var init_nexus3 = __esm({
60981
61388
  applyJsonFlag2(args.json);
60982
61389
  const startTime = Date.now();
60983
61390
  const projectIdOverride = args["project-id"];
60984
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61391
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
60985
61392
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
60986
61393
  const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
60987
61394
  repoPath,
@@ -61087,7 +61494,7 @@ var init_nexus3 = __esm({
61087
61494
  async run({ args }) {
61088
61495
  applyJsonFlag2(args.json);
61089
61496
  const startTime = Date.now();
61090
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61497
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
61091
61498
  const projectIdOverride = args["project-id"];
61092
61499
  const beforeRef = args.before ?? "HEAD~1";
61093
61500
  const afterRef = args.after ?? "HEAD";
@@ -61205,7 +61612,7 @@ var init_nexus3 = __esm({
61205
61612
  applyJsonFlag2(args.json);
61206
61613
  const startTime = Date.now();
61207
61614
  const projectIdOverride = args["project-id"];
61208
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61615
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
61209
61616
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
61210
61617
  const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
61211
61618
  const durationMs = Date.now() - startTime;
@@ -61261,7 +61668,7 @@ var init_nexus3 = __esm({
61261
61668
  const startTime = Date.now();
61262
61669
  const routeSymbol = args.routeSymbol;
61263
61670
  const projectIdOverride = args["project-id"];
61264
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
61671
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
61265
61672
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
61266
61673
  const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
61267
61674
  const durationMs = Date.now() - startTime;
@@ -61651,7 +62058,7 @@ var init_nexus3 = __esm({
61651
62058
  async run({ args }) {
61652
62059
  applyJsonFlag2(args.json);
61653
62060
  const startTime = Date.now();
61654
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
62061
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
61655
62062
  const projectIdOverride = args["project-id"];
61656
62063
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
61657
62064
  const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
@@ -61755,7 +62162,7 @@ var init_nexus3 = __esm({
61755
62162
  async run({ args }) {
61756
62163
  applyJsonFlag2(args.json);
61757
62164
  const startTime = Date.now();
61758
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot49();
62165
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot51();
61759
62166
  const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
61760
62167
  const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
61761
62168
  projectId,
@@ -61836,7 +62243,7 @@ var init_nexus3 = __esm({
61836
62243
  const isIncremental = !!args.incremental;
61837
62244
  try {
61838
62245
  const result = await runNexusWiki({
61839
- projectRoot: getProjectRoot49(),
62246
+ projectRoot: getProjectRoot51(),
61840
62247
  outputDir,
61841
62248
  communityFilter,
61842
62249
  incremental: isIncremental
@@ -62186,7 +62593,7 @@ __export(orchestrate_exports, {
62186
62593
  });
62187
62594
  import { execFileSync as execFileSync3 } from "node:child_process";
62188
62595
  import { orchestration } from "@cleocode/core";
62189
- import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot50 } from "@cleocode/core/internal";
62596
+ import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot52 } from "@cleocode/core/internal";
62190
62597
  function formatRollupTable(rollup) {
62191
62598
  const waves = "waves" in rollup ? rollup.waves : [rollup];
62192
62599
  const lines = [];
@@ -62329,7 +62736,7 @@ var init_orchestrate3 = __esm({
62329
62736
  },
62330
62737
  async run({ args }) {
62331
62738
  const rateWindowHours = args.window !== void 0 ? Number.parseFloat(String(args.window)) : void 0;
62332
- const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot50(), {
62739
+ const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot52(), {
62333
62740
  ...rateWindowHours !== void 0 && Number.isFinite(rateWindowHours) && rateWindowHours > 0 ? { rateWindowHours } : {}
62334
62741
  });
62335
62742
  cliOutput(metrics, {
@@ -63181,7 +63588,7 @@ __export(otel_exports, {
63181
63588
  otelCommand: () => otelCommand
63182
63589
  });
63183
63590
  import {
63184
- CleoError as CleoError6,
63591
+ CleoError as CleoError7,
63185
63592
  clearOtelData,
63186
63593
  formatError as formatError4,
63187
63594
  getOtelSessions,
@@ -63203,7 +63610,7 @@ var init_otel = __esm({
63203
63610
  const result = await getOtelStatus();
63204
63611
  cliOutput(result, { command: "otel" });
63205
63612
  } catch (err) {
63206
- if (err instanceof CleoError6) {
63613
+ if (err instanceof CleoError7) {
63207
63614
  cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
63208
63615
  process.exit(err.code);
63209
63616
  }
@@ -63218,7 +63625,7 @@ var init_otel = __esm({
63218
63625
  const result = await getOtelSummary();
63219
63626
  cliOutput(result, { command: "otel" });
63220
63627
  } catch (err) {
63221
- if (err instanceof CleoError6) {
63628
+ if (err instanceof CleoError7) {
63222
63629
  cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
63223
63630
  process.exit(err.code);
63224
63631
  }
@@ -63246,7 +63653,7 @@ var init_otel = __esm({
63246
63653
  });
63247
63654
  cliOutput(result, { command: "otel" });
63248
63655
  } catch (err) {
63249
- if (err instanceof CleoError6) {
63656
+ if (err instanceof CleoError7) {
63250
63657
  cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
63251
63658
  process.exit(err.code);
63252
63659
  }
@@ -63274,7 +63681,7 @@ var init_otel = __esm({
63274
63681
  });
63275
63682
  cliOutput(result, { command: "otel" });
63276
63683
  } catch (err) {
63277
- if (err instanceof CleoError6) {
63684
+ if (err instanceof CleoError7) {
63278
63685
  cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
63279
63686
  process.exit(err.code);
63280
63687
  }
@@ -63302,7 +63709,7 @@ var init_otel = __esm({
63302
63709
  });
63303
63710
  cliOutput(result, { command: "otel" });
63304
63711
  } catch (err) {
63305
- if (err instanceof CleoError6) {
63712
+ if (err instanceof CleoError7) {
63306
63713
  cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
63307
63714
  process.exit(err.code);
63308
63715
  }
@@ -63317,7 +63724,7 @@ var init_otel = __esm({
63317
63724
  const result = await clearOtelData();
63318
63725
  cliOutput(result, { command: "otel" });
63319
63726
  } catch (err) {
63320
- if (err instanceof CleoError6) {
63727
+ if (err instanceof CleoError7) {
63321
63728
  cliError(formatError4(err), err.code, { name: "E_INTERNAL" });
63322
63729
  process.exit(err.code);
63323
63730
  }
@@ -64534,7 +64941,7 @@ var refresh_memory_exports = {};
64534
64941
  __export(refresh_memory_exports, {
64535
64942
  refreshMemoryCommand: () => refreshMemoryCommand
64536
64943
  });
64537
- import { getProjectRoot as getProjectRoot51 } from "@cleocode/core";
64944
+ import { getProjectRoot as getProjectRoot53 } from "@cleocode/core";
64538
64945
  var refreshMemoryCommand;
64539
64946
  var init_refresh_memory = __esm({
64540
64947
  "packages/cleo/src/cli/commands/refresh-memory.ts"() {
@@ -64547,7 +64954,7 @@ var init_refresh_memory = __esm({
64547
64954
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
64548
64955
  },
64549
64956
  async run() {
64550
- const projectDir = getProjectRoot51();
64957
+ const projectDir = getProjectRoot53();
64551
64958
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
64552
64959
  const result = await writeMemoryBridge(projectDir);
64553
64960
  if (result.written) {
@@ -65253,7 +65660,7 @@ __export(remote_exports, {
65253
65660
  });
65254
65661
  import {
65255
65662
  addRemote,
65256
- CleoError as CleoError7,
65663
+ CleoError as CleoError8,
65257
65664
  getRemoteSyncStatus as getRemoteGitStatus,
65258
65665
  listRemotes,
65259
65666
  pull,
@@ -65291,7 +65698,7 @@ var init_remote = __esm({
65291
65698
  { command: "remote", message: `Remote '${name}' added: ${args.url}` }
65292
65699
  );
65293
65700
  } catch (err) {
65294
- if (err instanceof CleoError7) {
65701
+ if (err instanceof CleoError8) {
65295
65702
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
65296
65703
  process.exit(err.code);
65297
65704
  }
@@ -65320,7 +65727,7 @@ var init_remote = __esm({
65320
65727
  { command: "remote", message: `Remote '${args.name}' removed` }
65321
65728
  );
65322
65729
  } catch (err) {
65323
- if (err instanceof CleoError7) {
65730
+ if (err instanceof CleoError8) {
65324
65731
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
65325
65732
  process.exit(err.code);
65326
65733
  }
@@ -65345,7 +65752,7 @@ var init_remote = __esm({
65345
65752
  }
65346
65753
  );
65347
65754
  } catch (err) {
65348
- if (err instanceof CleoError7) {
65755
+ if (err instanceof CleoError8) {
65349
65756
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
65350
65757
  process.exit(err.code);
65351
65758
  }
@@ -65385,7 +65792,7 @@ var init_remote = __esm({
65385
65792
  }
65386
65793
  cliOutput({ ...status }, { command: "remote", message });
65387
65794
  } catch (err) {
65388
- if (err instanceof CleoError7) {
65795
+ if (err instanceof CleoError8) {
65389
65796
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
65390
65797
  process.exit(err.code);
65391
65798
  }
@@ -65449,7 +65856,7 @@ var init_remote = __esm({
65449
65856
  { command: "push", message: result.message }
65450
65857
  );
65451
65858
  } catch (err) {
65452
- if (err instanceof CleoError7) {
65859
+ if (err instanceof CleoError8) {
65453
65860
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
65454
65861
  process.exit(err.code);
65455
65862
  }
@@ -65492,7 +65899,7 @@ var init_remote = __esm({
65492
65899
  { command: "pull", message: result.message }
65493
65900
  );
65494
65901
  } catch (err) {
65495
- if (err instanceof CleoError7) {
65902
+ if (err instanceof CleoError8) {
65496
65903
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
65497
65904
  process.exit(err.code);
65498
65905
  }
@@ -66073,8 +66480,8 @@ __export(restore_exports, {
66073
66480
  import fs3 from "node:fs";
66074
66481
  import path5 from "node:path";
66075
66482
  import {
66076
- CleoError as CleoError8,
66077
- getProjectRoot as getProjectRoot52,
66483
+ CleoError as CleoError9,
66484
+ getProjectRoot as getProjectRoot54,
66078
66485
  getTaskAccessor as getTaskAccessor3,
66079
66486
  parseConflictReport,
66080
66487
  setAtPath
@@ -66095,7 +66502,7 @@ var init_restore = __esm({
66095
66502
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
66096
66503
  },
66097
66504
  async run() {
66098
- const projectRoot = getProjectRoot52();
66505
+ const projectRoot = getProjectRoot54();
66099
66506
  const reportPath = path5.join(projectRoot, CLEO_DIR_NAME3, RESTORE_CONFLICTS_MD);
66100
66507
  if (!fs3.existsSync(reportPath)) {
66101
66508
  humanLine("No pending restore conflicts. Nothing to finalize.");
@@ -66198,7 +66605,7 @@ var init_restore = __esm({
66198
66605
  });
66199
66606
  if (!response.success) {
66200
66607
  const code = ExitCode[response.error?.code] ?? 1 /* GENERAL_ERROR */;
66201
- throw new CleoError8(code, response.error?.message ?? "Backup restore failed");
66608
+ throw new CleoError9(code, response.error?.message ?? "Backup restore failed");
66202
66609
  }
66203
66610
  const data = response.data;
66204
66611
  if (args["dry-run"]) {
@@ -66227,7 +66634,7 @@ var init_restore = __esm({
66227
66634
  { command: "restore", operation: "admin.backup.restore" }
66228
66635
  );
66229
66636
  } catch (err) {
66230
- if (err instanceof CleoError8) {
66637
+ if (err instanceof CleoError9) {
66231
66638
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
66232
66639
  process.exit(err.code);
66233
66640
  }
@@ -66271,7 +66678,7 @@ var init_restore = __esm({
66271
66678
  const taskId = args.taskId;
66272
66679
  const idPattern = /^T\d{3,}$/;
66273
66680
  if (!idPattern.test(taskId)) {
66274
- throw new CleoError8(2 /* INVALID_INPUT */, `Invalid task ID: ${taskId}`);
66681
+ throw new CleoError9(2 /* INVALID_INPUT */, `Invalid task ID: ${taskId}`);
66275
66682
  }
66276
66683
  const accessor = await getTaskAccessor3();
66277
66684
  const activeTask = await accessor.loadSingleTask(taskId);
@@ -66298,7 +66705,7 @@ var init_restore = __esm({
66298
66705
  const response = await dispatchRaw("mutate", "tasks", "restore", { taskId });
66299
66706
  if (!response.success) {
66300
66707
  const code = ExitCode[response.error?.code] ?? 1 /* GENERAL_ERROR */;
66301
- throw new CleoError8(code, response.error?.message ?? "Task restore failed");
66708
+ throw new CleoError9(code, response.error?.message ?? "Task restore failed");
66302
66709
  }
66303
66710
  const resultData = response.data;
66304
66711
  cliOutput(
@@ -66340,7 +66747,7 @@ var init_restore = __esm({
66340
66747
  });
66341
66748
  if (!response.success) {
66342
66749
  const code = ExitCode[response.error?.code] ?? 1 /* GENERAL_ERROR */;
66343
- throw new CleoError8(code, response.error?.message ?? "Task restore failed");
66750
+ throw new CleoError9(code, response.error?.message ?? "Task restore failed");
66344
66751
  }
66345
66752
  const resultData = response.data;
66346
66753
  cliOutput(
@@ -66355,7 +66762,7 @@ var init_restore = __esm({
66355
66762
  );
66356
66763
  return;
66357
66764
  } else {
66358
- throw new CleoError8(
66765
+ throw new CleoError9(
66359
66766
  6 /* VALIDATION_ERROR */,
66360
66767
  `Task ${taskId} is already active with status: ${activeTask.status}`
66361
66768
  );
@@ -66387,7 +66794,7 @@ var init_restore = __esm({
66387
66794
  }
66388
66795
  }
66389
66796
  }
66390
- throw new CleoError8(
66797
+ throw new CleoError9(
66391
66798
  4 /* NOT_FOUND */,
66392
66799
  `Task ${taskId} not found in active tasks or archive`,
66393
66800
  {
@@ -66405,7 +66812,7 @@ var init_restore = __esm({
66405
66812
  });
66406
66813
  if (!response.success) {
66407
66814
  const code = ExitCode[response.error?.code] ?? 1 /* GENERAL_ERROR */;
66408
- throw new CleoError8(code, response.error?.message ?? "Task unarchive failed");
66815
+ throw new CleoError9(code, response.error?.message ?? "Task unarchive failed");
66409
66816
  }
66410
66817
  const resultData = response.data;
66411
66818
  cliOutput(
@@ -66419,7 +66826,7 @@ var init_restore = __esm({
66419
66826
  { command: "restore", operation: "tasks.restore" }
66420
66827
  );
66421
66828
  } catch {
66422
- throw new CleoError8(
66829
+ throw new CleoError9(
66423
66830
  4 /* NOT_FOUND */,
66424
66831
  `Task ${taskId} not found in active tasks or archive`,
66425
66832
  {
@@ -66428,7 +66835,7 @@ var init_restore = __esm({
66428
66835
  );
66429
66836
  }
66430
66837
  } catch (err) {
66431
- if (err instanceof CleoError8) {
66838
+ if (err instanceof CleoError9) {
66432
66839
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
66433
66840
  process.exit(err.code);
66434
66841
  }
@@ -67017,8 +67424,8 @@ var init_saga = __esm({
67017
67424
  }
67018
67425
  },
67019
67426
  async run({ args }) {
67020
- const { sagas: sagas2, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
67021
- const projectRoot = getProjectRoot58();
67427
+ const { sagas: sagas2, getProjectRoot: getProjectRoot60 } = await import("@cleocode/core");
67428
+ const projectRoot = getProjectRoot60();
67022
67429
  const sagaId = typeof args.sagaId === "string" && args.sagaId.length > 0 ? args.sagaId : void 0;
67023
67430
  const result = await sagas2.sagaNext(projectRoot, { sagaId });
67024
67431
  cliOutput(result.success ? result.data : result, { command: "saga", operation: "saga.next" });
@@ -67217,7 +67624,7 @@ import * as readline2 from "node:readline";
67217
67624
  import { promisify } from "node:util";
67218
67625
  import {
67219
67626
  BUILD_CONFIG as BUILD_CONFIG3,
67220
- CleoError as CleoError9,
67627
+ CleoError as CleoError10,
67221
67628
  checkAllRegisteredProjects as checkAllRegisteredProjects2,
67222
67629
  checkStorageMigration,
67223
67630
  getCleoHome as getCleoHome4,
@@ -67552,7 +67959,7 @@ var init_self_update = __esm({
67552
67959
  const currentVersion = isDev ? await getCurrentVersion() : await getNpmInstalledVersion() ?? await getCurrentVersion();
67553
67960
  const rawChannel = args.channel?.toLowerCase();
67554
67961
  if (rawChannel && rawChannel !== "stable" && rawChannel !== "beta") {
67555
- throw new CleoError9(
67962
+ throw new CleoError10(
67556
67963
  6 /* VALIDATION_ERROR */,
67557
67964
  `Invalid --channel '${rawChannel}'. Expected stable|beta`
67558
67965
  );
@@ -67594,7 +68001,7 @@ var init_self_update = __esm({
67594
68001
  progress.step(2, "Querying npm registry");
67595
68002
  const latest2 = await getDistTagVersion(requestedChannel === "beta" ? "beta" : "latest");
67596
68003
  if (!latest2) {
67597
- throw new CleoError9(
68004
+ throw new CleoError10(
67598
68005
  5 /* DEPENDENCY_ERROR */,
67599
68006
  "Failed to check latest version from GitHub"
67600
68007
  );
@@ -67624,7 +68031,7 @@ var init_self_update = __esm({
67624
68031
  progress.step(2, "Querying npm registry");
67625
68032
  const latest = args.version ?? await getDistTagVersion(requestedChannel === "beta" ? "beta" : "latest");
67626
68033
  if (!latest) {
67627
- throw new CleoError9(
68034
+ throw new CleoError10(
67628
68035
  5 /* DEPENDENCY_ERROR */,
67629
68036
  "Failed to check latest version from GitHub"
67630
68037
  );
@@ -67669,7 +68076,7 @@ var init_self_update = __esm({
67669
68076
  });
67670
68077
  progress.complete(`Updated to ${latest}`);
67671
68078
  } catch (err) {
67672
- if (err instanceof CleoError9) {
68079
+ if (err instanceof CleoError10) {
67673
68080
  progress.error(err.message);
67674
68081
  cliError(
67675
68082
  err.message,
@@ -68760,7 +69167,7 @@ var sequence_exports = {};
68760
69167
  __export(sequence_exports, {
68761
69168
  sequenceCommand: () => sequenceCommand
68762
69169
  });
68763
- import { getProjectRoot as getProjectRoot53 } from "@cleocode/core/internal";
69170
+ import { getProjectRoot as getProjectRoot55 } from "@cleocode/core/internal";
68764
69171
  var showCommand13, checkCommand7, repairCommand2, sequenceCommand;
68765
69172
  var init_sequence = __esm({
68766
69173
  "packages/cleo/src/cli/commands/sequence.ts"() {
@@ -68796,7 +69203,7 @@ var init_sequence = __esm({
68796
69203
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
68797
69204
  async run() {
68798
69205
  const { repairSequence } = await import("@cleocode/core/internal");
68799
- const projectRoot = getProjectRoot53();
69206
+ const projectRoot = getProjectRoot55();
68800
69207
  const repair = await repairSequence(projectRoot);
68801
69208
  const result = {
68802
69209
  repaired: repair.repaired,
@@ -69251,8 +69658,8 @@ var init_session4 = __esm({
69251
69658
  "audit-scope": { type: "string", description: "Audit log scope (global|local)" }
69252
69659
  },
69253
69660
  async run({ args }) {
69254
- const { detectSessionDrift, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
69255
- const projectRoot = await getProjectRoot58();
69661
+ const { detectSessionDrift, getProjectRoot: getProjectRoot60 } = await import("@cleocode/core");
69662
+ const projectRoot = await getProjectRoot60();
69256
69663
  const scope = args["audit-scope"] === "local" ? "local" : "global";
69257
69664
  const report = await detectSessionDrift({ projectRoot, auditScope: scope });
69258
69665
  cliOutput(report, { command: "session drift", operation: "session.drift" });
@@ -71225,7 +71632,7 @@ var sticky_exports = {};
71225
71632
  __export(sticky_exports, {
71226
71633
  stickyCommand: () => stickyCommand
71227
71634
  });
71228
- import { CleoError as CleoError10 } from "@cleocode/core";
71635
+ import { CleoError as CleoError11 } from "@cleocode/core";
71229
71636
  var addCommand13, listCommand25, showCommand16, convertCommand, archiveCommand4, purgeCommand2, stickyCommand;
71230
71637
  var init_sticky3 = __esm({
71231
71638
  "packages/cleo/src/cli/commands/sticky.ts"() {
@@ -71274,7 +71681,7 @@ var init_sticky3 = __esm({
71274
71681
  { command: "sticky", operation: "sticky.add" }
71275
71682
  );
71276
71683
  } catch (err) {
71277
- if (err instanceof CleoError10) {
71684
+ if (err instanceof CleoError11) {
71278
71685
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
71279
71686
  process.exit(err.code);
71280
71687
  }
@@ -71329,7 +71736,7 @@ var init_sticky3 = __esm({
71329
71736
  }
71330
71737
  cliOutput(data, { command: "sticky list", operation: "sticky.list", page: response.page });
71331
71738
  } catch (err) {
71332
- if (err instanceof CleoError10) {
71739
+ if (err instanceof CleoError11) {
71333
71740
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
71334
71741
  process.exit(err.code);
71335
71742
  }
@@ -71370,7 +71777,7 @@ var init_sticky3 = __esm({
71370
71777
  }
71371
71778
  cliOutput({ sticky: data }, { command: "sticky show", operation: "sticky.show" });
71372
71779
  } catch (err) {
71373
- if (err instanceof CleoError10) {
71780
+ if (err instanceof CleoError11) {
71374
71781
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
71375
71782
  process.exit(err.code);
71376
71783
  }
@@ -71448,7 +71855,7 @@ var init_sticky3 = __esm({
71448
71855
  operation: "sticky.convert"
71449
71856
  });
71450
71857
  } catch (err) {
71451
- if (err instanceof CleoError10) {
71858
+ if (err instanceof CleoError11) {
71452
71859
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
71453
71860
  process.exit(err.code);
71454
71861
  }
@@ -71475,7 +71882,7 @@ var init_sticky3 = __esm({
71475
71882
  { command: "sticky archive", operation: "sticky.archive" }
71476
71883
  );
71477
71884
  } catch (err) {
71478
- if (err instanceof CleoError10) {
71885
+ if (err instanceof CleoError11) {
71479
71886
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
71480
71887
  process.exit(err.code);
71481
71888
  }
@@ -71502,7 +71909,7 @@ var init_sticky3 = __esm({
71502
71909
  { command: "sticky purge", operation: "sticky.purge" }
71503
71910
  );
71504
71911
  } catch (err) {
71505
- if (err instanceof CleoError10) {
71912
+ if (err instanceof CleoError11) {
71506
71913
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
71507
71914
  process.exit(err.code);
71508
71915
  }
@@ -71949,13 +72356,13 @@ var init_telemetry2 = __esm({
71949
72356
  // packages/cleo/src/cli/commands/templates/lib.ts
71950
72357
  import { readFileSync as readFileSync15 } from "node:fs";
71951
72358
  import { isAbsolute as isAbsolute3, resolve as resolve8 } from "node:path";
71952
- import { getProjectRoot as getProjectRoot54 } from "@cleocode/core";
72359
+ import { getProjectRoot as getProjectRoot56 } from "@cleocode/core";
71953
72360
  import { resolveSourcePathAbsolute } from "@cleocode/core/templates/registry";
71954
72361
  function resolveProjectRoot6(raw) {
71955
72362
  if (typeof raw === "string" && raw.length > 0) {
71956
72363
  return isAbsolute3(raw) ? raw : resolve8(process.cwd(), raw);
71957
72364
  }
71958
- return getProjectRoot54();
72365
+ return getProjectRoot56();
71959
72366
  }
71960
72367
  function readTemplateSource(entry) {
71961
72368
  const sourceAbsolute = resolveSourcePathAbsolute(entry);
@@ -72739,7 +73146,7 @@ __export(token_exports, {
72739
73146
  tokenCommand: () => tokenCommand
72740
73147
  });
72741
73148
  import { readFileSync as readFileSync19 } from "node:fs";
72742
- import { getProjectRoot as getProjectRoot55, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
73149
+ import { getProjectRoot as getProjectRoot57, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
72743
73150
  function readPayload(args, textKey, fileKey) {
72744
73151
  const text = args[textKey];
72745
73152
  const file = args[fileKey];
@@ -72903,7 +73310,7 @@ var init_token = __esm({
72903
73310
  domain: args.domain,
72904
73311
  operation: args.operation
72905
73312
  };
72906
- const result = args.record ? await recordTokenExchange2(getProjectRoot55(), input2) : await measureTokenExchange(input2);
73313
+ const result = args.record ? await recordTokenExchange2(getProjectRoot57(), input2) : await measureTokenExchange(input2);
72907
73314
  cliOutput(result, {
72908
73315
  command: "token",
72909
73316
  operation: args.record ? "admin.token.record" : "token.estimate"
@@ -72939,7 +73346,7 @@ __export(transcript_exports, {
72939
73346
  });
72940
73347
  import { homedir as homedir6 } from "node:os";
72941
73348
  import { join as join34 } from "node:path";
72942
- import { getProjectRoot as getProjectRoot56 } from "@cleocode/core";
73349
+ import { getProjectRoot as getProjectRoot58 } from "@cleocode/core";
72943
73350
  import {
72944
73351
  parseDurationMs,
72945
73352
  pruneTranscripts,
@@ -72969,7 +73376,7 @@ var init_transcript = __esm({
72969
73376
  async run({ args }) {
72970
73377
  if (args.pending) {
72971
73378
  try {
72972
- const projectRoot = getProjectRoot56();
73379
+ const projectRoot = getProjectRoot58();
72973
73380
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
72974
73381
  const pending = await scanPendingTranscripts(projectRoot);
72975
73382
  cliOutput(
@@ -73066,7 +73473,7 @@ var init_transcript = __esm({
73066
73473
  async run({ args }) {
73067
73474
  const tier = args.tier ?? "warm";
73068
73475
  const dryRun = args["dry-run"] ?? false;
73069
- const projectRoot = getProjectRoot56();
73476
+ const projectRoot = getProjectRoot58();
73070
73477
  try {
73071
73478
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
73072
73479
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -73178,7 +73585,7 @@ var init_transcript = __esm({
73178
73585
  const dryRun = args["dry-run"] ?? false;
73179
73586
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
73180
73587
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
73181
- const projectRoot = getProjectRoot56();
73588
+ const projectRoot = getProjectRoot58();
73182
73589
  try {
73183
73590
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
73184
73591
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -73832,7 +74239,7 @@ __export(upgrade_exports, {
73832
74239
  upgradeCommand: () => upgradeCommand
73833
74240
  });
73834
74241
  import { resolve as resolve9 } from "node:path";
73835
- import { CleoError as CleoError11, diagnoseUpgrade, runUpgrade as runUpgrade2, upgradeWorkflows as upgradeWorkflows2 } from "@cleocode/core/internal";
74242
+ import { CleoError as CleoError12, diagnoseUpgrade, runUpgrade as runUpgrade2, upgradeWorkflows as upgradeWorkflows2 } from "@cleocode/core/internal";
73836
74243
  var workflowsSubcommand, upgradeCommand;
73837
74244
  var init_upgrade3 = __esm({
73838
74245
  "packages/cleo/src/cli/commands/upgrade.ts"() {
@@ -73899,7 +74306,7 @@ var init_upgrade3 = __esm({
73899
74306
  process.exit(1);
73900
74307
  }
73901
74308
  } catch (err) {
73902
- if (err instanceof CleoError11) {
74309
+ if (err instanceof CleoError12) {
73903
74310
  cliError(err.message, err.code, { name: "CleoError", fix: err.fix });
73904
74311
  process.exit(err.code);
73905
74312
  }
@@ -74025,7 +74432,7 @@ var init_upgrade3 = __esm({
74025
74432
  }
74026
74433
  progress.complete(isDryRun ? "Preview complete" : "Upgrade complete");
74027
74434
  } catch (err) {
74028
- if (err instanceof CleoError11) {
74435
+ if (err instanceof CleoError12) {
74029
74436
  progress.error(err.message);
74030
74437
  cliError(
74031
74438
  err.message,
@@ -74335,7 +74742,7 @@ __export(web_exports, {
74335
74742
  });
74336
74743
  import { spawn as spawn4 } from "node:child_process";
74337
74744
  import { rm as rm2 } from "node:fs/promises";
74338
- import { CleoError as CleoError12, formatError as formatError5 } from "@cleocode/core";
74745
+ import { CleoError as CleoError13, formatError as formatError5 } from "@cleocode/core";
74339
74746
  var startCommand9, stopCommand6, restartCommand, statusCommand18, openCommand3, webCommand;
74340
74747
  var init_web = __esm({
74341
74748
  "packages/cleo/src/cli/commands/web.ts"() {
@@ -74376,7 +74783,7 @@ var init_web = __esm({
74376
74783
  { command: "web", message: `CLEO Web UI running on port ${ctx.port}` }
74377
74784
  );
74378
74785
  } catch (err) {
74379
- if (err instanceof CleoError12) {
74786
+ if (err instanceof CleoError13) {
74380
74787
  console.error(formatError5(err));
74381
74788
  process.exit(err.code);
74382
74789
  }
@@ -74408,7 +74815,7 @@ var init_web = __esm({
74408
74815
  });
74409
74816
  cliOutput({ stopped: true }, { command: "web", message: "CLEO Web UI stopped" });
74410
74817
  } catch (err) {
74411
- if (err instanceof CleoError12) {
74818
+ if (err instanceof CleoError13) {
74412
74819
  console.error(formatError5(err));
74413
74820
  process.exit(err.code);
74414
74821
  }
@@ -74462,7 +74869,7 @@ var init_web = __esm({
74462
74869
  { command: "web", message: `CLEO Web UI running on port ${ctx.port}` }
74463
74870
  );
74464
74871
  } catch (err) {
74465
- if (err instanceof CleoError12) {
74872
+ if (err instanceof CleoError13) {
74466
74873
  console.error(formatError5(err));
74467
74874
  process.exit(err.code);
74468
74875
  }
@@ -74477,7 +74884,7 @@ var init_web = __esm({
74477
74884
  const status = await getWebStatus();
74478
74885
  cliOutput(status, { command: "web" });
74479
74886
  } catch (err) {
74480
- if (err instanceof CleoError12) {
74887
+ if (err instanceof CleoError13) {
74481
74888
  console.error(formatError5(err));
74482
74889
  process.exit(err.code);
74483
74890
  }
@@ -74491,7 +74898,7 @@ var init_web = __esm({
74491
74898
  try {
74492
74899
  const status = await getWebStatus();
74493
74900
  if (!status.running || !status.url) {
74494
- throw new CleoError12(
74901
+ throw new CleoError13(
74495
74902
  1 /* GENERAL_ERROR */,
74496
74903
  "Web server is not running. Start with: cleo web start"
74497
74904
  );
@@ -74510,7 +74917,7 @@ var init_web = __esm({
74510
74917
  }
74511
74918
  cliOutput({ url }, { command: "web", message: `Open browser to: ${url}` });
74512
74919
  } catch (err) {
74513
- if (err instanceof CleoError12) {
74920
+ if (err instanceof CleoError13) {
74514
74921
  console.error(formatError5(err));
74515
74922
  process.exit(err.code);
74516
74923
  }
@@ -74653,9 +75060,9 @@ var init_workgraph2 = __esm({
74653
75060
  },
74654
75061
  async run({ args }) {
74655
75062
  const { generatePlanningDoc } = await import("@cleocode/core/workgraph");
74656
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
75063
+ const { getProjectRoot: getProjectRoot60 } = await import("@cleocode/core");
74657
75064
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
74658
- const projectRoot = getProjectRoot58();
75065
+ const projectRoot = getProjectRoot60();
74659
75066
  const audience = String(args.audience) === "agent" ? "agent" : "maintainer";
74660
75067
  const result = await generatePlanningDoc(projectRoot, {
74661
75068
  sagaId: String(args.sagaId),
@@ -74672,9 +75079,9 @@ var init_workgraph2 = __esm({
74672
75079
  async run() {
74673
75080
  const { validateWorkGraphStructure } = await import("@cleocode/core/workgraph");
74674
75081
  const { taskList: taskList2 } = await import("@cleocode/core/internal");
74675
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
75082
+ const { getProjectRoot: getProjectRoot60 } = await import("@cleocode/core");
74676
75083
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
74677
- const projectRoot = getProjectRoot58();
75084
+ const projectRoot = getProjectRoot60();
74678
75085
  const listResult = await taskList2(projectRoot, { limit: 5e3 });
74679
75086
  const tasks = listResult.success ? listResult.data?.tasks ?? [] : [];
74680
75087
  const nodes = tasks.map((t) => ({
@@ -74693,9 +75100,9 @@ var init_workgraph2 = __esm({
74693
75100
  description: "One-shot saga-to-saga workgraph dashboard (tracking checklist)"
74694
75101
  },
74695
75102
  async run() {
74696
- const { sagas: sagas2, getProjectRoot: getProjectRoot58 } = await import("@cleocode/core");
75103
+ const { sagas: sagas2, getProjectRoot: getProjectRoot60 } = await import("@cleocode/core");
74697
75104
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
74698
- const projectRoot = getProjectRoot58();
75105
+ const projectRoot = getProjectRoot60();
74699
75106
  const listResult = await sagas2.sagaList(projectRoot);
74700
75107
  if (!listResult.success) {
74701
75108
  cliOutput2(listResult, { command: "workgraph", operation: "workgraph.status" });
@@ -74761,7 +75168,7 @@ __export(worktree_exports, {
74761
75168
  worktreeCommand: () => worktreeCommand
74762
75169
  });
74763
75170
  import readline4 from "node:readline";
74764
- import { getProjectRoot as getProjectRoot57, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
75171
+ import { getProjectRoot as getProjectRoot59, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
74765
75172
  async function promptYesNo2(question) {
74766
75173
  return new Promise((resolve11) => {
74767
75174
  const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
@@ -74866,7 +75273,7 @@ var init_worktree3 = __esm({
74866
75273
  const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
74867
75274
  const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
74868
75275
  const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
74869
- const projectRoot = getProjectRoot57();
75276
+ const projectRoot = getProjectRoot59();
74870
75277
  const listResult = await listWorktrees2({
74871
75278
  projectRoot,
74872
75279
  ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
@@ -75463,6 +75870,12 @@ var COMMAND_MANIFEST = [
75463
75870
  description: "Pre-flight release readiness check \u2014 lint matrix + changelog + changeset + npm OIDC + tag-trigger sanity (T10458)",
75464
75871
  load: async () => (await Promise.resolve().then(() => (init_doctor_release_readiness(), doctor_release_readiness_exports))).doctorReleaseReadinessCommand
75465
75872
  },
75873
+ {
75874
+ exportName: "doctorRepairCommand",
75875
+ name: "repair",
75876
+ description: "Detect malformed CLEO databases (PRAGMA quick_check) and restore each from its ",
75877
+ load: async () => (await Promise.resolve().then(() => (init_doctor_repair(), doctor_repair_exports))).doctorRepairCommand
75878
+ },
75466
75879
  {
75467
75880
  exportName: "doctorCommand",
75468
75881
  name: "doctor",
@@ -76515,8 +76928,8 @@ async function runStartupMaintenance() {
76515
76928
  detectAndRemoveLegacyGlobalFiles,
76516
76929
  detectAndRemoveStrayProjectNexus,
76517
76930
  getGlobalSalt,
76518
- getLogger: getLogger20,
76519
- getProjectRoot: getProjectRoot58,
76931
+ getLogger: getLogger21,
76932
+ getProjectRoot: getProjectRoot60,
76520
76933
  isCleanupMarkerSet,
76521
76934
  migrateSignaldockToConduit,
76522
76935
  needsSignaldockToConduitMigration,
@@ -76525,7 +76938,7 @@ async function runStartupMaintenance() {
76525
76938
  } = await import("@cleocode/core/internal");
76526
76939
  let projectRootForCleanup = "";
76527
76940
  try {
76528
- projectRootForCleanup = getProjectRoot58();
76941
+ projectRootForCleanup = getProjectRoot60();
76529
76942
  } catch {
76530
76943
  }
76531
76944
  if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
@@ -76541,11 +76954,11 @@ async function runStartupMaintenance() {
76541
76954
  }
76542
76955
  setCleanupMarker(CLI_VERSION, projectRootForCleanup);
76543
76956
  }
76544
- const _startupLog = getLogger20("cli-startup");
76957
+ const _startupLog = getLogger21("cli-startup");
76545
76958
  const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
76546
76959
  if (!isInitInvocation) {
76547
76960
  try {
76548
- const _projectRootForMigration = getProjectRoot58();
76961
+ const _projectRootForMigration = getProjectRoot60();
76549
76962
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
76550
76963
  const migrationResult = await migrateSignaldockToConduit(_projectRootForMigration);
76551
76964
  if (migrationResult.status === "failed") {