@cleocode/cleo 2026.3.11 → 2026.3.12

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <p alis|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2026.3.11-|g|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2026.3.10-|g|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2025.3.10-|gn="center">
1
+ <p alis|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2026.3.12-|g|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2026.3.11-|g|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2026.3.10-|g|version-[0-9]\+\.[0-9]\+\.[0-9]\+-|version-2025.3.10-|gn="center">
2
2
  <img src="docs/images/banner.png" alt="CLEO banner" width="900">
3
3
  </p>
4
4
 
package/dist/cli/index.js CHANGED
@@ -14959,8 +14959,8 @@ async function getSystemDiagnostics(projectRoot, opts) {
14959
14959
  }
14960
14960
  async function commandExists2(cmd) {
14961
14961
  try {
14962
- const { stdout } = await execAsync("which", [cmd]);
14963
- return stdout.trim();
14962
+ const { stdout: stdout2 } = await execAsync("which", [cmd]);
14963
+ return stdout2.trim();
14964
14964
  } catch {
14965
14965
  return null;
14966
14966
  }
@@ -15612,8 +15612,8 @@ async function resolveBinaryPath(name) {
15612
15612
  const execFileAsync5 = promisify5(execFile5);
15613
15613
  const resolver = process.platform === "win32" ? "where" : "which";
15614
15614
  try {
15615
- const { stdout } = await execFileAsync5(resolver, [name]);
15616
- const first = stdout.trim().split(/\r?\n/)[0] ?? "";
15615
+ const { stdout: stdout2 } = await execFileAsync5(resolver, [name]);
15616
+ const first = stdout2.trim().split(/\r?\n/)[0] ?? "";
15617
15617
  return first || null;
15618
15618
  } catch {
15619
15619
  return null;
@@ -34678,16 +34678,143 @@ function registerDecompositionCommand(program2) {
34678
34678
 
34679
34679
  // src/cli/commands/doctor.ts
34680
34680
  init_cli();
34681
- function registerDoctorCommand(program2) {
34682
- program2.command("doctor").description("Run system diagnostics and health checks").option("--detailed", "Show detailed health check results").option("--comprehensive", "Run comprehensive doctor report").option("--fix", "Auto-fix failed checks").action(async (opts) => {
34683
- if (opts["fix"]) {
34684
- await dispatchFromCli("mutate", "admin", "fix", {}, { command: "doctor", operation: "admin.fix" });
34685
- } else if (opts["comprehensive"]) {
34686
- await dispatchFromCli("query", "admin", "doctor", {}, { command: "doctor", operation: "admin.doctor" });
34681
+
34682
+ // src/cli/progress.ts
34683
+ import { stderr, stdout } from "node:process";
34684
+ var ProgressTracker = class {
34685
+ enabled;
34686
+ prefix;
34687
+ currentStep = 0;
34688
+ totalSteps;
34689
+ steps;
34690
+ constructor(options) {
34691
+ this.enabled = options.enabled;
34692
+ this.prefix = options.prefix ?? "CLEO";
34693
+ this.steps = options.steps;
34694
+ this.totalSteps = options.steps.length;
34695
+ }
34696
+ /**
34697
+ * Start the progress tracker.
34698
+ */
34699
+ start() {
34700
+ if (!this.enabled) return;
34701
+ this.currentStep = 0;
34702
+ stderr.write(`
34703
+ ${this.prefix}: Starting...
34704
+ `);
34705
+ }
34706
+ /**
34707
+ * Update to a specific step.
34708
+ */
34709
+ step(index3, message) {
34710
+ if (!this.enabled) return;
34711
+ this.currentStep = index3;
34712
+ const stepName = this.steps[index3] ?? message ?? "Working...";
34713
+ const progress = `[${index3 + 1}/${this.totalSteps}]`;
34714
+ stderr.write(` ${progress} ${stepName}...
34715
+ `);
34716
+ }
34717
+ /**
34718
+ * Move to next step.
34719
+ */
34720
+ next(message) {
34721
+ this.step(this.currentStep + 1, message);
34722
+ }
34723
+ /**
34724
+ * Mark as complete with optional summary.
34725
+ */
34726
+ complete(summary) {
34727
+ if (!this.enabled) return;
34728
+ if (summary) {
34729
+ stdout.write(`
34730
+ ${this.prefix}: \u2713 ${summary}
34731
+
34732
+ `);
34687
34733
  } else {
34688
- await dispatchFromCli("query", "admin", "health", {
34689
- detailed: opts["detailed"]
34690
- }, { command: "doctor", operation: "admin.health" });
34734
+ stdout.write(`
34735
+ ${this.prefix}: \u2713 Complete
34736
+
34737
+ `);
34738
+ }
34739
+ }
34740
+ /**
34741
+ * Report an error.
34742
+ */
34743
+ error(message) {
34744
+ if (!this.enabled) return;
34745
+ stderr.write(`
34746
+ ${this.prefix}: \u2717 ${message}
34747
+
34748
+ `);
34749
+ }
34750
+ };
34751
+ function createSelfUpdateProgress(enabled) {
34752
+ return new ProgressTracker({
34753
+ enabled,
34754
+ prefix: "CLEO",
34755
+ steps: [
34756
+ "Detecting installation type",
34757
+ "Checking current version",
34758
+ "Querying npm registry",
34759
+ "Comparing versions",
34760
+ "Running post-update checks",
34761
+ "Finalizing"
34762
+ ]
34763
+ });
34764
+ }
34765
+ function createDoctorProgress(enabled) {
34766
+ return new ProgressTracker({
34767
+ enabled,
34768
+ prefix: "CLEO Doctor",
34769
+ steps: [
34770
+ "Checking CLEO directory",
34771
+ "Verifying tasks database",
34772
+ "Checking configuration",
34773
+ "Validating schemas",
34774
+ "Running health checks"
34775
+ ]
34776
+ });
34777
+ }
34778
+ function createUpgradeProgress(enabled) {
34779
+ return new ProgressTracker({
34780
+ enabled,
34781
+ prefix: "CLEO Upgrade",
34782
+ steps: [
34783
+ "Analyzing current state",
34784
+ "Checking storage migration needs",
34785
+ "Validating schemas",
34786
+ "Applying fixes",
34787
+ "Verifying results"
34788
+ ]
34789
+ });
34790
+ }
34791
+
34792
+ // src/cli/commands/doctor.ts
34793
+ function registerDoctorCommand(program2) {
34794
+ program2.command("doctor").description("Run system diagnostics and health checks").option("--detailed", "Show detailed health check results").option("--comprehensive", "Run comprehensive doctor report").option("--fix", "Auto-fix failed checks").action(async (_opts, command) => {
34795
+ const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
34796
+ const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
34797
+ const progress = createDoctorProgress(isHuman);
34798
+ progress.start();
34799
+ try {
34800
+ if (opts["fix"]) {
34801
+ progress.step(4, "Applying fixes");
34802
+ await dispatchFromCli("mutate", "admin", "fix", {}, { command: "doctor", operation: "admin.fix" });
34803
+ progress.complete("Fixes applied");
34804
+ } else if (opts["comprehensive"]) {
34805
+ progress.step(0, "Checking CLEO directory");
34806
+ await dispatchFromCli("query", "admin", "doctor", {}, { command: "doctor", operation: "admin.doctor" });
34807
+ progress.complete("Comprehensive diagnostics complete");
34808
+ } else {
34809
+ progress.step(0, "Checking CLEO directory");
34810
+ await dispatchFromCli("query", "admin", "health", {
34811
+ detailed: opts["detailed"]
34812
+ }, { command: "doctor", operation: "admin.health" });
34813
+ progress.complete("Health check complete");
34814
+ }
34815
+ } catch (err) {
34816
+ progress.error("Health check failed");
34817
+ throw err;
34691
34818
  }
34692
34819
  });
34693
34820
  }
@@ -36730,8 +36857,8 @@ async function getCurrentVersion() {
36730
36857
  }
36731
36858
  async function getNpmInstalledVersion() {
36732
36859
  try {
36733
- const { stdout } = await execAsync2("npm", ["ls", "-g", "@cleocode/cleo", "--depth=0", "--json"]);
36734
- const data = JSON.parse(stdout);
36860
+ const { stdout: stdout2 } = await execAsync2("npm", ["ls", "-g", "@cleocode/cleo", "--depth=0", "--json"]);
36861
+ const data = JSON.parse(stdout2);
36735
36862
  return data.dependencies?.["@cleocode/cleo"]?.version ?? null;
36736
36863
  } catch {
36737
36864
  return null;
@@ -36739,19 +36866,19 @@ async function getNpmInstalledVersion() {
36739
36866
  }
36740
36867
  async function getDistTagVersion(tag) {
36741
36868
  try {
36742
- const { stdout } = await execAsync2("npm", ["view", `@cleocode/cleo@${tag}`, "version"]);
36743
- const v = stdout.trim();
36869
+ const { stdout: stdout2 } = await execAsync2("npm", ["view", `@cleocode/cleo@${tag}`, "version"]);
36870
+ const v = stdout2.trim();
36744
36871
  return v || null;
36745
36872
  } catch {
36746
36873
  if (tag === "latest") {
36747
36874
  try {
36748
- const { stdout } = await execAsync2("curl", [
36875
+ const { stdout: stdout2 } = await execAsync2("curl", [
36749
36876
  "-sL",
36750
36877
  "--max-time",
36751
36878
  "10",
36752
36879
  `https://api.github.com/repos/${GITHUB_REPO}/releases/latest`
36753
36880
  ]);
36754
- const data = JSON.parse(stdout);
36881
+ const data = JSON.parse(stdout2);
36755
36882
  return data.tag_name?.replace(/^v/, "") ?? null;
36756
36883
  } catch {
36757
36884
  return null;
@@ -36774,17 +36901,26 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
36774
36901
  );
36775
36902
  }
36776
36903
  function registerSelfUpdateCommand(program2) {
36777
- program2.command("self-update").description("Check for and install CLEO updates, then run post-update diagnostics").option("--check", "Only check if update is available").option("--status", "Show current vs latest version").option("--version <ver>", "Update to specific version").option("--channel <channel>", "Update channel: stable|beta").option("--beta", "Shortcut for --channel beta").option("--force", "Force update even if same version").option("--post-update", "Run post-update diagnostics and migration only").option("--no-auto-upgrade", "Skip automatic upgrade after update").option("--auto-migrate", "Automatically migrate storage without prompting").action(async (opts) => {
36904
+ program2.command("self-update").description("Check for and install CLEO updates, then run post-update diagnostics").option("--check", "Only check if update is available").option("--status", "Show current vs latest version").option("--version <ver>", "Update to specific version").option("--channel <channel>", "Update channel: stable|beta").option("--beta", "Shortcut for --channel beta").option("--force", "Force update even if same version").option("--post-update", "Run post-update diagnostics and migration only").option("--no-auto-upgrade", "Skip automatic upgrade after update").option("--auto-migrate", "Automatically migrate storage without prompting").action(async (_opts, command) => {
36905
+ const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
36906
+ const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
36907
+ const progress = createSelfUpdateProgress(isHuman);
36778
36908
  try {
36779
36909
  const noAutoUpgrade = opts["autoUpgrade"] === false;
36780
36910
  if (opts["postUpdate"]) {
36911
+ progress.start();
36912
+ progress.step(4, "Running post-update diagnostics");
36781
36913
  await runPostUpdateDiagnostics({ skipUpgrade: noAutoUpgrade, autoMigrate: !!opts["autoMigrate"] || !!opts["force"] });
36914
+ progress.complete("Post-update diagnostics complete");
36782
36915
  return;
36783
36916
  }
36917
+ progress.start();
36918
+ progress.step(0, "Detecting installation type");
36784
36919
  const runtime = await getRuntimeDiagnostics();
36785
36920
  const script = runtime.invocation.script;
36786
36921
  const fromNodeModules = script.includes("/node_modules/@cleocode/cleo/") || script.includes("\\node_modules\\@cleocode\\cleo\\");
36787
36922
  const isDev = runtime.channel === "dev" && !fromNodeModules;
36923
+ progress.step(1, "Checking current version");
36788
36924
  const currentVersion = isDev ? await getCurrentVersion() : await getNpmInstalledVersion() ?? await getCurrentVersion();
36789
36925
  const rawChannel = opts["channel"]?.toLowerCase();
36790
36926
  if (rawChannel && rawChannel !== "stable" && rawChannel !== "beta") {
@@ -36792,6 +36928,7 @@ function registerSelfUpdateCommand(program2) {
36792
36928
  }
36793
36929
  const requestedChannel = opts["beta"] ? "beta" : rawChannel ?? (runtime.channel === "beta" ? "beta" : "stable");
36794
36930
  if (isDev && !opts["force"]) {
36931
+ progress.step(4, "Running post-update checks");
36795
36932
  const preflight = checkStorageMigration();
36796
36933
  cliOutput({
36797
36934
  devMode: true,
@@ -36805,6 +36942,7 @@ function registerSelfUpdateCommand(program2) {
36805
36942
  }
36806
36943
  }, { command: "self-update" });
36807
36944
  if (preflight.migrationNeeded) {
36945
+ progress.error(`Storage migration needed: ${preflight.summary}`);
36808
36946
  process.stderr.write(
36809
36947
  `
36810
36948
  \u26A0 Storage migration needed: ${preflight.summary}
@@ -36813,15 +36951,19 @@ function registerSelfUpdateCommand(program2) {
36813
36951
 
36814
36952
  `
36815
36953
  );
36954
+ } else {
36955
+ progress.complete("Dev environment check complete");
36816
36956
  }
36817
36957
  process.exit(100 /* NO_DATA */);
36818
36958
  return;
36819
36959
  }
36820
36960
  if (opts["status"] || opts["check"]) {
36961
+ progress.step(2, "Querying npm registry");
36821
36962
  const latest2 = await getDistTagVersion(requestedChannel === "beta" ? "beta" : "latest");
36822
36963
  if (!latest2) {
36823
36964
  throw new CleoError(5 /* DEPENDENCY_ERROR */, "Failed to check latest version from GitHub");
36824
36965
  }
36966
+ progress.step(3, "Comparing versions");
36825
36967
  const updateAvailable = latest2 !== currentVersion;
36826
36968
  const preflight = checkStorageMigration();
36827
36969
  cliOutput({
@@ -36840,12 +36982,16 @@ function registerSelfUpdateCommand(program2) {
36840
36982
  }
36841
36983
  return;
36842
36984
  }
36985
+ progress.step(2, "Querying npm registry");
36843
36986
  const latest = opts["version"] ?? await getDistTagVersion(requestedChannel === "beta" ? "beta" : "latest");
36844
36987
  if (!latest) {
36845
36988
  throw new CleoError(5 /* DEPENDENCY_ERROR */, "Failed to check latest version from GitHub");
36846
36989
  }
36990
+ progress.step(3, "Comparing versions");
36847
36991
  if (latest === currentVersion && !opts["force"]) {
36992
+ progress.step(4, "Running post-update checks");
36848
36993
  await runPostUpdateDiagnostics({ skipUpgrade: noAutoUpgrade, autoMigrate: !!opts["autoMigrate"] || !!opts["force"] });
36994
+ progress.complete("Already up to date");
36849
36995
  cliOutput({
36850
36996
  currentVersion,
36851
36997
  upToDate: true
@@ -36853,8 +36999,10 @@ function registerSelfUpdateCommand(program2) {
36853
36999
  return;
36854
37000
  }
36855
37001
  const spec = opts["version"] ? `@cleocode/cleo@${latest}` : requestedChannel === "beta" ? "@cleocode/cleo@beta" : "@cleocode/cleo@latest";
37002
+ progress.step(4, `Installing ${spec}`);
36856
37003
  await execAsync2("npm", ["install", "-g", spec], { maxBuffer: 10 * 1024 * 1024 });
36857
37004
  await writeRuntimeVersionMetadata("prod-npm", "npm", latest);
37005
+ progress.step(5, "Finalizing");
36858
37006
  cliOutput({
36859
37007
  currentVersion,
36860
37008
  targetVersion: latest,
@@ -36863,11 +37011,14 @@ function registerSelfUpdateCommand(program2) {
36863
37011
  command: `npm install -g ${spec}`
36864
37012
  }, { command: "self-update", message: `Updated to ${latest}` });
36865
37013
  await runPostUpdateDiagnostics({ skipUpgrade: noAutoUpgrade, autoMigrate: !!opts["autoMigrate"] || !!opts["force"] });
37014
+ progress.complete(`Updated to ${latest}`);
36866
37015
  } catch (err) {
36867
37016
  if (err instanceof CleoError) {
37017
+ progress.error(err.message);
36868
37018
  console.error(formatError(err));
36869
37019
  process.exit(err.code);
36870
37020
  }
37021
+ progress.error("Unexpected error during update");
36871
37022
  throw err;
36872
37023
  }
36873
37024
  });
@@ -37117,16 +37268,29 @@ init_output();
37117
37268
  init_renderers();
37118
37269
  init_errors();
37119
37270
  function registerUpgradeCommand(program2) {
37120
- program2.command("upgrade").description("Unified project maintenance (storage migration, schema repair, structural fixes)").option("--status", "Show what needs updating without making changes").option("--dry-run", "Preview changes without applying").option("--include-global", "Also check global ~/.cleo data").option("--no-auto-migrate", "Skip automatic JSON\u2192SQLite migration").action(async (opts) => {
37271
+ program2.command("upgrade").description("Unified project maintenance (storage migration, schema repair, structural fixes)").option("--status", "Show what needs updating without making changes").option("--dry-run", "Preview changes without applying").option("--include-global", "Also check global ~/.cleo data").option("--no-auto-migrate", "Skip automatic JSON\u2192SQLite migration").action(async (_opts, command) => {
37272
+ const opts = command.optsWithGlobals ? command.optsWithGlobals() : command.opts();
37273
+ const isHuman = opts["human"] === true || !!process.stdout.isTTY && opts["json"] !== true;
37274
+ const progress = createUpgradeProgress(isHuman);
37121
37275
  try {
37122
37276
  const isDryRun = !!opts["dryRun"] || !!opts["status"];
37123
37277
  const includeGlobal = !!opts["includeGlobal"];
37124
37278
  const autoMigrate = opts["autoMigrate"] !== false;
37279
+ progress.start();
37280
+ progress.step(0, "Analyzing current state");
37281
+ if (includeGlobal) {
37282
+ progress.step(1, "Checking global ~/.cleo data");
37283
+ } else {
37284
+ progress.step(1, "Checking storage migration needs");
37285
+ }
37286
+ progress.step(2, "Validating schemas");
37287
+ progress.step(3, isDryRun ? "Previewing changes" : "Applying fixes");
37125
37288
  const result = await runUpgrade({
37126
37289
  dryRun: isDryRun,
37127
37290
  includeGlobal,
37128
37291
  autoMigrate
37129
37292
  });
37293
+ progress.step(4, "Verifying results");
37130
37294
  cliOutput({
37131
37295
  upToDate: result.upToDate,
37132
37296
  dryRun: result.dryRun,
@@ -37136,13 +37300,17 @@ function registerUpgradeCommand(program2) {
37136
37300
  storageMigration: result.storageMigration
37137
37301
  }, { command: "upgrade" });
37138
37302
  if (!result.success) {
37303
+ progress.error("Upgrade failed with errors");
37139
37304
  process.exit(1);
37140
37305
  }
37306
+ progress.complete(isDryRun ? "Preview complete" : "Upgrade complete");
37141
37307
  } catch (err) {
37142
37308
  if (err instanceof CleoError) {
37309
+ progress.error(err.message);
37143
37310
  console.error(formatError(err));
37144
37311
  process.exit(err.code);
37145
37312
  }
37313
+ progress.error("Unexpected error during upgrade");
37146
37314
  throw err;
37147
37315
  }
37148
37316
  });