[PR #5654] fix(read): narrow .env file blocking to not block .envrc #11515

Closed
opened 2026-02-16 18:16:21 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5654

State: closed
Merged: Yes


Summary

  • Fix overly broad .env file blocking that was catching .envrc (direnv) and other legitimate files
  • Changed from filepath.includes(".env") to basename-only regex /^\.env(\.|$)/
  • Added .env.example and .env.template to whitelist
  • Added test coverage for env file blocking behavior

Test plan

  • bun test test/tool/read.test.ts passes (7 tests)
  • Manual test: can now read .envrc files
  • Verify .env, .env.local, .env.production still blocked

Fixes #4969

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5654 **State:** closed **Merged:** Yes --- ## Summary - Fix overly broad `.env` file blocking that was catching `.envrc` (direnv) and other legitimate files - Changed from `filepath.includes(".env")` to basename-only regex `/^\.env(\.|$)/` - Added `.env.example` and `.env.template` to whitelist - Added test coverage for env file blocking behavior ## Test plan - [x] `bun test test/tool/read.test.ts` passes (7 tests) - [ ] Manual test: can now read `.envrc` files - [ ] Verify `.env`, `.env.local`, `.env.production` still blocked Fixes #4969 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:16:21 -05:00
yindo closed this issue 2026-02-16 18:16:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11515