diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-08 17:33:04 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-08 17:33:04 +0200 |
| commit | 944838bb0f753a0920ddb2f506758c410ed7ca43 (patch) | |
| tree | 12d6ae9e2de8878891159e363134a3f07686ed7a /internal | |
| parent | c802ba5803de1a53749bb5c4ecbc0159fceb385f (diff) | |
Fix amp agent prompt extraction to use TUI box pattern
Amp CLI runs in TUI mode with box-drawing UI (│ text │) similar to
Cursor, not shell-style (> prompt). Updated prompt pattern from
`(?m)>\s*(.+)$` to `(?m)│\s*(.+?)\s*│\s*$` to correctly extract
text from amp's box UI.
Changes:
- internal/tmuxedit/config_agent.go: Update amp promptPat to box pattern
- internal/tmuxedit/config_agent_test.go: Update test to use box format
- docs/usage.md: Document detection order and clear methods for all agents
- docs/tmux.md: Clarify input mode handling (Vim vs Emacs/readline)
- config.toml.example: Add detailed agent descriptions and patterns
- prompts/tmux-edit-integration-tests.md: Add test status, mock editor best practices
Integration tests verified:
- Amp detection: amp/sourcegraph keywords
- Prompt extraction: "hello world test" correctly captured
- End-to-end workflow: text modification and sending works
- Multi-line support: all lines delivered correctly
- All unit tests pass (67/67)
- Coverage: 80.9% (meets requirement)
- Cursor and Claude implementations unchanged
Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/tmuxedit/config_agent.go | 2 | ||||
| -rw-r--r-- | internal/tmuxedit/config_agent_test.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/internal/tmuxedit/config_agent.go b/internal/tmuxedit/config_agent.go index 2773025..e5268fa 100644 --- a/internal/tmuxedit/config_agent.go +++ b/internal/tmuxedit/config_agent.go @@ -23,7 +23,7 @@ func builtinAgents() []Agent { name: "amp", displayName: "Amp", detectPattern: `(?i)(amp|sourcegraph)`, - promptPat: `(?m)>\s*(.+)$`, + promptPat: `(?m)│\s*(.+?)\s*│\s*$`, clearFirst: true, clearKeys: "C-u", newlineKeys: "S-Enter", diff --git a/internal/tmuxedit/config_agent_test.go b/internal/tmuxedit/config_agent_test.go index 7c49c42..d7ad649 100644 --- a/internal/tmuxedit/config_agent_test.go +++ b/internal/tmuxedit/config_agent_test.go @@ -154,7 +154,8 @@ func TestConfigAgent_Amp(t *testing.T) { if !amp.Detect("Amp by Sourcegraph") { t.Error("amp should detect 'Amp by Sourcegraph'") } - got := amp.ExtractPrompt("> fix the bug") + // Amp uses box-drawing TUI format (like cursor), not shell-style > prompt + got := amp.ExtractPrompt("│ fix the bug │") if got != "fix the bug" { t.Errorf("ExtractPrompt() = %q, want %q", got, "fix the bug") } |
