@plume-press/cli 0.8.4 → 0.10.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 +205 -246
- package/dist/local.mjs +1 -1
- 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.10.0
|
|
7
7
|
npx plume init --check
|
|
8
8
|
npx plume --help
|
|
9
9
|
```
|
|
@@ -23,13 +23,13 @@ Import defineSchema from @plume-press/cli/schema, then run npx plume local schem
|
|
|
23
23
|
|
|
24
24
|
## Connect and integrate pages
|
|
25
25
|
|
|
26
|
-
npx plume connect opens browser approval for a Site Admin
|
|
26
|
+
npx plume connect opens browser approval for a Site Admin, then offers to send local content. npx plume push sends the checkout's local content to its Site as one new Update named Local content, to review and publish in Plume. It needs the matching plume.schema.ts on the Site's publication branch, sends at most 100 Items/1 MiB of content JSON and refuses Media.
|
|
27
27
|
|
|
28
28
|
A successful connection saves nonsecret Site/editor URL facts in Git-ignored .plume/site.json and creates the integration Skill only if absent. Ask your repository agent to use that guide to wire actual Next.js/Astro pages into existing components and verify them. It distinguishes private session preview, fixed prepared/static bindings and explicitly selected public SSR latest once per request. It does not scaffold arbitrary frameworks, configure deploy hooks, publish changes or certify the website.
|
|
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 production SSR,
|
|
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
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
|
|
package/dist/cli.mjs
CHANGED
|
@@ -2071,8 +2071,8 @@ var init_doc = __esm({
|
|
|
2071
2071
|
arg(this, { execution: "async" });
|
|
2072
2072
|
return;
|
|
2073
2073
|
}
|
|
2074
|
-
const
|
|
2075
|
-
const lines =
|
|
2074
|
+
const content = arg;
|
|
2075
|
+
const lines = content.split("\n").filter((x) => x);
|
|
2076
2076
|
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
2077
2077
|
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
2078
2078
|
for (const line of dedented) {
|
|
@@ -2081,9 +2081,9 @@ var init_doc = __esm({
|
|
|
2081
2081
|
}
|
|
2082
2082
|
compile() {
|
|
2083
2083
|
const F = Function;
|
|
2084
|
-
const
|
|
2084
|
+
const content = this?.content ?? [``];
|
|
2085
2085
|
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
|
|
2086
|
-
${
|
|
2086
|
+
${content.join("\n")}
|
|
2087
2087
|
};`);
|
|
2088
2088
|
return factory(...Object.values(this.closed));
|
|
2089
2089
|
}
|
|
@@ -22256,14 +22256,14 @@ function element(state, node2) {
|
|
|
22256
22256
|
const pos = reference.sourceCodeLocation;
|
|
22257
22257
|
const startTag = pos && pos.startTag && position(pos.startTag);
|
|
22258
22258
|
const endTag = pos && pos.endTag && position(pos.endTag);
|
|
22259
|
-
const
|
|
22259
|
+
const content = (
|
|
22260
22260
|
/** @type {Root} */
|
|
22261
22261
|
one(state, reference.content)
|
|
22262
22262
|
);
|
|
22263
22263
|
if (startTag && endTag && state.file) {
|
|
22264
|
-
|
|
22264
|
+
content.position = { start: startTag.end, end: endTag.start };
|
|
22265
22265
|
}
|
|
22266
|
-
result.content =
|
|
22266
|
+
result.content = content;
|
|
22267
22267
|
}
|
|
22268
22268
|
state.schema = schema3;
|
|
22269
22269
|
return result;
|
|
@@ -29414,12 +29414,12 @@ var init_parser = __esm({
|
|
|
29414
29414
|
/** @protected */
|
|
29415
29415
|
_insertTemplate(token) {
|
|
29416
29416
|
const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
|
|
29417
|
-
const
|
|
29418
|
-
this.treeAdapter.setTemplateContent(tmpl,
|
|
29417
|
+
const content = this.treeAdapter.createDocumentFragment();
|
|
29418
|
+
this.treeAdapter.setTemplateContent(tmpl, content);
|
|
29419
29419
|
this._attachElementToTree(tmpl, token.location);
|
|
29420
29420
|
this.openElements.push(tmpl, token.tagID);
|
|
29421
29421
|
if (this.options.sourceCodeLocationInfo)
|
|
29422
|
-
this.treeAdapter.setNodeSourceCodeLocation(
|
|
29422
|
+
this.treeAdapter.setNodeSourceCodeLocation(content, null);
|
|
29423
29423
|
}
|
|
29424
29424
|
/** @protected */
|
|
29425
29425
|
_insertFakeRootElement() {
|
|
@@ -32050,7 +32050,7 @@ function doctype(state, unsafe) {
|
|
|
32050
32050
|
function element2(state, unsafe) {
|
|
32051
32051
|
const name3 = typeof unsafe.tagName === "string" ? unsafe.tagName : "";
|
|
32052
32052
|
state.stack.push(name3);
|
|
32053
|
-
const
|
|
32053
|
+
const content = (
|
|
32054
32054
|
/** @type {Array<ElementContent>} */
|
|
32055
32055
|
children(state, unsafe.children)
|
|
32056
32056
|
);
|
|
@@ -32071,23 +32071,23 @@ function element2(state, unsafe) {
|
|
|
32071
32071
|
}
|
|
32072
32072
|
}
|
|
32073
32073
|
if (!safeElement) {
|
|
32074
|
-
return state.schema.strip && !state.schema.strip.includes(name3) ?
|
|
32074
|
+
return state.schema.strip && !state.schema.strip.includes(name3) ? content : void 0;
|
|
32075
32075
|
}
|
|
32076
32076
|
const node2 = {
|
|
32077
32077
|
type: "element",
|
|
32078
32078
|
tagName: name3,
|
|
32079
32079
|
properties: properties_,
|
|
32080
|
-
children:
|
|
32080
|
+
children: content
|
|
32081
32081
|
};
|
|
32082
32082
|
patch2(node2, unsafe);
|
|
32083
32083
|
return node2;
|
|
32084
32084
|
}
|
|
32085
32085
|
function root(state, unsafe) {
|
|
32086
|
-
const
|
|
32086
|
+
const content = (
|
|
32087
32087
|
/** @type {Array<RootContent>} */
|
|
32088
32088
|
children(state, unsafe.children)
|
|
32089
32089
|
);
|
|
32090
|
-
const node2 = { type: "root", children:
|
|
32090
|
+
const node2 = { type: "root", children: content };
|
|
32091
32091
|
patch2(node2, unsafe);
|
|
32092
32092
|
return node2;
|
|
32093
32093
|
}
|
|
@@ -33163,11 +33163,11 @@ function element3(node2, index2, parent, state) {
|
|
|
33163
33163
|
state.schema = svg2;
|
|
33164
33164
|
}
|
|
33165
33165
|
const attributes = serializeAttributes(state, node2.properties);
|
|
33166
|
-
const
|
|
33166
|
+
const content = state.all(
|
|
33167
33167
|
schema3.space === "html" && node2.tagName === "template" ? node2.content : node2
|
|
33168
33168
|
);
|
|
33169
33169
|
state.schema = schema3;
|
|
33170
|
-
if (
|
|
33170
|
+
if (content) selfClosing = false;
|
|
33171
33171
|
if (attributes || !omit2 || !opening(node2, index2, parent)) {
|
|
33172
33172
|
parts.push("<", node2.tagName, attributes ? " " + attributes : "");
|
|
33173
33173
|
if (selfClosing && (schema3.space === "svg" || state.settings.closeSelfClosing)) {
|
|
@@ -33179,7 +33179,7 @@ function element3(node2, index2, parent, state) {
|
|
|
33179
33179
|
}
|
|
33180
33180
|
parts.push(">");
|
|
33181
33181
|
}
|
|
33182
|
-
parts.push(
|
|
33182
|
+
parts.push(content);
|
|
33183
33183
|
if (!selfClosing && (!omit2 || !closing(node2, index2, parent))) {
|
|
33184
33184
|
parts.push("</" + node2.tagName + ">");
|
|
33185
33185
|
}
|
|
@@ -36087,9 +36087,9 @@ import { constants as constants2 } from "node:fs";
|
|
|
36087
36087
|
import { lstat as lstat2, mkdir as mkdir2, open as open2 } from "node:fs/promises";
|
|
36088
36088
|
async function inspect(path) {
|
|
36089
36089
|
try {
|
|
36090
|
-
const
|
|
36091
|
-
if (
|
|
36092
|
-
if (
|
|
36090
|
+
const stat3 = await lstat2(path);
|
|
36091
|
+
if (stat3.isFile()) return "file";
|
|
36092
|
+
if (stat3.isDirectory()) return "directory";
|
|
36093
36093
|
throw new PlumeLocalError(
|
|
36094
36094
|
"UNSAFE_PATH",
|
|
36095
36095
|
`${path} must be a regular file or directory, not a symbolic link or special file.`
|
|
@@ -36109,7 +36109,7 @@ async function ensureDirectory(path) {
|
|
|
36109
36109
|
if (await inspect(path) !== "directory")
|
|
36110
36110
|
throw new PlumeLocalError("UNSAFE_PATH", `${path} must be a directory.`);
|
|
36111
36111
|
}
|
|
36112
|
-
async function writeAbsent(path,
|
|
36112
|
+
async function writeAbsent(path, content) {
|
|
36113
36113
|
const kind = await inspect(path);
|
|
36114
36114
|
if (kind === "file") return false;
|
|
36115
36115
|
if (kind !== "missing")
|
|
@@ -36121,7 +36121,7 @@ async function writeAbsent(path, content2) {
|
|
|
36121
36121
|
420
|
|
36122
36122
|
);
|
|
36123
36123
|
try {
|
|
36124
|
-
await handle2.writeFile(
|
|
36124
|
+
await handle2.writeFile(content);
|
|
36125
36125
|
} finally {
|
|
36126
36126
|
await handle2.close();
|
|
36127
36127
|
}
|
|
@@ -36178,9 +36178,9 @@ async function writeIntegrationSkill(cwd) {
|
|
|
36178
36178
|
await ensureDirectory(resolve3(cwd, path));
|
|
36179
36179
|
return writeAbsent(resolve3(cwd, SKILL_PATH), SKILL);
|
|
36180
36180
|
}
|
|
36181
|
-
async function writeConnectedIntegration(cwd,
|
|
36182
|
-
const siteId = contentBindingSchema.shape.siteId.parse(
|
|
36183
|
-
const appUrl = developerUrl(
|
|
36181
|
+
async function writeConnectedIntegration(cwd, connection2) {
|
|
36182
|
+
const siteId = contentBindingSchema.shape.siteId.parse(connection2.siteId);
|
|
36183
|
+
const appUrl = developerUrl(connection2.endpoint, "").toString();
|
|
36184
36184
|
const editorUrl = developerUrl(appUrl, `sites/${siteId}/editor`).toString();
|
|
36185
36185
|
const skillCreated = await writeIntegrationSkill(cwd);
|
|
36186
36186
|
await ensureDirectory(resolve3(cwd, ".plume"));
|
|
@@ -36248,8 +36248,8 @@ async function readProjectFile(cwd, path, limit = 1024 * 1024) {
|
|
|
36248
36248
|
constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK
|
|
36249
36249
|
);
|
|
36250
36250
|
try {
|
|
36251
|
-
const
|
|
36252
|
-
if (!
|
|
36251
|
+
const stat3 = await handle2.stat();
|
|
36252
|
+
if (!stat3.isFile() || stat3.size > limit)
|
|
36253
36253
|
throw new PlumeLocalError(
|
|
36254
36254
|
"INVALID_PROJECT_FILE",
|
|
36255
36255
|
`${path} must be a regular file of at most ${limit} bytes.`
|
|
@@ -36327,12 +36327,12 @@ async function inspectIntegration(cwd) {
|
|
|
36327
36327
|
"INVALID_CONNECTION_FACTS",
|
|
36328
36328
|
"The saved Site facts are invalid. Reconnect from the correct repository."
|
|
36329
36329
|
);
|
|
36330
|
-
const
|
|
36331
|
-
const appUrl =
|
|
36332
|
-
if (
|
|
36330
|
+
const connection2 = parsedConnection?.success ? parsedConnection.data : null;
|
|
36331
|
+
const appUrl = connection2 ? developerUrl(connection2.appUrl, "").toString() : null;
|
|
36332
|
+
if (connection2 && (connection2.editorUrl !== developerUrl(
|
|
36333
36333
|
appUrl,
|
|
36334
|
-
`sites/${
|
|
36335
|
-
).toString() || binding?.success && binding.data.siteId !==
|
|
36334
|
+
`sites/${connection2.siteId}/editor`
|
|
36335
|
+
).toString() || binding?.success && binding.data.siteId !== connection2.siteId))
|
|
36336
36336
|
throw new PlumeLocalError(
|
|
36337
36337
|
"CONNECTION_MISMATCH",
|
|
36338
36338
|
"The saved Site facts do not match this checkout. Reconnect from the correct repository."
|
|
@@ -36380,9 +36380,9 @@ async function inspectIntegration(cwd) {
|
|
|
36380
36380
|
nextActions.push(
|
|
36381
36381
|
"Obtain the correct committed plume.lock from Plume; do not invent or repair a binding from environment overrides."
|
|
36382
36382
|
);
|
|
36383
|
-
if (!
|
|
36383
|
+
if (!connection2)
|
|
36384
36384
|
nextActions.push(
|
|
36385
|
-
"Successful plume connect saves the verified Site/editor URL. Browser approval and
|
|
36385
|
+
"Successful plume connect saves the verified Site/editor URL. Browser approval and sending local content remain explicit."
|
|
36386
36386
|
);
|
|
36387
36387
|
if (!skillPresent)
|
|
36388
36388
|
nextActions.push(
|
|
@@ -36398,12 +36398,12 @@ async function inspectIntegration(cwd) {
|
|
|
36398
36398
|
environmentNames: [...environment].sort(),
|
|
36399
36399
|
schema: schemaPresent ? "present-not-evaluated" : "missing",
|
|
36400
36400
|
binding: binding === null ? "missing" : binding.success ? { ...binding.data, validation: "parsed-not-remotely-verified" } : "invalid",
|
|
36401
|
-
connection:
|
|
36402
|
-
...
|
|
36401
|
+
connection: connection2 && appUrl ? {
|
|
36402
|
+
...connection2,
|
|
36403
36403
|
appUrl,
|
|
36404
36404
|
editorUrl: developerUrl(
|
|
36405
36405
|
appUrl,
|
|
36406
|
-
`sites/${
|
|
36406
|
+
`sites/${connection2.siteId}/editor`
|
|
36407
36407
|
).toString()
|
|
36408
36408
|
} : null,
|
|
36409
36409
|
integrationSkill: skillPresent ? "present-preserved" : "missing",
|
|
@@ -36448,7 +36448,7 @@ description: Integrate this website's real Next.js or Astro pages with Plume con
|
|
|
36448
36448
|
|
|
36449
36449
|
# Integrate this website with Plume
|
|
36450
36450
|
|
|
36451
|
-
Complete the user's integration request in this repository using its existing design, components, content and package manager. Inspect AGENTS.md and relevant repository Skills. This guide authorizes no work beyond that request or the current environment's permissions. Carry out ordinary authorized edits and checks; browser sign-in, content
|
|
36451
|
+
Complete the user's integration request in this repository using its existing design, components, content and package manager. Inspect AGENTS.md and relevant repository Skills. This guide authorizes no work beyond that request or the current environment's permissions. Carry out ordinary authorized edits and checks; browser sign-in, sending local content and publication retain their existing controls.
|
|
36452
36452
|
|
|
36453
36453
|
## Inspect before editing
|
|
36454
36454
|
|
|
@@ -36464,9 +36464,9 @@ Model real repeated content as Collections and real one-off content as Singleton
|
|
|
36464
36464
|
|
|
36465
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.
|
|
36466
36466
|
|
|
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.
|
|
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. plume push sends local records to the Site as one new Update named Local content, which an Admin reviews and publishes in Plume; the publication branch first needs the matching plume.schema.ts. plume connect performs browser approval and offers the same push; its setup credential is not ongoing developer access. A push sends at most 100 records/1 MiB and refuses media.
|
|
36468
36468
|
|
|
36469
|
-
Use only implemented commands in npx plume --help. There is no plume
|
|
36469
|
+
Use only implemented commands in npx plume --help. There is no plume doctor, automatic deploy-hook configuration or universal website-check command. Never claim a local change is published or deployed.
|
|
36470
36470
|
|
|
36471
36471
|
## One server-only reader, explicit content modes
|
|
36472
36472
|
|
|
@@ -36477,7 +36477,7 @@ Choose the mode explicitly in application/server configuration:
|
|
|
36477
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.
|
|
36478
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
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> builds as production-ssr, so the
|
|
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.
|
|
36481
36481
|
|
|
36482
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.
|
|
36483
36483
|
|
|
@@ -36763,7 +36763,7 @@ async function open4(path, expected) {
|
|
|
36763
36763
|
).get();
|
|
36764
36764
|
if (size.count > MAX_BASELINE_RECORDS || size.bytes + Buffer.byteLength(current.schema) > MAX_BASELINE_JSON_BYTES)
|
|
36765
36765
|
throw new Error(
|
|
36766
|
-
"
|
|
36766
|
+
"Local content to send is limited to 100 records and 1 MiB of JSON."
|
|
36767
36767
|
);
|
|
36768
36768
|
return {
|
|
36769
36769
|
revision: current.revision,
|
|
@@ -36974,7 +36974,7 @@ var init_package = __esm({
|
|
|
36974
36974
|
"packages/sdk/package.json"() {
|
|
36975
36975
|
package_default = {
|
|
36976
36976
|
name: "@plume-press/sdk",
|
|
36977
|
-
version: "0.
|
|
36977
|
+
version: "0.5.0",
|
|
36978
36978
|
private: true,
|
|
36979
36979
|
license: "MIT",
|
|
36980
36980
|
type: "module",
|
|
@@ -37001,7 +37001,7 @@ var init_package2 = __esm({
|
|
|
37001
37001
|
"packages/cli/package.json"() {
|
|
37002
37002
|
package_default2 = {
|
|
37003
37003
|
name: "@plume-press/cli",
|
|
37004
|
-
version: "0.
|
|
37004
|
+
version: "0.10.0",
|
|
37005
37005
|
private: true,
|
|
37006
37006
|
license: "MIT",
|
|
37007
37007
|
type: "module",
|
|
@@ -37371,7 +37371,7 @@ init_src();
|
|
|
37371
37371
|
init_protocol();
|
|
37372
37372
|
init_zod();
|
|
37373
37373
|
import { spawn } from "node:child_process";
|
|
37374
|
-
import { randomUUID as
|
|
37374
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
37375
37375
|
import { lstat as lstat5, mkdir as mkdir4, open as open7, rename as rename3, rm as rm5, writeFile as writeFile3 } from "node:fs/promises";
|
|
37376
37376
|
import { constants as constants5 } from "node:os";
|
|
37377
37377
|
import { resolve as resolve8 } from "node:path";
|
|
@@ -38516,12 +38516,11 @@ ${exit === exitCodes.usage ? `See plume ${name3} --help.
|
|
|
38516
38516
|
|
|
38517
38517
|
// packages/cli/src/connect.ts
|
|
38518
38518
|
init_src();
|
|
38519
|
-
init_protocol();
|
|
38520
38519
|
init_zod();
|
|
38521
38520
|
import { execFile as execFile2 } from "node:child_process";
|
|
38522
|
-
import { createHash as createHash3
|
|
38523
|
-
import { realpath } from "node:fs/promises";
|
|
38524
|
-
import { resolve as resolve5 } from "node:path";
|
|
38521
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
38522
|
+
import { realpath, stat as stat2 } from "node:fs/promises";
|
|
38523
|
+
import { join as join2, resolve as resolve5 } from "node:path";
|
|
38525
38524
|
import { createInterface } from "node:readline/promises";
|
|
38526
38525
|
import { promisify as promisify2 } from "node:util";
|
|
38527
38526
|
|
|
@@ -38654,25 +38653,12 @@ var printable2 = (value) => Array.from(value, (character) => {
|
|
|
38654
38653
|
const code = character.charCodeAt(0);
|
|
38655
38654
|
return code < 32 || code >= 127 && code < 160 ? " " : character;
|
|
38656
38655
|
}).join("");
|
|
38657
|
-
var pendingShape = external_exports.object({
|
|
38658
|
-
recordCount: external_exports.number().int().nonnegative(),
|
|
38659
|
-
createdAt: external_exports.number().int()
|
|
38660
|
-
});
|
|
38661
|
-
var completedShape = external_exports.object({
|
|
38662
|
-
recordCount: external_exports.number().int().nonnegative(),
|
|
38663
|
-
headSha: external_exports.string().regex(/^[a-f0-9]{40}$/)
|
|
38664
|
-
});
|
|
38665
|
-
var statusShape2 = external_exports.object({
|
|
38666
|
-
pending: pendingShape.nullable(),
|
|
38667
|
-
completed: completedShape.nullable()
|
|
38668
|
-
});
|
|
38669
38656
|
var failureShape = external_exports.object({
|
|
38670
|
-
error: external_exports.object({ code: external_exports.string(),
|
|
38657
|
+
error: external_exports.object({ code: external_exports.string(), message: external_exports.string().optional() })
|
|
38671
38658
|
});
|
|
38672
|
-
var
|
|
38673
|
-
|
|
38674
|
-
|
|
38675
|
-
recordCount: external_exports.number().int().nonnegative()
|
|
38659
|
+
var sentShape = external_exports.strictObject({
|
|
38660
|
+
updateId: external_exports.uuidv7(),
|
|
38661
|
+
itemCount: external_exports.number().int().positive()
|
|
38676
38662
|
});
|
|
38677
38663
|
async function checkout(cwd) {
|
|
38678
38664
|
const root3 = await git(cwd, "rev-parse", "--show-toplevel");
|
|
@@ -38713,7 +38699,20 @@ async function checkout(cwd) {
|
|
|
38713
38699
|
schemaHash: await schemaHash(schema3)
|
|
38714
38700
|
};
|
|
38715
38701
|
}
|
|
38716
|
-
async function
|
|
38702
|
+
async function hasLocalDatabase(cwd) {
|
|
38703
|
+
try {
|
|
38704
|
+
await stat2(join2(cwd, ".plume/local.sqlite"));
|
|
38705
|
+
return true;
|
|
38706
|
+
} catch (error62) {
|
|
38707
|
+
if (error62.code === "ENOENT") return false;
|
|
38708
|
+
throw new PlumeToolError(
|
|
38709
|
+
"LOCAL_STORE",
|
|
38710
|
+
`Could not read local content: ${error62 instanceof Error ? error62.message : String(error62)}`
|
|
38711
|
+
);
|
|
38712
|
+
}
|
|
38713
|
+
}
|
|
38714
|
+
async function localContent(cwd, schema3) {
|
|
38715
|
+
if (!await hasLocalDatabase(cwd)) return null;
|
|
38717
38716
|
try {
|
|
38718
38717
|
const { openLocalStore: openLocalStore2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
38719
38718
|
const store = await openLocalStore2({ cwd, schema: schema3 });
|
|
@@ -38724,15 +38723,15 @@ async function content(cwd, schema3) {
|
|
|
38724
38723
|
}
|
|
38725
38724
|
} catch (error62) {
|
|
38726
38725
|
const message = error62 instanceof Error ? error62.message : String(error62);
|
|
38727
|
-
if (error62 instanceof BaselineValidationError && error62.code === "LIMIT_EXCEEDED" || message.startsWith("
|
|
38726
|
+
if (error62 instanceof BaselineValidationError && error62.code === "LIMIT_EXCEEDED" || message.startsWith("Local content to send is limited"))
|
|
38728
38727
|
throw new PlumeToolError(
|
|
38729
38728
|
"CONTENT_TOO_LARGE",
|
|
38730
|
-
|
|
38729
|
+
"plume push sends at most 100 Items and 1 MiB of content. Nothing was sent."
|
|
38731
38730
|
);
|
|
38732
38731
|
if (error62 instanceof BaselineValidationError)
|
|
38733
38732
|
throw new PlumeToolError(
|
|
38734
38733
|
"INVALID_CONTENT",
|
|
38735
|
-
`Local content cannot be
|
|
38734
|
+
`Local content cannot be sent. Fix these Items, then run plume push again. Nothing was sent.
|
|
38736
38735
|
${error62.issues.slice(0, 5).map((issue2) => `${issue2.path || "content"}: ${issue2.message}`).join("\n")}`
|
|
38737
38736
|
);
|
|
38738
38737
|
throw new PlumeToolError(
|
|
@@ -38742,27 +38741,14 @@ ${error62.issues.slice(0, 5).map((issue2) => `${issue2.path || "content"}: ${iss
|
|
|
38742
38741
|
}
|
|
38743
38742
|
}
|
|
38744
38743
|
var remoteHelp = (branch) => ({
|
|
38745
|
-
|
|
38746
|
-
|
|
38747
|
-
|
|
38748
|
-
|
|
38749
|
-
|
|
38750
|
-
|
|
38751
|
-
|
|
38752
|
-
|
|
38753
|
-
SCHEMA_UNSUPPORTED: `Plume cannot read plume.schema.ts on branch ${branch}. The committed plume.schema.ts must be an inline \`export const schema = defineSchema({...})\` declaration with no imports besides defineSchema and no computed values. Push that form to ${branch}, then run plume connect again.`,
|
|
38754
|
-
SCHEMA_MISMATCH: `plume.schema.ts on branch ${branch} does not match this checkout's committed schema, or the schema of the pending transfer. Push the matching plume.schema.ts to ${branch}, then run plume connect again.`,
|
|
38755
|
-
CMS_NOT_READY: `Branch ${branch} has no plume.lock for this Site and schema yet. Publish an Update in Plume that adds this plume.schema.ts, then run plume connect again.`,
|
|
38756
|
-
TRANSFER_PENDING: "Plume is holding a pending transfer for this Site. Run plume connect again to resume it.",
|
|
38757
|
-
NO_PENDING_TRANSFER: "Plume has no pending transfer for this Site any more. Run plume connect again to check its current state.",
|
|
38758
|
-
UPDATE_OPEN: "An Update is open on this Site. Publish or discard the open Update in Plume, then run plume connect again.",
|
|
38759
|
-
ALREADY_TRANSFERRED: "This Site already has hosted content or a completed initial transfer, so local content can no longer be transferred. Edit content in Plume, or run plume connect again and choose schema only.",
|
|
38760
|
-
TRANSFER_CHANGED: `Branch ${branch} no longer holds the plume.lock and plume.schema.ts the pending transfer started from. Restore them on ${branch}, then run plume connect again to resume. Hosted editing waits until then.`,
|
|
38761
|
-
TRANSFER_INTERRUPTED: "Plume could not finish the transfer and kept it pending. Run plume connect again to resume it.",
|
|
38762
|
-
GITHUB_ACCESS: `Plume cannot use the connected GitHub repository (suspended or missing App installation, missing permissions, or a renamed/deleted repository). Repair the GitHub connection in this Site's setup in Plume, then run plume connect again.`,
|
|
38763
|
-
SITE_BUSY: "Someone is editing an Update on this Site in Plume. Wait for their session to end, then run plume connect again."
|
|
38764
|
-
});
|
|
38765
|
-
async function runConnect(options2) {
|
|
38744
|
+
UNAUTHORIZED: "Plume no longer accepts this connection: the sign-in expired or was revoked, or you are no longer an Admin of this Site. Run plume push again to sign in.",
|
|
38745
|
+
REPOSITORY_MISMATCH: "This Site is connected to a different GitHub repository than this checkout's origin. Run plume push from the Site's connected repository. Nothing was sent.",
|
|
38746
|
+
SCHEMA_UNSUPPORTED: `Plume cannot read plume.schema.ts on branch ${branch}. The committed plume.schema.ts must be an inline \`export const schema = defineSchema({...})\` declaration with no imports besides defineSchema and no computed values. Push that form to ${branch}, then run plume push again. Nothing was sent.`,
|
|
38747
|
+
SCHEMA_MISMATCH: `plume.schema.ts on branch ${branch} does not match this checkout's committed schema. Push the matching plume.schema.ts to ${branch}, then run plume push again. Nothing was sent.`,
|
|
38748
|
+
GITHUB_ACCESS: "Plume cannot read the connected GitHub repository. Check the GitHub connection in this Site's settings in Plume, then run plume push again. Nothing was sent.",
|
|
38749
|
+
BODY_TOO_LARGE: "plume push sends at most 100 Items and 1 MiB of content. Nothing was sent."
|
|
38750
|
+
});
|
|
38751
|
+
async function connection(options2) {
|
|
38766
38752
|
const cwd = await realpath(resolve5(options2.cwd));
|
|
38767
38753
|
const endpoint = developerUrl(options2.endpoint ?? defaultEndpoint, "").toString().replace(/\/$/, "");
|
|
38768
38754
|
const initial = await checkout(cwd);
|
|
@@ -38772,158 +38758,126 @@ async function runConnect(options2) {
|
|
|
38772
38758
|
present: options2.present,
|
|
38773
38759
|
...options2.fetch ? { fetch: options2.fetch } : {}
|
|
38774
38760
|
});
|
|
38775
|
-
|
|
38776
|
-
|
|
38777
|
-
|
|
38778
|
-
|
|
38779
|
-
|
|
38780
|
-
|
|
38781
|
-
|
|
38782
|
-
|
|
38783
|
-
|
|
38784
|
-
|
|
38785
|
-
|
|
38761
|
+
return { cwd, endpoint, initial, authorization };
|
|
38762
|
+
}
|
|
38763
|
+
async function push(options2, {
|
|
38764
|
+
cwd,
|
|
38765
|
+
endpoint,
|
|
38766
|
+
initial,
|
|
38767
|
+
authorization
|
|
38768
|
+
}, snapshot) {
|
|
38769
|
+
const current = await checkout(cwd);
|
|
38770
|
+
if (sha2562(current.repository) !== sha2562(initial.repository) || current.schemaHash !== initial.schemaHash)
|
|
38771
|
+
throw new PlumeToolError(
|
|
38772
|
+
"SOURCE_CHANGED",
|
|
38773
|
+
"The repository or schema changed meanwhile. Nothing was sent; run plume push again."
|
|
38774
|
+
);
|
|
38775
|
+
let response;
|
|
38776
|
+
try {
|
|
38777
|
+
response = await (options2.fetch ?? fetch)(
|
|
38778
|
+
developerUrl(endpoint, "api/developer/push"),
|
|
38779
|
+
{
|
|
38780
|
+
method: "POST",
|
|
38786
38781
|
headers: {
|
|
38787
|
-
|
|
38782
|
+
"content-type": "application/json",
|
|
38788
38783
|
authorization: `Bearer ${authorization.token}`
|
|
38789
38784
|
},
|
|
38790
|
-
|
|
38785
|
+
body: JSON.stringify({
|
|
38786
|
+
siteId: authorization.site.id,
|
|
38787
|
+
repository: initial.repository,
|
|
38788
|
+
schema: initial.schema,
|
|
38789
|
+
records: snapshot.records
|
|
38790
|
+
}),
|
|
38791
38791
|
redirect: "error",
|
|
38792
38792
|
credentials: "omit",
|
|
38793
|
-
signal: AbortSignal.timeout(
|
|
38794
|
-
}
|
|
38795
|
-
} catch {
|
|
38796
|
-
throw new PlumeToolError(
|
|
38797
|
-
"CONNECTION_LOST",
|
|
38798
|
-
transfer2 ? "The connection to Plume was lost before a response arrived. Run plume connect again: it shows whether Plume holds a pending transfer and lets you resume it." : "Could not check this Site's transfer status. Check your connection and run plume connect again. Nothing was transferred."
|
|
38799
|
-
);
|
|
38800
|
-
}
|
|
38801
|
-
const body3 = await boundedJson(response, 16 * 1024).catch(() => null);
|
|
38802
|
-
return { ok: response.ok, body: body3 };
|
|
38803
|
-
}
|
|
38804
|
-
function fail2(body3) {
|
|
38805
|
-
const code = failureShape.safeParse(body3).data?.error.code ?? "";
|
|
38806
|
-
throw Object.hasOwn(help, code) ? new PlumeToolError(code, help[code]) : new PlumeToolError(
|
|
38807
|
-
"TRANSFER_REJECTED",
|
|
38808
|
-
"Plume rejected the request. Check this Site's setup in Plume, then run plume connect again."
|
|
38793
|
+
signal: AbortSignal.timeout(6e4)
|
|
38794
|
+
}
|
|
38809
38795
|
);
|
|
38810
|
-
}
|
|
38811
|
-
|
|
38812
|
-
|
|
38813
|
-
|
|
38814
|
-
throw new PlumeToolError(
|
|
38815
|
-
"SOURCE_CHANGED",
|
|
38816
|
-
"The repository or schema changed during confirmation. Nothing was transferred; run plume connect again."
|
|
38817
|
-
);
|
|
38818
|
-
}
|
|
38819
|
-
const transfer = (mode2, records = []) => ({
|
|
38820
|
-
requestId: randomUUID2(),
|
|
38821
|
-
siteId: authorization.site.id,
|
|
38822
|
-
repository: initial.repository,
|
|
38823
|
-
schema: initial.schema,
|
|
38824
|
-
mode: mode2,
|
|
38825
|
-
records
|
|
38826
|
-
});
|
|
38827
|
-
async function resume(pending) {
|
|
38828
|
-
options2.write(
|
|
38829
|
-
`Plume is holding a pending transfer for this site.
|
|
38830
|
-
Site: ${printable2(authorization.site.name)}
|
|
38831
|
-
Repository: ${initial.repository.owner}/${initial.repository.name}
|
|
38832
|
-
Pending content: ${pending.recordCount} records, started ${new Date(pending.createdAt).toLocaleString()}
|
|
38833
|
-
Your current local content is not used; Plume will commit plume.lock with the pending records to branch ${branch}.
|
|
38834
|
-
`
|
|
38796
|
+
} catch (error62) {
|
|
38797
|
+
throw new PlumeToolError(
|
|
38798
|
+
"CONNECTION_LOST",
|
|
38799
|
+
`The connection to Plume was lost (${error62 instanceof Error ? error62.name : "error"}). Check this Site's Updates in Plume before running plume push again.`
|
|
38835
38800
|
);
|
|
38836
|
-
if (!await confirm("Resume it? [y/N] ")) {
|
|
38837
|
-
options2.write(
|
|
38838
|
-
"Cancelled. The transfer stays pending on Plume, and hosted editing waits until it is resumed. Run plume connect again to resume it.\n"
|
|
38839
|
-
);
|
|
38840
|
-
return { cancelled: true };
|
|
38841
|
-
}
|
|
38842
|
-
await unchanged();
|
|
38843
|
-
return send(transfer("resume"));
|
|
38844
38801
|
}
|
|
38845
|
-
|
|
38846
|
-
|
|
38847
|
-
|
|
38848
|
-
|
|
38849
|
-
|
|
38850
|
-
|
|
38851
|
-
|
|
38852
|
-
|
|
38853
|
-
|
|
38854
|
-
|
|
38855
|
-
|
|
38856
|
-
|
|
38857
|
-
"Plume returned an unexpected response. Run plume connect again to check the transfer status."
|
|
38858
|
-
);
|
|
38859
|
-
options2.write(
|
|
38860
|
-
body3.mode === "schema" ? "Connected. The existing binding was verified.\n" : `Connected. Plume committed plume.lock to ${branch}.
|
|
38861
|
-
Run git pull --ff-only origin '${branch.replaceAll("'", "'\\''")}' (on that branch) to receive it.
|
|
38862
|
-
`
|
|
38802
|
+
const body3 = await boundedJson(response, 16 * 1024).catch(() => null);
|
|
38803
|
+
if (!response.ok) {
|
|
38804
|
+
const error62 = failureShape.safeParse(body3).data?.error;
|
|
38805
|
+
const help = remoteHelp(
|
|
38806
|
+
printable2(authorization.repository.integrationBranch)
|
|
38807
|
+
);
|
|
38808
|
+
const code = error62?.code ?? "";
|
|
38809
|
+
if (Object.hasOwn(help, code))
|
|
38810
|
+
throw new PlumeToolError(code, help[code]);
|
|
38811
|
+
throw new PlumeToolError(
|
|
38812
|
+
"PUSH_REJECTED",
|
|
38813
|
+
code === "INVALID_CONTENT" || code === "CONFLICT" ? `Plume refused the content: ${printable2(error62?.message ?? "").slice(0, 1024)} Nothing was sent.` : "Plume rejected the request. Check this Site's setup in Plume, then run plume push again."
|
|
38863
38814
|
);
|
|
38864
|
-
try {
|
|
38865
|
-
const integration = await writeConnectedIntegration(cwd, {
|
|
38866
|
-
siteId: receipt.data.binding.siteId,
|
|
38867
|
-
endpoint
|
|
38868
|
-
});
|
|
38869
|
-
options2.write(
|
|
38870
|
-
`Editor: ${integration.editorUrl}
|
|
38871
|
-
Repository guide: .agents/skills/plume-integration/SKILL.md (${integration.skillCreated ? "created" : "preserved"}). Nonsecret Site facts: .plume/site.json.
|
|
38872
|
-
`
|
|
38873
|
-
);
|
|
38874
|
-
} catch {
|
|
38875
|
-
options2.write(
|
|
38876
|
-
"Connected, but the repository guide and Site facts could not be saved. Check that .agents and .plume are regular writable directories, then reconnect with schema only to save the guide.\n"
|
|
38877
|
-
);
|
|
38878
|
-
}
|
|
38879
|
-
return { cancelled: false, headSha: receipt.data.headSha };
|
|
38880
38815
|
}
|
|
38881
|
-
const
|
|
38882
|
-
if (!
|
|
38883
|
-
const parsed = statusShape2.safeParse(status2.body);
|
|
38884
|
-
if (!parsed.success)
|
|
38816
|
+
const sent = sentShape.safeParse(body3);
|
|
38817
|
+
if (!sent.success || sent.data.itemCount !== snapshot.records.length)
|
|
38885
38818
|
throw new PlumeToolError(
|
|
38886
38819
|
"INVALID_RESPONSE",
|
|
38887
|
-
"Plume returned an unexpected
|
|
38820
|
+
"Plume returned an unexpected response. Check this Site's Updates in Plume before running plume push again."
|
|
38888
38821
|
);
|
|
38889
|
-
|
|
38890
|
-
|
|
38822
|
+
options2.write(
|
|
38823
|
+
`Sent ${sent.data.itemCount} ${sent.data.itemCount === 1 ? "Item" : "Items"} to Plume as the Update \u201CLocal content\u201D. Review and publish it:
|
|
38824
|
+
${developerUrl(endpoint, `sites/${authorization.site.id}/editor`)}?update=${sent.data.updateId}
|
|
38825
|
+
`
|
|
38826
|
+
);
|
|
38827
|
+
return sent.data;
|
|
38828
|
+
}
|
|
38829
|
+
async function runConnect(options2) {
|
|
38830
|
+
const connected = await connection(options2);
|
|
38831
|
+
const { cwd, endpoint, initial, authorization } = connected;
|
|
38832
|
+
const site2 = printable2(authorization.site.name);
|
|
38833
|
+
try {
|
|
38834
|
+
const integration = await writeConnectedIntegration(cwd, {
|
|
38835
|
+
siteId: authorization.site.id,
|
|
38836
|
+
endpoint
|
|
38837
|
+
});
|
|
38891
38838
|
options2.write(
|
|
38892
|
-
`
|
|
38839
|
+
`Connected to ${site2}.
|
|
38840
|
+
Editor: ${integration.editorUrl}
|
|
38841
|
+
Repository guide: .agents/skills/plume-integration/SKILL.md (${integration.skillCreated ? "created" : "preserved"}). Nonsecret Site facts: .plume/site.json.
|
|
38893
38842
|
`
|
|
38894
38843
|
);
|
|
38895
|
-
|
|
38896
|
-
|
|
38897
|
-
|
|
38898
|
-
if (answer !== "1" && answer !== "2") {
|
|
38899
|
-
options2.write("Cancelled. Nothing was transferred.\n");
|
|
38900
|
-
return { cancelled: true };
|
|
38901
|
-
}
|
|
38902
|
-
const snapshot = answer === "2" ? await content(cwd, initial.schema) : null;
|
|
38903
|
-
const mode = snapshot?.records.length ? "content" : "schema";
|
|
38904
|
-
if (snapshot && mode === "schema")
|
|
38905
|
-
options2.write("No local records found; connecting schema only.\n");
|
|
38906
|
-
options2.write(
|
|
38907
|
-
`Transfer summary
|
|
38908
|
-
Site: ${printable2(authorization.site.name)}
|
|
38909
|
-
Repository: ${initial.repository.owner}/${initial.repository.name}
|
|
38910
|
-
Schema: ${initial.schema.collections.length} collections
|
|
38911
|
-
${mode === "content" ? `Local content: ${snapshot?.records.length} records
|
|
38912
|
-
Plume will commit plume.lock to branch ${branch}.` : `Schema only: existing hosted content is preserved.
|
|
38913
|
-
Plume will verify the existing plume.lock on branch ${branch}; nothing new is committed.`}
|
|
38844
|
+
} catch (error62) {
|
|
38845
|
+
options2.write(
|
|
38846
|
+
`Connected to ${site2}, but the repository guide and Site facts could not be saved (${error62 instanceof Error ? error62.message : "error"}). Check that .agents and .plume are regular writable directories, then run plume connect again.
|
|
38914
38847
|
`
|
|
38915
|
-
|
|
38916
|
-
|
|
38917
|
-
|
|
38918
|
-
|
|
38848
|
+
);
|
|
38849
|
+
}
|
|
38850
|
+
try {
|
|
38851
|
+
if (!await hasLocalDatabase(cwd)) return null;
|
|
38852
|
+
const answer = await options2.ask(
|
|
38853
|
+
"Send this checkout's local content to Plume as an Update? Nothing is published until you publish it in Plume. [y/N] "
|
|
38854
|
+
);
|
|
38855
|
+
if (answer.trim().toLowerCase() !== "y") {
|
|
38856
|
+
options2.write("Nothing was sent. Run plume push to send it later.\n");
|
|
38857
|
+
return null;
|
|
38858
|
+
}
|
|
38859
|
+
const snapshot = await localContent(cwd, initial.schema);
|
|
38860
|
+
if (snapshot?.records.length)
|
|
38861
|
+
return await push(options2, connected, snapshot);
|
|
38862
|
+
options2.write("This checkout has no local Items, so nothing was sent.\n");
|
|
38863
|
+
return null;
|
|
38864
|
+
} catch (error62) {
|
|
38865
|
+
if (!(error62 instanceof PlumeToolError)) throw error62;
|
|
38866
|
+
throw new PlumeToolError(
|
|
38867
|
+
error62.code,
|
|
38868
|
+
`The connection to ${site2} succeeded, but the local content was not sent. ${error62.message}`
|
|
38869
|
+
);
|
|
38919
38870
|
}
|
|
38920
|
-
|
|
38921
|
-
|
|
38871
|
+
}
|
|
38872
|
+
async function runPush(options2) {
|
|
38873
|
+
const connected = await connection(options2);
|
|
38874
|
+
const snapshot = await localContent(connected.cwd, connected.initial.schema);
|
|
38875
|
+
if (!snapshot?.records.length)
|
|
38922
38876
|
throw new PlumeToolError(
|
|
38923
|
-
"
|
|
38924
|
-
"
|
|
38877
|
+
"NO_LOCAL_CONTENT",
|
|
38878
|
+
"This checkout has no local Items to send. Add content with plume init's local CMS first."
|
|
38925
38879
|
);
|
|
38926
|
-
return
|
|
38880
|
+
return push(options2, connected, snapshot);
|
|
38927
38881
|
}
|
|
38928
38882
|
var execFileAsync2 = promisify2(execFile2);
|
|
38929
38883
|
async function openBrowser(url2) {
|
|
@@ -38931,8 +38885,9 @@ async function openBrowser(url2) {
|
|
|
38931
38885
|
const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url2] : [url2];
|
|
38932
38886
|
await execFileAsync2(command, args, { timeout: 1e4 });
|
|
38933
38887
|
}
|
|
38934
|
-
var connectHelp = "Usage: plume connect\nApprove this repository in your browser, then
|
|
38888
|
+
var connectHelp = "Usage: plume connect\nApprove this repository in your browser to connect it to its hosted Site, then choose whether to send local content as an Update.\n\nUsage: plume push\nSend this checkout's local content to its hosted Site as an Update to review and publish in Plume. PLUME_ENDPOINT overrides the default Plume endpoint.";
|
|
38935
38889
|
async function connectMain(args, env2) {
|
|
38890
|
+
const name3 = args[0];
|
|
38936
38891
|
if (args.length === 2 && args[1] === "--help") {
|
|
38937
38892
|
process.stdout.write(`${connectHelp}
|
|
38938
38893
|
`);
|
|
@@ -38944,7 +38899,8 @@ async function connectMain(args, env2) {
|
|
|
38944
38899
|
return 1;
|
|
38945
38900
|
}
|
|
38946
38901
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
38947
|
-
process.stderr.write(
|
|
38902
|
+
process.stderr.write(`Run plume ${name3} in an interactive terminal.
|
|
38903
|
+
`);
|
|
38948
38904
|
return 1;
|
|
38949
38905
|
}
|
|
38950
38906
|
const prompt = createInterface({
|
|
@@ -38952,7 +38908,7 @@ async function connectMain(args, env2) {
|
|
|
38952
38908
|
output: process.stdout
|
|
38953
38909
|
});
|
|
38954
38910
|
try {
|
|
38955
|
-
await runConnect({
|
|
38911
|
+
await (name3 === "push" ? runPush : runConnect)({
|
|
38956
38912
|
cwd: process.cwd(),
|
|
38957
38913
|
endpoint: env2.PLUME_ENDPOINT ?? defaultEndpoint,
|
|
38958
38914
|
ask: (question) => prompt.question(question),
|
|
@@ -38966,9 +38922,10 @@ Waiting for browser approval\u2026
|
|
|
38966
38922
|
);
|
|
38967
38923
|
try {
|
|
38968
38924
|
await openBrowser(url2);
|
|
38969
|
-
} catch {
|
|
38925
|
+
} catch (error62) {
|
|
38970
38926
|
process.stdout.write(
|
|
38971
|
-
|
|
38927
|
+
`Open the link above in your browser to continue (${error62 instanceof Error ? error62.name : "error"}).
|
|
38928
|
+
`
|
|
38972
38929
|
);
|
|
38973
38930
|
}
|
|
38974
38931
|
}
|
|
@@ -38976,7 +38933,7 @@ Waiting for browser approval\u2026
|
|
|
38976
38933
|
return 0;
|
|
38977
38934
|
} catch (error62) {
|
|
38978
38935
|
process.stderr.write(
|
|
38979
|
-
`${error62 instanceof PlumeToolError ? `${error62.code}: ${error62.message}` :
|
|
38936
|
+
`${error62 instanceof PlumeToolError ? `${error62.code}: ${error62.message}` : `plume ${name3} failed unexpectedly. Check this Site in Plume, then run it again.`}
|
|
38980
38937
|
`
|
|
38981
38938
|
);
|
|
38982
38939
|
return 1;
|
|
@@ -38993,7 +38950,7 @@ init_src();
|
|
|
38993
38950
|
import { createHash as createHash4 } from "node:crypto";
|
|
38994
38951
|
import { createWriteStream } from "node:fs";
|
|
38995
38952
|
import { link, lstat as lstat4, mkdtemp, open as open5, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
|
|
38996
|
-
import { dirname as dirname2, join as
|
|
38953
|
+
import { dirname as dirname2, join as join3, resolve as resolve6 } from "node:path";
|
|
38997
38954
|
import { addAbortSignal, Readable, Transform } from "node:stream";
|
|
38998
38955
|
import { finished, pipeline } from "node:stream/promises";
|
|
38999
38956
|
|
|
@@ -39174,8 +39131,8 @@ async function runExport(options2) {
|
|
|
39174
39131
|
if (!(error62 && typeof error62 === "object" && "code" in error62 && error62.code === "ENOENT"))
|
|
39175
39132
|
throw error62;
|
|
39176
39133
|
}
|
|
39177
|
-
staging = await mkdtemp(
|
|
39178
|
-
const temporary =
|
|
39134
|
+
staging = await mkdtemp(join3(dirname2(output2), ".plume-export-"));
|
|
39135
|
+
const temporary = join3(staging, "archive.zip");
|
|
39179
39136
|
const request = async (body3, object4 = false) => {
|
|
39180
39137
|
signal.throwIfAborted();
|
|
39181
39138
|
if (authorization.expiresAt <= Date.now()) throw new Error();
|
|
@@ -39218,7 +39175,7 @@ async function runExport(options2) {
|
|
|
39218
39175
|
);
|
|
39219
39176
|
const checksums = {};
|
|
39220
39177
|
const save = async (name3, bytes2) => {
|
|
39221
|
-
await writeFile2(
|
|
39178
|
+
await writeFile2(join3(staging, name3), bytes2, {
|
|
39222
39179
|
flag: "wx",
|
|
39223
39180
|
mode: 384
|
|
39224
39181
|
});
|
|
@@ -39231,7 +39188,7 @@ async function runExport(options2) {
|
|
|
39231
39188
|
let total;
|
|
39232
39189
|
const references = /* @__PURE__ */ new Set();
|
|
39233
39190
|
const records = /* @__PURE__ */ new Set();
|
|
39234
|
-
const contentFile = await open5(
|
|
39191
|
+
const contentFile = await open5(join3(staging, "content.jsonl"), "wx", 384);
|
|
39235
39192
|
const contentHash = createHash4("sha256");
|
|
39236
39193
|
try {
|
|
39237
39194
|
for (; ; ) {
|
|
@@ -39302,8 +39259,8 @@ async function runExport(options2) {
|
|
|
39302
39259
|
);
|
|
39303
39260
|
void zipDone.catch(() => controller.abort());
|
|
39304
39261
|
for (const name3 of ["schema.json", "README.md", "content.jsonl"])
|
|
39305
|
-
zip.addFile(
|
|
39306
|
-
const mediaFile = await open5(
|
|
39262
|
+
zip.addFile(join3(staging, name3), name3);
|
|
39263
|
+
const mediaFile = await open5(join3(staging, "media.jsonl"), "wx", 384);
|
|
39307
39264
|
const mediaHash = createHash4("sha256");
|
|
39308
39265
|
const included = /* @__PURE__ */ new Set();
|
|
39309
39266
|
const inventoryCursors = /* @__PURE__ */ new Set();
|
|
@@ -39408,7 +39365,7 @@ async function runExport(options2) {
|
|
|
39408
39365
|
for (const key3 of descriptors.keys())
|
|
39409
39366
|
if (!included.has(key3)) throw new Error();
|
|
39410
39367
|
checksums["media.jsonl"] = `sha256:${mediaHash.digest("hex")}`;
|
|
39411
|
-
zip.addFile(
|
|
39368
|
+
zip.addFile(join3(staging, "media.jsonl"), "media.jsonl");
|
|
39412
39369
|
const verified = external_exports.object({ ok: external_exports.literal(true), exportId: text3 }).strict().parse(await json2({ action: "verify" }));
|
|
39413
39370
|
if (verified.exportId !== source.exportId) throw new Error();
|
|
39414
39371
|
const manifest = {
|
|
@@ -39506,7 +39463,8 @@ var MAX_SCHEMA_BYTES2 = 256 * 1024;
|
|
|
39506
39463
|
var validationSchema = external_exports.object({
|
|
39507
39464
|
binding: contentBindingSchema,
|
|
39508
39465
|
revision: external_exports.number().int().nonnegative(),
|
|
39509
|
-
sealed: external_exports.literal(true)
|
|
39466
|
+
sealed: external_exports.literal(true),
|
|
39467
|
+
preview: external_exports.boolean()
|
|
39510
39468
|
}).strict();
|
|
39511
39469
|
var PlumeBuildError = class extends Error {
|
|
39512
39470
|
constructor(code, message) {
|
|
@@ -39626,7 +39584,7 @@ async function validateRemote(url2, binding, commitSha) {
|
|
|
39626
39584
|
);
|
|
39627
39585
|
if (result.binding.siteId !== binding.siteId || result.binding.schemaHash !== binding.schemaHash)
|
|
39628
39586
|
throw Error();
|
|
39629
|
-
return result
|
|
39587
|
+
return result;
|
|
39630
39588
|
} catch {
|
|
39631
39589
|
throw new PlumeBuildError(
|
|
39632
39590
|
"INVALID_RESPONSE",
|
|
@@ -39691,7 +39649,7 @@ async function runBuild(options2) {
|
|
|
39691
39649
|
"The .plume build directory is unavailable or is a symbolic link."
|
|
39692
39650
|
);
|
|
39693
39651
|
}
|
|
39694
|
-
const temporary = resolve8(directory, `.binding-${
|
|
39652
|
+
const temporary = resolve8(directory, `.binding-${randomUUID2()}.json`);
|
|
39695
39653
|
try {
|
|
39696
39654
|
await rm5(bindingFile, { force: true });
|
|
39697
39655
|
await rm5(deliveryFile, { force: true });
|
|
@@ -39716,15 +39674,15 @@ async function runBuild(options2) {
|
|
|
39716
39674
|
"INVALID_CONFIGURATION",
|
|
39717
39675
|
"Build from an exact Git commit."
|
|
39718
39676
|
);
|
|
39677
|
+
const { binding, preview } = await validateRemote(url2, lock, commitSha);
|
|
39719
39678
|
const requested = options2.delivery ?? "static";
|
|
39720
|
-
const
|
|
39721
|
-
const binding = await validateRemote(url2, lock, commitSha);
|
|
39679
|
+
const update = requested === "auto" && preview;
|
|
39722
39680
|
const descriptor = deliveryDescriptorSchema.safeParse({
|
|
39723
39681
|
version: 1,
|
|
39724
|
-
mode,
|
|
39682
|
+
mode: update ? "static" : requested === "auto" ? "production-ssr" : requested,
|
|
39725
39683
|
artifact: {
|
|
39726
39684
|
commitSha,
|
|
39727
|
-
environment: options2.environment ?? "production"
|
|
39685
|
+
environment: options2.environment ?? (update ? "preview" : "production")
|
|
39728
39686
|
},
|
|
39729
39687
|
binding
|
|
39730
39688
|
});
|
|
@@ -39772,7 +39730,8 @@ async function runBuild(options2) {
|
|
|
39772
39730
|
}
|
|
39773
39731
|
}
|
|
39774
39732
|
async function main(args, env2 = process.env) {
|
|
39775
|
-
if (args[0] === "connect"
|
|
39733
|
+
if (args[0] === "connect" || args[0] === "push")
|
|
39734
|
+
return connectMain(args, env2);
|
|
39776
39735
|
if (args[0] === "export") return exportMain(args, env2);
|
|
39777
39736
|
if (args[0] === "init") {
|
|
39778
39737
|
try {
|
package/dist/local.mjs
CHANGED
|
@@ -34435,7 +34435,7 @@ async function open2(path, expected) {
|
|
|
34435
34435
|
).get();
|
|
34436
34436
|
if (size.count > MAX_BASELINE_RECORDS || size.bytes + Buffer.byteLength(current.schema) > MAX_BASELINE_JSON_BYTES)
|
|
34437
34437
|
throw new Error(
|
|
34438
|
-
"
|
|
34438
|
+
"Local content to send is limited to 100 records and 1 MiB of JSON."
|
|
34439
34439
|
);
|
|
34440
34440
|
return {
|
|
34441
34441
|
revision: current.revision,
|