-
Notifications
You must be signed in to change notification settings - Fork 482
feat: add external terminal support with cross-platform detection #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add external terminal support with cross-platform detection #561
Conversation
Add utility function to open a terminal in a specified directory: - macOS: Uses Terminal.app via AppleScript - Windows: Tries Windows Terminal, falls back to cmd - Linux: Tries common terminal emulators (gnome-terminal, konsole, xfce4-terminal, xterm, x-terminal-emulator) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add POST /open-in-terminal endpoint to open a system terminal in the worktree directory using the cross-platform openInTerminal utility. The endpoint validates that worktreePath is provided and is an absolute path for security. Extracted from PR AutoMaker-Org#558.
Add "Open in Terminal" option to the worktree actions dropdown menu. This opens the system terminal in the worktree directory. Changes: - Add openInTerminal method to http-api-client - Add Terminal icon and menu item to worktree-actions-dropdown - Add onOpenInTerminal prop to WorktreeTab component - Add handleOpenInTerminal handler to use-worktree-actions hook - Wire up handler in worktree-panel for both mobile and desktop views Extracted from PR AutoMaker-Org#558.
Instead of opening the system terminal, the "Open in Terminal" action now opens Automaker's built-in terminal with the worktree directory: - Add pendingTerminalCwd state to app store - Update use-worktree-actions to set pending cwd and navigate to /terminal - Add effect in terminal-view to create session with pending cwd This matches the original PR AutoMaker-Org#558 behavior.
Add a setting to choose how "Open in Terminal" behaves:
- New Tab: Creates a new tab named after the branch (default)
- Split: Adds to current tab as a split view
Changes:
- Add openTerminalMode setting to terminal state ('newTab' | 'split')
- Update terminal-view to respect the setting
- Add UI in Terminal Settings to toggle the behavior
- Rename pendingTerminalCwd to pendingTerminal with branch name
The new tab mode names tabs after the branch for easy identification.
The split mode is useful for comparing terminals side by side.
- Move branch name display from tab name to terminal header - Show full branch name (no truncation) with GitBranch icon - Display branch name for both 'new tab' and 'split' modes - Persist openTerminalMode setting to server and include in import/export - Update settings dropdown to simplified "New Tab" label
Add support for opening worktree directories in external terminals (iTerm2, Warp, Ghostty, System Terminal, etc.) while retaining the integrated terminal as the default option. Changes: - Add terminal detection for macOS, Windows, and Linux - Add "Open in Terminal" split-button in worktree dropdown - Add external terminal selection in Settings > Terminal - Add default open mode setting (new tab vs split) - Display branch name in terminal panel header - Support 20+ terminals across platforms Part of AutoMaker-Org#558, Closes AutoMaker-Org#550
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @stefandevo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the application's terminal integration by introducing robust support for external terminal applications across macOS, Windows, and Linux. It enhances the user experience by providing flexible options for opening worktree directories, configurable default behaviors, and improved contextual information within the integrated terminal. The changes aim to streamline developer workflows by allowing seamless interaction with a wider range of terminal environments. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant and well-structured feature for external terminal support. The cross-platform detection is comprehensive, and the integration into the UI is thoughtfully designed with the split-button pattern. The backend API is clean and the new settings provide good user control. I've identified a few areas for improvement, mainly concerning code consistency, a potential bug in path escaping on macOS, and another bug related to re-opening terminals. I've also noted some apparently unused code that could be cleaned up. Overall, this is a great addition to the application.
- Add nonce parameter to terminal navigation to allow reopening same worktree multiple times - Fix shell path escaping in editor.ts using single-quote wrapper - Add validatePathParams middleware to open-in-external-terminal route - Remove redundant validation block from createOpenInExternalTerminalHandler - Remove unused pendingTerminal state and setPendingTerminal action - Remove unused getTerminalInfo function from editor.ts
Add data-testid with sanitized project name for E2E test assertions.
The testid format is 'project-switcher-project-{name}' where name is
the lowercased project name with spaces replaced by hyphens.
This fixes E2E tests that expect to find projects by name in the
project switcher.
Summary
Adds support for opening worktree directories in external terminals (iTerm2, Warp, Ghostty, Windows Terminal, etc.) while retaining Automaker's integrated terminal as the default option.
Related:
Features
1. External Terminal Detection
Cross-platform terminal detection supporting 20+ terminals:
2. Worktree Dropdown Integration
3. Settings
Two new settings in Settings > Terminal:
4. Branch Name Display
When opening a terminal from a worktree, the branch name is displayed in the terminal panel header next to the shell name (e.g., "zsh feature/my-branch").
File Structure
New Files
libs/types/src/terminal.tsTerminalInfotype definitionlibs/platform/src/terminal.tsapps/ui/src/components/icons/terminal-icons.tsxapps/ui/src/components/views/board-view/worktree-panel/hooks/use-available-terminals.tsModified Files
apps/server/src/routes/worktree/routes/open-in-terminal.tsapps/server/src/routes/worktree/index.tsapps/ui/src/components/views/board-view/worktree-panel/components/worktree-actions-dropdown.tsxapps/ui/src/components/views/settings-view/terminal/terminal-section.tsxapps/ui/src/store/app-store.tsbranchNameto terminal layout,openTerminalModesettingapps/ui/src/hooks/use-settings-sync.tsopenTerminalModesettingAPI Endpoints
GET/api/worktree/available-terminalsGET/api/worktree/default-terminalPOST/api/worktree/refresh-terminalsPOST/api/worktree/open-in-external-terminalHow It Works
Detection: On first request,
detectAllTerminals()scans for available terminals using:which/where)/Applications,/System/Applications,~/Applications)Opening: When user selects a terminal:
/terminalwithcwd,branch, andmodeparamsopenInExternalTerminal()which uses platform-specific methods (AppleScript for macOS,startfor Windows, direct execution for Linux)Testing