@m-kopa/launchpad-cli 0.77.0 → 0.78.0
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/CHANGELOG.md +15 -0
- package/dist/cli.js +1443 -254
- package/dist/commands/deploy-flags.d.ts +2 -0
- package/dist/commands/deploy-flags.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/destroy.d.ts +36 -0
- package/dist/commands/destroy.d.ts.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/status.d.ts +13 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/deploy/preflight.d.ts +134 -0
- package/dist/deploy/preflight.d.ts.map +1 -0
- package/dist/deploy/verify-deploy.d.ts.map +1 -1
- package/dist/destroy-failure.d.ts +23 -0
- package/dist/destroy-failure.d.ts.map +1 -0
- package/dist/scaffold/react-api-starter-files.d.ts +7 -0
- package/dist/scaffold/react-api-starter-files.d.ts.map +1 -0
- package/dist/scaffold/react-api-starter.d.ts +26 -0
- package/dist/scaffold/react-api-starter.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/skills/launchpad-content-pr/SKILL.md +1 -1
- package/skills/launchpad-deploy/SKILL.md +99 -69
- package/skills/launchpad-deploy-status/SKILL.md +39 -22
- package/skills/launchpad-destroy/SKILL.md +20 -13
- package/skills/launchpad-identity/SKILL.md +1 -1
- package/skills/launchpad-ingest/SKILL.md +1 -1
- package/skills/launchpad-integration-contract/SKILL.md +1 -1
- package/skills/launchpad-onboard/SKILL.md +1 -1
- package/skills/launchpad-report/SKILL.md +1 -1
- package/skills/launchpad-status/SKILL.md +6 -5
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
20
|
|
|
21
21
|
// src/version.ts
|
|
22
|
-
var CLI_VERSION = "0.
|
|
22
|
+
var CLI_VERSION = "0.78.0";
|
|
23
23
|
|
|
24
24
|
// src/config.ts
|
|
25
25
|
import { readFileSync } from "node:fs";
|
|
@@ -1979,7 +1979,7 @@ function describe10(e) {
|
|
|
1979
1979
|
}
|
|
1980
1980
|
|
|
1981
1981
|
// src/commands/deploy.ts
|
|
1982
|
-
import { existsSync as
|
|
1982
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
1983
1983
|
import * as path9 from "node:path";
|
|
1984
1984
|
|
|
1985
1985
|
// src/bundle/orchestrate.ts
|
|
@@ -6311,6 +6311,7 @@ async function verifyServed(args, deps = { fetch }) {
|
|
|
6311
6311
|
|
|
6312
6312
|
// src/commands/status.ts
|
|
6313
6313
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
6314
|
+
import { parse as parseYaml6 } from "yaml";
|
|
6314
6315
|
|
|
6315
6316
|
// src/deploy/manifest-state.ts
|
|
6316
6317
|
async function fetchManifestState(cfg, slug, opts = {}, fetcher = fetch) {
|
|
@@ -6368,6 +6369,98 @@ function inferSlug(opts) {
|
|
|
6368
6369
|
return fromManifest ?? fromDir;
|
|
6369
6370
|
}
|
|
6370
6371
|
|
|
6372
|
+
// src/destroy-failure.ts
|
|
6373
|
+
var MAX_REASON_LEN = 280;
|
|
6374
|
+
var CONTROL_CHARS = /[\u0000-\u001f\u007f-\u009f]/g;
|
|
6375
|
+
var RUN_URL = /https:\/\/github\.com\/M-KOPA\/[A-Za-z0-9._-]+\/actions\/runs\/\d+/;
|
|
6376
|
+
var REAP_PREFIX = /^destroy reap (failed|refused):\s*/;
|
|
6377
|
+
var REAP_OPERATION_PREFIX = /^destroy reap operation failed\s*-\s*/;
|
|
6378
|
+
var TF_PREFIX = /^tf-apply ([a-z_]+)\b/;
|
|
6379
|
+
function clean2(text) {
|
|
6380
|
+
return redactDiagnostic(text.replace(CONTROL_CHARS, " ").replace(/\s+/g, " "), MAX_REASON_LEN);
|
|
6381
|
+
}
|
|
6382
|
+
function reapSteps(detail) {
|
|
6383
|
+
const steps = [];
|
|
6384
|
+
if (/\bregistry read failed\b/.test(detail))
|
|
6385
|
+
steps.push("reading the app registry");
|
|
6386
|
+
if (/CLOUDFLARE_API_TOKEN|CLOUDFLARE_ACCOUNT_ID|WFP_DISPATCH_NAMESPACE|not configured/.test(detail)) {
|
|
6387
|
+
steps.push("platform configuration");
|
|
6388
|
+
}
|
|
6389
|
+
if (/\bd1 '[^']*' backup\b/.test(detail))
|
|
6390
|
+
steps.push("D1 database backup");
|
|
6391
|
+
else if (/\bd1 '/.test(detail))
|
|
6392
|
+
steps.push("D1 database delete");
|
|
6393
|
+
if (/\bworker '/.test(detail))
|
|
6394
|
+
steps.push("cron Worker delete");
|
|
6395
|
+
if (/\bdispatch-script '/.test(detail))
|
|
6396
|
+
steps.push("Workers script delete");
|
|
6397
|
+
if (/\bcontainer-worker '/.test(detail))
|
|
6398
|
+
steps.push("container Worker delete");
|
|
6399
|
+
return steps.length > 0 ? steps.join(", ") : "cleanup";
|
|
6400
|
+
}
|
|
6401
|
+
function describeDestroyFailure(slug, rawReason) {
|
|
6402
|
+
const retry = `run \`launchpad destroy ${slug}\` again`;
|
|
6403
|
+
const report = `run \`launchpad report\` with this output so the platform team can clear it`;
|
|
6404
|
+
const raw = (rawReason ?? "").trim();
|
|
6405
|
+
if (raw.length === 0) {
|
|
6406
|
+
return {
|
|
6407
|
+
step: "unknown (the bot recorded no reason)",
|
|
6408
|
+
reason: "no reason recorded",
|
|
6409
|
+
next: `${retry}; if it fails again, ${report}.`
|
|
6410
|
+
};
|
|
6411
|
+
}
|
|
6412
|
+
const reap = REAP_PREFIX.exec(raw);
|
|
6413
|
+
if (reap !== null) {
|
|
6414
|
+
const detail = raw.slice(reap[0].length).replace(REAP_OPERATION_PREFIX, "");
|
|
6415
|
+
const reason = clean2(detail);
|
|
6416
|
+
if (reap[1] === "refused") {
|
|
6417
|
+
if (/kill-switch/.test(detail)) {
|
|
6418
|
+
return {
|
|
6419
|
+
step: "cleanup of bot-owned resources (paused by the platform team)",
|
|
6420
|
+
reason,
|
|
6421
|
+
next: `nothing was deleted. Once the platform team says cleanup is resumed, ${retry}; it is safe to repeat.`
|
|
6422
|
+
};
|
|
6423
|
+
}
|
|
6424
|
+
return {
|
|
6425
|
+
step: "cleanup ownership check (nothing was deleted)",
|
|
6426
|
+
reason,
|
|
6427
|
+
next: `${retry} once; it is safe to repeat and passes if a lookup failed briefly. ` + `If it stops at the same check, ${report}.`
|
|
6428
|
+
};
|
|
6429
|
+
}
|
|
6430
|
+
const steps = reapSteps(detail);
|
|
6431
|
+
if (steps === "platform configuration") {
|
|
6432
|
+
return { step: steps, reason, next: `a repeat will fail the same way; ${report}.` };
|
|
6433
|
+
}
|
|
6434
|
+
return {
|
|
6435
|
+
step: `cleanup after Terraform destroy: ${steps}`,
|
|
6436
|
+
reason,
|
|
6437
|
+
next: `${retry}; it is safe to repeat (anything already deleted counts as done).`
|
|
6438
|
+
};
|
|
6439
|
+
}
|
|
6440
|
+
const tf = TF_PREFIX.exec(raw);
|
|
6441
|
+
if (tf !== null) {
|
|
6442
|
+
const url = RUN_URL.exec(raw)?.[0];
|
|
6443
|
+
return {
|
|
6444
|
+
step: `Terraform destroy run (${tf[1]})`,
|
|
6445
|
+
reason: clean2(url !== undefined ? raw.replace(url, "").replace(/\s*[—-]\s*$/, "") : raw),
|
|
6446
|
+
...url !== undefined ? { runUrl: url } : {},
|
|
6447
|
+
next: (url !== undefined ? "open the run link to see why, then " : "") + `${retry}.`
|
|
6448
|
+
};
|
|
6449
|
+
}
|
|
6450
|
+
return {
|
|
6451
|
+
step: "teardown",
|
|
6452
|
+
reason: clean2(raw),
|
|
6453
|
+
next: `${retry}; if it fails again, ${report}.`
|
|
6454
|
+
};
|
|
6455
|
+
}
|
|
6456
|
+
function destroyFailureLines(slug, view) {
|
|
6457
|
+
return [
|
|
6458
|
+
`${slug}: destroy FAILED at ${view.step}: ${view.reason}`,
|
|
6459
|
+
...view.runUrl !== undefined ? [` run: ${view.runUrl}`] : [],
|
|
6460
|
+
` next: ${view.next}`
|
|
6461
|
+
];
|
|
6462
|
+
}
|
|
6463
|
+
|
|
6371
6464
|
// src/groups/client.ts
|
|
6372
6465
|
import { mkdirSync, readFileSync as readFileSync7, writeFileSync } from "node:fs";
|
|
6373
6466
|
import { dirname as dirname5, join as join8 } from "node:path";
|
|
@@ -6815,10 +6908,10 @@ function sanitizeForTerminal(input) {
|
|
|
6815
6908
|
function sanitizeField(input, max = 160) {
|
|
6816
6909
|
if (input == null)
|
|
6817
6910
|
return "";
|
|
6818
|
-
const
|
|
6819
|
-
if (
|
|
6820
|
-
return
|
|
6821
|
-
return
|
|
6911
|
+
const clean3 = sanitizeForTerminal(input);
|
|
6912
|
+
if (clean3.length <= max)
|
|
6913
|
+
return clean3;
|
|
6914
|
+
return clean3.slice(0, Math.max(0, max - 1)) + "…";
|
|
6822
6915
|
}
|
|
6823
6916
|
|
|
6824
6917
|
// src/watch/render.ts
|
|
@@ -7291,7 +7384,7 @@ async function runStatus(args, io) {
|
|
|
7291
7384
|
};
|
|
7292
7385
|
}
|
|
7293
7386
|
}
|
|
7294
|
-
emit4(output, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
7387
|
+
emit4(output, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration, lifecycle.state === "failed" && localManifestDeclaresDispatch(parsed.file, parsed.slug));
|
|
7295
7388
|
return 0;
|
|
7296
7389
|
}
|
|
7297
7390
|
let localYaml = null;
|
|
@@ -7719,12 +7812,14 @@ function manifestAuth(manifest) {
|
|
|
7719
7812
|
return manifest.apiVersion === "launchpad.m-kopa.us/v2" ? manifest.spec.auth ?? "access" : manifest.auth ?? "access";
|
|
7720
7813
|
}
|
|
7721
7814
|
function lifecycleOutput(slug, lc) {
|
|
7815
|
+
const destroyFailure = lc.state === "destroy_failed" ? describeDestroyFailure(slug, lc.lifecycleReason) : undefined;
|
|
7722
7816
|
const state = lc.state === "failed" ? "provisioning_failed" : lc.state === "live" ? "in_sync" : lc.state;
|
|
7723
7817
|
return {
|
|
7724
7818
|
state,
|
|
7725
7819
|
slug,
|
|
7726
7820
|
stage: lc.failedAt?.stage ?? lc.stage ?? null,
|
|
7727
|
-
failedReason: lc.state === "failed" ? lc.failedAt?.message ?? lc.lifecycleReason ?? null : null,
|
|
7821
|
+
failedReason: lc.state === "failed" ? lc.failedAt?.message ?? lc.lifecycleReason ?? null : destroyFailure?.reason ?? null,
|
|
7822
|
+
...destroyFailure !== undefined ? { destroyFailure } : {},
|
|
7728
7823
|
submissionId: lc.submissionId ?? null,
|
|
7729
7824
|
deployedSha: null,
|
|
7730
7825
|
headSha: null,
|
|
@@ -7753,7 +7848,29 @@ function printMigrationLine(slug, migration, io) {
|
|
|
7753
7848
|
return;
|
|
7754
7849
|
io.out(`Migration to Workers dispatch: ${migration.stage} (users served by ${migration.servingOrigin}). ` + `Details: launchpad migrate --status --slug ${slug}`);
|
|
7755
7850
|
}
|
|
7756
|
-
function
|
|
7851
|
+
function isFailedDispatchApp(out, migration, localDispatch) {
|
|
7852
|
+
return out.deployment?.origin === "dispatch" || migration?.servingOrigin === "dispatch" || localDispatch || /^dispatch delivery\b/i.test(out.failedReason ?? "");
|
|
7853
|
+
}
|
|
7854
|
+
function dispatchFailureNextSteps(slug, stage) {
|
|
7855
|
+
const lines = [
|
|
7856
|
+
" this is a Workers dispatch app, so `launchpad recover` does not apply (it repairs live Pages apps)."
|
|
7857
|
+
];
|
|
7858
|
+
if (stage === "bot_pr_ci_failed") {
|
|
7859
|
+
lines.push(" the bootstrap PR's checks failed before any infrastructure existed; a fix pushed to that PR does not restart the deploy.", " free the slug, fix the cause in your app (often a vulnerable dependency: run `bun audit --prod`), then deploy again:", ` launchpad destroy ${slug} --confirm-slug ${slug} --yes`, ` if destroy answers 409 no_per_app_tf, the platform team must release the slug: \`launchpad bug "${slug} failed at bot_pr_ci_failed"\`.`);
|
|
7860
|
+
return lines;
|
|
7861
|
+
}
|
|
7862
|
+
lines.push(" read why the delivery build failed (the run link below), fix the cause in your app, then free the slug and deploy again:", ` launchpad destroy ${slug} --confirm-slug ${slug} --yes`, " launchpad deploy");
|
|
7863
|
+
return lines;
|
|
7864
|
+
}
|
|
7865
|
+
function localManifestDeclaresDispatch(file, slug) {
|
|
7866
|
+
try {
|
|
7867
|
+
const raw = parseYaml6(readFileSync9(file, "utf8"));
|
|
7868
|
+
return raw?.apiVersion === "launchpad.m-kopa.us/v2" && raw.metadata?.slug === slug && raw.spec?.origin === "dispatch";
|
|
7869
|
+
} catch {
|
|
7870
|
+
return false;
|
|
7871
|
+
}
|
|
7872
|
+
}
|
|
7873
|
+
function emit4(base, asJson, io, containerRedeploy, migration, localDispatch = false) {
|
|
7757
7874
|
const out = withLifecycleExtras(base, containerRedeploy, migration);
|
|
7758
7875
|
if (asJson) {
|
|
7759
7876
|
io.out(JSON.stringify(withTopLevelNotices(out), null, 2));
|
|
@@ -7776,6 +7893,9 @@ function emit4(base, asJson, io, containerRedeploy, migration) {
|
|
|
7776
7893
|
if (out.deployment?.reconciledToLive === true) {
|
|
7777
7894
|
io.out(` that lifecycle state is stale: this read verified the live build and reconciled the record failed→live.`);
|
|
7778
7895
|
io.out(` no action needed — re-run \`launchpad status ${out.slug}\` to see the reconciled state.`);
|
|
7896
|
+
} else if (isFailedDispatchApp(out, migration, localDispatch)) {
|
|
7897
|
+
for (const line of dispatchFailureNextSteps(out.slug, out.stage ?? null))
|
|
7898
|
+
io.out(line);
|
|
7779
7899
|
} else if (isLikelyLiveFailureStage(out.stage)) {
|
|
7780
7900
|
io.out(` the app may already be live — run \`launchpad recover ${out.slug}\` to reconcile the record;`);
|
|
7781
7901
|
io.out(` if it is not serving, the same command starts the stage-dependent recovery.`);
|
|
@@ -7791,7 +7911,9 @@ function emit4(base, asJson, io, containerRedeploy, migration) {
|
|
|
7791
7911
|
io.out(`${out.slug}: destroyed (slug retired).`);
|
|
7792
7912
|
return;
|
|
7793
7913
|
case "destroy_failed":
|
|
7794
|
-
|
|
7914
|
+
for (const line of destroyFailureLines(out.slug, out.destroyFailure ?? describeDestroyFailure(out.slug, null))) {
|
|
7915
|
+
io.out(line);
|
|
7916
|
+
}
|
|
7795
7917
|
return;
|
|
7796
7918
|
case "live_no_content":
|
|
7797
7919
|
io.out(`${out.slug}: live — no content deployed yet. Run \`launchpad deploy\`.`);
|
|
@@ -8397,6 +8519,8 @@ async function runFirstDeployVerification(args, io, deps) {
|
|
|
8397
8519
|
if (deps.now() - start >= args.timeoutMs) {
|
|
8398
8520
|
io.out(`⏳ Still provisioning${lc.stage ? ` (stage: ${lc.stage})` : ""} after ${Math.round(args.timeoutMs / 1000)}s — couldn't verify the served content yet.`);
|
|
8399
8521
|
io.out(` Re-check the outcome: \`launchpad status ${args.slug}\` (or \`launchpad watch ${args.slug}\`).`);
|
|
8522
|
+
io.out("");
|
|
8523
|
+
io.out(`Deploy NOT finished: ${args.slug} is still provisioning and is not live yet. ` + `Check: launchpad watch ${args.slug} (or launchpad status ${args.slug}).`);
|
|
8400
8524
|
return 0;
|
|
8401
8525
|
}
|
|
8402
8526
|
await deps.sleep(pollIntervalMs);
|
|
@@ -8440,8 +8564,8 @@ async function verifyFirstDeployServed(args, liveUrl, io, deps) {
|
|
|
8440
8564
|
}
|
|
8441
8565
|
|
|
8442
8566
|
// src/commands/deploy.ts
|
|
8443
|
-
import { parse as
|
|
8444
|
-
import { readFileSync as
|
|
8567
|
+
import { parse as parseYaml10 } from "yaml";
|
|
8568
|
+
import { readFileSync as readFileSync15 } from "node:fs";
|
|
8445
8569
|
|
|
8446
8570
|
// src/deploy/git-files.ts
|
|
8447
8571
|
import { spawn as spawn3 } from "node:child_process";
|
|
@@ -8501,7 +8625,7 @@ function runGit2(sp, cwd, args) {
|
|
|
8501
8625
|
}
|
|
8502
8626
|
|
|
8503
8627
|
// src/deploy/manifest-diff.ts
|
|
8504
|
-
import { parse as
|
|
8628
|
+
import { parse as parseYaml7 } from "yaml";
|
|
8505
8629
|
var MASK = "«redacted»";
|
|
8506
8630
|
var SECRET_KEY_SEGMENT = /(secret|token|api[_-]?key|access[_-]?key|private[_-]?key|secret[_-]?key|password|passwd|pwd|authorization|auth[_-]?token|bearer|client[_-]?secret|session|credential|value)/i;
|
|
8507
8631
|
function isSecretPath(path8) {
|
|
@@ -8592,7 +8716,7 @@ function diffManifests(localYaml, deployedYaml) {
|
|
|
8592
8716
|
let local;
|
|
8593
8717
|
let deployed;
|
|
8594
8718
|
try {
|
|
8595
|
-
local =
|
|
8719
|
+
local = parseYaml7(localYaml);
|
|
8596
8720
|
} catch (e) {
|
|
8597
8721
|
return {
|
|
8598
8722
|
inSync: false,
|
|
@@ -8601,7 +8725,7 @@ function diffManifests(localYaml, deployedYaml) {
|
|
|
8601
8725
|
};
|
|
8602
8726
|
}
|
|
8603
8727
|
try {
|
|
8604
|
-
deployed =
|
|
8728
|
+
deployed = parseYaml7(deployedYaml);
|
|
8605
8729
|
} catch (e) {
|
|
8606
8730
|
return {
|
|
8607
8731
|
inSync: false,
|
|
@@ -8726,6 +8850,7 @@ function parseDeployFlags(args) {
|
|
|
8726
8850
|
let rebaseOntoHead = false;
|
|
8727
8851
|
let overrideStale = null;
|
|
8728
8852
|
let allowUnguarded = false;
|
|
8853
|
+
let allowPreflightFailure = false;
|
|
8729
8854
|
let noOpen = false;
|
|
8730
8855
|
let i = 0;
|
|
8731
8856
|
while (i < args.length) {
|
|
@@ -8864,6 +8989,11 @@ function parseDeployFlags(args) {
|
|
|
8864
8989
|
i += 1;
|
|
8865
8990
|
continue;
|
|
8866
8991
|
}
|
|
8992
|
+
if (a === "--allow-preflight-failure") {
|
|
8993
|
+
allowPreflightFailure = true;
|
|
8994
|
+
i += 1;
|
|
8995
|
+
continue;
|
|
8996
|
+
}
|
|
8867
8997
|
if (a === "--rebase-onto-head") {
|
|
8868
8998
|
rebaseOntoHead = true;
|
|
8869
8999
|
i += 1;
|
|
@@ -8950,8 +9080,8 @@ function parseDeployFlags(args) {
|
|
|
8950
9080
|
if (modeFlagsSeen > 1) {
|
|
8951
9081
|
return "--new, --resume, --abandon, --dry-run, and --apply are mutually exclusive";
|
|
8952
9082
|
}
|
|
8953
|
-
if (mode !== "content" && (allowStale || rebaseOntoHead || overrideStale !== null || allowUnguarded)) {
|
|
8954
|
-
return "--allow-stale / --rebase-onto-head / --override-stale / --allow-unguarded are only valid for a content deploy";
|
|
9083
|
+
if (mode !== "content" && (allowStale || rebaseOntoHead || overrideStale !== null || allowUnguarded || allowPreflightFailure)) {
|
|
9084
|
+
return "--allow-stale / --rebase-onto-head / --override-stale / --allow-unguarded / --allow-preflight-failure are only valid for a content deploy";
|
|
8955
9085
|
}
|
|
8956
9086
|
if (rebaseOntoHead && overrideStale !== null) {
|
|
8957
9087
|
return "--rebase-onto-head and --override-stale are mutually exclusive — re-stamp to head, or override in place, not both";
|
|
@@ -9054,7 +9184,8 @@ function parseDeployFlags(args) {
|
|
|
9054
9184
|
allowStale,
|
|
9055
9185
|
rebaseOntoHead,
|
|
9056
9186
|
overrideStale,
|
|
9057
|
-
allowUnguarded
|
|
9187
|
+
allowUnguarded,
|
|
9188
|
+
allowPreflightFailure
|
|
9058
9189
|
},
|
|
9059
9190
|
message,
|
|
9060
9191
|
timeoutSeconds,
|
|
@@ -9610,11 +9741,11 @@ async function handleAccessDrift(params) {
|
|
|
9610
9741
|
}
|
|
9611
9742
|
|
|
9612
9743
|
// src/deploy/scheduled-tier-lines.ts
|
|
9613
|
-
var
|
|
9744
|
+
var CONTROL_CHARS2 = /[\u0000-\u001f\u007f-\u009f]/g;
|
|
9614
9745
|
function text(v) {
|
|
9615
9746
|
if (typeof v !== "string")
|
|
9616
9747
|
return null;
|
|
9617
|
-
const cleaned = v.replace(
|
|
9748
|
+
const cleaned = v.replace(CONTROL_CHARS2, " ").trim();
|
|
9618
9749
|
return cleaned === "" ? null : cleaned;
|
|
9619
9750
|
}
|
|
9620
9751
|
function textList(v) {
|
|
@@ -9876,7 +10007,7 @@ var ASSETS_ONLY_NOTE = "primary is not audited: this static app's dispatch scrip
|
|
|
9876
10007
|
// src/commands/redeploy.ts
|
|
9877
10008
|
import { existsSync as existsSync7, readFileSync as readFileSync11 } from "node:fs";
|
|
9878
10009
|
import { resolve as resolvePath2 } from "node:path";
|
|
9879
|
-
import { parse as
|
|
10010
|
+
import { parse as parseYaml8 } from "yaml";
|
|
9880
10011
|
var SLUG_RE5 = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
9881
10012
|
var DEFAULT_VERIFY_TIMEOUT_MS = 180000;
|
|
9882
10013
|
var redeployCommand = {
|
|
@@ -9955,7 +10086,7 @@ function readLocalAppType(cwd, file) {
|
|
|
9955
10086
|
if (!existsSync7(manifestPath))
|
|
9956
10087
|
return null;
|
|
9957
10088
|
try {
|
|
9958
|
-
const obj =
|
|
10089
|
+
const obj = parseYaml8(readFileSync11(manifestPath, "utf8"));
|
|
9959
10090
|
return coerceAppType(obj?.deployment?.type);
|
|
9960
10091
|
} catch {
|
|
9961
10092
|
return null;
|
|
@@ -10889,36 +11020,540 @@ function handleNetworkError(e, io, slug, verb) {
|
|
|
10889
11020
|
return 1;
|
|
10890
11021
|
}
|
|
10891
11022
|
|
|
11023
|
+
// src/deploy/preflight.ts
|
|
11024
|
+
import { builtinModules } from "node:module";
|
|
11025
|
+
import { existsSync as existsSync9, lstatSync as lstatSync3, readFileSync as readFileSync13 } from "node:fs";
|
|
11026
|
+
import { dirname as dirname6, join as join11, posix, relative as relative3 } from "node:path";
|
|
11027
|
+
import { parse as parseYaml9 } from "yaml";
|
|
11028
|
+
var BUILD_BUN_VERSION = "1.3.4";
|
|
11029
|
+
var BUILD_BUN_MAX_LOCKFILE_VERSION = 1;
|
|
11030
|
+
var REGENERATE_LOCKFILE_COMMAND = `npx --yes bun@${BUILD_BUN_VERSION} install`;
|
|
11031
|
+
var ALLOW_PREFLIGHT_FAILURE_FLAG = "--allow-preflight-failure";
|
|
11032
|
+
var SEEDED_API_ROUTER_PATH = "functions/api/[[path]].ts";
|
|
11033
|
+
var SEEDED_API_ROUTER_PACKAGES = ["hono", "@m-kopa/platform-auth"];
|
|
11034
|
+
function renderFinding(f, kind) {
|
|
11035
|
+
if (kind === "error") {
|
|
11036
|
+
return [
|
|
11037
|
+
`launchpad deploy: ${f.found}. Nothing was uploaded.`,
|
|
11038
|
+
` Why: ${f.why}`,
|
|
11039
|
+
` Fix: ${f.fix}`,
|
|
11040
|
+
...f.command !== undefined ? [` ${f.command}`] : [],
|
|
11041
|
+
` To deploy anyway (the delivery build is then expected to fail), pass ${ALLOW_PREFLIGHT_FAILURE_FLAG}.`
|
|
11042
|
+
];
|
|
11043
|
+
}
|
|
11044
|
+
return [
|
|
11045
|
+
kind === "allowed" ? `warning (${ALLOW_PREFLIGHT_FAILURE_FLAG}): ${f.found}.` : `warning: ${f.found}.`,
|
|
11046
|
+
` Why: ${f.why}`,
|
|
11047
|
+
` Fix: ${f.fix}`,
|
|
11048
|
+
...f.command !== undefined ? [` ${f.command}`] : [],
|
|
11049
|
+
kind === "allowed" ? " The deploy continues because you passed the flag; the delivery build is expected to fail." : " The deploy continues."
|
|
11050
|
+
];
|
|
11051
|
+
}
|
|
11052
|
+
function parseJsonc(text2) {
|
|
11053
|
+
let out = "";
|
|
11054
|
+
let i = 0;
|
|
11055
|
+
let inString = false;
|
|
11056
|
+
while (i < text2.length) {
|
|
11057
|
+
const c = text2[i];
|
|
11058
|
+
if (inString) {
|
|
11059
|
+
out += c;
|
|
11060
|
+
if (c === "\\") {
|
|
11061
|
+
out += text2[i + 1] ?? "";
|
|
11062
|
+
i += 2;
|
|
11063
|
+
continue;
|
|
11064
|
+
}
|
|
11065
|
+
if (c === '"')
|
|
11066
|
+
inString = false;
|
|
11067
|
+
i += 1;
|
|
11068
|
+
continue;
|
|
11069
|
+
}
|
|
11070
|
+
if (c === '"') {
|
|
11071
|
+
inString = true;
|
|
11072
|
+
out += c;
|
|
11073
|
+
i += 1;
|
|
11074
|
+
continue;
|
|
11075
|
+
}
|
|
11076
|
+
if (c === "/" && text2[i + 1] === "/") {
|
|
11077
|
+
while (i < text2.length && text2[i] !== `
|
|
11078
|
+
`)
|
|
11079
|
+
i += 1;
|
|
11080
|
+
continue;
|
|
11081
|
+
}
|
|
11082
|
+
if (c === "/" && text2[i + 1] === "*") {
|
|
11083
|
+
const end = text2.indexOf("*/", i + 2);
|
|
11084
|
+
i = end === -1 ? text2.length : end + 2;
|
|
11085
|
+
continue;
|
|
11086
|
+
}
|
|
11087
|
+
out += c;
|
|
11088
|
+
i += 1;
|
|
11089
|
+
}
|
|
11090
|
+
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
11091
|
+
}
|
|
11092
|
+
function parsePackageJson(text2) {
|
|
11093
|
+
try {
|
|
11094
|
+
const parsed = JSON.parse(text2.replace(/^/, ""));
|
|
11095
|
+
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
11096
|
+
} catch {
|
|
11097
|
+
return null;
|
|
11098
|
+
}
|
|
11099
|
+
}
|
|
11100
|
+
function dirPrefixOf(file) {
|
|
11101
|
+
const i = file.lastIndexOf("/");
|
|
11102
|
+
return i === -1 ? "" : file.slice(0, i + 1);
|
|
11103
|
+
}
|
|
11104
|
+
function ancestorPrefixes(prefix) {
|
|
11105
|
+
const out = [];
|
|
11106
|
+
let p = prefix;
|
|
11107
|
+
while (p !== "") {
|
|
11108
|
+
p = dirPrefixOf(p.slice(0, -1));
|
|
11109
|
+
out.push(p);
|
|
11110
|
+
}
|
|
11111
|
+
return out;
|
|
11112
|
+
}
|
|
11113
|
+
function parseBunLockfileVersion(text2) {
|
|
11114
|
+
const head = text2.slice(0, 4096);
|
|
11115
|
+
const match = /"lockfileVersion"\s*:\s*(\d+)\s*[,}\n]/.exec(head);
|
|
11116
|
+
if (match === null)
|
|
11117
|
+
return null;
|
|
11118
|
+
const n = Number.parseInt(match[1], 10);
|
|
11119
|
+
return Number.isSafeInteger(n) ? n : null;
|
|
11120
|
+
}
|
|
11121
|
+
function installManagerOf(pkg, pkgPresent) {
|
|
11122
|
+
if (!pkgPresent)
|
|
11123
|
+
return "unknown";
|
|
11124
|
+
if (pkg === null)
|
|
11125
|
+
return "unknown";
|
|
11126
|
+
const declared = pkg["packageManager"];
|
|
11127
|
+
if (declared === undefined)
|
|
11128
|
+
return "bun";
|
|
11129
|
+
if (typeof declared !== "string")
|
|
11130
|
+
return "unknown";
|
|
11131
|
+
const name = declared.split("@")[0] ?? "";
|
|
11132
|
+
if (name === "bun")
|
|
11133
|
+
return "bun";
|
|
11134
|
+
return ["pnpm", "npm", "yarn"].includes(name) ? "other" : "unknown";
|
|
11135
|
+
}
|
|
11136
|
+
function lockfileFinding(lockPath, version, why) {
|
|
11137
|
+
return {
|
|
11138
|
+
found: `${lockPath} has "lockfileVersion": ${version}`,
|
|
11139
|
+
why: `${why} bun 1.4 and newer write version 2; bun ${BUILD_BUN_VERSION} reads ${BUILD_BUN_MAX_LOCKFILE_VERSION} or older.`,
|
|
11140
|
+
fix: `in the folder that holds ${lockPath}, rewrite the lockfile with bun ${BUILD_BUN_VERSION}, then deploy again:`,
|
|
11141
|
+
command: REGENERATE_LOCKFILE_COMMAND
|
|
11142
|
+
};
|
|
11143
|
+
}
|
|
11144
|
+
function checkLockfiles(input2, errors, warnings) {
|
|
11145
|
+
const locks = [...input2.files].filter((f) => f === "bun.lock" || f.endsWith("/bun.lock")).sort();
|
|
11146
|
+
if (locks.length === 0)
|
|
11147
|
+
return;
|
|
11148
|
+
const dispatch = input2.origin === "dispatch";
|
|
11149
|
+
const root = input2.buildRoot;
|
|
11150
|
+
const functionsShipped = root !== null && input2.appType === "react+api" && [...input2.files].some((f) => f.startsWith(`${root}functions/`));
|
|
11151
|
+
const installProven = dispatch && root !== null && ((input2.buildCommand ?? "") !== "" || functionsShipped);
|
|
11152
|
+
const installPossible = dispatch && (installProven || input2.appType === "react+api" || root === null || input2.buildCommand === null);
|
|
11153
|
+
const pkgPath = root !== null ? `${root}package.json` : null;
|
|
11154
|
+
const pkgPresent = pkgPath !== null && input2.files.has(pkgPath);
|
|
11155
|
+
const pkgText = pkgPresent ? input2.readFile(pkgPath) : null;
|
|
11156
|
+
const manager = installManagerOf(pkgText === null ? null : parsePackageJson(pkgText), pkgText !== null);
|
|
11157
|
+
const workspaceAbove = root !== null && ancestorPrefixes(root).some((p) => {
|
|
11158
|
+
const path8 = `${p}package.json`;
|
|
11159
|
+
if (!input2.files.has(path8))
|
|
11160
|
+
return false;
|
|
11161
|
+
const text2 = input2.readFile(path8);
|
|
11162
|
+
const pkg = text2 === null ? null : parsePackageJson(text2);
|
|
11163
|
+
return pkg === null || pkg["workspaces"] !== undefined;
|
|
11164
|
+
});
|
|
11165
|
+
for (const lockPath of locks) {
|
|
11166
|
+
const version = parseBunLockfileVersion(input2.readFile(lockPath) ?? "");
|
|
11167
|
+
if (version !== null && version <= BUILD_BUN_MAX_LOCKFILE_VERSION)
|
|
11168
|
+
continue;
|
|
11169
|
+
const isBuildLock = root !== null && lockPath === `${root}bun.lock`;
|
|
11170
|
+
if (!dispatch) {
|
|
11171
|
+
if (version !== null) {
|
|
11172
|
+
warnings.push(lockfileFinding(lockPath, version, `this app is built by Cloudflare Pages, not by the Launchpad build. Its Pages project sets BUN_VERSION ${BUILD_BUN_VERSION} unless the app overrides it, and Cloudflare's build image decides how it installs, so this check cannot prove a failure. If the Pages build fails at the install, this lockfile is the likely cause.`));
|
|
11173
|
+
}
|
|
11174
|
+
continue;
|
|
11175
|
+
}
|
|
11176
|
+
if (!installPossible)
|
|
11177
|
+
continue;
|
|
11178
|
+
if (isBuildLock && manager === "other")
|
|
11179
|
+
continue;
|
|
11180
|
+
if (version === null) {
|
|
11181
|
+
if (isBuildLock) {
|
|
11182
|
+
warnings.push({
|
|
11183
|
+
found: `could not read "lockfileVersion" in ${lockPath}`,
|
|
11184
|
+
why: `the delivery build installs with bun ${BUILD_BUN_VERSION}, which reads lockfileVersion ${BUILD_BUN_MAX_LOCKFILE_VERSION} or older. If the build fails at "Install dependencies", this lockfile is the likely cause.`,
|
|
11185
|
+
fix: `rewrite the lockfile with bun ${BUILD_BUN_VERSION}, then deploy again:`,
|
|
11186
|
+
command: REGENERATE_LOCKFILE_COMMAND
|
|
11187
|
+
});
|
|
11188
|
+
}
|
|
11189
|
+
continue;
|
|
11190
|
+
}
|
|
11191
|
+
const proven = isBuildLock && installProven && pkgPresent && manager === "bun" && !workspaceAbove;
|
|
11192
|
+
if (proven) {
|
|
11193
|
+
errors.push(lockfileFinding(lockPath, version, `the delivery build runs \`bun install --frozen-lockfile\` with bun ${BUILD_BUN_VERSION} on this file, which cannot read it, so the build fails at "Install dependencies" and the app is left failed.`));
|
|
11194
|
+
} else {
|
|
11195
|
+
warnings.push(lockfileFinding(lockPath, version, isBuildLock ? `if the delivery build installs with bun (it does when there is a build command or a functions/ folder and package.json names no other package manager), bun ${BUILD_BUN_VERSION} cannot read this file and the build fails at "Install dependencies".` : `the delivery build installs at the build root (${root === null || root === "" ? "." : root.slice(0, -1)}), so it may not use this file; if bun ${BUILD_BUN_VERSION} does read it, the build fails at "Install dependencies".`));
|
|
11196
|
+
}
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
var BUILTINS = new Set(builtinModules);
|
|
11200
|
+
function packageNameOf(specifier) {
|
|
11201
|
+
if (specifier === "" || specifier.startsWith(".") || specifier.startsWith("/"))
|
|
11202
|
+
return null;
|
|
11203
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(specifier))
|
|
11204
|
+
return null;
|
|
11205
|
+
const parts = specifier.split("/");
|
|
11206
|
+
const name = specifier.startsWith("@") ? parts.length >= 2 && parts[0] !== "@" && parts[1] !== "" ? `${parts[0]}/${parts[1]}` : null : parts[0];
|
|
11207
|
+
if (name === null || BUILTINS.has(name))
|
|
11208
|
+
return null;
|
|
11209
|
+
return name;
|
|
11210
|
+
}
|
|
11211
|
+
var LOCAL_EXTENSIONS = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts", ".json", ".d.ts"];
|
|
11212
|
+
function isPathAlias(specifier, aliases) {
|
|
11213
|
+
if (specifier.startsWith("~") || specifier.startsWith("#") || specifier.startsWith("@/"))
|
|
11214
|
+
return true;
|
|
11215
|
+
if (aliases === undefined)
|
|
11216
|
+
return false;
|
|
11217
|
+
for (const key of aliases.pathKeys) {
|
|
11218
|
+
if (key.endsWith("*") ? specifier.startsWith(key.slice(0, -1)) : specifier === key)
|
|
11219
|
+
return true;
|
|
11220
|
+
}
|
|
11221
|
+
for (const base of aliases.baseDirs) {
|
|
11222
|
+
const local = base === "" ? specifier : `${base}/${specifier}`;
|
|
11223
|
+
if (LOCAL_EXTENSIONS.some((ext) => aliases.files.has(`${local}${ext}`)))
|
|
11224
|
+
return true;
|
|
11225
|
+
const asDir = `${local}/`;
|
|
11226
|
+
if ([...aliases.files].some((f) => f.startsWith(asDir)))
|
|
11227
|
+
return true;
|
|
11228
|
+
const first = specifier.split("/")[0];
|
|
11229
|
+
const firstDir = base === "" ? `${first}/` : `${base}/${first}/`;
|
|
11230
|
+
if (specifier.includes("/") && [...aliases.files].some((f) => f.startsWith(firstDir)))
|
|
11231
|
+
return true;
|
|
11232
|
+
}
|
|
11233
|
+
return false;
|
|
11234
|
+
}
|
|
11235
|
+
function isTypeOnlyClause(clause) {
|
|
11236
|
+
const c = clause.trim();
|
|
11237
|
+
if (/^type\s+\S/.test(c))
|
|
11238
|
+
return true;
|
|
11239
|
+
const named = /^\{([\s\S]*)\}$/.exec(c);
|
|
11240
|
+
if (named === null)
|
|
11241
|
+
return false;
|
|
11242
|
+
const parts = named[1].split(",").map((p) => p.trim()).filter((p) => p !== "");
|
|
11243
|
+
return parts.length > 0 && parts.every((p) => /^type\s+\S/.test(p));
|
|
11244
|
+
}
|
|
11245
|
+
function extractBarePackageImports(source, aliases) {
|
|
11246
|
+
const code = source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"'`\\])\/\/[^\n]*/g, "$1");
|
|
11247
|
+
const specifiers = [];
|
|
11248
|
+
const fromRe = /\b(?:import|export)\s+([^;'"`]*?)\s*\bfrom\s*["']([^"']+)["']/g;
|
|
11249
|
+
const sideEffectRe = /\bimport\s*["']([^"']+)["']/g;
|
|
11250
|
+
const callRe = /\b(?:import|require)\s*\(\s*["']([^"']+)["']\s*\)/g;
|
|
11251
|
+
for (const m of code.matchAll(fromRe)) {
|
|
11252
|
+
if (isTypeOnlyClause(m[1]))
|
|
11253
|
+
continue;
|
|
11254
|
+
specifiers.push(m[2]);
|
|
11255
|
+
}
|
|
11256
|
+
for (const m of code.matchAll(sideEffectRe))
|
|
11257
|
+
specifiers.push(m[1]);
|
|
11258
|
+
for (const m of code.matchAll(callRe))
|
|
11259
|
+
specifiers.push(m[1]);
|
|
11260
|
+
const names = [];
|
|
11261
|
+
for (const s of specifiers) {
|
|
11262
|
+
if (isPathAlias(s, aliases))
|
|
11263
|
+
continue;
|
|
11264
|
+
const name = packageNameOf(s);
|
|
11265
|
+
if (name !== null && !names.includes(name))
|
|
11266
|
+
names.push(name);
|
|
11267
|
+
}
|
|
11268
|
+
return names;
|
|
11269
|
+
}
|
|
11270
|
+
function declaredPackages(packageJsonText) {
|
|
11271
|
+
const parsed = parsePackageJson(packageJsonText);
|
|
11272
|
+
if (parsed === null)
|
|
11273
|
+
return null;
|
|
11274
|
+
const out = new Set;
|
|
11275
|
+
for (const key of ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]) {
|
|
11276
|
+
const block = parsed[key];
|
|
11277
|
+
if (block !== null && typeof block === "object" && !Array.isArray(block)) {
|
|
11278
|
+
for (const name of Object.keys(block))
|
|
11279
|
+
out.add(name);
|
|
11280
|
+
}
|
|
11281
|
+
}
|
|
11282
|
+
return out;
|
|
11283
|
+
}
|
|
11284
|
+
function bunAddCommand(packages) {
|
|
11285
|
+
return `npx --yes bun@${BUILD_BUN_VERSION} add ${packages.join(" ")}`;
|
|
11286
|
+
}
|
|
11287
|
+
var CATCHALL_RE = /^functions\/api\/\[\[[^/\]]+\]\](?:\/index)?\.(?:[jt]sx?|mjs)$/;
|
|
11288
|
+
function aliasConfigFor(filePath, input2) {
|
|
11289
|
+
const pathKeys = [];
|
|
11290
|
+
const baseDirs = [];
|
|
11291
|
+
const dir = dirPrefixOf(filePath);
|
|
11292
|
+
for (const prefix of [dir, ...ancestorPrefixes(dir)]) {
|
|
11293
|
+
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
11294
|
+
const path8 = `${prefix}${name}`;
|
|
11295
|
+
if (!input2.files.has(path8))
|
|
11296
|
+
continue;
|
|
11297
|
+
const text2 = input2.readFile(path8);
|
|
11298
|
+
if (text2 === null)
|
|
11299
|
+
continue;
|
|
11300
|
+
let opts = null;
|
|
11301
|
+
try {
|
|
11302
|
+
const parsed = parseJsonc(text2);
|
|
11303
|
+
const co = parsed?.compilerOptions;
|
|
11304
|
+
opts = co !== null && typeof co === "object" ? co : null;
|
|
11305
|
+
} catch {
|
|
11306
|
+
continue;
|
|
11307
|
+
}
|
|
11308
|
+
if (opts === null)
|
|
11309
|
+
continue;
|
|
11310
|
+
const paths = opts["paths"];
|
|
11311
|
+
if (paths !== null && typeof paths === "object" && !Array.isArray(paths))
|
|
11312
|
+
pathKeys.push(...Object.keys(paths));
|
|
11313
|
+
const baseUrl = opts["baseUrl"];
|
|
11314
|
+
if (typeof baseUrl === "string") {
|
|
11315
|
+
const base = posix.normalize(posix.join(prefix === "" ? "." : prefix, baseUrl));
|
|
11316
|
+
baseDirs.push(base === "." ? "" : base.replace(/\/$/, ""));
|
|
11317
|
+
}
|
|
11318
|
+
}
|
|
11319
|
+
}
|
|
11320
|
+
return { pathKeys, baseDirs, files: input2.files };
|
|
11321
|
+
}
|
|
11322
|
+
function checkRouterDependencies(input2, errors, warnings) {
|
|
11323
|
+
const root = input2.buildRoot;
|
|
11324
|
+
const catchallsUnder = (prefix) => [...input2.files].filter((f) => f.startsWith(prefix) && CATCHALL_RE.test(f.slice(prefix.length))).sort();
|
|
11325
|
+
const searchRoots = [...new Set([root ?? input2.appRootPrefix, input2.appRootPrefix])];
|
|
11326
|
+
let routerPath;
|
|
11327
|
+
for (const prefix of searchRoots) {
|
|
11328
|
+
const found = catchallsUnder(prefix);
|
|
11329
|
+
if (found.length > 0) {
|
|
11330
|
+
routerPath = found.includes(`${prefix}${SEEDED_API_ROUTER_PATH}`) ? `${prefix}${SEEDED_API_ROUTER_PATH}` : found[0];
|
|
11331
|
+
break;
|
|
11332
|
+
}
|
|
11333
|
+
}
|
|
11334
|
+
const shipsOwnRouter = routerPath !== undefined || [...input2.files].some((f) => /(^|\/)functions\/api\/\[\[/.test(f));
|
|
11335
|
+
const pkgPath = `${root ?? input2.appRootPrefix}package.json`;
|
|
11336
|
+
const pkgText = input2.files.has(pkgPath) ? input2.readFile(pkgPath) : null;
|
|
11337
|
+
if (input2.files.has(pkgPath) && pkgText === null)
|
|
11338
|
+
return;
|
|
11339
|
+
const declared = pkgText === null ? null : declaredPackages(pkgText);
|
|
11340
|
+
const hoisted = new Map;
|
|
11341
|
+
for (const prefix of ancestorPrefixes(dirPrefixOf(pkgPath))) {
|
|
11342
|
+
const path8 = `${prefix}package.json`;
|
|
11343
|
+
const text2 = input2.files.has(path8) ? input2.readFile(path8) : null;
|
|
11344
|
+
const pkgs = text2 === null ? null : declaredPackages(text2);
|
|
11345
|
+
for (const name of pkgs ?? [])
|
|
11346
|
+
if (!hoisted.has(name))
|
|
11347
|
+
hoisted.set(name, path8);
|
|
11348
|
+
}
|
|
11349
|
+
for (const outer of input2.outerPackageJsons ?? []) {
|
|
11350
|
+
for (const name of declaredPackages(outer.text) ?? [])
|
|
11351
|
+
if (!hoisted.has(name))
|
|
11352
|
+
hoisted.set(name, outer.label);
|
|
11353
|
+
}
|
|
11354
|
+
if (pkgText !== null && declared === null) {
|
|
11355
|
+
const finding = {
|
|
11356
|
+
found: `${pkgPath} is not valid JSON`,
|
|
11357
|
+
why: "the delivery build reads package.json (to choose the package manager and install) before anything else, so it stops at its first step.",
|
|
11358
|
+
fix: `make ${pkgPath} valid JSON (no comments, no trailing commas), then deploy again. To find the error:`,
|
|
11359
|
+
command: `node -e "JSON.parse(require('fs').readFileSync('${pkgPath}','utf8'))"`
|
|
11360
|
+
};
|
|
11361
|
+
(root !== null ? errors : warnings).push(finding);
|
|
11362
|
+
return;
|
|
11363
|
+
}
|
|
11364
|
+
if (shipsOwnRouter) {
|
|
11365
|
+
if (routerPath === undefined)
|
|
11366
|
+
return;
|
|
11367
|
+
const source = input2.readFile(routerPath);
|
|
11368
|
+
if (source === null)
|
|
11369
|
+
return;
|
|
11370
|
+
const required = extractBarePackageImports(source, aliasConfigFor(routerPath, input2));
|
|
11371
|
+
const missing2 = required.filter((n) => declared === null || !declared.has(n));
|
|
11372
|
+
const notHoisted2 = missing2.filter((n) => !hoisted.has(n));
|
|
11373
|
+
if (notHoisted2.length === 0)
|
|
11374
|
+
return;
|
|
11375
|
+
warnings.push({
|
|
11376
|
+
found: pkgText === null ? `no ${pkgPath} in the deploy bundle; ${routerPath} imports ${notHoisted2.join(", ")}` : `${pkgPath} does not list ${notHoisted2.join(", ")}, imported by ${routerPath}`,
|
|
11377
|
+
why: `the delivery build compiles ${routerPath} into the app's Worker and fails with "Could not resolve" if a package is not installed. If this name is a path alias or vendored code, ignore this warning.`,
|
|
11378
|
+
fix: pkgText === null ? "create package.json with the packages (or, if it exists, add it to app.include), then deploy again:" : "add the packages, then deploy again:",
|
|
11379
|
+
command: bunAddCommand(notHoisted2)
|
|
11380
|
+
});
|
|
11381
|
+
return;
|
|
11382
|
+
}
|
|
11383
|
+
const missing = SEEDED_API_ROUTER_PACKAGES.filter((n) => declared === null || !declared.has(n));
|
|
11384
|
+
if (missing.length === 0)
|
|
11385
|
+
return;
|
|
11386
|
+
const notHoisted = missing.filter((n) => !hoisted.has(n));
|
|
11387
|
+
const hoistedOnly = missing.filter((n) => hoisted.has(n));
|
|
11388
|
+
const provable = root === "" && input2.appRootPrefix === "";
|
|
11389
|
+
const where = `${SEEDED_API_ROUTER_PATH} (the API router the platform adds to every react+api app)`;
|
|
11390
|
+
if (notHoisted.length > 0) {
|
|
11391
|
+
const finding = {
|
|
11392
|
+
found: pkgText === null ? `this react+api app has no package.json in the deploy bundle, and ${where} imports ${notHoisted.join(", ")}` : `${pkgPath} does not list ${notHoisted.join(", ")}, imported by ${where}`,
|
|
11393
|
+
why: `the delivery build installs from package.json and compiles that router into the app's Worker; without ${notHoisted.join(" and ")} it fails with "Could not resolve".`,
|
|
11394
|
+
fix: pkgText === null ? "create package.json with the packages (or, if it exists, add it to app.include), then deploy again:" : "add the packages, then deploy again:",
|
|
11395
|
+
command: bunAddCommand(notHoisted)
|
|
11396
|
+
};
|
|
11397
|
+
(provable ? errors : warnings).push(finding);
|
|
11398
|
+
}
|
|
11399
|
+
if (hoistedOnly.length > 0) {
|
|
11400
|
+
const sources = [...new Set(hoistedOnly.map((n) => hoisted.get(n)))].join(", ");
|
|
11401
|
+
warnings.push({
|
|
11402
|
+
found: `${pkgPath} does not list ${hoistedOnly.join(", ")} (imported by ${where}); only ${sources} lists ${hoistedOnly.length === 1 ? "it" : "them"}`,
|
|
11403
|
+
why: "the delivery build installs from the app's own package.json in the app repo; a package listed only in a workspace root outside the bundle is not installed there.",
|
|
11404
|
+
fix: "add the packages to the app's package.json, then deploy again:",
|
|
11405
|
+
command: bunAddCommand(hoistedOnly)
|
|
11406
|
+
});
|
|
11407
|
+
}
|
|
11408
|
+
}
|
|
11409
|
+
function evaluateDeployPreflight(input2) {
|
|
11410
|
+
const errors = [];
|
|
11411
|
+
const warnings = [];
|
|
11412
|
+
if (input2.appType === "container")
|
|
11413
|
+
return { errors, warnings };
|
|
11414
|
+
checkLockfiles(input2, errors, warnings);
|
|
11415
|
+
if (input2.appType === "react+api" && input2.origin === "dispatch") {
|
|
11416
|
+
checkRouterDependencies(input2, errors, warnings);
|
|
11417
|
+
}
|
|
11418
|
+
return { errors, warnings };
|
|
11419
|
+
}
|
|
11420
|
+
function manifestFacts(manifest) {
|
|
11421
|
+
const raw = manifest;
|
|
11422
|
+
const isV22 = raw?.apiVersion === "launchpad.m-kopa.us/v2";
|
|
11423
|
+
const t = isV22 ? raw?.spec?.appType : raw?.deployment?.type;
|
|
11424
|
+
const appType = typeof t === "string" ? t : null;
|
|
11425
|
+
if (!isV22)
|
|
11426
|
+
return { appType, origin: "pages", buildRoot: null, buildCommand: null };
|
|
11427
|
+
const o = raw?.spec?.origin;
|
|
11428
|
+
const origin = o === undefined ? "pages" : typeof o === "string" ? o : null;
|
|
11429
|
+
const build = raw?.spec?.build;
|
|
11430
|
+
if (build !== undefined && (build === null || typeof build !== "object" || Array.isArray(build))) {
|
|
11431
|
+
return { appType, origin, buildRoot: null, buildCommand: null };
|
|
11432
|
+
}
|
|
11433
|
+
const b = build ?? {};
|
|
11434
|
+
const cmd = b["command"];
|
|
11435
|
+
const buildCommand = cmd === undefined ? "" : typeof cmd === "string" ? cmd : null;
|
|
11436
|
+
const rd = b["root_dir"];
|
|
11437
|
+
let buildRoot = null;
|
|
11438
|
+
if (rd === undefined || rd === "")
|
|
11439
|
+
buildRoot = "";
|
|
11440
|
+
else if (typeof rd === "string" && !posix.isAbsolute(rd) && !rd.includes("..")) {
|
|
11441
|
+
const n = posix.normalize(rd).replace(/\/+$/, "");
|
|
11442
|
+
buildRoot = n === "." || n === "" ? "" : `${n.replace(/^\.\//, "")}/`;
|
|
11443
|
+
}
|
|
11444
|
+
return { appType, origin, buildRoot, buildCommand };
|
|
11445
|
+
}
|
|
11446
|
+
function rootPrefixOf(manifest) {
|
|
11447
|
+
const input2 = extractBoundaryInput(manifest);
|
|
11448
|
+
if (input2.kind === "schema-error")
|
|
11449
|
+
return "";
|
|
11450
|
+
const root = resolveAppBoundary({ appType: input2.appType, app: input2.app }).root;
|
|
11451
|
+
return root === "." ? "" : `${root}/`;
|
|
11452
|
+
}
|
|
11453
|
+
var MAX_PREFLIGHT_READ_BYTES = 8 * 1024 * 1024;
|
|
11454
|
+
function readSmallFile(abs) {
|
|
11455
|
+
try {
|
|
11456
|
+
const stat = lstatSync3(abs);
|
|
11457
|
+
if (!stat.isFile() || stat.size > MAX_PREFLIGHT_READ_BYTES)
|
|
11458
|
+
return null;
|
|
11459
|
+
return readFileSync13(abs, "utf8");
|
|
11460
|
+
} catch {
|
|
11461
|
+
return null;
|
|
11462
|
+
}
|
|
11463
|
+
}
|
|
11464
|
+
function outerPackageJsonsOf(cwd) {
|
|
11465
|
+
if (existsSync9(join11(cwd, ".git")))
|
|
11466
|
+
return [];
|
|
11467
|
+
const found = [];
|
|
11468
|
+
let dir = cwd;
|
|
11469
|
+
for (let depth = 0;depth < 8; depth += 1) {
|
|
11470
|
+
const parent = dirname6(dir);
|
|
11471
|
+
if (parent === dir)
|
|
11472
|
+
return [];
|
|
11473
|
+
dir = parent;
|
|
11474
|
+
const text2 = readSmallFile(join11(dir, "package.json"));
|
|
11475
|
+
if (text2 !== null)
|
|
11476
|
+
found.push({ label: relative3(cwd, join11(dir, "package.json")), text: text2 });
|
|
11477
|
+
if (existsSync9(join11(dir, ".git")))
|
|
11478
|
+
return found;
|
|
11479
|
+
}
|
|
11480
|
+
return [];
|
|
11481
|
+
}
|
|
11482
|
+
function runDeployPreflight(cwd, manifestYaml, io, options = {}) {
|
|
11483
|
+
let manifest;
|
|
11484
|
+
try {
|
|
11485
|
+
manifest = parseYaml9(manifestYaml);
|
|
11486
|
+
} catch {
|
|
11487
|
+
return null;
|
|
11488
|
+
}
|
|
11489
|
+
let files;
|
|
11490
|
+
try {
|
|
11491
|
+
const walk = walkCwd(cwd);
|
|
11492
|
+
const boundary = applyBoundaryToFiles({ cwd, manifestYaml, files: walk.files });
|
|
11493
|
+
if (boundary.kind === "error")
|
|
11494
|
+
return null;
|
|
11495
|
+
files = new Set(boundary.files);
|
|
11496
|
+
} catch {
|
|
11497
|
+
return null;
|
|
11498
|
+
}
|
|
11499
|
+
let outerPackageJsons = [];
|
|
11500
|
+
try {
|
|
11501
|
+
outerPackageJsons = outerPackageJsonsOf(cwd);
|
|
11502
|
+
} catch {
|
|
11503
|
+
outerPackageJsons = [];
|
|
11504
|
+
}
|
|
11505
|
+
const result = evaluateDeployPreflight({
|
|
11506
|
+
...manifestFacts(manifest),
|
|
11507
|
+
appRootPrefix: rootPrefixOf(manifest),
|
|
11508
|
+
files,
|
|
11509
|
+
readFile: (rel) => readSmallFile(join11(cwd, rel)),
|
|
11510
|
+
outerPackageJsons
|
|
11511
|
+
});
|
|
11512
|
+
const blocks = [
|
|
11513
|
+
...result.warnings.map((w) => renderFinding(w, "warning")),
|
|
11514
|
+
...result.errors.map((e) => renderFinding(e, options.allowFailure === true ? "allowed" : "error"))
|
|
11515
|
+
];
|
|
11516
|
+
blocks.forEach((lines, i) => {
|
|
11517
|
+
if (i > 0)
|
|
11518
|
+
io.err("");
|
|
11519
|
+
for (const line of lines)
|
|
11520
|
+
io.err(line);
|
|
11521
|
+
});
|
|
11522
|
+
if (result.errors.length === 0 || options.allowFailure === true)
|
|
11523
|
+
return null;
|
|
11524
|
+
return 1;
|
|
11525
|
+
}
|
|
11526
|
+
|
|
10892
11527
|
// src/manifest/container-filesystem.ts
|
|
10893
|
-
import { lstatSync as
|
|
10894
|
-
import { dirname as
|
|
11528
|
+
import { lstatSync as lstatSync4, realpathSync } from "node:fs";
|
|
11529
|
+
import { dirname as dirname7, join as join12, relative as relative4, resolve as resolve9, sep as sep2 } from "node:path";
|
|
10895
11530
|
function validateContainerFilesystem(manifestPath, capability) {
|
|
10896
|
-
const root = realpathSync(
|
|
11531
|
+
const root = realpathSync(dirname7(manifestPath));
|
|
10897
11532
|
const segments = capability.container.image.slice(2).split("/");
|
|
10898
11533
|
let current = root;
|
|
10899
11534
|
for (const segment of segments) {
|
|
10900
|
-
current =
|
|
11535
|
+
current = join12(current, segment);
|
|
10901
11536
|
let stat;
|
|
10902
11537
|
try {
|
|
10903
|
-
stat =
|
|
11538
|
+
stat = lstatSync4(current);
|
|
10904
11539
|
} catch (error) {
|
|
10905
|
-
return failure("container_image_unreadable",
|
|
11540
|
+
return failure("container_image_unreadable", relative4(root, current), `cannot inspect container image path: ${describe17(error)}`);
|
|
10906
11541
|
}
|
|
10907
11542
|
if (stat.isSymbolicLink()) {
|
|
10908
|
-
return failure("container_image_symlink",
|
|
11543
|
+
return failure("container_image_symlink", relative4(root, current), "container image path must not contain symbolic links");
|
|
10909
11544
|
}
|
|
10910
11545
|
}
|
|
10911
11546
|
let finalPath;
|
|
10912
11547
|
try {
|
|
10913
11548
|
finalPath = realpathSync(current);
|
|
10914
11549
|
} catch (error) {
|
|
10915
|
-
return failure("container_image_unreadable",
|
|
11550
|
+
return failure("container_image_unreadable", relative4(root, current), `cannot resolve container image path: ${describe17(error)}`);
|
|
10916
11551
|
}
|
|
10917
11552
|
const rootPrefix = resolve9(root) + sep2;
|
|
10918
11553
|
if (!resolve9(finalPath).startsWith(rootPrefix)) {
|
|
10919
11554
|
return failure("container_image_outside_repository", capability.container.image, "container image resolves outside the app repository");
|
|
10920
11555
|
}
|
|
10921
|
-
if (!
|
|
11556
|
+
if (!lstatSync4(finalPath).isFile()) {
|
|
10922
11557
|
return failure("container_image_not_regular_file", capability.container.image, "container image must resolve to a regular Dockerfile");
|
|
10923
11558
|
}
|
|
10924
11559
|
return { kind: "ok", dockerfilePath: finalPath };
|
|
@@ -10965,7 +11600,7 @@ function rejectUnsupportedCliRuntime(args) {
|
|
|
10965
11600
|
}
|
|
10966
11601
|
|
|
10967
11602
|
// src/commands/migrate.ts
|
|
10968
|
-
import { closeSync, existsSync as
|
|
11603
|
+
import { closeSync, existsSync as existsSync10, lstatSync as lstatSync5, mkdirSync as mkdirSync2, mkdtempSync, openSync, readdirSync as readdirSync2, readFileSync as readFileSync14, renameSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
10969
11604
|
import path8 from "node:path";
|
|
10970
11605
|
import { stringify } from "yaml";
|
|
10971
11606
|
|
|
@@ -11404,8 +12039,8 @@ function secretsNextStep(secrets) {
|
|
|
11404
12039
|
}
|
|
11405
12040
|
async function convertToDispatch(cwd, dryRun) {
|
|
11406
12041
|
const file = path8.join(cwd, "launchpad.yaml");
|
|
11407
|
-
const regularFile =
|
|
11408
|
-
const original =
|
|
12042
|
+
const regularFile = lstatSync5(file).isFile();
|
|
12043
|
+
const original = readFileSync14(file, "utf8");
|
|
11409
12044
|
const loaded = parseManifestAnyVersion(original, file);
|
|
11410
12045
|
if (loaded.kind !== "ok")
|
|
11411
12046
|
throw new InvalidManifestError;
|
|
@@ -11537,7 +12172,7 @@ function runtimeRoots(cwd, appRootDir, build) {
|
|
|
11537
12172
|
function assertNoUncompiledCode(root, appType) {
|
|
11538
12173
|
const api = appType === "react+api";
|
|
11539
12174
|
for (const name of api ? ["_worker.js"] : ["_worker.js", "functions"]) {
|
|
11540
|
-
if (
|
|
12175
|
+
if (existsSync10(path8.join(root, name))) {
|
|
11541
12176
|
throw new Error(`${name} needs a runtime review before conversion. Pages Functions and custom Worker code must not be dropped. Ask the platform team to review this app.`);
|
|
11542
12177
|
}
|
|
11543
12178
|
}
|
|
@@ -11545,11 +12180,11 @@ function assertNoUncompiledCode(root, appType) {
|
|
|
11545
12180
|
assertWorkerRoutesFit(root);
|
|
11546
12181
|
}
|
|
11547
12182
|
function wranglerRuntimes(cwd, root) {
|
|
11548
|
-
return WRANGLER_FILES.map((name) => path8.join(root, name)).filter((file) =>
|
|
12183
|
+
return WRANGLER_FILES.map((name) => path8.join(root, name)).filter((file) => existsSync10(file)).map((file) => wranglerRuntime(path8.relative(cwd, file), readFileSync14(file, "utf8")));
|
|
11549
12184
|
}
|
|
11550
12185
|
function assertWorkerRoutesFit(root) {
|
|
11551
12186
|
const functions = path8.join(root, "functions");
|
|
11552
|
-
if (!
|
|
12187
|
+
if (!existsSync10(functions) || !lstatSync5(functions).isDirectory())
|
|
11553
12188
|
return;
|
|
11554
12189
|
const catchAll = readdirSync2(functions).find((name) => /^_middleware\.[cm]?[jt]sx?$/.test(name) || name.startsWith("["));
|
|
11555
12190
|
if (catchAll !== undefined) {
|
|
@@ -11557,10 +12192,10 @@ function assertWorkerRoutesFit(root) {
|
|
|
11557
12192
|
}
|
|
11558
12193
|
}
|
|
11559
12194
|
function saveMigration(file, original, converted) {
|
|
11560
|
-
if (
|
|
12195
|
+
if (readFileSync14(file, "utf8") !== original)
|
|
11561
12196
|
throw new Error("launchpad.yaml changed during the check. Retry migration.");
|
|
11562
12197
|
const backupDir = path8.join(path8.dirname(file), ".launchpad");
|
|
11563
|
-
if (
|
|
12198
|
+
if (existsSync10(backupDir) && !lstatSync5(backupDir).isDirectory()) {
|
|
11564
12199
|
throw new Error(".launchpad must be a regular directory, not a symlink or file.");
|
|
11565
12200
|
}
|
|
11566
12201
|
mkdirSync2(backupDir, { recursive: true });
|
|
@@ -11577,7 +12212,7 @@ function saveMigration(file, original, converted) {
|
|
|
11577
12212
|
}
|
|
11578
12213
|
const temporary = path8.join(attemptDir, "launchpad.yaml");
|
|
11579
12214
|
writeFileSync2(temporary, stringify(converted), { flag: "wx", mode: 384 });
|
|
11580
|
-
if (
|
|
12215
|
+
if (readFileSync14(file, "utf8") !== original)
|
|
11581
12216
|
throw new Error("launchpad.yaml changed during migration. Retry migration.");
|
|
11582
12217
|
renameSync(temporary, file);
|
|
11583
12218
|
} catch (error) {
|
|
@@ -11664,12 +12299,13 @@ async function runDeploy(args, io) {
|
|
|
11664
12299
|
}
|
|
11665
12300
|
const cwd = process.cwd();
|
|
11666
12301
|
const manifestPath = path9.join(cwd, "launchpad.yaml");
|
|
11667
|
-
if (
|
|
12302
|
+
if (existsSync11(manifestPath)) {
|
|
11668
12303
|
const contentMode = flags.mode.kind === "content" ? flags.mode : {
|
|
11669
12304
|
allowStale: false,
|
|
11670
12305
|
rebaseOntoHead: false,
|
|
11671
12306
|
overrideStale: null,
|
|
11672
|
-
allowUnguarded: false
|
|
12307
|
+
allowUnguarded: false,
|
|
12308
|
+
allowPreflightFailure: false
|
|
11673
12309
|
};
|
|
11674
12310
|
return runModelADeploy({
|
|
11675
12311
|
cwd,
|
|
@@ -11680,6 +12316,7 @@ async function runDeploy(args, io) {
|
|
|
11680
12316
|
rebaseOntoHead: contentMode.rebaseOntoHead,
|
|
11681
12317
|
overrideStale: contentMode.overrideStale,
|
|
11682
12318
|
allowUnguarded: contentMode.allowUnguarded,
|
|
12319
|
+
allowPreflightFailure: contentMode.allowPreflightFailure,
|
|
11683
12320
|
noOpen: flags.noOpen === true
|
|
11684
12321
|
});
|
|
11685
12322
|
}
|
|
@@ -11719,9 +12356,9 @@ async function runDeploy(args, io) {
|
|
|
11719
12356
|
}
|
|
11720
12357
|
let contentManifestYaml = null;
|
|
11721
12358
|
const contentManifestPath = path9.join(process.cwd(), "launchpad.yaml");
|
|
11722
|
-
if (
|
|
12359
|
+
if (existsSync11(contentManifestPath)) {
|
|
11723
12360
|
try {
|
|
11724
|
-
contentManifestYaml =
|
|
12361
|
+
contentManifestYaml = readFileSync15(contentManifestPath, "utf8");
|
|
11725
12362
|
} catch {
|
|
11726
12363
|
contentManifestYaml = null;
|
|
11727
12364
|
}
|
|
@@ -11809,7 +12446,7 @@ async function runDeploy(args, io) {
|
|
|
11809
12446
|
}
|
|
11810
12447
|
}
|
|
11811
12448
|
function deployUsage() {
|
|
11812
|
-
return `usage: launchpad deploy [--message <text>] [--slug <slug>] [--allow-unguarded] [--no-open]
|
|
12449
|
+
return `usage: launchpad deploy [--message <text>] [--slug <slug>] [--allow-unguarded] [--allow-preflight-failure] [--no-open]
|
|
11813
12450
|
` + ` (slug comes from launchpad.yaml at cwd when present — Model A —
|
|
11814
12451
|
` + " else from the current directory's `launchpad-app-<slug>` suffix)\n" + `
|
|
11815
12452
|
` + `provisioning modes:
|
|
@@ -11965,7 +12602,7 @@ function withTimeout(p, ms) {
|
|
|
11965
12602
|
async function surfaceManifestDiff(cfg, slug, manifestPath, io) {
|
|
11966
12603
|
let localYaml;
|
|
11967
12604
|
try {
|
|
11968
|
-
localYaml =
|
|
12605
|
+
localYaml = readFileSync15(manifestPath, "utf8");
|
|
11969
12606
|
} catch {
|
|
11970
12607
|
return;
|
|
11971
12608
|
}
|
|
@@ -12015,6 +12652,13 @@ async function runModelADeploy(args) {
|
|
|
12015
12652
|
let appType = "static";
|
|
12016
12653
|
let declaredOrigin;
|
|
12017
12654
|
let manifestIsV2 = false;
|
|
12655
|
+
try {
|
|
12656
|
+
const stop = runDeployPreflight(cwd, readFileSync15(manifestPath, "utf8"), io, {
|
|
12657
|
+
allowFailure: args.allowPreflightFailure === true
|
|
12658
|
+
});
|
|
12659
|
+
if (stop !== null)
|
|
12660
|
+
return stop;
|
|
12661
|
+
} catch {}
|
|
12018
12662
|
try {
|
|
12019
12663
|
await defaultToDispatch(cwd, manifestPath, io);
|
|
12020
12664
|
} catch (e) {
|
|
@@ -12034,7 +12678,7 @@ async function runModelADeploy(args) {
|
|
|
12034
12678
|
return 1;
|
|
12035
12679
|
}
|
|
12036
12680
|
try {
|
|
12037
|
-
const manifestObj =
|
|
12681
|
+
const manifestObj = parseYaml10(readFileSync15(manifestPath, "utf8"));
|
|
12038
12682
|
const metaSlug = resolveManifestSlug(manifestObj);
|
|
12039
12683
|
if (metaSlug === null) {
|
|
12040
12684
|
io.err(`launchpad deploy: launchpad.yaml is missing metadata.slug (v2) / metadata.name (v1). ` + `Run \`launchpad init\` again to regenerate the manifest.`);
|
|
@@ -12522,7 +13166,7 @@ function impliesPagesForGateway(fields) {
|
|
|
12522
13166
|
function originFields(manifestPath) {
|
|
12523
13167
|
let raw;
|
|
12524
13168
|
try {
|
|
12525
|
-
raw =
|
|
13169
|
+
raw = parseYaml10(readFileSync15(manifestPath, "utf8")) ?? {};
|
|
12526
13170
|
} catch {
|
|
12527
13171
|
return {};
|
|
12528
13172
|
}
|
|
@@ -12801,8 +13445,8 @@ function describe19(e) {
|
|
|
12801
13445
|
}
|
|
12802
13446
|
|
|
12803
13447
|
// src/commands/generate.ts
|
|
12804
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
12805
|
-
import { dirname as
|
|
13448
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync3 } from "node:fs";
|
|
13449
|
+
import { dirname as dirname8, resolve as resolve10, relative as relative5 } from "node:path";
|
|
12806
13450
|
var generateCommand = {
|
|
12807
13451
|
name: "generate",
|
|
12808
13452
|
summary: "emit derived runtime artefacts from launchpad.yaml",
|
|
@@ -12829,7 +13473,7 @@ async function runGenerate(args, io) {
|
|
|
12829
13473
|
});
|
|
12830
13474
|
if (unsupported2 !== null)
|
|
12831
13475
|
return unsupported2;
|
|
12832
|
-
const appRoot =
|
|
13476
|
+
const appRoot = dirname8(manifestPath);
|
|
12833
13477
|
const wranglerPath = resolve10(appRoot, "container", "wrangler.toml");
|
|
12834
13478
|
const workerPath = resolve10(appRoot, "container", "worker", "index.ts");
|
|
12835
13479
|
const workflowPath = resolve10(appRoot, ".github", "workflows", "deploy.yml");
|
|
@@ -12881,7 +13525,7 @@ function applyOne(artefact, path11, out, force) {
|
|
|
12881
13525
|
};
|
|
12882
13526
|
}
|
|
12883
13527
|
try {
|
|
12884
|
-
mkdirSync3(
|
|
13528
|
+
mkdirSync3(dirname8(path11), { recursive: true });
|
|
12885
13529
|
writeFileSync3(path11, out.content, "utf8");
|
|
12886
13530
|
return {
|
|
12887
13531
|
artefact,
|
|
@@ -12906,7 +13550,7 @@ function applyOne(artefact, path11, out, force) {
|
|
|
12906
13550
|
}
|
|
12907
13551
|
function readIfExists(path11) {
|
|
12908
13552
|
try {
|
|
12909
|
-
return { kind: "ok", content:
|
|
13553
|
+
return { kind: "ok", content: readFileSync16(path11, "utf8") };
|
|
12910
13554
|
} catch (err) {
|
|
12911
13555
|
const e = err;
|
|
12912
13556
|
if (e.code === "ENOENT")
|
|
@@ -12917,7 +13561,7 @@ function readIfExists(path11) {
|
|
|
12917
13561
|
function renderDryRun(inputs, appRoot, json, io) {
|
|
12918
13562
|
if (json) {
|
|
12919
13563
|
const files = inputs.map((i) => {
|
|
12920
|
-
const previewPath = i.preview === undefined ?
|
|
13564
|
+
const previewPath = i.preview === undefined ? relative5(appRoot, i.path) : i.path;
|
|
12921
13565
|
if (i.result.kind === "not-applicable" || i.result.kind === "unsupported") {
|
|
12922
13566
|
return {
|
|
12923
13567
|
artefact: i.artefact,
|
|
@@ -12945,7 +13589,7 @@ function renderDryRun(inputs, appRoot, json, io) {
|
|
|
12945
13589
|
io.out("");
|
|
12946
13590
|
continue;
|
|
12947
13591
|
}
|
|
12948
|
-
const headerPath = i.preview === undefined ?
|
|
13592
|
+
const headerPath = i.preview === undefined ? relative5(appRoot, i.path) : i.path;
|
|
12949
13593
|
const header = i.preview === undefined ? `--- ${headerPath} ---` : `--- [preview, destination = ${i.preview.destination}] ${headerPath} ---`;
|
|
12950
13594
|
io.out(header);
|
|
12951
13595
|
io.out(i.result.content);
|
|
@@ -12964,20 +13608,20 @@ function renderApplyHuman(reports, appRoot, io) {
|
|
|
12964
13608
|
const a = r.action;
|
|
12965
13609
|
switch (a.kind) {
|
|
12966
13610
|
case "written":
|
|
12967
|
-
io.out(`✓ ${r.artefact} — wrote ${a.bytes} bytes to ${
|
|
13611
|
+
io.out(`✓ ${r.artefact} — wrote ${a.bytes} bytes to ${relative5(appRoot, a.path)}`);
|
|
12968
13612
|
break;
|
|
12969
13613
|
case "unchanged":
|
|
12970
|
-
io.out(`= ${r.artefact} — unchanged (${
|
|
13614
|
+
io.out(`= ${r.artefact} — unchanged (${relative5(appRoot, a.path)})`);
|
|
12971
13615
|
break;
|
|
12972
13616
|
case "would-overwrite":
|
|
12973
|
-
io.err(`! ${r.artefact} — exists with different content (${
|
|
13617
|
+
io.err(`! ${r.artefact} — exists with different content (${relative5(appRoot, a.path)}); re-run with --force to overwrite`);
|
|
12974
13618
|
wouldOverwrite++;
|
|
12975
13619
|
break;
|
|
12976
13620
|
case "not-applicable":
|
|
12977
13621
|
io.out(`- ${r.artefact} — skipped (${a.reason})`);
|
|
12978
13622
|
break;
|
|
12979
13623
|
case "write-error":
|
|
12980
|
-
io.err(`✗ ${r.artefact} — ${a.message} (${
|
|
13624
|
+
io.err(`✗ ${r.artefact} — ${a.message} (${relative5(appRoot, a.path)})`);
|
|
12981
13625
|
writeError++;
|
|
12982
13626
|
break;
|
|
12983
13627
|
}
|
|
@@ -12996,17 +13640,17 @@ function renderApplyJson(reports, appRoot, io) {
|
|
|
12996
13640
|
const base = { artefact: r.artefact, warnings: r.warnings };
|
|
12997
13641
|
switch (a.kind) {
|
|
12998
13642
|
case "written":
|
|
12999
|
-
return { ...base, kind: a.kind, path:
|
|
13643
|
+
return { ...base, kind: a.kind, path: relative5(appRoot, a.path), bytes: a.bytes };
|
|
13000
13644
|
case "unchanged":
|
|
13001
13645
|
case "would-overwrite":
|
|
13002
|
-
return { ...base, kind: a.kind, path:
|
|
13646
|
+
return { ...base, kind: a.kind, path: relative5(appRoot, a.path) };
|
|
13003
13647
|
case "not-applicable":
|
|
13004
13648
|
return { ...base, kind: a.kind, reason: a.reason };
|
|
13005
13649
|
case "write-error":
|
|
13006
13650
|
return {
|
|
13007
13651
|
...base,
|
|
13008
13652
|
kind: a.kind,
|
|
13009
|
-
path:
|
|
13653
|
+
path: relative5(appRoot, a.path),
|
|
13010
13654
|
message: a.message
|
|
13011
13655
|
};
|
|
13012
13656
|
}
|
|
@@ -13645,17 +14289,17 @@ function describe22(e) {
|
|
|
13645
14289
|
|
|
13646
14290
|
// src/commands/init.ts
|
|
13647
14291
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
13648
|
-
import { existsSync as
|
|
13649
|
-
import { dirname as
|
|
14292
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync6, readFileSync as readFileSync18, writeFileSync as writeFileSync6 } from "node:fs";
|
|
14293
|
+
import { dirname as dirname11, resolve as resolve13 } from "node:path";
|
|
13650
14294
|
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
13651
14295
|
|
|
13652
14296
|
// src/detect/index.ts
|
|
13653
|
-
import { existsSync as
|
|
13654
|
-
import { join as
|
|
14297
|
+
import { existsSync as existsSync12, readFileSync as readFileSync17, statSync } from "node:fs";
|
|
14298
|
+
import { join as join14 } from "node:path";
|
|
13655
14299
|
function detectAppShape(cwd) {
|
|
13656
|
-
const hasPackageJson =
|
|
13657
|
-
const hasAnyLockfile = LOCKFILES.some(({ file }) =>
|
|
13658
|
-
const hasViteConfig = VITE_CONFIG_NAMES.some((n) =>
|
|
14300
|
+
const hasPackageJson = existsSync12(join14(cwd, "package.json"));
|
|
14301
|
+
const hasAnyLockfile = LOCKFILES.some(({ file }) => existsSync12(join14(cwd, file)));
|
|
14302
|
+
const hasViteConfig = VITE_CONFIG_NAMES.some((n) => existsSync12(join14(cwd, n)));
|
|
13659
14303
|
if (!hasPackageJson && !hasAnyLockfile && !hasViteConfig) {
|
|
13660
14304
|
return {
|
|
13661
14305
|
kind: "not-applicable",
|
|
@@ -13701,7 +14345,7 @@ var LOCKFILES = [
|
|
|
13701
14345
|
{ file: "yarn.lock", pm: "yarn" }
|
|
13702
14346
|
];
|
|
13703
14347
|
function detectPackageManager(cwd) {
|
|
13704
|
-
const present = LOCKFILES.filter(({ file }) =>
|
|
14348
|
+
const present = LOCKFILES.filter(({ file }) => existsSync12(join14(cwd, file)));
|
|
13705
14349
|
if (present.length === 0) {
|
|
13706
14350
|
return {
|
|
13707
14351
|
kind: "ambiguous",
|
|
@@ -13723,8 +14367,8 @@ function detectPackageManager(cwd) {
|
|
|
13723
14367
|
}
|
|
13724
14368
|
function detectVitePresence(cwd) {
|
|
13725
14369
|
for (const name of VITE_CONFIG_NAMES) {
|
|
13726
|
-
const p =
|
|
13727
|
-
if (
|
|
14370
|
+
const p = join14(cwd, name);
|
|
14371
|
+
if (existsSync12(p)) {
|
|
13728
14372
|
return { kind: "ok", value: { path: p } };
|
|
13729
14373
|
}
|
|
13730
14374
|
}
|
|
@@ -13734,9 +14378,9 @@ function detectVitePresence(cwd) {
|
|
|
13734
14378
|
};
|
|
13735
14379
|
}
|
|
13736
14380
|
function detectAppType(cwd) {
|
|
13737
|
-
const fnDir =
|
|
14381
|
+
const fnDir = join14(cwd, "functions");
|
|
13738
14382
|
let hasFunctionsDir = false;
|
|
13739
|
-
if (
|
|
14383
|
+
if (existsSync12(fnDir)) {
|
|
13740
14384
|
try {
|
|
13741
14385
|
hasFunctionsDir = statSync(fnDir).isDirectory();
|
|
13742
14386
|
} catch {
|
|
@@ -13746,8 +14390,8 @@ function detectAppType(cwd) {
|
|
|
13746
14390
|
return { kind: "ok", value: hasFunctionsDir ? "react+api" : "react" };
|
|
13747
14391
|
}
|
|
13748
14392
|
function detectBuildCommand(cwd, pm) {
|
|
13749
|
-
const pkgJsonPath =
|
|
13750
|
-
if (!
|
|
14393
|
+
const pkgJsonPath = join14(cwd, "package.json");
|
|
14394
|
+
if (!existsSync12(pkgJsonPath)) {
|
|
13751
14395
|
return {
|
|
13752
14396
|
kind: "ambiguous",
|
|
13753
14397
|
reason: "no package.json at repo root. Run your package manager's `init` first."
|
|
@@ -13755,7 +14399,7 @@ function detectBuildCommand(cwd, pm) {
|
|
|
13755
14399
|
}
|
|
13756
14400
|
let pkgJson;
|
|
13757
14401
|
try {
|
|
13758
|
-
pkgJson = JSON.parse(
|
|
14402
|
+
pkgJson = JSON.parse(readFileSync17(pkgJsonPath, "utf8"));
|
|
13759
14403
|
} catch (e) {
|
|
13760
14404
|
return {
|
|
13761
14405
|
kind: "ambiguous",
|
|
@@ -13790,7 +14434,7 @@ var OUT_DIR_REGEX = /\bbuild\s*:\s*\{[^{}]*?\boutDir\s*:\s*['"]([^'"]+)['"]/s;
|
|
|
13790
14434
|
function detectDestinationDir(cwd, vite) {
|
|
13791
14435
|
let text2;
|
|
13792
14436
|
try {
|
|
13793
|
-
text2 =
|
|
14437
|
+
text2 = readFileSync17(vite.path, "utf8");
|
|
13794
14438
|
} catch (e) {
|
|
13795
14439
|
return {
|
|
13796
14440
|
kind: "ambiguous",
|
|
@@ -13805,8 +14449,8 @@ function detectDestinationDir(cwd, vite) {
|
|
|
13805
14449
|
}
|
|
13806
14450
|
|
|
13807
14451
|
// src/scaffold/secure-api-template.ts
|
|
13808
|
-
import { existsSync as
|
|
13809
|
-
import { dirname as
|
|
14452
|
+
import { existsSync as existsSync13, lstatSync as lstatSync6, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
14453
|
+
import { dirname as dirname9, join as join15, resolve as resolve11 } from "node:path";
|
|
13810
14454
|
var SECURE_API_LIB_PATH = "functions/_lib/secure-api.ts";
|
|
13811
14455
|
var SECURE_API_ROUTER_PATH = "functions/api/[[path]].ts";
|
|
13812
14456
|
var SECURE_API_TEST_PATH = "tests/secure-api.test.ts";
|
|
@@ -14123,10 +14767,10 @@ function attestationJson(input2) {
|
|
|
14123
14767
|
function symlinkOnPath(baseDir, rel) {
|
|
14124
14768
|
let cur = resolve11(baseDir);
|
|
14125
14769
|
for (const part of rel.split("/")) {
|
|
14126
|
-
cur =
|
|
14770
|
+
cur = join15(cur, part);
|
|
14127
14771
|
let st;
|
|
14128
14772
|
try {
|
|
14129
|
-
st =
|
|
14773
|
+
st = lstatSync6(cur);
|
|
14130
14774
|
} catch {
|
|
14131
14775
|
return false;
|
|
14132
14776
|
}
|
|
@@ -14151,11 +14795,11 @@ function writeSecureApiScaffold(baseDir, attestation) {
|
|
|
14151
14795
|
continue;
|
|
14152
14796
|
}
|
|
14153
14797
|
const abs = resolve11(baseDir, rel);
|
|
14154
|
-
if (
|
|
14798
|
+
if (existsSync13(abs)) {
|
|
14155
14799
|
kept.push(rel);
|
|
14156
14800
|
continue;
|
|
14157
14801
|
}
|
|
14158
|
-
mkdirSync4(
|
|
14802
|
+
mkdirSync4(dirname9(abs), { recursive: true });
|
|
14159
14803
|
writeFileSync4(abs, text2, { encoding: "utf8", flag: "wx" });
|
|
14160
14804
|
written.push(rel);
|
|
14161
14805
|
}
|
|
@@ -14168,6 +14812,492 @@ function writeAttestation(baseDir, attestation) {
|
|
|
14168
14812
|
return true;
|
|
14169
14813
|
}
|
|
14170
14814
|
|
|
14815
|
+
// src/scaffold/react-api-starter.ts
|
|
14816
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
14817
|
+
import { dirname as dirname10, resolve as resolve12 } from "node:path";
|
|
14818
|
+
|
|
14819
|
+
// src/scaffold/react-api-starter-files.ts
|
|
14820
|
+
var PACKAGE_JSON = `{
|
|
14821
|
+
"name": "launchpad-app",
|
|
14822
|
+
"private": true,
|
|
14823
|
+
"type": "module",
|
|
14824
|
+
"scripts": {
|
|
14825
|
+
"build": "vite build",
|
|
14826
|
+
"test": "vitest run --passWithNoTests --dir functions"
|
|
14827
|
+
},
|
|
14828
|
+
"dependencies": {
|
|
14829
|
+
"@m-kopa/platform-auth": "0.7.0",
|
|
14830
|
+
"hono": "4.13.16",
|
|
14831
|
+
"react": "19.3.1",
|
|
14832
|
+
"react-dom": "19.3.1"
|
|
14833
|
+
},
|
|
14834
|
+
"devDependencies": {
|
|
14835
|
+
"@cloudflare/workers-types": "4.20260501.1",
|
|
14836
|
+
"typescript": "5.9.3",
|
|
14837
|
+
"vite": "8.3.8",
|
|
14838
|
+
"vitest": "4.1.12"
|
|
14839
|
+
}
|
|
14840
|
+
}
|
|
14841
|
+
`;
|
|
14842
|
+
var BUN_LOCK = `{
|
|
14843
|
+
"lockfileVersion": 1,
|
|
14844
|
+
"configVersion": 1,
|
|
14845
|
+
"workspaces": {
|
|
14846
|
+
"": {
|
|
14847
|
+
"name": "launchpad-app",
|
|
14848
|
+
"dependencies": {
|
|
14849
|
+
"@m-kopa/platform-auth": "0.7.0",
|
|
14850
|
+
"hono": "4.13.16",
|
|
14851
|
+
"react": "19.3.1",
|
|
14852
|
+
"react-dom": "19.3.1",
|
|
14853
|
+
},
|
|
14854
|
+
"devDependencies": {
|
|
14855
|
+
"@cloudflare/workers-types": "4.20260501.1",
|
|
14856
|
+
"typescript": "5.9.3",
|
|
14857
|
+
"vite": "8.3.8",
|
|
14858
|
+
"vitest": "4.1.12",
|
|
14859
|
+
},
|
|
14860
|
+
},
|
|
14861
|
+
},
|
|
14862
|
+
"packages": {
|
|
14863
|
+
"@cloudflare/workers-types": ["@cloudflare/workers-types@4.20260501.1", "", {}, "sha512-B/VX2w3my/sCqxKyWOX7SxUpFC1uD8Gh7I2zbI1d3zA8p7Tx03AFsnuEx8lYLmcd8yONAA93YsAZb1wAaLK83w=="],
|
|
14864
|
+
|
|
14865
|
+
"@emnapi/core": ["@emnapi/core@2.0.0-beta.2", "", { "dependencies": { "@emnapi/wasi-threads": "2.2.0", "tslib": "^2.4.0" } }, "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A=="],
|
|
14866
|
+
|
|
14867
|
+
"@emnapi/runtime": ["@emnapi/runtime@2.0.0-beta.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw=="],
|
|
14868
|
+
|
|
14869
|
+
"@emnapi/wasi-threads": ["@emnapi/wasi-threads@2.2.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw=="],
|
|
14870
|
+
|
|
14871
|
+
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="],
|
|
14872
|
+
|
|
14873
|
+
"@m-kopa/platform-auth": ["@m-kopa/platform-auth@0.7.0", "", { "dependencies": { "jose": "6.2.3" }, "peerDependencies": { "hono": ">=4.12.25 <5" }, "optionalPeers": ["hono"] }, "sha512-uJjYJRSkDn7qgznaARdVixz9KfF/MwU2dIi1rEvF+sRSY1fL8JwjKTl9IO13YQ3MwtncO5dPZE2jF+cJL66FXw=="],
|
|
14874
|
+
|
|
14875
|
+
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.6", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" } }, "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw=="],
|
|
14876
|
+
|
|
14877
|
+
"@oxc-project/types": ["@oxc-project/types@0.156.0", "", {}, "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw=="],
|
|
14878
|
+
|
|
14879
|
+
"@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.19", "", { "os": "android", "cpu": "arm" }, "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A=="],
|
|
14880
|
+
|
|
14881
|
+
"@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.19", "", { "os": "android", "cpu": "arm64" }, "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA=="],
|
|
14882
|
+
|
|
14883
|
+
"@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.19", "", { "os": "darwin", "cpu": "arm64" }, "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g=="],
|
|
14884
|
+
|
|
14885
|
+
"@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.19", "", { "os": "darwin", "cpu": "x64" }, "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg=="],
|
|
14886
|
+
|
|
14887
|
+
"@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.19", "", { "os": "freebsd", "cpu": "x64" }, "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA=="],
|
|
14888
|
+
|
|
14889
|
+
"@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.19", "", { "os": "linux", "cpu": "arm" }, "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw=="],
|
|
14890
|
+
|
|
14891
|
+
"@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.19", "", { "os": "linux", "cpu": "arm64" }, "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA=="],
|
|
14892
|
+
|
|
14893
|
+
"@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.19", "", { "os": "linux", "cpu": "arm64" }, "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg=="],
|
|
14894
|
+
|
|
14895
|
+
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.19", "", { "os": "linux", "cpu": "ppc64" }, "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q=="],
|
|
14896
|
+
|
|
14897
|
+
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.19", "", { "os": "linux", "cpu": "s390x" }, "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw=="],
|
|
14898
|
+
|
|
14899
|
+
"@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.19", "", { "os": "linux", "cpu": "x64" }, "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q=="],
|
|
14900
|
+
|
|
14901
|
+
"@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.19", "", { "os": "linux", "cpu": "x64" }, "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A=="],
|
|
14902
|
+
|
|
14903
|
+
"@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.19", "", { "os": "none", "cpu": "arm64" }, "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA=="],
|
|
14904
|
+
|
|
14905
|
+
"@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.2.19", "", { "dependencies": { "@emnapi/core": "2.0.0-beta.2", "@emnapi/runtime": "2.0.0-beta.2", "@napi-rs/wasm-runtime": "1.2.6" }, "cpu": "none" }, "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg=="],
|
|
14906
|
+
|
|
14907
|
+
"@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.19", "", { "os": "win32", "cpu": "arm64" }, "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ=="],
|
|
14908
|
+
|
|
14909
|
+
"@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.19", "", { "os": "win32", "cpu": "x64" }, "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag=="],
|
|
14910
|
+
|
|
14911
|
+
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.1.1", "", {}, "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA=="],
|
|
14912
|
+
|
|
14913
|
+
"@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
|
14914
|
+
|
|
14915
|
+
"@tybys/wasm-util": ["@tybys/wasm-util@0.10.5", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA=="],
|
|
14916
|
+
|
|
14917
|
+
"@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="],
|
|
14918
|
+
|
|
14919
|
+
"@types/deep-eql": ["@types/deep-eql@4.0.2", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="],
|
|
14920
|
+
|
|
14921
|
+
"@types/estree": ["@types/estree@1.0.10", "", {}, "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g=="],
|
|
14922
|
+
|
|
14923
|
+
"@vitest/expect": ["@vitest/expect@4.1.12", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "@types/chai": "^5.2.2", "@vitest/spy": "4.1.12", "@vitest/utils": "4.1.12", "chai": "^6.2.2", "tinyrainbow": "^3.1.0" } }, "sha512-vFlTt+YEu9WBpNjdGayNmlMVzrWPi1+sv853/7t2FU7hpO5gAFBKHzQmkCq5Xjpr+evegF2994LQT3hF3mRlqQ=="],
|
|
14924
|
+
|
|
14925
|
+
"@vitest/mocker": ["@vitest/mocker@4.1.12", "", { "dependencies": { "@vitest/spy": "4.1.12", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-fKShNpKZzupWZuY0z7egydvL0sqW4INEZBEExMBMAa6izlENEVHwoXgdaTCaBZ5fwlr4xf2o1wXC83n9RpO+NA=="],
|
|
14926
|
+
|
|
14927
|
+
"@vitest/pretty-format": ["@vitest/pretty-format@4.1.12", "", { "dependencies": { "tinyrainbow": "^3.1.0" } }, "sha512-XW9O8+Mxx4VpCtkYdMJLZQQwsVryP9wk7cPKDxtXFfwSak6yRh5+2fep/Y0XF/ElBvJHq8bcYdi6aeuai0opZA=="],
|
|
14928
|
+
|
|
14929
|
+
"@vitest/runner": ["@vitest/runner@4.1.12", "", { "dependencies": { "@vitest/utils": "4.1.12", "pathe": "^2.0.3" } }, "sha512-NKlVKCr5QnCe8jijdMnmkpHHU+WTqiLFR6G0pHji9uRjXK9xJl1k1nTw6F3pOOj2PDcsDt2GKQMI7wIsaT491w=="],
|
|
14930
|
+
|
|
14931
|
+
"@vitest/snapshot": ["@vitest/snapshot@4.1.12", "", { "dependencies": { "@vitest/pretty-format": "4.1.12", "@vitest/utils": "4.1.12", "magic-string": "^0.30.21", "pathe": "^2.0.3" } }, "sha512-ko1y1Qgb/slzQ9mr+b89Cuqud8WG1TKtsPD8r7ZUBdvVOGt85Af2HwCqHujrhwJq95hs/9RM7fcAPg57o1vlzw=="],
|
|
14932
|
+
|
|
14933
|
+
"@vitest/spy": ["@vitest/spy@4.1.12", "", {}, "sha512-RGq9x4JNGNTZHEJxvN0oSiJjeSCExm0n2gZKKJZHY9cX5AVA6M7VJILBT3ZJ/tJ/0J9uWT7fETV9/btoi//vSg=="],
|
|
14934
|
+
|
|
14935
|
+
"@vitest/utils": ["@vitest/utils@4.1.12", "", { "dependencies": { "@vitest/pretty-format": "4.1.12", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.1.0" } }, "sha512-Q3awXrwOfEV+qc3WmO5ONyE0yO7Q1gQ9/oyHxGLZ/pl7N3NO/ZztqQwKLuwMkV+CA1JYSIeO3gkHnRDIo4AVaA=="],
|
|
14936
|
+
|
|
14937
|
+
"assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="],
|
|
14938
|
+
|
|
14939
|
+
"chai": ["chai@6.3.0", "", {}, "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg=="],
|
|
14940
|
+
|
|
14941
|
+
"convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
|
|
14942
|
+
|
|
14943
|
+
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
|
14944
|
+
|
|
14945
|
+
"es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="],
|
|
14946
|
+
|
|
14947
|
+
"estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
|
|
14948
|
+
|
|
14949
|
+
"expect-type": ["expect-type@1.4.0", "", {}, "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA=="],
|
|
14950
|
+
|
|
14951
|
+
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
|
14952
|
+
|
|
14953
|
+
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
|
14954
|
+
|
|
14955
|
+
"hono": ["hono@4.13.16", "", {}, "sha512-AOLOEhvrV+iH92xXCnFr/5+3KjPKcI3xP63XJtX5spAnkznPdHijlIsUTpi7/9EhWqrTCekw5c5zh1K+YsVw7A=="],
|
|
14956
|
+
|
|
14957
|
+
"jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="],
|
|
14958
|
+
|
|
14959
|
+
"lightningcss": ["lightningcss@1.33.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.33.0", "lightningcss-darwin-arm64": "1.33.0", "lightningcss-darwin-x64": "1.33.0", "lightningcss-freebsd-x64": "1.33.0", "lightningcss-linux-arm-gnueabihf": "1.33.0", "lightningcss-linux-arm64-gnu": "1.33.0", "lightningcss-linux-arm64-musl": "1.33.0", "lightningcss-linux-x64-gnu": "1.33.0", "lightningcss-linux-x64-musl": "1.33.0", "lightningcss-win32-arm64-msvc": "1.33.0", "lightningcss-win32-x64-msvc": "1.33.0" } }, "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA=="],
|
|
14960
|
+
|
|
14961
|
+
"lightningcss-android-arm64": ["lightningcss-android-arm64@1.33.0", "", { "os": "android", "cpu": "arm64" }, "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg=="],
|
|
14962
|
+
|
|
14963
|
+
"lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.33.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg=="],
|
|
14964
|
+
|
|
14965
|
+
"lightningcss-darwin-x64": ["lightningcss-darwin-x64@1.33.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ=="],
|
|
14966
|
+
|
|
14967
|
+
"lightningcss-freebsd-x64": ["lightningcss-freebsd-x64@1.33.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg=="],
|
|
14968
|
+
|
|
14969
|
+
"lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.33.0", "", { "os": "linux", "cpu": "arm" }, "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ=="],
|
|
14970
|
+
|
|
14971
|
+
"lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg=="],
|
|
14972
|
+
|
|
14973
|
+
"lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ=="],
|
|
14974
|
+
|
|
14975
|
+
"lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg=="],
|
|
14976
|
+
|
|
14977
|
+
"lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw=="],
|
|
14978
|
+
|
|
14979
|
+
"lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.33.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA=="],
|
|
14980
|
+
|
|
14981
|
+
"lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.33.0", "", { "os": "win32", "cpu": "x64" }, "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA=="],
|
|
14982
|
+
|
|
14983
|
+
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
|
14984
|
+
|
|
14985
|
+
"nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="],
|
|
14986
|
+
|
|
14987
|
+
"obug": ["obug@2.2.1", "", {}, "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q=="],
|
|
14988
|
+
|
|
14989
|
+
"pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
|
|
14990
|
+
|
|
14991
|
+
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
|
14992
|
+
|
|
14993
|
+
"picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="],
|
|
14994
|
+
|
|
14995
|
+
"postcss": ["postcss@8.5.33", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ=="],
|
|
14996
|
+
|
|
14997
|
+
"react": ["react@19.3.1", "", {}, "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw=="],
|
|
14998
|
+
|
|
14999
|
+
"react-dom": ["react-dom@19.3.1", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.1" } }, "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ=="],
|
|
15000
|
+
|
|
15001
|
+
"rolldown": ["rolldown@1.2.19", "", { "dependencies": { "@oxc-project/types": "=0.156.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.19", "@rolldown/binding-android-arm64": "1.2.19", "@rolldown/binding-darwin-arm64": "1.2.19", "@rolldown/binding-darwin-x64": "1.2.19", "@rolldown/binding-freebsd-x64": "1.2.19", "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", "@rolldown/binding-linux-arm64-gnu": "1.2.19", "@rolldown/binding-linux-arm64-musl": "1.2.19", "@rolldown/binding-linux-ppc64-gnu": "1.2.19", "@rolldown/binding-linux-s390x-gnu": "1.2.19", "@rolldown/binding-linux-x64-gnu": "1.2.19", "@rolldown/binding-linux-x64-musl": "1.2.19", "@rolldown/binding-openharmony-arm64": "1.2.19", "@rolldown/binding-wasm32-wasi": "1.2.19", "@rolldown/binding-win32-arm64-msvc": "1.2.19", "@rolldown/binding-win32-x64-msvc": "1.2.19" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA=="],
|
|
15002
|
+
|
|
15003
|
+
"scheduler": ["scheduler@0.28.0", "", {}, "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw=="],
|
|
15004
|
+
|
|
15005
|
+
"siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="],
|
|
15006
|
+
|
|
15007
|
+
"source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="],
|
|
15008
|
+
|
|
15009
|
+
"stackback": ["stackback@0.0.2", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="],
|
|
15010
|
+
|
|
15011
|
+
"std-env": ["std-env@4.3.0", "", {}, "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag=="],
|
|
15012
|
+
|
|
15013
|
+
"tinybench": ["tinybench@2.9.0", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="],
|
|
15014
|
+
|
|
15015
|
+
"tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="],
|
|
15016
|
+
|
|
15017
|
+
"tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="],
|
|
15018
|
+
|
|
15019
|
+
"tinyrainbow": ["tinyrainbow@3.2.0", "", {}, "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A=="],
|
|
15020
|
+
|
|
15021
|
+
"tslib": ["tslib@2.9.1", "", {}, "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA=="],
|
|
15022
|
+
|
|
15023
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
15024
|
+
|
|
15025
|
+
"vite": ["vite@8.3.8", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.32", "rolldown": "~1.2.18", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA=="],
|
|
15026
|
+
|
|
15027
|
+
"vitest": ["vitest@4.1.12", "", { "dependencies": { "@vitest/expect": "4.1.12", "@vitest/mocker": "4.1.12", "@vitest/pretty-format": "4.1.12", "@vitest/runner": "4.1.12", "@vitest/snapshot": "4.1.12", "@vitest/spy": "4.1.12", "@vitest/utils": "4.1.12", "es-module-lexer": "^2.0.0", "expect-type": "^1.3.0", "magic-string": "^0.30.21", "obug": "^2.1.1", "pathe": "^2.0.3", "picomatch": "^4.0.3", "std-env": "^4.0.0-rc.1", "tinybench": "^2.9.0", "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tinyrainbow": "^3.1.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", "why-is-node-running": "^2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "4.1.12", "@vitest/browser-preview": "4.1.12", "@vitest/browser-webdriverio": "^4.1.11", "@vitest/coverage-istanbul": "4.1.12", "@vitest/coverage-v8": "4.1.12", "@vitest/ui": "4.1.12", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-5eWdz2yb3ajxWF3C8C4TjkXl7FGm3n2E/VlazALrQHzK7nYMSGFnCZto0bbPNl77AwkOZVLk0YnBAejUu0NiWA=="],
|
|
15028
|
+
|
|
15029
|
+
"why-is-node-running": ["why-is-node-running@2.3.0", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" } }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="],
|
|
15030
|
+
}
|
|
15031
|
+
}
|
|
15032
|
+
`;
|
|
15033
|
+
var TSCONFIG_JSON = `{
|
|
15034
|
+
"compilerOptions": {
|
|
15035
|
+
"target": "ES2022",
|
|
15036
|
+
"module": "ESNext",
|
|
15037
|
+
"moduleResolution": "Bundler",
|
|
15038
|
+
"lib": ["ES2022"],
|
|
15039
|
+
"types": ["@cloudflare/workers-types"],
|
|
15040
|
+
"strict": true,
|
|
15041
|
+
"noEmit": true,
|
|
15042
|
+
"skipLibCheck": true
|
|
15043
|
+
},
|
|
15044
|
+
"include": ["functions"]
|
|
15045
|
+
}
|
|
15046
|
+
`;
|
|
15047
|
+
var API_ROUTER = `// Canonical Hono router for \`react+api\`-type Launchpad apps
|
|
15048
|
+
// (M-881 / T3, AC3).
|
|
15049
|
+
//
|
|
15050
|
+
// **Why a catch-all Pages Function?** Cloudflare Pages routes the
|
|
15051
|
+
// path \`[[path]]\` to this handler for every URL under
|
|
15052
|
+
// \`/functions/api/...\`, regardless of segment count or shape. That
|
|
15053
|
+
// keeps all API surface in one file (one Hono app, one auth
|
|
15054
|
+
// middleware, one error envelope) instead of a function-per-route
|
|
15055
|
+
// fan-out — the Hono router handles HTTP-method + path dispatch.
|
|
15056
|
+
//
|
|
15057
|
+
// **Auth.** Every route under \`/api/*\` is gated by the
|
|
15058
|
+
// \`@m-kopa/platform-auth/hono\` middleware. The middleware extracts
|
|
15059
|
+
// the gateway assertion (or the Access header for Access apps),
|
|
15060
|
+
// validates it (RS256 only,
|
|
15061
|
+
// exact iss + aud check, claim narrowing), and stores the typed
|
|
15062
|
+
// \`User\` on \`c.var.user\`. Unauthenticated requests get a 401 with
|
|
15063
|
+
// a typed \`code\` field (one of the \`ErrorCode\` union) — consumers
|
|
15064
|
+
// dispatch on it.
|
|
15065
|
+
//
|
|
15066
|
+
// **nodejs_compat.** This template REQUIRES
|
|
15067
|
+
// \`compatibility_flags = ["nodejs_compat"]\` in \`wrangler.toml\`
|
|
15068
|
+
// (per ADR-0011's react+api carve-out from ADR 0005). Hono's
|
|
15069
|
+
// stable APIs run clean under nodejs_compat; downstream consumers
|
|
15070
|
+
// that grow their own backend (e.g. \`pdf-lib\` for the audit
|
|
15071
|
+
// assistant) inherit the same opt-in.
|
|
15072
|
+
//
|
|
15073
|
+
// **Per-app extension.** Add new routes by extending \`app\` below;
|
|
15074
|
+
// keep the auth middleware as the FIRST \`.use()\` so every route
|
|
15075
|
+
// inherits it. App-specific dependencies (DB clients, Anthropic
|
|
15076
|
+
// SDKs, etc.) get instantiated in module scope so they're reused
|
|
15077
|
+
// across invocations within the same isolate.
|
|
15078
|
+
|
|
15079
|
+
import { Hono } from "hono";
|
|
15080
|
+
import { handle } from "hono/cloudflare-pages";
|
|
15081
|
+
import { createJwksCache } from "@m-kopa/platform-auth";
|
|
15082
|
+
import {
|
|
15083
|
+
createPlatformAuthMiddleware,
|
|
15084
|
+
type PlatformAuthVariables,
|
|
15085
|
+
} from "@m-kopa/platform-auth/hono";
|
|
15086
|
+
|
|
15087
|
+
/** Provisioned gateway names take precedence over legacy Access-named bindings. */
|
|
15088
|
+
interface Env {
|
|
15089
|
+
readonly GATEWAY_ISSUER?: string;
|
|
15090
|
+
readonly GATEWAY_AUD?: string;
|
|
15091
|
+
readonly GATEWAY_JWKS_URL?: string;
|
|
15092
|
+
readonly CF_ACCESS_TEAM_DOMAIN?: string;
|
|
15093
|
+
readonly CF_ACCESS_AUD?: string;
|
|
15094
|
+
readonly JWKS_URL?: string;
|
|
15095
|
+
}
|
|
15096
|
+
|
|
15097
|
+
/** Resolve the issuer's transport without changing the JWT trust checks. */
|
|
15098
|
+
function authConfig(env: Env) {
|
|
15099
|
+
const issuer = (env.GATEWAY_ISSUER || env.CF_ACCESS_TEAM_DOMAIN)?.replace(/\\/$/, "");
|
|
15100
|
+
const audience = env.GATEWAY_AUD || env.CF_ACCESS_AUD;
|
|
15101
|
+
if (!issuer || !audience) return null;
|
|
15102
|
+
let access: boolean;
|
|
15103
|
+
try {
|
|
15104
|
+
const hostname = new URL(issuer).hostname;
|
|
15105
|
+
access = !env.GATEWAY_ISSUER && hostname.endsWith(".cloudflareaccess.com");
|
|
15106
|
+
} catch {
|
|
15107
|
+
return null;
|
|
15108
|
+
}
|
|
15109
|
+
return {
|
|
15110
|
+
teamDomain: issuer,
|
|
15111
|
+
audience,
|
|
15112
|
+
header: access ? "cf-access" as const : "gateway" as const,
|
|
15113
|
+
jwksUrl: resolveJwksUrl(env, issuer, access),
|
|
15114
|
+
};
|
|
15115
|
+
}
|
|
15116
|
+
|
|
15117
|
+
/** Prefer the provisioned endpoint; discovery paths belong to the selected issuer. */
|
|
15118
|
+
function resolveJwksUrl(env: Env, issuer: string, access: boolean): string {
|
|
15119
|
+
return env.GATEWAY_JWKS_URL || env.JWKS_URL ||
|
|
15120
|
+
\`\${issuer}\${access ? "/cdn-cgi/access/certs" : "/.well-known/jwks.json"}\`;
|
|
15121
|
+
}
|
|
15122
|
+
|
|
15123
|
+
let cachedJwks: { url: string; getKey: ReturnType<typeof createJwksCache> } | undefined;
|
|
15124
|
+
|
|
15125
|
+
/** Reuse keys within an isolate, replacing the cache when its endpoint changes. */
|
|
15126
|
+
function jwks(url: string): ReturnType<typeof createJwksCache> {
|
|
15127
|
+
if (cachedJwks?.url !== url) cachedJwks = { url, getKey: createJwksCache(url) };
|
|
15128
|
+
return cachedJwks.getKey;
|
|
15129
|
+
}
|
|
15130
|
+
|
|
15131
|
+
// Hono app + auth middleware. \`basePath\` is \`/api\` so route
|
|
15132
|
+
// handlers below register paths like \`/health\` (matched as
|
|
15133
|
+
// \`/api/health\` once \`[[path]]\` claims the route).
|
|
15134
|
+
//
|
|
15135
|
+
// No \`Bindings\` type parameter: the platform-auth middleware is typed for
|
|
15136
|
+
// \`{ Variables }\` only, and Hono's context is invariant in its env, so a
|
|
15137
|
+
// typed \`Bindings\` makes the middleware call below fail \`tsc\`. Narrow
|
|
15138
|
+
// \`c.env\` at the point of use instead.
|
|
15139
|
+
const app = new Hono<{ Variables: PlatformAuthVariables }>()
|
|
15140
|
+
.basePath("/api");
|
|
15141
|
+
|
|
15142
|
+
app.use("*", async (c, next) => {
|
|
15143
|
+
const config = authConfig(c.env as Env);
|
|
15144
|
+
if (config === null) return c.json({ error: "auth_unconfigured" }, 503);
|
|
15145
|
+
const middleware = createPlatformAuthMiddleware({
|
|
15146
|
+
teamDomain: config.teamDomain,
|
|
15147
|
+
audience: config.audience,
|
|
15148
|
+
header: config.header,
|
|
15149
|
+
jwks: jwks(config.jwksUrl),
|
|
15150
|
+
});
|
|
15151
|
+
return middleware(c, next);
|
|
15152
|
+
});
|
|
15153
|
+
|
|
15154
|
+
// \`/api/health\` — liveness probe. Cheap; returns the
|
|
15155
|
+
// authenticated user's preferredUsername + the deploy SHA so
|
|
15156
|
+
// dashboards can confirm both the deploy and the auth path are
|
|
15157
|
+
// healthy in one shot.
|
|
15158
|
+
app.get("/health", (c) => {
|
|
15159
|
+
return c.json({
|
|
15160
|
+
status: "ok",
|
|
15161
|
+
user: c.get("user").preferredUsername,
|
|
15162
|
+
ts: new Date().toISOString(),
|
|
15163
|
+
});
|
|
15164
|
+
});
|
|
15165
|
+
|
|
15166
|
+
// \`/api/me\` — typed identity readout. Replaces the standalone
|
|
15167
|
+
// \`functions/api/me.ts\` from the \`react\` template; teams porting
|
|
15168
|
+
// from \`react\` to \`react+api\` delete the standalone file when
|
|
15169
|
+
// dropping the catch-all in.
|
|
15170
|
+
app.get("/me", (c) => {
|
|
15171
|
+
const user = c.get("user");
|
|
15172
|
+
return c.json({
|
|
15173
|
+
preferredUsername: user.preferredUsername,
|
|
15174
|
+
sub: user.sub,
|
|
15175
|
+
groups: user.groups,
|
|
15176
|
+
});
|
|
15177
|
+
});
|
|
15178
|
+
|
|
15179
|
+
// Default 404 envelope so callers don't get Hono's HTML 404 page.
|
|
15180
|
+
app.notFound((c) =>
|
|
15181
|
+
c.json({ error: "not_found", path: c.req.path }, 404),
|
|
15182
|
+
);
|
|
15183
|
+
|
|
15184
|
+
// Pages Functions handler shape — \`onRequest(context)\` is the
|
|
15185
|
+
// entry point Cloudflare invokes. Hono's Pages adapter passes
|
|
15186
|
+
// \`context.request\` and \`context.env\` to the router and builds a
|
|
15187
|
+
// proper execution context from the Pages event, which the event
|
|
15188
|
+
// itself does not satisfy at the type level.
|
|
15189
|
+
export const onRequest = handle(app);
|
|
15190
|
+
`;
|
|
15191
|
+
var INDEX_HTML = `<!doctype html>
|
|
15192
|
+
<html lang="en">
|
|
15193
|
+
<head>
|
|
15194
|
+
<meta charset="utf-8" />
|
|
15195
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
15196
|
+
<title>Launchpad app</title>
|
|
15197
|
+
</head>
|
|
15198
|
+
<body>
|
|
15199
|
+
<div id="root"></div>
|
|
15200
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
15201
|
+
</body>
|
|
15202
|
+
</html>
|
|
15203
|
+
`;
|
|
15204
|
+
var VITE_CONFIG_JS = `import { defineConfig } from "vite";
|
|
15205
|
+
|
|
15206
|
+
// React without a Vite plugin: Vite compiles .jsx with the automatic JSX
|
|
15207
|
+
// runtime. Output goes to dist/, which launchpad.yaml's spec.build serves.
|
|
15208
|
+
export default defineConfig({
|
|
15209
|
+
build: { outDir: "dist" },
|
|
15210
|
+
});
|
|
15211
|
+
`;
|
|
15212
|
+
var MAIN_JSX = `import { StrictMode, useEffect, useState } from "react";
|
|
15213
|
+
import { createRoot } from "react-dom/client";
|
|
15214
|
+
|
|
15215
|
+
// Starter page scaffolded by \`launchpad init\`. It calls the API router in
|
|
15216
|
+
// functions/api/[[path]].ts, which checks the signed-in user on every route.
|
|
15217
|
+
function App() {
|
|
15218
|
+
const [me, setMe] = useState(null);
|
|
15219
|
+
const [error, setError] = useState(null);
|
|
15220
|
+
|
|
15221
|
+
useEffect(() => {
|
|
15222
|
+
fetch("/api/me")
|
|
15223
|
+
.then((res) => (res.ok ? res.json() : Promise.reject(new Error(\`HTTP \${res.status}\`))))
|
|
15224
|
+
.then(setMe)
|
|
15225
|
+
.catch((err) => setError(String(err.message ?? err)));
|
|
15226
|
+
}, []);
|
|
15227
|
+
|
|
15228
|
+
return (
|
|
15229
|
+
<main>
|
|
15230
|
+
<h1>Launchpad app</h1>
|
|
15231
|
+
<p>Edit src/main.jsx for the page and functions/api/[[path]].ts for the API, then run launchpad deploy.</p>
|
|
15232
|
+
{me && <p>Signed in as {me.preferredUsername}</p>}
|
|
15233
|
+
{error && <p>Could not load /api/me: {error}</p>}
|
|
15234
|
+
</main>
|
|
15235
|
+
);
|
|
15236
|
+
}
|
|
15237
|
+
|
|
15238
|
+
createRoot(document.getElementById("root")).render(
|
|
15239
|
+
<StrictMode>
|
|
15240
|
+
<App />
|
|
15241
|
+
</StrictMode>,
|
|
15242
|
+
);
|
|
15243
|
+
`;
|
|
15244
|
+
var REACT_API_STARTER_FILES = [
|
|
15245
|
+
["package.json", PACKAGE_JSON],
|
|
15246
|
+
["bun.lock", BUN_LOCK],
|
|
15247
|
+
["tsconfig.json", TSCONFIG_JSON],
|
|
15248
|
+
["functions/api/[[path]].ts", API_ROUTER],
|
|
15249
|
+
["index.html", INDEX_HTML],
|
|
15250
|
+
["vite.config.js", VITE_CONFIG_JS],
|
|
15251
|
+
["src/main.jsx", MAIN_JSX]
|
|
15252
|
+
];
|
|
15253
|
+
|
|
15254
|
+
// src/scaffold/react-api-starter.ts
|
|
15255
|
+
var REACT_API_STARTER_BUILD = {
|
|
15256
|
+
command: "bun install --frozen-lockfile && bun run build",
|
|
15257
|
+
destination_dir: "dist",
|
|
15258
|
+
root_dir: ""
|
|
15259
|
+
};
|
|
15260
|
+
var EXISTING_APP_MARKERS = [
|
|
15261
|
+
"package.json",
|
|
15262
|
+
"bun.lock",
|
|
15263
|
+
"bun.lockb",
|
|
15264
|
+
"package-lock.json",
|
|
15265
|
+
"yarn.lock",
|
|
15266
|
+
"pnpm-lock.yaml",
|
|
15267
|
+
"vite.config.ts",
|
|
15268
|
+
"vite.config.js",
|
|
15269
|
+
"vite.config.mts",
|
|
15270
|
+
"vite.config.mjs"
|
|
15271
|
+
];
|
|
15272
|
+
function existingAppMarker(baseDir) {
|
|
15273
|
+
return EXISTING_APP_MARKERS.find((m) => existsSync14(resolve12(baseDir, m)));
|
|
15274
|
+
}
|
|
15275
|
+
function writeReactApiStarter(baseDir, skip = new Set) {
|
|
15276
|
+
const marker = existingAppMarker(baseDir);
|
|
15277
|
+
if (marker !== undefined)
|
|
15278
|
+
return { kind: "existing-app", marker };
|
|
15279
|
+
const written = [];
|
|
15280
|
+
const kept = [];
|
|
15281
|
+
const skippedSymlink = [];
|
|
15282
|
+
for (const [rel, text2] of REACT_API_STARTER_FILES) {
|
|
15283
|
+
if (skip.has(rel))
|
|
15284
|
+
continue;
|
|
15285
|
+
if (symlinkOnPath(baseDir, rel)) {
|
|
15286
|
+
skippedSymlink.push(rel);
|
|
15287
|
+
continue;
|
|
15288
|
+
}
|
|
15289
|
+
const abs = resolve12(baseDir, rel);
|
|
15290
|
+
if (existsSync14(abs)) {
|
|
15291
|
+
kept.push(rel);
|
|
15292
|
+
continue;
|
|
15293
|
+
}
|
|
15294
|
+
mkdirSync5(dirname10(abs), { recursive: true });
|
|
15295
|
+
writeFileSync5(abs, text2, { encoding: "utf8", flag: "wx" });
|
|
15296
|
+
written.push(rel);
|
|
15297
|
+
}
|
|
15298
|
+
return { kind: "written", written, kept, skippedSymlink };
|
|
15299
|
+
}
|
|
15300
|
+
|
|
14171
15301
|
// src/commands/init.ts
|
|
14172
15302
|
var SLUG_REGEX3 = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
14173
15303
|
var initCommand = {
|
|
@@ -14183,11 +15313,11 @@ async function runInit(args, io, prompt, identity = () => apiJson(loadConfig(),
|
|
|
14183
15313
|
return 64;
|
|
14184
15314
|
}
|
|
14185
15315
|
const { inputs, options } = parsed;
|
|
14186
|
-
const outPath =
|
|
15316
|
+
const outPath = resolve13(process.cwd(), options.out);
|
|
14187
15317
|
if (options.attestAuthz && !options.secureTemplate) {
|
|
14188
15318
|
return attestExistingScaffold(outPath, io, identity);
|
|
14189
15319
|
}
|
|
14190
|
-
if (
|
|
15320
|
+
if (existsSync15(outPath) && !options.force) {
|
|
14191
15321
|
io.err(`launchpad init: ${outPath} already exists`);
|
|
14192
15322
|
io.err("Pass --force to overwrite.");
|
|
14193
15323
|
return 64;
|
|
@@ -14245,7 +15375,11 @@ async function runInit(args, io, prompt, identity = () => apiJson(loadConfig(),
|
|
|
14245
15375
|
io.out(`Audience: selected Entra groups (${fillResult.inputs.groups.join(", ")}), plus platform administrators.`);
|
|
14246
15376
|
io.out("The deploy skill confirms company-wide grants with you. Sensitive apps also require browser confirmation and platform-admin approval.");
|
|
14247
15377
|
}
|
|
14248
|
-
const
|
|
15378
|
+
const baseDir = dirname11(outPath);
|
|
15379
|
+
const starterWanted = options.starter && fillResult.inputs.type === "react+api";
|
|
15380
|
+
const existingApp = starterWanted ? existingAppMarker(baseDir) : undefined;
|
|
15381
|
+
const writeStarter = starterWanted && existingApp === undefined;
|
|
15382
|
+
const manifest = buildManifest({ ...fillResult.inputs, ...privateOwner === undefined ? {} : { privateOwner } }, writeStarter ? { buildCommand: REACT_API_STARTER_BUILD.command, destinationDir: REACT_API_STARTER_BUILD.destination_dir, rootDir: "" } : detected, options.secureTemplate ? SECURE_TEMPLATE_INCLUDE : []);
|
|
14249
15383
|
const validation = manifest.apiVersion === "launchpad.m-kopa.us/v2" ? ManifestV2Schema.safeParse(manifest) : ManifestSchema.safeParse(manifest);
|
|
14250
15384
|
if (!validation.success) {
|
|
14251
15385
|
io.err("launchpad init: invalid manifest input");
|
|
@@ -14256,7 +15390,7 @@ async function runInit(args, io, prompt, identity = () => apiJson(loadConfig(),
|
|
|
14256
15390
|
}
|
|
14257
15391
|
const yamlText = renderYaml(manifest);
|
|
14258
15392
|
try {
|
|
14259
|
-
|
|
15393
|
+
writeFileSync6(outPath, yamlText, { encoding: "utf8" });
|
|
14260
15394
|
} catch (err) {
|
|
14261
15395
|
const e = err;
|
|
14262
15396
|
io.err(`launchpad init: failed to write ${outPath}`);
|
|
@@ -14265,7 +15399,7 @@ async function runInit(args, io, prompt, identity = () => apiJson(loadConfig(),
|
|
|
14265
15399
|
}
|
|
14266
15400
|
io.out(`✓ wrote ${outPath}`);
|
|
14267
15401
|
if (options.gitignore) {
|
|
14268
|
-
const gitignorePath =
|
|
15402
|
+
const gitignorePath = resolve13(process.cwd(), ".gitignore");
|
|
14269
15403
|
try {
|
|
14270
15404
|
const changed = ensureGitignoreEntries(gitignorePath, [".env", ".env.local"]);
|
|
14271
15405
|
if (changed.length > 0) {
|
|
@@ -14280,12 +15414,12 @@ async function runInit(args, io, prompt, identity = () => apiJson(loadConfig(),
|
|
|
14280
15414
|
}
|
|
14281
15415
|
}
|
|
14282
15416
|
if (fillResult.inputs.type === "static") {
|
|
14283
|
-
const serveDir =
|
|
14284
|
-
const indexPath =
|
|
14285
|
-
if (!
|
|
15417
|
+
const serveDir = resolve13(dirname11(outPath), STATIC_SERVE_DIR);
|
|
15418
|
+
const indexPath = resolve13(serveDir, "index.html");
|
|
15419
|
+
if (!existsSync15(indexPath)) {
|
|
14286
15420
|
try {
|
|
14287
|
-
|
|
14288
|
-
|
|
15421
|
+
mkdirSync6(serveDir, { recursive: true });
|
|
15422
|
+
writeFileSync6(indexPath, starterIndexHtml(fillResult.inputs.name), {
|
|
14289
15423
|
encoding: "utf8"
|
|
14290
15424
|
});
|
|
14291
15425
|
io.out(`✓ scaffolded ${indexPath}`);
|
|
@@ -14297,12 +15431,23 @@ async function runInit(args, io, prompt, identity = () => apiJson(loadConfig(),
|
|
|
14297
15431
|
}
|
|
14298
15432
|
}
|
|
14299
15433
|
if (options.secureTemplate) {
|
|
14300
|
-
const code = await scaffoldSecureTemplate(
|
|
15434
|
+
const code = await scaffoldSecureTemplate(baseDir, fillResult.inputs.owner, options, io, prompt, identity, writeStarter);
|
|
15435
|
+
if (code !== 0)
|
|
15436
|
+
return code;
|
|
15437
|
+
}
|
|
15438
|
+
if (existingApp !== undefined) {
|
|
15439
|
+
io.out(` starter app not written: ${existingApp} already exists here, so your app is kept as it is (--no-starter skips this check)`);
|
|
15440
|
+
} else if (writeStarter) {
|
|
15441
|
+
const code = scaffoldReactApiStarter(baseDir, options.secureTemplate, io);
|
|
14301
15442
|
if (code !== 0)
|
|
14302
15443
|
return code;
|
|
14303
15444
|
}
|
|
14304
15445
|
io.out("");
|
|
14305
15446
|
io.out("Next steps:");
|
|
15447
|
+
if (writeStarter) {
|
|
15448
|
+
io.out(" npx --yes bun@1.3.4 install # the delivery build uses bun 1.3.4; bun 1.4+ rewrites bun.lock in a format it cannot read");
|
|
15449
|
+
io.out(" npx --yes bun@1.3.4 run build # check the app builds to dist/");
|
|
15450
|
+
}
|
|
14306
15451
|
io.out(" launchpad validate # confirm the manifest");
|
|
14307
15452
|
io.out(" launchpad secrets template # scaffold .env.example");
|
|
14308
15453
|
io.out(" launchpad deploy # build and deploy the app");
|
|
@@ -14332,6 +15477,7 @@ function parseArgs6(args) {
|
|
|
14332
15477
|
let skipDetect = false;
|
|
14333
15478
|
let secureTemplate = false;
|
|
14334
15479
|
let attestAuthz = false;
|
|
15480
|
+
let starter = true;
|
|
14335
15481
|
for (let i = 0;i < args.length; i++) {
|
|
14336
15482
|
const a = args[i];
|
|
14337
15483
|
switch (a) {
|
|
@@ -14356,6 +15502,9 @@ function parseArgs6(args) {
|
|
|
14356
15502
|
case "--attest-authz":
|
|
14357
15503
|
attestAuthz = true;
|
|
14358
15504
|
continue;
|
|
15505
|
+
case "--no-starter":
|
|
15506
|
+
starter = false;
|
|
15507
|
+
continue;
|
|
14359
15508
|
default:
|
|
14360
15509
|
break;
|
|
14361
15510
|
}
|
|
@@ -14489,7 +15638,7 @@ function parseArgs6(args) {
|
|
|
14489
15638
|
return {
|
|
14490
15639
|
kind: "ok",
|
|
14491
15640
|
inputs,
|
|
14492
|
-
options: { force, nonInteractive, out, gitignore, skipDetect, secureTemplate, attestAuthz }
|
|
15641
|
+
options: { force, nonInteractive, out, gitignore, skipDetect, secureTemplate, attestAuthz, starter }
|
|
14493
15642
|
};
|
|
14494
15643
|
}
|
|
14495
15644
|
async function fillRequired(inputs, options, io, prompt) {
|
|
@@ -14742,7 +15891,7 @@ function reportAttestation(input2, io) {
|
|
|
14742
15891
|
io.out(` The owner (${input2.owner}) attests by running \`launchpad init --attest-authz\` here while signed in as themselves.`);
|
|
14743
15892
|
io.out(` Do not edit ${AUTHZ_ATTESTATION_PATH} by hand: only a record written from the owner's session counts.`);
|
|
14744
15893
|
}
|
|
14745
|
-
async function scaffoldSecureTemplate(baseDir, owner, options, io, prompt, identity) {
|
|
15894
|
+
async function scaffoldSecureTemplate(baseDir, owner, options, io, prompt, identity, starterDeps = false) {
|
|
14746
15895
|
let attests = options.attestAuthz;
|
|
14747
15896
|
if (!attests && !options.nonInteractive) {
|
|
14748
15897
|
io.out("");
|
|
@@ -14773,28 +15922,29 @@ async function scaffoldSecureTemplate(baseDir, owner, options, io, prompt, ident
|
|
|
14773
15922
|
io.err(` skipped ${p}: a symlink is on its path`);
|
|
14774
15923
|
if (result.written.includes(AUTHZ_ATTESTATION_PATH))
|
|
14775
15924
|
reportAttestation(attestation, io);
|
|
14776
|
-
|
|
15925
|
+
if (!starterDeps)
|
|
15926
|
+
io.out(" Install: npm install hono @m-kopa/platform-auth && npm install -D vitest");
|
|
14777
15927
|
io.out(" Set ROLE_WRITER_GROUP_IDS (Entra group object IDs) before the write route accepts anyone.");
|
|
14778
15928
|
io.out(" Run the guard test: npx vitest run tests/secure-api.test.ts");
|
|
14779
15929
|
return 0;
|
|
14780
15930
|
}
|
|
14781
15931
|
function existingStatus(path11) {
|
|
14782
15932
|
try {
|
|
14783
|
-
const record = JSON.parse(
|
|
15933
|
+
const record = JSON.parse(readFileSync18(path11, "utf8"));
|
|
14784
15934
|
return typeof record?.status === "string" ? record.status : undefined;
|
|
14785
15935
|
} catch {
|
|
14786
15936
|
return;
|
|
14787
15937
|
}
|
|
14788
15938
|
}
|
|
14789
15939
|
async function attestExistingScaffold(outPath, io, identity) {
|
|
14790
|
-
const baseDir =
|
|
14791
|
-
if (!
|
|
15940
|
+
const baseDir = dirname11(outPath);
|
|
15941
|
+
if (!existsSync15(resolve13(baseDir, AUTHZ_ATTESTATION_PATH))) {
|
|
14792
15942
|
io.err(`launchpad init: --attest-authz needs --secure-template, or an existing ${AUTHZ_ATTESTATION_PATH} beside the manifest`);
|
|
14793
15943
|
return 64;
|
|
14794
15944
|
}
|
|
14795
15945
|
let owner;
|
|
14796
15946
|
try {
|
|
14797
|
-
const manifest = yamlParse(
|
|
15947
|
+
const manifest = yamlParse(readFileSync18(outPath, "utf8"));
|
|
14798
15948
|
owner = manifest?.spec?.owner?.email ?? manifest?.metadata?.owner;
|
|
14799
15949
|
} catch (err) {
|
|
14800
15950
|
io.err(`launchpad init: cannot read ${outPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -14810,7 +15960,7 @@ async function attestExistingScaffold(outPath, io, identity) {
|
|
|
14810
15960
|
return 1;
|
|
14811
15961
|
}
|
|
14812
15962
|
const attestation = { owner, date: new Date().toISOString().slice(0, 10), attester };
|
|
14813
|
-
if (attestationStatus(attestation) !== "attested" && existingStatus(
|
|
15963
|
+
if (attestationStatus(attestation) !== "attested" && existingStatus(resolve13(baseDir, AUTHZ_ATTESTATION_PATH)) === "attested") {
|
|
14814
15964
|
reportAttestation(attestation, io);
|
|
14815
15965
|
io.err("launchpad init: the owner has already attested; not replaced");
|
|
14816
15966
|
return 1;
|
|
@@ -14827,10 +15977,31 @@ async function attestExistingScaffold(outPath, io, identity) {
|
|
|
14827
15977
|
reportAttestation(attestation, io);
|
|
14828
15978
|
return attestationStatus(attestation) === "attested" ? 0 : 1;
|
|
14829
15979
|
}
|
|
15980
|
+
function scaffoldReactApiStarter(baseDir, secureTemplate, io) {
|
|
15981
|
+
let result;
|
|
15982
|
+
try {
|
|
15983
|
+
result = writeReactApiStarter(baseDir, secureTemplate ? new Set([SECURE_API_ROUTER_PATH]) : new Set);
|
|
15984
|
+
} catch (err) {
|
|
15985
|
+
const e = err;
|
|
15986
|
+
io.err(`launchpad init: failed to write the react+api starter app: ${e.message ?? String(err)}`);
|
|
15987
|
+
return 2;
|
|
15988
|
+
}
|
|
15989
|
+
if (result.kind === "existing-app") {
|
|
15990
|
+
io.out(` starter app not written: ${result.marker} already exists here, so your app is kept as it is`);
|
|
15991
|
+
return 0;
|
|
15992
|
+
}
|
|
15993
|
+
for (const p of result.written)
|
|
15994
|
+
io.out(`✓ scaffolded ${p}`);
|
|
15995
|
+
for (const p of result.kept)
|
|
15996
|
+
io.out(` kept existing ${p} (not overwritten)`);
|
|
15997
|
+
for (const p of result.skippedSymlink)
|
|
15998
|
+
io.err(` skipped ${p}: a symlink is on its path`);
|
|
15999
|
+
return 0;
|
|
16000
|
+
}
|
|
14830
16001
|
function ensureGitignoreEntries(path11, entries) {
|
|
14831
16002
|
let current = "";
|
|
14832
|
-
if (
|
|
14833
|
-
current =
|
|
16003
|
+
if (existsSync15(path11)) {
|
|
16004
|
+
current = readFileSync18(path11, "utf8");
|
|
14834
16005
|
}
|
|
14835
16006
|
const lines = current.split(/\r?\n/);
|
|
14836
16007
|
const present = new Set(lines.map((l) => l.trim()));
|
|
@@ -14848,7 +16019,7 @@ function ensureGitignoreEntries(path11, entries) {
|
|
|
14848
16019
|
}
|
|
14849
16020
|
}
|
|
14850
16021
|
if (added.length > 0) {
|
|
14851
|
-
|
|
16022
|
+
writeFileSync6(path11, out, { encoding: "utf8" });
|
|
14852
16023
|
}
|
|
14853
16024
|
return added;
|
|
14854
16025
|
}
|
|
@@ -15034,7 +16205,7 @@ async function printAgreementLoginNotice(io, deps = REAL_DEPS, timeoutMs = 5000)
|
|
|
15034
16205
|
});
|
|
15035
16206
|
const status = await Promise.race([
|
|
15036
16207
|
request,
|
|
15037
|
-
new Promise((
|
|
16208
|
+
new Promise((resolve14) => setTimeout(() => resolve14(null), timeoutMs).unref?.())
|
|
15038
16209
|
]);
|
|
15039
16210
|
if (status === null)
|
|
15040
16211
|
return;
|
|
@@ -15586,7 +16757,7 @@ function describe27(e) {
|
|
|
15586
16757
|
}
|
|
15587
16758
|
|
|
15588
16759
|
// src/commands/plan.ts
|
|
15589
|
-
import { resolve as
|
|
16760
|
+
import { resolve as resolve14 } from "node:path";
|
|
15590
16761
|
|
|
15591
16762
|
// src/manifest/container-runtime-warnings.ts
|
|
15592
16763
|
var CONTAINER_RUNTIME_GATE_WARNING = "Container apps are gated by the platform runtime switch; `launchpad deploy` may return " + "503 container_runtime_off until the platform team enables your app. See docs/concepts/containers.md.";
|
|
@@ -15613,7 +16784,7 @@ async function runPlan(args, io) {
|
|
|
15613
16784
|
io.err("Usage: launchpad plan [--file <path>] [--json]");
|
|
15614
16785
|
return 64;
|
|
15615
16786
|
}
|
|
15616
|
-
const manifestPath =
|
|
16787
|
+
const manifestPath = resolve14(process.cwd(), flags.file ?? "launchpad.yaml");
|
|
15617
16788
|
const result = loadManifest(manifestPath);
|
|
15618
16789
|
if (result.kind === "ok") {
|
|
15619
16790
|
const unsupported2 = rejectUnsupportedCliRuntime({
|
|
@@ -16014,8 +17185,26 @@ function renderSuccess2(body, parsed, io) {
|
|
|
16014
17185
|
}
|
|
16015
17186
|
}
|
|
16016
17187
|
io.out("");
|
|
16017
|
-
|
|
16018
|
-
|
|
17188
|
+
for (const line of destroyNextSteps(body))
|
|
17189
|
+
io.out(line);
|
|
17190
|
+
}
|
|
17191
|
+
function destroyNextSteps(body) {
|
|
17192
|
+
if (body.destroyPr) {
|
|
17193
|
+
return [
|
|
17194
|
+
"Next: tf-apply will destroy the Cloudflare resources on merge of the destroy PR.",
|
|
17195
|
+
" The bot archive-renames the app repo after tf-apply terminal-success (AC8)."
|
|
17196
|
+
];
|
|
17197
|
+
}
|
|
17198
|
+
if (body.lifecycle === "released") {
|
|
17199
|
+
return [
|
|
17200
|
+
typeof body.message === "string" && body.message !== "" ? `Done: ${body.message}` : `Done: "${body.slug}" was torn down before any Cloudflare resources existed; the slug is free.`
|
|
17201
|
+
];
|
|
17202
|
+
}
|
|
17203
|
+
const how = body.path === "per-app-workspace" ? "the platform's destroy workflow is removing the app's Cloudflare resources now (no PR to merge)" : "the platform is removing the app's Cloudflare resources";
|
|
17204
|
+
return [
|
|
17205
|
+
`Next: ${how}, then archive-renames the app repo.`,
|
|
17206
|
+
` Watch it finish (destroying → destroyed, usually 2-3 minutes): launchpad status ${body.slug}`
|
|
17207
|
+
];
|
|
16019
17208
|
}
|
|
16020
17209
|
function renderBotError2(status, env, slug, io) {
|
|
16021
17210
|
const errorCode = env?.error ?? "unknown";
|
|
@@ -16077,7 +17266,7 @@ function describe28(e) {
|
|
|
16077
17266
|
}
|
|
16078
17267
|
|
|
16079
17268
|
// src/commands/pull.ts
|
|
16080
|
-
import { writeFileSync as
|
|
17269
|
+
import { writeFileSync as writeFileSync7 } from "node:fs";
|
|
16081
17270
|
import { stringify as stringifyYaml } from "yaml";
|
|
16082
17271
|
|
|
16083
17272
|
// src/deploy/manifest-status.ts
|
|
@@ -16204,22 +17393,22 @@ async function treesEqual(cwd, tracked, headDir, headPaths) {
|
|
|
16204
17393
|
if (tracked.length !== headPaths.length)
|
|
16205
17394
|
return false;
|
|
16206
17395
|
const expected = new Set(headPaths);
|
|
16207
|
-
for (const
|
|
16208
|
-
if (!expected.has(
|
|
17396
|
+
for (const relative7 of tracked) {
|
|
17397
|
+
if (!expected.has(relative7))
|
|
16209
17398
|
return false;
|
|
16210
|
-
if (!equal(await readEntry(path13.resolve(cwd,
|
|
17399
|
+
if (!equal(await readEntry(path13.resolve(cwd, relative7)), await readEntry(path13.resolve(headDir, relative7)))) {
|
|
16211
17400
|
return false;
|
|
16212
17401
|
}
|
|
16213
17402
|
}
|
|
16214
17403
|
return true;
|
|
16215
17404
|
}
|
|
16216
|
-
async function listFiles(root,
|
|
17405
|
+
async function listFiles(root, relative7 = "") {
|
|
16217
17406
|
const files = [];
|
|
16218
|
-
const entries = await fs6.readdir(path13.resolve(root,
|
|
17407
|
+
const entries = await fs6.readdir(path13.resolve(root, relative7), {
|
|
16219
17408
|
withFileTypes: true
|
|
16220
17409
|
});
|
|
16221
17410
|
for (const entry of entries) {
|
|
16222
|
-
const child =
|
|
17411
|
+
const child = relative7.length === 0 ? entry.name : `${relative7}/${entry.name}`;
|
|
16223
17412
|
if (entry.isDirectory())
|
|
16224
17413
|
files.push(...await listFiles(root, child));
|
|
16225
17414
|
else if (entry.isFile())
|
|
@@ -16228,12 +17417,12 @@ async function listFiles(root, relative6 = "") {
|
|
|
16228
17417
|
return files.sort();
|
|
16229
17418
|
}
|
|
16230
17419
|
function gitOutput(cwd, args) {
|
|
16231
|
-
return new Promise((
|
|
17420
|
+
return new Promise((resolve16, reject) => {
|
|
16232
17421
|
execFile("git", [...args], { cwd, encoding: "utf8" }, (error, stdout) => {
|
|
16233
17422
|
if (error !== null)
|
|
16234
17423
|
reject(error);
|
|
16235
17424
|
else
|
|
16236
|
-
|
|
17425
|
+
resolve16(stdout);
|
|
16237
17426
|
});
|
|
16238
17427
|
});
|
|
16239
17428
|
}
|
|
@@ -16242,7 +17431,7 @@ function splitNull(value) {
|
|
|
16242
17431
|
}
|
|
16243
17432
|
async function reconcile(args) {
|
|
16244
17433
|
const removals = await cleanAncestorRemovals(args);
|
|
16245
|
-
const planned = await Promise.all(args.paths.map((
|
|
17434
|
+
const planned = await Promise.all(args.paths.map((relative7) => planPath(args, relative7, removals)));
|
|
16246
17435
|
const conflicts = planned.flatMap((entry) => entry.conflict === undefined ? [] : [entry.conflict]);
|
|
16247
17436
|
if (conflicts.length > 0) {
|
|
16248
17437
|
const report = {
|
|
@@ -16286,55 +17475,55 @@ async function reconcile(args) {
|
|
|
16286
17475
|
}
|
|
16287
17476
|
async function cleanAncestorRemovals(args) {
|
|
16288
17477
|
const removals = new Set;
|
|
16289
|
-
for (const
|
|
16290
|
-
assertSafePath(
|
|
16291
|
-
const checked = await checkParents(args.cwd,
|
|
17478
|
+
for (const relative7 of args.compare.deleted) {
|
|
17479
|
+
assertSafePath(relative7);
|
|
17480
|
+
const checked = await checkParents(args.cwd, relative7, removals);
|
|
16292
17481
|
if (checked.kind === "blocked")
|
|
16293
17482
|
continue;
|
|
16294
|
-
const base = await readEntry(path13.resolve(args.baseDir,
|
|
17483
|
+
const base = await readEntry(path13.resolve(args.baseDir, relative7));
|
|
16295
17484
|
const local = checked.projectedMissing ? { kind: "missing" } : await readEntry(checked.target);
|
|
16296
17485
|
if (local.kind !== "missing" && cleanLocal(base, local))
|
|
16297
|
-
removals.add(
|
|
17486
|
+
removals.add(relative7);
|
|
16298
17487
|
}
|
|
16299
17488
|
return removals;
|
|
16300
17489
|
}
|
|
16301
|
-
async function planPath(args,
|
|
16302
|
-
assertSafePath(
|
|
16303
|
-
const checked = await checkParents(args.cwd,
|
|
16304
|
-
const base = await readEntry(path13.resolve(args.baseDir,
|
|
16305
|
-
const upstreamDeleted = args.compare.deleted.includes(
|
|
16306
|
-
const head = upstreamDeleted ? { kind: "missing" } : await readEntry(path13.resolve(args.headDir,
|
|
16307
|
-
const unsupported2 = (args.compare.unsupported ?? []).includes(
|
|
17490
|
+
async function planPath(args, relative7, removals) {
|
|
17491
|
+
assertSafePath(relative7);
|
|
17492
|
+
const checked = await checkParents(args.cwd, relative7, removals);
|
|
17493
|
+
const base = await readEntry(path13.resolve(args.baseDir, relative7));
|
|
17494
|
+
const upstreamDeleted = args.compare.deleted.includes(relative7);
|
|
17495
|
+
const head = upstreamDeleted ? { kind: "missing" } : await readEntry(path13.resolve(args.headDir, relative7));
|
|
17496
|
+
const unsupported2 = (args.compare.unsupported ?? []).includes(relative7);
|
|
16308
17497
|
if (checked.kind === "blocked") {
|
|
16309
|
-
return conflictPlan(
|
|
17498
|
+
return conflictPlan(relative7, checked.target, { kind: "missing" }, head, upstreamDeleted, checked.reason);
|
|
16310
17499
|
}
|
|
16311
17500
|
const local = checked.projectedMissing ? { kind: "missing" } : await readEntry(checked.target);
|
|
16312
17501
|
if (unsupported2) {
|
|
16313
|
-
return conflictPlan(
|
|
17502
|
+
return conflictPlan(relative7, checked.target, local, head, false, "upstream or baseline path uses an unsupported Git entry type");
|
|
16314
17503
|
}
|
|
16315
17504
|
if (alreadyResolved(local, head, upstreamDeleted)) {
|
|
16316
|
-
return { relative:
|
|
17505
|
+
return { relative: relative7, target: checked.target, local, head, upstreamDeleted, apply: false };
|
|
16317
17506
|
}
|
|
16318
17507
|
if (unsupportedHead(head, upstreamDeleted)) {
|
|
16319
|
-
return conflictPlan(
|
|
17508
|
+
return conflictPlan(relative7, checked.target, local, head, true, "unsupported upstream file type");
|
|
16320
17509
|
}
|
|
16321
17510
|
if (cleanLocal(base, local)) {
|
|
16322
|
-
return { relative:
|
|
17511
|
+
return { relative: relative7, target: checked.target, local, head, upstreamDeleted, apply: true };
|
|
16323
17512
|
}
|
|
16324
|
-
return conflictPlan(
|
|
17513
|
+
return conflictPlan(relative7, checked.target, local, head, upstreamDeleted, conflictReason(base, local, upstreamDeleted));
|
|
16325
17514
|
}
|
|
16326
|
-
function conflictPlan(
|
|
17515
|
+
function conflictPlan(relative7, target, local, head, upstreamDeleted, reason) {
|
|
16327
17516
|
const suffix = upstreamDeleted ? ".upstream-deleted" : ".upstream";
|
|
16328
|
-
const digest = createHash4("sha256").update(
|
|
17517
|
+
const digest = createHash4("sha256").update(relative7).digest("hex");
|
|
16329
17518
|
return {
|
|
16330
|
-
relative:
|
|
17519
|
+
relative: relative7,
|
|
16331
17520
|
target,
|
|
16332
17521
|
local,
|
|
16333
17522
|
head,
|
|
16334
17523
|
upstreamDeleted,
|
|
16335
17524
|
apply: false,
|
|
16336
17525
|
conflict: {
|
|
16337
|
-
path:
|
|
17526
|
+
path: relative7,
|
|
16338
17527
|
reason,
|
|
16339
17528
|
artifact: `${CONFLICT_DIR}/${digest}${suffix}`,
|
|
16340
17529
|
upstreamDeleted
|
|
@@ -16435,13 +17624,13 @@ function equal(left, right) {
|
|
|
16435
17624
|
return false;
|
|
16436
17625
|
return left.bytes.every((byte, index) => byte === right.bytes[index]);
|
|
16437
17626
|
}
|
|
16438
|
-
async function writeAtomic(cwd,
|
|
16439
|
-
const checked = await checkParents(cwd,
|
|
17627
|
+
async function writeAtomic(cwd, relative7, bytes, mode, allowMetadata = false) {
|
|
17628
|
+
const checked = await checkParents(cwd, relative7, new Set, allowMetadata);
|
|
16440
17629
|
if (checked.kind === "blocked")
|
|
16441
17630
|
throw new Error(checked.reason);
|
|
16442
17631
|
const file = checked.target;
|
|
16443
17632
|
await fs6.mkdir(path13.dirname(file), { recursive: true });
|
|
16444
|
-
const rechecked = await checkParents(cwd,
|
|
17633
|
+
const rechecked = await checkParents(cwd, relative7, new Set, allowMetadata);
|
|
16445
17634
|
if (rechecked.kind === "blocked")
|
|
16446
17635
|
throw new Error(rechecked.reason);
|
|
16447
17636
|
const temporary = `${file}.launchpad-tmp-${process.pid}-${crypto.randomUUID()}`;
|
|
@@ -16456,8 +17645,8 @@ async function writeAtomic(cwd, relative6, bytes, mode, allowMetadata = false) {
|
|
|
16456
17645
|
throw error;
|
|
16457
17646
|
}
|
|
16458
17647
|
}
|
|
16459
|
-
async function writeJsonAtomic(cwd,
|
|
16460
|
-
await writeAtomic(cwd,
|
|
17648
|
+
async function writeJsonAtomic(cwd, relative7, value) {
|
|
17649
|
+
await writeAtomic(cwd, relative7, new TextEncoder().encode(`${JSON.stringify(value, null, 2)}
|
|
16461
17650
|
`), 384, true);
|
|
16462
17651
|
}
|
|
16463
17652
|
async function resetConflictArtifacts(cwd) {
|
|
@@ -16473,37 +17662,37 @@ async function cleanupConflictState(cwd) {
|
|
|
16473
17662
|
throw new Error(report.reason);
|
|
16474
17663
|
await fs6.rm(report.target, { force: true });
|
|
16475
17664
|
}
|
|
16476
|
-
function assertSafePath(
|
|
16477
|
-
if (!isSafeSourcePath(
|
|
16478
|
-
throw new Error(`unsafe source path returned by bot: ${
|
|
17665
|
+
function assertSafePath(relative7) {
|
|
17666
|
+
if (!isSafeSourcePath(relative7)) {
|
|
17667
|
+
throw new Error(`unsafe source path returned by bot: ${relative7}`);
|
|
16479
17668
|
}
|
|
16480
17669
|
}
|
|
16481
|
-
function isSafeSourcePath(
|
|
16482
|
-
return isSafeRelativePath(
|
|
17670
|
+
function isSafeSourcePath(relative7) {
|
|
17671
|
+
return isSafeRelativePath(relative7) && !relative7.startsWith(`${MARKER_DIR}/`);
|
|
16483
17672
|
}
|
|
16484
|
-
function isSafeRelativePath(
|
|
16485
|
-
const normalized = path13.posix.normalize(
|
|
16486
|
-
return
|
|
17673
|
+
function isSafeRelativePath(relative7) {
|
|
17674
|
+
const normalized = path13.posix.normalize(relative7);
|
|
17675
|
+
return relative7.length > 0 && !relative7.includes("\\") && !path13.isAbsolute(relative7) && normalized === relative7 && normalized !== ".." && !normalized.startsWith("../");
|
|
16487
17676
|
}
|
|
16488
|
-
function resolveInsideClone(cwd,
|
|
17677
|
+
function resolveInsideClone(cwd, relative7) {
|
|
16489
17678
|
const root = path13.resolve(cwd);
|
|
16490
|
-
const target = path13.resolve(root,
|
|
17679
|
+
const target = path13.resolve(root, relative7);
|
|
16491
17680
|
const fromRoot = path13.relative(root, target);
|
|
16492
17681
|
if (fromRoot.length === 0 || path13.isAbsolute(fromRoot) || fromRoot === ".." || fromRoot.startsWith(`..${path13.sep}`)) {
|
|
16493
|
-
throw new Error(`unsafe source path returned by bot: ${
|
|
17682
|
+
throw new Error(`unsafe source path returned by bot: ${relative7}`);
|
|
16494
17683
|
}
|
|
16495
17684
|
return target;
|
|
16496
17685
|
}
|
|
16497
|
-
async function checkParents(cwd,
|
|
17686
|
+
async function checkParents(cwd, relative7, projectedRemovals, allowMetadata = false) {
|
|
16498
17687
|
if (allowMetadata) {
|
|
16499
|
-
if (!isSafeRelativePath(
|
|
16500
|
-
throw new Error(`unsafe metadata path: ${
|
|
17688
|
+
if (!isSafeRelativePath(relative7)) {
|
|
17689
|
+
throw new Error(`unsafe metadata path: ${relative7}`);
|
|
16501
17690
|
}
|
|
16502
17691
|
} else {
|
|
16503
|
-
assertSafePath(
|
|
17692
|
+
assertSafePath(relative7);
|
|
16504
17693
|
}
|
|
16505
|
-
const target = resolveInsideClone(cwd,
|
|
16506
|
-
const components =
|
|
17694
|
+
const target = resolveInsideClone(cwd, relative7);
|
|
17695
|
+
const components = relative7.split("/");
|
|
16507
17696
|
let current = path13.resolve(cwd);
|
|
16508
17697
|
for (let index = 0;index < components.length - 1; index += 1) {
|
|
16509
17698
|
current = path13.join(current, components[index]);
|
|
@@ -16593,7 +17782,7 @@ async function runPull(args, io) {
|
|
|
16593
17782
|
}
|
|
16594
17783
|
const yaml = stringifyYaml(res.status);
|
|
16595
17784
|
if (parsed.out !== null) {
|
|
16596
|
-
|
|
17785
|
+
writeFileSync7(parsed.out, yaml);
|
|
16597
17786
|
io.err(`launchpad pull: wrote status (${res.role} view) to ${parsed.out}`);
|
|
16598
17787
|
} else {
|
|
16599
17788
|
io.out(yaml.replace(/\n$/, ""));
|
|
@@ -16614,7 +17803,7 @@ async function runPull(args, io) {
|
|
|
16614
17803
|
return 1;
|
|
16615
17804
|
}
|
|
16616
17805
|
if (parsed.out !== null) {
|
|
16617
|
-
|
|
17806
|
+
writeFileSync7(parsed.out, state.manifestYaml);
|
|
16618
17807
|
io.err(`launchpad pull: wrote ${state.manifestYaml.length} bytes to ${parsed.out}`);
|
|
16619
17808
|
} else {
|
|
16620
17809
|
io.out(state.manifestYaml.replace(/\n$/, ""));
|
|
@@ -17148,7 +18337,7 @@ function describe30(e) {
|
|
|
17148
18337
|
}
|
|
17149
18338
|
|
|
17150
18339
|
// src/deploy/rollback.ts
|
|
17151
|
-
import { existsSync as
|
|
18340
|
+
import { existsSync as existsSync16, readFileSync as readFileSync19, writeFileSync as writeFileSync8 } from "node:fs";
|
|
17152
18341
|
import { resolve as resolvePath4 } from "node:path";
|
|
17153
18342
|
import { createInterface as createInterface4 } from "node:readline/promises";
|
|
17154
18343
|
|
|
@@ -17250,7 +18439,7 @@ async function runRollback(opts, io, deps = {}) {
|
|
|
17250
18439
|
}
|
|
17251
18440
|
}
|
|
17252
18441
|
try {
|
|
17253
|
-
|
|
18442
|
+
writeFileSync8(manifestPath, historicalYaml, "utf8");
|
|
17254
18443
|
} catch (e) {
|
|
17255
18444
|
io.err(`launchpad rollback: failed to write ${manifestPath}: ${describe31(e)}`);
|
|
17256
18445
|
return 2;
|
|
@@ -17273,11 +18462,11 @@ async function runRollback(opts, io, deps = {}) {
|
|
|
17273
18462
|
}, io, applyDeps);
|
|
17274
18463
|
}
|
|
17275
18464
|
function readCurrentManifest(path15) {
|
|
17276
|
-
if (!
|
|
18465
|
+
if (!existsSync16(path15))
|
|
17277
18466
|
return null;
|
|
17278
18467
|
let raw;
|
|
17279
18468
|
try {
|
|
17280
|
-
raw =
|
|
18469
|
+
raw = readFileSync19(path15, "utf8");
|
|
17281
18470
|
} catch {
|
|
17282
18471
|
return null;
|
|
17283
18472
|
}
|
|
@@ -17546,9 +18735,9 @@ function renderManifestError5(result, io) {
|
|
|
17546
18735
|
}
|
|
17547
18736
|
|
|
17548
18737
|
// src/secrets/set.ts
|
|
17549
|
-
import { existsSync as
|
|
18738
|
+
import { existsSync as existsSync17, readFileSync as readFileSync20 } from "node:fs";
|
|
17550
18739
|
import { resolve as resolvePath6 } from "node:path";
|
|
17551
|
-
import { parse as
|
|
18740
|
+
import { parse as parseYaml11 } from "yaml";
|
|
17552
18741
|
var CELL_LABEL2 = {
|
|
17553
18742
|
present: "PRESENT",
|
|
17554
18743
|
missing: "MISSING",
|
|
@@ -17556,14 +18745,14 @@ var CELL_LABEL2 = {
|
|
|
17556
18745
|
};
|
|
17557
18746
|
function loadSet(fleetFile, setName, io) {
|
|
17558
18747
|
const path15 = resolvePath6(process.cwd(), fleetFile ?? "fleet-secret-sets.yaml");
|
|
17559
|
-
if (!
|
|
18748
|
+
if (!existsSync17(path15)) {
|
|
17560
18749
|
io.err(`✗ ${path15}`);
|
|
17561
18750
|
io.err(" fleet-secret-sets.yaml not found. Run from the platform repo root or pass --fleet-file.");
|
|
17562
18751
|
return 2;
|
|
17563
18752
|
}
|
|
17564
18753
|
let obj;
|
|
17565
18754
|
try {
|
|
17566
|
-
obj =
|
|
18755
|
+
obj = parseYaml11(readFileSync20(path15, "utf8"));
|
|
17567
18756
|
} catch (e) {
|
|
17568
18757
|
io.err(`✗ ${path15}`);
|
|
17569
18758
|
io.err(` YAML parse error: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -17652,14 +18841,14 @@ async function runSecretsPushSet(opts, io, deps = {}) {
|
|
|
17652
18841
|
if (typeof set === "number")
|
|
17653
18842
|
return set;
|
|
17654
18843
|
const envPath = resolvePath6(process.cwd(), opts.env ?? ".env");
|
|
17655
|
-
if (!
|
|
18844
|
+
if (!existsSync17(envPath)) {
|
|
17656
18845
|
io.err(`launchpad secrets push --set: ${envPath} not found.`);
|
|
17657
18846
|
io.err(` Create a .env carrying the set's secrets: ${set.secrets.join(", ")}`);
|
|
17658
18847
|
return 2;
|
|
17659
18848
|
}
|
|
17660
18849
|
let envText;
|
|
17661
18850
|
try {
|
|
17662
|
-
envText =
|
|
18851
|
+
envText = readFileSync20(envPath, "utf8");
|
|
17663
18852
|
} catch (e) {
|
|
17664
18853
|
io.err(`launchpad secrets push --set: failed to read ${envPath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
17665
18854
|
return 2;
|
|
@@ -17803,8 +18992,8 @@ function setPushExit(e) {
|
|
|
17803
18992
|
}
|
|
17804
18993
|
|
|
17805
18994
|
// src/commands/secrets-template.ts
|
|
17806
|
-
import { existsSync as
|
|
17807
|
-
import { resolve as
|
|
18995
|
+
import { existsSync as existsSync18, writeFileSync as writeFileSync9 } from "node:fs";
|
|
18996
|
+
import { resolve as resolve16 } from "node:path";
|
|
17808
18997
|
async function runSecretsTemplate(args, io) {
|
|
17809
18998
|
const flags = parseFlags4(args);
|
|
17810
18999
|
if (flags.kind === "usage-error") {
|
|
@@ -17812,7 +19001,7 @@ async function runSecretsTemplate(args, io) {
|
|
|
17812
19001
|
io.err("Usage: launchpad secrets template [--file <path>] [--out <path>] " + "[--stdout] [--force] [--include-platform-managed]");
|
|
17813
19002
|
return 64;
|
|
17814
19003
|
}
|
|
17815
|
-
const manifestPath =
|
|
19004
|
+
const manifestPath = resolve16(process.cwd(), flags.file ?? "launchpad.yaml");
|
|
17816
19005
|
const renderResult = renderManifest(loadManifestAnyVersion(manifestPath), io);
|
|
17817
19006
|
if (renderResult.kind !== "ok") {
|
|
17818
19007
|
return renderResult.code;
|
|
@@ -17826,14 +19015,14 @@ async function runSecretsTemplate(args, io) {
|
|
|
17826
19015
|
}
|
|
17827
19016
|
return 0;
|
|
17828
19017
|
}
|
|
17829
|
-
const outPath =
|
|
17830
|
-
if (
|
|
19018
|
+
const outPath = resolve16(process.cwd(), flags.out);
|
|
19019
|
+
if (existsSync18(outPath) && !flags.force) {
|
|
17831
19020
|
io.err(`launchpad secrets template: ${outPath} already exists`);
|
|
17832
19021
|
io.err("Pass --force to overwrite, or --stdout to print without writing.");
|
|
17833
19022
|
return 64;
|
|
17834
19023
|
}
|
|
17835
19024
|
try {
|
|
17836
|
-
|
|
19025
|
+
writeFileSync9(outPath, body, { encoding: "utf8" });
|
|
17837
19026
|
} catch (err) {
|
|
17838
19027
|
const e = err;
|
|
17839
19028
|
io.err(`launchpad secrets template: failed to write ${outPath}`);
|
|
@@ -18128,16 +19317,16 @@ function printHelp5(io) {
|
|
|
18128
19317
|
|
|
18129
19318
|
// src/commands/skills.ts
|
|
18130
19319
|
import { fileURLToPath } from "node:url";
|
|
18131
|
-
import { dirname as
|
|
18132
|
-
import { promises as fs7, existsSync as
|
|
19320
|
+
import { dirname as dirname13, join as join18, resolve as resolve17 } from "node:path";
|
|
19321
|
+
import { promises as fs7, existsSync as existsSync19 } from "node:fs";
|
|
18133
19322
|
|
|
18134
19323
|
// src/skills-bundle.ts
|
|
18135
19324
|
import { homedir as homedir2 } from "node:os";
|
|
18136
|
-
import { join as
|
|
18137
|
-
import { readFileSync as
|
|
19325
|
+
import { join as join17 } from "node:path";
|
|
19326
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync3 } from "node:fs";
|
|
18138
19327
|
var SKILL_PREFIX = "launchpad-";
|
|
18139
19328
|
function skillsTargetDir() {
|
|
18140
|
-
return process.env.LAUNCHPAD_SKILLS_TARGET_DIR ??
|
|
19329
|
+
return process.env.LAUNCHPAD_SKILLS_TARGET_DIR ?? join17(homedir2(), ".claude", "skills");
|
|
18141
19330
|
}
|
|
18142
19331
|
function readInstalledSkills() {
|
|
18143
19332
|
try {
|
|
@@ -18147,7 +19336,7 @@ function readInstalledSkills() {
|
|
|
18147
19336
|
return { present: false, version: null };
|
|
18148
19337
|
return {
|
|
18149
19338
|
present: true,
|
|
18150
|
-
version: readSkillVersion(
|
|
19339
|
+
version: readSkillVersion(join17(dir, bundle.name, "SKILL.md"))
|
|
18151
19340
|
};
|
|
18152
19341
|
} catch {
|
|
18153
19342
|
return { present: false, version: null };
|
|
@@ -18155,7 +19344,7 @@ function readInstalledSkills() {
|
|
|
18155
19344
|
}
|
|
18156
19345
|
function readSkillVersion(path15) {
|
|
18157
19346
|
try {
|
|
18158
|
-
const text2 =
|
|
19347
|
+
const text2 = readFileSync21(path15, "utf8");
|
|
18159
19348
|
const fenceEnd = text2.indexOf(`
|
|
18160
19349
|
---`, 4);
|
|
18161
19350
|
const front = fenceEnd === -1 ? text2.slice(0, 1024) : text2.slice(0, fenceEnd);
|
|
@@ -18234,13 +19423,13 @@ function resolveInstallEnv() {
|
|
|
18234
19423
|
return { bundleDir, userSkillsDir };
|
|
18235
19424
|
}
|
|
18236
19425
|
function defaultBundleDir() {
|
|
18237
|
-
const here =
|
|
19426
|
+
const here = dirname13(fileURLToPath(import.meta.url));
|
|
18238
19427
|
const candidates = [
|
|
18239
|
-
|
|
18240
|
-
|
|
19428
|
+
resolve17(here, "..", "skills"),
|
|
19429
|
+
resolve17(here, "..", "..", "skills")
|
|
18241
19430
|
];
|
|
18242
19431
|
for (const c of candidates) {
|
|
18243
|
-
if (
|
|
19432
|
+
if (existsSync19(join18(c, "launchpad-onboard", "SKILL.md"))) {
|
|
18244
19433
|
return c;
|
|
18245
19434
|
}
|
|
18246
19435
|
}
|
|
@@ -18261,12 +19450,12 @@ async function doInstall(io) {
|
|
|
18261
19450
|
}
|
|
18262
19451
|
let installed = 0;
|
|
18263
19452
|
for (const skill of BUNDLED_SKILLS) {
|
|
18264
|
-
const src =
|
|
19453
|
+
const src = join18(env.bundleDir, skill);
|
|
18265
19454
|
if (!await isDir(src)) {
|
|
18266
19455
|
io.err(`launchpad skills install: bundled skill "${skill}" missing from ${env.bundleDir} — package is incomplete.`);
|
|
18267
19456
|
return 1;
|
|
18268
19457
|
}
|
|
18269
|
-
const dest =
|
|
19458
|
+
const dest = join18(env.userSkillsDir, skill);
|
|
18270
19459
|
await fs7.rm(dest, { recursive: true, force: true });
|
|
18271
19460
|
await fs7.cp(src, dest, { recursive: true });
|
|
18272
19461
|
installed++;
|
|
@@ -18291,7 +19480,7 @@ async function doUninstall(io) {
|
|
|
18291
19480
|
continue;
|
|
18292
19481
|
if (!isBundleManaged(entry.name))
|
|
18293
19482
|
continue;
|
|
18294
|
-
const target =
|
|
19483
|
+
const target = join18(env.userSkillsDir, entry.name);
|
|
18295
19484
|
await fs7.rm(target, { recursive: true, force: true });
|
|
18296
19485
|
removed++;
|
|
18297
19486
|
io.out(`✗ removed ${target}`);
|
|
@@ -18314,7 +19503,7 @@ async function doList(io) {
|
|
|
18314
19503
|
}
|
|
18315
19504
|
const width = managedDirs.reduce((n, s) => Math.max(n, s.length), 0);
|
|
18316
19505
|
for (const name of managedDirs) {
|
|
18317
|
-
const skillFile =
|
|
19506
|
+
const skillFile = join18(env.userSkillsDir, name, "SKILL.md");
|
|
18318
19507
|
const version = await readVersion(skillFile);
|
|
18319
19508
|
io.out(` ${name.padEnd(width + 2)}${version ?? "(no version)"}`);
|
|
18320
19509
|
}
|
|
@@ -18349,9 +19538,9 @@ function describe32(e) {
|
|
|
18349
19538
|
import { execFile as execFile2, spawn as spawn5 } from "node:child_process";
|
|
18350
19539
|
import { promisify } from "node:util";
|
|
18351
19540
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
18352
|
-
import { dirname as
|
|
19541
|
+
import { dirname as dirname14, resolve as resolve18, relative as relative7, isAbsolute as isAbsolute3, join as join19 } from "node:path";
|
|
18353
19542
|
import { homedir as homedir3, tmpdir } from "node:os";
|
|
18354
|
-
import { readFileSync as
|
|
19543
|
+
import { readFileSync as readFileSync22, mkdtempSync as mkdtempSync2, writeFileSync as writeFileSync10, rmSync as rmSync3 } from "node:fs";
|
|
18355
19544
|
|
|
18356
19545
|
// src/commands/channel-auth.ts
|
|
18357
19546
|
import { createServer as createServer2 } from "node:http";
|
|
@@ -18394,9 +19583,9 @@ async function startLoopback(state, timeoutMs) {
|
|
|
18394
19583
|
resolveCode(code);
|
|
18395
19584
|
}
|
|
18396
19585
|
});
|
|
18397
|
-
const bound = await new Promise((
|
|
18398
|
-
server.once("error", () =>
|
|
18399
|
-
server.listen(0, "127.0.0.1", () =>
|
|
19586
|
+
const bound = await new Promise((resolve18) => {
|
|
19587
|
+
server.once("error", () => resolve18(false));
|
|
19588
|
+
server.listen(0, "127.0.0.1", () => resolve18(true));
|
|
18400
19589
|
});
|
|
18401
19590
|
if (!bound)
|
|
18402
19591
|
return null;
|
|
@@ -18472,7 +19661,7 @@ var PKG = "@m-kopa/launchpad-cli";
|
|
|
18472
19661
|
var REGISTRY = "https://registry.npmjs.org";
|
|
18473
19662
|
var CHANNEL_VERSION_URL = "https://get.launchpad.m-kopa.us/version.json";
|
|
18474
19663
|
var CHANNEL_INSTALL_URL = "https://get.launchpad.m-kopa.us";
|
|
18475
|
-
var CHANNEL_MARKER =
|
|
19664
|
+
var CHANNEL_MARKER = join19(homedir3(), ".launchpad", "channel");
|
|
18476
19665
|
var EXIT_UPDATE_AVAILABLE = 10;
|
|
18477
19666
|
var UPGRADE_ARGS = {
|
|
18478
19667
|
npm: ["install", "-g", `${PKG}@latest`],
|
|
@@ -18601,10 +19790,10 @@ async function openSystemBrowser(url) {
|
|
|
18601
19790
|
await execFileAsync(opener, [url]);
|
|
18602
19791
|
}
|
|
18603
19792
|
async function runInstallerScript(script) {
|
|
18604
|
-
const dir = mkdtempSync2(
|
|
18605
|
-
const file =
|
|
19793
|
+
const dir = mkdtempSync2(join19(tmpdir(), "launchpad-update-"));
|
|
19794
|
+
const file = join19(dir, "install.sh");
|
|
18606
19795
|
try {
|
|
18607
|
-
|
|
19796
|
+
writeFileSync10(file, script, { mode: 448 });
|
|
18608
19797
|
return await new Promise((resolvePromise) => {
|
|
18609
19798
|
const child = spawn5("bash", [file], { stdio: "inherit" });
|
|
18610
19799
|
child.on("error", () => resolvePromise(127));
|
|
@@ -18626,7 +19815,7 @@ function resolveLatestVersion() {
|
|
|
18626
19815
|
}
|
|
18627
19816
|
function detectInstallChannel() {
|
|
18628
19817
|
try {
|
|
18629
|
-
return
|
|
19818
|
+
return readFileSync22(CHANNEL_MARKER, "utf8").trim() === "platform" ? "platform" : "github";
|
|
18630
19819
|
} catch {
|
|
18631
19820
|
return "github";
|
|
18632
19821
|
}
|
|
@@ -18689,7 +19878,7 @@ function errStderr(e) {
|
|
|
18689
19878
|
return "";
|
|
18690
19879
|
}
|
|
18691
19880
|
async function detectPackageManager2() {
|
|
18692
|
-
const pkgRoot =
|
|
19881
|
+
const pkgRoot = resolve18(dirname14(fileURLToPath2(import.meta.url)), "..", "..");
|
|
18693
19882
|
const candidates = [];
|
|
18694
19883
|
const npmRoot = await pmRoot("npm");
|
|
18695
19884
|
if (npmRoot !== null)
|
|
@@ -18697,7 +19886,7 @@ async function detectPackageManager2() {
|
|
|
18697
19886
|
const pnpmRoot = await pmRoot("pnpm");
|
|
18698
19887
|
if (pnpmRoot !== null)
|
|
18699
19888
|
candidates.push(["pnpm", pnpmRoot]);
|
|
18700
|
-
candidates.push(["bun",
|
|
19889
|
+
candidates.push(["bun", resolve18(homedir3(), ".bun/install/global/node_modules")]);
|
|
18701
19890
|
const matches = candidates.filter(([, root]) => pathContains(root, pkgRoot));
|
|
18702
19891
|
return matches.length === 1 ? matches[0][0] : null;
|
|
18703
19892
|
}
|
|
@@ -18711,7 +19900,7 @@ async function pmRoot(pm) {
|
|
|
18711
19900
|
}
|
|
18712
19901
|
}
|
|
18713
19902
|
function pathContains(root, child) {
|
|
18714
|
-
const rel =
|
|
19903
|
+
const rel = relative7(root, child);
|
|
18715
19904
|
return rel === "" || !rel.startsWith("..") && !isAbsolute3(rel);
|
|
18716
19905
|
}
|
|
18717
19906
|
function runUpgrade(pm) {
|
|
@@ -18834,12 +20023,12 @@ function printHelp7(io) {
|
|
|
18834
20023
|
}
|
|
18835
20024
|
|
|
18836
20025
|
// src/commands/validate.ts
|
|
18837
|
-
import { existsSync as
|
|
18838
|
-
import { dirname as
|
|
20026
|
+
import { existsSync as existsSync20, readFileSync as readFileSync24, readdirSync as readdirSync4, statSync as statSync3 } from "node:fs";
|
|
20027
|
+
import { dirname as dirname15, resolve as resolve19 } from "node:path";
|
|
18839
20028
|
|
|
18840
20029
|
// src/commands/app-lints.ts
|
|
18841
|
-
import { readFileSync as
|
|
18842
|
-
import { join as
|
|
20030
|
+
import { readFileSync as readFileSync23, statSync as statSync2 } from "node:fs";
|
|
20031
|
+
import { join as join20 } from "node:path";
|
|
18843
20032
|
var MAX_READ_BYTES = 512000;
|
|
18844
20033
|
function cleanRoot(rootDir) {
|
|
18845
20034
|
if (rootDir === undefined)
|
|
@@ -18856,10 +20045,10 @@ function runAppLints(dir, rootDir) {
|
|
|
18856
20045
|
const inRoot = root === undefined ? rel : rel.startsWith(`${root}/`) ? rel.slice(root.length + 1) : null;
|
|
18857
20046
|
if (inRoot === null || !isServerCodePath(inRoot))
|
|
18858
20047
|
continue;
|
|
18859
|
-
const abs =
|
|
20048
|
+
const abs = join20(dir, rel);
|
|
18860
20049
|
if (statSync2(abs).size > MAX_READ_BYTES)
|
|
18861
20050
|
continue;
|
|
18862
|
-
files[rel] =
|
|
20051
|
+
files[rel] = readFileSync23(abs, "utf8");
|
|
18863
20052
|
}
|
|
18864
20053
|
} catch (e) {
|
|
18865
20054
|
skipped = e instanceof Error ? e.message : String(e);
|
|
@@ -18924,7 +20113,7 @@ async function runValidate(args, io) {
|
|
|
18924
20113
|
return 64;
|
|
18925
20114
|
}
|
|
18926
20115
|
const { file, json, strictGroups, appLints } = parseResult;
|
|
18927
|
-
const path15 =
|
|
20116
|
+
const path15 = resolve19(process.cwd(), file ?? "launchpad.yaml");
|
|
18928
20117
|
const result = loadManifestAnyVersion(path15);
|
|
18929
20118
|
if (result.kind !== "ok") {
|
|
18930
20119
|
return json ? renderJsonError(result, io) : renderHumanError(result, io);
|
|
@@ -18945,7 +20134,7 @@ async function runValidate(args, io) {
|
|
|
18945
20134
|
if (serveErrors.length > 0) {
|
|
18946
20135
|
boundary.errors = [...boundary.errors, ...serveErrors];
|
|
18947
20136
|
}
|
|
18948
|
-
const lints = appLints ? runAppLints(
|
|
20137
|
+
const lints = appLints ? runAppLints(dirname15(path15), manifestRootDir(result.manifest)) : undefined;
|
|
18949
20138
|
const groupCheck = strictGroups ? await checkGroups(allowedEntraGroups(view.access)) : { kind: "skipped" };
|
|
18950
20139
|
return json ? renderJsonOk(result, groupCheck, boundary, io, lints) : renderHumanOk(result, groupCheck, boundary, io, lints);
|
|
18951
20140
|
}
|
|
@@ -18953,7 +20142,7 @@ function manifestRootDir(manifest) {
|
|
|
18953
20142
|
return manifest.apiVersion === "launchpad.m-kopa.us/v2" ? manifest.spec.build?.root_dir : manifest.build?.root_dir;
|
|
18954
20143
|
}
|
|
18955
20144
|
function checkBoundary(manifestPath, declared) {
|
|
18956
|
-
const dir =
|
|
20145
|
+
const dir = dirname15(manifestPath);
|
|
18957
20146
|
let files;
|
|
18958
20147
|
try {
|
|
18959
20148
|
files = walkCwd(dir).files;
|
|
@@ -18962,7 +20151,7 @@ function checkBoundary(manifestPath, declared) {
|
|
|
18962
20151
|
}
|
|
18963
20152
|
let manifestYaml;
|
|
18964
20153
|
try {
|
|
18965
|
-
manifestYaml =
|
|
20154
|
+
manifestYaml = readFileSync24(manifestPath, "utf8");
|
|
18966
20155
|
} catch {
|
|
18967
20156
|
manifestYaml = null;
|
|
18968
20157
|
}
|
|
@@ -18986,9 +20175,9 @@ function checkStaticServeDir(manifestPath, manifest) {
|
|
|
18986
20175
|
`static app destination_dir '${serveDir}' is unsafe — use a confined relative subdirectory (e.g. '${STATIC_SERVE_DIR}'). ` + `Serving '.' or an absolute/parent path would publish files outside your app's content.`
|
|
18987
20176
|
];
|
|
18988
20177
|
}
|
|
18989
|
-
const dir =
|
|
18990
|
-
const abs =
|
|
18991
|
-
if (!
|
|
20178
|
+
const dir = dirname15(manifestPath);
|
|
20179
|
+
const abs = resolve19(dir, serveDir);
|
|
20180
|
+
if (!existsSync20(abs)) {
|
|
18992
20181
|
return [
|
|
18993
20182
|
`static app serves '${serveDir}/' but that directory does not exist — nothing would be served. ` + `Create ${serveDir}/index.html (or run \`launchpad init\` to scaffold it).`
|
|
18994
20183
|
];
|
|
@@ -19013,7 +20202,7 @@ function checkStaticServeDir(manifestPath, manifest) {
|
|
|
19013
20202
|
`static app's served directory '${serveDir}/' is empty — the deploy would serve an empty site.`
|
|
19014
20203
|
];
|
|
19015
20204
|
}
|
|
19016
|
-
if (!
|
|
20205
|
+
if (!existsSync20(resolve19(abs, "index.html"))) {
|
|
19017
20206
|
return [
|
|
19018
20207
|
`static app's served directory '${serveDir}/' has no index.html — the deploy would serve a directory with no entrypoint.`
|
|
19019
20208
|
];
|
|
@@ -20233,20 +21422,20 @@ var listOwnersCommand = makeListOwnersCommand();
|
|
|
20233
21422
|
// src/update-notifier.ts
|
|
20234
21423
|
import { spawn as spawn6 } from "node:child_process";
|
|
20235
21424
|
import { homedir as homedir4 } from "node:os";
|
|
20236
|
-
import { join as
|
|
21425
|
+
import { join as join21 } from "node:path";
|
|
20237
21426
|
import {
|
|
20238
|
-
existsSync as
|
|
20239
|
-
mkdirSync as
|
|
20240
|
-
readFileSync as
|
|
20241
|
-
writeFileSync as
|
|
21427
|
+
existsSync as existsSync21,
|
|
21428
|
+
mkdirSync as mkdirSync7,
|
|
21429
|
+
readFileSync as readFileSync25,
|
|
21430
|
+
writeFileSync as writeFileSync11
|
|
20242
21431
|
} from "node:fs";
|
|
20243
21432
|
var INTERNAL_REFRESH_VERB = "__refresh-update-cache";
|
|
20244
21433
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
20245
21434
|
var OPT_OUT_ENV = "LAUNCHPAD_NO_UPDATE_NOTIFIER";
|
|
20246
|
-
var CACHE_FILE =
|
|
21435
|
+
var CACHE_FILE = join21(homedir4(), ".launchpad", "update-check.json");
|
|
20247
21436
|
function readCache2() {
|
|
20248
21437
|
try {
|
|
20249
|
-
const raw = JSON.parse(
|
|
21438
|
+
const raw = JSON.parse(readFileSync25(CACHE_FILE, "utf8"));
|
|
20250
21439
|
if (typeof raw === "object" && raw !== null && typeof raw.checkedAt === "number") {
|
|
20251
21440
|
const latest = raw.latest;
|
|
20252
21441
|
return {
|
|
@@ -20259,23 +21448,23 @@ function readCache2() {
|
|
|
20259
21448
|
}
|
|
20260
21449
|
function writeCache2(state) {
|
|
20261
21450
|
try {
|
|
20262
|
-
|
|
20263
|
-
|
|
21451
|
+
mkdirSync7(join21(homedir4(), ".launchpad"), { recursive: true });
|
|
21452
|
+
writeFileSync11(CACHE_FILE, `${JSON.stringify(state)}
|
|
20264
21453
|
`, { mode: 384 });
|
|
20265
21454
|
} catch {}
|
|
20266
21455
|
}
|
|
20267
|
-
var SKILLS_HINT_MARKER =
|
|
21456
|
+
var SKILLS_HINT_MARKER = join21(homedir4(), ".launchpad", "skills-hint-shown");
|
|
20268
21457
|
function absentHintShown() {
|
|
20269
21458
|
try {
|
|
20270
|
-
return
|
|
21459
|
+
return existsSync21(SKILLS_HINT_MARKER);
|
|
20271
21460
|
} catch {
|
|
20272
21461
|
return false;
|
|
20273
21462
|
}
|
|
20274
21463
|
}
|
|
20275
21464
|
function markAbsentHintShown() {
|
|
20276
21465
|
try {
|
|
20277
|
-
|
|
20278
|
-
|
|
21466
|
+
mkdirSync7(join21(homedir4(), ".launchpad"), { recursive: true });
|
|
21467
|
+
writeFileSync11(SKILLS_HINT_MARKER, `${Date.now()}
|
|
20279
21468
|
`, { mode: 384 });
|
|
20280
21469
|
} catch {}
|
|
20281
21470
|
}
|
|
@@ -20377,8 +21566,8 @@ var refreshUpdateCacheCommand = {
|
|
|
20377
21566
|
// src/telemetry.ts
|
|
20378
21567
|
import { spawn as spawn7 } from "node:child_process";
|
|
20379
21568
|
import { homedir as homedir5 } from "node:os";
|
|
20380
|
-
import { join as
|
|
20381
|
-
import { existsSync as
|
|
21569
|
+
import { join as join22 } from "node:path";
|
|
21570
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync8, readFileSync as readFileSync26, writeFileSync as writeFileSync12 } from "node:fs";
|
|
20382
21571
|
import { randomUUID } from "node:crypto";
|
|
20383
21572
|
var INTERNAL_EMIT_VERB = "__emit-telemetry";
|
|
20384
21573
|
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
@@ -20386,8 +21575,8 @@ var POSTHOG_PROJECT_KEY = "phc_CYaCuETanWc36TMTiB7cdkdnmPPhFZCkDGmWGLaNkXnb";
|
|
|
20386
21575
|
var CAPTURE_PATH = "/i/v0/e/";
|
|
20387
21576
|
var SEND_TIMEOUT_MS = 3000;
|
|
20388
21577
|
var APP = "launchpad-cli";
|
|
20389
|
-
var DEVICE_ID_FILE =
|
|
20390
|
-
var FIRST_RUN_MARKER =
|
|
21578
|
+
var DEVICE_ID_FILE = join22(homedir5(), ".launchpad", "telemetry-id.json");
|
|
21579
|
+
var FIRST_RUN_MARKER = join22(homedir5(), ".launchpad", "telemetry-notice-shown");
|
|
20391
21580
|
function buildEvent(ctx, identity, nowMs) {
|
|
20392
21581
|
const properties = {
|
|
20393
21582
|
app: APP,
|
|
@@ -20454,15 +21643,15 @@ async function resolveIdentityReal() {
|
|
|
20454
21643
|
}
|
|
20455
21644
|
function getOrCreateDeviceId() {
|
|
20456
21645
|
try {
|
|
20457
|
-
const raw = JSON.parse(
|
|
21646
|
+
const raw = JSON.parse(readFileSync26(DEVICE_ID_FILE, "utf8"));
|
|
20458
21647
|
const id2 = raw?.deviceId;
|
|
20459
21648
|
if (typeof id2 === "string" && id2)
|
|
20460
21649
|
return id2;
|
|
20461
21650
|
} catch {}
|
|
20462
21651
|
const id = randomUUID();
|
|
20463
21652
|
try {
|
|
20464
|
-
|
|
20465
|
-
|
|
21653
|
+
mkdirSync8(join22(homedir5(), ".launchpad"), { recursive: true });
|
|
21654
|
+
writeFileSync12(DEVICE_ID_FILE, `${JSON.stringify({ deviceId: id })}
|
|
20466
21655
|
`, {
|
|
20467
21656
|
mode: 384
|
|
20468
21657
|
});
|
|
@@ -20532,15 +21721,15 @@ function telemetryNoticeLine() {
|
|
|
20532
21721
|
}
|
|
20533
21722
|
function firstRunNoticeShown() {
|
|
20534
21723
|
try {
|
|
20535
|
-
return
|
|
21724
|
+
return existsSync22(FIRST_RUN_MARKER);
|
|
20536
21725
|
} catch {
|
|
20537
21726
|
return false;
|
|
20538
21727
|
}
|
|
20539
21728
|
}
|
|
20540
21729
|
function markFirstRunNotice() {
|
|
20541
21730
|
try {
|
|
20542
|
-
|
|
20543
|
-
|
|
21731
|
+
mkdirSync8(join22(homedir5(), ".launchpad"), { recursive: true });
|
|
21732
|
+
writeFileSync12(FIRST_RUN_MARKER, `${Date.now()}
|
|
20544
21733
|
`, { mode: 384 });
|
|
20545
21734
|
} catch {}
|
|
20546
21735
|
}
|
|
@@ -20605,22 +21794,22 @@ import { createInterface as createInterface7 } from "node:readline/promises";
|
|
|
20605
21794
|
import { platform } from "node:os";
|
|
20606
21795
|
|
|
20607
21796
|
// src/report/breadcrumb.ts
|
|
20608
|
-
import { writeFileSync as
|
|
21797
|
+
import { writeFileSync as writeFileSync13, readFileSync as readFileSync27, mkdirSync as mkdirSync9 } from "node:fs";
|
|
20609
21798
|
import { homedir as homedir6 } from "node:os";
|
|
20610
|
-
import { join as
|
|
21799
|
+
import { join as join23, dirname as dirname16 } from "node:path";
|
|
20611
21800
|
function breadcrumbPath() {
|
|
20612
|
-
return
|
|
21801
|
+
return join23(homedir6(), ".launchpad", "last-run.json");
|
|
20613
21802
|
}
|
|
20614
21803
|
function writeBreadcrumb(verb, exit) {
|
|
20615
21804
|
try {
|
|
20616
21805
|
const p = breadcrumbPath();
|
|
20617
|
-
|
|
20618
|
-
|
|
21806
|
+
mkdirSync9(dirname16(p), { recursive: true });
|
|
21807
|
+
writeFileSync13(p, JSON.stringify({ verb, exit, ts: Date.now() }), "utf8");
|
|
20619
21808
|
} catch {}
|
|
20620
21809
|
}
|
|
20621
21810
|
function readBreadcrumb() {
|
|
20622
21811
|
try {
|
|
20623
|
-
const raw = JSON.parse(
|
|
21812
|
+
const raw = JSON.parse(readFileSync27(breadcrumbPath(), "utf8"));
|
|
20624
21813
|
if (typeof raw !== "object" || raw === null)
|
|
20625
21814
|
return null;
|
|
20626
21815
|
const r = raw;
|