f99010fae1
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Windows) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Has been cancelled
127 lines
2.7 KiB
Go
127 lines
2.7 KiB
Go
package parser
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNormalizeToolCategory(t *testing.T) {
|
|
tests := []struct {
|
|
toolName string
|
|
want string
|
|
}{
|
|
// Claude Code tools
|
|
{"Read", "Read"},
|
|
{"Edit", "Edit"},
|
|
{"Write", "Write"},
|
|
{"NotebookEdit", "Write"},
|
|
{"Bash", "Bash"},
|
|
{"Grep", "Grep"},
|
|
{"Glob", "Glob"},
|
|
{"Task", "Task"},
|
|
{"Agent", "Task"},
|
|
{"Skill", "Tool"},
|
|
|
|
// Codex tools
|
|
{"shell_command", "Bash"},
|
|
{"exec_command", "Bash"},
|
|
{"list_files", "Read"},
|
|
{"apply_patch", "Edit"},
|
|
{"write_stdin", "Bash"},
|
|
{"shell", "Bash"},
|
|
|
|
// Gemini tools
|
|
{"read_file", "Read"},
|
|
{"write_file", "Write"},
|
|
{"edit_file", "Edit"},
|
|
{"replace", "Edit"},
|
|
{"list_directory", "Read"},
|
|
{"run_command", "Bash"},
|
|
{"execute_command", "Bash"},
|
|
{"run_shell_command", "Bash"},
|
|
{"search_files", "Grep"},
|
|
{"grep", "Grep"},
|
|
{"grep_search", "Grep"},
|
|
|
|
// OpenCode tools (lowercase)
|
|
// "grep" already tested above in Gemini section.
|
|
{"read", "Read"},
|
|
{"edit", "Edit"},
|
|
{"write", "Write"},
|
|
{"bash", "Bash"},
|
|
{"glob", "Glob"},
|
|
{"task", "Task"},
|
|
|
|
// Amp tools
|
|
{"create_file", "Write"},
|
|
{"look_at", "Read"},
|
|
{"undo_edit", "Edit"},
|
|
{"finder", "Grep"},
|
|
{"read_web_page", "Read"},
|
|
{"skill", "Tool"},
|
|
|
|
// Pi tools
|
|
{"str_replace", "Edit"},
|
|
{"find", "Read"},
|
|
|
|
// Copilot tools
|
|
{"view", "Read"},
|
|
{"report_intent", "Tool"},
|
|
|
|
// Cursor tools
|
|
{"ApplyPatch", "Edit"},
|
|
|
|
// Piebald / Zencoder-style built-in tools
|
|
{"ReadFile", "Read"},
|
|
{"WriteFile", "Write"},
|
|
{"EditFile", "Edit"},
|
|
{"RunTerminalCommand", "Bash"},
|
|
{"LaunchSubagent", "Task"},
|
|
{"WebFetch", "Tool"},
|
|
{"WebSearch", "Tool"},
|
|
{"TodoWrite", "Tool"},
|
|
{"AskUserQuestion", "Tool"},
|
|
{"ProposePlanToUser", "Tool"},
|
|
|
|
// Zencoder tools (not already covered above).
|
|
{"subagent__ZencoderSubagent", "Task"},
|
|
{"zencoder-rag-mcp__web_search", "Read"},
|
|
// Zencoder MCP-prefixed subagent variants
|
|
{"Zencoder_subagent__ZencoderSubagent", "Task"},
|
|
{"mcp__zen_subagents__spawn_subagent", "Task"},
|
|
|
|
// Forge tools
|
|
{"fs_search", "Grep"},
|
|
{"patch", "Edit"},
|
|
{"multi_patch", "Edit"},
|
|
{"undo", "Edit"},
|
|
{"remove", "Edit"},
|
|
{"fetch", "Read"},
|
|
{"todo_write", "Tool"},
|
|
{"todo_read", "Tool"},
|
|
{"parallel", "Task"},
|
|
|
|
// Unknown
|
|
{"view_image", "Other"},
|
|
{"update_plan", "Other"},
|
|
{"list_mcp_resources", "Other"},
|
|
{"EnterPlanMode", "Other"},
|
|
{"ExitPlanMode", "Other"},
|
|
{"", "Other"},
|
|
{"some_random_tool", "Other"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
testName := tt.toolName
|
|
if testName == "" {
|
|
testName = "empty_string"
|
|
}
|
|
t.Run(testName, func(t *testing.T) {
|
|
got := NormalizeToolCategory(tt.toolName)
|
|
assert.Equal(t, tt.want, got,
|
|
"NormalizeToolCategory(%q)", tt.toolName)
|
|
})
|
|
}
|
|
}
|