codanna-codebase-intelligence

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codanna 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

探索类

undefined
undefined

Natural 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"
undefined
find_symbol name:"process_file"
undefined

Relationships

关联关系类

undefined
undefined

Who 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
undefined
analyze_impact symbol:"DatabaseConnection" depth:3
undefined

Documentation (RAG)

文档类(RAG)

undefined
undefined

Search indexed markdown/docs

搜索已索引的markdown/文档内容

search_documents query:"API authentication" collection:"docs"
undefined
search_documents query:"API authentication" collection:"docs"
undefined

Tool Selection Guide

工具选择指南

TaskToolExample
Find code by concept
semantic_search_docs
"database migrations"
Find symbol by name
search_symbols
Pattern: "auth*"
Get symbol details
find_symbol
Exact: "UserService"
Trace callers
find_callers
"Who uses this?"
Trace dependencies
get_calls
"What does this call?"
Assess refactor risk
analyze_impact
"What breaks?"
任务工具示例
按概念查找代码
semantic_search_docs
"database migrations"
按名称查找符号
search_symbols
模式: "auth*"
获取符号详情
find_symbol
精确匹配: "UserService"
追溯调用方
find_callers
"哪些地方使用了这个内容?"
追溯依赖
get_calls
"这个内容调用了哪些模块?"
评估重构风险
analyze_impact
"哪些功能会受影响?"

Workflow Patterns

工作流模式

Before Refactoring

重构前

  1. find_symbol
    - understand current implementation
  2. find_callers
    - identify all usage sites
  3. analyze_impact
    - assess blast radius
  4. Then proceed with changes
  1. find_symbol
    - 理解当前实现逻辑
  2. find_callers
    - 识别所有使用位置
  3. analyze_impact
    - 评估影响范围
  4. 再执行代码修改

Understanding Unfamiliar Code

理解陌生代码

  1. semantic_search_docs
    - "how does X work"
  2. find_symbol
    - get entry point details
  3. get_calls
    - trace execution flow
  1. semantic_search_docs
    - 搜索"X功能是如何实现的"
  2. find_symbol
    - 获取入口点详情
  3. get_calls
    - 追溯执行流程

Finding Where to Add Code

查找代码新增位置

  1. semantic_search_docs
    - "similar patterns"
  2. find_callers
    - how existing code integrates
  3. Follow established patterns
  1. semantic_search_docs
    - 搜索"同类功能实现模式"
  2. find_callers
    - 了解现有代码的集成方式
  3. 遵循已有规范新增代码

Why Codanna Over Grep

为什么选择Codanna而非Grep

Grep/FindCodanna
Text matchingSemantic understanding
String "parse" matches comments
find_symbol
finds the actual function
Manual call tracing
find_callers
shows full graph
Guessing impact
analyze_impact
shows dependencies
Grep/FindCodanna
文本匹配语义理解
字符串"parse"会匹配到注释内容
find_symbol
会定位到实际的函数
手动追溯调用关系
find_callers
可展示完整调用图
人工猜测影响范围
analyze_impact
可展示所有依赖

Tips

使用提示

  • Start broad with
    semantic_search_docs
    , then drill down with
    find_symbol
  • Use
    analyze_impact
    before any refactor touching shared code
  • find_callers
    with depth > 1 shows transitive callers
  • Results include file paths and line numbers - use for navigation
  • 先用
    semantic_search_docs
    进行宽泛搜索,再用
    find_symbol
    向下钻取细节
  • 修改公共代码前务必先使用
    analyze_impact
    评估影响
  • find_callers
    设置大于1的depth参数可展示间接调用方
  • 结果包含文件路径和行号,可用于快速导航