@theholocron/cli 5.0.0-alpha.558 → 5.0.0-alpha.559
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 +121 -80
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +5 -0
- package/package.json +5 -5
package/dist/cli.mjs
CHANGED
|
@@ -23867,58 +23867,6 @@ async function installEngineeringStructure({ repoRoot }) {
|
|
|
23867
23867
|
for (const [path, content] of writes) if (await writeIfAbsent(path, content)) results.push(path.replace(repoRoot + "/", ""));
|
|
23868
23868
|
return results.length > 0 ? `created: ${results.join(", ")}` : "all files already exist — nothing to write";
|
|
23869
23869
|
}
|
|
23870
|
-
// src/commands/setup/errors-env-keys/errors-env-keys.ts
|
|
23871
|
-
/**
|
|
23872
|
-
* The env keys `holocron setup` pushes a tracker's DSN under: the
|
|
23873
|
-
* provider's `envKeys` (always), then the `frameworkEnvKeys` of every
|
|
23874
|
-
* framework in the repo's detected `stack`; a repeated key is pushed once.
|
|
23875
|
-
* `unknown` lists the `frameworkEnvKeys` names that are not a known stack name
|
|
23876
|
-
* (a typo in a plugin), whose keys are never pushed, so the caller can say so.
|
|
23877
|
-
*/
|
|
23878
|
-
function errorsEnvKeys(described, stack) {
|
|
23879
|
-
const extra = stack.flatMap((framework) => described.frameworkEnvKeys?.[framework] ?? []);
|
|
23880
|
-
const known = KNOWN_STACK_DEPS;
|
|
23881
|
-
const unknown = Object.keys(described.frameworkEnvKeys ?? {}).filter((name) => !known.includes(name));
|
|
23882
|
-
return {
|
|
23883
|
-
keys: [.../* @__PURE__ */ new Set([...described.envKeys, ...extra])],
|
|
23884
|
-
unknown
|
|
23885
|
-
};
|
|
23886
|
-
}
|
|
23887
|
-
// src/commands/setup/issue-types-step/issue-types-step.ts
|
|
23888
|
-
function toStatus(row, dryRun) {
|
|
23889
|
-
if (row.status === "fail") return "fail";
|
|
23890
|
-
if (row.status === "skip") return dryRun && row.detail.startsWith("would") ? "dry-run" : "skip";
|
|
23891
|
-
return "ok";
|
|
23892
|
-
}
|
|
23893
|
-
/**
|
|
23894
|
-
* `holocron setup`'s step for the organization's issue Types (spec `tech-org-issue-types`, #2512): make each Type the
|
|
23895
|
-
* org area's `issueTypes` declares, through `ensureIssueTypes()` as the `setup` caller. It only adds a missing Type
|
|
23896
|
-
* (never `update`, never deletes), and a refusal, an unreadable list, the limit or no terminal without `--yes` is a
|
|
23897
|
-
* skip row, never a failure, so a contributor without the organization permission still gets a passing `setup`.
|
|
23898
|
-
* Nothing declared, no steps: setup's output is unchanged. `holocron apply issue-types` is the deliberate version.
|
|
23899
|
-
*/
|
|
23900
|
-
async function issueTypesStep(input) {
|
|
23901
|
-
if (!input.declared || input.declared.length === 0) return [];
|
|
23902
|
-
const { loader } = input;
|
|
23903
|
-
const issues = loader.has("issues") ? loader.get("issues") : void 0;
|
|
23904
|
-
const missingReason = whyMissing(loader, "issues", "no `issues` provider to read the Types with");
|
|
23905
|
-
return (await ensureIssueTypes({
|
|
23906
|
-
declared: input.declared,
|
|
23907
|
-
issues,
|
|
23908
|
-
caller: "setup",
|
|
23909
|
-
update: false,
|
|
23910
|
-
dryRun: input.dryRun,
|
|
23911
|
-
missingReason,
|
|
23912
|
-
...input.yes ? { yes: true } : {},
|
|
23913
|
-
...input.interactive !== void 0 ? { interactive: input.interactive } : {},
|
|
23914
|
-
...input.confirm ? { confirm: input.confirm } : {}
|
|
23915
|
-
})).rows.map((row) => ({
|
|
23916
|
-
capability: "issues",
|
|
23917
|
-
step: row.id === "issue-types:types" ? "issue types" : `issue type ${row.title}`,
|
|
23918
|
-
status: toStatus(row, input.dryRun),
|
|
23919
|
-
message: [row.detail, ...row.problems].filter(Boolean).join("; ")
|
|
23920
|
-
}));
|
|
23921
|
-
}
|
|
23922
23870
|
// src/commands/setup/run-step/run-step.ts
|
|
23923
23871
|
async function runStep(capability, step, dryRun, body, opts = {}) {
|
|
23924
23872
|
const { result, logged } = await execStep(capability, step, dryRun, body, opts);
|
|
@@ -24001,6 +23949,108 @@ function formatStep(step) {
|
|
|
24001
23949
|
if (step.status === "dry-run") return ` ${style.dim(`… ${label}`)}`;
|
|
24002
23950
|
return ` ${style.dim(`· ${label}`)}`;
|
|
24003
23951
|
}
|
|
23952
|
+
// src/commands/setup/ensure-project-domain/ensure-project-domain.ts
|
|
23953
|
+
/**
|
|
23954
|
+
* Attaches a domain to a deployment project and makes the record the provider asks for (the one `ensureCustomDomain()`
|
|
23955
|
+
* hands back, when it hands one back and a `dns` provider is configured). Idempotent, and a provider without
|
|
23956
|
+
* `ensureCustomDomain` leaves nothing to do. The one place `holocron setup` and `holocron new instance` do it, so an
|
|
23957
|
+
* instance's domain is made the way an app's is (spec `tech-new-instance-command`).
|
|
23958
|
+
*/
|
|
23959
|
+
async function ensureProjectDomain(input) {
|
|
23960
|
+
const { deploy, project, hostname, dryRun, report } = input;
|
|
23961
|
+
if (!deploy.ensureCustomDomain) return;
|
|
23962
|
+
const made = { record: null };
|
|
23963
|
+
report(await runStep("deployment", `ensureCustomDomain ${hostname}`, dryRun, async () => {
|
|
23964
|
+
made.record = await deploy.ensureCustomDomain(project, hostname);
|
|
23965
|
+
}));
|
|
23966
|
+
const dns = made.record ? input.dns() : void 0;
|
|
23967
|
+
if (made.record && dns) {
|
|
23968
|
+
const dnsRecord = made.record;
|
|
23969
|
+
report(await runStep("dns", `upsertRecord ${dnsRecord.record.name}`, dryRun, async () => {
|
|
23970
|
+
await dns.upsertRecord(dnsRecord.zone, {
|
|
23971
|
+
...dnsRecord.record,
|
|
23972
|
+
ttl: 1
|
|
23973
|
+
});
|
|
23974
|
+
}));
|
|
23975
|
+
}
|
|
23976
|
+
}
|
|
23977
|
+
// src/commands/setup/ensure-instance-project/ensure-instance-project.ts
|
|
23978
|
+
/**
|
|
23979
|
+
* Makes an app's preview instance: its project, with no framework preset, and the domain it serves (spec
|
|
23980
|
+
* `tech-sentinel-preview-instance`). An instance is a bare function, never an app, so a preset would make Vercel's build
|
|
23981
|
+
* reject it ("No Next.js version detected"). Idempotent: an existing project or domain is left as it is. `holocron setup`
|
|
23982
|
+
* runs it beside the app's own project, and `holocron new instance` runs it alone, without the rest of `setup`
|
|
23983
|
+
* (`tech-new-instance-command`).
|
|
23984
|
+
*/
|
|
23985
|
+
async function ensureInstanceProject(input) {
|
|
23986
|
+
const { deploy, instance, dryRun, report } = input;
|
|
23987
|
+
report(await runStep("deployment", `ensureProject ${instance.project}`, dryRun, async () => {
|
|
23988
|
+
await deploy.ensureProject({
|
|
23989
|
+
name: instance.project,
|
|
23990
|
+
framework: null
|
|
23991
|
+
});
|
|
23992
|
+
}));
|
|
23993
|
+
if (instance.domain) await ensureProjectDomain({
|
|
23994
|
+
deploy,
|
|
23995
|
+
dns: input.dns,
|
|
23996
|
+
project: instance.project,
|
|
23997
|
+
hostname: instance.domain,
|
|
23998
|
+
dryRun,
|
|
23999
|
+
report
|
|
24000
|
+
});
|
|
24001
|
+
}
|
|
24002
|
+
// src/commands/setup/errors-env-keys/errors-env-keys.ts
|
|
24003
|
+
/**
|
|
24004
|
+
* The env keys `holocron setup` pushes a tracker's DSN under: the
|
|
24005
|
+
* provider's `envKeys` (always), then the `frameworkEnvKeys` of every
|
|
24006
|
+
* framework in the repo's detected `stack`; a repeated key is pushed once.
|
|
24007
|
+
* `unknown` lists the `frameworkEnvKeys` names that are not a known stack name
|
|
24008
|
+
* (a typo in a plugin), whose keys are never pushed, so the caller can say so.
|
|
24009
|
+
*/
|
|
24010
|
+
function errorsEnvKeys(described, stack) {
|
|
24011
|
+
const extra = stack.flatMap((framework) => described.frameworkEnvKeys?.[framework] ?? []);
|
|
24012
|
+
const known = KNOWN_STACK_DEPS;
|
|
24013
|
+
const unknown = Object.keys(described.frameworkEnvKeys ?? {}).filter((name) => !known.includes(name));
|
|
24014
|
+
return {
|
|
24015
|
+
keys: [.../* @__PURE__ */ new Set([...described.envKeys, ...extra])],
|
|
24016
|
+
unknown
|
|
24017
|
+
};
|
|
24018
|
+
}
|
|
24019
|
+
// src/commands/setup/issue-types-step/issue-types-step.ts
|
|
24020
|
+
function toStatus(row, dryRun) {
|
|
24021
|
+
if (row.status === "fail") return "fail";
|
|
24022
|
+
if (row.status === "skip") return dryRun && row.detail.startsWith("would") ? "dry-run" : "skip";
|
|
24023
|
+
return "ok";
|
|
24024
|
+
}
|
|
24025
|
+
/**
|
|
24026
|
+
* `holocron setup`'s step for the organization's issue Types (spec `tech-org-issue-types`, #2512): make each Type the
|
|
24027
|
+
* org area's `issueTypes` declares, through `ensureIssueTypes()` as the `setup` caller. It only adds a missing Type
|
|
24028
|
+
* (never `update`, never deletes), and a refusal, an unreadable list, the limit or no terminal without `--yes` is a
|
|
24029
|
+
* skip row, never a failure, so a contributor without the organization permission still gets a passing `setup`.
|
|
24030
|
+
* Nothing declared, no steps: setup's output is unchanged. `holocron apply issue-types` is the deliberate version.
|
|
24031
|
+
*/
|
|
24032
|
+
async function issueTypesStep(input) {
|
|
24033
|
+
if (!input.declared || input.declared.length === 0) return [];
|
|
24034
|
+
const { loader } = input;
|
|
24035
|
+
const issues = loader.has("issues") ? loader.get("issues") : void 0;
|
|
24036
|
+
const missingReason = whyMissing(loader, "issues", "no `issues` provider to read the Types with");
|
|
24037
|
+
return (await ensureIssueTypes({
|
|
24038
|
+
declared: input.declared,
|
|
24039
|
+
issues,
|
|
24040
|
+
caller: "setup",
|
|
24041
|
+
update: false,
|
|
24042
|
+
dryRun: input.dryRun,
|
|
24043
|
+
missingReason,
|
|
24044
|
+
...input.yes ? { yes: true } : {},
|
|
24045
|
+
...input.interactive !== void 0 ? { interactive: input.interactive } : {},
|
|
24046
|
+
...input.confirm ? { confirm: input.confirm } : {}
|
|
24047
|
+
})).rows.map((row) => ({
|
|
24048
|
+
capability: "issues",
|
|
24049
|
+
step: row.id === "issue-types:types" ? "issue types" : `issue type ${row.title}`,
|
|
24050
|
+
status: toStatus(row, input.dryRun),
|
|
24051
|
+
message: [row.detail, ...row.problems].filter(Boolean).join("; ")
|
|
24052
|
+
}));
|
|
24053
|
+
}
|
|
24004
24054
|
// src/commands/setup/skills/skills.ts
|
|
24005
24055
|
async function fetchExternalSkill(entry) {
|
|
24006
24056
|
if (entry.sourceType !== "github")
|
|
@@ -24671,25 +24721,19 @@ async function runSetup(input) {
|
|
|
24671
24721
|
const deploy = loader.get("deployment");
|
|
24672
24722
|
print(style.step("deployment"));
|
|
24673
24723
|
const previewCfg = previewConfigOf(config);
|
|
24674
|
-
const
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
steps.push(await runStep("deployment", `ensureCustomDomain ${hostname}`, dryRun, async () => {
|
|
24678
|
-
customDomainDns.value = await deploy.ensureCustomDomain(projectId, hostname);
|
|
24679
|
-
}));
|
|
24680
|
-
print(formatStep(steps[steps.length - 1]));
|
|
24681
|
-
if (customDomainDns.value && loader.has("dns")) {
|
|
24682
|
-
const dns = loader.get("dns");
|
|
24683
|
-
const dnsRecord = customDomainDns.value;
|
|
24684
|
-
steps.push(await runStep("dns", `upsertRecord ${dnsRecord.record.name}`, dryRun, async () => {
|
|
24685
|
-
await dns.upsertRecord(dnsRecord.zone, {
|
|
24686
|
-
...dnsRecord.record,
|
|
24687
|
-
ttl: 1
|
|
24688
|
-
});
|
|
24689
|
-
}));
|
|
24690
|
-
print(formatStep(steps[steps.length - 1]));
|
|
24691
|
-
}
|
|
24724
|
+
const report = (step) => {
|
|
24725
|
+
steps.push(step);
|
|
24726
|
+
print(formatStep(step));
|
|
24692
24727
|
};
|
|
24728
|
+
const getDns = () => loader.has("dns") ? loader.get("dns") : void 0;
|
|
24729
|
+
const ensureCustomDomain = (project, hostname) => ensureProjectDomain({
|
|
24730
|
+
deploy,
|
|
24731
|
+
dns: getDns,
|
|
24732
|
+
project,
|
|
24733
|
+
hostname,
|
|
24734
|
+
dryRun,
|
|
24735
|
+
report
|
|
24736
|
+
});
|
|
24693
24737
|
if (!previewCfg) {
|
|
24694
24738
|
steps.push(await runStep("deployment", `ensureProject ${config.name}`, dryRun, async () => {
|
|
24695
24739
|
await deploy.ensureProject({ name: config.name });
|
|
@@ -24706,16 +24750,13 @@ async function runSetup(input) {
|
|
|
24706
24750
|
if (previewCfg?.domain) await ensureCustomDomain(previewCfg.project, previewCfg.domain);
|
|
24707
24751
|
const { options: deploymentOptions } = config.providers.deployment.tuple;
|
|
24708
24752
|
const instance = previewInstance(config.name, deploymentOptions);
|
|
24709
|
-
if (instance) {
|
|
24710
|
-
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
print(formatStep(steps[steps.length - 1]));
|
|
24717
|
-
if (instance.domain) await ensureCustomDomain(instance.project, instance.domain);
|
|
24718
|
-
}
|
|
24753
|
+
if (instance) await ensureInstanceProject({
|
|
24754
|
+
deploy,
|
|
24755
|
+
dns: getDns,
|
|
24756
|
+
instance,
|
|
24757
|
+
dryRun,
|
|
24758
|
+
report
|
|
24759
|
+
});
|
|
24719
24760
|
if (previewCfg?.domain && deploy.providerName === "cloudflare" && loader.has("dns")) {
|
|
24720
24761
|
const dns = loader.get("dns");
|
|
24721
24762
|
const wildcardDomain = `*.${previewCfg.domain}`;
|