Skip to content

Conversation

@stefandevo
Copy link
Collaborator

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:

Platform Terminals
macOS System Terminal, iTerm2, Warp, Ghostty, Rio, Alacritty, WezTerm, Kitty, Hyper, Tabby
Windows Windows Terminal, PowerShell, Command Prompt, Git Bash, Alacritty, WezTerm
Linux GNOME Terminal, Konsole, XFCE4 Terminal, Tilix, Terminator, Kitty, Alacritty, WezTerm, Hyper, Tabby, XTerm, Foot

2. Worktree Dropdown Integration

  • Split-button pattern for "Open in Terminal" action
  • Primary click opens in default terminal (integrated or external)
  • Submenu shows all available options:
    • Integrated terminal with New Tab / Split options
    • All detected external terminals

3. Settings

Two new settings in Settings > Terminal:

  • Default External Terminal: Choose which terminal opens by default
  • Default Open Mode: Choose whether integrated terminal opens in new tab or splits current tab

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

File Description
libs/types/src/terminal.ts TerminalInfo type definition
libs/platform/src/terminal.ts Terminal detection & launching (~500 lines)
apps/ui/src/components/icons/terminal-icons.tsx SVG icons for 15+ terminals
apps/ui/src/components/views/board-view/worktree-panel/hooks/use-available-terminals.ts React hooks for terminal state

Modified Files

File Changes
apps/server/src/routes/worktree/routes/open-in-terminal.ts Added 4 new API handlers
apps/server/src/routes/worktree/index.ts Registered new routes
apps/ui/src/components/views/board-view/worktree-panel/components/worktree-actions-dropdown.tsx Terminal submenu UI
apps/ui/src/components/views/settings-view/terminal/terminal-section.tsx Settings UI for terminal preferences
apps/ui/src/store/app-store.ts Added branchName to terminal layout, openTerminalMode setting
apps/ui/src/hooks/use-settings-sync.ts Sync openTerminalMode setting

API Endpoints

Method Endpoint Description
GET /api/worktree/available-terminals List all detected external terminals
GET /api/worktree/default-terminal Get the default external terminal
POST /api/worktree/refresh-terminals Clear cache and re-detect terminals
POST /api/worktree/open-in-external-terminal Open directory in external terminal

How It Works

  1. Detection: On first request, detectAllTerminals() scans for available terminals using:

    • CLI command lookup (which/where)
    • macOS app bundle check (/Applications, /System/Applications, ~/Applications)
    • Windows path checks for common locations
    • Results cached for 5 minutes
  2. Opening: When user selects a terminal:

    • Integrated: Navigates to /terminal with cwd, branch, and mode params
    • External: Calls openInExternalTerminal() which uses platform-specific methods (AppleScript for macOS, start for Windows, direct execution for Linux)

Testing

  1. Open a project with worktrees
  2. Click the dropdown on any worktree
  3. Hover over "Open in Terminal" to see submenu
  4. Test integrated terminal (New Tab / Split options)
  5. Test external terminals (should open in correct directory)
  6. Go to Settings > Terminal to configure defaults

Shironex and others added 7 commits January 17, 2026 20:03
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
@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • External Terminal Support: Introduced comprehensive cross-platform detection and launching capabilities for over 20 external terminal applications, including iTerm2, Warp, Windows Terminal, GNOME Terminal, and more. Users can now open worktree directories in their preferred external terminal.
  • Enhanced Worktree Dropdown Integration: The 'Open in Terminal' action in the worktree dropdown now features a split-button pattern. A primary click opens the worktree in the default terminal (integrated or external), while a submenu provides options for the integrated terminal (new tab/split) and all detected external terminals.
  • New Terminal Settings: Two new settings have been added under 'Settings > Terminal': 'Default External Terminal' allows users to select their preferred external terminal, and 'Default Open Mode' configures whether the integrated terminal opens in a new tab or splits the current tab.
  • Branch Name Display in Integrated Terminal: When opening an integrated terminal from a worktree, the branch name is now displayed in the terminal panel header alongside the shell name, providing immediate context.
  • New API Endpoints and Detection Logic: Added several new API endpoints for managing terminals, including fetching available terminals, getting the default terminal, refreshing the terminal cache, and opening external terminals. The backend now includes robust, platform-specific logic for terminal detection and launching, with results cached for performance.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.
@webdevcody webdevcody deleted the branch AutoMaker-Org:v0.12.0rc January 17, 2026 23:51
@webdevcody webdevcody closed this Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants