Skip to content

Commit 3dbdc35

Browse files
authored
fix: cursor-agent type (#62)
1 parent 54e98c9 commit 3dbdc35

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

cmd/server/server.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,28 @@ import (
2323
type AgentType = msgfmt.AgentType
2424

2525
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-
AgentTypeCursor AgentType = msgfmt.AgentTypeCursor
33-
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+
AgentTypeCursorAgent AgentType = msgfmt.AgentTypeCursorAgent
33+
AgentTypeCursor AgentType = msgfmt.AgentTypeCursor
34+
AgentTypeCustom AgentType = msgfmt.AgentTypeCustom
3435
)
3536

3637
// exhaustiveness of this map is checked by the exhaustive linter
3738
var agentTypeMap = map[AgentType]bool{
38-
AgentTypeClaude: true,
39-
AgentTypeGoose: true,
40-
AgentTypeAider: true,
41-
AgentTypeCodex: true,
42-
AgentTypeGemini: true,
43-
AgentTypeAmp: true,
44-
AgentTypeCursor: true,
45-
AgentTypeCustom: true,
39+
AgentTypeClaude: true,
40+
AgentTypeGoose: true,
41+
AgentTypeAider: true,
42+
AgentTypeCodex: true,
43+
AgentTypeGemini: true,
44+
AgentTypeAmp: true,
45+
AgentTypeCursorAgent: true,
46+
AgentTypeCursor: true,
47+
AgentTypeCustom: true,
4648
}
4749

4850
func parseAgentType(firstArg string, agentTypeVar string) (AgentType, error) {

cmd/server/server_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ func TestParseAgentType(t *testing.T) {
4747
agentTypeVar: "",
4848
want: AgentTypeGemini,
4949
},
50+
{
51+
firstArg: "cursor-agent",
52+
agentTypeVar: "",
53+
want: AgentTypeCursorAgent,
54+
},
5055
{
5156
firstArg: "cursor",
5257
agentTypeVar: "",
@@ -87,6 +92,11 @@ func TestParseAgentType(t *testing.T) {
8792
agentTypeVar: "gemini",
8893
want: AgentTypeGemini,
8994
},
95+
{
96+
firstArg: "claude",
97+
agentTypeVar: "cursor-agent",
98+
want: AgentTypeCursorAgent,
99+
},
90100
{
91101
firstArg: "claude",
92102
agentTypeVar: "cursor",

lib/msgfmt/msgfmt.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func RemoveUserInput(msgRaw string, userInputRaw string, agentType AgentType) st
192192
if idx, found := skipTrailingInputBoxLine(msgLines, lastUserInputLineIdx, "╯", "╰"); found {
193193
lastUserInputLineIdx = idx
194194
}
195-
} else if agentType == AgentTypeCursor {
195+
} else if agentType == AgentTypeCursorAgent || agentType == AgentTypeCursor {
196196
if idx, found := skipTrailingInputBoxLine(msgLines, lastUserInputLineIdx, "┘", "└"); found {
197197
lastUserInputLineIdx = idx
198198
}
@@ -225,14 +225,15 @@ func trimEmptyLines(message string) string {
225225
type AgentType string
226226

227227
const (
228-
AgentTypeClaude AgentType = "claude"
229-
AgentTypeGoose AgentType = "goose"
230-
AgentTypeAider AgentType = "aider"
231-
AgentTypeCodex AgentType = "codex"
232-
AgentTypeGemini AgentType = "gemini"
233-
AgentTypeAmp AgentType = "amp"
234-
AgentTypeCursor AgentType = "cursor"
235-
AgentTypeCustom AgentType = "custom"
228+
AgentTypeClaude AgentType = "claude"
229+
AgentTypeGoose AgentType = "goose"
230+
AgentTypeAider AgentType = "aider"
231+
AgentTypeCodex AgentType = "codex"
232+
AgentTypeGemini AgentType = "gemini"
233+
AgentTypeAmp AgentType = "amp"
234+
AgentTypeCursorAgent AgentType = "cursor-agent"
235+
AgentTypeCursor AgentType = "cursor"
236+
AgentTypeCustom AgentType = "custom"
236237
)
237238

238239
func formatGenericMessage(message string, userInput string, agentType AgentType) string {
@@ -263,6 +264,8 @@ func FormatAgentMessage(agentType AgentType, message string, userInput string) s
263264
return formatGenericMessage(message, userInput, agentType)
264265
case AgentTypeAmp:
265266
return formatGenericMessage(message, userInput, agentType)
267+
case AgentTypeCursorAgent:
268+
return formatGenericMessage(message, userInput, agentType)
266269
case AgentTypeCursor:
267270
return formatGenericMessage(message, userInput, agentType)
268271
case AgentTypeCustom:

0 commit comments

Comments
 (0)