@theholocron/cli 5.0.0-alpha.226 → 5.0.0-alpha.227

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.mjs CHANGED
@@ -12590,6 +12590,25 @@ function buildRunMenuEntries(taskNames) {
12590
12590
  return entries;
12591
12591
  }
12592
12592
  //#endregion
12593
+ //#region src/ui/command-failure/command-failure.ts
12594
+ /**
12595
+ * Error class names whose `.message` is a complete, actionable sentence. Any other error is printed too, so a command
12596
+ * that throws a plain `Error` is never silent; this set only marks the ones written to be read as they are.
12597
+ */
12598
+ const USER_FACING_ERRORS = /* @__PURE__ */ new Set([
12599
+ "WorkspaceContextError",
12600
+ "ConfigFileError",
12601
+ "NonInteractiveError"
12602
+ ]);
12603
+ /**
12604
+ * The line to print for an error that reached the top level: its message with control characters stripped (a provider's
12605
+ * text can carry them), plus a provider's response detail when it has one. Never empty, so a failure always says
12606
+ * something.
12607
+ */
12608
+ function commandFailureMessage(err) {
12609
+ return describeProviderError(err) || (err instanceof Error ? err.name : "the command failed");
12610
+ }
12611
+ //#endregion
12593
12612
  //#region src/update-notifier/update-notifier.ts
12594
12613
  const PACKAGE_NAME = "@theholocron/cli";
12595
12614
  const CACHE_TTL_MS = 864e5;
@@ -12711,15 +12730,6 @@ const resolveSyncToken = createFeatureResolver({
12711
12730
  envName: "HOLOCRON_SYNC_TOKEN",
12712
12731
  keyringKey: "github.sync"
12713
12732
  });
12714
- /**
12715
- * Error class names whose `.message` is a complete, actionable sentence —
12716
- * the top-level catch prints it and suppresses the stack trace.
12717
- */
12718
- const USER_FACING_ERRORS = /* @__PURE__ */ new Set([
12719
- "WorkspaceContextError",
12720
- "ConfigFileError",
12721
- "NonInteractiveError"
12722
- ]);
12723
12733
  const { version: CLI_VERSION } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
12724
12734
  /** Whether to print the correlation id at command end (`--debug` / `--verbose`). */
12725
12735
  let printRunId = false;
@@ -14024,7 +14034,7 @@ try {
14024
14034
  }).parse();
14025
14035
  } catch (err) {
14026
14036
  captureException(err);
14027
- if (!errorReported && err instanceof Error && USER_FACING_ERRORS.has(err.name)) reportError(err.message);
14037
+ if (!errorReported) reportError(commandFailureMessage(err));
14028
14038
  if (!process.exitCode) process.exitCode = 1;
14029
14039
  }
14030
14040
  finishCommand(!process.exitCode);