@supacloud/cli 0.15.0 → 0.17.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 CHANGED
@@ -146,6 +146,7 @@ supacloud-cli queue dlq --queue emails --limit 20
146
146
  supacloud-cli task_events inspect_webhook --ref abc123
147
147
  supacloud-cli database query --sql "select now()"
148
148
  supacloud-cli database query --ref abc123 --file ./queries/vector-search.sql
149
+ supacloud-cli database migration_inventory --ref abc123
149
150
  supacloud-cli database push_migrations --ref abc123 --dir supabase/migrations --dry_run
150
151
  supacloud-cli supabase migration_new --name add_accounts
151
152
  supacloud-cli supabase db_diff --schema public --name add_accounts
@@ -154,22 +155,70 @@ supacloud-cli frontend list --ref abc123
154
155
  supacloud-cli branch create --name feature-orders --data_mode schema_only
155
156
  supacloud-cli branch promotion_plan --branch_ref preview123
156
157
  supacloud-cli branch promote --branch_ref preview123 --plan_checksum <sha256>
157
- supacloud-cli edge_functions deploy --ref abc123 --slug hello --path ./supabase/functions/hello
158
- supacloud-cli edge_functions deploy_bundle --ref abc123 --slug hello --files '{"index.ts":"export default { fetch: () => new Response(\"ok\") }"}'
159
- supacloud-cli edge_functions source --ref abc123 --slug hello --output ./hello.ts
160
- supacloud-cli edge_functions activate --ref abc123 --slug hello --version 3
158
+ supacloud-cli edge_functions deploy --ref abc123 --slug hello --path ./supabase/functions/hello --expected-active-version absent
159
+ supacloud-cli edge_functions deploy --ref abc123 --slug hello --prebundled-path ./dist/hello.js --expected-sha256 <sha256> --expected-active-version 4
160
+ supacloud-cli edge_functions deploy_bundle --ref abc123 --slug hello --files '{"index.ts":"export default { fetch: () => new Response(\"ok\") }"}' --expected-active-version 7
161
+ supacloud-cli edge_functions source --ref abc123 --slug hello --version 7 --output ./hello-v7.ts
162
+ supacloud-cli edge_functions activate --ref abc123 --slug hello --version 3 --expected-active-version 8
161
163
  supacloud-cli scheduled_functions list --ref abc123
162
164
  supacloud-cli secrets upsert --ref abc123 --from-env API_KEY,WEBHOOK_SECRET
165
+ supacloud-cli storage list_buckets --ref abc123
166
+ supacloud-cli storage get_bucket --ref abc123 --bucket reports
167
+ supacloud-cli storage create_bucket --ref abc123 --bucket reports --public false \
168
+ --file_size_limit 10485760 --allowed_mime_types "application/pdf,image/png"
169
+ supacloud-cli storage update_bucket --ref abc123 --bucket reports \
170
+ --expected_revision <revision-from-get_bucket> \
171
+ --allowed_mime_types '["application/pdf"]'
172
+ supacloud-cli storage delete_bucket --ref abc123 --bucket reports \
173
+ --expected_revision <revision-from-get_bucket> --require_empty true
163
174
  ```
164
175
 
176
+ `database migration_inventory` reads the canonical migration ledger through the
177
+ project-scoped Management API and prints only a validated JSON array. It rejects
178
+ non-2xx responses, malformed entries, unsafe project refs, duplicate canonical
179
+ migration versions, checksum
180
+ drift, and statement-count mismatches instead of treating them as an empty
181
+ ledger. `database list_migrations` remains available with its legacy SQL-backed,
182
+ human-readable behavior.
183
+
184
+ Bucket list/get output includes the metadata `revision`. Update and delete reject
185
+ stale revisions with HTTP 409. Delete additionally requires `require_empty=true`;
186
+ it never empties a bucket. Mutation receipts bind `project_ref`, `bucket_id`,
187
+ `previous_revision`, and `new_revision` (`null` after delete).
188
+
189
+ `database push_migrations` rejects a remote row that reuses a local migration
190
+ name with another version, or a local version with another name, before either
191
+ dry-run reporting or apply can continue. This keeps the preview consistent with
192
+ the server conflict that would otherwise occur after deployment starts.
193
+
165
194
  `edge_functions deploy --path` bundles local TypeScript and dependencies with
166
195
  Bun and runs a local syntax check before upload. The Management API validates and
167
196
  normalizes the final server-side artifact against the multi-tenant Edge Runtime
168
197
  module policy consistently for CLI, Web Console, and direct API deployments.
198
+ For an artifact already built and validated by release automation, use
199
+ `deploy --prebundled-path <file> --expected-sha256 <64-lowercase-hex>`. The CLI
200
+ holds the opened regular file while reading it, rejects metadata drift, invalid
201
+ UTF-8, or a caller-hash mismatch before HTTP, and never passes the artifact in
202
+ the process argument list. The Management API validates the hash and runtime
203
+ policy again, rejects any normalization that would change the code, and stores
204
+ the submitted bytes unchanged as both immutable source and runtime artifact.
205
+ `--prebundled-path` is mutually exclusive with `--path`, `--code`, and
206
+ `--minify`.
169
207
  `deploy_bundle --files` accepts a JSON object in shell usage.
170
208
  Use `source --output <file>` for large Functions so terminal or automation output
171
209
  limits cannot truncate the original TS/JS source code. The destination must not
172
- already exist.
210
+ already exist. Add the positive version observed from `list` as
211
+ `source --version <N>` to read the immutable release instead of the moving active
212
+ pointer; this remains correct across an active-version A→B→A transition.
213
+
214
+ `deploy`, `deploy_bundle`, and `activate` require
215
+ `--expected-active-version <N|absent>`. Read the current positive integer
216
+ version from `edge_functions list`; use `absent` only when creating a slug that
217
+ does not yet exist. A stale value returns HTTP 409 without building, preheating,
218
+ or activating another version. List output remains a JSON array with string
219
+ `slug` and numeric `version` fields, while source output is exactly
220
+ `{ "code": "..." }`. Release automation must use `source --version <N>` for a
221
+ version-bound backup.
173
222
 
174
223
  `edge_functions activate` restores an existing immutable Function version and
175
224
  returns a machine-readable receipt containing the activated version and JWT
@@ -180,27 +229,50 @@ Mutation receipts use schema `supacloud.cli.release-control.v1`. An
180
229
  `OUTCOME_UNKNOWN` error means the server may have committed the mutation before
181
230
  the response was lost or failed validation; read back current state before any
182
231
  retry.
232
+ Version `0` is reserved for service-internal legacy recovery and cannot be used
233
+ as a public CLI/API activation target or expected active version.
234
+
235
+ ```json
236
+ {
237
+ "schema": "supacloud.cli.release-control.v1",
238
+ "ok": true,
239
+ "operation": "edge_functions.deploy_bundle",
240
+ "project_ref": "abc123",
241
+ "slug": "hello",
242
+ "previous_active_version": "7",
243
+ "active_version": "8",
244
+ "version": "8",
245
+ "verify_jwt": true
246
+ }
247
+ ```
183
248
 
184
249
  Scheduled Function lifecycle operations are also project-scoped:
185
250
 
186
251
  ```bash
187
252
  supacloud-cli scheduled_functions create --ref abc123 --name nightly \
188
253
  --slug cleanup --cron "0 2 * * *" --method POST
254
+ supacloud-cli scheduled_functions get --ref abc123 --schedule_id <id>
189
255
  supacloud-cli scheduled_functions update --ref abc123 --schedule_id <id> \
190
- --cron "0 3 * * *"
191
- supacloud-cli scheduled_functions delete --ref abc123 --schedule_id <id>
256
+ --expected_updated_at <updated_at-from-list> --cron "0 3 * * *"
257
+ supacloud-cli scheduled_functions delete --ref abc123 --schedule_id <id> \
258
+ --expected_updated_at <updated_at-from-list>
192
259
  ```
193
260
 
194
261
  Schedule IDs are canonical UUIDv4 values returned by create/list. Cron values
195
262
  use bounded numeric five-field syntax with wildcards, lists, ranges, and steps;
196
263
  out-of-range endpoints and steps are rejected before HTTP dispatch.
264
+ Update and delete require the exact canonical UTC `updated_at` returned by list.
265
+ A stale revision fails with HTTP 409 and performs no mutation; read the list
266
+ again before deciding whether to issue a new write.
197
267
 
198
268
  Use `--body_file ./payload.json` for a JSON-object request body. Header values
199
269
  must come from environment variables: pass a JSON name mapping such as
200
270
  `--header_env '{"x-schedule-token":"SCHEDULE_TOKEN"}'`. Platform-owned
201
271
  `authorization`, `apikey`, and `x-project-ref` headers cannot be overridden. Receipts never
202
272
  include header values or body content; list and mutation receipts report only
203
- whether the body is empty and the configured header names.
273
+ whether the body is empty and the configured header names. Update receipts bind
274
+ `previous_updated_at` to the requested revision and return a newer `updated_at`;
275
+ delete receipts return the matched revision as `deleted_updated_at`.
204
276
 
205
277
  For secret writes, `--from-env` accepts a comma-separated list of environment
206
278
  variable names. The CLI reads each non-empty value from its own process