[FEATURE]: Add shfmt formatter for shell scripts #3885

Closed
opened 2026-02-16 17:41:48 -05:00 by yindo · 1 comment
Owner

Originally created by @anntnzrb on GitHub (Dec 26, 2025).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Add built-in support for shfmt as a formatter for shell scripts.

Why is this needed?

  • OpenCode has bash-language-server for LSP but no shell formatter
  • shfmt is the de facto standard shell formatter (like gofmt for Go)
  • Follows existing formatter patterns

Proposed implementation

  • Extensions: .sh, .bash (NOT .zsh - shfmt doesn't support Zsh)
  • Command: shfmt -w $FILE
  • Detection: Binary check via Bun.which("shfmt")
Originally created by @anntnzrb on GitHub (Dec 26, 2025). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Add built-in support for [shfmt](https://github.com/mvdan/sh) as a formatter for shell scripts. ### Why is this needed? - OpenCode has `bash-language-server` for LSP but no shell formatter - `shfmt` is the de facto standard shell formatter (like `gofmt` for Go) - Follows existing formatter patterns ### Proposed implementation - Extensions: `.sh`, `.bash` (NOT `.zsh` - shfmt doesn't support Zsh) - Command: `shfmt -w $FILE` - Detection: Binary check via `Bun.which("shfmt")`
yindo closed this issue 2026-02-16 17:41:48 -05:00
Author
Owner

@anntnzrb commented on GitHub (Dec 26, 2025):

PR: #6204

@anntnzrb commented on GitHub (Dec 26, 2025): PR: #6204
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3885