Skip to content

chore: add .envrc so direnv loads .env.local on cd#2456

Open
andrew-bierman wants to merge 1 commit into
mainfrom
chore/direnv-envrc
Open

chore: add .envrc so direnv loads .env.local on cd#2456
andrew-bierman wants to merge 1 commit into
mainfrom
chore/direnv-envrc

Conversation

@andrew-bierman

@andrew-bierman andrew-bierman commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a one-line .envrc (dotenv_if_exists .env.local) so direnv auto-exports the contents of .env.local whenever you cd into the repo.
  • Removes the manual export PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN=... && bun install two-step that configure-deps.ts currently nudges you toward — the token is already in .env.local for runtime, and direnv promotes it into the parent shell before bun reads bunfig.toml.

Why

bunfig.toml resolves \$PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN at bun process startup, before the preinstall hook runs, so the env must be present in the parent shell. .env.local alone can't satisfy that. direnv fills the gap cleanly without per-shell exports.

No secrets

  • .envrc itself contains no secrets — just the directive.
  • .env.local is already in .gitignore.

Test plan

  • direnv allow in the repo root.
  • cd out and back in; direnv prints loading ~/Code/PackRat/.envrc and export +PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN.
  • bun install succeeds with no manual export.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated environment variable loading to conditionally support local configuration overrides.

Review Change Stack

direnv reads .env.local on entry, which surfaces PACKRAT_NATIVEWIND_UI_GITHUB_TOKEN
(and any other locals) into the shell before bun reads bunfig.toml — removing
the manual `export ... && bun install` two-step for fresh checkouts.

No secrets in this file; .env.local is already gitignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 20, 2026 05:48
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1a6aca20-a5ef-46e9-942b-7a7f7dc54efb

📥 Commits

Reviewing files that changed from the base of the PR and between 12be343 and 04c949a.

📒 Files selected for processing (1)
  • .envrc

Walkthrough

.envrc now conditionally loads .env.local when present, allowing developers to customize environment variables locally without version control tracking.

Changes

Environment Configuration

Layer / File(s) Summary
dotenv_if_exists directive
.envrc
Adds dotenv_if_exists .env.local to load optional local environment overrides, supporting per-developer configuration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a .envrc file to enable direnv to automatically load .env.local on directory entry.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/direnv-envrc

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a direnv configuration so repository-local environment variables from .env.local are automatically exported when entering the repo, supporting workflows where tooling needs env vars present at process startup (e.g., Bun config resolution).

Changes:

  • Add .envrc with dotenv_if_exists .env.local to load .env.local via direnv on cd.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .envrc
@@ -0,0 +1 @@
dotenv_if_exists .env.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants