Back to Vibe Coder Toolkit
Environment
Env Sync
Never lose an env var again
npx promptreports-cli env syncCompares your local .env.local against Vercel production variables. Finds drift before it breaks prod.
env-sync queries the Vercel API for every environment variable in your linked project, compares against your local .env.local, and shows 4 states: healthy (both match), MISSING LOCAL (Vercel has it, you don't), missing remote (you have it, Vercel doesn't), and DRIFT (both have it but values differ). Optionally merges missing local vars from Vercel with --merge.
On this page
Prerequisites
- VERCEL_TOKEN environment variable
- .vercel/project.json (run `vercel link` first)
Flags & Options
| Flag | Description | Default |
|---|---|---|
| --diff | Show differences without writing anything | — |
| --backup | Create .env.local.backup before any writes | — |
| --merge | Write missing local vars from Vercel into .env.local | — |
| --json | JSON output | — |
| --quiet | Suppress output | — |
Examples
See drift
npx promptreports-cli env sync --diffRead-only — just show what's different.
Sync missing
npx promptreports-cli env sync --merge --backupPull missing vars from Vercel, back up first.
CI check
npx promptreports-cli env sync --jsonExit non-zero if drift exists.
Output
Table with Key, Local status, Vercel status, and sync status. Summary line counts issues.
Key Local Vercel Status
DATABASE_URL set set healthy
STRIPE_SECRET_KEY — set MISSING LOCAL
OPENROUTER_API_KEY set — missing remote
NEXTAUTH_SECRET set set DRIFT
SENTRY_DSN set set healthy
1 issues found: 1 missing local, 0 missing remote, 1 drift
Added 1 missing vars to .env.local
Backup saved to .env.local.backupWhat it reads and writes
Reads
- .env.local
- .vercel/project.json
Writes
- .env.local (with --merge)
- .env.local.backup (with --backup)
API calls
- GET https://api.vercel.com/v9/projects/{projectId}/env (10s timeout)
Free vs Pro usage
Free tier
- Catch missing env vars before deploy day
- Onboard new team members — tell them to run env-sync --merge
- CI guard against drift
Pro tier
Upgrade- Team-wide env policy enforcement
- Auto-rotate secrets across machines via push notifications
- Drift history (who changed what, when) via dashboard
- Integration with 1Password, Vault, AWS Secrets Manager
Pro tips
- Always use --backup the first time you --merge
- Drift is usually a dev changing something locally — use it as a trigger to rotate
- Run weekly in CI to catch silent drift