CLI
The rce-code command-line interface is a thin wrapper over the Python facade. It is a Click command group: rce-code <command> [ARGS] [OPTIONS]. Every command opens (or creates) the index for the target repository, runs, prints plain-text results, and closes. This page documents every command, its arguments, and its options exactly as defined.
How the CLI locates the index
There is no global repository flag — instead, every command takes its own --repo option, which defaults to . (the current directory). The index database itself lives at <repo>/.rce/code/index.db and is opened (or created, with migrations applied) on each invocation. So running a command from inside a repository "just works"; from elsewhere, point it with --repo.
Index on first use
open_or_create, so the .rce/code/index.db file and its schema are created on first use. Run rce-code index before any search command, and rce-code embed before the semantic and hybrid searches.Commands
| Command | What it does |
|---|---|
index | Index (or refresh) the repository. |
stats | Print index health for the repository. |
search | Lexical (FTS5 BM25) search for a query. |
search-semantic | Semantic (vector) search for a query — run embed first. |
search-hybrid | Hybrid search fusing lexical + semantic + symbol results. |
grep | Grep the repository via ripgrep. |
embed | Embed chunks that lack a current embedding. |
symbols | List symbol definitions in a file. |
find | Find symbol definitions by name across the repo. |
refs | Show references (calls + imports) to a name. |
callers | Show resolved callers of the symbol(s) named. |
callees | Show resolved callees of the symbol(s) named. |
repomap | Print a relevance-ranked repository map within a token budget. |
--repo is on every command
--repo <path> (default .). It is omitted from the per-command option tables to avoid repetition; assume it is always available.index
Build or incrementally refresh the index. Idempotent — unchanged files are hash-skipped.
| Argument / Option | Default | Description |
|---|---|---|
--repo | . | Repository root. |
Prints a one-line summary: indexed N file(s), deleted N, skipped {...}.
stats
Print index health: counts, embedding coverage, FTS status, and skip reasons.
| Argument / Option | Default | Description |
|---|---|---|
--repo | . | Repository root. |
search
Lexical FTS5 BM25 search over indexed chunks.
| Argument / Option | Default | Description |
|---|---|---|
QUERY (positional) | — | The search query. |
-k, --top-k | 10 | Maximum number of results. |
--repo | . | Repository root. |
Each line is <file>:<start_line>-<end_line> (score <score>).
search-semantic
Embedding cosine-KNN (vector) search. Returns nothing until chunks are embedded — run rce-code embed first. See Semantic Search.
| Argument / Option | Default | Description |
|---|---|---|
QUERY (positional) | — | The search query. |
-k, --top-k | 10 | Maximum number of results. |
--repo | . | Repository root. |
search-hybrid
Reciprocal-Rank-Fusion of lexical + semantic + symbol search. Run embed first to include semantic results. See Hybrid Search.
| Argument / Option | Default | Description |
|---|---|---|
QUERY (positional) | — | The search query. |
-k, --top-k | 10 | Maximum number of results. |
--repo | . | Repository root. |
grep
Grep the working tree via ripgrep. Fixed-string by default; pass --regex to treat the pattern as a regular expression. See Grep.
| Argument / Option | Default | Description |
|---|---|---|
PATTERN (positional) | — | The pattern to search for. |
--regex / --literal | --literal | Treat PATTERN as a regex (otherwise a fixed string). |
--repo | . | Repository root. |
Each line is <file>:<line>:<column> <line_text>.
grep flag is a toggle pair
--regex/--literal is a single boolean flag pair defaulting to --literal. The richer grep options exposed on the Python API (glob, case_sensitive, max_count, raw) are not surfaced as CLI flags — reach for the Python API when you need them.embed
Embed chunks that lack a current embedding. Prints embedded N chunk(s). Run this after index and before the semantic / hybrid searches. See Embedders.
| Argument / Option | Default | Description |
|---|---|---|
--repo | . | Repository root. |
symbols
List the symbol definitions in a single file, in source order.
| Argument / Option | Default | Description |
|---|---|---|
FILE (positional) | — | Repo-relative file path. |
--repo | . | Repository root. |
Each line is tab-separated: <start_line>\t<kind>\t<qualified_name>.
find
Find symbol definitions named NAME anywhere in the repo.
| Argument / Option | Default | Description |
|---|---|---|
NAME (positional) | — | Exact symbol name to find. |
--repo | . | Repository root. |
Each line is <file>:<start_line>\t<kind>\t<qualified_name>.
refs
Show references to NAME — both calls and imports, including unresolved ones. By default shows all references; --imports narrows to import references only.
| Argument / Option | Default | Description |
|---|---|---|
NAME (positional) | — | Target name to look up. |
--imports / --all | --all | Only import references (otherwise calls + imports). |
--repo | . | Repository root. |
Each line is <from_file>:<line>:<col>\t<import|call>\t<to_name>.
callers
Show the resolved callers of the symbol(s) named NAME. Resolves the name to symbol(s), then lists every symbol that calls them via the resolved call graph.
| Argument / Option | Default | Description |
|---|---|---|
NAME (positional) | — | Symbol name whose callers to show. |
--repo | . | Repository root. |
Each line is <file>:<start_line>\t<qualified_name> (one per caller).
callees
Show the resolved callees of the symbol(s) named NAME — the symbols those definitions call.
| Argument / Option | Default | Description |
|---|---|---|
NAME (positional) | — | Symbol name whose callees to show. |
--repo | . | Repository root. |
Each line is <file>:<start_line>\t<qualified_name> (one per callee).
repomap
Print a relevance-ranked repository map fit to a token budget, biased toward the files and identifiers you name. See Repo Map.
| Argument / Option | Default | Description |
|---|---|---|
--focus | — (repeatable) | File(s) to bias the map toward. Pass multiple times for multiple files. |
--ident | — (repeatable) | Identifier(s) mentioned in context. Pass multiple times for multiple idents. |
--budget | 1024 | Token budget for the generated map. |
--repo | . | Repository root. |
--focus and --ident are repeatable
--focus and --ident are multiple-value options — repeat the flag once per value rather than passing a comma-separated list.