@palettelab/cli 0.3.21 → 0.3.23
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 +175 -0
- package/lib/commands/publish.js +11 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,178 @@ npx @palettelab/cli <command>
|
|
|
21
21
|
pltt <command>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Quick Start: Build And Test A Palette App
|
|
25
|
+
|
|
26
|
+
Use this flow when a developer wants to create an app, run it locally, then test
|
|
27
|
+
it inside the real Palette OS without Docker.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx --yes @palettelab/cli@latest init simple-todo --template database
|
|
31
|
+
cd simple-todo
|
|
32
|
+
npm install
|
|
33
|
+
npx --yes @palettelab/cli@latest dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`pltt dev` runs the local SDK simulator. It is the fastest loop for frontend,
|
|
37
|
+
backend, manifest, SDK hooks, and local database checks. It does not require
|
|
38
|
+
Docker and does not publish anything to the platform.
|
|
39
|
+
|
|
40
|
+
When the app is ready to test with real Palette OS services, configure a hosted
|
|
41
|
+
sandbox environment and run:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx --yes @palettelab/cli@latest login \
|
|
45
|
+
--env staging \
|
|
46
|
+
--url https://YOUR-PALETTE-STAGING-URL \
|
|
47
|
+
--token pltt_xxxxx
|
|
48
|
+
|
|
49
|
+
npx --yes @palettelab/cli@latest dev --sandbox --env staging
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The hosted sandbox flow packages the app, uploads it to the configured Palette
|
|
53
|
+
environment, creates a preview publish, and prints a real OS preview URL. Use
|
|
54
|
+
that URL to test routing, OS shell behavior, login context, organization
|
|
55
|
+
context, Data Room APIs, storage, install/review behavior, logs, permissions,
|
|
56
|
+
and platform APIs.
|
|
57
|
+
|
|
58
|
+
## Staging URL
|
|
59
|
+
|
|
60
|
+
The staging URL is the base URL of the Palette platform backend/API
|
|
61
|
+
environment. The CLI appends the API paths itself, for example:
|
|
62
|
+
|
|
63
|
+
- `/api/v1/appstore/sign-upload`
|
|
64
|
+
- `/api/v1/appstore/publish`
|
|
65
|
+
- `/api/v1/developer/publish-tokens`
|
|
66
|
+
- `/api/superadmin/publish-tokens`
|
|
67
|
+
|
|
68
|
+
Use the same public origin only if that origin proxies API routes to the
|
|
69
|
+
backend. For example, `https://apps.pltt.xyz` is valid only when these paths are
|
|
70
|
+
served by the backend, not by the frontend catch-all route:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
/api/v1/*
|
|
74
|
+
/api/superadmin/*
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Validate a staging URL before giving it to developers:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl https://YOUR-PALETTE-STAGING-URL/api/v1/health
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
A valid staging URL returns a backend health JSON response. If it returns the
|
|
84
|
+
Palette frontend HTML, it is a frontend-only URL and the CLI cannot publish to
|
|
85
|
+
it. In that case either use the real backend domain, for example
|
|
86
|
+
`https://api.your-domain.example`, or update the web server/reverse proxy so
|
|
87
|
+
`/api/v1/*` and `/api/superadmin/*` go to the backend.
|
|
88
|
+
|
|
89
|
+
## Publish Token
|
|
90
|
+
|
|
91
|
+
Every developer needs a publish token before they can use hosted sandbox or
|
|
92
|
+
publish commands. Tokens start with `pltt_`.
|
|
93
|
+
|
|
94
|
+
Developers can create their own token after logging in to Palette:
|
|
95
|
+
|
|
96
|
+
1. Open Palette OS in the browser.
|
|
97
|
+
2. Open Settings.
|
|
98
|
+
3. Go to Developer.
|
|
99
|
+
4. Create a developer publish token.
|
|
100
|
+
5. Copy the token immediately. The raw token is shown only once.
|
|
101
|
+
|
|
102
|
+
Superadmins can also allocate tokens from the superadmin publish-token section.
|
|
103
|
+
Use superadmin allocation for service accounts, CI, or developers who should
|
|
104
|
+
not create their own token.
|
|
105
|
+
|
|
106
|
+
Do not commit tokens to a repository. Store them through `pltt login` or an
|
|
107
|
+
environment variable.
|
|
108
|
+
|
|
109
|
+
## Configure A Hosted Sandbox
|
|
110
|
+
|
|
111
|
+
The recommended setup is `pltt login`, which writes
|
|
112
|
+
`~/.palette/config.json` with file mode `0600`:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npx --yes @palettelab/cli@latest login \
|
|
116
|
+
--env staging \
|
|
117
|
+
--url https://YOUR-PALETTE-STAGING-URL \
|
|
118
|
+
--token pltt_xxxxx
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
You can verify the saved environment with:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
cat ~/.palette/config.json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
You can also use environment variables instead of storing the token:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export PALETTE_STAGING_URL=https://YOUR-PALETTE-STAGING-URL
|
|
131
|
+
export PALETTE_STAGING_TOKEN=pltt_xxxxx
|
|
132
|
+
npx --yes @palettelab/cli@latest dev --sandbox --env staging
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Environment variable precedence:
|
|
136
|
+
|
|
137
|
+
1. `PALETTE_<ENV>_URL` and `PALETTE_<ENV>_TOKEN`
|
|
138
|
+
2. `PALETTE_PUBLISH_TOKEN` as a token fallback
|
|
139
|
+
3. `~/.palette/config.json`
|
|
140
|
+
4. `./palette.config.json` for repo-local overrides
|
|
141
|
+
|
|
142
|
+
## Test Inside The Real Palette OS Without Docker
|
|
143
|
+
|
|
144
|
+
Use hosted sandbox for real OS testing:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx --yes @palettelab/cli@latest dev --sandbox --env staging
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This is the correct flow for internal teams that need real platform features
|
|
151
|
+
without pushing the app to production approval and without running Docker on the
|
|
152
|
+
developer machine.
|
|
153
|
+
|
|
154
|
+
Expected behavior:
|
|
155
|
+
|
|
156
|
+
1. The CLI runs local contract checks.
|
|
157
|
+
2. The CLI bundles frontend and backend artifacts.
|
|
158
|
+
3. The CLI uploads the package to the staging Palette environment.
|
|
159
|
+
4. The platform creates a preview/review publish.
|
|
160
|
+
5. The CLI prints the preview URL, status command, and logs command.
|
|
161
|
+
6. The developer opens the preview URL inside the real Palette OS.
|
|
162
|
+
|
|
163
|
+
For developer sandboxes where manual review should not block testing, the
|
|
164
|
+
backend environment should run with:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
APPSTORE_AUTO_APPROVE_SANDBOX_PREVIEWS=true
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
With that backend setting enabled, passing sandbox preview publishes are marked
|
|
171
|
+
active automatically, so developers can test OS shell, auth, Data Room,
|
|
172
|
+
organization, install, permission, log, and platform API behavior immediately.
|
|
173
|
+
|
|
174
|
+
Useful follow-up commands:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx --yes @palettelab/cli@latest status --env staging
|
|
178
|
+
npx --yes @palettelab/cli@latest logs simple-todo --env staging --follow
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Local-Only Versus OS Testing
|
|
182
|
+
|
|
183
|
+
Use the right command for the kind of test you need:
|
|
184
|
+
|
|
185
|
+
| Goal | Command | Docker | Uses real OS services |
|
|
186
|
+
|---|---|---:|---:|
|
|
187
|
+
| Fast SDK/frontend/backend loop | `pltt dev` | No | No |
|
|
188
|
+
| Real OS preview in hosted cloud sandbox | `pltt dev --sandbox --env staging` | No | Yes |
|
|
189
|
+
| Alias for hosted cloud sandbox | `pltt dev --cloud --env staging` | No | Yes |
|
|
190
|
+
| Internal full local platform parity | `pltt dev --platform` | Yes | Local platform container |
|
|
191
|
+
| Production/review publish | `pltt publish --env production` | No | Yes |
|
|
192
|
+
|
|
193
|
+
For normal app developers, Docker is not required. Docker is only needed for
|
|
194
|
+
internal platform parity checks with `pltt dev --platform`.
|
|
195
|
+
|
|
24
196
|
## Commands
|
|
25
197
|
|
|
26
198
|
### `pltt init <name>`
|
|
@@ -75,6 +247,8 @@ the declared Alembic migrations and platform-managed Postgres/RLS.
|
|
|
75
247
|
|
|
76
248
|
`pltt dev --sandbox` skips Docker and publishes a reviewable preview to a configured Palette sandbox. This is the payment-gateway-style flow: your app uses local SDKs, while real platform services such as login, Data Room, storage, database policies, logs, review, and publish lifecycle run in the hosted sandbox. It defaults to `--env staging` unless `--env` or `PALETTE_ENV` is set, adds a 24-hour preview TTL by default, and prints the preview/status/log commands returned by the platform.
|
|
77
249
|
|
|
250
|
+
For developer sandboxes where manual approval should not block OS testing, run the sandbox backend with `APPSTORE_AUTO_APPROVE_SANDBOX_PREVIEWS=true`. Preview publishes are still checked by the automated review gates; passing preview publishes are marked active and synced immediately so backend routes, installs, logs, permissions, and platform APIs can be tested in the OS without Docker.
|
|
251
|
+
|
|
78
252
|
`pltt dev --cloud` is kept as an alias for `--sandbox`.
|
|
79
253
|
|
|
80
254
|
`pltt sandbox --env staging` is the same hosted preview flow as
|
|
@@ -90,6 +264,7 @@ Environment variables:
|
|
|
90
264
|
| `PALETTE_FRONTEND_PORT` | `3000` | Preferred starting host port for the frontend |
|
|
91
265
|
| `PALETTE_BACKEND_PORT` | `8000` | Preferred starting host port for the backend |
|
|
92
266
|
| `PALETTE_DEV_DATABASE_URL` | `.palette/dev/<plugin-id>.sqlite3` | Override the local dev database URL |
|
|
267
|
+
| `APPSTORE_AUTO_APPROVE_SANDBOX_PREVIEWS` | `false` | Backend setting for hosted sandboxes; auto-approve passing preview publishes so developers can test full OS behavior without manual review |
|
|
93
268
|
|
|
94
269
|
### `pltt login`
|
|
95
270
|
|
package/lib/commands/publish.js
CHANGED
|
@@ -210,8 +210,12 @@ async function run(argv, { cwd }) {
|
|
|
210
210
|
console.log(
|
|
211
211
|
`[pltt] published ${record.plugin_id}@${record.version} (status=${record.status})`,
|
|
212
212
|
)
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
if (record.status === "active") {
|
|
214
|
+
console.log(`[pltt] active on ${env.url}`)
|
|
215
|
+
} else {
|
|
216
|
+
console.log(`[pltt] awaiting superadmin review on ${env.url}`)
|
|
217
|
+
}
|
|
218
|
+
if (record.review_url && record.status !== "active") {
|
|
215
219
|
console.log(`[pltt] review queue: ${record.review_url}`)
|
|
216
220
|
}
|
|
217
221
|
if (record.preview_url) {
|
|
@@ -220,7 +224,11 @@ async function run(argv, { cwd }) {
|
|
|
220
224
|
if (record.preview_expires_at) {
|
|
221
225
|
console.log(`[pltt] preview expires: ${record.preview_expires_at}`)
|
|
222
226
|
}
|
|
223
|
-
|
|
227
|
+
if (record.status === "active") {
|
|
228
|
+
console.log(`[pltt] live at ${env.url}${record.catalog_url}`)
|
|
229
|
+
} else {
|
|
230
|
+
console.log(`[pltt] once approved, live at ${env.url}${record.catalog_url}`)
|
|
231
|
+
}
|
|
224
232
|
return record
|
|
225
233
|
}
|
|
226
234
|
|