@paneui/cli 0.0.24 → 0.0.26

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.
@@ -2,19 +2,38 @@
2
2
  // template, swapping design + content in place (#267).
3
3
  import { assertKnownFlags } from "../argv.js";
4
4
  import { makeClient } from "../config.js";
5
+ import { resolveJson, resolveText } from "../input.js";
5
6
  import { printJson, fail, failFromError } from "../output.js";
6
- const KNOWN_FLAGS = ["template-version"];
7
+ const KNOWN_FLAGS = [
8
+ "template-version",
9
+ "template",
10
+ "template-type",
11
+ "event-schema",
12
+ "input-schema",
13
+ "record-schema",
14
+ "template-record-schema",
15
+ ];
7
16
  const KNOWN_BOOLS = ["force"];
8
17
  export const upgradeHelp = `pane upgrade — re-pin a live pane to another template version
9
18
 
10
19
  Usage:
11
20
  pane upgrade <pane-id> [--template-version <n>] [--force]
21
+ pane upgrade <pane-id> --template <path|inline> [--event-schema <v>] [--force]
12
22
 
13
23
  Re-points an existing, live pane at a different version of the SAME template
14
24
  (POST /v1/panes/:id/upgrade). This swaps the pane's HTML (design) and its
15
25
  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 ...'.
26
+ same URL, no new pane is created.
27
+
28
+ Two ways to pick the target version:
29
+ • --template-version <n> — re-pin to an existing version. Append it first
30
+ with 'pane template version <id|slug> --template ...'.
31
+ • --template <path|inline> — INLINE EDIT: supply the new HTML directly and the
32
+ relay appends a fresh version + re-pins to it in one call. This is the
33
+ one-shot way to edit an INLINE pane's HTML in place. Any schema you don't
34
+ pass is inherited from the pane's current version, so to change only the
35
+ HTML you pass only --template. Inline panes only (a named/reusable template
36
+ must go through 'pane template version' + --template-version).
18
37
 
19
38
  Events already on disk are never rewritten — each keeps the template version
20
39
  it was authored under, so the prior history still renders.
@@ -31,8 +50,17 @@ Note: the re-pin takes effect on the relay immediately and emits a
31
50
  force-reloaded in v1 — the new version renders the next time the URL is loaded.
32
51
 
33
52
  Options:
34
- --template-version <n> Target version number. Defaults to the template's
35
- latest version.
53
+ --template-version <n> Re-pin to this existing version. Defaults to the
54
+ template's latest version. Mutually exclusive with
55
+ --template.
56
+ --template <v> INLINE EDIT: new HTML — a file path or inline HTML.
57
+ Appends a fresh version + re-pins, in one call.
58
+ --template-type <t> Template type for --template (default: html-inline).
59
+ --event-schema <v> New event schema for --template (file or inline JSON).
60
+ Omit to inherit the current version's.
61
+ --input-schema <v> New input schema for --template (file or inline JSON).
62
+ --record-schema <v> New record schema for --template (file or inline JSON).
63
+ --template-record-schema <v> New template-level record schema for --template.
36
64
  --force Override the strict schema-compat gate (compat=force).
37
65
  --url <url> Relay base URL (overrides PANE_URL).
38
66
  --api-key <key> Agent API key (overrides PANE_API_KEY).
@@ -47,6 +75,10 @@ export async function runUpgrade(args) {
47
75
  fail("missing <pane-id>", "invalid_args");
48
76
  const opts = {};
49
77
  const versionRaw = args.flags.get("template-version");
78
+ const templateRaw = args.flags.get("template");
79
+ if (versionRaw !== undefined && templateRaw !== undefined) {
80
+ fail("--template and --template-version are mutually exclusive", "invalid_args");
81
+ }
50
82
  if (versionRaw !== undefined) {
51
83
  const version = Number(versionRaw);
52
84
  if (!Number.isInteger(version) || version < 1) {
@@ -54,6 +86,25 @@ export async function runUpgrade(args) {
54
86
  }
55
87
  opts.template_version = version;
56
88
  }
89
+ if (templateRaw !== undefined) {
90
+ const tpl = { source: resolveText(templateRaw) };
91
+ const type = args.flags.get("template-type");
92
+ if (type !== undefined)
93
+ tpl.type = type;
94
+ const es = args.flags.get("event-schema");
95
+ if (es !== undefined)
96
+ tpl.event_schema = resolveJson(es, "--event-schema");
97
+ const is = args.flags.get("input-schema");
98
+ if (is !== undefined)
99
+ tpl.input_schema = resolveJson(is, "--input-schema");
100
+ const rs = args.flags.get("record-schema");
101
+ if (rs !== undefined)
102
+ tpl.record_schema = resolveJson(rs, "--record-schema");
103
+ const trs = args.flags.get("template-record-schema");
104
+ if (trs !== undefined)
105
+ tpl.template_record_schema = resolveJson(trs, "--template-record-schema");
106
+ opts.template = tpl;
107
+ }
57
108
  if (args.bools.has("force"))
58
109
  opts.compat = "force";
59
110
  const client = makeClient(args);
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.24";
11
+ export const VERSION = "0.0.26";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paneui/cli",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
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.24",
44
+ "@paneui/core": "^0.0.26",
45
45
  "qrcode-terminal": "^0.12.0"
46
46
  },
47
47
  "devDependencies": {