CLI Search
The code-search search command lets you search across all indexed repositories.
Basic Usage
Section titled “Basic Usage”# Simple text searchcode-search search "foo"
# Search for a phrasecode-search search "func main"
# Regex searchcode-search search "func\s+\w+\(" --regexCommand Syntax
Section titled “Command Syntax”code-search search <query> [flags]Command Options
Section titled “Command Options”--regex, -r
Section titled “--regex, -r”Treat the search query as a regular expression.
# Match function definitionscode-search search "func\s+\w+\(" --regex
# Match version numberscode-search search "v\d+\.\d+\.\d+" --regex--repos, -R
Section titled “--repos, -R”Filter results to specific repositories (can be used multiple times or comma-separated).
# Single repocode-search search "foo" --repos myorg/myrepo
# Multiple reposcode-search search "foo" --repos myorg/frontend,myorg/backend
# Or specify multiple timescode-search search "foo" -R myorg/frontend -R myorg/backend--langs, -l
Section titled “--langs, -l”Filter by programming languages (can be specified multiple times).
code-search search "class" --langs pythoncode-search search "interface" --langs typescript,javascriptSupported languages: go, python, javascript, typescript, java, ruby, rust, c, cpp, csharp, php, swift, kotlin, and more.
--files, -f
Section titled “--files, -f”Filter by file path patterns (can be specified multiple times).
# By extensioncode-search search "import" --files "*.py"
# By directorycode-search search "config" --files "src/**"
# By filenamecode-search search "main" --files "main.go,main.ts"--case-sensitive
Section titled “--case-sensitive”Enable case-sensitive search (default is case-insensitive).
code-search search "foo" --case-sensitivecode-search search "foo" --case-sensitive # Different results--context, -C
Section titled “--context, -C”Number of lines to show before and after each match.
code-search search "error" --context 5--stream
Section titled “--stream”Stream results as they arrive for faster time-to-first-result. Useful for interactive searches with large result sets.
# Stream results as they're foundcode-search search "TODO" --stream
# Combine with other filterscode-search search "deprecated" --repos myorg/backend --stream--limit, -n
Section titled “--limit, -n”Maximum number of results to return.
code-search search "foo" --limit 50Global Options
Section titled “Global Options”These options are available on all commands:
| Option | Description |
|---|---|
--config | Path to config file |
--api-url | API server URL (default: localhost:8080) |
--output | Output format: text, json, table |
Examples
Section titled “Examples”Symbol search
Section titled “Symbol search”# Find function definitionscode-search search "func Create" --lang go
# Find class definitionscode-search search "class User" --lang pythonImport search
Section titled “Import search”# Find where a package is importedcode-search search 'import "github.com/pkg/errors"' --lang gocode-search search "from flask import" --lang pythonSecurity patterns
Section titled “Security patterns”# Find hardcoded secrets (be careful!)code-search search 'password\s*=' --regexcode-search search 'api_key\s*=' --regexPerformance Tips
Section titled “Performance Tips”- Use filters - Narrow results with
--repo,--lang,--file - Limit results - Use
--limitfor large result sets - Be specific - More specific queries are faster
Next Steps
Section titled “Next Steps”- Replace Commands - Bulk replace operations
- Find Commands - Find files and symbols