Show HN: Neatify – A universal scriptable formatter using Tree-sitter/Rust/Rhai

github.com
its-a-new-world
1 hour ago
2points
1 comments

Comments

its-a-new-world1 hour ago
I've been programming for 20 years, handcrafting tool after tool in a bunch of different languages.

With the advent of LLM-assisted coding, the landscape has shifted. I find myself surrounded by "generated" code in a wider variety of languages and formats than ever before. The specific output depends on the model, the prompt, and the tool orchestration. Keeping this polyglot soup consistent using traditional formatters proved impossible. Most formatters are either limited to a handful of languages or are so opinionated that you’re stuck with their "one true way."

So, I built Neatify.

Neatify is a universal, scriptable engine for formatting and linting. It’s built on three core pillars:

- Rust core for raw speed

- Tree-sitter for high-fidelity, syntax-agnostic parsing.

- Rhai as a lightweight scripting layer to define the logic.

In Neatify, the "opinion" isn't hardcoded into a binary with a few configuration toggles to tweak. It's just a script. If you can describe your style to an LLM, it can generate a Rhai script to enforce it via Neatify.

A few notes on the project:

- Performance: I spent significant time on performance finetuning. A 7,000-line Java file that initially took minutes to process now formats in ~800ms. But there is still room for improvement.

- AI-Orchestrated: To keep with the spirit of the project, I architected this in Rust and Rhai —languages I hadn't used before— working in close coordination with AI. It’s been an experiment in "Architect-led" development.

- License: LGPL-3.0

I’d love to hear your thoughts on the "formatter-as-script" approach!