@theholocron/cli 5.0.0-alpha.482 → 5.0.0-alpha.483
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 -0
- package/dist/cli.mjs +150 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-Crowwrda.d.mts → index-UQEV2tGX.d.mts} +41 -1
- package/dist/index.d.mts +2 -2
- package/dist/plugin/capabilities.d.mts +2 -2
- package/dist/presets.d.mts +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -668,6 +668,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
668
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 |
|
|
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
|
+
| `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 |
|
|
671
672
|
| `holocron doctor environments` | Do the deployment environments exist? The ones `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 |
|
|
672
673
|
| `holocron doctor project [--post [channel]]` | Does each board `providers.projects.boards` declares exist and match its template? One row per board, status list, field, view and automation rule; the board's extras and the items `reconcile project` would fix (no status, closed but not done, open blocker but not blocked, blocked without a blocker) are `info` rows, never a failure. A template file that does not read fails, naming the file. Read-only; `--post` shares the failing rows through the `notifications` bot. |
|
|
673
674
|
| `holocron doctor repo` | Do the repository settings `setup` writes match the config? One row per group the config declares: description and homepage, default branch and merge settings, topics, custom properties, team access, branch protection; labels and security settings are always checked. Read-only. Reads through optional `Source` methods (`getRepoInfo`, `getProperties`, `listLabels`, `listTeamAccess`, `getRulesetDetail`, `getSecurity`); a group that cannot be read is a skip, not a failure |
|
package/dist/cli.mjs
CHANGED
|
@@ -109,6 +109,7 @@ const COMMAND_CONTEXTS = {
|
|
|
109
109
|
"doctor project": "workspace",
|
|
110
110
|
"doctor logs": "workspace",
|
|
111
111
|
"doctor wiki": "workspace",
|
|
112
|
+
"doctor errors": "workspace",
|
|
112
113
|
"doctor github-app": "workspace",
|
|
113
114
|
"move issues": "workspace",
|
|
114
115
|
"apply properties": "workspace",
|
|
@@ -385,6 +386,14 @@ const doctorEnvironmentsEntry = {
|
|
|
385
386
|
skipOptions: ["all", "repo"],
|
|
386
387
|
supportsDryRun: false
|
|
387
388
|
};
|
|
389
|
+
// src/commands/doctor-errors/doctor-errors.entry.ts
|
|
390
|
+
const doctorErrorsEntry = {
|
|
391
|
+
name: "doctor errors",
|
|
392
|
+
description: "Check the error tracker's organization, declared projects, keys and alert rules (read-only)",
|
|
393
|
+
positionals: [],
|
|
394
|
+
skipOptions: ["all", "repo"],
|
|
395
|
+
supportsDryRun: false
|
|
396
|
+
};
|
|
388
397
|
// src/commands/doctor-github-app/doctor-github-app.entry.ts
|
|
389
398
|
const doctorGitHubAppEntry = {
|
|
390
399
|
name: "doctor github-app",
|
|
@@ -1348,6 +1357,7 @@ const registry = createCommandRegistry([
|
|
|
1348
1357
|
doctorGitHubAppEntry,
|
|
1349
1358
|
doctorLogsEntry,
|
|
1350
1359
|
doctorWikiEntry,
|
|
1360
|
+
doctorErrorsEntry,
|
|
1351
1361
|
projectMoveEntry,
|
|
1352
1362
|
repoPropertiesApplyEntry,
|
|
1353
1363
|
migrateIssueEntry,
|
|
@@ -7435,7 +7445,7 @@ async function runDoctorDns(input) {
|
|
|
7435
7445
|
});
|
|
7436
7446
|
else if (!loader.has("dns")) {
|
|
7437
7447
|
const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
|
|
7438
|
-
for (const zone of zones) rows.push(row$
|
|
7448
|
+
for (const zone of zones) rows.push(row$20(zone, "skip", why));
|
|
7439
7449
|
for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
|
|
7440
7450
|
} else {
|
|
7441
7451
|
const dns = loader.get("dns");
|
|
@@ -7457,7 +7467,7 @@ async function runDoctorDns(input) {
|
|
|
7457
7467
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
7458
7468
|
};
|
|
7459
7469
|
}
|
|
7460
|
-
function row$
|
|
7470
|
+
function row$20(zone, status, detail, problems = []) {
|
|
7461
7471
|
return {
|
|
7462
7472
|
id: `dns-${zone}`,
|
|
7463
7473
|
title: `${zone} records exist`,
|
|
@@ -7486,7 +7496,7 @@ async function checkDomain(dns, deploy, project, hostname) {
|
|
|
7486
7496
|
return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
|
|
7487
7497
|
}
|
|
7488
7498
|
}
|
|
7489
|
-
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$
|
|
7499
|
+
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$20(zone, ...args)) {
|
|
7490
7500
|
try {
|
|
7491
7501
|
const have = await dns.listRecords(zone);
|
|
7492
7502
|
const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
|
|
@@ -7596,6 +7606,130 @@ const doctorEnvironmentsCommand = {
|
|
|
7596
7606
|
})).status === "fail") process.exitCode = 1;
|
|
7597
7607
|
}
|
|
7598
7608
|
};
|
|
7609
|
+
// src/commands/doctor-errors/declared-projects.ts
|
|
7610
|
+
/**
|
|
7611
|
+
* The error tracker projects the config declares: every project a notifications layout's `relay.errors.projects`
|
|
7612
|
+
* sends alerts from, in order, each once.
|
|
7613
|
+
*/
|
|
7614
|
+
function declaredProjects(layouts) {
|
|
7615
|
+
return [...new Set(layouts.flatMap((layout) => layout.relay?.errors?.projects ?? []))];
|
|
7616
|
+
}
|
|
7617
|
+
// src/commands/doctor-errors/errors-rows.ts
|
|
7618
|
+
const row$19 = (id, title, status, detail, problems = []) => ({
|
|
7619
|
+
id,
|
|
7620
|
+
title,
|
|
7621
|
+
status,
|
|
7622
|
+
detail,
|
|
7623
|
+
problems
|
|
7624
|
+
});
|
|
7625
|
+
/**
|
|
7626
|
+
* The rows `holocron doctor errors` prints for one {@link ErrorsInspection}: the organization, then for each declared
|
|
7627
|
+
* project that it exists, has a client key and is watched by an enabled alert rule. Pure. A project missing, a project
|
|
7628
|
+
* with no key and a project no enabled rule watches fail; alert rules the token could not read are a skip. The Comlink
|
|
7629
|
+
* relay's integration and rule have their own rows in `doctor notifications`.
|
|
7630
|
+
*/
|
|
7631
|
+
function errorsRows(found, providerName) {
|
|
7632
|
+
const orgSlug = found.org.slug;
|
|
7633
|
+
if (!found.org.exists) {
|
|
7634
|
+
const problem = `${providerName} has no organization named ${orgSlug}; check the \`org\` option of the \`errors\` provider`;
|
|
7635
|
+
const rows = [row$19("errors:org", "organization exists", "fail", `${orgSlug} not found`, [problem])];
|
|
7636
|
+
for (const project of found.projects) rows.push(row$19(`errors:project:${project.slug}`, `project ${project.slug} exists`, "skip", "not checked: no organization"));
|
|
7637
|
+
return rows;
|
|
7638
|
+
}
|
|
7639
|
+
const rows = [row$19("errors:org", "organization exists", "ok", `${orgSlug} (${found.org.name ?? orgSlug})`)];
|
|
7640
|
+
if (found.projects.length === 0) {
|
|
7641
|
+
rows.push(row$19("errors:projects", "declared projects", "skip", "none declared: no `relay.errors.projects` in a layout"));
|
|
7642
|
+
return rows;
|
|
7643
|
+
}
|
|
7644
|
+
for (const project of found.projects) {
|
|
7645
|
+
const slug = project.slug;
|
|
7646
|
+
if (!project.exists) {
|
|
7647
|
+
const problem = `no project ${slug} in ${found.org.slug}; create it in ${providerName}`;
|
|
7648
|
+
rows.push(row$19(`errors:project:${slug}`, `project ${slug} exists`, "fail", "not found", [problem]), row$19(`errors:dsn:${slug}`, `project ${slug} has a key`, "skip", "not checked: no project"), row$19(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", "not checked: no project"));
|
|
7649
|
+
continue;
|
|
7650
|
+
}
|
|
7651
|
+
rows.push(row$19(`errors:project:${slug}`, `project ${slug} exists`, "ok", slug));
|
|
7652
|
+
rows.push(project.hasDsn ? row$19(`errors:dsn:${slug}`, `project ${slug} has a key`, "ok", "a client key (DSN) exists") : row$19(`errors:dsn:${slug}`, `project ${slug} has a key`, "fail", "no client key", [`${slug} has no client key, so an SDK has no DSN to send to; add one in ${providerName}`]));
|
|
7653
|
+
if (project.alertRules === void 0) rows.push(row$19(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", found.alertsUnreadable ? `could not read the alert rules: ${found.alertsUnreadable}` : "not read"));
|
|
7654
|
+
else if (project.alertRules === 0) rows.push(row$19(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "fail", "no enabled rule", [`no enabled alert rule watches ${slug}, so its errors reach no one`]));
|
|
7655
|
+
else rows.push(row$19(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "ok", `${project.alertRules} enabled rule(s)`));
|
|
7656
|
+
}
|
|
7657
|
+
return rows;
|
|
7658
|
+
}
|
|
7659
|
+
// src/commands/doctor-errors/doctor-errors.ts
|
|
7660
|
+
/**
|
|
7661
|
+
* `holocron doctor errors` — does the error tracker the config declares have the organization, projects, keys and
|
|
7662
|
+
* alert rules it relies on?
|
|
7663
|
+
*
|
|
7664
|
+
* Read-only: it never creates a project or a rule, and prints names and counts only, never a DSN, a key or a token.
|
|
7665
|
+
* The rows (`errorsRows()`): the organization; for each project a notifications layout's `relay.errors.projects`
|
|
7666
|
+
* declares, that it exists, has a client key and is watched by an enabled alert rule. The Comlink relay's own
|
|
7667
|
+
* integration and rule are `doctor notifications`' rows and are not repeated. A project the provider says is missing
|
|
7668
|
+
* fails; anything that cannot be read (no token, no `org`, a token without the alert scope) is a skip with the reason.
|
|
7669
|
+
*/
|
|
7670
|
+
const skip$1 = (detail) => ({
|
|
7671
|
+
id: "errors",
|
|
7672
|
+
title: "errors",
|
|
7673
|
+
status: "skip",
|
|
7674
|
+
detail,
|
|
7675
|
+
problems: []
|
|
7676
|
+
});
|
|
7677
|
+
async function runDoctorErrors(input) {
|
|
7678
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
7679
|
+
const logger = input.logger ?? getLogger();
|
|
7680
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
7681
|
+
await loader.load();
|
|
7682
|
+
assertPluginsResolvable(loader, "doctor errors");
|
|
7683
|
+
let rows;
|
|
7684
|
+
if (!loader.has("errors")) {
|
|
7685
|
+
const failure = loader.loadFailures().find((f) => f.key === "errors");
|
|
7686
|
+
rows = [skip$1(failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `errors` provider is configured in holocron.config.ts")];
|
|
7687
|
+
} else {
|
|
7688
|
+
const errors = loader.get("errors");
|
|
7689
|
+
if (!errors.inspect) rows = [skip$1(`${errors.providerName} cannot read its organization`)];
|
|
7690
|
+
else {
|
|
7691
|
+
const layouts = (loader.has("notifications") ? loader.get("notifications") : []).flatMap((p) => p.layout ? [p.layout] : []);
|
|
7692
|
+
try {
|
|
7693
|
+
rows = errorsRows(await errors.inspect({ projects: declaredProjects(layouts) }), errors.providerName);
|
|
7694
|
+
} catch (err) {
|
|
7695
|
+
rows = [skip$1(missingTokenReason(err) ?? `could not read ${errors.providerName}: ${describeError(err)}`)];
|
|
7696
|
+
}
|
|
7697
|
+
}
|
|
7698
|
+
}
|
|
7699
|
+
printCheckRows(rows, print);
|
|
7700
|
+
const summary = summariseChecks(rows);
|
|
7701
|
+
printCheckSummary(summary, print);
|
|
7702
|
+
const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
|
|
7703
|
+
logger.info({
|
|
7704
|
+
...summary,
|
|
7705
|
+
status
|
|
7706
|
+
}, "doctor errors");
|
|
7707
|
+
return {
|
|
7708
|
+
status,
|
|
7709
|
+
rows,
|
|
7710
|
+
summary,
|
|
7711
|
+
...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
|
|
7712
|
+
};
|
|
7713
|
+
}
|
|
7714
|
+
// src/commands/doctor-errors/doctor-errors.command.ts
|
|
7715
|
+
const doctorErrorsCommand = {
|
|
7716
|
+
command: "errors",
|
|
7717
|
+
describe: "Check the error tracker's organization, declared projects, keys and alert rules (read-only)",
|
|
7718
|
+
handler: async (argv) => {
|
|
7719
|
+
const tokens = tokenContext(argv.token);
|
|
7720
|
+
if (!tokens) return;
|
|
7721
|
+
const loaded = await loadConfig(argv.cwd);
|
|
7722
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
7723
|
+
if ((await runDoctorErrors({
|
|
7724
|
+
loaded,
|
|
7725
|
+
context: {
|
|
7726
|
+
repoRoot: argv.cwd,
|
|
7727
|
+
...tokens,
|
|
7728
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
7729
|
+
}
|
|
7730
|
+
})).status === "fail") process.exitCode = 1;
|
|
7731
|
+
}
|
|
7732
|
+
};
|
|
7599
7733
|
// src/commands/doctor-github-app/permission-gaps.ts
|
|
7600
7734
|
const LEVELS$1 = [
|
|
7601
7735
|
"read",
|
|
@@ -15257,6 +15391,19 @@ const DEEP_CHECKS = [
|
|
|
15257
15391
|
...report.reason ? { reason: report.reason } : {}
|
|
15258
15392
|
};
|
|
15259
15393
|
}
|
|
15394
|
+
},
|
|
15395
|
+
{
|
|
15396
|
+
name: "errors",
|
|
15397
|
+
capability: "errors",
|
|
15398
|
+
command: doctorErrorsCommand,
|
|
15399
|
+
async run(input) {
|
|
15400
|
+
const report = await runDoctorErrors(input);
|
|
15401
|
+
return {
|
|
15402
|
+
status: report.status,
|
|
15403
|
+
summary: report.summary,
|
|
15404
|
+
...report.reason ? { reason: report.reason } : {}
|
|
15405
|
+
};
|
|
15406
|
+
}
|
|
15260
15407
|
}
|
|
15261
15408
|
];
|
|
15262
15409
|
// src/commands/doctor-all/doctor-all.ts
|