@cleocode/cleo 2026.5.82 → 2026.5.84

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
@@ -268,16 +268,6 @@ async function runCommand(cmd, opts) {
268
268
  }
269
269
  return { result };
270
270
  }
271
- async function resolveSubCommand(cmd, rawArgs, parent) {
272
- const subCommands2 = await resolveValue(cmd.subCommands);
273
- if (subCommands2 && Object.keys(subCommands2).length > 0) {
274
- const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
275
- const subCommandName = rawArgs[subCommandArgIndex];
276
- const subCommand = await resolveValue(subCommands2[subCommandName]);
277
- if (subCommand) return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
278
- }
279
- return [cmd, parent];
280
- }
281
271
  async function showUsage(cmd, parent) {
282
272
  try {
283
273
  console.log(await renderUsage(cmd, parent) + "\n");
@@ -347,26 +337,6 @@ async function renderUsage(cmd, parent) {
347
337
  }
348
338
  return usageLines.filter((l) => typeof l === "string").join("\n");
349
339
  }
350
- async function runMain(cmd, opts = {}) {
351
- const rawArgs = opts.rawArgs || process.argv.slice(2);
352
- const showUsage$1 = opts.showUsage || showUsage;
353
- try {
354
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
355
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
356
- process.exit(0);
357
- } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
358
- const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
359
- if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
360
- console.log(meta.version);
361
- } else await runCommand(cmd, { rawArgs });
362
- } catch (error) {
363
- if (error instanceof CLIError) {
364
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
365
- console.error(error.message);
366
- } else console.error(error, "\n");
367
- process.exit(1);
368
- }
369
- }
370
340
  var CLIError, noColor, _c, bold, cyan, gray, underline, negativePrefixRe;
371
341
  var init_dist = __esm({
372
342
  "node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/index.mjs"() {
@@ -9063,6 +9033,25 @@ var init_registry = __esm({
9063
9033
  }
9064
9034
  ]
9065
9035
  },
9036
+ {
9037
+ gateway: "query",
9038
+ domain: "pipeline",
9039
+ operation: "release.pr-status",
9040
+ description: "Poll GitHub CI check statuses for the open release PR matching release/v<version> (T9095)",
9041
+ tier: 1,
9042
+ idempotent: true,
9043
+ sessionRequired: false,
9044
+ requiredParams: ["version"],
9045
+ params: [
9046
+ {
9047
+ name: "version",
9048
+ type: "string",
9049
+ required: true,
9050
+ description: "Release version (e.g. 2026.5.43 or v2026.5.43)",
9051
+ cli: { positional: true }
9052
+ }
9053
+ ]
9054
+ },
9066
9055
  // release.prepare/changelog/commit/tag/push/gates.run removed — merged into release.ship via step param (T5615)
9067
9056
  {
9068
9057
  gateway: "mutate",
@@ -27375,6 +27364,7 @@ var init_pipeline3 = __esm({
27375
27364
  "release.show",
27376
27365
  "release.channel.show",
27377
27366
  "release.changelog.since",
27367
+ "release.pr-status",
27378
27368
  "phase.show",
27379
27369
  "phase.list",
27380
27370
  "chain.show",
@@ -34778,7 +34768,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
34778
34768
  try {
34779
34769
  const { existsSync: existsSync17, mkdirSync: mkdirSync7, writeFileSync: writeFileSync7 } = await import("node:fs");
34780
34770
  const { join: join29 } = await import("node:path");
34781
- const { homedir: homedir10 } = await import("node:os");
34771
+ const { homedir: homedir8 } = await import("node:os");
34782
34772
  const name = args.name;
34783
34773
  const role = args.role;
34784
34774
  const tier = args.tier ?? inferTierFromRole(role);
@@ -34836,7 +34826,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
34836
34826
  }
34837
34827
  let targetRoot;
34838
34828
  if (isGlobal) {
34839
- const home = homedir10();
34829
+ const home = homedir8();
34840
34830
  const xdgData = process.env["XDG_DATA_HOME"] ?? join29(home, ".local", "share");
34841
34831
  targetRoot = join29(xdgData, "cleo", "cant", "agents");
34842
34832
  } else {
@@ -37300,10 +37290,10 @@ __export(briefing_exports, {
37300
37290
  briefingCommand: () => briefingCommand
37301
37291
  });
37302
37292
  import { existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs";
37303
- import { homedir as homedir3 } from "node:os";
37304
37293
  import { join as join9 } from "node:path";
37294
+ import { resolveLegacyCleoDir } from "@cleocode/paths";
37305
37295
  function resolveInjectionTemplatePath() {
37306
- const xdgConfig = process.env["XDG_CONFIG_HOME"] ?? join9(homedir3(), ".cleo");
37296
+ const xdgConfig = resolveLegacyCleoDir(process.env["XDG_CONFIG_HOME"]);
37307
37297
  return join9(xdgConfig, "templates", "CLEO-INJECTION.md");
37308
37298
  }
37309
37299
  function extractSection(content, sectionName) {
@@ -37479,7 +37469,7 @@ var caamp_exports = {};
37479
37469
  __export(caamp_exports, {
37480
37470
  caampCommand: () => caampCommand
37481
37471
  });
37482
- import { homedir as homedir4 } from "node:os";
37472
+ import { homedir as homedir3 } from "node:os";
37483
37473
  import { join as join10 } from "node:path";
37484
37474
  var dedupeCommand, caampCommand;
37485
37475
  var init_caamp = __esm({
@@ -37515,7 +37505,7 @@ var init_caamp = __esm({
37515
37505
  if (args.file) {
37516
37506
  filePaths = [args.file];
37517
37507
  } else {
37518
- const home = homedir4();
37508
+ const home = homedir3();
37519
37509
  filePaths = [
37520
37510
  join10(home, ".agents", "AGENTS.md"),
37521
37511
  // project-level AGENTS.md in cwd
@@ -39788,7 +39778,6 @@ __export(daemon_exports, {
39788
39778
  daemonCommand: () => daemonCommand
39789
39779
  });
39790
39780
  import { existsSync as existsSync10 } from "node:fs";
39791
- import { homedir as homedir5 } from "node:os";
39792
39781
  import { join as join12 } from "node:path";
39793
39782
  import { fileURLToPath as fileURLToPath4 } from "node:url";
39794
39783
  import { getGCDaemonStatus, spawnGCDaemon, stopGCDaemon } from "@cleocode/core/gc/daemon.js";
@@ -39796,6 +39785,7 @@ import {
39796
39785
  bootstrapDaemon as bootstrapSentientDaemon,
39797
39786
  getSentientDaemonStatus
39798
39787
  } from "@cleocode/core/sentient";
39788
+ import { resolveLegacyCleoDir as resolveLegacyCleoDir2 } from "@cleocode/paths";
39799
39789
  async function showDaemonStatus(cleoDir, projectRoot) {
39800
39790
  try {
39801
39791
  const gcStatus = await getGCDaemonStatus(cleoDir);
@@ -39891,7 +39881,7 @@ var init_daemon = __esm({
39891
39881
  }
39892
39882
  },
39893
39883
  async run({ args }) {
39894
- const cleoDir = args["cleo-dir"] ?? join12(homedir5(), ".cleo");
39884
+ const cleoDir = resolveLegacyCleoDir2(args["cleo-dir"]);
39895
39885
  const foreground = args.foreground ?? false;
39896
39886
  if (foreground) {
39897
39887
  const projectRoot = process.cwd();
@@ -39964,7 +39954,7 @@ var init_daemon = __esm({
39964
39954
  }
39965
39955
  },
39966
39956
  async run({ args }) {
39967
- const cleoDir = args["cleo-dir"] ?? join12(homedir5(), ".cleo");
39957
+ const cleoDir = resolveLegacyCleoDir2(args["cleo-dir"]);
39968
39958
  try {
39969
39959
  const stopResult = await stopGCDaemon(cleoDir);
39970
39960
  cliOutput(stopResult, {
@@ -40002,7 +39992,7 @@ var init_daemon = __esm({
40002
39992
  }
40003
39993
  },
40004
39994
  async run({ args }) {
40005
- const cleoDir = args["cleo-dir"] ?? join12(homedir5(), ".cleo");
39995
+ const cleoDir = resolveLegacyCleoDir2(args["cleo-dir"]);
40006
39996
  await showDaemonStatus(cleoDir, process.cwd());
40007
39997
  }
40008
39998
  });
@@ -40100,7 +40090,7 @@ var init_daemon = __esm({
40100
40090
  },
40101
40091
  async run({ args, cmd, rawArgs }) {
40102
40092
  if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
40103
- const cleoDir = args["cleo-dir"] ?? join12(homedir5(), ".cleo");
40093
+ const cleoDir = resolveLegacyCleoDir2(args["cleo-dir"]);
40104
40094
  await showDaemonStatus(cleoDir, process.cwd());
40105
40095
  }
40106
40096
  });
@@ -41102,7 +41092,10 @@ import {
41102
41092
  publishDocs,
41103
41093
  rankDocs,
41104
41094
  readJson,
41105
- searchDocs as searchDocs2
41095
+ recordPublication,
41096
+ searchDocs as searchDocs2,
41097
+ statusDocs,
41098
+ syncFromGit
41106
41099
  } from "@cleocode/core/internal";
41107
41100
  async function getScriptNames(projectRoot) {
41108
41101
  const scriptsDir = join14(projectRoot, "scripts");
@@ -41166,7 +41159,7 @@ async function runGapCheck(_projectRoot, filterId) {
41166
41159
  }
41167
41160
  return results;
41168
41161
  }
41169
- var addCommand4, listCommand7, fetchCommand, removeCommand2, generateCommand, exportCommand4, searchCommand, mergeCommand, graphCommand, rankCommand, versionsCommand, publishCommand2, syncCommand3, gapCheckCommand, docsCommand;
41162
+ var addCommand4, listCommand7, fetchCommand, removeCommand2, generateCommand, exportCommand4, searchCommand, mergeCommand, graphCommand, rankCommand, versionsCommand, publishCommand2, syncCommand3, statusCommand6, gapCheckCommand, docsCommand;
41170
41163
  var init_docs3 = __esm({
41171
41164
  "packages/cleo/src/cli/commands/docs.ts"() {
41172
41165
  "use strict";
@@ -41718,30 +41711,87 @@ var init_docs3 = __esm({
41718
41711
  attachmentId: args.attachment ?? void 0,
41719
41712
  projectRoot
41720
41713
  });
41714
+ try {
41715
+ await recordPublication({
41716
+ ownerId: result.ownerId,
41717
+ blobName: result.blobName,
41718
+ publishedPath: result.relativePath,
41719
+ lastBlobSha: result.blobSha256,
41720
+ projectRoot
41721
+ });
41722
+ } catch {
41723
+ }
41721
41724
  cliOutput(result, { command: "docs publish", operation: "docs.publish" });
41722
41725
  } catch (err) {
41723
41726
  const message = err instanceof Error ? err.message : String(err);
41724
- cliOutput(
41725
- formatError5(new CleoError3(1 /* GENERAL_ERROR */, `docs publish failed: ${message}`)),
41726
- { command: "docs publish", operation: "docs.publish" }
41727
- );
41727
+ cliError(`docs publish failed: ${message}`, 1 /* GENERAL_ERROR */, {
41728
+ name: "E_DOCS_PUBLISH_FAILED"
41729
+ });
41728
41730
  process.exit(1 /* GENERAL_ERROR */);
41729
41731
  }
41730
41732
  }
41731
41733
  });
41732
41734
  syncCommand3 = defineCommand({
41733
- meta: { name: "sync", description: "Run drift detection between scripts and docs index" },
41735
+ meta: {
41736
+ name: "sync",
41737
+ description: "Bidirectional docs sync. Use --from <path> --for <ownerId> to ingest a git file as a new blob version. Without --from, runs the legacy drift check between scripts/ and COMMANDS-INDEX.json."
41738
+ },
41734
41739
  args: {
41740
+ from: {
41741
+ type: "string",
41742
+ description: "Git-tracked file path to ingest as a new blob version (triggers reverse-ingest mode)"
41743
+ },
41744
+ for: {
41745
+ type: "string",
41746
+ description: "Owner entity ID for reverse-ingest mode (T###, ses_*, O-*). Required when --from is set."
41747
+ },
41748
+ name: {
41749
+ type: "string",
41750
+ description: "Override the blob name used in the manifest. Default: basename of --from."
41751
+ },
41752
+ "content-type": {
41753
+ type: "string",
41754
+ description: "IANA MIME type recorded with the new blob version (default: application/octet-stream)"
41755
+ },
41735
41756
  quick: {
41736
41757
  type: "boolean",
41737
- description: "Quick check (commands only)"
41758
+ description: "Legacy mode only: quick check (commands only)"
41738
41759
  },
41739
41760
  strict: {
41740
41761
  type: "boolean",
41741
- description: "Exit with error on any drift"
41762
+ description: "Legacy mode only: exit with error on any drift"
41742
41763
  }
41743
41764
  },
41744
41765
  async run({ args }) {
41766
+ if (args.from) {
41767
+ const projectRoot = getProjectRoot27();
41768
+ const ownerId = args.for ?? void 0;
41769
+ if (!ownerId) {
41770
+ cliError(
41771
+ "--for <ownerId> is required when --from <path> is set",
41772
+ 6 /* VALIDATION_ERROR */,
41773
+ { name: "E_VALIDATION" }
41774
+ );
41775
+ process.exit(6 /* VALIDATION_ERROR */);
41776
+ }
41777
+ try {
41778
+ const result = await syncFromGit({
41779
+ ownerId: String(ownerId),
41780
+ fromPath: String(args.from),
41781
+ blobName: args.name ?? void 0,
41782
+ contentType: args["content-type"] ?? void 0,
41783
+ projectRoot
41784
+ });
41785
+ cliOutput(result, { command: "docs sync", operation: "docs.sync" });
41786
+ } catch (err) {
41787
+ const message = err instanceof Error ? err.message : String(err);
41788
+ cliError(`docs sync failed: ${message}`, 1 /* GENERAL_ERROR */, {
41789
+ name: "E_DOCS_SYNC_FAILED"
41790
+ });
41791
+ process.exit(1 /* GENERAL_ERROR */);
41792
+ }
41793
+ return;
41794
+ }
41745
41795
  try {
41746
41796
  const projectRoot = process.cwd();
41747
41797
  const result = await detectDrift(projectRoot);
@@ -41769,6 +41819,34 @@ var init_docs3 = __esm({
41769
41819
  }
41770
41820
  }
41771
41821
  });
41822
+ statusCommand6 = defineCommand({
41823
+ meta: {
41824
+ name: "status",
41825
+ description: "Compare published files on disk against the docs SSoT and report drift. Exits 0 when all entries are in-sync, 2 when any drift is present."
41826
+ },
41827
+ args: {
41828
+ json: {
41829
+ type: "boolean",
41830
+ description: "Emit LAFS JSON envelope"
41831
+ }
41832
+ },
41833
+ async run() {
41834
+ const projectRoot = getProjectRoot27();
41835
+ try {
41836
+ const result = await statusDocs({ projectRoot });
41837
+ cliOutput(result, { command: "docs status", operation: "docs.status" });
41838
+ if (!result.allInSync) {
41839
+ process.exit(2);
41840
+ }
41841
+ } catch (err) {
41842
+ const message = err instanceof Error ? err.message : String(err);
41843
+ cliError(`docs status failed: ${message}`, 1 /* GENERAL_ERROR */, {
41844
+ name: "E_DOCS_STATUS_FAILED"
41845
+ });
41846
+ process.exit(1 /* GENERAL_ERROR */);
41847
+ }
41848
+ }
41849
+ });
41772
41850
  gapCheckCommand = defineCommand({
41773
41851
  meta: {
41774
41852
  name: "gap-check",
@@ -41812,7 +41890,7 @@ var init_docs3 = __esm({
41812
41890
  docsCommand = defineCommand({
41813
41891
  meta: {
41814
41892
  name: "docs",
41815
- description: "Documentation attachment management (add/list/fetch/remove), llmtxt primitives (search/merge/graph/rank/versions/publish), and drift detection (sync/gap-check)"
41893
+ description: "Documentation attachment management (add/list/fetch/remove), llmtxt primitives (search/merge/graph/rank/versions/publish), and drift detection (sync/status/gap-check)"
41816
41894
  },
41817
41895
  subCommands: {
41818
41896
  add: addCommand4,
@@ -41828,6 +41906,7 @@ var init_docs3 = __esm({
41828
41906
  versions: versionsCommand,
41829
41907
  publish: publishCommand2,
41830
41908
  sync: syncCommand3,
41909
+ status: statusCommand6,
41831
41910
  "gap-check": gapCheckCommand
41832
41911
  },
41833
41912
  async run({ cmd, rawArgs }) {
@@ -43477,11 +43556,12 @@ var gc_exports = {};
43477
43556
  __export(gc_exports, {
43478
43557
  gcCommand: () => gcCommand
43479
43558
  });
43480
- import { homedir as homedir6, tmpdir } from "node:os";
43559
+ import { homedir as homedir4, tmpdir } from "node:os";
43481
43560
  import { join as join18 } from "node:path";
43482
43561
  import { pruneOrphanTempDirs, pruneOrphanWorktrees } from "@cleocode/core/gc/cleanup.js";
43483
43562
  import { runGC } from "@cleocode/core/gc/runner.js";
43484
43563
  import { readGCState } from "@cleocode/core/gc/state.js";
43564
+ import { resolveLegacyCleoDir as resolveLegacyCleoDir3 } from "@cleocode/paths";
43485
43565
  function formatBytes(bytes) {
43486
43566
  if (bytes === 0) return "0 B";
43487
43567
  const units = ["B", "KB", "MB", "GB", "TB"];
@@ -43489,7 +43569,7 @@ function formatBytes(bytes) {
43489
43569
  const value = bytes / 1024 ** exp;
43490
43570
  return `${value.toFixed(exp === 0 ? 0 : 1)} ${units[exp] ?? "B"}`;
43491
43571
  }
43492
- var runCommand2, statusCommand6, worktreesCommand, tempCommand, gcCommand;
43572
+ var runCommand2, statusCommand7, worktreesCommand, tempCommand, gcCommand;
43493
43573
  var init_gc = __esm({
43494
43574
  "packages/cleo/src/cli/commands/gc.ts"() {
43495
43575
  "use strict";
@@ -43517,7 +43597,7 @@ var init_gc = __esm({
43517
43597
  }
43518
43598
  },
43519
43599
  async run({ args }) {
43520
- const cleoDir = args["cleo-dir"] ?? join18(homedir6(), ".cleo");
43600
+ const cleoDir = resolveLegacyCleoDir3(args["cleo-dir"]);
43521
43601
  const dryRun = args["dry-run"];
43522
43602
  try {
43523
43603
  const gcResult = await runGC({ cleoDir, dryRun });
@@ -43542,7 +43622,7 @@ var init_gc = __esm({
43542
43622
  }
43543
43623
  }
43544
43624
  });
43545
- statusCommand6 = defineCommand({
43625
+ statusCommand7 = defineCommand({
43546
43626
  meta: {
43547
43627
  name: "status",
43548
43628
  description: "Show last GC run stats, disk usage, and escalation state"
@@ -43559,7 +43639,7 @@ var init_gc = __esm({
43559
43639
  }
43560
43640
  },
43561
43641
  async run({ args }) {
43562
- const cleoDir = args["cleo-dir"] ?? join18(homedir6(), ".cleo");
43642
+ const cleoDir = resolveLegacyCleoDir3(args["cleo-dir"]);
43563
43643
  const statePath = join18(cleoDir, "gc-state.json");
43564
43644
  try {
43565
43645
  const state = await readGCState(statePath);
@@ -43613,7 +43693,7 @@ var init_gc = __esm({
43613
43693
  }
43614
43694
  },
43615
43695
  async run({ args }) {
43616
- const xdgData = process.env["XDG_DATA_HOME"] ?? join18(homedir6(), ".local", "share");
43696
+ const xdgData = process.env["XDG_DATA_HOME"] ?? join18(homedir4(), ".local", "share");
43617
43697
  const worktreesRoot = args["worktrees-root"] ?? join18(xdgData, "cleo", "worktrees");
43618
43698
  const projectHash = args["project-hash"];
43619
43699
  const dryRun = args["dry-run"];
@@ -43705,7 +43785,7 @@ var init_gc = __esm({
43705
43785
  },
43706
43786
  subCommands: {
43707
43787
  run: runCommand2,
43708
- status: statusCommand6,
43788
+ status: statusCommand7,
43709
43789
  worktrees: worktreesCommand,
43710
43790
  temp: tempCommand
43711
43791
  },
@@ -44004,7 +44084,7 @@ function applyJsonFlag(jsonFlag) {
44004
44084
  setFormatContext({ format: "json", source: "flag", quiet: false });
44005
44085
  }
44006
44086
  }
44007
- var statusCommand7, resolveCommand, depsCommand2, rawCommand, discoverCommand, searchCommand2, augmentCommand, contextCommand2, impactCommand2, impactFullCommand, clustersCommand, flowsCommand, diffCommand, routeMapCommand, shapeCheckCommand, searchCodeCommand, wikiCommand, hotPathsCommand, hotNodesCommand, coldSymbolsCommand, orphansCommand, queryCommand, initCommand, syncCommand4, reconcileCommand, livingFullContextCommand, livingTaskFootprintCommand, livingBrainAnchorsCommand, livingWhyCommand, livingConduitScanCommand, livingCommand, graphCommand2;
44087
+ var statusCommand8, resolveCommand, depsCommand2, rawCommand, discoverCommand, searchCommand2, augmentCommand, contextCommand2, impactCommand2, impactFullCommand, clustersCommand, flowsCommand, diffCommand, routeMapCommand, shapeCheckCommand, searchCodeCommand, wikiCommand, hotPathsCommand, hotNodesCommand, coldSymbolsCommand, orphansCommand, queryCommand, initCommand, syncCommand4, reconcileCommand, livingFullContextCommand, livingTaskFootprintCommand, livingBrainAnchorsCommand, livingWhyCommand, livingConduitScanCommand, livingCommand, graphCommand2;
44008
44088
  var init_graph2 = __esm({
44009
44089
  "packages/cleo/src/cli/commands/graph.ts"() {
44010
44090
  "use strict";
@@ -44012,7 +44092,7 @@ var init_graph2 = __esm({
44012
44092
  init_cli();
44013
44093
  init_format_context();
44014
44094
  init_renderers();
44015
- statusCommand7 = defineCommand({
44095
+ statusCommand8 = defineCommand({
44016
44096
  meta: {
44017
44097
  name: "status",
44018
44098
  description: "Show code intelligence index freshness: file count, node/relation counts, last indexed time."
@@ -44799,7 +44879,7 @@ var init_graph2 = __esm({
44799
44879
  description: "Project-scoped code intelligence: symbol graph, impact analysis, clusters, flows"
44800
44880
  },
44801
44881
  subCommands: {
44802
- status: statusCommand7,
44882
+ status: statusCommand8,
44803
44883
  resolve: resolveCommand,
44804
44884
  deps: depsCommand2,
44805
44885
  raw: rawCommand,
@@ -47583,7 +47663,7 @@ __export(memory_exports, {
47583
47663
  });
47584
47664
  import { createHash as createHash3 } from "node:crypto";
47585
47665
  import { existsSync as existsSync15, mkdirSync as mkdirSync6, readdirSync as readdirSync3, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "node:fs";
47586
- import { homedir as homedir7 } from "node:os";
47666
+ import { homedir as homedir5 } from "node:os";
47587
47667
  import { join as join21 } from "node:path";
47588
47668
  import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
47589
47669
  import {
@@ -48697,7 +48777,7 @@ var init_memory3 = __esm({
48697
48777
  }
48698
48778
  },
48699
48779
  async run({ args }) {
48700
- const sourceDir = args.from ?? join21(homedir7(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
48780
+ const sourceDir = args.from ?? join21(homedir5(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
48701
48781
  const isDryRun = !!args["dry-run"];
48702
48782
  const projectRoot = getProjectRoot32();
48703
48783
  const stateFile = join21(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
@@ -49703,14 +49783,14 @@ __export(nexus_exports, {
49703
49783
  nexusCommand: () => nexusCommand
49704
49784
  });
49705
49785
  import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
49706
- import { homedir as homedir8 } from "node:os";
49786
+ import { homedir as homedir6 } from "node:os";
49707
49787
  import path4 from "node:path";
49708
49788
  import { getProjectRoot as getProjectRoot34 } from "@cleocode/core";
49709
49789
  import { generateGexf, getSymbolImpact } from "@cleocode/core/nexus";
49710
49790
  async function appendDeprecationTelemetry(op, replacement) {
49711
49791
  try {
49712
49792
  const dateStr = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
49713
- const dir = path4.join(homedir8(), ".local", "state", "cleo", "nexus-deprecation");
49793
+ const dir = path4.join(homedir6(), ".local", "state", "cleo", "nexus-deprecation");
49714
49794
  await mkdir2(dir, { recursive: true });
49715
49795
  const record = JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), op, replacement }) + "\n";
49716
49796
  await appendFile(path4.join(dir, `${dateStr}.jsonl`), record, "utf8");
@@ -49722,7 +49802,7 @@ function applyJsonFlag2(jsonFlag) {
49722
49802
  setFormatContext({ format: "json", source: "flag", quiet: false });
49723
49803
  }
49724
49804
  }
49725
- var initCommand3, registerCommand2, unregisterCommand, listCommand12, statusCommand8, showCommand8, resolveCommand2, discoverCommand2, augmentCommand2, setupCommand, searchCommand3, depsCommand3, criticalPathCommand2, blockingCommand, orphansCommand2, syncCommand5, reconcileCommand2, graphCommand3, shareStatusCommand, transferPreviewCommand, transferCommand, permissionSetCommand, permissionCommand, shareExportCommand, shareImportCommand, shareCommand, clustersCommand2, flowsCommand2, contextCommand4, impactCommand3, analyzeCommand3, projectsListCommand, projectsRegisterCommand, projectsRemoveCommand, projectsScanCommand, projectsCleanCommand, projectsCommand, refreshBridgeCommand, exportCommand6, diffCommand2, queryCommand2, routeMapCommand2, shapeCheckCommand2, fullContextCommand, taskFootprintCommand, brainAnchorsCommand, whyCommand, impactFullCommand2, conduitScanCommand, taskSymbolsCommand, searchCodeCommand2, contractsSyncCommand, contractsShowCommand, contractsLinkTasksCommand, contractsCommand, groupCommand, wikiCommand2, hotPathsCommand2, hotNodesCommand2, coldSymbolsCommand2, sigilSyncCommand, sigilListCommand, sigilCommand, topEntriesCommand, nexusCommand;
49805
+ var initCommand3, registerCommand2, unregisterCommand, listCommand12, statusCommand9, showCommand8, resolveCommand2, discoverCommand2, augmentCommand2, setupCommand, searchCommand3, depsCommand3, criticalPathCommand2, blockingCommand, orphansCommand2, syncCommand5, reconcileCommand2, graphCommand3, shareStatusCommand, transferPreviewCommand, transferCommand, permissionSetCommand, permissionCommand, shareExportCommand, shareImportCommand, shareCommand, clustersCommand2, flowsCommand2, contextCommand4, impactCommand3, analyzeCommand3, projectsListCommand, projectsRegisterCommand, projectsRemoveCommand, projectsScanCommand, projectsCleanCommand, projectsCommand, refreshBridgeCommand, exportCommand6, diffCommand2, queryCommand2, routeMapCommand2, shapeCheckCommand2, fullContextCommand, taskFootprintCommand, brainAnchorsCommand, whyCommand, impactFullCommand2, conduitScanCommand, taskSymbolsCommand, searchCodeCommand2, contractsSyncCommand, contractsShowCommand, contractsLinkTasksCommand, contractsCommand, groupCommand, wikiCommand2, hotPathsCommand2, hotNodesCommand2, coldSymbolsCommand2, sigilSyncCommand, sigilListCommand, sigilCommand, topEntriesCommand, nexusCommand;
49726
49806
  var init_nexus4 = __esm({
49727
49807
  "packages/cleo/src/cli/commands/nexus.ts"() {
49728
49808
  "use strict";
@@ -49794,7 +49874,7 @@ var init_nexus4 = __esm({
49794
49874
  await dispatchFromCli("query", "nexus", "list", {}, { command: "nexus" });
49795
49875
  }
49796
49876
  });
49797
- statusCommand8 = defineCommand({
49877
+ statusCommand9 = defineCommand({
49798
49878
  meta: {
49799
49879
  name: "status",
49800
49880
  description: "Show code intelligence index freshness: file count, node/relation counts, last indexed time, stale files. Falls back to NEXUS registry status if code-intelligence index is unavailable."
@@ -49964,9 +50044,9 @@ var init_nexus4 = __esm({
49964
50044
  args: {},
49965
50045
  async run() {
49966
50046
  try {
49967
- const { homedir: homedir10 } = await import("node:os");
50047
+ const { homedir: homedir8 } = await import("node:os");
49968
50048
  const { installNexusAugmentHook } = await import("@cleocode/core/internal");
49969
- const homeDir = homedir10();
50049
+ const homeDir = homedir8();
49970
50050
  installNexusAugmentHook(homeDir);
49971
50051
  cliOutput({ homeDir }, { command: "nexus-setup", operation: "nexus.setup" });
49972
50052
  } catch (err) {
@@ -52223,7 +52303,7 @@ var init_nexus4 = __esm({
52223
52303
  register: registerCommand2,
52224
52304
  unregister: unregisterCommand,
52225
52305
  list: listCommand12,
52226
- status: statusCommand8,
52306
+ status: statusCommand9,
52227
52307
  show: showCommand8,
52228
52308
  resolve: resolveCommand2,
52229
52309
  discover: discoverCommand2,
@@ -52362,7 +52442,7 @@ function formatRollupTable(rollup) {
52362
52442
  }
52363
52443
  return lines.join("\n");
52364
52444
  }
52365
- var rollupCommand, startCommand5, statusCommand9, analyzeCommand4, readyCommand, nextCommand2, wavesCommand2, planCommand, spawnCommand2, validateCommand6, contextCommand5, ivtrCommand, parallelCommand, tesseraListCommand, tesseraInstantiateCommand, tesseraCommand, unblockCommand, bootstrapCommand, classifyCommand, fanoutStatusCommand, handoffCommand, spawnExecuteCommand, fanoutCommand, pruneCommand, worktreeCompleteCommand, conduitStatusCommand, conduitPeekCommand, conduitStartCommand, conduitStopCommand, approveCommand, rejectCommand, pendingCommand, conduitSendCommand, orchestrateCommand;
52445
+ var rollupCommand, startCommand5, statusCommand10, analyzeCommand4, readyCommand, nextCommand2, wavesCommand2, planCommand, spawnCommand2, validateCommand6, contextCommand5, ivtrCommand, parallelCommand, tesseraListCommand, tesseraInstantiateCommand, tesseraCommand, unblockCommand, bootstrapCommand, classifyCommand, fanoutStatusCommand, handoffCommand, spawnExecuteCommand, fanoutCommand, pruneCommand, worktreeCompleteCommand, conduitStatusCommand, conduitPeekCommand, conduitStartCommand, conduitStopCommand, approveCommand, rejectCommand, pendingCommand, conduitSendCommand, orchestrateCommand;
52366
52446
  var init_orchestrate3 = __esm({
52367
52447
  "packages/cleo/src/cli/commands/orchestrate.ts"() {
52368
52448
  "use strict";
@@ -52414,7 +52494,7 @@ var init_orchestrate3 = __esm({
52414
52494
  );
52415
52495
  }
52416
52496
  });
52417
- statusCommand9 = defineCommand({
52497
+ statusCommand10 = defineCommand({
52418
52498
  meta: { name: "status", description: "Get orchestration status for an epic or overall project" },
52419
52499
  args: {
52420
52500
  epic: {
@@ -53158,7 +53238,7 @@ var init_orchestrate3 = __esm({
53158
53238
  meta: { name: "orchestrate", description: "Multi-agent orchestration commands" },
53159
53239
  subCommands: {
53160
53240
  start: startCommand5,
53161
- status: statusCommand9,
53241
+ status: statusCommand10,
53162
53242
  "roll-up": rollupCommand,
53163
53243
  analyze: analyzeCommand4,
53164
53244
  ready: readyCommand,
@@ -53214,13 +53294,13 @@ import {
53214
53294
  getOtelSummary,
53215
53295
  getRealTokenUsage
53216
53296
  } from "@cleocode/core/internal";
53217
- var statusCommand10, summaryCommand2, sessionsCommand, spawnsCommand, realCommand, clearCommand, otelCommand;
53297
+ var statusCommand11, summaryCommand2, sessionsCommand, spawnsCommand, realCommand, clearCommand, otelCommand;
53218
53298
  var init_otel = __esm({
53219
53299
  "packages/cleo/src/cli/commands/otel.ts"() {
53220
53300
  "use strict";
53221
53301
  init_dist();
53222
53302
  init_renderers();
53223
- statusCommand10 = defineCommand({
53303
+ statusCommand11 = defineCommand({
53224
53304
  meta: { name: "status", description: "Show token tracking status and recent activity" },
53225
53305
  async run() {
53226
53306
  try {
@@ -53355,7 +53435,7 @@ var init_otel = __esm({
53355
53435
  description: "Lightweight token metrics from .cleo/metrics/TOKEN_USAGE.jsonl (session-level, spawn-level events)"
53356
53436
  },
53357
53437
  subCommands: {
53358
- status: statusCommand10,
53438
+ status: statusCommand11,
53359
53439
  summary: summaryCommand2,
53360
53440
  sessions: sessionsCommand,
53361
53441
  spawns: spawnsCommand,
@@ -53660,7 +53740,7 @@ var playbook_exports = {};
53660
53740
  __export(playbook_exports, {
53661
53741
  playbookCommand: () => playbookCommand
53662
53742
  });
53663
- var runCommand3, statusCommand11, resumeCommand, createCommand2, listCommand14, validateCommand7, playbookCommand;
53743
+ var runCommand3, statusCommand12, resumeCommand, createCommand2, listCommand14, validateCommand7, playbookCommand;
53664
53744
  var init_playbook3 = __esm({
53665
53745
  "packages/cleo/src/cli/commands/playbook.ts"() {
53666
53746
  "use strict";
@@ -53692,7 +53772,7 @@ var init_playbook3 = __esm({
53692
53772
  );
53693
53773
  }
53694
53774
  });
53695
- statusCommand11 = defineCommand({
53775
+ statusCommand12 = defineCommand({
53696
53776
  meta: {
53697
53777
  name: "status",
53698
53778
  description: "Return the current state of a playbook run from playbook_runs"
@@ -53849,7 +53929,7 @@ var init_playbook3 = __esm({
53849
53929
  },
53850
53930
  subCommands: {
53851
53931
  run: runCommand3,
53852
- status: statusCommand11,
53932
+ status: statusCommand12,
53853
53933
  resume: resumeCommand,
53854
53934
  list: listCommand14,
53855
53935
  create: createCommand2,
@@ -54689,18 +54769,34 @@ var init_release3 = __esm({
54689
54769
  description: "Generate CHANGELOG from git log since a given tag, with task/epic grouping"
54690
54770
  },
54691
54771
  args: {
54772
+ sinceTag: {
54773
+ type: "positional",
54774
+ description: "Git tag or ref to generate changelog from (e.g. v2026.4.75)",
54775
+ required: false
54776
+ },
54692
54777
  since: {
54693
54778
  type: "string",
54694
- description: "Git tag or ref to generate changelog from (e.g. v2026.4.75)",
54695
- required: true
54779
+ description: "Git tag or ref to generate changelog from (e.g. v2026.4.75). Alias for the positional argument.",
54780
+ required: false
54696
54781
  }
54697
54782
  },
54698
54783
  async run({ args }) {
54784
+ const sinceTag = typeof args["sinceTag"] === "string" && args["sinceTag"].length > 0 ? args["sinceTag"] : typeof args["since"] === "string" && args["since"].length > 0 ? args["since"] : void 0;
54785
+ if (sinceTag === void 0) {
54786
+ cliError(
54787
+ "Missing required argument: <sinceTag> (or --since)",
54788
+ 2,
54789
+ { name: "E_MISSING_ARGUMENT", fix: "Run: cleo release changelog <tag>" },
54790
+ { operation: "release.changelog.since" }
54791
+ );
54792
+ process.exit(2);
54793
+ return;
54794
+ }
54699
54795
  await dispatchFromCli(
54700
54796
  "query",
54701
54797
  "pipeline",
54702
54798
  "release.changelog.since",
54703
- { sinceTag: args.since },
54799
+ { sinceTag },
54704
54800
  { command: "release" }
54705
54801
  );
54706
54802
  }
@@ -54914,8 +55010,21 @@ var init_release3 = __esm({
54914
55010
  fromWorkflow: args["from-workflow"] === true,
54915
55011
  rollback: args.rollback === true
54916
55012
  });
54917
- cliOutput(result, { command: "release", operation: "release.reconcile" });
54918
- if (!result.success) process.exit(1);
55013
+ if (result.success) {
55014
+ cliOutput(result.data, { command: "release", operation: "release.reconcile" });
55015
+ return;
55016
+ }
55017
+ cliError(
55018
+ result.error.message,
55019
+ result.error.code,
55020
+ {
55021
+ name: result.error.code,
55022
+ ...result.error.details ? { details: result.error.details } : {},
55023
+ ...result.error.fix ? { fix: result.error.fix } : {}
55024
+ },
55025
+ { operation: "release.reconcile" }
55026
+ );
55027
+ process.exit(1);
54919
55028
  }
54920
55029
  });
54921
55030
  releaseCommand = defineCommand({
@@ -58143,7 +58252,7 @@ async function promptOwnerAuthPassword(sessionName) {
58143
58252
  const token = deriveOwnerAuthToken(sessionName, password);
58144
58253
  return token;
58145
58254
  }
58146
- var startCommand7, endCommand, handoffCommand2, statusCommand12, resumeCommand2, findCommand6, listCommand21, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, sessionCommand;
58255
+ var startCommand7, endCommand, handoffCommand2, statusCommand13, resumeCommand2, findCommand6, listCommand21, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, sessionCommand;
58147
58256
  var init_session4 = __esm({
58148
58257
  "packages/cleo/src/cli/commands/session.ts"() {
58149
58258
  "use strict";
@@ -58331,7 +58440,7 @@ var init_session4 = __esm({
58331
58440
  );
58332
58441
  }
58333
58442
  });
58334
- statusCommand12 = defineCommand({
58443
+ statusCommand13 = defineCommand({
58335
58444
  meta: { name: "status", description: "Show current session status" },
58336
58445
  async run() {
58337
58446
  const response = await dispatchRaw("query", "session", "status");
@@ -58671,7 +58780,7 @@ var init_session4 = __esm({
58671
58780
  end: endCommand,
58672
58781
  stop: endCommand,
58673
58782
  handoff: handoffCommand2,
58674
- status: statusCommand12,
58783
+ status: statusCommand13,
58675
58784
  resume: resumeCommand2,
58676
58785
  find: findCommand6,
58677
58786
  list: listCommand21,
@@ -59298,7 +59407,8 @@ var skills_exports = {};
59298
59407
  __export(skills_exports, {
59299
59408
  skillsCommand: () => skillsCommand2
59300
59409
  });
59301
- var listCommand22, searchCommand4, validateCommand8, infoCommand, installCommand3, uninstallCommand2, enableCommand2, disableCommand2, refreshCommand, dispatchCommand, catalogCommand, precedenceCommand, depsCommand4, spawnProvidersCommand, skillsCommand2;
59410
+ import { AgentsSkillsRealDirError, runDoctorBridge } from "@cleocode/caamp";
59411
+ var listCommand22, searchCommand4, validateCommand8, infoCommand, installCommand3, uninstallCommand2, enableCommand2, disableCommand2, refreshCommand, dispatchCommand, catalogCommand, precedenceCommand, depsCommand4, doctorBridgeCommand, doctorCommand4, spawnProvidersCommand, skillsCommand2;
59302
59412
  var init_skills2 = __esm({
59303
59413
  "packages/cleo/src/cli/commands/skills.ts"() {
59304
59414
  "use strict";
@@ -59599,6 +59709,72 @@ var init_skills2 = __esm({
59599
59709
  );
59600
59710
  }
59601
59711
  });
59712
+ doctorBridgeCommand = defineCommand({
59713
+ meta: {
59714
+ name: "bridge",
59715
+ description: "Create the single ~/.agents/skills bridge symlink + remove orphan per-skill symlinks"
59716
+ },
59717
+ args: {
59718
+ force: {
59719
+ type: "boolean",
59720
+ description: "Back up and replace a real ~/.agents/skills directory if present"
59721
+ },
59722
+ "dry-run": {
59723
+ type: "boolean",
59724
+ description: "Print planned actions without mutating disk state"
59725
+ },
59726
+ json: {
59727
+ type: "boolean",
59728
+ description: "Output as JSON (default)"
59729
+ },
59730
+ human: {
59731
+ type: "boolean",
59732
+ description: "Output in human-readable format"
59733
+ }
59734
+ },
59735
+ async run({ args }) {
59736
+ const { cliError: cliError2, cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
59737
+ try {
59738
+ const result = await runDoctorBridge({
59739
+ force: args.force === true,
59740
+ dryRun: args["dry-run"] === true
59741
+ });
59742
+ cliOutput2(
59743
+ { success: true, data: result },
59744
+ { command: "skills doctor bridge", operation: "skills.doctor.bridge" }
59745
+ );
59746
+ } catch (error) {
59747
+ if (error instanceof AgentsSkillsRealDirError) {
59748
+ cliError2(
59749
+ error.message,
59750
+ error.code,
59751
+ {
59752
+ details: {
59753
+ agentsSkillsPath: error.agentsSkillsPath,
59754
+ entryCount: error.entryCount
59755
+ }
59756
+ },
59757
+ { operation: "skills.doctor.bridge" }
59758
+ );
59759
+ process.exit(1);
59760
+ }
59761
+ const message = error instanceof Error ? error.message : String(error);
59762
+ cliError2(message, "E_INTERNAL_ERROR", void 0, {
59763
+ operation: "skills.doctor.bridge"
59764
+ });
59765
+ process.exit(1);
59766
+ }
59767
+ }
59768
+ });
59769
+ doctorCommand4 = defineCommand({
59770
+ meta: {
59771
+ name: "doctor",
59772
+ description: "Diagnose and repair the skill storage topology"
59773
+ },
59774
+ subCommands: {
59775
+ bridge: doctorBridgeCommand
59776
+ }
59777
+ });
59602
59778
  spawnProvidersCommand = defineCommand({
59603
59779
  meta: { name: "spawn-providers", description: "List providers capable of spawning subagents" },
59604
59780
  args: {
@@ -59633,7 +59809,8 @@ var init_skills2 = __esm({
59633
59809
  catalog: catalogCommand,
59634
59810
  precedence: precedenceCommand,
59635
59811
  deps: depsCommand4,
59636
- "spawn-providers": spawnProvidersCommand
59812
+ "spawn-providers": spawnProvidersCommand,
59813
+ doctor: doctorCommand4
59637
59814
  },
59638
59815
  async run({ cmd, rawArgs }) {
59639
59816
  if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
@@ -59861,7 +60038,7 @@ var init_stats = __esm({
59861
60038
  // packages/cleo/src/cli/commands/status.ts
59862
60039
  var status_exports = {};
59863
60040
  __export(status_exports, {
59864
- statusCommand: () => statusCommand13
60041
+ statusCommand: () => statusCommand14
59865
60042
  });
59866
60043
  import { getCleoStatus } from "@cleocode/core/status";
59867
60044
  function formatEpoch(epoch) {
@@ -59947,7 +60124,7 @@ function computeExitCode(status) {
59947
60124
  const hasInvalid = status.credentials.some((c) => c.lastStatus === "invalid");
59948
60125
  return hasInvalid ? 1 : 0;
59949
60126
  }
59950
- var statusCommand13;
60127
+ var statusCommand14;
59951
60128
  var init_status = __esm({
59952
60129
  "packages/cleo/src/cli/commands/status.ts"() {
59953
60130
  "use strict";
@@ -59955,7 +60132,7 @@ var init_status = __esm({
59955
60132
  init_format_context();
59956
60133
  init_colors();
59957
60134
  init_renderers();
59958
- statusCommand13 = defineCommand({
60135
+ statusCommand14 = defineCommand({
59959
60136
  meta: {
59960
60137
  name: "status",
59961
60138
  description: "Unified config + credential + session + harness + daemon snapshot. Use --json for the full LAFS envelope (CleoStatus interface). Exits non-zero when any credential is in invalid state."
@@ -60572,7 +60749,7 @@ var testing_exports = {};
60572
60749
  __export(testing_exports, {
60573
60750
  testingCommand: () => testingCommand
60574
60751
  });
60575
- var validateCommand9, checkCommand7, statusCommand14, coverageCommand, runCommand4, testingCommand;
60752
+ var validateCommand9, checkCommand7, statusCommand15, coverageCommand, runCommand4, testingCommand;
60576
60753
  var init_testing = __esm({
60577
60754
  "packages/cleo/src/cli/commands/testing.ts"() {
60578
60755
  "use strict";
@@ -60633,7 +60810,7 @@ var init_testing = __esm({
60633
60810
  );
60634
60811
  }
60635
60812
  });
60636
- statusCommand14 = defineCommand({
60813
+ statusCommand15 = defineCommand({
60637
60814
  meta: { name: "status", description: "Show test suite status" },
60638
60815
  async run() {
60639
60816
  await dispatchFromCli(
@@ -60680,7 +60857,7 @@ var init_testing = __esm({
60680
60857
  subCommands: {
60681
60858
  validate: validateCommand9,
60682
60859
  check: checkCommand7,
60683
- status: statusCommand14,
60860
+ status: statusCommand15,
60684
60861
  coverage: coverageCommand,
60685
60862
  run: runCommand4
60686
60863
  },
@@ -60897,7 +61074,7 @@ var transcript_exports = {};
60897
61074
  __export(transcript_exports, {
60898
61075
  transcriptCommand: () => transcriptCommand
60899
61076
  });
60900
- import { homedir as homedir9 } from "node:os";
61077
+ import { homedir as homedir7 } from "node:os";
60901
61078
  import { join as join25 } from "node:path";
60902
61079
  import { getProjectRoot as getProjectRoot39 } from "@cleocode/core";
60903
61080
  import {
@@ -60952,7 +61129,7 @@ var init_transcript = __esm({
60952
61129
  }
60953
61130
  return;
60954
61131
  }
60955
- const projectsDir = args["projects-dir"] ?? join25(homedir9(), ".claude", "projects");
61132
+ const projectsDir = args["projects-dir"] ?? join25(homedir7(), ".claude", "projects");
60956
61133
  try {
60957
61134
  const result = await scanTranscripts(projectsDir);
60958
61135
  cliOutput(
@@ -61258,7 +61435,7 @@ var init_transcript = __esm({
61258
61435
  process.exit(2);
61259
61436
  return;
61260
61437
  }
61261
- const projectsDir = args["projects-dir"] ?? join25(homedir9(), ".claude", "projects");
61438
+ const projectsDir = args["projects-dir"] ?? join25(homedir7(), ".claude", "projects");
61262
61439
  try {
61263
61440
  const pruneResult = await pruneTranscripts({
61264
61441
  olderThanMs,
@@ -62049,7 +62226,7 @@ Logs: ${logFile}`
62049
62226
  { command: "web", message: `CLEO Web UI running on port ${port}` }
62050
62227
  );
62051
62228
  }
62052
- var DEFAULT_PORT, DEFAULT_HOST, startCommand9, stopCommand5, restartCommand, statusCommand15, openCommand2, webCommand;
62229
+ var DEFAULT_PORT, DEFAULT_HOST, startCommand9, stopCommand5, restartCommand, statusCommand16, openCommand2, webCommand;
62053
62230
  var init_web = __esm({
62054
62231
  "packages/cleo/src/cli/commands/web.ts"() {
62055
62232
  "use strict";
@@ -62181,7 +62358,7 @@ var init_web = __esm({
62181
62358
  }
62182
62359
  }
62183
62360
  });
62184
- statusCommand15 = defineCommand({
62361
+ statusCommand16 = defineCommand({
62185
62362
  meta: { name: "status", description: "Check server status" },
62186
62363
  async run() {
62187
62364
  try {
@@ -62235,7 +62412,7 @@ var init_web = __esm({
62235
62412
  start: startCommand9,
62236
62413
  stop: stopCommand5,
62237
62414
  restart: restartCommand,
62238
- status: statusCommand15,
62415
+ status: statusCommand16,
62239
62416
  open: openCommand2
62240
62417
  },
62241
62418
  async run({ cmd, rawArgs }) {
@@ -62469,8 +62646,14 @@ var init_worktree3 = __esm({
62469
62646
  prune: pruneCommand3,
62470
62647
  "force-unlock": forceUnlockCommand
62471
62648
  },
62472
- async run() {
62473
- await showUsage(worktreeCommand);
62649
+ // Early-return when a subcommand was matched; citty still invokes the
62650
+ // parent run() after the subcommand finishes which would otherwise
62651
+ // append the help text to the subcommand's JSON envelope output
62652
+ // (T9686-A bug A4).
62653
+ async run({ cmd, rawArgs }) {
62654
+ const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
62655
+ if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
62656
+ await showUsage(cmd);
62474
62657
  }
62475
62658
  });
62476
62659
  }
@@ -63773,7 +63956,51 @@ async function startCli() {
63773
63956
  }
63774
63957
  }
63775
63958
  }
63776
- runMain(main, { showUsage: customShowUsage });
63959
+ await runMainWithLafsEnvelope(main, argv, customShowUsage);
63960
+ }
63961
+ function asCittyCliError(value) {
63962
+ if (!(value instanceof Error)) return null;
63963
+ if (value.name !== "CLIError") return null;
63964
+ if (!("code" in value)) return null;
63965
+ const code = value.code;
63966
+ if (typeof code !== "string") return null;
63967
+ return value;
63968
+ }
63969
+ async function runMainWithLafsEnvelope(cmd, rawArgs, showUsage2) {
63970
+ const helpFlags = ["--help", "-h"];
63971
+ const versionFlags = ["--version", "-V"];
63972
+ if (rawArgs.some((a) => helpFlags.includes(a))) {
63973
+ await showUsage2(cmd);
63974
+ process.exit(0);
63975
+ }
63976
+ if (rawArgs.length === 1 && versionFlags.includes(rawArgs[0])) {
63977
+ const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
63978
+ const version = meta?.version;
63979
+ if (!version) {
63980
+ const { cliError: cliError2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
63981
+ cliError2("No version specified", 1, { name: "E_NO_VERSION" });
63982
+ process.exit(1);
63983
+ }
63984
+ process.stdout.write(`${version}
63985
+ `);
63986
+ process.exit(0);
63987
+ }
63988
+ try {
63989
+ await runCommand(cmd, { rawArgs });
63990
+ } catch (err) {
63991
+ const { cliError: cliError2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
63992
+ const cittyCliError = asCittyCliError(err);
63993
+ if (cittyCliError) {
63994
+ cliError2(cittyCliError.message, 1, {
63995
+ name: cittyCliError.code === "EARG" ? "E_VALIDATION" : `E_${cittyCliError.code}`,
63996
+ fix: `Run 'cleo <command> --help' to see required arguments.`
63997
+ });
63998
+ process.exit(1);
63999
+ }
64000
+ const message = err instanceof Error ? err.message : String(err);
64001
+ cliError2(message, 1, { name: "E_CLI_UNCAUGHT" });
64002
+ process.exit(1);
64003
+ }
63777
64004
  }
63778
64005
  async function runStartupMaintenance() {
63779
64006
  const {