@paneui/cli 0.0.12 → 0.0.14
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/dist/commands/upgrade.js +67 -0
- package/dist/index.js +10 -0
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// `pane upgrade <pane-id>` — re-pin a live pane to another version of its
|
|
2
|
+
// template, swapping design + content in place (#267).
|
|
3
|
+
import { assertKnownFlags } from "../argv.js";
|
|
4
|
+
import { makeClient } from "../config.js";
|
|
5
|
+
import { printJson, fail, failFromError } from "../output.js";
|
|
6
|
+
const KNOWN_FLAGS = ["template-version"];
|
|
7
|
+
const KNOWN_BOOLS = ["force"];
|
|
8
|
+
export const upgradeHelp = `pane upgrade — re-pin a live pane to another template version
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
pane upgrade <pane-id> [--template-version <n>] [--force]
|
|
12
|
+
|
|
13
|
+
Re-points an existing, live pane at a different version of the SAME template
|
|
14
|
+
(POST /v1/panes/:id/upgrade). This swaps the pane's HTML (design) and its
|
|
15
|
+
event/input/record schemas (content contract) in place — the human keeps the
|
|
16
|
+
same URL, no new pane is created. Use it after appending a new template
|
|
17
|
+
version with 'pane template version <id|slug> --template ...'.
|
|
18
|
+
|
|
19
|
+
Events already on disk are never rewritten — each keeps the template version
|
|
20
|
+
it was authored under, so the prior history still renders.
|
|
21
|
+
|
|
22
|
+
By default the relay runs a strict schema-compat gate: if the target version's
|
|
23
|
+
schema narrows the pane's current one (a removed collection, a newly-required
|
|
24
|
+
field, a tightened type), the upgrade is refused with a
|
|
25
|
+
'schema_incompatible_upgrade' error whose details.breaks lists what would
|
|
26
|
+
break. Pass --force to apply the upgrade anyway, accepting that events written
|
|
27
|
+
under the old schema may no longer validate.
|
|
28
|
+
|
|
29
|
+
Note: the re-pin takes effect on the relay immediately and emits a
|
|
30
|
+
'system.template.updated' event, but an already-open pane tab is not
|
|
31
|
+
force-reloaded in v1 — the new version renders the next time the URL is loaded.
|
|
32
|
+
|
|
33
|
+
Options:
|
|
34
|
+
--template-version <n> Target version number. Defaults to the template's
|
|
35
|
+
latest version.
|
|
36
|
+
--force Override the strict schema-compat gate (compat=force).
|
|
37
|
+
--url <url> Relay base URL (overrides PANE_URL).
|
|
38
|
+
--api-key <key> Agent API key (overrides PANE_API_KEY).
|
|
39
|
+
-h, --help Show this help.
|
|
40
|
+
|
|
41
|
+
Output (stdout, JSON):
|
|
42
|
+
{ pane_id, template_version_id, template_version, upgraded, breaks, compat }`;
|
|
43
|
+
export async function runUpgrade(args) {
|
|
44
|
+
assertKnownFlags(args, KNOWN_FLAGS, KNOWN_BOOLS, "pane upgrade");
|
|
45
|
+
const paneId = args.positionals[0];
|
|
46
|
+
if (!paneId)
|
|
47
|
+
fail("missing <pane-id>", "invalid_args");
|
|
48
|
+
const opts = {};
|
|
49
|
+
const versionRaw = args.flags.get("template-version");
|
|
50
|
+
if (versionRaw !== undefined) {
|
|
51
|
+
const version = Number(versionRaw);
|
|
52
|
+
if (!Number.isInteger(version) || version < 1) {
|
|
53
|
+
fail("--template-version must be a positive integer", "invalid_args");
|
|
54
|
+
}
|
|
55
|
+
opts.template_version = version;
|
|
56
|
+
}
|
|
57
|
+
if (args.bools.has("force"))
|
|
58
|
+
opts.compat = "force";
|
|
59
|
+
const client = makeClient(args);
|
|
60
|
+
try {
|
|
61
|
+
const res = await client.upgradePane(paneId, opts);
|
|
62
|
+
printJson(res);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
failFromError(e);
|
|
66
|
+
}
|
|
67
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import { runState, stateHelp } from "./commands/state.js";
|
|
|
31
31
|
import { runSend, sendHelp } from "./commands/send.js";
|
|
32
32
|
import { runWatch, watchHelp } from "./commands/watch.js";
|
|
33
33
|
import { runDelete, deleteHelp } from "./commands/delete.js";
|
|
34
|
+
import { runUpgrade, upgradeHelp } from "./commands/upgrade.js";
|
|
34
35
|
import { runParticipant, participantHelp } from "./commands/participant.js";
|
|
35
36
|
import { runShare, shareHelp } from "./commands/share.js";
|
|
36
37
|
import { runTemplate, artifactHelp } from "./commands/template.js";
|
|
@@ -62,6 +63,9 @@ Pane commands (operate on the core noun — a live UI channel):
|
|
|
62
63
|
send <id> Emit an agent event into a pane.
|
|
63
64
|
watch <id> Stream a pane's events as JSON-lines on stdout.
|
|
64
65
|
delete <id> Close/delete a pane (DELETE /v1/panes/:id).
|
|
66
|
+
upgrade <id> Re-pin a live pane to another version of its template —
|
|
67
|
+
swap design + content in place, same URL (--template-version
|
|
68
|
+
<n>, --force to override the schema-compat gate).
|
|
65
69
|
participant Manage participant URLs on an existing pane
|
|
66
70
|
<list|new|revoke> (list | mint a fresh URL | revoke one URL).
|
|
67
71
|
share <id> Share a pane by identity: invite humans by email
|
|
@@ -147,6 +151,8 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
147
151
|
"link",
|
|
148
152
|
"invite-only",
|
|
149
153
|
"list",
|
|
154
|
+
// `pane upgrade --force`: override the strict schema-compat gate.
|
|
155
|
+
"force",
|
|
150
156
|
]);
|
|
151
157
|
async function main() {
|
|
152
158
|
const rawArgv = process.argv.slice(2);
|
|
@@ -182,6 +188,7 @@ async function main() {
|
|
|
182
188
|
send: sendHelp,
|
|
183
189
|
watch: watchHelp,
|
|
184
190
|
delete: deleteHelp,
|
|
191
|
+
upgrade: upgradeHelp,
|
|
185
192
|
participant: participantHelp,
|
|
186
193
|
share: shareHelp,
|
|
187
194
|
// Other noun groups.
|
|
@@ -236,6 +243,9 @@ async function main() {
|
|
|
236
243
|
case "delete":
|
|
237
244
|
await runDelete(args);
|
|
238
245
|
break;
|
|
246
|
+
case "upgrade":
|
|
247
|
+
await runUpgrade(args);
|
|
248
|
+
break;
|
|
239
249
|
case "participant":
|
|
240
250
|
await runParticipant(args);
|
|
241
251
|
break;
|
package/dist/version.js
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
// Keep this in lockstep with packages/cli/package.json's `version` field;
|
|
9
9
|
// they're consulted in different places (here for the runtime header,
|
|
10
10
|
// package.json for npm publish + dependency resolution).
|
|
11
|
-
export const VERSION = "0.0.
|
|
11
|
+
export const VERSION = "0.0.14";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paneui/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Command-line client for the Pane relay: create panes, inspect state, send and watch events.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test:unit": "vitest run"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@paneui/core": "^0.0.
|
|
44
|
+
"@paneui/core": "^0.0.14",
|
|
45
45
|
"qrcode-terminal": "^0.12.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|