@theholocron/cli 5.2.0 โ 5.3.0
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 +243 -21
- package/dist/cli.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -727,7 +727,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
727
727
|
| `holocron reconcile project [board]` | Sets item statuses where a rule says so: an open blocker means `blocked`, no blocker left means `planned`, closed means `done`, and, from the pull requests that close the item, an open one means `active` and green required checks mean `review` (a failure moves `review` back; GitHub reads them through `closedByPullRequestsReferences`) (status only; `--dry-run` previews; an open item with no status is reported). Runs hourly from `platform.projectReconcile.yml`, which `setup` writes when `providers.projects` declares boards |
|
|
728
728
|
| `holocron reconcile ci [pull-request] [--max-age <minutes>] [--shadow] [--dry-run]` | Makes `ci / Required checks` say what the checks on each open pull request call for (spec `process-sentinel-posts-ci`): reads the head commit's check runs and statuses through `source` and posts the verdict with astromech's `postAggregate()`. A check missing or wrong for longer than `--max-age` (default 10) is a failing row, because a webhook was missed. Posts the real check only where `ci.aggregate` is `sentinel` (under `actions` it does nothing; `--shadow` repairs Sentinel's shadow check) and leaves a commit alone where the Actions job already posts it. The manual recovery path and, run every 15 minutes by the `reconcile-ci` task, the sweep |
|
|
729
729
|
| `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 |
|
|
730
|
-
| `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. `--shadow [--limit n]` adds a `shadow` row that compares Sentinel's `ci / Required checks (sentinel)` with the Actions `ci / Required checks` on the newest open and merged pull requests (through `source`): a decided pull request where they differ fails the row, and 20 consecutive that agree pass it (SPEC-0099). The ruleset's checks are `doctor repo`'s
|
|
730
|
+
| `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. `--remote` adds three rows that read public URLs: the `ci-v1` tag exists in holocron, each file and action the workflows name at it is there, and every workflow left in `theholocron/.github` carries the frozen-copy notice (#1564). `--shadow [--limit n]` adds a `shadow` row that compares Sentinel's `ci / Required checks (sentinel)` with the Actions `ci / Required checks` on the newest open and merged pull requests (through `source`): a decided pull request where they differ fails the row, and 20 consecutive that agree pass it (SPEC-0099). The ruleset's checks are `doctor repo`'s |
|
|
731
731
|
| `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 |
|
|
732
732
|
| `holocron redeliver webhooks [--since <time>] [--app <name>] [--dry-run] [--yes]` | Asks GitHub to deliver again the webhooks each `githubApps` instance's endpoint did not accept: reads the App's delivery log with its own JWT (id and key from its vault environment, in memory), keeps the deliveries whose latest attempt failed, and redelivers each once, oldest first (spec `process-sentinel-posts-ci`, recovery 2). Asks first unless `--yes` or `--dry-run`. It repairs every Sentinel handler; replaying is safe because each recomputes from the API |
|
|
733
733
|
| `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 |
|
package/dist/cli.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
15
15
|
import { appendFileSync, closeSync, copyFileSync, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
16
16
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
17
17
|
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver as createFeatureResolver$1, createKeyring, createPrivateFile, deferCredentials, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue as resolveValue$1, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
18
|
-
import { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, hostedReusableWorkflows, isDeprecated, isTask, localize, mergeScripts, packageLocation, postAggregate, readWorkspacePackages, recordDeploys, requiredChecks, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, wedgeFix, workflowFile, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
|
|
18
|
+
import { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, DOT_GITHUB_REPO as DOT_GITHUB_REPO$1, HOLOCRON_REPO, HOLOCRON_REPO as HOLOCRON_REPO$1, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, hostedReusableWorkflows, isDeprecated, isTask, localize, mergeScripts, packageLocation, postAggregate, readWorkspacePackages, recordDeploys, requiredChecks, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, wedgeFix, workflowFile, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
|
|
19
19
|
import { loadTasksConfig, releaseGroups } from "@theholocron/astromech/config";
|
|
20
20
|
import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
|
|
21
21
|
import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
|
|
@@ -513,6 +513,11 @@ const doctorCiEntry = {
|
|
|
513
513
|
flag: "--shadow",
|
|
514
514
|
type: "confirm",
|
|
515
515
|
message: "Also compare Sentinel's shadow aggregate with the Actions one?"
|
|
516
|
+
}, {
|
|
517
|
+
key: "remote",
|
|
518
|
+
flag: "--remote",
|
|
519
|
+
type: "confirm",
|
|
520
|
+
message: "Also check the hosted files over the network (the ci-v1 tag, what callers name at it, the frozen copies)?"
|
|
516
521
|
}],
|
|
517
522
|
skipOptions: [
|
|
518
523
|
"all",
|
|
@@ -14288,6 +14293,31 @@ function callersRow(callers) {
|
|
|
14288
14293
|
};
|
|
14289
14294
|
return problemRow(id, title, callerProblems(callers), `${callers.length} of ${callers.length} named for their id`);
|
|
14290
14295
|
}
|
|
14296
|
+
// src/commands/doctor-ci/fetch-text.ts
|
|
14297
|
+
const TIMEOUT_MS = 1e4;
|
|
14298
|
+
/** Reads a public URL with `fetch` and a timeout; a request that fails is status 0, never a throw. */
|
|
14299
|
+
const fetchText = async (url) => {
|
|
14300
|
+
/* v8 ignore start -- the real network; the rows are tested with an injected reader */
|
|
14301
|
+
try {
|
|
14302
|
+
const res = await fetch(url, {
|
|
14303
|
+
headers: {
|
|
14304
|
+
accept: "application/vnd.github+json",
|
|
14305
|
+
"user-agent": "holocron-doctor-ci"
|
|
14306
|
+
},
|
|
14307
|
+
signal: AbortSignal.timeout(TIMEOUT_MS)
|
|
14308
|
+
});
|
|
14309
|
+
return {
|
|
14310
|
+
status: res.status,
|
|
14311
|
+
text: await res.text()
|
|
14312
|
+
};
|
|
14313
|
+
} catch {
|
|
14314
|
+
return {
|
|
14315
|
+
status: 0,
|
|
14316
|
+
text: ""
|
|
14317
|
+
};
|
|
14318
|
+
}
|
|
14319
|
+
/* v8 ignore stop */
|
|
14320
|
+
};
|
|
14291
14321
|
// src/commands/doctor-ci/home-of.ts
|
|
14292
14322
|
/** Where a job's `uses:` value is hosted: the frozen copies in `theholocron/.github`, holocron at `ci-v1`, this repo, or elsewhere. */
|
|
14293
14323
|
function homeOf(uses) {
|
|
@@ -14420,6 +14450,182 @@ function realCiIo(repoRoot) {
|
|
|
14420
14450
|
} };
|
|
14421
14451
|
/* v8 ignore stop */
|
|
14422
14452
|
}
|
|
14453
|
+
// src/commands/doctor-ci/remote-constants.ts
|
|
14454
|
+
/** The tag generated callers pin the hosted files to (`CI_TARGET.ref` in astromech). */
|
|
14455
|
+
const CI_TAG = "ci-v1";
|
|
14456
|
+
/** The line a frozen copy carries in `theholocron/.github` (written by `holocron sync github` until it stopped). */
|
|
14457
|
+
const FROZEN_NOTICE = "DEPRECATED โ frozen copy";
|
|
14458
|
+
const API = "https://api.github.com";
|
|
14459
|
+
const RAW = "https://raw.githubusercontent.com";
|
|
14460
|
+
// src/commands/doctor-ci/frozen-row.ts
|
|
14461
|
+
const ID$10 = "frozen";
|
|
14462
|
+
const TITLE$11 = `the workflows left in ${DOT_GITHUB_REPO} say they are frozen`;
|
|
14463
|
+
/**
|
|
14464
|
+
* The `frozen` row: every workflow still in `theholocron/.github` carries the deprecation notice, so nobody mistakes a
|
|
14465
|
+
* copy for the live reusable. A file without it is one callers may still use unmarked (a repo still calling
|
|
14466
|
+
* `security.yml@main` is why it is there), so it fails with the file names. A read that cannot be made is a skip.
|
|
14467
|
+
*/
|
|
14468
|
+
async function frozenRow(read) {
|
|
14469
|
+
const listing = await read(`${API}/repos/${DOT_GITHUB_REPO}/contents/.github/workflows`);
|
|
14470
|
+
if (listing.status !== 200) return {
|
|
14471
|
+
id: ID$10,
|
|
14472
|
+
title: TITLE$11,
|
|
14473
|
+
status: "skip",
|
|
14474
|
+
detail: `could not list them (HTTP ${listing.status || "no answer"})`,
|
|
14475
|
+
problems: []
|
|
14476
|
+
};
|
|
14477
|
+
let names;
|
|
14478
|
+
try {
|
|
14479
|
+
names = JSON.parse(listing.text).map((entry) => entry.name).filter((name) => typeof name === "string" && /\.ya?ml$/.test(name)).sort();
|
|
14480
|
+
} catch {
|
|
14481
|
+
return {
|
|
14482
|
+
id: ID$10,
|
|
14483
|
+
title: TITLE$11,
|
|
14484
|
+
status: "skip",
|
|
14485
|
+
detail: "the listing was not JSON",
|
|
14486
|
+
problems: []
|
|
14487
|
+
};
|
|
14488
|
+
}
|
|
14489
|
+
const files = await Promise.all(names.map(async (name) => ({
|
|
14490
|
+
name,
|
|
14491
|
+
res: await read(`${RAW}/${DOT_GITHUB_REPO}/main/.github/workflows/${name}`)
|
|
14492
|
+
})));
|
|
14493
|
+
const unread = files.find(({ res }) => res.status !== 200);
|
|
14494
|
+
if (unread) return {
|
|
14495
|
+
id: ID$10,
|
|
14496
|
+
title: TITLE$11,
|
|
14497
|
+
status: "skip",
|
|
14498
|
+
detail: `could not read ${unread.name} (HTTP ${unread.res.status || "no answer"})`,
|
|
14499
|
+
problems: []
|
|
14500
|
+
};
|
|
14501
|
+
const unmarked = files.filter(({ res }) => !res.text.split("\n", 15).some((line) => line.includes(FROZEN_NOTICE)));
|
|
14502
|
+
if (unmarked.length > 0) return {
|
|
14503
|
+
id: ID$10,
|
|
14504
|
+
title: TITLE$11,
|
|
14505
|
+
status: "fail",
|
|
14506
|
+
detail: `${unmarked.length} of ${files.length} carry no notice`,
|
|
14507
|
+
problems: unmarked.map(({ name }) => `${name}: no "${FROZEN_NOTICE}" notice`)
|
|
14508
|
+
};
|
|
14509
|
+
return {
|
|
14510
|
+
id: ID$10,
|
|
14511
|
+
title: TITLE$11,
|
|
14512
|
+
status: "ok",
|
|
14513
|
+
detail: `${files.length} of ${files.length} carry the notice`,
|
|
14514
|
+
problems: []
|
|
14515
|
+
};
|
|
14516
|
+
}
|
|
14517
|
+
// src/commands/doctor-ci/hosted-paths.ts
|
|
14518
|
+
const USES = new RegExp(`^\\s*(?:-\\s+)?uses:\\s*["']?${HOLOCRON_REPO}/([^@\\s"']+)@${CI_TAG}["']?\\s*(?:#.*)?$`, "gm");
|
|
14519
|
+
/**
|
|
14520
|
+
* Every `theholocron/holocron/<path>@ci-v1` a workflow calls, in a job (`uses:` of a reusable workflow) or a step (an
|
|
14521
|
+
* action), once each, with the files that name it.
|
|
14522
|
+
*/
|
|
14523
|
+
function hostedPaths(workflows) {
|
|
14524
|
+
const found = /* @__PURE__ */ new Map();
|
|
14525
|
+
for (const { file, text } of workflows) for (const match of text.matchAll(USES)) {
|
|
14526
|
+
const path = match[1];
|
|
14527
|
+
found.set(path, (found.get(path) ?? /* @__PURE__ */ new Set()).add(file));
|
|
14528
|
+
}
|
|
14529
|
+
return [...found].map(([path, files]) => ({
|
|
14530
|
+
path,
|
|
14531
|
+
files: [...files].sort()
|
|
14532
|
+
})).sort((a, b) => a.path.localeCompare(b.path));
|
|
14533
|
+
}
|
|
14534
|
+
// src/commands/doctor-ci/refs-row.ts
|
|
14535
|
+
const ID$9 = "refs";
|
|
14536
|
+
const TITLE$10 = `every ${CI_TAG} reference resolves`;
|
|
14537
|
+
/** A workflow file holds itself at its path; an action is a folder with an `action.yml` (or `.yaml`) in it. */
|
|
14538
|
+
async function resolves(read, path) {
|
|
14539
|
+
const url = (p) => `${RAW}/${HOLOCRON_REPO}/${CI_TAG}/${p}`;
|
|
14540
|
+
if (/\.ya?ml$/.test(path)) return (await read(url(path))).status;
|
|
14541
|
+
const yml = (await read(url(`${path}/action.yml`))).status;
|
|
14542
|
+
return yml === 200 ? 200 : yml === 404 ? (await read(url(`${path}/action.yaml`))).status : yml;
|
|
14543
|
+
}
|
|
14544
|
+
/**
|
|
14545
|
+
* The `refs` row: each workflow file and action the repository's workflows name at the tag exists at the tag. A path
|
|
14546
|
+
* that answers 404 fails with the files that name it; one that cannot be read at all (no answer, a rate limit) is a skip
|
|
14547
|
+
* for the whole row, so a network problem never reads as a broken reference.
|
|
14548
|
+
*/
|
|
14549
|
+
async function refsRow(workflows, read) {
|
|
14550
|
+
const paths = hostedPaths(workflows);
|
|
14551
|
+
if (paths.length === 0) return {
|
|
14552
|
+
id: ID$9,
|
|
14553
|
+
title: TITLE$10,
|
|
14554
|
+
status: "skip",
|
|
14555
|
+
detail: `no workflow names a file at ${CI_TAG}`,
|
|
14556
|
+
problems: []
|
|
14557
|
+
};
|
|
14558
|
+
const answers = await Promise.all(paths.map(async (hosted) => ({
|
|
14559
|
+
hosted,
|
|
14560
|
+
status: await resolves(read, hosted.path)
|
|
14561
|
+
})));
|
|
14562
|
+
const unread = answers.filter(({ status }) => status !== 200 && status !== 404);
|
|
14563
|
+
if (unread.length > 0) {
|
|
14564
|
+
const first = unread[0];
|
|
14565
|
+
return {
|
|
14566
|
+
id: ID$9,
|
|
14567
|
+
title: TITLE$10,
|
|
14568
|
+
status: "skip",
|
|
14569
|
+
detail: `could not read ${first.hosted.path} (HTTP ${first.status || "no answer"})`,
|
|
14570
|
+
problems: []
|
|
14571
|
+
};
|
|
14572
|
+
}
|
|
14573
|
+
const missing = answers.filter(({ status }) => status === 404);
|
|
14574
|
+
if (missing.length > 0) return {
|
|
14575
|
+
id: ID$9,
|
|
14576
|
+
title: TITLE$10,
|
|
14577
|
+
status: "fail",
|
|
14578
|
+
detail: `${missing.length} of ${paths.length} missing at ${CI_TAG}`,
|
|
14579
|
+
problems: missing.map(({ hosted }) => `${hosted.path}: not at ${CI_TAG} (named by ${hosted.files.join(", ")})`)
|
|
14580
|
+
};
|
|
14581
|
+
return {
|
|
14582
|
+
id: ID$9,
|
|
14583
|
+
title: TITLE$10,
|
|
14584
|
+
status: "ok",
|
|
14585
|
+
detail: `${paths.length} found at ${CI_TAG}`,
|
|
14586
|
+
problems: []
|
|
14587
|
+
};
|
|
14588
|
+
}
|
|
14589
|
+
// src/commands/doctor-ci/tag-row.ts
|
|
14590
|
+
const ID$8 = "tag";
|
|
14591
|
+
const TITLE$9 = `${CI_TAG} exists in ${HOLOCRON_REPO}`;
|
|
14592
|
+
/** The `tag` row: the tag every caller pins the hosted files to exists. A read that fails or is rate limited is a skip, not a fail. */
|
|
14593
|
+
async function tagRow(read) {
|
|
14594
|
+
const res = await read(`${API}/repos/${HOLOCRON_REPO}/git/ref/tags/${CI_TAG}`);
|
|
14595
|
+
if (res.status === 200) {
|
|
14596
|
+
const sha = /"sha"\s*:\s*"([0-9a-f]{7,40})"/.exec(res.text)?.[1];
|
|
14597
|
+
return {
|
|
14598
|
+
id: ID$8,
|
|
14599
|
+
title: TITLE$9,
|
|
14600
|
+
status: "ok",
|
|
14601
|
+
detail: sha ? `at ${sha.slice(0, 9)}` : "found",
|
|
14602
|
+
problems: []
|
|
14603
|
+
};
|
|
14604
|
+
}
|
|
14605
|
+
if (res.status === 404) return {
|
|
14606
|
+
id: ID$8,
|
|
14607
|
+
title: TITLE$9,
|
|
14608
|
+
status: "fail",
|
|
14609
|
+
detail: "no such tag",
|
|
14610
|
+
problems: [`${HOLOCRON_REPO} has no ${CI_TAG} tag, so every caller that pins it fails to resolve`]
|
|
14611
|
+
};
|
|
14612
|
+
return {
|
|
14613
|
+
id: ID$8,
|
|
14614
|
+
title: TITLE$9,
|
|
14615
|
+
status: "skip",
|
|
14616
|
+
detail: `could not read the tag (HTTP ${res.status || "no answer"})`,
|
|
14617
|
+
problems: []
|
|
14618
|
+
};
|
|
14619
|
+
}
|
|
14620
|
+
// src/commands/doctor-ci/remote-rows.ts
|
|
14621
|
+
/** The rows of `doctor ci --remote`: the tag, what the callers name at it, and the frozen copies. All read public URLs only. */
|
|
14622
|
+
async function remoteRows(workflows, read) {
|
|
14623
|
+
return [
|
|
14624
|
+
await tagRow(read),
|
|
14625
|
+
await refsRow(workflows, read),
|
|
14626
|
+
await frozenRow(read)
|
|
14627
|
+
];
|
|
14628
|
+
}
|
|
14423
14629
|
// src/commands/doctor-ci/shadow-verdict.ts
|
|
14424
14630
|
/**
|
|
14425
14631
|
* The verdict of the newest run named `name` among a commit's check runs: still running is `pending`, a completed
|
|
@@ -14580,6 +14786,7 @@ async function runDoctorCi(input) {
|
|
|
14580
14786
|
callersRow(callers),
|
|
14581
14787
|
aggregateRow(callers, aggregateChecks(tasksConfig).expected, aggregatePoster(tasksConfig)),
|
|
14582
14788
|
homeRow(callers),
|
|
14789
|
+
...input.remote ? await remoteRows(io.workflows(), input.fetchText ?? fetchText) : [],
|
|
14583
14790
|
...input.shadow ? await shadowRows(input) : []
|
|
14584
14791
|
];
|
|
14585
14792
|
printCheckRows(rows, print);
|
|
@@ -14603,6 +14810,9 @@ const doctorCiCommand = {
|
|
|
14603
14810
|
builder: (y) => y.option("shadow", {
|
|
14604
14811
|
type: "boolean",
|
|
14605
14812
|
describe: "Also compare Sentinel's shadow aggregate (ci / Required checks (sentinel)) with the Actions one on the newest pull requests (reads through `source`)"
|
|
14813
|
+
}).option("remote", {
|
|
14814
|
+
type: "boolean",
|
|
14815
|
+
describe: "Also check the hosted files over the network: the ci-v1 tag, every file and action the workflows name at it, and the frozen copies in theholocron/.github (public URLs, no token)"
|
|
14606
14816
|
}).option("limit", {
|
|
14607
14817
|
type: "number",
|
|
14608
14818
|
describe: "With --shadow: how many of the newest pull requests to read (default 40)"
|
|
@@ -14620,6 +14830,7 @@ const doctorCiCommand = {
|
|
|
14620
14830
|
...argv.shadow ? { org: resolveOrg(argv, loaded.resolved) } : {}
|
|
14621
14831
|
},
|
|
14622
14832
|
...argv.shadow ? { shadow: true } : {},
|
|
14833
|
+
...argv.remote ? { remote: true } : {},
|
|
14623
14834
|
...argv.limit !== void 0 ? { shadowLimit: Number(argv.limit) } : {}
|
|
14624
14835
|
})).status === "fail") process.exitCode = 1;
|
|
14625
14836
|
}
|
|
@@ -36875,6 +37086,7 @@ function cloneOrg(org) {
|
|
|
36875
37086
|
/* v8 ignore stop */
|
|
36876
37087
|
}
|
|
36877
37088
|
// src/commands/probe/references/find-references.ts
|
|
37089
|
+
const CALL = /^-?\s*uses:\s/;
|
|
36878
37090
|
/** The repository that hosts the files; its own references are the starters and shims, not callers. */
|
|
36879
37091
|
const HOST_REPO = ".github";
|
|
36880
37092
|
/** What a reference points at, from the text after the needle. */
|
|
@@ -36899,6 +37111,14 @@ function findReferences(repo, needle) {
|
|
|
36899
37111
|
});
|
|
36900
37112
|
return found;
|
|
36901
37113
|
}
|
|
37114
|
+
/**
|
|
37115
|
+
* Whether a reference is a live call: a `uses:` line in a YAML file, which is what GitHub reads. Tests, docs and specs
|
|
37116
|
+
* name the path on purpose (the legacy-path detection, a test that nothing spells it, a record of the move), so they are
|
|
37117
|
+
* references to list but not calls to wait on.
|
|
37118
|
+
*/
|
|
37119
|
+
function isCall(ref) {
|
|
37120
|
+
return /\.ya?ml$/.test(ref.file) && CALL.test(ref.text);
|
|
37121
|
+
}
|
|
36902
37122
|
// src/commands/probe/references/references-probes.ts
|
|
36903
37123
|
function scan(repos, needle) {
|
|
36904
37124
|
return {
|
|
@@ -36918,27 +37138,29 @@ function summarise(ctx, repos, found, needle, max) {
|
|
|
36918
37138
|
ctx.say({
|
|
36919
37139
|
status: "info",
|
|
36920
37140
|
label: repo.name === ".github" ? `${repo.name} (host)` : repo.name,
|
|
36921
|
-
detail: `${files} files: ${count("workflow")} workflow, ${count("action")} action, ${count("other")} other`
|
|
37141
|
+
detail: `${files} files: ${count("workflow")} workflow, ${count("action")} action, ${count("other")} other; ${own.filter(isCall).length} live calls`
|
|
36922
37142
|
});
|
|
36923
37143
|
}
|
|
36924
|
-
const outside = found.filter((ref) => ref.repo !== HOST_REPO)
|
|
36925
|
-
const
|
|
36926
|
-
|
|
37144
|
+
const outside = found.filter((ref) => ref.repo !== HOST_REPO);
|
|
37145
|
+
const calls = outside.filter(isCall).length;
|
|
37146
|
+
const inside = found.length - outside.length;
|
|
37147
|
+
const detail = `${outside.length} references in all (tests, docs and specs may name the path on purpose), ${inside} more inside ${HOST_REPO}`;
|
|
37148
|
+
if (calls > max) ctx.say({
|
|
36927
37149
|
status: "fail",
|
|
36928
|
-
label: `${
|
|
37150
|
+
label: `${calls} live calls outside ${HOST_REPO}`,
|
|
36929
37151
|
detail: `more than the ${max} allowed; ${detail}`
|
|
36930
37152
|
});
|
|
36931
37153
|
else ctx.say({
|
|
36932
37154
|
status: "ok",
|
|
36933
|
-
label: `${
|
|
37155
|
+
label: `${calls} live calls outside ${HOST_REPO}`,
|
|
36934
37156
|
detail
|
|
36935
37157
|
});
|
|
36936
37158
|
}
|
|
36937
37159
|
/**
|
|
36938
37160
|
* `ci refs` counts the references to the reusable workflows and composite actions hosted in `<org>/.github` across
|
|
36939
37161
|
* every active repository of the org. It is the exit test for removing the forwarding shims there: they can go when
|
|
36940
|
-
*
|
|
36941
|
-
* its file and line.
|
|
37162
|
+
* no live call outside `.github` is left (a `uses:` line in a YAML file; see {@link isCall}). It fails above `<max>`,
|
|
37163
|
+
* which defaults to 0, so the exit code is the test (#2915). `ci ref-list` prints each reference with its file and line.
|
|
36942
37164
|
*/
|
|
36943
37165
|
function ciProbes(org, clone = cloneOrg) {
|
|
36944
37166
|
const needle = (name) => `${name}/.github/.github/`;
|
|
@@ -36958,13 +37180,13 @@ function ciProbes(org, clone = cloneOrg) {
|
|
|
36958
37180
|
};
|
|
36959
37181
|
return {
|
|
36960
37182
|
refs: {
|
|
36961
|
-
summary: "Count references to the reusable workflows and actions hosted in the org's .github repo (arg: max).",
|
|
37183
|
+
summary: "Count references to the reusable workflows and actions hosted in the org's .github repo; fails on a live call outside it (arg: max, default 0).",
|
|
36962
37184
|
writes: false,
|
|
36963
37185
|
async run(ctx) {
|
|
36964
37186
|
const result = read(ctx);
|
|
36965
37187
|
if (!result) return;
|
|
36966
|
-
const max = ctx.args?.[0] === void 0 ?
|
|
36967
|
-
if (
|
|
37188
|
+
const max = ctx.args?.[0] === void 0 ? 0 : Number(ctx.args[0]);
|
|
37189
|
+
if (!Number.isInteger(max) || max < 0) {
|
|
36968
37190
|
ctx.say({
|
|
36969
37191
|
status: "fail",
|
|
36970
37192
|
label: `\`${ctx.args[0]}\` is not a number`,
|
|
@@ -39114,7 +39336,7 @@ async function runSyncTrust(input) {
|
|
|
39114
39336
|
const print = input.print ?? ((line) => console.log(line));
|
|
39115
39337
|
const logger = input.logger ?? getLogger();
|
|
39116
39338
|
const cwd = input.cwd ?? process.cwd();
|
|
39117
|
-
const repo = input.repo ?? HOLOCRON_REPO;
|
|
39339
|
+
const repo = input.repo ?? HOLOCRON_REPO$1;
|
|
39118
39340
|
const dryRun = input.dryRun ?? false;
|
|
39119
39341
|
const force = input.force ?? false;
|
|
39120
39342
|
const exec = input.exec ?? defaultExec;
|
|
@@ -39275,7 +39497,7 @@ const publishArgs = (y) => y.option("initial", {
|
|
|
39275
39497
|
describe: "--sync-trust only: revoke and recreate every package's Trusted Publisher entry even when its file and repository already match. npm expires an entry that is not used for a publish soon after it is made but still lists it as matching, so a plain run skips it."
|
|
39276
39498
|
}).option("repo", {
|
|
39277
39499
|
type: "string",
|
|
39278
|
-
describe: `owner/repo for Trusted Publisher config (--sync-trust). Defaults to ${HOLOCRON_REPO}.`
|
|
39500
|
+
describe: `owner/repo for Trusted Publisher config (--sync-trust). Defaults to ${HOLOCRON_REPO$1}.`
|
|
39279
39501
|
}).option("group", {
|
|
39280
39502
|
type: "string",
|
|
39281
39503
|
describe: "Only this version group's packages: a folder of the repo (clients, observability). Omitted, every public package in the workspace."
|
|
@@ -41680,7 +41902,7 @@ const specsSyncCommand = {
|
|
|
41680
41902
|
* like `...tasks` from `nodeDocs()` โ see issue #464).
|
|
41681
41903
|
*/
|
|
41682
41904
|
function buildBatch(repo) {
|
|
41683
|
-
if (repo !== DOT_GITHUB_REPO) return [];
|
|
41905
|
+
if (repo !== DOT_GITHUB_REPO$1) return [];
|
|
41684
41906
|
const frozen = new Set(frozenReusablePaths());
|
|
41685
41907
|
return [...reusableTemplates()].filter(([path]) => !frozen.has(path)).map(([path, content]) => ({
|
|
41686
41908
|
path,
|
|
@@ -41695,9 +41917,9 @@ function gitBlobSha(content) {
|
|
|
41695
41917
|
async function runSyncGithub(input) {
|
|
41696
41918
|
const print = input.print ?? ((line) => console.log(line));
|
|
41697
41919
|
const logger = input.logger ?? getLogger();
|
|
41698
|
-
const repo = input.repo ?? DOT_GITHUB_REPO;
|
|
41920
|
+
const repo = input.repo ?? DOT_GITHUB_REPO$1;
|
|
41699
41921
|
const { token, dryRun = false, branch, createPr = false } = input;
|
|
41700
|
-
const message = input.message ?? `chore: sync from ${HOLOCRON_REPO}`;
|
|
41922
|
+
const message = input.message ?? `chore: sync from ${HOLOCRON_REPO$1}`;
|
|
41701
41923
|
const client = createGitHubClient({
|
|
41702
41924
|
token,
|
|
41703
41925
|
fetch: input.fetch
|
|
@@ -41787,7 +42009,7 @@ async function runSyncGithub(input) {
|
|
|
41787
42009
|
const batch = buildBatch(repo);
|
|
41788
42010
|
const stamps = [];
|
|
41789
42011
|
let frozen = 0;
|
|
41790
|
-
if (repo === DOT_GITHUB_REPO) for (const path of frozenReusablePaths()) {
|
|
42012
|
+
if (repo === DOT_GITHUB_REPO$1) for (const path of frozenReusablePaths()) {
|
|
41791
42013
|
if (!existingBlobs.has(path)) continue;
|
|
41792
42014
|
let current;
|
|
41793
42015
|
try {
|
|
@@ -41947,8 +42169,8 @@ async function runSyncGithub(input) {
|
|
|
41947
42169
|
// src/commands/sync-github/sync-github.args.ts
|
|
41948
42170
|
const syncGithubArgs = (y) => y.option("repo", {
|
|
41949
42171
|
type: "string",
|
|
41950
|
-
default: DOT_GITHUB_REPO,
|
|
41951
|
-
describe: `Target org/repo (default: ${DOT_GITHUB_REPO})`
|
|
42172
|
+
default: DOT_GITHUB_REPO$1,
|
|
42173
|
+
describe: `Target org/repo (default: ${DOT_GITHUB_REPO$1})`
|
|
41952
42174
|
}).option("branch", {
|
|
41953
42175
|
type: "string",
|
|
41954
42176
|
describe: "Push to this branch instead of the default branch (enables PR-based workflow for protected repos)"
|
|
@@ -41958,7 +42180,7 @@ const syncGithubArgs = (y) => y.option("repo", {
|
|
|
41958
42180
|
describe: "Open a PR after pushing to --branch (no-op without --branch)"
|
|
41959
42181
|
}).option("message", {
|
|
41960
42182
|
type: "string",
|
|
41961
|
-
describe: `Commit message (default: chore: sync from ${HOLOCRON_REPO})`
|
|
42183
|
+
describe: `Commit message (default: chore: sync from ${HOLOCRON_REPO$1})`
|
|
41962
42184
|
}).option("output-dir", {
|
|
41963
42185
|
type: "string",
|
|
41964
42186
|
describe: "Write generated files to this local directory instead of pushing (for validation)"
|