@supacloud/cli 0.9.2 → 0.11.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
@@ -2,9 +2,8 @@
2
2
 
3
3
  Project-scoped CLI for SupaCloud users.
4
4
 
5
- Use the explicit `supacloud-cli` command for project workflows. The old `supacloud`
6
- binary name is kept as a compatibility alias only; it is easy to confuse with the
7
- server binary installed at `/usr/local/bin/supacloud`.
5
+ This package exposes only `supacloud-cli`. The bare `supacloud` name is reserved
6
+ for the compiled server binary installed at `/usr/local/bin/supacloud`.
8
7
 
9
8
  Install:
10
9
 
@@ -19,10 +18,34 @@ One-off execution:
19
18
  npm exec --package @supacloud/cli -- supacloud-cli status
20
19
  ```
21
20
 
21
+ Install the packaged AI Skill:
22
+
23
+ ```bash
24
+ supacloud-cli ai show_skill
25
+ supacloud-cli ai install_skill --dry_run
26
+ supacloud-cli ai install_skill
27
+ ```
28
+
29
+ The default destination is `$CODEX_HOME/skills/supacloud-cli` or
30
+ `~/.codex/skills/supacloud-cli`. Use `--target /path/to/skills` for an explicit
31
+ Skill root. Different existing content is preserved unless `--force` is passed;
32
+ forced replacement creates a timestamped adjacent backup first.
33
+
34
+ The Skill directs agents to keep schema, functions/RPC, triggers, RLS, indexes,
35
+ grants, extensions, and reference-data changes in migrations; use read-only SQL
36
+ for ordinary inspection; dry-run remote migrations; and reconcile existing
37
+ remote drift before touching migration history.
38
+
22
39
  `supacloud-cli` defaults to the current workspace's project context. If you do not pass explicit flags, it tries to auto-link from `.env`:
23
40
 
24
41
  - `SUPABASE_URL` or `SUPACLOUD_API_URL`
25
42
  - `SUPABASE_SERVICE_ROLE_KEY` or `SUPACLOUD_API_TOKEN`
43
+ - `SUPACLOUD_PROJECT_REF` when the project ref cannot be inferred from a managed `<ref>.api.*` hostname
44
+
45
+ Both `--key value` and `--key=value` flag syntax are accepted. `--ref` can
46
+ override the auto-linked project for an individual command. `status` checks
47
+ configuration, Management API connectivity, and authentication; it exits
48
+ non-zero when any required check fails.
26
49
 
27
50
  Examples:
28
51
 
@@ -38,9 +61,77 @@ supacloud-cli task_events inspect_webhook --ref abc123
38
61
  supacloud-cli database query --sql "select now()"
39
62
  supacloud-cli database query --ref abc123 --file ./queries/vector-search.sql
40
63
  supacloud-cli database push_migrations --ref abc123 --dir supabase/migrations --dry_run
64
+ supacloud-cli supabase migration_new --name add_accounts
65
+ supacloud-cli supabase db_diff --schema public --name add_accounts
66
+ supacloud-cli supabase push --ref abc123 --dir supabase/migrations --dry_run
41
67
  supacloud-cli frontend list --ref abc123
42
68
  ```
43
69
 
70
+ ## Official Supabase CLI adapter
71
+
72
+ The `supabase` command group is a thin, allowlisted adapter around the official
73
+ open-source Supabase CLI. It is not a fork. Local authoring commands work without
74
+ SupaCloud credentials:
75
+
76
+ ```bash
77
+ supacloud-cli supabase version
78
+ supacloud-cli supabase migration_new --name add_accounts
79
+ supacloud-cli supabase db_diff --schema public --name add_accounts
80
+ supacloud-cli supabase db_reset --no_seed
81
+ ```
82
+
83
+ Remote inspection and backup commands require an explicit, percent-encoded
84
+ Postgres DSN:
85
+
86
+ ```bash
87
+ supacloud-cli supabase db_pull --db_url "$SUPACLOUD_DB_URL" --declarative
88
+ supacloud-cli supabase migration_list --db_url "$SUPACLOUD_DB_URL"
89
+ supacloud-cli supabase db_dump --db_url "$SUPACLOUD_DB_URL" --file backups/schema.sql
90
+ supacloud-cli supabase gen_types --db_url "$SUPACLOUD_DB_URL" --schema public --file src/database.types.ts
91
+ ```
92
+
93
+ Remote migration application intentionally stays on SupaCloud's existing
94
+ project-authenticated API:
95
+
96
+ ```bash
97
+ supacloud-cli supabase push --ref abc123 --dir supabase/migrations --dry_run
98
+ supacloud-cli supabase push --ref abc123 --dir supabase/migrations
99
+ ```
100
+
101
+ `push` uses `SUPABASE_SERVICE_ROLE_KEY` or `SUPACLOUD_API_TOKEN` only for the
102
+ SupaCloud Management API. Those credentials, upstream access tokens, database
103
+ passwords, and secret/key environment variables are removed from the official
104
+ CLI child process, and command output is redacted.
105
+
106
+ `push` requires a resolved project ref; pass `--ref` explicitly or set
107
+ `SUPACLOUD_PROJECT_REF`. Relative migration directories are resolved against
108
+ `--workdir` (or the current directory).
109
+
110
+ Executable resolution order:
111
+
112
+ 1. `SUPACLOUD_SUPABASE_CLI_BIN`
113
+ 2. exact `SUPABASE_CLI_VERSION` through an explicit Bun/npm package runner
114
+ 3. `<workdir>/node_modules/supabase`
115
+ 4. `supabase` on `PATH`
116
+
117
+ Windows under Node.js requires an installed official CLI or
118
+ `SUPACLOUD_SUPABASE_CLI_BIN`; the adapter does not execute `.cmd` through a shell.
119
+
120
+ Direct SQL/console changes do not automatically create migrations or migration
121
+ history. Keep migration files in version control and run `supabase push --dry_run`
122
+ before applying them.
123
+
124
+ If the live database already contains reviewed historical changes, first pull,
125
+ back up, and prove schema equivalence. Then preview the controlled tracking sync:
126
+
127
+ ```bash
128
+ supacloud-cli database baseline_migrations --ref abc123 --dir supabase/migrations --dry_run
129
+ ```
130
+
131
+ Only after explicit approval, rerun without `--dry_run`. This records migration
132
+ files as applied without executing their DDL; never edit migration-history tables
133
+ through `database query`.
134
+
44
135
  Use `database query --file` for complex SQL, pgvector queries, and single-request transaction blocks.
45
136
 
46
137
  ```sql
@@ -77,6 +168,7 @@ Project commands owned by this CLI:
77
168
 
78
169
  Queue commands:
79
170
 
171
+ - `queue list`
80
172
  - `queue send`
81
173
  - `queue receive`
82
174
  - `queue ack`
@@ -85,6 +177,7 @@ Queue commands:
85
177
  - `queue retry`
86
178
  - `queue delete_message`
87
179
  - `queue list_messages`
180
+ - `queue get_message`
88
181
  - `queue stats`
89
182
  - `queue dlq`
90
183
  - `queue get_settings`
@@ -96,9 +189,16 @@ Task event commands:
96
189
  - `task_events unregister_webhook`
97
190
  - `task_events inspect_webhook`
98
191
 
192
+ Diagnostic commands:
193
+
194
+ - `diagnostics list_checks`
195
+ - `diagnostics run_checks`
196
+ - `diagnostics get_run`
197
+ - `diagnostics repair`
198
+
99
199
  Gateway / Caddy commands (require admin privileges; config is injected via the Caddy JSON Admin API):
100
200
 
101
- - `gateway routes` — list custom gateway routes (reverse_proxy / static sites)
201
+ - `gateway routes` — list custom gateway routes (reverse_proxy / static sites / redirects)
102
202
  - `gateway upsert_route` — create or replace a route
103
203
  - `gateway update_route` — replace a route by id
104
204
  - `gateway delete_route` — remove a route by id
@@ -117,6 +217,9 @@ Gateway / Caddy commands (require admin privileges; config is injected via the C
117
217
  supacloud-cli gateway routes --ref abc123
118
218
  supacloud-cli gateway upsert_route --ref abc123 --route_id webhook \
119
219
  --hosts "api.example.com" --paths "/webhook/*" --upstream 10.0.0.5:8080
220
+ supacloud-cli gateway upsert_route --ref abc123 --route_id canonical-https \
221
+ --hosts "www.example.com" --paths "/*" --protocol http \
222
+ --redirect_to 'https://www.example.com{http.request.uri}' --redirect_status 308
120
223
  supacloud-cli gateway config --ref abc123 --rate_limit_tier pro
121
224
  supacloud-cli gateway rebuild --ref abc123 --clean
122
225
  ```