Skip to content

Commit e9c3fbc

Browse files
committed
feat(bridge): add BridgeToolProvider and update tool list formatting #308
Add new BridgeToolProvider to manage tool collection and modify BridgeRunContext to format toolList as a string. Also, clean up redundant comments and unused constants in BuiltinCommand.
1 parent 100f1c4 commit e9c3fbc

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

core/src/main/kotlin/cc/unitmesh/devti/bridge/BridgeRunContext.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ data class BridgeRunContext(
7373
relatedFiles = emptyList(),
7474
userInput = input,
7575
workspace = workspace(project),
76-
toolList = BridgeToolProvider.collect(project),
76+
toolList = BridgeToolProvider.collect(project).joinToString("\n"),
7777
shell = ShellUtil.detectShells().firstOrNull() ?: "/bin/bash",
7878
frameworkContext = runBlocking {
7979
return@runBlocking ChatContextProvider.collectChatContextList(project, creationContext)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cc.unitmesh.devti.bridge
2+
3+
import cc.unitmesh.devti.agenttool.AgentTool
4+
import cc.unitmesh.devti.devin.dataprovider.BuiltinCommand
5+
import cc.unitmesh.devti.devin.dataprovider.BuiltinCommand.*
6+
import com.intellij.openapi.project.Project
7+
8+
object BridgeToolProvider {
9+
val Tools =
10+
setOf(RELATED, STRUCTURE, LOCAL_SEARCH, RIPGREP_SEARCH, DATABASE, DIR, REV)
11+
12+
fun collect(project: Project): List<AgentTool> {
13+
val commonTools = Tools
14+
.map {
15+
val example = BuiltinCommand.example(it)
16+
AgentTool(it.commandName, it.description, example)
17+
}
18+
19+
/// collect function tools in Bridge.kt
20+
21+
return commonTools
22+
}
23+
}

core/src/main/kotlin/cc/unitmesh/devti/devin/dataprovider/BuiltinCommand.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,5 @@ enum class BuiltinCommand(
160160

161161
val READ_COMMANDS =
162162
setOf(DIR, LOCAL_SEARCH, FILE, REV, STRUCTURE, SYMBOL, DATABASE, RELATED, RIPGREP_SEARCH, BROWSE)
163-
164-
/**
165-
*
166-
*/
167-
val REFACTORING_TOOLS =
168-
setOf(RELATED, STRUCTURE, FILE, SYMBOL, LOCAL_SEARCH, RIPGREP_SEARCH, DATABASE, DIR, BROWSE, REV)
169163
}
170164
}

0 commit comments

Comments
 (0)