Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,28 @@ import (
type AgentType = msgfmt.AgentType

const (
AgentTypeClaude AgentType = msgfmt.AgentTypeClaude
AgentTypeGoose AgentType = msgfmt.AgentTypeGoose
AgentTypeAider AgentType = msgfmt.AgentTypeAider
AgentTypeCodex AgentType = msgfmt.AgentTypeCodex
AgentTypeGemini AgentType = msgfmt.AgentTypeGemini
AgentTypeAmp AgentType = msgfmt.AgentTypeAmp
AgentTypeCursor AgentType = msgfmt.AgentTypeCursor
AgentTypeCustom AgentType = msgfmt.AgentTypeCustom
AgentTypeClaude AgentType = msgfmt.AgentTypeClaude
AgentTypeGoose AgentType = msgfmt.AgentTypeGoose
AgentTypeAider AgentType = msgfmt.AgentTypeAider
AgentTypeCodex AgentType = msgfmt.AgentTypeCodex
AgentTypeGemini AgentType = msgfmt.AgentTypeGemini
AgentTypeAmp AgentType = msgfmt.AgentTypeAmp
AgentTypeCursorAgent AgentType = msgfmt.AgentTypeCursorAgent
AgentTypeCursor AgentType = msgfmt.AgentTypeCursor
Comment on lines +32 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference in AgentTypeCursorAgent and AgentTypeCursor
@35C4n0r

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're synonyms.

AgentTypeCustom AgentType = msgfmt.AgentTypeCustom
)

// exhaustiveness of this map is checked by the exhaustive linter
var agentTypeMap = map[AgentType]bool{
AgentTypeClaude: true,
AgentTypeGoose: true,
AgentTypeAider: true,
AgentTypeCodex: true,
AgentTypeGemini: true,
AgentTypeAmp: true,
AgentTypeCursor: true,
AgentTypeCustom: true,
AgentTypeClaude: true,
AgentTypeGoose: true,
AgentTypeAider: true,
AgentTypeCodex: true,
AgentTypeGemini: true,
AgentTypeAmp: true,
AgentTypeCursorAgent: true,
AgentTypeCursor: true,
AgentTypeCustom: true,
}

func parseAgentType(firstArg string, agentTypeVar string) (AgentType, error) {
Expand Down
10 changes: 10 additions & 0 deletions cmd/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func TestParseAgentType(t *testing.T) {
agentTypeVar: "",
want: AgentTypeGemini,
},
{
firstArg: "cursor-agent",
agentTypeVar: "",
want: AgentTypeCursorAgent,
},
{
firstArg: "cursor",
agentTypeVar: "",
Expand Down Expand Up @@ -87,6 +92,11 @@ func TestParseAgentType(t *testing.T) {
agentTypeVar: "gemini",
want: AgentTypeGemini,
},
{
firstArg: "claude",
agentTypeVar: "cursor-agent",
want: AgentTypeCursorAgent,
},
{
firstArg: "claude",
agentTypeVar: "cursor",
Expand Down
21 changes: 12 additions & 9 deletions lib/msgfmt/msgfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func RemoveUserInput(msgRaw string, userInputRaw string, agentType AgentType) st
if idx, found := skipTrailingInputBoxLine(msgLines, lastUserInputLineIdx, "╯", "╰"); found {
lastUserInputLineIdx = idx
}
} else if agentType == AgentTypeCursor {
} else if agentType == AgentTypeCursorAgent || agentType == AgentTypeCursor {
if idx, found := skipTrailingInputBoxLine(msgLines, lastUserInputLineIdx, "┘", "└"); found {
lastUserInputLineIdx = idx
}
Expand Down Expand Up @@ -225,14 +225,15 @@ func trimEmptyLines(message string) string {
type AgentType string

const (
AgentTypeClaude AgentType = "claude"
AgentTypeGoose AgentType = "goose"
AgentTypeAider AgentType = "aider"
AgentTypeCodex AgentType = "codex"
AgentTypeGemini AgentType = "gemini"
AgentTypeAmp AgentType = "amp"
AgentTypeCursor AgentType = "cursor"
AgentTypeCustom AgentType = "custom"
AgentTypeClaude AgentType = "claude"
AgentTypeGoose AgentType = "goose"
AgentTypeAider AgentType = "aider"
AgentTypeCodex AgentType = "codex"
AgentTypeGemini AgentType = "gemini"
AgentTypeAmp AgentType = "amp"
AgentTypeCursorAgent AgentType = "cursor-agent"
AgentTypeCursor AgentType = "cursor"
AgentTypeCustom AgentType = "custom"
)

func formatGenericMessage(message string, userInput string, agentType AgentType) string {
Expand Down Expand Up @@ -263,6 +264,8 @@ func FormatAgentMessage(agentType AgentType, message string, userInput string) s
return formatGenericMessage(message, userInput, agentType)
case AgentTypeAmp:
return formatGenericMessage(message, userInput, agentType)
case AgentTypeCursorAgent:
return formatGenericMessage(message, userInput, agentType)
case AgentTypeCursor:
return formatGenericMessage(message, userInput, agentType)
case AgentTypeCustom:
Expand Down