ClaudeMods
☰
ZH-CN
● 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.

更多类似作品