codanna-codebase-intelligence
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodanna Codebase Intelligence
Codanna代码库智能工具
Codanna indexes your codebase and provides semantic search, call graphs, and dependency analysis via MCP tools. Use codanna before grep/find - it understands code structure, not just text patterns.
Codanna会为你的代码库建立索引,通过MCP工具提供语义搜索、调用图和依赖分析功能。请在使用grep/find前优先使用codanna——它可理解代码结构,而非仅匹配文本模式。
When to Use
适用场景
- Finding code: "Where do we handle authentication?" →
semantic_search_docs - Understanding dependencies: "What calls this function?" →
find_callers - Impact analysis: "What breaks if I change this?" →
analyze_impact - Exploring symbols: "Show me the Parser struct" →
find_symbol
- 查找代码: "我们在哪里处理身份认证?" →
semantic_search_docs - 理解依赖: "哪些地方调用了这个函数?" →
find_callers - 影响分析: "如果我修改这个地方会导致什么功能出错?" →
analyze_impact - 探索符号: "给我展示Parser结构体" →
find_symbol
Core Tools
核心工具
Discovery
探索类
undefinedundefinedNatural language search - finds code by intent, not keywords
自然语言搜索 - 按功能意图查找代码,而非关键词匹配
semantic_search_docs query:"error handling patterns" limit:5
semantic_search_docs query:"error handling patterns" limit:5
Search symbols by name/pattern
按名称/模式搜索符号
search_symbols query:"parse" kind:"function"
search_symbols query:"parse" kind:"function"
Get full details on a specific symbol
获取指定符号的完整详情
find_symbol name:"process_file"
undefinedfind_symbol name:"process_file"
undefinedRelationships
关联关系类
undefinedundefinedWho calls this function? (upstream)
哪些主体调用了这个函数?(上游依赖)
find_callers symbol:"validate_input"
find_callers symbol:"validate_input"
What does this function call? (downstream)
这个函数调用了哪些内容?(下游依赖)
get_calls symbol:"process_request"
get_calls symbol:"process_request"
Full dependency graph - what breaks if I change this?
完整依赖图 - 修改当前内容会影响哪些功能?
analyze_impact symbol:"DatabaseConnection" depth:3
undefinedanalyze_impact symbol:"DatabaseConnection" depth:3
undefinedDocumentation (RAG)
文档类(RAG)
undefinedundefinedSearch indexed markdown/docs
搜索已索引的markdown/文档内容
search_documents query:"API authentication" collection:"docs"
undefinedsearch_documents query:"API authentication" collection:"docs"
undefinedTool Selection Guide
工具选择指南
| Task | Tool | Example |
|---|---|---|
| Find code by concept | | "database migrations" |
| Find symbol by name | | Pattern: "auth*" |
| Get symbol details | | Exact: "UserService" |
| Trace callers | | "Who uses this?" |
| Trace dependencies | | "What does this call?" |
| Assess refactor risk | | "What breaks?" |
| 任务 | 工具 | 示例 |
|---|---|---|
| 按概念查找代码 | | "database migrations" |
| 按名称查找符号 | | 模式: "auth*" |
| 获取符号详情 | | 精确匹配: "UserService" |
| 追溯调用方 | | "哪些地方使用了这个内容?" |
| 追溯依赖 | | "这个内容调用了哪些模块?" |
| 评估重构风险 | | "哪些功能会受影响?" |
Workflow Patterns
工作流模式
Before Refactoring
重构前
- - understand current implementation
find_symbol - - identify all usage sites
find_callers - - assess blast radius
analyze_impact - Then proceed with changes
- - 理解当前实现逻辑
find_symbol - - 识别所有使用位置
find_callers - - 评估影响范围
analyze_impact - 再执行代码修改
Understanding Unfamiliar Code
理解陌生代码
- - "how does X work"
semantic_search_docs - - get entry point details
find_symbol - - trace execution flow
get_calls
- - 搜索"X功能是如何实现的"
semantic_search_docs - - 获取入口点详情
find_symbol - - 追溯执行流程
get_calls
Finding Where to Add Code
查找代码新增位置
- - "similar patterns"
semantic_search_docs - - how existing code integrates
find_callers - Follow established patterns
- - 搜索"同类功能实现模式"
semantic_search_docs - - 了解现有代码的集成方式
find_callers - 遵循已有规范新增代码
Why Codanna Over Grep
为什么选择Codanna而非Grep
| Grep/Find | Codanna |
|---|---|
| Text matching | Semantic understanding |
| String "parse" matches comments | |
| Manual call tracing | |
| Guessing impact | |
| Grep/Find | Codanna |
|---|---|
| 文本匹配 | 语义理解 |
| 字符串"parse"会匹配到注释内容 | |
| 手动追溯调用关系 | |
| 人工猜测影响范围 | |
Tips
使用提示
- Start broad with , then drill down with
semantic_search_docsfind_symbol - Use before any refactor touching shared code
analyze_impact - with depth > 1 shows transitive callers
find_callers - Results include file paths and line numbers - use for navigation
- 先用进行宽泛搜索,再用
semantic_search_docs向下钻取细节find_symbol - 修改公共代码前务必先使用评估影响
analyze_impact - 给设置大于1的depth参数可展示间接调用方
find_callers - 结果包含文件路径和行号,可用于快速导航