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
# Lint checks only: no transforms, writes, or post-process
# 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 |
Preview without writing files; fail if transformations are needed |
--checks-only |
Lint checks only; no writes, transforms, or post-process |
--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 |
--all-lines |
Report every severity on all lines, overriding configured scopes |
--diff-base <REF> |
Compare against the merge-base of local REF and HEAD |
--version |
Print the CLI version and exit |
You can also set the baseline via RUST_LLM_TIDY_DIFF_BASE; --diff-base
takes precedence.
See reporting scope for baseline comparison and same-file duplication for DUP001 settings.
Exit status
Errors fail any run, and --dry-run also fails when edits are needed,
without writing files. Warnings, hints, and reminders alone do not fail it.
--checks-only runs lint checks only, never modifies files, and keeps
configured rule selections. Configured post_process commands never run.
Preview operations read the original source and skip external post_process
commands, so dry-run does not fully check apply-mode results.
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","hint", or"reminder"for findings,"success"for change records (applied or would-be changes)line- 1-based reported line,nullwhen no specific line (link/table fixes)item_name- item name,nullwhen unnamedtitle- friendly 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.
Hints and reminders never fail a run and print in separate groups 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 DOC*, TEXT*, TEST* checks | no | yes |
An optional YAML config file (.rust-llm-tidy.yml) customizes processing.
Per file it can:
- exclude files from processing
- whitelist or blacklist specific rules per path
- 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