自动更新维护 GitHub 本地库和 Skills 本地库的工具
- 📂 自动扫描 - 发现目录中的 Git 仓库
- 🔍 状态分析 - 查看仓库与上游的同步状态
- 🔄 安全更新 - 支持多种更新策略(safe/stash/force)
- 📊 美观报告 - 使用 Rich 输出漂亮的终端表格
- ⚙️ 灵活配置 - YAML 配置文件,易于定制
- 🌐 跨平台 - 支持 Windows、macOS、Linux
git clone https://github.com/super-818/repo_keeper.git
cd repo_keeper
pip install --no-build-isolation -e .# 更新 D:\github 下的所有仓库(默认 safe 策略)
repokeeper D:\github
# 强制更新(覆盖本地修改)
repokeeper D:\github --force
# 使用 stash 策略(先暂存本地修改,更新后恢复)
repokeeper D:\github --stash
# 指定策略
repokeeper D:\github --strategy force
# 预览更新(不实际执行)
repokeeper D:\github --dry-run# 初始化配置
repokeeper init
# 扫描仓库
repokeeper scan
# 查看状态
repokeeper status
# 执行更新
repokeeper update
# 强制更新
repokeeper update --force
# 使用 stash 策略
repokeeper update --strategy stash| 命令 | 说明 |
|---|---|
repokeeper <path> |
直接更新指定目录(最简单) |
repokeeper init |
首次配置引导 |
repokeeper scan |
扫描发现仓库 |
repokeeper status |
查看仓库状态 |
repokeeper update |
执行更新 |
repokeeper add <path> |
添加监控目录 |
repokeeper remove <path> |
移除监控目录 |
repokeeper config show |
显示配置 |
repokeeper config edit |
编辑配置 |
repokeeper history |
查看更新历史 |
repokeeper doctor |
诊断和修复 |
- safe (默认) - 有本地修改时跳过更新,安全第一
- stash - 先 stash 本地修改,更新后恢复
- force - 强制覆盖本地修改,以远端最新版为准(慎用)
# 直接更新时使用 force 策略
repokeeper D:\github --force
# 或使用完整命令
repokeeper update --strategy force- 检测到本地修改 - 使用
--force或--stash参数 - 路径问题 - Windows 上文件名包含特殊字符导致 Git 报错
- 引用锁定 - 其他 Git 进程正在运行,稍等重试
- 网络问题 - 无法连接远程仓库,检查网络
配置文件位于 ~/.repo-keeper/config.yaml (Windows: %USERPROFILE%\.repo-keeper\config.yaml)
示例配置:
global:
log_level: info
language: zh-CN
watched_dirs:
- path: D:\github
type: git-collection
scan_depth: 1
auto_update: true
- path: D:\skills
type: skills-collection
scan_depth: 2
auto_update: true
update:
default_strategy: safe
dry_run: falserepo-keeper/
├── src/
│ └── repo_keeper/
│ ├── __init__.py
│ ├── __main__.py
│ ├── cli/ # CLI 命令
│ ├── core/ # 核心引擎
│ ├── db/ # 数据库
│ ├── notifier/ # 通知
│ ├── scheduler/ # 定时任务
│ ├── tools/ # AI 工具集成
│ └── utils/ # 工具函数
├── skills/ # AI Agent Skills
├── pyproject.toml
├── QUICKSTART.md
└── README.md
GitHub: https://github.com/super-818/repo_keeper
PyPI: https://pypi.org/project/repokeeper/
MIT 协议,欢迎 Star ⭐ 和贡献代码!