Skip to content

Show git repo and branch in header - #89

Merged
srid merged 5 commits into
masterfrom
feat/git-context-header
Mar 23, 2026
Merged

Show git repo and branch in header#89
srid merged 5 commits into
masterfrom
feat/git-context-header

Conversation

@srid

@srid srid commented Mar 23, 2026

Copy link
Copy Markdown
Member

The header now displays repo name and branch when the active terminal is inside a git repo, giving instant context about which project and branch you're working in. Non-git directories continue showing just the shortened CWD path.

The server enriches the existing CWD change stream with git metadata resolved via simple-git (~2ms per rev-parse call). The PTY layer remains unchanged — it still emits raw paths via OSC 7 — and the oRPC handler maps each path to a CwdInfo object containing the optional GitInfo before streaming to the client. Handles empty repos (no commits yet) by falling back from rev-parse --abbrev-ref HEAD to symbolic-ref --short HEAD.

This is Phase 4a from the implementation plan, laying the groundwork for Phase 4b's worktree-grouped sidebar.

Try it locally

nix run github:juspay/kolu/feat/git-context-header

srid added 5 commits March 23, 2026 16:17
Server resolves git metadata via simple-git when CWD changes.
Header displays repo:branch alongside shortened CWD path.
Non-git directories show CWD only (existing behavior).
Header: repo:branch no longer clips — only the CWD path truncates.
Sidebar: shows branch name alongside directory basename.
Extracted toCwdInfo helper, simplified branch resolution to prefer
symbolic-ref (works in empty repos), DRY'd test steps.
Add data-testid="sidebar-branch" to sidebar git context.
Test both header and sidebar show/hide branch in git-context.feature.
…debar

Header: ~/path · branch (full shortened path, no separate repo name).
Sidebar: dirname · branch. Both use same order for consistency.
Resolve merge conflicts in Header and Sidebar — replace text-slate-*
with semantic tokens (text-fg-2, text-fg-3) from the new design system.
@srid
srid marked this pull request as ready for review March 23, 2026 21:33
@srid
srid merged commit eb42451 into master Mar 23, 2026
5 checks passed
@srid
srid deleted the feat/git-context-header branch March 23, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant