rust-llm-tidy-cli
Command-line adapter for the rust-llm-tidy library.
Installation
Or build from source:
Usage
rust-llm-tidy is a single command that runs the full pipeline (fix,
reorder, vis, lints) by default on every allowed source file:
# Tidy a file in place
# Report the changes that would be made instead of modifying the file
# Tidy every allowed source file under a directory recursively
# No paths given -> process the changed files in the current git diff
# Run only specific ops (repeatable); overrides the config `include` mode
# Skip an op for this run (additive to config `exclude`)
# Validate the config without processing files
# Emit the lint findings as a single JSON array on stdout
Flags
| Flag | Effect |
|---|---|
--dry-run |
Print the changes that would be made instead of modifying files |
--config <PATH> |
Explicit config path (overrides auto-discovery) |
--no-config |
Disable config discovery and loading |
--validate |
Validate config and exit (no files processed) |
--include <OP> |
Run only these ops/lint-codes (repeatable) |
--exclude <OP> |
Skip these ops/lint-codes (repeatable) |
--output-mode <MODE> |
Lint output format: text (default) or json |
--json |
Alias for --output-mode json |
JSON output
Print every lint finding and change record as one JSON array on stdout instead
of the default path:line: sev[CODE]: ... stderr diagnostics.
Change records are emitted for both in-place and --dry-run runs. Prints []
when there are no findings or changes, even when the run exits non-zero:
Fields:
severity-"error","warning", or"hint"for lint findings,"success"for change records (applied or would-be changes)line- 1-based item start line,nullwhen no specific line (link/table fixes)item_name- item name,nullwhen unnamedtitle- friendly per-code title for lint findings,nullfor change recordspath,code,message,item_kind- as in plaintext
In JSON mode the plaintext per-line diagnostics are not printed to stderr.
--output-mode json combines freely with --dry-run; the would-be changes are
folded into the same document.
See dry-run change reporting for the shared record format.
Hint-severity findings never fail a run and print as their own group in text mode; see hints.
Operations
| Op | Does | Mutates | Default on? |
|---|---|---|---|
tables |
align GFM tables | yes | yes |
fences |
alternate nested fence delimiters | yes | yes |
links |
hoist inline links to reference style | yes | yes |
reorder |
review-friendly item order | yes | yes |
vis |
narrow bare pub in restricted modules |
yes | yes |
lints |
run DOC001-DOC006, TEXT001-TEXT002, TEST001 checks | no | yes |
An optional YAML config file (.rust-llm-tidy.yml) may exclude files from
processing, whitelist or blacklist specific rules per path, and run external
programs (e.g. rustfmt) on every processed file.
Pass --config <PATH> to use an explicit config or --no-config to disable
discovery. See the repository README for the full schema.
Library use
Use rust-llm-tidy as a dependency for source buffers or complete file
processing.
The CLI owns only arguments, rendering and exit status; all processing lives in
the library.
Ordering Rules
The algorithm orders top-level items across phases. Within most phases, an item comes before any item it references; alphabetical order breaks ties. See docs/reorder.md for an annotated 10-phase example.
License
Licensed under Apache 2.0