@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/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 —
@@ -104,7 +115,113 @@ when an install fails the CLI says which setting names it.
104
115
  `eslint-config-prettier` keeping the two from arguing on save. `lint` and `format` are scripts from the first
105
116
  commit, which is the only moment a repository's style is cheap to decide.
106
117
  - **The authoring skill**, in `.claude/skills/`, so an agent working in the project knows how a space is put
107
- 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.
108
225
 
109
226
  ## `pull`
110
227
 
@@ -140,6 +257,18 @@ what the builder shows, and what it is for, and checks every folder is free befo
140
257
 
141
258
  A name that would make a built-in element's type (`button`, `form`) is refused: a space could not tell the two apart.
142
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
+
143
272
  ## `create --plugin`
144
273
 
145
274
  A plugin package: elements any space can load, with a Vite preview to write them in. It builds nothing itself —
@@ -199,7 +328,7 @@ What `upload plugin` and `runtime push` keep, written to a file to look at: the
199
328
  ```bash
200
329
  plitzi login # sign in, in your browser
201
330
  plitzi space # choose the space to work in, in your browser
202
- 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
203
332
  plitzi upload plugin # the zip pack plugin left, on that space
204
333
  plitzi logout # the session revoked on the platform, and forgotten here
205
334
  ```
@@ -229,7 +358,7 @@ certificate authorities the system trusts, as the browser beside it does.
229
358
 
230
359
  ```bash
231
360
  plitzi runtime push # pack src/runtime.ts and keep it as the space's draft runtime
232
- 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
233
362
  printf %s "$URL" | plitzi runtime vars set REDIS_URL # a value from stdin stays out of the shell history
234
363
  plitzi runtime vars unset REDIS_URL
235
364
  plitzi runtime size medium # the size the draft runs at (--environment for a published one)