@supacloud/cli 0.3.1 → 0.3.3
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 +25 -8
- package/dist/index.js +29 -21
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,7 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Project-scoped CLI for SupaCloud users.
|
|
4
4
|
|
|
5
|
-
`supacloud`
|
|
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`.
|
|
8
|
+
|
|
9
|
+
Install:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @supacloud/cli
|
|
13
|
+
supacloud-cli status
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
One-off execution:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm exec --package @supacloud/cli -- supacloud-cli status
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`supacloud-cli` defaults to the current workspace's project context. If you do not pass explicit flags, it tries to auto-link from `.env`:
|
|
6
23
|
|
|
7
24
|
- `SUPABASE_URL` or `SUPACLOUD_API_URL`
|
|
8
25
|
- `SUPABASE_SERVICE_ROLE_KEY` or `SUPACLOUD_API_TOKEN`
|
|
@@ -10,13 +27,13 @@ Project-scoped CLI for SupaCloud users.
|
|
|
10
27
|
Examples:
|
|
11
28
|
|
|
12
29
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
supacloud-cli status
|
|
31
|
+
supacloud-cli project get
|
|
32
|
+
supacloud-cli project logs --log_type database
|
|
33
|
+
supacloud-cli database query --sql "select now()"
|
|
34
|
+
supacloud-cli database query --ref abc123 --file ./queries/vector-search.sql
|
|
35
|
+
supacloud-cli database push_migrations --ref abc123 --dir supabase/migrations --dry_run
|
|
36
|
+
supacloud-cli frontend list --ref abc123
|
|
20
37
|
```
|
|
21
38
|
|
|
22
39
|
Use `database query --file` for complex SQL, pgvector queries, and single-request transaction blocks.
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,9 @@ var __export = (target, all) => {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// src/index.ts
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
|
|
17
20
|
// node_modules/zod/v3/external.js
|
|
18
21
|
var exports_external = {};
|
|
19
22
|
__export(exports_external, {
|
|
@@ -4354,7 +4357,7 @@ function migrationVersionFromFilename(file, fallbackIndex = 0) {
|
|
|
4354
4357
|
return Date.now() * 1000 + fallbackIndex;
|
|
4355
4358
|
}
|
|
4356
4359
|
function appliedMigrationKeys(data) {
|
|
4357
|
-
const rows = data?.rows || [];
|
|
4360
|
+
const rows = Array.isArray(data) ? data : data?.rows || [];
|
|
4358
4361
|
const keys = new Set;
|
|
4359
4362
|
for (const row of rows) {
|
|
4360
4363
|
if (!row || typeof row !== "object")
|
|
@@ -5642,6 +5645,9 @@ function registerUserProjectCliTools(server, http, options = {}) {
|
|
|
5642
5645
|
}
|
|
5643
5646
|
|
|
5644
5647
|
// src/index.ts
|
|
5648
|
+
var invokedCommand = path.basename(process.argv[1] || "supacloud-cli");
|
|
5649
|
+
var commandName = invokedCommand === "supacloud" ? "supacloud" : "supacloud-cli";
|
|
5650
|
+
var preferredCommand = "supacloud-cli";
|
|
5645
5651
|
var projectActionSchema = exports_external.enum(["get", "health", "logs", "api_keys", "settings", "tasks"]);
|
|
5646
5652
|
var genericActionSchema = exports_external.string();
|
|
5647
5653
|
function unwrapMcpSchema(schema) {
|
|
@@ -5671,15 +5677,17 @@ function printHelp(context = resolveSupaCloudContext()) {
|
|
|
5671
5677
|
const autoLink = context.inferredSupabaseUrl ? `Project context: ${context.inferredSupabaseUrl} (${context.source})` : "Project context: not detected";
|
|
5672
5678
|
console.error(`
|
|
5673
5679
|
╔═══════════════════════════════════════════════════════════╗
|
|
5674
|
-
║ supacloud
|
|
5680
|
+
║ supacloud-cli ║
|
|
5675
5681
|
║ Project CLI for SupaCloud users ║
|
|
5676
5682
|
╚═══════════════════════════════════════════════════════════╝
|
|
5677
5683
|
|
|
5684
|
+
${commandName === "supacloud" ? "NOTE\n\n `supacloud` is kept as a compatibility alias. Prefer `supacloud-cli`\n to avoid confusion with the server binary at /usr/local/bin/supacloud.\n" : ""}
|
|
5685
|
+
|
|
5678
5686
|
USAGE
|
|
5679
5687
|
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5688
|
+
${preferredCommand} <module> <action> [--flags]
|
|
5689
|
+
${preferredCommand} status
|
|
5690
|
+
${preferredCommand} --help
|
|
5683
5691
|
|
|
5684
5692
|
DEFAULT CONTEXT
|
|
5685
5693
|
|
|
@@ -5692,15 +5700,15 @@ DEFAULT CONTEXT
|
|
|
5692
5700
|
|
|
5693
5701
|
EXAMPLES
|
|
5694
5702
|
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5703
|
+
${preferredCommand} status
|
|
5704
|
+
${preferredCommand} project get
|
|
5705
|
+
${preferredCommand} project logs --log_type database
|
|
5706
|
+
${preferredCommand} frontend list --ref abc123
|
|
5707
|
+
${preferredCommand} database query --sql "select now()"
|
|
5708
|
+
${preferredCommand} database query --ref abc123 --file ./queries/vector-search.sql
|
|
5709
|
+
${preferredCommand} database push_migrations --ref abc123 --dir supabase/migrations --dry_run
|
|
5710
|
+
${preferredCommand} edge_functions deploy --ref abc123 --slug hello --path ./supabase/functions/hello
|
|
5711
|
+
${preferredCommand} edge_functions config --ref abc123 --slug hello --verify_jwt false --background_routes "/queue/*,/render/*"
|
|
5704
5712
|
|
|
5705
5713
|
SEPARATE ADMIN CLI
|
|
5706
5714
|
|
|
@@ -5747,8 +5755,8 @@ function createCliTools() {
|
|
|
5747
5755
|
" - SUPACLOUD_API_URL + SUPACLOUD_API_TOKEN",
|
|
5748
5756
|
"",
|
|
5749
5757
|
"Then retry commands such as:",
|
|
5750
|
-
|
|
5751
|
-
|
|
5758
|
+
` ${preferredCommand} project get`,
|
|
5759
|
+
` ${preferredCommand} project logs --log_type database`
|
|
5752
5760
|
].join(`
|
|
5753
5761
|
`)
|
|
5754
5762
|
}
|
|
@@ -5762,7 +5770,7 @@ function createCliTools() {
|
|
|
5762
5770
|
content: [
|
|
5763
5771
|
{
|
|
5764
5772
|
type: "text",
|
|
5765
|
-
text:
|
|
5773
|
+
text: `⚠️ This command requires project-scoped API context. Run \`${preferredCommand} status\` to inspect current detection.`
|
|
5766
5774
|
}
|
|
5767
5775
|
]
|
|
5768
5776
|
})
|
|
@@ -5778,9 +5786,9 @@ function createCliTools() {
|
|
|
5778
5786
|
{
|
|
5779
5787
|
type: "text",
|
|
5780
5788
|
text: [
|
|
5781
|
-
|
|
5789
|
+
`⚠️ No project context found for ${preferredCommand}.`,
|
|
5782
5790
|
"",
|
|
5783
|
-
|
|
5791
|
+
`${preferredCommand} expects project-scoped credentials by default.`,
|
|
5784
5792
|
"Provide one of these sources:",
|
|
5785
5793
|
"",
|
|
5786
5794
|
" 1. Current workspace .env",
|
|
@@ -5841,9 +5849,9 @@ async function main() {
|
|
|
5841
5849
|
console.log(JSON.stringify(result, null, 2));
|
|
5842
5850
|
return;
|
|
5843
5851
|
}
|
|
5844
|
-
await runCli(cliTools, args, { commandName
|
|
5852
|
+
await runCli(cliTools, args, { commandName });
|
|
5845
5853
|
}
|
|
5846
5854
|
main().catch((error) => {
|
|
5847
|
-
console.error(
|
|
5855
|
+
console.error(`${commandName} failed:`, error);
|
|
5848
5856
|
process.exit(1);
|
|
5849
5857
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
+
"supacloud-cli": "dist/index.js",
|
|
8
9
|
"supacloud": "dist/index.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|