Description
According to the docs https://opencode.ai/docs/permissions/:
Rules are evaluated by pattern match, with the last matching rule winning. A common pattern is to put the catch-all "*" rule first, and more specific rules after it.
Therefore the below opencode.json should result in a behavior allowing writing to the specified directory but no others, regardless of the root project directory location.
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"external_directory": {
"~/Documents/Programming/AI/**": "allow"
},
"edit": {
"*": "deny",
"~/Documents/Programming/AI/**": "allow"
},
"bash": {
"*": "deny",
"cd ~/Documents/Programming/AI/*": "allow",
"ls ~/Documents/Programming/AI/*": "allow",
"touch ~/Documents/Programming/AI/*": "allow",
"pwd": "allow"
}
}
}
However this results in no write access in any directory.
Similarly, based on my interpretation of the docs, this altercation to the opencode.json should also allow for the same expected behavior:
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"external_directory": {
"~/Documents/Programming/AI/**": "allow"
},
"edit": "deny",
"edit": {
"~/Documents/Programming/AI/**": "allow"
},
"bash": {
"*": "deny",
"cd ~/Documents/Programming/AI/*": "allow",
"ls ~/Documents/Programming/AI/*": "allow",
"touch ~/Documents/Programming/AI/*": "allow",
"pwd": "allow"
}
}
}
This results in having write access to all directories. The documentation is worded to imply that this might only work when restricting access?
Add explicit rules when a tool should be restricted in these paths, such as blocking edits while keeping reads:
Plugins
None
OpenCode version
1.14.25
Steps to reproduce
- Use the provided opencode.json configurations.
- Ask OpenCode to write to a file within your specified directory
Screenshot and/or share link
No response
Operating System
Fedora 43
Terminal
Foot
Description
According to the docs https://opencode.ai/docs/permissions/:
Therefore the below opencode.json should result in a behavior allowing writing to the specified directory but no others, regardless of the root project directory location.
However this results in no write access in any directory.
Similarly, based on my interpretation of the docs, this altercation to the opencode.json should also allow for the same expected behavior:
This results in having write access to all directories. The documentation is worded to imply that this might only work when restricting access?
Plugins
None
OpenCode version
1.14.25
Steps to reproduce
Screenshot and/or share link
No response
Operating System
Fedora 43
Terminal
Foot