@theholocron/cli 5.0.0-alpha.362 → 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 +5 -1
- package/dist/cli.mjs +197 -26
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-BLKX9ztT.d.mts → config-system-uzcuUTOA.d.mts} +1 -1
- package/dist/{index-oC-J5CCm.d.mts → index-CvlWdUi1.d.mts} +11 -0
- package/dist/index.d.mts +2 -2
- package/dist/plugin/capabilities.d.mts +1 -1
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +25 -6
- package/package.json +14 -14
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
|
|
|
@@ -691,6 +691,10 @@ See the [command pages](https://theholocron.dev/holocron/commands/notifications-
|
|
|
691
691
|
|
|
692
692
|
## Cleaning up
|
|
693
693
|
|
|
694
|
+
- **`holocron repo properties apply [--yes]`** — adds the capabilities the organization's `holocron_capabilities`
|
|
695
|
+
custom property does not allow yet (`holocron doctor repo` names them). The allowed values are organization-wide, so it
|
|
696
|
+
asks first (`--yes` skips the question; `--dry-run` only reads). It only adds values: nothing is removed or reordered
|
|
697
|
+
and the rest of the definition is kept. It needs a token with the organization's Custom properties: admin.
|
|
694
698
|
- **`holocron repo cleanup branches [--local | --remote]`** — lists the branches whose pull request is merged,
|
|
695
699
|
grouped, each saying whether it lives locally, on the remote or both; then asks, and offers a checklist with the
|
|
696
700
|
proven-merged ones ticked. Proven merged means an ancestor of `origin/alpha` or `origin/main`, or the head (or an
|
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";
|
|
@@ -760,6 +760,7 @@ const COMMAND_CONTEXTS = {
|
|
|
760
760
|
"doctor project": "workspace",
|
|
761
761
|
"doctor github-app": "workspace",
|
|
762
762
|
"project move": "workspace",
|
|
763
|
+
"repo properties apply": "workspace",
|
|
763
764
|
"doctor dns": "workspace",
|
|
764
765
|
"doctor repo": "workspace",
|
|
765
766
|
"doctor secrets": "workspace",
|
|
@@ -1454,8 +1455,8 @@ function describeExpiry(expiresAt, now) {
|
|
|
1454
1455
|
* `holocron doctor tokens` — is each token a configured plugin takes set, and still accepted?
|
|
1455
1456
|
*
|
|
1456
1457
|
* Read-only. For every token a configured plugin lists (its `tokens` export), the token is looked up the way the
|
|
1457
|
-
* plugin does it (the environment
|
|
1458
|
-
* 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
|
|
1459
1460
|
* depends on what is run. One that is set and rejected (expired, revoked, malformed) fails, and so does one that
|
|
1460
1461
|
* the plugin reports will expire within `TOKEN_EXPIRY_WARN_DAYS` days (a warning is a fail: the check has no third
|
|
1461
1462
|
* status). A token with no expiry shows nothing extra.
|
|
@@ -1470,6 +1471,7 @@ async function runDoctorTokens(input) {
|
|
|
1470
1471
|
const readToken = input.keyring ?? keyring.get;
|
|
1471
1472
|
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
1472
1473
|
const rows = [];
|
|
1474
|
+
rows.push(...await loadCredentials(input));
|
|
1473
1475
|
for (const pkg of configuredPackages(input)) {
|
|
1474
1476
|
let module;
|
|
1475
1477
|
try {
|
|
@@ -1501,6 +1503,21 @@ function configuredPackages(input) {
|
|
|
1501
1503
|
const packages = Object.values(input.loaded.resolved.providers).flatMap((entry) => entry.cardinality === "single" ? [entry.tuple.packageName] : entry.tuples.map((t) => t.packageName));
|
|
1502
1504
|
return [...new Set(packages)];
|
|
1503
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
|
+
}
|
|
1504
1521
|
function row$8(id, status, detail) {
|
|
1505
1522
|
return {
|
|
1506
1523
|
id,
|
|
@@ -1513,10 +1530,11 @@ function row$8(id, status, detail) {
|
|
|
1513
1530
|
async function checkToken(token, module, env, readToken, now) {
|
|
1514
1531
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
1515
1532
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
1516
|
-
const
|
|
1533
|
+
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
1534
|
+
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
1517
1535
|
if (!value) return row$8(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron auth set ${keyringKey}\`)`);
|
|
1518
1536
|
if (!module.verifyToken || token.verifiable === false) return row$8(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
1519
|
-
const from = fromEnv ?? "keyring";
|
|
1537
|
+
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
1520
1538
|
try {
|
|
1521
1539
|
const verified = await module.verifyToken(value);
|
|
1522
1540
|
if (!verified.ok) return row$8(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
@@ -2392,6 +2410,13 @@ const registry = createCommandRegistry([
|
|
|
2392
2410
|
doctorProjectEntry,
|
|
2393
2411
|
doctorGitHubAppEntry,
|
|
2394
2412
|
projectMoveEntry,
|
|
2413
|
+
{
|
|
2414
|
+
name: "repo properties apply",
|
|
2415
|
+
description: "Add the capabilities the organization's holocron_capabilities property does not allow yet",
|
|
2416
|
+
positionals: [],
|
|
2417
|
+
skipOptions: ["yes"],
|
|
2418
|
+
supportsDryRun: true
|
|
2419
|
+
},
|
|
2395
2420
|
doctorDnsEntry,
|
|
2396
2421
|
doctorRepoEntry,
|
|
2397
2422
|
doctorSecretsEntry,
|
|
@@ -9055,6 +9080,16 @@ function hostedReusableFile(id, content) {
|
|
|
9055
9080
|
});
|
|
9056
9081
|
return `${workflowHeader()}# Source package: .\n\n${content}`;
|
|
9057
9082
|
}
|
|
9083
|
+
// src/commands/repo-properties/capability-property/capability-property.ts
|
|
9084
|
+
/** The organization's custom property that lists the capabilities a repo wires. */
|
|
9085
|
+
const CAPABILITIES_PROPERTY = "holocron_capabilities";
|
|
9086
|
+
/**
|
|
9087
|
+
* Every value that property must allow: each capability the CLI defines, so a new capability is a value the
|
|
9088
|
+
* organization has to allow before any repo can declare it.
|
|
9089
|
+
*/
|
|
9090
|
+
function capabilityValues() {
|
|
9091
|
+
return Object.keys(CARDINALITY).sort();
|
|
9092
|
+
}
|
|
9058
9093
|
// src/commands/setup/branch-protection.ts
|
|
9059
9094
|
const RULESET_NAME = "holocron-default-branch";
|
|
9060
9095
|
function buildClassicProtectionPayload(requiredChecks = []) {
|
|
@@ -9493,6 +9528,21 @@ function repoChecks(config, repoRoot) {
|
|
|
9493
9528
|
};
|
|
9494
9529
|
}
|
|
9495
9530
|
});
|
|
9531
|
+
checks.push({
|
|
9532
|
+
id: "repo-capabilities-allowed",
|
|
9533
|
+
title: `${CAPABILITIES_PROPERTY} allows every capability`,
|
|
9534
|
+
needs: "getOrgPropertyValues",
|
|
9535
|
+
async run(source) {
|
|
9536
|
+
const allowed = await source.getOrgPropertyValues(CAPABILITIES_PROPERTY);
|
|
9537
|
+
if (allowed === void 0) return { skip: `the organization's ${CAPABILITIES_PROPERTY} definition cannot be read with this token, is not defined or takes any value` };
|
|
9538
|
+
const have = new Set(allowed);
|
|
9539
|
+
const wanted = capabilityValues();
|
|
9540
|
+
return {
|
|
9541
|
+
problems: wanted.filter((v) => !have.has(v)).map((v) => `"${v}" is not an allowed value of ${CAPABILITIES_PROPERTY}; run \`holocron repo properties apply\``),
|
|
9542
|
+
checked: wanted.length
|
|
9543
|
+
};
|
|
9544
|
+
}
|
|
9545
|
+
});
|
|
9496
9546
|
checks.push({
|
|
9497
9547
|
id: "repo-labels",
|
|
9498
9548
|
title: "labels match",
|
|
@@ -12537,7 +12587,7 @@ function defaultWriteFile(filepath, content) {
|
|
|
12537
12587
|
}
|
|
12538
12588
|
async function runNew(input) {
|
|
12539
12589
|
const cwd = input.cwd ?? process.cwd();
|
|
12540
|
-
const org = input.org ??
|
|
12590
|
+
const org = input.org ?? DEFAULT_ORG;
|
|
12541
12591
|
const print = input.print ?? ((line) => console.log(line));
|
|
12542
12592
|
const logger = input.logger ?? getLogger();
|
|
12543
12593
|
const execFn = input.exec ?? defaultExec$2;
|
|
@@ -12616,7 +12666,7 @@ async function runNew(input) {
|
|
|
12616
12666
|
print(` Detected template slug: ${templateSlug}`);
|
|
12617
12667
|
print(` Patching files…`);
|
|
12618
12668
|
const variants = deriveVariants(templateSlug, input.name);
|
|
12619
|
-
variants.unshift([
|
|
12669
|
+
variants.unshift([`${DEFAULT_ORG}/${templateSlug}`, `${org}/${input.name}`]);
|
|
12620
12670
|
const filesPatched = patchFiles(repoDir, variants, input.description, input.homepage, input.runtimeEnvironment, print, readFn, writeFn, walkFn);
|
|
12621
12671
|
print(` ${filesPatched.length} file${filesPatched.length === 1 ? "" : "s"} patched`);
|
|
12622
12672
|
if (input.description !== void 0 || input.homepage !== void 0) try {
|
|
@@ -12779,7 +12829,7 @@ const newRepoArgs = (y) => y.positional("type", {
|
|
|
12779
12829
|
describe: "Mark the new repo as a GitHub template repository"
|
|
12780
12830
|
}).option("org", {
|
|
12781
12831
|
type: "string",
|
|
12782
|
-
default:
|
|
12832
|
+
default: DEFAULT_ORG,
|
|
12783
12833
|
describe: "GitHub org that owns the template and will own the new repo"
|
|
12784
12834
|
}).option("verify", {
|
|
12785
12835
|
type: "boolean",
|
|
@@ -13978,7 +14028,7 @@ async function runPublish(input = {}) {
|
|
|
13978
14028
|
const print = input.print ?? ((line) => console.log(line));
|
|
13979
14029
|
const logger = input.logger ?? getLogger();
|
|
13980
14030
|
const cwd = input.cwd ?? process.cwd();
|
|
13981
|
-
const tag = input.tag ??
|
|
14031
|
+
const tag = input.tag ?? PRERELEASE_CHANNEL;
|
|
13982
14032
|
const dryRun = input.dryRun ?? false;
|
|
13983
14033
|
const otp = input.otp;
|
|
13984
14034
|
const env = createEnvLookup(input.env);
|
|
@@ -14351,7 +14401,7 @@ async function runSyncTrust(input) {
|
|
|
14351
14401
|
const print = input.print ?? ((line) => console.log(line));
|
|
14352
14402
|
const logger = input.logger ?? getLogger();
|
|
14353
14403
|
const cwd = input.cwd ?? process.cwd();
|
|
14354
|
-
const repo = input.repo ??
|
|
14404
|
+
const repo = input.repo ?? HOLOCRON_REPO;
|
|
14355
14405
|
const dryRun = input.dryRun ?? false;
|
|
14356
14406
|
const exec = input.exec ?? defaultExec$1;
|
|
14357
14407
|
const packageNames = input.packages ?? discoverPublicPackages(cwd, scopeOf(input));
|
|
@@ -14507,7 +14557,7 @@ const publishArgs = (y) => y.option("initial", {
|
|
|
14507
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."
|
|
14508
14558
|
}).option("repo", {
|
|
14509
14559
|
type: "string",
|
|
14510
|
-
describe:
|
|
14560
|
+
describe: `owner/repo for Trusted Publisher config (--sync-trust). Defaults to ${HOLOCRON_REPO}.`
|
|
14511
14561
|
}).option("group", {
|
|
14512
14562
|
type: "string",
|
|
14513
14563
|
describe: "Only this version group's packages: a folder of the repo (clients, observability). Omitted, every public package in the workspace."
|
|
@@ -17896,6 +17946,107 @@ const projectCommand = {
|
|
|
17896
17946
|
builder: (y) => y.command(projectListCommand).command(projectCreateCommand).command(projectCloseCommand).command(projectSetupCommand).command(projectMoveCommand).command(projectReconcileCommand).command(groupMenu$1("project")),
|
|
17897
17947
|
handler: () => {}
|
|
17898
17948
|
};
|
|
17949
|
+
// src/commands/repo-properties/run-properties-apply/run-properties-apply.ts
|
|
17950
|
+
/**
|
|
17951
|
+
* `holocron repo properties apply` — add the capabilities the organization's `holocron_capabilities` property lacks.
|
|
17952
|
+
*
|
|
17953
|
+
* `doctor repo` reports the drift; this is the separate, deliberate step that fixes it. The allowed values are
|
|
17954
|
+
* organization-wide, so it asks first (`--yes` skips the question; without a terminal it refuses instead of hanging),
|
|
17955
|
+
* `--dry-run` only reads, and it only ever adds a value: nothing is removed or reordered, and the rest of the
|
|
17956
|
+
* property's definition is kept. The values wanted are every capability the CLI defines. It needs a token with the
|
|
17957
|
+
* organization's Custom properties: admin.
|
|
17958
|
+
*/
|
|
17959
|
+
async function runPropertiesApply(input) {
|
|
17960
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
17961
|
+
const stop = (status, reason) => {
|
|
17962
|
+
print(statusRow(status, ["repo properties apply", reason]));
|
|
17963
|
+
return {
|
|
17964
|
+
status,
|
|
17965
|
+
reason
|
|
17966
|
+
};
|
|
17967
|
+
};
|
|
17968
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
17969
|
+
await loader.load();
|
|
17970
|
+
assertPluginsResolvable$1(loader, "repo properties apply");
|
|
17971
|
+
if (!loader.has("source")) return stop("skip", whyMissing(loader, "source", "no `source` provider to read the property with"));
|
|
17972
|
+
const source = loader.get("source");
|
|
17973
|
+
if (!source.getOrgPropertyValues || !source.addOrgPropertyValues) return stop("skip", `the \`${source.providerName}\` provider cannot read or change an organization property`);
|
|
17974
|
+
let missing;
|
|
17975
|
+
try {
|
|
17976
|
+
const allowed = await source.getOrgPropertyValues(CAPABILITIES_PROPERTY);
|
|
17977
|
+
if (allowed === void 0) return stop("fail", `cannot read the organization's ${CAPABILITIES_PROPERTY} definition: the token needs Custom properties: read, and the property must exist and be a select`);
|
|
17978
|
+
const have = new Set(allowed);
|
|
17979
|
+
missing = capabilityValues().filter((v) => !have.has(v));
|
|
17980
|
+
} catch (err) {
|
|
17981
|
+
return stop("fail", describeError(err));
|
|
17982
|
+
}
|
|
17983
|
+
if (missing.length === 0) {
|
|
17984
|
+
print(statusRow("ok", ["repo properties apply", `${CAPABILITIES_PROPERTY} already allows every capability`]));
|
|
17985
|
+
return {
|
|
17986
|
+
status: "ok",
|
|
17987
|
+
added: []
|
|
17988
|
+
};
|
|
17989
|
+
}
|
|
17990
|
+
if (input.context.dryRun) {
|
|
17991
|
+
print(statusRow("skip", ["repo properties apply", `dry run: would add ${missing.join(", ")}`]));
|
|
17992
|
+
return {
|
|
17993
|
+
status: "ok",
|
|
17994
|
+
added: missing
|
|
17995
|
+
};
|
|
17996
|
+
}
|
|
17997
|
+
if (!input.yes) {
|
|
17998
|
+
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`repo properties apply\` changes an organization-wide property; pass --yes to run it without asking`);
|
|
17999
|
+
if (!await (input.confirm ?? ((message) => confirm({
|
|
18000
|
+
message,
|
|
18001
|
+
default: false
|
|
18002
|
+
})))(`Allow ${missing.join(", ")} in holocron_capabilities for the whole organization?`)) {
|
|
18003
|
+
print(statusRow("skip", ["repo properties apply", "cancelled; nothing was changed"]));
|
|
18004
|
+
return { status: "cancelled" };
|
|
18005
|
+
}
|
|
18006
|
+
}
|
|
18007
|
+
try {
|
|
18008
|
+
const added = await source.addOrgPropertyValues(CAPABILITIES_PROPERTY, missing);
|
|
18009
|
+
print(statusRow("ok", ["repo properties apply", `${CAPABILITIES_PROPERTY}: added ${added.join(", ") || "nothing"}`]));
|
|
18010
|
+
return {
|
|
18011
|
+
status: "ok",
|
|
18012
|
+
added
|
|
18013
|
+
};
|
|
18014
|
+
} catch (err) {
|
|
18015
|
+
return stop("fail", describeError(err));
|
|
18016
|
+
}
|
|
18017
|
+
}
|
|
18018
|
+
// src/commands/repo-properties/repo-properties-apply.command.ts
|
|
18019
|
+
const repoPropertiesApplyCommand = {
|
|
18020
|
+
command: "apply",
|
|
18021
|
+
describe: "Add the capabilities the organization's holocron_capabilities property does not allow yet",
|
|
18022
|
+
builder: (y) => y.option("yes", {
|
|
18023
|
+
type: "boolean",
|
|
18024
|
+
describe: "Add without asking"
|
|
18025
|
+
}),
|
|
18026
|
+
handler: async (argv) => {
|
|
18027
|
+
const tokens = tokenContext$1(argv.token);
|
|
18028
|
+
if (!tokens) return;
|
|
18029
|
+
const loaded = await loadConfig(argv.cwd);
|
|
18030
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
18031
|
+
if ((await runPropertiesApply({
|
|
18032
|
+
loaded,
|
|
18033
|
+
context: {
|
|
18034
|
+
repoRoot: argv.cwd,
|
|
18035
|
+
dryRun: argv.dryRun,
|
|
18036
|
+
...tokens,
|
|
18037
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
18038
|
+
},
|
|
18039
|
+
...argv.yes ? { yes: true } : {}
|
|
18040
|
+
})).status === "fail") process.exitCode = 1;
|
|
18041
|
+
}
|
|
18042
|
+
};
|
|
18043
|
+
// src/commands/repo-properties/repo-properties.command.ts
|
|
18044
|
+
const repoPropertiesCommand = {
|
|
18045
|
+
command: "properties",
|
|
18046
|
+
describe: "Organization-level custom properties that `doctor repo` checks",
|
|
18047
|
+
builder: (y) => y.command(repoPropertiesApplyCommand).command(groupMenu$1("repo properties")),
|
|
18048
|
+
handler: () => {}
|
|
18049
|
+
};
|
|
17899
18050
|
// src/commands/setup/agent-prompts-data.ts
|
|
17900
18051
|
/**
|
|
17901
18052
|
* Canonical AI engineering workflow role prompts.
|
|
@@ -19310,8 +19461,8 @@ function groupBranches(classified) {
|
|
|
19310
19461
|
return [...entries.values()].sort((a, b) => (b.date ?? "").localeCompare(a.date ?? "") || a.name.localeCompare(b.name));
|
|
19311
19462
|
}
|
|
19312
19463
|
// src/commands/repo-cleanup-branches/constants.ts
|
|
19313
|
-
/** The long-lived branches: never deleted, and what a branch must be an ancestor of (as `origin/<name>`) to count as merged. */
|
|
19314
|
-
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;
|
|
19315
19466
|
// src/commands/repo-cleanup-branches/local-git.ts
|
|
19316
19467
|
/** `git` run in `cwd`, no shell: its trimmed stdout and stderr, and whether it exited 0. */
|
|
19317
19468
|
function git(cwd, args) {
|
|
@@ -19836,6 +19987,24 @@ async function runSyncReadme(input) {
|
|
|
19836
19987
|
...problems.length > 0 ? { problems } : {}
|
|
19837
19988
|
};
|
|
19838
19989
|
}
|
|
19990
|
+
// src/presets/constants.ts
|
|
19991
|
+
/**
|
|
19992
|
+
* The org's DNS zone as the presets ship it to a consumer repo that has no `.holocron/org.ts` of its own. A repo
|
|
19993
|
+
* with an org area sets `domain` there instead and does not take it from a preset (both set is a `ConfigError`,
|
|
19994
|
+
* #1878): destructure `{ repo, providers, org, docs }` from the preset, as the root `holocron.config.ts` does.
|
|
19995
|
+
*/
|
|
19996
|
+
const DEFAULT_DOMAIN = "theholocron.dev";
|
|
19997
|
+
/** The subdomain the engineering wiki is served from, under the org's zone. */
|
|
19998
|
+
const WIKI_SUBDOMAIN = "wiki";
|
|
19999
|
+
/**
|
|
20000
|
+
* The wiki's hostname under a zone.
|
|
20001
|
+
*
|
|
20002
|
+
* @param domain - The org's zone; defaults to {@link DEFAULT_DOMAIN} when no config is in reach.
|
|
20003
|
+
* @returns For example `wiki.theholocron.dev`.
|
|
20004
|
+
*/
|
|
20005
|
+
function wikiHost(domain = DEFAULT_DOMAIN) {
|
|
20006
|
+
return `${WIKI_SUBDOMAIN}.${domain}`;
|
|
20007
|
+
}
|
|
19839
20008
|
// src/commands/sync-wiki/sync-wiki.ts
|
|
19840
20009
|
const env$2 = createEnvLookup();
|
|
19841
20010
|
/** The keyring entry `holocron auth set github.read` fills; the last place `sync-wiki` looks. */
|
|
@@ -19940,10 +20109,13 @@ async function discoverWikiRepos(org, token, fetchFn) {
|
|
|
19940
20109
|
* wiki-enabled repo (excluding self), keeping the navbar uncluttered
|
|
19941
20110
|
* regardless of how many repos are in the org.
|
|
19942
20111
|
*
|
|
20112
|
+
* A wiki repo that names no `domain` of its own links to `https://<wikiHostname>/<basepath>`. `runSyncWiki` passes the
|
|
20113
|
+
* wiki host of the config's `domain`; the default zone applies when none is in reach.
|
|
20114
|
+
*
|
|
19943
20115
|
* The block is replaced wholesale on each sync so removed/added wikis
|
|
19944
20116
|
* stay in sync automatically.
|
|
19945
20117
|
*/
|
|
19946
|
-
function buildNavbarLinks(repos, currentBasepath, repoFullName) {
|
|
20118
|
+
function buildNavbarLinks(repos, currentBasepath, repoFullName, wikiHostname = wikiHost()) {
|
|
19947
20119
|
const lines = [
|
|
19948
20120
|
`navbar-links:`,
|
|
19949
20121
|
` - type: github`,
|
|
@@ -19953,7 +20125,7 @@ function buildNavbarLinks(repos, currentBasepath, repoFullName) {
|
|
|
19953
20125
|
if (others.length > 0) {
|
|
19954
20126
|
lines.push(` - type: dropdown`, ` text: Other Projects`, ` icon: fa-duotone fa-book`, ` links:`);
|
|
19955
20127
|
for (const repo of others) {
|
|
19956
|
-
const url = repo.domain ? `https://${repo.domain}` : `https
|
|
20128
|
+
const url = repo.domain ? `https://${repo.domain}` : `https://${wikiHostname}/${repo.basepath}`;
|
|
19957
20129
|
lines.push(` - href: ${url}`, ` text: ${repo.displayName}`);
|
|
19958
20130
|
}
|
|
19959
20131
|
}
|
|
@@ -20043,7 +20215,7 @@ async function runSyncWiki(input) {
|
|
|
20043
20215
|
message: await mergeWikiConfig(docsYmlPath, {
|
|
20044
20216
|
owner,
|
|
20045
20217
|
repoName,
|
|
20046
|
-
navbarBlock: buildNavbarLinks(repos, deriveBasepath(typeof wikiOpts?.domain === "string" ? wikiOpts.domain : void 0, repoName), rawRepo)
|
|
20218
|
+
navbarBlock: buildNavbarLinks(repos, deriveBasepath(typeof wikiOpts?.domain === "string" ? wikiOpts.domain : void 0, repoName), rawRepo, wikiHost(config.domain))
|
|
20047
20219
|
}) ? `updated (${repos.length} wiki repos discovered)` : "already up to date"
|
|
20048
20220
|
};
|
|
20049
20221
|
} catch (err) {
|
|
@@ -20925,7 +21097,7 @@ const repoUpgradeCommand = {
|
|
|
20925
21097
|
const repoCommand = {
|
|
20926
21098
|
command: "repo",
|
|
20927
21099
|
describe: "Set up, sync, upgrade and clean up the current repo",
|
|
20928
|
-
builder: (y) => y.command(setupCommand).command(repoSyncCommand).command(repoUpgradeCommand).command(repoCleanupCommand).command(groupMenu$1("repo")),
|
|
21100
|
+
builder: (y) => y.command(setupCommand).command(repoSyncCommand).command(repoUpgradeCommand).command(repoCleanupCommand).command(repoPropertiesCommand).command(groupMenu$1("repo")),
|
|
20929
21101
|
handler: () => {}
|
|
20930
21102
|
};
|
|
20931
21103
|
// src/commands/run/run.args.ts
|
|
@@ -22403,7 +22575,6 @@ const specsCommand = {
|
|
|
22403
22575
|
handler: () => {}
|
|
22404
22576
|
};
|
|
22405
22577
|
// src/commands/sync-github/sync-github.ts
|
|
22406
|
-
const DEFAULT_REPO = "theholocron/.github";
|
|
22407
22578
|
/**
|
|
22408
22579
|
* The file set `sync-github` pushes to `theholocron/.github` — the reusable
|
|
22409
22580
|
* `workflow_call` implementations, composite actions and starter-workflow
|
|
@@ -22413,7 +22584,7 @@ const DEFAULT_REPO = "theholocron/.github";
|
|
|
22413
22584
|
* like `...tasks` from `nodeDocs()` — see issue #464).
|
|
22414
22585
|
*/
|
|
22415
22586
|
function buildBatch(repo) {
|
|
22416
|
-
if (repo !==
|
|
22587
|
+
if (repo !== DOT_GITHUB_REPO) return [];
|
|
22417
22588
|
const frozen = new Set(frozenReusablePaths());
|
|
22418
22589
|
return [...reusableTemplates()].filter(([path]) => !frozen.has(path)).map(([path, content]) => ({
|
|
22419
22590
|
path,
|
|
@@ -22428,9 +22599,9 @@ function gitBlobSha(content) {
|
|
|
22428
22599
|
async function runSyncGithub(input) {
|
|
22429
22600
|
const print = input.print ?? ((line) => console.log(line));
|
|
22430
22601
|
const logger = input.logger ?? getLogger();
|
|
22431
|
-
const repo = input.repo ??
|
|
22602
|
+
const repo = input.repo ?? DOT_GITHUB_REPO;
|
|
22432
22603
|
const { token, dryRun = false, branch, createPr = false } = input;
|
|
22433
|
-
const message = input.message ?? `chore: sync from
|
|
22604
|
+
const message = input.message ?? `chore: sync from ${HOLOCRON_REPO}`;
|
|
22434
22605
|
const client = createGitHubClient({
|
|
22435
22606
|
token,
|
|
22436
22607
|
fetch: input.fetch
|
|
@@ -22520,7 +22691,7 @@ async function runSyncGithub(input) {
|
|
|
22520
22691
|
const batch = buildBatch(repo);
|
|
22521
22692
|
const stamps = [];
|
|
22522
22693
|
let frozen = 0;
|
|
22523
|
-
if (repo ===
|
|
22694
|
+
if (repo === DOT_GITHUB_REPO) for (const path of frozenReusablePaths()) {
|
|
22524
22695
|
if (!existingBlobs.has(path)) continue;
|
|
22525
22696
|
let current;
|
|
22526
22697
|
try {
|
|
@@ -22680,8 +22851,8 @@ async function runSyncGithub(input) {
|
|
|
22680
22851
|
// src/commands/sync-github/sync-github.args.ts
|
|
22681
22852
|
const syncGithubArgs = (y) => y.option("repo", {
|
|
22682
22853
|
type: "string",
|
|
22683
|
-
default:
|
|
22684
|
-
describe:
|
|
22854
|
+
default: DOT_GITHUB_REPO,
|
|
22855
|
+
describe: `Target org/repo (default: ${DOT_GITHUB_REPO})`
|
|
22685
22856
|
}).option("branch", {
|
|
22686
22857
|
type: "string",
|
|
22687
22858
|
describe: "Push to this branch instead of the default branch (enables PR-based workflow for protected repos)"
|
|
@@ -22691,7 +22862,7 @@ const syncGithubArgs = (y) => y.option("repo", {
|
|
|
22691
22862
|
describe: "Open a PR after pushing to --branch (no-op without --branch)"
|
|
22692
22863
|
}).option("message", {
|
|
22693
22864
|
type: "string",
|
|
22694
|
-
describe:
|
|
22865
|
+
describe: `Commit message (default: chore: sync from ${HOLOCRON_REPO})`
|
|
22695
22866
|
}).option("output-dir", {
|
|
22696
22867
|
type: "string",
|
|
22697
22868
|
describe: "Write generated files to this local directory instead of pushing (for validation)"
|