@plitzi/cli 0.37.9 → 0.37.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/cli",
3
- "version": "0.37.9",
3
+ "version": "0.37.10",
4
4
  "license": "AGPL-3.0",
5
5
  "description": "Command line for Plitzi: scaffold a project that renders a space, a plugin package, or an element of your own.",
6
6
  "files": [
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@plitzi/sdk-authoring": "0.37.9",
24
+ "@plitzi/sdk-authoring": "0.37.10",
25
25
  "chalk": "^6.0.0",
26
26
  "commander": "^15.0.0",
27
27
  "esbuild": "^0.28.2",
28
28
  "fflate": "^0.8.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@plitzi/sdk-shared": "0.37.9",
31
+ "@plitzi/sdk-shared": "0.37.10",
32
32
  "@types/node": "^26.6.2",
33
33
  "eslint": "^9.39.5",
34
34
  "eslint-plugin-import": "^2.32.0",
@@ -17,7 +17,7 @@ test wired together; a plugin's four files in the shape Plitzi's own elements us
17
17
  a signed-in upload. **Reach for it before writing any of those yourself.**
18
18
 
19
19
  ```bash
20
- npx @plitzi/cli create my-site # a project that renders a space
20
+ npx @plitzi/cli create my-site # a project that renders a space (--template blank | catalog)
21
21
  npx @plitzi/cli create my-board --from pizarra # a space on Plitzi, as a project that serves it alone
22
22
  npx @plitzi/cli pull # that project brought up to date with its space
23
23
  npx @plitzi/cli add plugin seat-picker legend # elements of your own, in the project you are in
@@ -25,6 +25,9 @@ npx @plitzi/cli create seat-picker --plugin # a plugin package any space can
25
25
  npx @plitzi/cli pack plugin # a plugin built, and zipped the way the builder takes it
26
26
  npx @plitzi/cli upload plugin # that zip, on the space you work in, and installed there
27
27
  npx @plitzi/cli whoami # who the CLI is signed in as, and the space it works in
28
+ npx @plitzi/cli data describe public/data/products.json # a JSON file's fields, types and one row — not read whole
29
+ npx @plitzi/cli skills update # the skills in .claude/skills, up to the SDK installed
30
+ npx @plitzi/cli explain navigate # what a name means: element, step, trigger, problem or suggestion code (--list steps)
28
31
  npx @plitzi/cli functions pull # the space's functions (its own server code) into functions/
29
32
  npx @plitzi/cli functions push # functions/ back as the space's draft, built and checked
30
33
  npx @plitzi/cli functions try feed.read --params '{"limit":3}' # one task of the saved draft, in the sandbox
@@ -43,8 +46,24 @@ npx @plitzi/cli functions dev feed.read --watch # the same, fr
43
46
  - **Signing in happens in the browser.** `login`, `space` and a first `upload` open one; the person completes it (MFA
44
47
  and social sign-in included — the CLI never sees a password). Tell them a browser tab is waiting, and wait.
45
48
  - **One space at a time.** Everything goes to the space `whoami` names; `plitzi space` switches it. No command takes a
46
- space as a flag, so check `whoami` before an upload.
49
+ space as a flag, so check `whoami --json` (`{ api, user, space }`) before an upload.
47
50
  - **`--no-install`** writes the files without installing, **`--force`** writes into a directory that has work in it.
51
+ - **Read stdout, exit code and stderr apart.** The answer is on stdout (`--json`: one object, one line); errors and
52
+ sign-in prompts are on stderr; exit 1 means it did not do what was asked, or a check found something. A flag value
53
+ that is not one is refused with what it takes — read the message rather than retrying without the flag.
54
+
55
+ ## The Plitzi MCP or this CLI
56
+
57
+ Where the space lives decides which one an agent uses — the two never take turns on one space.
58
+
59
+ | The space | Use |
60
+ | --- | --- |
61
+ | In a project, written in code (`src/space.ts`, `--source local`) | this CLI and `@plitzi/sdk-authoring`. No account and no MCP |
62
+ | On Plitzi — edited in the builder, with collaborators, published from there | the Plitzi MCP server: it reads and edits the live space, previews a page and checks every edit with the same linter |
63
+ | On Plitzi, and wanted in code from now on | `create --from <space>`, then `pull` to keep the project in step |
64
+
65
+ The MCP needs a signed-in account. If it asks for authentication and nobody can give it, do not wait on it: a project
66
+ with `--source local` needs neither.
48
67
 
49
68
  ## Projects (`create`)
50
69
 
@@ -57,39 +76,37 @@ What a project gives you, so you use it rather than rebuild it:
57
76
 
58
77
  | Script | What it is for |
59
78
  | --- | --- |
60
- | `start` | serve it — in client mode Vite, which hot-replaces on save |
79
+ | `start` | serve it — in client mode Vite, which hot-replaces on save. The server prints only what goes wrong; `-- --verbose` adds every request |
61
80
  | `start:dev` | server mode: the server, restarted on save |
62
- | `author` | author `src/space.ts` and print every warning — the check after each change (local projects) |
63
- | `shot -- /path --width 390 --scheme dark` | a picture of one page |
81
+ | `author` | author `src/space.ts`: one line when it is fine, every problem at once (file:line, what to change) when not, then the suggestions (`[suggest]`: a shorter way to the same page, the most elements saved first); `-- --json` for a tool |
82
+ | `npx plitzi fix` | what `author` reports that has one fix, as a diff of your source; `--write` writes it, formatted, and keeps it only if the space then authors with it gone and nothing new |
83
+ | `check -- /path --width 1440,390` | whether a page is whole, in text: elements on screen, overflow, console, refused requests, failed flows; `--state` and `--element <id>` say what it holds; `--json` |
84
+ | `npx plitzi import <url>` | a page the user owns, measured as a place to start from: `tokens.ts` (colours light and dark, corners, shadows, Google fonts), `outline.ts` (its blocks and their layout per breakpoint), its repeated lists as `data/*.json`, screenshots per width, and `IMPORT.md` saying what was not carried over. Never the words. Only a site whose domain the user verified on one of their spaces (`_plitzi` TXT, under Domains in the dashboard), or one served from this machine — anything else is refused |
85
+ | `shot -- /path --width 390 --scheme dark` | a picture of one page — `--frames 4` says what moves, `--compare <url>` how much differs from another site by section, `--wait-for <element>`; refused when the port answers as another project |
64
86
  | `visual` | a browser asserts every element the space names is visible |
65
87
  | `typecheck`, `lint`, `format` | before calling a change done |
66
88
 
89
+ **Which port.** `start` takes 8080, or the next free one when something else holds it — printed, and written to
90
+ `.plitzi/dev-server.json`, where `check`, `shot` and `visual` look for it. Set `PORT` to choose one (then a taken port is an
91
+ error). `/health` answers with the space's name: a server that answers as something else is not this project.
92
+
93
+ The data a page reads with no backend goes in `public/data/*.json`, served by the project as it is; in server mode a
94
+ provider with `runtime: 'server'` reads it on the server, so the page arrives with it. To bind to a file, learn its fields
95
+ with `data describe` rather than reading it: a catalogue is half a megabyte, its shape twenty lines.
96
+
97
+ A local space starts as a tour of the platform with a plugin of the project's own; **`--template blank`** starts it as
98
+ tokens, a layout and one empty page instead — the one to pick when the project is about to be a specific site; and
99
+ **`--template catalog`** as a complete small shop (layout, card component, data in `public/data`, a filtered list, a
100
+ page per product), a file per part — the one to read when unsure how a whole site is put together.
101
+
67
102
  The space itself is written with `@plitzi/sdk-authoring` — see the `plitzi-authoring` skill, which `create` copies into
68
103
  `.claude/skills/` beside this one.
69
104
 
70
105
  ## A space on Plitzi, as a project (`create --from`, `pull`)
71
106
 
72
- `create --from <space>` (its permanent URL or id) writes a server project holding everything the space is made of, and
73
- serving it with nothing of Plitzi's — neither its servers nor its CDN:
74
-
75
- - its pages as authoring code in `src/space/` (`--source cloud` writes none: they stay on Plitzi, read with a key);
76
- - its actions in `src/actions/` — each a `defineAction` call where the document reads back exactly, JSON where it does
77
- not (the report says why) — and its connectors as JSON;
78
- - its functions in `functions/`, its runtime and plugins as the source they were built from, under `src/`;
79
- - its files downloaded into `public/`, every CDN address rewritten to the project's own;
80
- - `.env` with a signing key made for it, and the names of the variables and credentials it needs — never their values.
81
-
82
- It takes a signed-in CLI and a space the person may change (owner, admin or writer). It takes out the draft unless
83
- `--environment production` (that environment's latest snapshot) or `--environment production --revision 3` (that one,
84
- pinned) says otherwise. Read the report it prints: a
85
- plugin or runtime uploaded before Plitzi kept sources comes across built only (`vendor/`), and a space with visitor
86
- roles needs sign-in of its own (the note in `src/main.ts`).
107
+ Taking a space out of Plitzi as a server project of its own, and keeping it in step: read
108
+ [reference/from-space.md](reference/from-space.md) when the task names `--from` or `pull`.
87
109
 
88
- `pull` brings the project up to date: what changed on the space alone is written, what changed here alone is kept,
89
- and when one file changed on both it writes **nothing** and names them — keep your changes aside and pull again, or
90
- `--force` to take the space's copy. It never touches `.env`, and only adds to `package.json`. What the project was given
91
- is recorded in `.plitzi/space.json`: commit it. It follows the version the project was made from; `pull --environment
92
- … --revision …` moves it to another, `--revision latest` lets go of a pin.
93
110
 
94
111
  ## Elements of your own (`add plugin`)
95
112
 
@@ -101,8 +118,15 @@ read.
101
118
  plitzi add plugin seat-picker # one; asks what the builder calls it and what it is for
102
119
  plitzi add plugin seat-picker legend # several at once
103
120
  plitzi add plugin seat-picker --title "Seat Picker" --description "Pick a seat from a venue map"
121
+ plitzi add plugin ticker --prop interval:number=5000 --prop paused:boolean --trigger onTick:count --callback reset --headless
104
122
  ```
105
123
 
124
+ **Say its shape and it is written in it**, with nothing to delete: `--prop name:type=default` (string, number,
125
+ boolean) for each attribute — typed, defaulted, bindable, with a control in its panel; `--trigger onTick:count` for
126
+ each event and what a flow reads from it, fired with the `use<Name>Events()` hook it gets; `--callback reset` for
127
+ each action a flow can call; `--headless` for one with nothing to see (hidden on a page, a badge in the builder).
128
+ Without them it writes a counter that shows the three ways an element talks to a space — to be rewritten.
129
+
106
130
  Each is a folder (`src/plugins/SeatPicker/` in a project `create` wrote):
107
131
 
108
132
  | File | What it holds |
@@ -155,30 +179,24 @@ is what `create --from` brings back; `plitzi pack source` writes what would be k
155
179
  A self-hosted page server does not need `pack`: it compiles a plugin from its source
156
180
  (`plugins: { seatPicker: { js: 'src/plugins/SeatPicker/index.ts', action: 'compile' } }` in `createServer`).
157
181
 
182
+ The same server decides its own say over the space's **feature flags**: `createServer({ flags: { newCheckout: true } })`
183
+ (or a function of `{ spaceId, environment }` when it serves several). It overrides what the space declares — only for
184
+ flags the space declares — and is overridden by the SDK's `flags` prop and a tester's dev tools. Declaring the flags
185
+ themselves is the space's (`flags` in the spec; see the authoring skill's feature flags).
186
+
158
187
  ## A space's functions (`functions`)
159
188
 
160
- A space's own server code — TypeScript tasks its actions run as steps, and routes under `/fn/` — lives in the space;
161
- `functions/` in a project is a **working copy** of it. The contract (`defineFunctions`, `ctx`) and every rule are in
162
- `docs/en/functions.md` of the workspace; what matters for the CLI:
163
-
164
- - **Pull before you edit, push when done.** `pull` refuses to overwrite what is not pushed (`--force` throws it
165
- away); `push` refuses when the space changed since the pull — someone saved in the builder. Then: keep your changes
166
- aside, `pull`, apply them again, `push`. Never `--force` over somebody else's work to get past it.
167
- - **A push is checked, not just stored.** A problem comes back as `functions/<file>:<line> <message>` and nothing is
168
- saved — fix it and push again. `index.ts` must default-export `defineFunctions({ … })`; files import each other by
169
- relative path and `@plitzi/sdk-server/functions`, nothing else.
170
- - **`try` runs the saved draft for real** (its fetches and writes happen). `dev` runs `functions/` on this machine with
171
- the project's own `@plitzi/sdk-server` — `npm install -D @plitzi/sdk-server isolated-vm core-js` first — and sends
172
- nothing to the space; `PLITZI_FUNCTIONS_CREDENTIALS='{"stripe":{"apiKey":"…"}}'` gives it credentials to name.
173
- - **A run gets 100 ms of CPU and 10 s.** A task that needs more asks with `limits: { cpuMs, wallMs }` (or
174
- `defineFunctions({ limits })` for all), up to the plan's ceiling; asking above it is a problem the push reports.
175
- - **The live site runs what the space was last published with.** A push changes the draft; publishing is the person's.
189
+ A space's own server code, edited in `functions/` with `pull`, `push`, `try` and `dev`: read
190
+ [reference/functions.md](reference/functions.md) when the task names its functions.
191
+
176
192
 
177
193
  ## When something does not work
178
194
 
179
195
  | What you see | What it is |
180
196
  | --- | --- |
181
197
  | `create` printed questions and wrote nothing | nobody answered the three choices — ask the user, pass them as flags |
198
+ | `start` says the port is in use | `PORT` is set to a taken port — unset it to take the next free one, or choose another |
199
+ | A page that is not this project's, or `shot` refuses the port | another server answers there — `curl 127.0.0.1:<port>/health` names it; `.plitzi/dev-server.json` has this project's port |
182
200
  | An element renders "Custom Component … Not Found" | the `renderType` names no registered plugin — check the folder name's camelCase |
183
201
  | A flow on the plugin's event is refused, or never runs | the event is not in `declaration.ts`, or the plugin is missing from `src/plugins/declarations.ts` |
184
202
  | `upload` opens a browser | there is no session, or no space chosen — the person completes it there |
@@ -0,0 +1,23 @@
1
+ # A space on Plitzi, as a project (`create --from`, `pull`)
2
+
3
+ `create --from <space>` (its permanent URL or id) writes a server project holding everything the space is made of, and
4
+ serving it with nothing of Plitzi's — neither its servers nor its CDN:
5
+
6
+ - its pages as authoring code in `src/space/` (`--source cloud` writes none: they stay on Plitzi, read with a key);
7
+ - its actions in `src/actions/` — each a `defineAction` call where the document reads back exactly, JSON where it does
8
+ not (the report says why) — and its connectors as JSON;
9
+ - its functions in `functions/`, its runtime and plugins as the source they were built from, under `src/`;
10
+ - its files downloaded into `public/`, every CDN address rewritten to the project's own;
11
+ - `.env` with a signing key made for it, and the names of the variables and credentials it needs — never their values.
12
+
13
+ It takes a signed-in CLI and a space the person may change (owner, admin or writer). It takes out the draft unless
14
+ `--environment production` (that environment's latest snapshot) or `--environment production --revision 3` (that one,
15
+ pinned) says otherwise. Read the report it prints: a
16
+ plugin or runtime uploaded before Plitzi kept sources comes across built only (`vendor/`), and a space with visitor
17
+ roles needs sign-in of its own (the note in `src/main.ts`).
18
+
19
+ `pull` brings the project up to date: what changed on the space alone is written, what changed here alone is kept,
20
+ and when one file changed on both it writes **nothing** and names them — keep your changes aside and pull again, or
21
+ `--force` to take the space's copy. It never touches `.env`, and only adds to `package.json`. What the project was given
22
+ is recorded in `.plitzi/space.json`: commit it. It follows the version the project was made from; `pull --environment
23
+ … --revision …` moves it to another, `--revision latest` lets go of a pin.
@@ -0,0 +1,18 @@
1
+ # A space's functions (`functions`)
2
+
3
+ A space's own server code — TypeScript tasks its actions run as steps, and routes under `/fn/` — lives in the space;
4
+ `functions/` in a project is a **working copy** of it. The contract (`defineFunctions`, `ctx`) is typed in
5
+ `@plitzi/sdk-server/functions`, whose `.d.ts` documents every field; what matters for the CLI:
6
+
7
+ - **Pull before you edit, push when done.** `pull` refuses to overwrite what is not pushed (`--force` throws it
8
+ away); `push` refuses when the space changed since the pull — someone saved in the builder. Then: keep your changes
9
+ aside, `pull`, apply them again, `push`. Never `--force` over somebody else's work to get past it.
10
+ - **A push is checked, not just stored.** A problem comes back as `functions/<file>:<line> <message>` and nothing is
11
+ saved — fix it and push again. `index.ts` must default-export `defineFunctions({ … })`; files import each other by
12
+ relative path and `@plitzi/sdk-server/functions`, nothing else.
13
+ - **`try` runs the saved draft for real** (its fetches and writes happen). `dev` runs `functions/` on this machine with
14
+ the project's own `@plitzi/sdk-server` — `npm install -D @plitzi/sdk-server isolated-vm core-js` first — and sends
15
+ nothing to the space; `PLITZI_FUNCTIONS_CREDENTIALS='{"stripe":{"apiKey":"…"}}'` gives it credentials to name.
16
+ - **A run gets 100 ms of CPU and 10 s.** A task that needs more asks with `limits: { cpuMs, wallMs }` (or
17
+ `defineFunctions({ limits })` for all), up to the plan's ceiling; asking above it is a problem the push reports.
18
+ - **The live site runs what the space was last published with.** A push changes the draft; publishing is the person's.