@poli-page/cli 0.8.2 → 0.10.0
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 +282 -117
- package/dist/api-client.d.ts +101 -111
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +99 -133
- package/dist/api-client.js.map +1 -1
- package/dist/auth.d.ts +10 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +6 -3
- package/dist/auth.js.map +1 -1
- package/dist/cloud-context.d.ts +0 -2
- package/dist/cloud-context.d.ts.map +1 -1
- package/dist/cloud-context.js +2 -25
- package/dist/cloud-context.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +5 -2
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/dev.d.ts +97 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +534 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/documents/get.d.ts +4 -0
- package/dist/commands/documents/get.d.ts.map +1 -1
- package/dist/commands/documents/get.js +3 -5
- package/dist/commands/documents/get.js.map +1 -1
- package/dist/commands/env.d.ts +3 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +227 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/init.d.ts +42 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +152 -18
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/link.d.ts +8 -0
- package/dist/commands/link.d.ts.map +1 -1
- package/dist/commands/link.js +25 -36
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/publish.d.ts +17 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +163 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/render.d.ts +27 -11
- package/dist/commands/render.d.ts.map +1 -1
- package/dist/commands/render.js +128 -60
- package/dist/commands/render.js.map +1 -1
- package/dist/commands/watch.d.ts +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +14 -123
- package/dist/commands/watch.js.map +1 -1
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +15 -3
- package/dist/credentials.js.map +1 -1
- package/dist/dev-page.d.ts +22 -0
- package/dist/dev-page.d.ts.map +1 -0
- package/dist/dev-page.js +280 -0
- package/dist/dev-page.js.map +1 -0
- package/dist/dev-server.d.ts +51 -0
- package/dist/dev-server.d.ts.map +1 -0
- package/dist/dev-server.js +228 -0
- package/dist/dev-server.js.map +1 -0
- package/dist/environment-name.d.ts +8 -0
- package/dist/environment-name.d.ts.map +1 -0
- package/dist/environment-name.js +21 -0
- package/dist/environment-name.js.map +1 -0
- package/dist/exit-codes.d.ts +4 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +14 -10
- package/dist/exit-codes.js.map +1 -1
- package/dist/manifest.d.ts +8 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +28 -2
- package/dist/manifest.js.map +1 -1
- package/dist/manifest.schema.d.ts +0 -2
- package/dist/manifest.schema.d.ts.map +1 -1
- package/dist/manifest.schema.js +1 -15
- package/dist/manifest.schema.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +6 -10
- package/dist/program.js.map +1 -1
- package/dist/project-files.d.ts +11 -0
- package/dist/project-files.d.ts.map +1 -0
- package/dist/project-files.js +57 -0
- package/dist/project-files.js.map +1 -0
- package/dist/project-sync.d.ts +50 -0
- package/dist/project-sync.d.ts.map +1 -0
- package/dist/project-sync.js +118 -0
- package/dist/project-sync.js.map +1 -0
- package/dist/sync-engine.d.ts +3 -3
- package/dist/sync-engine.d.ts.map +1 -1
- package/dist/sync-engine.js +4 -3
- package/dist/sync-engine.js.map +1 -1
- package/dist/template-importer.d.ts +15 -0
- package/dist/template-importer.d.ts.map +1 -1
- package/dist/template-importer.js +44 -0
- package/dist/template-importer.js.map +1 -1
- package/dist/template-prompt.d.ts +8 -0
- package/dist/template-prompt.d.ts.map +1 -1
- package/dist/template-prompt.js +4 -4
- package/dist/template-prompt.js.map +1 -1
- package/package.json +3 -3
- package/dist/commands/checkout.d.ts +0 -15
- package/dist/commands/checkout.d.ts.map +0 -1
- package/dist/commands/checkout.js +0 -145
- package/dist/commands/checkout.js.map +0 -1
- package/dist/commands/preview.d.ts +0 -30
- package/dist/commands/preview.d.ts.map +0 -1
- package/dist/commands/preview.js +0 -129
- package/dist/commands/preview.js.map +0 -1
- package/dist/commands/push.d.ts +0 -26
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -139
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/version-state.d.ts +0 -35
- package/dist/commands/version-state.d.ts.map +0 -1
- package/dist/commands/version-state.js +0 -179
- package/dist/commands/version-state.js.map +0 -1
- package/dist/commands/versions.d.ts +0 -19
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js +0 -120
- package/dist/commands/versions.js.map +0 -1
package/README.md
CHANGED
|
@@ -17,7 +17,8 @@ Command-line tool for [Poli Page](https://poli.page) — scaffold projects, mana
|
|
|
17
17
|
- [Project lifecycle](#project-lifecycle)
|
|
18
18
|
- [Authentication commands](#authentication-commands)
|
|
19
19
|
- [Cloud sync](#cloud-sync)
|
|
20
|
-
- [
|
|
20
|
+
- [Live development](#live-development)
|
|
21
|
+
- [Environments](#environments)
|
|
21
22
|
- [Render](#render)
|
|
22
23
|
- [Documents](#documents)
|
|
23
24
|
- [Manifest format](#manifest-format)
|
|
@@ -65,24 +66,27 @@ poli new invoice --from-template showcase/invoice
|
|
|
65
66
|
# 4. Link the project to your organization (writes the cloud manifest)
|
|
66
67
|
poli link
|
|
67
68
|
|
|
68
|
-
# 5. Render
|
|
69
|
+
# 5. Render the draft (the files `poli link` uploaded) to a PDF
|
|
69
70
|
poli render invoice -o invoice.pdf
|
|
70
71
|
|
|
71
|
-
# 6.
|
|
72
|
-
poli
|
|
72
|
+
# 6. Publish the project to the sandbox environment
|
|
73
|
+
poli publish --env sandbox
|
|
73
74
|
|
|
74
|
-
# 7.
|
|
75
|
-
poli
|
|
76
|
-
poli promote 1.0.0
|
|
75
|
+
# 7. Publish it to live when ready
|
|
76
|
+
poli publish --env live -m "First release"
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
To iterate on a template with live feedback against the cloud:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
poli
|
|
83
|
-
# edit
|
|
82
|
+
poli dev
|
|
83
|
+
# opens http://127.0.0.1:7654 — edit a template, save, and the browser
|
|
84
|
+
# reloads the freshly rendered PDF of your draft
|
|
84
85
|
```
|
|
85
86
|
|
|
87
|
+
`poli dev` is the code-first alternative to the desktop editor. If you only want
|
|
88
|
+
the sync half, without a browser, use `poli watch`.
|
|
89
|
+
|
|
86
90
|
---
|
|
87
91
|
|
|
88
92
|
## Authentication
|
|
@@ -101,20 +105,29 @@ After `poli login`, the session token is stored at `~/.polipage/credentials.json
|
|
|
101
105
|
|
|
102
106
|
### Programmatic (CI / CD / scripts)
|
|
103
107
|
|
|
104
|
-
Set the `POLI_PAGE_API_KEY` environment variable.
|
|
108
|
+
Set the `POLI_PAGE_API_KEY` environment variable. Every key is bound to one environment and carries its name: `pp_<environment>_` followed by 32 lowercase hex characters. The CLI checks the whole key before any call.
|
|
109
|
+
|
|
110
|
+
| Key | Renders |
|
|
111
|
+
| ----------------------- | ---------------------------------------------------------------- |
|
|
112
|
+
| `pp_sandbox_…` | `name@sandbox` — free, watermarked, not counted |
|
|
113
|
+
| `pp_live_…` | `name@live` — counted in the monthly quota |
|
|
114
|
+
| `pp_<environment>_…` | `name@<environment>` — counted in the monthly quota |
|
|
105
115
|
|
|
106
|
-
|
|
107
|
-
| ----------- | ----------------------------------------------------------------- |
|
|
108
|
-
| `pp_test_*` | Sandbox renders (unmetered, no quota) |
|
|
109
|
-
| `pp_live_*` | Live renders (counts in the monthly quota, billable) |
|
|
110
|
-
| `pp_sa_*` | Service account — recommended for CI; rotates without breaking dev|
|
|
116
|
+
A key renders only its own environment, and never the draft: the draft (`poli render name`) needs `poli login`.
|
|
111
117
|
|
|
112
118
|
```bash
|
|
113
|
-
export POLI_PAGE_API_KEY=
|
|
114
|
-
poli render invoice -o invoice.pdf
|
|
115
|
-
poli
|
|
119
|
+
export POLI_PAGE_API_KEY=pp_live_xxx
|
|
120
|
+
poli render invoice@live -o invoice.pdf
|
|
121
|
+
poli publish --env live -m "Release from CI" # service key only
|
|
116
122
|
```
|
|
117
123
|
|
|
124
|
+
Standard keys and service keys share the `pp_<environment>_…` format; the CLI asks `GET /v1/me` which one it holds:
|
|
125
|
+
|
|
126
|
+
- a **standard key** renders only. `poli publish` refuses it before any upload (exit `5`).
|
|
127
|
+
- a **service key** (recommended for CI) also publishes, into its own environment only: `--env` is still required and must name the environment in the key (exit `2` otherwise). Its role decides on a protected environment: an `admin` service key can publish to one, a `developer` one gets `ENVIRONMENT_PROTECTED` (exit `5`). Nothing prompts.
|
|
128
|
+
|
|
129
|
+
The other workspace commands (`link`, `watch`, `dev`) need `poli login`.
|
|
130
|
+
|
|
118
131
|
### Precedence
|
|
119
132
|
|
|
120
133
|
When **both** `~/.polipage/credentials.json` (a session) and `POLI_PAGE_API_KEY` are set, **the session wins**. `poli login` does not refuse if the env var is set — it shows an info-message and proceeds, after which the new session takes precedence.
|
|
@@ -125,11 +138,11 @@ This means a developer can keep `POLI_PAGE_API_KEY` set in `.zshrc` for occasion
|
|
|
125
138
|
|
|
126
139
|
## Commands
|
|
127
140
|
|
|
128
|
-
|
|
141
|
+
17 commands grouped by category.
|
|
129
142
|
|
|
130
143
|
### Project lifecycle
|
|
131
144
|
|
|
132
|
-
#### `poli init <name>`
|
|
145
|
+
#### `poli init <name>` / `poli init --starter <name> [dir]`
|
|
133
146
|
|
|
134
147
|
Scaffold a new Poli Page project. Creates the directory, the `poli-page.json` manifest, `templates/`, `partials/`, `assets/{fonts,images}/`, `tailwind.css`, and `.gitignore`.
|
|
135
148
|
|
|
@@ -149,6 +162,31 @@ Flags:
|
|
|
149
162
|
- `--source <repo>` — source repo, format `github:<owner>/<repo>` (default: `github:poli-page/templates`)
|
|
150
163
|
- `--no-cache` — bypass the 24-hour template cache
|
|
151
164
|
|
|
165
|
+
##### `--starter getting-started` — start from your org's getting-started project
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
poli init --starter getting-started # writes ./getting-started
|
|
169
|
+
poli init --starter getting-started my-start # writes ./my-start
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Writes the whole `getting-started/` project of [`poli-page/templates`](https://github.com/poli-page/templates) (templates, mocks, `poli-page.json`, `tailwind.css`, fonts and images) into `dir` (default: `./getting-started`). The files come from the public templates repo — the same source your org's `getting-started` project was created from — nothing is downloaded from the cloud.
|
|
173
|
+
|
|
174
|
+
When you are logged in, the folder is linked to the **existing** `getting-started` project of your organization (it never creates a cloud project). If you belong to several organizations, pass `--org <slug>` (or pick one at the prompt). Logged out, or when the organization has no `getting-started` project, the starter is written unlinked and the command tells you how to link it (`poli login`, then `poli link`).
|
|
175
|
+
|
|
176
|
+
A non-empty target directory is refused unless you pass `--force`. Then:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
cd getting-started
|
|
180
|
+
poli watch # live sync of your edits to the cloud draft
|
|
181
|
+
poli publish --env sandbox # publish the project to the sandbox environment
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
and re-run the dashboard snippet to see your change.
|
|
185
|
+
|
|
186
|
+
Piped, or with `--json`, it prints `{ starter, projectDir, link }` as JSON instead (`link` is `{ status: "linked", orgSlug }` or `{ status: "unlinked", reason }`) and never prompts. `<name>` is one top-level folder of the source (no `/`).
|
|
187
|
+
|
|
188
|
+
Flags: `--starter <name>`, `--org <slug>`, `--force`, `--json`, plus `--source` and `--no-cache` as above.
|
|
189
|
+
|
|
152
190
|
#### `poli new <name>`
|
|
153
191
|
|
|
154
192
|
Create a new template inside an existing project from a remote starter.
|
|
@@ -184,7 +222,7 @@ Displays the active identity and organization. Calls `GET /v1/me` over hybrid au
|
|
|
184
222
|
```bash
|
|
185
223
|
# Inside a linked project (session)
|
|
186
224
|
$ poli whoami
|
|
187
|
-
xavier@example.com @ acme (session)
|
|
225
|
+
xavier@example.com @ acme (session, role=owner)
|
|
188
226
|
|
|
189
227
|
# Anywhere — fallback when no project is linked, lists the orgs the session can see
|
|
190
228
|
$ poli whoami
|
|
@@ -194,6 +232,10 @@ xavier@example.com (session, 2 organizations: acme, demo-corp)
|
|
|
194
232
|
# Programmatic (API key)
|
|
195
233
|
$ POLI_PAGE_API_KEY=pp_live_xxx poli whoami
|
|
196
234
|
pp_live_xxx…abcd @ acme (api-key, environment=live)
|
|
235
|
+
|
|
236
|
+
# A service key also shows its role (a session shows the member's role)
|
|
237
|
+
$ POLI_PAGE_API_KEY=pp_staging_xxx poli whoami
|
|
238
|
+
pp_staging_xxx…abcd @ acme (api-key, environment=staging, role=admin)
|
|
197
239
|
```
|
|
198
240
|
|
|
199
241
|
Flag: `--json` to dump the raw `/v1/me` payload (or, in `session-no-org` mode, `{ mode, user, orgs }`).
|
|
@@ -210,7 +252,7 @@ Removes the `cloud:` section from `poli-page.json`. Local files are preserved.
|
|
|
210
252
|
|
|
211
253
|
#### `poli watch`
|
|
212
254
|
|
|
213
|
-
Auto-syncs the local project to the cloud draft on every save. Debounce 2s. Each batch sends only the SHA-256 delta via `PATCH /api/organizations/:orgId/projects/:projectId/files`.
|
|
255
|
+
Auto-syncs the local project to the cloud draft on every save. Debounce 2s. Each batch sends only the SHA-256 delta via `PATCH /api/organizations/:orgId/projects/:projectId/files`. It syncs the same file set as [`poli publish`](#poli-publish), each file with its encoding (`base64` for assets, `utf8` otherwise); other files are not tracked.
|
|
214
256
|
|
|
215
257
|
```bash
|
|
216
258
|
poli watch
|
|
@@ -220,143 +262,214 @@ Resilience built in:
|
|
|
220
262
|
|
|
221
263
|
- Network errors → exponential backoff (1s, 2s, 4s, 8s, 16s, 30s capped, reset on success)
|
|
222
264
|
- `503 ORGANIZATION_MIGRATING` → 5-second retry
|
|
223
|
-
- `403 SYSTEM_PROJECT_LOCKED` (the `getting-started` system project) → friendly error + exit
|
|
224
265
|
- Other API errors → logged, watch continues, next save retries
|
|
225
266
|
|
|
226
|
-
Requires a TTY. Refused with exit `2` when run in a non-interactive context.
|
|
267
|
+
Requires a TTY. Refused with exit `2` when run in a non-interactive context. If
|
|
268
|
+
you need the same sync inside a script or alongside a browser preview, use
|
|
269
|
+
[`poli dev`](#poli-dev-template), which has no TTY requirement.
|
|
270
|
+
|
|
271
|
+
### Live development
|
|
227
272
|
|
|
228
|
-
#### `poli
|
|
273
|
+
#### `poli dev [template]`
|
|
229
274
|
|
|
230
|
-
|
|
275
|
+
Live PDF preview server for template authors. On every save it syncs the
|
|
276
|
+
project to the cloud draft, renders the active template's draft to PDF through
|
|
277
|
+
`POST /v1/render/draft` with your signed-in session, and pushes a reload to every
|
|
278
|
+
connected browser over Server-Sent Events — no polling, no fixed delay. Draft
|
|
279
|
+
renders are session-only: they carry no watermark, are never stored as a
|
|
280
|
+
document, and are not counted. `POLI_PAGE_API_KEY` plays no part: an API key
|
|
281
|
+
cannot render the draft.
|
|
231
282
|
|
|
232
283
|
```bash
|
|
233
|
-
poli
|
|
284
|
+
poli dev # first template in the manifest
|
|
285
|
+
poli dev invoice # start on a specific template
|
|
286
|
+
poli dev --port 8123 # pick the port
|
|
287
|
+
poli dev --no-open # don't launch a browser
|
|
288
|
+
poli dev -d ./big.json # render every template against your own data
|
|
234
289
|
```
|
|
235
290
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
291
|
+
| Flag | Default | Meaning |
|
|
292
|
+
| -------------------- | ------------------ | ---------------------------------------------------------- |
|
|
293
|
+
| `-p, --port <n>` | `7654` | Port to bind on `127.0.0.1`. Walks upwards when it is busy. |
|
|
294
|
+
| `-d, --data <path>` | the template mock | JSON data file, same shape as `poli render -d`. |
|
|
295
|
+
| `--no-open` | opens the browser | Skip launching a browser on start. |
|
|
296
|
+
| `[template]` | first in manifest | Which template to show first. |
|
|
297
|
+
|
|
298
|
+
The served page gives you:
|
|
299
|
+
|
|
300
|
+
- **A template switcher.** By default the view *follows the most recently
|
|
301
|
+
changed template*: a save under `templates/<name>/` makes `<name>` the active
|
|
302
|
+
one. When a batch touches several templates, the one with the newest mtime
|
|
303
|
+
wins. A change to a file that no single template owns — a shared partial,
|
|
304
|
+
`tailwind.css`, an asset, or `poli-page.json` — belongs to all of them and so
|
|
305
|
+
moves nothing: the current template stays on screen and is re-rendered.
|
|
306
|
+
- **A pin.** Click *Pin* to freeze the view on the current template so an
|
|
307
|
+
unrelated save cannot yank you away. Unpin to follow again.
|
|
308
|
+
- **The real PDF.** Every render is the actual PDF of the draft — pagination,
|
|
309
|
+
page breaks, fonts — shown in the browser's PDF viewer and reloaded after each
|
|
310
|
+
successful sync. There is no separate HTML preview mode.
|
|
311
|
+
- **An error overlay.** A failed compile or render is shown with its message
|
|
312
|
+
(and `file:line:column` when the engine reports a position) on top of the last
|
|
313
|
+
good PDF, which stays visible behind it. A render error clears on the next
|
|
314
|
+
successful render; a failed sync stays shown until a sync succeeds, even when
|
|
315
|
+
a render succeeds in between (the cloud draft is still out of date).
|
|
316
|
+
|
|
317
|
+
Notes:
|
|
318
|
+
|
|
319
|
+
- **No TTY required.** Unlike `poli watch`, `poli dev` is a server and runs
|
|
320
|
+
happily with its stdout piped, so you can compose it into your own dev script:
|
|
321
|
+
|
|
322
|
+
```json
|
|
323
|
+
{ "scripts": { "dev": "concurrently \"poli dev --no-open\" \"vite\"" } }
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
- It binds to `127.0.0.1` only — the rendered draft is never exposed to the
|
|
327
|
+
local network.
|
|
328
|
+
- On start it pushes the whole working tree to the draft, so the first render
|
|
329
|
+
reflects your local files rather than whatever the draft last contained.
|
|
330
|
+
- Failures are surfaced, not fatal: a render that errors, a rejected sync, a
|
|
331
|
+
broken `poli-page.json`, or a dropped connection leave the server up and the
|
|
332
|
+
page serving.
|
|
333
|
+
- `Ctrl-C` (or `SIGTERM`) closes the watcher, every SSE connection, and the
|
|
334
|
+
port.
|
|
335
|
+
|
|
336
|
+
### Environments
|
|
337
|
+
|
|
338
|
+
#### `poli publish`
|
|
339
|
+
|
|
340
|
+
Publishes the local project, the files on disk, to an environment of your organization: `POST /v1/projects/<projectSlug>/publish`, with your `poli login` session and the manifest's `cloud.orgId`, or, without a session, with a service key in `POLI_PAGE_API_KEY` (see below). The environment's copy of the project is replaced in place. There is no rollback: to go back, check out the earlier state from your own version control and publish again.
|
|
241
341
|
|
|
242
|
-
|
|
342
|
+
```bash
|
|
343
|
+
poli publish --env sandbox
|
|
344
|
+
poli publish --env live -m "Invoice footer fix"
|
|
345
|
+
poli publish --env live --yes # protected environment, no prompt (scripts)
|
|
346
|
+
```
|
|
243
347
|
|
|
244
|
-
|
|
348
|
+
| Flag | Meaning |
|
|
349
|
+
| ---------------------- | ----------------------------------------------------------------------------------------- |
|
|
350
|
+
| `--env <name>` | Required. The target environment; there is no default, and `draft` is not an environment. |
|
|
351
|
+
| `-m, --message <text>` | Kept in the publish log with the date, author and bundle hash. 500 characters at most. |
|
|
352
|
+
| `-y, --yes` | Publish to a protected environment without the confirmation prompt. |
|
|
353
|
+
| `--json` | Print the API response as JSON (also the default when stdout is not a TTY). |
|
|
245
354
|
|
|
246
|
-
-
|
|
247
|
-
-
|
|
355
|
+
- **Environment names** are 1-20 characters: lowercase letters, digits and single inner hyphens, starting with a letter. A name that breaks this rule is refused before any call (exit `2`). An environment that does not exist in the organization is refused with the list of the ones that do (exit `2`).
|
|
356
|
+
- **The bundle** is the project file set: `poli-page.json`, `tailwind.css`, the `.html`, `.json` and `.css` files under `templates/<slug>/`, the `.html` files under `partials/`, everything under `assets/images/` and `assets/icons/`, and the `.woff2`, `.woff`, `.ttf` and `.otf` files under `assets/fonts/`. Anything else (`.gitignore`, `README.md`, `output/`, `node_modules/`) is left out. Assets are sent base64-encoded, every other file as UTF-8. A bundle over 5 MiB, or a message over 500 characters, is refused before any call (exit `2`).
|
|
357
|
+
- **Protected environments** (`live` by default) accept a publish from an owner or an admin only. In a terminal, `poli publish` asks for confirmation first; without a TTY it needs `--yes`, and `CI=true` counts as `--yes`. Without the role, the API refuses with `ENVIRONMENT_PROTECTED` (exit `5`).
|
|
358
|
+
- **With a service key** (`POLI_PAGE_API_KEY` and no `poli login` session; a session wins when both are there): the CLI calls `GET /v1/me`, then publishes to the manifest's `cloud.projectSlug` with no organization header, since the key carries its organization. `--env` must name the key's own environment, or the publish is refused before any upload, naming it (exit `2`). A standard key is refused with "Standard API keys can only render. Use a service key or `poli login`." (exit `5`). There is no prompt and no environment check on the CLI side: the API applies the protected-environment rule, and a service key without the `admin` role gets `ENVIRONMENT_PROTECTED` (exit `5`).
|
|
359
|
+
- **One publish at a time** per project and environment: while one runs, a second gets `PUBLISH_IN_PROGRESS` (exit `3`). It is not retried; run it again once the first one is done.
|
|
248
360
|
|
|
249
|
-
|
|
250
|
-
poli push --message "Tweaked invoice header" # patch (default), anchored on cloud.track
|
|
251
|
-
poli push --major --message "BREAKING: new schema" # ignores track, picks max(major)+1
|
|
252
|
-
poli push --minor
|
|
253
|
-
poli push 1.0.2 # explicit version (no track logic)
|
|
254
|
-
poli push --track 1.0 --patch # override the manifest track (CI)
|
|
255
|
-
```
|
|
361
|
+
On success it prints the environment, the project, the short bundle hash, the file count and the publish log id.
|
|
256
362
|
|
|
257
|
-
|
|
363
|
+
#### `poli env list`
|
|
258
364
|
|
|
259
|
-
|
|
365
|
+
Lists your organization's environments, with your `poli login` session (any member of the organization can run it).
|
|
260
366
|
|
|
261
367
|
```bash
|
|
262
|
-
poli
|
|
263
|
-
#
|
|
264
|
-
poli
|
|
265
|
-
poli promote 1.0.2
|
|
368
|
+
poli env list # in a linked folder: the project's state in each environment
|
|
369
|
+
poli env list --org acme # elsewhere, or for another organization
|
|
370
|
+
poli env list --json
|
|
266
371
|
```
|
|
267
372
|
|
|
268
|
-
|
|
373
|
+
| Flag | Meaning |
|
|
374
|
+
| -------------- | ------------------------------------------------------------------------------------------- |
|
|
375
|
+
| `--org <slug>` | The organization to list. Default: the linked project's organization, else your only one. |
|
|
376
|
+
| `--json` | Print the API response as JSON (also the default when stdout is not a TTY). |
|
|
269
377
|
|
|
270
|
-
|
|
378
|
+
In a linked folder, each environment shows whether it is protected and read-only, whether the project is published there, and the project's last publish in it: its status (`succeeded`, `in-progress`, or `failed` with the API's error code), its date (UTC), its author, its short bundle hash and its message, or `not published`. The last publish is the latest attempt, so a failed one shows even when an earlier publish is still the one served.
|
|
271
379
|
|
|
272
|
-
Display all versions of the linked project with their state badges.
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
STATE VERSION PUSHED MESSAGE
|
|
276
|
-
LIVE 2.0.0 3 days ago Major redesign
|
|
277
|
-
LIVE 1.0.5 1 week ago Hotfix URSSAF
|
|
278
|
-
SANDBOX 1.1.0 2 hours ago
|
|
279
|
-
DEPRECATED 1.0.2 3 weeks ago
|
|
280
380
|
```
|
|
381
|
+
Environments of acme, project invoices:
|
|
281
382
|
|
|
282
|
-
|
|
383
|
+
ENVIRONMENT PROTECTED READ-ONLY PUBLISHED LAST PUBLISH
|
|
384
|
+
sandbox no no yes succeeded 2026-10-26 10:00 UTC Ada Lovelace 0123456789ab Invoice footer fix
|
|
385
|
+
live yes no no not published
|
|
386
|
+
```
|
|
283
387
|
|
|
284
|
-
|
|
388
|
+
Outside a linked folder, or with `--org` naming another organization, it lists the organization's environments with their protected and read-only flags and how many projects are published in each (`PROJECTS`). When you belong to several organizations and no project is linked, `--org` is required: without it the command exits `2` and lists your organizations' slugs. An environment is read-only when the organization's plan no longer covers it.
|
|
285
389
|
|
|
286
|
-
#### `poli
|
|
390
|
+
#### `poli env remove-project <environment>`
|
|
287
391
|
|
|
288
|
-
|
|
392
|
+
Removes the linked project from an environment: the environment's copy of the project is deleted, and the documents rendered from it are kept. The draft and the other environments are untouched, nothing is written to the publish log, and renders of the project in that environment then get `PROJECT_NOT_IN_ENVIRONMENT` until a later `poli publish --env <environment>` adds it back. Only an owner or an admin of the organization can do it, in every environment.
|
|
289
393
|
|
|
290
394
|
```bash
|
|
291
|
-
poli
|
|
292
|
-
poli
|
|
395
|
+
poli env remove-project staging # asks you to type the project slug
|
|
396
|
+
poli env remove-project staging --yes # scripts: no prompt
|
|
293
397
|
```
|
|
294
398
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
#### `poli versions un-deprecate <version>`
|
|
399
|
+
| Flag | Meaning |
|
|
400
|
+
| ----------- | ---------------------------------------------------------------------------------- |
|
|
401
|
+
| `-y, --yes` | Remove without typing the project slug to confirm. |
|
|
402
|
+
| `--json` | Print `{ org, project, environment }` (also the default when stdout is not a TTY). |
|
|
300
403
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
#### `poli versions download <version> [-o <dir>]`
|
|
304
|
-
|
|
305
|
-
Download a published version's content to a local directory (read-only inspection or hotfix base).
|
|
404
|
+
- **Confirmation.** In a terminal, you type the project slug (`cloud.projectSlug` in `poli-page.json`); anything else aborts and nothing is sent. Without a TTY the command needs `--yes` and otherwise exits `2`; `CI=true` does not stand in for `--yes` here.
|
|
405
|
+
- **Errors.** A developer gets `INSUFFICIENT_ROLE` (exit `5`, owner or admin required). A project that is not published in the environment (`PROJECT_NOT_IN_ENVIRONMENT`) or an environment the organization does not have (`ENVIRONMENT_NOT_FOUND`) exits `2`. While a publish or another removal of the same project and environment runs (`PUBLISH_IN_PROGRESS`), while the project is being transferred (`TRANSFER_IN_PROGRESS`), or when the environment is read-only (`ENVIRONMENT_READ_ONLY`), it exits `3`.
|
|
306
406
|
|
|
307
407
|
### Render
|
|
308
408
|
|
|
309
409
|
#### `poli render <spec>`
|
|
310
410
|
|
|
311
|
-
Render a template against the cloud engine. The `<spec>` is either the bare template `name` (
|
|
411
|
+
Render a template against the cloud engine. The `<spec>` is either the bare template `name` (the draft) or `name@<environment>` (what is published in that environment).
|
|
412
|
+
|
|
413
|
+
- **The draft** (`name`, or `name@draft`) renders through `POST /v1/render/draft` and needs a `poli login` session: an API key never renders the draft. The API answers the PDF itself, which the CLI writes locally. Nothing is stored, watermarked or counted, so there is no document and `--no-download` is refused.
|
|
414
|
+
- **An environment** (`name@<environment>`) renders through `POST /v1/render` with `environment: <environment>`. Every such render produces a stored document (api-spec §11.3): the CLI receives a JSON descriptor (`documentId`, `presignedPdfUrl`, `expiresAt`, `environment`, `diagnostics`, …), then fetches the URL and writes the PDF locally; pass `--no-download` to skip that step. With an API key, the environment must be the key's own; another one is refused before any call, naming the key's environment.
|
|
312
415
|
|
|
313
416
|
```bash
|
|
314
|
-
poli render invoice #
|
|
315
|
-
poli render invoice@
|
|
316
|
-
poli render invoice@
|
|
417
|
+
poli render invoice # the draft (session), downloads PDF
|
|
418
|
+
poli render invoice@sandbox # what is published in sandbox
|
|
419
|
+
poli render invoice@production --data ./mock.json # an environment + custom data
|
|
317
420
|
poli render invoice -o ./out/invoice.pdf # custom path
|
|
318
|
-
poli render invoice --no-download
|
|
421
|
+
poli render invoice@sandbox --no-download # JSON descriptor only
|
|
319
422
|
```
|
|
320
423
|
|
|
321
424
|
Spec rules:
|
|
322
425
|
|
|
323
426
|
- `name` → renders the draft (equivalent to `name@draft`).
|
|
324
|
-
- `name@<
|
|
427
|
+
- `name@<environment>` → an environment name: 1-20 characters, lowercase letters, digits and single inner hyphens, starting with a letter. `draft` is not an environment name: `name@draft` means the draft. Versions are gone: `name@1.2.3` and `name@latest` are refused with a pointer to `name@<environment>` (exit code `2`).
|
|
325
428
|
|
|
326
429
|
Flags:
|
|
327
430
|
|
|
328
431
|
- `--data <file>` — JSON data overrides the mock
|
|
329
432
|
- `-o <file>` — output PDF path. Incompatible with `--no-download`
|
|
330
|
-
- `--no-download` — skip the presigned URL fetch (CI/CD pipelines)
|
|
433
|
+
- `--no-download` — skip the presigned URL fetch (CI/CD pipelines). Environment renders only
|
|
331
434
|
- `--json` — force JSON output even in a TTY
|
|
332
435
|
|
|
436
|
+
With `--json` (or piped), an environment render prints the API descriptor plus `outputPath`; a draft render, which has no descriptor, prints `{ "template", "environment": "draft", "outputPath" }`.
|
|
437
|
+
|
|
438
|
+
Errors:
|
|
439
|
+
|
|
440
|
+
- `404 PROJECT_NOT_IN_ENVIRONMENT` — the project was never published there: run `poli publish --env <environment>`. Exit code `2`.
|
|
441
|
+
- `404 ENVIRONMENT_NOT_FOUND` / `404 TEMPLATE_NOT_FOUND` — the environment does not exist, or the published copy has no such template. Exit code `2`.
|
|
442
|
+
- `503 PUBLISH_IN_PROGRESS` — a publish of that project and environment is running: the CLI waits `Retry-After` and retries once, then exits `3`.
|
|
443
|
+
|
|
333
444
|
[Output rules](#output-conventions) apply: in a TTY you see only the `✓` line, in a pipe you see only the JSON descriptor, with `--json` you always see the JSON. Pipelines stay clean:
|
|
334
445
|
|
|
335
446
|
```bash
|
|
336
|
-
$ DOC_ID=$(poli render invoice | jq -r '.documentId')
|
|
447
|
+
$ DOC_ID=$(poli render invoice@sandbox | jq -r '.documentId')
|
|
337
448
|
$ poli documents thumbnails "$DOC_ID" --width 400
|
|
338
449
|
```
|
|
339
450
|
|
|
340
|
-
|
|
451
|
+
The success line (TTY) names what was rendered, and says `billed` when the render counts:
|
|
341
452
|
|
|
342
453
|
```
|
|
343
|
-
✓ Rendered invoice
|
|
344
|
-
✓ Rendered invoice
|
|
454
|
+
✓ Rendered invoice@production (billed) → ./output/invoice/a4-portrait/invoice.pdf
|
|
455
|
+
✓ Rendered invoice@sandbox → ./output/invoice/a4-portrait/invoice.pdf
|
|
456
|
+
✓ Rendered invoice@draft → ./output/invoice/a4-portrait/invoice.pdf
|
|
345
457
|
```
|
|
346
458
|
|
|
347
459
|
Counter:
|
|
348
|
-
-
|
|
349
|
-
- `
|
|
460
|
+
- the draft → never counted
|
|
461
|
+
- `sandbox` → free, never counted (and the only watermarked environment)
|
|
462
|
+
- every other environment → counts in the monthly quota
|
|
350
463
|
|
|
351
464
|
### Documents
|
|
352
465
|
|
|
353
|
-
Documents are the cloud-stored output of every `poli render
|
|
466
|
+
Documents are the cloud-stored output of every `poli render name@<environment>` invocation (or the same render endpoints called via the SDK or REST API); a draft render (`poli render name`) is never stored. The CLI lets you inspect, delete, and re-derive thumbnails or preview HTML from them.
|
|
354
467
|
|
|
355
468
|
There is intentionally **no `poli documents list`** — your application is responsible for tracking the `documentId` values it cares about.
|
|
356
469
|
|
|
357
470
|
#### `poli documents get <id>`
|
|
358
471
|
|
|
359
|
-
Returns the document JSON descriptor —
|
|
472
|
+
Returns the document JSON descriptor — the shape `poli render name@<environment>` prints, without the render's `diagnostics`. The summary shows the environment the document was rendered in. Output rules: in a TTY you see only the human-readable summary; in a pipe you see only the JSON descriptor; `--json` forces JSON. The CLI never downloads the PDF — `curl` the `presignedPdfUrl` or hand it to the browser yourself.
|
|
360
473
|
|
|
361
474
|
```bash
|
|
362
475
|
poli documents get doc_abc123
|
|
@@ -398,8 +511,7 @@ poli documents preview doc_abc123 -o ./preview.html
|
|
|
398
511
|
```jsonc
|
|
399
512
|
{
|
|
400
513
|
"project": {
|
|
401
|
-
"name": "my-invoices"
|
|
402
|
-
"version": "1.0.0"
|
|
514
|
+
"name": "my-invoices"
|
|
403
515
|
},
|
|
404
516
|
"fonts": [
|
|
405
517
|
{
|
|
@@ -428,6 +540,8 @@ poli documents preview doc_abc123 -o ./preview.html
|
|
|
428
540
|
|
|
429
541
|
The `cloud:` block is written by `poli link`, removed by `poli unlink`. **No API keys here** — the credentials file (or `POLI_PAGE_API_KEY`) carries the secret.
|
|
430
542
|
|
|
543
|
+
A manifest from before environments may still carry `project.version` or `cloud.track`. Both are ignored, and dropped the next time the CLI writes the file (`poli link`, `poli unlink`, `poli new`).
|
|
544
|
+
|
|
431
545
|
---
|
|
432
546
|
|
|
433
547
|
## Configuration
|
|
@@ -436,11 +550,10 @@ The `cloud:` block is written by `poli link`, removed by `poli unlink`. **No API
|
|
|
436
550
|
|
|
437
551
|
| Variable | Effect |
|
|
438
552
|
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
439
|
-
| `POLI_PAGE_API_KEY` | Single env var for any API key in CI/CD.
|
|
553
|
+
| `POLI_PAGE_API_KEY` | Single env var for any API key in CI/CD: `pp_<environment>_` followed by 32 lowercase hex characters, checked in full before any call. The key renders only its own environment; a service key also publishes to it. **Precedence**: when a credentials file is also present, the session wins. |
|
|
440
554
|
| `POLI_API_URL` | Override the API base URL (precedence: `--api-url` flag → `POLI_API_URL` → `poli-page.json` `cloud.apiUrl` → `~/.polipage/credentials.json` `apiUrl` → default `https://api.poli.page`). |
|
|
441
|
-
| `POLI_PAGE_ENV` | Default render env (`sandbox` or `live`) when commands accept an env hint. |
|
|
442
555
|
| `NO_COLOR` | Disable ANSI colors (Unix standard). |
|
|
443
|
-
| `CI` | Auto-detected; equivalent to a global `--yes`.
|
|
556
|
+
| `CI` | Auto-detected; equivalent to a global `--yes`, except for `poli env remove-project`. |
|
|
444
557
|
|
|
445
558
|
### Common flags
|
|
446
559
|
|
|
@@ -451,7 +564,7 @@ The `cloud:` block is written by `poli link`, removed by `poli unlink`. **No API
|
|
|
451
564
|
|
|
452
565
|
### Output conventions
|
|
453
566
|
|
|
454
|
-
Every command that returns a payload (renders, descriptors,
|
|
567
|
+
Every command that returns a payload (renders, descriptors, publishes) follows the same output rule:
|
|
455
568
|
|
|
456
569
|
| Context | Stdout |
|
|
457
570
|
| ------- | ------ |
|
|
@@ -461,9 +574,9 @@ Every command that returns a payload (renders, descriptors, lists, version mutat
|
|
|
461
574
|
|
|
462
575
|
Either the summary **or** the JSON — never both at once. Errors always go to stderr with a clear message.
|
|
463
576
|
|
|
464
|
-
Commands that take this contract: `render`, `documents get`, `documents preview`, `documents thumbnails`, `whoami`, `
|
|
577
|
+
Commands that take this contract: `render`, `documents get`, `documents preview`, `documents thumbnails`, `whoami`, `publish`, `env list`, `env remove-project`, `init --starter`.
|
|
465
578
|
|
|
466
|
-
Imperative commands (`init`, `new`, `link`, `unlink`, `
|
|
579
|
+
Imperative commands (`init` without `--starter`, `new`, `link`, `unlink`, `logout`, `documents delete`, `watch`, `login`) don't have a JSON payload to forward — they just acknowledge with a `✓` line on success.
|
|
467
580
|
|
|
468
581
|
---
|
|
469
582
|
|
|
@@ -471,12 +584,12 @@ Imperative commands (`init`, `new`, `link`, `unlink`, `checkout`, `logout`, `doc
|
|
|
471
584
|
|
|
472
585
|
| Code | Meaning |
|
|
473
586
|
| ---- | ------------------------------------------------------------------------------------------------------ |
|
|
474
|
-
| `0` | Success
|
|
475
|
-
| `1` | Recoverable inconsistency (already logged in, already linked
|
|
476
|
-
| `2` | Invalid usage (bad args, template not found,
|
|
587
|
+
| `0` | Success |
|
|
588
|
+
| `1` | Recoverable inconsistency (already logged in, already linked) |
|
|
589
|
+
| `2` | Invalid usage (bad args, template not found, project not published in that environment, non-TTY context where TTY is required) |
|
|
477
590
|
| `3` | Network / API error (timeout, 5xx, unspecified 4xx) |
|
|
478
591
|
| `4` | Not authenticated — run `poli login` or set `POLI_PAGE_API_KEY` |
|
|
479
|
-
| `5` | Not authorized (insufficient role, `THUMBNAILS_NOT_AVAILABLE
|
|
592
|
+
| `5` | Not authorized (insufficient role, protected environment, `THUMBNAILS_NOT_AVAILABLE`) |
|
|
480
593
|
| `6` | Invalid local state (no project, project not linked, empty folder where required) |
|
|
481
594
|
|
|
482
595
|
These map to the centralised `ExitCode` constants in `src/exit-codes.ts`. Every handler routes errors through `errorToExitCode(err)`.
|
|
@@ -485,6 +598,32 @@ These map to the centralised `ExitCode` constants in `src/exit-codes.ts`. Every
|
|
|
485
598
|
|
|
486
599
|
## CI / CD
|
|
487
600
|
|
|
601
|
+
### Publish from CI with a service key
|
|
602
|
+
|
|
603
|
+
```yaml
|
|
604
|
+
# .github/workflows/publish.yml
|
|
605
|
+
name: Publish templates
|
|
606
|
+
|
|
607
|
+
on:
|
|
608
|
+
push:
|
|
609
|
+
branches: [main]
|
|
610
|
+
|
|
611
|
+
jobs:
|
|
612
|
+
publish:
|
|
613
|
+
runs-on: ubuntu-latest
|
|
614
|
+
env:
|
|
615
|
+
POLI_PAGE_API_KEY: ${{ secrets.POLI_PAGE_SERVICE_KEY }} # a service key for `live`
|
|
616
|
+
steps:
|
|
617
|
+
- uses: actions/checkout@v4
|
|
618
|
+
- uses: actions/setup-node@v4
|
|
619
|
+
with:
|
|
620
|
+
node-version: '22'
|
|
621
|
+
- run: npm install -g @poli-page/cli
|
|
622
|
+
- run: poli publish --env live -m "Deploy ${{ github.sha }}"
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
The workflow runs in the linked project folder (the one with `poli-page.json` and its `cloud` block). The key decides the environment: `--env` must name it. `live` is protected, so the service key needs the `admin` role.
|
|
626
|
+
|
|
488
627
|
### GitHub Actions
|
|
489
628
|
|
|
490
629
|
```yaml
|
|
@@ -504,14 +643,14 @@ jobs:
|
|
|
504
643
|
with:
|
|
505
644
|
node-version: '22'
|
|
506
645
|
- run: npm install -g @poli-page/cli
|
|
507
|
-
- run: poli render invoice@
|
|
646
|
+
- run: poli render invoice@live -o ./artifacts/invoice.pdf
|
|
508
647
|
- uses: actions/upload-artifact@v4
|
|
509
648
|
with:
|
|
510
649
|
name: invoice-pdf
|
|
511
650
|
path: ./artifacts/invoice.pdf
|
|
512
651
|
```
|
|
513
652
|
|
|
514
|
-
|
|
653
|
+
The key decides the environment: a `pp_live_…` key renders `invoice@live` and nothing else. A standard key is enough to render; a service key also works, and rotating either one does not log out any developer.
|
|
515
654
|
|
|
516
655
|
### GitLab CI
|
|
517
656
|
|
|
@@ -522,7 +661,7 @@ render:
|
|
|
522
661
|
POLI_PAGE_API_KEY: $POLI_PAGE_API_KEY
|
|
523
662
|
script:
|
|
524
663
|
- npm install -g @poli-page/cli
|
|
525
|
-
- poli render invoice@
|
|
664
|
+
- poli render invoice@live -o invoice.pdf
|
|
526
665
|
artifacts:
|
|
527
666
|
paths:
|
|
528
667
|
- invoice.pdf
|
|
@@ -533,10 +672,10 @@ render:
|
|
|
533
672
|
```bash
|
|
534
673
|
# In a build script
|
|
535
674
|
npm install -g @poli-page/cli
|
|
536
|
-
POLI_PAGE_API_KEY=
|
|
675
|
+
POLI_PAGE_API_KEY=pp_live_xxx poli render homepage-pdf@live -o ./public/welcome.pdf
|
|
537
676
|
```
|
|
538
677
|
|
|
539
|
-
|
|
678
|
+
A service key has a **fixed role and environment** from its creation. The CLI does not try to switch them — the API enforces the permissions.
|
|
540
679
|
|
|
541
680
|
---
|
|
542
681
|
|
|
@@ -546,17 +685,47 @@ Service accounts have a **fixed role and environment** at creation. The CLI does
|
|
|
546
685
|
|
|
547
686
|
Either run `poli login` interactively, or export `POLI_PAGE_API_KEY` for CI use. Exit code `4`.
|
|
548
687
|
|
|
549
|
-
### `POLI_PAGE_API_KEY must
|
|
688
|
+
### `POLI_PAGE_API_KEY must be a Poli Page API key: \`pp_<environment>_…\`...`
|
|
689
|
+
|
|
690
|
+
You set the variable but its value is not a whole key: `pp_`, the environment name, `_`, then 32 lowercase hex characters. Copy the key again, or create one from the dashboard's API keys page. Exit code `4`.
|
|
691
|
+
|
|
692
|
+
### `Standard API keys can only render. Use a service key or \`poli login\`.`
|
|
693
|
+
|
|
694
|
+
`poli publish` with `POLI_PAGE_API_KEY` set to a standard key. Only a service key, or a `poli login` session, can publish. Exit code `5`.
|
|
695
|
+
|
|
696
|
+
### `This service key publishes to "<a>" only, not "<b>"...`
|
|
550
697
|
|
|
551
|
-
|
|
698
|
+
A service key publishes into its own environment only. Pass `--env <a>`, or use a service key for `<b>`. Exit code `2`.
|
|
552
699
|
|
|
553
700
|
### `This folder isn't linked to a cloud project. Run \`poli link\` first.`
|
|
554
701
|
|
|
555
|
-
You're in session mode and the local manifest has no `cloud:` block. Either run `poli link`, or switch to api-key mode with `POLI_PAGE_API_KEY=pp_
|
|
702
|
+
You're in session mode and the local manifest has no `cloud:` block. Either run `poli link`, or switch to api-key mode with `POLI_PAGE_API_KEY=pp_<environment>_…` (which carries the org context implicitly). Exit code `6`.
|
|
703
|
+
|
|
704
|
+
### `API keys render a published environment: use \`name@<environment>\``
|
|
705
|
+
|
|
706
|
+
`poli render name` renders the draft, which only a `poli login` session can do. With an API key, render the key's environment: `poli render name@<environment>`. Exit code `2`.
|
|
707
|
+
|
|
708
|
+
### `This API key renders the \`<a>\` environment, not \`<b>\``
|
|
709
|
+
|
|
710
|
+
A key renders only the environment in its prefix. Render `name@<a>`, or use a key for `<b>`. Exit code `2`.
|
|
556
711
|
|
|
557
|
-
### `\`
|
|
712
|
+
### `\`invoice@1.2.3\`: templates no longer have versions...`
|
|
558
713
|
|
|
559
|
-
|
|
714
|
+
Render specs name an environment, not a version: `poli render invoice@<environment>`, or `poli render invoice` for the draft. Exit code `2`.
|
|
715
|
+
|
|
716
|
+
### `403 DRAFT_REQUIRES_SESSION`
|
|
717
|
+
|
|
718
|
+
The API renders the draft for a `poli login` session only. The CLI refuses a draft render with an API key before any call (see above), so this code comes back only from a draft render sent outside the CLI with a key. Render `name@<environment>` with the key, or render the draft after `poli login`.
|
|
719
|
+
|
|
720
|
+
### `Environment "<env>" is protected...` (`403 ENVIRONMENT_PROTECTED`)
|
|
721
|
+
|
|
722
|
+
`poli publish --env <env>` to a protected environment (`live` by default) by someone who is not an owner or admin of the organization, or with a service key without the `admin` role. Ask an owner or admin to publish, or use an `admin` service key. Exit code `5`.
|
|
723
|
+
|
|
724
|
+
Without a terminal, `Environment "<env>" is protected. Pass --yes to publish to it without a prompt.` means the confirmation could not be asked: pass `--yes` (`CI=true` counts as `--yes`). Exit code `2`.
|
|
725
|
+
|
|
726
|
+
### `PUBLISH_IN_PROGRESS`
|
|
727
|
+
|
|
728
|
+
A publish of the same project and environment is running. `poli render name@<env>` gets `503 PUBLISH_IN_PROGRESS`, waits `Retry-After` and retries once; if the publish is still running, it exits `3`: try again in a moment. `poli publish` and `poli env remove-project` get it while another publish or removal runs, and do not retry: run the command again once the other one is done. Exit code `3`.
|
|
560
729
|
|
|
561
730
|
### `403 THUMBNAILS_NOT_AVAILABLE`
|
|
562
731
|
|
|
@@ -564,7 +733,7 @@ Thumbnails via `poli documents thumbnails` are a paid-tier feature. Upgrade to S
|
|
|
564
733
|
|
|
565
734
|
### `429 OVERAGE_CAP_EXCEEDED`
|
|
566
735
|
|
|
567
|
-
Your org has crossed the monthly cap on `live` PDF renders (counted across `poli render`
|
|
736
|
+
Your org has crossed the monthly cap on `live` PDF renders (counted across `poli render` in any environment other than `sandbox` and `poli documents thumbnails` on a document of such an environment). Wait until the next billing period or raise the cap from your dashboard. Exit code `3`.
|
|
568
737
|
|
|
569
738
|
### `503 ORGANIZATION_MIGRATING`
|
|
570
739
|
|
|
@@ -574,10 +743,6 @@ Your org is being migrated to a new tier. `poli watch` retries automatically aft
|
|
|
574
743
|
|
|
575
744
|
Make sure you're not editing inside an ignored directory. Default ignores: `node_modules/`, `.git/`, `output/`, `dist/`, `*.log`, `.DS_Store`. The watcher uses `chokidar` v5; if your editor saves via "atomic write + rename" (some Vim setups), the rename event fires within the debounce window and triggers a sync.
|
|
576
745
|
|
|
577
|
-
### CI pipeline rejected with exit `5` on `poli promote`
|
|
578
|
-
|
|
579
|
-
Service-account `developer` keys cannot promote. Either use an `admin` SA, or run `poli promote` from a developer's interactive session. Service-account roles are fixed at creation.
|
|
580
|
-
|
|
581
746
|
---
|
|
582
747
|
|
|
583
748
|
## License
|