@supacloud/cli 0.128.1 → 0.128.2
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/dist/index.js +94 -26
- package/dist/shared/tools/agent-completion.d.ts +17 -0
- package/dist/shared/tools/agent-completion.test.d.ts +1 -0
- package/dist/shared/tools/app-verification-plan.d.ts +6 -0
- package/dist/shared/tools/lite-cli-tools.d.ts +1 -2
- package/package.json +5 -5
- package/skills/supacloud/SKILL.md +17 -1
- package/skills/supacloud/references/command-map.md +4 -1
- package/skills/supacloud/references/database-workflow.md +12 -0
package/dist/index.js
CHANGED
|
@@ -19484,6 +19484,8 @@ var ACTION_POLICY = {
|
|
|
19484
19484
|
local: [
|
|
19485
19485
|
"version",
|
|
19486
19486
|
"start",
|
|
19487
|
+
"handoff",
|
|
19488
|
+
"complete",
|
|
19487
19489
|
"migrate",
|
|
19488
19490
|
"status",
|
|
19489
19491
|
"keys",
|
|
@@ -29493,6 +29495,8 @@ function buildLiteArgs(request) {
|
|
|
29493
29495
|
return ["--version"];
|
|
29494
29496
|
switch (request.action) {
|
|
29495
29497
|
case "start":
|
|
29498
|
+
case "handoff":
|
|
29499
|
+
case "complete":
|
|
29496
29500
|
case "migrate":
|
|
29497
29501
|
case "status":
|
|
29498
29502
|
case "keys":
|
|
@@ -29553,10 +29557,12 @@ function buildLiteArgs(request) {
|
|
|
29553
29557
|
optionalFlag(args, "--replication-tls-key", request.replication_tls_key);
|
|
29554
29558
|
optionalFlag(args, "--output", request.output);
|
|
29555
29559
|
optionalFlag(args, "--file", request.action === "db_diff" ? request.file : undefined);
|
|
29556
|
-
|
|
29560
|
+
if (request.service_role === true) {
|
|
29561
|
+
throw new Error("The Lite agent adapter cannot print or forward the service_role key");
|
|
29562
|
+
}
|
|
29557
29563
|
booleanFlag(args, "--force", request.force);
|
|
29558
29564
|
booleanFlag(args, "--memory", request.memory);
|
|
29559
|
-
if (request.format === "json")
|
|
29565
|
+
if (request.action === "handoff" || request.format === "json")
|
|
29560
29566
|
args.push("--json");
|
|
29561
29567
|
if (request.baseline && request.action !== "db_pull")
|
|
29562
29568
|
throw new Error("baseline requires db_pull");
|
|
@@ -29564,8 +29570,9 @@ function buildLiteArgs(request) {
|
|
|
29564
29570
|
if (request.production && request.action !== "doctor")
|
|
29565
29571
|
throw new Error("production requires doctor");
|
|
29566
29572
|
booleanFlag(args, "--production", request.production);
|
|
29567
|
-
if (request.module_file && request.action !== "db_check")
|
|
29568
|
-
throw new Error("module_file requires db_check");
|
|
29573
|
+
if (request.module_file && request.action !== "db_check" && request.action !== "complete" && request.action !== "handoff" && request.action !== "start") {
|
|
29574
|
+
throw new Error("module_file requires db_check, complete, handoff, or start");
|
|
29575
|
+
}
|
|
29569
29576
|
optionalFlag(args, "--module-file", request.module_file);
|
|
29570
29577
|
optionalFlag(args, "--runtime-mode", request.runtime_mode);
|
|
29571
29578
|
optionalFlag(args, "--postgres-dir", request.postgres_dir);
|
|
@@ -29628,6 +29635,24 @@ async function executeLiteCli(request, environment, fallbackWorkdir) {
|
|
|
29628
29635
|
].join(" "));
|
|
29629
29636
|
}
|
|
29630
29637
|
}
|
|
29638
|
+
function containsPrivilegedProjectKey(text) {
|
|
29639
|
+
if (/service_role key\s*:/i.test(text))
|
|
29640
|
+
return true;
|
|
29641
|
+
for (const match of text.matchAll(/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g)) {
|
|
29642
|
+
const payload = match[0]?.split(".")[1];
|
|
29643
|
+
if (!payload)
|
|
29644
|
+
continue;
|
|
29645
|
+
try {
|
|
29646
|
+
const claims = JSON.parse(Buffer.from(payload.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8"));
|
|
29647
|
+
if (claims.role === "service_role")
|
|
29648
|
+
return true;
|
|
29649
|
+
} catch {}
|
|
29650
|
+
}
|
|
29651
|
+
return false;
|
|
29652
|
+
}
|
|
29653
|
+
function agentJsonResult(action, request) {
|
|
29654
|
+
return action === "handoff" || request.format === "json" && (action === "keys" || action === "complete");
|
|
29655
|
+
}
|
|
29631
29656
|
function formatExecutionText2(action, execution) {
|
|
29632
29657
|
const combinedOutput = [execution.stdout.trim(), execution.stderr.trim()].filter(Boolean).join(`
|
|
29633
29658
|
`);
|
|
@@ -29639,10 +29664,12 @@ function registerLiteCliTools(server, options = {}) {
|
|
|
29639
29664
|
const environment = options.environment || process.env;
|
|
29640
29665
|
const fallbackWorkdir = options.currentWorkingDirectory || process.cwd();
|
|
29641
29666
|
const execute = options.executeLiteCli || ((request) => executeLiteCli(request, environment, fallbackWorkdir));
|
|
29642
|
-
registerTool(server, "lite", "Controlled adapter for the local SupaCloud Lite CLI.
|
|
29667
|
+
registerTool(server, "lite", "Controlled adapter for the local SupaCloud Lite CLI. One worktree uses one project database. handoff returns only the project URL, the anon key, and the next commands. Schema and seed changes go through forward migrations. complete runs the existing RLS reconcile and is not done when that check is skipped. This adapter never prints the service_role key and never calls the Management API.", {
|
|
29643
29668
|
action: withDescription(stringEnum2([
|
|
29644
29669
|
"version",
|
|
29645
29670
|
"start",
|
|
29671
|
+
"handoff",
|
|
29672
|
+
"complete",
|
|
29646
29673
|
"migrate",
|
|
29647
29674
|
"status",
|
|
29648
29675
|
"keys",
|
|
@@ -29683,10 +29710,9 @@ function registerLiteCliTools(server, options = {}) {
|
|
|
29683
29710
|
output: optional(String2(), "[gen_types/snapshot_create/upgrade] Output path"),
|
|
29684
29711
|
file: optional(String2(), "[db_diff/db_pull] Migration suffix or name"),
|
|
29685
29712
|
snapshot_file: optional(String2(), "[snapshot_restore] Snapshot archive"),
|
|
29686
|
-
service_role: optional(Boolean2(), "[keys] Also print the service_role key"),
|
|
29687
29713
|
force: optional(Boolean2(), "[snapshot_restore] Replace non-empty restore targets"),
|
|
29688
29714
|
memory: optional(Boolean2(), "[*] Use an in-memory PGlite database"),
|
|
29689
|
-
format: optional(stringEnum2(["text", "json"]), "[doctor] Output format
|
|
29715
|
+
format: optional(stringEnum2(["text", "json"]), "[start/keys/complete/doctor] Output format. start, keys, and handoff JSON is the agent handoff."),
|
|
29690
29716
|
baseline: optional(Boolean2(), "[db_pull] Record already-present schema in local migration history after review"),
|
|
29691
29717
|
production: optional(Boolean2(), "[doctor] Add single-node production readiness checks"),
|
|
29692
29718
|
runtime_mode: optional(stringEnum2(["development", "strict"]), "[*] Lite runtime mode"),
|
|
@@ -29694,13 +29720,21 @@ function registerLiteCliTools(server, options = {}) {
|
|
|
29694
29720
|
identity_module: optional(String2(), "[*] Trusted external identity bridge module"),
|
|
29695
29721
|
external_auth_proxy_issuer: optional(String2(), "[start] Same-origin OAuth proxy issuer"),
|
|
29696
29722
|
external_auth_proxy_redirect_origin: optional(String2(), "[start] Allowed logout redirect origins"),
|
|
29697
|
-
module_file: optional(String2(), "[db_check] Database module manifest")
|
|
29723
|
+
module_file: optional(String2(), "[db_check/complete/handoff/start] Database module manifest")
|
|
29698
29724
|
}, async (request) => {
|
|
29725
|
+
if (request.service_role === true) {
|
|
29726
|
+
throw new Error("The Lite agent adapter cannot print or forward the service_role key");
|
|
29727
|
+
}
|
|
29699
29728
|
buildLiteArgs(request);
|
|
29700
29729
|
const execution = await execute(request);
|
|
29730
|
+
if (containsPrivilegedProjectKey(`${execution.stdout}
|
|
29731
|
+
${execution.stderr}`)) {
|
|
29732
|
+
throw new Error("Refusing to return a service_role key to the agent");
|
|
29733
|
+
}
|
|
29734
|
+
const text = agentJsonResult(request.action, request) ? execution.stdout.trim() : formatExecutionText2(request.action, execution);
|
|
29701
29735
|
return {
|
|
29702
29736
|
isError: execution.exitCode !== 0,
|
|
29703
|
-
content: [{ type: "text", text
|
|
29737
|
+
content: [{ type: "text", text }]
|
|
29704
29738
|
};
|
|
29705
29739
|
});
|
|
29706
29740
|
}
|
|
@@ -30122,7 +30156,7 @@ var starter_metadata_default = {
|
|
|
30122
30156
|
generatedBy: "supacloud/starter-metadata-v1",
|
|
30123
30157
|
packages: {
|
|
30124
30158
|
compiler: {
|
|
30125
|
-
version: "0.
|
|
30159
|
+
version: "0.66.1"
|
|
30126
30160
|
},
|
|
30127
30161
|
app: {
|
|
30128
30162
|
version: "0.39.5",
|
|
@@ -30140,7 +30174,7 @@ var starter_metadata_default = {
|
|
|
30140
30174
|
version: "0.16.3"
|
|
30141
30175
|
},
|
|
30142
30176
|
db: {
|
|
30143
|
-
version: "0.26.
|
|
30177
|
+
version: "0.26.1",
|
|
30144
30178
|
dependencies: {},
|
|
30145
30179
|
devDependencies: {},
|
|
30146
30180
|
peerDependencies: {
|
|
@@ -36667,6 +36701,15 @@ async function createVerificationPlan(root, graph, target, sourceRoot = root) {
|
|
|
36667
36701
|
manual.push("No colocated tests found; declare a focused test before changing this module");
|
|
36668
36702
|
if (selected.length > 32)
|
|
36669
36703
|
manual.push("More than 32 local tests; narrow module ownership before execution");
|
|
36704
|
+
const completion = {
|
|
36705
|
+
rls: "required",
|
|
36706
|
+
skipped_is_done: false,
|
|
36707
|
+
executed: false,
|
|
36708
|
+
commands: [
|
|
36709
|
+
["supacloud", "db", "module_check", "--module_file", "db/modules.ts"],
|
|
36710
|
+
["supacloud-lite", "complete", "--project-dir", ".", "--module-file", "supabase/db/modules.ts"]
|
|
36711
|
+
]
|
|
36712
|
+
};
|
|
36670
36713
|
return {
|
|
36671
36714
|
version: 1,
|
|
36672
36715
|
source: "declaration",
|
|
@@ -36678,14 +36721,16 @@ async function createVerificationPlan(root, graph, target, sourceRoot = root) {
|
|
|
36678
36721
|
...selected.map((file) => ["bun", "test", `./${file}`]),
|
|
36679
36722
|
["git", "diff", "--check"]
|
|
36680
36723
|
] : [],
|
|
36724
|
+
completion,
|
|
36681
36725
|
manual,
|
|
36682
36726
|
coverage,
|
|
36683
36727
|
limitations: [
|
|
36684
36728
|
"Colocation selects candidates; it does not prove behavioral coverage",
|
|
36685
36729
|
"Dependent modules and database behavior require explicit integration acceptance",
|
|
36686
|
-
"No recursive scan, test execution or generated-file repair is performed"
|
|
36730
|
+
"No recursive scan, test execution or generated-file repair is performed",
|
|
36731
|
+
"RLS completion commands are required and were not executed by this plan"
|
|
36687
36732
|
],
|
|
36688
|
-
releaseOnly: ["generated artifact drift", "consumer types", "
|
|
36733
|
+
releaseOnly: ["generated artifact drift", "consumer types", "authenticated integration", "delivery read-back"],
|
|
36689
36734
|
executed: false
|
|
36690
36735
|
};
|
|
36691
36736
|
}
|
|
@@ -37377,6 +37422,7 @@ async function runContext(args) {
|
|
|
37377
37422
|
["supacloud", "app", "compile"],
|
|
37378
37423
|
...verification.commands
|
|
37379
37424
|
],
|
|
37425
|
+
completion: verification.completion,
|
|
37380
37426
|
release: {
|
|
37381
37427
|
first: ["supacloud", "app", "check", "--format", "json"],
|
|
37382
37428
|
rule: "Check committed artifacts before any regeneration; never repair drift to make this gate pass",
|
|
@@ -37390,7 +37436,8 @@ async function runContext(args) {
|
|
|
37390
37436
|
` focused tests: ${verification.tests.join(", ") || "-"}`,
|
|
37391
37437
|
...verification.manual.map((item) => ` manual: ${item}`),
|
|
37392
37438
|
" fixes: preview first; business policy requires explicit input",
|
|
37393
|
-
" release: app check before regeneration; local tests do not prove deployment"
|
|
37439
|
+
" release: app check before regeneration; local tests do not prove deployment",
|
|
37440
|
+
` completion: not done until ${verification.completion.commands.map((command) => command.join(" ")).join("; ")}`
|
|
37394
37441
|
].join(`
|
|
37395
37442
|
`));
|
|
37396
37443
|
}
|
|
@@ -38843,6 +38890,28 @@ import {
|
|
|
38843
38890
|
} from "@supacloud/db";
|
|
38844
38891
|
import { databaseSources } from "@supacloud/db/source-contracts";
|
|
38845
38892
|
|
|
38893
|
+
// src/shared/tools/agent-completion.ts
|
|
38894
|
+
function databaseCheckCompletion(report) {
|
|
38895
|
+
const catalog = report.checks.find((check) => check.name === "catalog");
|
|
38896
|
+
if (!catalog || catalog.skipped === true) {
|
|
38897
|
+
return {
|
|
38898
|
+
done: false,
|
|
38899
|
+
rls_checks: "skipped",
|
|
38900
|
+
skipped_is_done: false,
|
|
38901
|
+
reason: "The catalog reconcile, including rls-disabled, did not run"
|
|
38902
|
+
};
|
|
38903
|
+
}
|
|
38904
|
+
if (!report.ok || catalog.ok !== true) {
|
|
38905
|
+
return {
|
|
38906
|
+
done: false,
|
|
38907
|
+
rls_checks: "ran",
|
|
38908
|
+
skipped_is_done: false,
|
|
38909
|
+
reason: "The catalog reconcile reported an error"
|
|
38910
|
+
};
|
|
38911
|
+
}
|
|
38912
|
+
return { done: true, rls_checks: "ran", skipped_is_done: false };
|
|
38913
|
+
}
|
|
38914
|
+
|
|
38846
38915
|
// src/shared/tools/db-workflow.ts
|
|
38847
38916
|
import { createHash as createHash9 } from "node:crypto";
|
|
38848
38917
|
import { lstat as lstat4, mkdir as mkdir7, mkdtemp, readFile as readFile6, readdir as readdir6, rename as rename3, rm as rm2, writeFile as writeFile6 } from "node:fs/promises";
|
|
@@ -40121,12 +40190,10 @@ async function runCheck2(args, root, environment, spawn, liteBinary, options) {
|
|
|
40121
40190
|
} else {
|
|
40122
40191
|
checks.push({ name: "catalog", skipped: true, reason: "no --database_url, DATABASE_URL, --lite or --remote" });
|
|
40123
40192
|
}
|
|
40193
|
+
const report = { version: 1, scope: "database-check", root, ok, checks };
|
|
40124
40194
|
return textResult3(JSON.stringify({
|
|
40125
|
-
|
|
40126
|
-
|
|
40127
|
-
root,
|
|
40128
|
-
ok,
|
|
40129
|
-
checks
|
|
40195
|
+
...report,
|
|
40196
|
+
completion: databaseCheckCompletion(report)
|
|
40130
40197
|
}, null, 2), !ok);
|
|
40131
40198
|
}
|
|
40132
40199
|
async function runExplain2(args, root) {
|
|
@@ -44414,7 +44481,7 @@ async function runProjectDeployment(http, args) {
|
|
|
44414
44481
|
// package.json
|
|
44415
44482
|
var package_default = {
|
|
44416
44483
|
name: "@supacloud/cli",
|
|
44417
|
-
version: "0.128.
|
|
44484
|
+
version: "0.128.2",
|
|
44418
44485
|
description: "Project-scoped CLI for SupaCloud users",
|
|
44419
44486
|
type: "module",
|
|
44420
44487
|
main: "./dist/index.js",
|
|
@@ -44466,17 +44533,17 @@ var package_default = {
|
|
|
44466
44533
|
directory: "packages/cli"
|
|
44467
44534
|
},
|
|
44468
44535
|
dependencies: {
|
|
44469
|
-
"@supacloud/compiler": "^0.
|
|
44536
|
+
"@supacloud/compiler": "^0.66.1",
|
|
44470
44537
|
"@supacloud/delivery": "0.30.0",
|
|
44471
|
-
"@supacloud/db": "0.26.
|
|
44538
|
+
"@supacloud/db": "0.26.1",
|
|
44472
44539
|
typebox: "1.4.3"
|
|
44473
44540
|
},
|
|
44474
44541
|
overrides: {
|
|
44475
44542
|
"@supacloud/contracts": "0.16.3",
|
|
44476
44543
|
"@supacloud/delivery": "0.30.0",
|
|
44477
44544
|
"@graphql-tools/utils": "^12.0.4",
|
|
44478
|
-
"@supacloud/compiler": "^0.
|
|
44479
|
-
"@supacloud/db": "0.26.
|
|
44545
|
+
"@supacloud/compiler": "^0.66.1",
|
|
44546
|
+
"@supacloud/db": "0.26.1",
|
|
44480
44547
|
"deepmerge-ts": "8.0.2",
|
|
44481
44548
|
prisma: "6.19.3"
|
|
44482
44549
|
},
|
|
@@ -44733,8 +44800,9 @@ EXAMPLES
|
|
|
44733
44800
|
${preferredCommand} supabase db_diff --schema public --name add_accounts
|
|
44734
44801
|
${preferredCommand} supabase push --ref abc123 --dir supabase/migrations --dry_run
|
|
44735
44802
|
${preferredCommand} supabase db_dump --db_url "postgresql://..." --file backups/schema.sql
|
|
44736
|
-
${preferredCommand} lite
|
|
44737
|
-
${preferredCommand} lite start --project_dir . --port 54321
|
|
44803
|
+
${preferredCommand} lite handoff --project_dir .
|
|
44804
|
+
${preferredCommand} lite start --project_dir . --port 54321 --format json
|
|
44805
|
+
${preferredCommand} lite complete --project_dir . --module_file supabase/db/modules.ts
|
|
44738
44806
|
${preferredCommand} lite doctor --project_dir . --format json
|
|
44739
44807
|
${preferredCommand} branch create --name feature-auth --data_mode schema_only
|
|
44740
44808
|
${preferredCommand} branch promotion_plan --branch_ref preview123
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface DatabaseCheckCompletion {
|
|
2
|
+
done: boolean;
|
|
3
|
+
rls_checks: "ran" | "skipped";
|
|
4
|
+
skipped_is_done: false;
|
|
5
|
+
reason?: string;
|
|
6
|
+
}
|
|
7
|
+
interface DatabaseCheckReport {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
checks: ReadonlyArray<{
|
|
10
|
+
name: string;
|
|
11
|
+
skipped?: boolean;
|
|
12
|
+
ok?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/** Catalog reconcile is the existing RLS check. Skipping it is not agent completion. */
|
|
16
|
+
export declare function databaseCheckCompletion(report: DatabaseCheckReport): DatabaseCheckCompletion;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,6 +8,12 @@ export declare function createVerificationPlan(root: string, graph: ApplicationG
|
|
|
8
8
|
files: string[];
|
|
9
9
|
tests: string[];
|
|
10
10
|
commands: string[][];
|
|
11
|
+
completion: {
|
|
12
|
+
rls: "required";
|
|
13
|
+
skipped_is_done: false;
|
|
14
|
+
executed: boolean;
|
|
15
|
+
commands: string[][];
|
|
16
|
+
};
|
|
11
17
|
manual: string[];
|
|
12
18
|
coverage: {
|
|
13
19
|
directory: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { resolveLiteCommand } from "./lite-cli-command";
|
|
2
2
|
import { type ToolServer } from "../tool-server";
|
|
3
|
-
export type LiteCliAction = "version" | "start" | "migrate" | "status" | "keys" | "gen_types" | "db_reset" | "db_diff" | "db_pull" | "db_check" | "snapshot_create" | "snapshot_restore" | "upgrade" | "inspect" | "doctor";
|
|
3
|
+
export type LiteCliAction = "version" | "start" | "handoff" | "complete" | "migrate" | "status" | "keys" | "gen_types" | "db_reset" | "db_diff" | "db_pull" | "db_check" | "snapshot_create" | "snapshot_restore" | "upgrade" | "inspect" | "doctor";
|
|
4
4
|
export interface LiteCliArgs {
|
|
5
5
|
action: LiteCliAction;
|
|
6
6
|
workdir?: string;
|
|
@@ -30,7 +30,6 @@ export interface LiteCliArgs {
|
|
|
30
30
|
output?: string;
|
|
31
31
|
file?: string;
|
|
32
32
|
snapshot_file?: string;
|
|
33
|
-
service_role?: boolean;
|
|
34
33
|
force?: boolean;
|
|
35
34
|
memory?: boolean;
|
|
36
35
|
format?: "text" | "json";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.128.
|
|
3
|
+
"version": "0.128.2",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.
|
|
55
|
+
"@supacloud/compiler": "^0.66.1",
|
|
56
56
|
"@supacloud/delivery": "0.30.0",
|
|
57
|
-
"@supacloud/db": "0.26.
|
|
57
|
+
"@supacloud/db": "0.26.1",
|
|
58
58
|
"typebox": "1.4.3"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
61
|
"@supacloud/contracts": "0.16.3",
|
|
62
62
|
"@supacloud/delivery": "0.30.0",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.4",
|
|
64
|
-
"@supacloud/compiler": "^0.
|
|
65
|
-
"@supacloud/db": "0.26.
|
|
64
|
+
"@supacloud/compiler": "^0.66.1",
|
|
65
|
+
"@supacloud/db": "0.26.1",
|
|
66
66
|
"deepmerge-ts": "8.0.2",
|
|
67
67
|
"prisma": "6.19.3"
|
|
68
68
|
},
|
|
@@ -18,7 +18,7 @@ Use `supacloud` as the project-level control surface and keep durable changes re
|
|
|
18
18
|
|
|
19
19
|
A missing remote project context does not block local `app init/generate/context/check/doctor`, `migration_new`, `db_diff`, or `db_reset`; it blocks remote inspection/apply until context is supplied.
|
|
20
20
|
|
|
21
|
-
2. Never place secrets, service-role keys, database URLs, passwords, or tokens in commands that will be logged, source files, migration files, or chat output.
|
|
21
|
+
2. Never place secrets, service-role keys, database URLs, passwords, or tokens in commands that will be logged, source files, migration files, or chat output. The Lite agent handoff is only `url`, `anon_key`, and `next`. Do not request or repeat the `service_role` key.
|
|
22
22
|
3. Treat schema, functions/RPC, triggers, RLS policies, indexes, grants, extensions, and seed/reference-data changes as migrations. Do not apply them through `database query`, `psql`, a dashboard SQL editor, or a raw Management API call.
|
|
23
23
|
4. Use `database query` only for read-only inspection unless the user explicitly authorizes a documented break-glass operation. Break-glass work still requires a backup, rollback SQL, and a follow-up migration in the same task.
|
|
24
24
|
5. Run a remote migration dry-run before apply. Production apply requires explicit user approval in the current task.
|
|
@@ -70,6 +70,21 @@ supacloud app doctor --format json
|
|
|
70
70
|
supacloud app verify-plan --target <module>
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
For a local isolated backend, start Lite and read the handoff. Do not create a
|
|
74
|
+
second project database in the same worktree.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
supacloud-lite start --json --project-dir .
|
|
78
|
+
supacloud lite handoff --project_dir .
|
|
79
|
+
supacloud lite complete --project_dir . --module_file supabase/db/modules.ts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`handoff` prints only the project URL, the anon key, and the next commands.
|
|
83
|
+
Schema and seed changes are forward files under `supabase/migrations`, applied
|
|
84
|
+
with `lite migrate`. `complete` runs the existing RLS reconcile. A skipped RLS
|
|
85
|
+
check is not done. Production MCP stays plan-only. See
|
|
86
|
+
`docs/vibecoding-lite-agent-contract.md`.
|
|
87
|
+
|
|
73
88
|
Read [references/app-workflow.md](references/app-workflow.md) for the full
|
|
74
89
|
sequence and guardrails. `app fix` previews one reviewed diagnostic repair;
|
|
75
90
|
`--write` applies it and requires a recheck. These local app actions do not need
|
|
@@ -136,6 +151,7 @@ supacloud database baseline_migrations \
|
|
|
136
151
|
|
|
137
152
|
Before declaring success, provide:
|
|
138
153
|
|
|
154
|
+
- the Lite `complete` result, or `db check` / `db module_check` evidence whose `completion.done` is true, when the change touches a backend schema. `completion.rls_checks: "skipped"` is not done;
|
|
139
155
|
- migration filenames and reviewed diff;
|
|
140
156
|
- local reset/test/typecheck evidence appropriate to the project;
|
|
141
157
|
- remote dry-run evidence;
|
|
@@ -25,7 +25,10 @@ Load this reference when selecting a command surface or when a user asks an AI t
|
|
|
25
25
|
| Pull official Supabase configuration | `supabase config_pull` | Preview by default; local write requires `dry_run=false` and `yes`; not SupaCloud settings |
|
|
26
26
|
| Run the official local stack | `supabase stack_start`, `stack_prepare`, `stack_status`, `stack_stop` | Docker default; native alpha requires `SUPACLOUD_ENABLE_NATIVE_STACK=1` |
|
|
27
27
|
| Remove the official local stack | `supabase stack_destroy` | Local data loss; requires `confirm_destroy` and `yes` |
|
|
28
|
-
|
|
|
28
|
+
| Start a local agent backend | `lite handoff`, `lite start --format json` | One worktree, one database. JSON is `url`, `anon_key`, and `next` only. Never request the `service_role` key |
|
|
29
|
+
| Finish a local agent backend | `lite complete` | Runs the existing RLS reconcile. Skipped checks are not done |
|
|
30
|
+
| Change Lite schema or seed | `supabase/migrations` then `lite migrate` | Forward migrations only. Do not use ad-hoc SQL or production writes |
|
|
31
|
+
| Capture Lite drift | `lite db_diff`, `lite db_pull`, `lite db_check` | Operator inspection. Drafts stay outside the ledger. Not the agent authoring path. `db_check` is read-only |
|
|
29
32
|
| Rebuild local database | `supabase db_reset` | Local only; preserve required seed behavior |
|
|
30
33
|
| Inspect or back up a remote database | `supabase db_pull`, `migration_list`, `db_dump`, `gen_types` | Requires explicit PostgreSQL DSN; redact it |
|
|
31
34
|
| Replay the release-canary fixture stage receipt | `release release_canary_fixture_stage_replay` | Dual-bind Management project context and that project's service-role application origin; accepts only the exact subject/request UUID pair and a strict idempotent receipt |
|
|
@@ -96,6 +96,18 @@ Do not fabricate old migration files and immediately push them. Reconcile delibe
|
|
|
96
96
|
10. Never insert/update/delete `supabase_migrations.schema_migrations` via `database query`. If the controlled baseline action cannot represent the verified state, stop and request operator assistance.
|
|
97
97
|
11. Run `supabase push --dry_run`; it should report no unintended pending historical migration. Read back migration history and affected objects.
|
|
98
98
|
|
|
99
|
+
## Lite agent schema path
|
|
100
|
+
|
|
101
|
+
Use one project database for the worktree. Read `lite handoff` or
|
|
102
|
+
`lite start --format json`. Keep the `service_role` key out of the model
|
|
103
|
+
context. Put schema and seed changes in a new forward migration and apply them
|
|
104
|
+
with `lite migrate`. Run `lite complete` before calling the backend done. That
|
|
105
|
+
command runs the existing module reconcile, including `rls-disabled`. A missing
|
|
106
|
+
manifest or a manifest with no owned tables is skipped, and skipped is not done.
|
|
107
|
+
|
|
108
|
+
`lite db_pull` and `lite db_diff` are operator drift tools. They are not the
|
|
109
|
+
agent path for applying schema. Do not point them at production.
|
|
110
|
+
|
|
99
111
|
## Lite drift
|
|
100
112
|
|
|
101
113
|
For Lite, `lite db_pull` writes drafts outside migrations and does not silently
|