Skip to content

CLI command reference

Every Rigor command is a subcommand of the single rigor executable:

Terminal window
rigor <command> [options] [arguments]

rigor help prints the command list; rigor version prints the installed version. An unknown command, or a malformed option, exits 64 — the conventional “usage error” code.

Commands check · init · annotate · type-of · type-scan · explain · diff · sig-gen · lsp · baseline · triage · coverage · mcp · plugins · plugin · playground · skill · lsp vs mcp · exit codes

Analyse Ruby source for type errors and report diagnostics. This is the command you run day to day and in CI.

Terminal window
rigor check [paths...]

paths are files or directories; when omitted, Rigor checks the paths: list from the configuration file.

OptionEffect
--config=PATHUse a specific config file instead of auto-discovery.
--format=text|jsonOutput format. Default text.
--explainSurface fail-soft fallback events as info diagnostics.
--no-cacheSkip the persistent cache for this run.
--clear-cacheDelete the cache directory before running.
--cache-statsPrint the on-disk cache inventory when finished.
--[no-]statsPrint a run summary (files, classes, memory, wall time) to stderr. Default on.
--workers=NDispatch analysis across N parallel worker processes (fork-based pool today; ADR-15). Default 0 (sequential).
--baseline=PATHLoad a baseline file, overriding config.
--no-baselineIgnore any configured baseline.
--baseline-strictFail the run on any baseline drift — a CI gate.
--treat-all-as-inline-rbsForce-load rigor-rbs-inline with require_magic_comment: false, so every analysed file is treated as inline-RBS without the # rbs_inline: enabled comment (ADR-32).
--tmp-file=PATH --instead-of=PATHEditor mode: analyse PATH using the buffer in --tmp-file. Both required together.

Exit 0 when no error-severity diagnostics remain, 1 when any are reported, 64 on a usage error.

Write a starter configuration file.

Terminal window
rigor init [--path=PATH] [--force]

Writes .rigor.dist.yml by default. --path chooses a different target; --force overwrites an existing file. Exit 1 if the file exists and --force was not given.

Reprint a file with every line tagged by the type of the expression it evaluates to, as a trailing #=> dump_type: comment. See Inspecting inferred types.

Terminal window
rigor annotate [--[no-]color] [--config=PATH] FILE

FILE is required. Colour is auto-detected for a tty and honours NO_COLOR; --color / --no-color override. Exit 1 on a parse error or a missing file.

Print the inferred type at one source position.

Terminal window
rigor type-of FILE:LINE:COL
rigor type-of FILE LINE COL

Accepts the position as a single file:line:col triple or as three arguments. --format=json emits a machine-readable form; --trace records fail-soft fallbacks. The editor-mode --tmp-file / --instead-of pair is accepted as on check.

Report type_of inference coverage across paths — a diagnostic-of-the-diagnoser, useful when investigating why a class infers poorly.

Terminal window
rigor type-scan PATH...

--limit=N caps the printed examples (default 10), --show-recognized includes fully-covered classes, and --threshold=RATIO makes the command exit non-zero when the unrecognized-node ratio exceeds RATIO.

Print the catalogue entry for a diagnostic rule, or list every rule when called with no argument.

Terminal window
rigor explain [rule]

rule is a rule ID (call.undefined-method), a legacy alias, or a family wildcard (call, flow, def, assert, dump). --format=json is available. Exit 64 for an unknown rule.

Compare the current diagnostics against a saved baseline JSON and report only what is new.

Terminal window
rigor diff <baseline.json> [paths...]

--current=PATH compares against a saved diagnostics JSON instead of running a fresh check. Exit 1 when new diagnostics appear.

Emit RBS signatures inferred from your Ruby source. See handbook chapter 11 for the classification model and the --params policy.

Terminal window
rigor sig-gen [paths]
OptionEffect
--printWrite RBS to stdout. Default.
--diffWrite a unified diff against existing RBS.
--writeWrite RBS to sig/<path>.rbs files.
--overwriteAllow tighter-return updates to replace user-authored RBS.
--include-privateEmit private and protected methods too.
--params=untyped|observed|observed-strictParameter-typing policy. Default untyped.
--observe=PATHScan PATH for call-site observations. Repeatable.
--new-files / --new-methods / --tighter-returnsEmit only that classification.
--format=text|jsonOutput format.

Run the Language Server over stdio. See Editor integration.

Terminal window
rigor lsp [--transport=stdio] [--log=PATH] [--config=PATH]

stdio is the only transport in v1. --log=PATH writes the wire log to a file instead of stderr.

Manage diagnostic baselines. See Baselines for the file format and workflow.

Terminal window
rigor baseline <generate|regenerate|dump|drift|prune> [options]
SubcommandPurpose
generateWrite a fresh baseline from the current diagnostics. Refuses to overwrite without --force.
regenerateRewrite the baseline unconditionally — use after a quality pass.
dumpPrint the baseline contents, filterable by --rule and --file.
driftAudit how each bucket has drifted; filter with --only=within|over|cleared|reducible.
pruneDrop buckets that no longer match any diagnostic. --dry-run previews.

generate and regenerate accept --output=PATH and --match-mode=rule|message.

Summarise a diagnostic stream — rule distribution, per-file hotspots, and heuristic “why” hints — instead of dumping the raw list. See Baselines.

Terminal window
rigor triage [paths]

--top=N sets the hotspot count (default 10); --hints-only and --no-hints select which sections print. triage is advisory and always exits 0 — it never gates a build.

Report type-precision coverage — the ratio of call sites that resolve to a precise type versus those that fall back to Dynamic. A quality gate for “how much is Rigor actually inferring”.

Terminal window
rigor coverage [paths]

--format=text|json selects the output format and --config=PATH overrides config discovery. --threshold=RATIO exits 1 when the precision ratio falls below RATIO (0.01.0), making it a CI gate.

Run the Rigor MCP (Model Context Protocol) server over stdio, so AI coding assistants can call Rigor tools directly. See MCP server.

Terminal window
rigor mcp [--transport=stdio] [--config=PATH]

stdio is the only transport. The server is a pure-Ruby JSON-RPC 2.0 implementation exposing seven read-only tools: rigor_check, rigor_type_of, rigor_triage, rigor_annotate, rigor_sig_gen, rigor_explain, rigor_coverage.

lsp speaks the Language Server Protocol to editors; mcp speaks the Model Context Protocol to AI assistants. Both run over stdio and wrap the same analysis engine.

Report the activation status of every plugin configured in .rigor.yml — loaded, load-error (with reason), and each plugin’s declared extension surfaces. See Plugins.

Terminal window
rigor plugins [--format=text|json] [--strict] [--capabilities] [--config=PATH]

Without --strict the command always exits 0; with --strict it exits 1 when any plugin failed to load (a CI gate).

--capabilities switches to the extension-protocol catalogue (ADR-37): a focused, machine-readable map of what each loaded plugin contributes — the AST node types its node_rules match, the receiver classes its dynamic_returns gate on, the methods its type_specifiers narrow, and the facts it produces / consumes. Combine with --format=json for tooling (an AI agent can enumerate every plugin’s behaviour without reading a line of plugin source). The same narrow surfaces also appear in the default full report. Not to be confused with the singular rigor plugin.

Browse the on-disk source of the plugins bundled in the toolchain, so you can read a real, working plugin as a worked example when authoring your own.

Terminal window
rigor plugin <list|path|print|root> [name]
SubcommandPurpose
listTable of every bundled plugin and example, name + absolute directory path (default when no subcommand given).
path <name>One-line absolute path to the plugin’s directory.
print <name>A header (dir / lib / sig / README paths) followed by the plugin’s main source body inlined.
rootThe rigortype gem root and its key subdirectories.

Paths resolve at runtime from the gem location (a documented caveat for container / cross-filesystem setups).

Start the browser playground (a CodeMirror editor with real-time diagnostics). Requires the separate rigor-playground gem; if it is not installed the command prints an install hint and exits 64.

Terminal window
rigor playground

List or print the bundled Agent Skills shipped inside the rigortype gem, so an AI coding agent installed alongside Rigor can discover and follow them without a project-side source checkout. See Skills.

Terminal window
rigor skill <list|print|path> [name]
SubcommandPurpose
listTable of every bundled skill (name + absolute path); the default when no subcommand is given.
print <name>Print the SKILL.md body to stdout, with a header pointing at the skill’s references/ directory.
path <name>Print the single-line absolute SKILL.md path, suitable as input to a file-reading tool.
CodeMeaning
0Success — no error-severity diagnostics.
1Diagnostics found, or a per-command failure (parse error, missing file, new diagnostics on diff).
64Usage error — unknown command, bad flag, malformed argument.

rigor triage is the exception: it is advisory and always exits 0.

© 2026 TypedDuck. Licensed under CC BY-SA 4.0.