Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI Reference

drut has four subcommands: check, format, server, and mcp.

check

drut check <PATH>

Reports every structural diagnostic found for each .s/.block file under <PATH> (a single file or a directory, scanned recursively). Prints nothing and exits 0 for a clean run.

FlagValuesDefaultEffect
--formattext, sariftextOutput format. sarif emits SARIF 2.1.0, for CI/tooling integration.

format

drut format <PATH> [flags]

Normalizes whitespace (and, opt-in, keyword casing/operator spacing/blank-line runs) for each .s/.block file under <PATH>. With none of --write, --check, or --diff, defaults to printing the reformatted result to stdout.

Disposition flags (mutually exclusive):

FlagEffect
--writeOverwrite each matched file in place.
--checkReport which files would change; write nothing.
--diffPrint a unified diff per changed file; write nothing.

Formatting-axis flags — every one of these mirrors a drut.toml [format] field one-to-one; see the Configuration Reference for accepted values, defaults, and what each actually does:

Flagdrut.toml field
--casing-control-wordscasing_control_words
--casing-pair-keywordscasing_pair_keywords
--casing-data-referencescasing_data_references
--casing-function-callscasing_function_calls
--indent-top-levelindent_top_level
--indent-widthindent_width
--operator-spacingoperator_spacing
--blank-linesblank_lines
--blank-lines-top-capblank_lines_top_cap
--blank-lines-nested-capblank_lines_nested_cap
--line-wrapline_wrap
--line-wrap-widthline_wrap_width
--line-wrap-styleline_wrap_style

An explicit flag here always wins over drut.toml and any editor setting for that one run — see the Configuration Reference’s Precedence section.

Other flags:

FlagEffect
--isolatedSkip drut.toml discovery entirely for this run — built-in defaults plus whatever other flags you passed. Useful for CI reproducibility or a one-off sanity check.

server

drut server

Speaks the Language Server Protocol over stdio. No flags — launched by an LSP client (like the VS Code extension), not run interactively. See the Editor Guide.

mcp

drut mcp

Speaks the Model Context Protocol over stdio. No flags — launched by an MCP-capable client (an AI coding assistant), not run interactively. Exposes four read-only tools, entirely independent of server above (no shared state). See the MCP Guide.