Expand description
Worktree cleanup for finished runs: blyte clean, on review, and at dispatch.
Structs§
- Clean
Context - Context for cleaning a repository, caching metadata to avoid redundant git calls and disk reads.
- Clean
Repo Stats - GitWorktree
Info
Enums§
Functions§
- check_
removable - Evaluates whether a worktree is removable according to the clean rules.
- clean_
on_ review - Removes a run’s worktree on review after recording the verdict under the same rules.
Removes the worktree only when the rules allow it now (e.g. redone, or work already merged);
otherwise prints nothing extra beyond the verdict line, except for accepted/fixed prints
worktree .wt/<id> kept until wip/<id> is merged. - clean_
quiet - Quiet cleanup at dispatch start: no output unless something was removed,
then one line
blyte: removed N finished worktrees (X GB)on stderr. Never fails the dispatch: logs errors to stderr and goes on. - clean_
repo - Cleans one repository.
- dir_
size - Recursively computes directory size in bytes without following symlinks.
- display_
worktree_ path - Formats a worktree path for display and for git CLI commands:
relative to
rootif insiderootor a sibling (same parent directory); otherwise absolute. - find_
blyte_ worktrees - Lists all
.wt/<id>directories that have a corresponding.wt/<id>.start.json. - find_
default_ branch - Identifies the default branch (origin/HEAD’s target, else main, else master).
- find_
merged_ followup - Finds a follow-up run that makes
<id>merged. - find_
repo_ root - Finds the root repository (resolving the owning repository if inside a
.wtrun). - format_
size - Formats byte count into human-readable representation: e.g. “812 MB”, “12.3 GB”.
- get_
branch_ tip - Returns the commit SHA at the tip of
branch_nameif it exists. - has_
uncommitted_ changes - Checks whether a worktree has uncommitted changes via
git status --porcelain. - has_
wt_ component - Returns true if any path component is
.wt. - is_
branch_ merged - Checks whether a branch’s work is on the default branch when any of:
- is_
branch_ merged_ with_ extra_ targets - Checks whether a branch’s work is on the default branch or any of the extra target refs.
- is_
branch_ merged_ with_ targets - Checks whether a branch’s work is on the default branch or any of the extra target refs.
- is_
commit_ merged - Checks whether a commit’s work is on the default branch when any of:
- is_
commit_ merged_ with_ targets - Checks whether a commit’s work is on the default branch or any of the extra target refs.
- is_
linked_ worktree - Returns true if
rootis a linked worktree (its git-dir differs from its git-common-dir). - is_
pid_ alive - Checks whether a process with the given PID is alive.
- is_
research - Checks whether a run is a research run from its start file.
- is_
worktree_ clean - Checks whether a worktree’s working tree is clean:
git status --porcelainlists nothing other than.DS_Storefiles, at any depth. - list_
all_ run_ ids - Lists all run IDs that have a corresponding
.wt/<id>.start.json. - parse_
worktree_ list - Parses git worktrees from
git worktree list --porcelain. - read_
run_ base - Reads
basefrom.wt/<id>.start.jsonif present. - report_
other_ worktrees - Inspects other worktrees (excluding main checkout, linked-worktree roots,
and blyte’s
.wt/<id>runs), and reports any that are both merged and clean. Never deletes them. - resolve_
base_ targets - Resolves candidate git refs for a run’s base branch.
Returns (display_name, targets) if
baseis a branch name that resolves. Returns None ifbaseis not a branch name (e.g. HEAD, commit id, wip/ branch) or if none of the candidate refs resolve in git. - run
- Runs the
blyte cleancommand.