@m-kopa/launchpad-cli 0.69.0 → 0.71.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 +26 -0
- package/dist/bundle/upload.d.ts +2 -0
- package/dist/bundle/upload.d.ts.map +1 -1
- package/dist/cli.js +572 -253
- package/dist/commands/deploy.d.ts.map +1 -1
- 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/deploy/deployment-status.d.ts +39 -3
- package/dist/deploy/deployment-status.d.ts.map +1 -1
- package/dist/notices.d.ts +32 -0
- package/dist/notices.d.ts.map +1 -0
- 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 +9 -1
- package/skills/launchpad-deploy/SKILL.md +16 -3
- package/skills/launchpad-deploy-status/SKILL.md +19 -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 +10 -1
- package/dist/manifest/migrate-dispatch.d.ts +0 -18
- package/dist/manifest/migrate-dispatch.d.ts.map +0 -1
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.71.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) {
|
|
@@ -5070,6 +5226,9 @@ function dispatchFunctionsWarning(manifestYaml, files) {
|
|
|
5070
5226
|
import { readFileSync as readFileSync10, existsSync as existsSync4 } from "node:fs";
|
|
5071
5227
|
import { join as join9 } from "node:path";
|
|
5072
5228
|
|
|
5229
|
+
// src/deploy/deployment-status.ts
|
|
5230
|
+
import { z as z7 } from "zod";
|
|
5231
|
+
|
|
5073
5232
|
// src/deploy/redact-diagnostic.ts
|
|
5074
5233
|
var MAX_DIAGNOSTIC_LEN = 600;
|
|
5075
5234
|
var SECRET_KV = /(["']?)(\b[A-Za-z0-9_-]*(?:secrets?|token|api[_-]?key|access[_-]?key|secret[_-]?key|private[_-]?key|password|passwd|pwd|authorization|auth[_-]?token|bearer|client[_-]?secret|session)\b)\1(\s*[=:]\s*|\s+)(?:"[^"]*"|'[^']*'|\S+)/gi;
|
|
@@ -5085,6 +5244,51 @@ function redactDiagnostic(text, maxLen = MAX_DIAGNOSTIC_LEN) {
|
|
|
5085
5244
|
return t;
|
|
5086
5245
|
}
|
|
5087
5246
|
|
|
5247
|
+
// src/notices.ts
|
|
5248
|
+
import { z as z6 } from "zod";
|
|
5249
|
+
var NOTICE_COMMAND_ALLOWLIST = new Set([
|
|
5250
|
+
"launchpad migrate --origin dispatch --dry-run",
|
|
5251
|
+
"launchpad migrate --status",
|
|
5252
|
+
"launchpad migrate --finalize"
|
|
5253
|
+
]);
|
|
5254
|
+
var MAX_TEXT = 300;
|
|
5255
|
+
var NoticeSchema = z6.object({
|
|
5256
|
+
id: z6.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
|
|
5257
|
+
schema: z6.literal(1),
|
|
5258
|
+
level: z6.enum(["info", "warning"]),
|
|
5259
|
+
text: z6.string().transform(clean).pipe(z6.string().min(1)),
|
|
5260
|
+
command: z6.string().optional().catch(undefined)
|
|
5261
|
+
});
|
|
5262
|
+
function parseNotices(raw) {
|
|
5263
|
+
if (!Array.isArray(raw))
|
|
5264
|
+
return [];
|
|
5265
|
+
return raw.flatMap((item) => {
|
|
5266
|
+
const parsed = NoticeSchema.safeParse(item);
|
|
5267
|
+
if (!parsed.success)
|
|
5268
|
+
return [];
|
|
5269
|
+
const { command, ...notice } = parsed.data;
|
|
5270
|
+
return [command !== undefined && NOTICE_COMMAND_ALLOWLIST.has(command) ? { ...notice, command } : notice];
|
|
5271
|
+
});
|
|
5272
|
+
}
|
|
5273
|
+
function clean(text) {
|
|
5274
|
+
const printable = [...text].map((ch) => {
|
|
5275
|
+
const code = ch.charCodeAt(0);
|
|
5276
|
+
return code < 32 || code >= 127 && code <= 159 ? " " : ch;
|
|
5277
|
+
});
|
|
5278
|
+
return printable.join("").trim().slice(0, MAX_TEXT);
|
|
5279
|
+
}
|
|
5280
|
+
function renderNotices(notices, io) {
|
|
5281
|
+
if (notices.length === 0)
|
|
5282
|
+
return;
|
|
5283
|
+
io.out("");
|
|
5284
|
+
for (const notice of notices) {
|
|
5285
|
+
io.out(`${notice.level === "warning" ? "Warning" : "Notice"}: ${notice.text}`);
|
|
5286
|
+
if (notice.command !== undefined && !notice.text.includes(notice.command)) {
|
|
5287
|
+
io.out(` ${notice.command}`);
|
|
5288
|
+
}
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5291
|
+
|
|
5088
5292
|
// src/deploy/deployment-status.ts
|
|
5089
5293
|
async function fetchStandingExceptions(cfg, slug, fetcher = fetch) {
|
|
5090
5294
|
let raw;
|
|
@@ -5106,10 +5310,12 @@ async function fetchDeploymentStatusBestEffort(cfg, slug) {
|
|
|
5106
5310
|
return null;
|
|
5107
5311
|
}
|
|
5108
5312
|
}
|
|
5109
|
-
async function fetchDeploymentStatus(cfg, slug, fetcher = fetch) {
|
|
5313
|
+
async function fetchDeploymentStatus(cfg, slug, fetcher = fetch, options = {}) {
|
|
5110
5314
|
let raw;
|
|
5111
5315
|
try {
|
|
5112
|
-
raw = await apiJson(cfg, {
|
|
5316
|
+
raw = await apiJson(cfg, {
|
|
5317
|
+
path: `/apps/${encodeURIComponent(slug)}/deployment-status` + (options.notices === true ? "?notices=1" : "")
|
|
5318
|
+
}, fetcher);
|
|
5113
5319
|
} catch (e) {
|
|
5114
5320
|
if (e instanceof NotFoundError)
|
|
5115
5321
|
return null;
|
|
@@ -5124,9 +5330,14 @@ async function fetchDeploymentStatus(cfg, slug, fetcher = fetch) {
|
|
|
5124
5330
|
...projectV2(raw.v2),
|
|
5125
5331
|
liveDeployment: scrubLiveDeployment(raw.liveDeployment ?? null),
|
|
5126
5332
|
lastSuccessfulDeployment: projectLastSuccessful(raw.lastSuccessfulDeployment),
|
|
5127
|
-
...raw.reconciledToLive === true ? { reconciledToLive: true } : {}
|
|
5333
|
+
...raw.reconciledToLive === true ? { reconciledToLive: true } : {},
|
|
5334
|
+
...noticesOf(raw.notices)
|
|
5128
5335
|
};
|
|
5129
5336
|
}
|
|
5337
|
+
function noticesOf(raw) {
|
|
5338
|
+
const notices = parseNotices(raw);
|
|
5339
|
+
return notices.length === 0 ? {} : { notices };
|
|
5340
|
+
}
|
|
5130
5341
|
function projectV2(value) {
|
|
5131
5342
|
if (value === null || typeof value !== "object")
|
|
5132
5343
|
return {};
|
|
@@ -5148,10 +5359,38 @@ function projectV2(value) {
|
|
|
5148
5359
|
...typeof raw.reason === "string" ? { reason: redactDiagnostic(raw.reason) } : {},
|
|
5149
5360
|
...typeof raw.detail === "string" ? { detail: redactDiagnostic(raw.detail) } : {},
|
|
5150
5361
|
...projectRunUrl(raw.runUrl),
|
|
5151
|
-
...typeof raw.deliveredAt === "string" ? { deliveredAt: raw.deliveredAt } : {}
|
|
5362
|
+
...typeof raw.deliveredAt === "string" ? { deliveredAt: raw.deliveredAt } : {},
|
|
5363
|
+
...projectVerifiedCommit(raw.verifiedCommit),
|
|
5364
|
+
...projectScriptBinding(raw.scriptBinding)
|
|
5152
5365
|
};
|
|
5153
5366
|
return { v2 };
|
|
5154
5367
|
}
|
|
5368
|
+
var Sha40 = z7.string().regex(/^[0-9a-f]{40}$/);
|
|
5369
|
+
var VerifiedCommitSchema = z7.object({
|
|
5370
|
+
commitSha: Sha40,
|
|
5371
|
+
runId: z7.number().int().positive(),
|
|
5372
|
+
artifactSha256: z7.string().regex(/^[0-9a-f]{64}$/),
|
|
5373
|
+
verifiedAt: z7.string().transform((value) => redactDiagnostic(value)),
|
|
5374
|
+
runUrl: z7.unknown().optional()
|
|
5375
|
+
});
|
|
5376
|
+
var ScriptBindingSchema = z7.object({
|
|
5377
|
+
state: z7.enum(["match", "mismatch", "unbound", "unreadable"]),
|
|
5378
|
+
commitSha: Sha40.optional().catch(undefined)
|
|
5379
|
+
});
|
|
5380
|
+
function projectVerifiedCommit(value) {
|
|
5381
|
+
const parsed = VerifiedCommitSchema.safeParse(value);
|
|
5382
|
+
if (!parsed.success)
|
|
5383
|
+
return {};
|
|
5384
|
+
const { runUrl, ...verifiedCommit } = parsed.data;
|
|
5385
|
+
return { verifiedCommit: { ...verifiedCommit, ...projectRunUrl(runUrl) } };
|
|
5386
|
+
}
|
|
5387
|
+
function projectScriptBinding(value) {
|
|
5388
|
+
const parsed = ScriptBindingSchema.safeParse(value);
|
|
5389
|
+
if (!parsed.success)
|
|
5390
|
+
return {};
|
|
5391
|
+
const { state, commitSha } = parsed.data;
|
|
5392
|
+
return { scriptBinding: { state, ...commitSha === undefined ? {} : { commitSha } } };
|
|
5393
|
+
}
|
|
5155
5394
|
function projectRunUrl(value) {
|
|
5156
5395
|
if (typeof value !== "string")
|
|
5157
5396
|
return {};
|
|
@@ -5920,10 +6159,10 @@ function sanitizeForTerminal(input) {
|
|
|
5920
6159
|
function sanitizeField(input, max = 160) {
|
|
5921
6160
|
if (input == null)
|
|
5922
6161
|
return "";
|
|
5923
|
-
const
|
|
5924
|
-
if (
|
|
5925
|
-
return
|
|
5926
|
-
return
|
|
6162
|
+
const clean2 = sanitizeForTerminal(input);
|
|
6163
|
+
if (clean2.length <= max)
|
|
6164
|
+
return clean2;
|
|
6165
|
+
return clean2.slice(0, Math.max(0, max - 1)) + "…";
|
|
5927
6166
|
}
|
|
5928
6167
|
|
|
5929
6168
|
// src/watch/render.ts
|
|
@@ -6377,7 +6616,7 @@ async function runStatus(args, io) {
|
|
|
6377
6616
|
let output = lifecycleOutput(parsed.slug, lifecycle);
|
|
6378
6617
|
if (lifecycle.state === "failed") {
|
|
6379
6618
|
try {
|
|
6380
|
-
const deployment2 = await fetchDeploymentStatus(cfg, parsed.slug);
|
|
6619
|
+
const deployment2 = await fetchDeploymentStatus(cfg, parsed.slug, fetch, { notices: true });
|
|
6381
6620
|
output = {
|
|
6382
6621
|
...output,
|
|
6383
6622
|
deployment: deployment2,
|
|
@@ -6396,7 +6635,7 @@ async function runStatus(args, io) {
|
|
|
6396
6635
|
};
|
|
6397
6636
|
}
|
|
6398
6637
|
}
|
|
6399
|
-
emit4(output, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6638
|
+
emit4(output, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6400
6639
|
return 0;
|
|
6401
6640
|
}
|
|
6402
6641
|
let localYaml = null;
|
|
@@ -6438,7 +6677,7 @@ async function runStatus(args, io) {
|
|
|
6438
6677
|
let deployment = null;
|
|
6439
6678
|
let deploymentKnown = false;
|
|
6440
6679
|
try {
|
|
6441
|
-
deployment = await fetchDeploymentStatus(cfg, parsed.slug);
|
|
6680
|
+
deployment = await fetchDeploymentStatus(cfg, parsed.slug, fetch, { notices: true });
|
|
6442
6681
|
deploymentKnown = deployment !== null;
|
|
6443
6682
|
} catch (e) {
|
|
6444
6683
|
if (e instanceof UnauthenticatedError || e instanceof ForbiddenError) {
|
|
@@ -6473,7 +6712,7 @@ async function runStatus(args, io) {
|
|
|
6473
6712
|
}),
|
|
6474
6713
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6475
6714
|
};
|
|
6476
|
-
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6715
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6477
6716
|
return 0;
|
|
6478
6717
|
}
|
|
6479
6718
|
if (local === null) {
|
|
@@ -6490,7 +6729,7 @@ async function runStatus(args, io) {
|
|
|
6490
6729
|
}),
|
|
6491
6730
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6492
6731
|
};
|
|
6493
|
-
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6732
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6494
6733
|
if (parsed.strict) {
|
|
6495
6734
|
if (deployment?.liveDeployment?.buildStatus === "failure" || deployment?.v2?.state === "refused") {
|
|
6496
6735
|
io.err(`launchpad status: --strict: live build FAILED ` + `(drift not evaluated — no local launchpad.yaml here).`);
|
|
@@ -6528,7 +6767,7 @@ async function runStatus(args, io) {
|
|
|
6528
6767
|
...standingExceptions !== null ? { standingExceptions } : {}
|
|
6529
6768
|
})
|
|
6530
6769
|
};
|
|
6531
|
-
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6770
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6532
6771
|
return 0;
|
|
6533
6772
|
}
|
|
6534
6773
|
const localGroups = await resolveStatusGroups({
|
|
@@ -6591,7 +6830,7 @@ async function runStatus(args, io) {
|
|
|
6591
6830
|
...groupIssues.length === 0 ? {} : { groupIssues },
|
|
6592
6831
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6593
6832
|
};
|
|
6594
|
-
emit4(result, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6833
|
+
emit4(result, parsed.json, io, lifecycle?.containerRedeploy, lifecycle?.migration);
|
|
6595
6834
|
if (parsed.strict && (result.state === "drift" || accessDrift?.inSync === false || groupIssues.length > 0)) {
|
|
6596
6835
|
return 1;
|
|
6597
6836
|
}
|
|
@@ -6846,95 +7085,119 @@ function containerRedeployLine(view) {
|
|
|
6846
7085
|
}
|
|
6847
7086
|
return `Container redeploy: ${view.state} (attempt ${view.attemptId})`;
|
|
6848
7087
|
}
|
|
6849
|
-
function
|
|
6850
|
-
|
|
7088
|
+
function withLifecycleExtras(base, containerRedeploy, migration) {
|
|
7089
|
+
return {
|
|
7090
|
+
...base,
|
|
7091
|
+
...containerRedeploy === undefined ? {} : { containerRedeploy },
|
|
7092
|
+
...migration === undefined ? {} : { migration }
|
|
7093
|
+
};
|
|
7094
|
+
}
|
|
7095
|
+
function printMigrationLine(slug, migration, io) {
|
|
7096
|
+
if (migration === undefined)
|
|
7097
|
+
return;
|
|
7098
|
+
io.out(`Migration to Workers dispatch: ${migration.stage} (users served by ${migration.servingOrigin}). ` + `Details: launchpad migrate --status --slug ${slug}`);
|
|
7099
|
+
}
|
|
7100
|
+
function emit4(base, asJson, io, containerRedeploy, migration) {
|
|
7101
|
+
const out = withLifecycleExtras(base, containerRedeploy, migration);
|
|
6851
7102
|
if (asJson) {
|
|
6852
|
-
io.out(JSON.stringify(out, null, 2));
|
|
7103
|
+
io.out(JSON.stringify(withTopLevelNotices(out), null, 2));
|
|
6853
7104
|
return;
|
|
6854
7105
|
}
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
io.out(
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
io.out(
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
7106
|
+
try {
|
|
7107
|
+
printMigrationLine(out.slug, migration, io);
|
|
7108
|
+
if (out.statusPageUrl !== undefined) {
|
|
7109
|
+
io.out(`Status page: ${out.statusPageUrl}`);
|
|
7110
|
+
}
|
|
7111
|
+
if (containerRedeploy !== undefined)
|
|
7112
|
+
io.out(containerRedeployLine(containerRedeploy));
|
|
7113
|
+
switch (out.state) {
|
|
7114
|
+
case "provisioning":
|
|
7115
|
+
io.out(`${out.slug}: provisioning (stage: ${out.stage ?? "starting"})` + (out.submissionId ? ` — submission ${out.submissionId}` : ""));
|
|
7116
|
+
io.out(" still working — re-run `launchpad status` to watch progress.");
|
|
7117
|
+
return;
|
|
7118
|
+
case "provisioning_failed":
|
|
7119
|
+
io.out(`${out.slug}: provisioning FAILED at stage ${out.stage ?? "unknown"}` + (out.failedReason ? `: ${out.failedReason}` : ""));
|
|
7120
|
+
if (out.deployment?.reconciledToLive === true) {
|
|
7121
|
+
io.out(` that lifecycle state is stale: this read verified the live build and reconciled the record failed→live.`);
|
|
7122
|
+
io.out(` no action needed — re-run \`launchpad status ${out.slug}\` to see the reconciled state.`);
|
|
7123
|
+
} else if (isLikelyLiveFailureStage(out.stage)) {
|
|
7124
|
+
io.out(` the app may already be live — run \`launchpad recover ${out.slug}\` to reconcile the record;`);
|
|
7125
|
+
io.out(` if it is not serving, the same command starts the stage-dependent recovery.`);
|
|
7126
|
+
} else {
|
|
7127
|
+
io.out(` run \`launchpad recover ${out.slug}\` to start the stage-dependent recovery.`);
|
|
7128
|
+
}
|
|
7129
|
+
surfaceFailedLifecycleDeployment(out, io);
|
|
7130
|
+
return;
|
|
7131
|
+
case "destroying":
|
|
7132
|
+
io.out(`${out.slug}: destroying…`);
|
|
7133
|
+
return;
|
|
7134
|
+
case "destroyed":
|
|
7135
|
+
io.out(`${out.slug}: destroyed (slug retired).`);
|
|
7136
|
+
return;
|
|
7137
|
+
case "destroy_failed":
|
|
7138
|
+
io.out(`${out.slug}: destroy FAILED — see the portal / re-run \`launchpad destroy\`.`);
|
|
7139
|
+
return;
|
|
7140
|
+
case "live_no_content":
|
|
7141
|
+
io.out(`${out.slug}: live — no content deployed yet. Run \`launchpad deploy\`.`);
|
|
7142
|
+
surfaceNoLocalManifestNote(out, io);
|
|
7143
|
+
surfaceHeadVsDeployed(out, io);
|
|
7144
|
+
surfaceDeployment(out, io);
|
|
7145
|
+
surfaceExceptions(out, io);
|
|
7146
|
+
return;
|
|
7147
|
+
case "no_deployed_manifest":
|
|
7148
|
+
io.out(`${out.slug}: no deployed manifest yet — run \`launchpad deploy\`.`);
|
|
7149
|
+
surfaceNoLocalManifestNote(out, io);
|
|
7150
|
+
surfaceHeadVsDeployed(out, io);
|
|
7151
|
+
surfaceDeployment(out, io);
|
|
7152
|
+
surfaceExceptions(out, io);
|
|
7153
|
+
return;
|
|
7154
|
+
case "live_content_untracked":
|
|
7155
|
+
io.out(`${out.slug}: live — content deployed via ` + `${triggerLabel(out.deployment?.liveDeployment?.trigger)} ` + `(no platform-tracked manifest; this app deploys outside \`launchpad deploy\`).`);
|
|
7156
|
+
surfaceNoLocalManifestNote(out, io);
|
|
7157
|
+
surfaceHeadVsDeployed(out, io);
|
|
7158
|
+
surfaceDeployment(out, io);
|
|
7159
|
+
surfaceExceptions(out, io);
|
|
7160
|
+
return;
|
|
7161
|
+
case "live_drift_unknown":
|
|
7162
|
+
io.out(`${out.slug}: live` + (out.deployedSha ? ` (content @ ${out.deployedSha.slice(0, 7)})` : ""));
|
|
7163
|
+
surfaceNoLocalManifestNote(out, io);
|
|
7164
|
+
surfaceHeadVsDeployed(out, io);
|
|
7165
|
+
surfaceDeployment(out, io);
|
|
7166
|
+
surfaceExceptions(out, io);
|
|
7167
|
+
return;
|
|
7168
|
+
case "in_sync":
|
|
7169
|
+
io.out(`${out.slug}: live, in sync` + (out.deployedSha ? ` (content @ ${out.deployedSha.slice(0, 7)})` : ""));
|
|
7170
|
+
surfaceHeadVsDeployed(out, io);
|
|
7171
|
+
surfaceAccessDrift(out, io);
|
|
7172
|
+
surfaceGroupIssues(out, io);
|
|
7173
|
+
surfaceDeployment(out, io);
|
|
7174
|
+
surfaceExceptions(out, io);
|
|
7175
|
+
return;
|
|
7176
|
+
case "drift":
|
|
7177
|
+
io.out(`${out.slug}: live, drift: ${out.driftFields.join(", ")}`);
|
|
7178
|
+
for (const d of out.driftDetails) {
|
|
7179
|
+
io.out(` ${d.path}:`);
|
|
7180
|
+
io.out(` local: ${formatValue(d.local)}`);
|
|
7181
|
+
io.out(` deployed: ${formatValue(d.deployed)}`);
|
|
7182
|
+
}
|
|
7183
|
+
surfaceHeadVsDeployed(out, io);
|
|
7184
|
+
surfaceAccessDrift(out, io);
|
|
7185
|
+
surfaceGroupIssues(out, io);
|
|
7186
|
+
surfaceDeployment(out, io);
|
|
7187
|
+
surfaceExceptions(out, io);
|
|
7188
|
+
return;
|
|
7189
|
+
}
|
|
7190
|
+
} finally {
|
|
7191
|
+
renderNotices(out.deployment?.notices ?? [], io);
|
|
6936
7192
|
}
|
|
6937
7193
|
}
|
|
7194
|
+
function withTopLevelNotices(out) {
|
|
7195
|
+
const notices = out.deployment?.notices;
|
|
7196
|
+
if (out.deployment === undefined || out.deployment === null || notices === undefined)
|
|
7197
|
+
return out;
|
|
7198
|
+
const { notices: _moved, ...deployment } = out.deployment;
|
|
7199
|
+
return { ...out, deployment, notices };
|
|
7200
|
+
}
|
|
6938
7201
|
function surfaceAccessDrift(out, io) {
|
|
6939
7202
|
const ad = out.accessDrift;
|
|
6940
7203
|
if (ad === undefined || ad.inSync)
|
|
@@ -7054,11 +7317,37 @@ function renderV2DeploymentLines(dep) {
|
|
|
7054
7317
|
if (delivery.runUrl)
|
|
7055
7318
|
lines.push(` GitHub run: ${delivery.runUrl}`);
|
|
7056
7319
|
}
|
|
7320
|
+
if (delivery.state === "delivered")
|
|
7321
|
+
lines.push(...commitBindingLines(delivery));
|
|
7057
7322
|
if (delivery.state !== "delivered" && dep.lastSuccessfulDeployment !== null) {
|
|
7058
7323
|
lines.push(` serving: previous successful deployment from ${dep.lastSuccessfulDeployment.createdOn}`);
|
|
7059
7324
|
}
|
|
7060
7325
|
return lines;
|
|
7061
7326
|
}
|
|
7327
|
+
function commitBindingLines(delivery) {
|
|
7328
|
+
const verified = delivery.verifiedCommit;
|
|
7329
|
+
const lines = [];
|
|
7330
|
+
if (verified !== undefined) {
|
|
7331
|
+
lines.push(` built from verified commit ${verified.commitSha.slice(0, 7)} (GitHub run ${verified.runId}, artifact sha256 ${verified.artifactSha256.slice(0, 12)})`);
|
|
7332
|
+
}
|
|
7333
|
+
switch (delivery.scriptBinding?.state) {
|
|
7334
|
+
case "match":
|
|
7335
|
+
lines.push(" script commit tag: matches this delivery");
|
|
7336
|
+
break;
|
|
7337
|
+
case "mismatch":
|
|
7338
|
+
lines.push(` WARNING: the live script is tagged with commit ${delivery.scriptBinding.commitSha?.slice(0, 7) ?? "(unreadable)"}, not this delivery's commit. It may have been uploaded outside a deploy; tell the platform team.`);
|
|
7339
|
+
break;
|
|
7340
|
+
case "unbound":
|
|
7341
|
+
lines.push(" script commit tag: none (uploaded before commit binding existed; the next deploy adds it)");
|
|
7342
|
+
break;
|
|
7343
|
+
case "unreadable":
|
|
7344
|
+
lines.push(" script commit tag: could not be read back from Cloudflare");
|
|
7345
|
+
break;
|
|
7346
|
+
default:
|
|
7347
|
+
break;
|
|
7348
|
+
}
|
|
7349
|
+
return lines;
|
|
7350
|
+
}
|
|
7062
7351
|
function surfaceExceptions(out, io) {
|
|
7063
7352
|
const exceptions = out.standingExceptions;
|
|
7064
7353
|
if (exceptions === undefined || exceptions.length === 0)
|
|
@@ -9110,142 +9399,6 @@ import { closeSync, existsSync as existsSync7, lstatSync as lstatSync4, mkdirSyn
|
|
|
9110
9399
|
import path8 from "node:path";
|
|
9111
9400
|
import { stringify } from "yaml";
|
|
9112
9401
|
|
|
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
9402
|
// src/manifest/wrangler-config.ts
|
|
9250
9403
|
var ALLOWED_KEYS = new Set([
|
|
9251
9404
|
"name",
|
|
@@ -9474,34 +9627,183 @@ function stringEnd(text, start) {
|
|
|
9474
9627
|
return text.length;
|
|
9475
9628
|
}
|
|
9476
9629
|
|
|
9630
|
+
// src/commands/migrate-live.ts
|
|
9631
|
+
var WARNINGS = {
|
|
9632
|
+
rollback: "Rolling back serves the app's last Pages build again. Any D1 writes or schema changes made since staging stay as they are.",
|
|
9633
|
+
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."
|
|
9634
|
+
};
|
|
9635
|
+
async function runLiveMigration(slug, action, options, io) {
|
|
9636
|
+
const warning = WARNINGS[action];
|
|
9637
|
+
if (warning !== undefined && !options.json)
|
|
9638
|
+
io.err(`note: ${warning}`);
|
|
9639
|
+
let res;
|
|
9640
|
+
try {
|
|
9641
|
+
res = await apiRaw(loadConfig(), {
|
|
9642
|
+
method: action === "status" ? "GET" : "POST",
|
|
9643
|
+
path: `/apps/${encodeURIComponent(slug)}/migration`,
|
|
9644
|
+
...action === "status" ? {} : { jsonBody: { action, ...options.consent === undefined ? {} : { consent: options.consent } } },
|
|
9645
|
+
nonThrowingStatuses: [400, 409, 500, 502, 503]
|
|
9646
|
+
});
|
|
9647
|
+
} catch (error) {
|
|
9648
|
+
if (error instanceof ForbiddenError || error instanceof NotFoundError) {
|
|
9649
|
+
io.err(`launchpad migrate: ${error.message}`);
|
|
9650
|
+
return 1;
|
|
9651
|
+
}
|
|
9652
|
+
throw error;
|
|
9653
|
+
}
|
|
9654
|
+
const body = await res.json().catch(() => ({})) ?? {};
|
|
9655
|
+
if (options.json) {
|
|
9656
|
+
io.out(JSON.stringify({ httpStatus: res.status, ...body }, null, 2));
|
|
9657
|
+
return exitFor(action, res.status, body);
|
|
9658
|
+
}
|
|
9659
|
+
render(slug, action, res.status, body, io);
|
|
9660
|
+
return exitFor(action, res.status, body);
|
|
9661
|
+
}
|
|
9662
|
+
function exitFor(action, status, body) {
|
|
9663
|
+
if (action === "check")
|
|
9664
|
+
return status === 200 && body.eligible === true ? 0 : 1;
|
|
9665
|
+
return status === 200 || status === 202 ? 0 : 1;
|
|
9666
|
+
}
|
|
9667
|
+
function render(slug, action, status, body, io) {
|
|
9668
|
+
const refusals = Array.isArray(body.refusals) ? body.refusals : [];
|
|
9669
|
+
if (action === "check")
|
|
9670
|
+
renderCheck(slug, body, refusals, io);
|
|
9671
|
+
else if (status === 200 || status === 202)
|
|
9672
|
+
renderAccepted(slug, action, body, io);
|
|
9673
|
+
else
|
|
9674
|
+
renderRefused(status, body, refusals, io);
|
|
9675
|
+
}
|
|
9676
|
+
function renderCheck(slug, body, refusals, io) {
|
|
9677
|
+
if (body.eligible === true) {
|
|
9678
|
+
io.out(`${slug}: eligible to move to Workers dispatch. Nothing was changed.`);
|
|
9679
|
+
io.out("Run `launchpad migrate --origin dispatch` to stage it. Users stay on Pages until you flip.");
|
|
9680
|
+
} else {
|
|
9681
|
+
io.out(`${slug}: not eligible to move yet.`);
|
|
9682
|
+
for (const refusal of refusals)
|
|
9683
|
+
io.out(` ${refusal.code}: ${refusal.message}`);
|
|
9684
|
+
}
|
|
9685
|
+
renderLedger(body.migration, io);
|
|
9686
|
+
}
|
|
9687
|
+
function renderAccepted(slug, action, body, io) {
|
|
9688
|
+
if (typeof body.commitSha === "string") {
|
|
9689
|
+
io.out(`${slug}: ${action} committed ${body.commitSha.slice(0, 12)}.`);
|
|
9690
|
+
if (typeof body.prUrl === "string")
|
|
9691
|
+
io.out(`Terraform: ${body.prUrl}`);
|
|
9692
|
+
if (body.reconcile === "pending")
|
|
9693
|
+
io.out("The Terraform change is queued; the platform finishes it automatically.");
|
|
9694
|
+
io.out("Run `launchpad pull` so your local launchpad.yaml matches before your next deploy.");
|
|
9695
|
+
}
|
|
9696
|
+
if (body.migration === null) {
|
|
9697
|
+
io.out(`${slug}: no migration has started. Run \`launchpad migrate --origin dispatch --dry-run\`.`);
|
|
9698
|
+
return;
|
|
9699
|
+
}
|
|
9700
|
+
renderLedger(body.migration, io);
|
|
9701
|
+
}
|
|
9702
|
+
function renderRefused(status, body, refusals, io) {
|
|
9703
|
+
io.err(`launchpad migrate: ${typeof body.message === "string" ? body.message : `the bot answered ${status}`}`);
|
|
9704
|
+
if (refusals.length > 1)
|
|
9705
|
+
for (const refusal of refusals)
|
|
9706
|
+
io.err(` ${refusal.code}: ${refusal.message}`);
|
|
9707
|
+
}
|
|
9708
|
+
function renderLedger(ledger, io) {
|
|
9709
|
+
if (ledger === null || ledger === undefined)
|
|
9710
|
+
return;
|
|
9711
|
+
io.out(`Migration stage: ${ledger.stage}`);
|
|
9712
|
+
if (ledger.delivery !== null && ledger.delivery !== undefined) {
|
|
9713
|
+
io.out(`Dispatch delivery: ${ledger.delivery.state}${ledger.delivery.reason === null ? "" : ` (${ledger.delivery.reason})`}`);
|
|
9714
|
+
if (ledger.delivery.runUrl !== null)
|
|
9715
|
+
io.out(`Build: ${ledger.delivery.runUrl}`);
|
|
9716
|
+
}
|
|
9717
|
+
if (typeof ledger.next === "string")
|
|
9718
|
+
io.out(`Next: ${ledger.next}`);
|
|
9719
|
+
}
|
|
9720
|
+
|
|
9477
9721
|
// src/commands/migrate.ts
|
|
9478
|
-
var USAGE =
|
|
9722
|
+
var USAGE = [
|
|
9723
|
+
"usage: launchpad migrate --origin dispatch [--dry-run] [--consent <text>]",
|
|
9724
|
+
" launchpad migrate --status | --flip | --finalize | --rollback [--slug <slug>] [--consent <text>] [--json]"
|
|
9725
|
+
].join(`
|
|
9726
|
+
`);
|
|
9479
9727
|
var migrateCommand = {
|
|
9480
9728
|
name: "migrate",
|
|
9481
|
-
summary: "
|
|
9729
|
+
summary: "move an app to Workers dispatch (unprovisioned: local YAML; live: staged, flipped, finalized)",
|
|
9482
9730
|
run: runMigrate
|
|
9483
9731
|
};
|
|
9732
|
+
var LIVE_FLAGS = {
|
|
9733
|
+
"--status": "status",
|
|
9734
|
+
"--flip": "flip",
|
|
9735
|
+
"--finalize": "finalize",
|
|
9736
|
+
"--rollback": "rollback"
|
|
9737
|
+
};
|
|
9738
|
+
function parseMigrateArgs(args) {
|
|
9739
|
+
const seen = new Set;
|
|
9740
|
+
const live = [];
|
|
9741
|
+
let consent;
|
|
9742
|
+
let slug;
|
|
9743
|
+
for (let i = 0;i < args.length; i++) {
|
|
9744
|
+
const arg = args[i];
|
|
9745
|
+
const action = LIVE_FLAGS[arg];
|
|
9746
|
+
if (action !== undefined)
|
|
9747
|
+
live.push(action);
|
|
9748
|
+
else if (arg === "--origin" && args[i + 1] === "dispatch")
|
|
9749
|
+
seen.add(args[i++]);
|
|
9750
|
+
else if (arg === "--consent" && args[i + 1] !== undefined)
|
|
9751
|
+
consent = args[++i];
|
|
9752
|
+
else if (arg === "--slug" && args[i + 1] !== undefined && !args[i + 1].startsWith("-"))
|
|
9753
|
+
slug = args[++i];
|
|
9754
|
+
else if (arg === "--dry-run" || arg === "--json")
|
|
9755
|
+
seen.add(arg);
|
|
9756
|
+
else
|
|
9757
|
+
return null;
|
|
9758
|
+
}
|
|
9759
|
+
const origin = seen.has("--origin");
|
|
9760
|
+
const dryRun = seen.has("--dry-run");
|
|
9761
|
+
const valid = live.length === 0 ? origin && slug === undefined : live.length === 1 && !origin && !dryRun;
|
|
9762
|
+
if (!valid)
|
|
9763
|
+
return null;
|
|
9764
|
+
return {
|
|
9765
|
+
action: live[0] ?? "origin",
|
|
9766
|
+
dryRun,
|
|
9767
|
+
json: seen.has("--json"),
|
|
9768
|
+
...consent === undefined ? {} : { consent },
|
|
9769
|
+
...slug === undefined ? {} : { slug }
|
|
9770
|
+
};
|
|
9771
|
+
}
|
|
9484
9772
|
async function runMigrate(args, io) {
|
|
9485
9773
|
if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
|
|
9486
9774
|
io.out(USAGE);
|
|
9487
9775
|
return 0;
|
|
9488
9776
|
}
|
|
9489
|
-
const
|
|
9490
|
-
if (
|
|
9777
|
+
const parsed = parseMigrateArgs(args);
|
|
9778
|
+
if (parsed === null) {
|
|
9491
9779
|
io.err(USAGE);
|
|
9492
9780
|
return 64;
|
|
9493
9781
|
}
|
|
9494
9782
|
try {
|
|
9495
|
-
|
|
9496
|
-
|
|
9783
|
+
if (parsed.action !== "origin")
|
|
9784
|
+
return await runLive(parsed.action, parsed, io);
|
|
9785
|
+
try {
|
|
9786
|
+
reportMigration(io, await convertToDispatch(process.cwd(), parsed.dryRun));
|
|
9787
|
+
return 0;
|
|
9788
|
+
} catch (error) {
|
|
9789
|
+
if (!(error instanceof RegisteredAppError))
|
|
9790
|
+
throw error;
|
|
9791
|
+
return await runLive(parsed.dryRun ? "check" : "start", parsed, io);
|
|
9792
|
+
}
|
|
9497
9793
|
} catch (error) {
|
|
9498
9794
|
io.err(`launchpad migrate: ${error instanceof Error ? error.message : String(error)}`);
|
|
9499
9795
|
return 1;
|
|
9500
9796
|
}
|
|
9501
9797
|
}
|
|
9798
|
+
async function runLive(action, parsed, io) {
|
|
9799
|
+
const slug = parsed.slug ?? inferSlug({ cwd: process.cwd(), warn: (line) => io.err(line) });
|
|
9800
|
+
if (slug === null)
|
|
9801
|
+
throw new Error("run this in the app's directory (next to launchpad.yaml).");
|
|
9802
|
+
return runLiveMigration(slug, action, { json: parsed.json, ...parsed.consent === undefined ? {} : { consent: parsed.consent } }, io);
|
|
9803
|
+
}
|
|
9502
9804
|
function reportMigration(io, result) {
|
|
9503
9805
|
if (result.kind === "already") {
|
|
9504
|
-
io.out("launchpad.yaml already selects Workers dispatch. Run `launchpad deploy`.");
|
|
9806
|
+
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
9807
|
return;
|
|
9506
9808
|
}
|
|
9507
9809
|
if (result.kind === "eligible") {
|
|
@@ -9538,8 +9840,9 @@ async function convertToDispatch(cwd, dryRun) {
|
|
|
9538
9840
|
if (loaded.kind !== "ok")
|
|
9539
9841
|
throw new InvalidManifestError;
|
|
9540
9842
|
const manifest = loaded.manifest;
|
|
9541
|
-
if (manifest.apiVersion === "launchpad.m-kopa.us/v2" && manifest.spec.origin === "dispatch")
|
|
9542
|
-
return { kind: "already" };
|
|
9843
|
+
if (manifest.apiVersion === "launchpad.m-kopa.us/v2" && manifest.spec.origin === "dispatch") {
|
|
9844
|
+
return { kind: "already", migrating: manifest.spec.migration !== undefined };
|
|
9845
|
+
}
|
|
9543
9846
|
const slug = manifest.apiVersion === "launchpad.m-kopa.us/v2" ? manifest.metadata.slug : manifest.metadata.name;
|
|
9544
9847
|
let converted;
|
|
9545
9848
|
try {
|
|
@@ -9619,7 +9922,7 @@ class RegistryUnavailableError extends Error {
|
|
|
9619
9922
|
|
|
9620
9923
|
class RegisteredAppError extends Error {
|
|
9621
9924
|
constructor() {
|
|
9622
|
-
super("This app is already registered
|
|
9925
|
+
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
9926
|
}
|
|
9624
9927
|
}
|
|
9625
9928
|
var WRANGLER_FILES = ["wrangler.toml", "wrangler.json", "wrangler.jsonc"];
|
|
@@ -10489,15 +10792,17 @@ ${w}`, ""), message);
|
|
|
10489
10792
|
baseline: deployContext.origin
|
|
10490
10793
|
});
|
|
10491
10794
|
surfaceCommittedHandoff(dispatchOrigin, io);
|
|
10795
|
+
const notices = parseNotices(success.notices);
|
|
10492
10796
|
if (noVerify) {
|
|
10493
10797
|
if (dispatchOrigin) {
|
|
10494
10798
|
io.out(`Run \`launchpad status ${slug}\` to confirm the delivery stage and outcome.`);
|
|
10495
10799
|
} else {
|
|
10496
10800
|
io.out(`Run \`launchpad status ${slug}\` to confirm the build outcome (success / failure + log excerpt).`);
|
|
10497
10801
|
}
|
|
10802
|
+
renderNotices(notices, io);
|
|
10498
10803
|
return 0;
|
|
10499
10804
|
}
|
|
10500
|
-
|
|
10805
|
+
const verified = await runDeployVerification({
|
|
10501
10806
|
slug,
|
|
10502
10807
|
cwd,
|
|
10503
10808
|
appType,
|
|
@@ -10507,6 +10812,8 @@ ${w}`, ""), message);
|
|
|
10507
10812
|
timeoutMs: verifyTimeoutMs,
|
|
10508
10813
|
dispatchOrigin
|
|
10509
10814
|
}, io, realVerifyDeployDeps(cfg));
|
|
10815
|
+
renderNotices(notices, io);
|
|
10816
|
+
return verified;
|
|
10510
10817
|
}
|
|
10511
10818
|
}
|
|
10512
10819
|
}
|
|
@@ -15094,7 +15401,7 @@ async function runSecretsPush(opts, io, deps = {}) {
|
|
|
15094
15401
|
try {
|
|
15095
15402
|
resp = await apiJson(cfg, {
|
|
15096
15403
|
method: "POST",
|
|
15097
|
-
path: `/apps/${slug}/secrets/${b.name}`,
|
|
15404
|
+
path: `/apps/${slug}/secrets/${b.name}${opts.staged === true ? "?target=staged" : ""}`,
|
|
15098
15405
|
jsonBody: b.targets !== undefined ? { value, targets: b.targets } : { value },
|
|
15099
15406
|
nonThrowingStatuses: [409]
|
|
15100
15407
|
}, fetcher);
|
|
@@ -15107,7 +15414,7 @@ async function runSecretsPush(opts, io, deps = {}) {
|
|
|
15107
15414
|
io.err(`✗ secrets push ${b.name}: invalid bot response (results must be an array)`);
|
|
15108
15415
|
return 2;
|
|
15109
15416
|
}
|
|
15110
|
-
if (resp.error === "dispatch_script_not_delivered") {
|
|
15417
|
+
if (resp.error === "dispatch_script_not_delivered" || resp.error === "no_staged_migration") {
|
|
15111
15418
|
io.err(`✗ secrets push ${b.name}: ${resp.message ?? "the dispatch script is not delivered yet"}`);
|
|
15112
15419
|
io.err(`${pushed} of ${envFileBindings.length} pushed before failure.`);
|
|
15113
15420
|
return 1;
|
|
@@ -15145,7 +15452,9 @@ async function runSecretsPush(opts, io, deps = {}) {
|
|
|
15145
15452
|
if (anyPagesUpdated) {
|
|
15146
15453
|
return offerRedeploy(slug, opts, io, deps);
|
|
15147
15454
|
}
|
|
15148
|
-
if (anyDispatchUpdated) {
|
|
15455
|
+
if (anyDispatchUpdated && opts.staged === true) {
|
|
15456
|
+
io.out("Set on the staged dispatch script. It serves users once you run `launchpad migrate --flip`.");
|
|
15457
|
+
} else if (anyDispatchUpdated) {
|
|
15149
15458
|
io.out("Set on the app's dispatch Worker and live now - no redeploy needed.");
|
|
15150
15459
|
} else if (anyWorkerUpdated) {
|
|
15151
15460
|
io.out("These secrets bind on the app's next invocation — no redeploy needed.");
|
|
@@ -15776,7 +16085,7 @@ async function runSecrets(args, io) {
|
|
|
15776
16085
|
if (typeof parsed === "string") {
|
|
15777
16086
|
io.err(`launchpad secrets push: ${parsed}`);
|
|
15778
16087
|
io.err("");
|
|
15779
|
-
io.err("usage: launchpad secrets push [--file <manifest>] [--env <.env>] [--dry-run] [--redeploy] [--yes]");
|
|
16088
|
+
io.err("usage: launchpad secrets push [--file <manifest>] [--env <.env>] [--dry-run] [--redeploy | --staged] [--yes]");
|
|
15780
16089
|
io.err(" launchpad secrets push --set <name> [--fleet-file <path>] [--env <.env>] [--yes]");
|
|
15781
16090
|
return 64;
|
|
15782
16091
|
}
|
|
@@ -15812,6 +16121,7 @@ function parsePushArgs(args) {
|
|
|
15812
16121
|
let fleetFile = null;
|
|
15813
16122
|
let yes = false;
|
|
15814
16123
|
let redeploy = false;
|
|
16124
|
+
let staged = false;
|
|
15815
16125
|
let i = 0;
|
|
15816
16126
|
while (i < args.length) {
|
|
15817
16127
|
const a = args[i] ?? "";
|
|
@@ -15842,6 +16152,11 @@ function parsePushArgs(args) {
|
|
|
15842
16152
|
i += 1;
|
|
15843
16153
|
continue;
|
|
15844
16154
|
}
|
|
16155
|
+
if (a === "--staged") {
|
|
16156
|
+
staged = true;
|
|
16157
|
+
i += 1;
|
|
16158
|
+
continue;
|
|
16159
|
+
}
|
|
15845
16160
|
if (a === "--redeploy") {
|
|
15846
16161
|
redeploy = true;
|
|
15847
16162
|
i += 1;
|
|
@@ -15854,9 +16169,13 @@ function parsePushArgs(args) {
|
|
|
15854
16169
|
return "--file/--dry-run are not valid with --set (use --fleet-file / --yes)";
|
|
15855
16170
|
if (redeploy)
|
|
15856
16171
|
return "--redeploy is not valid with --set (a fleet secret-set has no single app to redeploy)";
|
|
16172
|
+
if (staged)
|
|
16173
|
+
return "--staged is not valid with --set (it targets one app's staged migration)";
|
|
15857
16174
|
return { set, fleetFile, env, yes };
|
|
15858
16175
|
}
|
|
15859
|
-
|
|
16176
|
+
if (staged && redeploy)
|
|
16177
|
+
return "--redeploy is not valid with --staged (the staged script needs no redeploy)";
|
|
16178
|
+
return { file, env, dryRun, redeploy: redeploy || yes, ...staged ? { staged } : {} };
|
|
15860
16179
|
}
|
|
15861
16180
|
function parseStatusArgs(args) {
|
|
15862
16181
|
let file = null;
|