Skip to content

Conversation

@phodal
Copy link
Owner

@phodal phodal commented Dec 8, 2025

Summary by CodeRabbit

  • New Features

    • AutoDev 3.0 (Development) now available with expanded platform support: VSCode Extension, Web Version, CLI Tool, Desktop & Android releases.
    • Enhanced tool integration and registration system for improved plugin functionality.
  • Documentation

    • Updated project documentation to distinguish AutoDev 2.0 (Stable) and AutoDev 3.0 (Development) versions with respective platform links.

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

Introduce autodev-core.xml and related plugin XML files to register extension points, actions, and services for the IntelliJ IDEA integration.
…l system

- Add ToolchainFunctionAdapter to wrap ToolchainFunctionProvider as ExecutableTool
- Add IdeaToolProvider to collect all IDEA extension tools
- Register IDEA tools in IdeaAgentViewModel during CodingAgent initialization

Closes #502
Add explicit dependency for ktor-serialization-kotlinx-json in mpp-idea, excluding coroutines and serialization modules to avoid conflicts with IntelliJ.
Copilot AI review requested due to automatic review settings December 8, 2025 11:24
@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR integrates ToolchainFunctionProvider extensions into the AutoDev IDEA plugin by introducing adapter classes, a provider for IDEA tools, configuring plugin descriptors, and wiring tool registration into the agent initialization flow during startup.

Changes

Cohort / File(s) Summary
Documentation and build configuration
README.md, mpp-idea/build.gradle.kts
Updated project title and development version sections; changed Ktor serialization dependency from compileOnly to implementation with explicit kotlinx module exclusions to avoid conflicts with bundled IntelliJ versions.
Plugin descriptors (META-INF)
mpp-idea/mpp-idea-core/src/main/resources/META-INF/autodev-core.xml, docker.xml, json-contrib.xml
Added three new plugin descriptor files declaring metadata, extensions, extension points, services, actions, and provider integrations for IDEA plugin architecture.
Tool adapter and provider
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/tool/ToolchainFunctionAdapter.kt, IdeaToolProvider.kt
Introduced ToolchainFunctionAdapter, ToolchainFunctionParams, ToolchainFunctionSchema, ToolchainFunctionInvocation, and IdeaToolProvider classes to bridge ToolchainFunctionProvider extensions with the IDEA tool framework.
Agent integration
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentViewModel.kt
Added registerIdeaTools() helper method to collect and register IDEA-specific tools during CodingAgent initialization.

Sequence Diagram

sequenceDiagram
    participant ViewModel as IdeaAgentViewModel
    participant Agent as CodingAgent
    participant Provider as IdeaToolProvider
    participant Ext as ToolchainFunctionProvider
    participant Adapter as ToolchainFunctionAdapter
    
    ViewModel->>Agent: create CodingAgent
    ViewModel->>Provider: create IdeaToolProvider(project)
    Provider->>Ext: discover extensions
    Ext-->>Provider: iterate ToolchainFunctionProviders
    Provider->>Adapter: wrap each provider tool
    Adapter-->>Provider: ExecutableTool<ToolchainFunctionParams, ToolResult>
    Provider-->>ViewModel: provideTools() → List<ExecutableTool>
    ViewModel->>Agent: register each tool
    Agent-->>ViewModel: tools registered & ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • autodev-core.xml: Review extensibility declarations, action/service/extension-point mappings for correctness and completeness
  • ToolchainFunctionAdapter & IdeaToolProvider: Verify adapter pattern implementation, blocking behavior (runBlocking), exception handling, and provider iteration logic
  • IdeaAgentViewModel integration: Confirm wiring point timing and error recovery in registerIdeaTools()
  • build.gradle.kts excludes: Validate kotlinx module exclusions prevent runtime conflicts without breaking transitive dependencies

Possibly related issues

Possibly related PRs

Poem

🐰 Tools now hop through adapters fair,
Providers dance in IDEA's care,
Extensions bloom like clover bright,
Agents register with delight,
The ecosystem grows just right! 🌱✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/idea-tool-provider-integration

📜 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 b40f566 and 6a6bc92.

📒 Files selected for processing (8)
  • README.md (1 hunks)
  • mpp-idea/build.gradle.kts (2 hunks)
  • mpp-idea/mpp-idea-core/src/main/resources/META-INF/autodev-core.xml (1 hunks)
  • mpp-idea/mpp-idea-core/src/main/resources/META-INF/docker.xml (1 hunks)
  • mpp-idea/mpp-idea-core/src/main/resources/META-INF/json-contrib.xml (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/tool/IdeaToolProvider.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/tool/ToolchainFunctionAdapter.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentViewModel.kt (3 hunks)

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

@phodal phodal merged commit e984721 into master Dec 8, 2025
2 of 4 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements integration between IntelliJ IDEA's ToolchainFunctionProvider extension point system and mpp-core's tool registry, enabling IDEA-specific tools to be used by the CodingAgent. The integration uses an adapter pattern to bridge the two systems, with IdeaToolProvider collecting all ToolchainFunctionProvider extensions and wrapping them as ExecutableTools that can be registered with CodingAgent.

Key changes:

  • Implemented IdeaToolProvider to collect and wrap ToolchainFunctionProvider extensions
  • Created ToolchainFunctionAdapter to adapt ToolchainFunctionProvider interface to ExecutableTool
  • Integrated tool registration in IdeaAgentViewModel.registerIdeaTools() during CodingAgent initialization

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentViewModel.kt Added registerIdeaTools() method to register IDEA-specific tools with CodingAgent during initialization
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/tool/ToolchainFunctionAdapter.kt Implemented adapter pattern to wrap ToolchainFunctionProvider as ExecutableTool with parameter handling and execution logic
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/tool/IdeaToolProvider.kt Created provider to collect all ToolchainFunctionProvider extensions and convert them to ExecutableTools
mpp-idea/mpp-idea-core/src/main/resources/META-INF/json-contrib.xml Added LocalJsonTextProvider extension configuration for JSON module support
mpp-idea/mpp-idea-core/src/main/resources/META-INF/docker.xml Added placeholder configuration file for Docker module support
mpp-idea/mpp-idea-core/src/main/resources/META-INF/autodev-core.xml Moved core plugin configuration including extension points and implementations from other locations
mpp-idea/build.gradle.kts Changed ktor-serialization-kotlinx-json from compileOnly to implementation with exclusions to fix runtime dependency issues
README.md Updated with links to AutoDev 2.0 stable branch and clarified version information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

println("Registered ${ideaTools.size} IDEA tools from ToolchainFunctionProvider extensions")
}
} catch (e: Exception) {
println("Warning: Failed to register IDEA tools: ${e.message}")
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace println with IntelliJ Platform's Logger for consistent logging. Use Logger.getInstance(IdeaAgentViewModel::class.java) to create a logger instance and call logger.warn() for logging warning messages. This follows the logging pattern used elsewhere in the IDEA plugin codebase.

Copilot uses AI. Check for mistakes.
}
} catch (e: Exception) {
// Log and continue with other providers
println("Warning: Failed to load tools from ${provider::class.simpleName}: ${e.message}")
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace println with IntelliJ Platform's Logger for consistent logging. Use Logger.getInstance(IdeaToolProvider::class.java) to create a logger instance and call logger.warn() for logging warning messages. This follows the logging pattern used elsewhere in the IDEA plugin codebase and ensures logs are properly integrated with IntelliJ's logging system.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +48
val toolInfos = runBlocking { provider.toolInfos(project) }

// Create an adapter for each tool
for (agentTool in toolInfos) {
val adapter = ToolchainFunctionAdapter(
provider = provider,
project = project,
agentTool = agentTool
)
tools.add(adapter)
}

// If no toolInfos, try to create tools from funcNames
if (toolInfos.isEmpty()) {
val funcNames = runBlocking { provider.funcNames() }
for (funcName in funcNames) {
// Check if this provider is applicable for this function
val isApplicable = runBlocking { provider.isApplicable(project, funcName) }
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using runBlocking in production code as it blocks the calling thread. Consider making provideTools() a suspend function or using coroutineScope with appropriate dispatchers. If this method is called from UI code, consider using IntelliJ's ProgressManager.getInstance().run() or ReadAction.nonBlocking() APIs to handle coroutines properly without blocking the thread.

Copilot uses AI. Check for mistakes.
}

if (ideaTools.isNotEmpty()) {
println("Registered ${ideaTools.size} IDEA tools from ToolchainFunctionProvider extensions")
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace println with IntelliJ Platform's Logger for consistent logging. Use Logger.getInstance(IdeaAgentViewModel::class.java) to create a logger instance and call logger.info() or logger.warn() methods for logging messages. This follows the logging pattern used elsewhere in the IDEA plugin codebase and ensures logs are properly integrated with IntelliJ's logging system.

Copilot uses AI. Check for mistakes.
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.

2 participants