lancet Docs
Reference

CLI Subcommands, Flags & Exit Codes Reference

Authoritative per-subcommand syntax and exit codes across all 15 entrypoints.

All subcommands share deterministic exit codes, .gitignore traversal, and structured JSON output when --json is passed. For lancet rg's 40+ ripgrep flags, see lancet rg Parity Reference.

Exit Codes#

CodeMeaningReturned JSON status
0Success / at least one match / edit applied or previewed cleanlycomplete
10 matches (or missing index in lancet status)empty
2Bad query/CLI flags, unsupported target/rename, CAS conflict, or I/O errorinvalid_query, unsupported, conflict
Command & FlagDefault / ValuesMeaning
lancet <QUERY> [PATH]PATH = .Evaluate LQL query over directory or file
--json · --statsfalseMachine-readable JSON · execution telemetry on stderr
--no-index | --trust-index | --index-dir DIRauto, PATH/.lancetOverride index freshness strategy or location
--hidden · --no-ignore · -j THREADS · --ocrfalse, CPUs, falseTraversal & OCR toggles
--max-lines N · --max-cols N20, 240Display cap per matched unit and line
lancet batch [PATH] -q Q... [--name N...] [--queries-json JSON]—Share one index open + walk across multiple LQL queries
lancet parse <QUERY>—Print normalized canonical query + JSON IR
lancet explain <QUERY> [PATH]—Show required trigrams, candidate count & selectivity %

lancet fd & outline & refs & read#

SubcommandFlags & Arguments
lancet fd [PATTERN] [PATH...]-p/--pattern, -t f|d, -e/--ext (comma/repeatable), --type-class, -g (glob; auto-detected on */?/[), -r (regex), -s (case), -d/--max-depth, --changed-within DUR, --min-size, --max-size, --tree, --dirs, --limit N, --meta, --no-index, --trust-index, --index-dir, --hidden, --no-ignore, -j, --json, --stats
lancet outline [PATH]-d/--max-depth, -e/--ext, --limit N, --hidden, --no-ignore, -j, --ocr, --json
lancet refs <SYMBOL> [PATH]--rank, --kind KIND,... (requires --rank), -l/--lang, -e/--ext, --path GLOB, --all-files, --limit N, --no-index, --trust-index, --index-dir, --hidden, --no-ignore, -j, --json, --stats
lancet read <TARGET>...One or more targets (file:10-50, zip!entry), -l/--lines, -s/--symbol, -p/--page, --sheet, --rows, --cols, -e/--entry, --budget-tokens, --raw, --ocr, --json

lancet ast, edit, patch, rename, index & mcp#

SubcommandFlags & Arguments
lancet ast <PATTERN> [PATH]-l/--lang, -r/--rewrite TEMPLATE, --apply, --path GLOB (repeatable), --limit N, --no-index, --trust-index, --index-dir, --hidden, --no-ignore, -j, --json, --stats
lancet edit <PATH>Target (one of): --lines, --symbol, --find [--all], or --edits FILE|- · Operation (one of): --with, --with-file FILE|-, --delete, --insert-before, --insert-after · Safety: --rev REV, --apply, --allow-syntax-errors, --json
lancet patch [DIFF|-]--root DIR (.), -p/--strip N (1), --apply, --allow-syntax-errors, --json
lancet rename <FILE:LINE[:COL]> <OLD> <NEW>--rev REV, --apply, --json
lancet index [PATH] · status [PATH]--rebuild | --compact, --index-dir, --ocr, --hidden, --no-ignore, -j
lancet mcp--root DIR (.), --read-only, --trust-index, -j/--threads
MIT OR Apache-2.0 · Single Rust binary View Markdown source on GitHub →