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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AgentAPI

Control [Claude Code](https://github.com/anthropics/claude-code), [Goose](https://github.com/block/goose), [Aider](https://github.com/Aider-AI/aider), [Gemini](https://github.com/google-gemini/gemini-cli), [Sourcegraph Amp](https://github.com/sourcegraph/amp-cli), [Codex](https://github.com/openai/codex), [Auggie](https://docs.augmentcode.com/cli/overview), and [Cursor CLI](https://cursor.com/en/cli) with an HTTP API.
Control [Claude Code](https://github.com/anthropics/claude-code), [AmazonQ](https://aws.amazon.com/developer/learning/q-developer-cli/), [Goose](https://github.com/block/goose), [Aider](https://github.com/Aider-AI/aider), [Gemini](https://github.com/google-gemini/gemini-cli), [Sourcegraph Amp](https://github.com/sourcegraph/amp-cli), [Codex](https://github.com/openai/codex), [Auggie](https://docs.augmentcode.com/cli/overview), and [Cursor CLI](https://cursor.com/en/cli) with an HTTP API.

![agentapi-chat](https://github.com/user-attachments/assets/57032c9f-4146-4b66-b219-09e38ab7690d)

Expand Down
4 changes: 4 additions & 0 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const (
AgentTypeCursorAgent AgentType = msgfmt.AgentTypeCursorAgent
AgentTypeCursor AgentType = msgfmt.AgentTypeCursor
AgentTypeAuggie AgentType = msgfmt.AgentTypeAuggie
AgentTypeAmazonQ AgentType = msgfmt.AgentTypeAmazonQ
AgentTypeQ AgentType = msgfmt.AgentTypeQ
AgentTypeCustom AgentType = msgfmt.AgentTypeCustom
)

Expand All @@ -46,6 +48,8 @@ var agentTypeMap = map[AgentType]bool{
AgentTypeCursorAgent: true,
AgentTypeCursor: true,
AgentTypeAuggie: true,
AgentTypeAmazonQ: true,
AgentTypeQ: true,
AgentTypeCustom: true,
}

Expand Down
20 changes: 20 additions & 0 deletions cmd/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ func TestParseAgentType(t *testing.T) {
agentTypeVar: "",
want: AgentTypeCursor,
},
{
firstArg: "amazonq",
agentTypeVar: "",
want: AgentTypeAmazonQ,
},
{
firstArg: "q",
agentTypeVar: "",
want: AgentTypeQ,
},
{
firstArg: "auggie",
agentTypeVar: "",
Expand Down Expand Up @@ -97,6 +107,16 @@ func TestParseAgentType(t *testing.T) {
agentTypeVar: "gemini",
want: AgentTypeGemini,
},
{
firstArg: "claude",
agentTypeVar: "amazonq",
want: AgentTypeAmazonQ,
},
{
firstArg: "claude",
agentTypeVar: "q",
want: AgentTypeQ,
},
{
firstArg: "claude",
agentTypeVar: "cursor-agent",
Expand Down
6 changes: 6 additions & 0 deletions lib/msgfmt/msgfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ const (
AgentTypeCursorAgent AgentType = "cursor-agent"
AgentTypeCursor AgentType = "cursor"
AgentTypeAuggie AgentType = "auggie"
AgentTypeAmazonQ AgentType = "amazonq"
AgentTypeQ AgentType = "q"
AgentTypeCustom AgentType = "custom"
)

Expand Down Expand Up @@ -271,6 +273,10 @@ func FormatAgentMessage(agentType AgentType, message string, userInput string) s
return formatGenericMessage(message, userInput, agentType)
case AgentTypeAuggie:
return formatGenericMessage(message, userInput, agentType)
case AgentTypeAmazonQ:
return formatGenericMessage(message, userInput, agentType)
case AgentTypeQ:
return formatGenericMessage(message, userInput, agentType)
case AgentTypeCustom:
return formatGenericMessage(message, userInput, agentType)
default:
Expand Down
2 changes: 1 addition & 1 deletion lib/msgfmt/msgfmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func TestTrimEmptyLines(t *testing.T) {

func TestFormatAgentMessage(t *testing.T) {
dir := "testdata/format"
agentTypes := []AgentType{AgentTypeClaude, AgentTypeGoose, AgentTypeAider, AgentTypeGemini, AgentTypeAmp, AgentTypeCodex, AgentTypeCursorAgent, AgentTypeCursor, AgentTypeAuggie, AgentTypeCustom}
agentTypes := []AgentType{AgentTypeClaude, AgentTypeGoose, AgentTypeAider, AgentTypeGemini, AgentTypeAmp, AgentTypeCodex, AgentTypeCursorAgent, AgentTypeCursor, AgentTypeAuggie, AgentTypeQ, AgentTypeCustom}
for _, agentType := range agentTypes {
t.Run(string(agentType), func(t *testing.T) {
cases, err := testdataDir.ReadDir(path.Join(dir, string(agentType)))
Expand Down
13 changes: 13 additions & 0 deletions lib/msgfmt/testdata/format/q/confirmation_box/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
🛠️ Using tool: coder_report_task from mcp server coder
● Running coder_report_task with the param:
⋮ {
⋮ "name": "coder_report_task",
⋮ "arguments": {
⋮ "summary": "Checking current directory to identify repository",
⋮ "link": "",
⋮ "state": "working"
⋮ }
⋮ }

Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
20 changes: 20 additions & 0 deletions lib/msgfmt/testdata/format/q/confirmation_box/msg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
> what repo is this ?




🛠️ Using tool: coder_report_task from mcp server coder
● Running coder_report_task with the param:
⋮ {
⋮ "name": "coder_report_task",
⋮ "arguments": {
⋮ "summary": "Checking current directory to identify repository",
⋮ "link": "",
⋮ "state": "working"
⋮ }
⋮ }

Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

>
1 change: 1 addition & 0 deletions lib/msgfmt/testdata/format/q/confirmation_box/user.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
what repo is this ?
12 changes: 12 additions & 0 deletions lib/msgfmt/testdata/format/q/first_message/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
✓ coder loaded in 0.03 s

Welcome to Amazon Q!

💡 Run /prompts to learn how to build & run repeatable workflows

/help all commands
ctrl + j new lines
ctrl + s fuzzy search


🤖 You are chatting with claude-sonnet-4
14 changes: 14 additions & 0 deletions lib/msgfmt/testdata/format/q/first_message/msg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
✓ coder loaded in 0.03 s

Welcome to Amazon Q!

💡 Run /prompts to learn how to build & run repeatable workflows

/help all commands
ctrl + j new lines
ctrl + s fuzzy search


🤖 You are chatting with claude-sonnet-4

>
Empty file.
62 changes: 62 additions & 0 deletions lib/msgfmt/testdata/format/q/multi-line-input/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
🛠️ Using tool: coder_report_task from mcp server coder
● Running coder_report_task with the param:
⋮ {
⋮ "name": "coder_report_task",
⋮ "arguments": {
⋮ "summary": "Searching for the formatCodexMessage function in the codebase",
⋮ "link": "",
⋮ "state": "working"
⋮ }
⋮ }

Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> y


● Completed in 0.0s





Tool validation failed:
Failed to validate tool parameters: Path is not a file:



🛠️ Using tool: fs_read (trusted)
● Reading directory: /Users/jkmr/Documents/work/agentapi with maximum depth of 0
✓ Successfully read directory /Users/jkmr/Documents/work/agentapi (29 entries)

● Completed in 0.1s





🛠️ Using tool: execute_bash
● I will run the following shell command:
find /Users/jkmr/Documents/work/agentapi -name "*.go" -exec grep -l "formatCodexMessage" {} \;
↳ Purpose: Search for Go files containing formatCodexMessage function


Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> y

/Users/jkmr/Documents/work/agentapi/lib/msgfmt/msgfmt.go

● Completed in 0.449s


> The formatCodexMessage function is located in the file:

/Users/jkmr/Documents/work/agentapi/lib/msgfmt/msgfmt.go
75 changes: 75 additions & 0 deletions lib/msgfmt/testdata/format/q/multi-line-input/msg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
> Which file has this snippet
func formatCodexMessage(message string, userInput string) string {
message = RemoveUserInput(message, userInput)
message = removeCodexInputBox(message)
message = trimEmptyLines(message)
return message
}




🛠️ Using tool: coder_report_task from mcp server coder
● Running coder_report_task with the param:
⋮ {
⋮ "name": "coder_report_task",
⋮ "arguments": {
⋮ "summary": "Searching for the formatCodexMessage function in the codebase",
⋮ "link": "",
⋮ "state": "working"
⋮ }
⋮ }

Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> y


● Completed in 0.0s





Tool validation failed:
Failed to validate tool parameters: Path is not a file:



🛠️ Using tool: fs_read (trusted)
● Reading directory: /Users/jkmr/Documents/work/agentapi with maximum depth of 0
✓ Successfully read directory /Users/jkmr/Documents/work/agentapi (29 entries)

● Completed in 0.1s





🛠️ Using tool: execute_bash
● I will run the following shell command:
find /Users/jkmr/Documents/work/agentapi -name "*.go" -exec grep -l "formatCodexMessage" {} \;
↳ Purpose: Search for Go files containing formatCodexMessage function


Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> y

/Users/jkmr/Documents/work/agentapi/lib/msgfmt/msgfmt.go

● Completed in 0.449s


> The formatCodexMessage function is located in the file:

/Users/jkmr/Documents/work/agentapi/lib/msgfmt/msgfmt.go

>
7 changes: 7 additions & 0 deletions lib/msgfmt/testdata/format/q/multi-line-input/user.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Which file has this snippet
func formatCodexMessage(message string, userInput string) string {
message = RemoveUserInput(message, userInput)
message = removeCodexInputBox(message)
message = trimEmptyLines(message)
return message
}
59 changes: 59 additions & 0 deletions lib/msgfmt/testdata/format/q/second_message/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
🛠️ Using tool: coder_report_task from mcp server coder
● Running coder_report_task with the param:
⋮ {
⋮ "name": "coder_report_task",
⋮ "arguments": {
⋮ "summary": "Checking for untracked files in the repository",
⋮ "link": "/Users/jkmr/Documents/work/agentapi",
⋮ "state": "working"
⋮ }
⋮ }

Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> t


● Completed in 0.0s





🛠️ Using tool: execute_bash
● I will run the following shell command:
git status --porcelain | grep '^??' | wc -l
↳ Purpose: Count untracked files using git status


Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> t

8

● Completed in 0.24s


> There are 8 untracked files in the repository.


🛠️ Using tool: coder_report_task (trusted) from mcp server coder
● Running coder_report_task with the param:
⋮ {
⋮ "name": "coder_report_task",
⋮ "arguments": {
⋮ "link": "/Users/jkmr/Documents/work/agentapi",
⋮ "summary": "Found 8 untracked files in the repository",
⋮ "state": "idle"
⋮ }
⋮ }

● Completed in 0.0s
Loading