summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-08 17:33:04 +0200
committerPaul Buetow <paul@buetow.org>2026-02-08 17:33:04 +0200
commitbe73769b81b57f9a90475a45f23b2c447178ff2a (patch)
tree0ffa602318b02ab2636daddcda6b7d3d46e768de /internal
parent4892fc63fa3a68d3e837a88b1254de849567227f (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.go2
-rw-r--r--internal/tmuxedit/config_agent_test.go3
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")
}