Skip to content

Commit e2c6097

Browse files
committed
feat(mcp): add JBProtocol support for AutoDev commands #392 unit-mesh/autodev-workbench#89
Implement AutoDevJbProtocolService to handle 'autodev://' protocol commands. This enables deep linking functionality for issue evaluation
1 parent 74f600f commit e2c6097

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

core/src/233/main/resources/META-INF/autodev-core.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<httpRequestHandler implementation="cc.unitmesh.devti.mcp.host.MCPService"/>
8181
<postStartupActivity implementation="cc.unitmesh.devti.update.AutoDevUpdateStartupActivity"/>
8282
<postStartupActivity implementation="cc.unitmesh.devti.mcp.MCPServerStartupValidator"/>
83+
<jbProtocolCommand implementation="cc.unitmesh.devti.mcp.AutoDevJbProtocolService"/>
8384
<notificationGroup id="UnitMesh.MCPServer" displayType="BALLOON"/>
8485
</extensions>
8586

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package cc.unitmesh.devti.mcp
2+
3+
import cc.unitmesh.devti.mcp.host.IssueArgs
4+
import cc.unitmesh.devti.mcp.host.IssueEvaluateTool
5+
import com.intellij.openapi.application.JBProtocolCommand
6+
import com.intellij.openapi.project.ProjectManager
7+
8+
class AutoDevJbProtocolService : JBProtocolCommand("autodev") {
9+
override suspend fun execute(
10+
target: String?,
11+
parameters: Map<String, String>,
12+
fragment: String?
13+
): String? {
14+
val issueEvaluateTool = IssueEvaluateTool()
15+
val issue = parameters["issue"]
16+
if (issue == null) {
17+
return null
18+
}
19+
20+
val args: IssueArgs = IssueArgs(issue = issue)
21+
22+
val project = ProjectManager.getInstance().openProjects.firstOrNull()
23+
?: return null
24+
val result = issueEvaluateTool.handle(project, args)
25+
return result.toString()
26+
}
27+
}

0 commit comments

Comments
 (0)