使用说明
MCP代码库洞察-WIP
🚧 开发中
该项目正在积极开发中。功能和文档正在不断更新。
概述
MCP Codebase Insight是一个通过语义分析、模式检测和文档管理来分析和理解代码库的系统。
发展现状
已完成的功能
- ✅ 核心矢量存储系统
- ✅ 基础知识库
- ✅ SSE集成
- ✅ 测试框架
- ✅ TDD和调试框架(rules_template集成)
进行中
- 🔄 文件管理系统
- 🔄 高级模式检测
- 🔄 性能优化
- 🔄 集成测试
- 🔄 调试实用程序增强
计划的
- 📋 API扩展文档
- 📋 自定义模式插件
- 📋 高级缓存策略
- 📋 部署指南
- 📋 综合误差跟踪系统
快速开始
-
安装
pip install mcp-codebase-insight -
基本用法
from mcp_codebase_insight import CodebaseAnalyzer analyzer = CodebaseAnalyzer() results = analyzer.analyze_code("path/to/code") -
运行测试
# Run all tests pytest tests/ # Run unit tests pytest tests/unit/ # Run component tests pytest tests/components/ # Run tests with coverage pytest tests/ --cov=src --cov-report=term-missing -
调试实用程序
from mcp_codebase_insight.utils.debug_utils import debug_trace, DebugContext, get_error_tracker # Use debug trace decorator @debug_trace def my_function(): # Implementation # Use debug context with DebugContext("operation_name"): # Code to debug # Track errors try: # Risky operation except Exception as e: error_id = get_error_tracker().record_error(e, context={"operation": "description"}) print(f"Error recorded with ID: {error_id}")
测试和调试
测试驱动开发
本项目遵循测试驱动开发(TDD)原则:
- 先写一个失败的测试(红色)
- 编写最少的代码以使测试通过(绿色)
- 在保持测试通过的同时重构干净的代码(重构)
我们的TDD文档可以在 docs/tdd/workflow.md.
调试框架
我们使用Agans的9条调试规则:
- 了解系统
- 让它失败
- 停止思考,看看
- 分而治之
- 一次改变一件事
- 保持审计跟踪
- 检查插头
- 获得新鲜视角
- 如果你没有修复它,它就没有修复
在中了解有关我们调试方法的更多信息 docs/debuggers/agans_9_rules.md.
文档
贡献
我们欢迎捐款!请查看我们的 贡献指南 了解详情。
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。