pub enum Command {
Show 13 variants
Index {
path: PathBuf,
force: bool,
languages: Vec<String>,
quiet: bool,
command: Option<IndexSubcommand>,
},
Query {Show 25 fields
pattern: Option<String>,
symbols: bool,
lang: Option<String>,
kind: Option<String>,
ast: bool,
regex: bool,
json: bool,
pretty: bool,
ai: bool,
limit: Option<usize>,
offset: Option<usize>,
expand: bool,
file: Option<String>,
exact: bool,
contains: bool,
count: bool,
timeout: u64,
plain: bool,
glob: Vec<String>,
exclude: Vec<String>,
paths: bool,
no_truncate: bool,
all: bool,
force: bool,
dependencies: bool,
},
Serve {
port: u16,
host: String,
},
Stats {
json: bool,
pretty: bool,
},
Clear {
yes: bool,
},
ListFiles {
json: bool,
pretty: bool,
},
Watch {
path: PathBuf,
debounce: u64,
quiet: bool,
},
Mcp,
Analyze {Show 19 fields
circular: bool,
hotspots: bool,
min_dependents: usize,
unused: bool,
islands: bool,
min_island_size: usize,
max_island_size: Option<usize>,
format: String,
json: bool,
pretty: bool,
count: bool,
all: bool,
plain: bool,
glob: Vec<String>,
exclude: Vec<String>,
force: bool,
limit: Option<usize>,
offset: Option<usize>,
sort: Option<String>,
},
Deps {
file: PathBuf,
reverse: bool,
depth: usize,
format: String,
json: bool,
pretty: bool,
},
Ask {Show 16 fields
question: Option<String>,
execute: bool,
provider: Option<String>,
json: bool,
pretty: bool,
additional_context: Option<String>,
configure: bool,
agentic: bool,
max_iterations: usize,
no_eval: bool,
show_reasoning: bool,
verbose: bool,
quiet: bool,
answer: bool,
interactive: bool,
debug: bool,
},
Context {
structure: bool,
path: Option<String>,
file_types: bool,
project_type: bool,
framework: bool,
entry_points: bool,
test_layout: bool,
config_files: bool,
depth: usize,
json: bool,
},
IndexSymbolsInternal {
cache_dir: PathBuf,
},
}Variants§
Index
Build or update the local code index
Fields
command: Option<IndexSubcommand>Subcommand (status, compact)
Query
Query the code index
If no pattern is provided, launches interactive mode (TUI).
Search modes:
-
Default: Word-boundary matching (precise, finds complete identifiers) Example: rfx query “Error” → finds “Error” but not “NetworkError” Example: rfx query “test” → finds “test” but not “test_helper”
-
Symbol search: Word-boundary for text, exact match for symbols Example: rfx query “parse” –symbols → finds only “parse” function/class Example: rfx query “parse” –kind function → finds only “parse” functions
-
Substring search: Expansive matching (opt-in with –contains) Example: rfx query “mb” –contains → finds “mb”, “kmb_dai_ops”, “symbol”, etc.
-
Regex search: Pattern-controlled matching (opt-in with –regex) Example: rfx query “^mb_.*” –regex → finds “mb_init”, “mb_start”, etc.
Interactive mode:
- Launch with: rfx query
- Search, filter, and navigate code results in a live TUI
- Press ‘?’ for help, ‘q’ to quit
Fields
lang: Option<String>Filter by language Supported: rust, python, javascript, typescript, vue, svelte, go, java, php, c, c++, c#, ruby, kotlin, zig
kind: Option<String>Filter by symbol kind (implies –symbols) Supported: function, class, struct, enum, interface, trait, constant, variable, method, module, namespace, type, macro, property, event, import, export, attribute
ast: boolUse AST pattern matching (SLOW: 500ms-2s+, scans all files)
WARNING: AST queries bypass trigram optimization and scan the entire codebase. In 95% of cases, use –symbols instead which is 10-100x faster.
When –ast is set, the pattern parameter is interpreted as a Tree-sitter S-expression query instead of text search.
RECOMMENDED: Always use –glob to limit scope for better performance.
Examples: Fast (2-50ms): rfx query “fetch” –symbols –kind function –lang python Slow (500ms-2s): rfx query “(function_definition) @fn” –ast –lang python Faster with glob: rfx query “(class_declaration) @class” –ast –lang typescript –glob “src/**/*.ts”
regex: boolUse regex pattern matching
Enables standard regex syntax in the search pattern: | for alternation (OR) - NO backslash needed . matches any character .* matches zero or more characters ^ anchors to start of line $ anchors to end of line
Examples: –regex “belongsTo|hasMany” Match belongsTo OR hasMany –regex “^import.*from” Lines starting with import…from –regex “fn.*test” Functions containing ‘test’
Note: Cannot be combined with –contains (mutually exclusive)
pretty: boolPretty-print JSON output (only with –json) By default, JSON is minified to reduce token usage
ai: boolAI-optimized mode: returns JSON with ai_instruction field Implies –json (minified by default, use –pretty for formatted output) Provides context-aware guidance to AI agents on response format and next actions
offset: Option<usize>Pagination offset (skip first N results after sorting) Use with –limit for pagination: –offset 0 –limit 10, then –offset 10 –limit 10
expand: boolShow full symbol definition (entire function/class body) Only applicable to symbol searches
file: Option<String>Filter by file path (supports substring matching) Example: –file math.rs or –file helpers/
contains: boolUse substring matching for both text and symbols (expansive search)
Default behavior uses word-boundary matching for precision: “Error” matches “Error” but not “NetworkError”
With –contains, enables substring matching (expansive): “Error” matches “Error”, “NetworkError”, “error_handler”, etc.
Use cases:
- Finding partial matches: –contains “partial”
- When you’re unsure of exact names
- Exploratory searches
Note: Cannot be combined with –regex or –exact (mutually exclusive)
glob: Vec<String>Include files matching glob pattern (can be repeated)
Pattern syntax (NO shell quotes in the pattern itself): ** = recursive match (all subdirectories)
- = single level match (one directory)
Examples: –glob src//.rs All .rs files under src/ (recursive) –glob app/Models/.php PHP files directly in Models/ (not subdirs) –glob tests//*_test.go All test files under tests/
Tip: Use –file for simple substring matching instead: –file User.php Simpler than –glob **/User.php
exclude: Vec<String>Exclude files matching glob pattern (can be repeated)
Same syntax as –glob (** for recursive, * for single level)
Examples: –exclude target/** Exclude all files under target/ –exclude /*.gen.rs Exclude generated Rust files –exclude node_modules/ Exclude npm dependencies
paths: boolReturn only unique file paths (no line numbers or content) Compatible with –json to output [“path1”, “path2”, …]
no_truncate: boolDisable smart preview truncation (show full lines) By default, previews are truncated to ~100 chars to reduce token usage
all: boolReturn all results (no limit) Equivalent to –limit 0, convenience flag for getting unlimited results
Serve
Start a local HTTP API server
Stats
Show index statistics and cache information
Clear
Clear the local cache
ListFiles
List all indexed files
Watch
Watch for file changes and auto-reindex
Continuously monitors the workspace for changes and automatically triggers incremental reindexing. Useful for IDE integrations and keeping the index always fresh during active development.
The debounce timer resets on every file change, batching rapid edits (e.g., multi-file refactors, format-on-save) into a single reindex.
Fields
Mcp
Start MCP server for AI agent integration
Runs Reflex as a Model Context Protocol (MCP) server using stdio transport. This command is automatically invoked by MCP clients like Claude Code and should not be run manually.
Configuration example for Claude Code (~/.claude/claude_code_config.json): { “mcpServers”: { “reflex”: { “type”: “stdio”, “command”: “rfx”, “args”: [“mcp”] } } }
Analyze
Analyze codebase structure and dependencies
Perform graph-wide dependency analysis to understand code architecture. By default, shows a summary report with counts. Use specific flags for detailed results.
Examples: rfx analyze # Summary report rfx analyze –circular # Find cycles rfx analyze –hotspots # Most-imported files rfx analyze –hotspots –min-dependents 5 # Filter by minimum rfx analyze –unused # Orphaned files rfx analyze –islands # Disconnected components rfx analyze –hotspots –count # Just show count rfx analyze –circular –glob “src/**” # Limit to src/
Fields
all: boolReturn all results (no limit) Equivalent to –limit 0, convenience flag for unlimited results
glob: Vec<String>Include files matching glob pattern (can be repeated) Example: –glob “src//*.rs” –glob “tests//*.rs”
Deps
Analyze dependencies for a specific file
Show dependencies and dependents for a single file. For graph-wide analysis, use ‘rfx analyze’ instead.
Examples: rfx deps src/main.rs # Show dependencies rfx deps src/config.rs –reverse # Show dependents rfx deps src/api.rs –depth 3 # Transitive deps
Fields
Ask
Ask a natural language question and generate search queries
Uses an LLM to translate natural language questions into rfx query commands.
Requires API key configuration for one of: OpenAI, Anthropic, or Groq.
If no question is provided, launches interactive chat mode by default.
Configuration:
-
Run interactive setup wizard (recommended): rfx ask –configure
-
OR set API key via environment variable:
- OPENAI_API_KEY, ANTHROPIC_API_KEY, or GROQ_API_KEY
-
Optional: Configure provider in .reflex/config.toml: [semantic] provider = “groq” # or openai, anthropic model = “llama-3.3-70b-versatile” # optional, defaults to provider default
Examples: rfx ask –configure # Interactive setup wizard rfx ask # Launch interactive chat (default) rfx ask “Find all TODOs in Rust files” rfx ask “Where is the main function defined?” –execute rfx ask “Show me error handling code” –provider groq
Fields
Context
Generate codebase context for AI prompts
Provides structural and organizational context about the project to help
LLMs understand project layout. Use with rfx ask --additional-context.
By default (no flags), shows all context types. Use individual flags to select specific context types.
Examples: rfx context # Full context (all types) rfx context –path services/backend # Full context for monorepo subdirectory rfx context –framework –entry-points # Specific context types only rfx context –structure –depth 5 # Deep directory tree
§Use with semantic queries
rfx ask “find auth” –additional-context “$(rfx context –framework)”
Fields
IndexSymbolsInternal
Internal command: Run background symbol indexing (hidden from help)
Trait Implementations§
Source§impl FromArgMatches for Command
impl FromArgMatches for Command
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Subcommand for Command
impl Subcommand for Command
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommandAuto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more