@@ -23,48 +23,44 @@ import (
2323type AgentType = msgfmt.AgentType
2424
2525const (
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
3836)
3937
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 ,
5452}
5553
5654func parseAgentType (firstArg string , agentTypeVar string ) (AgentType , error ) {
5755 // 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 {
6057 return castedAgentType , nil
6158 }
6259 if agentTypeVar != "" {
6360 return AgentTypeCustom , fmt .Errorf ("invalid agent type: %s" , agentTypeVar )
6461 }
6562 // 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 {
6864 return castedFirstArg , nil
6965 }
7066 return AgentTypeCustom , nil
@@ -148,9 +144,9 @@ func runServer(ctx context.Context, logger *slog.Logger, argsToPass []string) er
148144}
149145
150146var 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 )
154150 }
155151 sort .Strings (names )
156152 return names
0 commit comments