@theholocron/cli 5.0.0-alpha.270 → 5.0.0-alpha.272
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 +23 -36
- package/dist/cli.mjs +94 -13
- package/dist/cli.mjs.map +1 -1
- package/dist/{compose-CDyegVKe.mjs → compose-8k8KP396.mjs} +21 -1
- package/dist/{index-CL7nYbMl.d.mts → index-DSzAZQdK.d.mts} +18 -1
- package/dist/index.d.mts +36 -27
- package/dist/index.mjs +7 -3
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -188,14 +188,14 @@ A minimal config — for repos with a `package.json` and a GitHub remote
|
|
|
188
188
|
|
|
189
189
|
Additional `repo` fields recognised by `holocron repo setup`:
|
|
190
190
|
|
|
191
|
-
| Field | Type | Description
|
|
192
|
-
| ----------------- | --------------------------------------- |
|
|
193
|
-
| `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron repo setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`.
|
|
194
|
-
| `repo.topics` | `string[]` | GitHub topics set on the repository.
|
|
195
|
-
| `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below.
|
|
196
|
-
| `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard.
|
|
197
|
-
| `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on.
|
|
198
|
-
| `repo.secrets` | `{ repo?, org?, environments? }`
|
|
191
|
+
| Field | Type | Description |
|
|
192
|
+
| ----------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
193
|
+
| `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron repo setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`. |
|
|
194
|
+
| `repo.topics` | `string[]` | GitHub topics set on the repository. |
|
|
195
|
+
| `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
|
|
196
|
+
| `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
|
|
197
|
+
| `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on. |
|
|
198
|
+
| `repo.secrets` | `{ repo?, org?, environments?, sync? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. `sync: [{ environment, keys?, scope? }]` declares the vault environments `secrets sync` fills from; the doctor expects their keys (every key the `vault` provider lists when `keys` is omitted, names only) at the `scope` (`repo`, `env=<name>`, `org=<name>`). |
|
|
199
199
|
|
|
200
200
|
### Custom properties synced to GitHub
|
|
201
201
|
|
|
@@ -540,33 +540,20 @@ A `notifications` provider can declare a whole server in `holocron.config.ts`
|
|
|
540
540
|
pinned messages, onboarding, the bot application) and the CLI applies and checks it. The
|
|
541
541
|
commands and the config are provider-neutral; Discord is the first provider.
|
|
542
542
|
|
|
543
|
-
| Command | What it does
|
|
544
|
-
| -------------------------------------------------------------- |
|
|
545
|
-
| `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches
|
|
546
|
-
| `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret)
|
|
547
|
-
| `holocron notifications create-server --name <n> --owner <id>` | Creates the server the layout describes, writes its id into the config, applies the layout, invites the owner, waits for them to join and hands the server over (`--resume` finishes an interrupted hand-over; `--force` allows a second server)
|
|
548
|
-
| `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept)
|
|
549
|
-
| `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one)
|
|
550
|
-
| `holocron doctor notifications [--built-only] [--deliver]` | Step by step: does the server match the layout, do the secrets exist, and does a person (not the bot) own it. A full run also leaves one `🧪 test:` post in the layout's `testChannel`; `--built-only` posts nothing; `--deliver` posts to every channel and removes each post
|
|
551
|
-
| `holocron doctor variables` | Do the Actions variables `repo.variables` declares exist, with those values (and, for the organization's, that visibility)? One row for the repository and one for the organization, each only when declared. Read-only. An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure
|
|
552
|
-
| `holocron doctor
|
|
553
|
-
| `holocron doctor
|
|
554
|
-
| `holocron doctor
|
|
555
|
-
| `holocron
|
|
556
|
-
|
|
|
557
|
-
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
558
|
-
| `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches |
|
|
559
|
-
| `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret) |
|
|
560
|
-
| `holocron notifications create-server --name <n> --owner <id>` | Creates the server the layout describes, writes its id into the config, applies the layout, invites the owner, waits for them to join and hands the server over (`--resume` finishes an interrupted hand-over; `--force` allows a second server) |
|
|
561
|
-
| `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
|
|
562
|
-
| `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
|
|
563
|
-
| `holocron doctor notifications [--built-only] [--deliver]` | Step by step: does the server match the layout, do the secrets exist, and does a person (not the bot) own it. A full run also leaves one `🧪 test:` post in the layout's `testChannel`; `--built-only` posts nothing; `--deliver` posts to every channel and removes each post |
|
|
564
|
-
| `holocron doctor variables` | Do the Actions variables `repo.variables` declares exist, with those values (and, for the organization's, that visibility)? One row for the repository and one for the organization, each only when declared. Read-only. An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure |
|
|
565
|
-
| `holocron doctor environments` | Do the deployment environments exist? The ones `repo setup` creates (`staging`, `production`, when an `environments` provider is configured) plus every environment `repo.secrets.environments` names. One row. A missing one fails; an extra one is never a problem; no provider with some named is a skip |
|
|
566
|
-
| `holocron doctor secrets` | Do the secrets the config says must exist (`repo.secrets`, plus the notification layout's webhook and role secrets and the Chromatic token) exist? One row for the repository, the organization and each environment, each only when something is expected there. Names only; an undeclared secret is never a problem. A scope that cannot be read is a skip |
|
|
567
|
-
| `holocron doctor tokens` | For every token a configured plugin lists (the GitHub plugin's nine), looked up as the plugin does (env var, then keyring) and verified with its `verifyToken`: set and accepted is ok, set and rejected fails, not set is a skip. No token is printed. What a token may do is not checked, because GitHub does not return a fine-grained token's permissions |
|
|
568
|
-
| `holocron doctor --all` | Runs every deep check (`doctor notifications`, `doctor variables`, ...) and prints one row each, then `N ok, N fail, N skipped` counted in checks. Exits 1 when any check failed. A check that cannot run (no provider, no token) is a skip with the reason. Read-only: notifications runs as `--built-only`, so it posts nothing |
|
|
569
|
-
| `holocron probe [<provider> [<probe>]] [--dry-run] [--yes]` | Poke a live provider on purpose: list the probes, inspect something, or run a proof that cleans up after itself. Plugins offer the probes; nothing secret is printed; one that changes things asks first |
|
|
543
|
+
| Command | What it does |
|
|
544
|
+
| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
545
|
+
| `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches |
|
|
546
|
+
| `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret) |
|
|
547
|
+
| `holocron notifications create-server --name <n> --owner <id>` | Creates the server the layout describes, writes its id into the config, applies the layout, invites the owner, waits for them to join and hands the server over (`--resume` finishes an interrupted hand-over; `--force` allows a second server) |
|
|
548
|
+
| `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
|
|
549
|
+
| `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
|
|
550
|
+
| `holocron doctor notifications [--built-only] [--deliver]` | Step by step: does the server match the layout, do the secrets exist, and does a person (not the bot) own it. A full run also leaves one `🧪 test:` post in the layout's `testChannel`; `--built-only` posts nothing; `--deliver` posts to every channel and removes each post |
|
|
551
|
+
| `holocron doctor variables` | Do the Actions variables `repo.variables` declares exist, with those values (and, for the organization's, that visibility)? One row for the repository and one for the organization, each only when declared. Read-only. An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure |
|
|
552
|
+
| `holocron doctor environments` | Do the deployment environments exist? The ones `repo setup` creates (`staging`, `production`, when an `environments` provider is configured) plus every environment `repo.secrets.environments` names. One row. A missing one fails; an extra one is never a problem; no provider with some named is a skip |
|
|
553
|
+
| `holocron doctor secrets` | Do the secrets the config says must exist (`repo.secrets`, plus the notification layout's webhook and role secrets and the Chromatic token) exist? One row for the repository, the organization and each environment, each only when something is expected there. Names only; an undeclared secret is never a problem. A scope that cannot be read is a skip |
|
|
554
|
+
| `holocron doctor tokens` | For every token a configured plugin lists (every plugin that resolves one: GitHub's nine, Discord's three, Sentry's two, ...), looked up as the plugin does (its env var, the vendor's, then keyring) and verified with its `verifyToken`: set and accepted is ok (with how long is left, when the token expires), set and rejected fails, a token with 7 days or fewer left fails with `expires in N days: renew it`, not set is a skip. No token is printed. What a token may do is not checked, because GitHub does not return a fine-grained token's permissions |
|
|
555
|
+
| `holocron doctor --all` | Runs every deep check (`doctor notifications`, `doctor variables`, ...) and prints one row each, then `N ok, N fail, N skipped` counted in checks. Exits 1 when any check failed. A check that cannot run (no provider, no token) is a skip with the reason. Read-only: notifications runs as `--built-only`, so it posts nothing |
|
|
556
|
+
| `holocron probe [<provider> [<probe>]] [--dry-run] [--yes]` | Poke a live provider on purpose: list the probes, inspect something, or run a proof that cleans up after itself. Plugins offer the probes; nothing secret is printed; one that changes things asks first |
|
|
570
557
|
|
|
571
558
|
Channels fed by another service are declared with `feeds` on the channel: `{ name: "uptime", webhook: true, feeds: { monitoring: true } }` (the object form `{ name?, webhook?, avatar? }` overrides the alert channel's name, default `Message to #<channel>`, the dedicated webhook's name, default the provider's, and gives that webhook a picture, a file path or `https://` URL, or `{ url, image }` (the URL is tried first, the file in the repo is the fallback), else the provider's own icon (`Monitoring.icon`, a URL and an embedded `data:` image; Checkly provides one), else the layout's `webhookAvatar`, else the layout's `webhookAvatar`). `setup` gives the channel a dedicated webhook and hands its URL straight to the `monitoring` provider through `Monitoring.ensureAlertChannel({ name, format: "discord", url? })`, which finds an alert channel of that name or creates one and subscribes every check; the URL is never stored as a secret. It needs a `monitoring` provider that implements `ensureAlertChannel` (Checkly does). Two feeds may not share an alert channel name, and a feed's webhook may not share the channel's own webhook name (compared without regard to case).
|
|
572
559
|
|
|
@@ -574,7 +561,7 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
|
|
|
574
561
|
|
|
575
562
|
`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.
|
|
576
563
|
|
|
577
|
-
`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`.
|
|
564
|
+
`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`, which also covers the keys of the vault environments declared in `repo.secrets.sync`.
|
|
578
565
|
|
|
579
566
|
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.
|
|
580
567
|
|
package/dist/cli.mjs
CHANGED
|
@@ -5640,13 +5640,14 @@ const doctorNotificationsCommand = {
|
|
|
5640
5640
|
})).status === "fail") process.exitCode = 1;
|
|
5641
5641
|
}
|
|
5642
5642
|
};
|
|
5643
|
-
// src/commands/doctor-secrets/
|
|
5643
|
+
// src/commands/doctor-secrets/unique-names.ts
|
|
5644
5644
|
/** Names that differ only in case are one secret to GitHub, so the first spelling wins. */
|
|
5645
|
-
const
|
|
5645
|
+
const uniqueNames = (names) => {
|
|
5646
5646
|
const seen = /* @__PURE__ */ new Map();
|
|
5647
5647
|
for (const name of names) if (!seen.has(name.toUpperCase())) seen.set(name.toUpperCase(), name);
|
|
5648
5648
|
return [...seen.values()];
|
|
5649
5649
|
};
|
|
5650
|
+
// src/commands/doctor-secrets/expected-secrets.ts
|
|
5650
5651
|
/**
|
|
5651
5652
|
* The secret a Chromatic project reads: `CHROMATIC_PROJECT_TOKEN` for `default` (or no name), otherwise
|
|
5652
5653
|
* `CHROMATIC_PROJECT_TOKEN_<NAME>`.
|
|
@@ -5661,9 +5662,69 @@ function expectedSecrets(config, layouts) {
|
|
|
5661
5662
|
const declared = config.repo?.secrets;
|
|
5662
5663
|
const chromatic = (config.tasks ?? []).flatMap((task) => typeof task === "object" && task.name === "verification.visualRegression" ? (task.with?.["chromatic-projects"] ?? []).map((project) => chromaticSecret(project.tokenName)) : []);
|
|
5663
5664
|
return {
|
|
5664
|
-
repo:
|
|
5665
|
-
org:
|
|
5666
|
-
environments: Object.fromEntries(Object.entries(declared?.environments ?? {}).map(([env, names]) => [env,
|
|
5665
|
+
repo: uniqueNames([...declared?.repo ?? [], ...chromatic]),
|
|
5666
|
+
org: uniqueNames([...declared?.org ?? [], ...layouts.flatMap(layoutSecretNames)]),
|
|
5667
|
+
environments: Object.fromEntries(Object.entries(declared?.environments ?? {}).map(([env, names]) => [env, uniqueNames(names)]))
|
|
5668
|
+
};
|
|
5669
|
+
}
|
|
5670
|
+
// src/commands/doctor-secrets/synced-secrets.ts
|
|
5671
|
+
/**
|
|
5672
|
+
* The secrets `holocron secrets sync` fills from a vault, as `repo.secrets.sync` declares them: which names land at
|
|
5673
|
+
* which scope. An entry that lists `keys` needs no vault. One that does not asks the vault which keys the environment
|
|
5674
|
+
* holds, and only the names are kept: the values the provider returns are dropped at once and never logged or printed.
|
|
5675
|
+
* An entry that cannot be resolved (no vault, no token, an environment the vault cannot list) is a skipped row with
|
|
5676
|
+
* the reason, and an unreadable `scope` is a failed one.
|
|
5677
|
+
*
|
|
5678
|
+
* @param entries - `repo.secrets.sync`.
|
|
5679
|
+
* @param vault - The `vault` provider, or why there is none.
|
|
5680
|
+
*/
|
|
5681
|
+
async function syncedSecrets(entries, vault) {
|
|
5682
|
+
const scopes = [];
|
|
5683
|
+
const rows = [];
|
|
5684
|
+
for (const entry of entries) {
|
|
5685
|
+
const id = `sync-${entry.environment}`;
|
|
5686
|
+
const title = `${entry.environment} vault environment is synced`;
|
|
5687
|
+
let scope;
|
|
5688
|
+
try {
|
|
5689
|
+
scope = parseScope(entry.scope ?? "repo");
|
|
5690
|
+
} catch (err) {
|
|
5691
|
+
rows.push({
|
|
5692
|
+
id,
|
|
5693
|
+
title,
|
|
5694
|
+
status: "fail",
|
|
5695
|
+
detail: "1 problem(s)",
|
|
5696
|
+
problems: [describeProviderError(err)]
|
|
5697
|
+
});
|
|
5698
|
+
continue;
|
|
5699
|
+
}
|
|
5700
|
+
if (entry.keys) {
|
|
5701
|
+
scopes.push({
|
|
5702
|
+
scope,
|
|
5703
|
+
names: entry.keys
|
|
5704
|
+
});
|
|
5705
|
+
continue;
|
|
5706
|
+
}
|
|
5707
|
+
const skip = (detail) => rows.push({
|
|
5708
|
+
id,
|
|
5709
|
+
title,
|
|
5710
|
+
status: "skip",
|
|
5711
|
+
detail,
|
|
5712
|
+
problems: []
|
|
5713
|
+
});
|
|
5714
|
+
if ("why" in vault) skip(vault.why);
|
|
5715
|
+
else if (!vault.readEnvironment) skip(`vault provider (${vault.providerName}) cannot list an environment's keys`);
|
|
5716
|
+
else try {
|
|
5717
|
+
scopes.push({
|
|
5718
|
+
scope,
|
|
5719
|
+
names: Object.keys(await vault.readEnvironment(entry.environment))
|
|
5720
|
+
});
|
|
5721
|
+
} catch (err) {
|
|
5722
|
+
skip(err instanceof MissingTokenError ? err.message : `could not read vault environment ${entry.environment}: ${describeProviderError(err)}`);
|
|
5723
|
+
}
|
|
5724
|
+
}
|
|
5725
|
+
return {
|
|
5726
|
+
scopes,
|
|
5727
|
+
rows
|
|
5667
5728
|
};
|
|
5668
5729
|
}
|
|
5669
5730
|
// src/commands/doctor-secrets/doctor-secrets.ts
|
|
@@ -5684,6 +5745,12 @@ async function runDoctorSecrets(input) {
|
|
|
5684
5745
|
const config = input.loaded.resolved;
|
|
5685
5746
|
const expected = expectedSecrets(config, (loader.has("notifications") ? loader.get("notifications") : []).flatMap((p) => p.layout ? [p.layout] : []));
|
|
5686
5747
|
const org = input.context.org ?? (input.context.repo ?? config.repo?.name ?? "").split("/")[0];
|
|
5748
|
+
const synced = await syncedSecrets(config.repo?.secrets?.sync ?? [], loader.has("vault") ? loader.get("vault") : { why: whyMissing(loader, "vault", "no `vault` provider to list the environment's keys with") });
|
|
5749
|
+
const foreignOrgs = /* @__PURE__ */ new Map();
|
|
5750
|
+
for (const { scope, names } of synced.scopes) if (scope.kind === "repo") expected.repo = uniqueNames([...expected.repo, ...names]);
|
|
5751
|
+
else if (scope.kind === "environment") expected.environments[scope.name] = uniqueNames([...expected.environments[scope.name] ?? [], ...names]);
|
|
5752
|
+
else if (scope.name === org) expected.org = uniqueNames([...expected.org, ...names]);
|
|
5753
|
+
else foreignOrgs.set(scope.name, uniqueNames([...foreignOrgs.get(scope.name) ?? [], ...names]));
|
|
5687
5754
|
const checks = [];
|
|
5688
5755
|
if (expected.repo.length > 0) checks.push({
|
|
5689
5756
|
id: "repo-secrets",
|
|
@@ -5712,8 +5779,20 @@ async function runDoctorSecrets(input) {
|
|
|
5712
5779
|
names
|
|
5713
5780
|
});
|
|
5714
5781
|
}
|
|
5782
|
+
for (const [name, names] of foreignOrgs) {
|
|
5783
|
+
if (names.length === 0) continue;
|
|
5784
|
+
checks.push({
|
|
5785
|
+
id: `org-secrets-${name}`,
|
|
5786
|
+
title: `${name} organization secrets exist`,
|
|
5787
|
+
scope: {
|
|
5788
|
+
kind: "organization",
|
|
5789
|
+
name
|
|
5790
|
+
},
|
|
5791
|
+
names
|
|
5792
|
+
});
|
|
5793
|
+
}
|
|
5715
5794
|
const rows = [];
|
|
5716
|
-
if (checks.length === 0) rows.push({
|
|
5795
|
+
if (checks.length === 0 && synced.rows.length === 0) rows.push({
|
|
5717
5796
|
id: "secrets",
|
|
5718
5797
|
title: "secrets",
|
|
5719
5798
|
status: "ok",
|
|
@@ -5733,6 +5812,7 @@ async function runDoctorSecrets(input) {
|
|
|
5733
5812
|
const secrets = loader.get("secrets");
|
|
5734
5813
|
for (const check of checks) rows.push(await checkScope(secrets, check));
|
|
5735
5814
|
}
|
|
5815
|
+
rows.push(...synced.rows);
|
|
5736
5816
|
printCheckRows(rows, print);
|
|
5737
5817
|
const summary = summariseChecks(rows);
|
|
5738
5818
|
printCheckSummary(summary, print);
|
|
@@ -5865,7 +5945,7 @@ async function runDoctorTokens(input) {
|
|
|
5865
5945
|
rows.push(row$1(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
|
|
5866
5946
|
continue;
|
|
5867
5947
|
}
|
|
5868
|
-
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env
|
|
5948
|
+
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, keyring, now()));
|
|
5869
5949
|
}
|
|
5870
5950
|
if (rows.length === 0) rows.push(row$1("tokens", "skip", "no configured plugin lists the tokens it takes"));
|
|
5871
5951
|
printCheckRows(rows, print);
|
|
@@ -5897,12 +5977,13 @@ function row$1(id, status, detail) {
|
|
|
5897
5977
|
problems: []
|
|
5898
5978
|
};
|
|
5899
5979
|
}
|
|
5900
|
-
async function checkToken(token, module,
|
|
5901
|
-
const { keyringKey, envName } = token;
|
|
5902
|
-
const
|
|
5903
|
-
|
|
5904
|
-
if (!
|
|
5905
|
-
|
|
5980
|
+
async function checkToken(token, module, env, keyring, now) {
|
|
5981
|
+
const { keyringKey, envName, vendorEnvName } = token;
|
|
5982
|
+
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
5983
|
+
const value = fromEnv ? env.get(fromEnv) : keyring(keyringKey);
|
|
5984
|
+
if (!value) return row$1(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron auth set ${keyringKey}\`)`);
|
|
5985
|
+
if (!module.verifyToken || token.verifiable === false) return row$1(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
5986
|
+
const from = fromEnv ?? "keyring";
|
|
5906
5987
|
try {
|
|
5907
5988
|
const verified = await module.verifyToken(value);
|
|
5908
5989
|
if (!verified.ok) return row$1(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|