@m-kopa/launchpad-cli 0.69.0 → 0.70.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 +13 -0
- package/dist/cli.js +355 -160
- package/dist/commands/migrate-live.d.ts +19 -0
- package/dist/commands/migrate-live.d.ts.map +1 -0
- package/dist/commands/migrate.d.ts +2 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/secrets/push.d.ts +6 -0
- package/dist/secrets/push.d.ts.map +1 -1
- 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 +8 -3
- package/skills/launchpad-deploy-status/SKILL.md +10 -1
- package/skills/launchpad-destroy/SKILL.md +1 -1
- package/skills/launchpad-identity/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 +1 -1
- package/dist/manifest/migrate-dispatch.d.ts +0 -18
- package/dist/manifest/migrate-dispatch.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
|
|
7
7
|
pre-1.0 minor bumps may carry breaking changes per ADR 0005.
|
|
8
8
|
|
|
9
|
+
## 0.70.0 - 2026-10-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `launchpad migrate` moves a live Pages app to Workers dispatch in stages: `--origin dispatch --dry-run` checks it, `--origin dispatch` stages the Worker while users stay on Pages, `--flip` moves routing once the Worker is read back, has your secrets and serves its home page, and `--finalize` deletes the Pages project after a 24-hour soak. `--rollback` goes back to Pages with one Terraform apply until you finalize, and `--status` shows where it is. Owners and co-owners only; break-glass passes `--consent`. The platform team switches it on per app while it rolls out (ADR 0041 amendment 1).
|
|
14
|
+
- `launchpad secrets push --staged` writes secrets to the staged Worker during a migration, before the flip.
|
|
15
|
+
- `launchpad status` shows the migration stage and which origin is serving users, in text and `--json`.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- `launchpad migrate --origin dispatch` on a registered app now asks the platform instead of refusing with "ask the platform team".
|
|
20
|
+
- `launchpad deploy` can no longer change a live app's origin. A manifest that would move a registered app between Pages and dispatch is refused with `origin_change_requires_migrate`; use `launchpad migrate`.
|
|
21
|
+
|
|
9
22
|
## 0.69.0 - 2026-10-05
|
|
10
23
|
|
|
11
24
|
### Changed
|
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.70.0";
|
|
23
23
|
|
|
24
24
|
// src/config.ts
|
|
25
25
|
import { readFileSync } from "node:fs";
|
|
@@ -3345,6 +3345,7 @@ var EnvVarSchema = z3.discriminatedUnion("type", [
|
|
|
3345
3345
|
z3.object({ type: z3.literal("secret_text"), secret_ref: z3.string().min(1) }).strict(),
|
|
3346
3346
|
z3.object({ type: z3.literal("plain_text"), value: z3.string() }).strict()
|
|
3347
3347
|
]);
|
|
3348
|
+
var MIGRATION_STAGES = ["staged", "flipped"];
|
|
3348
3349
|
var SpecSchema = z3.object({
|
|
3349
3350
|
appType: z3.enum(APP_TYPES2),
|
|
3350
3351
|
display: z3.object({
|
|
@@ -3374,6 +3375,7 @@ var SpecSchema = z3.object({
|
|
|
3374
3375
|
containers: z3.array(ContainerSchema).min(1).optional(),
|
|
3375
3376
|
secrets: SecretsSchema.optional(),
|
|
3376
3377
|
fronted_by_concierge: z3.boolean().optional(),
|
|
3378
|
+
migration: z3.object({ stage: z3.enum(MIGRATION_STAGES) }).strict().optional(),
|
|
3377
3379
|
bindings: z3.object({
|
|
3378
3380
|
d1: z3.string().min(1).max(64).regex(ENV_NAME_REGEX, "bindings.d1 must be an UPPER_SNAKE_CASE binding name").optional()
|
|
3379
3381
|
}).strict().optional()
|
|
@@ -3438,7 +3440,7 @@ var SpecSchema = z3.object({
|
|
|
3438
3440
|
message: "origin: dispatch requires an explicit auth: gateway (auth defaults to 'access' when omitted). A dispatch-namespace Worker has no public hostname for Cloudflare Access to gate, so the gateway must be the sole gate."
|
|
3439
3441
|
});
|
|
3440
3442
|
}
|
|
3441
|
-
if (s.confine_origin !== undefined) {
|
|
3443
|
+
if (s.confine_origin !== undefined && s.migration === undefined) {
|
|
3442
3444
|
ctx.addIssue({
|
|
3443
3445
|
code: z3.ZodIssueCode.custom,
|
|
3444
3446
|
path: ["confine_origin"],
|
|
@@ -3446,6 +3448,22 @@ var SpecSchema = z3.object({
|
|
|
3446
3448
|
});
|
|
3447
3449
|
}
|
|
3448
3450
|
}
|
|
3451
|
+
if (s.migration !== undefined) {
|
|
3452
|
+
if (s.origin !== "dispatch") {
|
|
3453
|
+
ctx.addIssue({
|
|
3454
|
+
code: z3.ZodIssueCode.custom,
|
|
3455
|
+
path: ["migration"],
|
|
3456
|
+
message: "migration is only valid with origin: dispatch; the portal-bot writes it while moving a live app."
|
|
3457
|
+
});
|
|
3458
|
+
}
|
|
3459
|
+
if (s.appType !== "static" && s.appType !== "react" && s.appType !== "react+api") {
|
|
3460
|
+
ctx.addIssue({
|
|
3461
|
+
code: z3.ZodIssueCode.custom,
|
|
3462
|
+
path: ["migration"],
|
|
3463
|
+
message: `migration is only valid for static, react and react+api apps (current appType: '${s.appType}')`
|
|
3464
|
+
});
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3449
3467
|
if (s.bindings?.d1 !== undefined) {
|
|
3450
3468
|
if (s.origin !== "dispatch") {
|
|
3451
3469
|
ctx.addIssue({
|
|
@@ -4905,6 +4923,144 @@ function uncompiledFunctionsWarning(spec, paths) {
|
|
|
4905
4923
|
return null;
|
|
4906
4924
|
return `warning: ${dir}/ will NOT be served. This is a ${spec.appType} app on Workers dispatch, and only react+api apps ` + `get their functions compiled, so every route under ${dir}/ returns 404. Running them needs ` + "`appType: react+api` with a package.json and lockfile at the build root. For an app that is already live, " + "that is a runtime change: ask the platform team with `launchpad feature` rather than flipping appType yourself. " + 'See the launchpad-identity skill, "Dispatch rules".';
|
|
4907
4925
|
}
|
|
4926
|
+
// ../launchpad-engine/dist/migrate-dispatch.js
|
|
4927
|
+
var PLATFORM_ENV_NAMES = new Set([
|
|
4928
|
+
"GATEWAY_ISSUER",
|
|
4929
|
+
"GATEWAY_AUD",
|
|
4930
|
+
"GATEWAY_JWKS_URL",
|
|
4931
|
+
"CF_ACCESS_TEAM_DOMAIN",
|
|
4932
|
+
"CF_ACCESS_AUD",
|
|
4933
|
+
"JWKS_URL"
|
|
4934
|
+
]);
|
|
4935
|
+
var PLATFORM_ENV_PREFIXES = ["GATEWAY_", "CF_ACCESS_"];
|
|
4936
|
+
function dispatchManifest(manifest, wrangler = {}) {
|
|
4937
|
+
const v2 = manifest.apiVersion === "launchpad.m-kopa.us/v2";
|
|
4938
|
+
const source = v2 ? manifest.spec : manifest;
|
|
4939
|
+
const appType = v2 ? manifest.spec.appType : manifest.deployment.type;
|
|
4940
|
+
if (appType === "container" || source.containers !== undefined) {
|
|
4941
|
+
throw new Error("Containers use their own runtime and cannot convert to dispatch.");
|
|
4942
|
+
}
|
|
4943
|
+
if (!v2)
|
|
4944
|
+
assertConvertibleV1(manifest);
|
|
4945
|
+
const d1 = d1Binding(v2 ? manifest.spec.bindings?.d1 : pagesTargetD1(manifest), wrangler.d1);
|
|
4946
|
+
const manifestEnv = v2 ? manifest.spec.env_vars : plainTextEnv(manifest.production_env);
|
|
4947
|
+
const plainEnv = withWranglerVars(manifestEnv, wrangler.vars ?? {}, d1);
|
|
4948
|
+
const envVars = { ...plainEnv, ...secretEnv(source.secrets, plainEnv) };
|
|
4949
|
+
const spec = v2 ? { ...manifest.spec, secrets: undefined } : {
|
|
4950
|
+
appType,
|
|
4951
|
+
display: {
|
|
4952
|
+
name: manifest.metadata.name,
|
|
4953
|
+
team: manifest.metadata.team,
|
|
4954
|
+
...manifest.metadata.description === undefined ? {} : { description: manifest.metadata.description }
|
|
4955
|
+
},
|
|
4956
|
+
owner: { email: manifest.metadata.owner },
|
|
4957
|
+
access: {
|
|
4958
|
+
audience: manifest.access.audience,
|
|
4959
|
+
private_owner: manifest.access.private_owner,
|
|
4960
|
+
allowed_entra_groups: [...allowedEntraGroups(manifest.access)],
|
|
4961
|
+
identity_types: manifest.access.identity_types
|
|
4962
|
+
},
|
|
4963
|
+
build: manifest.build,
|
|
4964
|
+
app: manifest.app,
|
|
4965
|
+
verify: manifest.verify,
|
|
4966
|
+
sensitive: manifest.sensitive,
|
|
4967
|
+
catalogue: manifest.catalogue
|
|
4968
|
+
};
|
|
4969
|
+
const candidate = {
|
|
4970
|
+
apiVersion: "launchpad.m-kopa.us/v2",
|
|
4971
|
+
kind: "App",
|
|
4972
|
+
metadata: v2 ? manifest.metadata : { slug: manifest.metadata.name, schemaVersion: 2 },
|
|
4973
|
+
spec: {
|
|
4974
|
+
...spec,
|
|
4975
|
+
...d1 === undefined ? {} : { bindings: { d1 } },
|
|
4976
|
+
env_vars: Object.keys(envVars).length === 0 ? undefined : envVars,
|
|
4977
|
+
origin: "dispatch",
|
|
4978
|
+
auth: "gateway",
|
|
4979
|
+
confine_origin: undefined
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4982
|
+
return parseV2OrThrow(candidate, "Cannot convert manifest");
|
|
4983
|
+
}
|
|
4984
|
+
function parseV2OrThrow(candidate, prefix) {
|
|
4985
|
+
const parsed = parseManifestV2(candidate);
|
|
4986
|
+
if (parsed.kind !== "ok") {
|
|
4987
|
+
throw new Error(`${prefix}: ${parsed.issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ")}`);
|
|
4988
|
+
}
|
|
4989
|
+
return parsed.manifest;
|
|
4990
|
+
}
|
|
4991
|
+
function assertConvertibleV1(manifest) {
|
|
4992
|
+
const unsupported2 = [
|
|
4993
|
+
manifest.hostnames !== undefined && "hostnames",
|
|
4994
|
+
manifest.targets !== undefined && pagesTargetD1(manifest) === undefined && "targets",
|
|
4995
|
+
manifest.access.session_duration !== undefined && "access.session_duration",
|
|
4996
|
+
manifest.deployment.runtime !== undefined && "deployment.runtime"
|
|
4997
|
+
].filter(Boolean);
|
|
4998
|
+
if (unsupported2.length > 0) {
|
|
4999
|
+
throw new Error(`Cannot preserve ${unsupported2.join(", ")} on dispatch. Review these settings with the platform team before migrating.`);
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
function d1Binding(declared, wranglerD1) {
|
|
5003
|
+
if (declared !== undefined && wranglerD1 !== undefined && declared !== wranglerD1) {
|
|
5004
|
+
throw new Error(`The manifest binds D1 as ${declared} but the wrangler config binds ${wranglerD1}. Use one name for both.`);
|
|
5005
|
+
}
|
|
5006
|
+
return declared ?? wranglerD1;
|
|
5007
|
+
}
|
|
5008
|
+
function withWranglerVars(env, vars, d1) {
|
|
5009
|
+
const entries = Object.entries(vars);
|
|
5010
|
+
if (entries.length === 0)
|
|
5011
|
+
return env;
|
|
5012
|
+
const out = { ...env };
|
|
5013
|
+
for (const [name, value] of entries) {
|
|
5014
|
+
if (isPlatformEnvName(name)) {
|
|
5015
|
+
throw new Error(`The wrangler var ${name} is set by the platform on dispatch apps. Rename it before converting.`);
|
|
5016
|
+
}
|
|
5017
|
+
if (/_(TOKEN|SECRET)$/.test(name)) {
|
|
5018
|
+
throw new Error(`The wrangler var ${name} is named like a secret. Declare it as an \`env-file\` secret in launchpad.yaml and remove it from the wrangler vars.`);
|
|
5019
|
+
}
|
|
5020
|
+
if (name === d1)
|
|
5021
|
+
throw new Error(`The wrangler var ${name} has the same name as the D1 binding. Rename one of them.`);
|
|
5022
|
+
const existing = out[name];
|
|
5023
|
+
if (existing !== undefined && !(existing.type === "plain_text" && existing.value === value)) {
|
|
5024
|
+
throw new Error(`The wrangler var ${name} differs from the ${name} environment variable in launchpad.yaml. Keep one value.`);
|
|
5025
|
+
}
|
|
5026
|
+
out[name] = { type: "plain_text", value };
|
|
5027
|
+
}
|
|
5028
|
+
return out;
|
|
5029
|
+
}
|
|
5030
|
+
function isPlatformEnvName(name) {
|
|
5031
|
+
return PLATFORM_ENV_NAMES.has(name) || PLATFORM_ENV_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
5032
|
+
}
|
|
5033
|
+
function plainTextEnv(env) {
|
|
5034
|
+
if (env === undefined)
|
|
5035
|
+
return;
|
|
5036
|
+
return Object.fromEntries(Object.entries(env).map(([name, value]) => [name, { type: "plain_text", value }]));
|
|
5037
|
+
}
|
|
5038
|
+
function secretEnv(secrets, env) {
|
|
5039
|
+
const out = {};
|
|
5040
|
+
for (const binding of secrets?.bindings ?? []) {
|
|
5041
|
+
const refusal = secretRefusal(binding, env);
|
|
5042
|
+
if (refusal !== undefined)
|
|
5043
|
+
throw new Error(`Secret ${binding.name} ${refusal}`);
|
|
5044
|
+
out[binding.name] = { type: "secret_text", secret_ref: binding.name };
|
|
5045
|
+
}
|
|
5046
|
+
return out;
|
|
5047
|
+
}
|
|
5048
|
+
function secretRefusal(binding, env) {
|
|
5049
|
+
const targets = binding.targets === undefined || binding.targets === "all" ? [] : binding.targets;
|
|
5050
|
+
const checks = [
|
|
5051
|
+
[binding.source !== "env-file", "is platform-managed and cannot be converted automatically. Ask the platform team to migrate it."],
|
|
5052
|
+
[targets.some((target) => target !== "primary"), "targets another surface, which dispatch does not have."],
|
|
5053
|
+
[PLATFORM_ENV_NAMES.has(binding.name), "is set by the platform on dispatch apps. Rename it before converting."],
|
|
5054
|
+
[env?.[binding.name] !== undefined, "is also declared as an environment variable. Keep one."]
|
|
5055
|
+
];
|
|
5056
|
+
return checks.find(([refused]) => refused)?.[1];
|
|
5057
|
+
}
|
|
5058
|
+
function pagesTargetD1(manifest) {
|
|
5059
|
+
const [target, ...rest] = manifest.targets ?? [];
|
|
5060
|
+
if (rest.length > 0 || target?.kind !== "pages")
|
|
5061
|
+
return;
|
|
5062
|
+
return target.d1_binding;
|
|
5063
|
+
}
|
|
4908
5064
|
// src/bundle/boundary.ts
|
|
4909
5065
|
var MAX_CONTENT_PROBE_BYTES = 1024 * 1024;
|
|
4910
5066
|
function applyBoundaryToFiles(args) {
|
|
@@ -6396,7 +6552,7 @@ async function runStatus(args, io) {
|
|
|
6396
6552
|
};
|
|
6397
6553
|
}
|
|
6398
6554
|
}
|
|
6399
|
-
emit4(output, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6555
|
+
emit4(output, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6400
6556
|
return 0;
|
|
6401
6557
|
}
|
|
6402
6558
|
let localYaml = null;
|
|
@@ -6473,7 +6629,7 @@ async function runStatus(args, io) {
|
|
|
6473
6629
|
}),
|
|
6474
6630
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6475
6631
|
};
|
|
6476
|
-
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6632
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6477
6633
|
return 0;
|
|
6478
6634
|
}
|
|
6479
6635
|
if (local === null) {
|
|
@@ -6490,7 +6646,7 @@ async function runStatus(args, io) {
|
|
|
6490
6646
|
}),
|
|
6491
6647
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6492
6648
|
};
|
|
6493
|
-
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6649
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6494
6650
|
if (parsed.strict) {
|
|
6495
6651
|
if (deployment?.liveDeployment?.buildStatus === "failure" || deployment?.v2?.state === "refused") {
|
|
6496
6652
|
io.err(`launchpad status: --strict: live build FAILED ` + `(drift not evaluated — no local launchpad.yaml here).`);
|
|
@@ -6528,7 +6684,7 @@ async function runStatus(args, io) {
|
|
|
6528
6684
|
...standingExceptions !== null ? { standingExceptions } : {}
|
|
6529
6685
|
})
|
|
6530
6686
|
};
|
|
6531
|
-
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6687
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6532
6688
|
return 0;
|
|
6533
6689
|
}
|
|
6534
6690
|
const localGroups = await resolveStatusGroups({
|
|
@@ -6591,7 +6747,7 @@ async function runStatus(args, io) {
|
|
|
6591
6747
|
...groupIssues.length === 0 ? {} : { groupIssues },
|
|
6592
6748
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6593
6749
|
};
|
|
6594
|
-
emit4(result, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6750
|
+
emit4(result, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6595
6751
|
if (parsed.strict && (result.state === "drift" || accessDrift?.inSync === false || groupIssues.length > 0)) {
|
|
6596
6752
|
return 1;
|
|
6597
6753
|
}
|
|
@@ -6846,12 +7002,25 @@ function containerRedeployLine(view) {
|
|
|
6846
7002
|
}
|
|
6847
7003
|
return `Container redeploy: ${view.state} (attempt ${view.attemptId})`;
|
|
6848
7004
|
}
|
|
6849
|
-
function
|
|
6850
|
-
|
|
7005
|
+
function withLifecycleExtras(base, containerRedeploy, migration) {
|
|
7006
|
+
return {
|
|
7007
|
+
...base,
|
|
7008
|
+
...containerRedeploy === undefined ? {} : { containerRedeploy },
|
|
7009
|
+
...migration === undefined ? {} : { migration }
|
|
7010
|
+
};
|
|
7011
|
+
}
|
|
7012
|
+
function printMigrationLine(slug, migration, io) {
|
|
7013
|
+
if (migration === undefined)
|
|
7014
|
+
return;
|
|
7015
|
+
io.out(`Migration to Workers dispatch: ${migration.stage} (users served by ${migration.servingOrigin}). ` + `Details: launchpad migrate --status --slug ${slug}`);
|
|
7016
|
+
}
|
|
7017
|
+
function emit4(base, asJson, io, containerRedeploy, migration) {
|
|
7018
|
+
const out = withLifecycleExtras(base, containerRedeploy, migration);
|
|
6851
7019
|
if (asJson) {
|
|
6852
7020
|
io.out(JSON.stringify(out, null, 2));
|
|
6853
7021
|
return;
|
|
6854
7022
|
}
|
|
7023
|
+
printMigrationLine(out.slug, migration, io);
|
|
6855
7024
|
if (out.statusPageUrl !== undefined) {
|
|
6856
7025
|
io.out(`Status page: ${out.statusPageUrl}`);
|
|
6857
7026
|
}
|
|
@@ -9110,142 +9279,6 @@ import { closeSync, existsSync as existsSync7, lstatSync as lstatSync4, mkdirSyn
|
|
|
9110
9279
|
import path8 from "node:path";
|
|
9111
9280
|
import { stringify } from "yaml";
|
|
9112
9281
|
|
|
9113
|
-
// src/manifest/migrate-dispatch.ts
|
|
9114
|
-
var PLATFORM_ENV_NAMES = new Set([
|
|
9115
|
-
"GATEWAY_ISSUER",
|
|
9116
|
-
"GATEWAY_AUD",
|
|
9117
|
-
"GATEWAY_JWKS_URL",
|
|
9118
|
-
"CF_ACCESS_TEAM_DOMAIN",
|
|
9119
|
-
"CF_ACCESS_AUD",
|
|
9120
|
-
"JWKS_URL"
|
|
9121
|
-
]);
|
|
9122
|
-
var PLATFORM_ENV_PREFIXES = ["GATEWAY_", "CF_ACCESS_"];
|
|
9123
|
-
function dispatchManifest(manifest, wrangler = {}) {
|
|
9124
|
-
const v2 = manifest.apiVersion === "launchpad.m-kopa.us/v2";
|
|
9125
|
-
const source = v2 ? manifest.spec : manifest;
|
|
9126
|
-
const appType = v2 ? manifest.spec.appType : manifest.deployment.type;
|
|
9127
|
-
if (appType === "container" || source.containers !== undefined) {
|
|
9128
|
-
throw new Error("Containers use their own runtime and cannot convert to dispatch.");
|
|
9129
|
-
}
|
|
9130
|
-
if (!v2)
|
|
9131
|
-
assertConvertibleV1(manifest);
|
|
9132
|
-
const d1 = d1Binding(v2 ? manifest.spec.bindings?.d1 : pagesTargetD1(manifest), wrangler.d1);
|
|
9133
|
-
const manifestEnv = v2 ? manifest.spec.env_vars : plainTextEnv(manifest.production_env);
|
|
9134
|
-
const plainEnv = withWranglerVars(manifestEnv, wrangler.vars ?? {}, d1);
|
|
9135
|
-
const envVars = { ...plainEnv, ...secretEnv(source.secrets, plainEnv) };
|
|
9136
|
-
const spec = v2 ? { ...manifest.spec, secrets: undefined } : {
|
|
9137
|
-
appType,
|
|
9138
|
-
display: {
|
|
9139
|
-
name: manifest.metadata.name,
|
|
9140
|
-
team: manifest.metadata.team,
|
|
9141
|
-
...manifest.metadata.description === undefined ? {} : { description: manifest.metadata.description }
|
|
9142
|
-
},
|
|
9143
|
-
owner: { email: manifest.metadata.owner },
|
|
9144
|
-
access: {
|
|
9145
|
-
audience: manifest.access.audience,
|
|
9146
|
-
private_owner: manifest.access.private_owner,
|
|
9147
|
-
allowed_entra_groups: [...allowedEntraGroups(manifest.access)],
|
|
9148
|
-
identity_types: manifest.access.identity_types
|
|
9149
|
-
},
|
|
9150
|
-
build: manifest.build,
|
|
9151
|
-
app: manifest.app,
|
|
9152
|
-
verify: manifest.verify,
|
|
9153
|
-
sensitive: manifest.sensitive,
|
|
9154
|
-
catalogue: manifest.catalogue
|
|
9155
|
-
};
|
|
9156
|
-
const candidate = {
|
|
9157
|
-
apiVersion: "launchpad.m-kopa.us/v2",
|
|
9158
|
-
kind: "App",
|
|
9159
|
-
metadata: v2 ? manifest.metadata : { slug: manifest.metadata.name, schemaVersion: 2 },
|
|
9160
|
-
spec: {
|
|
9161
|
-
...spec,
|
|
9162
|
-
...d1 === undefined ? {} : { bindings: { d1 } },
|
|
9163
|
-
env_vars: Object.keys(envVars).length === 0 ? undefined : envVars,
|
|
9164
|
-
origin: "dispatch",
|
|
9165
|
-
auth: "gateway",
|
|
9166
|
-
confine_origin: undefined
|
|
9167
|
-
}
|
|
9168
|
-
};
|
|
9169
|
-
const parsed = parseManifestV2(candidate);
|
|
9170
|
-
if (parsed.kind !== "ok") {
|
|
9171
|
-
throw new Error(`Cannot convert manifest: ${parsed.issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ")}`);
|
|
9172
|
-
}
|
|
9173
|
-
return parsed.manifest;
|
|
9174
|
-
}
|
|
9175
|
-
function assertConvertibleV1(manifest) {
|
|
9176
|
-
const unsupported2 = [
|
|
9177
|
-
manifest.hostnames !== undefined && "hostnames",
|
|
9178
|
-
manifest.targets !== undefined && pagesTargetD1(manifest) === undefined && "targets",
|
|
9179
|
-
manifest.access.session_duration !== undefined && "access.session_duration",
|
|
9180
|
-
manifest.deployment.runtime !== undefined && "deployment.runtime"
|
|
9181
|
-
].filter(Boolean);
|
|
9182
|
-
if (unsupported2.length > 0) {
|
|
9183
|
-
throw new Error(`Cannot preserve ${unsupported2.join(", ")} on dispatch. Review these settings with the platform team before migrating.`);
|
|
9184
|
-
}
|
|
9185
|
-
}
|
|
9186
|
-
function d1Binding(declared, wranglerD1) {
|
|
9187
|
-
if (declared !== undefined && wranglerD1 !== undefined && declared !== wranglerD1) {
|
|
9188
|
-
throw new Error(`The manifest binds D1 as ${declared} but the wrangler config binds ${wranglerD1}. Use one name for both.`);
|
|
9189
|
-
}
|
|
9190
|
-
return declared ?? wranglerD1;
|
|
9191
|
-
}
|
|
9192
|
-
function withWranglerVars(env, vars, d1) {
|
|
9193
|
-
const entries = Object.entries(vars);
|
|
9194
|
-
if (entries.length === 0)
|
|
9195
|
-
return env;
|
|
9196
|
-
const out = { ...env };
|
|
9197
|
-
for (const [name, value] of entries) {
|
|
9198
|
-
if (isPlatformEnvName(name)) {
|
|
9199
|
-
throw new Error(`The wrangler var ${name} is set by the platform on dispatch apps. Rename it before converting.`);
|
|
9200
|
-
}
|
|
9201
|
-
if (/_(TOKEN|SECRET)$/.test(name)) {
|
|
9202
|
-
throw new Error(`The wrangler var ${name} is named like a secret. Declare it as an \`env-file\` secret in launchpad.yaml and remove it from the wrangler vars.`);
|
|
9203
|
-
}
|
|
9204
|
-
if (name === d1)
|
|
9205
|
-
throw new Error(`The wrangler var ${name} has the same name as the D1 binding. Rename one of them.`);
|
|
9206
|
-
const existing = out[name];
|
|
9207
|
-
if (existing !== undefined && !(existing.type === "plain_text" && existing.value === value)) {
|
|
9208
|
-
throw new Error(`The wrangler var ${name} differs from the ${name} environment variable in launchpad.yaml. Keep one value.`);
|
|
9209
|
-
}
|
|
9210
|
-
out[name] = { type: "plain_text", value };
|
|
9211
|
-
}
|
|
9212
|
-
return out;
|
|
9213
|
-
}
|
|
9214
|
-
function isPlatformEnvName(name) {
|
|
9215
|
-
return PLATFORM_ENV_NAMES.has(name) || PLATFORM_ENV_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
9216
|
-
}
|
|
9217
|
-
function plainTextEnv(env) {
|
|
9218
|
-
if (env === undefined)
|
|
9219
|
-
return;
|
|
9220
|
-
return Object.fromEntries(Object.entries(env).map(([name, value]) => [name, { type: "plain_text", value }]));
|
|
9221
|
-
}
|
|
9222
|
-
function secretEnv(secrets, env) {
|
|
9223
|
-
const out = {};
|
|
9224
|
-
for (const binding of secrets?.bindings ?? []) {
|
|
9225
|
-
const refusal = secretRefusal(binding, env);
|
|
9226
|
-
if (refusal !== undefined)
|
|
9227
|
-
throw new Error(`Secret ${binding.name} ${refusal}`);
|
|
9228
|
-
out[binding.name] = { type: "secret_text", secret_ref: binding.name };
|
|
9229
|
-
}
|
|
9230
|
-
return out;
|
|
9231
|
-
}
|
|
9232
|
-
function secretRefusal(binding, env) {
|
|
9233
|
-
const targets = binding.targets === undefined || binding.targets === "all" ? [] : binding.targets;
|
|
9234
|
-
const checks = [
|
|
9235
|
-
[binding.source !== "env-file", "is platform-managed and cannot be converted automatically. Ask the platform team to migrate it."],
|
|
9236
|
-
[targets.some((target) => target !== "primary"), "targets another surface, which dispatch does not have."],
|
|
9237
|
-
[PLATFORM_ENV_NAMES.has(binding.name), "is set by the platform on dispatch apps. Rename it before converting."],
|
|
9238
|
-
[env?.[binding.name] !== undefined, "is also declared as an environment variable. Keep one."]
|
|
9239
|
-
];
|
|
9240
|
-
return checks.find(([refused]) => refused)?.[1];
|
|
9241
|
-
}
|
|
9242
|
-
function pagesTargetD1(manifest) {
|
|
9243
|
-
const [target, ...rest] = manifest.targets ?? [];
|
|
9244
|
-
if (rest.length > 0 || target?.kind !== "pages")
|
|
9245
|
-
return;
|
|
9246
|
-
return target.d1_binding;
|
|
9247
|
-
}
|
|
9248
|
-
|
|
9249
9282
|
// src/manifest/wrangler-config.ts
|
|
9250
9283
|
var ALLOWED_KEYS = new Set([
|
|
9251
9284
|
"name",
|
|
@@ -9474,34 +9507,183 @@ function stringEnd(text, start) {
|
|
|
9474
9507
|
return text.length;
|
|
9475
9508
|
}
|
|
9476
9509
|
|
|
9510
|
+
// src/commands/migrate-live.ts
|
|
9511
|
+
var WARNINGS = {
|
|
9512
|
+
rollback: "Rolling back serves the app's last Pages build again. Any D1 writes or schema changes made since staging stay as they are.",
|
|
9513
|
+
finalize: "Finalizing deletes the Pages project. Rolling back after this needs a free Pages slot and a rebuild, and every secret has to be pushed again."
|
|
9514
|
+
};
|
|
9515
|
+
async function runLiveMigration(slug, action, options, io) {
|
|
9516
|
+
const warning = WARNINGS[action];
|
|
9517
|
+
if (warning !== undefined && !options.json)
|
|
9518
|
+
io.err(`note: ${warning}`);
|
|
9519
|
+
let res;
|
|
9520
|
+
try {
|
|
9521
|
+
res = await apiRaw(loadConfig(), {
|
|
9522
|
+
method: action === "status" ? "GET" : "POST",
|
|
9523
|
+
path: `/apps/${encodeURIComponent(slug)}/migration`,
|
|
9524
|
+
...action === "status" ? {} : { jsonBody: { action, ...options.consent === undefined ? {} : { consent: options.consent } } },
|
|
9525
|
+
nonThrowingStatuses: [400, 409, 500, 502, 503]
|
|
9526
|
+
});
|
|
9527
|
+
} catch (error) {
|
|
9528
|
+
if (error instanceof ForbiddenError || error instanceof NotFoundError) {
|
|
9529
|
+
io.err(`launchpad migrate: ${error.message}`);
|
|
9530
|
+
return 1;
|
|
9531
|
+
}
|
|
9532
|
+
throw error;
|
|
9533
|
+
}
|
|
9534
|
+
const body = await res.json().catch(() => ({})) ?? {};
|
|
9535
|
+
if (options.json) {
|
|
9536
|
+
io.out(JSON.stringify({ httpStatus: res.status, ...body }, null, 2));
|
|
9537
|
+
return exitFor(action, res.status, body);
|
|
9538
|
+
}
|
|
9539
|
+
render(slug, action, res.status, body, io);
|
|
9540
|
+
return exitFor(action, res.status, body);
|
|
9541
|
+
}
|
|
9542
|
+
function exitFor(action, status, body) {
|
|
9543
|
+
if (action === "check")
|
|
9544
|
+
return status === 200 && body.eligible === true ? 0 : 1;
|
|
9545
|
+
return status === 200 || status === 202 ? 0 : 1;
|
|
9546
|
+
}
|
|
9547
|
+
function render(slug, action, status, body, io) {
|
|
9548
|
+
const refusals = Array.isArray(body.refusals) ? body.refusals : [];
|
|
9549
|
+
if (action === "check")
|
|
9550
|
+
renderCheck(slug, body, refusals, io);
|
|
9551
|
+
else if (status === 200 || status === 202)
|
|
9552
|
+
renderAccepted(slug, action, body, io);
|
|
9553
|
+
else
|
|
9554
|
+
renderRefused(status, body, refusals, io);
|
|
9555
|
+
}
|
|
9556
|
+
function renderCheck(slug, body, refusals, io) {
|
|
9557
|
+
if (body.eligible === true) {
|
|
9558
|
+
io.out(`${slug}: eligible to move to Workers dispatch. Nothing was changed.`);
|
|
9559
|
+
io.out("Run `launchpad migrate --origin dispatch` to stage it. Users stay on Pages until you flip.");
|
|
9560
|
+
} else {
|
|
9561
|
+
io.out(`${slug}: not eligible to move yet.`);
|
|
9562
|
+
for (const refusal of refusals)
|
|
9563
|
+
io.out(` ${refusal.code}: ${refusal.message}`);
|
|
9564
|
+
}
|
|
9565
|
+
renderLedger(body.migration, io);
|
|
9566
|
+
}
|
|
9567
|
+
function renderAccepted(slug, action, body, io) {
|
|
9568
|
+
if (typeof body.commitSha === "string") {
|
|
9569
|
+
io.out(`${slug}: ${action} committed ${body.commitSha.slice(0, 12)}.`);
|
|
9570
|
+
if (typeof body.prUrl === "string")
|
|
9571
|
+
io.out(`Terraform: ${body.prUrl}`);
|
|
9572
|
+
if (body.reconcile === "pending")
|
|
9573
|
+
io.out("The Terraform change is queued; the platform finishes it automatically.");
|
|
9574
|
+
io.out("Run `launchpad pull` so your local launchpad.yaml matches before your next deploy.");
|
|
9575
|
+
}
|
|
9576
|
+
if (body.migration === null) {
|
|
9577
|
+
io.out(`${slug}: no migration has started. Run \`launchpad migrate --origin dispatch --dry-run\`.`);
|
|
9578
|
+
return;
|
|
9579
|
+
}
|
|
9580
|
+
renderLedger(body.migration, io);
|
|
9581
|
+
}
|
|
9582
|
+
function renderRefused(status, body, refusals, io) {
|
|
9583
|
+
io.err(`launchpad migrate: ${typeof body.message === "string" ? body.message : `the bot answered ${status}`}`);
|
|
9584
|
+
if (refusals.length > 1)
|
|
9585
|
+
for (const refusal of refusals)
|
|
9586
|
+
io.err(` ${refusal.code}: ${refusal.message}`);
|
|
9587
|
+
}
|
|
9588
|
+
function renderLedger(ledger, io) {
|
|
9589
|
+
if (ledger === null || ledger === undefined)
|
|
9590
|
+
return;
|
|
9591
|
+
io.out(`Migration stage: ${ledger.stage}`);
|
|
9592
|
+
if (ledger.delivery !== null && ledger.delivery !== undefined) {
|
|
9593
|
+
io.out(`Dispatch delivery: ${ledger.delivery.state}${ledger.delivery.reason === null ? "" : ` (${ledger.delivery.reason})`}`);
|
|
9594
|
+
if (ledger.delivery.runUrl !== null)
|
|
9595
|
+
io.out(`Build: ${ledger.delivery.runUrl}`);
|
|
9596
|
+
}
|
|
9597
|
+
if (typeof ledger.next === "string")
|
|
9598
|
+
io.out(`Next: ${ledger.next}`);
|
|
9599
|
+
}
|
|
9600
|
+
|
|
9477
9601
|
// src/commands/migrate.ts
|
|
9478
|
-
var USAGE =
|
|
9602
|
+
var USAGE = [
|
|
9603
|
+
"usage: launchpad migrate --origin dispatch [--dry-run] [--consent <text>]",
|
|
9604
|
+
" launchpad migrate --status | --flip | --finalize | --rollback [--slug <slug>] [--consent <text>] [--json]"
|
|
9605
|
+
].join(`
|
|
9606
|
+
`);
|
|
9479
9607
|
var migrateCommand = {
|
|
9480
9608
|
name: "migrate",
|
|
9481
|
-
summary: "
|
|
9609
|
+
summary: "move an app to Workers dispatch (unprovisioned: local YAML; live: staged, flipped, finalized)",
|
|
9482
9610
|
run: runMigrate
|
|
9483
9611
|
};
|
|
9612
|
+
var LIVE_FLAGS = {
|
|
9613
|
+
"--status": "status",
|
|
9614
|
+
"--flip": "flip",
|
|
9615
|
+
"--finalize": "finalize",
|
|
9616
|
+
"--rollback": "rollback"
|
|
9617
|
+
};
|
|
9618
|
+
function parseMigrateArgs(args) {
|
|
9619
|
+
const seen = new Set;
|
|
9620
|
+
const live = [];
|
|
9621
|
+
let consent;
|
|
9622
|
+
let slug;
|
|
9623
|
+
for (let i = 0;i < args.length; i++) {
|
|
9624
|
+
const arg = args[i];
|
|
9625
|
+
const action = LIVE_FLAGS[arg];
|
|
9626
|
+
if (action !== undefined)
|
|
9627
|
+
live.push(action);
|
|
9628
|
+
else if (arg === "--origin" && args[i + 1] === "dispatch")
|
|
9629
|
+
seen.add(args[i++]);
|
|
9630
|
+
else if (arg === "--consent" && args[i + 1] !== undefined)
|
|
9631
|
+
consent = args[++i];
|
|
9632
|
+
else if (arg === "--slug" && args[i + 1] !== undefined && !args[i + 1].startsWith("-"))
|
|
9633
|
+
slug = args[++i];
|
|
9634
|
+
else if (arg === "--dry-run" || arg === "--json")
|
|
9635
|
+
seen.add(arg);
|
|
9636
|
+
else
|
|
9637
|
+
return null;
|
|
9638
|
+
}
|
|
9639
|
+
const origin = seen.has("--origin");
|
|
9640
|
+
const dryRun = seen.has("--dry-run");
|
|
9641
|
+
const valid = live.length === 0 ? origin && slug === undefined : live.length === 1 && !origin && !dryRun;
|
|
9642
|
+
if (!valid)
|
|
9643
|
+
return null;
|
|
9644
|
+
return {
|
|
9645
|
+
action: live[0] ?? "origin",
|
|
9646
|
+
dryRun,
|
|
9647
|
+
json: seen.has("--json"),
|
|
9648
|
+
...consent === undefined ? {} : { consent },
|
|
9649
|
+
...slug === undefined ? {} : { slug }
|
|
9650
|
+
};
|
|
9651
|
+
}
|
|
9484
9652
|
async function runMigrate(args, io) {
|
|
9485
9653
|
if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
|
|
9486
9654
|
io.out(USAGE);
|
|
9487
9655
|
return 0;
|
|
9488
9656
|
}
|
|
9489
|
-
const
|
|
9490
|
-
if (
|
|
9657
|
+
const parsed = parseMigrateArgs(args);
|
|
9658
|
+
if (parsed === null) {
|
|
9491
9659
|
io.err(USAGE);
|
|
9492
9660
|
return 64;
|
|
9493
9661
|
}
|
|
9494
9662
|
try {
|
|
9495
|
-
|
|
9496
|
-
|
|
9663
|
+
if (parsed.action !== "origin")
|
|
9664
|
+
return await runLive(parsed.action, parsed, io);
|
|
9665
|
+
try {
|
|
9666
|
+
reportMigration(io, await convertToDispatch(process.cwd(), parsed.dryRun));
|
|
9667
|
+
return 0;
|
|
9668
|
+
} catch (error) {
|
|
9669
|
+
if (!(error instanceof RegisteredAppError))
|
|
9670
|
+
throw error;
|
|
9671
|
+
return await runLive(parsed.dryRun ? "check" : "start", parsed, io);
|
|
9672
|
+
}
|
|
9497
9673
|
} catch (error) {
|
|
9498
9674
|
io.err(`launchpad migrate: ${error instanceof Error ? error.message : String(error)}`);
|
|
9499
9675
|
return 1;
|
|
9500
9676
|
}
|
|
9501
9677
|
}
|
|
9678
|
+
async function runLive(action, parsed, io) {
|
|
9679
|
+
const slug = parsed.slug ?? inferSlug({ cwd: process.cwd(), warn: (line) => io.err(line) });
|
|
9680
|
+
if (slug === null)
|
|
9681
|
+
throw new Error("run this in the app's directory (next to launchpad.yaml).");
|
|
9682
|
+
return runLiveMigration(slug, action, { json: parsed.json, ...parsed.consent === undefined ? {} : { consent: parsed.consent } }, io);
|
|
9683
|
+
}
|
|
9502
9684
|
function reportMigration(io, result) {
|
|
9503
9685
|
if (result.kind === "already") {
|
|
9504
|
-
io.out("launchpad.yaml already selects Workers dispatch. Run `launchpad deploy`.");
|
|
9686
|
+
io.out(result.migrating === true ? "This app is mid-migration to Workers dispatch. Run `launchpad migrate --status` for the next step." : "launchpad.yaml already selects Workers dispatch. Run `launchpad deploy`.");
|
|
9505
9687
|
return;
|
|
9506
9688
|
}
|
|
9507
9689
|
if (result.kind === "eligible") {
|
|
@@ -9538,8 +9720,9 @@ async function convertToDispatch(cwd, dryRun) {
|
|
|
9538
9720
|
if (loaded.kind !== "ok")
|
|
9539
9721
|
throw new InvalidManifestError;
|
|
9540
9722
|
const manifest = loaded.manifest;
|
|
9541
|
-
if (manifest.apiVersion === "launchpad.m-kopa.us/v2" && manifest.spec.origin === "dispatch")
|
|
9542
|
-
return { kind: "already" };
|
|
9723
|
+
if (manifest.apiVersion === "launchpad.m-kopa.us/v2" && manifest.spec.origin === "dispatch") {
|
|
9724
|
+
return { kind: "already", migrating: manifest.spec.migration !== undefined };
|
|
9725
|
+
}
|
|
9543
9726
|
const slug = manifest.apiVersion === "launchpad.m-kopa.us/v2" ? manifest.metadata.slug : manifest.metadata.name;
|
|
9544
9727
|
let converted;
|
|
9545
9728
|
try {
|
|
@@ -9619,7 +9802,7 @@ class RegistryUnavailableError extends Error {
|
|
|
9619
9802
|
|
|
9620
9803
|
class RegisteredAppError extends Error {
|
|
9621
9804
|
constructor() {
|
|
9622
|
-
super("This app is already registered
|
|
9805
|
+
super("This app is already registered, so its local launchpad.yaml was not converted. Run `launchpad migrate --origin dispatch --dry-run` to check whether it can move.");
|
|
9623
9806
|
}
|
|
9624
9807
|
}
|
|
9625
9808
|
var WRANGLER_FILES = ["wrangler.toml", "wrangler.json", "wrangler.jsonc"];
|
|
@@ -15094,7 +15277,7 @@ async function runSecretsPush(opts, io, deps = {}) {
|
|
|
15094
15277
|
try {
|
|
15095
15278
|
resp = await apiJson(cfg, {
|
|
15096
15279
|
method: "POST",
|
|
15097
|
-
path: `/apps/${slug}/secrets/${b.name}`,
|
|
15280
|
+
path: `/apps/${slug}/secrets/${b.name}${opts.staged === true ? "?target=staged" : ""}`,
|
|
15098
15281
|
jsonBody: b.targets !== undefined ? { value, targets: b.targets } : { value },
|
|
15099
15282
|
nonThrowingStatuses: [409]
|
|
15100
15283
|
}, fetcher);
|
|
@@ -15107,7 +15290,7 @@ async function runSecretsPush(opts, io, deps = {}) {
|
|
|
15107
15290
|
io.err(`✗ secrets push ${b.name}: invalid bot response (results must be an array)`);
|
|
15108
15291
|
return 2;
|
|
15109
15292
|
}
|
|
15110
|
-
if (resp.error === "dispatch_script_not_delivered") {
|
|
15293
|
+
if (resp.error === "dispatch_script_not_delivered" || resp.error === "no_staged_migration") {
|
|
15111
15294
|
io.err(`✗ secrets push ${b.name}: ${resp.message ?? "the dispatch script is not delivered yet"}`);
|
|
15112
15295
|
io.err(`${pushed} of ${envFileBindings.length} pushed before failure.`);
|
|
15113
15296
|
return 1;
|
|
@@ -15145,7 +15328,9 @@ async function runSecretsPush(opts, io, deps = {}) {
|
|
|
15145
15328
|
if (anyPagesUpdated) {
|
|
15146
15329
|
return offerRedeploy(slug, opts, io, deps);
|
|
15147
15330
|
}
|
|
15148
|
-
if (anyDispatchUpdated) {
|
|
15331
|
+
if (anyDispatchUpdated && opts.staged === true) {
|
|
15332
|
+
io.out("Set on the staged dispatch script. It serves users once you run `launchpad migrate --flip`.");
|
|
15333
|
+
} else if (anyDispatchUpdated) {
|
|
15149
15334
|
io.out("Set on the app's dispatch Worker and live now - no redeploy needed.");
|
|
15150
15335
|
} else if (anyWorkerUpdated) {
|
|
15151
15336
|
io.out("These secrets bind on the app's next invocation — no redeploy needed.");
|
|
@@ -15776,7 +15961,7 @@ async function runSecrets(args, io) {
|
|
|
15776
15961
|
if (typeof parsed === "string") {
|
|
15777
15962
|
io.err(`launchpad secrets push: ${parsed}`);
|
|
15778
15963
|
io.err("");
|
|
15779
|
-
io.err("usage: launchpad secrets push [--file <manifest>] [--env <.env>] [--dry-run] [--redeploy] [--yes]");
|
|
15964
|
+
io.err("usage: launchpad secrets push [--file <manifest>] [--env <.env>] [--dry-run] [--redeploy | --staged] [--yes]");
|
|
15780
15965
|
io.err(" launchpad secrets push --set <name> [--fleet-file <path>] [--env <.env>] [--yes]");
|
|
15781
15966
|
return 64;
|
|
15782
15967
|
}
|
|
@@ -15812,6 +15997,7 @@ function parsePushArgs(args) {
|
|
|
15812
15997
|
let fleetFile = null;
|
|
15813
15998
|
let yes = false;
|
|
15814
15999
|
let redeploy = false;
|
|
16000
|
+
let staged = false;
|
|
15815
16001
|
let i = 0;
|
|
15816
16002
|
while (i < args.length) {
|
|
15817
16003
|
const a = args[i] ?? "";
|
|
@@ -15842,6 +16028,11 @@ function parsePushArgs(args) {
|
|
|
15842
16028
|
i += 1;
|
|
15843
16029
|
continue;
|
|
15844
16030
|
}
|
|
16031
|
+
if (a === "--staged") {
|
|
16032
|
+
staged = true;
|
|
16033
|
+
i += 1;
|
|
16034
|
+
continue;
|
|
16035
|
+
}
|
|
15845
16036
|
if (a === "--redeploy") {
|
|
15846
16037
|
redeploy = true;
|
|
15847
16038
|
i += 1;
|
|
@@ -15854,9 +16045,13 @@ function parsePushArgs(args) {
|
|
|
15854
16045
|
return "--file/--dry-run are not valid with --set (use --fleet-file / --yes)";
|
|
15855
16046
|
if (redeploy)
|
|
15856
16047
|
return "--redeploy is not valid with --set (a fleet secret-set has no single app to redeploy)";
|
|
16048
|
+
if (staged)
|
|
16049
|
+
return "--staged is not valid with --set (it targets one app's staged migration)";
|
|
15857
16050
|
return { set, fleetFile, env, yes };
|
|
15858
16051
|
}
|
|
15859
|
-
|
|
16052
|
+
if (staged && redeploy)
|
|
16053
|
+
return "--redeploy is not valid with --staged (the staged script needs no redeploy)";
|
|
16054
|
+
return { file, env, dryRun, redeploy: redeploy || yes, ...staged ? { staged } : {} };
|
|
15860
16055
|
}
|
|
15861
16056
|
function parseStatusArgs(args) {
|
|
15862
16057
|
let file = null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `launchpad migrate` for a registered, live app (ADR 0041 amendment 1): a
|
|
3
|
+
* thin client over the portal-bot's `/apps/<slug>/migration` endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Owns: argument-to-action mapping, the warnings an owner must read before
|
|
6
|
+
* finalize or rollback, and rendering the bot's verdicts.
|
|
7
|
+
*
|
|
8
|
+
* Must never: edit the local launchpad.yaml (the bot commits every stage and
|
|
9
|
+
* the owner picks it up with `launchpad pull`), or decide eligibility itself;
|
|
10
|
+
* the bot is the authority and this only reports what it said.
|
|
11
|
+
*/
|
|
12
|
+
import type { CliIo } from "../dispatcher.js";
|
|
13
|
+
export type LiveAction = "check" | "start" | "status" | "flip" | "finalize" | "rollback";
|
|
14
|
+
/** Run one migration action against the bot and render the answer. Returns the exit code. */
|
|
15
|
+
export declare function runLiveMigration(slug: string, action: LiveAction, options: {
|
|
16
|
+
readonly consent?: string;
|
|
17
|
+
readonly json: boolean;
|
|
18
|
+
}, io: CliIo): Promise<number>;
|
|
19
|
+
//# sourceMappingURL=migrate-live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-live.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAsBzF,6FAA6F;AAC7F,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,EAC9D,EAAE,EAAE,KAAK,GACR,OAAO,CAAC,MAAM,CAAC,CA2BjB"}
|
|
@@ -7,6 +7,7 @@ export declare const BACKUP_PATH = ".launchpad/manifest-before-dispatch.yaml";
|
|
|
7
7
|
export declare function secretsNextStep(secrets: readonly string[]): string | null;
|
|
8
8
|
export type DispatchConversion = {
|
|
9
9
|
readonly kind: "already";
|
|
10
|
+
readonly migrating?: boolean;
|
|
10
11
|
} | {
|
|
11
12
|
readonly kind: "eligible" | "converted";
|
|
12
13
|
readonly slug: string;
|
|
@@ -41,7 +42,7 @@ export declare class MigrationSaveError extends Error {
|
|
|
41
42
|
export declare class RegistryUnavailableError extends Error {
|
|
42
43
|
constructor(cause: unknown);
|
|
43
44
|
}
|
|
44
|
-
/** The slug already has an app record;
|
|
45
|
+
/** The slug already has an app record; `launchpad migrate` then moves it through the bot in stages. */
|
|
45
46
|
export declare class RegisteredAppError extends Error {
|
|
46
47
|
constructor();
|
|
47
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAS,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAS,OAAO,EAAE,MAAM,kBAAkB,CAAC;AASvD,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC;AAgHF,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAI1E;AAED,eAAO,MAAM,WAAW,6CAA6C,CAAC;AAEtE,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAGzE;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1D;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,uFAAuF;IACvF,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C,CAAC;AAEN;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+BjG;AAqCD;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,KAAK,EAAE,OAAO;CAG3B;AAED,kFAAkF;AAClF,qBAAa,oBAAqB,SAAQ,KAAK;;CAI9C;AAED,yFAAyF;AACzF,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,KAAK,EAAE,OAAO;CAG3B;AAED,yFAAyF;AACzF,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,KAAK,EAAE,OAAO;CAG3B;AAED,uGAAuG;AACvG,qBAAa,kBAAmB,SAAQ,KAAK;;CAI5C"}
|
|
@@ -29,6 +29,14 @@ export interface LifecycleView {
|
|
|
29
29
|
readonly statusPageUrl?: string;
|
|
30
30
|
/** AIO-811: latest container content-redeploy outcome (never changes `state`). */
|
|
31
31
|
readonly containerRedeploy?: ContainerRedeployView;
|
|
32
|
+
/** Live-app dispatch migration, when one has started (ADR 0041 amendment 1). */
|
|
33
|
+
readonly migration?: MigrationView;
|
|
34
|
+
}
|
|
35
|
+
/** The migration stage and the origin serving users, as the bot reports it. */
|
|
36
|
+
export interface MigrationView {
|
|
37
|
+
readonly stage: string;
|
|
38
|
+
readonly servingOrigin: "pages" | "dispatch";
|
|
39
|
+
readonly updatedAt: string;
|
|
32
40
|
}
|
|
33
41
|
/** Latest container content-redeploy outcome, as the bot reports it. */
|
|
34
42
|
export interface ContainerRedeployView {
|
|
@@ -106,6 +114,8 @@ export interface StatusJsonOutput {
|
|
|
106
114
|
readonly statusPageUrl?: string;
|
|
107
115
|
/** AIO-811: latest container content-redeploy outcome (never changes `state`). */
|
|
108
116
|
readonly containerRedeploy?: ContainerRedeployView;
|
|
117
|
+
/** Live-app dispatch migration, when one has started (ADR 0041 amendment 1). */
|
|
118
|
+
readonly migration?: MigrationView;
|
|
109
119
|
}
|
|
110
120
|
export interface StatusGroupIssue {
|
|
111
121
|
readonly code: "group_not_assigned";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAC;AAUxC,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAGjE,eAAO,MAAM,aAAa,EAAE,OAI3B,CAAC;AAEF,UAAU,UAAU;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAID;;+EAE+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,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,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAChD,GACA,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CA2DpE;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,UAAU,EACpB,eAAe,CAAC,EAAE;IAChB,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAChD,GACA,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAsBpE;AAkFD,wEAAwE;AACxE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CASzE;AAkVD,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,oBAAoB,GAAG,MAAM,EAAE,CA6B3E;AAkFD;0BAC0B;AAC1B,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,GAAE,MAAsB,EAC3B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC5B,UAAU,GAAG,MAAM,CA2ErB"}
|
package/dist/secrets/push.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ export interface PushOptions {
|
|
|
13
13
|
* (no silent prod deploy — sp-rdpl41 AC3).
|
|
14
14
|
*/
|
|
15
15
|
readonly redeploy?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* `--staged`: write to the app's staged dispatch script during a live-app
|
|
18
|
+
* migration (between `launchpad migrate --origin dispatch` and `--flip`),
|
|
19
|
+
* so the flip's secret check passes. Users stay on Pages meanwhile.
|
|
20
|
+
*/
|
|
21
|
+
readonly staged?: boolean;
|
|
16
22
|
}
|
|
17
23
|
export interface PushDeps {
|
|
18
24
|
readonly config?: CliConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/secrets/push.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAY1D,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/secrets/push.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAY1D,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IAChC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,CACrB,IAAI,EAAE,eAAe,EACrB,EAAE,EAAE,KAAK,EACT,IAAI,CAAC,EAAE,YAAY,KAChB,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB;AAiBD,wBAAsB,cAAc,CAClC,IAAI,EAAE,WAAW,EACjB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC,QAAQ,CAAC,CAsNnB"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.
|
|
1
|
+
export declare const CLI_VERSION = "0.70.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-content-pr
|
|
3
3
|
description: Push a content change to a Launchpad app via `launchpad deploy` and verify it shipped via `launchpad status`. Covers the post-first-deploy iteration loop (edit → deploy → verify) - subsequent deploys commit directly to the app repo's main, then the dispatch delivery (or, for a legacy Pages app, the Pages build) runs asynchronously, so verification is its own step. Use when someone says "push a content change", "ship an update", "/launchpad-content-pr", "verify my deploy", or after `/launchpad-deploy` reports `done` and they want to follow up with an edit.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-deploy
|
|
3
3
|
description: Walk a Launchpad user through deploying an app from their local working directory (Model A — `launchpad init` + `launchpad deploy`). Wraps the CLI verbs end-to-end: detects the app shape, scaffolds `launchpad.yaml`, resolves the allowed Entra group via `launchpad groups`, bundles the CWD via `launchpad deploy`, and watches the rollout via `launchpad status`. Use when someone says "deploy a new app", "ship my app to Launchpad", "/launchpad-deploy", "I have an app locally — get it on Launchpad", or any variant. Resume/abandon for legacy in-flight provisioning is at the bottom.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -177,7 +177,12 @@ If `launchpad status` shows the same refusal after that deploy, the paths are ou
|
|
|
177
177
|
A refused dispatch build is not a reason to switch to Pages: do not rewrite the manifest as v1, set `origin: pages`, or pass `--origin pages` to get past it.
|
|
178
178
|
The Cloudflare account has a fixed limit of 100 Pages projects, so a new Pages project can fail at Terraform apply even after the CLI accepts the deploy.
|
|
179
179
|
Changing `appType` to `react` would not convert the API; do not suggest it.
|
|
180
|
-
|
|
180
|
+
A live app already on Pages moves with `launchpad migrate`, not by editing `origin` and deploying: deploy refuses that with `origin_change_requires_migrate`.
|
|
181
|
+
Only an owner or co-owner can run it, and only while the platform team has switched it on for that app; otherwise it answers `migration_disabled` or `not_on_allowlist`, which is not the author's fault.
|
|
182
|
+
The steps are `launchpad migrate --origin dispatch --dry-run` (a verdict with a code per blocker, nothing changed), `launchpad migrate --origin dispatch` (stage: users stay on Pages), `launchpad migrate --status` until it says `staged`, `launchpad secrets push --staged` for every Pages secret, `launchpad migrate --flip`, then `launchpad migrate --finalize` no sooner than 24 hours later.
|
|
183
|
+
Run `launchpad pull` after each step before the next deploy; a deploy whose manifest disagrees with the migration is refused with `migration_manifest_mismatch`.
|
|
184
|
+
Never run `--flip`, `--finalize` or `--rollback` for the author without asking first; finalize deletes the Pages project, and rollback after finalize is refused.
|
|
185
|
+
Do not delete Pages resources by hand.
|
|
181
186
|
If the pool is full or inventory cannot be read, report the capacity error; do not fall back to Pages or change authentication to bypass it.
|
|
182
187
|
Do not replace that manifest with a v1 example or add `--origin pages` just because an older app uses Pages.
|
|
183
188
|
Use `--origin pages` only when Pages is deliberately required.
|
|
@@ -490,7 +495,7 @@ Flags — there is nothing useful to pass on the Model A path:
|
|
|
490
495
|
a platform capacity fault, not the author's. Do not retry on Pages,
|
|
491
496
|
and do not create a new slug to get round it. A registered app that
|
|
492
497
|
was moved from dispatch to Pages needs the platform team to return
|
|
493
|
-
it to dispatch (`launchpad migrate`
|
|
498
|
+
it to dispatch (`launchpad migrate` only moves live Pages apps), so
|
|
494
499
|
offer `/launchpad-report` with the slug and the error.
|
|
495
500
|
- **Terminal-failed but the app is actually serving** → `launchpad
|
|
496
501
|
recover <slug>`. The bot re-derives reality from live Cloudflare
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-deploy-status
|
|
3
3
|
description: Show the current provisioning stage + failure reason for a Launchpad app via `launchpad status` (Model A drift + deployment_verified) and `launchpad apps` (lifecycle bucket), or watch provisioning live with `launchpad watch`. Renders the M-892 stage trace for in-flight provisioning, and is the canonical home for `launchpad recover` (repair a terminal-failed app record that is actually live). Use when someone says "what's the status of demo-X", "/launchpad-deploy-status", "is my deploy stuck", "watch my deploy go live", "watch provisioning", "my app says failed but it's serving", or after `/launchpad-deploy` reports a non-`done` terminal stage.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -375,6 +375,15 @@ into the body. Do **not** offer to file for a user-side failure (auth/401,
|
|
|
375
375
|
not-found/404) — resolve those instead.
|
|
376
376
|
|
|
377
377
|
|
|
378
|
+
## Live-app migration status
|
|
379
|
+
|
|
380
|
+
When `launchpad status` prints `Migration to Workers dispatch: <stage> (users served by <origin>)`, the app is mid-migration (or finished one).
|
|
381
|
+
Run `launchpad migrate --status` for the detail and relay its `Next:` line verbatim.
|
|
382
|
+
The stages are `staging` (building and uploading the Worker; users on Pages), `staged` (ready to flip), `flipped` (users on the Worker; Pages kept for rollback during the 24-hour soak), `finalized` (Pages deleted) and `rolled_back` (back on Pages).
|
|
383
|
+
In `staging`, a `Dispatch delivery: refused` line means the staged build failed: relay the reason, and the author either fixes it and deploys again or runs `launchpad migrate --rollback`.
|
|
384
|
+
Ask before running `--flip`, `--finalize` or `--rollback`; they change what users are served.
|
|
385
|
+
If a deploy is refused with `migration_manifest_mismatch` or `origin_change_requires_migrate`, run `launchpad pull` and deploy again; do not edit `origin` or `migration` by hand.
|
|
386
|
+
|
|
378
387
|
## Dispatch status in CLI 0.60.0
|
|
379
388
|
|
|
380
389
|
New static and React apps use Workers dispatch and have no per-app Pages project.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-destroy
|
|
3
3
|
description: Tear down a Launchpad app end-to-end via `launchpad destroy` — Cloudflare Pages project, edge-auth wiring (gateway KV/audience entries, or the Access app for `auth: access` apps), custom hostname, platform-repo TF, and the app repo (archive-renamed). Owner-only verb with a two-step destructive confirmation. Use when someone says "destroy this app", "/launchpad-destroy", "tear down `<slug>`", "delete the app", or asks to clean up a smoke-test / orphan / retired app.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-identity
|
|
3
3
|
description: Teach an app author how to use the signed-in user's identity inside a Launchpad app - read the gateway-forwarded X-Launchpad-User-Assertion in the app's server code (functions/ on a react+api app, compiled into its Worker on dispatch, or a Pages Function on a legacy Pages app), VERIFY it with @m-kopa/platform-auth (fail-closed), and show who's logged in (sub/email/name). Use when someone says "who is logged in", "show the current user", "get the user's email in my app", "auth in my launchpad app", "read the user identity", "/launchpad-identity", or is wiring up an /api/me for a gateway-fronted app.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-onboard
|
|
3
3
|
description: One-time setup for the Launchpad CLI + Claude Code skill bundle. Verifies the `launchpad` CLI is installed and current, runs `launchpad whoami` to confirm the session is fresh, and checks the bundled skills are installed and in lock-step with the CLI. Idempotent — safe to re-run any time. Use when someone says "set me up for Launchpad", "I just got a new machine and want to use Launchpad", "/launchpad-onboard", or any of the other launchpad-* skills fails on a prereq check.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-report
|
|
3
3
|
description: File a bug report or feature request to the Launchpad team's tracker from the CLI. Use when someone reports something broken, hits an error in a launchpad command, or wishes a feature existed — e.g. "this is broken", "report a bug", "can you file that", "I wish launchpad could…", "/launchpad-bug", "/launchpad-feature". Always confirm and show exactly what you'll send before filing; never file silently.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-status
|
|
3
3
|
description: Safely refresh a Launchpad clone, show manifest drift, or read the deployed manifest. Wraps bare `launchpad pull` for source sync, `launchpad pull --manifest` for deployed YAML, and `launchpad status` for drift. Use for "sync my clone", "what's deployed", "show drift", "/launchpad-status", "/launchpad-pull", or post-deploy verification.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type DeploymentManifest, type Manifest, type ManifestV2 } from "@m-kopa/launchpad-engine";
|
|
2
|
-
/** What the app's wrangler config declares, already checked by the caller. */
|
|
3
|
-
export interface WranglerSettings {
|
|
4
|
-
readonly d1?: string;
|
|
5
|
-
readonly vars?: Readonly<Record<string, string>>;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Convert a Pages-implied manifest to v2 dispatch, keeping only what the
|
|
9
|
-
* dispatch runtime preserves. Wrangler `vars` become plain_text env vars.
|
|
10
|
-
*/
|
|
11
|
-
export declare function dispatchManifest(manifest: DeploymentManifest, wrangler?: WranglerSettings): ManifestV2;
|
|
12
|
-
/**
|
|
13
|
-
* The D1 binding name when `targets` is exactly one pages target carrying
|
|
14
|
-
* `d1_binding`. Dispatch declares that database as `spec.bindings.d1`; every
|
|
15
|
-
* other target shape (cron Workers, secrets surfaces) has no dispatch form.
|
|
16
|
-
*/
|
|
17
|
-
export declare function pagesTargetD1(manifest: Pick<Manifest, "targets">): string | undefined;
|
|
18
|
-
//# sourceMappingURL=migrate-dispatch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-dispatch.d.ts","sourceRoot":"","sources":["../../src/manifest/migrate-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,QAAQ,EACb,KAAK,UAAU,EAGhB,MAAM,0BAA0B,CAAC;AAUlC,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAClD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,GAAE,gBAAqB,GAAG,UAAU,CAiD1G;AA2FD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAIrF"}
|