Git File Forensics

Git File Forensics

🚀 Git 文件取证 MCP 工具

Git 文件取证 MCP 工具是一款专注于单个文件分析的取证工具,可深入分析 git 文件层级。它能帮助用户获取文件历史、变更和模式的详细洞察,而非针对整个仓库进行分析。

🚀 快速开始

本工具可帮助您深入分析 git 文件层级,获取文件历史、变更和模式的详细信息。下面为您介绍使用前的安装步骤。

📦 安装指南

克隆代码库并构建

git clone [repository-url]
cd git-file-forensics
npm install
npm run build

配置 MCP 设置

将以下配置添加到 MCP 设置(路径示例:~/Library/Application Support/Code/User/globalStorage/david-dafu-dev.dafu/settings/cline_mcp_settings.json):

{
"mcpServers": {
"git-file-forensics": {
"command": "/opt/homebrew/bin/node",
"args": ["/path/to/git-file-forensics/build/index.js"],
"alwaysAllow": []
}
}
}

✨ 主要特性

本工具提供了一系列实用的功能,可帮助您对文件进行深入分析,以下是各工具的详细介绍:

1. track_file_versions

此工具可跟踪特定文件的完整版本历史,包括文件的重命名和移动操作。

{
"method": "tools/call",
"params": {
"name": "track_file_versions",
"arguments": {
"repoPath": "/path/to/repo", // 仓库路径
"file": "path/to/file",     // 文件路径
"outputPath": "output.json"  // 输出文件路径
}
}
}

2. analyze_file_diff

该工具用于分析两个版本之间的具体变更情况。

{
"method": "tools/call",
"params": {
"name": "analyze_file_diff",
"arguments": {
"repoPath": "/path/to/repo",
"file": "path/to/file",
"versions": {              // 版本对比信息
"from": "commit-hash-1", // 起始提交哈希值
"to": "commit-hash-2"    // 结束提交哈希值
},
"outputPath": "output.json"
}
}
}

3. analyze_file_context

此工具可分析特定提交中的文件变更上下文。

{
"method": "tools/call",
"params": {
"name": "analyze_file_context",
"arguments": {
"repoPath": "/path/to/repo",
"file": "path/to/file",
"commit": "commit-hash",   // 提交哈希值
"outputPath": "output.json"
}
}
}

4. analyze_file_semantics

该工具用于分析文件历史中的语义变更和模式。

{
"method": "tools/call",
"params": {
"name": "analyze_file_semantics",
"arguments": {
"repoPath": "/path/to/repo",
"file": "path/to/file",
"outputPath": "output.json"
}
}
}

📚 详细文档

输出格式

所有工具的输出均为 JSON 文件,其中包含以下内容:

  • 详细分析结果
  • 统计摘要信息
  • 变更模式记录
  • 风险评估数据

系统要求

  • Node.js:用于运行工具
  • Git:版本控制工具
  • MCP SDK:必要的开发库

📄 许可证

该工具采用 Apache License 2.0 协议,源代码和详细信息可通过以下链接获取:

[版权声明信息]

此工具旨在为开发者提供强大的文件历史分析能力,帮助识别和理解代码变更模式。

  • 0 关注
  • 0 收藏,30 浏览
  • system 提出于 2025-09-27 13:30

相似服务问题

相关AI产品