Skip to content

feat(ui): add git context to header and title - #14

Merged
jfyne merged 3 commits into
masterfrom
worktree-check-context
Mar 12, 2026
Merged

feat(ui): add git context to header and title#14
jfyne merged 3 commits into
masterfrom
worktree-check-context

Conversation

@jfyne

@jfyne jfyne commented Mar 12, 2026

Copy link
Copy Markdown
Owner

What's Changed

Adds git context detection (branch, working directory, worktree status) displayed in the HTML <title> tag and a new header context bar showing branch and directory. Gracefully degrades to plain "Meatcheck" when not in a git repository or git is unavailable.

Requirements

Functional Requirements (EARS)

  • When the application starts in a git repository, the system shall detect and display the current branch name
  • When the application starts in a git repository, the system shall display the working directory path in a context bar
  • When the application is running inside a git worktree, the system shall display worktree info (the worktree path and main repo path)
  • When the application starts outside a git repository, the system shall not display a context bar
  • The HTML <title> shall include branch name and directory when in a git repo, and be just "Meatcheck" otherwise
  • If git is not installed or detection fails, the system shall degrade gracefully (no context bar, plain title)

Acceptance Criteria

Feature: Git context display in meatcheck UI

  Scenario: Branch and directory shown in title for git repo
    Given the user launches meatcheck from a git repository on branch "feature-xyz"
    When the page loads
    Then the HTML title contains "Meatcheck - feature-xyz"
    And the HTML title contains the working directory path

  Scenario: Context bar shows branch and directory
    Given the user launches meatcheck from a git repository on branch "main"
    And the working directory is "/home/user/project"
    When the page loads
    Then the header contains a context bar with the branch "main"
    And the context bar shows the directory "/home/user/project"

  Scenario: Worktree info shown when in a git worktree
    Given the user launches meatcheck from a git worktree
    When the page loads
    Then the context bar shows a "worktree" indicator

  Scenario: No context bar for non-git directory
    Given the user launches meatcheck from a directory that is not a git repository
    When the page loads
    Then the HTML title is "Meatcheck"
    And no context bar is displayed in the header

  Scenario: Graceful fallback when git is not installed
    Given git is not available on the system PATH
    When the user launches meatcheck
    Then the application starts normally
    And no git context is displayed

  Scenario: Title fallback when GitContext is nil
    Given the ReviewModel has no GitContext set
    When the page renders
    Then the HTML title is exactly "Meatcheck"

  Scenario: Detached HEAD state
    Given the user launches meatcheck from a git repository in detached HEAD state
    When the page loads
    Then the context bar shows branch "HEAD"

Suggested Review Order

# File What it does
1 model.go Defines GitContext struct and adds Git *GitContext field to ReviewModel
2 git.go Implements detectGitContext() function that detects branch, directory, and worktree status via git subcommands
3 app.go Calls detectGitContext() early in Run() and passes result to model
4 template.html Updates <title> to include branch/directory; adds .header-context div with branch and directory display
5 styles.css Adds CSS for .header-context, .ctx-item, .ctx-label, .ctx-value with flex layout, text truncation, and overflow ellipsis
6 git_test.go Unit tests for detectGitContext(): in-repo detection, non-git fallback, worktree detection, detached HEAD
7 http_render_test.go Render tests for title and context bar: title includes context when set, no context when nil, context bar styling

jfyne added 3 commits March 12, 2026 18:52
Add working directory, git branch, and worktree info to the meatcheck UI.
Display context in both the HTML <title> and a header bar on the page.

The plan includes 2 stages: git context detection using os/exec git commands,
and UI display in the header and title with graceful fallback for non-git repos.

Extract requirements to docs/requirements/review-ui.md
Detect git repository info at startup (branch, working directory, worktree
status) and display it in the HTML title and a new header context bar.
The context bar shows branch and directory labels with muted styling.
Gracefully degrades to plain "Meatcheck" title when not in a git repo.
Long working directory paths now truncate with ellipsis instead of wrapping
or breaking layout. The label stays visible, values shrink with text-overflow.
@jfyne
jfyne marked this pull request as ready for review March 12, 2026 19:16
@jfyne
jfyne merged commit aea4dce into master Mar 12, 2026
1 check passed
@jfyne
jfyne deleted the worktree-check-context branch March 12, 2026 19:17
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