StyLua
$ stylua Community Low RiskFast Rust-based formatter for Lua 5.1–5.4, LuaJIT, and Roblox Luau codebases. Supports --check dry-run verification, --output-format json / unified diff reporting, and --verify AST safety checks.
brew install stylua Formats Lua and Luau repositories locally in milliseconds; no MCP server needed.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports --check, --output-format json / unified, --color Never, and --respect-ignores.
--check --output-format jsonreturns structured mismatch records--color Neverdisables ANSI color escapes
Offers --check read-only verification and --verify to abort if formatting alters the parsed AST.
--verifyvalidates AST equivalence before finalizing edits
Single static Rust binary distributed via Homebrew, Cargo, npm wrapper, and GitHub Releases.
- Zero runtime dependencies on macOS, Linux, and Windows
De-facto standard formatter for Neovim plugins and Roblox Luau projects with fast Rust execution.
- Supports Lua 5.1–5.4, LuaJIT, and Luau syntax
Actively maintained community standard (JohnnyMorganz/StyLua) under MPL-2.0.
- Popular
JohnnyMorganz/StyLuarepository
Well-structured README documenting stylua.toml options and CLI flags.
- Official README and
--helpoutput
Security, Auth & Guardrails
Purely local formatter; no credentials stored or required.
MPL-2.0 open-source Rust binary; completely free.
# StyLua (stylua) Agent Rules - Run `stylua --check --color Never .` before formatting to inspect pending diffs. - Pass `--verify` when formatting critical Lua/Neovim configs to guarantee AST equivalence.
Agent-Ready Command Recipes
Safe Read-Only Queries
stylua --check --output-format json --color Never .
Reports unformatted files and diffs in JSON and exits non-zero without editing any files.
Controlled Writes & Previews
stylua --verify lua/
Reformats lua/ in place and verifies the output AST matches the original before writing.
Strengths for Agents
- +
--verifyguarantees AST equivalence so formatting never silently changes Lua semantics. - + Fast single Rust binary with
--check --output-format jsonand--color Never.
Caveats & Pitfalls
- ! Note that running
stylua .without--checkwrites files in place immediately. - ! Scoped strictly to Lua/Luau formatting; does not lint logic errors (pair with
seleneorluacheck).