@theholocron/cli 5.0.0-alpha.461 → 5.0.0-alpha.463
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/dist/cli.mjs
CHANGED
|
@@ -259,13 +259,14 @@ const cleanupPreviewEntry = {
|
|
|
259
259
|
flag: "--project",
|
|
260
260
|
type: "input",
|
|
261
261
|
required: true,
|
|
262
|
-
message: "Cloudflare Pages project name
|
|
262
|
+
message: "Deployment project (a Cloudflare Pages project name such as theholocron-preview, or a Vercel project):"
|
|
263
263
|
}],
|
|
264
264
|
skipOptions: [
|
|
265
265
|
"project-id",
|
|
266
266
|
"target",
|
|
267
267
|
"files",
|
|
268
|
-
"repo"
|
|
268
|
+
"repo",
|
|
269
|
+
"yes"
|
|
269
270
|
],
|
|
270
271
|
supportsDryRun: true
|
|
271
272
|
};
|
|
@@ -1037,7 +1038,7 @@ const providerEntry = {
|
|
|
1037
1038
|
supportsDryRun: false
|
|
1038
1039
|
};
|
|
1039
1040
|
// src/commands/publish/publish.entry.ts
|
|
1040
|
-
const env$
|
|
1041
|
+
const env$11 = createEnvLookup();
|
|
1041
1042
|
const PUBLISH_TAG_OPTION = {
|
|
1042
1043
|
key: "tag",
|
|
1043
1044
|
flag: "--tag",
|
|
@@ -1050,7 +1051,7 @@ const PUBLISH_OTP_OPTION = {
|
|
|
1050
1051
|
type: "password",
|
|
1051
1052
|
secret: true,
|
|
1052
1053
|
askLast: true,
|
|
1053
|
-
required: Boolean(env$
|
|
1054
|
+
required: Boolean(env$11.get("HOLOCRON_NPM_ENFORCE_2FA")),
|
|
1054
1055
|
message: "One-time password (2FA), if npm requires it for this publish:"
|
|
1055
1056
|
};
|
|
1056
1057
|
const publishEntry = {
|
|
@@ -1740,7 +1741,7 @@ const menuCommand = (version) => ({
|
|
|
1740
1741
|
* traces, errors, structured context that routes to Axiom. It runs in
|
|
1741
1742
|
* parallel to `print` (user-facing UX output) and does not replace it.
|
|
1742
1743
|
*/
|
|
1743
|
-
const env$
|
|
1744
|
+
const env$10 = createEnvLookup();
|
|
1744
1745
|
const holocron = holocronEnv();
|
|
1745
1746
|
/**
|
|
1746
1747
|
* The CLI's Axiom dataset (`holocron`; each service has its own): the process environment (`HOLOCRON_AXIOM_DATASET`, then the unprefixed `AXIOM_DATASET`,
|
|
@@ -1768,7 +1769,7 @@ function resolveCliAxiom(opts, ctx) {
|
|
|
1768
1769
|
if (fromEnv) return fromEnv;
|
|
1769
1770
|
const dataset = resolveCliDataset(opts, contextForCommand(ctx.command ?? "") === "global");
|
|
1770
1771
|
if (!dataset) return void 0;
|
|
1771
|
-
const org = opts.org ?? env$
|
|
1772
|
+
const org = opts.org ?? env$10.get(`${PREFIX$1}_ORG`);
|
|
1772
1773
|
const token = holocron.get("AXIOM_TOKEN") || (org ? keyring.get(`axiom.${org}`) : null) || keyring.get("axiom");
|
|
1773
1774
|
return token ? {
|
|
1774
1775
|
dataset,
|
|
@@ -1794,7 +1795,7 @@ const getRunId = logger.getRunId;
|
|
|
1794
1795
|
logger.resetCliLogger;
|
|
1795
1796
|
logger.resolveLogLevel;
|
|
1796
1797
|
// src/observability/resolve-telemetry/resolve-telemetry.ts
|
|
1797
|
-
const env$
|
|
1798
|
+
const env$9 = holocronEnv();
|
|
1798
1799
|
/**
|
|
1799
1800
|
* Holocron-specific credential resolution for the telemetry sinks — the env
|
|
1800
1801
|
* chain plus Holocron's own shipped fallbacks. This is **CLI policy**, not part
|
|
@@ -1818,15 +1819,15 @@ const FALLBACK_POSTHOG_PROJECT_TOKEN = "phc_AC4vFCvYzwnzmG7Vg5nEc3PZKZztoPyfKp4L
|
|
|
1818
1819
|
const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
|
|
1819
1820
|
/** Resolve the Sentry DSN. `""` → error telemetry disabled. */
|
|
1820
1821
|
function resolveDsn() {
|
|
1821
|
-
return env$
|
|
1822
|
+
return env$9.get("SENTRY_DSN") ?? FALLBACK_DSN;
|
|
1822
1823
|
}
|
|
1823
1824
|
/** Resolve the PostHog project key. `""` → usage analytics disabled. */
|
|
1824
1825
|
function resolvePostHogKey() {
|
|
1825
|
-
return env$
|
|
1826
|
+
return env$9.get("POSTHOG_PROJECT_TOKEN") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;
|
|
1826
1827
|
}
|
|
1827
1828
|
/** Resolve the PostHog ingest host. */
|
|
1828
1829
|
function resolvePostHogHost() {
|
|
1829
|
-
return env$
|
|
1830
|
+
return env$9.get("POSTHOG_HOST") ?? DEFAULT_POSTHOG_HOST;
|
|
1830
1831
|
}
|
|
1831
1832
|
// src/observability/telemetry/telemetry.ts
|
|
1832
1833
|
/**
|
|
@@ -2855,7 +2856,7 @@ function resolvedEnvironment(entry) {
|
|
|
2855
2856
|
return entry.environment;
|
|
2856
2857
|
}
|
|
2857
2858
|
// src/commands/resolve-org/resolve-org.ts
|
|
2858
|
-
const env$
|
|
2859
|
+
const env$8 = createEnvLookup();
|
|
2859
2860
|
/**
|
|
2860
2861
|
* Resolves the active org in priority order:
|
|
2861
2862
|
* 1. `--org` CLI flag
|
|
@@ -2863,7 +2864,7 @@ const env$7 = createEnvLookup();
|
|
|
2863
2864
|
* 3. `org` from `holocron.config.ts`
|
|
2864
2865
|
*/
|
|
2865
2866
|
function resolveOrg(argv, config) {
|
|
2866
|
-
return argv.org ?? env$
|
|
2867
|
+
return argv.org ?? env$8.get("HOLOCRON_ORG") ?? config.org;
|
|
2867
2868
|
}
|
|
2868
2869
|
// src/commands/apply-resolved-config/apply-resolved-config.ts
|
|
2869
2870
|
/**
|
|
@@ -5122,7 +5123,7 @@ async function runClone(input) {
|
|
|
5122
5123
|
};
|
|
5123
5124
|
}
|
|
5124
5125
|
// src/commands/clone/clone.command.ts
|
|
5125
|
-
const env$
|
|
5126
|
+
const env$7 = createEnvLookup();
|
|
5126
5127
|
const resolveCloneToken = createFeatureResolver({
|
|
5127
5128
|
envName: "HOLOCRON_READ_TOKEN",
|
|
5128
5129
|
keyringKey: "github.read"
|
|
@@ -5160,7 +5161,7 @@ const cloneCommand = {
|
|
|
5160
5161
|
} } : {},
|
|
5161
5162
|
confirmOpen: async (openTarget, moreToCome) => {
|
|
5162
5163
|
if (!process.stdin.isTTY) return;
|
|
5163
|
-
if (moreToCome && env$
|
|
5164
|
+
if (moreToCome && env$7.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") return;
|
|
5164
5165
|
if (await confirm({
|
|
5165
5166
|
message: `Open ${openTarget}?`,
|
|
5166
5167
|
default: false
|
|
@@ -5170,7 +5171,7 @@ const cloneCommand = {
|
|
|
5170
5171
|
if (report.status === "fail") {
|
|
5171
5172
|
if (report.message) reportError(`clone: ${report.message}`);
|
|
5172
5173
|
process.exitCode = 1;
|
|
5173
|
-
} else if (report.status === "dry-run" && report.cloned === 0 && env$
|
|
5174
|
+
} else if (report.status === "dry-run" && report.cloned === 0 && env$7.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") process.exitCode = DRY_RUN_NOOP_EXIT_CODE;
|
|
5174
5175
|
}
|
|
5175
5176
|
};
|
|
5176
5177
|
// src/commands/project/project-options/project-options.ts
|
|
@@ -5400,6 +5401,10 @@ const cleanupPreviewArgs = (y) => y.positional("pr", {
|
|
|
5400
5401
|
}).option("repo", {
|
|
5401
5402
|
type: "string",
|
|
5402
5403
|
describe: "GitHub repo as owner/name — defaults to the repo in holocron.config"
|
|
5404
|
+
}).option("yes", {
|
|
5405
|
+
type: "boolean",
|
|
5406
|
+
default: false,
|
|
5407
|
+
describe: "Delete every preview deployment found without asking (for CI). Refuses a pull request that is still open."
|
|
5403
5408
|
});
|
|
5404
5409
|
// src/commands/cleanup-preview/cleanup-preview.ts
|
|
5405
5410
|
function prStateLabel(pr) {
|
|
@@ -5433,7 +5438,7 @@ async function runCleanupPreview(input) {
|
|
|
5433
5438
|
print(`${style.header(`PR #${pr.number}`)} — ${pr.title}`);
|
|
5434
5439
|
print(` Status : ${prStateLabel(pr)} | Branch : ${style.dim(pr.branch)}`);
|
|
5435
5440
|
print(` URL : ${style.dim(pr.url)}`);
|
|
5436
|
-
print(`
|
|
5441
|
+
print(` Alias : ${style.dim(branch)}`);
|
|
5437
5442
|
print("");
|
|
5438
5443
|
if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a deployment provider to holocron.config.json");
|
|
5439
5444
|
const deploy = loader.get("deployment");
|
|
@@ -5464,6 +5469,23 @@ async function runCleanupPreview(input) {
|
|
|
5464
5469
|
}
|
|
5465
5470
|
print(`Found ${deployments.length} deployment${deployments.length === 1 ? "" : "s"} for ${style.dim(branch)}:`);
|
|
5466
5471
|
print("");
|
|
5472
|
+
if (input.yes && pr.state === "open") {
|
|
5473
|
+
const message = `PR #${pr.number} is still open: --yes only deletes the previews of a closed pull request.`;
|
|
5474
|
+
print(style.fail(message));
|
|
5475
|
+
logger.warn({
|
|
5476
|
+
pr: pr.number,
|
|
5477
|
+
branch,
|
|
5478
|
+
status: "fail"
|
|
5479
|
+
}, "cleanup-preview: refused, PR is open");
|
|
5480
|
+
return {
|
|
5481
|
+
pr,
|
|
5482
|
+
branch,
|
|
5483
|
+
found: deployments.length,
|
|
5484
|
+
deleted: 0,
|
|
5485
|
+
status: "fail",
|
|
5486
|
+
message
|
|
5487
|
+
};
|
|
5488
|
+
}
|
|
5467
5489
|
if (pr.state === "open") {
|
|
5468
5490
|
print(style.warn(`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`));
|
|
5469
5491
|
print(style.warn("Nothing is pre-selected — check the deployments you want to remove."));
|
|
@@ -5477,7 +5499,8 @@ async function runCleanupPreview(input) {
|
|
|
5477
5499
|
};
|
|
5478
5500
|
});
|
|
5479
5501
|
let selected;
|
|
5480
|
-
|
|
5502
|
+
if (input.yes) selected = deployments.map((d) => d.id);
|
|
5503
|
+
else try {
|
|
5481
5504
|
selected = await checkbox({
|
|
5482
5505
|
message: "Select deployments to delete (space to toggle, a to select all, enter to confirm):",
|
|
5483
5506
|
choices
|
|
@@ -5561,7 +5584,8 @@ const cleanupPreviewCommand = {
|
|
|
5561
5584
|
},
|
|
5562
5585
|
prNumber: Number(pr),
|
|
5563
5586
|
project: argv.project,
|
|
5564
|
-
...argv.repo ? { repo: argv.repo } : {}
|
|
5587
|
+
...argv.repo ? { repo: argv.repo } : {},
|
|
5588
|
+
...argv.yes ? { yes: true } : {}
|
|
5565
5589
|
})).status === "fail") process.exitCode = 1;
|
|
5566
5590
|
}
|
|
5567
5591
|
};
|
|
@@ -6108,7 +6132,8 @@ async function runDeployFromFiles(input) {
|
|
|
6108
6132
|
try {
|
|
6109
6133
|
const result = await withSpinner(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
|
|
6110
6134
|
files,
|
|
6111
|
-
...input.target ? { target: input.target } : {}
|
|
6135
|
+
...input.target ? { target: input.target } : {},
|
|
6136
|
+
...input.previewKey && !input.target ? { meta: { holocronPreview: input.previewKey } } : {}
|
|
6112
6137
|
}));
|
|
6113
6138
|
logger.info({
|
|
6114
6139
|
url: result.url,
|
|
@@ -6153,6 +6178,7 @@ async function runDeployFromFiles(input) {
|
|
|
6153
6178
|
}
|
|
6154
6179
|
}
|
|
6155
6180
|
// src/commands/deploy/deploy.command.ts
|
|
6181
|
+
const env$6 = createEnvLookup();
|
|
6156
6182
|
const deployCommand = {
|
|
6157
6183
|
command: "deploy [branch]",
|
|
6158
6184
|
describe: "Trigger a deployment via the configured `deployment` capability",
|
|
@@ -6179,7 +6205,8 @@ const deployCommand = {
|
|
|
6179
6205
|
context,
|
|
6180
6206
|
projectId: argv.projectId,
|
|
6181
6207
|
dir: argv.files,
|
|
6182
|
-
...argv.target ? { target: argv.target } : {}
|
|
6208
|
+
...argv.target ? { target: argv.target } : {},
|
|
6209
|
+
...env$6.get("HOLOCRON_PREVIEW_KEY") ? { previewKey: env$6.get("HOLOCRON_PREVIEW_KEY") } : {}
|
|
6183
6210
|
})).status === "fail") process.exitCode = 1;
|
|
6184
6211
|
return;
|
|
6185
6212
|
}
|