Skip to content

feat(sidebar): show project name on worktree rows in header-less views - #6898

Open
jtalborough wants to merge 1 commit into
stablyai:mainfrom
jtalborough:feat/sidebar-project-name-on-worktree-rows
Open

jtalborough wants to merge 1 commit into
stablyai:mainfrom
jtalborough:feat/sidebar-project-name-on-worktree-rows

Conversation

@jtalborough

@jtalborough jtalborough commented Jun 30, 2026 •

Copy link
Copy Markdown

What

In the header-less workspace views (Group by → None / Status / PR) there is no project header above the rows, so a project's primary worktree showed only its branch name (e.g. main) and was indistinguishable from every other project's primary. Worktrees created under a project (e.g. a hawksbill branch under orca) likewise carried no project context.

This prefixes the project name (bold) before the branch/worktree name (lighter gray) on every worktree row in those views, so each row is identifiable:

orca · main                ← primary: no status lane, flush-left
  ⑂ orca · hawksbill        ← worktree: branch glyph in status lane, nested level

The primary worktree drops its status lane entirely so it sits flush-left, and the additional worktrees — which keep their branch glyph in the status lane — read as a nested level.

The grouped Group by → Project view is unchanged: its header already names the project, so the prefix and lane-omission are gated off there (hideRepoBadge).

Why

The flat "All" view is a common way to scan every workspace, but primary rows all read as just main with no way to tell which project they belonged to.

Review summary (cross-cutting checks)

  • Cross-platform: pure layout/Tailwind, no platform branches or modifier-key handling. Holds on macOS/Linux/Windows, light/dark.
  • SSH / remote: presentational only — no runtime, IPC, or connectionId paths touched.
  • Agents / integrations / git providers: provider- and agent-neutral; reads only repo.displayName and worktree.isMainWorktree.
  • Performance: no new work in the virtualized row hot path; gating is a couple of boolean checks per card.
  • UI quality: follows docs/STYLEGUIDE.md (existing tokens, no new colors); reuses the status-lane branch glyph rather than adding chrome.
  • Security: none — renderer-only render change.

Tests

WorktreeCard.project-identity.test.tsx: project prefix + status lane on a worktree row; prefix shown and status lane omitted for the primary; grouped-view case (no prefix, primary keeps its lane). oxlint, tsgo typecheck, and oxfmt all clean.

Visual

UI change — screenshots to be attached to the PR conversation (before/after of the All view).

🤖 Generated with Claude Code


Open in Stage

ELI5

In sidebar views without project headers, each worktree row shows the project name next to the branch so rows from different repos are not ambiguous. Project grouping still uses headers as before.

In the All / None / Status / PR views there is no project header above
the rows, so a project's primary worktree showed only its branch name
("main") and was indistinguishable from every other project's primary.
Worktrees created under a project (e.g. a `hawksbill` branch under
`orca`) likewise carried no project context.

Prefix the project name (bold) before the branch/worktree name (lighter
gray) on every worktree row in those views so each row is identifiable.
The primary worktree drops its status lane entirely so it sits
flush-left and the additional worktrees — which keep their branch glyph
in the status lane — read as a nested level. The grouped Group by →
Project view is unchanged; its header already names the project, so the
prefix and lane-omission are gated off there (hideRepoBadge).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ghost

ghost commented Jun 30, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Update WorktreeCard layout for header-less views
2 Verify project identity rendering in sidebar
Open in Stage

Chapters generated by Stage for commit 73c4b8c on Jun 30, 2026 12:20pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

WorktreeCard adds a primaryRowOmitsStatusLane boolean that suppresses the status lane for the main worktree in header-less views when hideRepoBadge is true. The title row now conditionally renders a bold project-name prefix when repo context is visible, with the branch/worktree portion displayed in muted text. The hasBranchIdentity prop on the status slot no longer marks the main worktree, and the "primary" badge is gated to header-less mode only. A new test file (WorktreeCard.project-identity.test.tsx) verifies these three rendering behaviors using renderToStaticMarkup with vi.mock isolation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main user-facing change to worktree rows in header-less views.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description covers the change, rationale, tests, cross-cutting review, security, and visual notes, with only minor template mismatches.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/renderer/src/components/sidebar/WorktreeCard.project-identity.test.tsx (1)

129-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the branch-identity behavior, not just slot presence.

These checks only prove whether the status-slot wrapper renders. The new hasBranchIdentity branch at Line 1397 can regress while this suite still passes, because both the primary and non-primary cases are asserted only with data-worktree-card-status-slot. Please add one assertion that distinguishes the branch-identity rendering path from the plain status-dot path.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 193801c8-bfbf-4ea6-893f-84fa8b5aa3ff

📥 Commits

Reviewing files that changed from the base of the PR and between be3f30e and 73c4b8c.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/WorktreeCard.project-identity.test.tsx
  • src/renderer/src/components/sidebar/WorktreeCard.tsx

Comment on lines +1197 to +1199
// Why: in header-less views the primary worktree drops its status lane entirely so
// its content sits flush-left and the branch-glyph worktrees read as a nested level.
const primaryRowOmitsStatusLane = worktree.isMainWorktree && !isFolder && !hideRepoBadge

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include primaryRowOmitsStatusLane in the new-card gutter calculation.

Line 1375 hides the slot, but Line 1297 still reserves the left offset whenever showCombinedStatusSlot is true. In experimentalNewWorktreeCardStyle, primary rows in header-less views will still keep a blank gutter instead of actually sitting flush-left.

Suggested fix
-  const applyNewCardStyleStatusLaneOffset = newCardStyle && showCombinedStatusSlot
+  const applyNewCardStyleStatusLaneOffset =
+    newCardStyle && showCombinedStatusSlot && !primaryRowOmitsStatusLane
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Why: in header-less views the primary worktree drops its status lane entirely so
// its content sits flush-left and the branch-glyph worktrees read as a nested level.
const primaryRowOmitsStatusLane = worktree.isMainWorktree && !isFolder && !hideRepoBadge
const applyNewCardStyleStatusLaneOffset =
newCardStyle && showCombinedStatusSlot && !primaryRowOmitsStatusLane

@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants