Repository navigation
feat(cli): add variable and variable-group commands - #395
Draft
clankergoose wants to merge 4 commits into
Draft
clankergoose wants to merge 4 commits into
clankergoose wants to merge 4 commits into
Conversation
Adds `prisma variable` with add/update/delete/list subcommands and `prisma variable group` with list/create/update/delete subcommands. Variables write to named groups (--group <name> or --role production|preview). --branch is rejected on write commands; use a variable group or send a service variable with the deploy. --role preview fails when the project has custom groups (Decided 37). New API endpoints (variable-groups, resolved-variables, groupId filter on environment-variables) are not in @prisma/management-api-sdk v1.80.0 so they are called through typed wrappers in lib/variable/api.ts that cast once to the raw client. Also: - Renames "Env map" column to "Variable group" in `branch list`. - Adds a deprecation warning to all `project env` write/list commands. - Adds the 8 new commands to the e2e-coverage exclusion list (endpoints not yet deployed to the standard CI environment) and to the mount-coverage snapshot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
commit: |
…lint `variable update --file` looked each key up by role, so in a custom group it changed the preview group's row. It now looks keys up by group id, the same way the single-key path does. Also fixes lint: removes an unused import and test helper, a nested ternary and non-null assertions, and gives a reason for each remaining cast and sequential await. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verrides Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xamples Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demo only. Not for merge. CLI side of the variable groups demo. Platform PRs: prisma/pdp-control-plane#6109 (API) and #6110 (Console). Spec: prisma/pdp-control-plane#5916. Review comments will not get replies.
Summary
Adds
prisma variable(add / update / delete / list) andprisma variable group(list / create / update / delete) commands.Key design decisions
--group <name>or--role production|previewselect the target group; the two flags are mutually exclusive.--branchis rejected on write commands withVARIABLE.NO_BRANCH_WRITE; branch overrides are deprecated and the new command writes to groups only.--role previewcheck (Decided 37): if the project has any custom groups,--role previewfails withVARIABLE.CUSTOM_GROUP_CONFLICT; use--group previewinstead.@prisma/management-api-sdkv1.80.0.lib/variable/api.tsholds typed wrappers that cast once to the raw client. Every call site imports from that module rather than casting inline.prisma deploy --variablelives in Composer (packages/composer) and is out of scope for this PR; noted as a known gap.prisma branch listcolumn renamed from "Env map" to "Variable group".prisma project envcommands warn on stderr that they are deprecated.New commands
prisma variable add KEY=VALUE --group <n>prisma variable update KEY=VALUE --group <n>prisma variable delete KEY --group <n>prisma variable list [--group <n>] [--branch <n>]prisma variable group listprisma variable group create <name> --equals|--starts-with <val>prisma variable group update <name> [--name] [--equals|--starts-with]prisma variable group delete <name> [--confirm <name>]Tests
tests/variable.test.tscovers:--group/--rolemutual exclusion →VARIABLE.CONFLICTING_FLAGSMissing both →
VARIABLE.MISSING_GROUP--branchon write commands →VARIABLE.NO_BRANCH_WRITE--role previewwith custom groups →VARIABLE.CUSTOM_GROUP_CONFLICTvariable addPOST with correctgroupIdvariable updatePATCH via looked-up idvariable deleteDELETE via looked-up idDotenv file import
variable group listtable renderingvariable group create --equalsand--starts-withrequest bodiesRule conflict / missing rule errors
variable group delete --confirmwith built-in group rejectionvariable update --filein a custom group: updates the group's rows, looked up by group id.Checks
pnpm lint: passes.pnpm typecheck: passes (9 of 9 tasks).tests/variable.test.ts: 25 of 25 pass.pnpm testin@prisma/cli: 700 pass, 4 fail. The same 4 fail onmainin the same environment (auth-opsUI context andcomposer-isolation), andmainalso fails 15 test files there. They come from the local setup, not from this branch. One moreauth-opstest fails intermittently on both.tests/branch.test.ts: updated column header "Env map" → "Variable group".tests/mount-coverage.test.ts: 8 new commands added to the snapshot.tests/e2e-coverage.test.ts: 8 new commands excluded with reason (endpoints not yet in published SDK or standard CI environment).🤖 Generated with Claude Code