lucky8197/dsh-git-hygiene ↗★ 1
dsh-git-hygiene
Git 卫生巡检(Git Hygiene Checker):只读扫描仓库的已合并分支、过期分支、大文件、未跟踪文件与仓库体积,输出体检报告与清理建议。不自动删除任何东西。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:lucky8197/dsh-git-hygiene说明文档
阅读完整 README ↗dsh-git-hygiene(Git 卫生巡检)
Git Hygiene Checker for DeepSeek Harness. A read-only DSH plugin that inspects a repository's hygiene: merged-but-not-deleted branches, stale branches with no commits for months, oversized tracked files, untracked files, and uncommitted work — then outputs a health report with cleanup suggestions. It never deletes or modifies anything automatically. Install with:
dsh plugin --profile web add "github:lucky8197/dsh-git-hygiene#main".
仓库用久了会"长胖":功能分支合并后没人删、几个月不动的老分支堆积、不小心提交了
几十 MB 的二进制、未跟踪文件散落一地。dsh-git-hygiene 用只读 git 命令给仓库
做一次"体检",把这些问题量化成带清理建议的报告。
特性
| 维度 | 说明 | 发现类型 | 严重度 |
|---|---|---|---|
| 已合并分支 | 已合并到当前分支但未删除的分支(git branch --merged) | merged_branch | medium |
| 过期分支 | 超过 N 天(默认 90)无提交的分支(for-each-ref committerdate) | stale_branch | low |
| 大文件 | 跟踪文件超过阈值(默认 5 MB),提示用 LFS/filter-repo 处理 | large_file | low |
| 未跟踪文件 | git status --porcelain 的 ?? 条目 | untracked | low |
| 未提交修改 | 工作区 dirty 状态(M/A/D 等) | dirty_worktree | low |
快速安装
dsh plugin --profile web add "github:lucky8197/dsh-git-hygiene#main"
工具用法
git_hygiene
参数:
cwd?: string 仓库目录(默认当前会话工作目录)
staleDays?: number 过期分支阈值(天,默认 90)
maxFileBytes?: number 大文件阈值(字节,默认 5MB)
输出:canonical JSON 报告(渲染为分节文本)
canonical JSON
{
"tool": "git_hygiene",
"version": 1,
"cwd": "/path/to/repo",
"repo": { "isRepo": true, "root": "/path/to/repo", "branch": "main",
"head": "abc1234…", "remotes": ["origin"], "sizeBytes": 4211000, "objectCount": 1200 },
"findings": [
{ "severity": "medium", "kind": "merged_branch",
"detail": "2 个分支已合并到当前分支,可以安全删除:feature-a、feature-b",
"evidence": "feature-a, feature-b",
"fix": "对每个已合并分支执行 `git branch -d
`(-d 安全删除,未合并会拒绝)" }
],
"stats": { "findingCount": 1, "byKind": { "merged_branch": 1 } },
"suggestions": [ { "severity": "medium", "text": "…" } ]
}