@plume-press/cli 0.8.3 → 0.9.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/README.md +3 -3
- package/dist/cli.mjs +119 -619
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Use Node.js 22.13 or newer. Install the scoped package in your website project before using its plume command. These examples use npm; keep your project's chosen package manager.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install --save-dev @plume-press/cli@0.
|
|
6
|
+
npm install --save-dev @plume-press/cli@0.9.0
|
|
7
7
|
npx plume init --check
|
|
8
8
|
npx plume --help
|
|
9
9
|
```
|
|
@@ -29,9 +29,9 @@ A successful connection saves nonsecret Site/editor URL facts in Git-ignored .pl
|
|
|
29
29
|
|
|
30
30
|
## Check a connected build
|
|
31
31
|
|
|
32
|
-
Use plume build --delivery auto -- <your existing framework build command> when the host builds both the live branch and preview branches: it builds
|
|
32
|
+
Use plume build --delivery auto -- <your existing framework build command> when the host builds both the live branch and preview branches, with no host setting: it builds production SSR, or static in the preview environment for a commit Plume pushed for an Update whose content is not published yet. The explicit modes are --delivery production-ssr for public request-time content, or --delivery static (the default) for a pinned build. The wrapper validates exact Git HEAD (committed files must be unchanged; new files the host or install adds are allowed and listed in the build log), plume.lock and matching plume.schema.ts once, writes .plume/binding.json and .plume/delivery.json, then runs the framework. Compilation records the actual SHA and environment. There is no build UUID or preparation wait. It performs no publication. PLUME_ENDPOINT defaults to https://app.plume.press; validation needs no token. Schema files execute locally as trusted framework configuration does.
|
|
33
33
|
|
|
34
|
-
Production SSR resolves createLatestPlume once per render and shares the reader across page queries;
|
|
34
|
+
Production SSR resolves createLatestPlume once per render and shares the reader across page queries; static uses createPlume with the compiled binding. Static or cached pages need a rebuild or real invalidation for freshness.
|
|
35
35
|
|
|
36
36
|
## Export a Site
|
|
37
37
|
|
package/dist/cli.mjs
CHANGED
|
@@ -35540,7 +35540,7 @@ var init_src = __esm({
|
|
|
35540
35540
|
});
|
|
35541
35541
|
|
|
35542
35542
|
// packages/sdk/src/protocol.ts
|
|
35543
|
-
var MAX_CONTENT_DATA_BYTES, MAX_CONTENT_RESPONSE_BYTES, MAX_MEDIA_BYTES, contentBindingSchema, publicPublicationSchema, latestPublicationSchema,
|
|
35543
|
+
var MAX_CONTENT_DATA_BYTES, MAX_CONTENT_RESPONSE_BYTES, MAX_MEDIA_BYTES, contentBindingSchema, publicPublicationSchema, latestPublicationSchema, deliveryArtifactSchema, deliveryDescriptorSchema, name, depth, contentQuerySchema, mediaPath, mediaQuerySchema, mediaRequestSchema, contentRequestSchema, timestamp, contentRecordSchema, contentAssetSchema, contentResponseSchema;
|
|
35544
35544
|
var init_protocol = __esm({
|
|
35545
35545
|
"packages/sdk/src/protocol.ts"() {
|
|
35546
35546
|
"use strict";
|
|
@@ -35570,33 +35570,18 @@ var init_protocol = __esm({
|
|
|
35570
35570
|
}).refine(
|
|
35571
35571
|
(value) => !value.publication || value.publication.commitSha === value.commitSha && value.publication.branch === value.branch && value.publication.acceptedAt === value.acceptedAt
|
|
35572
35572
|
);
|
|
35573
|
-
previewCandidateSchema = external_exports.object({
|
|
35574
|
-
operationId: external_exports.uuidv7(),
|
|
35575
|
-
commitSha: external_exports.string().regex(/^[a-f0-9]{40}$/)
|
|
35576
|
-
}).strict();
|
|
35577
35573
|
deliveryArtifactSchema = external_exports.object({
|
|
35578
35574
|
commitSha: external_exports.string().regex(/^[a-f0-9]{40}$/),
|
|
35579
35575
|
environment: external_exports.enum(["production", "preview"])
|
|
35580
35576
|
}).strict();
|
|
35581
35577
|
deliveryDescriptorSchema = external_exports.object({
|
|
35582
35578
|
version: external_exports.literal(1),
|
|
35583
|
-
mode: external_exports.enum(["production-ssr", "
|
|
35579
|
+
mode: external_exports.enum(["production-ssr", "static"]),
|
|
35584
35580
|
artifact: deliveryArtifactSchema,
|
|
35585
|
-
binding: contentBindingSchema
|
|
35586
|
-
candidate: previewCandidateSchema.nullable()
|
|
35581
|
+
binding: contentBindingSchema
|
|
35587
35582
|
}).strict().refine(
|
|
35588
35583
|
(value) => value.mode !== "production-ssr" || value.artifact.environment === "production"
|
|
35589
|
-
).refine(
|
|
35590
|
-
(value) => value.mode !== "selected-preview" || value.artifact.environment === "preview" && value.candidate?.commitSha === value.artifact.commitSha
|
|
35591
35584
|
);
|
|
35592
|
-
renderEvidenceSchema = external_exports.object({
|
|
35593
|
-
version: external_exports.literal(1),
|
|
35594
|
-
mode: external_exports.enum(["production-ssr", "selected-preview", "static"]),
|
|
35595
|
-
artifact: deliveryArtifactSchema,
|
|
35596
|
-
binding: contentBindingSchema,
|
|
35597
|
-
candidate: previewCandidateSchema.nullable(),
|
|
35598
|
-
publication: publicPublicationSchema.nullable()
|
|
35599
|
-
}).strict();
|
|
35600
35585
|
name = external_exports.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/).max(100);
|
|
35601
35586
|
depth = external_exports.union([external_exports.literal(0), external_exports.literal(1)]).optional();
|
|
35602
35587
|
contentQuerySchema = external_exports.discriminatedUnion("kind", [
|
|
@@ -35669,7 +35654,7 @@ var init_protocol = __esm({
|
|
|
35669
35654
|
|
|
35670
35655
|
// packages/cli/src/developer.ts
|
|
35671
35656
|
import { execFile } from "node:child_process";
|
|
35672
|
-
import { readFile,
|
|
35657
|
+
import { readFile, stat } from "node:fs/promises";
|
|
35673
35658
|
import { resolve } from "node:path";
|
|
35674
35659
|
import { pathToFileURL } from "node:url";
|
|
35675
35660
|
import { promisify } from "node:util";
|
|
@@ -35852,143 +35837,6 @@ function githubRepository(url2) {
|
|
|
35852
35837
|
);
|
|
35853
35838
|
return match ? { owner: match[1], name: match[2] } : null;
|
|
35854
35839
|
}
|
|
35855
|
-
async function verifyCheckout(cwd, inspect2, input2) {
|
|
35856
|
-
const root3 = await git(cwd, "rev-parse", "--show-toplevel");
|
|
35857
|
-
if (await realpath(root3) !== await realpath(cwd))
|
|
35858
|
-
throw new PlumeToolError(
|
|
35859
|
-
"CHECKOUT_MISMATCH",
|
|
35860
|
-
"Run plume prepare from the connected repository root."
|
|
35861
|
-
);
|
|
35862
|
-
const [branch, head2, status2, origin] = await Promise.all([
|
|
35863
|
-
git(cwd, "branch", "--show-current"),
|
|
35864
|
-
git(cwd, "rev-parse", "HEAD"),
|
|
35865
|
-
git(cwd, "status", "--porcelain=v1", "--untracked-files=all"),
|
|
35866
|
-
git(cwd, "config", "--get", "remote.origin.url")
|
|
35867
|
-
]);
|
|
35868
|
-
const repository = githubRepository(origin);
|
|
35869
|
-
if (inspect2.branch !== `plume/${input2.updateId}` || branch !== inspect2.branch || !repository || repository.owner.toLowerCase() !== inspect2.repository.owner.toLowerCase() || repository.name.toLowerCase() !== inspect2.repository.name.toLowerCase())
|
|
35870
|
-
throw new PlumeToolError(
|
|
35871
|
-
"CHECKOUT_MISMATCH",
|
|
35872
|
-
"The local branch or origin does not match this Update's connected GitHub repository."
|
|
35873
|
-
);
|
|
35874
|
-
if (status2)
|
|
35875
|
-
throw new PlumeToolError(
|
|
35876
|
-
"CHECKOUT_DIRTY",
|
|
35877
|
-
"Commit or remove tracked and untracked local changes before preparing. Ignored files are allowed."
|
|
35878
|
-
);
|
|
35879
|
-
const expectedHeads = inspect2.state === "editing" ? [inspect2.headSha] : inspect2.state === "preparing" ? [inspect2.preparationBaseSha] : [inspect2.preparationBaseSha, inspect2.preparedHeadSha];
|
|
35880
|
-
if (!expectedHeads.includes(head2))
|
|
35881
|
-
throw new PlumeToolError(
|
|
35882
|
-
"CHECKOUT_MISMATCH",
|
|
35883
|
-
"Local HEAD does not match this Update's preparation starting point. Refresh the checkout and inspect the Update."
|
|
35884
|
-
);
|
|
35885
|
-
}
|
|
35886
|
-
async function runLocalPrepare(options2) {
|
|
35887
|
-
const parsed = prepareInput.safeParse(options2.input);
|
|
35888
|
-
if (!parsed.success)
|
|
35889
|
-
throw new PlumeToolError(
|
|
35890
|
-
"INVALID_INPUT",
|
|
35891
|
-
"Provide exact Site, Update, writer and preparation IDs with the expected version and revision."
|
|
35892
|
-
);
|
|
35893
|
-
const input2 = parsed.data;
|
|
35894
|
-
let inspect2;
|
|
35895
|
-
try {
|
|
35896
|
-
inspect2 = inspectResult.parse(
|
|
35897
|
-
(await runDeveloperTool({
|
|
35898
|
-
action: "update.inspect",
|
|
35899
|
-
input: { siteId: input2.siteId, updateId: input2.updateId },
|
|
35900
|
-
endpoint: options2.endpoint,
|
|
35901
|
-
token: options2.token
|
|
35902
|
-
})).result
|
|
35903
|
-
);
|
|
35904
|
-
} catch (error62) {
|
|
35905
|
-
if (error62 instanceof PlumeToolError) throw error62;
|
|
35906
|
-
throw new PlumeToolError(
|
|
35907
|
-
"INVALID_RESPONSE",
|
|
35908
|
-
"Plume returned an invalid Update inspection. No preparation was requested."
|
|
35909
|
-
);
|
|
35910
|
-
}
|
|
35911
|
-
if (inspect2.updateId !== input2.updateId || inspect2.versionId !== input2.expectedVersionId)
|
|
35912
|
-
throw new PlumeToolError(
|
|
35913
|
-
"UPDATE_CONFLICT",
|
|
35914
|
-
"The inspected Update no longer has the expected content version."
|
|
35915
|
-
);
|
|
35916
|
-
if (inspect2.state === "editing" && inspect2.revision !== input2.expectedRevision)
|
|
35917
|
-
throw new PlumeToolError(
|
|
35918
|
-
"UPDATE_CONFLICT",
|
|
35919
|
-
"The inspected Update revision changed. Refresh before preparing."
|
|
35920
|
-
);
|
|
35921
|
-
if ((inspect2.state === "preparing" || inspect2.state === "prepared") && inspect2.preparationId !== input2.preparationId)
|
|
35922
|
-
throw new PlumeToolError(
|
|
35923
|
-
"UPDATE_CONFLICT",
|
|
35924
|
-
"Another preparation owns this Update. Inspect it before retrying."
|
|
35925
|
-
);
|
|
35926
|
-
if (inspect2.state === "initializing")
|
|
35927
|
-
throw new PlumeToolError(
|
|
35928
|
-
"UPDATE_CONFLICT",
|
|
35929
|
-
"Finish starting this Update before preparing it."
|
|
35930
|
-
);
|
|
35931
|
-
await verifyCheckout(resolve(options2.cwd), inspect2, input2);
|
|
35932
|
-
const localSchema = await stat(
|
|
35933
|
-
resolve(options2.cwd, "plume.schema.ts")
|
|
35934
|
-
).catch(() => null) ? await loadCheckoutSchema(resolve(options2.cwd)) : defineSchema({ collections: [] });
|
|
35935
|
-
if (await schemaHash(localSchema) !== inspect2.schemaHash)
|
|
35936
|
-
throw new PlumeToolError(
|
|
35937
|
-
"SCHEMA_MISMATCH",
|
|
35938
|
-
"The local plume.schema.ts does not match this Update's registered schema. Register it before preparing."
|
|
35939
|
-
);
|
|
35940
|
-
await verifyCheckout(resolve(options2.cwd), inspect2, input2);
|
|
35941
|
-
if (!input2.sessionId || !input2.token)
|
|
35942
|
-
throw new PlumeToolError(
|
|
35943
|
-
"INVALID_INPUT",
|
|
35944
|
-
"Preparation requires the writer sessionId and token."
|
|
35945
|
-
);
|
|
35946
|
-
const plan = external_exports.object({
|
|
35947
|
-
fingerprint: external_exports.string(),
|
|
35948
|
-
operationId: id.nullable(),
|
|
35949
|
-
content: external_exports.object({ present: external_exports.boolean() }),
|
|
35950
|
-
website: external_exports.object({ present: external_exports.boolean() })
|
|
35951
|
-
}).parse(
|
|
35952
|
-
(await runDeveloperTool({
|
|
35953
|
-
action: "publication.plan",
|
|
35954
|
-
input: { siteId: input2.siteId, updateId: input2.updateId },
|
|
35955
|
-
endpoint: options2.endpoint,
|
|
35956
|
-
token: options2.token
|
|
35957
|
-
})).result
|
|
35958
|
-
);
|
|
35959
|
-
if (plan.operationId) {
|
|
35960
|
-
if (plan.operationId !== input2.preparationId)
|
|
35961
|
-
throw new PlumeToolError(
|
|
35962
|
-
"UPDATE_CONFLICT",
|
|
35963
|
-
"Another saved publication owns this Update. Inspect it before retrying."
|
|
35964
|
-
);
|
|
35965
|
-
return (await runDeveloperTool({
|
|
35966
|
-
action: "publication.status",
|
|
35967
|
-
input: {
|
|
35968
|
-
siteId: input2.siteId,
|
|
35969
|
-
updateId: input2.updateId,
|
|
35970
|
-
operationId: plan.operationId
|
|
35971
|
-
},
|
|
35972
|
-
endpoint: options2.endpoint,
|
|
35973
|
-
token: options2.token
|
|
35974
|
-
})).result;
|
|
35975
|
-
}
|
|
35976
|
-
return (await runDeveloperTool({
|
|
35977
|
-
action: "publication.start",
|
|
35978
|
-
input: {
|
|
35979
|
-
siteId: input2.siteId,
|
|
35980
|
-
updateId: input2.updateId,
|
|
35981
|
-
operationId: input2.preparationId,
|
|
35982
|
-
sessionId: input2.sessionId,
|
|
35983
|
-
token: input2.token,
|
|
35984
|
-
planFingerprint: plan.fingerprint,
|
|
35985
|
-
scope: plan.content.present && plan.website.present ? "both" : plan.content.present ? "content" : "website",
|
|
35986
|
-
purpose: "preview"
|
|
35987
|
-
},
|
|
35988
|
-
endpoint: options2.endpoint,
|
|
35989
|
-
token: options2.token
|
|
35990
|
-
})).result;
|
|
35991
|
-
}
|
|
35992
35840
|
async function readInput() {
|
|
35993
35841
|
let size = 0;
|
|
35994
35842
|
const chunks = [];
|
|
@@ -36058,24 +35906,13 @@ async function developerMain(args, env2 = process.env) {
|
|
|
36058
35906
|
`);
|
|
36059
35907
|
return 0;
|
|
36060
35908
|
}
|
|
36061
|
-
if (!(args[0] === "tool" && args.length === 2)
|
|
35909
|
+
if (!(args[0] === "tool" && args.length === 2)) {
|
|
36062
35910
|
process.stderr.write(`${developerHelp}
|
|
36063
35911
|
`);
|
|
36064
35912
|
return 2;
|
|
36065
35913
|
}
|
|
36066
35914
|
try {
|
|
36067
35915
|
const input2 = await readInput();
|
|
36068
|
-
if (args[0] === "prepare") {
|
|
36069
|
-
const result2 = await runLocalPrepare({
|
|
36070
|
-
cwd: process.cwd(),
|
|
36071
|
-
input: input2,
|
|
36072
|
-
endpoint: env2.PLUME_ENDPOINT ?? "",
|
|
36073
|
-
token: env2.PLUME_DEVELOPER_TOKEN ?? ""
|
|
36074
|
-
});
|
|
36075
|
-
process.stdout.write(`${JSON.stringify({ ok: true, result: result2 })}
|
|
36076
|
-
`);
|
|
36077
|
-
return 0;
|
|
36078
|
-
}
|
|
36079
35916
|
const request = args[1] === "schema.register" && !Object.hasOwn(input2, "schema") ? {
|
|
36080
35917
|
...input2,
|
|
36081
35918
|
schema: await loadCheckoutSchema(process.cwd())
|
|
@@ -36112,12 +35949,11 @@ async function developerMain(args, env2 = process.env) {
|
|
|
36112
35949
|
return 1;
|
|
36113
35950
|
}
|
|
36114
35951
|
}
|
|
36115
|
-
var execFileAsync, MAX_INPUT_BYTES, MAX_RESPONSE_BYTES, MAX_SCHEMA_BYTES, MAX_SCHEMA_SOURCE_BYTES, schemaIssues, remoteText, detailShapes, id, context, writer, revision, record2,
|
|
35952
|
+
var execFileAsync, MAX_INPUT_BYTES, MAX_RESPONSE_BYTES, MAX_SCHEMA_BYTES, MAX_SCHEMA_SOURCE_BYTES, schemaIssues, remoteText, detailShapes, id, context, writer, revision, record2, _sha, operation, schemas, developerActions, PlumeToolError, developerHelp;
|
|
36116
35953
|
var init_developer = __esm({
|
|
36117
35954
|
"packages/cli/src/developer.ts"() {
|
|
36118
35955
|
"use strict";
|
|
36119
35956
|
init_src();
|
|
36120
|
-
init_protocol();
|
|
36121
35957
|
init_zod();
|
|
36122
35958
|
execFileAsync = promisify(execFile);
|
|
36123
35959
|
MAX_INPUT_BYTES = 512 * 1024;
|
|
@@ -36181,62 +36017,15 @@ var init_developer = __esm({
|
|
|
36181
36017
|
)
|
|
36182
36018
|
)
|
|
36183
36019
|
};
|
|
36184
|
-
|
|
36020
|
+
_sha = external_exports.string().regex(/^[a-f0-9]{40}$/);
|
|
36185
36021
|
operation = { operationId: id.optional() };
|
|
36186
|
-
prepareInput = external_exports.object({
|
|
36187
|
-
...context,
|
|
36188
|
-
sessionId: id.optional(),
|
|
36189
|
-
token: id.optional(),
|
|
36190
|
-
...revision,
|
|
36191
|
-
preparationId: id
|
|
36192
|
-
}).strict();
|
|
36193
|
-
inspectResult = external_exports.object({
|
|
36194
|
-
updateId: id,
|
|
36195
|
-
branch: external_exports.string(),
|
|
36196
|
-
headSha: sha,
|
|
36197
|
-
repository: external_exports.object({ owner: external_exports.string(), name: external_exports.string() }),
|
|
36198
|
-
state: external_exports.enum(["initializing", "editing", "preparing", "prepared"]),
|
|
36199
|
-
preparationId: id.nullable(),
|
|
36200
|
-
preparationBaseSha: sha.nullable(),
|
|
36201
|
-
preparedHeadSha: sha.nullable(),
|
|
36202
|
-
versionId: id,
|
|
36203
|
-
revision: external_exports.number().int().nonnegative(),
|
|
36204
|
-
schemaHash: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
36205
|
-
binding: contentBindingSchema.nullable()
|
|
36206
|
-
});
|
|
36207
36022
|
schemas = {
|
|
36208
36023
|
// Needs no IDs: answers with the credential's own Site and Update.
|
|
36209
36024
|
status: external_exports.object({ sessionId: id.optional() }).strict(),
|
|
36210
36025
|
context: external_exports.object(context).strict(),
|
|
36211
|
-
"update.
|
|
36212
|
-
"
|
|
36213
|
-
"
|
|
36214
|
-
...context,
|
|
36215
|
-
...writer,
|
|
36216
|
-
operationId: id,
|
|
36217
|
-
scope: external_exports.enum(["content", "website", "both"]),
|
|
36218
|
-
purpose: external_exports.enum(["publish", "preview"]),
|
|
36219
|
-
planFingerprint: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/)
|
|
36220
|
-
}).strict(),
|
|
36221
|
-
"publication.status": external_exports.object({ ...context, operationId: id }).strict(),
|
|
36222
|
-
"publication.recover": external_exports.object({ ...context, operationId: id }).strict(),
|
|
36223
|
-
"publication.cancel": external_exports.object({ ...context, operationId: id }).strict(),
|
|
36224
|
-
"publication.publishPrepared": external_exports.object({
|
|
36225
|
-
...context,
|
|
36226
|
-
operationId: id,
|
|
36227
|
-
preparedFingerprint: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/)
|
|
36228
|
-
}).strict(),
|
|
36229
|
-
"update.prepare": prepareInput.extend({
|
|
36230
|
-
sessionId: id,
|
|
36231
|
-
token: id,
|
|
36232
|
-
expectedHeadSha: sha
|
|
36233
|
-
}),
|
|
36234
|
-
"update.resume": external_exports.object({
|
|
36235
|
-
...context,
|
|
36236
|
-
sessionId: id,
|
|
36237
|
-
preparationId: id,
|
|
36238
|
-
expectedVersionId: id
|
|
36239
|
-
}).strict(),
|
|
36026
|
+
"update.publishing": external_exports.object(context).strict(),
|
|
36027
|
+
"update.publish": external_exports.object({ ...context, ...writer, ...revision }).strict(),
|
|
36028
|
+
"update.keepEditing": external_exports.object({ ...context, sessionId: id, token: id.optional() }).strict(),
|
|
36240
36029
|
"writer.acquire": external_exports.object({ ...context, sessionId: id }).strict(),
|
|
36241
36030
|
"writer.takeover": external_exports.object({ ...context, sessionId: id }).strict(),
|
|
36242
36031
|
"writer.renew": external_exports.object({ ...context, ...writer }).strict(),
|
|
@@ -36282,14 +36071,13 @@ var init_developer = __esm({
|
|
|
36282
36071
|
remoteMessage;
|
|
36283
36072
|
};
|
|
36284
36073
|
developerHelp = `Advanced: the developer tool protocol (one JSON object on stdin, one JSON line out).
|
|
36285
|
-
Most work is easier with the commands above (plume status, plume items
|
|
36074
|
+
Most work is easier with the commands above (plume status, plume items), which handle editing control, versions and IDs for you.
|
|
36286
36075
|
|
|
36287
36076
|
Usage: plume tool <action> < request.json
|
|
36288
|
-
plume prepare < request.json
|
|
36289
36077
|
|
|
36290
36078
|
Actions: ${developerActions.join(", ")}
|
|
36291
36079
|
Use PLUME_ENDPOINT and a separate PLUME_DEVELOPER_TOKEN. Send siteId and updateId explicitly on stdin (status needs neither and returns them). The action belongs in the command, not the JSON. schema.register without a schema field loads the named schema export from plume.schema.ts.
|
|
36292
|
-
Mutations require an explicit Update, expected version/revision, and writer lease. Acquire with writer.acquire, retain its sessionId/token for writes, and release with writer.release. A busy Site answers WRITER_BUSY with details.holder (name, since); writer.takeover takes control explicitly, never automatically. record.replace requires fullReplacement: true and replaces the whole record. update.discard takes a free lease for sessionId when token is omitted.
|
|
36080
|
+
Mutations require an explicit Update, expected version/revision, and writer lease. Acquire with writer.acquire, retain its sessionId/token for writes, and release with writer.release. A busy Site answers WRITER_BUSY with details.holder (name, since); writer.takeover takes control explicitly, never automatically. record.replace requires fullReplacement: true and replaces the whole record. update.discard takes a free lease for sessionId when token is omitted. update.publish publishes in one request and answers with update.publishing's state: published, or waiting on the Update's pull request.
|
|
36293
36081
|
Exit codes: 0 success, 1 refused or failed, 2 wrong usage.`;
|
|
36294
36082
|
}
|
|
36295
36083
|
});
|
|
@@ -36676,9 +36464,9 @@ Model real repeated content as Collections and real one-off content as Singleton
|
|
|
36676
36464
|
|
|
36677
36465
|
For an unconnected local project, plume local schema applies safe additions; plume local record commands take JSON on stdin. The local reader createLocalPlume from @plume-press/cli/local stays on this machine. Local public visibility does not publish.
|
|
36678
36466
|
|
|
36679
|
-
Hosted schemas arrive through an ordinary Update: add plume.schema.ts and page wiring on its branch, register the schema with plume schema apply using developer access for that Update, then
|
|
36467
|
+
Hosted schemas arrive through an ordinary Update: add plume.schema.ts and page wiring on its branch, register the schema with plume schema apply using developer access for that Update, then publish through the existing Plume workflow when requested. To transfer local records once, the publication branch first needs a published schema-only Update and plume.lock, no hosted content, no open Updates and no active writer. plume connect performs browser approval, an explicit transfer choice and confirmation; its setup credential is not ongoing developer access. Resume interrupted transfers with plume connect; never silently merge them into an open Update. Transfer supports at most 100 records/1 MiB and rejects media.
|
|
36680
36468
|
|
|
36681
|
-
Use only implemented commands in npx plume --help. There is no plume push, doctor, automatic deploy-hook configuration or universal website-check command.
|
|
36469
|
+
Use only implemented commands in npx plume --help. There is no plume push, doctor, automatic deploy-hook configuration or universal website-check command. Never claim a local change is published or deployed.
|
|
36682
36470
|
|
|
36683
36471
|
## One server-only reader, explicit content modes
|
|
36684
36472
|
|
|
@@ -36687,17 +36475,14 @@ Create or adapt one reader factory beside the site's existing server data helper
|
|
|
36687
36475
|
Choose the mode explicitly in application/server configuration:
|
|
36688
36476
|
|
|
36689
36477
|
- **Plume session preview:** when PLUME_PREVIEW is exactly true, require the session-provided PLUME_ENDPOINT and use createPlume({ schema, binding, endpoint, mode: "preview" }). Read the session's generated .plume/binding.json; fail if it is absent or malformed. Local loopback preview URLs can carry a path capability: keep the complete URL server-only. Do not replace it with the public CMS origin.
|
|
36690
|
-
- **
|
|
36691
|
-
- **
|
|
36692
|
-
- **
|
|
36693
|
-
- **One build script for live and preview branches:** plume build --delivery auto -- <existing framework build command> builds as selected-preview only when HEAD is Plume's prepared publication commit (same trailer and reservation checks; a failed check stops the build) and as production-ssr otherwise, so the host needs no setting. .plume/delivery.json records the resolved mode; choose the reader from that compiled mode, never from runtime variables.
|
|
36478
|
+
- **Deliberately static build:** plume build --delivery static -- <existing framework build command> compiles one immutable selection: the latest published content for the checkout's schema, or an Update's own content when its pull request is built before it is published. Newly published content shows after the next rebuild; a latest probe cannot certify an old page.
|
|
36479
|
+
- **Public SSR:** compile the explicit descriptor with plume build --delivery production-ssr -- <existing framework build command>. Only for an explicitly selected public production SSR mode on a host that supports it, await createLatestPlume({ schema, siteId }) once per request/render. Derive siteId from the committed Site binding, and pass the reader to all page/metadata queries. Use a request-scoped promise/cache, never a module-global reader or promise. A public URL or matching schema does not by itself select latest.
|
|
36480
|
+
- **One build script for live and preview branches:** plume build --delivery auto -- <existing framework build command> needs no host setting: it builds as production-ssr, or as static in the preview environment for a commit Plume pushed for an Update whose content is not published yet (a shared preview build or an Update's pull request), so that build shows the Update. Wire both readers. .plume/delivery.json records the resolved mode; choose the reader from that compiled mode, never from runtime variables.
|
|
36694
36481
|
|
|
36695
36482
|
Next.js: keep the helper server-only (import "server-only"). In App Router, use the existing server components and request-scoped React cache to share the async reader across a render/metadata pass; opt affected public SSR routes into the framework's dynamic behavior and avoid persistent caching of the latest binding. Preserve Pages Router if the site uses it: resolve once inside getServerSideProps and pass rendered data. Keep getStaticProps/static routes pinned when intentional.
|
|
36696
36483
|
|
|
36697
36484
|
Astro: resolve once in page frontmatter or the existing request context and pass the reader/data into layouts and components. Public latest needs a configured SSR adapter and on-demand rendering (export const prerender = false for the affected routes); preserve deliberate static output and its fixed build binding. Do not add an arbitrary host adapter without checking the actual deployment.
|
|
36698
36485
|
|
|
36699
|
-
Emit cooperative publication evidence from the exact reader used for actual page queries: createRenderEvidence(reader, compiledDescriptor), serialized with serializeRenderEvidence. In Astro set X-Plume-Render on the actual HTML response; in Next App Router render one inert script type="application/json" data-plume-render="1" with that escaped JSON. Do not make a separate latest lookup or add a redundant probe endpoint. Intentional static routes emit mode static. Local/working preview dev configuration must select an explicit private module with no compiled descriptor and emit no publication evidence. Runtime flags cannot switch the compiled host-preview mode. Configure the host connection's Content page path to that real route. These are cooperative integration facts, not cryptographic attestation or a completed provider build receipt.
|
|
36700
|
-
|
|
36701
36486
|
## Admin entry and visitor metadata
|
|
36702
36487
|
|
|
36703
36488
|
If /admin is free, add a framework-native server redirect to the verified editorUrl in .plume/site.json. In Next App Router this can be an app/admin route/page; in Astro use its existing redirects configuration or a server route as appropriate. Carry the nonsecret URL into reviewed application configuration that exists at deployment; .plume/site.json is Git-ignored. If /admin already has a purpose, preserve it and resolve the entry route in the integration diff. The destination's sign-in return and Site membership checks remain the authority: embed no shared secret, developer token or auth capability.
|
|
@@ -37189,7 +36974,7 @@ var init_package = __esm({
|
|
|
37189
36974
|
"packages/sdk/package.json"() {
|
|
37190
36975
|
package_default = {
|
|
37191
36976
|
name: "@plume-press/sdk",
|
|
37192
|
-
version: "0.
|
|
36977
|
+
version: "0.5.0",
|
|
37193
36978
|
private: true,
|
|
37194
36979
|
license: "MIT",
|
|
37195
36980
|
type: "module",
|
|
@@ -37216,7 +37001,7 @@ var init_package2 = __esm({
|
|
|
37216
37001
|
"packages/cli/package.json"() {
|
|
37217
37002
|
package_default2 = {
|
|
37218
37003
|
name: "@plume-press/cli",
|
|
37219
|
-
version: "0.
|
|
37004
|
+
version: "0.9.0",
|
|
37220
37005
|
private: true,
|
|
37221
37006
|
license: "MIT",
|
|
37222
37007
|
type: "module",
|
|
@@ -37254,7 +37039,6 @@ var init_package2 = __esm({
|
|
|
37254
37039
|
// packages/cli/src/local.ts
|
|
37255
37040
|
var local_exports = {};
|
|
37256
37041
|
__export(local_exports, {
|
|
37257
|
-
PlumeLocalError: () => PlumeLocalError,
|
|
37258
37042
|
localHelp: () => localHelp,
|
|
37259
37043
|
runLocalCommand: () => runLocalCommand,
|
|
37260
37044
|
runLocalInit: () => runLocalInit
|
|
@@ -37518,7 +37302,6 @@ var init_local = __esm({
|
|
|
37518
37302
|
init_developer();
|
|
37519
37303
|
init_integration();
|
|
37520
37304
|
init_project_files();
|
|
37521
|
-
init_project_files();
|
|
37522
37305
|
MAX_INPUT_BYTES2 = 1024 * 1024;
|
|
37523
37306
|
SCHEMA_TEMPLATE = `import { defineSchema } from "@plume-press/cli/schema";
|
|
37524
37307
|
|
|
@@ -37608,11 +37391,9 @@ import {
|
|
|
37608
37391
|
writeFile
|
|
37609
37392
|
} from "node:fs/promises";
|
|
37610
37393
|
import { dirname, resolve as resolve2 } from "node:path";
|
|
37611
|
-
import { setTimeout as delay } from "node:timers/promises";
|
|
37612
37394
|
var exitCodes = { done: 0, failed: 1, usage: 2, busy: 3 };
|
|
37613
37395
|
var LEASE_SECONDS = 90;
|
|
37614
37396
|
var RENEW_EVERY_MS = 3e4;
|
|
37615
|
-
var PUBLISH_TIMEOUT_MS = 10 * 6e4;
|
|
37616
37397
|
var UsageError = class extends Error {
|
|
37617
37398
|
};
|
|
37618
37399
|
function uuidv72(now = Date.now()) {
|
|
@@ -37630,10 +37411,9 @@ var printable = (value, keepNewlines = false) => Array.from(value, (character) =
|
|
|
37630
37411
|
}).join("");
|
|
37631
37412
|
var statusLabels = {
|
|
37632
37413
|
draft: "Editing",
|
|
37633
|
-
prepared: "
|
|
37634
|
-
in_review: "
|
|
37635
|
-
merged: "Published"
|
|
37636
|
-
closed: "Closed"
|
|
37414
|
+
prepared: "Publishing",
|
|
37415
|
+
in_review: "Waiting for an Admin",
|
|
37416
|
+
merged: "Published"
|
|
37637
37417
|
};
|
|
37638
37418
|
function updateLabel(id2) {
|
|
37639
37419
|
const timestamp2 = Number.parseInt(id2.replaceAll("-", "").slice(0, 12), 16);
|
|
@@ -37660,8 +37440,8 @@ var statusShape = external_exports.object({
|
|
|
37660
37440
|
update: external_exports.object({
|
|
37661
37441
|
id: uuid3,
|
|
37662
37442
|
branch: external_exports.string().max(255),
|
|
37663
|
-
state: external_exports.enum(["initializing", "editing", "
|
|
37664
|
-
status: external_exports.enum(["draft", "prepared", "in_review", "merged"
|
|
37443
|
+
state: external_exports.enum(["initializing", "editing", "prepared"]),
|
|
37444
|
+
status: external_exports.enum(["draft", "prepared", "in_review", "merged"]),
|
|
37665
37445
|
prNumber: external_exports.number().int().nullable()
|
|
37666
37446
|
}),
|
|
37667
37447
|
versionId: uuid3,
|
|
@@ -37709,13 +37489,7 @@ var sessionShape = external_exports.object({
|
|
|
37709
37489
|
siteId: uuid3,
|
|
37710
37490
|
updateId: uuid3,
|
|
37711
37491
|
sessionId: uuid3,
|
|
37712
|
-
token: uuid3.optional()
|
|
37713
|
-
publish: external_exports.object({
|
|
37714
|
-
operationId: uuid3,
|
|
37715
|
-
scope: external_exports.enum(["content", "website", "both"]),
|
|
37716
|
-
purpose: external_exports.enum(["publish", "preview"]),
|
|
37717
|
-
planFingerprint: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/)
|
|
37718
|
-
}).optional()
|
|
37492
|
+
token: uuid3.optional()
|
|
37719
37493
|
});
|
|
37720
37494
|
async function checkoutRoot(cwd) {
|
|
37721
37495
|
let directory = resolve2(cwd);
|
|
@@ -37822,10 +37596,10 @@ async function context2(ctx, session) {
|
|
|
37822
37596
|
return call(ctx, "context", ids(session), contextShape, true);
|
|
37823
37597
|
}
|
|
37824
37598
|
function requireEditable(current) {
|
|
37825
|
-
if (
|
|
37599
|
+
if (current.update?.state !== "editing")
|
|
37826
37600
|
throw new PlumeToolError(
|
|
37827
37601
|
"UPDATE_FROZEN",
|
|
37828
|
-
"This Update
|
|
37602
|
+
"This Update is being published or waits for an Admin. Choose Keep editing under Publish in Plume to edit it again."
|
|
37829
37603
|
);
|
|
37830
37604
|
}
|
|
37831
37605
|
async function heldLease(ctx, session) {
|
|
@@ -38442,227 +38216,6 @@ async function schema2(ctx, args) {
|
|
|
38442
38216
|
}
|
|
38443
38217
|
return exitCodes.done;
|
|
38444
38218
|
}
|
|
38445
|
-
var publicationStatusShape = external_exports.object({
|
|
38446
|
-
operationId: uuid3,
|
|
38447
|
-
sourceUpdateId: uuid3,
|
|
38448
|
-
scope: external_exports.enum(["content", "website", "both"]),
|
|
38449
|
-
purpose: external_exports.enum(["publish", "preview"]),
|
|
38450
|
-
publicationRequested: external_exports.boolean(),
|
|
38451
|
-
state: external_exports.enum([
|
|
38452
|
-
"preparing",
|
|
38453
|
-
"prepared",
|
|
38454
|
-
"needs_approval",
|
|
38455
|
-
"publishing",
|
|
38456
|
-
"recovery_required",
|
|
38457
|
-
"accepted",
|
|
38458
|
-
"cancelling",
|
|
38459
|
-
"cancelled",
|
|
38460
|
-
"blocked"
|
|
38461
|
-
]),
|
|
38462
|
-
progress: external_exports.string().nullable(),
|
|
38463
|
-
reason: external_exports.string().nullable(),
|
|
38464
|
-
allowedActions: external_exports.array(external_exports.enum(["publish_prepared", "recover", "cancel"])),
|
|
38465
|
-
candidate: external_exports.object({ preparedFingerprint: external_exports.string().nullable() }).passthrough().nullable(),
|
|
38466
|
-
result: external_exports.object({
|
|
38467
|
-
receipt: external_exports.object({ operationId: uuid3, sequence: external_exports.number().int().positive() }).passthrough(),
|
|
38468
|
-
sourceUpdateId: uuid3,
|
|
38469
|
-
continuationUpdateId: uuid3.nullable()
|
|
38470
|
-
}).passthrough().nullable()
|
|
38471
|
-
}).passthrough().refine(
|
|
38472
|
-
(value) => value.state === "accepted" ? value.result?.receipt.operationId === value.operationId : value.result === null
|
|
38473
|
-
);
|
|
38474
|
-
var scopePlanShape = external_exports.object({
|
|
38475
|
-
present: external_exports.boolean(),
|
|
38476
|
-
permission: external_exports.enum(["allowed", "approval", "locked"]),
|
|
38477
|
-
disabledReason: external_exports.string().nullable()
|
|
38478
|
-
});
|
|
38479
|
-
var publicationPlanShape = external_exports.object({
|
|
38480
|
-
operationId: uuid3.nullable(),
|
|
38481
|
-
fingerprint: external_exports.string(),
|
|
38482
|
-
content: scopePlanShape,
|
|
38483
|
-
website: scopePlanShape,
|
|
38484
|
-
schemaPartialBlocked: external_exports.boolean()
|
|
38485
|
-
});
|
|
38486
|
-
async function publish(ctx, args) {
|
|
38487
|
-
const options2 = parse6(
|
|
38488
|
-
args,
|
|
38489
|
-
["--preview", "--status", "--recover", "--cancel", "--publish-prepared"],
|
|
38490
|
-
["--scope"]
|
|
38491
|
-
);
|
|
38492
|
-
if (options2.positional.length)
|
|
38493
|
-
throw new UsageError("plume publish takes no positional arguments.");
|
|
38494
|
-
const actionFlags = [
|
|
38495
|
-
"--status",
|
|
38496
|
-
"--recover",
|
|
38497
|
-
"--cancel",
|
|
38498
|
-
"--publish-prepared"
|
|
38499
|
-
].filter((flag) => options2.flags.has(flag));
|
|
38500
|
-
if (actionFlags.length > 1)
|
|
38501
|
-
throw new UsageError("Choose one publication action.");
|
|
38502
|
-
const requestedScope = options2.values.get("--scope");
|
|
38503
|
-
if (requestedScope && !["content", "website", "both"].includes(requestedScope))
|
|
38504
|
-
throw new UsageError("--scope takes content, website or both.");
|
|
38505
|
-
let { session } = await scope(ctx);
|
|
38506
|
-
let pending = session.publish;
|
|
38507
|
-
let status2;
|
|
38508
|
-
let stop = () => {
|
|
38509
|
-
};
|
|
38510
|
-
try {
|
|
38511
|
-
if (pending) {
|
|
38512
|
-
if (requestedScope && requestedScope !== pending.scope || options2.flags.has("--preview") && pending.purpose !== "preview")
|
|
38513
|
-
throw new UsageError(
|
|
38514
|
-
"This checkout has a saved publication. Inspect or cancel it before choosing a different scope."
|
|
38515
|
-
);
|
|
38516
|
-
try {
|
|
38517
|
-
status2 = await call(
|
|
38518
|
-
ctx,
|
|
38519
|
-
"publication.status",
|
|
38520
|
-
{ ...ids(session), operationId: pending.operationId },
|
|
38521
|
-
publicationStatusShape,
|
|
38522
|
-
true
|
|
38523
|
-
);
|
|
38524
|
-
} catch (error62) {
|
|
38525
|
-
if (!(error62 instanceof PlumeToolError) || error62.code !== "NOT_FOUND" || actionFlags.length)
|
|
38526
|
-
throw error62;
|
|
38527
|
-
const lease = await control(ctx, session);
|
|
38528
|
-
session = await readSession(ctx) ?? session;
|
|
38529
|
-
stop = keepControl(ctx, session, lease);
|
|
38530
|
-
status2 = await call(
|
|
38531
|
-
ctx,
|
|
38532
|
-
"publication.start",
|
|
38533
|
-
{
|
|
38534
|
-
...ids(session),
|
|
38535
|
-
...pending,
|
|
38536
|
-
sessionId: session.sessionId,
|
|
38537
|
-
token: lease.token
|
|
38538
|
-
},
|
|
38539
|
-
publicationStatusShape
|
|
38540
|
-
);
|
|
38541
|
-
}
|
|
38542
|
-
} else {
|
|
38543
|
-
const plan = await call(
|
|
38544
|
-
ctx,
|
|
38545
|
-
"publication.plan",
|
|
38546
|
-
ids(session),
|
|
38547
|
-
publicationPlanShape,
|
|
38548
|
-
true
|
|
38549
|
-
);
|
|
38550
|
-
if (plan.operationId) {
|
|
38551
|
-
status2 = await call(
|
|
38552
|
-
ctx,
|
|
38553
|
-
"publication.status",
|
|
38554
|
-
{ ...ids(session), operationId: plan.operationId },
|
|
38555
|
-
publicationStatusShape,
|
|
38556
|
-
true
|
|
38557
|
-
);
|
|
38558
|
-
pending = {
|
|
38559
|
-
operationId: status2.operationId,
|
|
38560
|
-
scope: status2.scope,
|
|
38561
|
-
purpose: status2.purpose,
|
|
38562
|
-
planFingerprint: plan.fingerprint
|
|
38563
|
-
};
|
|
38564
|
-
} else {
|
|
38565
|
-
if (actionFlags.length)
|
|
38566
|
-
throw new UsageError(
|
|
38567
|
-
"There is no saved publication for this Update."
|
|
38568
|
-
);
|
|
38569
|
-
const selected = requestedScope ?? (plan.content.present && plan.website.present ? "both" : plan.content.present ? "content" : "website");
|
|
38570
|
-
const scopes = selected === "both" ? [plan.content, plan.website] : [selected === "content" ? plan.content : plan.website];
|
|
38571
|
-
if (scopes.some(
|
|
38572
|
-
(value) => !value.present || value.permission === "locked" || value.disabledReason
|
|
38573
|
-
) || selected !== "both" && plan.schemaPartialBlocked)
|
|
38574
|
-
throw new PlumeToolError(
|
|
38575
|
-
"SCOPE_UNAVAILABLE",
|
|
38576
|
-
"The selected publication scope is unavailable. Inspect this Update in Plume."
|
|
38577
|
-
);
|
|
38578
|
-
const lease = await control(ctx, session);
|
|
38579
|
-
session = await readSession(ctx) ?? session;
|
|
38580
|
-
stop = keepControl(ctx, session, lease);
|
|
38581
|
-
pending = {
|
|
38582
|
-
operationId: uuidv72(),
|
|
38583
|
-
scope: selected,
|
|
38584
|
-
purpose: options2.flags.has("--preview") ? "preview" : "publish",
|
|
38585
|
-
planFingerprint: plan.fingerprint
|
|
38586
|
-
};
|
|
38587
|
-
await writeSession(ctx, { ...session, publish: pending });
|
|
38588
|
-
status2 = await call(
|
|
38589
|
-
ctx,
|
|
38590
|
-
"publication.start",
|
|
38591
|
-
{
|
|
38592
|
-
...ids(session),
|
|
38593
|
-
...pending,
|
|
38594
|
-
sessionId: session.sessionId,
|
|
38595
|
-
token: lease.token
|
|
38596
|
-
},
|
|
38597
|
-
publicationStatusShape
|
|
38598
|
-
);
|
|
38599
|
-
}
|
|
38600
|
-
await writeSession(ctx, { ...session, publish: pending });
|
|
38601
|
-
}
|
|
38602
|
-
if (status2.operationId !== pending.operationId || status2.sourceUpdateId !== session.updateId)
|
|
38603
|
-
throw new PlumeToolError(
|
|
38604
|
-
"INVALID_RESPONSE",
|
|
38605
|
-
"The publication response identifies another operation or Update."
|
|
38606
|
-
);
|
|
38607
|
-
const action = actionFlags[0];
|
|
38608
|
-
if (action && action !== "--status") {
|
|
38609
|
-
const allowed = action === "--publish-prepared" ? "publish_prepared" : action.slice(2);
|
|
38610
|
-
if (!status2.allowedActions.includes(
|
|
38611
|
-
allowed
|
|
38612
|
-
))
|
|
38613
|
-
throw new PlumeToolError(
|
|
38614
|
-
"ACTION_UNAVAILABLE",
|
|
38615
|
-
"This action is unavailable for the saved publication."
|
|
38616
|
-
);
|
|
38617
|
-
const input2 = { ...ids(session), operationId: status2.operationId };
|
|
38618
|
-
status2 = await call(
|
|
38619
|
-
ctx,
|
|
38620
|
-
action === "--publish-prepared" ? "publication.publishPrepared" : action === "--cancel" ? "publication.cancel" : "publication.recover",
|
|
38621
|
-
action === "--publish-prepared" ? {
|
|
38622
|
-
...input2,
|
|
38623
|
-
preparedFingerprint: status2.candidate?.preparedFingerprint
|
|
38624
|
-
} : input2,
|
|
38625
|
-
publicationStatusShape
|
|
38626
|
-
);
|
|
38627
|
-
}
|
|
38628
|
-
stop();
|
|
38629
|
-
const deadline = Date.now() + PUBLISH_TIMEOUT_MS;
|
|
38630
|
-
let previous = "";
|
|
38631
|
-
while (action !== "--status" && ["preparing", "publishing", "cancelling"].includes(status2.state) && Date.now() < deadline) {
|
|
38632
|
-
const label = status2.progress ?? status2.state;
|
|
38633
|
-
if (!ctx.json && label !== previous) ctx.io.out(`${printable(label)}\u2026
|
|
38634
|
-
`);
|
|
38635
|
-
previous = label;
|
|
38636
|
-
await delay(1e3);
|
|
38637
|
-
status2 = await call(
|
|
38638
|
-
ctx,
|
|
38639
|
-
"publication.status",
|
|
38640
|
-
{ ...ids(session), operationId: pending.operationId },
|
|
38641
|
-
publicationStatusShape,
|
|
38642
|
-
true
|
|
38643
|
-
);
|
|
38644
|
-
if (status2.operationId !== pending.operationId || status2.sourceUpdateId !== session.updateId)
|
|
38645
|
-
throw new PlumeToolError(
|
|
38646
|
-
"INVALID_RESPONSE",
|
|
38647
|
-
"The saved publication identity changed."
|
|
38648
|
-
);
|
|
38649
|
-
}
|
|
38650
|
-
if (["accepted", "cancelled"].includes(status2.state))
|
|
38651
|
-
await writeSession(ctx, {
|
|
38652
|
-
...session,
|
|
38653
|
-
publish: void 0,
|
|
38654
|
-
token: void 0
|
|
38655
|
-
});
|
|
38656
|
-
emit(
|
|
38657
|
-
ctx,
|
|
38658
|
-
status2,
|
|
38659
|
-
() => status2.state === "accepted" && status2.result ? `Published ${status2.scope}. Publication ${status2.operationId}, sequence ${status2.result.receipt.sequence}.${status2.result.continuationUpdateId ? ` Retained work: ${status2.result.continuationUpdateId}.` : ""}` : `Publication ${status2.operationId}: ${status2.state}${status2.reason ? ` (${status2.reason})` : ""}.${status2.allowedActions.length ? ` Available actions: ${status2.allowedActions.map((value) => `--${value.replaceAll("_", "-")}`).join(", ")}.` : ""}`
|
|
38660
|
-
);
|
|
38661
|
-
return exitCodes.done;
|
|
38662
|
-
} finally {
|
|
38663
|
-
stop();
|
|
38664
|
-
}
|
|
38665
|
-
}
|
|
38666
38219
|
async function takeControl(ctx, args) {
|
|
38667
38220
|
const options2 = parse6(args);
|
|
38668
38221
|
if (options2.positional.length)
|
|
@@ -38718,7 +38271,7 @@ var commands = {
|
|
|
38718
38271
|
|
|
38719
38272
|
Usage: plume status [--json]
|
|
38720
38273
|
|
|
38721
|
-
Shows the Site, the Update this developer access is for (and its status: Editing,
|
|
38274
|
+
Shows the Site, the Update this developer access is for (and its status: Editing, Publishing, Waiting for an Admin or Published), who holds editing control and since when, and links to the Update in Plume's Content and Website preview pages.
|
|
38722
38275
|
|
|
38723
38276
|
Example:
|
|
38724
38277
|
plume status`,
|
|
@@ -38778,18 +38331,6 @@ Examples:
|
|
|
38778
38331
|
plume schema apply`,
|
|
38779
38332
|
run: schema2
|
|
38780
38333
|
},
|
|
38781
|
-
publish: {
|
|
38782
|
-
summary: "Publish the Update, showing each step",
|
|
38783
|
-
help: `plume publish \u2014 publish this checkout's Update, as Publish in Plume does.
|
|
38784
|
-
|
|
38785
|
-
Usage: plume publish [--scope content|website|both] [--preview] [--status|--recover|--cancel|--publish-prepared] [--json]
|
|
38786
|
-
|
|
38787
|
-
Starts one saved scoped publication and observes its status. The default selects the changed scopes. --preview prepares an immutable host preview; publishing it later requires --publish-prepared. --status only reads. --recover wakes an authorized recoverable operation; --cancel requests cancellation. A lost response keeps the same operation identity. Content publication does not cause a Website build.
|
|
38788
|
-
|
|
38789
|
-
Example:
|
|
38790
|
-
plume publish`,
|
|
38791
|
-
run: publish
|
|
38792
|
-
},
|
|
38793
38334
|
"take-control": {
|
|
38794
38335
|
summary: "Take editing control from whoever holds it",
|
|
38795
38336
|
help: `plume take-control \u2014 take editing control of this Update.
|
|
@@ -38877,34 +38418,6 @@ function explain(error62, ctx) {
|
|
|
38877
38418
|
exit: exitCodes.failed
|
|
38878
38419
|
};
|
|
38879
38420
|
}
|
|
38880
|
-
case "RECONCILIATION_CONFLICT": {
|
|
38881
|
-
const conflicts = details?.conflicts ?? [];
|
|
38882
|
-
const total = Number(details?.total ?? conflicts.length);
|
|
38883
|
-
return {
|
|
38884
|
-
...base2,
|
|
38885
|
-
message: [
|
|
38886
|
-
"Publishing stopped: these Items changed both here and in the published version.",
|
|
38887
|
-
...conflicts.map(
|
|
38888
|
-
(item) => ` ${printable(item.collection)}/${printable(item.recordId)}`
|
|
38889
|
-
),
|
|
38890
|
-
...total > conflicts.length ? [` \u2026and ${total - conflicts.length} more`] : [],
|
|
38891
|
-
"Choose which version to keep in Plume (Resolve conflicts on the Update\u2019s card), then run plume publish again."
|
|
38892
|
-
].join("\n"),
|
|
38893
|
-
exit: exitCodes.failed
|
|
38894
|
-
};
|
|
38895
|
-
}
|
|
38896
|
-
case "CODE_CONFLICT": {
|
|
38897
|
-
const paths = details?.paths ?? [];
|
|
38898
|
-
return {
|
|
38899
|
-
...base2,
|
|
38900
|
-
message: [
|
|
38901
|
-
"Publishing stopped: the code changed both in this Update and in the published version.",
|
|
38902
|
-
...paths.map((path) => ` ${printable(path)}`),
|
|
38903
|
-
"Combine them on the Update\u2019s branch and push, then run plume publish again."
|
|
38904
|
-
].join("\n"),
|
|
38905
|
-
exit: exitCodes.failed
|
|
38906
|
-
};
|
|
38907
|
-
}
|
|
38908
38421
|
case "NOT_FOUND":
|
|
38909
38422
|
return {
|
|
38910
38423
|
...base2,
|
|
@@ -39007,7 +38520,7 @@ init_protocol();
|
|
|
39007
38520
|
init_zod();
|
|
39008
38521
|
import { execFile as execFile2 } from "node:child_process";
|
|
39009
38522
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
39010
|
-
import { realpath
|
|
38523
|
+
import { realpath } from "node:fs/promises";
|
|
39011
38524
|
import { resolve as resolve5 } from "node:path";
|
|
39012
38525
|
import { createInterface } from "node:readline/promises";
|
|
39013
38526
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -39016,7 +38529,7 @@ import { promisify as promisify2 } from "node:util";
|
|
|
39016
38529
|
init_zod();
|
|
39017
38530
|
init_developer();
|
|
39018
38531
|
import { createHash as createHash2, randomBytes as randomBytes2 } from "node:crypto";
|
|
39019
|
-
import { setTimeout as
|
|
38532
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
39020
38533
|
var codeResponse = external_exports.object({
|
|
39021
38534
|
device_code: external_exports.string().min(16).max(512),
|
|
39022
38535
|
user_code: external_exports.string().regex(/^[ABCDEFGHJKLMNPQRSTUVWXYZ23456789]{8}$/),
|
|
@@ -39038,7 +38551,7 @@ var sha256 = (value) => createHash2("sha256").update(value).digest("hex");
|
|
|
39038
38551
|
async function authorizeConnection(options2) {
|
|
39039
38552
|
const request = options2.fetch ?? fetch;
|
|
39040
38553
|
const now = options2.now ?? Date.now;
|
|
39041
|
-
const wait = options2.wait ?? ((ms) =>
|
|
38554
|
+
const wait = options2.wait ?? ((ms) => delay(ms, void 0, { signal: options2.signal }));
|
|
39042
38555
|
const startUrl = developerUrl(options2.endpoint, "api/auth/device/code");
|
|
39043
38556
|
const exchangeUrl = developerUrl(
|
|
39044
38557
|
options2.endpoint,
|
|
@@ -39163,7 +38676,7 @@ var receiptShape = external_exports.strictObject({
|
|
|
39163
38676
|
});
|
|
39164
38677
|
async function checkout(cwd) {
|
|
39165
38678
|
const root3 = await git(cwd, "rev-parse", "--show-toplevel");
|
|
39166
|
-
if (await
|
|
38679
|
+
if (await realpath(root3) !== cwd)
|
|
39167
38680
|
throw new PlumeToolError(
|
|
39168
38681
|
"CHECKOUT_MISMATCH",
|
|
39169
38682
|
"Run plume connect from the Git repository root."
|
|
@@ -39250,7 +38763,7 @@ var remoteHelp = (branch) => ({
|
|
|
39250
38763
|
SITE_BUSY: "Someone is editing an Update on this Site in Plume. Wait for their session to end, then run plume connect again."
|
|
39251
38764
|
});
|
|
39252
38765
|
async function runConnect(options2) {
|
|
39253
|
-
const cwd = await
|
|
38766
|
+
const cwd = await realpath(resolve5(options2.cwd));
|
|
39254
38767
|
const endpoint = developerUrl(options2.endpoint ?? defaultEndpoint, "").toString().replace(/\/$/, "");
|
|
39255
38768
|
const initial = await checkout(cwd);
|
|
39256
38769
|
const authorization = await (options2.authorize ?? authorizeConnection)({
|
|
@@ -39477,63 +38990,16 @@ init_developer();
|
|
|
39477
38990
|
|
|
39478
38991
|
// packages/cli/src/export.ts
|
|
39479
38992
|
init_src();
|
|
39480
|
-
init_protocol();
|
|
39481
|
-
init_zod();
|
|
39482
|
-
init_developer();
|
|
39483
38993
|
import { createHash as createHash4 } from "node:crypto";
|
|
39484
38994
|
import { createWriteStream } from "node:fs";
|
|
39485
38995
|
import { link, lstat as lstat4, mkdtemp, open as open5, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
|
|
39486
38996
|
import { dirname as dirname2, join as join2, resolve as resolve6 } from "node:path";
|
|
39487
38997
|
import { addAbortSignal, Readable, Transform } from "node:stream";
|
|
39488
38998
|
import { finished, pipeline } from "node:stream/promises";
|
|
39489
|
-
|
|
39490
|
-
|
|
39491
|
-
|
|
39492
|
-
|
|
39493
|
-
var site = external_exports.object({ id: text3, name: text3 }).strict();
|
|
39494
|
-
var authorizationSchema = external_exports.object({
|
|
39495
|
-
format: external_exports.literal(1),
|
|
39496
|
-
endpoint: text3,
|
|
39497
|
-
token: text3.max(16384),
|
|
39498
|
-
site,
|
|
39499
|
-
expiresAt: integer2
|
|
39500
|
-
}).strict();
|
|
39501
|
-
var sourceSchema = external_exports.object({
|
|
39502
|
-
exportId: text3,
|
|
39503
|
-
site,
|
|
39504
|
-
binding: contentBindingSchema,
|
|
39505
|
-
revision: integer2,
|
|
39506
|
-
commitSha: text3.nullable(),
|
|
39507
|
-
branch: text3,
|
|
39508
|
-
capturedAt: integer2,
|
|
39509
|
-
storageCutoff: integer2
|
|
39510
|
-
}).strict();
|
|
39511
|
-
var recordSchema = external_exports.object({
|
|
39512
|
-
collection: text3,
|
|
39513
|
-
recordId: text3,
|
|
39514
|
-
visibility: external_exports.enum(["draft", "public"]),
|
|
39515
|
-
data: external_exports.record(external_exports.string(), external_exports.json())
|
|
39516
|
-
}).strict();
|
|
39517
|
-
var descriptorSchema = external_exports.object({
|
|
39518
|
-
id: text3,
|
|
39519
|
-
objectKey: text3,
|
|
39520
|
-
filename: external_exports.string(),
|
|
39521
|
-
mediaType: text3,
|
|
39522
|
-
byteLength: integer2,
|
|
39523
|
-
sha256: external_exports.string().regex(/^(?:sha256:)?[a-f0-9]{64}$/),
|
|
39524
|
-
width: integer2.nullable(),
|
|
39525
|
-
height: integer2.nullable()
|
|
39526
|
-
}).strict();
|
|
39527
|
-
var cursorSchema = external_exports.object({ createdAt: integer2, id: text3 }).strict();
|
|
39528
|
-
var inventorySchema = external_exports.object({
|
|
39529
|
-
key: text3,
|
|
39530
|
-
etag: text3,
|
|
39531
|
-
size: integer2,
|
|
39532
|
-
uploaded: integer2,
|
|
39533
|
-
contentType: text3.optional()
|
|
39534
|
-
}).strict();
|
|
39535
|
-
var digest = (bytes2) => `sha256:${createHash4("sha256").update(bytes2).digest("hex")}`;
|
|
39536
|
-
var normalizeHash = (hash2) => hash2.startsWith("sha256:") ? hash2 : `sha256:${hash2}`;
|
|
38999
|
+
|
|
39000
|
+
// packages/core/src/customer-export.ts
|
|
39001
|
+
init_delivered();
|
|
39002
|
+
init_rich_text();
|
|
39537
39003
|
var extensions = {
|
|
39538
39004
|
"image/jpeg": "jpg",
|
|
39539
39005
|
"image/png": "png",
|
|
@@ -39602,6 +39068,67 @@ function referencedAssets(fields, data, ids2) {
|
|
|
39602
39068
|
}
|
|
39603
39069
|
}
|
|
39604
39070
|
}
|
|
39071
|
+
var storageArchivePath = (index2, mediaType) => `storage/${String(index2).padStart(8, "0")}.${extensions[mediaType ?? ""] ?? "bin"}`;
|
|
39072
|
+
var mediaLine = (asset, item, archivePath, sha2563) => `${JSON.stringify({ ...asset ?? { id: null, objectKey: item.key, filename: null, mediaType: item.contentType ?? "application/octet-stream" }, registered: !!asset, archivePath, byteLength: item.size, sha256: sha2563, etag: item.etag, uploaded: item.uploaded })}
|
|
39073
|
+
`;
|
|
39074
|
+
var manifestHeader = {
|
|
39075
|
+
format: 1,
|
|
39076
|
+
complete: true,
|
|
39077
|
+
source: "published"
|
|
39078
|
+
};
|
|
39079
|
+
|
|
39080
|
+
// packages/cli/src/export.ts
|
|
39081
|
+
init_protocol();
|
|
39082
|
+
init_zod();
|
|
39083
|
+
init_developer();
|
|
39084
|
+
import { ZipFile } from "yazl";
|
|
39085
|
+
var exportHelp = "Usage: plume export --authorization <file> --out <archive.zip>\nExport the Published content and all current Site storage to a local ZIP.";
|
|
39086
|
+
var text3 = external_exports.string().min(1);
|
|
39087
|
+
var integer2 = external_exports.number().int().nonnegative();
|
|
39088
|
+
var site = external_exports.object({ id: text3, name: text3 }).strict();
|
|
39089
|
+
var authorizationSchema = external_exports.object({
|
|
39090
|
+
format: external_exports.literal(1),
|
|
39091
|
+
endpoint: text3,
|
|
39092
|
+
token: text3.max(16384),
|
|
39093
|
+
site,
|
|
39094
|
+
expiresAt: integer2
|
|
39095
|
+
}).strict();
|
|
39096
|
+
var sourceSchema = external_exports.object({
|
|
39097
|
+
exportId: text3,
|
|
39098
|
+
site,
|
|
39099
|
+
binding: contentBindingSchema,
|
|
39100
|
+
revision: integer2,
|
|
39101
|
+
commitSha: text3.nullable(),
|
|
39102
|
+
branch: text3,
|
|
39103
|
+
capturedAt: integer2,
|
|
39104
|
+
storageCutoff: integer2
|
|
39105
|
+
}).strict();
|
|
39106
|
+
var recordSchema = external_exports.object({
|
|
39107
|
+
collection: text3,
|
|
39108
|
+
recordId: text3,
|
|
39109
|
+
visibility: external_exports.enum(["draft", "public"]),
|
|
39110
|
+
data: external_exports.record(external_exports.string(), external_exports.json())
|
|
39111
|
+
}).strict();
|
|
39112
|
+
var descriptorSchema = external_exports.object({
|
|
39113
|
+
id: text3,
|
|
39114
|
+
objectKey: text3,
|
|
39115
|
+
filename: external_exports.string(),
|
|
39116
|
+
mediaType: text3,
|
|
39117
|
+
byteLength: integer2,
|
|
39118
|
+
sha256: external_exports.string().regex(/^(?:sha256:)?[a-f0-9]{64}$/),
|
|
39119
|
+
width: integer2.nullable(),
|
|
39120
|
+
height: integer2.nullable()
|
|
39121
|
+
}).strict();
|
|
39122
|
+
var cursorSchema = external_exports.object({ createdAt: integer2, id: text3 }).strict();
|
|
39123
|
+
var inventorySchema = external_exports.object({
|
|
39124
|
+
key: text3,
|
|
39125
|
+
etag: text3,
|
|
39126
|
+
size: integer2,
|
|
39127
|
+
uploaded: integer2,
|
|
39128
|
+
contentType: text3.optional()
|
|
39129
|
+
}).strict();
|
|
39130
|
+
var digest = (bytes2) => `sha256:${createHash4("sha256").update(bytes2).digest("hex")}`;
|
|
39131
|
+
var normalizeHash = (hash2) => hash2.startsWith("sha256:") ? hash2 : `sha256:${hash2}`;
|
|
39605
39132
|
async function runExport(options2) {
|
|
39606
39133
|
const controller = new AbortController();
|
|
39607
39134
|
const signal = options2.signal ? AbortSignal.any([options2.signal, controller.signal]) : controller.signal;
|
|
@@ -39799,7 +39326,10 @@ async function runExport(options2) {
|
|
|
39799
39326
|
throw new Error();
|
|
39800
39327
|
const asset = descriptors.get(item.key);
|
|
39801
39328
|
if (asset && asset.byteLength !== item.size) throw new Error();
|
|
39802
|
-
const archivePath =
|
|
39329
|
+
const archivePath = storageArchivePath(
|
|
39330
|
+
included.size + 1,
|
|
39331
|
+
asset?.mediaType ?? item.contentType
|
|
39332
|
+
);
|
|
39803
39333
|
const response = await request(
|
|
39804
39334
|
{ action: "object", key: item.key, etag: item.etag },
|
|
39805
39335
|
true
|
|
@@ -39853,8 +39383,7 @@ async function runExport(options2) {
|
|
|
39853
39383
|
if (bytes2 !== item.size || asset && normalizeHash(asset.sha256) !== sha2563)
|
|
39854
39384
|
throw new Error();
|
|
39855
39385
|
checksums[archivePath] = sha2563;
|
|
39856
|
-
const line =
|
|
39857
|
-
`;
|
|
39386
|
+
const line = mediaLine(asset, item, archivePath, sha2563);
|
|
39858
39387
|
await mediaFile.writeFile(line);
|
|
39859
39388
|
mediaHash.update(line);
|
|
39860
39389
|
included.add(item.key);
|
|
@@ -39883,9 +39412,7 @@ async function runExport(options2) {
|
|
|
39883
39412
|
const verified = external_exports.object({ ok: external_exports.literal(true), exportId: text3 }).strict().parse(await json2({ action: "verify" }));
|
|
39884
39413
|
if (verified.exportId !== source.exportId) throw new Error();
|
|
39885
39414
|
const manifest = {
|
|
39886
|
-
|
|
39887
|
-
complete: true,
|
|
39888
|
-
source: "published",
|
|
39415
|
+
...manifestHeader,
|
|
39889
39416
|
snapshot: source,
|
|
39890
39417
|
inventory: {
|
|
39891
39418
|
startedAt: inventoryStartedAt,
|
|
@@ -39980,7 +39507,7 @@ var validationSchema = external_exports.object({
|
|
|
39980
39507
|
binding: contentBindingSchema,
|
|
39981
39508
|
revision: external_exports.number().int().nonnegative(),
|
|
39982
39509
|
sealed: external_exports.literal(true),
|
|
39983
|
-
|
|
39510
|
+
preview: external_exports.boolean()
|
|
39984
39511
|
}).strict();
|
|
39985
39512
|
var PlumeBuildError = class extends Error {
|
|
39986
39513
|
constructor(code, message) {
|
|
@@ -40062,7 +39589,7 @@ function validationUrl(endpoint) {
|
|
|
40062
39589
|
);
|
|
40063
39590
|
}
|
|
40064
39591
|
}
|
|
40065
|
-
async function validateRemote(url2, binding, commitSha
|
|
39592
|
+
async function validateRemote(url2, binding, commitSha) {
|
|
40066
39593
|
const abort = new AbortController(), interrupt = () => abort.abort();
|
|
40067
39594
|
process.on("SIGINT", interrupt);
|
|
40068
39595
|
process.on("SIGTERM", interrupt);
|
|
@@ -40074,8 +39601,7 @@ async function validateRemote(url2, binding, commitSha, operationId) {
|
|
|
40074
39601
|
headers: { "content-type": "application/json" },
|
|
40075
39602
|
body: JSON.stringify({
|
|
40076
39603
|
binding,
|
|
40077
|
-
commitSha
|
|
40078
|
-
...operationId ? { mode: "selected-preview", operationId } : {}
|
|
39604
|
+
commitSha
|
|
40079
39605
|
}),
|
|
40080
39606
|
redirect: "error",
|
|
40081
39607
|
cache: "no-store",
|
|
@@ -40099,7 +39625,7 @@ async function validateRemote(url2, binding, commitSha, operationId) {
|
|
|
40099
39625
|
const result = validationSchema.parse(
|
|
40100
39626
|
await boundedJson(response, MAX_RESPONSE_BYTES2)
|
|
40101
39627
|
);
|
|
40102
|
-
if (
|
|
39628
|
+
if (result.binding.siteId !== binding.siteId || result.binding.schemaHash !== binding.schemaHash)
|
|
40103
39629
|
throw Error();
|
|
40104
39630
|
return result;
|
|
40105
39631
|
} catch {
|
|
@@ -40178,8 +39704,8 @@ async function runBuild(options2) {
|
|
|
40178
39704
|
"Provide a build command."
|
|
40179
39705
|
);
|
|
40180
39706
|
const url2 = validationUrl(options2.endpoint);
|
|
40181
|
-
const
|
|
40182
|
-
await validateSchema(cwd, options2.schemaPath ?? "plume.schema.ts",
|
|
39707
|
+
const lock = await readLock(cwd);
|
|
39708
|
+
await validateSchema(cwd, options2.schemaPath ?? "plume.schema.ts", lock);
|
|
40183
39709
|
const commitSha = await git(cwd, "rev-parse", "HEAD");
|
|
40184
39710
|
if (!await untrackedFiles(cwd))
|
|
40185
39711
|
throw new PlumeBuildError(
|
|
@@ -40191,45 +39717,22 @@ async function runBuild(options2) {
|
|
|
40191
39717
|
"INVALID_CONFIGURATION",
|
|
40192
39718
|
"Build from an exact Git commit."
|
|
40193
39719
|
);
|
|
39720
|
+
const { binding, preview } = await validateRemote(url2, lock, commitSha);
|
|
40194
39721
|
const requested = options2.delivery ?? "static";
|
|
40195
|
-
|
|
40196
|
-
let operationId;
|
|
40197
|
-
const trailers = requested === "selected-preview" || requested === "auto" ? /^Prepare Plume publication\n\nPlume-Publication: ([a-f0-9-]{36})\nPlume-Content: ([a-f0-9-]{36})\nPlume-Schema: (sha256:[a-f0-9]{64})$/.exec(
|
|
40198
|
-
await git(cwd, "show", "-s", "--format=%B", "HEAD")
|
|
40199
|
-
) : null;
|
|
40200
|
-
if (requested === "selected-preview" || trailers) {
|
|
40201
|
-
mode = "selected-preview";
|
|
40202
|
-
const candidate = previewCandidateSchema.safeParse({
|
|
40203
|
-
operationId: trailers?.[1],
|
|
40204
|
-
commitSha
|
|
40205
|
-
});
|
|
40206
|
-
if (!candidate.success || trailers?.[2] !== binding.contentVersionId || trailers?.[3] !== binding.schemaHash)
|
|
40207
|
-
throw new PlumeBuildError(
|
|
40208
|
-
"INVALID_CONFIGURATION",
|
|
40209
|
-
"Build a selected preview from its exact Plume binding commit and matching lock."
|
|
40210
|
-
);
|
|
40211
|
-
operationId = candidate.data.operationId;
|
|
40212
|
-
}
|
|
40213
|
-
const validation = await validateRemote(
|
|
40214
|
-
url2,
|
|
40215
|
-
binding,
|
|
40216
|
-
commitSha,
|
|
40217
|
-
operationId
|
|
40218
|
-
);
|
|
39722
|
+
const update = requested === "auto" && preview;
|
|
40219
39723
|
const descriptor = deliveryDescriptorSchema.safeParse({
|
|
40220
39724
|
version: 1,
|
|
40221
|
-
mode,
|
|
39725
|
+
mode: update ? "static" : requested === "auto" ? "production-ssr" : requested,
|
|
40222
39726
|
artifact: {
|
|
40223
39727
|
commitSha,
|
|
40224
|
-
environment: options2.environment ?? (
|
|
39728
|
+
environment: options2.environment ?? (update ? "preview" : "production")
|
|
40225
39729
|
},
|
|
40226
|
-
binding
|
|
40227
|
-
candidate: mode === "selected-preview" ? validation.candidate ?? null : null
|
|
39730
|
+
binding
|
|
40228
39731
|
});
|
|
40229
39732
|
if (!descriptor.success)
|
|
40230
39733
|
throw new PlumeBuildError(
|
|
40231
39734
|
"VALIDATION_FAILED",
|
|
40232
|
-
"Choose a valid delivery mode
|
|
39735
|
+
"Choose a valid delivery mode and environment."
|
|
40233
39736
|
);
|
|
40234
39737
|
await writeFile3(
|
|
40235
39738
|
deliveryFile,
|
|
@@ -40324,8 +39827,7 @@ async function main(args, env2 = process.env) {
|
|
|
40324
39827
|
if (args[0] && commandNames.includes(args[0])) return runCommand(args, io);
|
|
40325
39828
|
if (args[0] === "help" && args.length === 2 && commandNames.includes(args[1]))
|
|
40326
39829
|
return runCommand([args[1], "--help"], io);
|
|
40327
|
-
if (args[0] === "tool"
|
|
40328
|
-
return developerMain(args, env2);
|
|
39830
|
+
if (args[0] === "tool") return developerMain(args, env2);
|
|
40329
39831
|
if (!args.length || args.length === 1 && (args[0] === "--help" || args[0] === "help")) {
|
|
40330
39832
|
const { localHelp: localHelp2 } = await Promise.resolve().then(() => (init_local(), local_exports));
|
|
40331
39833
|
process.stdout.write(
|
|
@@ -40360,15 +39862,13 @@ ${developerHelp}
|
|
|
40360
39862
|
if (!flag || !value || !["--delivery", "--environment"].includes(flag) || buildFlags.has(flag))
|
|
40361
39863
|
throw new PlumeBuildError(
|
|
40362
39864
|
"INVALID_CONFIGURATION",
|
|
40363
|
-
"Usage: plume build [--delivery auto|production-ssr|
|
|
39865
|
+
"Usage: plume build [--delivery auto|production-ssr|static] [--environment production|preview] -- <command ...>"
|
|
40364
39866
|
);
|
|
40365
39867
|
buildFlags.set(flag, value);
|
|
40366
39868
|
}
|
|
40367
39869
|
const mode = buildFlags.get("--delivery") ?? "static";
|
|
40368
39870
|
const environment = buildFlags.get("--environment");
|
|
40369
|
-
if (!["auto", "production-ssr", "
|
|
40370
|
-
mode
|
|
40371
|
-
) || environment && !["production", "preview"].includes(environment))
|
|
39871
|
+
if (!["auto", "production-ssr", "static"].includes(mode) || environment && !["production", "preview"].includes(environment))
|
|
40372
39872
|
throw new PlumeBuildError(
|
|
40373
39873
|
"INVALID_CONFIGURATION",
|
|
40374
39874
|
"Choose a supported delivery mode and environment."
|