Visitar URL original
feat(app): show worktree badges in the sidebar by arodu · Pull Request #63553 · anomalyco/opencode · GitHub
Skip to content

feat(app): show worktree badges in the sidebar - #63553

Open
arodu wants to merge 3 commits into
anomalyco:devfrom
arodu:sidebar-worktree-badge
Open

arodu wants to merge 3 commits into
anomalyco:devfrom
arodu:sidebar-worktree-badge

Conversation

@arodu

@arodu arodu commented Nov 12, 2026 •

Copy link
Copy Markdown

Issue for this PR

Refs #63143.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The Customize side bar groups sessions by project, so sessions from a project's git worktrees look the same. This adds a small badge to each session row with the worktree's short directory name (main, qa, cake5, ...) and a color derived from its directory. It only appears when the project has worktrees, so projects without worktrees look unchanged.

How did you verify your code works?

  • bun run --cwd packages/app typecheck:tsc
  • Dev desktop, project with four worktrees: rows show main, cake5, 43967, qa; a project without worktrees shows no badge.

Screenshots / recordings

Before (dark)
before-dark

After (dark)
after-dark

Before (light)
before-light

After (light)
after-light

QA subdirectory is a session started in a worktree subdirectory; after the change its badge resolves to qa. Root subdirectory resolves to Local.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #55446

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typechecks (tsc -b in packages/app), but I couldn't run it: the change lives in the desktop/web Customize sidebar and only the TUI can be driven here. Please add a before/after screenshot in light and dark theme that includes a session started in a subdirectory of a worktree.

Public API is unchanged.

The main thing to fix is the label source: it's the session directory's own name, not the worktree containing it. So a session started in a subfolder shows the subfolder's name and color, and one under the root never shows main. Also: the path helpers duplicate @opencode/util/path and break on Windows paths; the badge doesn't truncate; and main is a hard-coded English string while the rest of the sidebar uses language.t. Details inline.

Related: #55446

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new commit addresses all earlier points. The badge now comes from the worktree that contains the session (longest match), so subdirectories get their worktree's label and color. The root shows a translated "Local" label, plain git worktrees are included, path handling uses @opencode/util/path (so Windows paths work), and long names truncate. The new sidebar-worktree.test.ts passes (7 tests) and tsc -b in packages/app passes. I couldn't run the desktop/web sidebar here, so before/after screenshots in light and dark theme, including a session started in a subdirectory, would still help.

The public API is unchanged (one new English UI string, sidebar.worktree.local).

@arodu

arodu commented Nov 12, 2026

Copy link
Copy Markdown
Author

Screenshots added to the description. The review points were addressed in 5bff3fb.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new push only merges dev; the PR's own changes are the same as at the last review, and the earlier points were all addressed then. The worktree helper's tests (7) and tsc -b in packages/app pass on the new head. I couldn't run the desktop/web sidebar here; thanks for the light and dark screenshots, which cover the subdirectory cases. Nothing further from me.

The public API is unchanged.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant