@theholocron/cli 5.0.0-alpha.426 → 5.0.0-alpha.427

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
@@ -19749,6 +19749,21 @@ const newCommand = {
19749
19749
  handler: () => {}
19750
19750
  };
19751
19751
  // src/commands/probe/probe.args.ts
19752
+ /**
19753
+ * Shown in `holocron probe --help`: how a probe about a token (`cloudflare token`) picks the token it checks, so the
19754
+ * run itself prints only the result.
19755
+ */
19756
+ const TOKEN_PROBE_HELP = [
19757
+ "Probes about a token (for example `holocron probe cloudflare token`) check one token. The first of these that applies picks it:",
19758
+ [
19759
+ "- --token <provider>=<value>: that token (a bare --token <value> goes to every provider).",
19760
+ "- --environment <layer or name>: the provider's token, read from that vault Environment.",
19761
+ "- On a terminal, with neither: a question, which asks for the configured token, an Environment or a pasted token.",
19762
+ "- Otherwise: the token the provider normally resolves."
19763
+ ].join("\n"),
19764
+ "--environment takes a layer (local, dev, ci or prod, which is this repo's `<org/repo> - <layer>`) or an Environment the config already names; anything else is refused. `local` is read over `dev`, as the CLI reads it.",
19765
+ "A token read from a layer is checked against what that layer's token should carry (the permission table in the tokens docs): what it should have must be there and what it should not have must not be. Any other token is only described. The token is never printed."
19766
+ ].join("\n\n");
19752
19767
  const probeArgs = (y) => y.positional("provider", {
19753
19768
  type: "string",
19754
19769
  describe: "Which provider's probes (omit to list them all)"
@@ -19783,7 +19798,7 @@ const probeArgs = (y) => y.positional("provider", {
19783
19798
  type: "boolean",
19784
19799
  default: false,
19785
19800
  describe: "Run a probe that changes things without asking first (required without a terminal)"
19786
- });
19801
+ }).epilogue(TOKEN_PROBE_HELP);
19787
19802
  // src/commands/probe/app-vault.ts
19788
19803
  /**
19789
19804
  * The vault of an app that carries its own `holocron.config` (`apps/comlink`, `apps/sentinel`): those configs govern where
@@ -21990,7 +22005,7 @@ async function runProbeCommand(input) {
21990
22005
  let override;
21991
22006
  try {
21992
22007
  if (chosen?.environment) {
21993
- const found = await environmentToken({
22008
+ override = (await environmentToken({
21994
22009
  provider: input.provider,
21995
22010
  environment: chosen.environment,
21996
22011
  repoRoot: context.repoRoot,
@@ -21998,10 +22013,8 @@ async function runProbeCommand(input) {
21998
22013
  vault: loader.has("vault") ? loader.get("vault") : void 0,
21999
22014
  /* v8 ignore next -- the real importer reads installed plugin packages, which tests replace with `providerTokens` */
22000
22015
  tokens: await (input.providerTokens ?? defaultProviderTokens(input.loaded))(input.provider)
22001
- });
22002
- override = found.token;
22016
+ })).token;
22003
22017
  if (isEnvironmentLayer(chosen.environment)) layer = chosen.environment;
22004
- print(statusRow("skip", ["token", `read ${found.variable} from ${found.environment}`]));
22005
22018
  } else if (chosen?.token) override = chosen.token;
22006
22019
  } catch (err) {
22007
22020
  print(statusRow("fail", [`\`${input.provider} ${input.probe}\``, commandFailureMessage(err)]));