Expand description
Repository and unmerged-branch discovery via git shell-out. Design decision: shell-out (not git2/gix) — simple and debuggable; the product performance bottleneck is the LLM, not git.
Structs§
- Open
Loop - An open loop: an unmerged branch with its own commits.
- Repo
Candidate - A git repository discovered under a configured root (deduped by common-dir).
- Scan
Options - Options controlling a scan (light phase always; heavy phase optional + memoised).
- Worktree
Entry - One entry from
git worktree list --porcelain.
Functions§
- commit_
window - Time window of the branch-exclusive commits.
- default_
branch - Default branch: origin/HEAD’s target if it resolves locally; otherwise main; otherwise master.
- diffstat
- Diffstat of the branch against the base (for the distillation prompt).
- find_
repos - Walks roots up to
scan_depthlooking for git repo candidates, then deduplicates by absolute--git-common-dir. - find_
repos_ cached - Like
find_reposbut optionally consultsindexto skipgit rev-parsefor already-known paths (resolves #17). - git_
common_ dir - Absolute path of the git common-dir for
path(bare store /.gitdir). - git_log
- Branch-exclusive commits relative to the default (for the distillation prompt).
- open_
loops - Returns all unmerged branches (except default) in a repo, optionally reading and updating the inventory memo for ahead/behind.
- open_
loops_ indexed - Like
open_loopsbut optionally consults a SQLiteindexfor the refs-fingerprint gate (#13). - parse_
worktree_ porcelain - Parses
git worktree list --porcelaininto entries. - refs_
fingerprint - Cheap fingerprint of a repo’s refs: the MAX mtime (unix nanoseconds since the
epoch) of
<common_dir>/HEAD,<common_dir>/packed-refs(when present), the newest entry anywhere under the<common_dir>/refstree, and the newest entry anywhere under the<common_dir>/worktrees/tree. Missing files or directories contribute 0. - repo_
name_ from_ common_ dir - Derives a stable repo name from the absolute git common-dir (§5 of Spec Fase A).
- repo_
name_ hint - Path-based repo name guess when
git rev-parse --git-common-dirfails. Primary naming comes from common-dir during dedup; this is the error fallback only. - scan
- Scans all repos found under the roots in parallel.
- scan_
indexed - Like
scanbut optionally consults a SQLiteindexfor the refs-fingerprint gate (#13) and to cache--git-common-dirduring repo discovery. - worktree_
map - Maps each checked-out branch to the absolute path of its worktree.