Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ide): fold a branch open to reach its local folder and its GitHub page

rubenluetke10-beepf2f67de3dd05
diff --git a/jarvis/agentic_ide/git_overview.py b/jarvis/agentic_ide/git_overview.py
index 3d412e7c0c..ba97c420c4 100644
--- a/jarvis/agentic_ide/git_overview.py
+++ b/jarvis/agentic_ide/git_overview.py
@@ -667,6 +667,27 @@ def _github_for(root: Path, info: RepoOverview, refresh: bool) -> _GitHubSnapsho
return snap if snap.ok else None
+def branch_checkout(folder: str | Path, branch: str) -> Path | None:
+ """The folder ``branch`` is checked out in — this one or a linked worktree.
+
+ None when no checkout of that branch exists on this computer (or the folder
+ is gone): the caller then has nothing local to open.
+ """
+ if not branch:
+ return None
+ path = Path(folder).expanduser()
+ text = _out(["worktree", "list", "--porcelain"], path) if path.is_dir() else None
+ tree = ""
+ for line in (text or "").splitlines():
+ key, _, value = line.partition(" ")
+ if key == "worktree":
+ tree = value.strip()
+ elif key == "branch" and value.strip() == f"refs/heads/{branch}" and tree:
+ found = Path(tree)
+ return found if found.is_dir() else None
+ return None
+
+
def overview(folder: str | Path, *, refresh: bool = False, github: bool = True) -> RepoOverview:
"""Branches of the repository ``folder`` is in, with merge, PR and CI state."""
path = Path(folder).expanduser()
diff --git a/jarvis/ui/web/agentic_ide_git_routes.py b/jarvis/ui/web/agentic_ide_git_routes.py
index ef1a144167..22c62c193c 100644
--- a/jarvis/ui/web/agentic_ide_git_routes.py
+++ b/jarvis/ui/web/agentic_ide_git_routes.py
@@ -6,6 +6,8 @@ Endpoints (all under ``/api/agentic-ide/git``)::
GET /changes Changed files under a folder, with line counts
GET /diff One file's change against the last commit
GET /overview A workspace's branches with merged-into, PR and CI state
+ GET /branch/editors Where a branch's checkout can be opened on this computer
+ POST /branch/open Open a branch's checkout in the file manager or an editor
GET /github/repos The person's GitHub repositories, for the one-time pick
PUT /github/binding Remember which GitHub repository a workspace folder is
POST /prepare Git half of opening a workspace or an agent
@@ -30,7 +32,7 @@ from __future__ import annotations
from dataclasses import asdict
from pathlib import Path
-from fastapi import APIRouter, HTTPException, Query
+from fastapi import APIRouter, HTTPException, Query, Request
from pydantic import BaseModel, Field
from jarvis.agentic_ide import git_changes, git_ops, git_overview, github_link, github_status
@@ -38,6 +40,7 @@ from jarvis.agentic_ide.git_ops import GitError, PrepareMode
from jarvis.agentic_ide.session import account_home, get_registry
from jarvis.agentic_ide.session_branches import PaneBranchRecord
from jarvis.agentic_ide.thread_folders import allowed_thread_folder
+from jarvis.ui.web.surface_security import is_loopback_request
router = APIRouter(prefix="/api/agentic-ide/git", tags=["agentic-ide-git"])
@@ -153,6 +156,71 @@ def session_github_status(workspace_id: str = Query(..., min_length=1)) -> dict:
return {"panes": github_status.statuses(records)}
+# The editors a branch's checkout is offered in, when installed.
+_BRANCH_EDITORS = ("code", "cursor")
+
+
+def _native_actions(request: Request) -> bool:
+ """Opening a folder acts on the screen of the computer running Jarvis."""
+ return is_loopback_request(request.scope) and bool(
+ getattr(request.app.state, "native_file_actions", False)
+ )
+
+
[email protected]("/branch/editors", summary="Where a branch's checkout can be opened")
+def branch_editors(request: Request) -> dict:
+ """The file manager and the installed editors; empty on a headless host."""
+ if not _native_actions(request):
+ return {"file_manager": False, "editors": []}
+ from jarvis.ui.web import outputs_routes
+
+ labels = dict(outputs_routes._OPENER_EDITORS)
+ installed = {entry["id"] for entry in outputs_routes._available_openers()}
+ editors = [{"id": oid, "label": labels[oid]} for oid in _BRANCH_EDITORS if oid in installed]
+ return {"file_manager": True, "editors": editors}
+
+
+class OpenBranchRequest(BaseModel):
+ workspace_id: str = Field(..., min_length=1)
+ branch: str = Field(..., min_length=1, max_length=300)
+ target: str = Field(
+ "folder", min_length=1, max_length=40, description='"folder" or an editor id'
+ )
+
+
[email protected]("/branch/open", summary="Open a branch's checkout in the file manager or an editor")
+def open_branch(request: Request, req: OpenBranchRequest) -> dict:
+ """Open the folder a branch is checked out in.
+
+ The folder comes from git's own worktree list for the open workspace, never
+ from the client, and ``target`` is a closed id — this cannot open an
+ arbitrary path or launch an arbitrary program.
+ """
+ if not _native_actions(request):
+ raise HTTPException(status_code=404, detail="Folders can only be opened on this computer.")
+ session = get_registry().get(req.workspace_id)
+ if session is None:
+ raise HTTPException(status_code=404, detail="Workspace not found.")
+ folder = git_overview.branch_checkout(session.folder, req.branch)
+ if folder is None:
+ raise HTTPException(
+ status_code=404, detail="This branch is not checked out on this computer."
+ )
+ from jarvis.platform import open_path
+
+ if req.target == "folder":
+ return {"opened": bool(open_path.open_file(folder)), "path": str(folder)}
+ if req.target not in _BRANCH_EDITORS:
+ raise HTTPException(status_code=400, detail="Unknown editor.")
+ from jarvis.ui.web import outputs_routes
+
+ resolved = outputs_routes._resolve_opener(req.target)
+ if resolved is None:
+ raise HTTPException(status_code=409, detail="That editor is not installed.")
+ kind, value = resolved
+ return {"opened": bool(open_path.open_file_with(folder, kind, value)), "path": str(folder)}
+
+
class BindingRequest(BaseModel):
workspace_id: str = Field(..., min_length=1)
repo: str = Field("", max_length=200, description="owner/name; empty forgets the choice")
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
index edf0d9c1d1..b9acebdab8 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
@@ -92,6 +92,7 @@ let status = 200;
let gate: Promise<void> | null = null;
const calls: string[] = [];
const puts: string[] = [];
+const opens: string[] = [];
const REPOS = {
connected: true,
source: "app",
@@ -109,6 +110,7 @@ beforeEach(() => {
gate = null;
calls.length = 0;
puts.length = 0;
+ opens.length = 0;
vi.stubGlobal(
"fetch",
vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
@@ -117,6 +119,11 @@ beforeEach(() => {
const json = (body: unknown, code = 200) =>
new Response(JSON.stringify(body), { status: code, headers: { "Content-Type": "application/json" } });
if (url.includes("/github/repos")) return json(REPOS);
+ if (url.includes("/branch/editors")) return json({ file_manager: true, editors: [{ id: "code", label: "VS Code" }] });
+ if (url.includes("/branch/open")) {
+ opens.push(String(init?.body));
+ return json({ opened: true, path: "/code/app" });
+ }
if (url.includes("/github/binding")) {
puts.push(String(init?.body));
answer = OVERVIEW;
@@ -306,6 +313,36 @@ describe("GitOverviewTab", () => {
expect(date("undated")).toBeUndefined();
});
+ it("folds a clicked branch open with its local folder and its GitHub page", async () => {
+ answer = { ...OVERVIEW, branches: [...OVERVIEW.branches, branch("wip/local", { upstream: "", on_github: false })] };
+ render(<GitOverviewTab />);
+ await screen.findAllByTestId("git-branch-row");
+ expect(screen.queryByTestId("git-branch-details")).toBeNull();
+
+ fireEvent.click(within(row("feature/wip")).getByTestId("git-branch-toggle"));
+ const details = within(row("feature/wip")).getByTestId("git-branch-details");
+ fireEvent.click(await within(details).findByTestId("git-open-folder"));
+ await vi.waitFor(() => expect(opens).toHaveLength(1));
+ expect(JSON.parse(opens[0])).toEqual({ workspace_id: "w1", branch: "feature/wip", target: "folder" });
+ fireEvent.click(within(details).getByTestId("git-open-code"));
+ await vi.waitFor(() => expect(JSON.parse(opens[1]).target).toBe("code"));
+ fireEvent.click(within(details).getByTestId("git-open-github"));
+ expect(openExternalUrl).toHaveBeenCalledWith("https://github.com/o/r/tree/feature/wip");
+ fireEvent.click(within(details).getByTestId("git-open-pr"));
+ expect(openExternalUrl).toHaveBeenCalledWith("https://github.com/o/r/pull/7");
+
+ // Not checked out anywhere: nothing local to open, the switch command instead; not on GitHub either.
+ fireEvent.click(within(row("wip/local")).getByTestId("git-branch-toggle"));
+ const local = within(row("wip/local")).getByTestId("git-branch-details");
+ expect(within(local).queryByTestId("git-open-folder")).toBeNull();
+ expect(within(local).getByTestId("git-copy-switch")).toBeTruthy();
+ expect(within(local).queryByTestId("git-open-github")).toBeNull();
+
+ // A second click folds it away again.
+ fireEvent.click(within(row("feature/wip")).getByTestId("git-branch-toggle"));
+ expect(within(row("feature/wip")).queryByTestId("git-branch-details")).toBeNull();
+ });
+
it("offers GitHub pages and copies from a branch's menu", async () => {
render(<GitOverviewTab />);
await screen.findAllByTestId("git-branch-row");
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
index 5fe4b6ed46..27ba45edc8 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
@@ -1,15 +1,20 @@
import { useCallback, useEffect, useMemo, useState, type ReactNode, type SVGProps } from "react";
import {
+ ChevronDown,
ChevronRight,
CircleCheck,
CircleDashed,
CircleDot,
CircleHelp,
CircleX,
+ CirclePlay,
+ Copy,
Ellipsis,
ExternalLink,
FolderGit2,
+ FolderOpen,
GitBranch,
+ GitCompareArrows,
GitMerge,
GitPullRequest,
GitPullRequestClosed,
@@ -19,19 +24,25 @@ import {
Loader2,
RefreshCw,
Search,
+ SquareTerminal,
X,
+ type LucideIcon,
} from "lucide-react";
import { fill, useT, useUiLanguage } from "@/i18n";
+import { robustCopy } from "@/lib/clipboard";
import { openExternalUrl } from "@/lib/openExternal";
import { cn } from "@/lib/utils";
import { QuickTooltip } from "@/components/ui/tooltip";
import { useEventStore } from "@/store/events";
import { useIdeChatStore } from "@/store/ideChat";
-import { BranchMenu, branchUrl } from "./BranchMenu";
+import { BranchMenu, branchPath, branchUrl } from "./BranchMenu";
import { ConnectGitHubCard, GitHubRepoPicker } from "./GitHubRepoPicker";
import {
+ fetchBranchEditors,
fetchGitOverview,
GitOverviewError,
+ openBranchCheckout,
+ type BranchEditors,
type BranchRow,
type CiState,
type CiStatus,
@@ -334,18 +345,192 @@ function CommitDate({ seconds }: { seconds: number }) {
);
}
+function DetailButton({
+ icon: Icon,
+ label,
+ testId,
+ primary,
+ onClick,
+}: {
+ icon: LucideIcon | ((props: SVGProps<SVGSVGElement>) => ReactNode);
+ label: string;
+ testId: string;
+ primary?: boolean;
+ onClick: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ data-testid={testId}
+ onClick={onClick}
+ className={cn(
+ "inline-flex h-7 max-w-full items-center gap-1.5 rounded-md border px-2 text-[11.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ primary
+ ? "border-primary/40 bg-primary/10 text-foreground hover:bg-primary/15"
+ : "border-border/70 text-foreground/90 hover:bg-secondary",
+ )}
+ >
+ <Icon className="h-3.5 w-3.5 shrink-0" aria-hidden />
+ <span className="truncate">{label}</span>
+ </button>
+ );
+}
+
+function DetailSection({ icon: Icon, title, testId, children }: { icon: LucideIcon; title: string; testId: string; children: ReactNode }) {
+ return (
+ <section data-testid={testId} className="space-y-1.5">
+ <h4 className="flex items-center gap-1.5 text-[10.5px] font-semibold uppercase tracking-wide text-muted-foreground">
+ <Icon className="h-3.5 w-3.5" aria-hidden />
+ {title}
+ </h4>
+ {children}
+ </section>
+ );
+}
+
+/**
+ * What a clicked branch row folds open: where the branch lives on this
+ * computer (with a way to open that folder) and on GitHub (with a way there).
+ */
+function BranchDetails({
+ row,
+ repoUrl,
+ defaultBranch,
+ workspaceId,
+ editors,
+}: {
+ row: BranchRow;
+ repoUrl: string;
+ defaultBranch: string;
+ workspaceId: string;
+ editors: BranchEditors | null;
+}) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const pushToast = useEventStore((state) => state.pushToast);
+ const url = branchUrl(repoUrl, row);
+ const checkedOut = !row.remote_only && (row.current || Boolean(row.worktree));
+ const pr = row.pull_requests[0];
+ const canOpen = checkedOut && Boolean(editors?.file_manager);
+
+ const openLocal = (target: string) => {
+ void openBranchCheckout(workspaceId, row.name, target)
+ .then((result) => {
+ if (!result.opened) pushToast("error", t("ide_side_panel.git.details.open_failed"));
+ })
+ .catch((err: Error) => pushToast("error", err.message || t("ide_side_panel.git.details.open_failed")));
+ };
+ const copy = (text: string) => {
+ void robustCopy(text).then((ok) =>
+ pushToast(ok ? "success" : "error", ok ? fill(t("ide_side_panel.git.menu.copied"), { text }) : t("ide_side_panel.git.menu.copy_failed")),
+ );
+ };
+
+ const localState = row.remote_only
+ ? t("ide_side_panel.git.details.local_absent")
+ : row.current
+ ? t("ide_side_panel.git.current")
+ : row.worktree
+ ? t("ide_side_panel.git.details.local_worktree")
+ : t("ide_side_panel.git.details.local_branch_only");
+ const commitLine =
+ row.head && row.committed_at
+ ? `${row.head.slice(0, 7)} · ${new Intl.DateTimeFormat(lang, { dateStyle: "medium", timeStyle: "short" }).format(new Date(row.committed_at * 1000))}`
+ : row.head.slice(0, 7);
+
+ return (
+ <div data-testid="git-branch-details" className="grid gap-3 border-t border-border/50 pb-3 pl-9 pr-3 pt-2.5 text-[11.5px]">
+ <DetailSection icon={Laptop} title={t("ide_side_panel.git.details.local_title")} testId="git-details-local">
+ <p className="text-foreground">{localState}</p>
+ {row.worktree && <p className="break-all font-mono text-[10.5px] text-muted-foreground">{row.worktree}</p>}
+ {!row.remote_only && commitLine && (
+ <p className="font-mono text-[10.5px] text-muted-foreground">{fill(t("ide_side_panel.git.last_commit"), { date: commitLine })}</p>
+ )}
+ {row.upstream && (
+ <p className="text-[10.5px] text-muted-foreground">
+ {fill(t("ide_side_panel.git.tracks"), { upstream: row.upstream, ahead: row.ahead, behind: row.behind })}
+ </p>
+ )}
+ <div className="flex flex-wrap gap-1.5 pt-0.5">
+ {canOpen && (
+ <>
+ <DetailButton icon={FolderOpen} label={t("ide_side_panel.git.details.open_folder")} testId="git-open-folder" primary onClick={() => openLocal("folder")} />
+ {editors?.editors.map((editor) => (
+ <DetailButton
+ key={editor.id}
+ icon={SquareTerminal}
+ label={fill(t("ide_side_panel.git.details.open_in"), { editor: editor.label })}
+ testId={`git-open-${editor.id}`}
+ onClick={() => openLocal(editor.id)}
+ />
+ ))}
+ </>
+ )}
+ {!checkedOut && (
+ <DetailButton icon={Copy} label={t("ide_side_panel.git.menu.copy_switch")} testId="git-copy-switch" onClick={() => copy(`git switch ${row.name}`)} />
+ )}
+ </div>
+ </DetailSection>
+ <DetailSection icon={Globe} title={t("ide_side_panel.git.details.github_title")} testId="git-details-github">
+ <p className="text-foreground">
+ {url ? t("ide_side_panel.git.details.github_present") : repoUrl ? t("ide_side_panel.git.not_pushed") : t("ide_side_panel.git.menu.no_repo")}
+ </p>
+ {pr && (
+ <p className="truncate text-[10.5px] text-muted-foreground">
+ #{pr.number} · {prStateLabel(t, pr)} · {pr.title}
+ </p>
+ )}
+ <div className="flex flex-wrap gap-1.5 pt-0.5">
+ {url && (
+ <DetailButton icon={ExternalLink} label={t("ide_side_panel.git.details.open_github")} testId="git-open-github" primary onClick={() => void openExternalUrl(url)} />
+ )}
+ {pr && (
+ <DetailButton
+ icon={PR_ICON[pr.state]}
+ label={fill(t("ide_side_panel.git.menu.open_pr"), { number: pr.number })}
+ testId="git-open-pr"
+ onClick={() => void openExternalUrl(pr.url)}
+ />
+ )}
+ {url && !pr && defaultBranch && row.name !== defaultBranch && (
+ <DetailButton
+ icon={GitCompareArrows}
+ label={fill(t("ide_side_panel.git.menu.compare"), { target: defaultBranch })}
+ testId="git-open-compare"
+ onClick={() => void openExternalUrl(`${repoUrl}/compare/${branchPath(defaultBranch)}...${branchPath(row.name)}`)}
+ />
+ )}
+ {row.ci.url && (
+ <DetailButton icon={CirclePlay} label={t("ide_side_panel.git.menu.open_ci")} testId="git-open-ci" onClick={() => void openExternalUrl(row.ci.url)} />
+ )}
+ </div>
+ </DetailSection>
+ </div>
+ );
+}
+
function BranchLine({
row,
isDefault,
repoUrl,
+ defaultBranch,
+ workspaceId,
+ editors,
menuOpen,
onMenu,
+ expanded,
+ onToggle,
}: {
row: BranchRow;
isDefault: boolean;
repoUrl: string;
+ defaultBranch: string;
+ workspaceId: string;
+ editors: BranchEditors | null;
menuOpen: boolean;
onMenu: (row: BranchRow, x: number, y: number) => void;
+ expanded: boolean;
+ onToggle: (name: string) => void;
}) {
const t = useT();
const meta: string[] = [];
@@ -371,16 +556,24 @@ function BranchLine({
data-testid="git-branch-row"
data-branch={row.name}
data-current={row.current || undefined}
+ data-expanded={expanded || undefined}
onContextMenu={(event) => {
event.preventDefault();
onMenu(row, event.clientX, event.clientY);
}}
- className={cn("group/row flex min-h-9 items-center gap-1 py-1 pl-2 pr-1", row.current && "bg-accent/10", menuOpen && "bg-secondary/60")}
+ className={cn(row.current && "bg-accent/10", expanded && "bg-secondary/30")}
>
+ <div className={cn("group/row flex min-h-9 items-center gap-1 py-1 pl-2 pr-1", menuOpen && "bg-secondary/60")}>
<LinkIcon url={url} tip={url ? openTip : nameTip} label={url ? openTip : row.name} testId="git-branch-link">
<BranchIcon className={cn("h-4 w-4 shrink-0", row.current ? "text-accent" : "text-muted-foreground")} aria-hidden />
</LinkIcon>
- <span className="flex min-w-0 flex-1 flex-col leading-tight">
+ <button
+ type="button"
+ data-testid="git-branch-toggle"
+ aria-expanded={expanded}
+ onClick={() => onToggle(row.name)}
+ className="flex min-w-0 flex-1 flex-col rounded-md text-left leading-tight focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
<QuickTooltip content={nameTip} side="bottom" className="flex min-w-0 items-center gap-1.5">
<span className={cn("truncate font-mono text-[12.5px]", row.current ? "font-semibold text-foreground" : "text-foreground")}>
{row.name}
@@ -398,7 +591,7 @@ function BranchLine({
{meta.length > 0 && <span className="shrink-0 tabular-nums">{meta.join(" · ")}</span>}
{row.worktree && <span className="shrink-0">{t("ide_side_panel.git.worktree_badge")}</span>}
</span>
- </span>
+ </button>
<PullRequestBadge prs={row.pull_requests} />
<CiBadge ci={row.ci} stale={row.ci_stale} />
<QuickTooltip content={t("ide_side_panel.git.more")} side="bottom" className="inline-flex shrink-0">
@@ -421,6 +614,14 @@ function BranchLine({
<Ellipsis className="h-4 w-4" aria-hidden />
</button>
</QuickTooltip>
+ <ChevronDown
+ className={cn("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none", expanded && "rotate-180")}
+ aria-hidden
+ />
+ </div>
+ {expanded && (
+ <BranchDetails row={row} repoUrl={repoUrl} defaultBranch={defaultBranch} workspaceId={workspaceId} editors={editors} />
+ )}
</li>
);
}
@@ -619,6 +820,25 @@ export function GitOverviewTab() {
const [query, setQuery] = useState("");
const [filter, setFilter] = useState<BranchFilter>("all");
const [menu, setMenu] = useState<{ row: BranchRow; x: number; y: number } | null>(null);
+ const [expanded, setExpanded] = useState<ReadonlySet<string>>(() => new Set());
+ const [editors, setEditors] = useState<BranchEditors | null>(null);
+ const toggleRow = useCallback((name: string) => {
+ setExpanded((current) => {
+ const next = new Set(current);
+ if (!next.delete(name)) next.add(name);
+ return next;
+ });
+ }, []);
+ useEffect(() => {
+ let alive = true;
+ fetchBranchEditors()
+ .then((answer) => alive && setEditors(answer))
+ // An older backend has no such route: rows then offer GitHub and copy only.
+ .catch(() => alive && setEditors({ file_manager: false, editors: [] }));
+ return () => {
+ alive = false;
+ };
+ }, []);
const openMenu = useCallback((row: BranchRow, x: number, y: number) => {
setMenu((current) => (current?.row.name === row.name ? null : { row, x, y }));
}, []);
@@ -636,6 +856,7 @@ export function GitOverviewTab() {
setQuery("");
setFilter("all");
setMenu(null);
+ setExpanded(new Set());
}, [workspaceId]);
const allRows = useMemo(() => [...(data?.branches ?? []), ...(data?.remote_branches ?? [])], [data]);
const trimmed = query.trim();
@@ -782,8 +1003,13 @@ export function GitOverviewTab() {
row={row}
isDefault={row.name === data.default_branch}
repoUrl={github?.repo_url ?? ""}
+ defaultBranch={data.default_branch}
+ workspaceId={workspace.id}
+ editors={editors}
menuOpen={menu?.row.name === row.name}
onMenu={openMenu}
+ expanded={expanded.has(row.name)}
+ onToggle={toggleRow}
/>
))}
</ul>
@@ -817,8 +1043,13 @@ export function GitOverviewTab() {
row={row}
isDefault={false}
repoUrl={github?.repo_url ?? ""}
+ defaultBranch={data.default_branch}
+ workspaceId={workspace.id}
+ editors={editors}
menuOpen={menu?.row.name === row.name}
onMenu={openMenu}
+ expanded={expanded.has(`remote:${row.name}`)}
+ onToggle={() => toggleRow(`remote:${row.name}`)}
/>
))}
</ul>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/gitOverviewApi.ts b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/gitOverviewApi.ts
index 96b6e9924f..1c4316b4ae 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/gitOverviewApi.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/gitOverviewApi.ts
@@ -160,3 +160,22 @@ export function bindGitHubRepo(workspaceId: string, repo: string): Promise<{ ok:
body: JSON.stringify({ workspace_id: workspaceId, repo }),
});
}
+
+export interface BranchEditors {
+ /** False on a headless host or a remote browser: nothing opens on this screen. */
+ file_manager: boolean;
+ editors: { id: string; label: string }[];
+}
+
+export function fetchBranchEditors(): Promise<BranchEditors> {
+ return call<BranchEditors>(`/api/agentic-ide/git/branch/editors`);
+}
+
+/** Open the folder `branch` is checked out in, in the file manager (`folder`) or an editor. */
+export function openBranchCheckout(workspaceId: string, branch: string, target: string): Promise<{ opened: boolean; path: string }> {
+ return call(`/api/agentic-ide/git/branch/open`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ workspace_id: workspaceId, branch, target }),
+ });
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 56a9a52133..b9c2833bed 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -6233,6 +6233,18 @@
"github_only": "nur GitHub",
"github_only_tip": "Nur auf GitHub, nicht auf diesem Rechner.",
"last_commit": "Letzter Commit: {date}",
+ "details": {
+ "local_title": "Dieser Rechner",
+ "github_title": "GitHub",
+ "local_absent": "Nicht auf diesem Rechner.",
+ "local_worktree": "In einem anderen Ordner ausgecheckt:",
+ "local_branch_only": "Auf diesem Rechner, aber in keinem Ordner ausgecheckt.",
+ "github_present": "Auf GitHub.",
+ "open_folder": "Ordner öffnen",
+ "open_in": "In {editor} öffnen",
+ "open_github": "Auf GitHub öffnen",
+ "open_failed": "Der Ordner konnte nicht geöffnet werden."
+ },
"merged_short": "in {target}",
"merged_git": "In {target} gemergt: Jeder Commit dieses Branches ist in {target} enthalten.",
"merged_pr": "Über Pull Request #{number} in {target} gemergt.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 827a05c28e..5859f5e32d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -6266,6 +6266,18 @@
"github_only": "GitHub only",
"github_only_tip": "Only on GitHub, not on this computer.",
"last_commit": "Last commit: {date}",
+ "details": {
+ "local_title": "This computer",
+ "github_title": "GitHub",
+ "local_absent": "Not on this computer.",
+ "local_worktree": "Checked out in another folder:",
+ "local_branch_only": "On this computer, but not checked out in any folder.",
+ "github_present": "On GitHub.",
+ "open_folder": "Open folder",
+ "open_in": "Open in {editor}",
+ "open_github": "Open on GitHub",
+ "open_failed": "The folder could not be opened."
+ },
"merged_short": "in {target}",
"merged_git": "Merged into {target}: every commit of this branch is in {target}.",
"merged_pr": "Merged into {target} through pull request #{number}.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 7c3104f699..88de83f5a5 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -6233,6 +6233,18 @@
"github_only": "solo GitHub",
"github_only_tip": "Solo en GitHub, no está en este ordenador.",
"last_commit": "Último commit: {date}",
+ "details": {
+ "local_title": "Este ordenador",
+ "github_title": "GitHub",
+ "local_absent": "No está en este ordenador.",
+ "local_worktree": "Activa en otra carpeta:",
+ "local_branch_only": "En este ordenador, pero no está activa en ninguna carpeta.",
+ "github_present": "En GitHub.",
+ "open_folder": "Abrir carpeta",
+ "open_in": "Abrir en {editor}",
+ "open_github": "Abrir en GitHub",
+ "open_failed": "No se pudo abrir la carpeta."
+ },
"merged_short": "en {target}",
"merged_git": "Fusionada en {target}: todos los commits de esta rama están en {target}.",
"merged_pr": "Fusionada en {target} mediante el pull request #{number}.",
diff --git a/tests/unit/agentic_ide/test_git_overview.py b/tests/unit/agentic_ide/test_git_overview.py
index deaa0d5266..6be5ecc476 100644
--- a/tests/unit/agentic_ide/test_git_overview.py
+++ b/tests/unit/agentic_ide/test_git_overview.py
@@ -253,6 +253,19 @@ def test_overview_marks_current_default_and_merged_branches(repo: Path) -> None:
assert by_name["main"].merged_into == []
+@needs_git
+def test_branch_checkout_finds_this_folder_and_linked_worktrees(repo: Path, tmp_path: Path) -> None:
+ tree = tmp_path / "fresh-tree"
+ _git(repo, "worktree", "add", "-q", str(tree), "feature/fresh")
+ assert git_overview.branch_checkout(repo, "feature/wip") == repo
+ found = git_overview.branch_checkout(repo, "feature/fresh")
+ assert found is not None and found.resolve() == tree.resolve()
+ # Checked out nowhere, unknown, or a name git never saw: nothing to open.
+ assert git_overview.branch_checkout(repo, "feature/done") is None
+ assert git_overview.branch_checkout(repo, "no/such") is None
+ assert git_overview.branch_checkout(repo, "") is None
+
+
@needs_git
def test_overview_of_a_plain_folder_is_unavailable(tmp_path: Path) -> None:
info = git_overview.overview(tmp_path, github=False)