@renjfk/opencode-secret-tools
v0.1.1
Published
Configurable secret bridge for OpenCode. Provides list_secrets, get_secret, and clear_secret tools that shell out to any CLI-based secret store with automatic redaction.
Downloads
26
Maintainers
Readme
opencode-secret-tools
Configurable secret bridge for OpenCode.
Provides list_secrets, get_secret, and clear_secret tools that shell out
to any CLI-based secret store. After a secret is loaded into the environment, a
tool.execute.after hook redacts its value from all subsequent tool outputs
before they reach the LLM.
Install
Add to your OpenCode config at ~/.config/opencode/config.json:
{
"plugin": ["@renjfk/opencode-secret-tools"]
}Configuration
{
"plugin": [
[
"@renjfk/opencode-secret-tools",
{
"folder": "Secrets",
"listCmd": ["rbw", "list", "--fields", "name,folder"],
"getCmd": ["rbw", "get", "--folder", "Secrets", "{name}"]
}
]
]
}Options
| Option | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------- |
| listCmd | Yes | Command returning secret names. One per line, or TSV name\tfolder when folder is set. |
| getCmd | Yes | Command returning the secret value. {name} is replaced at runtime. |
| folder | No | Filter listCmd output to this folder. If omitted, every line is treated as a name. |
Tools
list_secrets({})— runlistCmd, parse and filter, return names.get_secret({ name })— rungetCmdwith{name}replaced, inject intoprocess.env, track value for redaction.clear_secret({ name })— delete fromprocess.env, stop tracking.
How it works
- User configures
listCmdandgetCmdfor their vault CLI (e.g.rbw,op,gopass). list_secretsrunslistCmd, parses the output (optionally filtering by folder), and returns names.get_secretrunsgetCmdwith{name}replaced, injects the value intoprocess.env, and tracks it for redaction.tool.execute.afterreplaces tracked values with[REDACTED: {name}]inoutput,title, andmetadataof all tools exceptlist_secrets.clear_secretremoves the env var and stops tracking.- Values shorter than 4 characters are not redacted to avoid false positives.
Contributing
opencode-secret-tools is open to contributions and ideas!
Issue conventions
Format: type: brief description
feat:new features or functionalityfix:bug fixesenhance:improvements to existing featureschore:maintenance tasks, dependencies, cleanupdocs:documentation updatesbuild:build system, CI/CD changes
Development
npm run test # node --test
npm run check # lint + fmt
npm run lint # oxlint
npm run fmt # oxfmt --check
npm run fmt:fix # oxfmt --writeTest local plugin in OpenCode
To test unpublished changes in the OpenCode TUI, point ~/.config/opencode/config.json
at the local repo path, not the npm package name:
{
"plugin": ["/Users/your-user/opencode-secret-tools/index.js"]
}Release process
Manual releases via opencode; see RELEASE_PROCESS.md.
License
This project is licensed under the MIT License.
