@supacloud/cli 0.10.0 → 0.12.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,89 @@ 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
68
+ supacloud-cli branch create --name feature-orders --data_mode schema_only
69
+ supacloud-cli branch promotion_plan --branch_ref preview123
70
+ supacloud-cli branch promote --branch_ref preview123 --plan_checksum <sha256>
71
+ ```
72
+
73
+ Branch promotion is migration-first. `branch promotion_plan` prints pending
74
+ versions, names, statement counts, and checksums without echoing SQL into terminal
75
+ logs; review the migration files or the Web Console SQL view before approval.
76
+ `branch promote` requires the reviewed checksum, executes with the project-scoped
77
+ database role, and does not automatically copy branch data.
78
+ Use `--data_mode full_clone` only for an explicitly approved non-sensitive or
79
+ masked debugging dataset. Whole-database replacement is an administrator-only
80
+ break-glass API mode and is intentionally not exposed by this project CLI.
81
+
82
+ ## Official Supabase CLI adapter
83
+
84
+ The `supabase` command group is a thin, allowlisted adapter around the official
85
+ open-source Supabase CLI. It is not a fork. Local authoring commands work without
86
+ SupaCloud credentials:
87
+
88
+ ```bash
89
+ supacloud-cli supabase version
90
+ supacloud-cli supabase migration_new --name add_accounts
91
+ supacloud-cli supabase db_diff --schema public --name add_accounts
92
+ supacloud-cli supabase db_reset --no_seed
93
+ ```
94
+
95
+ Remote inspection and backup commands require an explicit, percent-encoded
96
+ Postgres DSN:
97
+
98
+ ```bash
99
+ supacloud-cli supabase db_pull --db_url "$SUPACLOUD_DB_URL" --declarative
100
+ supacloud-cli supabase migration_list --db_url "$SUPACLOUD_DB_URL"
101
+ supacloud-cli supabase db_dump --db_url "$SUPACLOUD_DB_URL" --file backups/schema.sql
102
+ supacloud-cli supabase gen_types --db_url "$SUPACLOUD_DB_URL" --schema public --file src/database.types.ts
42
103
  ```
43
104
 
105
+ Remote migration application intentionally stays on SupaCloud's existing
106
+ project-authenticated API:
107
+
108
+ ```bash
109
+ supacloud-cli supabase push --ref abc123 --dir supabase/migrations --dry_run
110
+ supacloud-cli supabase push --ref abc123 --dir supabase/migrations
111
+ ```
112
+
113
+ `push` uses `SUPABASE_SERVICE_ROLE_KEY` or `SUPACLOUD_API_TOKEN` only for the
114
+ SupaCloud Management API. Those credentials, upstream access tokens, database
115
+ passwords, and secret/key environment variables are removed from the official
116
+ CLI child process, and command output is redacted.
117
+
118
+ `push` requires a resolved project ref; pass `--ref` explicitly or set
119
+ `SUPACLOUD_PROJECT_REF`. Relative migration directories are resolved against
120
+ `--workdir` (or the current directory).
121
+
122
+ Executable resolution order:
123
+
124
+ 1. `SUPACLOUD_SUPABASE_CLI_BIN`
125
+ 2. exact `SUPABASE_CLI_VERSION` through an explicit Bun/npm package runner
126
+ 3. `<workdir>/node_modules/supabase`
127
+ 4. `supabase` on `PATH`
128
+
129
+ Windows under Node.js requires an installed official CLI or
130
+ `SUPACLOUD_SUPABASE_CLI_BIN`; the adapter does not execute `.cmd` through a shell.
131
+
132
+ Direct SQL/console changes do not automatically create migrations or migration
133
+ history. Keep migration files in version control and run `supabase push --dry_run`
134
+ before applying them.
135
+
136
+ If the live database already contains reviewed historical changes, first pull,
137
+ back up, and prove schema equivalence. Then preview the controlled tracking sync:
138
+
139
+ ```bash
140
+ supacloud-cli database baseline_migrations --ref abc123 --dir supabase/migrations --dry_run
141
+ ```
142
+
143
+ Only after explicit approval, rerun without `--dry_run`. This records migration
144
+ files as applied without executing their DDL; never edit migration-history tables
145
+ through `database query`.
146
+
44
147
  Use `database query --file` for complex SQL, pgvector queries, and single-request transaction blocks.
45
148
 
46
149
  ```sql
@@ -77,6 +180,7 @@ Project commands owned by this CLI:
77
180
 
78
181
  Queue commands:
79
182
 
183
+ - `queue list`
80
184
  - `queue send`
81
185
  - `queue receive`
82
186
  - `queue ack`
@@ -85,6 +189,7 @@ Queue commands:
85
189
  - `queue retry`
86
190
  - `queue delete_message`
87
191
  - `queue list_messages`
192
+ - `queue get_message`
88
193
  - `queue stats`
89
194
  - `queue dlq`
90
195
  - `queue get_settings`
@@ -96,6 +201,13 @@ Task event commands:
96
201
  - `task_events unregister_webhook`
97
202
  - `task_events inspect_webhook`
98
203
 
204
+ Diagnostic commands:
205
+
206
+ - `diagnostics list_checks`
207
+ - `diagnostics run_checks`
208
+ - `diagnostics get_run`
209
+ - `diagnostics repair`
210
+
99
211
  Gateway / Caddy commands (require admin privileges; config is injected via the Caddy JSON Admin API):
100
212
 
101
213
  - `gateway routes` — list custom gateway routes (reverse_proxy / static sites / redirects)