Git Forensics — Git 历史深度分析

SkillFiles & storage

Performs deep analysis of Git repository history, identifies frequently changed hot-spot files, analyzes actual code contribution attribution, and scans historical commits for security issues such as leaked secrets. Triggers when the user mentions analyzing a repository, viewing code attribution, fi

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Git Forensics — Git 历史深度分析 skill

What this skill tells your AI

The instructions your AI receives, as published by rongxinzy/rongxinai in SKILLs/git-repo-audit/SKILL.md and read by ahel’s review.

对 Git 仓库进行三维深度分析:热点文件识别代码归属分析密钥泄露扫描

功能概览

1. 热点文件分析 (scripts/hotfiles.sh)

找出仓库中变更最频繁的文件,帮助识别:

  • 高风险代码区域(频繁修改 = 潜在不稳定)
  • 需要重点 code review 的文件
  • 可能需要拆分或重构的模块

用法:

bash scripts/hotfiles.sh [选项]
选项说明默认值
--repo PATH仓库路径当前目录
--top N显示前 N 个文件20
--since DATE起始日期(如 2024-01-01不限
--until DATE截止日期不限
--author AUTHOR按作者过滤不限
--format FORMAT输出格式:table / csv / jsontable

2. 代码归属分析 (scripts/ownership.sh)

分析代码的实际归属关系,输出每位贡献者在指定范围内的:

  • 提交次数与占比
  • 修改行数(增/删)
  • 最近活跃时间

用法:

bash scripts/ownership.sh [选项]
选项说明默认值
--repo PATH仓库路径当前目录
--path SUBPATH分析指定子目录或文件整个仓库
--top N显示前 N 位贡献者10
--since DATE起始日期不限
--format FORMAT输出格式:table / csv / jsontable

3. 密钥泄露扫描 (scripts/secret-scan.sh)

扫描 Git 全量历史(包括已删除的 commit),检测常见的密钥和敏感信息泄露:

  • AWS Access Key / Secret Key
  • GitHub / GitLab / Slack Token
  • SSH 私钥
  • 通用 API Key、密码、Secret 模式

用法:

bash scripts/secret-scan.sh [选项]
选项说明默认值
--repo PATH仓库路径当前目录
--branch BRANCH扫描指定分支所有分支
--since DATE起始日期不限
--format FORMAT输出格式:table / csv / jsontable
--severity LEVEL最低严重级别:low / medium / highlow

使用场景

  • 安全审计:在代码上线前扫描历史中是否有密钥泄露
  • Code Review 优化:识别热点文件,优先 review 高风险区域
  • 团队协作:了解谁最熟悉哪部分代码,合理分配 review 任务
  • 技术债务评估:高频变更文件可能是重构候选

依赖

  • git(>= 2.20)
  • bash(>= 4.0)
  • 标准 Unix 工具:awksortheadgrep

无需安装任何额外依赖或付费 API。

Signals

GitHub stars
152
Forks
3
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
git-repo-audit
Source
github.com/rongxinzy/rongxinai