Skip to content

feat(368): add Gemini/vibe-local CLI support and fix prompt detection#369

Merged
Kewton merged 16 commits intodevelopfrom
feature/368-worktree
Feb 26, 2026
Merged

feat(368): add Gemini/vibe-local CLI support and fix prompt detection#369
Kewton merged 16 commits intodevelopfrom
feature/368-worktree

Conversation

@Kewton
Copy link
Owner

@Kewton Kewton commented Feb 26, 2026

Summary

  • Gemini CLI / vibe-local CLI をCLIツール抽象化層に追加(Strategy パターン)
  • エージェント選択UI(Agent Settings Pane)を追加し、worktree毎に使用CLIツールを選択可能に
  • Gemini CLIのボックス罫線文字(╭╮╰╯│─)によるプロンプト検出失敗を修正(stripBoxDrawing()を全detectPrompt()呼び出し箇所に適用)
  • response-poller.tssetIntervalsetTimeoutチェーン変換でレースコンディション修正
  • プロンプトポップアップのヘッダーにCLIツール名を動的表示(「Geminiからの確認」等)

Changes

New Features

  • Gemini CLI / vibe-local CLI ツール実装(src/lib/cli-tools/gemini.ts, vibe-local.ts
  • Agent Settings UI(src/components/worktree/AgentSettingsPane.tsx
  • Ollama モデル選択対応
  • CMATE スケジュール実行のGemini/vibe-local対応

Bug Fixes

  • stripBoxDrawing() を全 detectPrompt() 呼び出し箇所に適用(status-detector, current-output, prompt-response, auto-yes-manager, response-poller)
  • response-poller.ts のレースコンディション修正(setIntervalsetTimeout チェーン)
  • Gemini trust folder ダイアログ自動処理
  • プロンプトポップアップのCLIツール名動的表示(i18n対応)

Security

  • worktree patch バリデーション強化
  • エージェント設定同期のセキュリティ強化

Test plan

  • npx tsc --noEmit パス
  • npm run lint パス
  • npm run test:unit パス
  • npm run build パス
  • Gemini CLIセッションでプロンプトが status: pending を維持し、Web UIにポップアップ表示されること
  • ポップアップヘッダーが「Geminiからの確認」と表示されること
  • Agent Settings UIで2ツールまで選択可能なこと

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Kewton and others added 16 commits February 25, 2026 12:15
…ration, API, vibe-local

- Add selected-agents-validator.ts with parseSelectedAgents(), validateSelectedAgentsInput(),
  and validateAgentsPair() core functions (R1-001 shared validation)
- Add getCliToolDisplayName() and CLI_TOOL_DISPLAY_NAMES to cli-tools/types.ts
- Add 'vibe-local' to CLI_TOOL_IDS (4th tool)
- Add VibeLocalTool stub class in cli-tools/vibe-local.ts
- Register VibeLocalTool in CLIToolManager
- Add DB migration v18: selected_agents column with cli_tool_id-aware defaults
- Update getWorktreeById/getWorktrees to include selectedAgents field
- Add updateSelectedAgents() DB function
- Extend GET /api/worktrees/:id with selectedAgents in response
- Extend PATCH /api/worktrees/:id with selectedAgents update + cli_tool_id auto-sync
- Add isValidWorktreeId check to GET/PATCH handlers (R4-002)
- Use CLI_TOOL_IDS instead of hardcoded arrays in API routes (R1-003)
- Remove SQL IN clause from getLastMessagesByCliBatch (R4-001)
- Update types: sessionStatusByCli/lastMessagesByCli to Partial<Record<CLIToolType,...>>
- Update SidebarBranchItem.cliStatus to Partial<Record<CLIToolType, BranchStatus>>
- Fix BranchListItem.tsx with optional chaining for cliStatus
- Update api-client.ts to use CLIToolType instead of hardcoded union
- Fix all existing tests for 4-tool count (manager, types, session-cleanup, db-migrations)
- Add 30 new tests: selected-agents-validator (23) + display-name (7)
- All 3982 tests pass, 0 TypeScript errors, 0 ESLint errors

Refs #368

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace hardcoded claude/codex in toBranchItem() with dynamic
  selectedAgents lookup (sidebar.ts)
- Remove non-null assertions (!) in PATCH route by extracting
  validatedAgents variable with type assertion (route.ts)
- Update JSDoc comments to include vibe-local in CLI tool enumerations
  (types.ts, manager.ts, models.ts)
- Add 2 new sidebar tests for selectedAgents-based cliStatus behavior

Quality Metrics:
- Tests: 3982 -> 3984 (2 new sidebar tests)
- TypeScript errors: 0
- ESLint errors: 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive design documentation and review artifacts for
the Agent settings tab feature (Issue #368).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… removal

- Create AgentSettingsPane component with checkbox UI (max 2 selection)
- Extend NotesAndLogsPane with 'agent' sub-tab for Agent settings
- Replace hardcoded ['claude','codex'] arrays in WorktreeDetailRefactored
  with dynamic selectedAgents state from API
- Replace capitalizeFirst() with centralized getCliToolDisplayName()
- Add selectedAgents state synced from API, with useEffect for activeCliTab sync
- Replace hardcoded CLI tool arrays in 7 API routes with CLI_TOOL_IDS
- Replace custom display name functions in MessageList.tsx and AutoYesToggle.tsx
  with getCliToolDisplayName()
- Add i18n keys for Agent tab (en/ja)
- All 4001 unit tests pass, 0 TypeScript errors, 0 ESLint errors

Issue #368

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ent settings

Extract isCliToolType() type guard and getCliToolDisplayNameSafe() safe wrapper
to replace unsafe `as CLIToolType` casts in MessageList and AutoYesToggle.
Remove duplicated getToolName()/formatCliToolName() local functions (DRY).
Refactor AgentSettingsPane to use ref pattern for stable callback identity.
Extract NotesAndLogsPane tab buttons into data-driven SUB_TABS array (DRY).

Quality Metrics:
- TypeScript errors: 0
- ESLint errors: 0
- Tests: 4011 passed (10 new tests added)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add AgentSettingsPane, NotesAndLogsPane (with agent tab), WorktreeDetailRefactored entries to CLAUDE.md
- Update cli-tools/types.ts entry with isCliToolType() and getCliToolDisplayNameSafe()
- Add iteration-2 progress report, context files, and results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace non-interactive pipe mode (echo | gemini) with interactive session
- startSession() now launches `gemini` command in tmux (same as Claude/Codex)
- sendMessage() uses sendKeys + Enter instead of pipe
- Update GEMINI_PROMPT_PATTERN to match REPL prompt (> / ❯)
- Add GEMINI_THINKING_PATTERN for braille spinner detection
- Update getCliToolPatterns() with interactive mode patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini CLI shows "Do you trust this folder?" on first launch in a new
directory. Add handleTrustDialog() that polls tmux output and auto-selects
"1. Trust folder" during session initialization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… status display

- Rewrite vibe-local.ts from pipe mode to interactive REPL mode (launch
  `vibe-local -y` in tmux, IME double-Enter for message submission)
- Add VIBE_LOCAL_PROMPT_PATTERN (`ctx:N% ❯`) and VIBE_LOCAL_THINKING_PATTERN
  to cli-patterns.ts with full skipPatterns support
- Add vibe-local to response-poller.ts prompt-based completion detection
- Fix BranchListItem.tsx: replace hardcoded Claude/Codex dots with dynamic
  rendering from selectedAgents (supports all CLI tools including vibe-local)
- Improve Gemini trust dialog timing (6s init, 1s poll, prompt early exit)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add model dropdown in Agent settings that fetches available models from
the local Ollama server and persists the selection per worktree. When
starting a vibe-local session, the selected model is passed via -m flag.

- DB migration v19: add vibe_local_model column to worktrees table
- New API: GET /api/ollama/models (queries Ollama at localhost:11434)
- PATCH /api/worktrees/:id: add vibeLocalModel validation and persistence
- AgentSettingsPane: Ollama model dropdown when vibe-local is checked
- vibe-local.ts: read model from DB and pass -m flag on session start

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend scheduled execution to support gemini and vibe-local CLI tools
in addition to claude and codex. Gemini uses `-p` flag, vibe-local uses
`-p -y` with optional `--model` from worktree DB settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cal support

Add Issue #368 entry to implementation-history (JP/EN), update
architecture.md with new CLI tools and DB columns (JP/EN), and add
Agent Settings section to webapp-guide (JP/EN).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract OLLAMA_MODEL_PATTERN to types.ts for defense-in-depth model
  name validation at point of use (vibe-local.ts) and API route
- Replace direct execAsync tmux calls with sendSpecialKey() in
  gemini.ts and vibe-local.ts, extending SpecialKey type with C-m/Enter
- Add CLI tool ID validation via isCliToolType() in cmate-parser.ts
  to reject invalid tool IDs before DB storage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tection

Gemini CLI wraps Action Required prompts in ╭─╮│╰─╯ borders, which
prevented prompt detection since │ prefix/suffix broke pattern matching.

- Add stripBoxDrawing() utility in cli-patterns.ts to remove box borders
- Apply stripBoxDrawing() after stripAnsi() in response-poller.ts and
  auto-yes-manager.ts prompt detection pipelines
- Add ● (U+25CF) support to DEFAULT_OPTION_PATTERN in prompt-detector.ts
- Add unit tests for stripBoxDrawing() and box-wrapped Gemini prompts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Kewton Kewton merged commit 67f00fc into develop Feb 26, 2026
5 checks passed
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.

1 participant