GritQL
$ grit Community Low RiskGritQL (grit) is a declarative structural query and rewrite CLI powered by Tree-sitter across JS/TS, Python, Go, Rust, SQL, and more. It supports --json / --jsonl diagnostics on grit check and --dry-run previews on grit apply.
npm install -g @getgrit/cli grit check --json and grit apply --dry-run execute Tree-sitter rewrites locally on disk with zero MCP latency.
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 --json and --jsonl structured outputs, --dry-run previews on grit apply, and non-interactive execution by default.
- Global
--json/--jsonlflags supported ongrit check grit apply --dry-runpreviews diffs without writing
grit check is strictly read-only and grit apply --dry-run prevents file writes; operates locally on workspace files.
- Explicit
--dry-runsafety flag before in-place rewrites
Distributed via @getgrit/cli on npm/npx and native binaries on GitHub Releases for macOS, Linux, and Windows.
- Easy
npm install -g @getgrit/cliornpx @getgrit/cliinstall
Declarative GritQL syntax handles multi-language structural search and complex contextual migrations cleanly.
- Multi-language Tree-sitter engine with reusable pattern library
GritQL core is maintained under the Biome organization (biomejs/gritql) under MIT.
- Backed by Biome ecosystem (
biomejs/gritql)
Clear pattern playground, CLI quickstart, and language reference at docs.grit.io.
- Documented CLI commands and GritQL syntax online
Security, Auth & Guardrails
None required for local grit check and grit apply execution.
100% free, offline, and open-source (MIT).
# GritQL (grit) Agent Rules - Always run `grit apply ... --dry-run` before running `grit apply` without `--dry-run`. - Pass `--json` or `--jsonl` on `grit check` for structured match parsing.
Agent-Ready Command Recipes
Safe Read-Only Queries
grit check --json
Evaluates .grit/grit.yaml rules across the repo and emits structured JSON diagnostics.
grit apply '`console.log($msg)` => `logger.info($msg)`' --dry-run src/
Previews AST rewrite diffs on src/ without modifying any files on disk.
Controlled Writes & Previews
grit apply '`var $x = $y` => `const $x = $y`' src/
Writes structural AST rewrites across src/ after verifying the --dry-run diff.
Strengths for Agents
- + Native
--json/--jsonloutputs plus--dry-runongrit apply. - + Concise declarative rewrite syntax (
=>) across TypeScript, Python, Go, Rust, and more.
Caveats & Pitfalls
- ! Running
grit applywithout--dry-runor--interactivemutates matched files immediately. - ! Not in Homebrew core; installed via npm (
@getgrit/cli) or GitHub release binaries.