opencode
opencode copied to clipboard
feat: Add Permission Control for Path Restrictions in Bash Tool
Summary: Allow users to approve bash commands that reference external paths via permission system.
Problem: Bash tool hard-rejects external paths without user control.
mkdir -p ~/.config/opencode # ❌ Fails immediately
Solution: Add external_paths permission type:
{
"permission": {
"external_paths": "ask" "ask" | "allow" | "deny"
}
}
Implementation: Modify bash.ts to use Permission.ask() for external paths instead of hard rejection.
Benefits:
- User control over external path access
- Consistent with other tool permissions
- Enables legitimate operations (config migration, etc.)
Files: packages/opencode/src/tool/bash.ts
note: we probably want some functionality to allow access for other tools to work outside cwd too, like read for instance.
This will be done as part of: #1961