@theholocron/cli 5.0.0-alpha.363 → 5.0.0-alpha.364
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 +38 -22
- package/dist/cli.mjs.map +1 -1
- package/dist/presets.mjs +3 -2
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -637,7 +637,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
637
637
|
| `holocron doctor dns` | Do the DNS records the config makes setup write exist, pointing where they should? The preview domain's apex and wildcard CNAMEs (Cloudflare), the docs host a wiki provider asks for, and the relay Worker's proxied placeholder; one row per zone. A missing record, another target or a missing proxy fails; an extra record never does. A record `ensureCustomDomain()` returns is not checked, because asking for it creates the domain |
|
|
638
638
|
| `holocron doctor monitoring` | Do the checks the `monitoring` provider declares exist in its account, matched by name, with the URL, method and (when stated) frequency, locations, activated, should-fail, body and assertions the config sets? One row. A check in the account that is not declared is never a problem. A provider that cannot list its checks, failed to load or has no token is a skip |
|
|
639
639
|
| `holocron doctor secrets` | Do the secrets the config says must exist (`repo.secrets`, plus the notification layout's webhook and role secrets and the Chromatic token) exist? One row for the repository, the organization and each environment, each only when something is expected there. Names only; an undeclared secret is never a problem. A scope that cannot be read is a skip |
|
|
640
|
-
| `holocron doctor tokens` | For every token a configured plugin lists (every plugin that resolves one: GitHub's nine, Discord's three, Sentry's two, ...), looked up as the plugin does (its env var, the vendor's, then keyring) and verified with its `verifyToken`: set and accepted is ok (with how long is left, when the token expires), set and rejected fails, a token with 7 days or fewer left fails with `expires in N days: renew it`, not set is a skip. No token is printed. What a token may do is not checked, because GitHub does not return a fine-grained token's permissions
|
|
640
|
+
| `holocron doctor tokens` | For every token a configured plugin lists (every plugin that resolves one: GitHub's nine, Discord's three, Sentry's two, ...), looked up as the plugin does (its env var, the vendor's, the repo's `.env` and the `credentials` providers, then keyring; a `credentials` provider that cannot be read is a failing row) and verified with its `verifyToken`: set and accepted is ok (with how long is left, when the token expires), set and rejected fails, a token with 7 days or fewer left fails with `expires in N days: renew it`, not set is a skip. No token is printed. What a token may do is not checked, because GitHub does not return a fine-grained token's permissions |
|
|
641
641
|
| `holocron doctor --all` | Runs every deep check (`doctor notifications`, `doctor variables`, ...) and prints one row each, then `N ok, N fail, N skipped` counted in checks. Exits 1 when any check failed. A check that cannot run (no provider, no token) is a skip with the reason. Read-only: notifications runs as `--built-only`, so it posts nothing |
|
|
642
642
|
| `holocron probe [<provider> [<probe>]] [--dry-run] [--yes] [--lcov <path>]` | Poke a live provider on purpose: list the probes, inspect something, or run a proof that cleans up after itself. Plugins offer the probes; nothing secret is printed; one that changes things asks first |
|
|
643
643
|
|
package/dist/cli.mjs
CHANGED
|
@@ -13,14 +13,14 @@ import yargs from "yargs";
|
|
|
13
13
|
import { hideBin } from "yargs/helpers";
|
|
14
14
|
import { ConfigError, ConfigError as ConfigError$1, createConfigSystem, lastWins, mergeByKey, shallowMerge, union } from "@theholocron/kyber/config";
|
|
15
15
|
import { LoaderError, assertPluginsResolvable, createPluginSystem, isModuleNotFound, resolvePluginPackage } from "@theholocron/kyber/plugins";
|
|
16
|
-
import { KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, createAlexignore, createAlexrc, createAstromech, createCommitMsg, createDco, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, mergeScripts, readWorkspacePackages, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, workflowFile, workflowKey, workflowKeys, workspacePackages } from "@theholocron/astromech";
|
|
16
|
+
import { DEFAULT_ORG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, createAlexignore, createAlexrc, createAstromech, createCommitMsg, createDco, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, mergeScripts, readWorkspacePackages, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, workflowFile, workflowKey, workflowKeys, workspacePackages } from "@theholocron/astromech";
|
|
17
17
|
import { loadTasksConfig } from "@theholocron/astromech/config";
|
|
18
18
|
import { readGitRemote, updateGitignore } from "@theholocron/git-utils";
|
|
19
19
|
import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
|
|
20
20
|
import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
|
|
21
21
|
import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
|
|
22
22
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
23
|
-
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver, createKeyring, dotenvLine, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
23
|
+
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver, createKeyring, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
24
24
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
25
25
|
import { pathToFileURL } from "node:url";
|
|
26
26
|
import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, numeric } from "@theholocron/kyber/menu";
|
|
@@ -1455,8 +1455,8 @@ function describeExpiry(expiresAt, now) {
|
|
|
1455
1455
|
* `holocron doctor tokens` — is each token a configured plugin takes set, and still accepted?
|
|
1456
1456
|
*
|
|
1457
1457
|
* Read-only. For every token a configured plugin lists (its `tokens` export), the token is looked up the way the
|
|
1458
|
-
* plugin does it (the environment
|
|
1459
|
-
* is still accepted. A token is never printed. One that is not set is a skip, not a failure: whether it is needed
|
|
1458
|
+
* plugin does it (the process environment, then the repo's `.env` and the `credentials` providers, then the OS keyring)
|
|
1459
|
+
* and the plugin's `verifyToken` is asked whether it is still accepted. Each row says where the token came from. A token is never printed. One that is not set is a skip, not a failure: whether it is needed
|
|
1460
1460
|
* depends on what is run. One that is set and rejected (expired, revoked, malformed) fails, and so does one that
|
|
1461
1461
|
* the plugin reports will expire within `TOKEN_EXPIRY_WARN_DAYS` days (a warning is a fail: the check has no third
|
|
1462
1462
|
* status). A token with no expiry shows nothing extra.
|
|
@@ -1471,6 +1471,7 @@ async function runDoctorTokens(input) {
|
|
|
1471
1471
|
const readToken = input.keyring ?? keyring.get;
|
|
1472
1472
|
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
1473
1473
|
const rows = [];
|
|
1474
|
+
rows.push(...await loadCredentials(input));
|
|
1474
1475
|
for (const pkg of configuredPackages(input)) {
|
|
1475
1476
|
let module;
|
|
1476
1477
|
try {
|
|
@@ -1502,6 +1503,21 @@ function configuredPackages(input) {
|
|
|
1502
1503
|
const packages = Object.values(input.loaded.resolved.providers).flatMap((entry) => entry.cardinality === "single" ? [entry.tuple.packageName] : entry.tuples.map((t) => t.packageName));
|
|
1503
1504
|
return [...new Set(packages)];
|
|
1504
1505
|
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Runs the step every command runs first: the repo's `.env` and the config's `credentials` providers are read into the
|
|
1508
|
+
* credential store, which is where `checkToken` and the plugins look after the process environment. A provider that
|
|
1509
|
+
* could not be read is a failing row (its tokens then fall through to the keyring, which is not what was meant), and a
|
|
1510
|
+
* loader that throws is a skip.
|
|
1511
|
+
*/
|
|
1512
|
+
async function loadCredentials(input) {
|
|
1513
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
1514
|
+
try {
|
|
1515
|
+
await loader.load();
|
|
1516
|
+
} catch (err) {
|
|
1517
|
+
return [row$8("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
|
|
1518
|
+
}
|
|
1519
|
+
return loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$8(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
|
|
1520
|
+
}
|
|
1505
1521
|
function row$8(id, status, detail) {
|
|
1506
1522
|
return {
|
|
1507
1523
|
id,
|
|
@@ -1514,10 +1530,11 @@ function row$8(id, status, detail) {
|
|
|
1514
1530
|
async function checkToken(token, module, env, readToken, now) {
|
|
1515
1531
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
1516
1532
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
1517
|
-
const
|
|
1533
|
+
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
1534
|
+
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
1518
1535
|
if (!value) return row$8(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron auth set ${keyringKey}\`)`);
|
|
1519
1536
|
if (!module.verifyToken || token.verifiable === false) return row$8(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
1520
|
-
const from = fromEnv ?? "keyring";
|
|
1537
|
+
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
1521
1538
|
try {
|
|
1522
1539
|
const verified = await module.verifyToken(value);
|
|
1523
1540
|
if (!verified.ok) return row$8(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
@@ -12570,7 +12587,7 @@ function defaultWriteFile(filepath, content) {
|
|
|
12570
12587
|
}
|
|
12571
12588
|
async function runNew(input) {
|
|
12572
12589
|
const cwd = input.cwd ?? process.cwd();
|
|
12573
|
-
const org = input.org ??
|
|
12590
|
+
const org = input.org ?? DEFAULT_ORG;
|
|
12574
12591
|
const print = input.print ?? ((line) => console.log(line));
|
|
12575
12592
|
const logger = input.logger ?? getLogger();
|
|
12576
12593
|
const execFn = input.exec ?? defaultExec$2;
|
|
@@ -12649,7 +12666,7 @@ async function runNew(input) {
|
|
|
12649
12666
|
print(` Detected template slug: ${templateSlug}`);
|
|
12650
12667
|
print(` Patching files…`);
|
|
12651
12668
|
const variants = deriveVariants(templateSlug, input.name);
|
|
12652
|
-
variants.unshift([
|
|
12669
|
+
variants.unshift([`${DEFAULT_ORG}/${templateSlug}`, `${org}/${input.name}`]);
|
|
12653
12670
|
const filesPatched = patchFiles(repoDir, variants, input.description, input.homepage, input.runtimeEnvironment, print, readFn, writeFn, walkFn);
|
|
12654
12671
|
print(` ${filesPatched.length} file${filesPatched.length === 1 ? "" : "s"} patched`);
|
|
12655
12672
|
if (input.description !== void 0 || input.homepage !== void 0) try {
|
|
@@ -12812,7 +12829,7 @@ const newRepoArgs = (y) => y.positional("type", {
|
|
|
12812
12829
|
describe: "Mark the new repo as a GitHub template repository"
|
|
12813
12830
|
}).option("org", {
|
|
12814
12831
|
type: "string",
|
|
12815
|
-
default:
|
|
12832
|
+
default: DEFAULT_ORG,
|
|
12816
12833
|
describe: "GitHub org that owns the template and will own the new repo"
|
|
12817
12834
|
}).option("verify", {
|
|
12818
12835
|
type: "boolean",
|
|
@@ -14011,7 +14028,7 @@ async function runPublish(input = {}) {
|
|
|
14011
14028
|
const print = input.print ?? ((line) => console.log(line));
|
|
14012
14029
|
const logger = input.logger ?? getLogger();
|
|
14013
14030
|
const cwd = input.cwd ?? process.cwd();
|
|
14014
|
-
const tag = input.tag ??
|
|
14031
|
+
const tag = input.tag ?? PRERELEASE_CHANNEL;
|
|
14015
14032
|
const dryRun = input.dryRun ?? false;
|
|
14016
14033
|
const otp = input.otp;
|
|
14017
14034
|
const env = createEnvLookup(input.env);
|
|
@@ -14384,7 +14401,7 @@ async function runSyncTrust(input) {
|
|
|
14384
14401
|
const print = input.print ?? ((line) => console.log(line));
|
|
14385
14402
|
const logger = input.logger ?? getLogger();
|
|
14386
14403
|
const cwd = input.cwd ?? process.cwd();
|
|
14387
|
-
const repo = input.repo ??
|
|
14404
|
+
const repo = input.repo ?? HOLOCRON_REPO;
|
|
14388
14405
|
const dryRun = input.dryRun ?? false;
|
|
14389
14406
|
const exec = input.exec ?? defaultExec$1;
|
|
14390
14407
|
const packageNames = input.packages ?? discoverPublicPackages(cwd, scopeOf(input));
|
|
@@ -14540,7 +14557,7 @@ const publishArgs = (y) => y.option("initial", {
|
|
|
14540
14557
|
describe: "Migrate npm Trusted Publisher config to a new workflow filename across every public package: --sync-trust <old-file> <new-file>. See issue #689 — npm requires fresh interactive 2FA per package; re-run after approving the printed authUrl if it stops early."
|
|
14541
14558
|
}).option("repo", {
|
|
14542
14559
|
type: "string",
|
|
14543
|
-
describe:
|
|
14560
|
+
describe: `owner/repo for Trusted Publisher config (--sync-trust). Defaults to ${HOLOCRON_REPO}.`
|
|
14544
14561
|
}).option("group", {
|
|
14545
14562
|
type: "string",
|
|
14546
14563
|
describe: "Only this version group's packages: a folder of the repo (clients, observability). Omitted, every public package in the workspace."
|
|
@@ -19444,8 +19461,8 @@ function groupBranches(classified) {
|
|
|
19444
19461
|
return [...entries.values()].sort((a, b) => (b.date ?? "").localeCompare(a.date ?? "") || a.name.localeCompare(b.name));
|
|
19445
19462
|
}
|
|
19446
19463
|
// src/commands/repo-cleanup-branches/constants.ts
|
|
19447
|
-
/** The long-lived branches: never deleted, and what a branch must be an ancestor of (as `origin/<name>`) to count as merged. */
|
|
19448
|
-
const BASE_BRANCHES =
|
|
19464
|
+
/** The long-lived branches: never deleted, and what a branch must be an ancestor of (as `origin/<name>`) to count as merged. These are the release branches. */
|
|
19465
|
+
const BASE_BRANCHES = RELEASE_BRANCHES;
|
|
19449
19466
|
// src/commands/repo-cleanup-branches/local-git.ts
|
|
19450
19467
|
/** `git` run in `cwd`, no shell: its trimmed stdout and stderr, and whether it exited 0. */
|
|
19451
19468
|
function git(cwd, args) {
|
|
@@ -22558,7 +22575,6 @@ const specsCommand = {
|
|
|
22558
22575
|
handler: () => {}
|
|
22559
22576
|
};
|
|
22560
22577
|
// src/commands/sync-github/sync-github.ts
|
|
22561
|
-
const DEFAULT_REPO = "theholocron/.github";
|
|
22562
22578
|
/**
|
|
22563
22579
|
* The file set `sync-github` pushes to `theholocron/.github` — the reusable
|
|
22564
22580
|
* `workflow_call` implementations, composite actions and starter-workflow
|
|
@@ -22568,7 +22584,7 @@ const DEFAULT_REPO = "theholocron/.github";
|
|
|
22568
22584
|
* like `...tasks` from `nodeDocs()` — see issue #464).
|
|
22569
22585
|
*/
|
|
22570
22586
|
function buildBatch(repo) {
|
|
22571
|
-
if (repo !==
|
|
22587
|
+
if (repo !== DOT_GITHUB_REPO) return [];
|
|
22572
22588
|
const frozen = new Set(frozenReusablePaths());
|
|
22573
22589
|
return [...reusableTemplates()].filter(([path]) => !frozen.has(path)).map(([path, content]) => ({
|
|
22574
22590
|
path,
|
|
@@ -22583,9 +22599,9 @@ function gitBlobSha(content) {
|
|
|
22583
22599
|
async function runSyncGithub(input) {
|
|
22584
22600
|
const print = input.print ?? ((line) => console.log(line));
|
|
22585
22601
|
const logger = input.logger ?? getLogger();
|
|
22586
|
-
const repo = input.repo ??
|
|
22602
|
+
const repo = input.repo ?? DOT_GITHUB_REPO;
|
|
22587
22603
|
const { token, dryRun = false, branch, createPr = false } = input;
|
|
22588
|
-
const message = input.message ?? `chore: sync from
|
|
22604
|
+
const message = input.message ?? `chore: sync from ${HOLOCRON_REPO}`;
|
|
22589
22605
|
const client = createGitHubClient({
|
|
22590
22606
|
token,
|
|
22591
22607
|
fetch: input.fetch
|
|
@@ -22675,7 +22691,7 @@ async function runSyncGithub(input) {
|
|
|
22675
22691
|
const batch = buildBatch(repo);
|
|
22676
22692
|
const stamps = [];
|
|
22677
22693
|
let frozen = 0;
|
|
22678
|
-
if (repo ===
|
|
22694
|
+
if (repo === DOT_GITHUB_REPO) for (const path of frozenReusablePaths()) {
|
|
22679
22695
|
if (!existingBlobs.has(path)) continue;
|
|
22680
22696
|
let current;
|
|
22681
22697
|
try {
|
|
@@ -22835,8 +22851,8 @@ async function runSyncGithub(input) {
|
|
|
22835
22851
|
// src/commands/sync-github/sync-github.args.ts
|
|
22836
22852
|
const syncGithubArgs = (y) => y.option("repo", {
|
|
22837
22853
|
type: "string",
|
|
22838
|
-
default:
|
|
22839
|
-
describe:
|
|
22854
|
+
default: DOT_GITHUB_REPO,
|
|
22855
|
+
describe: `Target org/repo (default: ${DOT_GITHUB_REPO})`
|
|
22840
22856
|
}).option("branch", {
|
|
22841
22857
|
type: "string",
|
|
22842
22858
|
describe: "Push to this branch instead of the default branch (enables PR-based workflow for protected repos)"
|
|
@@ -22846,7 +22862,7 @@ const syncGithubArgs = (y) => y.option("repo", {
|
|
|
22846
22862
|
describe: "Open a PR after pushing to --branch (no-op without --branch)"
|
|
22847
22863
|
}).option("message", {
|
|
22848
22864
|
type: "string",
|
|
22849
|
-
describe:
|
|
22865
|
+
describe: `Commit message (default: chore: sync from ${HOLOCRON_REPO})`
|
|
22850
22866
|
}).option("output-dir", {
|
|
22851
22867
|
type: "string",
|
|
22852
22868
|
describe: "Write generated files to this local directory instead of pushing (for validation)"
|