@supacloud/cli 0.85.0 → 0.87.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 +193 -151
- package/dist/index.js +305 -103
- package/dist/shared/context.d.ts +6 -0
- package/dist/shared/tools/ai-tools.d.ts +1 -1
- package/dist/shared/tools/application-schemas.d.ts +34 -0
- package/dist/shared/tools/application-tools.d.ts +2 -1
- package/dist/shared/tools/deploy-tools.d.ts +15 -1
- package/package.json +5 -5
- package/skills/{supacloud-cli → supacloud}/SKILL.md +17 -17
- package/skills/supacloud/agents/openai.yaml +4 -0
- package/skills/{supacloud-cli → supacloud}/references/command-map.md +7 -7
- package/skills/{supacloud-cli → supacloud}/references/database-workflow.md +7 -7
- package/skills/supacloud-cli/agents/openai.yaml +0 -4
package/dist/shared/context.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ export interface ResolvedContext {
|
|
|
21
21
|
credentialScope: ContextCredentialScope;
|
|
22
22
|
source: ContextSourceKind;
|
|
23
23
|
sourcePath: string | null;
|
|
24
|
+
environmentVariables: Readonly<Record<string, string>>;
|
|
25
|
+
applicationId: string;
|
|
26
|
+
applicationEnvironmentId: string;
|
|
27
|
+
applicationConfigurationPath: string;
|
|
28
|
+
applicationConfigurationId: string;
|
|
29
|
+
applicationManifestPath: string;
|
|
24
30
|
insecureTls: boolean;
|
|
25
31
|
}
|
|
26
32
|
export declare function resolveSupaCloudContext(env?: NodeJS.ProcessEnv, cwd?: string, selection?: ContextSelection): ResolvedContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ToolServer } from "../tool-server";
|
|
2
|
-
declare const SKILL_NAME = "supacloud
|
|
2
|
+
declare const SKILL_NAME = "supacloud";
|
|
3
3
|
type InstallMode = "dry-run" | "write";
|
|
4
4
|
type ConflictPolicy = "reject" | "replace";
|
|
5
5
|
type InstallAction = "create" | "replace" | "none";
|
|
@@ -152,3 +152,37 @@ export declare const ApplicationPromotionPlanSchema: import("typebox").TObject<{
|
|
|
152
152
|
execution_performed: import("typebox").TLiteral<false>;
|
|
153
153
|
data_recovery: import("typebox").TLiteral<"separate-required">;
|
|
154
154
|
}>;
|
|
155
|
+
export declare const ApplicationReleaseRequestSchema: import("typebox").TObject<{
|
|
156
|
+
release_id: import("typebox").TString;
|
|
157
|
+
configuration_id: import("typebox").TOptional<import("typebox").TString>;
|
|
158
|
+
configuration_write: import("typebox").TOptional<import("typebox").TObject<{
|
|
159
|
+
configuration_id: import("typebox").TString;
|
|
160
|
+
expected_configuration_id: import("typebox").TUnion<[import("typebox").TString, import("typebox").TNull]>;
|
|
161
|
+
configuration: import("typebox").TObject<{
|
|
162
|
+
bun_version: import("typebox").TString;
|
|
163
|
+
targets: import("typebox").TArray<import("typebox").TObject<{
|
|
164
|
+
name: import("typebox").TString;
|
|
165
|
+
kind: import("typebox").TUnion<[import("typebox").TLiteral<"http">, import("typebox").TLiteral<"worker">]>;
|
|
166
|
+
hosts: import("typebox").TArray<import("typebox").TString>;
|
|
167
|
+
environment: import("typebox").TRecord<"^.*$", import("typebox").TString>;
|
|
168
|
+
}>>;
|
|
169
|
+
}>;
|
|
170
|
+
}>>;
|
|
171
|
+
activation_id: import("typebox").TOptional<import("typebox").TString>;
|
|
172
|
+
expected_activation_id: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TString, import("typebox").TNull]>>;
|
|
173
|
+
expected_plan_sha256: import("typebox").TOptional<import("typebox").TString>;
|
|
174
|
+
}>;
|
|
175
|
+
export declare const ApplicationReleaseResultSchema: import("typebox").TObject<{
|
|
176
|
+
schema: import("typebox").TLiteral<"supacloud.application-release.v1">;
|
|
177
|
+
project_ref: import("typebox").TString;
|
|
178
|
+
application_id: import("typebox").TString;
|
|
179
|
+
environment_id: import("typebox").TString;
|
|
180
|
+
release_id: import("typebox").TString;
|
|
181
|
+
configuration_id: import("typebox").TString;
|
|
182
|
+
activation_id: import("typebox").TString;
|
|
183
|
+
expected_activation_id: import("typebox").TUnion<[import("typebox").TString, import("typebox").TNull]>;
|
|
184
|
+
plan_sha256: import("typebox").TString;
|
|
185
|
+
action: import("typebox").TUnion<[import("typebox").TLiteral<"activate">, import("typebox").TLiteral<"no-op">]>;
|
|
186
|
+
replayed: import("typebox").TBoolean;
|
|
187
|
+
execution_performed: import("typebox").TBoolean;
|
|
188
|
+
}>;
|
|
@@ -9,7 +9,7 @@ export declare const APPLICATION_TOOL_SCHEMA: {
|
|
|
9
9
|
ttl_seconds: Type.TOptional<Type.TInteger>;
|
|
10
10
|
wait: Type.TOptional<Type.TBoolean>;
|
|
11
11
|
timeout_seconds: Type.TOptional<Type.TInteger>;
|
|
12
|
-
action: Type.TEnum<("list_releases" | "get_release" | "upload_release" | "activate_release" | "logs" | "get_runtime" | "get_deployment_evidence" | "get_configuration" | "get_release_transfer_plan" | "get_promotion_plan" | "get_promotion_status" | "get_rollback_snapshot" | "get_history" | "get_deploy_plan" | "get_preview_plan" | "list_previews" | "get_preview" | "put_configuration" | "transfer_release" | "promote_application" | "reconcile_promotion" | "create_preview" | "reconcile_preview" | "cleanup_preview" | "deploy_release" | "rollback_release" | "reconcile_activation" | "retire_activation")[]>;
|
|
12
|
+
action: Type.TEnum<("list_releases" | "get_release" | "upload_release" | "activate_release" | "logs" | "get_runtime" | "get_deployment_evidence" | "get_configuration" | "get_release_transfer_plan" | "get_promotion_plan" | "get_promotion_status" | "get_rollback_snapshot" | "get_history" | "get_deploy_plan" | "get_preview_plan" | "list_previews" | "get_preview" | "put_configuration" | "release_application" | "transfer_release" | "promote_application" | "reconcile_promotion" | "create_preview" | "reconcile_preview" | "cleanup_preview" | "deploy_release" | "rollback_release" | "reconcile_activation" | "retire_activation")[]>;
|
|
13
13
|
ref: Type.TString;
|
|
14
14
|
id: Type.TString;
|
|
15
15
|
environment_id: Type.TOptional<Type.TString>;
|
|
@@ -17,6 +17,7 @@ export declare const APPLICATION_TOOL_SCHEMA: {
|
|
|
17
17
|
activation_id: Type.TOptional<Type.TString>;
|
|
18
18
|
expected_activation_id: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull, Type.TLiteral<"absent">]>>;
|
|
19
19
|
configuration_path: Type.TOptional<Type.TString>;
|
|
20
|
+
configuration_write: Type.TOptional<Type.TUnknown>;
|
|
20
21
|
manifest_path: Type.TOptional<Type.TString>;
|
|
21
22
|
release_id: Type.TOptional<Type.TString>;
|
|
22
23
|
source_ref: Type.TOptional<Type.TString>;
|
|
@@ -5,6 +5,15 @@ interface DeployToolOptions {
|
|
|
5
5
|
projectRef?: string;
|
|
6
6
|
environment?: string | null;
|
|
7
7
|
cwd?: string;
|
|
8
|
+
environmentVariables?: Readonly<Record<string, string>>;
|
|
9
|
+
application?: {
|
|
10
|
+
id: string;
|
|
11
|
+
environmentId: string;
|
|
12
|
+
configurationPath?: string;
|
|
13
|
+
configurationId?: string;
|
|
14
|
+
manifestPath?: string;
|
|
15
|
+
};
|
|
16
|
+
applicationRelease?: (args: Record<string, unknown>) => Promise<ToolResponse>;
|
|
8
17
|
edgeFunctionDeploy?: (args: Record<string, unknown>) => Promise<ToolResponse>;
|
|
9
18
|
}
|
|
10
19
|
interface ToolResponse {
|
|
@@ -27,7 +36,12 @@ export declare const deployToolSchema: {
|
|
|
27
36
|
diff: Type.TOptional<Type.TBoolean>;
|
|
28
37
|
json: Type.TOptional<Type.TBoolean>;
|
|
29
38
|
};
|
|
30
|
-
export declare function findDeployConfigRoot(startDirectory: string): Promise<string>;
|
|
39
|
+
export declare function findDeployConfigRoot(startDirectory: string, environmentName?: string): Promise<string>;
|
|
40
|
+
export declare function createBuildEnvironment(names: string[] | undefined, environmentVariables: Readonly<Record<string, string>> | undefined): {
|
|
41
|
+
env: NodeJS.ProcessEnv;
|
|
42
|
+
names: string[];
|
|
43
|
+
missing: string[];
|
|
44
|
+
};
|
|
31
45
|
export declare function createFrontendArchive(outputDirectory: string): Promise<{
|
|
32
46
|
archivePath: string;
|
|
33
47
|
sha256: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"bin": {
|
|
21
|
-
"supacloud
|
|
21
|
+
"supacloud": "dist/index.js"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"NOTICE",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.
|
|
56
|
-
"@supacloud/delivery": "0.
|
|
55
|
+
"@supacloud/compiler": "^0.44.0",
|
|
56
|
+
"@supacloud/delivery": "0.14.0",
|
|
57
57
|
"@supacloud/db": "0.16.0",
|
|
58
58
|
"typebox": "1.3.34"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
61
|
"@supacloud/contracts": "0.8.0",
|
|
62
|
-
"@supacloud/delivery": "0.
|
|
62
|
+
"@supacloud/delivery": "0.14.0",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: supacloud
|
|
3
|
-
description: Use when operating, implementing, diagnosing, deploying, or documenting a SupaCloud project through supacloud
|
|
2
|
+
name: supacloud
|
|
3
|
+
description: Use when operating, implementing, diagnosing, deploying, or documenting a SupaCloud project through supacloud, especially project endpoint discovery, database schema, functions/RPC, triggers, RLS, indexes, grants, extensions, migrations, backups, auth, storage, Edge Functions, frontend, queues, task events, diagnostics, or gateway work. Also use when an AI might otherwise call SQL, psql, a database API, or the Management API directly.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# SupaCloud CLI
|
|
7
7
|
|
|
8
|
-
Use `supacloud
|
|
8
|
+
Use `supacloud` as the project-level control surface and keep durable changes reproducible from version-controlled files. Use `supacloud-admin` only for server/platform operations.
|
|
9
9
|
|
|
10
10
|
## Non-negotiable rules
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Use `supacloud-cli` as the project-level control surface and keep durable change
|
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
git status --short --branch
|
|
16
|
-
supacloud
|
|
16
|
+
supacloud status
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
A missing remote project context does not block local `migration_new`, `db_diff`, or `db_reset`; it blocks remote inspection/apply until context is supplied.
|
|
@@ -24,7 +24,7 @@ Use `supacloud-cli` as the project-level control surface and keep durable change
|
|
|
24
24
|
5. Run a remote migration dry-run before apply. Production apply requires explicit user approval in the current task.
|
|
25
25
|
6. Do not edit `supabase_migrations.schema_migrations` through ordinary SQL. Migration history is an application ledger, not a schema backup or source of truth. For a proven-equivalent historical baseline, use the controlled `database baseline_migrations` action with dry-run and explicit approval.
|
|
26
26
|
7. Service-role credentials authenticate the SupaCloud Management API. Never reinterpret them as PostgreSQL passwords or forward them to the official Supabase CLI.
|
|
27
|
-
8. Read project domains through `supacloud
|
|
27
|
+
8. Read project domains through `supacloud project endpoints`. Do not infer API, Auth, or Studio origins by concatenating project refs and base domains. The projection reports configuration, not DNS/certificate/runtime readiness.
|
|
28
28
|
9. Cross-project enumeration is an Admin boundary. Use `supacloud-admin project list` or `supacloud-admin project list_endpoints`; do not attempt to widen project credentials.
|
|
29
29
|
|
|
30
30
|
## Workflow
|
|
@@ -34,8 +34,8 @@ Use `supacloud-cli` as the project-level control surface and keep durable change
|
|
|
34
34
|
3. For AI-assisted database changes, first request bounded context:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
supacloud
|
|
38
|
-
supacloud
|
|
37
|
+
supacloud db context --module_file db/modules.ts --module <module>
|
|
38
|
+
supacloud db context --module_file db/modules.ts --target <object>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
Use the returned source/test paths and ownership boundary; do not scan or
|
|
@@ -52,8 +52,8 @@ Use `supacloud-cli` as the project-level control surface and keep durable change
|
|
|
52
52
|
For the selected project:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
supacloud
|
|
56
|
-
supacloud
|
|
55
|
+
supacloud status
|
|
56
|
+
supacloud project endpoints
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
The fixed projection contains credential-free API/Auth/Studio origins, hosts,
|
|
@@ -66,18 +66,18 @@ ready. Project-wide or fleet-wide inventories belong to `supacloud-admin`.
|
|
|
66
66
|
For a new database change:
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
supacloud
|
|
69
|
+
supacloud supabase migration_new --name add_accounts
|
|
70
70
|
# Edit the generated SQL migration.
|
|
71
|
-
supacloud
|
|
72
|
-
supacloud
|
|
71
|
+
supacloud supabase db_reset --no_seed
|
|
72
|
+
supacloud supabase push --ref <project-ref> --dir supabase/migrations --dry_run
|
|
73
73
|
# Apply only after explicit approval.
|
|
74
|
-
supacloud
|
|
74
|
+
supacloud supabase push --ref <project-ref> --dir supabase/migrations
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
Use `db_diff` as an authoring aid, not as permission to bypass review:
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
|
-
supacloud
|
|
80
|
+
supacloud supabase db_diff --schema public --name reconcile_public_schema
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
For existing declarative SQL projects, `supabase db_schema_declarative_sync`
|
|
@@ -91,7 +91,7 @@ an existing Docker workflow. Lite drift pull writes drafts by default; only use
|
|
|
91
91
|
For a database that was previously changed directly, stop further direct writes and follow the reconciliation workflow in [references/database-workflow.md](references/database-workflow.md). Do not push guessed historical migrations against a live database. After schema equivalence is proven, preview and record the baseline through:
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
supacloud
|
|
94
|
+
supacloud database baseline_migrations \
|
|
95
95
|
--ref <project-ref> \
|
|
96
96
|
--dir supabase/migrations \
|
|
97
97
|
--dry_run
|
|
@@ -99,9 +99,9 @@ supacloud-cli database baseline_migrations \
|
|
|
99
99
|
|
|
100
100
|
## CLI boundaries
|
|
101
101
|
|
|
102
|
-
- `supacloud
|
|
102
|
+
- `supacloud`: selected-project status and endpoint projection, database, migrations, auth, storage, Edge Functions, frontend, queues, task events, diagnostics, and project gateway configuration.
|
|
103
103
|
- `supacloud-admin`: installation, upgrades, SSH diagnostics, platform-wide project/endpoint inventory, project lifecycle, tenant runtime, and server operations.
|
|
104
|
-
- Official `supabase` CLI: invoked only through the allowlisted `supacloud
|
|
104
|
+
- Official `supabase` CLI: invoked only through the allowlisted `supacloud supabase` adapter for supported local authoring or explicit-DSN inspection commands.
|
|
105
105
|
- Direct HTTP/SQL: read-only diagnosis or an explicitly approved break-glass path; never the default implementation path.
|
|
106
106
|
|
|
107
107
|
## Completion evidence
|
|
@@ -6,8 +6,8 @@ Load this reference when selecting a command surface or when a user asks an AI t
|
|
|
6
6
|
|
|
7
7
|
| Intent | Use | Guardrail |
|
|
8
8
|
| --- | --- | --- |
|
|
9
|
-
| Inspect current project binding | `supacloud
|
|
10
|
-
| Inspect selected project API/Auth/Studio origins | `supacloud
|
|
9
|
+
| Inspect current project binding | `supacloud status` | Read-only; run first |
|
|
10
|
+
| Inspect selected project API/Auth/Studio origins | `supacloud project endpoints` | Uses the Management API's authoritative projection; do not reconstruct domains locally |
|
|
11
11
|
| Enumerate projects or endpoint projections | `supacloud-admin project list` / `project list_endpoints` | Platform-wide read; never promote a project credential to Admin authority |
|
|
12
12
|
| Inspect project health/logs/tasks | `project`, `queue`, `task_events`, `diagnostics` | Prefer bounded reads |
|
|
13
13
|
| Read database rows or metadata | `database query` and database inspection actions | `SELECT`/read-only by default |
|
|
@@ -57,11 +57,11 @@ until a project-scoped context is resolved.
|
|
|
57
57
|
## Safe inspection pattern
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
|
-
supacloud
|
|
61
|
-
supacloud
|
|
62
|
-
supacloud
|
|
63
|
-
supacloud
|
|
64
|
-
supacloud
|
|
60
|
+
supacloud status
|
|
61
|
+
supacloud project get
|
|
62
|
+
supacloud project endpoints
|
|
63
|
+
supacloud project health
|
|
64
|
+
supacloud supabase migration_list --db_url "$SUPACLOUD_DB_URL"
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
The endpoint projection returns bounded, credential-free API/Auth/Studio origins,
|
|
@@ -8,7 +8,7 @@ Migration files are the durable source of truth. `supabase_migrations.schema_mig
|
|
|
8
8
|
2. Create a migration:
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
supacloud
|
|
11
|
+
supacloud supabase migration_new --name <intent>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
3. Put tables, views, functions/RPC, triggers, RLS, indexes, grants, extensions, and required reference data in the generated SQL file.
|
|
@@ -21,13 +21,13 @@ Migration files are the durable source of truth. `supabase_migrations.schema_mig
|
|
|
21
21
|
5. Rebuild locally and run application tests:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
supacloud
|
|
24
|
+
supacloud supabase db_reset --no_seed
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
6. Preview remote application:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
supacloud
|
|
30
|
+
supacloud supabase push --ref <project-ref> --dir supabase/migrations --dry_run
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
7. After explicit environment approval, apply and read back migration history.
|
|
@@ -38,7 +38,7 @@ Preserve the repository's existing schema authority. In a project already using
|
|
|
38
38
|
declarative SQL, edit those files and run:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
supacloud
|
|
41
|
+
supacloud supabase db_schema_declarative_sync --name <intent> --strict_coverage
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
The adapter defaults to no-apply. Review the generated migration, then use the
|
|
@@ -64,7 +64,7 @@ Do not fabricate old migration files and immediately push them. Reconcile delibe
|
|
|
64
64
|
3. Create a schema-only backup before changing tracking or schema:
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
supacloud
|
|
67
|
+
supacloud supabase db_dump \
|
|
68
68
|
--db_url "$SUPACLOUD_DB_URL" \
|
|
69
69
|
--file backups/pre-reconcile-schema.sql
|
|
70
70
|
```
|
|
@@ -72,7 +72,7 @@ Do not fabricate old migration files and immediately push them. Reconcile delibe
|
|
|
72
72
|
4. In an isolated branch/worktree, pull the actual remote schema:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
supacloud
|
|
75
|
+
supacloud supabase db_pull \
|
|
76
76
|
--db_url "$SUPACLOUD_DB_URL" \
|
|
77
77
|
--declarative \
|
|
78
78
|
--name remote_baseline
|
|
@@ -86,7 +86,7 @@ Do not fabricate old migration files and immediately push them. Reconcile delibe
|
|
|
86
86
|
8. Only after equivalence is proven, preview the controlled baseline action:
|
|
87
87
|
|
|
88
88
|
```bash
|
|
89
|
-
supacloud
|
|
89
|
+
supacloud database baseline_migrations \
|
|
90
90
|
--ref <project-ref> \
|
|
91
91
|
--dir supabase/migrations \
|
|
92
92
|
--dry_run
|