Skip to content

Commit 6b019a1

Browse files
authored
docs: fix permission system documentation in agents section (#7652)
1 parent 6a2fed7 commit 6b019a1

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

packages/web/src/content/docs/agents.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ permission:
429429
"*": ask
430430
"git diff": allow
431431
"git log*": allow
432+
"grep *": allow
432433
webfetch: deny
433434
---
434435

@@ -444,7 +445,8 @@ You can set permissions for specific bash commands.
444445
"build": {
445446
"permission": {
446447
"bash": {
447-
"git push": "ask"
448+
"git push": "ask",
449+
"grep *": "allow"
448450
}
449451
}
450452
}
@@ -480,7 +482,7 @@ Since the last matching rule takes precedence, put the `*` wildcard first and sp
480482
"permission": {
481483
"bash": {
482484
"*": "ask",
483-
"git status": "allow"
485+
"git status *": "allow"
484486
}
485487
}
486488
}

packages/web/src/content/docs/permissions.mdx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ For most permissions, you can use an object to apply different actions based on
5757
"*": "ask",
5858
"git *": "allow",
5959
"npm *": "allow",
60-
"rm *": "deny"
60+
"rm *": "deny",
61+
"grep *": "allow"
6162
},
6263
"edit": {
6364
"*": "deny",
@@ -139,22 +140,31 @@ The set of patterns that `always` would approve is provided by the tool (for exa
139140

140141
You can override permissions per agent. Agent permissions are merged with the global config, and agent rules take precedence. [Learn more](/docs/agents#permissions) about agent permissions.
141142

143+
:::note
144+
Refer to the [Granular Rules (Object Syntax)](#granular-rules-object-syntax) section above for more detailed pattern matching examples.
145+
:::
146+
142147
```json title="opencode.json"
143148
{
144149
"$schema": "https://opencode.ai/config.json",
145150
"permission": {
146151
"bash": {
147152
"*": "ask",
148-
"git status": "allow"
153+
"git *": "allow",
154+
"git commit *": "deny",
155+
"git push *": "deny",
156+
"grep *": "allow"
149157
}
150158
},
151159
"agent": {
152160
"build": {
153161
"permission": {
154162
"bash": {
155163
"*": "ask",
156-
"git status": "allow",
157-
"git push": "allow"
164+
"git *": "allow",
165+
"git commit *": "ask",
166+
"git push *": "deny",
167+
"grep *": "allow"
158168
}
159169
}
160170
}
@@ -176,3 +186,7 @@ permission:
176186

177187
Only analyze code and suggest changes.
178188
```
189+
190+
:::tip
191+
Use pattern matching for commands with arguments. `"grep *"` allows `grep pattern file.txt`, while `"grep"` alone would block it. Commands like `git status` work for default behavior but require explicit permission (like `"git status *"`) when arguments are passed.
192+
:::

0 commit comments

Comments
 (0)