Skip to content

feat: External CLI Agent Integration (Gemini & Kimi) #536

@phodal

Description

@phodal

Summary

This issue tracks the implementation and future work for External CLI Agent integration, allowing Xiuper to delegate coding tasks to third-party command-line coding agents like Claude Code (claude CLI) and OpenAI Codex (codex CLI).

Implemented Features (c0290d0)

Core Implementation

  • ExternalCliCodingAgent - Wrapper class implementing CodingAgentService
  • GitWorkspaceSnapshot - Git-based workspace change detection
  • JsExternalCliAgent - JavaScript export for Node.js CLI
  • GuiAgentEngine enum - Desktop GUI engine selection

CLI Support (autodev code)

  • --engine <engine> option: autodev, claude, or codex
  • --engine-mode <mode> option: non-interactive or interactive
  • --engine-arg <arg> option: repeatable extra arguments
  • --timeout-ms <ms> option: execution timeout

Compose GUI Support

  • Engine selector dropdown in DevInEditorInput toolbar
  • Dynamic dispatch based on selected engine
  • LLM config bypass for external engines

Files Changed

File Description
mpp-core/.../external/ExternalCliCodingAgent.kt Core agent wrapper
mpp-core/.../external/GitWorkspaceSnapshot.kt Workspace diff via git
mpp-core/.../CodingAgentExports.kt JS bindings
mpp-ui/.../CodingAgentViewModel.kt Engine state & dispatch
mpp-ui/.../CodingAgentPage.kt GUI integration
mpp-ui/.../DevInEditorInput.kt Engine selector UI
mpp-ui/.../TopToolbar.kt Toolbar extension
mpp-ui/.../index.tsx CLI options

Future Work

Phase 2: ACP Protocol Integration

For richer integration with Codex (and potentially other agents), we're exploring the Agent Client Protocol (ACP):

  • Implement ACP client in mpp-ui (Desktop JVM)
  • Support launching local ACP agent servers (stdio)
  • Map ACP session updates to Xiuper's renderer:
    • AgentMessageChunkrenderLLMResponseChunk
    • AgentThoughtChunkrenderThinkingChunk
    • ToolCallUpdaterenderToolCallWithParams
    • PlanUpdaterenderPlanSummary

Design Probe: docs/test-scripts/acp-codex/main.kt

Phase 3: Extended Agent Support

  • Gemini CLI agent integration
  • Custom agent configuration (user-defined CLIs)
  • Per-agent settings in config.yml

Documentation

  • docs/features/external-cli-agent.md - Full feature documentation

Usage Examples

# Claude Code
autodev code -p /path/to/project -t "Add unit tests" --engine claude

# Codex
autodev code -p /path/to/project -t "Refactor database" --engine codex

# With extra args
autodev code -p . -t "Fix bug" --engine claude --engine-arg "--max-tokens" --engine-arg "4096"

Related Resources

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions