The open source coding agent.
TypeScript
feat(opencode): add `cljfmt` formatter support for Clojure files (#13426)
Salam Elbilig9b23130ac474
diff --git a/packages/opencode/src/format/formatter.ts b/packages/opencode/src/format/formatter.tsindex 9e97fae9dfc..41844695802 100644--- a/packages/opencode/src/format/formatter.ts+++ b/packages/opencode/src/format/formatter.ts@@ -364,3 +364,12 @@ export const ormolu: Info = {return Bun.which("ormolu") !== null},}++export const cljfmt: Info = {+ name: "cljfmt",+ command: ["cljfmt", "fix", "--quiet", "$FILE"],+ extensions: [".clj", ".cljs", ".cljc", ".edn"],+ async enabled() {+ return Bun.which("cljfmt") !== null+ },+}diff --git a/packages/web/src/content/docs/formatters.mdx b/packages/web/src/content/docs/formatters.mdxindex 54f36e0cd0e..0cb947b08f0 100644--- a/packages/web/src/content/docs/formatters.mdx+++ b/packages/web/src/content/docs/formatters.mdx@@ -13,30 +13,31 @@ OpenCode comes with several built-in formatters for popular languages and framew| Formatter | Extensions | Requirements || -------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |-| gofmt | .go | `gofmt` command available |-| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available |-| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://prettier.io/docs/en/index.html) | `prettier` dependency in `package.json` |+| air | .R | `air` command available || biome | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://biomejs.dev/) | `biome.json(c)` config file |-| zig | .zig, .zon | `zig` command available |+| cargofmt | .rs | `cargo fmt` command available || clang-format | .c, .cpp, .h, .hpp, .ino, and [more](https://clang.llvm.org/docs/ClangFormat.html) | `.clang-format` config file |+| cljfmt | .clj, .cljs, .cljc, .edn | `cljfmt` command available |+| dart | .dart | `dart` command available |+| gleam | .gleam | `gleam` command available |+| gofmt | .go | `gofmt` command available |+| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available || ktlint | .kt, .kts | `ktlint` command available |+| mix | .ex, .exs, .eex, .heex, .leex, .neex, .sface | `mix` command available |+| nixfmt | .nix | `nixfmt` command available |+| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file |+| ormolu | .hs | `ormolu` command available |+| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) |+| pint | .php | `laravel/pint` dependency in `composer.json` |+| prettier | .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml, and [more](https://prettier.io/docs/en/index.html) | `prettier` dependency in `package.json` |+| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available || ruff | .py, .pyi | `ruff` command available with config || rustfmt | .rs | `rustfmt` command available |-| cargofmt | .rs | `cargo fmt` command available |-| uv | .py, .pyi | `uv` command available |-| rubocop | .rb, .rake, .gemspec, .ru | `rubocop` command available |+| shfmt | .sh, .bash | `shfmt` command available || standardrb | .rb, .rake, .gemspec, .ru | `standardrb` command available |-| htmlbeautifier | .erb, .html.erb | `htmlbeautifier` command available |-| air | .R | `air` command available |-| dart | .dart | `dart` command available |-| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file || terraform | .tf, .tfvars | `terraform` command available |-| gleam | .gleam | `gleam` command available |-| nixfmt | .nix | `nixfmt` command available |-| shfmt | .sh, .bash | `shfmt` command available |-| pint | .php | `laravel/pint` dependency in `composer.json` |-| oxfmt (Experimental) | .js, .jsx, .ts, .tsx | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) |-| ormolu | .hs | `ormolu` command available |+| uv | .py, .pyi | `uv` command available |+| zig | .zig, .zon | `zig` command available |So if your project has `prettier` in your `package.json`, OpenCode will automatically use it.