@theholocron/cli 5.0.0-alpha.409 → 5.0.0-alpha.410

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
@@ -10602,6 +10602,30 @@ const doctorSecretsCommand = {
10602
10602
  })).status === "fail") process.exitCode = 1;
10603
10603
  }
10604
10604
  };
10605
+ // src/commands/doctor-variable-owners/create-loaders.ts
10606
+ /**
10607
+ * The loader that lists an Environment's variable names. Built with `readCredentials: false`, so the `credentials`
10608
+ * providers are loaded but never asked for a value: only `Credentials.inspect` runs, and no value enters the process.
10609
+ *
10610
+ * @param loaded - The loaded config.
10611
+ * @param context - The runtime context.
10612
+ * @param importer - Replaces the plugin import, for a test.
10613
+ */
10614
+ function createNamesLoader(loaded, context, importer) {
10615
+ return new PluginLoader(loaded.resolved, context, importer, { readCredentials: false });
10616
+ }
10617
+ /**
10618
+ * The loader for the `secrets` and `source` providers that list GitHub names. Built normally, so the `credentials`
10619
+ * providers are read into the in-process store and the GitHub plugin finds its token in the usual chain. The token is
10620
+ * only used to authenticate; the check never prints or keeps it.
10621
+ *
10622
+ * @param loaded - The loaded config.
10623
+ * @param context - The runtime context.
10624
+ * @param importer - Replaces the plugin import, for a test.
10625
+ */
10626
+ function createGitHubLoader(loaded, context, importer) {
10627
+ return new PluginLoader(loaded.resolved, context, importer);
10628
+ }
10605
10629
  // src/commands/doctor-variable-owners/name-index.ts
10606
10630
  /** Every name across the places, folded to upper case as GitHub does, with the places that hold it. */
10607
10631
  function nameIndex(sources) {
@@ -10844,20 +10868,24 @@ function syncFeeds(config) {
10844
10868
  /**
10845
10869
  * `holocron doctor variable-owners` — does a variable live in more than one place?
10846
10870
  *
10847
- * Read-only, and names only: no value is read, printed, logged or kept. It gathers the variable names of every
10871
+ * Read-only, and names only: no value is printed, logged or kept, and the Environments are listed by a loader that never
10872
+ * reads a value. It gathers the variable names of every
10848
10873
  * 1Password Environment the config names (through `Credentials.inspect`) and of the GitHub Actions secrets and variables
10849
10874
  * (through the `secrets` and `source` providers), then reports a name that two places hold, one row per name (`fail`).
10850
10875
  * Not reported: the copy a `repo.secrets.sync` or `repo.variables.sync` entry makes (the one allowed path), a name
10851
10876
  * listed in `doctor.sharedVariables` (deliberate sharing), and the same name in the instances of one GitHub App
10852
10877
  * (`githubApps`). A bare name next to its prefixed spelling (`X` and `HOLOCRON_X`) is an `info` row, shown as skipped,
10853
- * because the fallback is deliberate during a rename. A place that cannot be read is a skip with the reason.
10878
+ * because the fallback is deliberate during a rename. A place that cannot be read is a skip with the reason. The GitHub
10879
+ * reads use a second loader that does read the `credentials` providers, only so the GitHub plugin finds its token.
10854
10880
  */
10855
10881
  async function runDoctorVariableOwners(input) {
10856
10882
  const print = input.print ?? ((line) => console.log(line));
10857
10883
  const logger = input.logger ?? getLogger();
10858
- const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context, void 0, { readCredentials: false });
10884
+ const loader = input.loader ?? createNamesLoader(input.loaded, input.context);
10885
+ const githubLoader = input.githubLoader ?? createGitHubLoader(input.loaded, input.context);
10859
10886
  await loader.load();
10860
10887
  assertPluginsResolvable$1(loader, "doctor variable-owners");
10888
+ await githubLoader.load();
10861
10889
  const config = input.loaded.resolved;
10862
10890
  const feeds = syncFeeds(config);
10863
10891
  const { names, instances } = ownerEnvironments(config);
@@ -10865,8 +10893,8 @@ async function runDoctorVariableOwners(input) {
10865
10893
  const failedToLoad = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => f.provider);
10866
10894
  const environments = await readEnvironments(names, instances, loader.has("credentials") ? loader.get("credentials") : [], failedToLoad.length > 0 ? `a \`credentials\` provider failed to load (${failedToLoad.join(", ")})` : "no `credentials` provider is configured");
10867
10895
  const github = await readGitHub({
10868
- secrets: loader.has("secrets") ? loader.get("secrets") : { why: whyMissing(loader, "secrets", "no `secrets` provider to read the secret names with") },
10869
- source: loader.has("source") ? loader.get("source") : { why: whyMissing(loader, "source", "no `source` provider to read the variable names with") },
10896
+ secrets: githubLoader.has("secrets") ? githubLoader.get("secrets") : { why: whyMissing(githubLoader, "secrets", "no `secrets` provider to read the secret names with") },
10897
+ source: githubLoader.has("source") ? githubLoader.get("source") : { why: whyMissing(githubLoader, "source", "no `source` provider to read the variable names with") },
10870
10898
  org: org || void 0,
10871
10899
  environments: githubEnvironments(config, feeds)
10872
10900
  });