direnv-envrc-bootstrap
Create/update a standard direnv `.envrc` that seeds a worktree `.env` from `~/.config/{slug}/.env` or from another git worktree, then loads it via `dotenv_if_exists`. Use when bootstrapping new git wo
SKILL.mdskills/direnv-envrc-bootstrap/SKILL.md
GitHubDirenv Envrc Bootstrap
Quick start
Option A (recommended for Codex worktrees): generate .envrc plus a pasteable Codex Setup Script:
bash scripts/codex_env_clipboard.sh- Paste clipboard into Codex → Environment → Setup script (or run
./codex_setup_script.sh)
Option B (repo-only): generate .envrc and allow/load env in your shell:
bash scripts/write_envrc.shsource scripts/bootstrap_direnv.sh
Defaults
- Seeds
./.envfrom~/.config/medicalassistant_mcp/.envif present. - Otherwise tries to copy
./.envfrom anothergit worktree(first one found). - If still missing and
./.env.templateexists, copies it to./.env. - Loads env vars via
dotenv_if_exists(direnv stdlib).
Common variants
Different app/config path:
bash scripts/write_envrc.sh --config-slug my_appsource scripts/bootstrap_direnv.sh --config-slug my_app
Overwrite existing
.envrc:bash scripts/write_envrc.sh --force
For Codex setup script generation with a custom config slug:
CONFIG_SLUG=my_app bash scripts/codex_env_clipboard.sh