@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/CHANGELOG.md +823 -0
- package/README.md +196 -5
- package/dist/index.js +3875 -781
- package/package.json +3 -3
- package/skills/plitzi-cli/SKILL.md +73 -23
- package/skills/plitzi-cli/reference/from-space.md +23 -0
- package/skills/plitzi-cli/reference/functions.md +18 -0
package/README.md
CHANGED
|
@@ -10,6 +10,17 @@ npx @plitzi/cli pack plugin # a plugin built, and zipped the
|
|
|
10
10
|
npx @plitzi/cli upload plugin # that zip, on the space you work in, and installed there
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## What every command does the same way
|
|
14
|
+
|
|
15
|
+
- **The answer goes to stdout; everything else to stderr** — errors, and the prompts on the way (sign in, open this
|
|
16
|
+
address). So `--json`, where a command has it, prints one object on one line and nothing more.
|
|
17
|
+
- **It exits 1 when it did not do what it was asked**, with why in red; a check that found something wrong exits 1 too.
|
|
18
|
+
- **A value that is not one is refused**, saying what the flag takes — a width out of range, a scheme that is not
|
|
19
|
+
`light` or `dark`, a count of 0 — never quietly turned into the default.
|
|
20
|
+
- **The same flag means the same thing everywhere:** `-o, --out` where it writes, `-f, --force` to write over what is
|
|
21
|
+
there, `-e, --environment` for which version of the space, `--width` for the widths a page is looked at (one, or
|
|
22
|
+
several separated by commas), `--api` for the platform, `--json` for a tool or an agent.
|
|
23
|
+
|
|
13
24
|
## `create`
|
|
14
25
|
|
|
15
26
|
Scaffolds a project that renders a Plitzi space, installs it, and leaves it ready to start. Three choices shape it —
|
|
@@ -35,6 +46,22 @@ plitzi create my-site --yes # at a ter
|
|
|
35
46
|
plitzi create . --force --no-install --package-manager npm --mode server --source local # into a directory that has work in it
|
|
36
47
|
```
|
|
37
48
|
|
|
49
|
+
### From a space on Plitzi
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
plitzi create my-board --from pizarra # the draft, as code
|
|
53
|
+
plitzi create my-board --from pizarra --environment production --revision 3 # a snapshot, as it was frozen
|
|
54
|
+
plitzi create my-board --from pizarra --source cloud # the pages stay on Plitzi
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A server project holding everything the space is made of — its pages as authoring code, its actions as `defineAction`
|
|
58
|
+
code (JSON, with the reason said, where one would not read back exactly), its functions, the source of its plugins and
|
|
59
|
+
runtime, and its files downloaded into `public/` with every CDN address rewritten — served by the project with nothing
|
|
60
|
+
of Plitzi's. `.env` gets a signing key made for it and the names of the variables and credentials the space had, never
|
|
61
|
+
their values. It signs in as you and needs a space you may change; the end of `create` says what came across
|
|
62
|
+
differently. What the project was given is recorded in `.plitzi/space.json` — commit it — for [`pull`](#pull). See
|
|
63
|
+
`docs/en/projects-from-spaces.md`.
|
|
64
|
+
|
|
38
65
|
## The package manager
|
|
39
66
|
|
|
40
67
|
`--package-manager npm|yarn|pnpm` says which one the project is written for: what it installs with, and what
|
|
@@ -88,7 +115,127 @@ when an install fails the CLI says which setting names it.
|
|
|
88
115
|
`eslint-config-prettier` keeping the two from arguing on save. `lint` and `format` are scripts from the first
|
|
89
116
|
commit, which is the only moment a repository's style is cheap to decide.
|
|
90
117
|
- **The authoring skill**, in `.claude/skills/`, so an agent working in the project knows how a space is put
|
|
91
|
-
together before it touches one
|
|
118
|
+
together before it touches one: a cheatsheet to start from, references by subject and recipes by intent — each a
|
|
119
|
+
file that authors with no warning. `.claude` is left out of the project's lint and formatting.
|
|
120
|
+
- **`AGENTS.md`**: the commands, the port, where data goes, how to look at a page, and what not to read.
|
|
121
|
+
- **Quiet output.** `author` prints one line when the space is fine (every problem with its code when it is not), the
|
|
122
|
+
server only what goes wrong (`npm start -- --verbose` for every request), `typecheck` one line per error. Under the
|
|
123
|
+
warnings, `author` prints the space's **suggestions**
|
|
124
|
+
(`[suggest] repeated-on-pages · … (saves 57) · src/pages/docs.ts:291`): a shorter way to the same page — a layout
|
|
125
|
+
for a header on every page, a component for a card copied with other words, a link's own `content` — the ones that
|
|
126
|
+
save the most first. Not problems: the space authors either way. `npm run author -- --json` carries them in
|
|
127
|
+
`suggestions`.
|
|
128
|
+
|
|
129
|
+
## `create --template blank` and `--template catalog`
|
|
130
|
+
|
|
131
|
+
A space written in the project starts as the welcome tour, with a plugin of the project's own. `--template blank`
|
|
132
|
+
starts it as tokens for both themes, a layout whose `site-main` the pages render in, and one empty page — with
|
|
133
|
+
`public/data/` and no example plugin — for a project that is about to be a specific site. `--template catalog` starts
|
|
134
|
+
it as a complete small shop to read and change: a layout with a menu, a product card component, the products in
|
|
135
|
+
`public/data/products.json` read as a typed source, a catalog filtered by category, and a page per product — a file
|
|
136
|
+
per part under `src/site/`. Both go with `--source local`.
|
|
137
|
+
|
|
138
|
+
## `check` and `shot`
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
plitzi check / --width 1440,390 # is the page whole? in text, per width; --json for a tool
|
|
142
|
+
plitzi check /products --state --element catalog-count # and what it holds: state, sources, one element
|
|
143
|
+
plitzi shot /about --width 390 --scheme dark
|
|
144
|
+
plitzi shot / --frames 4 --every 500 # what moves: a marquee, an autoplay
|
|
145
|
+
plitzi shot / --compare https://example.com --width 1440 # side by side, and how much differs by section
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Both run on the project's own Playwright against its running server (`npm start`), and refuse a port that answers as
|
|
149
|
+
another project. `check` reports every element the space owes the page that is missing or hidden (with why), broken
|
|
150
|
+
images, sideways scroll, text in the colour behind it, console errors and refused requests — a page's state in a few
|
|
151
|
+
hundred tokens, where a screenshot costs thousands. `shot --compare` writes the two pictures side by side and the
|
|
152
|
+
differences in red, and says the share that differs in each landmark of the page; `--frames` compares pictures taken
|
|
153
|
+
one after another and names what moved. A project `create` writes has them as `npm run check` and `npm run shot`.
|
|
154
|
+
|
|
155
|
+
## `fix`
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
plitzi fix # what authoring would fix, as a diff of your own source
|
|
159
|
+
plitzi fix --write # written, formatted as the project formats, and checked
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The fixes are the ones with a single reading (`fixSpace`'s: a key the element never reads, `'true'` where a boolean
|
|
163
|
+
goes, a URL in page mode, a `state.` prefix on a state key…). Each is made in the call that wrote the element — found
|
|
164
|
+
by the line and column the element remembers — and only where the value is written as a literal; anything else is
|
|
165
|
+
listed with where it is and why it was left. `--write` authors the space again in a fresh process and keeps the edits
|
|
166
|
+
only if every fix is gone and no problem was added; a fix that would add one is put back and said.
|
|
167
|
+
|
|
168
|
+
## `import`
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
plitzi import https://example.com/pricing # into src/imported
|
|
172
|
+
plitzi import https://example.com/ --out src/home --width 1440,390
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
A page you own or may reuse, measured in the project's own Playwright as a place to start writing from — never a copy
|
|
176
|
+
of it. The widest width is desktop, the others tablet and mobile; the page is measured once more in the dark scheme.
|
|
177
|
+
What lands in `--out`:
|
|
178
|
+
|
|
179
|
+
- `tokens.ts` — the page's own custom properties by their names, then the colours it shows most, each with the value
|
|
180
|
+
the same place shows in the dark (the light one again, said in `IMPORT.md`, when it has no dark scheme); the corners
|
|
181
|
+
and shadows it repeats; its Google fonts. `variables`, `fonts` and `t` to hand to the space.
|
|
182
|
+
- `outline.ts` — `container()`s for its landmarks and blocks, each with its layout per breakpoint written as what the
|
|
183
|
+
narrower widths change, colours as tokens, and a block hidden at a width as `display: 'none'` there. A repeated block
|
|
184
|
+
is written once, and its rows go to `data/<name>.json`.
|
|
185
|
+
- `assets.json`, `screens/<width>.png`, and `IMPORT.md`: what was not carried over (the text, states, scripts, fonts
|
|
186
|
+
not on Google) and what to do next.
|
|
187
|
+
|
|
188
|
+
It reads only a site that is yours: one served from this machine (a host that resolves to loopback), or one a verified
|
|
189
|
+
domain of one of your spaces covers — the `_plitzi` TXT record a custom domain is verified by, under **Domains** in the
|
|
190
|
+
dashboard, asked of the platform you are signed in to (`--api`). Anything else is refused before a page is opened.
|
|
191
|
+
|
|
192
|
+
It refuses an `--out` that already has files unless `--force`, and then names the files an earlier import left that it
|
|
193
|
+
did not write again.
|
|
194
|
+
|
|
195
|
+
## `explain`
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
plitzi explain container # an element: its attributes and their values, what it fires and answers, its slots
|
|
199
|
+
plitzi explain navigate # a step: its params and the function that writes it
|
|
200
|
+
plitzi explain onScroll # a trigger: what it hands its flow, and what fires it
|
|
201
|
+
plitzi explain class-and-css # a problem's code: what was wrong, what to write instead
|
|
202
|
+
plitzi explain content-attribute # a suggestion's code: what is written the long way, and the short one
|
|
203
|
+
plitzi explain --list steps # every one of a kind: elements, steps, triggers, codes, transformers
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
What a name means when authoring, from the catalogues the checks themselves read — the answer to a question that would
|
|
207
|
+
otherwise be a search through the SDK's types. `--json` answers in one object; over MCP it is `plitzi://explain/{name}`.
|
|
208
|
+
|
|
209
|
+
## `skills update`
|
|
210
|
+
|
|
211
|
+
The skills `create` copies into `.claude/skills/` say the version of the package they came from (`version:` in
|
|
212
|
+
`SKILL.md`), and `npm run author` says when the authoring skill is older than the `@plitzi/sdk-authoring` installed.
|
|
213
|
+
`plitzi skills update` replaces each Plitzi skill there with the one of the installed package — whole, so a reference it
|
|
214
|
+
no longer has goes with it — and leaves any other skill alone.
|
|
215
|
+
|
|
216
|
+
## `data describe`
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
plitzi data describe public/data/products.json # its shape, and one row of its longest list
|
|
220
|
+
plitzi data describe public/data/products.json --json # { shape, example }
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The fields of a JSON file, their types and which rows have them — `price?: number (in 812 of 879)` — so a page can
|
|
224
|
+
be bound to half a megabyte of data after reading twenty lines of it.
|
|
225
|
+
|
|
226
|
+
## `pull`
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
plitzi pull # the space's changes in, yours kept
|
|
230
|
+
plitzi pull --force # where a file changed on both sides, the space's copy wins
|
|
231
|
+
plitzi pull --environment production --revision latest # follow another version from now on
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
In a project `create --from` wrote: a file the space changed and you did not is written, one you changed and the space
|
|
235
|
+
did not is kept, one the space no longer has is removed unless you changed it. A file changed on both makes the pull
|
|
236
|
+
write **nothing** and name them. Both sides are compared as the project's Prettier writes them. `.env` is never touched;
|
|
237
|
+
`package.json` only gains the packages the space's code now asks for. It follows the version the project was made from —
|
|
238
|
+
the draft, an environment's latest, or a pinned revision.
|
|
92
239
|
|
|
93
240
|
## `add plugin`
|
|
94
241
|
|
|
@@ -110,6 +257,18 @@ what the builder shows, and what it is for, and checks every folder is free befo
|
|
|
110
257
|
|
|
111
258
|
A name that would make a built-in element's type (`button`, `form`) is refused: a space could not tell the two apart.
|
|
112
259
|
|
|
260
|
+
Told its shape, it writes that shape rather than the counter it writes otherwise — one element at a time:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
plitzi add plugin ticker --prop interval:number=5000 --prop paused:boolean --trigger onTick:count --callback reset --headless
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`--prop name:type=default` (string, number or boolean) is an attribute: in the props, the declaration's defaults and
|
|
267
|
+
`bindingsAllowed`, and a control in `Settings.tsx`. `--trigger onTick:count,at` is an event and what a flow started by
|
|
268
|
+
it reads, fired with the `useTickerEvents()` hook it gets. `--callback reset` is an action a flow can call. `--headless`
|
|
269
|
+
is an element with nothing to see: hidden on a page, a badge in the builder. The files are written as the project's
|
|
270
|
+
Prettier writes them.
|
|
271
|
+
|
|
113
272
|
## `create --plugin`
|
|
114
273
|
|
|
115
274
|
A plugin package: elements any space can load, with a Vite preview to write them in. It builds nothing itself —
|
|
@@ -149,12 +308,27 @@ Without folders, outside a package, it offers the elements in `src/plugins` —
|
|
|
149
308
|
what a manifest is written from. `--out` moves the build, `--no-zip` leaves the zip out, and `--plugin-version` sets the
|
|
150
309
|
version the manifest carries (the project's own by default).
|
|
151
310
|
|
|
311
|
+
Beside the zip it writes the plugin's **source** (`<name>.source.json.gz`): every file of the project its elements import
|
|
312
|
+
— followed with the project's own TypeScript, `import type` included — and the packages they need. `upload plugin`
|
|
313
|
+
keeps it on the space, which is what `create --from` brings back. `--source-root` names the project those paths are
|
|
314
|
+
relative to, when the elements are not a project of their own. A file outside it, a credentials file or a credential
|
|
315
|
+
in the code keeps it from being written — said, and never stopping the build.
|
|
316
|
+
|
|
317
|
+
## `pack source`
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
plitzi pack source src/runtime.ts --kind runtime --name runtime -o runtime.source.json.gz
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
What `upload plugin` and `runtime push` keep, written to a file to look at: the closure of the entries named, gzipped.
|
|
324
|
+
|
|
325
|
+
|
|
152
326
|
## `login`, `space` and `upload plugin`
|
|
153
327
|
|
|
154
328
|
```bash
|
|
155
329
|
plitzi login # sign in, in your browser
|
|
156
330
|
plitzi space # choose the space to work in, in your browser
|
|
157
|
-
plitzi whoami # who you are signed in as, and the space
|
|
331
|
+
plitzi whoami # who you are signed in as, and the space; --json for a tool
|
|
158
332
|
plitzi upload plugin # the zip pack plugin left, on that space
|
|
159
333
|
plitzi logout # the session revoked on the platform, and forgotten here
|
|
160
334
|
```
|
|
@@ -174,7 +348,8 @@ asked at a terminal). It is checked for its `plugin-manifest.json` before anythi
|
|
|
174
348
|
without a space, the browser opens for what is missing, so the first upload is one command too. It goes on one of the
|
|
175
349
|
space's public buckets — `--bucket <identifier>` (narrowed to one CDN with `--cdn <identifier>`), or asked when there
|
|
176
350
|
are several; a private bucket is refused, since no page could load from it — and is installed, as the builder does when
|
|
177
|
-
a zip is dropped under Resources: added, or the plugin already there moved to the new version with its settings kept.
|
|
351
|
+
a zip is dropped under Resources: added, or the plugin already there moved to the new version with its settings kept. The
|
|
352
|
+
source `pack plugin` wrote beside the zip goes up after it, into the space's private bucket.
|
|
178
353
|
|
|
179
354
|
`--api` (or `PLITZI_API_URL`) points it at another platform, a self-hosted or local one; the CLI trusts the
|
|
180
355
|
certificate authorities the system trusts, as the browser beside it does.
|
|
@@ -183,7 +358,7 @@ certificate authorities the system trusts, as the browser beside it does.
|
|
|
183
358
|
|
|
184
359
|
```bash
|
|
185
360
|
plitzi runtime push # pack src/runtime.ts and keep it as the space's draft runtime
|
|
186
|
-
plitzi runtime status # how each environment's runtime is, and its variables' names
|
|
361
|
+
plitzi runtime status # how each environment's runtime is, and its variables' names; --json
|
|
187
362
|
printf %s "$URL" | plitzi runtime vars set REDIS_URL # a value from stdin stays out of the shell history
|
|
188
363
|
plitzi runtime vars unset REDIS_URL
|
|
189
364
|
plitzi runtime size medium # the size the draft runs at (--environment for a published one)
|
|
@@ -203,7 +378,8 @@ from, and it runs as a server of its own too.
|
|
|
203
378
|
`push` packs the module with the project's own `@plitzi/sdk-server` — the module and every package it imports, bar
|
|
204
379
|
`@plitzi/*` and React, which the platform provides — and sends it to the space `plitzi whoami` names. It becomes the
|
|
205
380
|
draft's runtime, which starts on it; **publishing the space** from the builder takes it to the published site. A
|
|
206
|
-
runtime is part of the plans that carry it; on another, the push is refused and says so.
|
|
381
|
+
runtime is part of the plans that carry it; on another, the push is refused and says so. The source it was
|
|
382
|
+
packed from is kept beside it, and a publish freezes it with the code.
|
|
207
383
|
|
|
208
384
|
**It runs at a size** — small (0.25 CPU, 256 MB), medium (0.5 CPU, 512 MB) or large (1 CPU, 1 GB) — chosen per
|
|
209
385
|
environment among the sizes the space's plan includes. `status` says what each environment runs at and which sizes the
|
|
@@ -213,6 +389,21 @@ plan includes; `size` chooses another, and that runtime starts again at it.
|
|
|
213
389
|
nothing idle, and stays stopped until `start`, the builder, a push or a publish starts it again. `status` says when a
|
|
214
390
|
running one would stop, and why a stopped one is.
|
|
215
391
|
|
|
392
|
+
## `functions`
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
plitzi functions pull # the space's functions into functions/
|
|
396
|
+
plitzi functions push # functions/ saved as the space's draft, built and checked
|
|
397
|
+
plitzi functions try seismic.feed --params '{"minMagnitude":"4"}' # one task of the saved draft, in the sandbox
|
|
398
|
+
plitzi functions dev seismic.feed --params '{}' --watch # on this machine, as the platform runs it
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
A space's own server code — tasks its actions run as steps, routes under `/fn/` — and `functions/` is a working copy
|
|
402
|
+
of it: `.plitzi/functions.json` keeps what was pulled, so `pull` refuses to overwrite what is not pushed (`--force`
|
|
403
|
+
throws it away) and `push` refuses when the space moved on since. A problem comes back as
|
|
404
|
+
`functions/<file>:<line> <message>`. `dev` runs with the project's own `@plitzi/sdk-server` (`isolated-vm` and
|
|
405
|
+
`core-js` beside it); credentials come from `PLITZI_FUNCTIONS_CREDENTIALS`. See `docs/en/functions.md`.
|
|
406
|
+
|
|
216
407
|
## Credentials
|
|
217
408
|
|
|
218
409
|
`create` never mints one. A cloud project's key comes from Credentials in the builder, is written to `.env`, and
|