Git 文件取证 MCP 工具是一款专注于单个文件分析的取证工具,可深入分析 git 文件层级。它能帮助用户获取文件历史、变更和模式的详细洞察,而非针对整个仓库进行分析。
本工具可帮助您深入分析 git 文件层级,获取文件历史、变更和模式的详细信息。下面为您介绍使用前的安装步骤。
git clone [repository-url]
cd git-file-forensics
npm install
npm run build
将以下配置添加到 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": []
}
}
}
本工具提供了一系列实用的功能,可帮助您对文件进行深入分析,以下是各工具的详细介绍:
此工具可跟踪特定文件的完整版本历史,包括文件的重命名和移动操作。
{
"method": "tools/call",
"params": {
"name": "track_file_versions",
"arguments": {
"repoPath": "/path/to/repo", // 仓库路径
"file": "path/to/file", // 文件路径
"outputPath": "output.json" // 输出文件路径
}
}
}
该工具用于分析两个版本之间的具体变更情况。
{
"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"
}
}
}
此工具可分析特定提交中的文件变更上下文。
{
"method": "tools/call",
"params": {
"name": "analyze_file_context",
"arguments": {
"repoPath": "/path/to/repo",
"file": "path/to/file",
"commit": "commit-hash", // 提交哈希值
"outputPath": "output.json"
}
}
}
该工具用于分析文件历史中的语义变更和模式。
{
"method": "tools/call",
"params": {
"name": "analyze_file_semantics",
"arguments": {
"repoPath": "/path/to/repo",
"file": "path/to/file",
"outputPath": "output.json"
}
}
}
所有工具的输出均为 JSON 文件,其中包含以下内容:
该工具采用 Apache License 2.0 协议,源代码和详细信息可通过以下链接获取:
[版权声明信息]
此工具旨在为开发者提供强大的文件历史分析能力,帮助识别和理解代码变更模式。