🚧 正在开发中
该项目正处于积极开发阶段。功能和文档正在持续更新。
MCP 代码库洞察是一个通过语义分析、模式检测和文档管理来分析和理解代码库的系统。
安装
pip install mcp-codebase-insight
基本用法
from mcp_codebase_insight import CodebaseAnalyzer
analyzer = CodebaseAnalyzer()
results = analyzer.analyze_code("path/to/code")
运行测试
# 运行所有测试
pytest tests/
# 运行单元测试
pytest tests/unit/
# 运行组件测试
pytest tests/components/
# 运行带有覆盖率的测试
pytest tests/ --cov=src --cov-report=term-missing
调试工具
from mcp_codebase_insight.utils.debug_utils import debug_trace, DebugContext, get_error_tracker
# 使用调试追踪装饰器
@debug_trace
def my_function():
# 实现
# 使用调试上下文
with DebugContext("操作名称"):
# 要调试的代码
# 跟踪错误
try:
# 风险操作
except Exception as e:
error_id = get_error_tracker().record_error(e, context={"操作": "描述"})
print(f"已记录错误,ID:{error_id}")
本项目遵循测试驱动开发(TDD)原则:
我们的 TDD 文档可以在 docs/tdd/workflow.md 中找到。
我们使用 Agans 的 9 条调试规则:
更多关于我们的调试方法,请参阅 docs/debuggers/agans_9_rules.md。
我们欢迎贡献!详情请参阅我们的 贡献指南。
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。