@theholocron/cli 5.0.0-alpha.355 → 5.0.0-alpha.357
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 +4 -3
- package/dist/cli.mjs +68 -26
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-u8-jh7xW.mjs → config-system-CkpFGTap.mjs} +2 -1
- package/dist/{config-system-CTXxGw0f.d.mts → config-system-M2V5jsbK.d.mts} +6 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -239,9 +239,9 @@ repo's `.holocron/repo.ts` holds `teams`, `topics`, `variables` and `secrets`, n
|
|
|
239
239
|
`satisfies RepoConfig` (a type-only import).
|
|
240
240
|
|
|
241
241
|
**The `org` area** (#1820). The organization's constants that are provider options and that CI does not need:
|
|
242
|
-
`.holocron/org.ts` is `{ cloudflare: { accountId }, vercel: { teamId }, checkly: { accountId } }` (typed with
|
|
242
|
+
`.holocron/org.ts` is `{ cloudflare: { accountId }, vercel: { teamId }, checkly: { accountId }, sentry: { org } }` (typed with
|
|
243
243
|
`satisfies OrgConfig`). The loader fills each of these into every provider entry of that name that leaves the option
|
|
244
|
-
out, so the config can say `deployment: ["vercel", { domain }]` and `
|
|
244
|
+
out, so the config can say `deployment: ["vercel", { domain }]`, `monitoring: "checkly"` and `errors: "sentry"`. The same option set inline
|
|
245
245
|
and in the file is an error that names both (`vercel.teamId is set in providers.deployment and in
|
|
246
246
|
.holocron/org.ts`), with no merge and no precedence. A provider key or an option the area does not know is an error; a
|
|
247
247
|
provider the config does not use is ignored. The org area is shared: a config in a subdirectory (`apps/sentinel`)
|
|
@@ -788,7 +788,8 @@ export default defineConfig({
|
|
|
788
788
|
Axiom shipping activates when a token (`HOLOCRON_AXIOM_TOKEN` / `AXIOM_TOKEN`
|
|
789
789
|
→ OS keyring `axiom.<org>` → `axiom`) **and** a dataset
|
|
790
790
|
(`HOLOCRON_AXIOM_DATASET` / `AXIOM_DATASET` → `log.axiom.dataset` in
|
|
791
|
-
`holocron.config`
|
|
791
|
+
`holocron.config` → the credential chain, where the 1Password-synced
|
|
792
|
+
`AXIOM_DATASET` lives) both resolve; env vars win. The token is never read from a
|
|
792
793
|
config file.
|
|
793
794
|
|
|
794
795
|
The dataset side of that resolution is **execution-context-aware** (ADR-0012):
|
package/dist/cli.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJ
|
|
|
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, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
23
|
+
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver, createKeyring, dotenvLine, 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";
|
|
@@ -482,7 +482,8 @@ function placeNotifications(raw, area) {
|
|
|
482
482
|
const ORG_OPTIONS = {
|
|
483
483
|
cloudflare: ["accountId"],
|
|
484
484
|
vercel: ["teamId"],
|
|
485
|
-
checkly: ["accountId"]
|
|
485
|
+
checkly: ["accountId"],
|
|
486
|
+
sentry: ["org"]
|
|
486
487
|
};
|
|
487
488
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
488
489
|
const isTuple = (entry) => Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && isObject(entry[1]);
|
|
@@ -758,8 +759,10 @@ function commandsInContext(context) {
|
|
|
758
759
|
* traces, errors, structured context that routes to Axiom. It runs in
|
|
759
760
|
* parallel to `print` (user-facing UX output) and does not replace it.
|
|
760
761
|
*/
|
|
761
|
-
const env$
|
|
762
|
-
|
|
762
|
+
const env$9 = createEnvLookup();
|
|
763
|
+
/** The one definition of the CLI's variable prefix: `HOLOCRON_<NAME>` is tried before the bare `<NAME>`. */
|
|
764
|
+
const PREFIX$1 = "HOLOCRON";
|
|
765
|
+
const holocronEnv$1 = withEnvPrefix(env$9, PREFIX$1);
|
|
763
766
|
/**
|
|
764
767
|
* Dataset for `global`-context commands (`clone`, `auth set`, `upgrade
|
|
765
768
|
* node`, …) — ADR-0012. These commands aren't "about" any repo, so their
|
|
@@ -771,6 +774,15 @@ const holocronEnv$1 = withEnvPrefix(env$8, "HOLOCRON");
|
|
|
771
774
|
*/
|
|
772
775
|
const GLOBAL_AXIOM_DATASET = "holocron-global";
|
|
773
776
|
/**
|
|
777
|
+
* The dataset of a non-global command: the process environment (`HOLOCRON_AXIOM_DATASET`, then the unprefixed
|
|
778
|
+
* `AXIOM_DATASET`, through the prefix lookup), then `log.axiom.dataset`, then the credential chain, which is asked for
|
|
779
|
+
* the same pair of names. `resolveValue` takes a plain list of names, so the pair is built from {@link PREFIX} instead of
|
|
780
|
+
* adding a prefix option to kyber for one caller.
|
|
781
|
+
*/
|
|
782
|
+
function resolveCliDataset(opts) {
|
|
783
|
+
return holocronEnv$1.get("AXIOM_DATASET") ?? opts.configAxiomDataset ?? resolveValue$2([`${PREFIX$1}_AXIOM_DATASET`, "AXIOM_DATASET"]);
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
774
786
|
* Resolve Axiom credentials for the CLI.
|
|
775
787
|
*
|
|
776
788
|
* A `global`-context command (ADR-0012) always resolves to
|
|
@@ -780,8 +792,11 @@ const GLOBAL_AXIOM_DATASET = "holocron-global";
|
|
|
780
792
|
* right answer. Everything else keeps the existing chain: env vars win
|
|
781
793
|
* (same contract as `@theholocron/observability`'s `resolveAxiomFromEnv`),
|
|
782
794
|
* falling back to the CLI-only bridge that pairs the OS-keyring token
|
|
783
|
-
* (`axiom.<org>` then bare `axiom`) with a dataset from
|
|
784
|
-
* `HOLOCRON_AXIOM_DATASET
|
|
795
|
+
* (`axiom.<org>` then bare `axiom`) with a dataset from the process
|
|
796
|
+
* environment (`HOLOCRON_AXIOM_DATASET`, then `AXIOM_DATASET`), then
|
|
797
|
+
* `log.axiom.dataset`, then the credential chain (`resolveValue`, which finds the
|
|
798
|
+
* 1Password-synced `AXIOM_DATASET`). The config sits before the chain so a local
|
|
799
|
+
* run with no `.envrc` still ships to `holocron-local`, not to the CI dataset.
|
|
785
800
|
* Returns `undefined` unless both a token and a dataset are found.
|
|
786
801
|
*/
|
|
787
802
|
function resolveCliAxiom(opts, ctx) {
|
|
@@ -790,9 +805,9 @@ function resolveCliAxiom(opts, ctx) {
|
|
|
790
805
|
const fromEnv = resolveAxiomFromEnv();
|
|
791
806
|
if (fromEnv) return fromEnv;
|
|
792
807
|
}
|
|
793
|
-
const dataset = isGlobal ? GLOBAL_AXIOM_DATASET :
|
|
808
|
+
const dataset = isGlobal ? GLOBAL_AXIOM_DATASET : resolveCliDataset(opts);
|
|
794
809
|
if (!dataset) return void 0;
|
|
795
|
-
const org = opts.org ?? env$
|
|
810
|
+
const org = opts.org ?? env$9.get(`${PREFIX$1}_ORG`);
|
|
796
811
|
const token = holocronEnv$1.get("AXIOM_TOKEN") || (org ? keyring.get(`axiom.${org}`) : null) || keyring.get("axiom");
|
|
797
812
|
return token ? {
|
|
798
813
|
dataset,
|
|
@@ -800,7 +815,7 @@ function resolveCliAxiom(opts, ctx) {
|
|
|
800
815
|
} : void 0;
|
|
801
816
|
}
|
|
802
817
|
const logger = createCliLogger({
|
|
803
|
-
envPrefix:
|
|
818
|
+
envPrefix: PREFIX$1,
|
|
804
819
|
resolveAxiom: resolveCliAxiom
|
|
805
820
|
});
|
|
806
821
|
/**
|
|
@@ -886,7 +901,7 @@ const endSession = telemetry.endSession;
|
|
|
886
901
|
const flush = telemetry.flush;
|
|
887
902
|
telemetry.resetTelemetry;
|
|
888
903
|
// src/commands/resolve-org/resolve-org.ts
|
|
889
|
-
const env$
|
|
904
|
+
const env$8 = createEnvLookup();
|
|
890
905
|
/**
|
|
891
906
|
* Resolves the active org in priority order:
|
|
892
907
|
* 1. `--org` CLI flag
|
|
@@ -894,7 +909,7 @@ const env$7 = createEnvLookup();
|
|
|
894
909
|
* 3. `org` from `holocron.config.ts`
|
|
895
910
|
*/
|
|
896
911
|
function resolveOrg(argv, config) {
|
|
897
|
-
return argv.org ?? env$
|
|
912
|
+
return argv.org ?? env$8.get("HOLOCRON_ORG") ?? config.org;
|
|
898
913
|
}
|
|
899
914
|
// src/commands/apply-resolved-config/apply-resolved-config.ts
|
|
900
915
|
/**
|
|
@@ -2272,7 +2287,7 @@ const projectReconcileEntry = {
|
|
|
2272
2287
|
supportsDryRun: true
|
|
2273
2288
|
};
|
|
2274
2289
|
// src/commands/publish/publish.entry.ts
|
|
2275
|
-
const env$
|
|
2290
|
+
const env$7 = createEnvLookup();
|
|
2276
2291
|
const PUBLISH_TAG_OPTION = {
|
|
2277
2292
|
key: "tag",
|
|
2278
2293
|
flag: "--tag",
|
|
@@ -2285,7 +2300,7 @@ const PUBLISH_OTP_OPTION = {
|
|
|
2285
2300
|
type: "password",
|
|
2286
2301
|
secret: true,
|
|
2287
2302
|
askLast: true,
|
|
2288
|
-
required: Boolean(env$
|
|
2303
|
+
required: Boolean(env$7.get("HOLOCRON_NPM_ENFORCE_2FA")),
|
|
2289
2304
|
message: "One-time password (2FA), if npm requires it for this publish:"
|
|
2290
2305
|
};
|
|
2291
2306
|
// src/interactive-menu/command-catalog/command-catalog.ts
|
|
@@ -3047,7 +3062,7 @@ async function runClone(input) {
|
|
|
3047
3062
|
};
|
|
3048
3063
|
}
|
|
3049
3064
|
// src/commands/clone/clone.command.ts
|
|
3050
|
-
const env$
|
|
3065
|
+
const env$6 = createEnvLookup();
|
|
3051
3066
|
const resolveCloneToken = createFeatureResolver$1({
|
|
3052
3067
|
envName: "HOLOCRON_READ_TOKEN",
|
|
3053
3068
|
keyringKey: "github.read"
|
|
@@ -3085,7 +3100,7 @@ const cloneCommand = {
|
|
|
3085
3100
|
} } : {},
|
|
3086
3101
|
confirmOpen: async (openTarget, moreToCome) => {
|
|
3087
3102
|
if (!process.stdin.isTTY) return;
|
|
3088
|
-
if (moreToCome && env$
|
|
3103
|
+
if (moreToCome && env$6.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") return;
|
|
3089
3104
|
if (await confirm({
|
|
3090
3105
|
message: `Open ${openTarget}?`,
|
|
3091
3106
|
default: false
|
|
@@ -3095,7 +3110,7 @@ const cloneCommand = {
|
|
|
3095
3110
|
if (report.status === "fail") {
|
|
3096
3111
|
if (report.message) reportError(`clone: ${report.message}`);
|
|
3097
3112
|
process.exitCode = 1;
|
|
3098
|
-
} else if (report.status === "dry-run" && report.cloned === 0 && env$
|
|
3113
|
+
} else if (report.status === "dry-run" && report.cloned === 0 && env$6.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") process.exitCode = DRY_RUN_NOOP_EXIT_CODE;
|
|
3099
3114
|
}
|
|
3100
3115
|
};
|
|
3101
3116
|
// src/commands/config-show/config-show.args.ts
|
|
@@ -3826,6 +3841,7 @@ async function runDevServe(input) {
|
|
|
3826
3841
|
});
|
|
3827
3842
|
}
|
|
3828
3843
|
// src/commands/dev-serve/dev-serve.command.ts
|
|
3844
|
+
const env$5 = createEnvLookup();
|
|
3829
3845
|
const devServeCommand = {
|
|
3830
3846
|
command: "serve",
|
|
3831
3847
|
describe: "Serve the handler `dev.serve` names on PORT: the application `holocron dev` runs when it is configured, not usually run by hand",
|
|
@@ -3841,7 +3857,7 @@ const devServeCommand = {
|
|
|
3841
3857
|
cwd: argv.cwd,
|
|
3842
3858
|
environment: dev.environment ?? "",
|
|
3843
3859
|
serve: dev.serve,
|
|
3844
|
-
port: Number(
|
|
3860
|
+
port: Number(env$5.get("PORT") ?? dev.port ?? 3e3)
|
|
3845
3861
|
});
|
|
3846
3862
|
} catch (err) {
|
|
3847
3863
|
reportError(`dev serve: ${errorMessage(err)}`);
|
|
@@ -10727,6 +10743,36 @@ async function runMonitoringRunResolved(input) {
|
|
|
10727
10743
|
...input.runCheck ? { runCheck: input.runCheck } : {}
|
|
10728
10744
|
});
|
|
10729
10745
|
}
|
|
10746
|
+
// src/commands/resolve-vercel-credentials/resolve-vercel-credentials.ts
|
|
10747
|
+
/** The `teamId` of the first configured `vercel` provider (the loader fills it from `.holocron/org.ts`), if any. */
|
|
10748
|
+
function configuredTeamId(resolved) {
|
|
10749
|
+
for (const entry of Object.values(resolved?.providers ?? {})) {
|
|
10750
|
+
const tuples = entry.cardinality === "single" ? [entry.tuple] : entry.tuples;
|
|
10751
|
+
for (const tuple of tuples) {
|
|
10752
|
+
const teamId = tuple.provider === "vercel" ? tuple.options["teamId"] : void 0;
|
|
10753
|
+
if (typeof teamId === "string" && teamId !== "") return teamId;
|
|
10754
|
+
}
|
|
10755
|
+
}
|
|
10756
|
+
}
|
|
10757
|
+
/**
|
|
10758
|
+
* Reads the Vercel token, team id and Deployment Protection bypass secret through the credential chain
|
|
10759
|
+
* (`resolveValue`: the environment, then the `credentials` providers) instead of `process.env`. The environment's
|
|
10760
|
+
* `VERCEL_TEAM_ID` wins over the configured provider's `teamId`, so the override CI passes keeps working. A value that
|
|
10761
|
+
* is not set is left out, so the result spreads straight into the input of `resolveVercelBypassHeaders`.
|
|
10762
|
+
*
|
|
10763
|
+
* @param resolved - The loaded config, when the command has one. `monitoring run-resolved` loads none.
|
|
10764
|
+
* @param env - The environment to read. Default `process.env`; a test passes its own.
|
|
10765
|
+
*/
|
|
10766
|
+
function resolveVercelCredentials(resolved, env) {
|
|
10767
|
+
const vercelToken = resolveValue(["VERCEL_TOKEN"], env);
|
|
10768
|
+
const vercelTeamId = resolveValue(["VERCEL_TEAM_ID"], env) ?? configuredTeamId(resolved);
|
|
10769
|
+
const bypassSecret = resolveValue(["VERCEL_PROTECTION_BYPASS_SECRET"], env);
|
|
10770
|
+
return {
|
|
10771
|
+
...vercelToken ? { vercelToken } : {},
|
|
10772
|
+
...vercelTeamId ? { vercelTeamId } : {},
|
|
10773
|
+
...bypassSecret ? { bypassSecret } : {}
|
|
10774
|
+
};
|
|
10775
|
+
}
|
|
10730
10776
|
// src/commands/monitoring-check/monitoring-check.args.ts
|
|
10731
10777
|
const monitoringCheckArgs = (y) => y.positional("url", {
|
|
10732
10778
|
type: "string",
|
|
@@ -10749,9 +10795,7 @@ const monitoringCheckCommand = {
|
|
|
10749
10795
|
const { headers } = await resolveVercelBypassHeaders({
|
|
10750
10796
|
url,
|
|
10751
10797
|
...argv.vercelProject ? { vercelProject: argv.vercelProject } : {},
|
|
10752
|
-
...
|
|
10753
|
-
...process.env["VERCEL_TEAM_ID"] ? { vercelTeamId: process.env["VERCEL_TEAM_ID"] } : {},
|
|
10754
|
-
...process.env["VERCEL_PROTECTION_BYPASS_SECRET"] ? { bypassSecret: process.env["VERCEL_PROTECTION_BYPASS_SECRET"] } : {}
|
|
10798
|
+
...resolveVercelCredentials(loaded.resolved)
|
|
10755
10799
|
});
|
|
10756
10800
|
if ((await runMonitoringCheck({
|
|
10757
10801
|
loaded,
|
|
@@ -10839,9 +10883,7 @@ const monitoringRunResolvedCommand = {
|
|
|
10839
10883
|
checks: JSON.parse(readFileSync(argv.checksFile, "utf8")),
|
|
10840
10884
|
url: argv.url,
|
|
10841
10885
|
...argv.vercelProject ? { vercelProject: argv.vercelProject } : {},
|
|
10842
|
-
...
|
|
10843
|
-
...process.env["VERCEL_TEAM_ID"] ? { vercelTeamId: process.env["VERCEL_TEAM_ID"] } : {},
|
|
10844
|
-
...process.env["VERCEL_PROTECTION_BYPASS_SECRET"] ? { bypassSecret: process.env["VERCEL_PROTECTION_BYPASS_SECRET"] } : {}
|
|
10886
|
+
...resolveVercelCredentials()
|
|
10845
10887
|
})).status === "fail") process.exitCode = 1;
|
|
10846
10888
|
}
|
|
10847
10889
|
};
|
|
@@ -15274,7 +15316,7 @@ function runTypedoc(repoRoot) {
|
|
|
15274
15316
|
function realDiff(repoRoot) {
|
|
15275
15317
|
/* v8 ignore start -- runs the real git; the probe is tested with an injected diff */
|
|
15276
15318
|
return () => {
|
|
15277
|
-
const base =
|
|
15319
|
+
const base = createEnvLookup().get("BASE_SHA") ?? "origin/alpha";
|
|
15278
15320
|
return execFileSync("git", [
|
|
15279
15321
|
"diff",
|
|
15280
15322
|
"-U0",
|
|
@@ -20664,7 +20706,7 @@ async function runSecretSet(input) {
|
|
|
20664
20706
|
const dryRun = input.context.dryRun ?? false;
|
|
20665
20707
|
const scope = input.scope ?? { kind: "repo" };
|
|
20666
20708
|
if (!loader.has("secrets")) throw new Error("`secrets` capability is not configured — add a `secrets` provider to holocron.config.json");
|
|
20667
|
-
const value = await resolveValue(input);
|
|
20709
|
+
const value = await resolveValue$1(input);
|
|
20668
20710
|
if (!value) throw new Error(`no value for secret \`${input.name}\` — pass it positionally, via --from-stdin, --from-env <NAME>, or set $${input.name} in the environment`);
|
|
20669
20711
|
print(`Holocron secret set — ${input.name} (${describeScope$1(scope)})${dryRun ? " (dry-run)" : ""}`);
|
|
20670
20712
|
if (dryRun) {
|
|
@@ -20708,7 +20750,7 @@ async function runSecretSet(input) {
|
|
|
20708
20750
|
};
|
|
20709
20751
|
}
|
|
20710
20752
|
}
|
|
20711
|
-
async function resolveValue(input) {
|
|
20753
|
+
async function resolveValue$1(input) {
|
|
20712
20754
|
if (input.value) return input.value;
|
|
20713
20755
|
if (input.fromStdin) return (await (input.readStdin ?? defaultReadStdin)()).replace(/\r?\n$/, "");
|
|
20714
20756
|
if (input.fromEnv) return env$1.get(input.fromEnv);
|