@motherbase/cli 0.2.4 → 0.2.5

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 (47) hide show
  1. package/README.md +247 -134
  2. package/package.json +2 -2
  3. package/src/api.js +14 -2
  4. package/src/commands/_util.js +49 -6
  5. package/src/commands/backups.js +16 -0
  6. package/src/commands/branches.js +113 -0
  7. package/src/commands/completion.js +90 -0
  8. package/src/commands/db-catalog.js +326 -0
  9. package/src/commands/db.js +16 -5
  10. package/src/commands/domains.js +124 -0
  11. package/src/commands/functions.js +297 -274
  12. package/src/commands/gen.js +172 -126
  13. package/src/commands/import.js +23 -3
  14. package/src/commands/index.js +27 -6
  15. package/src/commands/inspect.js +142 -5
  16. package/src/commands/keys.js +72 -72
  17. package/src/commands/local.js +273 -273
  18. package/src/commands/mcp.js +61 -43
  19. package/src/commands/migrate.js +179 -0
  20. package/src/commands/migration.js +81 -6
  21. package/src/commands/network.js +83 -0
  22. package/src/commands/orgs.js +40 -0
  23. package/src/commands/postgres-config.js +113 -0
  24. package/src/commands/projects.js +8 -3
  25. package/src/commands/queues.js +133 -0
  26. package/src/commands/secrets.js +29 -8
  27. package/src/commands/signing.js +130 -0
  28. package/src/commands/snippets.js +44 -0
  29. package/src/commands/storage.js +192 -44
  30. package/src/commands/test.js +9 -0
  31. package/src/commands/users.js +30 -1
  32. package/src/commands/vault.js +82 -0
  33. package/src/commands/wrappers.js +150 -0
  34. package/src/edge-templates.js +194 -0
  35. package/src/format.js +92 -0
  36. package/src/inspect/csv.js +22 -0
  37. package/src/inspect/queries.js +562 -0
  38. package/src/main.js +41 -7
  39. package/src/mcp/platform-tools.js +233 -0
  40. package/src/mcp/protocol.js +149 -149
  41. package/src/mcp/storage-tools.js +93 -0
  42. package/src/mcp/tools.js +478 -166
  43. package/src/migration/commands.js +375 -0
  44. package/src/migration/files.js +245 -0
  45. package/src/prompt.js +1 -1
  46. package/src/storage/remote.js +62 -0
  47. package/src/commands/migrations.js +0 -85
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ // Custom domains and vanity subdomains (Supabase's `supabase domains` and
4
+ // `supabase vanity-subdomains`). Both are Console routes on the linked project.
5
+
6
+ const api = require('../api');
7
+ const { output, requireArg, consoleProjectPath } = require('./_util');
8
+
9
+ function renderHostname(d, ui) {
10
+ const custom = d.customHostname;
11
+ if (!custom) {
12
+ ui.info(`No custom domain. The API answers on ${d.projectDomain}.`);
13
+ return;
14
+ }
15
+ ui.keyValue({ hostname: custom.hostname, status: custom.status, projectDomain: d.projectDomain });
16
+ if (custom.status !== 'active') {
17
+ ui.print('');
18
+ ui.print('Publish these DNS records, then run `motherbase domains reverify`:');
19
+ ui.table(custom.requiredRecords, [
20
+ { key: 'type', label: 'TYPE' },
21
+ { key: 'name', label: 'NAME' },
22
+ { key: 'value', label: 'VALUE' },
23
+ ]);
24
+ }
25
+ for (const check of custom.checks || []) {
26
+ ui[check.ok ? 'success' : 'warn'](`${check.record} ${check.name}: ${check.ok ? 'ok' : `found ${check.found.join(', ') || 'nothing'}`}`);
27
+ }
28
+ }
29
+
30
+ const hostnamePath = (ctx, suffix = '') => consoleProjectPath(ctx, `/custom-hostname${suffix}`);
31
+
32
+ const domains = {
33
+ summary: 'Custom domain for the linked project\'s API',
34
+ usage: 'motherbase domains <create|get|reverify|activate|delete> ...',
35
+ subcommands: {
36
+ create: {
37
+ summary: 'Start using a custom hostname (prints the DNS records to publish)',
38
+ usage: 'motherbase domains create --custom-hostname <api.example.com>',
39
+ async run(ctx, _args, flags) {
40
+ const hostname = requireArg(flags['custom-hostname'], 'custom-hostname');
41
+ const data = await api.consoleRequest(ctx, 'POST', hostnamePath(ctx), { body: { hostname } });
42
+ output(ctx, data, renderHostname);
43
+ },
44
+ },
45
+ get: {
46
+ summary: 'Show the custom hostname and its verification state',
47
+ usage: 'motherbase domains get',
48
+ async run(ctx) {
49
+ output(ctx, await api.consoleRequest(ctx, 'GET', hostnamePath(ctx)), renderHostname);
50
+ },
51
+ },
52
+ reverify: {
53
+ summary: 'Check the DNS records again',
54
+ usage: 'motherbase domains reverify',
55
+ async run(ctx) {
56
+ output(ctx, await api.consoleRequest(ctx, 'POST', hostnamePath(ctx, '/reverify')), renderHostname);
57
+ },
58
+ },
59
+ activate: {
60
+ summary: 'Serve the API on the verified hostname (TLS is issued on first request)',
61
+ usage: 'motherbase domains activate',
62
+ async run(ctx) {
63
+ output(ctx, await api.consoleRequest(ctx, 'POST', hostnamePath(ctx, '/activate')), renderHostname);
64
+ },
65
+ },
66
+ delete: {
67
+ summary: 'Stop using the custom hostname',
68
+ usage: 'motherbase domains delete',
69
+ async run(ctx) {
70
+ const data = await api.consoleRequest(ctx, 'DELETE', hostnamePath(ctx));
71
+ output(ctx, data, (_d, ui) => ui.success('Custom hostname removed'));
72
+ },
73
+ },
74
+ },
75
+ };
76
+
77
+ function renderVanity(d, ui) {
78
+ if (d.vanitySubdomain) ui.keyValue(d.vanitySubdomain);
79
+ else ui.info(`No vanity subdomain${d.vanitySuffix ? ` (they live under ${d.vanitySuffix})` : ''}.`);
80
+ }
81
+
82
+ const vanityPath = (ctx, suffix = '') => consoleProjectPath(ctx, `/vanity-subdomain${suffix}`);
83
+
84
+ const vanitySubdomains = {
85
+ summary: 'Vanity subdomain under the platform domain',
86
+ usage: 'motherbase vanity-subdomains <get|check-availability|activate|delete> ...',
87
+ subcommands: {
88
+ get: {
89
+ summary: 'Show the active vanity subdomain',
90
+ usage: 'motherbase vanity-subdomains get',
91
+ async run(ctx) {
92
+ output(ctx, await api.consoleRequest(ctx, 'GET', vanityPath(ctx)), renderVanity);
93
+ },
94
+ },
95
+ 'check-availability': {
96
+ summary: 'Is a subdomain free?',
97
+ usage: 'motherbase vanity-subdomains check-availability --desired-subdomain <name>',
98
+ async run(ctx, _args, flags) {
99
+ const subdomain = requireArg(flags['desired-subdomain'], 'desired-subdomain');
100
+ const data = await api.consoleRequest(ctx, 'POST', vanityPath(ctx, '/check-availability'), { body: { subdomain } });
101
+ output(ctx, data, (d, ui) => (d.available ? ui.success(`${d.hostname} is available`) : ui.warn(`${d.hostname} is taken`)));
102
+ },
103
+ },
104
+ activate: {
105
+ summary: 'Serve the API on <name>.<platform domain> as well',
106
+ usage: 'motherbase vanity-subdomains activate --desired-subdomain <name>',
107
+ async run(ctx, _args, flags) {
108
+ const subdomain = requireArg(flags['desired-subdomain'], 'desired-subdomain');
109
+ const data = await api.consoleRequest(ctx, 'POST', vanityPath(ctx), { body: { subdomain } });
110
+ output(ctx, data, renderVanity);
111
+ },
112
+ },
113
+ delete: {
114
+ summary: 'Remove the vanity subdomain',
115
+ usage: 'motherbase vanity-subdomains delete',
116
+ async run(ctx) {
117
+ const data = await api.consoleRequest(ctx, 'DELETE', vanityPath(ctx));
118
+ output(ctx, data, (_d, ui) => ui.success('Vanity subdomain removed'));
119
+ },
120
+ },
121
+ },
122
+ };
123
+
124
+ module.exports = { domains, vanitySubdomains };