codemapper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodemapper
Codemapper
Code analysis tool () for exploring structure, symbols, dependencies, and call graphs.
cmAll commands support for concise, AI-friendly output.
--format ai一款用于探索代码结构、符号、依赖关系和调用图的代码分析工具()。
cm所有命令均支持参数,可生成简洁、适配AI的输出内容。
--format aiCode Statistics
代码统计
bash
cm stats . --format ai # Current directory
cm stats ./src --format ai # Specific directorybash
cm stats . --format ai # 当前目录
cm stats ./src --format ai # 指定目录Code Map
代码映射
bash
cm map . --level 2 --format ai # Basic overview
cm map . --level 3 --format ai # Detailed structure
cm map . --level 2 --exports-only --format ai # Public API only
cm map ./src --level 2 --format ai # Specific directoryDetail levels:
- Level 1: Files and directories only
- Level 2: Files with exported symbols
- Level 3: Files with all symbols and details
bash
cm map . --level 2 --format ai # 基础概览
cm map . --level 3 --format ai # 详细结构
cm map . --level 2 --exports-only --format ai # 仅显示公开API
cm map ./src --level 2 --format ai # 指定目录详情层级说明:
- Level 1:仅显示文件和目录
- Level 2:显示包含导出符号的文件
- Level 3:显示包含所有符号及详细信息的文件
Query Symbols
查询符号
bash
cm query authenticate . --format ai # Fuzzy search
cm query User . --exact --format ai # Exact match
cm query validate . --show-body --format ai # Show implementation
cm query process . --exports-only --format ai # Public onlybash
cm query authenticate . --format ai # 模糊搜索
cm query User . --exact --format ai # 精确匹配
cm query validate . --show-body --format ai # 查看实现代码
cm query process . --exports-only --format ai # 仅显示公开符号Call Graph Analysis
调用图分析
bash
undefinedbash
undefinedFind callers of a function
查找函数的调用方
cm callers processData . --format ai
cm callers UserService.get . --format ai
cm callers processData . --format ai
cm callers UserService.get . --format ai
Find callees (what a function calls)
查找被调用方(函数调用的对象)
cm callees processData . --format ai
cm callees UserService . --format ai
cm callees processData . --format ai
cm callees UserService . --format ai
Trace call path
追踪调用路径
cm call-path functionToFind . --format ai
cm call-path functionToFind --reverse --format ai
undefinedcm call-path functionToFind . --format ai
cm call-path functionToFind --reverse --format ai
undefinedDependency Analysis
依赖关系分析
bash
cm deps . --format ai # List all dependencies
cm deps . --circular --format ai # Detect circular deps
cm deps . --unused --format ai # Find unused deps
cm deps . --unused-symbols --format ai # Find unused symbolsbash
cm deps . --format ai # 列出所有依赖
cm deps . --circular --format ai # 检测循环依赖
cm deps . --unused --format ai # 查找未使用的依赖
cm deps . --unused-symbols --format ai # 查找未使用的符号Finding Tests
查找测试代码
bash
cm tests functionName . --format ai # Find tests for function
cm untested . --format ai # Find untested codebash
cm tests functionName . --format ai # 查找函数对应的测试代码
cm untested . --format ai # 查找未覆盖测试的代码Common Workflows
常见工作流
Code Exploration
代码探索
bash
cm map . --level 2 --format ai # Get overview
cm query User . --format ai # Find symbols
cm deps . --format ai # Understand depsbash
cm map . --level 2 --format ai # 获取概览
cm query User . --format ai # 查找符号
cm deps . --format ai # 理解依赖关系Refactoring Preparation
重构准备
bash
cm tests functionToRefactor . --format ai # Check test coverage
cm callers functionToRefactor . --format ai # Find callers to update
cm callees functionToRefactor . --format ai # Find callees
cm deps . --circular --format ai # Check for cyclesbash
cm tests functionToRefactor . --format ai # 检查测试覆盖率
cm callers functionToRefactor . --format ai # 查找需要更新的调用方
cm callees functionToRefactor . --format ai # 查找被调用方
cm deps . --circular --format ai # 检查循环依赖Tips
小贴士
- Use for concise output
--format ai - Use for overview,
--level 2for details--level 3 - Use to see public API
--exports-only - Use to see implementation details
--show-body - Use for precise matching
--exact
- 使用参数获取简洁输出
--format ai - 使用获取概览,
--level 2查看详细信息--level 3 - 使用查看公开API
--exports-only - 使用查看实现细节
--show-body - 使用进行精确匹配
--exact