add workspace widget with git branch and worktree management#151
Merged
add workspace widget with git branch and worktree management#151
Conversation
- Introduced `activeWorkingContextBySession` to track the working context for each chat session. - Added methods `setActiveWorkingContext` and `getActiveWorkingContext` to manage the active working context. - Updated relevant components (ChatView, ContextPanel) to utilize the new working context state. - Enhanced tests to cover the new working context functionality. This change improves the chat session management by allowing users to maintain context across different sessions, enhancing the overall user experience.
…onality - Removed the `getActiveWorkingContext` method from the chat session store as it was no longer needed. - Added `stashChanges` and `initRepo` functions to the Git API for managing repository state. - Updated the `ContextPanel` to include handlers for stashing changes and initializing a Git repository. - Enhanced the `WorkingContextPicker` to support stashing changes before switching branches. - Updated UI components to reflect new functionalities and improved user experience. - Added tests to cover new features and ensure proper functionality. These changes improve the chat application's integration with Git, allowing users to manage their repository state more effectively.
- Removed the `type` property from the `WorkingContext` interface in `chatSessionStore`. - Enhanced the `ContextPanel` tests to reflect changes in local branches and worktree selection. - Updated the `WorkingContextPicker` to utilize the current project path for better context handling. - Improved UI labels and interactions for selecting worktrees and branches. - Added new tests to ensure proper functionality of worktree and branch selection. These changes streamline the management of working contexts in the chat application, improving user experience and code maintainability.
…ctionality - Added utility functions to simplify branch button retrieval in ContextPanel tests. - Updated tests to reflect changes in branch display and selection behavior. - Refactored WorkingContextPicker to improve path handling for branch switching. - Removed unnecessary UI elements and improved localization for branch labels. - Enhanced test coverage for worktree and branch interactions, ensuring accurate functionality. These changes improve the reliability of the ContextPanel tests and streamline the user experience in managing branches and worktrees.
…ements - Added handlers for fetching, pulling, creating branches, and creating worktrees in the ContextPanel. - Updated the ContextPanel UI to include new actions for managing branches and worktrees. - Improved error handling in refetch calls to prevent unhandled promise rejections. - Enhanced WorkingContextPicker to better handle path display logic. - Updated localization files to include new strings for branch and worktree management. These changes improve the user experience by providing more robust Git management features within the chat application.
…ponents - Added a new file size limit for the ContextPanel test file to ensure integration tests remain efficient. - Refactored error handling in the ChatView component to prevent unhandled promise rejections. - Improved formatting and readability in various components, including WorkingContextPicker and WorkspaceActionsMenu. - Updated imports to use consistent icon libraries and removed redundant error formatting functions. These changes enhance the robustness of the chat application's file handling and improve overall code quality.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5afb61b14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…e from active path
lifeizhou-ap
added a commit
to lifeizhou-ap/goose2
that referenced
this pull request
Apr 13, 2026
* main: show per-message assistant identity from metadata instead of props (block#156) add file-aware widgets to context panel, simplify session search (block#154) Add i18n and cross-boundary dead data checks to code review skill (block#153) search session message content (block#152) add workspace widget with git branch and worktree management (block#151) fix: strip XML wrapper from replayed user messages (block#150) feat: add file @-mention autocomplete with project file scanning (block#147) improve sidebar contrast and constrain model picker (block#149)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category: new-feature
User Impact: Users can now switch branches, create worktrees, fetch, pull, and manage their git workspace directly from the context panel without leaving the chat.
Problem: The context panel showed static git information (branch names, worktree paths) but offered no way to interact with the workspace. Users had to switch to a terminal to change branches, create worktrees, or pull changes — breaking their flow.
Solution: Replaced the monolithic workspace section with a composable widget architecture. The new WorkspaceWidget includes a working context picker for switching between worktrees and branches (with dirty-state handling), inline fetch/pull actions, and a split-button for creating new branches or worktrees. The active working context is synced per-session to ACP so the agent always knows which branch and directory it's operating in.
File changes
src-tauri/src/commands/git.rs
Added Tauri commands for branch switching, stashing, init, fetch, pull, branch creation, and worktree creation. Includes helpers for path validation, worktree naming, and incoming commit counting.
src-tauri/src/lib.rs
Registered the new git commands with the Tauri command handler.
src/shared/types/git.ts
Extended
GitStatewithincomingCommitCountandlocalBranches. AddedCreatedWorktreetype.src/shared/api/git.ts
Added frontend API wrappers for all new git Tauri commands.
src/shared/ui/split-button.tsx
New shared
SplitButtoncomponent — a primary action button with a dropdown to switch between actions. Used for the "Create branch / Create worktree" toggle.src/shared/ui/dropdown-menu.tsx
Changed focus text color from
text-muted-foregroundtotext-foregroundfor better readability on highlighted dropdown items.src/features/chat/stores/chatSessionStore.ts
Added
WorkingContexttype andactiveWorkingContextBySessionstate to track the selected branch/path per session. Cleanup on session deletion.src/features/chat/ui/ChatView.tsx
Reads
activeWorkingContextfrom the store and syncs it to ACP when it changes. Injects a working context system prompt fragment so the agent knows the active branch and directory.src/features/chat/ui/ChatContextPanel.tsx
Passes
sessionIdthrough toContextPanel.src/features/chat/ui/ContextPanel.tsx
Refactored from a single large component into a composition of extracted widgets. Wires up git action callbacks and delegates rendering to
WorkspaceWidget,ChangesWidget,McpServersWidget, andProcessesWidget.src/features/chat/ui/widgets/Widget.tsx
Extracted the shared widget chrome (header bar with icon/title/action, content area) into a reusable component.
src/features/chat/ui/widgets/WorkspaceWidget.tsx
The main workspace widget — shows project info, the working context picker, action buttons, and handles the non-git/loading/error states.
src/features/chat/ui/widgets/WorkingContextPicker.tsx
Popover-based picker for switching between worktrees and branches. Handles dirty-state conflicts with a stash-or-carry dialog. Routes branch switches to the correct worktree path.
src/features/chat/ui/widgets/WorkspaceActionsMenu.tsx
Inline action bar with split-button for create (branch/worktree) and ghost buttons for fetch/pull. Shows incoming commit count on the pull button.
src/features/chat/ui/widgets/WorkspaceCreateDialog.tsx
Dialog for creating branches or worktrees. Syncs worktree name to branch name, shows path preview, supports both new-branch and existing-branch modes for worktrees.
src/features/chat/ui/widgets/formatError.ts
Shared error formatting utility extracted from the two widget files that needed it.
src/features/chat/ui/widgets/ChangesWidget.tsx, McpServersWidget.tsx, ProcessesWidget.tsx
Placeholder widgets for future changes, MCP servers, and processes panels.
src/shared/i18n/locales/en/chat.json, es/chat.json
Added translation keys for all new UI strings (picker, dialogs, git actions, create forms).
src/features/chat/ui/tests/ContextPanel.test.tsx
Comprehensive tests for the workspace widget: picker rendering, branch switching, worktree creation, dirty-state dialogs, and action button behavior.
scripts/check-file-sizes.mjs
Added scoped exception for the test file (550 lines).
Reproduction Steps