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

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
 
@@ -555,6 +555,8 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
555
555
 
556
556
  `holocron secrets sync <env> --worker <script>` also sets every key of the vault environment on a deployed Worker as a secret, through the optional `Workers.setSecret(script, name, value)` (write-only; the Cloudflare plugin implements it). The Worker must already exist. Sync only adds and updates: it never removes a binding, because a Worker also holds secrets that are not in the vault (for Comlink, the `COMLINK_<SOURCE>_WEBHOOK` that `notifications setup` sets), so a key deleted from the vault must be deleted from the Worker separately. Keys are written one at a time and each is reported; if one fails, the exit code is 1 and re-running finishes the rest, since every write is idempotent.
557
557
 
558
+ `holocron secrets list [--scope repo|environment|organization] [--env <name>] [--json]` prints the names (never the values; GitHub does not return them) of the secrets at each scope, sorted, under a heading per scope. With no `--scope` it lists the repository, plus the organization (`--org`, `HOLOCRON_ORG` or the config's `org`) and the `--env` environment when they are known; `--scope` lists one. A scope that cannot be listed is reported under its heading and the rest are still listed; the exit code is 1 if any failed. `--json` prints `[{ scope, names, error? }]`. It is read-only, so `--dry-run` does not apply. Comparing the names with what the config expects is `doctor secrets`.
559
+
558
560
  Pinned messages are declared under the provider's `layout` as `pinned: [{ channel, content }]` (`channel` is a channel in the layout, `content` up to 2000 characters); the layout is the whole set of messages the bot has pinned in those channels.
559
561
 
560
562
  Config shape added for role sync and sign-in (all under the provider's `layout`):
@@ -762,11 +764,14 @@ the local override exists to exempt.
762
764
  `astromech.reusableTemplates()` to `theholocron/.github` (a pure sync target —
763
765
  never hand-edit its `.github/workflows/*`).
764
766
  - `src/commands/` — `repo setup`, `repo sync`, `doctor`, `deploy`,
765
- `monitoring check`, `secrets set`, `secrets sync`, `package publish`,
767
+ `monitoring check`, `secrets list`, `secrets set`, `secrets sync`, `package publish`,
766
768
  `package bump-versions`, `sync github`, `repo upgrade node`,
767
769
  `repo upgrade deps`, `new plugin`, `auth`, `notifications setup`,
768
770
  `notifications channel add`, `notifications link`,
769
771
  `notifications sync-roles`, `doctor notifications`
772
+ - `src/commands/doctor-checks/` and `src/commands/deep-checks/` — the shared row
773
+ renderer and `declaredVsActual` helper, and `DEEP_CHECKS`, the registry every
774
+ `doctor <capability>` is listed in
770
775
  - `src/interactive-menu/` — the interactive fallback: `command-registry`
771
776
  (`COMMAND_REGISTRY`, each entry's `positionals`/`options`), `launch-menu`
772
777
  (Layers 1–2, picks + spawns a fresh `holocron <command>`), `child-argv`
package/dist/cli.mjs CHANGED
@@ -206,6 +206,7 @@ const COMMAND_CONTEXTS = {
206
206
  "repo sync readme": "repo-aware",
207
207
  doctor: "workspace",
208
208
  "repo setup": "workspace",
209
+ "secrets list": "workspace",
209
210
  "secrets set": "workspace",
210
211
  "secrets sync": "workspace",
211
212
  "notifications channel add": "workspace",
@@ -1602,6 +1603,12 @@ const COMMAND_REGISTRY = [
1602
1603
  }],
1603
1604
  supportsDryRun: true
1604
1605
  },
1606
+ {
1607
+ name: "secrets list",
1608
+ description: "List the names of the secrets at each scope (never the values)",
1609
+ positionals: [],
1610
+ supportsDryRun: false
1611
+ },
1605
1612
  {
1606
1613
  name: "secrets sync",
1607
1614
  description: "Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars",
@@ -2679,7 +2686,7 @@ var WorkspaceContextError = class extends Error {
2679
2686
  constructor(command, packages) {
2680
2687
  const [first, ...rest] = packages;
2681
2688
  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`);
2689
+ 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
2690
  this.command = command;
2684
2691
  this.packages = packages;
2685
2692
  }
@@ -3882,6 +3889,21 @@ function logReason(err) {
3882
3889
  const root = err instanceof Error && err.cause !== void 0 ? err.cause : err;
3883
3890
  return errorMessage(root);
3884
3891
  }
3892
+ // src/commands/doctor-checks/print-check-rows.ts
3893
+ /** One row per step, titles padded to the widest, each problem on its own indented line. */
3894
+ function printCheckRows(rows, print) {
3895
+ const width = Math.max(0, ...rows.map((row) => row.title.length));
3896
+ for (const row of rows) {
3897
+ print(statusRow(row.status, [row.title.padEnd(width), row.detail]));
3898
+ for (const problem of row.problems) print(` - ${problem}`);
3899
+ }
3900
+ }
3901
+ // src/commands/doctor-checks/print-check-summary.ts
3902
+ /** A blank line, then the closing `N ok, N fail, N skipped`. */
3903
+ function printCheckSummary(summary, print) {
3904
+ print("");
3905
+ print(style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
3906
+ }
3885
3907
  // src/commands/notifications-channel-add/avatar.ts
3886
3908
  /**
3887
3909
  * Read a webhook avatar named in a layout: a file path (from the directory the CLI runs in) or an
@@ -4964,8 +4986,11 @@ async function runDoctorNotifications(input) {
4964
4986
  };
4965
4987
  const refuse = (message, reason = message) => {
4966
4988
  print(` ${style.fail(message)}`);
4967
- print("");
4968
- print(style.header("0 ok, 1 fail, 0 skipped"));
4989
+ printCheckSummary({
4990
+ ok: 0,
4991
+ fail: 1,
4992
+ skip: 0
4993
+ }, print);
4969
4994
  logger.warn({ reason }, "doctor notifications");
4970
4995
  return {
4971
4996
  status: "fail",
@@ -5398,49 +5423,74 @@ async function runDoctorNotifications(input) {
5398
5423
  } catch (err) {
5399
5424
  failed("server-owner", OWNER_TITLE, shown(describeProviderError(err)));
5400
5425
  }
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
- }
5426
+ printCheckRows(checks.map((check) => ({
5427
+ ...check,
5428
+ status: check.status === "pass" ? "ok" : "fail"
5429
+ })), print);
5406
5430
  if (deliveryNote) {
5407
5431
  print("");
5408
5432
  print(` ${style.skip(`note: ${deliveryNote}`)}`);
5409
5433
  }
5410
5434
  const summary = summarise();
5411
- print("");
5412
- print(style.header(`${summary.pass} ok, ${summary.fail} fail, ${summary.skip} skipped`));
5435
+ printCheckSummary({
5436
+ ok: summary.pass,
5437
+ fail: summary.fail,
5438
+ skip: summary.skip
5439
+ }, print);
5413
5440
  return finish();
5414
5441
  }
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)
5442
+ // src/commands/deep-checks/deep-checks.ts
5443
+ /**
5444
+ * Every `doctor <capability>` deep check, in the order `doctor --all` runs them. Adding one is an entry here
5445
+ * plus its `COMMAND_CONTEXTS` and `COMMAND_REGISTRY` entries; `deep-checks.test.ts` fails without them.
5446
+ */
5447
+ const DEEP_CHECKS = [{
5448
+ name: "notifications",
5449
+ capability: "notifications",
5450
+ command: {
5451
+ command: "notifications",
5452
+ 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)",
5453
+ builder: doctorNotificationsArgs,
5454
+ handler: async (argv) => {
5455
+ const tokens = tokenContext(argv.token);
5456
+ if (!tokens) return;
5457
+ const loaded = await loadConfig(argv.cwd);
5458
+ applyResolvedConfig(argv, loaded.resolved);
5459
+ if ((await runDoctorNotifications({
5460
+ loaded,
5461
+ context: {
5462
+ repoRoot: argv.cwd,
5463
+ ...tokens,
5464
+ org: resolveOrg(argv, loaded.resolved)
5465
+ },
5466
+ ...argv.scope ? { scope: parseScope(argv.scope) } : {},
5467
+ ...argv.provider ? { provider: argv.provider } : {},
5468
+ ...argv.builtOnly ? { builtOnly: true } : {},
5469
+ ...argv.deliver ? { deliver: true } : {}
5470
+ })).status === "fail") process.exitCode = 1;
5471
+ }
5472
+ },
5473
+ async run(input) {
5474
+ const report = await runDoctorNotifications(input);
5475
+ return {
5476
+ status: report.status,
5477
+ summary: {
5478
+ ok: report.summary.pass,
5479
+ fail: report.summary.fail,
5480
+ skip: report.summary.skip
5431
5481
  },
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;
5482
+ ...report.message ? { reason: report.message } : {}
5483
+ };
5437
5484
  }
5438
- };
5485
+ }];
5439
5486
  // 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);
5487
+ const doctorArgs = (y) => {
5488
+ const withRepo = y.option("repo", {
5489
+ type: "string",
5490
+ describe: "Repo coords (\"owner/name\"). Defaults to plugin-specific resolution."
5491
+ });
5492
+ return DEEP_CHECKS.reduce((acc, check) => acc.command(check.command), withRepo);
5493
+ };
5444
5494
  // src/commands/doctor/doctor.ts
5445
5495
  /**
5446
5496
  * `holocron doctor` — load the config, instantiate every capability,
@@ -15145,9 +15195,9 @@ async function runSecretSet(input) {
15145
15195
  if (!loader.has("secrets")) throw new Error("`secrets` capability is not configured — add a `secrets` provider to holocron.config.json");
15146
15196
  const value = await resolveValue(input);
15147
15197
  if (!value) throw new Error(`no value for secret \`${input.name}\` — pass it positionally, via --from-stdin, --from-env <NAME>, or set $${input.name} in the environment`);
15148
- print(`Holocron secret set — ${input.name} (${describeScope(scope)})${dryRun ? " (dry-run)" : ""}`);
15198
+ print(`Holocron secret set — ${input.name} (${describeScope$1(scope)})${dryRun ? " (dry-run)" : ""}`);
15149
15199
  if (dryRun) {
15150
- const message = `would: secrets.setSecret(${describeScope(scope)}, ${input.name}, <${value.length} chars>)`;
15200
+ const message = `would: secrets.setSecret(${describeScope$1(scope)}, ${input.name}, <${value.length} chars>)`;
15151
15201
  print(` … ${message}`);
15152
15202
  return {
15153
15203
  status: "dry-run",
@@ -15162,7 +15212,7 @@ async function runSecretSet(input) {
15162
15212
  print(` ✓ set ${input.name} via ${secrets.providerName}`);
15163
15213
  logger.info({
15164
15214
  key: input.name,
15165
- scope: describeScope(scope),
15215
+ scope: describeScope$1(scope),
15166
15216
  provider: secrets.providerName,
15167
15217
  status: "ok"
15168
15218
  }, `secret set: ${input.name}`);
@@ -15176,7 +15226,7 @@ async function runSecretSet(input) {
15176
15226
  print(` ✗ ${message}`);
15177
15227
  logger.warn({
15178
15228
  key: input.name,
15179
- scope: describeScope(scope),
15229
+ scope: describeScope$1(scope),
15180
15230
  reason: message
15181
15231
  }, `secret set: ${input.name}`);
15182
15232
  return {
@@ -15201,7 +15251,7 @@ async function defaultReadStdin() {
15201
15251
  process.stdin.on("error", reject);
15202
15252
  });
15203
15253
  }
15204
- function describeScope(scope) {
15254
+ function describeScope$1(scope) {
15205
15255
  if (scope.kind === "repo") return "scope=repo";
15206
15256
  if (scope.kind === "environment") return `scope=environment:${scope.name}`;
15207
15257
  return `scope=organization:${scope.name}`;
@@ -15254,6 +15304,154 @@ const secretSetCommand = {
15254
15304
  })).status === "fail") process.exitCode = 1;
15255
15305
  }
15256
15306
  };
15307
+ // src/commands/secrets-list/secrets-list.ts
15308
+ /**
15309
+ * `holocron secrets list` — which secrets exist, by name, at each scope.
15310
+ *
15311
+ * Read-only: GitHub never returns a value, so only names are printed. A scope
15312
+ * that cannot be listed (a token without the scope, a missing environment) is
15313
+ * reported under its heading and counted, and the other scopes are still
15314
+ * listed; the command exits non-zero when any failed.
15315
+ */
15316
+ async function runSecretsList(input) {
15317
+ const print = input.print ?? ((line) => console.log(line));
15318
+ const logger = input.logger ?? getLogger();
15319
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
15320
+ await loader.load();
15321
+ assertPluginsResolvable(loader, "secrets list");
15322
+ if (!loader.has("secrets")) throw new Error("`secrets` capability is not configured — add a `secrets` provider to holocron.config.json");
15323
+ const secrets = loader.get("secrets");
15324
+ const groups = [];
15325
+ for (const scope of input.scopes) {
15326
+ const label = describeScope(scope);
15327
+ try {
15328
+ const names = [...await secrets.listSecrets(scope)].sort();
15329
+ groups.push({
15330
+ scope,
15331
+ label,
15332
+ names
15333
+ });
15334
+ logger.info({
15335
+ scope: label,
15336
+ count: names.length,
15337
+ provider: secrets.providerName
15338
+ }, `secrets list: ${label}`);
15339
+ } catch (err) {
15340
+ const error = errorMessage(err);
15341
+ groups.push({
15342
+ scope,
15343
+ label,
15344
+ names: [],
15345
+ error
15346
+ });
15347
+ logger.warn({
15348
+ scope: label,
15349
+ reason: error
15350
+ }, `secrets list: ${label}`);
15351
+ }
15352
+ }
15353
+ const report = {
15354
+ groups,
15355
+ failed: groups.filter((g) => g.error !== void 0).length
15356
+ };
15357
+ if (input.json) print(JSON.stringify(groups.map(({ label: _label, ...group }) => group), null, 2));
15358
+ else printGroups(groups, print);
15359
+ return report;
15360
+ }
15361
+ function printGroups(groups, print) {
15362
+ for (const [index, group] of groups.entries()) {
15363
+ if (index > 0) print("");
15364
+ print(group.label);
15365
+ if (group.error !== void 0) print(` ✗ ${group.error}`);
15366
+ else if (group.names.length === 0) print(" (none)");
15367
+ else for (const name of group.names) print(` ${name}`);
15368
+ }
15369
+ }
15370
+ function describeScope(scope) {
15371
+ if (scope.kind === "repo") return "repo";
15372
+ return `${scope.kind} ${scope.name}`;
15373
+ }
15374
+ // src/commands/secrets-list/secrets-list-scopes.ts
15375
+ /**
15376
+ * Turns `--scope`, `--env` and the resolved organization into the scopes to list.
15377
+ * With no `--scope` it lists the repository, then the organization and the
15378
+ * environment when one was named. Naming a scope whose name is missing throws.
15379
+ */
15380
+ function secretsListScopes(input) {
15381
+ const { scope, env, org } = input;
15382
+ if (scope === "repo") return [{ kind: "repo" }];
15383
+ if (scope === "environment") {
15384
+ if (!env) throw new Error("`--scope environment` needs `--env <name>`");
15385
+ return [{
15386
+ kind: "environment",
15387
+ name: env
15388
+ }];
15389
+ }
15390
+ if (scope === "organization") {
15391
+ if (!org) throw new Error("`--scope organization` needs `--org <name>` or `org` in holocron.config.ts");
15392
+ return [{
15393
+ kind: "organization",
15394
+ name: org
15395
+ }];
15396
+ }
15397
+ return [
15398
+ { kind: "repo" },
15399
+ ...org ? [{
15400
+ kind: "organization",
15401
+ name: org
15402
+ }] : [],
15403
+ ...env ? [{
15404
+ kind: "environment",
15405
+ name: env
15406
+ }] : []
15407
+ ];
15408
+ }
15409
+ // src/commands/secrets-list/secrets-list.args.ts
15410
+ const secretsListArgs = (y) => y.option("scope", {
15411
+ type: "string",
15412
+ choices: [
15413
+ "repo",
15414
+ "environment",
15415
+ "organization"
15416
+ ],
15417
+ describe: "List one scope. Omitted: the repository, plus the organization and the --env environment."
15418
+ }).option("env", {
15419
+ type: "string",
15420
+ describe: "The environment to list (adds it to the default scopes; required with --scope environment)."
15421
+ }).option("json", {
15422
+ type: "boolean",
15423
+ default: false,
15424
+ describe: "Print one JSON document: [{ scope, names, error? }]"
15425
+ });
15426
+ // src/commands/secrets-list/secrets-list.command.ts
15427
+ const secretsListCommand = {
15428
+ command: "list",
15429
+ describe: "List the names of the secrets at each scope (never the values)",
15430
+ builder: secretsListArgs,
15431
+ handler: async (argv) => {
15432
+ const tokens = tokenContext(argv.token);
15433
+ if (!tokens) return;
15434
+ const loaded = await loadConfig(argv.cwd);
15435
+ applyResolvedConfig(argv, loaded.resolved);
15436
+ const org = resolveOrg(argv, loaded.resolved);
15437
+ const scopes = secretsListScopes({
15438
+ ...argv.scope ? { scope: argv.scope } : {},
15439
+ ...argv.env ? { env: argv.env } : {},
15440
+ ...org ? { org } : {}
15441
+ });
15442
+ if ((await runSecretsList({
15443
+ loaded,
15444
+ context: {
15445
+ repoRoot: argv.cwd,
15446
+ dryRun: false,
15447
+ ...tokens,
15448
+ org
15449
+ },
15450
+ scopes,
15451
+ json: argv.json
15452
+ })).failed > 0) process.exitCode = 1;
15453
+ }
15454
+ };
15257
15455
  // src/commands/secrets-sync/secrets-sync.ts
15258
15456
  /**
15259
15457
  * `holocron secrets sync` — vault → destinations.
@@ -15520,8 +15718,8 @@ const secretsSyncCommand = {
15520
15718
  // src/commands/secrets/secrets.command.ts
15521
15719
  const secretsCommand = {
15522
15720
  command: "secrets",
15523
- describe: "Set secrets and sync vault environments",
15524
- builder: (y) => y.command(secretSetCommand).command(secretsSyncCommand).command(groupMenu("secrets")),
15721
+ describe: "List and set secrets, and sync vault environments",
15722
+ builder: (y) => y.command(secretSetCommand).command(secretsListCommand).command(secretsSyncCommand).command(groupMenu("secrets")),
15525
15723
  handler: () => {}
15526
15724
  };
15527
15725
  // src/commands/skills/skills.args.ts
@@ -16144,7 +16342,7 @@ try {
16144
16342
  });
16145
16343
  finishCommand = startCommand(name);
16146
16344
  }).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) => {
16345
+ 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
16346
  if (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {
16149
16347
  captureException(err);
16150
16348
  reportError(err.message);