Skip to main content

Module scanner

Module scanner 

Source
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§

OpenLoop
An open loop: an unmerged branch with its own commits.
RepoCandidate
A git repository discovered under a configured root (deduped by common-dir).
ScanOptions
Options controlling a scan (light phase always; heavy phase optional + memoised).
WorktreeEntry
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_depth looking for git repo candidates, then deduplicates by absolute --git-common-dir.
git_common_dir
Absolute path of the git common-dir for path (bare store / .git dir).
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.
parse_worktree_porcelain
Parses git worktree list --porcelain into entries.
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-dir fails. Primary naming comes from common-dir during dedup; this is the error fallback only.
scan
Scans all repos found under the roots in parallel.
worktree_map
Maps each checked-out branch to the absolute path of its worktree.