@cleocode/cleo 2026.5.124 → 2026.5.126

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
@@ -18713,7 +18713,6 @@ import {
18713
18713
  exportDocument,
18714
18714
  findSimilarDocs,
18715
18715
  generateDocsLlmsTxt,
18716
- getCleoDirAbsolute,
18717
18716
  getProjectRoot as getProjectRoot5,
18718
18717
  isLifecycleStatus,
18719
18718
  listDocVersions,
@@ -18728,6 +18727,8 @@ import {
18728
18727
  releaseReservedSlug,
18729
18728
  reserveSlugForDispatch,
18730
18729
  resolveAttachmentBackend,
18730
+ resolveCanonicalCleoDir,
18731
+ resolveProjectByCwd,
18731
18732
  runDocsImport,
18732
18733
  SlugCollisionError,
18733
18734
  SUPERSEDE_NOT_FOUND_CODE,
@@ -19284,7 +19285,7 @@ var init_docs2 = __esm({
19284
19285
  return lafsError("E_NOT_FOUND", `Attachment not found: ${ref}`, "fetch");
19285
19286
  }
19286
19287
  const cwd = getProjectRoot5();
19287
- const cleoDir = getCleoDirAbsolute(cwd);
19288
+ const cleoDir = resolveCanonicalCleoDir(resolveProjectByCwd(cwd));
19288
19289
  let storagePath;
19289
19290
  if (metadata.attachment.kind === "local-file") {
19290
19291
  storagePath = metadata.attachment.path;
@@ -28848,7 +28849,8 @@ async function orchestrateSpawnOp(params) {
28848
28849
  params.tier,
28849
28850
  params.noWorktree,
28850
28851
  params.spawnScope,
28851
- params.atomicityScope
28852
+ params.atomicityScope,
28853
+ params.resume
28852
28854
  );
28853
28855
  }
28854
28856
  async function orchestrateHandoffOp(params) {
@@ -28928,12 +28930,12 @@ async function orchestrateRejectOp(params) {
28928
28930
  async function orchestrateClassify(request, context, projectRoot) {
28929
28931
  try {
28930
28932
  const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
28931
- const { readFileSync: readFileSync22, readdirSync: readdirSync3, existsSync: existsSync20 } = await import("node:fs");
28933
+ const { readFileSync: readFileSync22, readdirSync: readdirSync3, existsSync: existsSync21 } = await import("node:fs");
28932
28934
  const { join: join38 } = await import("node:path");
28933
28935
  const workflowsDir = getCleoCantWorkflowsDir();
28934
28936
  const combined = `${request} ${context ?? ""}`.toLowerCase();
28935
28937
  const matches = [];
28936
- if (existsSync20(workflowsDir)) {
28938
+ if (existsSync21(workflowsDir)) {
28937
28939
  const files = readdirSync3(workflowsDir).filter((f) => f.endsWith(".cant"));
28938
28940
  for (const file of files) {
28939
28941
  try {
@@ -28953,7 +28955,7 @@ async function orchestrateClassify(request, context, projectRoot) {
28953
28955
  }
28954
28956
  }
28955
28957
  const localCantDir = join38(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
28956
- if (existsSync20(localCantDir)) {
28958
+ if (existsSync21(localCantDir)) {
28957
28959
  const files = readdirSync3(localCantDir).filter((f) => f.endsWith(".cant"));
28958
28960
  for (const file of files) {
28959
28961
  try {
@@ -29149,11 +29151,11 @@ async function orchestrateAnalyzeParallelSafety(taskIds, projectRoot) {
29149
29151
  };
29150
29152
  }
29151
29153
  }
29152
- async function handleWorktreeComplete(taskId, projectRoot, resolve10) {
29154
+ async function handleWorktreeComplete(taskId, projectRoot, resolve11) {
29153
29155
  try {
29154
29156
  const { completeWorktreeForTask } = await import("@cleocode/core/internal");
29155
29157
  const result = completeWorktreeForTask(taskId, projectRoot, {
29156
- resolve: resolve10 ?? "auto"
29158
+ resolve: resolve11 ?? "auto"
29157
29159
  });
29158
29160
  if (result.outcome === "conflict") {
29159
29161
  return {
@@ -29851,10 +29853,10 @@ var init_orchestrate2 = __esm({
29851
29853
  startTime
29852
29854
  );
29853
29855
  const rawResolve = params.resolve;
29854
- const resolve10 = rawResolve === "manual" ? "manual" : rawResolve === "auto" ? "auto" : void 0;
29856
+ const resolve11 = rawResolve === "manual" ? "manual" : rawResolve === "auto" ? "auto" : void 0;
29855
29857
  const p = {
29856
29858
  taskId: params.taskId,
29857
- ...resolve10 !== void 0 ? { resolve: resolve10 } : {}
29859
+ ...resolve11 !== void 0 ? { resolve: resolve11 } : {}
29858
29860
  };
29859
29861
  return wrapResult(
29860
29862
  await coreOps2["worktree.complete"](p),
@@ -35464,7 +35466,7 @@ function wrapParseError(rawInput, parseErr, sourceLabel) {
35464
35466
  return new Error(`Invalid JSON in ${sourceLabel}: ${parseErr.message} (got: ${snippet2})`);
35465
35467
  }
35466
35468
  function readStdinJson(stdin2) {
35467
- return new Promise((resolve10, reject) => {
35469
+ return new Promise((resolve11, reject) => {
35468
35470
  const chunks = [];
35469
35471
  stdin2.on("data", (chunk) => {
35470
35472
  chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
@@ -35475,7 +35477,7 @@ function readStdinJson(stdin2) {
35475
35477
  stdin2.on("end", () => {
35476
35478
  const raw = Buffer.concat(chunks).toString("utf8");
35477
35479
  try {
35478
- resolve10(JSON.parse(raw));
35480
+ resolve11(JSON.parse(raw));
35479
35481
  } catch (err) {
35480
35482
  reject(wrapParseError(raw, err, "stdin"));
35481
35483
  }
@@ -36704,12 +36706,12 @@ var init_agent = __esm({
36704
36706
  transportConfig: {},
36705
36707
  isActive: true
36706
36708
  });
36707
- const { existsSync: existsSync20, mkdirSync: mkdirSync7, writeFileSync: writeFileSync7 } = await import("node:fs");
36709
+ const { existsSync: existsSync21, mkdirSync: mkdirSync7, writeFileSync: writeFileSync7 } = await import("node:fs");
36708
36710
  const { join: join38 } = await import("node:path");
36709
36711
  const cantDir = join38(CLEO_DIR_NAME, AGENTS_SUBDIR);
36710
36712
  const cantPath = join38(cantDir, `${agentId}.cant`);
36711
36713
  let cantScaffolded = false;
36712
- if (!existsSync20(cantPath)) {
36714
+ if (!existsSync21(cantPath)) {
36713
36715
  mkdirSync7(cantDir, { recursive: true });
36714
36716
  const role = classification ?? "specialist";
36715
36717
  const cantContent = `---
@@ -36769,7 +36771,7 @@ agent ${agentId}:
36769
36771
  data: {
36770
36772
  agentId: credential.agentId,
36771
36773
  displayName: credential.displayName,
36772
- cantFile: cantScaffolded ? cantPath : existsSync20(cantPath) ? cantPath : null,
36774
+ cantFile: cantScaffolded ? cantPath : existsSync21(cantPath) ? cantPath : null,
36773
36775
  cantScaffolded
36774
36776
  }
36775
36777
  },
@@ -36888,7 +36890,7 @@ agent ${agentId}:
36888
36890
  try {
36889
36891
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
36890
36892
  const { createRuntime } = await import("@cleocode/runtime");
36891
- const { existsSync: existsSync20, readFileSync: readFileSync22 } = await import("node:fs");
36893
+ const { existsSync: existsSync21, readFileSync: readFileSync22 } = await import("node:fs");
36892
36894
  const { join: join38 } = await import("node:path");
36893
36895
  await openCleoDb("tasks");
36894
36896
  const registry = new AgentRegistryAccessor(getProjectRoot24());
@@ -36910,7 +36912,7 @@ agent ${agentId}:
36910
36912
  let profile = null;
36911
36913
  let cantValidation = null;
36912
36914
  const cantPath = args.cant ?? join38(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
36913
- if (existsSync20(cantPath)) {
36915
+ if (existsSync21(cantPath)) {
36914
36916
  profile = readFileSync22(cantPath, "utf-8");
36915
36917
  try {
36916
36918
  const cantModule = await import("@cleocode/cant");
@@ -37434,7 +37436,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37434
37436
  try {
37435
37437
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
37436
37438
  const { createRuntime } = await import("@cleocode/runtime");
37437
- const { existsSync: existsSync20 } = await import("node:fs");
37439
+ const { existsSync: existsSync21 } = await import("node:fs");
37438
37440
  const { join: join38 } = await import("node:path");
37439
37441
  await openCleoDb("tasks");
37440
37442
  const registry = new AgentRegistryAccessor(getProjectRoot24());
@@ -37453,7 +37455,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37453
37455
  await registry.update(args.agentId, { isActive: true });
37454
37456
  await registry.markUsed(args.agentId);
37455
37457
  const cantPath = join38(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
37456
- const hasProfile = existsSync20(cantPath);
37458
+ const hasProfile = existsSync21(cantPath);
37457
37459
  const runtime = await createRuntime(registry, {
37458
37460
  agentId: args.agentId,
37459
37461
  pollIntervalMs: 5e3,
@@ -38249,10 +38251,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38249
38251
  async run({ args }) {
38250
38252
  let tempDir = null;
38251
38253
  try {
38252
- const { existsSync: existsSync20 } = await import("node:fs");
38253
- const { basename, resolve: resolve10 } = await import("node:path");
38254
- const resolvedPath = resolve10(args.path);
38255
- if (!existsSync20(resolvedPath)) {
38254
+ const { existsSync: existsSync21 } = await import("node:fs");
38255
+ const { basename, resolve: resolve11 } = await import("node:path");
38256
+ const resolvedPath = resolve11(args.path);
38257
+ if (!existsSync21(resolvedPath)) {
38256
38258
  cliOutput(
38257
38259
  {
38258
38260
  success: false,
@@ -38377,11 +38379,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38377
38379
  },
38378
38380
  async run({ args }) {
38379
38381
  try {
38380
- const { existsSync: existsSync20, statSync } = await import("node:fs");
38381
- const { resolve: resolve10, basename, dirname: dirname12 } = await import("node:path");
38382
+ const { existsSync: existsSync21, statSync: statSync2 } = await import("node:fs");
38383
+ const { resolve: resolve11, basename, dirname: dirname12 } = await import("node:path");
38382
38384
  const { execFileSync: execFileSync5 } = await import("node:child_process");
38383
- const resolvedDir = resolve10(args.dir);
38384
- if (!existsSync20(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
38385
+ const resolvedDir = resolve11(args.dir);
38386
+ if (!existsSync21(resolvedDir) || !statSync2(resolvedDir).isDirectory()) {
38385
38387
  cliOutput(
38386
38388
  {
38387
38389
  success: false,
@@ -38397,7 +38399,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38397
38399
  }
38398
38400
  const { join: join38 } = await import("node:path");
38399
38401
  const personaPath = join38(resolvedDir, "persona.cant");
38400
- if (!existsSync20(personaPath)) {
38402
+ if (!existsSync21(personaPath)) {
38401
38403
  cliOutput(
38402
38404
  {
38403
38405
  success: false,
@@ -38413,7 +38415,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38413
38415
  }
38414
38416
  const agentName = basename(resolvedDir);
38415
38417
  const archiveName = `${agentName}.cantz`;
38416
- const archivePath = resolve10(archiveName);
38418
+ const archivePath = resolve11(archiveName);
38417
38419
  const parentDir = dirname12(resolvedDir);
38418
38420
  try {
38419
38421
  execFileSync5("zip", ["-r", archivePath, agentName], {
@@ -38435,7 +38437,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38435
38437
  process.exitCode = 1;
38436
38438
  return;
38437
38439
  }
38438
- const archiveStats = statSync(archivePath);
38440
+ const archiveStats = statSync2(archivePath);
38439
38441
  const { readdirSync: readdirSync3 } = await import("node:fs");
38440
38442
  let fileCount = 0;
38441
38443
  const countFiles = (dirPath) => {
@@ -38692,17 +38694,17 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38692
38694
  },
38693
38695
  async run({ args }) {
38694
38696
  try {
38695
- const { existsSync: existsSync20, readFileSync: readFileSync22, mkdirSync: mkdirSync7 } = await import("node:fs");
38696
- const { resolve: resolve10, join: join38 } = await import("node:path");
38697
- const specPath = resolve10(args.spec);
38698
- if (!existsSync20(specPath)) {
38697
+ const { existsSync: existsSync21, readFileSync: readFileSync22, mkdirSync: mkdirSync7 } = await import("node:fs");
38698
+ const { resolve: resolve11, join: join38 } = await import("node:path");
38699
+ const specPath = resolve11(args.spec);
38700
+ if (!existsSync21(specPath)) {
38699
38701
  cliError(`spec file not found: ${specPath}`, 4, { name: "E_NOT_FOUND" });
38700
38702
  process.exitCode = 4;
38701
38703
  return;
38702
38704
  }
38703
38705
  const specContent = readFileSync22(specPath, "utf-8");
38704
38706
  const projectRoot = getProjectRoot24();
38705
- const outputDir = args["output-dir"] ? resolve10(args["output-dir"]) : join38(projectRoot, ".cleo", "cant", "agents");
38707
+ const outputDir = args["output-dir"] ? resolve11(args["output-dir"]) : join38(projectRoot, ".cleo", "cant", "agents");
38706
38708
  mkdirSync7(outputDir, { recursive: true });
38707
38709
  if (args["dry-run"]) {
38708
38710
  cliOutput(
@@ -39453,8 +39455,8 @@ function detectAuthType(provider, token) {
39453
39455
  async function promptYesNo(question) {
39454
39456
  const rl = createInterface({ input: process.stdin, output: process.stderr });
39455
39457
  try {
39456
- const answer = await new Promise((resolve10) => {
39457
- rl.question(question, (a) => resolve10(a));
39458
+ const answer = await new Promise((resolve11) => {
39459
+ rl.question(question, (a) => resolve11(a));
39458
39460
  });
39459
39461
  const clean = answer.trim().toLowerCase();
39460
39462
  return clean === "y" || clean === "yes";
@@ -40390,12 +40392,12 @@ async function promptPassphrase() {
40390
40392
  "Cannot prompt for passphrase: stdin is not a TTY. Set the CLEO_BACKUP_PASSPHRASE environment variable for non-interactive use."
40391
40393
  );
40392
40394
  }
40393
- return new Promise((resolve10) => {
40395
+ return new Promise((resolve11) => {
40394
40396
  process.stdout.write("Passphrase: ");
40395
40397
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
40396
40398
  rl.question("", (answer) => {
40397
40399
  rl.close();
40398
- resolve10(answer.trim());
40400
+ resolve11(answer.trim());
40399
40401
  });
40400
40402
  });
40401
40403
  }
@@ -41505,11 +41507,11 @@ var init_caamp = __esm({
41505
41507
  }
41506
41508
  if (args["dry-run"]) {
41507
41509
  const { parseCaampBlocks } = await import("@cleocode/caamp");
41508
- const { existsSync: existsSync20 } = await import("node:fs");
41510
+ const { existsSync: existsSync21 } = await import("node:fs");
41509
41511
  const { readFile: readFile9 } = await import("node:fs/promises");
41510
41512
  const dryResults = [];
41511
41513
  for (const filePath of filePaths) {
41512
- if (!existsSync20(filePath)) {
41514
+ if (!existsSync21(filePath)) {
41513
41515
  dryResults.push({ filePath, exists: false, blockCount: 0, wouldRemove: 0 });
41514
41516
  continue;
41515
41517
  }
@@ -42603,11 +42605,11 @@ var init_check2 = __esm({
42603
42605
  },
42604
42606
  async run({ args }) {
42605
42607
  const { spawnSync } = await import("node:child_process");
42606
- const { existsSync: existsSync20 } = await import("node:fs");
42607
- const { join: join38, resolve: resolve10 } = await import("node:path");
42608
+ const { existsSync: existsSync21 } = await import("node:fs");
42609
+ const { join: join38, resolve: resolve11 } = await import("node:path");
42608
42610
  const strict = Boolean(args.strict);
42609
42611
  const jsonOnly = Boolean(args.json);
42610
- const repoRoot = resolve10(process.cwd());
42612
+ const repoRoot = resolve11(process.cwd());
42611
42613
  const gates = [
42612
42614
  {
42613
42615
  id: "gate-1",
@@ -42645,7 +42647,7 @@ var init_check2 = __esm({
42645
42647
  let anyFailed = false;
42646
42648
  for (const gate of gates) {
42647
42649
  const scriptPath = join38(repoRoot, gate.script);
42648
- if (!existsSync20(scriptPath)) {
42650
+ if (!existsSync21(scriptPath)) {
42649
42651
  results.push({
42650
42652
  id: gate.id,
42651
42653
  task: gate.task,
@@ -54325,7 +54327,7 @@ async function _headlessPkceFlow(provider, authUrl) {
54325
54327
  ` After approving, paste the full redirect URL (http://localhost?code=\u2026&state=\u2026):
54326
54328
  `
54327
54329
  );
54328
- return new Promise((resolve10, reject) => {
54330
+ return new Promise((resolve11, reject) => {
54329
54331
  let buf = "";
54330
54332
  process.stdin.setEncoding("utf8");
54331
54333
  process.stdin.once("data", (chunk) => {
@@ -54337,7 +54339,7 @@ async function _headlessPkceFlow(provider, authUrl) {
54337
54339
  reject(new Error('Redirect URL is missing the "code" parameter'));
54338
54340
  return;
54339
54341
  }
54340
- resolve10(code);
54342
+ resolve11(code);
54341
54343
  } catch {
54342
54344
  reject(new Error(`Invalid redirect URL: ${buf}`));
54343
54345
  }
@@ -54345,7 +54347,7 @@ async function _headlessPkceFlow(provider, authUrl) {
54345
54347
  });
54346
54348
  }
54347
54349
  async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
54348
- return new Promise((resolve10) => {
54350
+ return new Promise((resolve11) => {
54349
54351
  const server = createServer2((req, res) => {
54350
54352
  const url = new URL(req.url ?? "/", `http://localhost:${port}`);
54351
54353
  const code = url.searchParams.get("code");
@@ -54355,7 +54357,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
54355
54357
  if (error) {
54356
54358
  res.end(`<h1>Authorization failed</h1><p>${error}</p><p>You may close this tab.</p>`);
54357
54359
  server.close();
54358
- resolve10({
54360
+ resolve11({
54359
54361
  error: {
54360
54362
  code: "E_PKCE_AUTH_DENIED",
54361
54363
  codeName: "E_PKCE_AUTH_DENIED",
@@ -54367,7 +54369,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
54367
54369
  if (!code || state !== expectedState) {
54368
54370
  res.end("<h1>Invalid callback</h1><p>You may close this tab.</p>");
54369
54371
  server.close();
54370
- resolve10({
54372
+ resolve11({
54371
54373
  error: {
54372
54374
  code: "E_PKCE_INVALID_CALLBACK",
54373
54375
  codeName: "E_PKCE_INVALID_CALLBACK",
@@ -54378,7 +54380,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
54378
54380
  }
54379
54381
  res.end("<h1>Authorized</h1><p>You may close this tab and return to your terminal.</p>");
54380
54382
  server.close();
54381
- resolve10({ code });
54383
+ resolve11({ code });
54382
54384
  });
54383
54385
  server.listen(port, "localhost", () => {
54384
54386
  process.stderr.write("\n");
@@ -54511,7 +54513,7 @@ function _generateState() {
54511
54513
  return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
54512
54514
  }
54513
54515
  function _findFreePort() {
54514
- return new Promise((resolve10, reject) => {
54516
+ return new Promise((resolve11, reject) => {
54515
54517
  const srv = createServer2();
54516
54518
  srv.listen(0, "localhost", () => {
54517
54519
  const addr = srv.address();
@@ -54521,7 +54523,7 @@ function _findFreePort() {
54521
54523
  return;
54522
54524
  }
54523
54525
  const port = addr.port;
54524
- srv.close(() => resolve10(port));
54526
+ srv.close(() => resolve11(port));
54525
54527
  });
54526
54528
  srv.on("error", reject);
54527
54529
  });
@@ -55143,14 +55145,14 @@ async function readStdin() {
55143
55145
  if (process.stdin.isTTY) {
55144
55146
  return "";
55145
55147
  }
55146
- return new Promise((resolve10, reject) => {
55148
+ return new Promise((resolve11, reject) => {
55147
55149
  let data = "";
55148
55150
  process.stdin.setEncoding("utf-8");
55149
55151
  process.stdin.on("data", (chunk) => {
55150
55152
  data += chunk;
55151
55153
  });
55152
55154
  process.stdin.on("end", () => {
55153
- resolve10(data.trim());
55155
+ resolve11(data.trim());
55154
55156
  });
55155
55157
  process.stdin.on("error", reject);
55156
55158
  });
@@ -58719,13 +58721,13 @@ var init_nexus3 = __esm({
58719
58721
  if (!skipPrompt) {
58720
58722
  const { createInterface: createInterface5 } = await import("node:readline");
58721
58723
  const rl = createInterface5({ input: process.stdin, output: process.stdout });
58722
- const confirmed = await new Promise((resolve10) => {
58724
+ const confirmed = await new Promise((resolve11) => {
58723
58725
  rl.question(
58724
58726
  `
58725
58727
  [nexus] Delete ${matchCount} project(s) from the registry? [y/N] `,
58726
58728
  (answer) => {
58727
58729
  rl.close();
58728
- resolve10(answer.trim().toLowerCase() === "y");
58730
+ resolve11(answer.trim().toLowerCase() === "y");
58729
58731
  }
58730
58732
  );
58731
58733
  });
@@ -60376,6 +60378,10 @@ var init_orchestrate3 = __esm({
60376
60378
  "orchestrator-defer": {
60377
60379
  type: "boolean",
60378
60380
  description: "T9214 atomicity waiver: defer worker file-scope declaration to commit time. Tier-1+ orchestrators only \u2014 records auditable atomicity_waiver in the spawn manifest. Bypasses E_ATOMICITY_NO_SCOPE for worker tasks without explicit AC.files."
60381
+ },
60382
+ resume: {
60383
+ type: "boolean",
60384
+ description: "T10078 \u2014 skip worktree provisioning and attach to an existing locked worktree at the canonical XDG path. If the worktree does not exist, returns E_RESUME_WORKTREE_MISSING. Use after a prior aborted spawn left a worktree behind."
60379
60385
  }
60380
60386
  },
60381
60387
  async run({ args }) {
@@ -60397,7 +60403,8 @@ var init_orchestrate3 = __esm({
60397
60403
  tier,
60398
60404
  noWorktree: args["no-worktree"] === true,
60399
60405
  ...args.scope ? { spawnScope: args.scope } : {},
60400
- ...atomicityScope ? { atomicityScope } : {}
60406
+ ...atomicityScope ? { atomicityScope } : {},
60407
+ resume: args.resume === true
60401
60408
  },
60402
60409
  { command: "orchestrate" }
60403
60410
  );
@@ -61675,6 +61682,181 @@ var init_playbook3 = __esm({
61675
61682
  }
61676
61683
  });
61677
61684
 
61685
+ // packages/cleo/src/cli/commands/project.ts
61686
+ var project_exports = {};
61687
+ __export(project_exports, {
61688
+ projectCommand: () => projectCommand
61689
+ });
61690
+ import { existsSync as existsSync16, statSync } from "node:fs";
61691
+ import { resolve as resolve7 } from "node:path";
61692
+ import { moveProject, projectLifecycle, renameProject } from "@cleocode/core";
61693
+ function formatSuccessSection(header, icon, items) {
61694
+ const prefix = icon ? `${icon} ` : "";
61695
+ return { kind: "section", data: { header: `${prefix}${header}`, items } };
61696
+ }
61697
+ function formatErrorSection(code, message, details) {
61698
+ const items = [message];
61699
+ if (details) {
61700
+ for (const [key, value] of Object.entries(details)) {
61701
+ if (value !== void 0 && value !== null) {
61702
+ items.push(`${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`);
61703
+ }
61704
+ }
61705
+ }
61706
+ return { kind: "section", data: { header: `Error: ${code}`, items } };
61707
+ }
61708
+ var moveSubCommand, renameSubCommand, reregisterSubCommand, projectCommand;
61709
+ var init_project = __esm({
61710
+ "packages/cleo/src/cli/commands/project.ts"() {
61711
+ "use strict";
61712
+ init_dist();
61713
+ init_renderers();
61714
+ moveSubCommand = defineCommand({
61715
+ meta: { name: "move", description: "Move a CLEO project to a new directory." },
61716
+ args: {
61717
+ newPath: {
61718
+ type: "positional",
61719
+ description: "New absolute path for the project root.",
61720
+ required: true
61721
+ },
61722
+ "dry-run": {
61723
+ type: "boolean",
61724
+ description: "Compute the plan without executing.",
61725
+ default: false
61726
+ },
61727
+ json: { type: "boolean", description: "Output raw JSON envelope.", default: false }
61728
+ },
61729
+ async run({ args }) {
61730
+ const newPathRaw = args["newPath"];
61731
+ const dryRun = args["dry-run"] ?? false;
61732
+ const newPath = resolve7(newPathRaw);
61733
+ if (!dryRun && existsSync16(newPath) && statSync(newPath).isFile()) {
61734
+ cliOutput(formatErrorSection("E_INVALID_PATH", `newPath is not a directory: ${newPath}`), {
61735
+ command: "project",
61736
+ operation: "project.move"
61737
+ });
61738
+ process.exit(1);
61739
+ }
61740
+ const result = await moveProject(newPath, process.cwd());
61741
+ if (result.success) {
61742
+ const r = result.data;
61743
+ cliOutput(
61744
+ formatSuccessSection("Project Moved", "\u2705", [
61745
+ `Project ID: ${r.projectId}`,
61746
+ `Old path: ${r.oldPath}`,
61747
+ `New path: ${r.newPath}`,
61748
+ `New hash: ${r.newProjectHash}`,
61749
+ `Registry: ${r.reconcileStatus}`
61750
+ ]),
61751
+ { command: "project", operation: "project.move" }
61752
+ );
61753
+ } else {
61754
+ cliOutput(
61755
+ formatErrorSection(result.error.code, result.error.message, { fix: result.error.fix }),
61756
+ { command: "project", operation: "project.move" }
61757
+ );
61758
+ process.exit(1);
61759
+ }
61760
+ }
61761
+ });
61762
+ renameSubCommand = defineCommand({
61763
+ meta: { name: "rename", description: "Rename this project." },
61764
+ args: {
61765
+ newName: { type: "positional", description: "New project name.", required: true },
61766
+ "dry-run": { type: "boolean", description: "Validate without applying.", default: false },
61767
+ json: { type: "boolean", description: "Output raw JSON envelope.", default: false }
61768
+ },
61769
+ async run({ args }) {
61770
+ const newName = args["newName"];
61771
+ const dryRun = args["dry-run"] ?? false;
61772
+ const nameRe = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,99}$/;
61773
+ if (!newName || !nameRe.test(newName)) {
61774
+ cliOutput(formatErrorSection("E_VALIDATION", `Invalid project name: "${newName}".`), {
61775
+ command: "project",
61776
+ operation: "project.rename"
61777
+ });
61778
+ process.exit(2);
61779
+ }
61780
+ if (dryRun) {
61781
+ cliOutput(
61782
+ formatSuccessSection("Dry Run", void 0, [
61783
+ `Would rename project to "${newName}".`,
61784
+ "Run without --dry-run to apply."
61785
+ ]),
61786
+ { command: "project", operation: "project.rename" }
61787
+ );
61788
+ return;
61789
+ }
61790
+ const result = await renameProject(newName, process.cwd());
61791
+ if (result.success) {
61792
+ const r = result.data;
61793
+ cliOutput(
61794
+ formatSuccessSection("Project Renamed", "\u2705", [
61795
+ `Project ID: ${r.projectId}`,
61796
+ `Old name: ${r.oldName}`,
61797
+ `New name: ${r.newName}`,
61798
+ `Project hash: ${r.newProjectHash}`
61799
+ ]),
61800
+ { command: "project", operation: "project.rename" }
61801
+ );
61802
+ } else {
61803
+ cliOutput(
61804
+ formatErrorSection(result.error.code, result.error.message, { fix: result.error.fix }),
61805
+ { command: "project", operation: "project.rename" }
61806
+ );
61807
+ process.exit(1);
61808
+ }
61809
+ }
61810
+ });
61811
+ reregisterSubCommand = defineCommand({
61812
+ meta: { name: "re-register", description: "Re-register project with NEXUS." },
61813
+ args: {
61814
+ fix: { type: "boolean", description: "Auto-heal path_updated drift.", default: false },
61815
+ json: { type: "boolean", description: "Output raw JSON envelope.", default: false }
61816
+ },
61817
+ async run() {
61818
+ const result = await projectLifecycle.reregisterProject(process.cwd());
61819
+ if (result.success) {
61820
+ const r = result.data;
61821
+ const icon = r.drifted ? "\u26A0\uFE0F" : "\u2705";
61822
+ const items = [
61823
+ `Project ID: ${r.projectId}`,
61824
+ `Project root: ${r.projectRoot}`,
61825
+ `Hash: ${r.projectHash}`,
61826
+ `Status: ${r.reconcileStatus}`
61827
+ ];
61828
+ if (r.drifted && r.oldPath) items.push(`Old path: ${r.oldPath}`);
61829
+ cliOutput(
61830
+ formatSuccessSection(
61831
+ r.drifted ? "Project Re-registered (Drift Detected)" : "Project Re-registered",
61832
+ icon,
61833
+ items
61834
+ ),
61835
+ { command: "project", operation: "project.re-register" }
61836
+ );
61837
+ } else {
61838
+ cliOutput(
61839
+ formatErrorSection(result.error.code, result.error.message, { fix: result.error.fix }),
61840
+ { command: "project", operation: "project.re-register" }
61841
+ );
61842
+ process.exit(1);
61843
+ }
61844
+ }
61845
+ });
61846
+ projectCommand = defineCommand({
61847
+ meta: {
61848
+ name: "project",
61849
+ description: "Project lifecycle management (move, rename, re-register)."
61850
+ },
61851
+ subCommands: {
61852
+ move: moveSubCommand,
61853
+ rename: renameSubCommand,
61854
+ "re-register": reregisterSubCommand
61855
+ }
61856
+ });
61857
+ }
61858
+ });
61859
+
61678
61860
  // packages/cleo/src/cli/commands/promote.ts
61679
61861
  var promote_exports = {};
61680
61862
  __export(promote_exports, {
@@ -62320,13 +62502,13 @@ var init_relates = __esm({
62320
62502
  }
62321
62503
  },
62322
62504
  async run({ args }) {
62323
- const input2 = args.file === "-" ? await new Promise((resolve10, reject) => {
62505
+ const input2 = args.file === "-" ? await new Promise((resolve11, reject) => {
62324
62506
  let data = "";
62325
62507
  process.stdin.setEncoding("utf8");
62326
62508
  process.stdin.on("data", (chunk) => {
62327
62509
  data += chunk;
62328
62510
  });
62329
- process.stdin.on("end", () => resolve10(data));
62511
+ process.stdin.on("end", () => resolve11(data));
62330
62512
  process.stdin.on("error", reject);
62331
62513
  }) : await readFile5(args.file, "utf8");
62332
62514
  const parsed = JSON.parse(input2);
@@ -64958,11 +65140,11 @@ async function runPostUpdateDiagnostics(opts) {
64958
65140
  input: process.stdin,
64959
65141
  output: process.stdout
64960
65142
  });
64961
- shouldMigrate = await new Promise((resolve10) => {
65143
+ shouldMigrate = await new Promise((resolve11) => {
64962
65144
  rl.question(" Do you want to run the upgrade now? [Y/n] ", (answer) => {
64963
65145
  rl.close();
64964
65146
  const clean = answer.trim().toLowerCase();
64965
- resolve10(clean === "" || clean === "y" || clean === "yes");
65147
+ resolve11(clean === "" || clean === "y" || clean === "yes");
64966
65148
  });
64967
65149
  });
64968
65150
  }
@@ -66489,7 +66671,7 @@ async function promptOwnerAuthPassword(sessionName) {
66489
66671
  terminal: true
66490
66672
  });
66491
66673
  process.stderr.write(`[cleo] Enter owner-auth password for session "${sessionName}": `);
66492
- const password = await new Promise((resolve10) => {
66674
+ const password = await new Promise((resolve11) => {
66493
66675
  if (process.stdin.setRawMode) {
66494
66676
  process.stdin.setRawMode(
66495
66677
  true
@@ -66507,10 +66689,10 @@ async function promptOwnerAuthPassword(sessionName) {
66507
66689
  );
66508
66690
  }
66509
66691
  process.stderr.write("\n");
66510
- resolve10(pw);
66692
+ resolve11(pw);
66511
66693
  } else if (ch === "") {
66512
66694
  process.stderr.write("\n[cleo] Cancelled.\n");
66513
- resolve10("");
66695
+ resolve11("");
66514
66696
  } else if (ch === "\x7F" || ch === "\b") {
66515
66697
  pw = pw.slice(0, -1);
66516
66698
  } else {
@@ -69587,12 +69769,12 @@ var init_telemetry2 = __esm({
69587
69769
 
69588
69770
  // packages/cleo/src/cli/commands/templates/lib.ts
69589
69771
  import { readFileSync as readFileSync15 } from "node:fs";
69590
- import { isAbsolute as isAbsolute3, resolve as resolve7 } from "node:path";
69772
+ import { isAbsolute as isAbsolute3, resolve as resolve8 } from "node:path";
69591
69773
  import { getProjectRoot as getProjectRoot52 } from "@cleocode/core";
69592
69774
  import { resolveSourcePathAbsolute } from "@cleocode/core/templates/registry";
69593
69775
  function resolveProjectRoot6(raw) {
69594
69776
  if (typeof raw === "string" && raw.length > 0) {
69595
- return isAbsolute3(raw) ? raw : resolve7(process.cwd(), raw);
69777
+ return isAbsolute3(raw) ? raw : resolve8(process.cwd(), raw);
69596
69778
  }
69597
69779
  return getProjectRoot52();
69598
69780
  }
@@ -69613,7 +69795,7 @@ var init_lib = __esm({
69613
69795
  });
69614
69796
 
69615
69797
  // packages/cleo/src/cli/commands/templates/diff.ts
69616
- import { existsSync as existsSync16, readFileSync as readFileSync16 } from "node:fs";
69798
+ import { existsSync as existsSync17, readFileSync as readFileSync16 } from "node:fs";
69617
69799
  import { join as join31 } from "node:path";
69618
69800
  import { getTemplateById } from "@cleocode/core/templates/registry";
69619
69801
  function unifiedDiff(a, b) {
@@ -69695,7 +69877,7 @@ var init_diff = __esm({
69695
69877
  process.exit(1 /* GENERAL_ERROR */);
69696
69878
  return;
69697
69879
  }
69698
- if (!existsSync16(installPath)) {
69880
+ if (!existsSync17(installPath)) {
69699
69881
  const missingResult = {
69700
69882
  id,
69701
69883
  installPath,
@@ -69734,7 +69916,7 @@ ${unifiedDiff("", rendered)}`
69734
69916
  });
69735
69917
 
69736
69918
  // packages/cleo/src/cli/commands/templates/install.ts
69737
- import { existsSync as existsSync17, mkdirSync as mkdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync5 } from "node:fs";
69919
+ import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync5 } from "node:fs";
69738
69920
  import { dirname as dirname9, join as join32 } from "node:path";
69739
69921
  import { getTemplateById as getTemplateById2 } from "@cleocode/core/templates/registry";
69740
69922
  var templatesInstallCommand;
@@ -69802,7 +69984,7 @@ var init_install = __esm({
69802
69984
  process.exit(1 /* GENERAL_ERROR */);
69803
69985
  return;
69804
69986
  }
69805
- if (existsSync17(installPath)) {
69987
+ if (existsSync18(installPath)) {
69806
69988
  const current = readFileSync17(installPath, "utf8");
69807
69989
  if (current === rendered) {
69808
69990
  const noopResult = {
@@ -69951,7 +70133,7 @@ var init_show3 = __esm({
69951
70133
  });
69952
70134
 
69953
70135
  // packages/cleo/src/cli/commands/templates/upgrade.ts
69954
- import { existsSync as existsSync18, mkdirSync as mkdirSync6, readFileSync as readFileSync18, writeFileSync as writeFileSync6 } from "node:fs";
70136
+ import { existsSync as existsSync19, mkdirSync as mkdirSync6, readFileSync as readFileSync18, writeFileSync as writeFileSync6 } from "node:fs";
69955
70137
  import { dirname as dirname10, join as join33 } from "node:path";
69956
70138
  import { getTemplateById as getTemplateById4 } from "@cleocode/core/templates/registry";
69957
70139
  var templatesUpgradeCommand;
@@ -70027,7 +70209,7 @@ var init_upgrade2 = __esm({
70027
70209
  }
70028
70210
  const previewOnly = args["diff"] === true;
70029
70211
  const accept = args["accept"] === true;
70030
- const current = existsSync18(installPath) ? readFileSync18(installPath, "utf8") : null;
70212
+ const current = existsSync19(installPath) ? readFileSync18(installPath, "utf8") : null;
70031
70213
  const diffBody = current === null ? "" : current === rendered ? "" : unifiedDiff(current, rendered);
70032
70214
  let outcome;
70033
70215
  let reason;
@@ -71469,7 +71651,7 @@ var upgrade_exports = {};
71469
71651
  __export(upgrade_exports, {
71470
71652
  upgradeCommand: () => upgradeCommand
71471
71653
  });
71472
- import { resolve as resolve8 } from "node:path";
71654
+ import { resolve as resolve9 } from "node:path";
71473
71655
  import { CleoError as CleoError10, diagnoseUpgrade, runUpgrade as runUpgrade2, upgradeWorkflows as upgradeWorkflows2 } from "@cleocode/core/internal";
71474
71656
  var workflowsSubcommand, upgradeCommand;
71475
71657
  var init_upgrade3 = __esm({
@@ -71509,7 +71691,7 @@ var init_upgrade3 = __esm({
71509
71691
  const dryRun = args["dry-run"] === true || args.check === true;
71510
71692
  const force = args.force === true && !dryRun;
71511
71693
  const result = await upgradeWorkflows2({
71512
- projectRoot: resolve8(process.cwd()),
71694
+ projectRoot: resolve9(process.cwd()),
71513
71695
  templatesDir: getWorkflowTemplatesDir2(),
71514
71696
  dryRun,
71515
71697
  force
@@ -71875,7 +72057,7 @@ Logs: ${logFile}`
71875
72057
  }
71876
72058
  } catch {
71877
72059
  }
71878
- await new Promise((resolve10) => setTimeout(resolve10, 500));
72060
+ await new Promise((resolve11) => setTimeout(resolve11, 500));
71879
72061
  }
71880
72062
  if (!started) {
71881
72063
  try {
@@ -71952,7 +72134,7 @@ var init_web = __esm({
71952
72134
  }
71953
72135
  for (let i = 0; i < 60; i++) {
71954
72136
  if (!isProcessRunning(status.pid)) break;
71955
- await new Promise((resolve10) => setTimeout(resolve10, 500));
72137
+ await new Promise((resolve11) => setTimeout(resolve11, 500));
71956
72138
  }
71957
72139
  if (isProcessRunning(status.pid)) {
71958
72140
  try {
@@ -72004,7 +72186,7 @@ var init_web = __esm({
72004
72186
  }
72005
72187
  for (let i = 0; i < 60; i++) {
72006
72188
  if (!isProcessRunning(status.pid)) break;
72007
- await new Promise((resolve10) => setTimeout(resolve10, 500));
72189
+ await new Promise((resolve11) => setTimeout(resolve11, 500));
72008
72190
  }
72009
72191
  if (isProcessRunning(status.pid)) {
72010
72192
  try {
@@ -72100,7 +72282,7 @@ __export(workgraph_exports, {
72100
72282
  workgraphCommand: () => workgraphCommand
72101
72283
  });
72102
72284
  import { readFileSync as readFileSync20 } from "node:fs";
72103
- import { resolve as resolve9 } from "node:path";
72285
+ import { resolve as resolve10 } from "node:path";
72104
72286
  var validateCommand10, applyCommand, planCommand4, structureCommand, workgraphCommand;
72105
72287
  var init_workgraph2 = __esm({
72106
72288
  "packages/cleo/src/cli/commands/workgraph.ts"() {
@@ -72121,7 +72303,7 @@ var init_workgraph2 = __esm({
72121
72303
  async run({ args }) {
72122
72304
  const { validateWorkGraphScaffold } = await import("@cleocode/core/workgraph");
72123
72305
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
72124
- const filePath = resolve9(String(args.file));
72306
+ const filePath = resolve10(String(args.file));
72125
72307
  let raw;
72126
72308
  try {
72127
72309
  raw = readFileSync20(filePath, "utf-8");
@@ -72166,7 +72348,7 @@ var init_workgraph2 = __esm({
72166
72348
  async run({ args }) {
72167
72349
  const { applyWorkGraphScaffold } = await import("@cleocode/core/workgraph");
72168
72350
  const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
72169
- const filePath = resolve9(String(args.file));
72351
+ const filePath = resolve10(String(args.file));
72170
72352
  let raw;
72171
72353
  try {
72172
72354
  raw = readFileSync20(filePath, "utf-8");
@@ -72273,12 +72455,12 @@ __export(worktree_exports, {
72273
72455
  import readline4 from "node:readline";
72274
72456
  import { getProjectRoot as getProjectRoot55, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
72275
72457
  async function promptYesNo2(question) {
72276
- return new Promise((resolve10) => {
72458
+ return new Promise((resolve11) => {
72277
72459
  const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
72278
72460
  rl.question(`${question} [y/N]: `, (answer) => {
72279
72461
  rl.close();
72280
72462
  const trimmed = answer.trim().toLowerCase();
72281
- resolve10(trimmed === "y" || trimmed === "yes");
72463
+ resolve11(trimmed === "y" || trimmed === "yes");
72282
72464
  });
72283
72465
  });
72284
72466
  }
@@ -73199,6 +73381,12 @@ var COMMAND_MANIFEST = [
73199
73381
  description: "Playbook runtime operations (run, status, resume, list, create, validate)",
73200
73382
  load: async () => (await Promise.resolve().then(() => (init_playbook3(), playbook_exports))).playbookCommand
73201
73383
  },
73384
+ {
73385
+ exportName: "projectCommand",
73386
+ name: "project",
73387
+ description: "Project lifecycle management (move, rename, re-register).",
73388
+ load: async () => (await Promise.resolve().then(() => (init_project(), project_exports))).projectCommand
73389
+ },
73202
73390
  {
73203
73391
  exportName: "promoteCommand",
73204
73392
  name: "promote",
@@ -73653,14 +73841,14 @@ function lazyCommand(meta, loader2) {
73653
73841
  init_did_you_mean();
73654
73842
 
73655
73843
  // packages/cleo/src/cli/lib/first-run-detection.ts
73656
- import { existsSync as existsSync19 } from "node:fs";
73844
+ import { existsSync as existsSync20 } from "node:fs";
73657
73845
  import { join as join36 } from "node:path";
73658
73846
  async function detectFirstRun() {
73659
73847
  const envKey = process.env["ANTHROPIC_API_KEY"];
73660
73848
  if (typeof envKey === "string" && envKey.length > 0) return false;
73661
73849
  const { getCleoPlatformPaths } = await import("@cleocode/paths");
73662
73850
  const configPath = join36(getCleoPlatformPaths().config, "config.json");
73663
- if (existsSync19(configPath)) return false;
73851
+ if (existsSync20(configPath)) return false;
73664
73852
  try {
73665
73853
  const { getCredentialPool } = await import("@cleocode/core/llm/credential-pool.js");
73666
73854
  const pool = getCredentialPool();
@@ -73671,7 +73859,7 @@ async function detectFirstRun() {
73671
73859
  return true;
73672
73860
  }
73673
73861
  function waitForEnterOrTimeout(timeoutMs) {
73674
- return new Promise((resolve10) => {
73862
+ return new Promise((resolve11) => {
73675
73863
  let resolved = false;
73676
73864
  const finish = () => {
73677
73865
  if (resolved) return;
@@ -73683,7 +73871,7 @@ function waitForEnterOrTimeout(timeoutMs) {
73683
73871
  process.stdin.pause();
73684
73872
  } catch {
73685
73873
  }
73686
- resolve10();
73874
+ resolve11();
73687
73875
  };
73688
73876
  const onData = (chunk) => {
73689
73877
  const s = typeof chunk === "string" ? chunk : chunk.toString("utf8");