@cleocode/cleo 2026.5.57 → 2026.5.59

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
@@ -24010,16 +24010,16 @@ async function orchestrateRejectOp(params) {
24010
24010
  async function orchestrateClassify(request, context, projectRoot) {
24011
24011
  try {
24012
24012
  const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
24013
- const { readFileSync: readFileSync16, readdirSync: readdirSync4, existsSync: existsSync13 } = await import("node:fs");
24014
- const { join: join23 } = await import("node:path");
24013
+ const { readFileSync: readFileSync16, readdirSync: readdirSync4, existsSync: existsSync15 } = await import("node:fs");
24014
+ const { join: join25 } = await import("node:path");
24015
24015
  const workflowsDir = getCleoCantWorkflowsDir();
24016
24016
  const combined = `${request} ${context ?? ""}`.toLowerCase();
24017
24017
  const matches = [];
24018
- if (existsSync13(workflowsDir)) {
24018
+ if (existsSync15(workflowsDir)) {
24019
24019
  const files = readdirSync4(workflowsDir).filter((f) => f.endsWith(".cant"));
24020
24020
  for (const file of files) {
24021
24021
  try {
24022
- const src = readFileSync16(join23(workflowsDir, file), "utf-8");
24022
+ const src = readFileSync16(join25(workflowsDir, file), "utf-8");
24023
24023
  const teamMatch = /^team\s+(\S+):/m.exec(src);
24024
24024
  if (!teamMatch) continue;
24025
24025
  const teamName = teamMatch[1];
@@ -24034,12 +24034,12 @@ async function orchestrateClassify(request, context, projectRoot) {
24034
24034
  }
24035
24035
  }
24036
24036
  }
24037
- const localCantDir = join23(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
24038
- if (existsSync13(localCantDir)) {
24037
+ const localCantDir = join25(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
24038
+ if (existsSync15(localCantDir)) {
24039
24039
  const files = readdirSync4(localCantDir).filter((f) => f.endsWith(".cant"));
24040
24040
  for (const file of files) {
24041
24041
  try {
24042
- const src = readFileSync16(join23(localCantDir, file), "utf-8");
24042
+ const src = readFileSync16(join25(localCantDir, file), "utf-8");
24043
24043
  const teamMatch = /^team\s+(\S+):/m.exec(src);
24044
24044
  if (!teamMatch) continue;
24045
24045
  const teamName = teamMatch[1];
@@ -29981,6 +29981,87 @@ var init_adr = __esm({
29981
29981
  }
29982
29982
  });
29983
29983
 
29984
+ // packages/cleo/src/cli/commands/agent-outputs.ts
29985
+ var agent_outputs_exports = {};
29986
+ __export(agent_outputs_exports, {
29987
+ agentOutputsCommand: () => agentOutputsCommand
29988
+ });
29989
+ import { searchDocs } from "@cleocode/core/internal";
29990
+ var findCommand2, agentOutputsCommand;
29991
+ var init_agent_outputs = __esm({
29992
+ "packages/cleo/src/cli/commands/agent-outputs.ts"() {
29993
+ "use strict";
29994
+ init_src2();
29995
+ init_dist();
29996
+ init_renderers();
29997
+ findCommand2 = defineCommand({
29998
+ meta: {
29999
+ name: "find",
30000
+ description: "Search agent output documents by query (routed via DocsAccessor.searchDocs)"
30001
+ },
30002
+ args: {
30003
+ query: {
30004
+ type: "positional",
30005
+ description: "Free-text search query to match against agent output documents",
30006
+ required: true
30007
+ },
30008
+ limit: {
30009
+ type: "string",
30010
+ description: "Maximum number of results to return (default: 10)",
30011
+ default: "10"
30012
+ },
30013
+ json: {
30014
+ type: "boolean",
30015
+ description: "Emit raw JSON envelope instead of human-readable table",
30016
+ default: false
30017
+ }
30018
+ },
30019
+ async run({ args }) {
30020
+ try {
30021
+ const limit = parseInt(String(args.limit), 10);
30022
+ const query = String(args.query);
30023
+ const result = await searchDocs(query, { limit: Number.isNaN(limit) ? 10 : limit });
30024
+ if (args.json) {
30025
+ cliOutput(result, {
30026
+ command: "agent-outputs find",
30027
+ operation: "docs.agent-outputs.find"
30028
+ });
30029
+ return;
30030
+ }
30031
+ if (result.hits.length === 0) {
30032
+ console.log(`No agent output documents found matching "${query}".`);
30033
+ return;
30034
+ }
30035
+ console.log(`Found ${result.hits.length} result(s) for "${query}":
30036
+ `);
30037
+ for (const hit of result.hits) {
30038
+ const score = typeof hit.score === "number" ? ` (score: ${hit.score.toFixed(3)})` : "";
30039
+ console.log(` ${hit.name ?? hit.id}${score}`);
30040
+ }
30041
+ } catch (err) {
30042
+ const message = err instanceof Error ? err.message : String(err);
30043
+ cliError(`agent-outputs find failed: ${message}`, 1 /* GENERAL_ERROR */);
30044
+ }
30045
+ }
30046
+ });
30047
+ agentOutputsCommand = defineCommand({
30048
+ meta: {
30049
+ name: "agent-outputs",
30050
+ description: "Agent output document management \u2014 find/search via DocsAccessor (find subcommand)"
30051
+ },
30052
+ subCommands: {
30053
+ find: findCommand2
30054
+ },
30055
+ run({ rawArgs }) {
30056
+ const sub = rawArgs?.find((a) => !a.startsWith("-"));
30057
+ if (!sub) {
30058
+ showUsage(agentOutputsCommand);
30059
+ }
30060
+ }
30061
+ });
30062
+ }
30063
+ });
30064
+
29984
30065
  // packages/cleo/src/cli/commands/agent-profile-status.ts
29985
30066
  function computeProfileStatus(profile, validation) {
29986
30067
  if (profile === null) return "none";
@@ -30000,7 +30081,6 @@ __export(agent_exports, {
30000
30081
  agentCommand: () => agentCommand
30001
30082
  });
30002
30083
  import {
30003
- applyPerfPragmas,
30004
30084
  checkAgentHealth,
30005
30085
  detectCrashedAgents,
30006
30086
  detectStaleAgents,
@@ -30408,12 +30488,12 @@ var init_agent = __esm({
30408
30488
  transportConfig: {},
30409
30489
  isActive: true
30410
30490
  });
30411
- const { existsSync: existsSync13, mkdirSync: mkdirSync6, writeFileSync: writeFileSync5 } = await import("node:fs");
30412
- const { join: join23 } = await import("node:path");
30413
- const cantDir = join23(CLEO_DIR_NAME, AGENTS_SUBDIR);
30414
- const cantPath = join23(cantDir, `${agentId}.cant`);
30491
+ const { existsSync: existsSync15, mkdirSync: mkdirSync6, writeFileSync: writeFileSync5 } = await import("node:fs");
30492
+ const { join: join25 } = await import("node:path");
30493
+ const cantDir = join25(CLEO_DIR_NAME, AGENTS_SUBDIR);
30494
+ const cantPath = join25(cantDir, `${agentId}.cant`);
30415
30495
  let cantScaffolded = false;
30416
- if (!existsSync13(cantPath)) {
30496
+ if (!existsSync15(cantPath)) {
30417
30497
  mkdirSync6(cantDir, { recursive: true });
30418
30498
  const role = classification ?? "specialist";
30419
30499
  const cantContent = `---
@@ -30473,7 +30553,7 @@ agent ${agentId}:
30473
30553
  data: {
30474
30554
  agentId: credential.agentId,
30475
30555
  displayName: credential.displayName,
30476
- cantFile: cantScaffolded ? cantPath : existsSync13(cantPath) ? cantPath : null,
30556
+ cantFile: cantScaffolded ? cantPath : existsSync15(cantPath) ? cantPath : null,
30477
30557
  cantScaffolded
30478
30558
  }
30479
30559
  },
@@ -30592,8 +30672,8 @@ agent ${agentId}:
30592
30672
  try {
30593
30673
  const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
30594
30674
  const { createRuntime } = await import("@cleocode/runtime");
30595
- const { existsSync: existsSync13, readFileSync: readFileSync16 } = await import("node:fs");
30596
- const { join: join23 } = await import("node:path");
30675
+ const { existsSync: existsSync15, readFileSync: readFileSync16 } = await import("node:fs");
30676
+ const { join: join25 } = await import("node:path");
30597
30677
  await getDb3();
30598
30678
  const registry = new AgentRegistryAccessor(process.cwd());
30599
30679
  const credential = await registry.get(args.agentId);
@@ -30613,8 +30693,8 @@ agent ${agentId}:
30613
30693
  }
30614
30694
  let profile = null;
30615
30695
  let cantValidation = null;
30616
- const cantPath = args.cant ?? join23(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
30617
- if (existsSync13(cantPath)) {
30696
+ const cantPath = args.cant ?? join25(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
30697
+ if (existsSync15(cantPath)) {
30618
30698
  profile = readFileSync16(cantPath, "utf-8");
30619
30699
  try {
30620
30700
  const cantModule = await import("@cleocode/cant");
@@ -31138,8 +31218,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
31138
31218
  try {
31139
31219
  const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
31140
31220
  const { createRuntime } = await import("@cleocode/runtime");
31141
- const { existsSync: existsSync13 } = await import("node:fs");
31142
- const { join: join23 } = await import("node:path");
31221
+ const { existsSync: existsSync15 } = await import("node:fs");
31222
+ const { join: join25 } = await import("node:path");
31143
31223
  const { execFile: execFile2 } = await import("node:child_process");
31144
31224
  const { promisify: promisify2 } = await import("node:util");
31145
31225
  const execFileAsync = promisify2(execFile2);
@@ -31159,8 +31239,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
31159
31239
  }
31160
31240
  await registry.update(args.agentId, { isActive: true });
31161
31241
  await registry.markUsed(args.agentId);
31162
- const cantPath = join23(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
31163
- const hasProfile = existsSync13(cantPath);
31242
+ const cantPath = join25(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
31243
+ const hasProfile = existsSync15(cantPath);
31164
31244
  const runtime = await createRuntime(registry, {
31165
31245
  agentId: args.agentId,
31166
31246
  pollIntervalMs: 5e3,
@@ -32008,11 +32088,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32008
32088
  async run({ args }) {
32009
32089
  let tempDir = null;
32010
32090
  try {
32011
- const { existsSync: existsSync13, mkdirSync: mkdirSync6, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
32012
- const { join: join23, basename, resolve: resolve5, extname } = await import("node:path");
32091
+ const { existsSync: existsSync15, mkdirSync: mkdirSync6, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
32092
+ const { join: join25, basename, resolve: resolve7, extname } = await import("node:path");
32013
32093
  const { tmpdir: tmpdir2 } = await import("node:os");
32014
- const resolvedPath = resolve5(args.path);
32015
- if (!existsSync13(resolvedPath)) {
32094
+ const resolvedPath = resolve7(args.path);
32095
+ if (!existsSync15(resolvedPath)) {
32016
32096
  cliOutput(
32017
32097
  {
32018
32098
  success: false,
@@ -32033,7 +32113,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32033
32113
  cantPath = resolvedPath;
32034
32114
  } else if (stat2.isFile() && ext === ".cantz") {
32035
32115
  const { execFileSync: execFileSync5 } = await import("node:child_process");
32036
- tempDir = join23(tmpdir2(), `cleo-agent-install-${Date.now()}`);
32116
+ tempDir = join25(tmpdir2(), `cleo-agent-install-${Date.now()}`);
32037
32117
  mkdirSync6(tempDir, { recursive: true });
32038
32118
  try {
32039
32119
  execFileSync5("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
@@ -32055,7 +32135,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32055
32135
  return;
32056
32136
  }
32057
32137
  const topLevel = readdirSync4(tempDir).filter(
32058
- (entry) => statSync(join23(tempDir, entry)).isDirectory()
32138
+ (entry) => statSync(join25(tempDir, entry)).isDirectory()
32059
32139
  );
32060
32140
  if (topLevel.length !== 1) {
32061
32141
  cliOutput(
@@ -32072,8 +32152,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32072
32152
  return;
32073
32153
  }
32074
32154
  const agentName = topLevel[0];
32075
- const personaPath = join23(tempDir, agentName, "persona.cant");
32076
- if (!existsSync13(personaPath)) {
32155
+ const personaPath = join25(tempDir, agentName, "persona.cant");
32156
+ if (!existsSync15(personaPath)) {
32077
32157
  cliOutput(
32078
32158
  {
32079
32159
  success: false,
@@ -32087,12 +32167,12 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32087
32167
  process.exitCode = 6;
32088
32168
  return;
32089
32169
  }
32090
- cantPath = join23(tempDir, `${agentName}.cant`);
32170
+ cantPath = join25(tempDir, `${agentName}.cant`);
32091
32171
  copyFileSync(personaPath, cantPath);
32092
32172
  } else if (stat2.isDirectory()) {
32093
32173
  const agentName = basename(resolvedPath);
32094
- const personaPath = join23(resolvedPath, "persona.cant");
32095
- if (!existsSync13(personaPath)) {
32174
+ const personaPath = join25(resolvedPath, "persona.cant");
32175
+ if (!existsSync15(personaPath)) {
32096
32176
  cliOutput(
32097
32177
  {
32098
32178
  success: false,
@@ -32106,9 +32186,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32106
32186
  process.exitCode = 6;
32107
32187
  return;
32108
32188
  }
32109
- tempDir = join23(tmpdir2(), `cleo-agent-install-${Date.now()}`);
32189
+ tempDir = join25(tmpdir2(), `cleo-agent-install-${Date.now()}`);
32110
32190
  mkdirSync6(tempDir, { recursive: true });
32111
- cantPath = join23(tempDir, `${agentName}.cant`);
32191
+ cantPath = join25(tempDir, `${agentName}.cant`);
32112
32192
  copyFileSync(personaPath, cantPath);
32113
32193
  } else {
32114
32194
  cliOutput(
@@ -32124,17 +32204,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32124
32204
  process.exitCode = 6;
32125
32205
  return;
32126
32206
  }
32127
- const {
32128
- ensureGlobalSignaldockDb: ensureGlobalSignaldockDb2,
32129
- getGlobalSignaldockDbPath: getGlobalSignaldockDbPath2,
32130
- installAgentFromCant: installAgentFromCant2,
32131
- attachAgentToProject
32132
- } = await import("@cleocode/core/internal");
32133
- const { DatabaseSync: DatabaseSync2 } = await import("node:sqlite");
32134
- ensureGlobalSignaldockDb2();
32135
- const dbPath = getGlobalSignaldockDbPath2();
32136
- const db = new DatabaseSync2(dbPath);
32137
- applyPerfPragmas(db);
32207
+ const { installAgentFromCant: installAgentFromCant2, attachAgentToProject } = await import("@cleocode/core/internal");
32208
+ const { openCleoDb: openCleoDb2 } = await import("@cleocode/core/store/open-cleo-db");
32209
+ const { db: _sdDb } = await openCleoDb2("signaldock");
32210
+ const db = _sdDb;
32138
32211
  const isGlobal = args.global === true;
32139
32212
  const targetTier = isGlobal ? "global" : "project";
32140
32213
  const projectRoot = process.cwd();
@@ -32234,11 +32307,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32234
32307
  },
32235
32308
  async run({ args }) {
32236
32309
  try {
32237
- const { existsSync: existsSync13, statSync } = await import("node:fs");
32238
- const { resolve: resolve5, basename, dirname: dirname9 } = await import("node:path");
32310
+ const { existsSync: existsSync15, statSync } = await import("node:fs");
32311
+ const { resolve: resolve7, basename, dirname: dirname9 } = await import("node:path");
32239
32312
  const { execFileSync: execFileSync5 } = await import("node:child_process");
32240
- const resolvedDir = resolve5(args.dir);
32241
- if (!existsSync13(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
32313
+ const resolvedDir = resolve7(args.dir);
32314
+ if (!existsSync15(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
32242
32315
  cliOutput(
32243
32316
  {
32244
32317
  success: false,
@@ -32252,9 +32325,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32252
32325
  process.exitCode = 4;
32253
32326
  return;
32254
32327
  }
32255
- const { join: join23 } = await import("node:path");
32256
- const personaPath = join23(resolvedDir, "persona.cant");
32257
- if (!existsSync13(personaPath)) {
32328
+ const { join: join25 } = await import("node:path");
32329
+ const personaPath = join25(resolvedDir, "persona.cant");
32330
+ if (!existsSync15(personaPath)) {
32258
32331
  cliOutput(
32259
32332
  {
32260
32333
  success: false,
@@ -32270,7 +32343,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32270
32343
  }
32271
32344
  const agentName = basename(resolvedDir);
32272
32345
  const archiveName = `${agentName}.cantz`;
32273
- const archivePath = resolve5(archiveName);
32346
+ const archivePath = resolve7(archiveName);
32274
32347
  const parentDir = dirname9(resolvedDir);
32275
32348
  try {
32276
32349
  execFileSync5("zip", ["-r", archivePath, agentName], {
@@ -32301,7 +32374,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32301
32374
  if (entry.isFile()) {
32302
32375
  fileCount++;
32303
32376
  } else if (entry.isDirectory()) {
32304
- countFiles(join23(dirPath, entry.name));
32377
+ countFiles(join25(dirPath, entry.name));
32305
32378
  }
32306
32379
  }
32307
32380
  };
@@ -32370,8 +32443,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32370
32443
  },
32371
32444
  async run({ args }) {
32372
32445
  try {
32373
- const { existsSync: existsSync13, mkdirSync: mkdirSync6, writeFileSync: writeFileSync5 } = await import("node:fs");
32374
- const { join: join23 } = await import("node:path");
32446
+ const { existsSync: existsSync15, mkdirSync: mkdirSync6, writeFileSync: writeFileSync5 } = await import("node:fs");
32447
+ const { join: join25 } = await import("node:path");
32375
32448
  const { homedir: homedir7 } = await import("node:os");
32376
32449
  const name = args.name;
32377
32450
  const role = args.role;
@@ -32431,13 +32504,13 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32431
32504
  let targetRoot;
32432
32505
  if (isGlobal) {
32433
32506
  const home = homedir7();
32434
- const xdgData = process.env["XDG_DATA_HOME"] ?? join23(home, ".local", "share");
32435
- targetRoot = join23(xdgData, "cleo", "cant", "agents");
32507
+ const xdgData = process.env["XDG_DATA_HOME"] ?? join25(home, ".local", "share");
32508
+ targetRoot = join25(xdgData, "cleo", "cant", "agents");
32436
32509
  } else {
32437
- targetRoot = join23(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
32510
+ targetRoot = join25(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
32438
32511
  }
32439
- const agentDir = join23(targetRoot, name);
32440
- if (existsSync13(agentDir)) {
32512
+ const agentDir = join25(targetRoot, name);
32513
+ if (existsSync15(agentDir)) {
32441
32514
  cliOutput(
32442
32515
  {
32443
32516
  success: false,
@@ -32461,29 +32534,29 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32461
32534
  domain,
32462
32535
  parent
32463
32536
  });
32464
- writeFileSync5(join23(agentDir, "persona.cant"), personaContent, "utf-8");
32537
+ writeFileSync5(join25(agentDir, "persona.cant"), personaContent, "utf-8");
32465
32538
  const manifest = generateManifest({ name, role, tier, domain });
32466
32539
  writeFileSync5(
32467
- join23(agentDir, "manifest.json"),
32540
+ join25(agentDir, "manifest.json"),
32468
32541
  `${JSON.stringify(manifest, null, 2)}
32469
32542
  `,
32470
32543
  "utf-8"
32471
32544
  );
32472
32545
  const createdFiles = [
32473
- join23(agentDir, "persona.cant"),
32474
- join23(agentDir, "manifest.json")
32546
+ join25(agentDir, "persona.cant"),
32547
+ join25(agentDir, "manifest.json")
32475
32548
  ];
32476
32549
  if (team) {
32477
32550
  const teamConfigContent = generateTeamConfig(name, role, team);
32478
- writeFileSync5(join23(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
32479
- createdFiles.push(join23(agentDir, "team-config.cant"));
32551
+ writeFileSync5(join25(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
32552
+ createdFiles.push(join25(agentDir, "team-config.cant"));
32480
32553
  }
32481
32554
  if (seedBrain) {
32482
- const expertiseDir = join23(agentDir, "expertise");
32555
+ const expertiseDir = join25(agentDir, "expertise");
32483
32556
  mkdirSync6(expertiseDir, { recursive: true });
32484
32557
  const seedContent = generateMentalModelSeed(name, role, domain);
32485
- writeFileSync5(join23(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
32486
- createdFiles.push(join23(expertiseDir, "mental-model-seed.md"));
32558
+ writeFileSync5(join25(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
32559
+ createdFiles.push(join25(expertiseDir, "mental-model-seed.md"));
32487
32560
  try {
32488
32561
  const { execFile: execFile2 } = await import("node:child_process");
32489
32562
  const { promisify: promisify2 } = await import("node:util");
@@ -32581,10 +32654,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32581
32654
  },
32582
32655
  async run({ args }) {
32583
32656
  try {
32584
- const { existsSync: existsSync13, readFileSync: readFileSync16, mkdirSync: mkdirSync6 } = await import("node:fs");
32585
- const { resolve: resolve5, join: join23 } = await import("node:path");
32586
- const specPath = resolve5(args.spec);
32587
- if (!existsSync13(specPath)) {
32657
+ const { existsSync: existsSync15, readFileSync: readFileSync16, mkdirSync: mkdirSync6 } = await import("node:fs");
32658
+ const { resolve: resolve7, join: join25 } = await import("node:path");
32659
+ const specPath = resolve7(args.spec);
32660
+ if (!existsSync15(specPath)) {
32588
32661
  if (args.json) {
32589
32662
  const errEnv = {
32590
32663
  success: false,
@@ -32600,7 +32673,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32600
32673
  }
32601
32674
  const specContent = readFileSync16(specPath, "utf-8");
32602
32675
  const projectRoot = process.cwd();
32603
- const outputDir = args["output-dir"] ? resolve5(args["output-dir"]) : join23(projectRoot, ".cleo", "cant", "agents");
32676
+ const outputDir = args["output-dir"] ? resolve7(args["output-dir"]) : join25(projectRoot, ".cleo", "cant", "agents");
32604
32677
  mkdirSync6(outputDir, { recursive: true });
32605
32678
  if (args["dry-run"]) {
32606
32679
  const preview = {
@@ -32679,19 +32752,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32679
32752
  },
32680
32753
  async run({ args }) {
32681
32754
  try {
32682
- const {
32683
- buildDoctorReport,
32684
- reconcileDoctor,
32685
- ensureGlobalSignaldockDb: ensureGlobalSignaldockDb2,
32686
- getGlobalSignaldockDbPath: getGlobalSignaldockDbPath2
32687
- } = await import("@cleocode/core/internal");
32688
- const { createRequire: createRequire2 } = await import("node:module");
32689
- const { DatabaseSync: DatabaseSync2 } = createRequire2(import.meta.url)(
32690
- "node:sqlite"
32691
- );
32692
- await ensureGlobalSignaldockDb2();
32693
- const db = new DatabaseSync2(getGlobalSignaldockDbPath2());
32694
- applyPerfPragmas(db);
32755
+ const { buildDoctorReport, reconcileDoctor } = await import("@cleocode/core/internal");
32756
+ const { openCleoDb: openCleoDb2 } = await import("@cleocode/core/store/open-cleo-db");
32757
+ const { db: _sdDb2 } = await openCleoDb2("signaldock");
32758
+ const db = _sdDb2;
32695
32759
  try {
32696
32760
  const report = await buildDoctorReport(db, {});
32697
32761
  const d002 = report.findings.filter((f) => f.code === "D-002");
@@ -32754,21 +32818,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
32754
32818
  },
32755
32819
  async run({ args }) {
32756
32820
  try {
32757
- const {
32758
- buildDoctorReport,
32759
- reconcileDoctor,
32760
- ensureGlobalSignaldockDb: ensureGlobalSignaldockDb2,
32761
- getGlobalSignaldockDbPath: getGlobalSignaldockDbPath2
32762
- } = await import("@cleocode/core/internal");
32763
- const { createRequire: createRequire2 } = await import("node:module");
32764
- const nodeSqlite = createRequire2(import.meta.url)(
32765
- "node:sqlite"
32766
- );
32767
- const { DatabaseSync: DatabaseSync2 } = nodeSqlite;
32768
- await ensureGlobalSignaldockDb2();
32769
- const dbPath = getGlobalSignaldockDbPath2();
32770
- const db = new DatabaseSync2(dbPath);
32771
- applyPerfPragmas(db);
32821
+ const { buildDoctorReport, reconcileDoctor } = await import("@cleocode/core/internal");
32822
+ const { openCleoDb: openCleoDb2 } = await import("@cleocode/core/store/open-cleo-db");
32823
+ const { db: _sdDb3 } = await openCleoDb2("signaldock");
32824
+ const db = _sdDb3;
32772
32825
  try {
32773
32826
  const report = await buildDoctorReport(db, { projectRoot: process.cwd() });
32774
32827
  const repairFlag = args.repair === true;
@@ -33038,8 +33091,24 @@ var audit_exports = {};
33038
33091
  __export(audit_exports, {
33039
33092
  auditCommand: () => auditCommand
33040
33093
  });
33094
+ import { spawnSync } from "node:child_process";
33095
+ import { existsSync as existsSync6 } from "node:fs";
33096
+ import { join as join7, resolve as resolve3 } from "node:path";
33041
33097
  import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
33042
- var reconstructCommand, auditCommand;
33098
+ function resolveVerifierScript(taskId, projectRoot) {
33099
+ const id = taskId.toLowerCase();
33100
+ const candidates = [
33101
+ join7(projectRoot, "scripts", `verify-${taskId}-fu.mjs`),
33102
+ join7(projectRoot, "scripts", `verify-${taskId}.mjs`),
33103
+ join7(projectRoot, "scripts", `verify-${id}-fu.mjs`),
33104
+ join7(projectRoot, "scripts", `verify-${id}.mjs`)
33105
+ ];
33106
+ for (const candidate of candidates) {
33107
+ if (existsSync6(candidate)) return candidate;
33108
+ }
33109
+ return null;
33110
+ }
33111
+ var reconstructCommand, verifierCommand, auditCommand;
33043
33112
  var init_audit2 = __esm({
33044
33113
  "packages/cleo/src/cli/commands/audit.ts"() {
33045
33114
  "use strict";
@@ -33095,13 +33164,87 @@ var init_audit2 = __esm({
33095
33164
  });
33096
33165
  }
33097
33166
  });
33167
+ verifierCommand = defineCommand({
33168
+ meta: {
33169
+ name: "verifier",
33170
+ 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."
33171
+ },
33172
+ args: {
33173
+ taskId: {
33174
+ type: "positional",
33175
+ description: "Task ID whose acceptance verifier script to run independently (e.g. T9188)",
33176
+ required: true
33177
+ },
33178
+ script: {
33179
+ type: "string",
33180
+ description: "Explicit path to the verifier script (overrides auto-resolution)"
33181
+ }
33182
+ },
33183
+ async run({ args }) {
33184
+ const taskId = String(args.taskId);
33185
+ let projectRoot;
33186
+ try {
33187
+ projectRoot = getProjectRoot19(process.cwd()) ?? resolve3(process.cwd());
33188
+ } catch {
33189
+ projectRoot = resolve3(process.cwd());
33190
+ }
33191
+ let verifierPath;
33192
+ if (args.script) {
33193
+ const explicit = resolve3(projectRoot, String(args.script));
33194
+ verifierPath = existsSync6(explicit) ? explicit : null;
33195
+ if (!verifierPath) {
33196
+ cliError(`Verifier script not found: ${explicit}`, 1, { name: "E_NOT_FOUND" });
33197
+ process.exitCode = 1;
33198
+ return;
33199
+ }
33200
+ } else {
33201
+ verifierPath = resolveVerifierScript(taskId, projectRoot);
33202
+ }
33203
+ if (!verifierPath) {
33204
+ cliError(
33205
+ `No verifier script found for ${taskId}.
33206
+ Looked for: scripts/verify-${taskId}-fu.mjs, scripts/verify-${taskId}.mjs
33207
+ Create the verifier script per ADR-070 before running the auditor.`,
33208
+ 1,
33209
+ { name: "E_NOT_FOUND" }
33210
+ );
33211
+ process.exitCode = 1;
33212
+ return;
33213
+ }
33214
+ process.stdout.write(`[AUDITOR] Independent verifier run for ${taskId}
33215
+ `);
33216
+ process.stdout.write(`[AUDITOR] Script: ${verifierPath}
33217
+ `);
33218
+ process.stdout.write(`[AUDITOR] Note: Does NOT trust any prior Implementer claims.
33219
+
33220
+ `);
33221
+ const result = spawnSync("node", [verifierPath], { encoding: "utf8", stdio: "inherit" });
33222
+ const exitCode = result.status ?? 1;
33223
+ if (exitCode === 0) {
33224
+ process.stdout.write(
33225
+ `
33226
+ [AUDITOR] Audit pass. Verifier exit-code 0. Task ${taskId} acceptance verified.
33227
+ `
33228
+ );
33229
+ } else {
33230
+ process.stderr.write(
33231
+ `
33232
+ [AUDITOR] Audit fail. Verifier exit-code ${exitCode}. Task ${taskId} NOT verified.
33233
+ E_ACCEPTANCE_VERIFIER_FAILED. Implementation must be re-worked. (ADR-070)
33234
+ `
33235
+ );
33236
+ process.exitCode = exitCode;
33237
+ }
33238
+ }
33239
+ });
33098
33240
  auditCommand = defineCommand({
33099
33241
  meta: {
33100
33242
  name: "audit",
33101
- description: "Git-backed audit tooling (lineage reconstruction, integrity checks)"
33243
+ 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)."
33102
33244
  },
33103
33245
  subCommands: {
33104
- reconstruct: reconstructCommand
33246
+ reconstruct: reconstructCommand,
33247
+ verifier: verifierCommand
33105
33248
  },
33106
33249
  async run({ args: _args }) {
33107
33250
  await showUsage(auditCommand);
@@ -33528,12 +33671,12 @@ async function promptPassphrase() {
33528
33671
  "Cannot prompt for passphrase: stdin is not a TTY. Set the CLEO_BACKUP_PASSPHRASE environment variable for non-interactive use."
33529
33672
  );
33530
33673
  }
33531
- return new Promise((resolve5) => {
33674
+ return new Promise((resolve7) => {
33532
33675
  process.stdout.write("Passphrase: ");
33533
33676
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
33534
33677
  rl.question("", (answer) => {
33535
33678
  rl.close();
33536
- resolve5(answer.trim());
33679
+ resolve7(answer.trim());
33537
33680
  });
33538
33681
  });
33539
33682
  }
@@ -34406,113 +34549,13 @@ var init_briefing = __esm({
34406
34549
  }
34407
34550
  });
34408
34551
 
34409
- // packages/cleo/src/cli/commands/bug.ts
34410
- var bug_exports = {};
34411
- __export(bug_exports, {
34412
- bugCommand: () => bugCommand
34413
- });
34414
- import { appendSignedSeverityAttestation as appendSignedSeverityAttestation2 } from "@cleocode/core";
34415
- var SEVERITY_MAP, VALID_SEVERITIES, bugCommand;
34416
- var init_bug = __esm({
34417
- "packages/cleo/src/cli/commands/bug.ts"() {
34418
- "use strict";
34419
- init_dist();
34420
- init_cli();
34421
- init_renderers();
34422
- SEVERITY_MAP = {
34423
- P0: { priority: "critical", labels: ["bug", "p0"] },
34424
- P1: { priority: "high", labels: ["bug", "p1"] },
34425
- P2: { priority: "medium", labels: ["bug", "p2"] },
34426
- P3: { priority: "low", labels: ["bug", "p3"] }
34427
- };
34428
- VALID_SEVERITIES = Object.keys(SEVERITY_MAP);
34429
- bugCommand = defineCommand({
34430
- meta: {
34431
- name: "bug",
34432
- description: "Create a bug report task with severity mapping (requires active session)"
34433
- },
34434
- args: {
34435
- title: {
34436
- type: "positional",
34437
- description: "Bug report title",
34438
- required: true
34439
- },
34440
- severity: {
34441
- type: "string",
34442
- description: "Severity level (P0, P1, P2, P3)",
34443
- alias: "s",
34444
- default: "P2"
34445
- },
34446
- epic: {
34447
- type: "string",
34448
- description: "Epic ID to link as parent (optional)",
34449
- alias: "e"
34450
- },
34451
- description: {
34452
- type: "string",
34453
- description: "Bug description",
34454
- alias: "d"
34455
- },
34456
- "dry-run": {
34457
- type: "boolean",
34458
- description: "Show what would be created without making changes",
34459
- default: false
34460
- }
34461
- },
34462
- async run({ args }) {
34463
- const severity = args.severity ?? "P2";
34464
- if (!VALID_SEVERITIES.includes(severity)) {
34465
- cliError(
34466
- `Invalid severity "${severity}". Must be one of: ${VALID_SEVERITIES.join(", ")}`,
34467
- 1,
34468
- { name: "E_VALIDATION", fix: `Use one of: ${VALID_SEVERITIES.join(", ")}` }
34469
- );
34470
- process.exit(1);
34471
- }
34472
- const mapping = SEVERITY_MAP[severity];
34473
- const params = {
34474
- title: args.title,
34475
- type: "task",
34476
- priority: mapping.priority,
34477
- labels: mapping.labels,
34478
- origin: "bug-report",
34479
- description: args.description ?? args.title
34480
- };
34481
- if (args.epic !== void 0) {
34482
- params["parent"] = args.epic;
34483
- }
34484
- if (args["dry-run"]) {
34485
- params["dryRun"] = true;
34486
- }
34487
- if (!args["dry-run"]) {
34488
- try {
34489
- await appendSignedSeverityAttestation2({
34490
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
34491
- title: args.title,
34492
- severity,
34493
- ...args.epic !== void 0 ? { epic: args.epic } : {}
34494
- });
34495
- } catch (err) {
34496
- const code = err.code;
34497
- if (code === "E_OWNER_ONLY") {
34498
- cliError(err.message, 72, { name: "E_OWNER_ONLY" });
34499
- process.exit(72);
34500
- }
34501
- }
34502
- }
34503
- await dispatchFromCli("mutate", "tasks", "add", params, { command: "bug" });
34504
- }
34505
- });
34506
- }
34507
- });
34508
-
34509
34552
  // packages/cleo/src/cli/commands/caamp.ts
34510
34553
  var caamp_exports = {};
34511
34554
  __export(caamp_exports, {
34512
34555
  caampCommand: () => caampCommand
34513
34556
  });
34514
34557
  import { homedir as homedir2 } from "node:os";
34515
- import { join as join7 } from "node:path";
34558
+ import { join as join8 } from "node:path";
34516
34559
  var dedupeCommand, caampCommand;
34517
34560
  var init_caamp = __esm({
34518
34561
  "packages/cleo/src/cli/commands/caamp.ts"() {
@@ -34549,18 +34592,18 @@ var init_caamp = __esm({
34549
34592
  } else {
34550
34593
  const home = homedir2();
34551
34594
  filePaths = [
34552
- join7(home, ".agents", "AGENTS.md"),
34595
+ join8(home, ".agents", "AGENTS.md"),
34553
34596
  // project-level AGENTS.md in cwd
34554
- join7(process.cwd(), "AGENTS.md")
34597
+ join8(process.cwd(), "AGENTS.md")
34555
34598
  ];
34556
34599
  }
34557
34600
  if (args["dry-run"]) {
34558
34601
  const { parseCaampBlocks } = await import("@cleocode/caamp");
34559
- const { existsSync: existsSync13 } = await import("node:fs");
34602
+ const { existsSync: existsSync15 } = await import("node:fs");
34560
34603
  const { readFile: readFile6 } = await import("node:fs/promises");
34561
34604
  const dryResults = [];
34562
34605
  for (const filePath of filePaths) {
34563
- if (!existsSync13(filePath)) {
34606
+ if (!existsSync15(filePath)) {
34564
34607
  dryResults.push({ filePath, exists: false, blockCount: 0, wouldRemove: 0 });
34565
34608
  continue;
34566
34609
  }
@@ -34694,13 +34737,13 @@ var cant_exports = {};
34694
34737
  __export(cant_exports, {
34695
34738
  cantCommand: () => cantCommand
34696
34739
  });
34697
- import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync2 } from "node:fs";
34698
- import { dirname as dirname4, isAbsolute, join as join8, resolve as resolve3 } from "node:path";
34740
+ import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync2 } from "node:fs";
34741
+ import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve4 } from "node:path";
34699
34742
  function resolveFilePath(file) {
34700
- return isAbsolute(file) ? file : resolve3(process.cwd(), file);
34743
+ return isAbsolute(file) ? file : resolve4(process.cwd(), file);
34701
34744
  }
34702
34745
  function ensureExists(filePath, operation) {
34703
- if (existsSync6(filePath)) return true;
34746
+ if (existsSync7(filePath)) return true;
34704
34747
  cliError(`File not found: ${filePath}`, "E_FILE_READ");
34705
34748
  process.exitCode = 3;
34706
34749
  if (process.env["CLEO_DEBUG"]) humanWarn(`(operation: ${operation})`);
@@ -34860,7 +34903,7 @@ var init_cant = __esm({
34860
34903
  const projectRoot = process.cwd();
34861
34904
  let written = 0;
34862
34905
  for (const outputFile of result.outputFiles) {
34863
- const outputPath = isAbsolute(outputFile.path) ? outputFile.path : join8(projectRoot, outputFile.path);
34906
+ const outputPath = isAbsolute(outputFile.path) ? outputFile.path : join9(projectRoot, outputFile.path);
34864
34907
  mkdirSync2(dirname4(outputPath), { recursive: true });
34865
34908
  writeFileSync2(outputPath, outputFile.content, "utf-8");
34866
34909
  written++;
@@ -35534,9 +35577,9 @@ var init_code = __esm({
35534
35577
  async run({ args }) {
35535
35578
  await requireTreeSitter();
35536
35579
  const { smartOutline } = await import("@cleocode/core/internal");
35537
- const { join: join23 } = await import("node:path");
35580
+ const { join: join25 } = await import("node:path");
35538
35581
  const root = process.cwd();
35539
- const absPath = args.file.startsWith("/") ? args.file : join23(root, args.file);
35582
+ const absPath = args.file.startsWith("/") ? args.file : join25(root, args.file);
35540
35583
  const result = smartOutline(absPath, root);
35541
35584
  if (result.errors.length > 0 && result.symbols.length === 0) {
35542
35585
  cliError(result.errors.join(", "), 1, { name: "E_OUTLINE_FAILED" });
@@ -35627,9 +35670,9 @@ var init_code = __esm({
35627
35670
  async run({ args }) {
35628
35671
  await requireTreeSitter();
35629
35672
  const { smartUnfold } = await import("@cleocode/core/internal");
35630
- const { join: join23 } = await import("node:path");
35673
+ const { join: join25 } = await import("node:path");
35631
35674
  const root = process.cwd();
35632
- const absPath = args.file.startsWith("/") ? args.file : join23(root, args.file);
35675
+ const absPath = args.file.startsWith("/") ? args.file : join25(root, args.file);
35633
35676
  const result = smartUnfold(absPath, args.symbol, root);
35634
35677
  if (!result.found) {
35635
35678
  const errs = result.errors.length > 0 ? `: ${result.errors.join(", ")}` : "";
@@ -36771,9 +36814,9 @@ var daemon_exports = {};
36771
36814
  __export(daemon_exports, {
36772
36815
  daemonCommand: () => daemonCommand
36773
36816
  });
36774
- import { existsSync as existsSync7 } from "node:fs";
36817
+ import { existsSync as existsSync8 } from "node:fs";
36775
36818
  import { homedir as homedir3 } from "node:os";
36776
- import { join as join9 } from "node:path";
36819
+ import { join as join10 } from "node:path";
36777
36820
  import { fileURLToPath as fileURLToPath3 } from "node:url";
36778
36821
  import { getGCDaemonStatus, spawnGCDaemon, stopGCDaemon } from "@cleocode/core/gc/daemon.js";
36779
36822
  import {
@@ -36838,9 +36881,9 @@ async function showDaemonStatus(cleoDir, projectRoot) {
36838
36881
  }
36839
36882
  function resolveDaemonInstallerScript() {
36840
36883
  const filePath = fileURLToPath3(import.meta.url);
36841
- const candidate1 = join9(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
36842
- if (existsSync7(candidate1)) return candidate1;
36843
- const candidate2 = join9(
36884
+ const candidate1 = join10(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
36885
+ if (existsSync8(candidate1)) return candidate1;
36886
+ const candidate2 = join10(
36844
36887
  filePath,
36845
36888
  "..",
36846
36889
  "..",
@@ -36875,7 +36918,7 @@ var init_daemon = __esm({
36875
36918
  }
36876
36919
  },
36877
36920
  async run({ args }) {
36878
- const cleoDir = args["cleo-dir"] ?? join9(homedir3(), ".cleo");
36921
+ const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
36879
36922
  const foreground = args.foreground ?? false;
36880
36923
  if (foreground) {
36881
36924
  const projectRoot = process.cwd();
@@ -36912,13 +36955,13 @@ var init_daemon = __esm({
36912
36955
  {
36913
36956
  pid,
36914
36957
  cleoDir,
36915
- logs: join9(cleoDir, "logs", "gc.log"),
36958
+ logs: join10(cleoDir, "logs", "gc.log"),
36916
36959
  message: `GC daemon started (PID ${pid})`
36917
36960
  },
36918
36961
  {
36919
36962
  command: "daemon",
36920
36963
  operation: "daemon.start",
36921
- message: `GC daemon started (PID ${pid}) \u2014 Logs: ${join9(cleoDir, "logs", "gc.log")}`
36964
+ message: `GC daemon started (PID ${pid}) \u2014 Logs: ${join10(cleoDir, "logs", "gc.log")}`
36922
36965
  }
36923
36966
  );
36924
36967
  } catch (err) {
@@ -36948,7 +36991,7 @@ var init_daemon = __esm({
36948
36991
  }
36949
36992
  },
36950
36993
  async run({ args }) {
36951
- const cleoDir = args["cleo-dir"] ?? join9(homedir3(), ".cleo");
36994
+ const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
36952
36995
  try {
36953
36996
  const stopResult = await stopGCDaemon(cleoDir);
36954
36997
  cliOutput(stopResult, {
@@ -36986,7 +37029,7 @@ var init_daemon = __esm({
36986
37029
  }
36987
37030
  },
36988
37031
  async run({ args }) {
36989
- const cleoDir = args["cleo-dir"] ?? join9(homedir3(), ".cleo");
37032
+ const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
36990
37033
  await showDaemonStatus(cleoDir, process.cwd());
36991
37034
  }
36992
37035
  });
@@ -37084,7 +37127,7 @@ var init_daemon = __esm({
37084
37127
  },
37085
37128
  async run({ args, cmd, rawArgs }) {
37086
37129
  if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
37087
- const cleoDir = args["cleo-dir"] ?? join9(homedir3(), ".cleo");
37130
+ const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
37088
37131
  await showDaemonStatus(cleoDir, process.cwd());
37089
37132
  }
37090
37133
  });
@@ -37547,12 +37590,12 @@ var detect_drift_exports = {};
37547
37590
  __export(detect_drift_exports, {
37548
37591
  detectDriftCommand: () => detectDriftCommand
37549
37592
  });
37550
- import { existsSync as existsSync8, readdirSync, readFileSync as readFileSync9 } from "node:fs";
37551
- import { dirname as dirname5, join as join10 } from "node:path";
37593
+ import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync9 } from "node:fs";
37594
+ import { dirname as dirname5, join as join11 } from "node:path";
37552
37595
  function findProjectRoot() {
37553
37596
  let currentDir = process.cwd();
37554
37597
  while (currentDir !== "/") {
37555
- if (existsSync8(join10(currentDir, "package.json"))) {
37598
+ if (existsSync9(join11(currentDir, "package.json"))) {
37556
37599
  return currentDir;
37557
37600
  }
37558
37601
  const parent = dirname5(currentDir);
@@ -37576,8 +37619,8 @@ var init_detect_drift = __esm({
37576
37619
  },
37577
37620
  async run() {
37578
37621
  const projectRoot = findProjectRoot();
37579
- const isCleoRepo = existsSync8(join10(projectRoot, "packages", "cleo", "src"));
37580
- const cleoSrcRoot = isCleoRepo ? join10(projectRoot, "packages", "cleo", "src") : join10(projectRoot, "src");
37622
+ const isCleoRepo = existsSync9(join11(projectRoot, "packages", "cleo", "src"));
37623
+ const cleoSrcRoot = isCleoRepo ? join11(projectRoot, "packages", "cleo", "src") : join11(projectRoot, "src");
37581
37624
  const safeRead = (filePath) => {
37582
37625
  try {
37583
37626
  return readFileSync9(filePath, "utf-8");
@@ -37591,8 +37634,8 @@ var init_detect_drift = __esm({
37591
37634
  checks: [],
37592
37635
  recommendations: []
37593
37636
  };
37594
- const injPath = join10(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
37595
- if (existsSync8(injPath)) {
37637
+ const injPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
37638
+ if (existsSync9(injPath)) {
37596
37639
  const content = safeRead(injPath);
37597
37640
  userResult.checks.push({
37598
37641
  name: "Agent injection",
@@ -37643,10 +37686,10 @@ var init_detect_drift = __esm({
37643
37686
  }
37644
37687
  };
37645
37688
  try {
37646
- const specPath = join10(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
37647
- const registryPath = join10(cleoSrcRoot, "dispatch", "registry.ts");
37648
- const dispatchDomainsDir = join10(cleoSrcRoot, "dispatch", "domains");
37649
- if (!existsSync8(specPath)) {
37689
+ const specPath = join11(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
37690
+ const registryPath = join11(cleoSrcRoot, "dispatch", "registry.ts");
37691
+ const dispatchDomainsDir = join11(cleoSrcRoot, "dispatch", "domains");
37692
+ if (!existsSync9(specPath)) {
37650
37693
  addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
37651
37694
  {
37652
37695
  severity: "error",
@@ -37656,7 +37699,7 @@ var init_detect_drift = __esm({
37656
37699
  recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
37657
37700
  }
37658
37701
  ]);
37659
- } else if (!existsSync8(registryPath) || !existsSync8(dispatchDomainsDir)) {
37702
+ } else if (!existsSync9(registryPath) || !existsSync9(dispatchDomainsDir)) {
37660
37703
  addCheck("Gateway-to-spec sync", "fail", "Dispatch registry or domains missing", [
37661
37704
  {
37662
37705
  severity: "error",
@@ -37714,9 +37757,9 @@ var init_detect_drift = __esm({
37714
37757
  ]);
37715
37758
  }
37716
37759
  try {
37717
- const cliDir = join10(cleoSrcRoot, "cli", "commands");
37718
- const coreDir = isCleoRepo ? join10(projectRoot, "packages", "core", "src") : join10(projectRoot, "src", "core");
37719
- if (!existsSync8(cliDir)) {
37760
+ const cliDir = join11(cleoSrcRoot, "cli", "commands");
37761
+ const coreDir = isCleoRepo ? join11(projectRoot, "packages", "core", "src") : join11(projectRoot, "src", "core");
37762
+ if (!existsSync9(cliDir)) {
37720
37763
  addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
37721
37764
  {
37722
37765
  severity: "error",
@@ -37725,7 +37768,7 @@ var init_detect_drift = __esm({
37725
37768
  recommendation: "Verify TypeScript source structure is intact"
37726
37769
  }
37727
37770
  ]);
37728
- } else if (!existsSync8(coreDir)) {
37771
+ } else if (!existsSync9(coreDir)) {
37729
37772
  addCheck("CLI-to-core sync", "fail", "Core directory missing", [
37730
37773
  {
37731
37774
  severity: "error",
@@ -37742,8 +37785,8 @@ var init_detect_drift = __esm({
37742
37785
  addCheck("CLI-to-core sync", "fail", `Error: ${getErrorMessage(e)}`);
37743
37786
  }
37744
37787
  try {
37745
- const domainsDir = join10(cleoSrcRoot, "dispatch", "domains");
37746
- if (!existsSync8(domainsDir)) {
37788
+ const domainsDir = join11(cleoSrcRoot, "dispatch", "domains");
37789
+ if (!existsSync9(domainsDir)) {
37747
37790
  addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
37748
37791
  {
37749
37792
  severity: "error",
@@ -37760,8 +37803,8 @@ var init_detect_drift = __esm({
37760
37803
  addCheck("Domain handler coverage", "fail", `Error: ${getErrorMessage(e)}`);
37761
37804
  }
37762
37805
  try {
37763
- const matrixPath = join10(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
37764
- if (!existsSync8(matrixPath)) {
37806
+ const matrixPath = join11(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
37807
+ if (!existsSync9(matrixPath)) {
37765
37808
  addCheck("Capability matrix", "fail", "Capability matrix missing", [
37766
37809
  {
37767
37810
  severity: "error",
@@ -37777,8 +37820,8 @@ var init_detect_drift = __esm({
37777
37820
  addCheck("Capability matrix", "fail", `Error: ${getErrorMessage(e)}`);
37778
37821
  }
37779
37822
  try {
37780
- const schemaPath = join10(projectRoot, "src", "store", "schema.ts");
37781
- if (!existsSync8(schemaPath)) {
37823
+ const schemaPath = join11(projectRoot, "src", "store", "schema.ts");
37824
+ if (!existsSync9(schemaPath)) {
37782
37825
  addCheck("Schema validation", "fail", "Schema definition missing", [
37783
37826
  {
37784
37827
  severity: "error",
@@ -37812,10 +37855,10 @@ var init_detect_drift = __esm({
37812
37855
  addCheck("Schema validation", "fail", `Error: ${getErrorMessage(e)}`);
37813
37856
  }
37814
37857
  try {
37815
- const visionPath = join10(projectRoot, "docs", "concepts", "CLEO-VISION.md");
37816
- const specPath = join10(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
37858
+ const visionPath = join11(projectRoot, "docs", "concepts", "CLEO-VISION.md");
37859
+ const specPath = join11(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
37817
37860
  const issues = [];
37818
- if (!existsSync8(visionPath)) {
37861
+ if (!existsSync9(visionPath)) {
37819
37862
  issues.push({
37820
37863
  severity: "error",
37821
37864
  category: "vision",
@@ -37824,7 +37867,7 @@ var init_detect_drift = __esm({
37824
37867
  recommendation: "Create docs/concepts/CLEO-VISION.md with project vision"
37825
37868
  });
37826
37869
  }
37827
- if (!existsSync8(specPath)) {
37870
+ if (!existsSync9(specPath)) {
37828
37871
  issues.push({
37829
37872
  severity: "error",
37830
37873
  category: "spec",
@@ -37868,8 +37911,8 @@ var init_detect_drift = __esm({
37868
37911
  addCheck("Canonical identity", "fail", `Error: ${getErrorMessage(e)}`);
37869
37912
  }
37870
37913
  try {
37871
- const injectionPath = join10(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
37872
- if (!existsSync8(injectionPath)) {
37914
+ const injectionPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
37915
+ if (!existsSync9(injectionPath)) {
37873
37916
  addCheck("Agent injection", "fail", "Agent injection template missing", [
37874
37917
  {
37875
37918
  severity: "error",
@@ -37898,8 +37941,8 @@ var init_detect_drift = __esm({
37898
37941
  addCheck("Agent injection", "fail", `Error: ${getErrorMessage(e)}`);
37899
37942
  }
37900
37943
  try {
37901
- const exitCodesPath = join10(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
37902
- if (!existsSync8(exitCodesPath)) {
37944
+ const exitCodesPath = join11(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
37945
+ if (!existsSync9(exitCodesPath)) {
37903
37946
  addCheck("Exit codes", "fail", "Exit codes definition missing", [
37904
37947
  {
37905
37948
  severity: "error",
@@ -38073,7 +38116,7 @@ __export(docs_exports, {
38073
38116
  docsCommand: () => docsCommand
38074
38117
  });
38075
38118
  import { mkdir, readdir, readFile as readFile2, writeFile } from "node:fs/promises";
38076
- import { dirname as dirname6, isAbsolute as isAbsolute2, join as join11, resolve as resolve4 } from "node:path";
38119
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join12, resolve as resolve5 } from "node:path";
38077
38120
  import {
38078
38121
  buildDocsGraph,
38079
38122
  CleoError as CleoError3,
@@ -38086,10 +38129,10 @@ import {
38086
38129
  publishDocs,
38087
38130
  rankDocs,
38088
38131
  readJson,
38089
- searchDocs
38132
+ searchDocs as searchDocs2
38090
38133
  } from "@cleocode/core/internal";
38091
38134
  async function getScriptNames(projectRoot) {
38092
- const scriptsDir = join11(projectRoot, "scripts");
38135
+ const scriptsDir = join12(projectRoot, "scripts");
38093
38136
  try {
38094
38137
  const files = await readdir(scriptsDir);
38095
38138
  return files.filter((f) => f.endsWith(".sh")).map((f) => f.replace(".sh", "")).sort();
@@ -38098,7 +38141,7 @@ async function getScriptNames(projectRoot) {
38098
38141
  }
38099
38142
  }
38100
38143
  async function getIndexedCommands(projectRoot) {
38101
- const indexPath = join11(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
38144
+ const indexPath = join12(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
38102
38145
  const index = await readJson(indexPath);
38103
38146
  if (!index) return [];
38104
38147
  return index.commands.map((c) => c.name).sort();
@@ -38131,7 +38174,7 @@ async function runGapCheck(_projectRoot, filterId) {
38131
38174
  const reviewFiles = files.filter((f) => f.endsWith(".md"));
38132
38175
  for (const file of reviewFiles) {
38133
38176
  if (filterId && !file.includes(filterId)) continue;
38134
- const filePath = join11(reviewDir, file);
38177
+ const filePath = join12(reviewDir, file);
38135
38178
  const content = await readFile2(filePath, "utf-8");
38136
38179
  const taskMatch = file.match(/^(T\d+)/);
38137
38180
  const taskId = taskMatch ? taskMatch[1] : "UNKNOWN";
@@ -38386,7 +38429,7 @@ var init_docs3 = __esm({
38386
38429
  });
38387
38430
  let writtenPath;
38388
38431
  if (typeof args.out === "string" && args.out.length > 0) {
38389
- const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
38432
+ const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
38390
38433
  await mkdir(dirname6(outPath), { recursive: true });
38391
38434
  await writeFile(outPath, result.markdown, "utf8");
38392
38435
  writtenPath = outPath;
@@ -38441,7 +38484,7 @@ var init_docs3 = __esm({
38441
38484
  async run({ args }) {
38442
38485
  const projectRoot = getProjectRoot22();
38443
38486
  try {
38444
- const result = await searchDocs(String(args.query), {
38487
+ const result = await searchDocs2(String(args.query), {
38445
38488
  ownerId: args.owner ?? void 0,
38446
38489
  limit: args.limit ? Number.parseInt(String(args.limit), 10) : 10,
38447
38490
  projectRoot
@@ -38500,7 +38543,7 @@ var init_docs3 = __esm({
38500
38543
  base: args.base ?? void 0
38501
38544
  });
38502
38545
  if (typeof args.out === "string" && args.out.length > 0) {
38503
- const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
38546
+ const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
38504
38547
  await mkdir(dirname6(outPath), { recursive: true });
38505
38548
  await writeFile(outPath, result.merged, "utf8");
38506
38549
  humanInfo(`Wrote merged content to ${outPath}`);
@@ -38571,7 +38614,7 @@ var init_docs3 = __esm({
38571
38614
  output = lines.join("\n");
38572
38615
  }
38573
38616
  if (typeof args.out === "string" && args.out.length > 0) {
38574
- const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
38617
+ const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
38575
38618
  await mkdir(dirname6(outPath), { recursive: true });
38576
38619
  await writeFile(outPath, output, "utf8");
38577
38620
  humanInfo(`Wrote graph to ${outPath}`);
@@ -39095,16 +39138,10 @@ __export(migrate_agents_v2_exports, {
39095
39138
  walkAgentsDir: () => walkAgentsDir
39096
39139
  });
39097
39140
  import { createHash as createHash2 } from "node:crypto";
39098
- import { appendFileSync as appendFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync10 } from "node:fs";
39099
- import { join as join12 } from "node:path";
39100
- import { DatabaseSync } from "node:sqlite";
39101
- import {
39102
- applyPerfPragmas as applyPerfPragmas2,
39103
- ensureGlobalSignaldockDb,
39104
- getGlobalSignaldockDbPath,
39105
- getProjectRoot as getProjectRoot23,
39106
- installAgentFromCant
39107
- } from "@cleocode/core/internal";
39141
+ import { appendFileSync as appendFileSync2, existsSync as existsSync10, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync10 } from "node:fs";
39142
+ import { join as join13 } from "node:path";
39143
+ import { getProjectRoot as getProjectRoot23, installAgentFromCant } from "@cleocode/core/internal";
39144
+ import { openCleoDb } from "@cleocode/core/store/open-cleo-db";
39108
39145
  function sha256Hex(bytes) {
39109
39146
  return createHash2("sha256").update(bytes).digest("hex");
39110
39147
  }
@@ -39122,15 +39159,15 @@ function extractAgentName(source) {
39122
39159
  return headerMatch[1] ?? null;
39123
39160
  }
39124
39161
  function appendAuditLog(projectRoot, entry) {
39125
- const auditPath = join12(projectRoot, AUDIT_LOG_RELATIVE);
39126
- const auditDir = join12(auditPath, "..");
39127
- if (!existsSync9(auditDir)) {
39162
+ const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
39163
+ const auditDir = join13(auditPath, "..");
39164
+ if (!existsSync10(auditDir)) {
39128
39165
  mkdirSync3(auditDir, { recursive: true });
39129
39166
  }
39130
39167
  appendFileSync2(auditPath, JSON.stringify(entry) + "\n", "utf8");
39131
39168
  }
39132
39169
  function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
39133
- if (!existsSync9(scanDir)) return;
39170
+ if (!existsSync10(scanDir)) return;
39134
39171
  let files;
39135
39172
  try {
39136
39173
  files = readdirSync2(scanDir).filter((f) => f.endsWith(".cant"));
@@ -39141,7 +39178,7 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
39141
39178
  return;
39142
39179
  }
39143
39180
  for (const filename of files) {
39144
- const cantPath = join12(scanDir, filename);
39181
+ const cantPath = join13(scanDir, filename);
39145
39182
  const relPath = cantPath.replace(`${projectRoot}/`, "");
39146
39183
  let sourceBytes;
39147
39184
  let sourceText;
@@ -39235,13 +39272,12 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
39235
39272
  }
39236
39273
  async function runMigrateAgentsV2(projectRoot, verbose = true) {
39237
39274
  const summary = { registered: 0, skipped: 0, conflicts: 0, errors: 0 };
39238
- await ensureGlobalSignaldockDb();
39239
- const db = new DatabaseSync(getGlobalSignaldockDbPath());
39240
- applyPerfPragmas2(db);
39275
+ const { db: _sdDb } = await openCleoDb("signaldock");
39276
+ const db = _sdDb;
39241
39277
  try {
39242
- const canonicalDir = join12(projectRoot, ".cleo", "cant", "agents");
39278
+ const canonicalDir = join13(projectRoot, ".cleo", "cant", "agents");
39243
39279
  walkAgentsDir(db, canonicalDir, projectRoot, summary, verbose);
39244
- const legacyDir = join12(projectRoot, ".cleo", "agents");
39280
+ const legacyDir = join13(projectRoot, ".cleo", "agents");
39245
39281
  walkAgentsDir(db, legacyDir, projectRoot, summary, verbose);
39246
39282
  } finally {
39247
39283
  db.close();
@@ -39249,8 +39285,8 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
39249
39285
  return summary;
39250
39286
  }
39251
39287
  function readMigrationConflicts(projectRoot) {
39252
- const auditPath = join12(projectRoot, AUDIT_LOG_RELATIVE);
39253
- if (!existsSync9(auditPath)) return [];
39288
+ const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
39289
+ if (!existsSync10(auditPath)) return [];
39254
39290
  let raw;
39255
39291
  try {
39256
39292
  raw = readFileSync10(auditPath, "utf8");
@@ -40014,10 +40050,10 @@ var init_export = __esm({
40014
40050
  // packages/cleo/src/cli/commands/find.ts
40015
40051
  var find_exports = {};
40016
40052
  __export(find_exports, {
40017
- findCommand: () => findCommand2
40053
+ findCommand: () => findCommand3
40018
40054
  });
40019
40055
  import { createPage } from "@cleocode/core";
40020
- var findCommand2;
40056
+ var findCommand3;
40021
40057
  var init_find = __esm({
40022
40058
  "packages/cleo/src/cli/commands/find.ts"() {
40023
40059
  "use strict";
@@ -40025,7 +40061,7 @@ var init_find = __esm({
40025
40061
  init_dist();
40026
40062
  init_cli();
40027
40063
  init_renderers();
40028
- findCommand2 = defineCommand({
40064
+ findCommand3 = defineCommand({
40029
40065
  meta: { name: "find", description: "Fuzzy search tasks by title/description" },
40030
40066
  args: {
40031
40067
  query: {
@@ -40099,7 +40135,7 @@ __export(gc_exports, {
40099
40135
  gcCommand: () => gcCommand
40100
40136
  });
40101
40137
  import { homedir as homedir4, tmpdir } from "node:os";
40102
- import { join as join13 } from "node:path";
40138
+ import { join as join14 } from "node:path";
40103
40139
  import { pruneOrphanTempDirs, pruneOrphanWorktrees } from "@cleocode/core/gc/cleanup.js";
40104
40140
  import { runGC } from "@cleocode/core/gc/runner.js";
40105
40141
  import { readGCState } from "@cleocode/core/gc/state.js";
@@ -40138,7 +40174,7 @@ var init_gc = __esm({
40138
40174
  }
40139
40175
  },
40140
40176
  async run({ args }) {
40141
- const cleoDir = args["cleo-dir"] ?? join13(homedir4(), ".cleo");
40177
+ const cleoDir = args["cleo-dir"] ?? join14(homedir4(), ".cleo");
40142
40178
  const dryRun = args["dry-run"];
40143
40179
  try {
40144
40180
  const gcResult = await runGC({ cleoDir, dryRun });
@@ -40180,8 +40216,8 @@ var init_gc = __esm({
40180
40216
  }
40181
40217
  },
40182
40218
  async run({ args }) {
40183
- const cleoDir = args["cleo-dir"] ?? join13(homedir4(), ".cleo");
40184
- const statePath = join13(cleoDir, "gc-state.json");
40219
+ const cleoDir = args["cleo-dir"] ?? join14(homedir4(), ".cleo");
40220
+ const statePath = join14(cleoDir, "gc-state.json");
40185
40221
  try {
40186
40222
  const state = await readGCState(statePath);
40187
40223
  const diskStr = state.lastDiskUsedPct !== null ? `${state.lastDiskUsedPct.toFixed(1)}%` : "unknown";
@@ -40234,8 +40270,8 @@ var init_gc = __esm({
40234
40270
  }
40235
40271
  },
40236
40272
  async run({ args }) {
40237
- const xdgData = process.env["XDG_DATA_HOME"] ?? join13(homedir4(), ".local", "share");
40238
- const worktreesRoot = args["worktrees-root"] ?? join13(xdgData, "cleo", "worktrees");
40273
+ const xdgData = process.env["XDG_DATA_HOME"] ?? join14(homedir4(), ".local", "share");
40274
+ const worktreesRoot = args["worktrees-root"] ?? join14(xdgData, "cleo", "worktrees");
40239
40275
  const projectHash = args["project-hash"];
40240
40276
  const dryRun = args["dry-run"];
40241
40277
  const preserveRaw = args["preserve-tasks"];
@@ -40345,8 +40381,8 @@ __export(generate_changelog_exports, {
40345
40381
  generateChangelogCommand: () => generateChangelogCommand
40346
40382
  });
40347
40383
  import { execFileSync as execFileSync2 } from "node:child_process";
40348
- import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "node:fs";
40349
- import { dirname as dirname7, join as join14 } from "node:path";
40384
+ import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "node:fs";
40385
+ import { dirname as dirname7, join as join15 } from "node:path";
40350
40386
  import { CleoError as CleoError4, formatError as formatError6, getConfigPath, getProjectRoot as getProjectRoot25 } from "@cleocode/core";
40351
40387
  function getChangelogSource(cwd) {
40352
40388
  const configPath = getConfigPath(cwd);
@@ -40511,8 +40547,8 @@ var init_generate_changelog = __esm({
40511
40547
  const targetPlatform = args.platform;
40512
40548
  const dryRun = args["dry-run"] === true;
40513
40549
  const sourceFile = getChangelogSource();
40514
- const sourcePath = join14(getProjectRoot25(), sourceFile);
40515
- if (!existsSync10(sourcePath)) {
40550
+ const sourcePath = join15(getProjectRoot25(), sourceFile);
40551
+ if (!existsSync11(sourcePath)) {
40516
40552
  throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
40517
40553
  }
40518
40554
  const sourceContent = readFileSync11(sourcePath, "utf-8");
@@ -40524,7 +40560,7 @@ var init_generate_changelog = __esm({
40524
40560
  const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
40525
40561
  const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
40526
40562
  if (!dryRun) {
40527
- const fullPath = join14(getProjectRoot25(), outputPath);
40563
+ const fullPath = join15(getProjectRoot25(), outputPath);
40528
40564
  mkdirSync4(dirname7(fullPath), { recursive: true });
40529
40565
  writeFileSync3(fullPath, content, "utf-8");
40530
40566
  }
@@ -40545,7 +40581,7 @@ var init_generate_changelog = __esm({
40545
40581
  limit
40546
40582
  );
40547
40583
  if (!dryRun) {
40548
- const fullPath = join14(getProjectRoot25(), platformConfig.path);
40584
+ const fullPath = join15(getProjectRoot25(), platformConfig.path);
40549
40585
  mkdirSync4(dirname7(fullPath), { recursive: true });
40550
40586
  writeFileSync3(fullPath, content, "utf-8");
40551
40587
  }
@@ -40842,18 +40878,18 @@ __export(init_exports, {
40842
40878
  getGitignoreTemplate: () => getGitignoreTemplate,
40843
40879
  initCommand: () => initCommand
40844
40880
  });
40845
- import { existsSync as existsSync11, readFileSync as readFileSync12 } from "node:fs";
40846
- import { join as join15 } from "node:path";
40881
+ import { existsSync as existsSync12, readFileSync as readFileSync12 } from "node:fs";
40882
+ import { join as join16 } from "node:path";
40847
40883
  import { fileURLToPath as fileURLToPath4 } from "node:url";
40848
40884
  import { CleoError as CleoError5, formatError as formatError7, initProject as initProject2 } from "@cleocode/core";
40849
40885
  function getGitignoreTemplate() {
40850
40886
  try {
40851
40887
  const thisFile = fileURLToPath4(import.meta.url);
40852
- const packageRoot = join15(thisFile, "..", "..", "..", "..");
40853
- const localTemplatePath = join15(packageRoot, "templates", "cleo-gitignore");
40854
- const monorepoTemplatePath = join15(packageRoot, "..", "..", "templates", "cleo-gitignore");
40855
- const templatePath = existsSync11(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
40856
- if (existsSync11(templatePath)) {
40888
+ const packageRoot = join16(thisFile, "..", "..", "..", "..");
40889
+ const localTemplatePath = join16(packageRoot, "templates", "cleo-gitignore");
40890
+ const monorepoTemplatePath = join16(packageRoot, "..", "..", "templates", "cleo-gitignore");
40891
+ const templatePath = existsSync12(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
40892
+ if (existsSync12(templatePath)) {
40857
40893
  return readFileSync12(templatePath, "utf-8");
40858
40894
  }
40859
40895
  } catch {
@@ -41275,7 +41311,7 @@ async function handleIssueType(issueType, opts) {
41275
41311
  }
41276
41312
  cliOutput(result, { command: "issue", operation: `tools.issue.add.${issueType}` });
41277
41313
  }
41278
- var CLEO_REPO, bugCommand2, featureCommand, helpCommand, diagnosticsCommand2, issueCommand;
41314
+ var CLEO_REPO, bugCommand, featureCommand, helpCommand, diagnosticsCommand2, issueCommand;
41279
41315
  var init_issue = __esm({
41280
41316
  "packages/cleo/src/cli/commands/issue.ts"() {
41281
41317
  "use strict";
@@ -41283,7 +41319,7 @@ var init_issue = __esm({
41283
41319
  init_cli();
41284
41320
  init_renderers();
41285
41321
  CLEO_REPO = BUILD_CONFIG.repository.fullName;
41286
- bugCommand2 = defineCommand({
41322
+ bugCommand = defineCommand({
41287
41323
  meta: { name: "bug", description: "File a bug report" },
41288
41324
  args: {
41289
41325
  title: { type: "string", description: "Issue title", required: true },
@@ -41361,7 +41397,7 @@ var init_issue = __esm({
41361
41397
  description: "File bug reports, feature requests, or questions to CLEO GitHub repo"
41362
41398
  },
41363
41399
  subCommands: {
41364
- bug: bugCommand2,
41400
+ bug: bugCommand,
41365
41401
  feature: featureCommand,
41366
41402
  help: helpCommand,
41367
41403
  diagnostics: diagnosticsCommand2
@@ -41801,19 +41837,19 @@ async function readStdin() {
41801
41837
  if (process.stdin.isTTY) {
41802
41838
  return "";
41803
41839
  }
41804
- return new Promise((resolve5, reject) => {
41840
+ return new Promise((resolve7, reject) => {
41805
41841
  let data = "";
41806
41842
  process.stdin.setEncoding("utf-8");
41807
41843
  process.stdin.on("data", (chunk) => {
41808
41844
  data += chunk;
41809
41845
  });
41810
41846
  process.stdin.on("end", () => {
41811
- resolve5(data.trim());
41847
+ resolve7(data.trim());
41812
41848
  });
41813
41849
  process.stdin.on("error", reject);
41814
41850
  });
41815
41851
  }
41816
- var showCommand7, listCommand10, findCommand3, statsCommand3, appendCommand, archiveCommand2, manifestCommand;
41852
+ var showCommand7, listCommand10, findCommand4, statsCommand3, appendCommand, archiveCommand2, manifestCommand;
41817
41853
  var init_manifest = __esm({
41818
41854
  "packages/cleo/src/cli/commands/manifest.ts"() {
41819
41855
  "use strict";
@@ -41899,7 +41935,7 @@ var init_manifest = __esm({
41899
41935
  );
41900
41936
  }
41901
41937
  });
41902
- findCommand3 = defineCommand({
41938
+ findCommand4 = defineCommand({
41903
41939
  meta: {
41904
41940
  name: "find",
41905
41941
  description: "Full-text search manifest entries"
@@ -42108,7 +42144,7 @@ var init_manifest = __esm({
42108
42144
  subCommands: {
42109
42145
  show: showCommand7,
42110
42146
  list: listCommand10,
42111
- find: findCommand3,
42147
+ find: findCommand4,
42112
42148
  stats: statsCommand3,
42113
42149
  append: appendCommand,
42114
42150
  archive: archiveCommand2
@@ -42160,9 +42196,9 @@ __export(memory_exports, {
42160
42196
  memoryCommand: () => memoryCommand
42161
42197
  });
42162
42198
  import { createHash as createHash3 } from "node:crypto";
42163
- import { existsSync as existsSync12, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync4 } from "node:fs";
42199
+ import { existsSync as existsSync13, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync4 } from "node:fs";
42164
42200
  import { homedir as homedir5 } from "node:os";
42165
- import { join as join16 } from "node:path";
42201
+ import { join as join17 } from "node:path";
42166
42202
  import {
42167
42203
  getBrainDb as getBrainDb2,
42168
42204
  getBrainNativeDb as getBrainNativeDb3,
@@ -42202,7 +42238,7 @@ ${body}`).digest("hex").slice(0, 16);
42202
42238
  }
42203
42239
  function loadImportHashes(stateFile) {
42204
42240
  try {
42205
- if (!existsSync12(stateFile)) return /* @__PURE__ */ new Set();
42241
+ if (!existsSync13(stateFile)) return /* @__PURE__ */ new Set();
42206
42242
  const raw = readFileSync13(stateFile, "utf-8");
42207
42243
  const parsed = JSON.parse(raw);
42208
42244
  return new Set(parsed.hashes);
@@ -42212,7 +42248,7 @@ function loadImportHashes(stateFile) {
42212
42248
  }
42213
42249
  function saveImportHashes(stateFile, hashes) {
42214
42250
  const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
42215
- if (!existsSync12(dir)) mkdirSync5(dir, { recursive: true });
42251
+ if (!existsSync13(dir)) mkdirSync5(dir, { recursive: true });
42216
42252
  writeFileSync4(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
42217
42253
  }
42218
42254
  function makeMemorySubcommand(opts) {
@@ -42232,7 +42268,7 @@ function makeMemorySubcommand(opts) {
42232
42268
  }
42233
42269
  });
42234
42270
  }
42235
- var storeCommand, findCommand4, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand2, 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;
42271
+ var storeCommand, findCommand5, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand2, 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;
42236
42272
  var init_memory3 = __esm({
42237
42273
  "packages/cleo/src/cli/commands/memory.ts"() {
42238
42274
  "use strict";
@@ -42324,7 +42360,7 @@ var init_memory3 = __esm({
42324
42360
  }
42325
42361
  }
42326
42362
  });
42327
- findCommand4 = defineCommand({
42363
+ findCommand5 = defineCommand({
42328
42364
  meta: {
42329
42365
  name: "find",
42330
42366
  description: "Search BRAIN memory (all tables, or filter by --type pattern|learning)"
@@ -43304,16 +43340,16 @@ var init_memory3 = __esm({
43304
43340
  }
43305
43341
  },
43306
43342
  async run({ args }) {
43307
- const sourceDir = args.from ?? join16(homedir5(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
43343
+ const sourceDir = args.from ?? join17(homedir5(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
43308
43344
  const isDryRun = !!args["dry-run"];
43309
43345
  const projectRoot = getProjectRoot26();
43310
- const stateFile = join16(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
43311
- if (!existsSync12(sourceDir)) {
43346
+ const stateFile = join17(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
43347
+ if (!existsSync13(sourceDir)) {
43312
43348
  cliError(`Source directory not found: ${sourceDir}`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
43313
43349
  process.exit(1);
43314
43350
  return;
43315
43351
  }
43316
- const files = readdirSync3(sourceDir).filter((f) => f.endsWith(".md") && f !== "MEMORY.md").map((f) => join16(sourceDir, f));
43352
+ const files = readdirSync3(sourceDir).filter((f) => f.endsWith(".md") && f !== "MEMORY.md").map((f) => join17(sourceDir, f));
43317
43353
  const importedHashes = isDryRun ? /* @__PURE__ */ new Set() : loadImportHashes(stateFile);
43318
43354
  const stats = { total: files.length, imported: 0, skipped: 0, errors: 0 };
43319
43355
  const importedEntries = [];
@@ -44109,8 +44145,8 @@ data: ${JSON.stringify(event)}
44109
44145
  cursor = data.nextCursor;
44110
44146
  }
44111
44147
  if (!running) break;
44112
- await new Promise((resolve5) => {
44113
- const timer = setTimeout(resolve5, intervalMs);
44148
+ await new Promise((resolve7) => {
44149
+ const timer = setTimeout(resolve7, intervalMs);
44114
44150
  timer.unref?.();
44115
44151
  });
44116
44152
  }
@@ -44179,7 +44215,7 @@ data: ${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString() })}
44179
44215
  meta: { name: "memory", description: "BRAIN memory operations (patterns, learnings)" },
44180
44216
  subCommands: {
44181
44217
  store: storeCommand,
44182
- find: findCommand4,
44218
+ find: findCommand5,
44183
44219
  stats: statsCommand4,
44184
44220
  observe: observeCommand,
44185
44221
  timeline: timelineCommand,
@@ -45677,13 +45713,13 @@ var init_nexus4 = __esm({
45677
45713
  if (!skipPrompt) {
45678
45714
  const { createInterface: createInterface2 } = await import("node:readline");
45679
45715
  const rl = createInterface2({ input: process.stdin, output: process.stdout });
45680
- const confirmed = await new Promise((resolve5) => {
45716
+ const confirmed = await new Promise((resolve7) => {
45681
45717
  rl.question(
45682
45718
  `
45683
45719
  [nexus] Delete ${matchCount} project(s) from the registry? [y/N] `,
45684
45720
  (answer) => {
45685
45721
  rl.close();
45686
- resolve5(answer.trim().toLowerCase() === "y");
45722
+ resolve7(answer.trim().toLowerCase() === "y");
45687
45723
  }
45688
45724
  );
45689
45725
  });
@@ -50758,7 +50794,7 @@ __export(revert_exports, {
50758
50794
  revertCommand: () => revertCommand
50759
50795
  });
50760
50796
  import { readFile as readFile3 } from "node:fs/promises";
50761
- import { join as join17 } from "node:path";
50797
+ import { join as join18 } from "node:path";
50762
50798
  import { cwd as processCwd } from "node:process";
50763
50799
  import { E_RECEIPT_NOT_FOUND } from "@cleocode/core/sentient/chain-walker.js";
50764
50800
  import { SENTIENT_STATE_FILE } from "@cleocode/core/sentient/daemon.js";
@@ -50823,7 +50859,7 @@ async function loadOwnerAttestation(attestationFilePath) {
50823
50859
  return obj;
50824
50860
  }
50825
50861
  async function loadOwnerPubkeys(projectRoot) {
50826
- const path5 = join17(projectRoot, OWNER_PUBKEYS_FILE);
50862
+ const path5 = join18(projectRoot, OWNER_PUBKEYS_FILE);
50827
50863
  try {
50828
50864
  const raw = await readFile3(path5, "utf-8");
50829
50865
  const parsed = JSON.parse(raw);
@@ -50906,7 +50942,7 @@ var init_revert = __esm({
50906
50942
  if (attestation && allowedPubkeys.size > 0 && !allowedPubkeys.has(attestation.ownerPubkey)) {
50907
50943
  emitFailure2(
50908
50944
  E_OWNER_ATTESTATION_REQUIRED,
50909
- `Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${join17(projectRoot, OWNER_PUBKEYS_FILE)}`,
50945
+ `Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${join18(projectRoot, OWNER_PUBKEYS_FILE)}`,
50910
50946
  jsonMode
50911
50947
  );
50912
50948
  }
@@ -50959,7 +50995,7 @@ ${lines}`
50959
50995
  identity,
50960
50996
  includeHuman
50961
50997
  });
50962
- const statePath = join17(projectRoot, SENTIENT_STATE_FILE);
50998
+ const statePath = join18(projectRoot, SENTIENT_STATE_FILE);
50963
50999
  const state = await readSentientState(statePath);
50964
51000
  emitSuccess(
50965
51001
  {
@@ -51194,7 +51230,7 @@ __export(self_update_exports, {
51194
51230
  });
51195
51231
  import { execFile } from "node:child_process";
51196
51232
  import { readFile as readFile4 } from "node:fs/promises";
51197
- import { join as join18 } from "node:path";
51233
+ import { join as join19 } from "node:path";
51198
51234
  import * as readline2 from "node:readline";
51199
51235
  import { promisify } from "node:util";
51200
51236
  import {
@@ -51209,7 +51245,7 @@ import {
51209
51245
  async function getCurrentVersion() {
51210
51246
  const cleoHome = getCleoHome();
51211
51247
  try {
51212
- const content = await readFile4(join18(cleoHome, "VERSION"), "utf-8");
51248
+ const content = await readFile4(join19(cleoHome, "VERSION"), "utf-8");
51213
51249
  return (content.split("\n")[0] ?? "unknown").trim();
51214
51250
  } catch {
51215
51251
  return "unknown";
@@ -51263,7 +51299,7 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
51263
51299
  ];
51264
51300
  await import("node:fs/promises").then(
51265
51301
  ({ writeFile: writeFile3, mkdir: mkdir3 }) => mkdir3(cleoHome, { recursive: true }).then(
51266
- () => writeFile3(join18(cleoHome, "VERSION"), `${lines.join("\n")}
51302
+ () => writeFile3(join19(cleoHome, "VERSION"), `${lines.join("\n")}
51267
51303
  `, "utf-8")
51268
51304
  )
51269
51305
  );
@@ -51301,11 +51337,11 @@ async function runPostUpdateDiagnostics(opts) {
51301
51337
  input: process.stdin,
51302
51338
  output: process.stdout
51303
51339
  });
51304
- shouldMigrate = await new Promise((resolve5) => {
51340
+ shouldMigrate = await new Promise((resolve7) => {
51305
51341
  rl.question(" Do you want to run the upgrade now? [Y/n] ", (answer) => {
51306
51342
  rl.close();
51307
51343
  const clean = answer.trim().toLowerCase();
51308
- resolve5(clean === "" || clean === "y" || clean === "yes");
51344
+ resolve7(clean === "" || clean === "y" || clean === "yes");
51309
51345
  });
51310
51346
  });
51311
51347
  }
@@ -51674,7 +51710,7 @@ var sentient_exports = {};
51674
51710
  __export(sentient_exports, {
51675
51711
  sentientCommand: () => sentientCommand
51676
51712
  });
51677
- import { join as join19 } from "node:path";
51713
+ import { join as join20 } from "node:path";
51678
51714
  import { cwd as processCwd2 } from "node:process";
51679
51715
  import {
51680
51716
  getSentientDaemonStatus as getSentientDaemonStatus2,
@@ -51740,7 +51776,7 @@ var init_sentient3 = __esm({
51740
51776
  return;
51741
51777
  }
51742
51778
  if (dryRun) {
51743
- const statePath2 = join19(projectRoot, SENTIENT_STATE_FILE2);
51779
+ const statePath2 = join20(projectRoot, SENTIENT_STATE_FILE2);
51744
51780
  const outcome = await safeRunTick({ projectRoot, statePath: statePath2, dryRun: true });
51745
51781
  emitSuccess2(
51746
51782
  { dryRun: true, outcome },
@@ -51856,7 +51892,7 @@ Logs: ${logPath}`
51856
51892
  const jsonMode = args.json === true;
51857
51893
  const dryRun = args["dry-run"] === true;
51858
51894
  try {
51859
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
51895
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
51860
51896
  const outcome = await safeRunTick({ projectRoot, statePath, dryRun });
51861
51897
  emitSuccess2(
51862
51898
  { outcome, dryRun },
@@ -51925,7 +51961,7 @@ Logs: ${logPath}`
51925
51961
  return;
51926
51962
  }
51927
51963
  await db.update(tasks).set({ status: "pending", updatedAt: now }).where(eq2(tasks.id, id)).run();
51928
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
51964
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
51929
51965
  const state = await readSentientState2(statePath);
51930
51966
  await patchSentientState(statePath, {
51931
51967
  tier2Stats: {
@@ -51977,7 +52013,7 @@ Logs: ${logPath}`
51977
52013
  return;
51978
52014
  }
51979
52015
  await db.update(tasks).set({ status: "cancelled", cancellationReason: reason, cancelledAt: now, updatedAt: now }).where(eq2(tasks.id, id)).run();
51980
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
52016
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
51981
52017
  const state = await readSentientState2(statePath);
51982
52018
  await patchSentientState(statePath, {
51983
52019
  tier2Stats: {
@@ -52022,7 +52058,7 @@ Logs: ${logPath}`
52022
52058
  const projectRoot = resolveProjectRoot5(args.project);
52023
52059
  const jsonMode = args.json === true;
52024
52060
  try {
52025
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
52061
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
52026
52062
  const outcome = await safeRunProposeTick({ projectRoot, statePath });
52027
52063
  emitSuccess2(
52028
52064
  { outcome },
@@ -52042,7 +52078,7 @@ Logs: ${logPath}`
52042
52078
  const projectRoot = resolveProjectRoot5(args.project);
52043
52079
  const jsonMode = args.json === true;
52044
52080
  try {
52045
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
52081
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
52046
52082
  const updated = await patchSentientState(statePath, { tier2Enabled: true });
52047
52083
  emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals enabled");
52048
52084
  } catch (err) {
@@ -52061,7 +52097,7 @@ Logs: ${logPath}`
52061
52097
  const projectRoot = resolveProjectRoot5(args.project);
52062
52098
  const jsonMode = args.json === true;
52063
52099
  try {
52064
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
52100
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
52065
52101
  const updated = await patchSentientState(statePath, { tier2Enabled: false });
52066
52102
  emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals disabled");
52067
52103
  } catch (err) {
@@ -52092,7 +52128,7 @@ Logs: ${logPath}`
52092
52128
  const projectRoot = resolveProjectRoot5(args.project);
52093
52129
  const jsonMode = args.json === true;
52094
52130
  try {
52095
- const statePath = join19(projectRoot, SENTIENT_STATE_FILE2);
52131
+ const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
52096
52132
  const state = await readSentientState2(statePath);
52097
52133
  emitSuccess2(
52098
52134
  {
@@ -52404,7 +52440,7 @@ async function promptOwnerAuthPassword(sessionName) {
52404
52440
  terminal: true
52405
52441
  });
52406
52442
  process.stderr.write(`[cleo] Enter owner-auth password for session "${sessionName}": `);
52407
- const password = await new Promise((resolve5) => {
52443
+ const password = await new Promise((resolve7) => {
52408
52444
  if (process.stdin.setRawMode) {
52409
52445
  process.stdin.setRawMode(
52410
52446
  true
@@ -52422,10 +52458,10 @@ async function promptOwnerAuthPassword(sessionName) {
52422
52458
  );
52423
52459
  }
52424
52460
  process.stderr.write("\n");
52425
- resolve5(pw);
52461
+ resolve7(pw);
52426
52462
  } else if (ch === "") {
52427
52463
  process.stderr.write("\n[cleo] Cancelled.\n");
52428
- resolve5("");
52464
+ resolve7("");
52429
52465
  } else if (ch === "\x7F" || ch === "\b") {
52430
52466
  pw = pw.slice(0, -1);
52431
52467
  } else {
@@ -52439,7 +52475,7 @@ async function promptOwnerAuthPassword(sessionName) {
52439
52475
  const token = deriveOwnerAuthToken(sessionName, password);
52440
52476
  return token;
52441
52477
  }
52442
- var startCommand8, endCommand, handoffCommand2, statusCommand11, resumeCommand2, findCommand5, listCommand19, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, sessionCommand;
52478
+ var startCommand8, endCommand, handoffCommand2, statusCommand11, resumeCommand2, findCommand6, listCommand19, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, sessionCommand;
52443
52479
  var init_session4 = __esm({
52444
52480
  "packages/cleo/src/cli/commands/session.ts"() {
52445
52481
  "use strict";
@@ -52667,7 +52703,7 @@ var init_session4 = __esm({
52667
52703
  );
52668
52704
  }
52669
52705
  });
52670
- findCommand5 = defineCommand({
52706
+ findCommand6 = defineCommand({
52671
52707
  meta: {
52672
52708
  name: "find",
52673
52709
  description: "Find sessions (lightweight discovery \u2014 minimal fields, low context cost)"
@@ -52969,7 +53005,7 @@ var init_session4 = __esm({
52969
53005
  handoff: handoffCommand2,
52970
53006
  status: statusCommand11,
52971
53007
  resume: resumeCommand2,
52972
- find: findCommand5,
53008
+ find: findCommand6,
52973
53009
  list: listCommand19,
52974
53010
  gc: gcCommand2,
52975
53011
  show: showCommand13,
@@ -54390,7 +54426,7 @@ __export(transcript_exports, {
54390
54426
  transcriptCommand: () => transcriptCommand
54391
54427
  });
54392
54428
  import { homedir as homedir6 } from "node:os";
54393
- import { join as join20 } from "node:path";
54429
+ import { join as join21 } from "node:path";
54394
54430
  import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
54395
54431
  import {
54396
54432
  parseDurationMs,
@@ -54444,7 +54480,7 @@ var init_transcript = __esm({
54444
54480
  }
54445
54481
  return;
54446
54482
  }
54447
- const projectsDir = args["projects-dir"] ?? join20(homedir6(), ".claude", "projects");
54483
+ const projectsDir = args["projects-dir"] ?? join21(homedir6(), ".claude", "projects");
54448
54484
  try {
54449
54485
  const result = await scanTranscripts(projectsDir);
54450
54486
  cliOutput(
@@ -54750,7 +54786,7 @@ var init_transcript = __esm({
54750
54786
  process.exit(2);
54751
54787
  return;
54752
54788
  }
54753
- const projectsDir = args["projects-dir"] ?? join20(homedir6(), ".claude", "projects");
54789
+ const projectsDir = args["projects-dir"] ?? join21(homedir6(), ".claude", "projects");
54754
54790
  try {
54755
54791
  const pruneResult = await pruneTranscripts({
54756
54792
  olderThanMs,
@@ -54809,7 +54845,7 @@ var update_exports = {};
54809
54845
  __export(update_exports, {
54810
54846
  updateCommand: () => updateCommand2
54811
54847
  });
54812
- import { appendSignedSeverityAttestation as appendSignedSeverityAttestation3 } from "@cleocode/core";
54848
+ import { appendSignedSeverityAttestation as appendSignedSeverityAttestation2 } from "@cleocode/core";
54813
54849
  var updateCommand2;
54814
54850
  var init_update = __esm({
54815
54851
  "packages/cleo/src/cli/commands/update.ts"() {
@@ -55039,7 +55075,7 @@ var init_update = __esm({
55039
55075
  if (args["depends-waiver"] !== void 0) params["dependsWaiver"] = args["depends-waiver"];
55040
55076
  if (args.severity !== void 0) {
55041
55077
  try {
55042
- await appendSignedSeverityAttestation3({
55078
+ await appendSignedSeverityAttestation2({
55043
55079
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
55044
55080
  title: String(args.taskId),
55045
55081
  severity: args.severity,
@@ -55209,6 +55245,30 @@ var verify_exports = {};
55209
55245
  __export(verify_exports, {
55210
55246
  verifyCommand: () => verifyCommand3
55211
55247
  });
55248
+ import { spawnSync as spawnSync2 } from "node:child_process";
55249
+ import { existsSync as existsSync14 } from "node:fs";
55250
+ import { join as join22, resolve as resolve6 } from "node:path";
55251
+ function resolveVerifierScript2(taskId, projectRoot) {
55252
+ const id = taskId.toLowerCase();
55253
+ const candidates = [
55254
+ join22(projectRoot, "scripts", `verify-${taskId}-fu.mjs`),
55255
+ join22(projectRoot, "scripts", `verify-${taskId}.mjs`),
55256
+ join22(projectRoot, "scripts", `verify-${id}-fu.mjs`),
55257
+ join22(projectRoot, "scripts", `verify-${id}.mjs`)
55258
+ ];
55259
+ for (const candidate of candidates) {
55260
+ if (existsSync14(candidate)) return candidate;
55261
+ }
55262
+ return null;
55263
+ }
55264
+ function runVerifier(verifierPath) {
55265
+ const result = spawnSync2("node", [verifierPath], { encoding: "utf8" });
55266
+ return {
55267
+ exitCode: result.status ?? 1,
55268
+ stdout: result.stdout ?? "",
55269
+ stderr: result.stderr ?? ""
55270
+ };
55271
+ }
55212
55272
  var verifyCommand3;
55213
55273
  var init_verify = __esm({
55214
55274
  "packages/cleo/src/cli/commands/verify.ts"() {
@@ -55255,6 +55315,11 @@ var init_verify = __esm({
55255
55315
  "shared-evidence": {
55256
55316
  type: "boolean",
55257
55317
  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."
55318
+ },
55319
+ "acceptance-check": {
55320
+ type: "string",
55321
+ 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)",
55322
+ required: false
55258
55323
  }
55259
55324
  },
55260
55325
  async run({ args, cmd }) {
@@ -55262,6 +55327,53 @@ var init_verify = __esm({
55262
55327
  await showUsage(cmd);
55263
55328
  return;
55264
55329
  }
55330
+ const acceptanceCheckRaw = args["acceptance-check"];
55331
+ const shouldRunAcceptanceCheck = acceptanceCheckRaw !== void 0 && acceptanceCheckRaw !== false;
55332
+ if (shouldRunAcceptanceCheck) {
55333
+ const projectRoot = resolve6(process.cwd());
55334
+ let verifierPath = null;
55335
+ if (typeof acceptanceCheckRaw === "string" && acceptanceCheckRaw.length > 0) {
55336
+ const explicit = resolve6(projectRoot, acceptanceCheckRaw);
55337
+ verifierPath = existsSync14(explicit) ? explicit : null;
55338
+ if (!verifierPath) {
55339
+ process.stderr.write(
55340
+ `Error: --acceptance-check path not found: ${explicit}
55341
+ T9192 / ADR-070: verifier script must exist before gate writes are allowed.
55342
+ `
55343
+ );
55344
+ process.exitCode = 1;
55345
+ return;
55346
+ }
55347
+ } else {
55348
+ verifierPath = resolveVerifierScript2(String(args.taskId), projectRoot);
55349
+ }
55350
+ if (!verifierPath) {
55351
+ process.stderr.write(
55352
+ `Error: --acceptance-check: no verifier script found for ${args.taskId}.
55353
+ Looked for: scripts/verify-${args.taskId}-fu.mjs, scripts/verify-${args.taskId}.mjs
55354
+ T9192 / ADR-070: create the verifier script before using --acceptance-check.
55355
+ `
55356
+ );
55357
+ process.exitCode = 1;
55358
+ return;
55359
+ }
55360
+ const { exitCode, stdout, stderr: stderr2 } = runVerifier(verifierPath);
55361
+ process.stdout.write(stdout);
55362
+ if (stderr2) process.stderr.write(stderr2);
55363
+ if (exitCode !== 0) {
55364
+ process.stderr.write(
55365
+ `
55366
+ E_ACCEPTANCE_VERIFIER_FAILED: verifier exited ${exitCode}.
55367
+ Verifier: ${verifierPath}
55368
+ Gate writes blocked until verifier exits 0. (T9192 / ADR-070)
55369
+ `
55370
+ );
55371
+ process.exitCode = exitCode;
55372
+ return;
55373
+ }
55374
+ process.stdout.write(`Verifier passed (exit 0). Proceeding with gate operation.
55375
+ `);
55376
+ }
55265
55377
  const isWrite = !!(args.gate || args.all || args.reset);
55266
55378
  const useExplain = !isWrite && args.explain === true;
55267
55379
  const operation = isWrite ? "gate.set" : useExplain ? "verify.explain" : "gate.status";
@@ -55293,15 +55405,15 @@ __export(web_exports, {
55293
55405
  });
55294
55406
  import { execFileSync as execFileSync4, spawn } from "node:child_process";
55295
55407
  import { mkdir as mkdir2, open, readFile as readFile5, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
55296
- import { join as join21 } from "node:path";
55408
+ import { join as join23 } from "node:path";
55297
55409
  import { CleoError as CleoError12, formatError as formatError9, getCleoHome as getCleoHome2 } from "@cleocode/core";
55298
55410
  function getWebPaths() {
55299
55411
  const cleoHome = getCleoHome2();
55300
55412
  return {
55301
- pidFile: join21(cleoHome, "web-server.pid"),
55302
- configFile: join21(cleoHome, "web-server.json"),
55303
- logDir: join21(cleoHome, "logs"),
55304
- logFile: join21(cleoHome, "logs", "web-server.log")
55413
+ pidFile: join23(cleoHome, "web-server.pid"),
55414
+ configFile: join23(cleoHome, "web-server.json"),
55415
+ logDir: join23(cleoHome, "logs"),
55416
+ logFile: join23(cleoHome, "logs", "web-server.log")
55305
55417
  };
55306
55418
  }
55307
55419
  function isProcessRunning(pid) {
@@ -55340,7 +55452,7 @@ async function startWebServer(port, host) {
55340
55452
  throw new CleoError12(1 /* GENERAL_ERROR */, `Server already running (PID: ${status.pid})`);
55341
55453
  }
55342
55454
  const projectRoot = process.env["CLEO_ROOT"] ?? process.cwd();
55343
- const studioDir = process.env["CLEO_STUDIO_DIR"] ?? join21(projectRoot, "packages", "studio", "build");
55455
+ const studioDir = process.env["CLEO_STUDIO_DIR"] ?? join23(projectRoot, "packages", "studio", "build");
55344
55456
  await mkdir2(logDir, { recursive: true });
55345
55457
  await writeFile2(
55346
55458
  configFile,
@@ -55350,7 +55462,7 @@ async function startWebServer(port, host) {
55350
55462
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
55351
55463
  })
55352
55464
  );
55353
- const webIndexPath = join21(studioDir, "index.js");
55465
+ const webIndexPath = join23(studioDir, "index.js");
55354
55466
  try {
55355
55467
  await stat(webIndexPath);
55356
55468
  } catch {
@@ -55398,7 +55510,7 @@ Logs: ${logFile}`
55398
55510
  }
55399
55511
  } catch {
55400
55512
  }
55401
- await new Promise((resolve5) => setTimeout(resolve5, 500));
55513
+ await new Promise((resolve7) => setTimeout(resolve7, 500));
55402
55514
  }
55403
55515
  if (!started) {
55404
55516
  try {
@@ -55475,7 +55587,7 @@ var init_web = __esm({
55475
55587
  }
55476
55588
  for (let i = 0; i < 60; i++) {
55477
55589
  if (!isProcessRunning(status.pid)) break;
55478
- await new Promise((resolve5) => setTimeout(resolve5, 500));
55590
+ await new Promise((resolve7) => setTimeout(resolve7, 500));
55479
55591
  }
55480
55592
  if (isProcessRunning(status.pid)) {
55481
55593
  try {
@@ -55527,7 +55639,7 @@ var init_web = __esm({
55527
55639
  }
55528
55640
  for (let i = 0; i < 60; i++) {
55529
55641
  if (!isProcessRunning(status.pid)) break;
55530
- await new Promise((resolve5) => setTimeout(resolve5, 500));
55642
+ await new Promise((resolve7) => setTimeout(resolve7, 500));
55531
55643
  }
55532
55644
  if (isProcessRunning(status.pid)) {
55533
55645
  try {
@@ -55622,7 +55734,7 @@ init_dist();
55622
55734
  init_field_context();
55623
55735
  init_format_context();
55624
55736
  import { readFileSync as readFileSync15 } from "node:fs";
55625
- import { dirname as dirname8, join as join22 } from "node:path";
55737
+ import { dirname as dirname8, join as join24 } from "node:path";
55626
55738
  import { fileURLToPath as fileURLToPath5 } from "node:url";
55627
55739
 
55628
55740
  // packages/cleo/src/cli/generated/command-manifest.ts
@@ -55657,6 +55769,12 @@ var COMMAND_MANIFEST = [
55657
55769
  description: "Manage and validate Architecture Decision Records in .cleo/adrs/",
55658
55770
  load: async () => (await Promise.resolve().then(() => (init_adr(), adr_exports))).adrCommand
55659
55771
  },
55772
+ {
55773
+ exportName: "agentOutputsCommand",
55774
+ name: "agent-outputs",
55775
+ description: "Agent output document management \u2014 find/search via DocsAccessor (find subcommand)",
55776
+ load: async () => (await Promise.resolve().then(() => (init_agent_outputs(), agent_outputs_exports))).agentOutputsCommand
55777
+ },
55660
55778
  {
55661
55779
  exportName: "agentCommand",
55662
55780
  name: "agent",
@@ -55684,7 +55802,7 @@ var COMMAND_MANIFEST = [
55684
55802
  {
55685
55803
  exportName: "auditCommand",
55686
55804
  name: "audit",
55687
- description: "Git-backed audit tooling (lineage reconstruction, integrity checks)",
55805
+ description: "Git-backed audit tooling (lineage reconstruction, integrity checks). ",
55688
55806
  load: async () => (await Promise.resolve().then(() => (init_audit2(), audit_exports))).auditCommand
55689
55807
  },
55690
55808
  {
@@ -55723,12 +55841,6 @@ var COMMAND_MANIFEST = [
55723
55841
  description: "Session resume context: last handoff, current task, next tasks, bugs, blockers, epics, and memory. Use at session start to restore context.",
55724
55842
  load: async () => (await Promise.resolve().then(() => (init_briefing(), briefing_exports))).briefingCommand
55725
55843
  },
55726
- {
55727
- exportName: "bugCommand",
55728
- name: "bug",
55729
- description: "Create a bug report task with severity mapping (requires active session)",
55730
- load: async () => (await Promise.resolve().then(() => (init_bug(), bug_exports))).bugCommand
55731
- },
55732
55844
  {
55733
55845
  exportName: "caampCommand",
55734
55846
  name: "caamp",
@@ -56372,8 +56484,7 @@ var COMMAND_GROUPS = [
56372
56484
  "stop",
56373
56485
  "current",
56374
56486
  "next",
56375
- "exists",
56376
- "bug"
56487
+ "exists"
56377
56488
  ]
56378
56489
  },
56379
56490
  {
@@ -56681,7 +56792,7 @@ Or via NodeSource: https://github.com/nodesource/distributions
56681
56792
  }
56682
56793
  }
56683
56794
  function getPackageVersion() {
56684
- const pkgPath = join22(dirname8(fileURLToPath5(import.meta.url)), "../../package.json");
56795
+ const pkgPath = join24(dirname8(fileURLToPath5(import.meta.url)), "../../package.json");
56685
56796
  const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
56686
56797
  return pkg.version;
56687
56798
  }