Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
ad0c0fd
feat(config): add the workspace target key (CLI-2695)
Coly010 Oct 15, 2026
3ada876
feat(cli): add the shared target selector module (CLI-2695)
Coly010 Oct 15, 2026
ecbbd47
test(cli): refresh config precedence goldens for the workspace target…
Coly010 Oct 15, 2026
7448645
refactor(cli): keep the target flag option types module-private (CLI-…
Coly010 Oct 15, 2026
493b754
feat(cli): declare a target policy on every command (CLI-2695)
Coly010 Oct 15, 2026
f1b8543
refactor(cli): declare local database-target defaults for selectable …
Coly010 Oct 15, 2026
913bc28
feat(cli): announce the resolved target on stderr and in JSON results…
Coly010 Oct 15, 2026
5dd7356
feat(cli): resolve the project ref through one chain and announce the…
Coly010 Oct 15, 2026
617fa76
chore(cli): format the target policy test (CLI-2695)
Coly010 Oct 15, 2026
192c26a
feat(cli): resolve database targets and connections without defaults …
Coly010 Oct 15, 2026
f6cfd1c
feat(cli): add the hosted-mutation consent service (CLI-2695)
Coly010 Oct 15, 2026
4ade011
feat(cli): plan the db seed consent line without prompting (CLI-2695)
Coly010 Oct 15, 2026
c3de355
test(cli): guard the target selection and consent APIs (CLI-2695)
Coly010 Oct 15, 2026
880adcf
test(cli): add the hosted-consent test matrix helper (CLI-2695)
Coly010 Oct 15, 2026
b0f07b7
docs(cli): document target selection and hosted consent for agents (C…
Coly010 Oct 15, 2026
4f2707a
chore(cli): drop unused exports and a chained provide from the consen…
Coly010 Oct 15, 2026
515b3b4
docs(docs): add ADR 0033 for target selection and hosted-mutation con…
Coly010 Oct 15, 2026
24efd1f
docs(config): document the workspace target precedence (CLI-2695)
Coly010 Oct 15, 2026
5f28a72
feat(cli): require hosted-mutation consent for functions deploy and d…
Coly010 Oct 15, 2026
037c58b
feat(cli): require hosted-mutation consent for secrets set and unset …
Coly010 Oct 15, 2026
99ee293
feat(cli): default storage and seed buckets to the workspace target w…
Coly010 Oct 15, 2026
c32f002
refactor(cli): resolve db command targets through resolveTarget
Coly010 Oct 15, 2026
b4f235d
feat(cli): require hosted consent in branches, backups, domains, vani…
Coly010 Oct 15, 2026
f4d18f9
docs(cli): document hosted consent for branches, backups, domains, va…
Coly010 Oct 15, 2026
aae4275
feat(cli)!: resolve migration list/up/down/repair targets and require…
Coly010 Oct 15, 2026
6856267
feat(cli): resolve db push through the sync target group with one com…
Coly010 Oct 15, 2026
c5dc002
feat(cli): resolve the inspect target from the workspace target (CLI-…
Coly010 Oct 15, 2026
1eeb62a
test(cli): update db lint and advisors tests for resolved targets
Coly010 Oct 15, 2026
5bbf718
test(cli): update db dump tests for resolved targets
Coly010 Oct 15, 2026
630cc75
feat(cli): require hosted-mutation consent in the hosted command grou…
Coly010 Oct 15, 2026
4cb5f9c
docs(cli): document hosted consent and the target banner for the host…
Coly010 Oct 15, 2026
a8ac224
feat(cli): ask for hosted consent before creating or deleting project…
Coly010 Oct 15, 2026
a158e39
feat(cli): ask for hosted consent before compute push and delete
Coly010 Oct 15, 2026
2be069a
test(cli): update db diff tests for resolved targets
Coly010 Oct 15, 2026
c69c0e3
feat(cli): ask one hosted-mutation consent question for config push
Coly010 Oct 15, 2026
f827bae
feat(cli): resolve migration fetch through the sync target group
Coly010 Oct 15, 2026
48eb191
feat(cli)!: make migration squash target-aware with hosted consent, u…
Coly010 Oct 15, 2026
ef1ab50
feat(cli): add the linked target identity to config diff and pull JSON
Coly010 Oct 15, 2026
52f189c
test(cli): restore the ResolvedDbConfig import in the inspect specs test
Coly010 Oct 15, 2026
0967a0c
feat(cli): resolve the gen types target from the workspace target (CL…
Coly010 Oct 15, 2026
b4dca68
test(cli): cover storage and seed buckets target selection and hosted…
Coly010 Oct 15, 2026
917e2dc
docs(cli): document the gen types target defaults (CLI-2695)
Coly010 Oct 15, 2026
81ed1ca
test(cli): update db reset tests for resolved targets and hosted consent
Coly010 Oct 15, 2026
eb677fe
chore(cli): satisfy effect lint and knip for the storage and seed tar…
Coly010 Oct 15, 2026
7fd95ba
feat(cli): resolve db pull through the sync target group and consent …
Coly010 Oct 15, 2026
ed548e2
test(cli): cover db query resolved targets, read-only and hosted consent
Coly010 Oct 15, 2026
7bb7ee3
docs(cli): document hosted consent and target identity for functions,…
Coly010 Oct 15, 2026
d4ad440
chore(cli): keep retired consent error classes exported for knip and …
Coly010 Oct 15, 2026
51688b7
test(cli): update test db and db test for resolved targets and hosted…
Coly010 Oct 15, 2026
92c9cd4
feat(cli): consent once before pull writes and report the linked targ…
Coly010 Oct 15, 2026
57ee6db
docs(cli): document workspace target defaults and hosted consent for …
Coly010 Oct 15, 2026
37129ed
style(cli): format db command target migration files
Coly010 Oct 15, 2026
d3b2205
chore(cli): keep unused db target errors out of the knip report
Coly010 Oct 15, 2026
ee7bd8e
feat(cli): resolve the declarative generate target from the workspace…
Coly010 Oct 15, 2026
29c139b
docs(cli): document the declarative generate target defaults and the …
Coly010 Oct 15, 2026
2731e1d
chore(cli): fix format, effect lint and knip in the inspect and gen t…
Coly010 Oct 15, 2026
b90cfd0
feat(cli): confirm once before bootstrap creates the project and push…
Coly010 Oct 15, 2026
2673ef9
docs(cli): describe db push's default target and combined consent
Coly010 Oct 15, 2026
7975197
chore(cli): retire the prompt-era target and cancel errors and tidy s…
Coly010 Oct 15, 2026
12fc793
fix(cli): reject transaction control under db query --read-only (CLI-…
Coly010 Oct 15, 2026
502e195
chore(cli): merge CLI-2695 shard b
Coly010 Oct 15, 2026
b268d2e
chore(cli): merge CLI-2695 shard c
Coly010 Oct 15, 2026
5b1ac43
chore(cli): merge CLI-2695 shard d
Coly010 Oct 15, 2026
af8305a
chore(cli): merge CLI-2695 shard e
Coly010 Oct 15, 2026
e6b0ea1
chore(cli): merge CLI-2695 shard f
Coly010 Oct 15, 2026
887bb79
chore(cli): merge CLI-2695 shard g1
Coly010 Oct 15, 2026
68e83eb
chore(cli): merge CLI-2695 shard g2
Coly010 Oct 15, 2026
e3c2f72
chore(cli): merge CLI-2695 shard h
Coly010 Oct 15, 2026
879c516
chore(cli): merge CLI-2695 shard a
Coly010 Oct 15, 2026
ad58e12
test(cli): require a hosted-consent matrix for every consenting leaf
Coly010 Oct 15, 2026
1cd8270
test(cli): drop the account target banner stopgap from hosted-consent…
Coly010 Oct 15, 2026
44f556e
test(cli): assert db query --linked as a defaulted switch in the flag…
Coly010 Oct 15, 2026
1f65a1b
refactor(cli): remove the legacy db target resolution surface
Coly010 Oct 15, 2026
ccd9cd3
refactor(cli): delete the cancel and mutual-exclusion errors consent …
Coly010 Oct 15, 2026
c67e900
refactor(cli): drop redundant linked-target work and duplicate target…
Coly010 Oct 15, 2026
6f3f581
fix(cli): name the config file when target resolution cannot parse it
Coly010 Oct 15, 2026
23cdf3a
fix(cli): ask bootstrap's hosted consent once
Coly010 Oct 15, 2026
fecec51
refactor(cli): build pull's linked target in project-target
Coly010 Oct 15, 2026
0beacee
docs(cli): refresh target wording and stale comments
Coly010 Oct 15, 2026
1388dc4
test(cli): expect the readable config load error from db reset
Coly010 Oct 15, 2026
ca8bd80
chore(cli): remove imports and fixtures the cleanup left unused
Coly010 Oct 15, 2026
079dbea
chore(cli): merge CLI-2695 shard j2
Coly010 Oct 15, 2026
e907734
chore(cli): merge next into CLI-2695
Coly010 Oct 15, 2026
5825304
test(cli): name the consent-free operations that next now maps
Coly010 Oct 15, 2026
d5b14c4
test(cli): align merged integration tests with the target banner and …
Coly010 Oct 15, 2026
11bdda2
fix(cli): drop imports left unused by the next merge
Coly010 Oct 15, 2026
1b5e187
fix(cli): accept gen types --linked with --project-ref and announce t…
Coly010 Oct 15, 2026
8131c15
fix(cli): emit the functions deploy json envelope after pruning
Coly010 Oct 15, 2026
73772c0
fix(cli): gate network-ban removal on a --yes approval and report ban…
Coly010 Oct 15, 2026
da1c04a
chore(cli): merge gen types and functions deploy review fixes
Coly010 Oct 15, 2026
e6b0c64
fix(cli): consume a closing */ before the next block-comment delimite…
Coly010 Oct 15, 2026
16acb92
fix(cli): restrict db query --read-only to read statements and cap lo…
Coly010 Oct 15, 2026
fda5591
fix(cli): suggest the resolved target's flag when repairing migration…
Coly010 Oct 15, 2026
cca834c
fix(cli): name the migration list history column after the target
Coly010 Oct 15, 2026
c1c460b
docs(cli): refresh db dump, inspect, repair and target help for the l…
Coly010 Oct 15, 2026
4e296c1
feat(cli): point local connection failures at --linked on a linked ch…
Coly010 Oct 15, 2026
78a2d38
fix(cli): let db query --read-only start a statement with a parenthes…
Coly010 Oct 15, 2026
e51deed
chore(cli): merge db query read-only hardening
Coly010 Oct 15, 2026
97977db
fix(cli): suggest a valid value for empty target flags and date the -…
Coly010 Oct 15, 2026
6d04b90
fix(cli): tighten hosted-mutation consent sources, messages and exemp…
Coly010 Oct 15, 2026
a8c2d43
chore(cli): merge hosted consent review fixes
Coly010 Oct 15, 2026
1aa210c
chore(cli): merge db, migration and network-ban review fixes
Coly010 Oct 15, 2026
d7cb937
refactor(cli): evidence-based target identity, typed JSON target and …
Coly010 Oct 15, 2026
b1e37dc
refactor(cli): one config parse-error message, target docs and tests
Coly010 Oct 15, 2026
ed4b40e
chore(cli): format target changes and satisfy knip and effect lint
Coly010 Oct 15, 2026
a37bfe4
chore(cli): merge target identity, banner and JSON review fixes
Coly010 Oct 15, 2026
d682e59
docs(cli): align ADR 0033 banner examples with the identity rules
Coly010 Oct 15, 2026
8a9815f
test(cli): expect sentence-case config push consent actions
Coly010 Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions apps/cli-e2e/src/tests/functions.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ describe("functions", () => {
"--use-api",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Invalid token");
Expand All @@ -114,6 +115,7 @@ describe("functions", () => {
"--use-api",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Forbidden");
Expand All @@ -136,6 +138,7 @@ describe("functions", () => {
"--use-api",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Too Many Requests");
Expand All @@ -155,6 +158,7 @@ describe("functions", () => {
"--use-api",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Internal Server Error");
Expand All @@ -171,6 +175,7 @@ describe("functions", () => {
FUNCTION_NAME,
"--project-ref",
projectRef,
"--yes",
]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Deleted Function");
Expand All @@ -189,6 +194,7 @@ describe("functions", () => {
FUNCTION_NAME,
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("does not exist");
Expand All @@ -206,6 +212,7 @@ describe("functions", () => {
FUNCTION_NAME,
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Invalid token");
Expand All @@ -223,6 +230,7 @@ describe("functions", () => {
FUNCTION_NAME,
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Forbidden");
Expand All @@ -240,6 +248,7 @@ describe("functions", () => {
FUNCTION_NAME,
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Too Many Requests");
Expand All @@ -257,6 +266,7 @@ describe("functions", () => {
FUNCTION_NAME,
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toContain("Internal Server Error");
Expand Down
25 changes: 21 additions & 4 deletions apps/cli-e2e/src/tests/secrets.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("secrets", () => {

describe("secrets:set", () => {
testBehaviour("sets a single secret", async ({ run, projectRef }) => {
const result = await run(["secrets", "set", "FOO=bar", "--project-ref", projectRef]);
const result = await run(["secrets", "set", "FOO=bar", "--project-ref", projectRef, "--yes"]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Finished");
});
Expand All @@ -98,6 +98,7 @@ describe("secrets", () => {
"BAZ=qux",
"--project-ref",
projectRef,
"--yes",
]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Finished");
Expand All @@ -112,6 +113,7 @@ describe("secrets", () => {
".env.local",
"--project-ref",
projectRef,
"--yes",
]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Finished");
Expand All @@ -126,7 +128,14 @@ describe("secrets", () => {
body: { message: "Validation failed", errors: [{ message: "Invalid secret name" }] },
}),
});
const result = await run(["secrets", "set", "FOO=bar", "--project-ref", PROJECT_REF]);
const result = await run([
"secrets",
"set",
"FOO=bar",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
});

Expand All @@ -138,6 +147,7 @@ describe("secrets", () => {
"nonexistent.env",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
});
Expand All @@ -148,7 +158,14 @@ describe("secrets", () => {
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ status: 401, body: { message: "Invalid token" } }),
});
const result = await run(["secrets", "set", "FOO=bar", "--project-ref", PROJECT_REF]);
const result = await run([
"secrets",
"set",
"FOO=bar",
"--project-ref",
PROJECT_REF,
"--yes",
]);
expect(result.exitCode).not.toBe(0);
});
});
Expand All @@ -161,7 +178,7 @@ describe("secrets", () => {
});

testBehaviour("removes multiple secrets", async ({ run, projectRef }) => {
await run(["secrets", "set", "FOO=bar", "BAR=baz", "--project-ref", projectRef]);
await run(["secrets", "set", "FOO=bar", "BAR=baz", "--project-ref", projectRef, "--yes"]);
const result = await run([
"secrets",
"unset",
Expand Down
25 changes: 25 additions & 0 deletions apps/cli/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,31 @@ text layer. Therefore stdout is payload-only for either machine flag. Do not cha
layer to move spinners; that would change text output globally. Handlers check `--output` first and
use established encoders before the `output.format` branch.

## Targets and hosted consent

Every leaf declares its target group and consent default with `withTargetPolicy`; the
classification test in `src/command-internal/target/target-policy.unit.test.ts` fails a leaf
without one. Declare the target flags only through `targetFlags` in
`src/command-internal/target/target-flags.ts`.

- Database, storage, and seed commands call `resolveTarget`, then `resolveConnection`. Never pass a
default target: the policy owns the default, so a call site cannot fall back to local or linked.
- A command that binds `--password` passes `hasPasswordFlag: true` to `resolveConnection`.
- The linked `Target:` banner comes from `resolveTarget` and `resolveRef`; never build a linked
`ResolvedTarget` by hand.
- Hosted writes call `requireHostedMutationConsent` (or `requireTargetMutationConsent` when the
target may be local) after the plan and before the first persistent effect, and pass the
returned `HostedMutationConsent` to anything that needs proof of it.
- Never read stdin for consent. JSON, piped, and agent runs need `--yes` or a shell
`SUPABASE_YES`; `supabase/.env` and a cwd `.env*` file do not count. Write the action as an
imperative sentence-case phrase with no trailing period (`Delete project <ref>`).
- A `sync` or `selectable` leaf with `consent: "none"` declares a `consentExemptReason`.
- Every leaf with consent has a `describeHostedConsent("<command path>", …)` test from
`tests/helpers/hosted-consent.ts`.

See [ADR 0033](../../docs/adr/0033-target-selection-and-hosted-mutation-consent.md) for the
target-default and consent rules.

## Tests

Follow the root testing philosophy and use the package scripts in `package.json`. Cover meaningful
Expand Down
35 changes: 35 additions & 0 deletions apps/cli/docs/command-target.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Command target

Every command that acts on a database or hosted project announces the target it resolved, once, before it acts. The same identity goes to machine consumers as the JSON `target` object.

## Banner

`Target: <text>` on stderr in every output format, printed once per distinct text.

| Target | Text |
| ------------------------------------- | ----------------------------------------------------------------------------------- |
| Local stack | `local stack (<host>:<port>)` |
| Local stack, nothing selected, linked | `local stack (<host>:<port>) · default; pass --linked for <name> (<ref>)` |
| `--db-url` | `custom Postgres (<host>:<port>)`; the connection string's credentials never appear |
| Linked project the cache names | `project <name> (<ref>) · production` |
| Linked project nothing vouches for | `project <ref>`, or `project <name> (<ref>)` when the project picker named it |
| Ref other than the linked project | `project <ref> (not the linked project)` |
| Branch found by name or UUID | `project <parent ref> · branch <name> (<ref>)`, or `branch <ref>` for a UUID |

The `default; pass --linked` hint appears only when the checkout is linked and neither a selector flag nor a workspace `target` chose local. "Branch" is claimed only on positive evidence: a branch lookup by name or UUID, or a live probe. A cached link never proves one.

## JSON `target`

`json` and `stream-json` results carry `target`, tagged by `kind`:

| `kind` | Fields |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `local` | `host`, `port` |
| `db-url` | `host`, `port` |
| `linked` | `project_ref`, `environment` (`production`, `branch` or `unverified`), optional `project_name`, optional `parent_project_ref` (a branch's parent project) |

`environment` is `production` when the linked-project cache names the resolved ref, `branch` on positive evidence, and `unverified` otherwise. A failed identity check is `unverified`, never `branch`.

The first announced target becomes the run's `target`. It is merged into object results and into the machine error envelope. Array results are written unchanged. A command that owns extra `target` fields (for example `branch`, `local_scope`, or `config push`'s probed `environment`) adds them in front of the announced identity's, and its own values win on a clash.

The schema is `CommandTargetJson` in `src/shared/output/command-target.service.ts`; every target is encoded through it before it reaches output.
6 changes: 6 additions & 0 deletions apps/cli/docs/compute-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ settings into an ignored file. To deploy a source directory without a Compute
configuration entry, `compute push` requires an explicit `--exposure public` or
`--exposure private`. Record the entry in the authoritative config to persist
its deployment settings.

`compute push` and `compute delete` change the remote project, so both ask for
confirmation first, and both default to no. `compute delete` asks for the
compute's name to be typed back. Pass `--yes`, or set `SUPABASE_YES` in your
shell, to confirm in scripts and CI; without it, a run that cannot prompt fails
before changing anything.
2 changes: 1 addition & 1 deletion apps/cli/docs/supabase/config/diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Local values are shown as the configuration your file would produce once pushed,

With `--exit-code`, the command exits `2` when any difference is found, keeping exit `1` for errors — so scripts can distinguish drift from failure.

Machine-readable output is available through `--output-format json|stream-json` — a versioned payload (`schema_version`, `config_schema`, `target`, `scope`, `changes[]`, `masked[]`, `unmanaged[]`, `counts`) with per-change `path`s as segment arrays. The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead.
Machine-readable output is available through `--output-format json|stream-json` — a versioned payload (`schema_version`, `config_schema`, `target`, `scope`, `changes[]`, `masked[]`, `unmanaged[]`, `counts`) with per-change `path`s as segment arrays. `target` identifies the compared project: `kind` (`linked`), `project_ref`, `project_name` and `environment` (`production`, `branch` or `unverified`) when known, `parent_project_ref` for a branch, `branch` when it was named, and `local_scope` (`base` or `remotes.<name>`). The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead.
2 changes: 1 addition & 1 deletion apps/cli/docs/supabase/config/pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ max_rows = 250

Running the same command again finds no differences and writes nothing.

Machine-readable output is available through `--output-format json|stream-json` — a versioned payload (`schema_version`, `config_schema`, `config_path`, `format`, `target`, `destination`, `dry_run`, `wrote`, `scope`, `changes[]`, `warnings[]`, `masked[]`, `unmanaged[]`, `counts`) with per-change `path`s as segment arrays, each carrying `written` and, when unwritten, a `skipped_reason` (`env_reference | local_only | remote_env_reference | unwritable | would_invalidate | declined | dry_run`). A `would_invalidate` warning additionally carries `missing_fields` (`[{path, env_variable?}]`) naming what actually blocked the family. The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead. Note: the payload spells the root scope `"base"` (`target.local_scope`), while text output calls the same thing `config root`.
Machine-readable output is available through `--output-format json|stream-json` — a versioned payload (`schema_version`, `config_schema`, `config_path`, `format`, `target`, `destination`, `dry_run`, `wrote`, `scope`, `changes[]`, `warnings[]`, `masked[]`, `unmanaged[]`, `counts`) — `target` identifies the pulled project the same way `config diff` does (`kind`, `project_ref`, `project_name`, `environment`, `parent_project_ref`, `branch`, `local_scope`) — with per-change `path`s as segment arrays, each carrying `written` and, when unwritten, a `skipped_reason` (`env_reference | local_only | remote_env_reference | unwritable | would_invalidate | declined | dry_run`). A `would_invalidate` warning additionally carries `missing_fields` (`[{path, env_variable?}]`) naming what actually blocked the family. The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead. Note: the payload spells the root scope `"base"` (`target.local_scope`), while text output calls the same thing `config root`.
6 changes: 4 additions & 2 deletions apps/cli/docs/supabase/config/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This command allows you to manage project configuration as code by defining sett

Pass `--project-ref` to push to a specific project, or the name (or UUID) of a branch of the currently linked project — values that are exactly 20 lowercase letters are always treated as project refs. Without it, the linked project is the target.

Before anything is pushed, the command reports the project it resolved — its name and ref. When the resolved target is a preview branch that was only _inferred_ (for example after `supabase link <branch-name>`, or via `SUPABASE_PROJECT_ID`) rather than named on this invocation, it says so, names the branch and its parent project where they can be resolved, and asks for confirmation first. Declining — including on an unattended run with no `--yes` and no piped answer — fails the command rather than pushing. Pass `--yes` (or set `SUPABASE_YES`) to skip that confirmation in CI and scripted runs.
Before anything is pushed, the command prints the `Target:` line for the project or branch it resolved (name, ref, and for a branch its parent project), then shows the exact diff for every resource that will change. It then asks once — a single question covering every changed resource, with a default answer of no — and sends nothing until you confirm. If a change enables a paid add-on, its price is printed before the question.

An explicit `--project-ref <branch-name-or-uuid>` on the same invocation skips the confirmation entirely (the target is still echoed) — naming the branch yourself already counts as confirming it. Because the confirmation reads one line of piped input just like any other prompt, a script piping multiple `y`/`n` answers to an _inferred_ branch target needs one extra leading answer for it, ahead of the per-service prompts it already answers.
A push with nothing to change never asks. Declining fails the command and writes nothing. Piped answers are never read, so a script, a JSON run (`-o json`, `--output-format json`) or an agent must pass `--yes` or set `SUPABASE_YES` in the shell; a `SUPABASE_YES` in `supabase/.env` does not count. With `--yes` the command echoes `Confirmed by --yes: …` to stderr and pushes.

In `json` output the result carries a `target` object with the resolved identity (`kind`, `project_ref`, `project_name`, `environment`, and `parent_project_ref` for a branch) next to the push summary.
2 changes: 2 additions & 0 deletions apps/cli/docs/supabase/db/advisors.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## supabase-db-advisors

Inspects the database for common security and performance issues such as missing RLS policies, unindexed foreign keys, exposed auth.users, and more.

With no target flag the command inspects the workspace target, which is the local database unless `SUPABASE_TARGET` or `target` in `config.toml` says otherwise. Pass `--linked` for the linked project or `--db-url` for another database. The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.
2 changes: 1 addition & 1 deletion apps/cli/docs/supabase/db/diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Diffs schema changes made to the local or remote database.

Requires the local development stack to be running when diffing against the local database. To diff against a remote or self-hosted database, specify the `--linked` or `--db-url` flag respectively.
Requires the local development stack to be running when diffing against the local database. To diff against a remote or self-hosted database, specify the `--linked` or `--db-url` flag respectively. With no target flag the command diffs the workspace target, which is the local database unless `SUPABASE_TARGET` or `target` in `config.toml` says otherwise. The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.

Compares schema differences between the target database and a shadow database, using the bundled pg-delta engine by default. The legacy [djrobstep/migra](https://github.com/djrobstep/migra) engine, which runs in a container, remains available as a fallback (see below). The shadow database is created by applying migrations in local `supabase/migrations` directory in a separate container. Output is written to stdout by default. For convenience, you can also save the schema diff as a new migration file by passing in `-f` flag.

Expand Down
4 changes: 2 additions & 2 deletions apps/cli/docs/supabase/db/dump.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## supabase-db-dump

Dumps contents from a remote database.
Dumps contents from the target database.

Requires your local project to be linked to a remote database by running `supabase link`. For self-hosted databases, you can pass in the connection parameters using `--db-url` flag.
Dumps the local database by default, unless `SUPABASE_TARGET` or `target` in `config.toml` selects the linked project. Pass `--linked` to dump the linked project, which requires your local project to be linked by running `supabase link`. For self-hosted databases, you can pass in the connection parameters using `--db-url` flag. The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.

Runs `pg_dump` in a container with additional flags to exclude Supabase managed schemas. The ignored schemas include auth, storage, and those created by extensions.

Expand Down
Loading
Loading