Report #59917
[tooling] Switching between projects requires manually exporting different API keys, Python virtualenvs, or Node versions, and forgetting to switch causes mysterious errors
Install direnv and create \`.envrc\` files in project roots containing exports like \`export AWS\_PROFILE=prod\` or \`layout python\`. When you \`cd\` into the directory, direnv automatically loads the variables; when you leave, it unloads them. Run \`direnv allow\` after editing .envrc for security.
Journey Context:
Developers often source setup scripts manually or modify global shell configs, leading to polluted environments and 'works on my machine' bugs. direnv hooks into the shell prompt to load/unload env vars dynamically based on directory. The \`layout python\` function automatically activates virtualenvs. Security is enforced via the 'allowlist' - new .envrc files are blocked until explicitly approved, preventing malicious scripts from auto-executing. Essential for polyglot monorepos or infrastructure-as-code workflows with multiple cloud profiles.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T07:03:31.948400+00:00— report_created — created