-
Notifications
You must be signed in to change notification settings - Fork 471
Feat/idea tool provider integration #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
|
Caution Review failedThe pull request is closed. WalkthroughThis 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related issues
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
Comment |
There was a problem hiding this 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
IdeaToolProviderto collect and wrap ToolchainFunctionProvider extensions - Created
ToolchainFunctionAdapterto 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}") |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
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.
| } | ||
| } catch (e: Exception) { | ||
| // Log and continue with other providers | ||
| println("Warning: Failed to load tools from ${provider::class.simpleName}: ${e.message}") |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
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.
| 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) } |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| if (ideaTools.isNotEmpty()) { | ||
| println("Registered ${ideaTools.size} IDEA tools from ToolchainFunctionProvider extensions") |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
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.
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.