feat: Add branch name under worktree in session list (if different than worktree name) (#352)

* feat: show branch info in session sidebar and enrich worktrees

* feat: refresh sidebar branch display when switching branches in git menu

* fix: ensure branch name displays on mobile by fixing flex alignment

* style: make branch name font smaller, especially on mobile
This commit is contained in:
gsxdsm
2026-02-09 02:51:05 +02:00
committed by GitHub
parent 681918a089
commit 3f29b2c6a2
3 changed files with 68 additions and 13 deletions
@@ -1,7 +1,7 @@
import { opencodeClient } from '@/lib/opencode/client';
import { substituteCommandVariables } from '@/lib/openchamberConfig';
import type { WorktreeMetadata } from '@/types/worktree';
import { deleteRemoteBranch } from '@/lib/gitApi';
import { deleteRemoteBranch, getGitStatus } from '@/lib/gitApi';
export type ProjectRef = { id: string; path: string };
@@ -143,6 +143,21 @@ export async function listProjectWorktrees(project: ProjectRef): Promise<Worktre
} catch {
// ignore
}
// Enrich worktrees with branch information from git status
await Promise.all(
results.map(async (worktree) => {
try {
const status = await getGitStatus(worktree.path);
if (status?.current) {
worktree.branch = status.current;
}
} catch {
// ignore - branch will remain empty
}
})
);
return results.sort((a, b) => {
const aLabel = (a.label || a.branch || a.path).toLowerCase();
const bLabel = (b.label || b.branch || b.path).toLowerCase();