@plume-press/cli 0.8.0 → 0.8.2

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.mjs +27 -13
  3. 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.8.0
6
+ npm install --save-dev @plume-press/cli@0.8.2
7
7
  npx plume init --check
8
8
  npx plume --help
9
9
  ```
@@ -29,7 +29,7 @@ A successful connection saves nonsecret Site/editor URL facts in Git-ignored .pl
29
29
 
30
30
  ## Check a connected build
31
31
 
32
- Choose plume build --delivery production-ssr -- <your existing framework build command> for public request-time content, --delivery selected-preview for an immutable publication candidate, or --delivery static (the default) for a pinned build. The wrapper validates clean exact Git HEAD, plume.lock and matching plume.schema.ts once, writes .plume/binding.json and .plume/delivery.json, then runs the framework. Selected-preview HEAD trailers must identify an existing immutable native reservation and agree with the lock. Compilation records operation ID, actual SHA and environment; later host evidence must match the final prepared target. 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.
32
+ Use plume build --delivery auto -- <your existing framework build command> when the host builds both the live branch and preview branches: it builds a selected preview only when HEAD is Plume's prepared publication commit and production SSR otherwise, with no host setting. The explicit modes are --delivery production-ssr for public request-time content, --delivery selected-preview for an immutable publication candidate, 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. Selected-preview HEAD trailers must identify an existing immutable native reservation and agree with the lock. Compilation records operation ID, actual SHA and environment; later host evidence must match the final prepared target. 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
34
  Production SSR resolves createLatestPlume once per render and shares the reader across page queries; selected preview/static use createPlume with the compiled binding. Emit same-reader render evidence with the compiled descriptor. Static or cached pages need a rebuild or real invalidation for freshness; runtime environment variables must not switch an immutable preview to latest.
35
35
 
package/dist/cli.mjs CHANGED
@@ -36687,9 +36687,10 @@ Create or adapt one reader factory beside the site's existing server data helper
36687
36687
  Choose the mode explicitly in application/server configuration:
36688
36688
 
36689
36689
  - **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
- - **Immutable host preview:** run plume build --delivery selected-preview -- <existing framework build command> from its clean exact Git candidate. The build reads its committed Plume operation trailers and validates the exact sealed binding against the native immutable reservation, then writes .plume/delivery.json with operationId and compiled code SHA. Final native preparation must match that operation, SHA and binding before Plume confirms the host preview. Use createPlume with the generated .plume/binding.json and mode: "published". Never resolve latest for this mode.
36690
+ - **Immutable host preview:** run plume build --delivery selected-preview -- <existing framework build command> from its exact Git candidate with committed files unchanged (new files the host or install adds are allowed and listed in the build log). The build reads its committed Plume operation trailers and validates the exact sealed binding against the native immutable reservation, then writes .plume/delivery.json with operationId and compiled code SHA. Final native preparation must match that operation, SHA and binding before Plume confirms the host preview. Use createPlume with the generated .plume/binding.json and mode: "published". Never resolve latest for this mode.
36691
36691
  - **Deliberately static build:** plume build --delivery static -- <existing framework build command> compiles an immutable selection. Content changes require a real rebuild or supported invalidation; a latest probe cannot certify an old page.
36692
36692
  - **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. A prepared host preview must keep its fixed candidate even if public latest advances.
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.
36693
36694
 
36694
36695
  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.
36695
36696
 
@@ -37215,7 +37216,7 @@ var init_package2 = __esm({
37215
37216
  "packages/cli/package.json"() {
37216
37217
  package_default2 = {
37217
37218
  name: "@plume-press/cli",
37218
- version: "0.8.0",
37219
+ version: "0.8.2",
37219
37220
  private: true,
37220
37221
  license: "MIT",
37221
37222
  type: "module",
@@ -40147,6 +40148,10 @@ async function runCommand2(cwd, command) {
40147
40148
  });
40148
40149
  });
40149
40150
  }
40151
+ async function untrackedFiles(cwd) {
40152
+ const entries = (await git(cwd, "status", "--porcelain=v1", "-z", "--untracked-files=normal")).split("\0").filter(Boolean);
40153
+ return entries.every((entry) => entry.startsWith("?? ")) ? entries.map((entry) => entry.slice(3)) : null;
40154
+ }
40150
40155
  async function runBuild(options2) {
40151
40156
  const cwd = resolve8(options2.cwd);
40152
40157
  const directory = resolve8(cwd, ".plume");
@@ -40176,23 +40181,24 @@ async function runBuild(options2) {
40176
40181
  const binding = await readLock(cwd);
40177
40182
  await validateSchema(cwd, options2.schemaPath ?? "plume.schema.ts", binding);
40178
40183
  const commitSha = await git(cwd, "rev-parse", "HEAD");
40179
- if (await git(cwd, "status", "--porcelain=v1", "--untracked-files=all"))
40184
+ if (!await untrackedFiles(cwd))
40180
40185
  throw new PlumeBuildError(
40181
40186
  "INVALID_CONFIGURATION",
40182
- "Build from a clean Git checkout so the compiled code identity names the code being built."
40187
+ "Committed files must be unchanged. Commit or undo your changes, then build again."
40183
40188
  );
40184
40189
  if (!/^[a-f0-9]{40}$/.test(commitSha))
40185
40190
  throw new PlumeBuildError(
40186
40191
  "INVALID_CONFIGURATION",
40187
40192
  "Build from an exact Git commit."
40188
40193
  );
40189
- const mode = options2.delivery ?? "static";
40194
+ const requested = options2.delivery ?? "static";
40195
+ let mode = requested === "auto" ? "production-ssr" : requested;
40190
40196
  let operationId;
40191
- if (mode === "selected-preview") {
40192
- const message = await git(cwd, "show", "-s", "--format=%B", "HEAD");
40193
- const trailers = /^Prepare Plume publication\n\nPlume-Publication: ([a-f0-9-]{36})\nPlume-Content: ([a-f0-9-]{36})\nPlume-Schema: (sha256:[a-f0-9]{64})$/.exec(
40194
- message
40195
- );
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";
40196
40202
  const candidate = previewCandidateSchema.safeParse({
40197
40203
  operationId: trailers?.[1],
40198
40204
  commitSha
@@ -40237,11 +40243,17 @@ async function runBuild(options2) {
40237
40243
  mode: 420
40238
40244
  });
40239
40245
  await rename3(temporary, bindingFile);
40240
- if (await git(cwd, "rev-parse", "HEAD") !== commitSha || await git(cwd, "status", "--porcelain=v1", "--untracked-files=all"))
40246
+ const untracked = await untrackedFiles(cwd);
40247
+ if (await git(cwd, "rev-parse", "HEAD") !== commitSha || !untracked)
40241
40248
  throw new PlumeBuildError(
40242
40249
  "INVALID_CONFIGURATION",
40243
40250
  "The checkout changed while validating the build."
40244
40251
  );
40252
+ if (untracked.length)
40253
+ process.stderr.write(
40254
+ `Building commit ${commitSha.slice(0, 7)} with new files not in Git: ${untracked.join(", ")}
40255
+ `
40256
+ );
40245
40257
  return { exitCode: await runCommand2(cwd, options2.command), binding };
40246
40258
  } catch (error62) {
40247
40259
  await rm5(bindingFile, { force: true }).catch(() => {
@@ -40349,13 +40361,15 @@ ${developerHelp}
40349
40361
  if (!flag || !value || !["--delivery", "--environment"].includes(flag) || buildFlags.has(flag))
40350
40362
  throw new PlumeBuildError(
40351
40363
  "INVALID_CONFIGURATION",
40352
- "Usage: plume build [--delivery production-ssr|selected-preview|static] [--environment production|preview] -- <command ...>"
40364
+ "Usage: plume build [--delivery auto|production-ssr|selected-preview|static] [--environment production|preview] -- <command ...>"
40353
40365
  );
40354
40366
  buildFlags.set(flag, value);
40355
40367
  }
40356
40368
  const mode = buildFlags.get("--delivery") ?? "static";
40357
40369
  const environment = buildFlags.get("--environment");
40358
- if (!["production-ssr", "selected-preview", "static"].includes(mode) || environment && !["production", "preview"].includes(environment))
40370
+ if (!["auto", "production-ssr", "selected-preview", "static"].includes(
40371
+ mode
40372
+ ) || environment && !["production", "preview"].includes(environment))
40359
40373
  throw new PlumeBuildError(
40360
40374
  "INVALID_CONFIGURATION",
40361
40375
  "Choose a supported delivery mode and environment."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plume-press/cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "The plume command: set up a website's Plume CMS and check its builds.",
5
5
  "homepage": "https://app.plume.press",
6
6
  "license": "MIT",