@theholocron/cli 5.0.0-alpha.576 → 5.0.0-alpha.577

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
@@ -8,7 +8,7 @@ import { ProviderApiError, ProviderApiError as ProviderApiError$1, createRestCli
8
8
  import { addGlobalOptions, groupMenu as groupMenu$1, tokenContext as tokenContext$1 } from "@theholocron/kyber/flags";
9
9
  import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, dryRunPreviewEnvVar, numeric, spawnChild } from "@theholocron/kyber/menu";
10
10
  import { checkForUpdates } from "@theholocron/kyber/notifier";
11
- import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, statusRow as statusRow$1, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
11
+ import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, startCommandProgress, statusRow as statusRow$1, stopCommandSpinner, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
12
12
  import { LOG_LEVELS } from "@theholocron/observability/core";
13
13
  import yargs from "yargs";
14
14
  import { hideBin } from "yargs/helpers";
@@ -42471,6 +42471,89 @@ const COMMAND_MODULES = [
42471
42471
  rotateCommand,
42472
42472
  projectCommand
42473
42473
  ];
42474
+ // src/cli/command-progress/command-progress.ts
42475
+ /**
42476
+ * The commands that get no start-up spinner, each with its reason. They hand the terminal to something else, a child
42477
+ * process or the person, whose output the CLI cannot see: a spinner would be drawn over it. Every other command gets one,
42478
+ * so a new command is covered with no wiring (see `startCommandProgress()` in `@theholocron/kyber/ui`).
42479
+ */
42480
+ const PROGRESS_EXEMPT = [
42481
+ {
42482
+ command: "run",
42483
+ reason: "runs the repo's own tools, which write to the terminal themselves"
42484
+ },
42485
+ {
42486
+ command: "deploy",
42487
+ exact: true,
42488
+ reason: "builds the app and uploads it with child processes that write to the terminal"
42489
+ },
42490
+ {
42491
+ command: "deploy on-release",
42492
+ reason: "runs each package's deploy script, which writes to the terminal"
42493
+ },
42494
+ {
42495
+ command: "publish",
42496
+ reason: "runs npm and git, which write to the terminal and may ask for a one-time code"
42497
+ },
42498
+ {
42499
+ command: "upgrade",
42500
+ reason: "runs the package manager, which writes to the terminal"
42501
+ },
42502
+ {
42503
+ command: "dev",
42504
+ reason: "supervises the app and a tunnel for as long as they run"
42505
+ },
42506
+ {
42507
+ command: "new tunnel",
42508
+ reason: "runs cloudflared in the foreground for as long as it runs"
42509
+ },
42510
+ {
42511
+ command: "new repo",
42512
+ reason: "asks its own questions and runs the package manager"
42513
+ },
42514
+ {
42515
+ command: "new plugin",
42516
+ reason: "asks its own questions and runs the package manager"
42517
+ },
42518
+ {
42519
+ command: "clone",
42520
+ reason: "runs git, which writes its own progress"
42521
+ },
42522
+ {
42523
+ command: "install skills",
42524
+ reason: "runs the skills installer, which writes to the terminal"
42525
+ },
42526
+ {
42527
+ command: "update skills",
42528
+ reason: "runs the skills installer, which writes to the terminal"
42529
+ },
42530
+ {
42531
+ command: "open requests",
42532
+ reason: "holds the terminal for the request tool until it is closed"
42533
+ },
42534
+ {
42535
+ command: "start agent",
42536
+ reason: "hands the terminal to the agent"
42537
+ }
42538
+ ];
42539
+ /** Whether `words` is `exemption`'s command, or one under it when it is not `exact`. */
42540
+ function matches(words, exemption) {
42541
+ const parts = exemption.command.split(" ");
42542
+ if (exemption.exact && words.length !== parts.length) return false;
42543
+ return parts.every((part, i) => words[i] === part);
42544
+ }
42545
+ /**
42546
+ * The spinner text for a command, `doctor secrets…`, or `undefined` when it gets none: no command words (the menu), or a
42547
+ * command in {@link PROGRESS_EXEMPT}.
42548
+ *
42549
+ * @param words - The command's words, `argv._`.
42550
+ */
42551
+ function commandProgressLabel(words) {
42552
+ const named = words.slice(0, 3).map(String);
42553
+ if (named.length === 0) return void 0;
42554
+ if (PROGRESS_EXEMPT.some((exemption) => matches(named, exemption))) return void 0;
42555
+ return `${named.join(" ")}…`;
42556
+ }
42474
42557
  // src/cli/own-package-json.ts
42475
42558
  /**
42476
42559
  * The `name` and `version` of the package that `moduleUrl` belongs to, from the nearest `package.json` above it.
@@ -42552,6 +42635,8 @@ try {
42552
42635
  org: argv.org
42553
42636
  });
42554
42637
  finishCommand = startCommand$1(name);
42638
+ const label = commandProgressLabel(argv._);
42639
+ if (label) startCommandProgress(label);
42555
42640
  }).command(COMMAND_MODULES).command(menuCommand(CLI_VERSION)).strict().help().epilogue(`Execution contexts:
42556
42641
  global works from a bare 'npm i -g': ${commandsInContext("global").join(", ")}\n repo-aware needs ./holocron.config in cwd: ${commandsInContext("repo-aware").join(", ")}\n workspace also needs the plugin packages: ${commandsInContext("workspace").join(", ")}\n https://docs.theholocron.dev/holocron/execution-contexts`).fail((msg, err) => {
42557
42642
  if (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {
@@ -42570,6 +42655,8 @@ try {
42570
42655
  captureException(err);
42571
42656
  if (!errorReported) reportError(commandFailureMessage(err));
42572
42657
  if (!process.exitCode) process.exitCode = 1;
42658
+ } finally {
42659
+ stopCommandSpinner();
42573
42660
  }
42574
42661
  finishCommand(!process.exitCode);
42575
42662
  endSession();