SuperAPI AI 工具集

codegraph-skill

编程与开发

查看项目

更新于 10-16 11:30

技能介绍

Codegraph Skill

Codegraph 为当前项目提供预索引的 AST 代码图。该技能仅使用 CLI,不要运行 codegraph install,因为该命令会单独配置 MCP 与智能体规则。

前置条件

运行以下命令,且必须成功:

bunx codegraph status

如果尚未初始化:

bun add -d @colbymchenry/codegraph bunx codegraph init -i

索引位于 .codegraph/ 目录,编辑后可通过 bunx codegraph sync 重新生成。

CLI 命令

始终通过 bunx codegraph … 运行,或直接使用 PATH 中的 codegraph:

  • 按名称查找符号:bunx codegraph query <name>
  • 谁调用了 X:bunx codegraph callers <symbol>
  • X 调用了什么:bunx codegraph callees <symbol>
  • 变更影响范围:bunx codegraph impact <symbol>
  • 文件变更影响的测试:bunx codegraph affected <files…>
  • 项目文件树:bunx codegraph files
  • 索引健康状态:bunx codegraph status
  • 编辑后刷新:bunx codegraph sync

推荐工作流

  1. 阅读 .mind-mesh/agent/context.md(mind-mesh-knowledge-skill)
  2. 使用 bunx codegraph query <SymbolName> 定位定义
  3. 对关系类问题使用 callers、callees、impact
  4. 需要某个文件的完整源码文本时使用 repomix-context-skill
  5. 后续的 shell 命令(测试、git)使用 rtk-skill

何时使用本技能与其他技能的对比

使用 Codegraph 的场景:符号查找、调用链分析、重构前影响评估、文件与符号图。 改用其他方式:架构问题查看 context.md;业务规则查看 knowledge/;需要原始源码片段使用 repomix;需要详细的测试或 git 输出使用 rtk cargo test、rtk git diff。

禁止事项

  • 不要运行 codegraph install,MindMesh 会管理 AGENTS.md
  • 不要盲目对整个仓库执行 grep 来重新验证 Codegraph 的 AST 结果
  • 当 impact 已能回答问题时,不要串联 query 与手动读取文件

索引过期

如果编辑后 codegraph status 显示存在待处理文件,运行:

bunx codegraph sync