@cleocode/cleo 2026.5.70 → 2026.5.72

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
@@ -24311,8 +24311,8 @@ async function loadPlaybookByName(name) {
24311
24311
  return null;
24312
24312
  }
24313
24313
  try {
24314
- const { getProjectRoot: getProjectRoot35 } = await import("@cleocode/core/internal");
24315
- const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot35();
24314
+ const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
24315
+ const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot33();
24316
24316
  const resolved = resolvePlaybook(name, {
24317
24317
  projectRoot,
24318
24318
  globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
@@ -24356,8 +24356,8 @@ async function acquireDb() {
24356
24356
  async function buildDefaultDispatcher() {
24357
24357
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
24358
24358
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
24359
- const { getProjectRoot: getProjectRoot35 } = await import("@cleocode/core/internal");
24360
- const projectRoot = getProjectRoot35();
24359
+ const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
24360
+ const projectRoot = getProjectRoot33();
24361
24361
  return {
24362
24362
  async dispatch(input) {
24363
24363
  try {
@@ -24547,8 +24547,8 @@ var init_playbook2 = __esm({
24547
24547
  projectRoot = __playbookRuntimeOverrides.projectRoot;
24548
24548
  } else {
24549
24549
  try {
24550
- const { getProjectRoot: getProjectRoot35 } = await import("@cleocode/core/internal");
24551
- projectRoot = getProjectRoot35();
24550
+ const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
24551
+ projectRoot = getProjectRoot33();
24552
24552
  } catch {
24553
24553
  projectRoot = void 0;
24554
24554
  }
@@ -24612,14 +24612,14 @@ var init_playbook2 = __esm({
24612
24612
  const dispatcher = await buildDefaultDispatcher();
24613
24613
  let result;
24614
24614
  try {
24615
- const { getProjectRoot: getProjectRoot35 } = await import("@cleocode/core/internal");
24615
+ const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
24616
24616
  const opts = {
24617
24617
  db,
24618
24618
  playbook: parsed.definition,
24619
24619
  playbookHash: parsed.sourceHash,
24620
24620
  initialContext,
24621
24621
  dispatcher,
24622
- projectRoot: getProjectRoot35()
24622
+ projectRoot: getProjectRoot33()
24623
24623
  };
24624
24624
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
24625
24625
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -24981,12 +24981,12 @@ async function orchestrateRejectOp(params) {
24981
24981
  async function orchestrateClassify(request, context, projectRoot) {
24982
24982
  try {
24983
24983
  const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
24984
- const { readFileSync: readFileSync17, readdirSync: readdirSync4, existsSync: existsSync16 } = await import("node:fs");
24984
+ const { readFileSync: readFileSync17, readdirSync: readdirSync4, existsSync: existsSync14 } = await import("node:fs");
24985
24985
  const { join: join26 } = await import("node:path");
24986
24986
  const workflowsDir = getCleoCantWorkflowsDir();
24987
24987
  const combined = `${request} ${context ?? ""}`.toLowerCase();
24988
24988
  const matches = [];
24989
- if (existsSync16(workflowsDir)) {
24989
+ if (existsSync14(workflowsDir)) {
24990
24990
  const files = readdirSync4(workflowsDir).filter((f) => f.endsWith(".cant"));
24991
24991
  for (const file of files) {
24992
24992
  try {
@@ -25006,7 +25006,7 @@ async function orchestrateClassify(request, context, projectRoot) {
25006
25006
  }
25007
25007
  }
25008
25008
  const localCantDir = join26(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
25009
- if (existsSync16(localCantDir)) {
25009
+ if (existsSync14(localCantDir)) {
25010
25010
  const files = readdirSync4(localCantDir).filter((f) => f.endsWith(".cant"));
25011
25011
  for (const file of files) {
25012
25012
  try {
@@ -28134,9 +28134,7 @@ var init_tasks3 = __esm({
28134
28134
  scope: params.scope,
28135
28135
  severity: params.severity,
28136
28136
  // T1633: BRAIN duplicate-bypass flag
28137
- forceDuplicate: params.forceDuplicate,
28138
- // T9218 / ADR-070: mandatory verifier for high-consequence tasks
28139
- verifier: params.verifier
28137
+ forceDuplicate: params.forceDuplicate
28140
28138
  }),
28141
28139
  "add"
28142
28140
  );
@@ -28175,7 +28173,11 @@ var init_tasks3 = __esm({
28175
28173
  // T1590: AC-immutability override reason
28176
28174
  reason: params.reason,
28177
28175
  // T9241: clear the free-text blockedBy reason
28178
- clearBlockedBy: params.clearBlockedBy
28176
+ clearBlockedBy: params.clearBlockedBy,
28177
+ // T9327: relates mutations
28178
+ relates: params.relates,
28179
+ addRelates: params.addRelates,
28180
+ removeRelates: params.removeRelates
28179
28181
  }),
28180
28182
  "update"
28181
28183
  );
@@ -29528,11 +29530,11 @@ var init_security = __esm({
29528
29530
  });
29529
29531
 
29530
29532
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
29531
- function createSanitizer(getProjectRoot35) {
29533
+ function createSanitizer(getProjectRoot33) {
29532
29534
  return async (req, next) => {
29533
29535
  if (req.params) {
29534
29536
  try {
29535
- const root = getProjectRoot35 ? getProjectRoot35() : void 0;
29537
+ const root = getProjectRoot33 ? getProjectRoot33() : void 0;
29536
29538
  req.params = sanitizeParams(req.params, root, {
29537
29539
  domain: req.domain,
29538
29540
  operation: req.operation
@@ -30389,17 +30391,13 @@ var init_add = __esm({
30389
30391
  description: "Justification for creating a critical-priority task without --depends (T1856). Records waiver in task metadata."
30390
30392
  },
30391
30393
  /**
30392
- * Path to an existing verifier script (T9218 / ADR-070).
30393
- *
30394
- * Required when creating tasks with priority=critical, size=large, or
30395
- * type=epic. The path must point to an existing .mjs file. Omitting
30396
- * this on high-consequence tasks causes rejection with E_VERIFIER_REQUIRED.
30397
- *
30398
- * Use `cleo verify backfill <taskId>` to generate a stub after creation.
30394
+ * Related tasks semantic relationships (non-dependency).
30395
+ * Comma-separated task IDs with optional type suffix (e.g. "T001:blocks,T002:related").
30396
+ * Default type is 'related'.
30399
30397
  */
30400
- verifier: {
30398
+ relates: {
30401
30399
  type: "string",
30402
- description: "Path to existing verifier script for this task (required for priority=critical, size=large, type=epic) (T9218 / ADR-070)"
30400
+ description: 'Comma-separated related task IDs with optional type suffix (e.g. "T001:blocks,T002")'
30403
30401
  }
30404
30402
  },
30405
30403
  async run({ args, cmd }) {
@@ -30423,6 +30421,12 @@ var init_add = __esm({
30423
30421
  }
30424
30422
  if (args.labels) params["labels"] = args.labels.split(",").map((s) => s.trim());
30425
30423
  if (args.depends) params["depends"] = args.depends.split(",").map((s) => s.trim());
30424
+ if (args.relates) {
30425
+ params["relates"] = args.relates.split(",").map((s) => {
30426
+ const [taskId, relType = "related"] = s.trim().split(":");
30427
+ return { taskId: taskId.trim(), type: relType.trim() };
30428
+ });
30429
+ }
30426
30430
  if (args.notes !== void 0) params["notes"] = args.notes;
30427
30431
  if (args.note !== void 0) params["notes"] = params["notes"] ?? args.note;
30428
30432
  if (args.position !== void 0)
@@ -30433,7 +30437,6 @@ var init_add = __esm({
30433
30437
  if (args.scope !== void 0) params["scope"] = args.scope;
30434
30438
  if (args.severity !== void 0) params["severity"] = args.severity;
30435
30439
  if (args["force-duplicate"] !== void 0) params["forceDuplicate"] = args["force-duplicate"];
30436
- if (args.verifier !== void 0) params["verifier"] = args.verifier;
30437
30440
  if (args.priority === "critical" && !args.depends && args["depends-waiver"] === void 0) {
30438
30441
  cliError(
30439
30442
  'Critical-priority tasks must declare at least one dependency (--depends) or provide a waiver (--depends-waiver "<reason>").',
@@ -31480,12 +31483,12 @@ var init_agent = __esm({
31480
31483
  transportConfig: {},
31481
31484
  isActive: true
31482
31485
  });
31483
- const { existsSync: existsSync16, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("node:fs");
31486
+ const { existsSync: existsSync14, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("node:fs");
31484
31487
  const { join: join26 } = await import("node:path");
31485
31488
  const cantDir = join26(CLEO_DIR_NAME, AGENTS_SUBDIR);
31486
31489
  const cantPath = join26(cantDir, `${agentId}.cant`);
31487
31490
  let cantScaffolded = false;
31488
- if (!existsSync16(cantPath)) {
31491
+ if (!existsSync14(cantPath)) {
31489
31492
  mkdirSync7(cantDir, { recursive: true });
31490
31493
  const role = classification ?? "specialist";
31491
31494
  const cantContent = `---
@@ -31545,7 +31548,7 @@ agent ${agentId}:
31545
31548
  data: {
31546
31549
  agentId: credential.agentId,
31547
31550
  displayName: credential.displayName,
31548
- cantFile: cantScaffolded ? cantPath : existsSync16(cantPath) ? cantPath : null,
31551
+ cantFile: cantScaffolded ? cantPath : existsSync14(cantPath) ? cantPath : null,
31549
31552
  cantScaffolded
31550
31553
  }
31551
31554
  },
@@ -31664,7 +31667,7 @@ agent ${agentId}:
31664
31667
  try {
31665
31668
  const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
31666
31669
  const { createRuntime } = await import("@cleocode/runtime");
31667
- const { existsSync: existsSync16, readFileSync: readFileSync17 } = await import("node:fs");
31670
+ const { existsSync: existsSync14, readFileSync: readFileSync17 } = await import("node:fs");
31668
31671
  const { join: join26 } = await import("node:path");
31669
31672
  await getDb3();
31670
31673
  const registry = new AgentRegistryAccessor(process.cwd());
@@ -31686,7 +31689,7 @@ agent ${agentId}:
31686
31689
  let profile = null;
31687
31690
  let cantValidation = null;
31688
31691
  const cantPath = args.cant ?? join26(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
31689
- if (existsSync16(cantPath)) {
31692
+ if (existsSync14(cantPath)) {
31690
31693
  profile = readFileSync17(cantPath, "utf-8");
31691
31694
  try {
31692
31695
  const cantModule = await import("@cleocode/cant");
@@ -32210,7 +32213,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32210
32213
  try {
32211
32214
  const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
32212
32215
  const { createRuntime } = await import("@cleocode/runtime");
32213
- const { existsSync: existsSync16 } = await import("node:fs");
32216
+ const { existsSync: existsSync14 } = await import("node:fs");
32214
32217
  const { join: join26 } = await import("node:path");
32215
32218
  const { execFile: execFile2 } = await import("node:child_process");
32216
32219
  const { promisify: promisify2 } = await import("node:util");
@@ -32232,7 +32235,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32232
32235
  await registry.update(args.agentId, { isActive: true });
32233
32236
  await registry.markUsed(args.agentId);
32234
32237
  const cantPath = join26(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
32235
- const hasProfile = existsSync16(cantPath);
32238
+ const hasProfile = existsSync14(cantPath);
32236
32239
  const runtime = await createRuntime(registry, {
32237
32240
  agentId: args.agentId,
32238
32241
  pollIntervalMs: 5e3,
@@ -33080,11 +33083,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33080
33083
  async run({ args }) {
33081
33084
  let tempDir = null;
33082
33085
  try {
33083
- const { existsSync: existsSync16, mkdirSync: mkdirSync7, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
33084
- const { join: join26, basename, resolve: resolve7, extname } = await import("node:path");
33086
+ const { existsSync: existsSync14, mkdirSync: mkdirSync7, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
33087
+ const { join: join26, basename, resolve: resolve5, extname } = await import("node:path");
33085
33088
  const { tmpdir: tmpdir2 } = await import("node:os");
33086
- const resolvedPath = resolve7(args.path);
33087
- if (!existsSync16(resolvedPath)) {
33089
+ const resolvedPath = resolve5(args.path);
33090
+ if (!existsSync14(resolvedPath)) {
33088
33091
  cliOutput(
33089
33092
  {
33090
33093
  success: false,
@@ -33145,7 +33148,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33145
33148
  }
33146
33149
  const agentName = topLevel[0];
33147
33150
  const personaPath = join26(tempDir, agentName, "persona.cant");
33148
- if (!existsSync16(personaPath)) {
33151
+ if (!existsSync14(personaPath)) {
33149
33152
  cliOutput(
33150
33153
  {
33151
33154
  success: false,
@@ -33164,7 +33167,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33164
33167
  } else if (stat2.isDirectory()) {
33165
33168
  const agentName = basename(resolvedPath);
33166
33169
  const personaPath = join26(resolvedPath, "persona.cant");
33167
- if (!existsSync16(personaPath)) {
33170
+ if (!existsSync14(personaPath)) {
33168
33171
  cliOutput(
33169
33172
  {
33170
33173
  success: false,
@@ -33299,11 +33302,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33299
33302
  },
33300
33303
  async run({ args }) {
33301
33304
  try {
33302
- const { existsSync: existsSync16, statSync } = await import("node:fs");
33303
- const { resolve: resolve7, basename, dirname: dirname9 } = await import("node:path");
33305
+ const { existsSync: existsSync14, statSync } = await import("node:fs");
33306
+ const { resolve: resolve5, basename, dirname: dirname9 } = await import("node:path");
33304
33307
  const { execFileSync: execFileSync5 } = await import("node:child_process");
33305
- const resolvedDir = resolve7(args.dir);
33306
- if (!existsSync16(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
33308
+ const resolvedDir = resolve5(args.dir);
33309
+ if (!existsSync14(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
33307
33310
  cliOutput(
33308
33311
  {
33309
33312
  success: false,
@@ -33319,7 +33322,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33319
33322
  }
33320
33323
  const { join: join26 } = await import("node:path");
33321
33324
  const personaPath = join26(resolvedDir, "persona.cant");
33322
- if (!existsSync16(personaPath)) {
33325
+ if (!existsSync14(personaPath)) {
33323
33326
  cliOutput(
33324
33327
  {
33325
33328
  success: false,
@@ -33335,7 +33338,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33335
33338
  }
33336
33339
  const agentName = basename(resolvedDir);
33337
33340
  const archiveName = `${agentName}.cantz`;
33338
- const archivePath = resolve7(archiveName);
33341
+ const archivePath = resolve5(archiveName);
33339
33342
  const parentDir = dirname9(resolvedDir);
33340
33343
  try {
33341
33344
  execFileSync5("zip", ["-r", archivePath, agentName], {
@@ -33435,7 +33438,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33435
33438
  },
33436
33439
  async run({ args }) {
33437
33440
  try {
33438
- const { existsSync: existsSync16, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("node:fs");
33441
+ const { existsSync: existsSync14, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("node:fs");
33439
33442
  const { join: join26 } = await import("node:path");
33440
33443
  const { homedir: homedir9 } = await import("node:os");
33441
33444
  const name = args.name;
@@ -33502,7 +33505,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33502
33505
  targetRoot = join26(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
33503
33506
  }
33504
33507
  const agentDir = join26(targetRoot, name);
33505
- if (existsSync16(agentDir)) {
33508
+ if (existsSync14(agentDir)) {
33506
33509
  cliOutput(
33507
33510
  {
33508
33511
  success: false,
@@ -33646,17 +33649,17 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
33646
33649
  },
33647
33650
  async run({ args }) {
33648
33651
  try {
33649
- const { existsSync: existsSync16, readFileSync: readFileSync17, mkdirSync: mkdirSync7 } = await import("node:fs");
33650
- const { resolve: resolve7, join: join26 } = await import("node:path");
33651
- const specPath = resolve7(args.spec);
33652
- if (!existsSync16(specPath)) {
33652
+ const { existsSync: existsSync14, readFileSync: readFileSync17, mkdirSync: mkdirSync7 } = await import("node:fs");
33653
+ const { resolve: resolve5, join: join26 } = await import("node:path");
33654
+ const specPath = resolve5(args.spec);
33655
+ if (!existsSync14(specPath)) {
33653
33656
  cliError(`spec file not found: ${specPath}`, 4, { name: "E_NOT_FOUND" });
33654
33657
  process.exitCode = 4;
33655
33658
  return;
33656
33659
  }
33657
33660
  const specContent = readFileSync17(specPath, "utf-8");
33658
33661
  const projectRoot = process.cwd();
33659
- const outputDir = args["output-dir"] ? resolve7(args["output-dir"]) : join26(projectRoot, ".cleo", "cant", "agents");
33662
+ const outputDir = args["output-dir"] ? resolve5(args["output-dir"]) : join26(projectRoot, ".cleo", "cant", "agents");
33660
33663
  mkdirSync7(outputDir, { recursive: true });
33661
33664
  if (args["dry-run"]) {
33662
33665
  cliOutput(
@@ -34054,11 +34057,8 @@ var audit_exports = {};
34054
34057
  __export(audit_exports, {
34055
34058
  auditCommand: () => auditCommand
34056
34059
  });
34057
- import { spawnSync } from "node:child_process";
34058
- import { existsSync as existsSync6 } from "node:fs";
34059
- import { resolve as resolve3 } from "node:path";
34060
- import { getProjectRoot as getProjectRoot19, reconstructLineage, resolveVerifierScript } from "@cleocode/core/internal";
34061
- var reconstructCommand, verifierCommand, auditCommand;
34060
+ import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
34061
+ var reconstructCommand, auditCommand;
34062
34062
  var init_audit2 = __esm({
34063
34063
  "packages/cleo/src/cli/commands/audit.ts"() {
34064
34064
  "use strict";
@@ -34114,82 +34114,13 @@ var init_audit2 = __esm({
34114
34114
  });
34115
34115
  }
34116
34116
  });
34117
- verifierCommand = defineCommand({
34118
- meta: {
34119
- name: "verifier",
34120
- description: "Independent acceptance verifier re-run (ADR-070 auditor-loop). Resolves scripts/verify-<taskId>-fu.mjs and runs it independently. Does NOT trust prior Implementer claims. Exits non-zero if verifier fails."
34121
- },
34122
- args: {
34123
- taskId: {
34124
- type: "positional",
34125
- description: "Task ID whose acceptance verifier script to run independently (e.g. T9188)",
34126
- required: true
34127
- },
34128
- script: {
34129
- type: "string",
34130
- description: "Explicit path to the verifier script (overrides auto-resolution)"
34131
- }
34132
- },
34133
- async run({ args }) {
34134
- const taskId = String(args.taskId);
34135
- let projectRoot;
34136
- try {
34137
- projectRoot = getProjectRoot19(process.cwd()) ?? resolve3(process.cwd());
34138
- } catch {
34139
- projectRoot = resolve3(process.cwd());
34140
- }
34141
- let verifierPath;
34142
- if (args.script) {
34143
- const explicit = resolve3(projectRoot, String(args.script));
34144
- verifierPath = existsSync6(explicit) ? explicit : null;
34145
- if (!verifierPath) {
34146
- cliError(`Verifier script not found: ${explicit}`, 1, { name: "E_NOT_FOUND" });
34147
- process.exitCode = 1;
34148
- return;
34149
- }
34150
- } else {
34151
- verifierPath = resolveVerifierScript(taskId, projectRoot);
34152
- }
34153
- if (!verifierPath) {
34154
- cliError(
34155
- `No verifier script found for ${taskId}.
34156
- Looked for: scripts/verify-${taskId}-fu.mjs, scripts/verify-${taskId}.mjs
34157
- Create the verifier script per ADR-070 before running the auditor.`,
34158
- 1,
34159
- { name: "E_NOT_FOUND" }
34160
- );
34161
- process.exitCode = 1;
34162
- return;
34163
- }
34164
- humanLine(`[AUDITOR] Independent verifier run for ${taskId}`);
34165
- humanLine(`[AUDITOR] Script: ${verifierPath}`);
34166
- humanLine("[AUDITOR] Note: Does NOT trust any prior Implementer claims.\n");
34167
- const result = spawnSync("node", [verifierPath], { encoding: "utf8", stdio: "inherit" });
34168
- const exitCode = result.status ?? 1;
34169
- if (exitCode === 0) {
34170
- humanLine(
34171
- `
34172
- [AUDITOR] Audit pass. Verifier exit-code 0. Task ${taskId} acceptance verified.`
34173
- );
34174
- } else {
34175
- process.stderr.write(
34176
- `
34177
- [AUDITOR] Audit fail. Verifier exit-code ${exitCode}. Task ${taskId} NOT verified.
34178
- E_ACCEPTANCE_VERIFIER_FAILED. Implementation must be re-worked. (ADR-070)
34179
- `
34180
- );
34181
- process.exitCode = exitCode;
34182
- }
34183
- }
34184
- });
34185
34117
  auditCommand = defineCommand({
34186
34118
  meta: {
34187
34119
  name: "audit",
34188
- description: "Git-backed audit tooling (lineage reconstruction, integrity checks). Also provides independent acceptance verifier re-runs for the ADR-070 auditor-loop pattern (verifier subcommand \u2014 does not trust Implementer claims, runs script independently)."
34120
+ description: "Git-backed audit tooling (lineage reconstruction, integrity checks). Independent re-verification of task completion claims is handled by `cleo verify <taskId> --explain` which re-validates ADR-051 evidence atoms."
34189
34121
  },
34190
34122
  subCommands: {
34191
- reconstruct: reconstructCommand,
34192
- verifier: verifierCommand
34123
+ reconstruct: reconstructCommand
34193
34124
  },
34194
34125
  async run({ args: _args }) {
34195
34126
  await showUsage(auditCommand);
@@ -34198,144 +34129,6 @@ var init_audit2 = __esm({
34198
34129
  }
34199
34130
  });
34200
34131
 
34201
- // packages/cleo/src/cli/commands/backfill.ts
34202
- var backfill_exports = {};
34203
- __export(backfill_exports, {
34204
- backfillCommand: () => backfillCommand
34205
- });
34206
- import { backfillTasks, getProjectRoot as getProjectRoot20, populateEmbeddings } from "@cleocode/core/internal";
34207
- var backfillCommand;
34208
- var init_backfill = __esm({
34209
- "packages/cleo/src/cli/commands/backfill.ts"() {
34210
- "use strict";
34211
- init_dist();
34212
- init_renderers();
34213
- backfillCommand = defineCommand({
34214
- meta: {
34215
- name: "backfill",
34216
- description: "Retroactively add acceptance criteria and verification metadata to existing tasks"
34217
- },
34218
- args: {
34219
- "dry-run": {
34220
- type: "boolean",
34221
- description: "Show what would be changed without modifying any tasks",
34222
- default: false
34223
- },
34224
- rollback: {
34225
- type: "boolean",
34226
- description: "Revert a previous backfill (clear auto-generated AC and verification)",
34227
- default: false
34228
- },
34229
- tasks: {
34230
- type: "string",
34231
- description: "Comma-separated list of task IDs to restrict backfill to (e.g. T001,T002)"
34232
- },
34233
- embeddings: {
34234
- type: "boolean",
34235
- description: "Retroactively generate embeddings for brain observations that lack them",
34236
- default: false
34237
- }
34238
- },
34239
- async run({ args }) {
34240
- const root = getProjectRoot20();
34241
- if (args.embeddings) {
34242
- try {
34243
- let lastLine = "";
34244
- const result = await populateEmbeddings(root, {
34245
- onProgress: (current, total) => {
34246
- if (process.stdout.isTTY) {
34247
- humanProgress(`\rEmbedding ${current}/${total}...`);
34248
- } else {
34249
- const line = `Embedding ${current}/${total}...`;
34250
- if (line !== lastLine) {
34251
- humanLine(line);
34252
- lastLine = line;
34253
- }
34254
- }
34255
- }
34256
- });
34257
- if (process.stdout.isTTY && result.processed + result.skipped + result.errors > 0) {
34258
- humanProgress("\n");
34259
- }
34260
- if (result.processed === 0 && result.skipped === 0 && result.errors === 0) {
34261
- cliOutput(
34262
- {
34263
- processed: 0,
34264
- skipped: 0,
34265
- errors: 0,
34266
- message: "No observations to embed (provider unavailable or nothing to backfill)."
34267
- },
34268
- { command: "backfill", operation: "admin.backfill", message: "Nothing to embed" }
34269
- );
34270
- return;
34271
- }
34272
- cliOutput(
34273
- { processed: result.processed, skipped: result.skipped, errors: result.errors },
34274
- {
34275
- command: "backfill",
34276
- operation: "admin.backfill",
34277
- message: `Processed ${result.processed}, skipped ${result.skipped}, errors ${result.errors}`
34278
- }
34279
- );
34280
- } catch (err) {
34281
- const message = err instanceof Error ? err.message : String(err);
34282
- cliError(
34283
- `Embedding backfill failed: ${message}`,
34284
- "E_INTERNAL",
34285
- {
34286
- name: "E_INTERNAL"
34287
- },
34288
- { operation: "admin.backfill" }
34289
- );
34290
- process.exit(1);
34291
- }
34292
- return;
34293
- }
34294
- const dryRun = !!args["dry-run"];
34295
- const rollback = !!args.rollback;
34296
- const taskIds = args.tasks?.trim() ? args.tasks.split(",").map((s) => s.trim()).filter(Boolean) : void 0;
34297
- if (!dryRun && !rollback && !process.env["CLEO_NONINTERACTIVE"]) {
34298
- humanWarn(
34299
- "Warning: Backfill will modify tasks in-place. Run with --dry-run first to preview changes.\n Set CLEO_NONINTERACTIVE=1 or pass --dry-run to suppress this warning.\n"
34300
- );
34301
- }
34302
- try {
34303
- const result = await backfillTasks(root, { dryRun, rollback, taskIds });
34304
- const output = {
34305
- dryRun,
34306
- rollback,
34307
- tasksScanned: result.tasksScanned,
34308
- tasksChanged: result.tasksChanged,
34309
- changes: result.changes
34310
- };
34311
- if (!rollback) {
34312
- output["acAdded"] = result.acAdded;
34313
- output["verificationAdded"] = result.verificationAdded;
34314
- }
34315
- const messagePrefix = dryRun ? "[dry run] " : rollback ? "[rollback] " : "";
34316
- const messageSuffix = result.changes.length === 0 ? "Nothing to do \u2014 all tasks already have AC and verification metadata." : `Scanned ${result.tasksScanned}, changed ${result.tasksChanged} task(s).`;
34317
- cliOutput(output, {
34318
- command: "backfill",
34319
- operation: "admin.backfill",
34320
- message: `${messagePrefix}${messageSuffix}`
34321
- });
34322
- } catch (err) {
34323
- const message = err instanceof Error ? err.message : String(err);
34324
- cliError(
34325
- `Backfill failed: ${message}`,
34326
- "E_INTERNAL",
34327
- {
34328
- name: "E_INTERNAL"
34329
- },
34330
- { operation: "admin.backfill" }
34331
- );
34332
- process.exit(1);
34333
- }
34334
- }
34335
- });
34336
- }
34337
- });
34338
-
34339
34132
  // packages/cleo/src/cli/commands/backup-inspect.ts
34340
34133
  var backup_inspect_exports = {};
34341
34134
  __export(backup_inspect_exports, {
@@ -34616,12 +34409,12 @@ async function promptPassphrase() {
34616
34409
  "Cannot prompt for passphrase: stdin is not a TTY. Set the CLEO_BACKUP_PASSPHRASE environment variable for non-interactive use."
34617
34410
  );
34618
34411
  }
34619
- return new Promise((resolve7) => {
34412
+ return new Promise((resolve5) => {
34620
34413
  process.stdout.write("Passphrase: ");
34621
34414
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
34622
34415
  rl.question("", (answer) => {
34623
34416
  rl.close();
34624
- resolve7(answer.trim());
34417
+ resolve5(answer.trim());
34625
34418
  });
34626
34419
  });
34627
34420
  }
@@ -34754,9 +34547,9 @@ var init_backup = __esm({
34754
34547
  },
34755
34548
  async run({ args }) {
34756
34549
  const scope = args.scope;
34757
- const { packBundle, getProjectRoot: getProjectRoot35 } = await import("@cleocode/core/internal");
34550
+ const { packBundle, getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
34758
34551
  const includesProject = scope === "project" || scope === "all";
34759
- const projectRoot = includesProject ? getProjectRoot35() : void 0;
34552
+ const projectRoot = includesProject ? getProjectRoot33() : void 0;
34760
34553
  let passphrase;
34761
34554
  if (args.encrypt === true) {
34762
34555
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -35057,7 +34850,7 @@ import {
35057
34850
  exportBrainAsJson,
35058
34851
  getMemoryQualityReport,
35059
34852
  getPlasticityStats,
35060
- getProjectRoot as getProjectRoot21,
34853
+ getProjectRoot as getProjectRoot20,
35061
34854
  purgeBrainNoise,
35062
34855
  runBrainMaintenance
35063
34856
  } from "@cleocode/core/internal";
@@ -35096,7 +34889,7 @@ var init_brain2 = __esm({
35096
34889
  json: { type: "boolean", description: "Output results as JSON" }
35097
34890
  },
35098
34891
  async run({ args }) {
35099
- const root = getProjectRoot21();
34892
+ const root = getProjectRoot20();
35100
34893
  try {
35101
34894
  const result = await runBrainMaintenance(root, {
35102
34895
  skipDecay: !!args["skip-decay"],
@@ -35167,7 +34960,7 @@ var init_brain2 = __esm({
35167
34960
  json: { type: "boolean", description: "Output results as JSON" }
35168
34961
  },
35169
34962
  async run({ args: _args }) {
35170
- const root = getProjectRoot21();
34963
+ const root = getProjectRoot20();
35171
34964
  try {
35172
34965
  const result = await backfillBrainGraph(root);
35173
34966
  cliOutput(
@@ -35208,7 +35001,7 @@ var init_brain2 = __esm({
35208
35001
  json: { type: "boolean", description: "Output results as JSON" }
35209
35002
  },
35210
35003
  async run({ args: _args }) {
35211
- const root = getProjectRoot21();
35004
+ const root = getProjectRoot20();
35212
35005
  try {
35213
35006
  const result = await purgeBrainNoise(root);
35214
35007
  cliOutput(
@@ -35254,7 +35047,7 @@ var init_brain2 = __esm({
35254
35047
  json: { type: "boolean", description: "Output results as JSON" }
35255
35048
  },
35256
35049
  async run({ args }) {
35257
- const root = getProjectRoot21();
35050
+ const root = getProjectRoot20();
35258
35051
  const limit = Number.parseInt(args.limit, 10) || 20;
35259
35052
  try {
35260
35053
  const stats = await getPlasticityStats(root, limit);
@@ -35304,7 +35097,7 @@ var init_brain2 = __esm({
35304
35097
  json: { type: "boolean", description: "Output results as JSON" }
35305
35098
  },
35306
35099
  async run({ args: _args }) {
35307
- const root = getProjectRoot21();
35100
+ const root = getProjectRoot20();
35308
35101
  try {
35309
35102
  const report = await getMemoryQualityReport(root);
35310
35103
  cliOutput(
@@ -35353,7 +35146,7 @@ var init_brain2 = __esm({
35353
35146
  }
35354
35147
  },
35355
35148
  async run({ args }) {
35356
- const root = getProjectRoot21();
35149
+ const root = getProjectRoot20();
35357
35150
  const format = args.format ?? "gexf";
35358
35151
  if (format !== "gexf" && format !== "json") {
35359
35152
  cliError(`Invalid format: ${format}. Use 'gexf' or 'json'.`, "E_VALIDATION", {
@@ -35433,7 +35226,7 @@ var briefing_exports = {};
35433
35226
  __export(briefing_exports, {
35434
35227
  briefingCommand: () => briefingCommand
35435
35228
  });
35436
- import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
35229
+ import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
35437
35230
  import { homedir as homedir2 } from "node:os";
35438
35231
  import { join as join7 } from "node:path";
35439
35232
  function resolveInjectionTemplatePath() {
@@ -35465,7 +35258,7 @@ function renderForAdapter(sectionName, content, format) {
35465
35258
  }
35466
35259
  async function runBriefingInject(sectionName, formatStr) {
35467
35260
  const templatePath = resolveInjectionTemplatePath();
35468
- if (!existsSync7(templatePath)) {
35261
+ if (!existsSync6(templatePath)) {
35469
35262
  process.stderr.write(`[briefing inject] CLEO-INJECTION.md not found at ${templatePath}
35470
35263
  `);
35471
35264
  process.exitCode = 1;
@@ -35658,11 +35451,11 @@ var init_caamp = __esm({
35658
35451
  }
35659
35452
  if (args["dry-run"]) {
35660
35453
  const { parseCaampBlocks } = await import("@cleocode/caamp");
35661
- const { existsSync: existsSync16 } = await import("node:fs");
35454
+ const { existsSync: existsSync14 } = await import("node:fs");
35662
35455
  const { readFile: readFile6 } = await import("node:fs/promises");
35663
35456
  const dryResults = [];
35664
35457
  for (const filePath of filePaths) {
35665
- if (!existsSync16(filePath)) {
35458
+ if (!existsSync14(filePath)) {
35666
35459
  dryResults.push({ filePath, exists: false, blockCount: 0, wouldRemove: 0 });
35667
35460
  continue;
35668
35461
  }
@@ -35760,13 +35553,13 @@ var cant_exports = {};
35760
35553
  __export(cant_exports, {
35761
35554
  cantCommand: () => cantCommand
35762
35555
  });
35763
- import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "node:fs";
35764
- import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve4 } from "node:path";
35556
+ import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "node:fs";
35557
+ import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve3 } from "node:path";
35765
35558
  function resolveFilePath(file) {
35766
- return isAbsolute(file) ? file : resolve4(process.cwd(), file);
35559
+ return isAbsolute(file) ? file : resolve3(process.cwd(), file);
35767
35560
  }
35768
35561
  function ensureExists(filePath, operation) {
35769
- if (existsSync8(filePath)) return true;
35562
+ if (existsSync7(filePath)) return true;
35770
35563
  cliError(`File not found: ${filePath}`, "E_FILE_READ");
35771
35564
  process.exitCode = 3;
35772
35565
  if (process.env["CLEO_DEBUG"]) humanWarn(`(operation: ${operation})`);
@@ -37921,7 +37714,7 @@ var daemon_exports = {};
37921
37714
  __export(daemon_exports, {
37922
37715
  daemonCommand: () => daemonCommand
37923
37716
  });
37924
- import { existsSync as existsSync9 } from "node:fs";
37717
+ import { existsSync as existsSync8 } from "node:fs";
37925
37718
  import { homedir as homedir4 } from "node:os";
37926
37719
  import { join as join10 } from "node:path";
37927
37720
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -37989,7 +37782,7 @@ async function showDaemonStatus(cleoDir, projectRoot) {
37989
37782
  function resolveDaemonInstallerScript() {
37990
37783
  const filePath = fileURLToPath3(import.meta.url);
37991
37784
  const candidate1 = join10(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
37992
- if (existsSync9(candidate1)) return candidate1;
37785
+ if (existsSync8(candidate1)) return candidate1;
37993
37786
  const candidate2 = join10(
37994
37787
  filePath,
37995
37788
  "..",
@@ -38697,12 +38490,12 @@ var detect_drift_exports = {};
38697
38490
  __export(detect_drift_exports, {
38698
38491
  detectDriftCommand: () => detectDriftCommand
38699
38492
  });
38700
- import { existsSync as existsSync10, readdirSync, readFileSync as readFileSync10 } from "node:fs";
38493
+ import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync10 } from "node:fs";
38701
38494
  import { dirname as dirname5, join as join11 } from "node:path";
38702
38495
  function findProjectRoot() {
38703
38496
  let currentDir = process.cwd();
38704
38497
  while (currentDir !== "/") {
38705
- if (existsSync10(join11(currentDir, "package.json"))) {
38498
+ if (existsSync9(join11(currentDir, "package.json"))) {
38706
38499
  return currentDir;
38707
38500
  }
38708
38501
  const parent = dirname5(currentDir);
@@ -38726,7 +38519,7 @@ var init_detect_drift = __esm({
38726
38519
  },
38727
38520
  async run() {
38728
38521
  const projectRoot = findProjectRoot();
38729
- const isCleoRepo = existsSync10(join11(projectRoot, "packages", "cleo", "src"));
38522
+ const isCleoRepo = existsSync9(join11(projectRoot, "packages", "cleo", "src"));
38730
38523
  const cleoSrcRoot = isCleoRepo ? join11(projectRoot, "packages", "cleo", "src") : join11(projectRoot, "src");
38731
38524
  const safeRead = (filePath) => {
38732
38525
  try {
@@ -38742,7 +38535,7 @@ var init_detect_drift = __esm({
38742
38535
  recommendations: []
38743
38536
  };
38744
38537
  const injPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
38745
- if (existsSync10(injPath)) {
38538
+ if (existsSync9(injPath)) {
38746
38539
  const content = safeRead(injPath);
38747
38540
  userResult.checks.push({
38748
38541
  name: "Agent injection",
@@ -38796,7 +38589,7 @@ var init_detect_drift = __esm({
38796
38589
  const specPath = join11(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
38797
38590
  const registryPath = join11(cleoSrcRoot, "dispatch", "registry.ts");
38798
38591
  const dispatchDomainsDir = join11(cleoSrcRoot, "dispatch", "domains");
38799
- if (!existsSync10(specPath)) {
38592
+ if (!existsSync9(specPath)) {
38800
38593
  addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
38801
38594
  {
38802
38595
  severity: "error",
@@ -38806,7 +38599,7 @@ var init_detect_drift = __esm({
38806
38599
  recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
38807
38600
  }
38808
38601
  ]);
38809
- } else if (!existsSync10(registryPath) || !existsSync10(dispatchDomainsDir)) {
38602
+ } else if (!existsSync9(registryPath) || !existsSync9(dispatchDomainsDir)) {
38810
38603
  addCheck("Gateway-to-spec sync", "fail", "Dispatch registry or domains missing", [
38811
38604
  {
38812
38605
  severity: "error",
@@ -38866,7 +38659,7 @@ var init_detect_drift = __esm({
38866
38659
  try {
38867
38660
  const cliDir = join11(cleoSrcRoot, "cli", "commands");
38868
38661
  const coreDir = isCleoRepo ? join11(projectRoot, "packages", "core", "src") : join11(projectRoot, "src", "core");
38869
- if (!existsSync10(cliDir)) {
38662
+ if (!existsSync9(cliDir)) {
38870
38663
  addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
38871
38664
  {
38872
38665
  severity: "error",
@@ -38875,7 +38668,7 @@ var init_detect_drift = __esm({
38875
38668
  recommendation: "Verify TypeScript source structure is intact"
38876
38669
  }
38877
38670
  ]);
38878
- } else if (!existsSync10(coreDir)) {
38671
+ } else if (!existsSync9(coreDir)) {
38879
38672
  addCheck("CLI-to-core sync", "fail", "Core directory missing", [
38880
38673
  {
38881
38674
  severity: "error",
@@ -38893,7 +38686,7 @@ var init_detect_drift = __esm({
38893
38686
  }
38894
38687
  try {
38895
38688
  const domainsDir = join11(cleoSrcRoot, "dispatch", "domains");
38896
- if (!existsSync10(domainsDir)) {
38689
+ if (!existsSync9(domainsDir)) {
38897
38690
  addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
38898
38691
  {
38899
38692
  severity: "error",
@@ -38911,7 +38704,7 @@ var init_detect_drift = __esm({
38911
38704
  }
38912
38705
  try {
38913
38706
  const matrixPath = join11(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
38914
- if (!existsSync10(matrixPath)) {
38707
+ if (!existsSync9(matrixPath)) {
38915
38708
  addCheck("Capability matrix", "fail", "Capability matrix missing", [
38916
38709
  {
38917
38710
  severity: "error",
@@ -38928,7 +38721,7 @@ var init_detect_drift = __esm({
38928
38721
  }
38929
38722
  try {
38930
38723
  const schemaPath = join11(projectRoot, "src", "store", "schema.ts");
38931
- if (!existsSync10(schemaPath)) {
38724
+ if (!existsSync9(schemaPath)) {
38932
38725
  addCheck("Schema validation", "fail", "Schema definition missing", [
38933
38726
  {
38934
38727
  severity: "error",
@@ -38965,7 +38758,7 @@ var init_detect_drift = __esm({
38965
38758
  const visionPath = join11(projectRoot, "docs", "concepts", "CLEO-VISION.md");
38966
38759
  const specPath = join11(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
38967
38760
  const issues = [];
38968
- if (!existsSync10(visionPath)) {
38761
+ if (!existsSync9(visionPath)) {
38969
38762
  issues.push({
38970
38763
  severity: "error",
38971
38764
  category: "vision",
@@ -38974,7 +38767,7 @@ var init_detect_drift = __esm({
38974
38767
  recommendation: "Create docs/concepts/CLEO-VISION.md with project vision"
38975
38768
  });
38976
38769
  }
38977
- if (!existsSync10(specPath)) {
38770
+ if (!existsSync9(specPath)) {
38978
38771
  issues.push({
38979
38772
  severity: "error",
38980
38773
  category: "spec",
@@ -39019,7 +38812,7 @@ var init_detect_drift = __esm({
39019
38812
  }
39020
38813
  try {
39021
38814
  const injectionPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
39022
- if (!existsSync10(injectionPath)) {
38815
+ if (!existsSync9(injectionPath)) {
39023
38816
  addCheck("Agent injection", "fail", "Agent injection template missing", [
39024
38817
  {
39025
38818
  severity: "error",
@@ -39049,7 +38842,7 @@ var init_detect_drift = __esm({
39049
38842
  }
39050
38843
  try {
39051
38844
  const exitCodesPath = join11(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
39052
- if (!existsSync10(exitCodesPath)) {
38845
+ if (!existsSync9(exitCodesPath)) {
39053
38846
  addCheck("Exit codes", "fail", "Exit codes definition missing", [
39054
38847
  {
39055
38848
  severity: "error",
@@ -39223,14 +39016,14 @@ __export(docs_exports, {
39223
39016
  docsCommand: () => docsCommand
39224
39017
  });
39225
39018
  import { mkdir, readdir, readFile as readFile2, writeFile } from "node:fs/promises";
39226
- import { dirname as dirname6, isAbsolute as isAbsolute2, join as join12, resolve as resolve5 } from "node:path";
39019
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join12, resolve as resolve4 } from "node:path";
39227
39020
  import {
39228
39021
  buildDocsGraph,
39229
39022
  CleoError as CleoError3,
39230
39023
  exportDocument,
39231
39024
  formatError as formatError5,
39232
39025
  getAgentOutputsAbsolute,
39233
- getProjectRoot as getProjectRoot22,
39026
+ getProjectRoot as getProjectRoot21,
39234
39027
  listDocVersions,
39235
39028
  mergeDocs,
39236
39029
  publishDocs,
@@ -39526,7 +39319,7 @@ var init_docs3 = __esm({
39526
39319
  const taskId = String(args.task);
39527
39320
  const includeAttachments = args["include-attachments"] !== false;
39528
39321
  const includeMemoryRefs = args["include-memory-refs"] === true;
39529
- const projectRoot = getProjectRoot22();
39322
+ const projectRoot = getProjectRoot21();
39530
39323
  try {
39531
39324
  const result = await exportDocument({
39532
39325
  taskId,
@@ -39536,7 +39329,7 @@ var init_docs3 = __esm({
39536
39329
  });
39537
39330
  let writtenPath;
39538
39331
  if (typeof args.out === "string" && args.out.length > 0) {
39539
- const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
39332
+ const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
39540
39333
  await mkdir(dirname6(outPath), { recursive: true });
39541
39334
  await writeFile(outPath, result.markdown, "utf8");
39542
39335
  writtenPath = outPath;
@@ -39589,7 +39382,7 @@ var init_docs3 = __esm({
39589
39382
  }
39590
39383
  },
39591
39384
  async run({ args }) {
39592
- const projectRoot = getProjectRoot22();
39385
+ const projectRoot = getProjectRoot21();
39593
39386
  try {
39594
39387
  const result = await searchDocs2(String(args.query), {
39595
39388
  ownerId: args.owner ?? void 0,
@@ -39641,7 +39434,7 @@ var init_docs3 = __esm({
39641
39434
  }
39642
39435
  },
39643
39436
  async run({ args }) {
39644
- const projectRoot = getProjectRoot22();
39437
+ const projectRoot = getProjectRoot21();
39645
39438
  const rawStrategy = args.strategy ?? "three-way";
39646
39439
  const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
39647
39440
  try {
@@ -39650,7 +39443,7 @@ var init_docs3 = __esm({
39650
39443
  base: args.base ?? void 0
39651
39444
  });
39652
39445
  if (typeof args.out === "string" && args.out.length > 0) {
39653
- const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
39446
+ const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
39654
39447
  await mkdir(dirname6(outPath), { recursive: true });
39655
39448
  await writeFile(outPath, result.merged, "utf8");
39656
39449
  humanInfo(`Wrote merged content to ${outPath}`);
@@ -39691,7 +39484,7 @@ var init_docs3 = __esm({
39691
39484
  }
39692
39485
  },
39693
39486
  async run({ args }) {
39694
- const projectRoot = getProjectRoot22();
39487
+ const projectRoot = getProjectRoot21();
39695
39488
  const fmt = args.format ?? "mermaid";
39696
39489
  try {
39697
39490
  const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
@@ -39721,7 +39514,7 @@ var init_docs3 = __esm({
39721
39514
  output = lines.join("\n");
39722
39515
  }
39723
39516
  if (typeof args.out === "string" && args.out.length > 0) {
39724
- const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
39517
+ const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
39725
39518
  await mkdir(dirname6(outPath), { recursive: true });
39726
39519
  await writeFile(outPath, output, "utf8");
39727
39520
  humanInfo(`Wrote graph to ${outPath}`);
@@ -39761,7 +39554,7 @@ var init_docs3 = __esm({
39761
39554
  }
39762
39555
  },
39763
39556
  async run({ args }) {
39764
- const projectRoot = getProjectRoot22();
39557
+ const projectRoot = getProjectRoot21();
39765
39558
  try {
39766
39559
  const result = await rankDocs({
39767
39560
  ownerId: String(args.for),
@@ -39800,7 +39593,7 @@ var init_docs3 = __esm({
39800
39593
  }
39801
39594
  },
39802
39595
  async run({ args }) {
39803
- const projectRoot = getProjectRoot22();
39596
+ const projectRoot = getProjectRoot21();
39804
39597
  try {
39805
39598
  const result = await listDocVersions({
39806
39599
  ownerId: String(args.for),
@@ -39844,7 +39637,7 @@ var init_docs3 = __esm({
39844
39637
  }
39845
39638
  },
39846
39639
  async run({ args }) {
39847
- const projectRoot = getProjectRoot22();
39640
+ const projectRoot = getProjectRoot21();
39848
39641
  try {
39849
39642
  const result = await publishDocs({
39850
39643
  ownerId: String(args.for),
@@ -40247,9 +40040,9 @@ __export(migrate_agents_v2_exports, {
40247
40040
  walkAgentsDir: () => walkAgentsDir
40248
40041
  });
40249
40042
  import { createHash as createHash2 } from "node:crypto";
40250
- import { appendFileSync as appendFileSync2, existsSync as existsSync11, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync11 } from "node:fs";
40043
+ import { appendFileSync as appendFileSync2, existsSync as existsSync10, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync11 } from "node:fs";
40251
40044
  import { join as join13 } from "node:path";
40252
- import { getProjectRoot as getProjectRoot23, installAgentFromCant } from "@cleocode/core/internal";
40045
+ import { getProjectRoot as getProjectRoot22, installAgentFromCant } from "@cleocode/core/internal";
40253
40046
  import { openCleoDb } from "@cleocode/core/store/open-cleo-db";
40254
40047
  function sha256Hex(bytes) {
40255
40048
  return createHash2("sha256").update(bytes).digest("hex");
@@ -40270,13 +40063,13 @@ function extractAgentName(source) {
40270
40063
  function appendAuditLog(projectRoot, entry) {
40271
40064
  const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
40272
40065
  const auditDir = join13(auditPath, "..");
40273
- if (!existsSync11(auditDir)) {
40066
+ if (!existsSync10(auditDir)) {
40274
40067
  mkdirSync3(auditDir, { recursive: true });
40275
40068
  }
40276
40069
  appendFileSync2(auditPath, JSON.stringify(entry) + "\n", "utf8");
40277
40070
  }
40278
40071
  function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
40279
- if (!existsSync11(scanDir)) return;
40072
+ if (!existsSync10(scanDir)) return;
40280
40073
  let files;
40281
40074
  try {
40282
40075
  files = readdirSync2(scanDir).filter((f) => f.endsWith(".cant"));
@@ -40395,7 +40188,7 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
40395
40188
  }
40396
40189
  function readMigrationConflicts(projectRoot) {
40397
40190
  const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
40398
- if (!existsSync11(auditPath)) return [];
40191
+ if (!existsSync10(auditPath)) return [];
40399
40192
  let raw;
40400
40193
  try {
40401
40194
  raw = readFileSync11(auditPath, "utf8");
@@ -40436,7 +40229,7 @@ var init_migrate_agents_v2 = __esm({
40436
40229
  }
40437
40230
  },
40438
40231
  async run({ args }) {
40439
- const projectRoot = getProjectRoot23();
40232
+ const projectRoot = getProjectRoot22();
40440
40233
  const verbose = args.quiet !== true;
40441
40234
  if (verbose) {
40442
40235
  humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
@@ -40480,7 +40273,7 @@ __export(doctor_exports, {
40480
40273
  });
40481
40274
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "node:fs";
40482
40275
  import { join as join14 } from "node:path";
40483
- import { getProjectRoot as getProjectRoot24, quarantineRogueCleoDir, scanRogueCleoDirs } from "@cleocode/core/internal";
40276
+ import { getProjectRoot as getProjectRoot23, quarantineRogueCleoDir, scanRogueCleoDirs } from "@cleocode/core/internal";
40484
40277
  async function scanTestFixturesInProd(projectRoot) {
40485
40278
  const { getDb: getDb3, getNativeDb } = await import("@cleocode/core/internal");
40486
40279
  await getDb3(projectRoot);
@@ -40702,7 +40495,7 @@ var init_doctor = __esm({
40702
40495
  try {
40703
40496
  if (args.brain) {
40704
40497
  const { computeBrainHealthDashboard } = await import("@cleocode/core/internal");
40705
- const projectRoot = getProjectRoot24();
40498
+ const projectRoot = getProjectRoot23();
40706
40499
  const dashboard = await computeBrainHealthDashboard(projectRoot);
40707
40500
  cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
40708
40501
  if (dashboard.hasP0Failure) {
@@ -40711,7 +40504,7 @@ var init_doctor = __esm({
40711
40504
  return;
40712
40505
  }
40713
40506
  if (args["scan-test-fixtures-in-prod"]) {
40714
- const projectRoot = getProjectRoot24();
40507
+ const projectRoot = getProjectRoot23();
40715
40508
  const matches = await scanTestFixturesInProd(projectRoot);
40716
40509
  const dryRun = args["dry-run"] !== false && args.quarantine !== true;
40717
40510
  const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
@@ -40799,7 +40592,7 @@ var init_doctor = __esm({
40799
40592
  progress.complete("Comprehensive diagnostics complete");
40800
40593
  } else if (args["scan-rogue-cleo-dirs"]) {
40801
40594
  progress.step(0, "Scanning for rogue .cleo/ directories");
40802
- const projectRoot = getProjectRoot24();
40595
+ const projectRoot = getProjectRoot23();
40803
40596
  const reports = scanRogueCleoDirs(projectRoot);
40804
40597
  progress.complete(
40805
40598
  `Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
@@ -40808,7 +40601,7 @@ var init_doctor = __esm({
40808
40601
  } else if (args["quarantine-rogue-cleo-dirs"]) {
40809
40602
  const isDryRun = args["dry-run"] === true;
40810
40603
  progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
40811
- const projectRoot = getProjectRoot24();
40604
+ const projectRoot = getProjectRoot23();
40812
40605
  const reports = scanRogueCleoDirs(projectRoot);
40813
40606
  if (reports.length === 0) {
40814
40607
  progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
@@ -40862,7 +40655,7 @@ var init_doctor = __esm({
40862
40655
  const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/internal");
40863
40656
  const { getCleoHome: getCleoHome3 } = await import("@cleocode/core/internal");
40864
40657
  const cleoHome = getCleoHome3();
40865
- const projectRoot = getProjectRoot24();
40658
+ const projectRoot = getProjectRoot23();
40866
40659
  const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
40867
40660
  const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
40868
40661
  const isDryRun = args["dry-run"] === true;
@@ -40911,7 +40704,7 @@ var init_doctor = __esm({
40911
40704
  { command: "doctor", operation: "admin.health" }
40912
40705
  );
40913
40706
  try {
40914
- const projectRoot = getProjectRoot24();
40707
+ const projectRoot = getProjectRoot23();
40915
40708
  const conflicts = readMigrationConflicts(projectRoot);
40916
40709
  if (conflicts.length > 0) {
40917
40710
  progress.complete(
@@ -41854,9 +41647,9 @@ __export(generate_changelog_exports, {
41854
41647
  generateChangelogCommand: () => generateChangelogCommand
41855
41648
  });
41856
41649
  import { execFileSync as execFileSync2 } from "node:child_process";
41857
- import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync4 } from "node:fs";
41650
+ import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync4 } from "node:fs";
41858
41651
  import { dirname as dirname7, join as join17 } from "node:path";
41859
- import { CleoError as CleoError4, formatError as formatError6, getConfigPath, getProjectRoot as getProjectRoot25 } from "@cleocode/core";
41652
+ import { CleoError as CleoError4, formatError as formatError6, getConfigPath, getProjectRoot as getProjectRoot24 } from "@cleocode/core";
41860
41653
  function getChangelogSource(cwd) {
41861
41654
  const configPath = getConfigPath(cwd);
41862
41655
  try {
@@ -41887,7 +41680,7 @@ function getDefaultOutputPath(platform) {
41887
41680
  }
41888
41681
  }
41889
41682
  function getGitHubRepoSlug(cwd) {
41890
- const projectRoot = getProjectRoot25(cwd);
41683
+ const projectRoot = getProjectRoot24(cwd);
41891
41684
  try {
41892
41685
  const remoteUrl = execFileSync2("git", ["remote", "get-url", "origin"], {
41893
41686
  cwd: projectRoot,
@@ -42020,8 +41813,8 @@ var init_generate_changelog = __esm({
42020
41813
  const targetPlatform = args.platform;
42021
41814
  const dryRun = args["dry-run"] === true;
42022
41815
  const sourceFile = getChangelogSource();
42023
- const sourcePath = join17(getProjectRoot25(), sourceFile);
42024
- if (!existsSync12(sourcePath)) {
41816
+ const sourcePath = join17(getProjectRoot24(), sourceFile);
41817
+ if (!existsSync11(sourcePath)) {
42025
41818
  throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
42026
41819
  }
42027
41820
  const sourceContent = readFileSync12(sourcePath, "utf-8");
@@ -42033,7 +41826,7 @@ var init_generate_changelog = __esm({
42033
41826
  const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
42034
41827
  const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
42035
41828
  if (!dryRun) {
42036
- const fullPath = join17(getProjectRoot25(), outputPath);
41829
+ const fullPath = join17(getProjectRoot24(), outputPath);
42037
41830
  mkdirSync5(dirname7(fullPath), { recursive: true });
42038
41831
  writeFileSync4(fullPath, content, "utf-8");
42039
41832
  }
@@ -42054,7 +41847,7 @@ var init_generate_changelog = __esm({
42054
41847
  limit
42055
41848
  );
42056
41849
  if (!dryRun) {
42057
- const fullPath = join17(getProjectRoot25(), platformConfig.path);
41850
+ const fullPath = join17(getProjectRoot24(), platformConfig.path);
42058
41851
  mkdirSync5(dirname7(fullPath), { recursive: true });
42059
41852
  writeFileSync4(fullPath, content, "utf-8");
42060
41853
  }
@@ -43193,7 +42986,7 @@ __export(init_exports, {
43193
42986
  getGitignoreTemplate: () => getGitignoreTemplate,
43194
42987
  initCommand: () => initCommand2
43195
42988
  });
43196
- import { existsSync as existsSync13, readFileSync as readFileSync13 } from "node:fs";
42989
+ import { existsSync as existsSync12, readFileSync as readFileSync13 } from "node:fs";
43197
42990
  import { join as join18 } from "node:path";
43198
42991
  import { fileURLToPath as fileURLToPath4 } from "node:url";
43199
42992
  import { CleoError as CleoError5, formatError as formatError7, initProject as initProject2 } from "@cleocode/core";
@@ -43203,8 +42996,8 @@ function getGitignoreTemplate() {
43203
42996
  const packageRoot = join18(thisFile, "..", "..", "..", "..");
43204
42997
  const localTemplatePath = join18(packageRoot, "templates", "cleo-gitignore");
43205
42998
  const monorepoTemplatePath = join18(packageRoot, "..", "..", "templates", "cleo-gitignore");
43206
- const templatePath = existsSync13(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
43207
- if (existsSync13(templatePath)) {
42999
+ const templatePath = existsSync12(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
43000
+ if (existsSync12(templatePath)) {
43208
43001
  return readFileSync13(templatePath, "utf-8");
43209
43002
  }
43210
43003
  } catch {
@@ -44091,7 +43884,7 @@ var llm_cost_exports = {};
44091
43884
  __export(llm_cost_exports, {
44092
43885
  costCommand: () => costCommand
44093
43886
  });
44094
- import { getProjectRoot as getProjectRoot26 } from "@cleocode/core/internal";
43887
+ import { getProjectRoot as getProjectRoot25 } from "@cleocode/core/internal";
44095
43888
  import { computeCost } from "@cleocode/core/llm/usage-pricing";
44096
43889
  function resolveSessionId(raw) {
44097
43890
  if (raw === "current") {
@@ -44164,7 +43957,7 @@ var init_llm_cost = __esm({
44164
43957
  process.exit(6);
44165
43958
  }
44166
43959
  const sessionId = resolveSessionId(rawSessionId);
44167
- const projectRoot = getProjectRoot26(process.cwd());
43960
+ const projectRoot = getProjectRoot25(process.cwd());
44168
43961
  let breakdown;
44169
43962
  try {
44170
43963
  breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
@@ -44327,7 +44120,7 @@ async function _headlessPkceFlow(provider, authUrl) {
44327
44120
  ` After approving, paste the full redirect URL (http://localhost?code=\u2026&state=\u2026):
44328
44121
  `
44329
44122
  );
44330
- return new Promise((resolve7, reject) => {
44123
+ return new Promise((resolve5, reject) => {
44331
44124
  let buf = "";
44332
44125
  process.stdin.setEncoding("utf8");
44333
44126
  process.stdin.once("data", (chunk) => {
@@ -44339,7 +44132,7 @@ async function _headlessPkceFlow(provider, authUrl) {
44339
44132
  reject(new Error('Redirect URL is missing the "code" parameter'));
44340
44133
  return;
44341
44134
  }
44342
- resolve7(code);
44135
+ resolve5(code);
44343
44136
  } catch {
44344
44137
  reject(new Error(`Invalid redirect URL: ${buf}`));
44345
44138
  }
@@ -44347,7 +44140,7 @@ async function _headlessPkceFlow(provider, authUrl) {
44347
44140
  });
44348
44141
  }
44349
44142
  async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
44350
- return new Promise((resolve7) => {
44143
+ return new Promise((resolve5) => {
44351
44144
  const server = createServer((req, res) => {
44352
44145
  const url = new URL(req.url ?? "/", `http://localhost:${port}`);
44353
44146
  const code = url.searchParams.get("code");
@@ -44357,7 +44150,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
44357
44150
  if (error) {
44358
44151
  res.end(`<h1>Authorization failed</h1><p>${error}</p><p>You may close this tab.</p>`);
44359
44152
  server.close();
44360
- resolve7({
44153
+ resolve5({
44361
44154
  error: {
44362
44155
  code: "E_PKCE_AUTH_DENIED",
44363
44156
  codeName: "E_PKCE_AUTH_DENIED",
@@ -44369,7 +44162,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
44369
44162
  if (!code || state !== expectedState) {
44370
44163
  res.end("<h1>Invalid callback</h1><p>You may close this tab.</p>");
44371
44164
  server.close();
44372
- resolve7({
44165
+ resolve5({
44373
44166
  error: {
44374
44167
  code: "E_PKCE_INVALID_CALLBACK",
44375
44168
  codeName: "E_PKCE_INVALID_CALLBACK",
@@ -44380,7 +44173,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
44380
44173
  }
44381
44174
  res.end("<h1>Authorized</h1><p>You may close this tab and return to your terminal.</p>");
44382
44175
  server.close();
44383
- resolve7({ code });
44176
+ resolve5({ code });
44384
44177
  });
44385
44178
  server.listen(port, "localhost", () => {
44386
44179
  process.stderr.write("\n");
@@ -44513,7 +44306,7 @@ function _generateState() {
44513
44306
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
44514
44307
  }
44515
44308
  function _findFreePort() {
44516
- return new Promise((resolve7, reject) => {
44309
+ return new Promise((resolve5, reject) => {
44517
44310
  const srv = createServer();
44518
44311
  srv.listen(0, "localhost", () => {
44519
44312
  const addr = srv.address();
@@ -44523,7 +44316,7 @@ function _findFreePort() {
44523
44316
  return;
44524
44317
  }
44525
44318
  const port = addr.port;
44526
- srv.close(() => resolve7(port));
44319
+ srv.close(() => resolve5(port));
44527
44320
  });
44528
44321
  srv.on("error", reject);
44529
44322
  });
@@ -44990,14 +44783,14 @@ async function readStdin() {
44990
44783
  if (process.stdin.isTTY) {
44991
44784
  return "";
44992
44785
  }
44993
- return new Promise((resolve7, reject) => {
44786
+ return new Promise((resolve5, reject) => {
44994
44787
  let data = "";
44995
44788
  process.stdin.setEncoding("utf-8");
44996
44789
  process.stdin.on("data", (chunk) => {
44997
44790
  data += chunk;
44998
44791
  });
44999
44792
  process.stdin.on("end", () => {
45000
- resolve7(data.trim());
44793
+ resolve5(data.trim());
45001
44794
  });
45002
44795
  process.stdin.on("error", reject);
45003
44796
  });
@@ -45349,14 +45142,14 @@ __export(memory_exports, {
45349
45142
  memoryCommand: () => memoryCommand
45350
45143
  });
45351
45144
  import { createHash as createHash3 } from "node:crypto";
45352
- import { existsSync as existsSync14, mkdirSync as mkdirSync6, readdirSync as readdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
45145
+ import { existsSync as existsSync13, mkdirSync as mkdirSync6, readdirSync as readdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
45353
45146
  import { homedir as homedir6 } from "node:os";
45354
45147
  import { join as join19 } from "node:path";
45355
45148
  import {
45356
45149
  getBrainDb as getBrainDb2,
45357
45150
  getBrainNativeDb as getBrainNativeDb3,
45358
45151
  getDreamStatus,
45359
- getProjectRoot as getProjectRoot27,
45152
+ getProjectRoot as getProjectRoot26,
45360
45153
  runConsolidation,
45361
45154
  triggerManualDream
45362
45155
  } from "@cleocode/core/internal";
@@ -45392,7 +45185,7 @@ ${body}`).digest("hex").slice(0, 16);
45392
45185
  }
45393
45186
  function loadImportHashes(stateFile) {
45394
45187
  try {
45395
- if (!existsSync14(stateFile)) return /* @__PURE__ */ new Set();
45188
+ if (!existsSync13(stateFile)) return /* @__PURE__ */ new Set();
45396
45189
  const raw = readFileSync14(stateFile, "utf-8");
45397
45190
  const parsed = JSON.parse(raw);
45398
45191
  return new Set(parsed.hashes);
@@ -45402,7 +45195,7 @@ function loadImportHashes(stateFile) {
45402
45195
  }
45403
45196
  function saveImportHashes(stateFile, hashes) {
45404
45197
  const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
45405
- if (!existsSync14(dir)) mkdirSync6(dir, { recursive: true });
45198
+ if (!existsSync13(dir)) mkdirSync6(dir, { recursive: true });
45406
45199
  writeFileSync5(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
45407
45200
  }
45408
45201
  function makeMemorySubcommand(opts) {
@@ -45422,7 +45215,7 @@ function makeMemorySubcommand(opts) {
45422
45215
  }
45423
45216
  });
45424
45217
  }
45425
- var storeCommand, findCommand5, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand3, graphStatsCommand, graphShowCommand, graphNeighborsCommand, graphAddCommand, graphRemoveCommand, reasonWhyCommand, reasonSimilarCommand, searchHybridCommand, codeLinksCommand, codeAutoLinkCommand, codeMemoriesForCodeCommand, codeForMemoryCommand, consolidateCommand, dreamCommand, reflectCommand, dedupScanCommand, importCommand3, doctorCommand3, llmStatusCommand, verifyCommand, pendingVerifyCommand, tierStatsCommand, tierPromoteCommand, tierDemoteCommand, precompactFlushCommand, backfillRunCommand, backfillApproveCommand, backfillRollbackCommand, backfillCommand2, digestCommand, recentCommand, diaryReadCommand, diaryWriteCommand, diaryCommand, watchCommand2, tierCommand, sweepCommand, memoryCommand;
45218
+ var storeCommand, findCommand5, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand3, graphStatsCommand, graphShowCommand, graphNeighborsCommand, graphAddCommand, graphRemoveCommand, reasonWhyCommand, reasonSimilarCommand, searchHybridCommand, codeLinksCommand, codeAutoLinkCommand, codeMemoriesForCodeCommand, codeForMemoryCommand, consolidateCommand, dreamCommand, reflectCommand, dedupScanCommand, importCommand3, doctorCommand3, llmStatusCommand, verifyCommand, pendingVerifyCommand, tierStatsCommand, tierPromoteCommand, tierDemoteCommand, precompactFlushCommand, backfillRunCommand, backfillApproveCommand, backfillRollbackCommand, backfillCommand, digestCommand, recentCommand, diaryReadCommand, diaryWriteCommand, diaryCommand, watchCommand2, tierCommand, sweepCommand, memoryCommand;
45426
45219
  var init_memory3 = __esm({
45427
45220
  "packages/cleo/src/cli/commands/memory.ts"() {
45428
45221
  "use strict";
@@ -46317,7 +46110,7 @@ var init_memory3 = __esm({
46317
46110
  },
46318
46111
  args: {},
46319
46112
  async run() {
46320
- const root = getProjectRoot27();
46113
+ const root = getProjectRoot26();
46321
46114
  try {
46322
46115
  const result = await runConsolidation(root);
46323
46116
  cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
@@ -46341,7 +46134,7 @@ var init_memory3 = __esm({
46341
46134
  }
46342
46135
  },
46343
46136
  async run({ args }) {
46344
- const root = getProjectRoot27();
46137
+ const root = getProjectRoot26();
46345
46138
  if (args.status) {
46346
46139
  try {
46347
46140
  const status = await getDreamStatus(root);
@@ -46378,7 +46171,7 @@ var init_memory3 = __esm({
46378
46171
  }
46379
46172
  },
46380
46173
  async run({ args }) {
46381
- const root = getProjectRoot27();
46174
+ const root = getProjectRoot26();
46382
46175
  try {
46383
46176
  const { runObserver, runReflector } = await import("@cleocode/core/internal");
46384
46177
  const observerResult = await runObserver(root, args.session, {
@@ -46418,7 +46211,7 @@ var init_memory3 = __esm({
46418
46211
  }
46419
46212
  },
46420
46213
  async run({ args }) {
46421
- const root = getProjectRoot27();
46214
+ const root = getProjectRoot26();
46422
46215
  try {
46423
46216
  const { getBrainDb: getBrainDbInner, getBrainNativeDb: getBrainNativeDbInner } = await import("@cleocode/core/internal");
46424
46217
  await getBrainDbInner(root);
@@ -46516,9 +46309,9 @@ var init_memory3 = __esm({
46516
46309
  async run({ args }) {
46517
46310
  const sourceDir = args.from ?? join19(homedir6(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
46518
46311
  const isDryRun = !!args["dry-run"];
46519
- const projectRoot = getProjectRoot27();
46312
+ const projectRoot = getProjectRoot26();
46520
46313
  const stateFile = join19(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
46521
- if (!existsSync14(sourceDir)) {
46314
+ if (!existsSync13(sourceDir)) {
46522
46315
  cliError(`Source directory not found: ${sourceDir}`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
46523
46316
  process.exit(1);
46524
46317
  return;
@@ -46729,7 +46522,7 @@ var init_memory3 = __esm({
46729
46522
  },
46730
46523
  args: {},
46731
46524
  async run() {
46732
- const root = getProjectRoot27();
46525
+ const root = getProjectRoot26();
46733
46526
  try {
46734
46527
  await getBrainDb2(root);
46735
46528
  const nativeDb = getBrainNativeDb3();
@@ -46828,7 +46621,7 @@ var init_memory3 = __esm({
46828
46621
  }
46829
46622
  },
46830
46623
  async run({ args }) {
46831
- const root = getProjectRoot27();
46624
+ const root = getProjectRoot26();
46832
46625
  const targetTier = args.to;
46833
46626
  const reason = args.reason;
46834
46627
  const validTiers = ["medium", "long"];
@@ -46932,7 +46725,7 @@ var init_memory3 = __esm({
46932
46725
  }
46933
46726
  },
46934
46727
  async run({ args }) {
46935
- const root = getProjectRoot27();
46728
+ const root = getProjectRoot26();
46936
46729
  const targetTier = args.to;
46937
46730
  const reason = args.reason;
46938
46731
  const validTiers = ["short", "medium"];
@@ -47091,7 +46884,7 @@ var init_memory3 = __esm({
47091
46884
  runId: args["runId"]
47092
46885
  })
47093
46886
  });
47094
- backfillCommand2 = defineCommand({
46887
+ backfillCommand = defineCommand({
47095
46888
  meta: {
47096
46889
  name: "backfill",
47097
46890
  description: "Staged brain-graph backfill operations: run, approve, rollback (T1003)."
@@ -47319,8 +47112,8 @@ data: ${JSON.stringify(event)}
47319
47112
  cursor = data.nextCursor;
47320
47113
  }
47321
47114
  if (!running) break;
47322
- await new Promise((resolve7) => {
47323
- const timer = setTimeout(resolve7, intervalMs);
47115
+ await new Promise((resolve5) => {
47116
+ const timer = setTimeout(resolve5, intervalMs);
47324
47117
  timer.unref?.();
47325
47118
  });
47326
47119
  }
@@ -47424,7 +47217,7 @@ data: ${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString() })}
47424
47217
  tier: tierCommand,
47425
47218
  // T1013 — new memory subcommands
47426
47219
  "precompact-flush": precompactFlushCommand,
47427
- backfill: backfillCommand2,
47220
+ backfill: backfillCommand,
47428
47221
  digest: digestCommand,
47429
47222
  recent: recentCommand,
47430
47223
  diary: diaryCommand,
@@ -47446,7 +47239,7 @@ var migrate_claude_mem_exports = {};
47446
47239
  __export(migrate_claude_mem_exports, {
47447
47240
  migrateClaudeMemCommand: () => migrateClaudeMemCommand
47448
47241
  });
47449
- import { getProjectRoot as getProjectRoot28, migrateClaudeMem } from "@cleocode/core/internal";
47242
+ import { getProjectRoot as getProjectRoot27, migrateClaudeMem } from "@cleocode/core/internal";
47450
47243
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
47451
47244
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
47452
47245
  var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
@@ -47509,7 +47302,7 @@ var init_migrate_claude_mem = __esm({
47509
47302
  }
47510
47303
  },
47511
47304
  async run({ args }) {
47512
- const root = getProjectRoot28();
47305
+ const root = getProjectRoot27();
47513
47306
  try {
47514
47307
  const result = await migrateClaudeMem(root, {
47515
47308
  sourcePath: args.source,
@@ -47558,7 +47351,7 @@ var init_migrate_claude_mem = __esm({
47558
47351
  }
47559
47352
  },
47560
47353
  async run({ args }) {
47561
- const projectRoot = getProjectRoot28();
47354
+ const projectRoot = getProjectRoot27();
47562
47355
  try {
47563
47356
  const db = await getDb2(projectRoot);
47564
47357
  const rcasdFlag = Boolean(args.rcasd);
@@ -48503,7 +48296,7 @@ var init_nexus4 = __esm({
48503
48296
  const repoPath = args.path ? path4.resolve(args.path) : process.cwd();
48504
48297
  humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
48505
48298
  try {
48506
- const [{ getNexusDb, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot35 }, { eq: eq2 }] = await Promise.all([
48299
+ const [{ getNexusDb, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot33 }, { eq: eq2 }] = await Promise.all([
48507
48300
  import("@cleocode/core/store/nexus-sqlite"),
48508
48301
  import("@cleocode/nexus/pipeline"),
48509
48302
  import("@cleocode/core/internal"),
@@ -48583,7 +48376,7 @@ var init_nexus4 = __esm({
48583
48376
  extensions: { duration_ms: durationMs }
48584
48377
  }
48585
48378
  );
48586
- void getProjectRoot35;
48379
+ void getProjectRoot33;
48587
48380
  } catch (err) {
48588
48381
  const msg = err instanceof Error ? err.message : String(err);
48589
48382
  cliError(
@@ -48901,13 +48694,13 @@ var init_nexus4 = __esm({
48901
48694
  if (!skipPrompt) {
48902
48695
  const { createInterface: createInterface2 } = await import("node:readline");
48903
48696
  const rl = createInterface2({ input: process.stdin, output: process.stdout });
48904
- const confirmed = await new Promise((resolve7) => {
48697
+ const confirmed = await new Promise((resolve5) => {
48905
48698
  rl.question(
48906
48699
  `
48907
48700
  [nexus] Delete ${matchCount} project(s) from the registry? [y/N] `,
48908
48701
  (answer) => {
48909
48702
  rl.close();
48910
- resolve7(answer.trim().toLowerCase() === "y");
48703
+ resolve5(answer.trim().toLowerCase() === "y");
48911
48704
  }
48912
48705
  );
48913
48706
  });
@@ -52185,7 +51978,7 @@ var refresh_memory_exports = {};
52185
51978
  __export(refresh_memory_exports, {
52186
51979
  refreshMemoryCommand: () => refreshMemoryCommand
52187
51980
  });
52188
- import { getProjectRoot as getProjectRoot29 } from "@cleocode/core";
51981
+ import { getProjectRoot as getProjectRoot28 } from "@cleocode/core";
52189
51982
  var refreshMemoryCommand;
52190
51983
  var init_refresh_memory = __esm({
52191
51984
  "packages/cleo/src/cli/commands/refresh-memory.ts"() {
@@ -52198,7 +51991,7 @@ var init_refresh_memory = __esm({
52198
51991
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
52199
51992
  },
52200
51993
  async run() {
52201
- const projectDir = getProjectRoot29();
51994
+ const projectDir = getProjectRoot28();
52202
51995
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
52203
51996
  const result = await writeMemoryBridge(projectDir);
52204
51997
  if (result.written) {
@@ -53508,7 +53301,7 @@ __export(restore_exports, {
53508
53301
  import fs3 from "node:fs";
53509
53302
  import path5 from "node:path";
53510
53303
  import { CleoError as CleoError8, getTaskAccessor as getTaskAccessor3 } from "@cleocode/core";
53511
- import { getProjectRoot as getProjectRoot30 } from "@cleocode/core/internal";
53304
+ import { getProjectRoot as getProjectRoot29 } from "@cleocode/core/internal";
53512
53305
  function parseMarkdownValue(raw) {
53513
53306
  const trimmed = raw.trim();
53514
53307
  if (trimmed === "_(not present)_" || trimmed === "") return void 0;
@@ -53628,7 +53421,7 @@ var init_restore = __esm({
53628
53421
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
53629
53422
  },
53630
53423
  async run() {
53631
- const projectRoot = getProjectRoot30();
53424
+ const projectRoot = getProjectRoot29();
53632
53425
  const reportPath = path5.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
53633
53426
  if (!fs3.existsSync(reportPath)) {
53634
53427
  humanLine("No pending restore conflicts. Nothing to finalize.");
@@ -54526,11 +54319,11 @@ async function runPostUpdateDiagnostics(opts) {
54526
54319
  input: process.stdin,
54527
54320
  output: process.stdout
54528
54321
  });
54529
- shouldMigrate = await new Promise((resolve7) => {
54322
+ shouldMigrate = await new Promise((resolve5) => {
54530
54323
  rl.question(" Do you want to run the upgrade now? [Y/n] ", (answer) => {
54531
54324
  rl.close();
54532
54325
  const clean = answer.trim().toLowerCase();
54533
- resolve7(clean === "" || clean === "y" || clean === "yes");
54326
+ resolve5(clean === "" || clean === "y" || clean === "yes");
54534
54327
  });
54535
54328
  });
54536
54329
  }
@@ -55603,7 +55396,7 @@ var sequence_exports = {};
55603
55396
  __export(sequence_exports, {
55604
55397
  sequenceCommand: () => sequenceCommand
55605
55398
  });
55606
- import { getProjectRoot as getProjectRoot31 } from "@cleocode/core/internal";
55399
+ import { getProjectRoot as getProjectRoot30 } from "@cleocode/core/internal";
55607
55400
  var showCommand12, checkCommand6, repairCommand, sequenceCommand;
55608
55401
  var init_sequence = __esm({
55609
55402
  "packages/cleo/src/cli/commands/sequence.ts"() {
@@ -55639,7 +55432,7 @@ var init_sequence = __esm({
55639
55432
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
55640
55433
  async run() {
55641
55434
  const { repairSequence } = await import("@cleocode/core/internal");
55642
- const projectRoot = getProjectRoot31();
55435
+ const projectRoot = getProjectRoot30();
55643
55436
  const repair = await repairSequence(projectRoot);
55644
55437
  const result = {
55645
55438
  repaired: repair.repaired,
@@ -55693,7 +55486,7 @@ async function promptOwnerAuthPassword(sessionName) {
55693
55486
  terminal: true
55694
55487
  });
55695
55488
  process.stderr.write(`[cleo] Enter owner-auth password for session "${sessionName}": `);
55696
- const password = await new Promise((resolve7) => {
55489
+ const password = await new Promise((resolve5) => {
55697
55490
  if (process.stdin.setRawMode) {
55698
55491
  process.stdin.setRawMode(
55699
55492
  true
@@ -55711,10 +55504,10 @@ async function promptOwnerAuthPassword(sessionName) {
55711
55504
  );
55712
55505
  }
55713
55506
  process.stderr.write("\n");
55714
- resolve7(pw);
55507
+ resolve5(pw);
55715
55508
  } else if (ch === "") {
55716
55509
  process.stderr.write("\n[cleo] Cancelled.\n");
55717
- resolve7("");
55510
+ resolve5("");
55718
55511
  } else if (ch === "\x7F" || ch === "\b") {
55719
55512
  pw = pw.slice(0, -1);
55720
55513
  } else {
@@ -56082,8 +55875,8 @@ var init_session4 = __esm({
56082
55875
  "audit-scope": { type: "string", description: "Audit log scope (global|local)" }
56083
55876
  },
56084
55877
  async run({ args }) {
56085
- const { detectSessionDrift, getProjectRoot: getProjectRoot35 } = await import("@cleocode/core");
56086
- const projectRoot = await getProjectRoot35();
55878
+ const { detectSessionDrift, getProjectRoot: getProjectRoot33 } = await import("@cleocode/core");
55879
+ const projectRoot = await getProjectRoot33();
56087
55880
  const scope = args["audit-scope"] === "local" ? "local" : "global";
56088
55881
  const report = await detectSessionDrift({ projectRoot, auditScope: scope });
56089
55882
  cliOutput(report, { command: "session drift", operation: "session.drift" });
@@ -57591,7 +57384,7 @@ __export(token_exports, {
57591
57384
  tokenCommand: () => tokenCommand
57592
57385
  });
57593
57386
  import { readFileSync as readFileSync15 } from "node:fs";
57594
- import { getProjectRoot as getProjectRoot32, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
57387
+ import { getProjectRoot as getProjectRoot31, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
57595
57388
  function readPayload(args, textKey, fileKey) {
57596
57389
  const text = args[textKey];
57597
57390
  const file = args[fileKey];
@@ -57755,7 +57548,7 @@ var init_token = __esm({
57755
57548
  domain: args.domain,
57756
57549
  operation: args.operation
57757
57550
  };
57758
- const result = args.record ? await recordTokenExchange2(getProjectRoot32(), input) : await measureTokenExchange(input);
57551
+ const result = args.record ? await recordTokenExchange2(getProjectRoot31(), input) : await measureTokenExchange(input);
57759
57552
  cliOutput(result, {
57760
57553
  command: "token",
57761
57554
  operation: args.record ? "admin.token.record" : "token.estimate"
@@ -57791,7 +57584,7 @@ __export(transcript_exports, {
57791
57584
  });
57792
57585
  import { homedir as homedir8 } from "node:os";
57793
57586
  import { join as join23 } from "node:path";
57794
- import { getProjectRoot as getProjectRoot33 } from "@cleocode/core";
57587
+ import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
57795
57588
  import {
57796
57589
  parseDurationMs,
57797
57590
  pruneTranscripts,
@@ -57821,7 +57614,7 @@ var init_transcript = __esm({
57821
57614
  async run({ args }) {
57822
57615
  if (args.pending) {
57823
57616
  try {
57824
- const projectRoot = getProjectRoot33();
57617
+ const projectRoot = getProjectRoot32();
57825
57618
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
57826
57619
  const pending = await scanPendingTranscripts(projectRoot);
57827
57620
  cliOutput(
@@ -57918,7 +57711,7 @@ var init_transcript = __esm({
57918
57711
  async run({ args }) {
57919
57712
  const tier = args.tier ?? "warm";
57920
57713
  const dryRun = args["dry-run"] ?? false;
57921
- const projectRoot = getProjectRoot33();
57714
+ const projectRoot = getProjectRoot32();
57922
57715
  try {
57923
57716
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
57924
57717
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -58030,7 +57823,7 @@ var init_transcript = __esm({
58030
57823
  const dryRun = args["dry-run"] ?? false;
58031
57824
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
58032
57825
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
58033
- const projectRoot = getProjectRoot33();
57826
+ const projectRoot = getProjectRoot32();
58034
57827
  try {
58035
57828
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
58036
57829
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -58388,6 +58181,23 @@ var init_update = __esm({
58388
58181
  "depends-waiver": {
58389
58182
  type: "string",
58390
58183
  description: "Justification for promoting a task to critical priority without --depends (T1856). Records waiver in task metadata."
58184
+ },
58185
+ /**
58186
+ * Related tasks — semantic relationships (non-dependency).
58187
+ * Comma-separated task IDs with optional type suffix (e.g. "T001:blocks,T002").
58188
+ * Default type is 'related'. Replaces existing relates list.
58189
+ */
58190
+ relates: {
58191
+ type: "string",
58192
+ description: 'Set related tasks (comma-separated, optional type suffix: "T001:blocks,T002")'
58193
+ },
58194
+ "add-relates": {
58195
+ type: "string",
58196
+ description: "Add related tasks without overwriting existing (comma-separated, optional type suffix)"
58197
+ },
58198
+ "remove-relates": {
58199
+ type: "string",
58200
+ description: "Remove related tasks by taskId (comma-separated)"
58391
58201
  }
58392
58202
  },
58393
58203
  async run({ args, cmd }) {
@@ -58413,6 +58223,21 @@ var init_update = __esm({
58413
58223
  params["addDepends"] = args["add-depends"].split(",").map((s) => s.trim());
58414
58224
  if (args["remove-depends"])
58415
58225
  params["removeDepends"] = args["remove-depends"].split(",").map((s) => s.trim());
58226
+ if (args.relates) {
58227
+ params["relates"] = args.relates.split(",").map((s) => {
58228
+ const [taskId, relType = "related"] = s.trim().split(":");
58229
+ return { taskId: taskId.trim(), type: relType.trim() };
58230
+ });
58231
+ }
58232
+ if (args["add-relates"]) {
58233
+ params["addRelates"] = args["add-relates"].split(",").map((s) => {
58234
+ const [taskId, relType = "related"] = s.trim().split(":");
58235
+ return { taskId: taskId.trim(), type: relType.trim() };
58236
+ });
58237
+ }
58238
+ if (args["remove-relates"]) {
58239
+ params["removeRelates"] = args["remove-relates"].split(",").map((s) => s.trim());
58240
+ }
58416
58241
  if (args.notes !== void 0) params["notes"] = args.notes;
58417
58242
  if (args.note !== void 0) params["notes"] = params["notes"] ?? args.note;
58418
58243
  if (args.acceptance)
@@ -58624,124 +58449,14 @@ var init_upgrade = __esm({
58624
58449
  // packages/cleo/src/cli/commands/verify.ts
58625
58450
  var verify_exports = {};
58626
58451
  __export(verify_exports, {
58627
- backfillCommand: () => backfillCommand3,
58628
58452
  verifyCommand: () => verifyCommand3
58629
58453
  });
58630
- import { existsSync as existsSync15 } from "node:fs";
58631
- import { resolve as resolve6 } from "node:path";
58632
- import {
58633
- backfillAllPendingVerifiers,
58634
- backfillVerifier,
58635
- getProjectRoot as getProjectRoot34,
58636
- resolveVerifierScript as resolveVerifierScript2,
58637
- runVerifier
58638
- } from "@cleocode/core";
58639
- async function runBackfillSingle(taskId, projectRoot, force) {
58640
- const response = await dispatchRaw("query", "tasks", "show", { taskId });
58641
- if (!response.success) {
58642
- process.stderr.write(
58643
- `Error: could not fetch task ${taskId}: ${response.error?.message ?? "unknown error"}
58644
- `
58645
- );
58646
- process.exitCode = 1;
58647
- return;
58648
- }
58649
- const task = response.data?.task;
58650
- if (!task) {
58651
- process.stderr.write(`Error: task ${taskId} not found.
58652
- `);
58653
- process.exitCode = 1;
58654
- return;
58655
- }
58656
- const result = backfillVerifier(task, projectRoot, force);
58657
- if (result.status === "generated") {
58658
- cliOutput(result, { command: "verify", operation: "verify.scaffold" });
58659
- } else if (result.status === "skipped") {
58660
- process.stderr.write(
58661
- `Error: verifier already exists: ${result.path}
58662
- Use --force to overwrite. (T9218 idempotency guard)
58663
- `
58664
- );
58665
- process.exitCode = 1;
58666
- } else {
58667
- process.stderr.write(`Error generating verifier for ${taskId}: ${result.error}
58668
- `);
58669
- process.exitCode = 1;
58670
- }
58671
- }
58672
- async function runBackfillAll(projectRoot, force) {
58673
- const seen = /* @__PURE__ */ new Set();
58674
- const pending = [];
58675
- const queries = [
58676
- dispatchRaw("query", "tasks", "list", { priority: "critical", limit: 200 }),
58677
- dispatchRaw("query", "tasks", "list", { size: "large", limit: 200 }),
58678
- dispatchRaw("query", "tasks", "list", { type: "epic", limit: 200 })
58679
- ];
58680
- const results = await Promise.all(queries);
58681
- for (const response of results) {
58682
- if (!response.success) continue;
58683
- const tasks = response.data?.tasks ?? [];
58684
- for (const t of tasks) {
58685
- const id = String(t.id ?? "");
58686
- if (!id || seen.has(id)) continue;
58687
- seen.add(id);
58688
- pending.push(t);
58689
- }
58690
- }
58691
- const summary = backfillAllPendingVerifiers(pending, projectRoot, force);
58692
- if (summary.succeeded === 0 && summary.failed === 0 && summary.skipped === 0) {
58693
- cliOutput(
58694
- { message: "All critical/large/epic tasks already have verifier scripts. Nothing to do." },
58695
- { command: "verify", operation: "verify.scaffold-all" }
58696
- );
58697
- return;
58698
- }
58699
- cliOutput(summary, { command: "verify", operation: "verify.scaffold-all" });
58700
- if (summary.failed > 0) {
58701
- process.exitCode = 1;
58702
- }
58703
- }
58704
- var backfillCommand3, verifyCommand3;
58454
+ var verifyCommand3;
58705
58455
  var init_verify = __esm({
58706
58456
  "packages/cleo/src/cli/commands/verify.ts"() {
58707
58457
  "use strict";
58708
58458
  init_dist();
58709
58459
  init_cli();
58710
- init_renderers();
58711
- backfillCommand3 = defineCommand({
58712
- meta: {
58713
- name: "backfill",
58714
- description: "Auto-generate a verifier stub from AC text for a task lacking one (T9218 / ADR-070)"
58715
- },
58716
- args: {
58717
- taskId: {
58718
- type: "positional",
58719
- description: "Task ID to generate a verifier stub for (e.g. T9213). Omit when using --all-pending.",
58720
- required: false
58721
- },
58722
- "all-pending": {
58723
- type: "boolean",
58724
- description: "Process all critical/large/epic tasks that lack a verifier script (T9218)"
58725
- },
58726
- force: {
58727
- type: "boolean",
58728
- description: "Overwrite an existing verifier without error (idempotency override)"
58729
- }
58730
- },
58731
- async run({ args, cmd }) {
58732
- const projectRoot = getProjectRoot34();
58733
- const force = !!args.force;
58734
- if (args["all-pending"]) {
58735
- await runBackfillAll(projectRoot, force);
58736
- return;
58737
- }
58738
- if (!args.taskId) {
58739
- await showUsage(cmd);
58740
- return;
58741
- }
58742
- await runBackfillSingle(String(args.taskId), projectRoot, force);
58743
- }
58744
- });
58745
58460
  verifyCommand3 = defineCommand({
58746
58461
  meta: { name: "verify", description: "View or modify verification gates for a task" },
58747
58462
  args: {
@@ -58782,11 +58497,6 @@ var init_verify = __esm({
58782
58497
  "shared-evidence": {
58783
58498
  type: "boolean",
58784
58499
  description: "Acknowledge that the same evidence atom is applied to >3 distinct tasks in this session (T1502 / ADR-059). Without this flag, such reuse triggers a warning; in strict mode (CLEO_STRICT_EVIDENCE=1) it is a hard reject."
58785
- },
58786
- "acceptance-check": {
58787
- type: "string",
58788
- description: "Run the task acceptance verifier before any gate write. Resolves scripts/verify-<taskId>-fu.mjs (or pass an explicit path). Blocks if verifier exits non-zero. (T9192 / ADR-070)",
58789
- required: false
58790
58500
  }
58791
58501
  },
58792
58502
  async run({ args, cmd }) {
@@ -58794,67 +58504,6 @@ var init_verify = __esm({
58794
58504
  await showUsage(cmd);
58795
58505
  return;
58796
58506
  }
58797
- if (args.taskId === "backfill") {
58798
- const remainingArgs = process.argv.slice(process.argv.indexOf("backfill") + 1);
58799
- const taskIdArg = remainingArgs.find((a) => !a.startsWith("-"));
58800
- const allPending = remainingArgs.includes("--all-pending");
58801
- const force = remainingArgs.includes("--force");
58802
- const projectRoot = getProjectRoot34();
58803
- if (allPending) {
58804
- await runBackfillAll(projectRoot, force);
58805
- } else if (taskIdArg) {
58806
- await runBackfillSingle(taskIdArg, projectRoot, force);
58807
- } else {
58808
- await showUsage(cmd);
58809
- }
58810
- return;
58811
- }
58812
- const acceptanceCheckRaw = args["acceptance-check"];
58813
- const shouldRunAcceptanceCheck = acceptanceCheckRaw !== void 0 && acceptanceCheckRaw !== false;
58814
- if (shouldRunAcceptanceCheck) {
58815
- const projectRoot = resolve6(process.cwd());
58816
- let verifierPath = null;
58817
- if (typeof acceptanceCheckRaw === "string" && acceptanceCheckRaw.length > 0) {
58818
- const explicit = resolve6(projectRoot, acceptanceCheckRaw);
58819
- verifierPath = existsSync15(explicit) ? explicit : null;
58820
- if (!verifierPath) {
58821
- process.stderr.write(
58822
- `Error: --acceptance-check path not found: ${explicit}
58823
- T9192 / ADR-070: verifier script must exist before gate writes are allowed.
58824
- `
58825
- );
58826
- process.exitCode = 1;
58827
- return;
58828
- }
58829
- } else {
58830
- verifierPath = resolveVerifierScript2(String(args.taskId), projectRoot);
58831
- }
58832
- if (!verifierPath) {
58833
- process.stderr.write(
58834
- `Error: --acceptance-check: no verifier script found for ${args.taskId}.
58835
- Looked for: scripts/verify-${args.taskId}-fu.mjs, scripts/verify-${args.taskId}.mjs
58836
- T9192 / ADR-070: create the verifier script before using --acceptance-check.
58837
- `
58838
- );
58839
- process.exitCode = 1;
58840
- return;
58841
- }
58842
- const { exitCode, stdout, stderr: stderr2 } = runVerifier(verifierPath);
58843
- process.stdout.write(stdout);
58844
- if (stderr2) process.stderr.write(stderr2);
58845
- if (exitCode !== 0) {
58846
- process.stderr.write(
58847
- `
58848
- E_ACCEPTANCE_VERIFIER_FAILED: verifier exited ${exitCode}.
58849
- Verifier: ${verifierPath}
58850
- Gate writes blocked until verifier exits 0. (T9192 / ADR-070)
58851
- `
58852
- );
58853
- process.exitCode = exitCode;
58854
- return;
58855
- }
58856
- humanLine("Verifier passed (exit 0). Proceeding with gate operation.");
58857
- }
58858
58507
  const isWrite = !!(args.gate || args.all || args.reset);
58859
58508
  const useExplain = !isWrite && args.explain === true;
58860
58509
  const operation = isWrite ? "gate.set" : useExplain ? "verify.explain" : "gate.status";
@@ -58991,7 +58640,7 @@ Logs: ${logFile}`
58991
58640
  }
58992
58641
  } catch {
58993
58642
  }
58994
- await new Promise((resolve7) => setTimeout(resolve7, 500));
58643
+ await new Promise((resolve5) => setTimeout(resolve5, 500));
58995
58644
  }
58996
58645
  if (!started) {
58997
58646
  try {
@@ -59068,7 +58717,7 @@ var init_web = __esm({
59068
58717
  }
59069
58718
  for (let i = 0; i < 60; i++) {
59070
58719
  if (!isProcessRunning(status.pid)) break;
59071
- await new Promise((resolve7) => setTimeout(resolve7, 500));
58720
+ await new Promise((resolve5) => setTimeout(resolve5, 500));
59072
58721
  }
59073
58722
  if (isProcessRunning(status.pid)) {
59074
58723
  try {
@@ -59120,7 +58769,7 @@ var init_web = __esm({
59120
58769
  }
59121
58770
  for (let i = 0; i < 60; i++) {
59122
58771
  if (!isProcessRunning(status.pid)) break;
59123
- await new Promise((resolve7) => setTimeout(resolve7, 500));
58772
+ await new Promise((resolve5) => setTimeout(resolve5, 500));
59124
58773
  }
59125
58774
  if (isProcessRunning(status.pid)) {
59126
58775
  try {
@@ -59286,12 +58935,6 @@ var COMMAND_MANIFEST = [
59286
58935
  description: "Git-backed audit tooling (lineage reconstruction, integrity checks). ",
59287
58936
  load: async () => (await Promise.resolve().then(() => (init_audit2(), audit_exports))).auditCommand
59288
58937
  },
59289
- {
59290
- exportName: "backfillCommand",
59291
- name: "backfill",
59292
- description: "Retroactively add acceptance criteria and verification metadata to existing tasks",
59293
- load: async () => (await Promise.resolve().then(() => (init_backfill(), backfill_exports))).backfillCommand
59294
- },
59295
58938
  {
59296
58939
  exportName: "backupInspectSubCommand",
59297
58940
  name: "inspect",
@@ -59958,12 +59601,6 @@ var COMMAND_MANIFEST = [
59958
59601
  description: "Unified project maintenance (storage migration, schema repair, structural fixes, doc refresh)",
59959
59602
  load: async () => (await Promise.resolve().then(() => (init_upgrade(), upgrade_exports))).upgradeCommand
59960
59603
  },
59961
- {
59962
- exportName: "backfillCommand",
59963
- name: "backfill",
59964
- description: "Auto-generate a verifier stub from AC text for a task lacking one (T9218 / ADR-070)",
59965
- load: async () => (await Promise.resolve().then(() => (init_verify(), verify_exports))).backfillCommand
59966
- },
59967
59604
  {
59968
59605
  exportName: "verifyCommand",
59969
59606
  name: "verify",
@@ -60413,7 +60050,7 @@ async function runStartupMaintenance() {
60413
60050
  detectAndRemoveStrayProjectNexus,
60414
60051
  getGlobalSalt,
60415
60052
  getLogger: getLogger17,
60416
- getProjectRoot: getProjectRoot35,
60053
+ getProjectRoot: getProjectRoot33,
60417
60054
  isCleanupMarkerSet,
60418
60055
  migrateSignaldockToConduit,
60419
60056
  needsSignaldockToConduitMigration,
@@ -60422,7 +60059,7 @@ async function runStartupMaintenance() {
60422
60059
  } = await import("@cleocode/core/internal");
60423
60060
  let projectRootForCleanup = "";
60424
60061
  try {
60425
- projectRootForCleanup = getProjectRoot35();
60062
+ projectRootForCleanup = getProjectRoot33();
60426
60063
  } catch {
60427
60064
  }
60428
60065
  if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
@@ -60442,7 +60079,7 @@ async function runStartupMaintenance() {
60442
60079
  const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
60443
60080
  if (!isInitInvocation) {
60444
60081
  try {
60445
- const _projectRootForMigration = getProjectRoot35();
60082
+ const _projectRootForMigration = getProjectRoot33();
60446
60083
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
60447
60084
  const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
60448
60085
  if (migrationResult.status === "failed") {