@theholocron/cli 5.0.0-alpha.513 → 5.0.0-alpha.515
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 +1 -1
- package/dist/cli.mjs +130 -41
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-D_e9vKTW.d.mts → index-ur4G1f2k.d.mts} +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/plugin/capabilities.d.mts +1 -1
- package/dist/presets.d.mts +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -691,7 +691,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
691
691
|
|
|
692
692
|
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?, alerts? }` 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`). A channel's own `webhook.avatar` and the layout's `webhookAvatar` take the same forms, a path or `https://` URL, or `{ url, image }` (the URL first, the file in the repo as the fallback); a relative path is read from the repository root. `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). `alerts: { failure?, recovery?, degraded?, sslExpiry?, sslExpiryThreshold? }` (`MonitoringAlertSettings`, passed as `ensureAlertChannel({ ..., alerts })`) sets what the alert channel alerts about: a new channel defaults to failure, recovery and degraded on and `sslExpiry` off, and on an existing channel a setting left out is left alone. A check in the `monitoring` provider's `checks` can route itself with `alertChannels: ["Message to #uptime"]` (`MonitoringCheckInput.alertChannels`, the alert channel names): it is then subscribed to those channels only, and a name no feed declares is refused by `setup`. `inspectAlertChannel` returns the channel's `alerts` and the `misrouted` checks that `doctor notifications` reports. 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).
|
|
693
693
|
|
|
694
|
-
Channels fed by the error tracker add `feeds: { errors: true }` and a layout `relay: { host, zone?, script?, code? }`: `setup` makes a dedicated webhook, points `host` at the Comlink Worker (a proxied DNS record via `dns`), and deploys it via `workers.deployScript` with the webhook URL as `COMLINK_<SOURCE>_WEBHOOK`. The URL never leaves the Worker's secret; other secrets on the script are kept. A service other than the error tracker is declared in `relay.sources: { <id>: { capability, name?, events?, scope?, options? } }` and carried by a channel with `feeds.relay.<id>`: `setup` asks the provider of `capability` to make the vendor's webhook (optional `ensureRelaySource`, found again by its URL, never deleted), hands the Worker `COMLINK_<ID>_SECRET` (when the provider made or chose a secret) and `COMLINK_<ID>_WEBHOOK` in the same deploy, and `doctor notifications` adds a `relay-source:<id>` row (optional `inspectRelaySource`). With `relay.errors: { projects, integration?, rule?, frequency? }` it also ensures the tracker's integration and alert rule (`errors.ensureRelay`) and deploys the Worker with the integration's signing secret. Needs `errors`, `workers` and `dns`; only one channel may be fed.
|
|
694
|
+
Channels fed by the error tracker add `feeds: { errors: true }` and a layout `relay: { host, zone?, script?, code? }`: `setup` makes a dedicated webhook, points `host` at the Comlink Worker (a proxied DNS record via `dns`), and deploys it via `workers.deployScript` with the webhook URL as `COMLINK_<SOURCE>_WEBHOOK`. The URL never leaves the Worker's secret; other secrets on the script are kept. A service other than the error tracker is declared in `relay.sources: { <id>: { capability, provider?, name?, events?, scope?, options? } }` and carried by a channel with `feeds.relay.<id>`: `provider` names the plugin for a capability the root config gives to another one (`vercel` for `deployment`; `setup` loads it by name with the options of the config that names it, root or a workspace package's, and refuses, before writing, one that is missing, cannot make a webhook or has no token; `doctor notifications` finds it the same way and skips the `relay-source:<id>` row, with the reason, when it cannot load or read it); `setup` asks the provider of `capability` to make the vendor's webhook (optional `ensureRelaySource`, found again by its URL, never deleted), hands the Worker `COMLINK_<ID>_SECRET` (when the provider made or chose a secret) and `COMLINK_<ID>_WEBHOOK` in the same deploy, and `doctor notifications` adds a `relay-source:<id>` row (optional `inspectRelaySource`). With `relay.errors: { projects, integration?, rule?, frequency? }` it also ensures the tracker's integration and alert rule (`errors.ensureRelay`) and deploys the Worker with the integration's signing secret. Needs `errors`, `workers` and `dns`; only one channel may be fed.
|
|
695
695
|
|
|
696
696
|
`holocron sync secrets --env <environment> --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 `setup notifications` 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.
|
|
697
697
|
|
package/dist/cli.mjs
CHANGED
|
@@ -3819,6 +3819,28 @@ var PluginLoader = class extends system.PluginLoader {
|
|
|
3819
3819
|
throw err;
|
|
3820
3820
|
}
|
|
3821
3821
|
}
|
|
3822
|
+
/**
|
|
3823
|
+
* Loads one provider by name with the given options, whether or not `holocron.config` names it under `key`, and
|
|
3824
|
+
* returns what it makes for that capability, leaving the capability registry alone (a relay source names the plugin
|
|
3825
|
+
* that makes its webhook). The token is read when the capability is first used, not here. Throws
|
|
3826
|
+
* {@link WorkspaceContextError} when the provider's package cannot be imported here, a {@link LoaderError} when it
|
|
3827
|
+
* does not implement `key`, and what `createPlugin` throws as it is.
|
|
3828
|
+
*/
|
|
3829
|
+
async loadNamedCapability(provider, options, key) {
|
|
3830
|
+
const packageName = system.resolvePackage(provider);
|
|
3831
|
+
try {
|
|
3832
|
+
const factory = (await this.loadProvider({
|
|
3833
|
+
provider,
|
|
3834
|
+
packageName,
|
|
3835
|
+
options
|
|
3836
|
+
})).capabilities[key];
|
|
3837
|
+
if (typeof factory !== "function") throw new LoaderError(`\`${packageName}\` does not implement the \`${key}\` capability`);
|
|
3838
|
+
return factory();
|
|
3839
|
+
} catch (err) {
|
|
3840
|
+
if (err instanceof LoaderError && err.message.startsWith("failed to import")) throw new WorkspaceContextError("provider", [packageName]);
|
|
3841
|
+
throw err;
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3822
3844
|
};
|
|
3823
3845
|
/** The `setup` and `doctor` a created plugin carries. */
|
|
3824
3846
|
function actionsOf(plugin) {
|
|
@@ -12493,16 +12515,17 @@ async function relaySourceChecks(input) {
|
|
|
12493
12515
|
const { layout } = input;
|
|
12494
12516
|
const host = layout.relay?.host;
|
|
12495
12517
|
const rows = [];
|
|
12496
|
-
for (const
|
|
12518
|
+
for (const source of declaredRelaySources(layout)) {
|
|
12519
|
+
const { id, spec } = source;
|
|
12497
12520
|
const rowId = `relay-source:${id}`;
|
|
12498
12521
|
const title = `${shown$6(id)} webhook at the vendor posts to the relay`;
|
|
12499
12522
|
if (!host) {
|
|
12500
12523
|
rows.push(skipRow$1(rowId, title, "no `relay.host` is declared"));
|
|
12501
12524
|
continue;
|
|
12502
12525
|
}
|
|
12503
|
-
const provider = input.
|
|
12526
|
+
const { provider, problem } = await input.resolve(source);
|
|
12504
12527
|
if (!provider) {
|
|
12505
|
-
rows.push(skipRow$1(rowId, title,
|
|
12528
|
+
rows.push(skipRow$1(rowId, title, problem));
|
|
12506
12529
|
continue;
|
|
12507
12530
|
}
|
|
12508
12531
|
if (!provider.inspectRelaySource) {
|
|
@@ -12548,6 +12571,8 @@ const RELAY_SOURCE_CAPABILITIES = [
|
|
|
12548
12571
|
];
|
|
12549
12572
|
/** An id is a URL path segment and part of a Worker binding name, so it is lower-case letters and digits. */
|
|
12550
12573
|
const ID$1 = /^[a-z][a-z0-9]*$/;
|
|
12574
|
+
/** A plugin's name, as `providers.<capability>` spells it: lower-case letters, digits and hyphens (`vercel`, `1password`). */
|
|
12575
|
+
const PROVIDER = /^[a-z0-9][a-z0-9-]*$/;
|
|
12551
12576
|
/**
|
|
12552
12577
|
* The first reason the layout's relay sources cannot work, or undefined. `errorsSource` is the error tracker's id when a
|
|
12553
12578
|
* channel is fed by it, since the tracker's binding names are taken. Pure: it reads the layout and nothing else.
|
|
@@ -12562,6 +12587,7 @@ function relaySourcesProblem(layout, errorsSource) {
|
|
|
12562
12587
|
if (!ID$1.test(id)) return `relay source \`${id}\`: the id must be lower-case letters and digits, starting with a letter (it is a path and part of a binding name)`;
|
|
12563
12588
|
if (errorsSource !== void 0 && id === errorsSource) return `relay source \`${id}\` is the error tracker's own source — it is set up by \`relay.errors\`, not \`relay.sources\``;
|
|
12564
12589
|
if (!RELAY_SOURCE_CAPABILITIES.includes(spec?.capability)) return `relay source \`${id}\`: \`capability\` must be one of ${RELAY_SOURCE_CAPABILITIES.join(", ")}`;
|
|
12590
|
+
if (spec.provider !== void 0 && !(typeof spec.provider === "string" && PROVIDER.test(spec.provider))) return `relay source \`${id}\`: \`provider\` must be a plugin name, lower-case letters, digits and hyphens (\`vercel\`)`;
|
|
12565
12591
|
for (const key of ["events", "scope"]) {
|
|
12566
12592
|
const list = spec[key];
|
|
12567
12593
|
if (list !== void 0 && !(Array.isArray(list) && list.every((item) => typeof item === "string"))) return `relay source \`${id}\`: \`${key}\` must be a list of strings`;
|
|
@@ -12588,6 +12614,71 @@ function relaySourcesProblem(layout, errorsSource) {
|
|
|
12588
12614
|
}
|
|
12589
12615
|
}
|
|
12590
12616
|
}
|
|
12617
|
+
// src/commands/provider-tuples/provider-tuples.ts
|
|
12618
|
+
/** The providers a config names, in the order it names them: one tuple per capability entry, so a provider named twice appears twice. */
|
|
12619
|
+
function providerTuples(providers) {
|
|
12620
|
+
return Object.values(providers).flatMap((entry) => entry.cardinality === "single" ? [entry.tuple] : entry.tuples);
|
|
12621
|
+
}
|
|
12622
|
+
// src/commands/workspace-providers/workspace-providers.ts
|
|
12623
|
+
/**
|
|
12624
|
+
* The providers the configs of the workspace's packages name (`apps/sentinel` names `vercel` for its `deployment`) that
|
|
12625
|
+
* `config` does not: what `doctor tokens` and `probe` load by name next to the repo's own, so the token a package's
|
|
12626
|
+
* provider needs is checked from the root. Nothing is written and the root config needs no key for it. The first
|
|
12627
|
+
* package to name a provider supplies its options (its `teamId`, from the shared `org` area). A package whose config
|
|
12628
|
+
* cannot be read is left out: its own commands report it.
|
|
12629
|
+
*/
|
|
12630
|
+
async function workspaceProviders(repoRoot, config) {
|
|
12631
|
+
const known = new Set(providerTuples(config.providers).map((t) => t.provider));
|
|
12632
|
+
const found = [];
|
|
12633
|
+
for (const pkg of await readWorkspaceConfigs(repoRoot)) {
|
|
12634
|
+
if ("error" in pkg) continue;
|
|
12635
|
+
for (const tuple of providerTuples(pkg.resolved.providers)) {
|
|
12636
|
+
if (known.has(tuple.provider)) continue;
|
|
12637
|
+
known.add(tuple.provider);
|
|
12638
|
+
found.push(tuple);
|
|
12639
|
+
}
|
|
12640
|
+
}
|
|
12641
|
+
return found;
|
|
12642
|
+
}
|
|
12643
|
+
// src/commands/relay-sources/resolve-relay-source-provider.ts
|
|
12644
|
+
/**
|
|
12645
|
+
* The provider that makes a relay source's webhook: the configured provider of its `capability`, or, when the source
|
|
12646
|
+
* names a `provider` (spec `tech-relay-source-provider`), that plugin loaded by name beside the configured ones.
|
|
12647
|
+
*
|
|
12648
|
+
* - No `provider`: the configured provider of the capability (a problem when there is none).
|
|
12649
|
+
* - `provider` equal to the configured one: that same provider, loaded once.
|
|
12650
|
+
* - Any other: the plugin is loaded with the options of the first provider entry that names it, the root config's (for
|
|
12651
|
+
* another capability) then a workspace package's (`apps/sentinel` names `vercel`), through
|
|
12652
|
+
* `PluginLoader.loadNamedCapability`; the registry, the cardinality rules and what the root deploys are untouched. A
|
|
12653
|
+
* plugin no config names, that does not resolve, that fails to build or that lacks `ensureRelaySource` is a
|
|
12654
|
+
* `problem` that names it, never a throw, so the caller can refuse before it writes.
|
|
12655
|
+
*
|
|
12656
|
+
* Reads the workspace's package configs and loads a plugin; creates no webhook and calls no vendor.
|
|
12657
|
+
*/
|
|
12658
|
+
async function resolveRelaySourceProvider(input) {
|
|
12659
|
+
const { loader, source } = input;
|
|
12660
|
+
const { id, spec } = source;
|
|
12661
|
+
const configured = loader.has(spec.capability) ? loader.get(spec.capability) : void 0;
|
|
12662
|
+
if (spec.provider === void 0 || configured?.providerName === spec.provider) return configured ? { provider: configured } : { problem: `relay source \`${id}\`: no \`${spec.capability}\` provider is configured` };
|
|
12663
|
+
const named = spec.provider;
|
|
12664
|
+
const tuple = await optionsFor(named, input);
|
|
12665
|
+
if (!tuple) return { problem: `relay source \`${id}\`: provider \`${named}\` is named by no \`holocron.config\` here, so there are no options to load it with — name it in the config of the package that uses it` };
|
|
12666
|
+
let made;
|
|
12667
|
+
try {
|
|
12668
|
+
made = await loader.loadNamedCapability(named, tuple.options, spec.capability);
|
|
12669
|
+
} catch (err) {
|
|
12670
|
+
return { problem: `relay source \`${id}\`: provider \`${named}\` (${tuple.packageName}) could not be loaded for \`${spec.capability}\`: ${describeError(err)}` };
|
|
12671
|
+
}
|
|
12672
|
+
const provider = made;
|
|
12673
|
+
if (typeof provider.ensureRelaySource !== "function") return { problem: `relay source \`${id}\`: provider \`${named}\` cannot make a relay webhook (its \`${spec.capability}\` has no \`ensureRelaySource\`)` };
|
|
12674
|
+
return { provider };
|
|
12675
|
+
}
|
|
12676
|
+
/** The tuple that supplies the named plugin's options: the root config's entry, else the first workspace package's. */
|
|
12677
|
+
async function optionsFor(name, input) {
|
|
12678
|
+
const root = providerTuples(input.config.providers).find((t) => t.provider === name);
|
|
12679
|
+
if (root) return root;
|
|
12680
|
+
return (await (input.workspace ?? workspaceProviders)(input.repoRoot, input.config)).find((t) => t.provider === name);
|
|
12681
|
+
}
|
|
12591
12682
|
// src/commands/read-repo-text/read-repo-text.ts
|
|
12592
12683
|
/** A text file named in a config is a few paragraphs; this only keeps a wrong file from filling memory. */
|
|
12593
12684
|
const MAX_REPO_TEXT_BYTES = 102400;
|
|
@@ -13020,6 +13111,14 @@ async function runNotificationsSetup(input$1) {
|
|
|
13020
13111
|
let workers;
|
|
13021
13112
|
let dns;
|
|
13022
13113
|
const sourceProviders = /* @__PURE__ */ new Map();
|
|
13114
|
+
const inspectInputOf = (source) => ({
|
|
13115
|
+
source: source.id,
|
|
13116
|
+
url: `https://${layout.relay?.host}/${source.id}`,
|
|
13117
|
+
name: source.spec.name ?? source.id.charAt(0).toUpperCase() + source.id.slice(1),
|
|
13118
|
+
...source.spec.events ? { events: source.spec.events } : {},
|
|
13119
|
+
...source.spec.scope ? { scope: source.spec.scope } : {},
|
|
13120
|
+
...source.spec.options ? { options: source.spec.options } : {}
|
|
13121
|
+
});
|
|
13023
13122
|
const declaredSources = declaredRelaySources(layout);
|
|
13024
13123
|
const wantsErrors = wantsRelay(layout);
|
|
13025
13124
|
if (wantsAnyRelay(layout) || declaredSources.length > 0) {
|
|
@@ -13030,12 +13129,27 @@ async function runNotificationsSetup(input$1) {
|
|
|
13030
13129
|
["dns", "a `dns` provider (for its host)"],
|
|
13031
13130
|
...wantsErrors ? [["errors", "an `errors` provider (the tracker whose alerts it carries)"]] : []
|
|
13032
13131
|
];
|
|
13033
|
-
for (const { id, spec } of declaredSources) needs.push([spec.capability, `a \`${spec.capability}\` provider (it makes the ${id} webhook)`]);
|
|
13132
|
+
for (const { id, spec } of declaredSources) if (spec.provider === void 0) needs.push([spec.capability, `a \`${spec.capability}\` provider (it makes the ${id} webhook)`]);
|
|
13034
13133
|
for (const [key, what] of needs) if (!loader.has(key)) return refuse(whyMissing(loader, key, `the relay Worker needs ${what} — add one`));
|
|
13035
13134
|
if (wantsErrors) errors = loader.get("errors");
|
|
13036
13135
|
workers = loader.get("workers");
|
|
13037
13136
|
dns = loader.get("dns");
|
|
13038
|
-
for (const
|
|
13137
|
+
for (const source of declaredSources) {
|
|
13138
|
+
const resolved = await resolveRelaySourceProvider({
|
|
13139
|
+
loader,
|
|
13140
|
+
config: input$1.loaded.resolved,
|
|
13141
|
+
repoRoot: input$1.context.repoRoot,
|
|
13142
|
+
source,
|
|
13143
|
+
...input$1.workspaceProviders ? { workspace: input$1.workspaceProviders } : {}
|
|
13144
|
+
});
|
|
13145
|
+
if (!resolved.provider) return refuse(resolved.problem);
|
|
13146
|
+
if (source.spec.provider !== void 0 && !dryRun) try {
|
|
13147
|
+
await resolved.provider.inspectRelaySource?.(inspectInputOf(source));
|
|
13148
|
+
} catch (err) {
|
|
13149
|
+
if (err instanceof AuthError) return refuse(`relay source \`${source.id}\`: provider \`${source.spec.provider}\` has no token — ${describeError(err)}`);
|
|
13150
|
+
}
|
|
13151
|
+
sourceProviders.set(source.id, resolved.provider);
|
|
13152
|
+
}
|
|
13039
13153
|
const clash = relayProblem(layout, errors, monitoring) ?? relaySourcesProblem(layout, errors?.providerName);
|
|
13040
13154
|
if (clash) return refuse(clash);
|
|
13041
13155
|
}
|
|
@@ -13347,14 +13461,7 @@ async function runNotificationsSetup(input$1) {
|
|
|
13347
13461
|
const provider = sourceProviders.get(source.id);
|
|
13348
13462
|
if (!provider.inspectRelaySource || !relayWebhooks.has(source.id)) continue;
|
|
13349
13463
|
try {
|
|
13350
|
-
if (!(await provider.inspectRelaySource(
|
|
13351
|
-
source: source.id,
|
|
13352
|
-
url: `https://${layout.relay.host}/${source.id}`,
|
|
13353
|
-
name: source.spec.name ?? source.id.charAt(0).toUpperCase() + source.id.slice(1),
|
|
13354
|
-
...source.spec.events ? { events: source.spec.events } : {},
|
|
13355
|
-
...source.spec.scope ? { scope: source.spec.scope } : {},
|
|
13356
|
-
...source.spec.options ? { options: source.spec.options } : {}
|
|
13357
|
-
})).exists) chosen.set(source.id, newRelaySecret());
|
|
13464
|
+
if (!(await provider.inspectRelaySource(inspectInputOf(source))).exists) chosen.set(source.id, newRelaySecret());
|
|
13358
13465
|
} catch {}
|
|
13359
13466
|
}
|
|
13360
13467
|
if (chosen.size > 0) {
|
|
@@ -14939,8 +15046,16 @@ async function runDoctorNotifications(input) {
|
|
|
14939
15046
|
}));
|
|
14940
15047
|
checks.push(...await relaySourceChecks({
|
|
14941
15048
|
layout,
|
|
14942
|
-
|
|
14943
|
-
|
|
15049
|
+
resolve: async (source) => {
|
|
15050
|
+
const resolved = await resolveRelaySourceProvider({
|
|
15051
|
+
loader,
|
|
15052
|
+
config: input.loaded.resolved,
|
|
15053
|
+
repoRoot: input.context.repoRoot,
|
|
15054
|
+
source,
|
|
15055
|
+
...input.workspaceProviders ? { workspace: input.workspaceProviders } : {}
|
|
15056
|
+
});
|
|
15057
|
+
return resolved.provider || source.spec.provider !== void 0 ? resolved : { problem: whyMissing(loader, source.spec.capability, `no \`${source.spec.capability}\` provider is configured`) };
|
|
15058
|
+
}
|
|
14944
15059
|
}));
|
|
14945
15060
|
const withHook = (layout.categories ?? []).flatMap((cat) => (cat.channels ?? []).filter((c) => c.webhook).map((channel) => ({
|
|
14946
15061
|
cat,
|
|
@@ -18548,11 +18663,6 @@ async function runProbe(input) {
|
|
|
18548
18663
|
rows
|
|
18549
18664
|
};
|
|
18550
18665
|
}
|
|
18551
|
-
// src/commands/provider-tuples/provider-tuples.ts
|
|
18552
|
-
/** The providers a config names, in the order it names them: one tuple per capability entry, so a provider named twice appears twice. */
|
|
18553
|
-
function providerTuples(providers) {
|
|
18554
|
-
return Object.values(providers).flatMap((entry) => entry.cardinality === "single" ? [entry.tuple] : entry.tuples);
|
|
18555
|
-
}
|
|
18556
18666
|
// src/commands/token-rotation/token-rotation.ts
|
|
18557
18667
|
/** The rotation policy of a token that declares none: a token is due after 90 days, and an expiry is flagged 14 days ahead. */
|
|
18558
18668
|
const DEFAULT_TOKEN_ROTATION = {
|
|
@@ -18590,27 +18700,6 @@ function tokenExpectations(tokens, filter = {}) {
|
|
|
18590
18700
|
}
|
|
18591
18701
|
return found;
|
|
18592
18702
|
}
|
|
18593
|
-
// src/commands/workspace-providers/workspace-providers.ts
|
|
18594
|
-
/**
|
|
18595
|
-
* The providers the configs of the workspace's packages name (`apps/sentinel` names `vercel` for its `deployment`) that
|
|
18596
|
-
* `config` does not: what `doctor tokens` and `probe` load by name next to the repo's own, so the token a package's
|
|
18597
|
-
* provider needs is checked from the root. Nothing is written and the root config needs no key for it. The first
|
|
18598
|
-
* package to name a provider supplies its options (its `teamId`, from the shared `org` area). A package whose config
|
|
18599
|
-
* cannot be read is left out: its own commands report it.
|
|
18600
|
-
*/
|
|
18601
|
-
async function workspaceProviders(repoRoot, config) {
|
|
18602
|
-
const known = new Set(providerTuples(config.providers).map((t) => t.provider));
|
|
18603
|
-
const found = [];
|
|
18604
|
-
for (const pkg of await readWorkspaceConfigs(repoRoot)) {
|
|
18605
|
-
if ("error" in pkg) continue;
|
|
18606
|
-
for (const tuple of providerTuples(pkg.resolved.providers)) {
|
|
18607
|
-
if (known.has(tuple.provider)) continue;
|
|
18608
|
-
known.add(tuple.provider);
|
|
18609
|
-
found.push(tuple);
|
|
18610
|
-
}
|
|
18611
|
-
}
|
|
18612
|
-
return found;
|
|
18613
|
-
}
|
|
18614
18703
|
// src/commands/doctor-tokens/summarise-probe-rows.ts
|
|
18615
18704
|
/**
|
|
18616
18705
|
* Folds what one token probe reported into the one row the doctor shows for that token in that layer. A failing probe row
|