Skip to content

feat(cli): add experimental supabase env set - #7888

Draft
kanadgupta wants to merge 1 commit into
developfrom
kanad-claude/cli-env-set
Draft

kanadgupta wants to merge 1 commit into
developfrom
kanad-claude/cli-env-set

Conversation

@kanadgupta

Copy link
Copy Markdown
Member

Summary

Adds an experimental supabase env set command. It writes a secret or variable to a project's production or development environment through the beta Management API environment endpoints. Branches pick up the value on their next deploy.

supabase env set <NAME> [VALUE] --environment <production|development> [--visible]
  • Opt-in: the env family only appears with SUPABASE_EXPERIMENTAL_ENVIRONMENTS=1 or [experimental] environments = true in config.toml.
  • Secret by default: values are stored as write-only secrets; --visible stores a readable variable.
  • No secrets in arguments: a secret value passed as an argument is refused so it stays out of shell history. It's read from a hidden prompt on a terminal, or from stdin otherwise (one trailing line break is dropped).
  • Checks run locally first: names and values are checked against the API's rules before any request, and error messages never include the value.
  • Parent project only: --remote takes a project ref, and a linked branch resolves to its parent.
  • Asks before writing: both environments ask for confirmation; scripts pass --yes.

The permission block for parent-project lookup moves from commands/branches/ to command-internal/target/parent-scoped-project-ref.ts, next to the code that does the lookup, since env set now uses it too. Docs are in apps/cli/docs/env-commands.md.

🤖 Generated with Claude Code

Add an opt-in `env` command family, enabled with
SUPABASE_EXPERIMENTAL_ENVIRONMENTS=1 or `environments = true` under
[experimental], with one leaf: `supabase env set`. It writes a secret
or variable to a project environment (`production` or `development`)
through the Management API's environment endpoints.

Values are stored as write-only secrets unless `--visible` is passed.
A secret value is never accepted as an argument: it is read from a
hidden prompt or from stdin. Names and values are checked against the
API's rules before any request, and errors never echo the value. The
command acts on the parent project and asks for hosted-mutation
consent.

Move the parent-project permission block next to
`resolveParentScopedProjectRef`, its shared owner, now that `env` uses
it alongside `branches`.

Generated with AI

Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant