@gandalfix/opencode-permission-export
v1.0.1
Published
OpenCode plugin to export granted permissions as config snippet
Readme
opencode-permission-export
OpenCode plugin that exports granted permissions as a config snippet.
Installation
npm install @gandalfix/opencode-permission-exportAdd to your opencode.json:
{
"plugin": ["@gandalfix/opencode-permission-export"]
}Usage
During an OpenCode session, the plugin tracks all permission requests. When you want to export the granted permissions:
export my permissionsor
run export-permissionsThe tool outputs a JSON snippet you can copy into your opencode.json:
{
"permission": {
"bash": {
"git status": "allow",
"npm run *": "allow"
},
"edit": {
"src/*.ts": "allow"
}
}
}How It Works
- Hooks into
permission.askandpermission.repliedevents - Tracks which permissions were granted vs denied
- Generates valid OpenCode permission config syntax
- Only exports granted permissions (denied are noted but not included)
License
MIT
