opencode-fmt
v0.3.1
Published
[](https://bun.sh) [](https://opensource.org/licenses/MIT) [ in column widths. |
| logging | false | Enables duration and raw/clean output logging to opencode-fmt.log. |
Examples
Emoji Sanitization
The sanitizer removes pictographic and dingbat symbols from the text stream.
Before: Hello [hand-wave], our launch [rocket] was a success [party]!
After: Hello , our launch was a success !
(Note: Surrounding whitespaces are strictly preserved for deterministic layout stability, which may result in double spaces where an emoji was removed).
[!NOTE] If a response contains only emojis (and optional whitespace characters),
opencode-fmtwill replace it with a redaction placeholder:[Only emojis received and redacted by opencode-fmt]
Table Alignment
The aligner intelligently pads columns based on the longest cell in each column.
Before:
| Header 1 | H2 |
|---|---|
| Val | Long Value |After:
| Header 1 | H2 |
| -------- | ---------- |
| Val | Long Value |Architectural Constraints
This plugin is governed by strict technical rules to preserve its performance:
- AST-Free Processing: No heavyweight parsing into an Abstract Syntax Tree.
- Zero Runtime Dependencies: Built purely on native Bun/Node APIs and the core plugin hook.
- Flat Config: No nested objects are allowed in
config.jsonto prevent parsing overhead. The configuration is stored in~/.config/opencode/fmt/config.json. Top-level arrays are permitted for list-based features. Any unknown keys are merged but ignored by core logic. - Diff Stability: Non-target text (pure paragraphs) is preserved byte-for-byte in the output.
Inspiration
This plugin was inspired by two community plugins that pioneered single-feature plugin design:
- opencode-md-table-formatter by @franlol — Automatic Markdown table formatting with concealment mode support
- opencode-unmoji by @bastiangx — Strips emojis from agent output
Both showed that focused, lightweight plugins can solve specific pain points elegantly. This plugin follows the same philosophy: one concern, done well.
License
This project is licensed under the MIT License. See the LICENSE file for details.
© 2026 Ritesh Kumar Pal
