@@ -23,48 +23,44 @@ import (
23
23
type AgentType = msgfmt.AgentType
24
24
25
25
const (
26
- AgentTypeClaude AgentType = msgfmt .AgentTypeClaude
27
- AgentTypeGoose AgentType = msgfmt .AgentTypeGoose
28
- AgentTypeAider AgentType = msgfmt .AgentTypeAider
29
- AgentTypeCodex AgentType = msgfmt .AgentTypeCodex
30
- AgentTypeGemini AgentType = msgfmt .AgentTypeGemini
31
- AgentTypeAmp AgentType = msgfmt .AgentTypeAmp
32
- AgentTypeCursorAgent AgentType = msgfmt .AgentTypeCursorAgent
33
- AgentTypeCursor AgentType = msgfmt .AgentTypeCursor
34
- AgentTypeAuggie AgentType = msgfmt .AgentTypeAuggie
35
- AgentTypeAmazonQ AgentType = msgfmt .AgentTypeAmazonQ
36
- AgentTypeQ AgentType = msgfmt .AgentTypeQ
37
- AgentTypeCustom AgentType = msgfmt .AgentTypeCustom
26
+ AgentTypeClaude AgentType = msgfmt .AgentTypeClaude
27
+ AgentTypeGoose AgentType = msgfmt .AgentTypeGoose
28
+ AgentTypeAider AgentType = msgfmt .AgentTypeAider
29
+ AgentTypeCodex AgentType = msgfmt .AgentTypeCodex
30
+ AgentTypeGemini AgentType = msgfmt .AgentTypeGemini
31
+ AgentTypeAmp AgentType = msgfmt .AgentTypeAmp
32
+ AgentTypeCursor AgentType = msgfmt .AgentTypeCursor
33
+ AgentTypeAuggie AgentType = msgfmt .AgentTypeAuggie
34
+ AgentTypeAmazonQ AgentType = msgfmt .AgentTypeAmazonQ
35
+ AgentTypeCustom AgentType = msgfmt .AgentTypeCustom
38
36
)
39
37
40
- // exhaustiveness of this map is checked by the exhaustive linter
41
- var agentTypeMap = map [AgentType ] bool {
42
- AgentTypeClaude : true ,
43
- AgentTypeGoose : true ,
44
- AgentTypeAider : true ,
45
- AgentTypeCodex : true ,
46
- AgentTypeGemini : true ,
47
- AgentTypeAmp : true ,
48
- AgentTypeCursorAgent : true ,
49
- AgentTypeCursor : true ,
50
- AgentTypeAuggie : true ,
51
- AgentTypeAmazonQ : true ,
52
- AgentTypeQ : true ,
53
- AgentTypeCustom : true ,
38
+ // agentTypeAliases contains the mapping of possible input agent type strings to their canonical AgentType values
39
+ var agentTypeAliases = map [string ] AgentType {
40
+ "claude" : AgentTypeClaude ,
41
+ "goose" : AgentTypeGoose ,
42
+ "aider" : AgentTypeAider ,
43
+ "codex" : AgentTypeCodex ,
44
+ "gemini" : AgentTypeGemini ,
45
+ "amp" : AgentTypeAmp ,
46
+ "auggie" : AgentTypeAuggie ,
47
+ "cursor" : AgentTypeCursor ,
48
+ "cursor-agent" : AgentTypeCursor ,
49
+ "q" : AgentTypeAmazonQ ,
50
+ "amazonq" : AgentTypeAmazonQ ,
51
+ "custom" : AgentTypeCustom ,
54
52
}
55
53
56
54
func parseAgentType (firstArg string , agentTypeVar string ) (AgentType , error ) {
57
55
// if the agent type is provided, use it
58
- castedAgentType := AgentType (agentTypeVar )
59
- if _ , ok := agentTypeMap [castedAgentType ]; ok {
56
+ if castedAgentType , ok := agentTypeAliases [agentTypeVar ]; ok {
60
57
return castedAgentType , nil
61
58
}
62
59
if agentTypeVar != "" {
63
60
return AgentTypeCustom , fmt .Errorf ("invalid agent type: %s" , agentTypeVar )
64
61
}
65
62
// if the agent type is not provided, guess it from the first argument
66
- castedFirstArg := AgentType (firstArg )
67
- if _ , ok := agentTypeMap [castedFirstArg ]; ok {
63
+ if castedFirstArg , ok := agentTypeAliases [firstArg ]; ok {
68
64
return castedFirstArg , nil
69
65
}
70
66
return AgentTypeCustom , nil
@@ -148,9 +144,9 @@ func runServer(ctx context.Context, logger *slog.Logger, argsToPass []string) er
148
144
}
149
145
150
146
var agentNames = (func () []string {
151
- names := make ([]string , 0 , len (agentTypeMap ))
152
- for agentType := range agentTypeMap {
153
- names = append (names , string ( agentType ) )
147
+ names := make ([]string , 0 , len (agentTypeAliases ))
148
+ for agentType := range agentTypeAliases {
149
+ names = append (names , agentType )
154
150
}
155
151
sort .Strings (names )
156
152
return names
0 commit comments