Logo poly

poly

Cộng đồng
Goldziher

Universal zero-dependency linter and formatter. One pure-Rust binary (poly) that lints and formats ~30 languages in-process — ruff, oxc, biome, mago and more compiled in — with a tree-sitter tier for the long tail. One config, git hooks, and an MCP server for agents.

Nhà phát hànhGoldziher
Kho mãpoly
Ngôn ngữRust
Bản fork
1
Sao
18
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    poly cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    18 sao và 1 bản fork từ kho mã được liên kết.

One binary. ~30 languages. No toolchain to install.

poly lints and formats whole repositories in seconds: curated Rust backends for the languages that matter, a tree-sitter fallback for everything else, and a Claude/Codex plugin plus an MCP server so agents can drive it directly instead of shelling out.

Lint + format · one poly.toml · pure Rust, zero deps · blake3 cache + rayon parallelism · git hooks & commit checks · MCP + Claude/Codex plugin

CI License: MIT Docs

Install · What You Get · What Runs Out of the Box · AI Agents & MCP · Performance · Docs · Contributing


What You Get

CapabilityWhat it does
Fast on real reposLints Django in 0.82s and home-assistant's 25,000 files in 3.5s, cold cache; see Performance.
One binary, no toolchainCompiled-in Rust backends for Python, JavaScript, TypeScript, JSX, TSX, JSON, YAML, TOML, Markdown, MDX, CSS, SCSS, Less, HTML, Vue, Svelte, Astro, Angular, XML, PHP, Ruby, SQL, GraphQL, Nix, HCL, Dockerfile, INI and .env. Go, Rust, Zig, Java, Kotlin, Swift, Dart, R, Gleam and shell use their own toolchain when it is installed, and a tree-sitter tier covers everything else. No Node, Python, or Ruby runtime needed. See the language table.
Built for agentsA Claude/Codex plugin and a stdio MCP server ship in the box — an agent calls poly's tools directly instead of shelling out and parsing text. See AI Agents & MCP.
One configpoly.toml drives linting, formatting, git hooks, and commit-message policy.
Cache + parallelismA blake3 content-hash cache skips unchanged work; rayon parallelizes the rest across cores.
Git hooks & commit checkspoly hooks install wires lint, format, and Conventional-Commit checks into git — no external hook framework.
Two lint tiers on every languageA code-quality metrics engine and a built-in 26-rule ast-grep pack (13 rules on by default) run on top of the backends above, at warning severity so they never redden an unconfigured CI.
Simple distributionPrebuilt binaries via a shell/PowerShell installer, a GitHub Action, Homebrew, Scoop, npm, and PyPI.

Installation

Quick install

sh
curl -fsSL https://raw.githubusercontent.com/Goldziher/poly/main/install.sh | sh

Windows PowerShell:

powershell
irm https://raw.githubusercontent.com/Goldziher/poly/main/install.ps1 | iex

Both detect the platform, download the matching release archive, and verify it against sha256sums.txt. Set POLY_VERSION=0.23.1 to pin an exact release.

GitHub Actions

yaml
- uses: Goldziher/poly@v0
  with:
    version: v0.23.1 # omit for the latest release

Forwards to install.sh and caches the installed binary by version and platform. See ACTION_USAGE.md for the full input/output reference.

Package managers

sh
brew install Goldziher/tap/poly
powershell
scoop bucket add goldziher https://github.com/Goldziher/scoop-bucket
scoop install poly

Homebrew's tap is a single rolling formula with no versioned alias yet — treat it as a get-latest channel and use the installer script or the GitHub Action where a pinned version matters. cargo binstall --git https://github.com/Goldziher/poly poly-cli also works, resolving the same GitHub release archives.

npm and PyPI

sh
npm i -g @goldziher/polylint
pip install polylint

Both install the same prebuilt poly binary. The package is named polylint (the unscoped poly name belongs to unrelated projects on both registries), but the executable is poly on every channel — polylint also works everywhere as an alias for the same binary. Full per-platform detail in docs/INSTALL-PACKAGES.md.

As an agent plugin

poly ships its own Claude/Codex plugin, registering poly mcp as a stdio server plus 5 skills and 2 slash commands (/poly-check, /poly-fix):

text
/plugin marketplace add Goldziher/poly
/plugin install poly@poly

Codex: add the Goldziher/poly marketplace through your client's plugin manager (manifest at .codex-plugin/plugin.json). The plugin assumes poly is already on PATH — it does not bundle the binary — and its version tracks the poly binary version lock-step. See AI Agents & MCP.

As an MCP server

Any MCP-capable client can run poly directly:

json
{
  "mcpServers": {
    "poly": { "command": "poly", "args": ["mcp"] }
  }
}

Quickstart

console
$ poly lint
./app.py
  warning  ruff  T201  5:5  `print` found
  warning  ruff  ANN201  4:5  Missing return type annotation for public function `main`
  error  ruff  F401  1:8  `os` imported but unused

3 issues found.
  2 files linted
  1 issue fixable with the `--fix` option

$ poly fmt --check
would reformat ./src/main.rs

1 file will change.
  2 files checked

$ poly fmt --fix
reformatted ./src/main.rs

1 file reformatted.
  2 files checked

$ poly hooks install
✓ Installed 2 git hooks in .git/hooks
  › commit-msg
  › pre-commit

poly fmt is a dry run by default (CI-friendly); add --fix to write changes, and poly lint --fix to apply lint autofixes. poly hooks install wires the git hooks once — lint, format, and commit checks then run on every git commit.

Exit codes are a contract: 0 is clean, 2 means the run verified less than it claims, and 1 means findings — which for poly fmt --fix reports that files were rewritten, so a script running it in fix mode should treat 1 as success. Add -q to trim the per-file detail on a large repository; the summary keeps every count and reason.


Demos

Real recordings, not mockups — vhs runs each command live, so the timings on screen are the timings you get. Tapes are in docs/media/tapes/.

Kubernetes: 31,303 files, one binary, no Go toolchain.

poly linting the Kubernetes repository

Django is not a Python repo — it is Python, JavaScript, CSS, HTML, TOML, YAML and Markdown. One tool, one config, one pass.

poly formatting and linting Django

Every report has a machine-readable form. --format toon is compact enough to hand to an agent without burning its context; --format json is there when you want a document to parse.

poly emitting TOON output

And an agent can skip the terminal entirely. poly mcp speaks MCP over stdio and advertises the same eleven tools the CLI exposes.

the poly MCP server listing its tools


How It Works

poly discovers files once (respecting .gitignore), plans the engine list once per language, and runs the per-file work in parallel on a rayon pool. Every backend — a linked-in Rust crate, the tree-sitter tier, or a wrapped CLI — returns the same Diagnostic and FormatOutput shapes, so reporting, caching, and MCP output stay uniform.

The default path needs no Python, Node, Go, or JVM — the backends are Rust crates compiled into the binary, and a language without a dedicated backend falls through to a tree-sitter generic tier that is still pure Rust. The result cache is keyed by file bytes, engine name, engine version, and resolved engine config, so a tool upgrade or a config change invalidates exactly the entries it affects. --debug prints per-file engine timing and cache hit/miss data.


What Runs Out of the Box

poly is useful with an empty poly.toml. This is what a run with no configuration actually does; anything opt-in is marked as such.

BackendWhat it enables by default
ruff (Python)22 selector groups: ruff's own F, E4, E7, E9, plus W6, I, UP, B, ANN, SIM, C4, RET, FURB, PERF, TRY, BLE, S110, C90, PLR, T20, TC, PTH, RUF, ARG. E1/E2/E3/W1/W2/W3 stay off because the formatter owns them, and seven noisy members are turned back off: B008, RUF100, ANN002, ANN003, ARG002, PLR2004, TRY003. Line length 120, docstring code formatted at width 120.
oxlint (JS/TS)oxlint's own default is correctness only. poly adds suspicious, pedantic, complexity, typescript/no-explicit-any, typescript/no-non-null-assertion and no-console, all at warning. restriction, style and nursery stay off; no-underscore-dangle, max-lines-per-function, max-lines and max-classes-per-file are turned back off.
mago (PHP)PHP 8.4, with six maintainability metrics downgraded from error to warning: cyclomatic-complexity (15), excessive-parameter-list (5), too-many-methods (10), too-many-properties (10), too-many-enum-cases (20), kan-defect (1).
rumdl (Markdown)Five rumdl-proprietary stylistic rules disabled, plus four more for MDX. Line length 120.
biome (CSS/SCSS, GraphQL)The correctness and suspicious rule groups. Accessibility, style, complexity, performance and security are opt-in.

Three tiers that run on every language

  • typos — spell-checks identifiers, comments and strings. Always on; it has no enable key.
  • The code-quality engine — tree-sitter metric rules, listed below.
  • The built-in ast-grep pack — 26 rules across C#, Elixir, Go, Java, Kotlin, Python, Ruby, Rust and Swift. 13 are on by default; the other 13 ship severity: off and are one config line away. Your own rules under [rules] dirs sit above the pack — a rule with the same id replaces the built-in one outright.

A fourth cross-cutting engine, uncomment (comment removal), is off by default.

Quality ruleDefault
file-too-long1000 lines
function-too-long80 lines
type-too-long300 lines
too-many-parameters6
nesting-too-deep4
cyclomatic-complexity20
lazy-ignoreon
magic-numberopt-in — allows −1, 0, 1, 2, 10, 100
law-of-demeteropt-in — chain depth 3

The quality engine never duplicates a backend rule: where ruff or oxlint already covers a metric, it defers. It counts as lint coverage only for languages whose control flow it can model — Python, Rust, Go, JavaScript, JSX, TypeScript, TSX, Java, Kotlin, C, C++, C# and Ruby — while other languages still get the line-count rules.

Everything these three tiers report is warning severity, and warnings alone do not fail a run, so turning poly on does not redden an unconfigured CI.

Native toolchain CLIs

gofmt, rustfmt and shellcheck run automatically when found on PATH; shellcheck is the only one of the three that lints. zig fmt, shfmt, google-java-format, ktfmt, styler (R), swift-format, dart format and gleam format are opt-in. When a tool is absent the language falls through to the tree-sitter tier, so the zero-dependency promise holds either way.


Backend Coverage

LanguageBackendLintFormat
Pythonruffyesyes
JavaScript / TypeScript / JSX / TSX / JSONoxcyesyes
TOMLtaployesyes
YAMLsaphyr + pretty_yamlyesyes
Markdown / MDXrumdlyesyes
SQLsqruffyesyes
CSS / SCSSmalva + biomeyesyes
Lessmalvanoyes
GraphQLgraphql + biomeyesyes
PHPmagoyesyes
HCL / Terraformhclyesyes
HTML / Vue / Svelte / Astro / XMLmarkup_fmtnoyes
Dockerfiledockerfileyesno
.envdotenvyesno
INIiniyesno
Rubyrubyfmtnoyes
Nixalejandranoyes
Gogofmt, automatic when installednoyes
Rustrustfmt, automatic when installednoyes
Shellshellcheck automatic, shfmt opt-inyesopt-in
Zig / Java / Kotlin / R / Swift / Dart / Gleamfirst-party CLI, opt-innoopt-in
Everything else identifiedtree-sitter generic tiernobest effort

The Lint column is the language's own backend; the three cross-cutting tiers add findings on top, including where that column says no. Beyond this table, an opt-in catalog of 348 tools across 175 languages covers the long tail. Full per-language reference: Backends.


AI Agents & MCP

poly ships its agent integration in the box rather than expecting one to be bolted on.

text
/plugin marketplace add Goldziher/poly
/plugin install poly@poly

That installs 5 skills and 2 slash commands (/poly-check, /poly-fix) that teach an agent poly's tiered backend model and when to reach for lint vs. format vs. hooks. Codex clients add the same marketplace through their own plugin manager.

poly mcp is a stdio MCP server exposing eleven tools that mirror the CLI 1:1 — lint, format_check, rules, config_show, cache_stats and version (read-only), lint_fix, format_write and cache_clean (mutating), and workspace_lint / workspace_lint_fix. The last two run the multi-minute whole-project phase (cargo clippy, cargo-sort, cargo-machete, cargo-deny) and are exposed as async Tasks: the call returns a handle the client polls with tasks/get, falling back to a synchronous result for clients that do not declare the capability.

Every result carries a poly identity block (version, build id, channel, executable, pid, engines — a blake3 digest of every compiled-in backend's version) and separates three per-file outcomes — checked, skipped (poly declined the file) and errored (poly failed on a file it accepted). isError is set whenever anything errored, so an agent can gate on it before trusting the payload.

Full parameter reference: .ai-rulez/skills/poly-mcp/SKILL.md.


Performance

Release build, Apple Silicon, cold cache (--no-cache), best of three runs on an idle machine. poly lint --no-workspace and poly fmt --check over the whole repository, counting the files poly actually inspected. These are poly's own numbers — not a comparison against ruff, oxlint, biome or anything else; no such benchmark was run.

Projectpoly lintFindingsPeak RSSpoly fmt --check
Django3,113 files in 0.82s66,8390.21 GB5,539 files in 0.30s
home-assistant25,443 files in 3.5s376,8290.48 GB25,559 files in 1.2s
Kubernetes21,657 files in 6.8s41,5760.40 GB21,824 files in 12.9s
prettier7,057 files in 1.9s19,3730.40 GB7,450 files in 0.44s
TypeScript32,606 files in 13.3s179,5860.52 GB40,012 files in 4.0s

Kubernetes is the one repository where formatting costs more than linting: its Go files go through gofmt, the one backend that is a subprocess rather than a linked-in crate, and ~20,000 process spawns dominate the run.

The blake3 cache and rayon parallelism (see How It Works) are what keep repeat runs fast — Django re-lints in 0.71s warm against 0.82s cold: a cache hit skips the engine entirely, and everything else is split across cores.


Documentation

A single poly.toml drives linting, formatting, git hooks, and commit-message policy; poly.local.toml layers local overrides on top, nested files cascade in a monorepo, and poly config show prints the effective merged result. Unknown keys, unknown sections and wrongly-typed values are reported as warnings, never silently ignored.

  • Quickstart — install, first run, first config.
  • Configuration — every key, rule selection, inline suppression, monorepo cascading, shared and remote config.
  • Hooks — poly hooks install, builtin hooks, staged isolation, timeouts, concurrency, caching.
  • CLI reference — every subcommand and flag, and the exit-code contract.
  • Backends — full language table and the tool catalog.

Contributing

Keep changes small and test-backed. A new or changed backend needs known-bad and known-unformatted fixtures under crates/poly-core/tests/, and must preserve the uniform Engine boundary. Before committing:

sh
poly hooks install   # wires lint/format/cargo checks into git; they run on every commit
cargo test --workspace --no-fail-fast

For anything touching the runner, an engine, or the rule pack, also run the hardening harness. poly's own fixtures are small and chosen to exercise a known path; the harness runs poly over real third-party trees and checks the things fixtures cannot — that no file errored, that formatting converges in two passes, that the cache never serves a different answer than a cold run, and that no language poly claims to lint reports no lint rules for it:

sh
task harden           # pinned third-party repositories
task harden:local     # the sibling working trees next door, read-only
task harden:generated # machine-generated code (corpus C)

It also reports per-rule finding counts per repository, which is how a pack rule earns a default severity. See docs/harden-corpus.md for what each corpus is allowed to assert, and why a count needs a pinned input while an invariant does not.


License

MIT - see LICENSE.

Cài đặt

TypingMind
{
  "mcpServers": {
    "poly": {
      "command": "poly",
      "args": [
        "mcp"
      ]
    }
  }
}

Dùng MCP poly với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối poly, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm poly làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của poly.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "poly": {
      "command": "npx",
      "args": [
        "-y",
        "@goldziher/opencode-poly"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của poly, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của poly.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng poly giúp tôi làm việc này không?
poly
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng poly.

Câu hỏi thường gặp

Máy chủ MCP poly dùng để làm gì?

poly là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP poly với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng poly với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP poly với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối poly, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP poly với TypingMind?

poly hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP poly cung cấp những công cụ nào trong TypingMind?

poly cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP poly không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu poly yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇