ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 brunolca

worktree-terminal

一個 Claude Code mod,會在你或你的代理程式正在使用的 worktree 中開啟終端機。

brunolca@brunolca

brunolca/claude-plugins/tree/main/plugins/worktree-terminal

原貼文圖片1
已翻譯

關於這個 mod

當 Claude 在自己的 git worktree 中執行代理程式(Agent 使用 isolation: "worktree",或使用 EnterWorktree)時,變更會位於 .claude/worktrees/<name>。/term 可直接在那裡開啟 shell:作為 Claude 旁邊的分割窗格、分頁或視窗。它支援 /term、/term list、/term <n>、/term main、/term <name>,以及 --split/--tab/--window 位置覆寫;提示列上方還提供每個 worktree 的按鈕。在 /config 下的設定中,可以選擇終端機應用程式(auto、tmux、zellij、kitty、wezterm、iterm、ghostty、warp、alacritty、gnome-terminal、konsole、terminal、system、custom)、位置和自訂指令。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add brunolca/claude-plugins
claude plugin install worktree-terminal
原文 / README

worktree-terminal

A Claude Code mod that opens a terminal in the worktree you or your agents are working in.

When Claude runs agents in their own git worktrees (Agent with isolation: "worktree", EnterWorktree), their changes live in .claude/worktrees/<name>. /term opens a shell right there: as a split next to Claude, a tab, or a window.

worktree-terminal demo: /term list shows agent worktrees, /term 2 opens a kitty split in one, a button opens the other

Usage

| Command | Opens | | --- | --- | | /term | the session's current directory (the worktree, once Claude entered one) | | /term list | lists every worktree of the repo, agents' marked | | /term <n> / /term main / /term <name> | a worktree by its number, the main one, or part of its folder or branch name | | … --split / --tab / --window | overrides the placement for this call |

While agent worktrees exist, a row above the prompt has one button per worktree.

/term runs at once, even mid-turn.

Settings

In /config, under worktree-terminal:

| Setting | Values | | --- | --- | | Terminal app | auto (default), tmux, zellij, kitty, wezterm, iterm, ghostty, warp, alacritty, gnome-terminal, konsole, terminal, system, custom | | Placement | split (default, right of Claude), tab, window | | Custom command | used with custom: argv split on spaces, {dir} replaced by the path, e.g. foot -D {dir} |

auto reads the environment of the window Claude runs in; a multiplexer (tmux, Zellij) wins over the terminal hosting it.

Terminals

| Terminal | split | tab | window | Needs | | --- | --- | --- | --- | --- | | tmux | ✓ | ✓ | → tab | | | Zellij | ✓ | ✓ | → tab | | | kitty | ✓ | ✓ | ✓ | allow_remote_control yes; listen_on unix:/tmp/kitty recommended; splits layout for a right split | | WezTerm | ✓ | ✓ | ✓ | wezterm on PATH | | iTerm2 | ✓ | ✓ | ✓ | Automation permission for iTerm2 (asked once) | | Warp | → tab | ✓ | ✓ | | | GNOME Terminal | → tab | ✓ | ✓ | | | Konsole | → tab | ✓ | ✓ | | | Ghostty | → window | → window | ✓ | | | Alacritty | → window | → window | ✓ | | | Terminal.app | → window | → window | ✓ | | | anything else | → window | → window | ✓ | open -a Terminal (macOS), x-terminal-emulator (Linux) |

→ is the fallback used when the terminal has no way to open that placement from outside; /term says when it fell back.

Development

claude plugin validate plugins/worktree-terminal
claude plugin test plugins/worktree-terminal
claude --plugin-dir plugins/worktree-terminal   # load from the working copy, hot-reloaded

Adding a terminal: one entry in TERMINALS (hooks/terminals.ts) and one in CASES (tests/terminals.test.ts); a test fails while they disagree.

更多類似作品