@theholocron/cli 5.0.0-alpha.262 → 5.0.0-alpha.263

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
@@ -117,7 +117,7 @@ A `workspace` command run from a bare global install (no plugins next to the
117
117
  CLI) fails with one actionable line — install the plugins as devDependencies or
118
118
  use `pnpm exec holocron <cmd>`. `auth check` degrades to "token present,
119
119
  verification skipped" instead. `holocron --help` prints the grouping; see
120
- [Execution Contexts](https://theholocron.github.io/holocron/execution-contexts).
120
+ [Execution Contexts](https://docs.theholocron.dev/holocron/execution-contexts).
121
121
 
122
122
  ### Viewing the resolved config
123
123
 
@@ -767,6 +767,9 @@ the local override exists to exempt.
767
767
  `repo upgrade deps`, `new plugin`, `auth`, `notifications setup`,
768
768
  `notifications channel add`, `notifications link`,
769
769
  `notifications sync-roles`, `doctor notifications`
770
+ - `src/commands/doctor-checks/` and `src/commands/deep-checks/` — the shared row
771
+ renderer and `declaredVsActual` helper, and `DEEP_CHECKS`, the registry every
772
+ `doctor <capability>` is listed in
770
773
  - `src/interactive-menu/` — the interactive fallback: `command-registry`
771
774
  (`COMMAND_REGISTRY`, each entry's `positionals`/`options`), `launch-menu`
772
775
  (Layers 1–2, picks + spawns a fresh `holocron <command>`), `child-argv`
package/dist/cli.mjs CHANGED
@@ -2679,7 +2679,7 @@ var WorkspaceContextError = class extends Error {
2679
2679
  constructor(command, packages) {
2680
2680
  const [first, ...rest] = packages;
2681
2681
  const subject = rest.length > 0 ? `${first} (and ${rest.length} other${rest.length === 1 ? "" : "s"})` : first ?? "its plugins";
2682
- super(`\`${command}\` needs ${subject}, but no plugin package resolves here.\nRun it from a repo that has the \`@theholocron/holocron-plugin-*\` packages as devDependencies, or \`pnpm exec holocron ${command}\`. A global install can't resolve them — see https://theholocron.github.io/holocron/execution-contexts`);
2682
+ super(`\`${command}\` needs ${subject}, but no plugin package resolves here.\nRun it from a repo that has the \`@theholocron/holocron-plugin-*\` packages as devDependencies, or \`pnpm exec holocron ${command}\`. A global install can't resolve them — see https://docs.theholocron.dev/holocron/execution-contexts`);
2683
2683
  this.command = command;
2684
2684
  this.packages = packages;
2685
2685
  }
@@ -3882,6 +3882,21 @@ function logReason(err) {
3882
3882
  const root = err instanceof Error && err.cause !== void 0 ? err.cause : err;
3883
3883
  return errorMessage(root);
3884
3884
  }
3885
+ // src/commands/doctor-checks/print-check-rows.ts
3886
+ /** One row per step, titles padded to the widest, each problem on its own indented line. */
3887
+ function printCheckRows(rows, print) {
3888
+ const width = Math.max(0, ...rows.map((row) => row.title.length));
3889
+ for (const row of rows) {
3890
+ print(statusRow(row.status, [row.title.padEnd(width), row.detail]));
3891
+ for (const problem of row.problems) print(` - ${problem}`);
3892
+ }
3893
+ }
3894
+ // src/commands/doctor-checks/print-check-summary.ts
3895
+ /** A blank line, then the closing `N ok, N fail, N skipped`. */
3896
+ function printCheckSummary(summary, print) {
3897
+ print("");
3898
+ print(style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
3899
+ }
3885
3900
  // src/commands/notifications-channel-add/avatar.ts
3886
3901
  /**
3887
3902
  * Read a webhook avatar named in a layout: a file path (from the directory the CLI runs in) or an
@@ -4964,8 +4979,11 @@ async function runDoctorNotifications(input) {
4964
4979
  };
4965
4980
  const refuse = (message, reason = message) => {
4966
4981
  print(` ${style.fail(message)}`);
4967
- print("");
4968
- print(style.header("0 ok, 1 fail, 0 skipped"));
4982
+ printCheckSummary({
4983
+ ok: 0,
4984
+ fail: 1,
4985
+ skip: 0
4986
+ }, print);
4969
4987
  logger.warn({ reason }, "doctor notifications");
4970
4988
  return {
4971
4989
  status: "fail",
@@ -5398,49 +5416,74 @@ async function runDoctorNotifications(input) {
5398
5416
  } catch (err) {
5399
5417
  failed("server-owner", OWNER_TITLE, shown(describeProviderError(err)));
5400
5418
  }
5401
- const width = Math.max(...checks.map((c) => c.title.length));
5402
- for (const check of checks) {
5403
- print(statusRow(check.status === "pass" ? "ok" : "fail", [check.title.padEnd(width), check.detail]));
5404
- for (const problem of check.problems) print(` - ${problem}`);
5405
- }
5419
+ printCheckRows(checks.map((check) => ({
5420
+ ...check,
5421
+ status: check.status === "pass" ? "ok" : "fail"
5422
+ })), print);
5406
5423
  if (deliveryNote) {
5407
5424
  print("");
5408
5425
  print(` ${style.skip(`note: ${deliveryNote}`)}`);
5409
5426
  }
5410
5427
  const summary = summarise();
5411
- print("");
5412
- print(style.header(`${summary.pass} ok, ${summary.fail} fail, ${summary.skip} skipped`));
5428
+ printCheckSummary({
5429
+ ok: summary.pass,
5430
+ fail: summary.fail,
5431
+ skip: summary.skip
5432
+ }, print);
5413
5433
  return finish();
5414
5434
  }
5415
- // src/commands/doctor-notifications/doctor-notifications.command.ts
5416
- const doctorNotificationsCommand = {
5417
- command: "notifications",
5418
- describe: "Check the layout against the server and the secrets store, step by step (a full run leaves one test post in the test channel; --built-only posts nothing unless --deliver)",
5419
- builder: doctorNotificationsArgs,
5420
- handler: async (argv) => {
5421
- const tokens = tokenContext(argv.token);
5422
- if (!tokens) return;
5423
- const loaded = await loadConfig(argv.cwd);
5424
- applyResolvedConfig(argv, loaded.resolved);
5425
- if ((await runDoctorNotifications({
5426
- loaded,
5427
- context: {
5428
- repoRoot: argv.cwd,
5429
- ...tokens,
5430
- org: resolveOrg(argv, loaded.resolved)
5435
+ // src/commands/deep-checks/deep-checks.ts
5436
+ /**
5437
+ * Every `doctor <capability>` deep check, in the order `doctor --all` runs them. Adding one is an entry here
5438
+ * plus its `COMMAND_CONTEXTS` and `COMMAND_REGISTRY` entries; `deep-checks.test.ts` fails without them.
5439
+ */
5440
+ const DEEP_CHECKS = [{
5441
+ name: "notifications",
5442
+ capability: "notifications",
5443
+ command: {
5444
+ command: "notifications",
5445
+ describe: "Check the layout against the server and the secrets store, step by step (a full run leaves one test post in the test channel; --built-only posts nothing unless --deliver)",
5446
+ builder: doctorNotificationsArgs,
5447
+ handler: async (argv) => {
5448
+ const tokens = tokenContext(argv.token);
5449
+ if (!tokens) return;
5450
+ const loaded = await loadConfig(argv.cwd);
5451
+ applyResolvedConfig(argv, loaded.resolved);
5452
+ if ((await runDoctorNotifications({
5453
+ loaded,
5454
+ context: {
5455
+ repoRoot: argv.cwd,
5456
+ ...tokens,
5457
+ org: resolveOrg(argv, loaded.resolved)
5458
+ },
5459
+ ...argv.scope ? { scope: parseScope(argv.scope) } : {},
5460
+ ...argv.provider ? { provider: argv.provider } : {},
5461
+ ...argv.builtOnly ? { builtOnly: true } : {},
5462
+ ...argv.deliver ? { deliver: true } : {}
5463
+ })).status === "fail") process.exitCode = 1;
5464
+ }
5465
+ },
5466
+ async run(input) {
5467
+ const report = await runDoctorNotifications(input);
5468
+ return {
5469
+ status: report.status,
5470
+ summary: {
5471
+ ok: report.summary.pass,
5472
+ fail: report.summary.fail,
5473
+ skip: report.summary.skip
5431
5474
  },
5432
- ...argv.scope ? { scope: parseScope(argv.scope) } : {},
5433
- ...argv.provider ? { provider: argv.provider } : {},
5434
- ...argv.builtOnly ? { builtOnly: true } : {},
5435
- ...argv.deliver ? { deliver: true } : {}
5436
- })).status === "fail") process.exitCode = 1;
5475
+ ...report.message ? { reason: report.message } : {}
5476
+ };
5437
5477
  }
5438
- };
5478
+ }];
5439
5479
  // src/commands/doctor/doctor.args.ts
5440
- const doctorArgs = (y) => y.option("repo", {
5441
- type: "string",
5442
- describe: "Repo coords (\"owner/name\"). Defaults to plugin-specific resolution."
5443
- }).command(doctorNotificationsCommand);
5480
+ const doctorArgs = (y) => {
5481
+ const withRepo = y.option("repo", {
5482
+ type: "string",
5483
+ describe: "Repo coords (\"owner/name\"). Defaults to plugin-specific resolution."
5484
+ });
5485
+ return DEEP_CHECKS.reduce((acc, check) => acc.command(check.command), withRepo);
5486
+ };
5444
5487
  // src/commands/doctor/doctor.ts
5445
5488
  /**
5446
5489
  * `holocron doctor` — load the config, instantiate every capability,
@@ -16144,7 +16187,7 @@ try {
16144
16187
  });
16145
16188
  finishCommand = startCommand(name);
16146
16189
  }).command(cloneCommand).command(doctorCommand).command(skillsCommand).command(runCommand).command(configShowCommand).command(authCommand).command(menuCommand(CLI_VERSION)).command(repoCommand).command(newCommand).command(probeCommand).command(secretsCommand).command(notificationsCommand).command(syncCommand).command(packageCommand).command(deployCommand).command(monitoringCommand).strict().help().epilogue(`Execution contexts:
16147
- 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://theholocron.github.io/holocron/execution-contexts`).fail((msg, err) => {
16190
+ 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) => {
16148
16191
  if (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {
16149
16192
  captureException(err);
16150
16193
  reportError(err.message);