docs: update permissions documentation with wildcard and rule evaluation #8392
+62
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated permission patterns and defaults in documentation.
What does this PR do?
This pull request updates the documentation for configuring permissions in OpenCode.
Clarified permission configuration docs:
How did you verify your code works?
No code changes. I used https://mdxjs.com/playground/ and github preview for the changes to confirm formatting.
Further Discussion (Why)
I was trying to dig into the docs to understand permissions because I felt that the doc wasn't clear enough and OpenCode felt like it was doing too much without asking.
There is actually a mistake in the docs saying that .env reads are "deny" but the code does not match and has "ask". This could be a bug, but this documentation reflects the current state of the code. Wildcard matching for tool name was also not really documented well.
Default permissions - packages/opencode/src/agent/agent.ts:47-65
Wildcard matching - packages/opencode/src/util/wildcard.ts:4-17
Rule evaluation order - packages/opencode/src/permission/next.ts:223-225