Goal
Move the shell-neutral Git/HEAD lookup into the existing common defaults boundary and keep shell-specific prompt expansion, escapes, options and key bindings in the Bash/Zsh files.
Background
Repository-wide duplication review against f9c18f3294873cbbcda9acc7af7f1bc6b17eed45 (2026-09-17).
The Bash and Zsh defaults duplicate the Git-directory ancestor walk, gitdir-file handling and HEAD-to-branch formatting. The directory functions are identical after the function name, and the prompt functions differ almost only in their helper prefix. Both already load the shell-neutral base_defaults.sh boundary.
Verified source locations:
No matching open issue was found in the repository backlog.
This is a maintainability refactor. Similarity alone is not evidence of a production failure; any demonstrated differences are called out above.
Scope
Move the shell-neutral Git/HEAD lookup into the existing common defaults boundary and keep shell-specific prompt expansion, escapes, options and key bindings in the Bash/Zsh files.
Acceptance Criteria
- A single implementation handles ordinary repos, worktrees/submodules with gitdir files, detached HEAD and nonrepos.
- Preserve output and avoid adding Git subprocesses to prompt rendering.
- Preserve interactive-only loading and source guards.
- Prove the helper works in both Bash and Zsh, including spaces in checkout paths.
Validation
Run shell-defaults/profile BATS coverage under Bash and Zsh; compare branch labels for normal, linked worktree, detached and malformed/unreadable Git metadata fixtures.
Run focused checks first, then the repository-required broader checks for the actual implementation. Preserve public command contracts and review .ai-context/ impact in the PR.
Non-Goals
No unification of PS1/PROMPT syntax, history settings, key bindings or baserc guard implementations.
Project Fields
- Status: Ready
- Priority: P3
- Area: Shell
- Initiative: Contract Hardening
- Size: S
- Milestone: Unscheduled; no release commitment is implied by this audit.
Agent Assignment
Implementation-ready scoped follow-up, assigned to codeforester. Follow AGENTS.md and docs/github-workflow.md: start through basectl gh issue start, use the canonical issue worktree, characterize current behavior before extraction, and open an issue-linked PR. Keep each refactor independently reviewable.
Goal
Move the shell-neutral Git/HEAD lookup into the existing common defaults boundary and keep shell-specific prompt expansion, escapes, options and key bindings in the Bash/Zsh files.
Background
Repository-wide duplication review against
f9c18f3294873cbbcda9acc7af7f1bc6b17eed45(2026-09-17).The Bash and Zsh defaults duplicate the Git-directory ancestor walk, gitdir-file handling and HEAD-to-branch formatting. The directory functions are identical after the function name, and the prompt functions differ almost only in their helper prefix. Both already load the shell-neutral
base_defaults.shboundary.Verified source locations:
lib/shell/bash_defaults.sh:50-97lib/shell/zsh_defaults.sh:52-99lib/shell/base_defaults.sh:1-43No matching open issue was found in the repository backlog.
This is a maintainability refactor. Similarity alone is not evidence of a production failure; any demonstrated differences are called out above.
Scope
Move the shell-neutral Git/HEAD lookup into the existing common defaults boundary and keep shell-specific prompt expansion, escapes, options and key bindings in the Bash/Zsh files.
Acceptance Criteria
Validation
Run shell-defaults/profile BATS coverage under Bash and Zsh; compare branch labels for normal, linked worktree, detached and malformed/unreadable Git metadata fixtures.
Run focused checks first, then the repository-required broader checks for the actual implementation. Preserve public command contracts and review
.ai-context/impact in the PR.Non-Goals
No unification of PS1/PROMPT syntax, history settings, key bindings or baserc guard implementations.
Project Fields
Agent Assignment
Implementation-ready scoped follow-up, assigned to
codeforester. FollowAGENTS.mdanddocs/github-workflow.md: start throughbasectl gh issue start, use the canonical issue worktree, characterize current behavior before extraction, and open an issue-linked PR. Keep each refactor independently reviewable.