opencode-trailing-whitespace
v0.1.0
Published
OpenCode plugin to remove trailing whitespace from edited code
Maintainers
Readme
opencode-trailing-whitespace
OpenCode plugin that automatically removes trailing whitespace from code before writing to disk.
Installation
bun add opencode-trailing-whitespaceUsage
Add to your config.json:
{
"plugin": ["opencode-trailing-whitespace"]
}Or copy to .opencode/plugin/ directory for local use.
Behavior
Intercepts the following tools and cleans trailing whitespace:
| Tool | Cleaned Field |
| ------- | ------------------------ |
| write | content |
| edit | newString |
| patch | Added lines (+ prefix) |
Final newlines are preserved when present in the original content.
Toggle Feature
The plugin provides a tool that allows the model (or user via the model) to temporarily disable trailing whitespace removal:
| Tool | Description |
| ---- | ----------- |
| trailing_whitespace_toggle | Enable or disable the feature by setting enabled to true or false |
Example: Ask the model to "disable trailing whitespace removal" and it will call the toggle tool with enabled: false.
