@theholocron/cli 5.0.0-alpha.485 โ 5.0.0-alpha.487
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 +320 -110
- package/dist/cli.mjs.map +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -665,7 +665,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
665
665
|
| `holocron doctor notifications [--built-only] [--deliver] [--post]` | 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; `--post [channel]` posts the result as the bot (the failures, or only the summary when none fail). It also reads the Checkly feed (webhook, alert channel, subscriptions), the Comlink relay (Worker, route, bindings, the tracker's integration and rule) and the Notifications workflow (the file, and the secrets it reads), posting nothing, so `--built-only` keeps those steps. The `bot-permissions` row compares what the bot's roles hold server-wide with the permissions it needs (`ServerInspection` `botPermissions`; the owner and Administrator hold all, channel overwrites are left to the forum row) and, when some are missing, fails naming them in plain words with the invite link that asks for them again (not a credential); it is skipped, with the reason, when the roles could not be read |
|
|
666
666
|
| `holocron doctor ci` | Has the repo moved to the flat task vocabulary? One row each for the `tasks:` entries (a deprecated alias, with the id that replaces it), the generated callers (file, workflow and job name equal the task id), the `ci` aggregate's `expected` list (no id missing or stale) and where the callers point (`theholocron/.github` or holocron `ci-v1`). Read-only, no provider needed; exits 1 on a failure. The ruleset's checks are `doctor repo`'s |
|
|
667
667
|
| `holocron doctor github-app` | Does each GitHub App instance in `githubApps` (`{ name, manifest, environment }`) have what its manifest file (`default_permissions`, `default_events`) declares? Reads the App's id and key from the vault `environment` in memory (never printed), calls `GET /app` and `GET /app/installations` with the App's JWT. Rows per instance: `reachable`, `events` (all subscribed), `permissions` (each granted at least at the manifest's level, `read < write < admin`), `installations` (none lags the App, a pending update fails). Extras on the App are `info` in a row's detail, never a failure. A gap ends with the App's settings page (user- or organization-owned) and, for an installation, its own page. Credentials that cannot be read are a skip; an unreadable manifest or a rejected JWT fails. Read-only |
|
|
668
|
-
| `holocron doctor releases` | Did npm receive every release tag? One row per release line (each `release` task group, tags `<group>-v<version>`, and the repo-wide `v<version>`) and channel (`latest`, or a prerelease's first identifier such as `alpha`): the newest tag against what each package serves on that dist-tag. A package behind, or not on npm, fails the row, which names the tag and the `refs/notes/semantic-release-<tag>` note to delete and the two known causes (a sigstore 409, `ENEEDAUTH` fixed by `holocron publish package --sync-trust`). A tag under 30 minutes old is a skip. Reads git tags and npm's public registry; no provider or token. Read-only
|
|
668
|
+
| `holocron doctor releases` | Did npm receive every release tag? One row per release line (each `release` task group, tags `<group>-v<version>`, and the repo-wide `v<version>`) and channel (`latest`, or a prerelease's first identifier such as `alpha`): the newest tag against what each package serves on that dist-tag. A package behind, or not on npm, fails the row, which names the tag and the `refs/notes/semantic-release-<tag>` note to delete and the two known causes (a sigstore 409, `ENEEDAUTH` fixed by `holocron publish package --sync-trust`). `publish package --skip-already-published` retries a sigstore 409 twice, publishes the rest of the group anyway and ends with every failure listed (and in the job summary), so a package left behind is the case to look for here. A tag under 30 minutes old is a skip. Reads git tags and npm's public registry; no provider or token. Read-only |
|
|
669
669
|
| `holocron doctor logs` | Does each Axiom dataset the setup ships logs to exist, and does the token reach it? Rows: `token is accepted` (a 401 fails), one `dataset for <service>` for the CLI (`HOLOCRON_AXIOM_DATASET`, resolved by the logger's own chain), Sentinel (`SENTINEL_AXIOM_DATASET`) and any other `dev.serve.logging.datasetVar` (a 404 fails and names the fix), `organization` (`HOLOCRON_AXIOM_ORG`, then `AXIOM_ORG`), and an `info` row per dataset with the `retentionDays` Axiom reports (or says it reported none). Reads through the optional `Logs.readDataset` / `Logs.checkToken`; never creates a dataset or prints a token. A name or token that cannot be read is a skip. Read-only |
|
|
670
670
|
| `holocron doctor wiki` | Does the wiki the config declares exist, and does it match the sources? Rows: `organization is set` (`fern/fern.config.json` against the declared `fernOrg`), `docs site is declared` (the `instances:` url and `custom-domain` of `fern/docs.yml`), `docs site answers` and `custom domain answers` (one unauthenticated GET each: a 404 or 5xx fails, a 401/403 passes as restricted, no answer is a skip), `navigation pages exist` (every `path:` of the navigation is on disk), an `info` row for pages under `docs/wiki` the navigation leaves out, and `published pages` (the site's sitemap lists at least as many pages as the navigation; fewer fails and names the wiki workflow). Reads through the optional `Wiki.inspect()`; never publishes, writes or sends a token. A provider that cannot inspect, or a site that cannot be reached, is a skip. Read-only |
|
|
671
671
|
| `holocron doctor errors` | Does the error tracker have the organization, projects, keys and alert rules the config relies on? Rows: `organization exists`, and for each project a notifications layout's `relay.errors.projects` declares, `project <slug> exists` (a 404 fails), `project <slug> has a key` (a client key, so an SDK has a DSN; none fails) and `project <slug> has an alert rule` (at least one enabled rule watches its issues; none fails). The Comlink relay's integration and rule stay in `doctor notifications`. Reads through the optional `Errors.inspect()` and returns counts only, never a DSN or key. A missing token or `org`, or alert rules the token cannot read, is a skip. Read-only |
|
package/dist/cli.mjs
CHANGED
|
@@ -7552,8 +7552,8 @@ const SETUP_ENVIRONMENTS = ["staging", "production"];
|
|
|
7552
7552
|
* set on one that exists. An environment that exists but is not expected is never a problem. With no provider and
|
|
7553
7553
|
* nothing named, nothing is declared; with no provider but some named, the row is a skip with the reason.
|
|
7554
7554
|
*/
|
|
7555
|
-
const ID$
|
|
7556
|
-
const TITLE$
|
|
7555
|
+
const ID$5 = "environments";
|
|
7556
|
+
const TITLE$5 = "environments exist";
|
|
7557
7557
|
async function runDoctorEnvironments(input) {
|
|
7558
7558
|
const print = input.print ?? ((line) => console.log(line));
|
|
7559
7559
|
const logger = input.logger ?? getLogger();
|
|
@@ -7577,8 +7577,8 @@ async function runDoctorEnvironments(input) {
|
|
|
7577
7577
|
}
|
|
7578
7578
|
async function checkEnvironments(loader, named) {
|
|
7579
7579
|
const make = (status, detail, problems = []) => ({
|
|
7580
|
-
id: ID$
|
|
7581
|
-
title: TITLE$
|
|
7580
|
+
id: ID$5,
|
|
7581
|
+
title: TITLE$5,
|
|
7582
7582
|
status,
|
|
7583
7583
|
detail,
|
|
7584
7584
|
problems
|
|
@@ -8103,9 +8103,87 @@ const doctorLogsCommand = {
|
|
|
8103
8103
|
})).status === "fail") process.exitCode = 1;
|
|
8104
8104
|
}
|
|
8105
8105
|
};
|
|
8106
|
+
// src/commands/workspace-configs/workspace-configs.ts
|
|
8107
|
+
/** The extensions a `holocron.config` can have. */
|
|
8108
|
+
const CONFIG_EXTENSIONS$1 = [
|
|
8109
|
+
"ts",
|
|
8110
|
+
"js",
|
|
8111
|
+
"mjs",
|
|
8112
|
+
"cjs",
|
|
8113
|
+
"json"
|
|
8114
|
+
];
|
|
8115
|
+
/**
|
|
8116
|
+
* The config of every workspace package that has a `holocron.config.*` of its own (`apps/sentinel`, `apps/comlink`), in
|
|
8117
|
+
* workspace order. A package whose config cannot be loaded is still listed, with the reason, so a caller decides whether
|
|
8118
|
+
* leaving it out is safe (`workspaceProviders()` does, `readWorkspaceMonitoring()` does not). Where the workspace itself
|
|
8119
|
+
* cannot be read (no `pnpm-workspace.yaml`, a bad one) there are none. Nothing is written and no provider is loaded.
|
|
8120
|
+
*/
|
|
8121
|
+
async function readWorkspaceConfigs(repoRoot) {
|
|
8122
|
+
let packages;
|
|
8123
|
+
try {
|
|
8124
|
+
packages = readWorkspacePackages(repoRoot);
|
|
8125
|
+
} catch {
|
|
8126
|
+
return [];
|
|
8127
|
+
}
|
|
8128
|
+
const found = [];
|
|
8129
|
+
for (const pkg of packages) {
|
|
8130
|
+
const path = pkg.path ?? `${pkg.dir}/${pkg.slug}`;
|
|
8131
|
+
const dir = join(repoRoot, path);
|
|
8132
|
+
if (!CONFIG_EXTENSIONS$1.some((ext) => existsSync(join(dir, `holocron.config.${ext}`)))) continue;
|
|
8133
|
+
try {
|
|
8134
|
+
found.push({
|
|
8135
|
+
path,
|
|
8136
|
+
dir,
|
|
8137
|
+
resolved: (await loadConfig(dir)).resolved
|
|
8138
|
+
});
|
|
8139
|
+
} catch (err) {
|
|
8140
|
+
found.push({
|
|
8141
|
+
path,
|
|
8142
|
+
dir,
|
|
8143
|
+
error: errorMessage(err)
|
|
8144
|
+
});
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
return found;
|
|
8148
|
+
}
|
|
8149
|
+
// src/commands/workspace-monitoring/workspace-monitoring.ts
|
|
8150
|
+
/**
|
|
8151
|
+
* The checks, dashboards and status pages the workspace packages' configs declare, read through the `monitoring`
|
|
8152
|
+
* capability of a loader built over each package's config (the same walk as `workspaceProviders()`), so the command
|
|
8153
|
+
* knows no vendor's option names. Only the declarations are read: the plugin is built, no credential provider is asked
|
|
8154
|
+
* for a value and nothing is requested from the provider. A package with no `monitoring` provider declares nothing; one
|
|
8155
|
+
* whose config cannot be loaded, or whose provider cannot be built, is named in `unreadable`, because "declared
|
|
8156
|
+
* nowhere" cannot be known without it.
|
|
8157
|
+
*/
|
|
8158
|
+
async function readWorkspaceMonitoring(context) {
|
|
8159
|
+
const out = {
|
|
8160
|
+
checks: [],
|
|
8161
|
+
dashboards: [],
|
|
8162
|
+
statusPages: [],
|
|
8163
|
+
unreadable: []
|
|
8164
|
+
};
|
|
8165
|
+
for (const pkg of await readWorkspaceConfigs(context.repoRoot)) {
|
|
8166
|
+
if ("error" in pkg) {
|
|
8167
|
+
out.unreadable.push(`${pkg.path}: ${pkg.error}`);
|
|
8168
|
+
continue;
|
|
8169
|
+
}
|
|
8170
|
+
if (!pkg.resolved.providers.monitoring) continue;
|
|
8171
|
+
const loader = new PluginLoader(pkg.resolved, context, void 0, { readCredentials: false });
|
|
8172
|
+
await loader.load();
|
|
8173
|
+
if (!loader.has("monitoring")) {
|
|
8174
|
+
out.unreadable.push(`${pkg.path}: ${whyMissing(loader, "monitoring", "its monitoring provider is not available")}`);
|
|
8175
|
+
continue;
|
|
8176
|
+
}
|
|
8177
|
+
const monitoring = loader.get("monitoring");
|
|
8178
|
+
out.checks.push(...monitoring.checks);
|
|
8179
|
+
out.dashboards.push(...monitoring.dashboards ?? []);
|
|
8180
|
+
out.statusPages.push(...monitoring.statusPages ?? []);
|
|
8181
|
+
}
|
|
8182
|
+
return out;
|
|
8183
|
+
}
|
|
8106
8184
|
// src/commands/doctor-monitoring/dashboard-rows/dashboard-rows.ts
|
|
8107
|
-
const ID$
|
|
8108
|
-
const TITLE$
|
|
8185
|
+
const ID$4 = "monitoring-dashboards";
|
|
8186
|
+
const TITLE$4 = "monitoring dashboards match";
|
|
8109
8187
|
/** The tags as comparable text: sorted and de-duplicated. */
|
|
8110
8188
|
const tagsText = (tags) => [...new Set(tags)].sort().join(", ") || "none";
|
|
8111
8189
|
/** What differs between a declared dashboard and the one the account holds. Privacy is always compared (default private). */
|
|
@@ -8137,7 +8215,7 @@ async function dashboardRows(monitoring) {
|
|
|
8137
8215
|
detail,
|
|
8138
8216
|
problems: []
|
|
8139
8217
|
});
|
|
8140
|
-
if (!monitoring.inspectDashboard) return [skip(ID$
|
|
8218
|
+
if (!monitoring.inspectDashboard) return [skip(ID$4, TITLE$4, "provider does not implement inspectDashboard")];
|
|
8141
8219
|
try {
|
|
8142
8220
|
const names = new Set(declared.map((d) => d.name));
|
|
8143
8221
|
const problems = [];
|
|
@@ -8148,14 +8226,14 @@ async function dashboardRows(monitoring) {
|
|
|
8148
8226
|
for (const other of have.others) if (!names.has(other)) extra.add(other);
|
|
8149
8227
|
}
|
|
8150
8228
|
const rows = [problems.length > 0 ? {
|
|
8151
|
-
id: ID$
|
|
8152
|
-
title: TITLE$
|
|
8229
|
+
id: ID$4,
|
|
8230
|
+
title: TITLE$4,
|
|
8153
8231
|
status: "fail",
|
|
8154
8232
|
detail: `${problems.length} problem(s)`,
|
|
8155
8233
|
problems
|
|
8156
8234
|
} : {
|
|
8157
|
-
id: ID$
|
|
8158
|
-
title: TITLE$
|
|
8235
|
+
id: ID$4,
|
|
8236
|
+
title: TITLE$4,
|
|
8159
8237
|
status: "ok",
|
|
8160
8238
|
detail: `${declared.length} of ${declared.length} match`,
|
|
8161
8239
|
problems: []
|
|
@@ -8164,10 +8242,10 @@ async function dashboardRows(monitoring) {
|
|
|
8164
8242
|
return rows;
|
|
8165
8243
|
} catch (err) {
|
|
8166
8244
|
const noToken = missingTokenReason(err);
|
|
8167
|
-
if (noToken !== void 0) return [skip(ID$
|
|
8245
|
+
if (noToken !== void 0) return [skip(ID$4, TITLE$4, noToken)];
|
|
8168
8246
|
return [{
|
|
8169
|
-
id: ID$
|
|
8170
|
-
title: TITLE$
|
|
8247
|
+
id: ID$4,
|
|
8248
|
+
title: TITLE$4,
|
|
8171
8249
|
status: "fail",
|
|
8172
8250
|
detail: errorMessage(err),
|
|
8173
8251
|
problems: []
|
|
@@ -8180,8 +8258,8 @@ async function dashboardRows(monitoring) {
|
|
|
8180
8258
|
* (a tag the config states is compared too; one it leaves out is not), and a heartbeat the account holds beyond the
|
|
8181
8259
|
* config is an `info` row (shown as skipped). Names only: the ping URL is never read here.
|
|
8182
8260
|
*/
|
|
8183
|
-
const ID$
|
|
8184
|
-
const TITLE$
|
|
8261
|
+
const ID$3 = "monitoring-heartbeats";
|
|
8262
|
+
const TITLE$3 = "monitoring heartbeats match";
|
|
8185
8263
|
const show = (b) => new Map([
|
|
8186
8264
|
["period", `${b.period} ${b.periodUnit}`],
|
|
8187
8265
|
["grace", `${b.grace} ${b.graceUnit}`],
|
|
@@ -8192,8 +8270,8 @@ async function heartbeatRows(monitoring) {
|
|
|
8192
8270
|
const declared = monitoring.heartbeats ?? [];
|
|
8193
8271
|
if (declared.length === 0) return [];
|
|
8194
8272
|
const skip = (detail) => ({
|
|
8195
|
-
id: ID$
|
|
8196
|
-
title: TITLE$
|
|
8273
|
+
id: ID$3,
|
|
8274
|
+
title: TITLE$3,
|
|
8197
8275
|
status: "skip",
|
|
8198
8276
|
detail,
|
|
8199
8277
|
problems: []
|
|
@@ -8217,14 +8295,14 @@ async function heartbeatRows(monitoring) {
|
|
|
8217
8295
|
}));
|
|
8218
8296
|
}
|
|
8219
8297
|
const rows = [problems.length > 0 ? {
|
|
8220
|
-
id: ID$
|
|
8221
|
-
title: TITLE$
|
|
8298
|
+
id: ID$3,
|
|
8299
|
+
title: TITLE$3,
|
|
8222
8300
|
status: "fail",
|
|
8223
8301
|
detail: `${problems.length} problem(s)`,
|
|
8224
8302
|
problems
|
|
8225
8303
|
} : {
|
|
8226
|
-
id: ID$
|
|
8227
|
-
title: TITLE$
|
|
8304
|
+
id: ID$3,
|
|
8305
|
+
title: TITLE$3,
|
|
8228
8306
|
status: "ok",
|
|
8229
8307
|
detail: `${declared.length} of ${declared.length} match`,
|
|
8230
8308
|
problems: []
|
|
@@ -8232,7 +8310,7 @@ async function heartbeatRows(monitoring) {
|
|
|
8232
8310
|
const declaredNames = new Set(declared.map((b) => b.name));
|
|
8233
8311
|
const extras = [...have.keys()].filter((name) => !declaredNames.has(name)).sort();
|
|
8234
8312
|
if (extras.length > 0) rows.push({
|
|
8235
|
-
id: `${ID$
|
|
8313
|
+
id: `${ID$3}-extra`,
|
|
8236
8314
|
title: "heartbeats beyond the config",
|
|
8237
8315
|
status: "skip",
|
|
8238
8316
|
detail: `info: the account also holds ${extras.length}: ${extras.join(", ")}`,
|
|
@@ -8243,8 +8321,8 @@ async function heartbeatRows(monitoring) {
|
|
|
8243
8321
|
const noToken = missingTokenReason(err);
|
|
8244
8322
|
if (noToken !== void 0) return [skip(noToken)];
|
|
8245
8323
|
return [{
|
|
8246
|
-
id: ID$
|
|
8247
|
-
title: TITLE$
|
|
8324
|
+
id: ID$3,
|
|
8325
|
+
title: TITLE$3,
|
|
8248
8326
|
status: "fail",
|
|
8249
8327
|
detail: errorMessage(err),
|
|
8250
8328
|
problems: []
|
|
@@ -8347,6 +8425,35 @@ async function statusPageRows(monitoring) {
|
|
|
8347
8425
|
}
|
|
8348
8426
|
return rows;
|
|
8349
8427
|
}
|
|
8428
|
+
// src/commands/doctor-monitoring/undeclared-check-rows/undeclared-check-rows.ts
|
|
8429
|
+
const ID$2 = "monitoring-undeclared";
|
|
8430
|
+
const TITLE$2 = "checks no config declares";
|
|
8431
|
+
function undeclaredCheckRows({ monitoring, workspace, have }) {
|
|
8432
|
+
if (have === void 0) return [];
|
|
8433
|
+
const tags = new Set([
|
|
8434
|
+
...monitoring.dashboards ?? [],
|
|
8435
|
+
...workspace.dashboards,
|
|
8436
|
+
...[...monitoring.statusPages ?? [], ...workspace.statusPages].flatMap((p) => p.components)
|
|
8437
|
+
].flatMap((x) => x.tags));
|
|
8438
|
+
if (tags.size === 0) return [];
|
|
8439
|
+
const row = (status, detail) => [{
|
|
8440
|
+
id: ID$2,
|
|
8441
|
+
title: TITLE$2,
|
|
8442
|
+
status,
|
|
8443
|
+
detail,
|
|
8444
|
+
problems: []
|
|
8445
|
+
}];
|
|
8446
|
+
if (workspace.unreadable.length > 0) return row("skip", `info: not compared, a package's config could not be read: ${workspace.unreadable.join("; ")}`);
|
|
8447
|
+
const declared = new Set([...monitoring.checks, ...workspace.checks].map((c) => c.name));
|
|
8448
|
+
const picked = have.map((c) => ({
|
|
8449
|
+
name: c.name,
|
|
8450
|
+
tags: c.tags ?? []
|
|
8451
|
+
})).filter((c) => c.tags.some((t) => tags.has(t)));
|
|
8452
|
+
const undeclared = picked.filter((c) => !declared.has(c.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
8453
|
+
if (undeclared.length === 0) return row("ok", `${picked.length} compared, all declared`);
|
|
8454
|
+
const shown = undeclared.map((c) => `${c.name} (${[...c.tags].sort().join(", ")})`);
|
|
8455
|
+
return row("skip", `info: ${undeclared.length} check(s) a declared dashboard or component picks up, declared nowhere: ${shown.join(", ")}`);
|
|
8456
|
+
}
|
|
8350
8457
|
// src/commands/doctor-monitoring/doctor-monitoring.ts
|
|
8351
8458
|
/**
|
|
8352
8459
|
* `holocron doctor monitoring` โ do the checks the `monitoring` provider declares exist in its account, as declared?
|
|
@@ -8358,6 +8465,10 @@ async function statusPageRows(monitoring) {
|
|
|
8358
8465
|
* lacks fails, an extra tag on it does not. A provider that cannot list its checks, a missing
|
|
8359
8466
|
* provider that failed to load, or a missing token is a skip with the reason, not a failure.
|
|
8360
8467
|
*
|
|
8468
|
+
* One more `info` row, `monitoring-undeclared` (`undeclared-check-rows/`), names the account's checks that a declared
|
|
8469
|
+
* dashboard or status page component picks up by tag and that no config declares, the root's or a workspace package's
|
|
8470
|
+
* (`readWorkspaceMonitoring()`). It reuses the checks row's one read of the account and is never a failure.
|
|
8471
|
+
*
|
|
8361
8472
|
* Heartbeats are one more row (`heartbeat-rows/`): each declared one must exist with the declared period and grace, and
|
|
8362
8473
|
* the account's others are an `info` row. Names only.
|
|
8363
8474
|
*
|
|
@@ -8372,7 +8483,17 @@ async function runDoctorMonitoring(input) {
|
|
|
8372
8483
|
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
8373
8484
|
await loader.load();
|
|
8374
8485
|
assertPluginsResolvable(loader, "doctor monitoring");
|
|
8375
|
-
const
|
|
8486
|
+
const checks = await checkRow(loader);
|
|
8487
|
+
const rows = [checks.row];
|
|
8488
|
+
if (loader.has("monitoring")) {
|
|
8489
|
+
const monitoring = loader.get("monitoring");
|
|
8490
|
+
const workspace = input.workspaceMonitoring ?? await readWorkspaceMonitoring(input.context);
|
|
8491
|
+
rows.push(...undeclaredCheckRows({
|
|
8492
|
+
monitoring,
|
|
8493
|
+
workspace,
|
|
8494
|
+
have: checks.have
|
|
8495
|
+
}));
|
|
8496
|
+
}
|
|
8376
8497
|
if (loader.has("monitoring")) rows.push(...await dashboardRows(loader.get("monitoring")));
|
|
8377
8498
|
if (loader.has("monitoring")) rows.push(...await statusPageRows(loader.get("monitoring")));
|
|
8378
8499
|
rows.push(...await heartbeatRowsOf(loader));
|
|
@@ -8391,60 +8512,63 @@ async function runDoctorMonitoring(input) {
|
|
|
8391
8512
|
...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
|
|
8392
8513
|
};
|
|
8393
8514
|
}
|
|
8515
|
+
/** The checks row and, when it read them, the checks the account holds (the one read `monitoring-undeclared` reuses). */
|
|
8394
8516
|
async function checkRow(loader) {
|
|
8395
|
-
const skip = (detail) => ({
|
|
8517
|
+
const skip = (detail) => ({ row: {
|
|
8396
8518
|
id: ID$1,
|
|
8397
8519
|
title: TITLE$1,
|
|
8398
8520
|
status: "skip",
|
|
8399
8521
|
detail,
|
|
8400
8522
|
problems: []
|
|
8401
|
-
});
|
|
8402
|
-
|
|
8403
|
-
if (loader.loadFailures().some((f) => f.key === "monitoring")) return skip(whyMissing(loader, "monitoring", "no `monitoring` provider is available"));
|
|
8404
|
-
return {
|
|
8405
|
-
id: ID$1,
|
|
8406
|
-
title: TITLE$1,
|
|
8407
|
-
status: "ok",
|
|
8408
|
-
detail: "none declared",
|
|
8409
|
-
problems: []
|
|
8410
|
-
};
|
|
8411
|
-
}
|
|
8412
|
-
const monitoring = loader.get("monitoring");
|
|
8413
|
-
if (monitoring.checks.length === 0) return {
|
|
8523
|
+
} });
|
|
8524
|
+
const none = () => ({ row: {
|
|
8414
8525
|
id: ID$1,
|
|
8415
8526
|
title: TITLE$1,
|
|
8416
8527
|
status: "ok",
|
|
8417
8528
|
detail: "none declared",
|
|
8418
8529
|
problems: []
|
|
8419
|
-
};
|
|
8530
|
+
} });
|
|
8531
|
+
if (!loader.has("monitoring")) {
|
|
8532
|
+
if (loader.loadFailures().some((f) => f.key === "monitoring")) return skip(whyMissing(loader, "monitoring", "no `monitoring` provider is available"));
|
|
8533
|
+
return none();
|
|
8534
|
+
}
|
|
8535
|
+
const monitoring = loader.get("monitoring");
|
|
8536
|
+
if (monitoring.checks.length === 0) return none();
|
|
8420
8537
|
if (!monitoring.listChecks) return skip("provider does not implement listChecks");
|
|
8421
8538
|
try {
|
|
8422
|
-
const
|
|
8539
|
+
const have = await monitoring.listChecks();
|
|
8540
|
+
const problems = compareChecks(monitoring.checks, have);
|
|
8423
8541
|
if (problems.length > 0) return {
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8542
|
+
row: {
|
|
8543
|
+
id: ID$1,
|
|
8544
|
+
title: TITLE$1,
|
|
8545
|
+
status: "fail",
|
|
8546
|
+
detail: `${problems.length} problem(s)`,
|
|
8547
|
+
problems
|
|
8548
|
+
},
|
|
8549
|
+
have
|
|
8429
8550
|
};
|
|
8430
8551
|
const n = monitoring.checks.length;
|
|
8431
8552
|
return {
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8553
|
+
row: {
|
|
8554
|
+
id: ID$1,
|
|
8555
|
+
title: TITLE$1,
|
|
8556
|
+
status: "ok",
|
|
8557
|
+
detail: `${n} of ${n} match`,
|
|
8558
|
+
problems: []
|
|
8559
|
+
},
|
|
8560
|
+
have
|
|
8437
8561
|
};
|
|
8438
8562
|
} catch (err) {
|
|
8439
8563
|
const noToken = missingTokenReason(err);
|
|
8440
8564
|
if (noToken !== void 0) return skip(noToken);
|
|
8441
|
-
return {
|
|
8565
|
+
return { row: {
|
|
8442
8566
|
id: ID$1,
|
|
8443
8567
|
title: TITLE$1,
|
|
8444
8568
|
status: "fail",
|
|
8445
8569
|
detail: errorMessage(err),
|
|
8446
8570
|
problems: []
|
|
8447
|
-
};
|
|
8571
|
+
} };
|
|
8448
8572
|
}
|
|
8449
8573
|
}
|
|
8450
8574
|
/** The heartbeat rows, only when a monitoring provider is loaded and declares heartbeats. */
|
|
@@ -14811,14 +14935,6 @@ function tokenExpectations(tokens, filter = {}) {
|
|
|
14811
14935
|
return found;
|
|
14812
14936
|
}
|
|
14813
14937
|
// src/commands/workspace-providers/workspace-providers.ts
|
|
14814
|
-
/** The extensions a `holocron.config` can have. */
|
|
14815
|
-
const CONFIG_EXTENSIONS$1 = [
|
|
14816
|
-
"ts",
|
|
14817
|
-
"js",
|
|
14818
|
-
"mjs",
|
|
14819
|
-
"cjs",
|
|
14820
|
-
"json"
|
|
14821
|
-
];
|
|
14822
14938
|
/**
|
|
14823
14939
|
* The providers the configs of the workspace's packages name (`apps/sentinel` names `vercel` for its `deployment`) that
|
|
14824
14940
|
* `config` does not: what `doctor tokens` and `probe` load by name next to the repo's own, so the token a package's
|
|
@@ -14829,23 +14945,12 @@ const CONFIG_EXTENSIONS$1 = [
|
|
|
14829
14945
|
async function workspaceProviders(repoRoot, config) {
|
|
14830
14946
|
const known = new Set(providerTuples(config.providers).map((t) => t.provider));
|
|
14831
14947
|
const found = [];
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
for (const pkg of packages) {
|
|
14839
|
-
const dir = join(repoRoot, pkg.path ?? `${pkg.dir}/${pkg.slug}`);
|
|
14840
|
-
if (!CONFIG_EXTENSIONS$1.some((ext) => existsSync(join(dir, `holocron.config.${ext}`)))) continue;
|
|
14841
|
-
try {
|
|
14842
|
-
for (const tuple of providerTuples((await loadConfig(dir)).resolved.providers)) {
|
|
14843
|
-
if (known.has(tuple.provider)) continue;
|
|
14844
|
-
known.add(tuple.provider);
|
|
14845
|
-
found.push(tuple);
|
|
14846
|
-
}
|
|
14847
|
-
} catch {
|
|
14848
|
-
continue;
|
|
14948
|
+
for (const pkg of await readWorkspaceConfigs(repoRoot)) {
|
|
14949
|
+
if ("error" in pkg) continue;
|
|
14950
|
+
for (const tuple of providerTuples(pkg.resolved.providers)) {
|
|
14951
|
+
if (known.has(tuple.provider)) continue;
|
|
14952
|
+
known.add(tuple.provider);
|
|
14953
|
+
found.push(tuple);
|
|
14849
14954
|
}
|
|
14850
14955
|
}
|
|
14851
14956
|
return found;
|
|
@@ -26893,6 +26998,101 @@ async function runPublish(input = {}) {
|
|
|
26893
26998
|
packageNames
|
|
26894
26999
|
};
|
|
26895
27000
|
}
|
|
27001
|
+
// src/commands/publish/publish-failures/publish-failures.ts
|
|
27002
|
+
/** The command that publishes what is still missing for the version the checkout is on. */
|
|
27003
|
+
const REPUBLISH_COMMAND = "holocron publish package --skip-already-published";
|
|
27004
|
+
function advice(failures) {
|
|
27005
|
+
const out = [];
|
|
27006
|
+
if (failures.some((f) => f.kind === "tlog-conflict")) out.push("A sigstore 409 that survives retries means the tarball is identical to one already in the transparency log (an earlier publish of the same bytes). Retrying cannot fix it: change the package's contents and release again.");
|
|
27007
|
+
if (failures.some((f) => f.kind === "failed")) out.push(`For any other failure, fix the cause and run \`${REPUBLISH_COMMAND}\` (add \`--group <folder>\` for a version group) at the tag it happened on; it publishes only what npm lacks. \`holocron doctor releases\` names a tag npm never received.`);
|
|
27008
|
+
return out;
|
|
27009
|
+
}
|
|
27010
|
+
/** Plain lines printed at the end of a run that left packages unpublished, all failures together. */
|
|
27011
|
+
function formatPublishFailures(failures) {
|
|
27012
|
+
const lines = [` โ ${failures.length} package(s) not published:`];
|
|
27013
|
+
for (const f of failures) lines.push(f.kind === "tlog-conflict" ? ` - ${f.name}@${f.version}: sigstore 409, identical tarball already in the transparency log` : ` - ${f.message}`);
|
|
27014
|
+
for (const line of advice(failures)) lines.push(` โ ${line}`);
|
|
27015
|
+
return lines;
|
|
27016
|
+
}
|
|
27017
|
+
/** The same report as Markdown for the job summary. */
|
|
27018
|
+
function publishFailuresMarkdown(failures) {
|
|
27019
|
+
return [
|
|
27020
|
+
"## Packages not published",
|
|
27021
|
+
"",
|
|
27022
|
+
"| Package | Reason |",
|
|
27023
|
+
"| --- | --- |",
|
|
27024
|
+
...failures.map((f) => `| \`${f.name}@${f.version}\` | ${f.kind === "tlog-conflict" ? "sigstore 409 (identical tarball already logged)" : "failed"} |`),
|
|
27025
|
+
"",
|
|
27026
|
+
...advice(failures).flatMap((a) => [a, ""])
|
|
27027
|
+
].join("\n").trimEnd();
|
|
27028
|
+
}
|
|
27029
|
+
// src/commands/publish/is-tlog-conflict.ts
|
|
27030
|
+
/**
|
|
27031
|
+
* Whether a failed `pnpm publish` was npm's sigstore step answering 409
|
|
27032
|
+
* (`TLOG_CREATE_ENTRY_ERROR`, "an equivalent entry already exists in the
|
|
27033
|
+
* transparency log"): the only failure class `publish package` retries (#1387).
|
|
27034
|
+
* A bare registry `E409` (the version already exists) is not this class; the
|
|
27035
|
+
* view check after every failure settles that one.
|
|
27036
|
+
*/
|
|
27037
|
+
function isTlogConflict(output) {
|
|
27038
|
+
return /TLOG_CREATE_ENTRY_ERROR|equivalent entry already exists in the transparency log/i.test(output);
|
|
27039
|
+
}
|
|
27040
|
+
// src/commands/publish/publish-one-package/publish-one-package.ts
|
|
27041
|
+
/** Default waits before the two retries of a sigstore 409. */
|
|
27042
|
+
const DEFAULT_BACKOFF_MS = [5e3, 15e3];
|
|
27043
|
+
const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
27044
|
+
/**
|
|
27045
|
+
* Publishes one package and settles what a failure means (#1387). After every failed call it asks the registry
|
|
27046
|
+
* (`npm view <name>@<version>`): a version that is there counts as published (another run made it). Only a sigstore 409
|
|
27047
|
+
* (`TLOG_CREATE_ENTRY_ERROR`) is tried again, after a short backoff; any other failure ends the package at once. A 409
|
|
27048
|
+
* that survives every retry is reported as `tlog-conflict`: the same bytes are already in the transparency log, which a
|
|
27049
|
+
* retry cannot change.
|
|
27050
|
+
*/
|
|
27051
|
+
async function publishOnePackage(input) {
|
|
27052
|
+
const { entry, exec, cwd, print } = input;
|
|
27053
|
+
const sleep = input.sleep ?? defaultSleep;
|
|
27054
|
+
const backoff = input.backoffMs ?? DEFAULT_BACKOFF_MS;
|
|
27055
|
+
const label = `${entry.name}@${entry.version}`;
|
|
27056
|
+
for (let attempt = 0;; attempt += 1) {
|
|
27057
|
+
const publish = await exec("pnpm", [...input.publishArgs], { cwd });
|
|
27058
|
+
if (publish.exitCode === 0) return { outcome: "published" };
|
|
27059
|
+
const view = await exec("npm", [
|
|
27060
|
+
"view",
|
|
27061
|
+
label,
|
|
27062
|
+
"version"
|
|
27063
|
+
], { cwd });
|
|
27064
|
+
if (view.exitCode === 0 && view.stdout.trim()) return { outcome: "concurrent" };
|
|
27065
|
+
const output = `${publish.stderr}\n${publish.stdout}`;
|
|
27066
|
+
const message = `publish failed for ${label} (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || "no output"}`;
|
|
27067
|
+
if (!isTlogConflict(output)) return {
|
|
27068
|
+
outcome: "failed",
|
|
27069
|
+
message
|
|
27070
|
+
};
|
|
27071
|
+
const wait = backoff[attempt];
|
|
27072
|
+
if (wait === void 0) return {
|
|
27073
|
+
outcome: "tlog-conflict",
|
|
27074
|
+
message
|
|
27075
|
+
};
|
|
27076
|
+
print(` โฆ ${label} hit a sigstore 409; retrying in ${wait / 1e3}s (${attempt + 1} of ${backoff.length})`);
|
|
27077
|
+
await sleep(wait);
|
|
27078
|
+
}
|
|
27079
|
+
}
|
|
27080
|
+
// src/commands/publish/write-job-summary/write-job-summary.ts
|
|
27081
|
+
/**
|
|
27082
|
+
* Appends Markdown to the file GitHub Actions names in `GITHUB_STEP_SUMMARY`, so the job's page says what happened.
|
|
27083
|
+
* Does nothing outside Actions (the variable is unset) and never throws: a summary that cannot be written must not
|
|
27084
|
+
* fail a publish. Returns whether the text was written.
|
|
27085
|
+
*/
|
|
27086
|
+
function writeJobSummary(markdown, env = createEnvLookup(), append = appendFileSync) {
|
|
27087
|
+
const file = env.get("GITHUB_STEP_SUMMARY");
|
|
27088
|
+
if (file === void 0) return false;
|
|
27089
|
+
try {
|
|
27090
|
+
append(file, `${markdown}\n`);
|
|
27091
|
+
return true;
|
|
27092
|
+
} catch {
|
|
27093
|
+
return false;
|
|
27094
|
+
}
|
|
27095
|
+
}
|
|
26896
27096
|
// src/commands/publish/run-steady-publish/run-steady-publish.ts
|
|
26897
27097
|
/**
|
|
26898
27098
|
* `holocron publish package` (no `--initial`) โ the steady-state publish
|
|
@@ -26981,6 +27181,7 @@ async function runSteadyPublish(input = {}) {
|
|
|
26981
27181
|
}
|
|
26982
27182
|
if (skipAlreadyPublished) {
|
|
26983
27183
|
print(" โ publishing packages not already on npmโฆ");
|
|
27184
|
+
const failures = [];
|
|
26984
27185
|
for (const entry of entries) {
|
|
26985
27186
|
const view = await exec("npm", [
|
|
26986
27187
|
"view",
|
|
@@ -26991,37 +27192,46 @@ async function runSteadyPublish(input = {}) {
|
|
|
26991
27192
|
print(` skip ${entry.name}@${entry.version} (already published)`);
|
|
26992
27193
|
continue;
|
|
26993
27194
|
}
|
|
26994
|
-
const
|
|
26995
|
-
|
|
26996
|
-
|
|
26997
|
-
|
|
26998
|
-
|
|
26999
|
-
|
|
27000
|
-
|
|
27001
|
-
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
|
|
27005
|
-
|
|
27006
|
-
|
|
27007
|
-
|
|
27008
|
-
|
|
27009
|
-
|
|
27010
|
-
}
|
|
27011
|
-
|
|
27012
|
-
|
|
27013
|
-
|
|
27014
|
-
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
|
|
27019
|
-
|
|
27020
|
-
|
|
27021
|
-
|
|
27022
|
-
|
|
27023
|
-
}
|
|
27024
|
-
|
|
27195
|
+
const result = await publishOnePackage({
|
|
27196
|
+
entry,
|
|
27197
|
+
publishArgs: [
|
|
27198
|
+
"--filter",
|
|
27199
|
+
entry.dir,
|
|
27200
|
+
"publish",
|
|
27201
|
+
...baseFlags,
|
|
27202
|
+
...otpFlags
|
|
27203
|
+
],
|
|
27204
|
+
cwd,
|
|
27205
|
+
exec,
|
|
27206
|
+
print,
|
|
27207
|
+
...input.sleep ? { sleep: input.sleep } : {},
|
|
27208
|
+
...input.backoffMs ? { backoffMs: input.backoffMs } : {}
|
|
27209
|
+
});
|
|
27210
|
+
if ("message" in result) {
|
|
27211
|
+
print(` โ ${result.message}`);
|
|
27212
|
+
failures.push({
|
|
27213
|
+
name: entry.name,
|
|
27214
|
+
version: entry.version,
|
|
27215
|
+
kind: result.outcome,
|
|
27216
|
+
message: result.message
|
|
27217
|
+
});
|
|
27218
|
+
} else if (result.outcome === "concurrent") print(` skip ${entry.name}@${entry.version} (published concurrently by another run)`);
|
|
27219
|
+
else print(` โ ${entry.name}@${entry.version}`);
|
|
27220
|
+
}
|
|
27221
|
+
if (failures.length > 0) {
|
|
27222
|
+
for (const line of formatPublishFailures(failures)) print(line);
|
|
27223
|
+
writeJobSummary(publishFailuresMarkdown(failures), input.envLookup);
|
|
27224
|
+
const message = `${failures.length} of ${entries.length} package(s) not published: ${failures.map((f) => `${f.name}@${f.version}`).join(", ")}`;
|
|
27225
|
+
logger.warn({
|
|
27226
|
+
tag,
|
|
27227
|
+
failed: failures.map((f) => f.name),
|
|
27228
|
+
reason: message
|
|
27229
|
+
}, "publish: done");
|
|
27230
|
+
return {
|
|
27231
|
+
status: "fail",
|
|
27232
|
+
message,
|
|
27233
|
+
packageNames
|
|
27234
|
+
};
|
|
27025
27235
|
}
|
|
27026
27236
|
logger.info({
|
|
27027
27237
|
tag,
|