Problem
lib/bash/gh/lib_gh.sh is documented as a GitHub CLI library, but several public helpers are generic local Git operations and never invoke gh:
gh_detect_default_branch
gh_worktree_path_for_branch
gh_list_worktree_branches
gh_branch_upstream
gh_branch_merged_to_ref
gh_list_remote_branches
Default-branch detection also duplicates _git_expected_update_branch in lib_git.sh. This blurs library ownership and makes Git-only callers import a GitHub-specific module.
Scope
- Move generic branch, remote, and worktree primitives into
lib_git.sh with git_* names.
- Consolidate default-branch detection behind one implementation.
- Make producer-command failures distinguishable from an empty/not-found result; current process-substitution loops can hide
git worktree list failure.
- Coordinate Base call-site/import updates before removing old names.
- Keep
lib_gh.sh focused on GitHub remote parsing and gh CLI/API behavior.
Acceptance Criteria
- Git-only helpers live and are documented in the Git library.
- Base uses the new Git API without importing
lib_gh.sh solely for local Git operations.
- Worktree/remote command failures return a real failure instead of empty success.
- No duplicate default-branch algorithm remains.
Validation
- Focused git/gh BATS coverage
- Relevant Base Bash tests for coordinated adoption
./tests/validate.sh
git diff --check
Problem
lib/bash/gh/lib_gh.shis documented as a GitHub CLI library, but several public helpers are generic local Git operations and never invokegh:gh_detect_default_branchgh_worktree_path_for_branchgh_list_worktree_branchesgh_branch_upstreamgh_branch_merged_to_refgh_list_remote_branchesDefault-branch detection also duplicates
_git_expected_update_branchinlib_git.sh. This blurs library ownership and makes Git-only callers import a GitHub-specific module.Scope
lib_git.shwithgit_*names.git worktree listfailure.lib_gh.shfocused on GitHub remote parsing andghCLI/API behavior.Acceptance Criteria
lib_gh.shsolely for local Git operations.Validation
./tests/validate.shgit diff --check