wip: permissions

This commit is contained in:
Dax Raad 2025-07-31 17:19:56 -04:00
commit 5e72f50554
4 changed files with 183 additions and 16 deletions

View file

@ -15,7 +15,7 @@ opencode supports both JSON and JSONC (JSON with Comments) formats. You can use
// Theme configuration
"theme": "opencode",
"model": "anthropic/claude-sonnet-4-20250514",
"autoupdate": true
"autoupdate": true,
}
```
@ -215,10 +215,10 @@ You can configure specialized agents for specific tasks through the `agent` opti
"tools": {
// Disable file modification tools for review-only agent
"write": false,
"edit": false
}
}
}
"edit": false,
},
},
},
}
```
@ -245,6 +245,29 @@ The `disabled_providers` option accepts an array of provider IDs. When a provide
---
### Permissions
You can configure permissions to control what AI agents can do in your codebase through the `permission` option.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"edit": "ask",
"bash": "ask"
}
}
```
The permissions system allows you to configure explicit approval requirements for sensitive operations:
- `edit` - Controls whether file editing operations require user approval (`"ask"` or `"allow"`)
- `bash` - Controls whether bash commands require user approval (can be `"ask"`/`"allow"` or a pattern map)
[Learn more about permissions here](/docs/permissions).
---
## Variables
You can use variable substitution in your config files to reference environment variables and file contents.