CommandMate icon indicating copy to clipboard operation
CommandMate copied to clipboard

feat(agents): Agentタブで別名インスタンス管理UI+ヘッダー/ターミナルのalias表示

Open Kewton opened this issue 5 months ago • 0 comments

Epic: #866 依存: #866 (B) 複数セッション基盤

目的

アクティビティバーの Agentタブで別名(alias)インスタンスを管理し、登録した別名でこれまで通り(ヘッダー・ターミナル)使えるようにする。

対応方針

Agentタブ(AgentSettingsPane)

  • 現状の「CLIツールごとのチェックボックス」(AgentSettingsPane.tsx:302-331)を、インスタンス管理リストへ変更:
    • 「+ インスタンス追加」→ ベースCLIツール選択 → 別名入力。
    • 既存インスタンスのリネーム・削除・並べ替え(drag&drop、既存 #786 の仕組みを流用)。
    • 上限 MAX_AGENT_INSTANCES = 10、最小1。
    • 保存は PATCH /api/worktrees/[id](agentInstances)。

表示層(alias 反映)

  • ヘッダーのエージェントバッジ(WorktreeDetailHeader.tsx:106)を alias 表示に。
  • ターミナルのエージェントタブ(WorktreeDetailSubComponents.tsx:619-666)と Split の CLI セレクタ(TerminalSplitPane.tsx:184-201)のラベルを alias に。セレクタはインスタンス一覧を提示。
  • getCliToolDisplayName() を alias 優先に拡張(または getInstanceLabel(instance) 新設)。
  • アクティブ選択を activeCliTab-<wt> → activeInstanceId-<wt>(useWorktreeDetailController.ts:68,206-221)へ。
  • モバイルの独立選択(useMobileSelectedAgents)との整合も確認。

受け入れ条件

  • [ ] Agentタブで別名インスタンスを追加/リネーム/削除/並べ替えできる。
  • [ ] 同一CLIツールの複数インスタンス(例 Claude×2)を別名で登録・利用できる。
  • [ ] ヘッダー・ターミナルタブ・セレクタに alias が表示される。
  • [ ] アクティブインスタンスが worktree ごとに永続化される。
  • [ ] 上限10・最小1のバリデーション。
  • [ ] lint/tsc/test:unit/build 通過。

影響ファイル(主)

  • src/components/worktree/AgentSettingsPane.tsx
  • src/components/worktree/WorktreeDetailHeader.tsx, WorktreeDetailSubComponents.tsx, TerminalSplitPane.tsx
  • src/hooks/useWorktreeDetailController.ts, src/hooks/useMobileSelectedAgents.ts
  • src/lib/cli-tools/types.ts(label 解決), src/app/api/worktrees/[id]/route.ts(agentInstances 検証)

Kewton avatar Jun 13 '26 04:06 Kewton