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): open the Git panel and a worktree workspace from the sidebar menus

rubenluetke10-beep10903d0584fc
diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.test.tsx
index e003f6b271..254861f4ad 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.test.tsx
@@ -289,7 +289,7 @@ it("offers the project's real launchers and runs them", async () => {
await screen.findByRole("menuitem", { name: "Open on GitHub" });
const menu = screen.getByRole("menu", { name: "Project actions for App" });
expect(Array.from(menu.querySelectorAll('[role="menuitem"]')).map((item) => item.textContent)).toEqual([
- "New workspace", "Open in VS Code", expect.stringMatching(/^Show in /), "Open on GitHub",
+ "New workspace", "New workspace in a worktreeOwn folder and branch for its agents", "Open in VS Code", expect.stringMatching(/^Show in /), "Open on GitHub",
"Rename project", "Pin project", "Delete project",
]);
fireEvent.click(screen.getByRole("menuitem", { name: "Open in VS Code" }));
@@ -326,6 +326,16 @@ it("adds an agent, duplicates the line-up and interrupts only working agents", a
await waitFor(() => expect(addTerminal).toHaveBeenCalledWith({ workspace_id: "p1-w1" }));
});
+it("opens the Git panel and a worktree workspace from the menus", async () => {
+ render(<IdeProjectTree />);
+ fireEvent.click(screen.getByRole("button", { name: "Workspace actions for Work" }));
+ fireEvent.click(await screen.findByRole("menuitem", { name: /^Git/ }));
+ expect(useIdeProjectsStore.getState().action).toMatchObject({ kind: "git-panel", workspaceId: "p1-w1" });
+ fireEvent.click(screen.getByRole("button", { name: "Project actions for App" }));
+ fireEvent.click(await screen.findByRole("menuitem", { name: /New workspace in a worktree/ }));
+ expect(useIdeProjectsStore.getState().action).toMatchObject({ kind: "new-workspace", projectId: "p1", worktree: true });
+});
+
it("offers a closed workspace only what works on it", async () => {
useIdeProjectsStore.setState({
projects: [{
@@ -338,7 +348,7 @@ it("offers a closed workspace only what works on it", async () => {
fireEvent.contextMenu(screen.getByTestId("ide-workspace-row-p1-w1"));
await screen.findByRole("menuitem", { name: "Open in VS Code" });
expect(screen.getByRole("menuitem", { name: "Reopen workspace" })).toBeDefined();
- for (const missing of [/Rename workspace/, /Add another agent/, /Duplicate/, /Interrupt/]) {
+ for (const missing of [/Rename workspace/, /Add another agent/, /Duplicate/, /Interrupt/, /^Git/]) {
expect(screen.queryByRole("menuitem", { name: missing })).toBeNull();
}
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx
index 7f264fc14c..7b93c50ed7 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeProjectTree.tsx
@@ -1,6 +1,6 @@
import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from "react";
import { createPortal } from "react-dom";
-import { ArrowUpRight, Check, ChevronDown, ChevronRight, Copy, CopyPlus, Folder, FolderOpen, FolderPlus, Globe, Loader2, Mic, MoreHorizontal, OctagonPause, Pencil, Pin, PinOff, Plus, SquareCode, Trash2, X, type LucideIcon } from "lucide-react";
+import { ArrowUpRight, Check, ChevronDown, ChevronRight, Copy, CopyPlus, Folder, FolderGit2, GitBranch, FolderOpen, FolderPlus, Globe, Loader2, Mic, MoreHorizontal, OctagonPause, Pencil, Pin, PinOff, Plus, SquareCode, Trash2, X, type LucideIcon } from "lucide-react";
import { ChatLibraryError, deleteProject, openProject, patchProject, reorderProjects, revealProject, fetchProjectLaunchers, openProjectIn, type ProjectLaunchers } from "@/lib/chatLibraryApi";
import { robustCopy } from "@/lib/clipboard";
import { addTerminal, fetchWorkspacePanes, interruptTerminal, removeWorkspace, renameWorkspace, startIdeSession, IdeApiError, reorderWorkspaces, type IdeProject, type ProjectWorkspace, type WorkspacePaneRow } from "@/lib/agenticIdeApi";
@@ -69,6 +69,7 @@ export function IdeProjectTree() {
const connectProject = useIdeProjectsStore((state) => state.connectProject);
const newWorkspace = useIdeProjectsStore((state) => state.newWorkspace);
const activateWorkspace = useIdeProjectsStore((state) => state.activateWorkspace);
+ const openGitPanel = useIdeProjectsStore((state) => state.openGitPanel);
const toggleVoice = useIdeProjectsStore((state) => state.toggleVoice);
const requestRefresh = useIdeProjectsStore((state) => state.requestRefresh);
const pushToast = useEventStore((state) => state.pushToast);
@@ -613,6 +614,8 @@ export function IdeProjectTree() {
const projectMenuSections = (project: IdeProject): TreeMenuItem[][] => [
[
{ id: "new", label: "New workspace", icon: FolderPlus, testId: "ide-project-menu-new", onSelect: run(() => newWorkspace(project.id)) },
+ { id: "new-worktree", label: "New workspace in a worktree", icon: FolderGit2, testId: "ide-project-menu-new-worktree",
+ hint: "Own folder and branch for its agents", onSelect: run(() => newWorkspace(project.id, { worktree: true })) },
...launcherItems(project, "project"),
],
[
@@ -646,6 +649,10 @@ export function IdeProjectTree() {
...launcherItems(project, "workspace"),
{ id: "copy", label: "Copy folder path", icon: Copy, testId: "ide-workspace-menu-copy", onSelect: run(() => void copyPath(workspace.folder || project.path)) },
],
+ isOpen ? [
+ { id: "git", label: "Git", icon: GitBranch, testId: "ide-workspace-menu-git", hint: "Commit, push, pull request, worktrees",
+ onSelect: run(() => openGitPanel(workspace.id)) },
+ ] : [],
isOpen ? [
{ id: "rename", label: "Rename workspace", icon: Pencil, testId: "ide-workspace-menu-rename",
onSelect: run(() => { setDraftWorkspaceName(workspace.name); setRenamingWorkspaceId(workspace.id); setProjectOpen(project.id, true); }) },
diff --git a/jarvis/ui/web/frontend/src/components/agentic/git/GitCheckoutPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/git/GitCheckoutPicker.tsx
index 7a1440fd8a..c1942a457c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/git/GitCheckoutPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/git/GitCheckoutPicker.tsx
@@ -65,6 +65,18 @@ export function GitCheckoutPicker({ folder, value, onChange, disabled, context,
return [...new Set([...ordered, ...info.remote_branches])];
}, [info]);
+ // A plan preset from outside ("New workspace in a worktree") learns its
+ // branch name and base once the repository is read; a mode this folder
+ // cannot offer (a worktree of a plain folder) falls back to keeping it.
+ useEffect(() => {
+ if (!info || !info.git_available) return;
+ const creates = value.mode === "new_worktree" || value.mode === "new_branch";
+ if (creates && !info.is_repo) onChange({ mode: "current", branch: "", base: "" });
+ else if (creates && !value.branch) onChange({ ...value, branch: info.suggested_branch, base: value.base || info.branch });
+ // Only when the inspection lands — not on every keystroke in the branch field.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [info]);
+
const options: Option[] = !info?.is_repo
? [
{ mode: "current", title: "Without git", hint: "Open the folder as it is", Icon: FolderTree, recommended: true },
diff --git a/jarvis/ui/web/frontend/src/components/agentic/git/GitPanelDialog.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/git/GitPanelDialog.test.tsx
index bccbe643f4..92147e4b83 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/git/GitPanelDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/git/GitPanelDialog.test.tsx
@@ -93,6 +93,12 @@ describe("GitCheckoutPicker", () => {
expect(screen.getByRole("radio", { name: /Existing worktree/ })).toBeTruthy();
});
+ it("completes a preset worktree plan once the repository is read", async () => {
+ const onChange = vi.fn();
+ render(<GitCheckoutPicker folder="/code/app" value={{ mode: "new_worktree", branch: "", base: "" }} onChange={onChange} context="workspace" />);
+ await waitFor(() => expect(onChange).toHaveBeenCalledWith({ mode: "new_worktree", branch: "agent/brave-river-0001", base: "feature/login" }));
+ });
+
it("offers git init for a plain folder", async () => {
git.inspectGit.mockResolvedValue({ ...info, is_repo: false });
const onChange = vi.fn();
diff --git a/jarvis/ui/web/frontend/src/store/ideProjects.ts b/jarvis/ui/web/frontend/src/store/ideProjects.ts
index 6ea09144e5..2ae569a24e 100644
--- a/jarvis/ui/web/frontend/src/store/ideProjects.ts
+++ b/jarvis/ui/web/frontend/src/store/ideProjects.ts
@@ -3,9 +3,11 @@ import type { IdeProject } from "@/lib/agenticIdeApi";
type IdeAction =
| { kind: "connect-project"; nonce: number }
- | { kind: "new-workspace"; projectId: string; nonce: number }
+ // `worktree`: preset the dialog to give the new workspace a git worktree of its own.
+ | { kind: "new-workspace"; projectId: string; worktree?: boolean; nonce: number }
| { kind: "activate-workspace"; workspaceId: string; nonce: number }
| { kind: "workspace-options"; workspaceId: string; nonce: number }
+ | { kind: "git-panel"; workspaceId: string; nonce: number }
| { kind: "toggle-voice"; nonce: number };
interface IdeProjectsStore {
@@ -18,9 +20,10 @@ interface IdeProjectsStore {
setPendingWorkspaceId: (workspaceId: string | null) => void;
requestRefresh: () => void;
connectProject: () => void;
- newWorkspace: (projectId: string) => void;
+ newWorkspace: (projectId: string, options?: { worktree?: boolean }) => void;
activateWorkspace: (workspaceId: string) => void;
openWorkspaceOptions: (workspaceId: string) => void;
+ openGitPanel: (workspaceId: string) => void;
toggleVoice: () => void;
}
@@ -34,8 +37,9 @@ export const useIdeProjectsStore = create<IdeProjectsStore>((set) => ({
setPendingWorkspaceId: (pendingWorkspaceId) => set({ pendingWorkspaceId }),
requestRefresh: () => set((state) => ({ refreshRequest: { nonce: (state.refreshRequest?.nonce ?? 0) + 1 } })),
connectProject: () => set((state) => ({ action: { kind: "connect-project", nonce: (state.action?.nonce ?? 0) + 1 } })),
- newWorkspace: (projectId) => set((state) => ({ action: { kind: "new-workspace", projectId, nonce: (state.action?.nonce ?? 0) + 1 } })),
+ newWorkspace: (projectId, options) => set((state) => ({ action: { kind: "new-workspace", projectId, worktree: options?.worktree, nonce: (state.action?.nonce ?? 0) + 1 } })),
activateWorkspace: (workspaceId) => set((state) => ({ action: { kind: "activate-workspace", workspaceId, nonce: (state.action?.nonce ?? 0) + 1 } })),
openWorkspaceOptions: (workspaceId) => set((state) => ({ action: { kind: "workspace-options", workspaceId, nonce: (state.action?.nonce ?? 0) + 1 } })),
+ openGitPanel: (workspaceId) => set((state) => ({ action: { kind: "git-panel", workspaceId, nonce: (state.action?.nonce ?? 0) + 1 } })),
toggleVoice: () => set((state) => ({ action: { kind: "toggle-voice", nonce: (state.action?.nonce ?? 0) + 1 } })),
}));
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 4105537d47..d8c2e6069a 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -263,13 +263,22 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
handledAction.current = action.nonce;
if (action.kind === "connect-project") { setProjectDialog(true); return; }
if (action.kind === "workspace-options") { if (action.workspaceId === session?.id) setOptionsOpen(true); return; }
+ if (action.kind === "git-panel") {
+ // The panel follows the ACTIVE workspace: bring the asked one to the front first.
+ if (action.workspaceId !== session?.id) void activateFromTree(action.workspaceId);
+ setGitOpen(true);
+ return;
+ }
if (action.kind === "toggle-voice") {
setVoiceOpen((current) => { const next = !current; storeVoiceBubbleOpen(next); return next; });
return;
}
if (action.kind === "new-workspace") {
const project = projects.find((entry) => entry.id === action.projectId);
- if (project) { setWorkspaceProject(project); setWorkspaceName(""); setWorkspaceAgents([installed[0]?.name ?? ""]); setWorkspaceGit(KEEP_CHECKOUT); }
+ if (project) {
+ setWorkspaceProject(project); setWorkspaceName(""); setWorkspaceAgents([installed[0]?.name ?? ""]);
+ setWorkspaceGit(action.worktree ? { mode: "new_worktree", branch: "", base: "" } : KEEP_CHECKOUT);
+ }
return;
}
void activateFromTree(action.workspaceId);