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

Skip to content

Commit bf7acf8

Browse files
authored
feat: support amazonq cli (#80)
1 parent 3f7ced2 commit bf7acf8

File tree

20 files changed

+370
-2
lines changed

20 files changed

+370
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AgentAPI
22

3-
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.
3+
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.
44

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

cmd/server/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const (
3232
AgentTypeCursorAgent AgentType = msgfmt.AgentTypeCursorAgent
3333
AgentTypeCursor AgentType = msgfmt.AgentTypeCursor
3434
AgentTypeAuggie AgentType = msgfmt.AgentTypeAuggie
35+
AgentTypeAmazonQ AgentType = msgfmt.AgentTypeAmazonQ
36+
AgentTypeQ AgentType = msgfmt.AgentTypeQ
3537
AgentTypeCustom AgentType = msgfmt.AgentTypeCustom
3638
)
3739

@@ -46,6 +48,8 @@ var agentTypeMap = map[AgentType]bool{
4648
AgentTypeCursorAgent: true,
4749
AgentTypeCursor: true,
4850
AgentTypeAuggie: true,
51+
AgentTypeAmazonQ: true,
52+
AgentTypeQ: true,
4953
AgentTypeCustom: true,
5054
}
5155

cmd/server/server_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ func TestParseAgentType(t *testing.T) {
5757
agentTypeVar: "",
5858
want: AgentTypeCursor,
5959
},
60+
{
61+
firstArg: "amazonq",
62+
agentTypeVar: "",
63+
want: AgentTypeAmazonQ,
64+
},
65+
{
66+
firstArg: "q",
67+
agentTypeVar: "",
68+
want: AgentTypeQ,
69+
},
6070
{
6171
firstArg: "auggie",
6272
agentTypeVar: "",
@@ -97,6 +107,16 @@ func TestParseAgentType(t *testing.T) {
97107
agentTypeVar: "gemini",
98108
want: AgentTypeGemini,
99109
},
110+
{
111+
firstArg: "claude",
112+
agentTypeVar: "amazonq",
113+
want: AgentTypeAmazonQ,
114+
},
115+
{
116+
firstArg: "claude",
117+
agentTypeVar: "q",
118+
want: AgentTypeQ,
119+
},
100120
{
101121
firstArg: "claude",
102122
agentTypeVar: "cursor-agent",

lib/msgfmt/msgfmt.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ const (
234234
AgentTypeCursorAgent AgentType = "cursor-agent"
235235
AgentTypeCursor AgentType = "cursor"
236236
AgentTypeAuggie AgentType = "auggie"
237+
AgentTypeAmazonQ AgentType = "amazonq"
238+
AgentTypeQ AgentType = "q"
237239
AgentTypeCustom AgentType = "custom"
238240
)
239241

@@ -271,6 +273,10 @@ func FormatAgentMessage(agentType AgentType, message string, userInput string) s
271273
return formatGenericMessage(message, userInput, agentType)
272274
case AgentTypeAuggie:
273275
return formatGenericMessage(message, userInput, agentType)
276+
case AgentTypeAmazonQ:
277+
return formatGenericMessage(message, userInput, agentType)
278+
case AgentTypeQ:
279+
return formatGenericMessage(message, userInput, agentType)
274280
case AgentTypeCustom:
275281
return formatGenericMessage(message, userInput, agentType)
276282
default:

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, AgentTypeAmp, AgentTypeCodex, AgentTypeCursorAgent, AgentTypeCursor, AgentTypeAuggie, AgentTypeCustom}
221+
agentTypes := []AgentType{AgentTypeClaude, AgentTypeGoose, AgentTypeAider, AgentTypeGemini, AgentTypeAmp, AgentTypeCodex, AgentTypeCursorAgent, AgentTypeCursor, AgentTypeAuggie, AgentTypeQ, AgentTypeCustom}
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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
🛠️ Using tool: coder_report_task from mcp server coder
2+
3+
● Running coder_report_task with the param:
4+
⋮ {
5+
⋮ "name": "coder_report_task",
6+
⋮ "arguments": {
7+
⋮ "summary": "Checking current directory to identify repository",
8+
⋮ "link": "",
9+
⋮ "state": "working"
10+
⋮ }
11+
⋮ }
12+
13+
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
> what repo is this ?
2+
3+
4+
5+
6+
🛠️ Using tool: coder_report_task from mcp server coder
7+
8+
● Running coder_report_task with the param:
9+
⋮ {
10+
⋮ "name": "coder_report_task",
11+
⋮ "arguments": {
12+
⋮ "summary": "Checking current directory to identify repository",
13+
⋮ "link": "",
14+
⋮ "state": "working"
15+
⋮ }
16+
⋮ }
17+
18+
Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:
19+
20+
>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
what repo is this ?
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
✓ coder loaded in 0.03 s
2+
3+
Welcome to Amazon Q!
4+
5+
💡 Run /prompts to learn how to build & run repeatable workflows
6+
7+
/help all commands
8+
ctrl + j new lines
9+
ctrl + s fuzzy search
10+
11+
12+
🤖 You are chatting with claude-sonnet-4
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
✓ coder loaded in 0.03 s
2+
3+
Welcome to Amazon Q!
4+
5+
💡 Run /prompts to learn how to build & run repeatable workflows
6+
7+
/help all commands
8+
ctrl + j new lines
9+
ctrl + s fuzzy search
10+
11+
12+
🤖 You are chatting with claude-sonnet-4
13+
14+
>

0 commit comments

Comments
 (0)