Skip to content

Conversation

@phodal
Copy link
Owner

@phodal phodal commented Nov 30, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Redesigned IDE plugin UI with agent-based architecture replacing legacy chat interface
    • Added code review integration with commit history and AI-assisted analysis
    • Introduced enhanced input handling with toolbar actions (@mention, settings, send/stop controls)
    • Added timeline-based chat with support for tool calls, errors, and task tracking
    • Implemented token counting and workspace indicators
  • Bug Fixes

    • Improved document handling with proper read action wrapping
    • Fixed cross-platform file path handling
    • Resolved dependency conflicts in plugin build
  • Documentation

    • Added IntelliJ IDEA plugin build and test documentation

✏️ Tip: You can customize this high-level summary in your review settings.

- Add IdeaAgentApp.kt with Compose UI for chat interface
- Add IdeaAgentViewModel.kt for managing agent state and messages
- Add IdeaAgentToolWindowFactory.kt for ToolWindow creation
- Add AgentType, ChatMessage, LLMConfig models
- Register AutoDev Agent ToolWindow in plugin.xml
- Fix CoroutineScopeHolder to avoid classloader conflicts
- Use compileOnly for kotlinx/ktor deps to use platform versions

Features:
- Tab-based navigation: Agentic, Review, Knowledge, Remote
- Chat interface with message bubbles
- Streaming output support
- LLM configuration support (placeholder)
- CoroutineScopeHolder: implement Disposable to cancel parentJob on project disposal
- IdeaAgentViewModel: preserve partial streaming output on abort
- IdeaAgentApp: simplify AgentTab structure by removing nested Box
- build.gradle.kts: extract mppVersion variable to avoid duplication
- DomainDictAgent: normalize path separators and skip empty package paths
feat(mpp-idea): add Agent ToolWindow with tab-based navigation
…s-platform consistency

- Remove duplicate AgentType.kt and LLMConfig.kt from mpp-idea
- Use cc.unitmesh.agent.AgentType from mpp-core
- Use ConfigManager from mpp-ui for LLM configuration (~/.autodev/config.yaml)
- Update IdeaAgentViewModel to load config via ConfigManager.load()
- Update IdeaAgentApp to use AgentType.getDisplayName()
- Add jogamp and other required repositories for mpp-ui dependencies
- Configure dependency substitution for mpp-ui-jvm and mpp-core-jvm targets
…licts

Exclude all Compose and UI library dependencies from mpp-ui and mpp-core
to prevent ClassCastException caused by duplicate Compose Runtime classes
loaded from different classloaders (plugin vs IntelliJ bundled).

Excluded dependencies:
- org.jetbrains.compose.* (runtime, foundation, material3, ui, desktop, etc.)
- org.jetbrains.skiko
- io.github.kevinnzou (webview/KCEF)
- dev.datlag (jcef)
- com.mohamedrejeb.richeditor
- cafe.adriel.bonsai
- com.mikepenz (markdown renderer)
- org.jetbrains.jediterm, org.jetbrains.pty4j
- io.github.vinceglb (filekit)
…task

- Exclude kotlinx-serialization-json-io and kotlinx-io-core modules
- Add verifyNoDuplicateDependencies task to detect classloader conflicts
- Task runs automatically before build to catch issues early
- Validates that no Compose/Kotlinx dependencies are included
…ecution

- Create JewelRenderer implementing CodingAgentRenderer with StateFlow
- Refactor IdeaAgentViewModel to use CodingAgent instead of simulated responses
- Update IdeaAgentApp to display timeline-based agent output
- Add UI components for tool calls, errors, and task completion
- Remove obsolete ChatMessage model (replaced by JewelRenderer.TimelineItem)

The IDEA plugin now uses the same CodingAgent as CLI and Desktop apps,
ensuring consistent behavior across all platforms.
Delete AutoDev Compose tool window and related classes to streamline tool window offerings and reduce redundancy.
refactor(mpp-idea): use mpp-ui's ConfigManager and AgentType for cross-platform consistency
…n system

- Replace Color(0xFF4CAF50) with AutoDevColors.Green.c400 for success status
- Replace Color(0xFFF44336) with AutoDevColors.Red.c400 for error status
- Use .copy(alpha = 0.2f) for background colors instead of hardcoded alpha
- Remove unused Color import

This ensures cross-platform color consistency by using the design system
tokens from mpp-ui instead of hardcoded hex values.
refactor(mpp-idea): replace hardcoded colors with AutoDevColors design system
- JewelRenderer: Add TaskInfo/TaskStatus for task-boundary tool support,
  TerminalOutputItem for shell commands, improved token tracking,
  forceStop() method, and tool call formatting helpers

- IdeaAgentViewModel: Add MCP server preloading, tool loading status,
  builtin commands (/clear, /help, /status), executeTask/cancelTask
  methods, and ToolLoadingStatus data class

- IdeaAgentApp: Add ToolLoadingStatusBar, ToolStatusChip,
  TerminalOutputBubble components for enhanced UI

- Add unit tests for JewelRenderer and IdeaAgentViewModel

Aligned with mpp-ui's CodingAgentViewModel for feature parity.
- Fix _currentToolCall null bug by capturing value before clearing
- Replace hardcoded colors with AutoDevColors design tokens
- Make toolStatus reactive to mcpPreloadingStatus changes
- Handle builtin commands (/clear, /help, /status) before config check
- Add 60s timeout to MCP preloading loop to prevent infinite loop
- Improve forceStop test assertion with explicit message verification
- Add mpp-idea build instructions to AGENTS.md
- Add IdeaCodeReviewModels.kt with data models (IdeaCodeReviewState, IdeaCommitInfo, IdeaDiffFileInfo, IdeaAIAnalysisProgress, IdeaAnalysisStage)
- Add IdeaCodeReviewViewModel.kt with git operations using GitOperations (JVM) and CodeReviewAgent integration
- Add IdeaCodeReviewContent.kt with three-panel Jewel UI (commit list, diff viewer, AI analysis panel)
- Integrate Code Review tab in IdeaAgentApp.kt
- Update IdeaAgentToolWindowFactory.kt to pass project and coroutineScope
- Add JUnit 4 runtime dependency required by IntelliJ Platform test infrastructure
- Temporarily disable IdeaAgentViewModelTest (requires full IntelliJ Platform setup)
- Remove testFramework(TestFrameworkType.Platform) to avoid JUnit conflicts
- JewelRendererTest now runs successfully with JUnit 5
- Add IdeaInputListener interface for input events
- Add IdeaDevInInput with EditorTextField and DevIn language support
- Add IdeaBottomToolbar with Jewel-based send/stop/@/settings buttons
- Add IdeaInputSection combining input with toolbar
- Update IdeaAgentApp to use new IdeaInputSection

Features:
- Multi-line text input with Enter to send, Shift+Enter for newline
- DevIn language syntax highlighting and completion
- LookupManager integration for completion popup handling
- Workspace path and token count display
- Replace pure Compose IdeaInputSection with SwingPanel-embedded IdeaDevInInput
- DevInInputArea now embeds EditorTextField for full DevIn language support
- Add text change listener to IdeaDevInInput for Compose state sync
- Combine SwingPanel editor with Compose bottom toolbar

This enables IntelliJ native completion popup and DevIn syntax highlighting.
- Fix memory leak by storing and properly disposing internal DocumentListener
- Fix recreateDocument to use EditorFactory instead of FileDocumentManager
- Re-attach listeners when document is recreated
- Fix Windows path handling in project name extraction
- Remove unused imports (Color, java.util.*)
- Extract duplicate send logic to avoid code duplication
- Remove redundant text assignment in clearInput()

Addresses review comments from PR #7
…jis with icons

- Fix ClassCastException in AnalysisAgent by validating SubAgent input before creating invocation
- Fix duplicate key error in LazyColumn by adding unique ID to TimelineItem
- Replace all emojis with Material Design icons from AutoDevComposeIcons
  - Tool icon (Build)
  - Error icon (Error)
  - Success/Failure icons (CheckCircle/Error)
  - Settings icon (Settings)
- Remove emoji from recovery advice and confirmation messages

Fixes:
- java.lang.ClassCastException: LinkedHashMap cannot be cast to ContentHandlerContext
- IllegalArgumentException: Key was already used in LazyColumn
feat(mpp-idea): add advanced DevIn input components with SwingPanel integration
@phodal phodal merged commit 8c6d995 into phodal:master Nov 30, 2025
3 of 4 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR comprehensively refactors the mpp-idea IntelliJ plugin, replacing a basic Compose chat interface with a multi-agent system featuring tabbed agent types, timeline-based rendering, code review integration, and enhanced build configuration with dependency conflict verification.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Added section describing mpp-idea as a standalone Gradle project with includeBuild, including build, test, and compilation commands.
Core Logic
core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInput.kt
Changed document creation to use EditorFactory with ReadAction wrapping instead of file-based retrieval, removing null-document fallback.
Agent Tool Orchestration
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/orchestrator/ToolOrchestrator.kt
Added specialized execution path for SubAgent tools with input validation via SubAgent.validateInput(params) before invocation.
Cross-Platform Path Handling
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/subagent/DomainDictAgent.kt
Normalized Windows backslashes to forward slashes in path extraction; added guard to skip empty package paths during file ranking.
Build Configuration & Dependency Management
mpp-idea/build.gradle.kts
Centralized version via mppVersion variable; introduced verifyNoDuplicateDependencies task to detect conflicting libraries; added extensive dependency exclusions for mpp-ui-jvm and mpp-core-jvm; added JUnit 5 test framework; wired verification task into build lifecycle.
Gradle Settings & Project Structure
mpp-idea/settings.gradle.kts
Enabled typesafe project accessors; declared plugin management with explicit versions (Kotlin 2.1.20, IntelliJ Platform 2.10.2); added includeBuild with dependency substitution for local mpp-ui and mpp-core projects.
UI Component Layer
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaBottomToolbar.kt, IdeaDevInInput.kt, IdeaInputListener.kt, IdeaInputSection.kt
Added new composable and stateful input components: IdeaBottomToolbar for action controls, IdeaDevInInput as a customizable editor field with document lifecycle management, IdeaInputListener interface for event handling, and IdeaInputSection composable combining input with toolbar.
Rendering State Management
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/JewelRenderer.kt
New comprehensive renderer managing timeline items (messages, tool calls, errors, task completions, terminal outputs), streaming output, execution state, token tracking, and task boundaries via StateFlow-backed observables.
Service Layer
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/services/CoroutineScopeHolder.kt
Refactored to accept Project parameter and implement Disposable; manages project-scoped CoroutineScope with parent SupervisorJob for proper lifecycle and child scope creation.
Removed Chat UI
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatApp.kt, AutoDevChatViewModel.kt, AutoDevToolWindowFactory.kt
Deleted entire Compose chat UI module including state management, message handling, and tool window factory integration.
New Agent UI
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt, IdeaAgentToolWindowFactory.kt, IdeaAgentViewModel.kt
Introduced multi-agent UI with tabbed agent types (Coding, Code Review, Knowledge, Remote), integrated timeline rendering, tool loading status, and task execution; new factory and view model handling agent initialization and lifecycle.
Code Review Feature
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/codereview/IdeaCodeReviewContent.kt, IdeaCodeReviewModels.kt, IdeaCodeReviewViewModel.kt
New code review module with UI component for displaying commits, diffs, and AI analysis progress; data models for review state and analysis stages; view model coordinating Git operations and CodeReviewAgent execution.
Plugin Configuration
mpp-idea/src/main/resources/META-INF/plugin.xml
Updated toolWindow declaration to use IdeaAgentToolWindowFactory with id "AutoDev Agent" (replaced AutoDevToolWindowFactory/"AutoDev Compose").
Test Coverage
mpp-idea/src/test/kotlin/cc/unitmesh/devins/idea/renderer/JewelRendererTest.kt, IdeaAgentViewModelTest.kt
Added comprehensive tests for JewelRenderer state transitions and timeline management; placeholder test file for IdeaAgentViewModel (fully commented pending IntelliJ Platform setup).

Sequence Diagram

sequenceDiagram
    participant User
    participant IdeaInputSection as IdeaInputSection<br/>(UI)
    participant IdeaAgentVM as IdeaAgentViewModel<br/>(Orchestrator)
    participant KoogLLM as KoogLLMService<br/>(LLM)
    participant CodingAgent as CodingAgent<br/>(Agent)
    participant ToolOrch as ToolOrchestrator<br/>(Tool Exec)
    participant JewelRenderer as JewelRenderer<br/>(State)
    participant UI as IdeaAgentApp<br/>(Render)

    rect rgb(200, 230, 255)
        Note over User,UI: Task Submission Phase
        User->>IdeaInputSection: Enter task text + Send
        IdeaInputSection->>IdeaAgentVM: sendMessage(content) / executeTask()
    end

    rect rgb(200, 255, 220)
        Note over IdeaAgentVM,CodingAgent: Initialization Phase
        IdeaAgentVM->>IdeaAgentVM: initializeCodingAgent()
        IdeaAgentVM->>KoogLLM: Create LLM service
        IdeaAgentVM->>CodingAgent: Construct with renderer, LLM, tools
    end

    rect rgb(255, 240, 200)
        Note over CodingAgent,JewelRenderer: Execution & Rendering Phase
        CodingAgent->>JewelRenderer: addUserMessage(content)
        activate JewelRenderer
        JewelRenderer->>JewelRenderer: Update timeline + UI state
        deactivate JewelRenderer
        
        CodingAgent->>KoogLLM: Request LLM response (streaming)
        activate KoogLLM
        loop Streaming chunks
            KoogLLM-->>JewelRenderer: renderLLMResponseChunk(text)
            JewelRenderer->>JewelRenderer: Update currentStreamingOutput
            JewelRenderer-->>UI: State change (StateFlow)
            UI->>User: Live text updates
        end
        KoogLLM-->>JewelRenderer: renderLLMResponseEnd()
        deactivate KoogLLM
    end

    rect rgb(255, 220, 220)
        Note over CodingAgent,ToolOrch: Tool Execution Phase
        CodingAgent->>ToolOrch: execute(tool, params)
        alt SubAgent Tool
            ToolOrch->>ToolOrch: validateInput(params)
            ToolOrch->>ToolOrch: createInvocation(validated)
        else Other Tool
            ToolOrch->>ToolOrch: cast to ExecutableTool
            ToolOrch->>ToolOrch: createInvocation(params)
        end
        ToolOrch-->>ToolOrch: Execute & return result
        CodingAgent->>JewelRenderer: renderToolCall(toolName, params)
        JewelRenderer->>JewelRenderer: Add ToolCallItem to timeline
        CodingAgent->>JewelRenderer: renderToolResult(result)
        JewelRenderer->>JewelRenderer: Update last ToolCallItem / Add output
    end

    rect rgb(220, 240, 255)
        Note over CodingAgent,JewelRenderer: Completion Phase
        CodingAgent->>JewelRenderer: renderFinalResult() / renderTaskComplete()
        JewelRenderer->>JewelRenderer: Update taskCompleted flag
        JewelRenderer-->>UI: Final state via StateFlow
        UI->>User: Display final result + enable input
    end
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120+ minutes

Areas requiring extra attention:

  • mpp-idea/build.gradle.kts: Complex dependency management with extensive exclusion blocks; verify that verifyNoDuplicateDependencies task correctly identifies conflicts and doesn't introduce false positives or negatives.
  • mpp-idea/settings.gradle.kts: Dependency substitution logic via includeBuild with project substitution mappings; ensure local project paths are resolved correctly and that remote fallbacks work as intended.
  • JewelRenderer.kt: Large, stateful class managing timeline, task state, and streaming output; validate StateFlow updates are thread-safe and that state transitions (task-boundary detection, iteration tracking, token accounting) are correct.
  • IdeaAgentViewModel.kt: Orchestrates task execution, agent initialization, LLM service integration, and coroutine lifecycle; verify cancelTask/abortRequest properly clean up resources and that config reloading doesn't cause race conditions.
  • IdeaInputSection.kt & IdeaDevInInput.kt: Editor lifecycle, document recreation, and listener management; ensure no memory leaks from dangling listeners or editor references.
  • UI Composition (IdeaAgentApp.kt, IdeaCodeReviewContent.kt): Large composables with complex state observation and rendering logic; validate LazyColumn/scroll-to-bottom behavior and that re-compositions don't cause unnecessary refreshes.
  • Migration completeness: Verify that removal of AutoDevChatApp, AutoDevChatViewModel, and AutoDevToolWindowFactory didn't leave orphaned references or missed integration points elsewhere in the codebase.
  • Gradle & Plugin Configuration (plugin.xml): Confirm plugin.xml toolWindow id change is reflected in all runtime references and that new test framework configuration doesn't break existing CI/CD pipelines.

Possibly related PRs

Poem

🐰 With agent tabs now gleaming bright and new,
Our plugin dons a coat of multi-hued,
Timelines bloom where chats once sang,
Code reviews dance where Compose' bells rang—
The warren celebrates with timeline cheer!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7eeeae and ec45f40.

📒 Files selected for processing (24)
  • AGENTS.md (1 hunks)
  • core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInput.kt (2 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/orchestrator/ToolOrchestrator.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/subagent/DomainDictAgent.kt (2 hunks)
  • mpp-idea/build.gradle.kts (4 hunks)
  • mpp-idea/settings.gradle.kts (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaBottomToolbar.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaDevInInput.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaInputListener.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaInputSection.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/JewelRenderer.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/services/CoroutineScopeHolder.kt (2 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatApp.kt (0 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatViewModel.kt (0 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevToolWindowFactory.kt (0 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentToolWindowFactory.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentViewModel.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/codereview/IdeaCodeReviewContent.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/codereview/IdeaCodeReviewModels.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/codereview/IdeaCodeReviewViewModel.kt (1 hunks)
  • mpp-idea/src/main/resources/META-INF/plugin.xml (1 hunks)
  • mpp-idea/src/test/kotlin/cc/unitmesh/devins/idea/renderer/JewelRendererTest.kt (1 hunks)
  • mpp-idea/src/test/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentViewModelTest.kt (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

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