@plitzi/cli 0.37.8 → 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.8",
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.8",
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.8",
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",
@@ -4,9 +4,10 @@ description: >-
4
4
  Use the Plitzi command line (@plitzi/cli, `plitzi …` or `npx @plitzi/cli …`) instead of hand-writing what it
5
5
  generates: scaffold a project that renders a space, add elements of your own (plugins) to it, create a plugin package,
6
6
  build a plugin into the module + manifest + zip the platform takes, sign in to upload and install it on a space, and
7
- edit a space's own server code (its functions) in the project. Use whenever the task is to start a Plitzi project,
8
- create or change a plugin/custom element, pack, upload or install one, pull/push/try a space's functions, or work out
9
- which space the CLI is connected to.
7
+ edit a space's own server code (its functions) in the project, and take a space on Plitzi out as a self-hosted project
8
+ of its own (`create --from`, kept in step with `pull`). Use whenever the task is to start a Plitzi project, create or
9
+ change a plugin/custom element, pack, upload or install one, pull/push/try a space's functions, move a space to a
10
+ server of its own, or work out which space the CLI is connected to.
10
11
  ---
11
12
 
12
13
  # The Plitzi CLI
@@ -16,12 +17,17 @@ test wired together; a plugin's four files in the shape Plitzi's own elements us
16
17
  a signed-in upload. **Reach for it before writing any of those yourself.**
17
18
 
18
19
  ```bash
19
- 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
+ npx @plitzi/cli create my-board --from pizarra # a space on Plitzi, as a project that serves it alone
22
+ npx @plitzi/cli pull # that project brought up to date with its space
20
23
  npx @plitzi/cli add plugin seat-picker legend # elements of your own, in the project you are in
21
24
  npx @plitzi/cli create seat-picker --plugin # a plugin package any space can load
22
25
  npx @plitzi/cli pack plugin # a plugin built, and zipped the way the builder takes it
23
26
  npx @plitzi/cli upload plugin # that zip, on the space you work in, and installed there
24
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)
25
31
  npx @plitzi/cli functions pull # the space's functions (its own server code) into functions/
26
32
  npx @plitzi/cli functions push # functions/ back as the space's draft, built and checked
27
33
  npx @plitzi/cli functions try feed.read --params '{"limit":3}' # one task of the saved draft, in the sandbox
@@ -40,8 +46,24 @@ npx @plitzi/cli functions dev feed.read --watch # the same, fr
40
46
  - **Signing in happens in the browser.** `login`, `space` and a first `upload` open one; the person completes it (MFA
41
47
  and social sign-in included — the CLI never sees a password). Tell them a browser tab is waiting, and wait.
42
48
  - **One space at a time.** Everything goes to the space `whoami` names; `plitzi space` switches it. No command takes a
43
- 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.
44
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.
45
67
 
46
68
  ## Projects (`create`)
47
69
 
@@ -54,16 +76,38 @@ What a project gives you, so you use it rather than rebuild it:
54
76
 
55
77
  | Script | What it is for |
56
78
  | --- | --- |
57
- | `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 |
58
80
  | `start:dev` | server mode: the server, restarted on save |
59
- | `author` | author `src/space.ts` and print every warning — the check after each change (local projects) |
60
- | `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 |
61
86
  | `visual` | a browser asserts every element the space names is visible |
62
87
  | `typecheck`, `lint`, `format` | before calling a change done |
63
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
+
64
102
  The space itself is written with `@plitzi/sdk-authoring` — see the `plitzi-authoring` skill, which `create` copies into
65
103
  `.claude/skills/` beside this one.
66
104
 
105
+ ## A space on Plitzi, as a project (`create --from`, `pull`)
106
+
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`.
109
+
110
+
67
111
  ## Elements of your own (`add plugin`)
68
112
 
69
113
  A plugin is a React component the space renders — a map, a chart, a seat picker: whatever is not text in a box. **Never
@@ -74,8 +118,15 @@ read.
74
118
  plitzi add plugin seat-picker # one; asks what the builder calls it and what it is for
75
119
  plitzi add plugin seat-picker legend # several at once
76
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
77
122
  ```
78
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
+
79
130
  Each is a folder (`src/plugins/SeatPicker/` in a project `create` wrote):
80
131
 
81
132
  | File | What it holds |
@@ -121,34 +172,33 @@ plitzi upload plugin # the zip pack left, onto the sp
121
172
  `pack` writes one ES module (React and the SDK kept out — the page provides them), `plugin-manifest.json` from the
122
173
  declarations with integrity hashes, and the zip the builder takes under Resources. `upload` checks the manifest,
123
174
  sends the zip to one of the space's CDNs (`--cdn`) and installs it — a plugin already there moves to the new version with
124
- its settings kept. `--plugin-version` sets the version the manifest carries.
175
+ its settings kept. `--plugin-version` sets the version the manifest carries. The plugin's source — every file it
176
+ imports, followed from its entry — is kept beside it on the space (`runtime push` does the same for a runtime), which
177
+ is what `create --from` brings back; `plitzi pack source` writes what would be kept to a file, to look at.
125
178
 
126
179
  A self-hosted page server does not need `pack`: it compiles a plugin from its source
127
180
  (`plugins: { seatPicker: { js: 'src/plugins/SeatPicker/index.ts', action: 'compile' } }` in `createServer`).
128
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
+
129
187
  ## A space's functions (`functions`)
130
188
 
131
- A space's own server code — TypeScript tasks its actions run as steps, and routes under `/api/` — lives in the space;
132
- `functions/` in a project is a **working copy** of it. The contract (`defineFunctions`, `ctx`) and every rule are in
133
- `docs/en/functions.md` of the workspace; what matters for the CLI:
134
-
135
- - **Pull before you edit, push when done.** `pull` refuses to overwrite what is not pushed (`--force` throws it
136
- away); `push` refuses when the space changed since the pull — someone saved in the builder. Then: keep your changes
137
- aside, `pull`, apply them again, `push`. Never `--force` over somebody else's work to get past it.
138
- - **A push is checked, not just stored.** A problem comes back as `functions/<file>:<line> <message>` and nothing is
139
- saved — fix it and push again. `index.ts` must default-export `defineFunctions({ … })`; files import each other by
140
- relative path and `@plitzi/sdk-server/functions`, nothing else.
141
- - **`try` runs the saved draft for real** (its fetches and writes happen). `dev` runs `functions/` on this machine with
142
- the project's own `@plitzi/sdk-server` — `npm install -D @plitzi/sdk-server isolated-vm core-js` first — and sends
143
- nothing to the space; `PLITZI_FUNCTIONS_CREDENTIALS='{"stripe":{"apiKey":"…"}}'` gives it credentials to name.
144
- - **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
+
145
192
 
146
193
  ## When something does not work
147
194
 
148
195
  | What you see | What it is |
149
196
  | --- | --- |
150
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 |
151
200
  | An element renders "Custom Component … Not Found" | the `renderType` names no registered plugin — check the folder name's camelCase |
152
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` |
153
202
  | `upload` opens a browser | there is no session, or no space chosen — the person completes it there |
154
203
  | The upload went to the wrong space | `plitzi space` chooses another; check `whoami` first |
204
+ | `pull` wrote nothing and named files | they changed here and on the space — set your changes aside and pull again, or `--force` |
@@ -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.