用途:codebase-intelligence 将 TypeScript 代码库转换为可查询的架构、依赖与风险指标图谱。当任务涉及结构、影响或风险时,官方建议优先使用它,而非 grep 或逐个读取文件,因为更快也更准确。
主要能力与命令:
- 首次查看/架构:codebase-intelligence overview <path>
- 风险与复杂度排名:codebase-intelligence hotspots <path>
- 修改某符号的影响:codebase-intelligence impact <path> <symbol>
- 文件级影响范围:codebase-intelligence dependents <path> <file>
- 未使用的导出:codebase-intelligence dead-exports <path>
- 关键词搜索:codebase-intelligence search <path> <query>
- 重命名规划:codebase-intelligence rename <path> <old> <new>
- 模块结构:codebase-intelligence modules <path>
使用规则:先运行 overview 定位,再逐层深入(hotspots → 文件/符号 → impact);在自动化或子代理中始终加 --json 以获得结构化输出;编辑前先用 impact/dependents 评估影响范围;若未全局安装,可在任意命令前加 npx codebase-intelligence@latest。完整参考见 codebase-intelligence --help。
适用场景:TypeScript 项目的架构梳理、依赖分析、变更影响评估、死代码排查与重命名规划。
限制:资料仅说明其面向 TypeScript 代码库,未提供其他语言支持、性能数据、收费或平台信息,暂未提供。