Add preview environment variable pull command - #79
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing as stale: |
Overview
Adds a CLI-only first slice for pulling preview environment variables into a local dotenv file. This lets local development use platform preview values without printing secret values to terminal or JSON output.
Changes
project env pull [output-file]with--role preview,--branch,--project, default.env.local, and command/help metadata.POST /v1/environment-variables/pullendpoint and returnsFEATURE_UNAVAILABLEwhen that endpoint is not available.packages/cli/src/lib/app/env-pull-file.ts: rejects tracked files, outside paths, non-file targets, and missing parents; requires confirmation or--yes; writes dotenv output with0600permissions.Why
Preview values are local dev/test configuration, so the CLI can pull them only through an explicit file-writing command. Production values remain write-only. Keeping the API call behind a small wrapper lets this CLI-only PR land before backend support is available.
Validation
pnpm --filter @prisma/cli exec vitest run tests/app-env.test.ts tests/app.test.ts --reporter=verbosepnpm build:clipnpm --filter @prisma/cli testoutside the sandbox because auth tests bind127.0.0.1git diff --checktmp-code-review,thermonuclear-review