From 944838bb0f753a0920ddb2f506758c410ed7ca43 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 8 Feb 2026 17:33:04 +0200 Subject: Fix amp agent prompt extraction to use TUI box pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .tmux-edit-send.Ac8ezG.md | 1 + config.toml.example | 6 +- docs/coverage.html | 11263 +++ docs/coverage.out | 126933 +++++++++++++++++++++++++++ docs/coverage/_internal.out | 1 + docs/coverage/_internal_appconfig.out | 514 + docs/coverage/_internal_editor.out | 25 + docs/coverage/_internal_hexaiaction.out | 302 + docs/coverage/_internal_hexaicli.out | 240 + docs/coverage/_internal_hexailsp.out | 47 + docs/coverage/_internal_ignore.out | 20 + docs/coverage/_internal_llm.out | 371 + docs/coverage/_internal_llmutils.out | 8 + docs/coverage/_internal_logging.out | 16 + docs/coverage/_internal_lsp.out | 1190 + docs/coverage/_internal_runtimeconfig.out | 76 + docs/coverage/_internal_stats.out | 89 + docs/coverage/_internal_testutil.out | 6 + docs/coverage/_internal_textutil.out | 60 + docs/coverage/_internal_tmux.out | 104 + docs/coverage/_internal_tmuxedit.out | 231 + docs/tmux.md | 8 +- docs/usage.md | 21 +- internal/tmuxedit/config_agent.go | 2 +- internal/tmuxedit/config_agent_test.go | 3 +- prompts/tmux-edit-integration-tests.md | 445 + 26 files changed, 141973 insertions(+), 9 deletions(-) create mode 100644 .tmux-edit-send.Ac8ezG.md create mode 100644 docs/coverage.html create mode 100644 docs/coverage.out create mode 100644 docs/coverage/_internal.out create mode 100644 docs/coverage/_internal_appconfig.out create mode 100644 docs/coverage/_internal_editor.out create mode 100644 docs/coverage/_internal_hexaiaction.out create mode 100644 docs/coverage/_internal_hexaicli.out create mode 100644 docs/coverage/_internal_hexailsp.out create mode 100644 docs/coverage/_internal_ignore.out create mode 100644 docs/coverage/_internal_llm.out create mode 100644 docs/coverage/_internal_llmutils.out create mode 100644 docs/coverage/_internal_logging.out create mode 100644 docs/coverage/_internal_lsp.out create mode 100644 docs/coverage/_internal_runtimeconfig.out create mode 100644 docs/coverage/_internal_stats.out create mode 100644 docs/coverage/_internal_testutil.out create mode 100644 docs/coverage/_internal_textutil.out create mode 100644 docs/coverage/_internal_tmux.out create mode 100644 docs/coverage/_internal_tmuxedit.out create mode 100644 prompts/tmux-edit-integration-tests.md diff --git a/.tmux-edit-send.Ac8ezG.md b/.tmux-edit-send.Ac8ezG.md new file mode 100644 index 0000000..bccdb31 --- /dev/null +++ b/.tmux-edit-send.Ac8ezG.md @@ -0,0 +1 @@ + i see so it is very good diff --git a/config.toml.example b/config.toml.example index cc4471d..781dc19 100644 --- a/config.toml.example +++ b/config.toml.example @@ -160,7 +160,11 @@ temperature = 0.2 # default_agent = "" # force agent name; skip auto-detect # Override or add agent definitions (merged with built-in defaults by name). -# Built-in agents: claude, cursor, amp, aider. +# Built-in agents (checked in order): cursor, claude, amp, aider. +# - cursor: Box UI │...│, clears with End+BSpace*200 +# - claude: Prompt symbol ❯, clears with Escape gg C-v G d i (Vi/Vim) +# - amp: Box UI │...│ (TUI mode), clears with C-u (Emacs/readline) +# - aider: Shell-style > prompt, clears with C-u (Emacs/readline) # Tmux keybinding (add to ~/.tmux.conf): # bind e run-shell -b "hexai-tmux-edit --pane '#{pane_id}'" diff --git a/docs/coverage.html b/docs/coverage.html new file mode 100644 index 0000000..70dbf00 --- /dev/null +++ b/docs/coverage.html @@ -0,0 +1,11263 @@ + + + + + + hexai-lsp: Go Coverage Report + + + +
+ +
+ not tracked + + no coverage + low coverage + * + * + * + * + * + * + * + * + high coverage + +
+
+
+ + + + + + + + + +