librarian
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUse this skill when the user points you to a remote git repository (GitHub/GitLab/Bitbucket URLs, , or shorthand).
git@...owner/repoThe goal is to keep a reusable local checkout that is:
- stable (predictable path)
- up to date (periodic fetch + fast-forward when safe)
- efficient (partial clone with , no repeated full clones)
--filter=blob:none
当用户向你提供远程git仓库(GitHub/GitLab/Bitbucket链接、格式地址或简写形式)时,使用此技能。
git@...owner/repo目标是维护一个可复用的本地检出副本,需满足:
- 稳定(路径可预测)
- 最新(定期拉取,在安全情况下进行快进合并)
- 高效(使用进行部分克隆,避免重复完整克隆)
--filter=blob:none
Cache location
缓存位置
Repositories are stored at:
~/.cache/checkouts/<host>/<org>/<repo>Example:
github.com/mitsuhiko/minijinja~/.cache/checkouts/github.com/mitsuhiko/minijinja仓库存储在以下路径:
~/.cache/checkouts/<host>/<org>/<repo>示例:
github.com/mitsuhiko/minijinja~/.cache/checkouts/github.com/mitsuhiko/minijinjaCommand
命令
bash
bash checkout.sh <repo> --path-onlyExamples:
bash
bash checkout.sh mitsuhiko/minijinja --path-only
bash checkout.sh github.com/mitsuhiko/minijinja --path-only
bash checkout.sh https://github.com/mitsuhiko/minijinja --path-onlyThe script will:
- Parse the repo reference into host/org/repo.
- Clone if missing.
- Reuse existing checkout if present.
- Fetch from when stale (default interval: 300s).
origin - Attempt a fast-forward merge if the checkout is clean and has an upstream.
bash
bash checkout.sh <repo> --path-only示例:
bash
bash checkout.sh mitsuhiko/minijinja --path-only
bash checkout.sh github.com/mitsuhiko/minijinja --path-only
bash checkout.sh https://github.com/mitsuhiko/minijinja --path-only脚本会执行以下操作:
- 将仓库引用解析为host/org/repo格式。
- 若仓库不存在则克隆。
- 若已有检出副本则复用。
- 当副本过期时(默认间隔:300秒),从拉取更新。
origin - 若检出副本干净且有上游分支,则尝试快进合并。
Update strategy
更新策略
- Default behavior is throttled refresh (every 5 minutes) to avoid unnecessary network calls.
- Force immediate refresh with:
bash
bash checkout.sh <repo> --force-update --path-only- 默认行为是限流刷新(每5分钟一次),避免不必要的网络请求。
- 使用以下命令强制立即刷新:
bash
bash checkout.sh <repo> --force-update --path-onlyRecommended workflow
推荐工作流程
- Resolve repository path via .
checkout.sh --path-only - Use that path for searching, reading, and analysis.
- On later references to the same repo, call again; it will find and update the cached checkout.
checkout.sh
- 通过解析仓库路径。
checkout.sh --path-only - 使用该路径进行搜索、读取和分析操作。
- 后续再次引用同一仓库时,再次调用;脚本会找到并更新缓存的检出副本。
checkout.sh
If edits are needed
若需要编辑内容
Prefer not to edit directly in the shared cache. Create a separate worktree or copy from the cached checkout for task-specific modifications.
建议不要直接在共享缓存中编辑。创建单独的工作树,或从缓存的检出副本中复制内容进行任务专属修改。
Notes
注意事项
- defaults to
owner/repo.github.com
- 格式默认对应
owner/repo。github.com