feat(#2163): opt-in git branch/status segment in the statusline

New statusline.show_git config (default false). When enabled, a git
segment renders after the directory: current branch plus compact
work-state markers (+staged ~unstaged ?untracked ↑ahead ↓behind, or ✓
when clean and in sync), e.g. " │ main+2~1?3".

One git status --porcelain=v2 --branch spawn per render via execFileSync
with a fixed argument array (no shell), a 1.5s timeout, and the
workspace dir passed with -C. Fails silently — segment absent outside a
repo, without git, or on timeout. Default output is unchanged when the
flag is absent.

Claude-Session: https://claude.ai/code/session_01Hme55Pvq6BhpgwBcyC5HAg
This commit is contained in:
Cody Anderson
2026-07-10 23:09:02 -06:00
parent ad7111e50b
commit d6672ff926
5 changed files with 344 additions and 7 deletions

View File

@@ -770,6 +770,13 @@ function cmdConfigSet(cwd: string, keyPath: string | undefined, value: string |
}
}
// statusline.show_git — boolean only
if (kp === 'statusline.show_git') {
if (typeof parsedValue !== 'boolean') {
error(`Invalid statusline.show_git '${val}'. Must be a boolean (true or false).`);
}
}
// Fallow scope + profile enum validation (#3424)
const VALID_FALLOW_SCOPES = ['phase', 'repo'];
if (kp === 'code_quality.fallow.scope') assertEnumValue(parsedValue, val, VALID_FALLOW_SCOPES, 'code_quality.fallow.scope');