Skip to content

Commit 7948265

Browse files
committed
support Sourcegraph Amp cli
1 parent 7c6d16e commit 7948265

File tree

15 files changed

+96
-4
lines changed

15 files changed

+96
-4
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
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) and [Codex](https://github.com/openai/codex) with an HTTP API.
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) and [Codex](https://github.com/openai/codex) with an HTTP API.
44

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

7-
87
You can use AgentAPI:
98

109
- to build a unified chat interface for coding agents

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
var rootCmd = &cobra.Command{
1313
Use: "agentapi",
1414
Short: "AgentAPI CLI",
15-
Long: `AgentAPI - HTTP API for Claude Code, Goose, Aider, Gemini and Codex`,
15+
Long: `AgentAPI - HTTP API for Claude Code, Goose, Aider, Gemini, Sourcegraph Amp and Codex`,
1616
Version: "0.3.2",
1717
}
1818

cmd/server/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const (
3636
AgentTypeAider AgentType = msgfmt.AgentTypeAider
3737
AgentTypeCodex AgentType = msgfmt.AgentTypeCodex
3838
AgentTypeGemini AgentType = msgfmt.AgentTypeGemini
39+
AgentTypeAmp AgentType = msgfmt.AgentTypeAmp
3940
AgentTypeCustom AgentType = msgfmt.AgentTypeCustom
4041
)
4142

@@ -46,6 +47,7 @@ var agentTypeMap = map[AgentType]bool{
4647
AgentTypeAider: true,
4748
AgentTypeCodex: true,
4849
AgentTypeGemini: true,
50+
AgentTypeAmp: true,
4951
AgentTypeCustom: true,
5052
}
5153

cmd/server/server_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ func TestParseAgentType(t *testing.T) {
2828
agentTypeVar: "",
2929
want: AgentTypeGemini,
3030
},
31+
{
32+
firstArg: "amp",
33+
agentTypeVar: "",
34+
want: AgentTypeAmp,
35+
},
3136
{
3237
firstArg: "goose",
3338
agentTypeVar: "",

lib/msgfmt/msgfmt.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ const (
206206
AgentTypeAider AgentType = "aider"
207207
AgentTypeCodex AgentType = "codex"
208208
AgentTypeGemini AgentType = "gemini"
209+
AgentTypeAmp AgentType = "amp"
209210
AgentTypeCustom AgentType = "custom"
210211
)
211212

@@ -236,6 +237,8 @@ func FormatAgentMessage(agentType AgentType, message string, userInput string) s
236237
return formatCodexMessage(message, userInput)
237238
case AgentTypeGemini:
238239
return formatGenericMessage(message, userInput)
240+
case AgentTypeAmp:
241+
return formatGenericMessage(message, userInput)
239242
case AgentTypeCustom:
240243
return formatGenericMessage(message, userInput)
241244
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, AgentTypeCodex, AgentTypeCustom}
221+
agentTypes := []AgentType{AgentTypeClaude, AgentTypeGoose, AgentTypeAider, AgentTypeGemini, AgentTypeAmp, AgentTypeCodex, 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Welcome to Amp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Welcome to Amp
2+
3+
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
4+
│ │
5+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

lib/msgfmt/testdata/format/amp/first_massage/user.txt

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
∴ Thinking
2+
The user is asking me to identify which file contains this specific TypeScript code snippet. The code shows a useEffect hook that sets up polling
3+
for messages and server status. I need to search for this code in the codebase to find the file it belongs to.
4+
5+
I should use the Grep tool to search for some unique parts of this code to locate the file.
6+
7+
✓ Grep Set up polling for messages and server status
8+
9+
✓ Grep const messageInterval = setInterval\(fetchMessages, 1000\)
10+
11+
✓ List Directory /mnt/c/Users/Username/test-amp
12+
13+
No files found in the workspace containing this code.

0 commit comments

Comments
 (0)