@supacloud/cli 0.3.0 → 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.
Files changed (3) hide show
  1. package/README.md +25 -8
  2. package/dist/index.js +28 -22
  3. 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` defaults to the current workspace's project context. If you do not pass explicit flags, it tries to auto-link from `.env`:
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
- npx @supacloud/cli status
14
- npx @supacloud/cli project get
15
- npx @supacloud/cli project logs --log_type database
16
- npx @supacloud/cli database query --sql "select now()"
17
- npx @supacloud/cli database query --ref abc123 --file ./queries/vector-search.sql
18
- npx @supacloud/cli database push_migrations --ref abc123 --dir supabase/migrations --dry_run
19
- npx @supacloud/cli frontend list --ref abc123
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, {
@@ -4374,8 +4377,6 @@ function sqlCreatesVectorExtension(sql) {
4374
4377
  return /\bCREATE\s+EXTENSION\s+(?:IF\s+NOT\s+EXISTS\s+)?["']?vector["']?/i.test(sql);
4375
4378
  }
4376
4379
  function extensionRows(data) {
4377
- if (Array.isArray(data))
4378
- return data;
4379
4380
  const shaped = data;
4380
4381
  const rows = shaped?.rows || [];
4381
4382
  return Array.isArray(rows) ? rows : [];
@@ -5644,6 +5645,9 @@ function registerUserProjectCliTools(server, http, options = {}) {
5644
5645
  }
5645
5646
 
5646
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";
5647
5651
  var projectActionSchema = exports_external.enum(["get", "health", "logs", "api_keys", "settings", "tasks"]);
5648
5652
  var genericActionSchema = exports_external.string();
5649
5653
  function unwrapMcpSchema(schema) {
@@ -5673,15 +5677,17 @@ function printHelp(context = resolveSupaCloudContext()) {
5673
5677
  const autoLink = context.inferredSupabaseUrl ? `Project context: ${context.inferredSupabaseUrl} (${context.source})` : "Project context: not detected";
5674
5678
  console.error(`
5675
5679
  ╔═══════════════════════════════════════════════════════════╗
5676
- ║ supacloud
5680
+ ║ supacloud-cli
5677
5681
  ║ Project CLI for SupaCloud users ║
5678
5682
  ╚═══════════════════════════════════════════════════════════╝
5679
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
+
5680
5686
  USAGE
5681
5687
 
5682
- supacloud <module> <action> [--flags]
5683
- supacloud status
5684
- supacloud --help
5688
+ ${preferredCommand} <module> <action> [--flags]
5689
+ ${preferredCommand} status
5690
+ ${preferredCommand} --help
5685
5691
 
5686
5692
  DEFAULT CONTEXT
5687
5693
 
@@ -5694,15 +5700,15 @@ DEFAULT CONTEXT
5694
5700
 
5695
5701
  EXAMPLES
5696
5702
 
5697
- supacloud status
5698
- supacloud project get
5699
- supacloud project logs --log_type database
5700
- supacloud frontend list --ref abc123
5701
- supacloud database query --sql "select now()"
5702
- supacloud database query --ref abc123 --file ./queries/vector-search.sql
5703
- supacloud database push_migrations --ref abc123 --dir supabase/migrations --dry_run
5704
- supacloud edge_functions deploy --ref abc123 --slug hello --path ./supabase/functions/hello
5705
- supacloud edge_functions config --ref abc123 --slug hello --verify_jwt false --background_routes "/queue/*,/render/*"
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/*"
5706
5712
 
5707
5713
  SEPARATE ADMIN CLI
5708
5714
 
@@ -5749,8 +5755,8 @@ function createCliTools() {
5749
5755
  " - SUPACLOUD_API_URL + SUPACLOUD_API_TOKEN",
5750
5756
  "",
5751
5757
  "Then retry commands such as:",
5752
- " supacloud project get",
5753
- " supacloud project logs --log_type database"
5758
+ ` ${preferredCommand} project get`,
5759
+ ` ${preferredCommand} project logs --log_type database`
5754
5760
  ].join(`
5755
5761
  `)
5756
5762
  }
@@ -5764,7 +5770,7 @@ function createCliTools() {
5764
5770
  content: [
5765
5771
  {
5766
5772
  type: "text",
5767
- text: "⚠️ This command requires project-scoped API context. Run `supacloud status` to inspect current detection."
5773
+ text: `⚠️ This command requires project-scoped API context. Run \`${preferredCommand} status\` to inspect current detection.`
5768
5774
  }
5769
5775
  ]
5770
5776
  })
@@ -5780,9 +5786,9 @@ function createCliTools() {
5780
5786
  {
5781
5787
  type: "text",
5782
5788
  text: [
5783
- "⚠️ No project context found for supacloud.",
5789
+ `⚠️ No project context found for ${preferredCommand}.`,
5784
5790
  "",
5785
- "supacloud expects project-scoped credentials by default.",
5791
+ `${preferredCommand} expects project-scoped credentials by default.`,
5786
5792
  "Provide one of these sources:",
5787
5793
  "",
5788
5794
  " 1. Current workspace .env",
@@ -5843,9 +5849,9 @@ async function main() {
5843
5849
  console.log(JSON.stringify(result, null, 2));
5844
5850
  return;
5845
5851
  }
5846
- await runCli(cliTools, args, { commandName: "supacloud" });
5852
+ await runCli(cliTools, args, { commandName });
5847
5853
  }
5848
5854
  main().catch((error) => {
5849
- console.error("supacloud failed:", error);
5855
+ console.error(`${commandName} failed:`, error);
5850
5856
  process.exit(1);
5851
5857
  });
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@supacloud/cli",
3
- "version": "0.3.0",
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": [