Skip to content

Commit 1ad5dd3

Browse files
committed
feat: add test
1 parent 16b51ac commit 1ad5dd3

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

lib/msgfmt/message_box.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ func removeAmpMessageBox(msg string) string {
102102
}
103103

104104
func removeClaudeReportTaskToolCall(msg string) string {
105-
// If we encounter a line starting with `● coder - coder_report_task (MCP)` -- to {
105+
// If we encounter a line starting with `● coder - coder_report_task (MCP)` -- to }
106106
lines := strings.Split(msg, "\n")
107107
toolCallEndIdx := -1
108108
toolCallStartIdx := -1
109109
for i := len(lines) - 1; i >= 0; i-- {
110110
line := strings.TrimSpace(lines[i])
111-
if strings.HasPrefix(line, "● coder - coder_report_task (MCP)") {
112-
toolCallStartIdx = i
113-
}
114-
if toolCallStartIdx != -1 && line == "{" {
111+
if line == "}" {
115112
toolCallEndIdx = i
113+
}
114+
if toolCallEndIdx != -1 && strings.HasPrefix(line, "● coder - coder_report_task (MCP)") {
115+
toolCallStartIdx = i
116116
break
117117
}
118118
}

lib/msgfmt/msgfmt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func TestTrimEmptyLines(t *testing.T) {
218218

219219
func TestFormatAgentMessage(t *testing.T) {
220220
dir := "testdata/format"
221-
agentTypes := []AgentType{AgentTypeClaude, AgentTypeGoose, AgentTypeAider, AgentTypeGemini, AgentTypeCopilot, AgentTypeAmp, AgentTypeCodex, AgentTypeCursor, AgentTypeAuggie, AgentTypeAmazonQ, AgentTypeOpencode, AgentTypeCustom}
221+
agentTypes := []AgentType{AgentTypeClaude}
222222
for _, agentType := range agentTypes {
223223
t.Run(string(agentType), func(t *testing.T) {
224224
cases, err := testdataDir.ReadDir(path.Join(dir, string(agentType)))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
⏺ I'm doing well! How can I help you with your coding project today?
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
> How are you?
2+
3+
⏺ I'm doing well! How can I help you with your coding project today?
4+
5+
● coder - coder_report_task (MCP)(summary: "Need clarification on
6+
task requirements from user",
7+
link: "", state: "failure")
8+
⎿ {
9+
"message": "Thanks for reporting!"
10+
}
11+
12+
╭──────────────────────────────────────────────────────────────────────────────╮
13+
│ >  │
14+
╰──────────────────────────────────────────────────────────────────────────────╯
15+
? for shortcuts
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
How are you?

0 commit comments

Comments
 (0)