Skip to content

Configurable sidebar detail for worktree rows - #71

Merged
big-guy merged 3 commits into
ness-dev:mainfrom
big-guy:worktree-sidebar-detail-setting
May 27, 2026
Merged

Configurable sidebar detail for worktree rows#71
big-guy merged 3 commits into
ness-dev:mainfrom
big-guy:worktree-sidebar-detail-setting

Conversation

@big-guy

@big-guy big-guy commented May 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Worktree details picker in Settings → Worktrees (below Setup & teardown scripts) that controls what extra info renders on the right side of each sidebar row. Default is unchanged (diff), so existing users see no behavior change unless they pick a different option.

Modes

  • Diff stat (default) — +N −M from PR additions/deletions
  • Age — relative worktree age (<1h / Nh / Nd / N.Ny, years switch in at ≥365 days)
  • Pull Request — first assignee's avatar (far right) + milestone title + #NNN pill
  • Nothing — hide the detail

The detail hides on hover so the existing Snooze / Remove action buttons can appear in its place — no real estate lost.

Cmd+I cycle (transient override)

A new hotkey Cmd+I cycles the displayed detail through diff → age → pr → diff without changing the configured default. 'none' is intentionally skipped so the hotkey never just blanks the row. The override is per-client renderer state (a tiny useSyncExternalStore cell in src/renderer/worktree-detail-override.ts) — no IPC, no persistence, resets on reload. Matches how sidebar widths / modal visibility are scoped per CLAUDE.md's slice-vs-useState guidance.

Live preview

A mock sidebar row above the option buttons in Settings updates in real time as you pick an option, including the same group-hover:hidden / hidden group-hover:flex Tailwind pattern as the real WorktreeTab — hover the preview to see the Snooze + Remove icons swap in.

image image

Wiring

Standard slice path: shared reducer + event variant, persisted with default-omitted serialization ('diff' not written to config.json), IPC handler with validation for all four values, backend method, ElectronAPI type. The PR-mode render only fires for worktrees that already have a prStatus; otherwise nothing renders (same silent no-op as the diff mode when there's no PR yet).

Pure helper formatWorktreeAge lives in src/renderer/components/worktree-detail.ts with vitest coverage for hour/day/year boundaries and edge cases (missing createdAt, clocks in the future).

Test plan

  • npm run typecheck clean
  • npx electron-vite build clean
  • npx vitest run src/renderer/components/worktree-detail.test.ts src/shared/state/settings.test.ts — age helper + settings reducer pass
  • Launch app, open Settings → Worktrees → Worktree details, pick each option (Diff stat / Age / Pull Request / Nothing) and verify the sidebar updates live
  • Hover a sidebar row and confirm the detail collapses to reveal the Snooze + Remove buttons
  • Press Cmd+I in the app and confirm the sidebar detail cycles diff → age → pr → diff without touching the Settings picker; reload and confirm the override is gone
  • On a worktree with an assignee + milestone + PR, switch to Pull Request mode and verify the milestone, #NNN, and far-right avatar render correctly
  • Quit and relaunch — the chosen detail persists; default-value choice (diff) is omitted from config.json rather than written

@big-guy

big-guy commented May 23, 2026

Copy link
Copy Markdown
Collaborator Author

Looking for opinions on this.

I could go two ways with this:

  1. There are useful details that users would want to see at a glance. Settings would let you pick which one you want to see. This PR is the first stab at that.
  2. This is just visually distracting and is covered by the right column (PR/changed files). We'd just remove this entirely

For (1), a few future ideas I had:

  • Information about the agent/model being used
  • real-time status info (like subagents running or tasks completed/remaining)
  • token spend

All of the above are complicated with multiple agents running at once or mixed agents (Codex + Claude).

If I had this option today, I would probably set it to None.

@frenchie4111

Copy link
Copy Markdown
Collaborator

I like the change you made in this PR to make it optional. I can't really see it getting more noisy from here. Like you said, most of the additional information belongs in the context sidebar.

I am personally on the fence between Diff and None. Diffs are useful to understand the magnitude of the changes on the worktree. It's a decent way of understanding "okay that one is going to take me X minutes to review" or "okay that one is X% risky"

naming nit. It's hard to figure out what "Sidebar" means in this context so I can see the settings being a bit confusing to people. We likely should use a preview based thing (like you have in the big UX change)

@frenchie4111

Copy link
Copy Markdown
Collaborator

One thing that I could find useful in the worktree sidebar is knowing who's PR I am reviewing. Now that I have been reviewing PRs within harness for a while the juggling of PRs is sometimes like "wait which one was this again..."

@big-guy

big-guy commented May 25, 2026

Copy link
Copy Markdown
Collaborator Author

One thing that I could find useful in the worktree sidebar is knowing who's PR I am reviewing. Now that I have been reviewing PRs within harness for a while the juggling of PRs is sometimes like "wait which one was this again..."

Do you care to know that before switching to a worktree? The changes on main for the PR panel show the assignee avatar now.

@big-guy

big-guy commented May 25, 2026

Copy link
Copy Markdown
Collaborator Author

I am personally on the fence between Diff and None. Diffs are useful to understand the magnitude of the changes on the worktree. It's a decent way of understanding "okay that one is going to take me X minutes to review" or "okay that one is X% risky"

Ah, this gives me other ideas that remove the need to make this configurable.

Instead of showing the details all the time, this could be shown some other ways:

  • On hover, show a tooltip that summarizes diff stat, PR info and age.
  • On mouseover, change how the row is presented so you can see the same information.
  • On a keypress (maybe cmd), change how the row is presented to show more details, like above.

Or, this isn't a global setting. This is context based depending on the status of the worktree. If it's something you created, maybe you care about age and whether or not it's about to be merged. If it's something someone else created (and you're reviewing), you care about the size of it and who's assigned. If it's something that's inflight (no PR yet), you care about something else.

WDYT?

@big-guy
big-guy force-pushed the worktree-sidebar-detail-setting branch from 2746cc1 to 630cf7c Compare May 25, 2026 21:14
@big-guy
big-guy marked this pull request as ready for review May 25, 2026 21:20
@big-guy

big-guy commented May 25, 2026

Copy link
Copy Markdown
Collaborator Author

Here's another variation... there's a default setting used (diff, PR, age, none) and a shortcut (cmd+I) that cycles through them. So you could configure this to None, but temporarily look at the others

@big-guy
big-guy force-pushed the worktree-sidebar-detail-setting branch from 33bc7dc to 67db9c0 Compare May 26, 2026 18:08
@big-guy
big-guy requested a review from frenchie4111 May 26, 2026 19:52
@big-guy big-guy self-assigned this May 26, 2026
big-guy and others added 2 commits May 27, 2026 11:57
Introduces a 'worktreeDetail' setting (diff | age | pr | none, default
diff) that controls the extra info rendered on the right side of each
worktree row in the sidebar. The diff stat (existing behavior) keeps
its place; the new modes are:

- age — relative worktree age (e.g. '3h', '5d', '1.5y'; years switch
  in at >= 365 days)
- pr — first assignee's avatar, milestone title, and #NNN pill
  (avatar on the far right)
- none — hide the detail

The detail hides on hover so the row action buttons can appear in
its place.

Wires the setting through the standard slice path (shared reducer,
event variant, persistence, IPC handler, backend method, ElectronAPI
type) and adds the picker to Settings → Worktrees, sitting below the
Setup & teardown scripts block. A small mock sidebar row above the
options gives a real-time preview of the configured choice, including
the hover-to-reveal-actions behavior.

Cmd+I cycles a per-client override (diff → age → pr → diff) without
touching the configured default. The override is renderer-only
transient state (useSyncExternalStore in
src/renderer/worktree-detail-override.ts), matches how sidebar widths /
modal visibility are scoped, and resets on reload. 'none' is
deliberately skipped from the cycle so the hotkey never just hides
the detail.

Pure helper formatWorktreeAge lives in
src/renderer/components/worktree-detail.ts with vitest coverage for
hour/day/year boundaries and edge cases (missing createdAt, clocks in
the future).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cycle now rotates diff → age → pr → none → diff so the override hotkey
can also hide the detail entirely.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@big-guy
big-guy force-pushed the worktree-sidebar-detail-setting branch from 67db9c0 to e68e0cf Compare May 27, 2026 15:58
@frenchie4111 frenchie4111 added this to the v2.11.0 milestone May 27, 2026
@big-guy
big-guy merged commit 3ce98dc into ness-dev:main May 27, 2026
1 check passed
@big-guy
big-guy deleted the worktree-sidebar-detail-setting branch May 27, 2026 21:09
@big-guy

big-guy commented May 27, 2026

Copy link
Copy Markdown
Collaborator Author

@frenchie4111 I'm not sure what the configuration looks like on your side, but it might make sense to enable the Merge queue. That way we can submit things for merge without having to update/rebase the PR first.

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.

2 participants