Every command srcnav provides for AI code navigation.
Build or rebuild the index for a codebase.
srcnav index -p /path/to/project
srcnav index -p . --force
Building: Indexing /path/to/project... Found 4435 files (max: 50000) Parsed 61583 items in 4.13s Parsed 7024 imports in 2.70s Done: 61583 items, 7024 imports indexed in 7.97s
Show index status for a project.
srcnav status -p /path/to/project
Status: Index found at "/path/.srcnav-cpp.db" Items: 27000
Show codebase statistics. Available in human-readable or JSON format.
srcnav stats -p /path/to/project
srcnav stats -p /path/to/project --json
================================================== Stats for: /path/to/project ================================================== 3925 files, 61583 items By Kind: constant 33992 function 11916 variable 6050 method 5702 class 1771 arrowfunction 1578 typealias 430 interface 122 enum 22 By Visibility: private 56395 export 5188
Find items by name pattern (regex supported). Filter by kind and visibility.
srcnav find "function_name" -p /path
srcnav find "av.*open.*" -p /path
srcnav find ".*" -p /path --kind function
srcnav find ".*" -p /path --kind struct
srcnav find ".*" -p /path --visibility public
srcnav find "func" -p /path --limit 10
srcnav find "func" -p /path --json
srcnav find "func" -p /path -c
srcnav find "func" -p /path --brief
private function createElement [/workspaces/DEVELOPMENT-2/3rdparty/react/packages/react/src/jsx/ReactJSXElement.js:610:8] private function createElementsInspectPanel [/workspaces/DEVELOPMENT-2/3rdparty/react/packages/react-devtools-extensions/src/main/index.js:294:1] 5 items found (43ms)
Search files by name pattern.
srcnav query search "avcodec" -p /path
srcnav query search "avcodec" -p /path --summary
srcnav query search "avcodec" -p /path --limit 1-20
Found 23 files in 12ms src/auth/login.ts src/auth/middleware.ts src/api/auth-guard.ts
Get all symbols defined in a file.
srcnav query context "libavcodec/avcodec.h" -p /path
srcnav query context "avcodec.h" -p /path --kind function
srcnav query context "avcodec.h" -p /path --summary
Total: 296 items By Kind: 137 constant, 48 function, 46 struct, 41 enum... By Visibility: 296 default formatDate (function) — line 12 formatCurrency (function) — line 28
Find files that include/import a given file.
srcnav query imports-of "libavcodec/avcodec.h" -p /path
srcnav query imports-of "avcodec.h" -p /path --limit 1-20
Found 47 files that import avcodec.h src decoder/decoder.cpp src encoder/encoder.cpp src utils/format.cpp
Find files that a given file includes/imports.
srcnav query dependencies-of "main.cpp" -p /path
srcnav query dependencies-of "main.cpp" -p /path --limit 1-20
15 files depend on this file src/components/Price.tsx src/services/billing.ts
Find include/import path between two files.
srcnav query path "libavcodec/avcodec.h" "libavformat/avformat.h" -p /path
srcnav query path "a.h" "b.h" -p /path --format mermaid
srcnav query path "a.h" "b.h" -p /path --format dot
Include path from avcodec.h to avformat.h: avcodec.h -> common.h -> utils.h -> avformat.h
Show symbol and surrounding context from the same file.
srcnav analyze context "avcodec_open2" -p /path
Symbol: avcodec_open2 (function)
File: libavcodec/utils.c:234
Context:
int avcodec_open2(AVCodecContext *ctx, const AVCodec *codec, AVDictionary **options) {
// function implementation...
}
Show type dependencies (upstream/downstream).
srcnav analyze deps "AVCodecContext" -p /path
Type: AVCodecContext Upstream dependencies: - AVCodec (type) - AVDictionary (type) Downstream dependencies: - DecoderContext (type) - EncoderContext (type)
Trace downstream impact of a symbol across multiple levels. This is critical for AI agents to know what will break before modifying code.
srcnav analyze impact "AVCodecContext" -p /path
srcnav analyze impact "AVCodecContext" -p /path --summary
srcnav analyze impact "AVCodecContext" -p /path -d 1
srcnav analyze impact "AVCodecContext" -p /path --kind function
srcnav analyze impact "AVCodecContext" -p /path -d 1 --limit 1-20
Total downstream: 375,443 items Level 1: 334 items Level 2: 332 items Level 3: 14,937 items Level 1 (direct users): decoder.c:45 - decode_frame (function) encoder.c:32 - encode_frame (function) ...
Run multiple queries in parallel for efficiency.
srcnav batch find "func1" "func2" "func3" -p /path
srcnav batch search "term1" "term2" -p /path
[func1] Found 12 items in 23ms [func2] Found 5 items in 18ms [func3] Found 8 items in 21ms
All commands support multiple output formats for AI consumption.
The --limit flag accepts three formats:
Python
Rust
Go
Java
C
C++
TypeScript
JavaScriptOpen source CLI. Better code navigation for AI agents.
Request Access