summaryrefslogtreecommitdiff
path: root/internal/tmuxedit
AgeCommit message (Collapse)Author
2026-04-07feat: remove tmux edit popup support for Claude CodePaul Buetow
Claude Code CLI now supports Ctrl+G to open the prompt in EDITOR (like OpenAI Codex CLI), making the built-in hexai-tmux-edit agent profile redundant. - Remove internal/tmuxedit/claude_agent.go and its tests - Update builtinAgents() to exclude claude; built-ins are now: cursor, amp, aider - Update all documentation (README, docs/tmux.md, docs/usage.md, docs/configuration.md) - Update config.toml.example to reflect new agent list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17Fix bugs, remove duplication, and clean up code quality issuesPaul Buetow
- Log swallowed JSON unmarshal errors in stats and LSP handlers - Fix debug log file handle leak in tmuxedit (return closer from initDebugLog) - Check f.Close() errors on write paths in promptstore and tmuxedit - Fix cacheGet TOCTOU race by using single write lock - Fix readInput to use passed stdin reader instead of os.Stdin.Stat() - Remove 45 'moved to' comment tombstones from lsp/handlers.go - Deduplicate canonicalProvider wrappers (use llmutils.CanonicalProvider directly) - Remove SetWindow side effect from stats.TakeSnapshot (pure read now) - Move duplicated splitLines to textutil.SplitLinesBytes - Collapse StatusSink.SetGlobal 10 params into GlobalStatus struct - Simplify LRU touchLocked to in-place delete-and-append Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16Replace Summary: prefixes with standard Go package doc commentsPaul Buetow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Decompose App God struct into embedded section structsPaul Buetow
Replace 60+ flat fields in App with 4 embedded section structs: CoreConfig, ProviderConfig, PromptConfig, FeatureConfig. Go field promotion preserves all existing field access patterns. Updated flattenAppConfig to recurse into embedded structs for runtimeconfig. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Replace panic with graceful error returns in tmuxedit and mcp-serverPaul Buetow
Change initDebugLog() and defaultLogPath() to return errors instead of panicking. Callers now handle errors gracefully with proper messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Release v0.24.0v0.24.0Paul Buetow
Bring unit test coverage from ~75% to 85.1% project-wide. All internal packages now exceed 80% coverage. Refactored cmd entrypoints to extract testable run() functions with injectable seams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11refactor: consolidate cache and state into .local/hexai directoryPaul Buetow
Move all cache and state files under ~/.local/hexai/ with subdirectories: - ~/.local/hexai/cache/ (was ~/.cache/hexai/) - ~/.local/hexai/state/ (was ~/.local/state/hexai/) - ~/.local/hexai/data/ (was ~/.local/share/hexai/) This centralizes all non-config hexai files under a single .local/hexai directory, making it easier to manage and back up user data. Amp-Thread-ID: https://ampcode.com/threads/T-019c4e03-73db-70a2-ae27-3e1cc31d59c3 Co-authored-by: Amp <amp@ampcode.com>
2026-02-10Add tmux popup history storage and consolidate state files to XDG_STATE_HOMEPaul Buetow
- Add StateDir() helper function respecting XDG_STATE_HOME (~/.local/state/hexai/) - Implement JSONL-based history storage for tmux popup submissions - New history.go with AppendHistory() and GetHistory() functions - Store timestamp, agent name, cwd, and submitted text - Comprehensive unit tests for history functionality - Integrate history append into tmux edit workflow after successful submission - Move logs from /tmp/ to persistent state directory: - hexai-lsp.log: ~/.local/state/hexai/hexai-lsp.log - hexai-tmux-edit.log: ~/.local/state/hexai/hexai-tmux-edit.log - Update README.md with File Locations section documenting XDG directories - Fix pre-existing test failures by isolating project config in unit tests - Panic on state directory creation failure instead of silent fallback All unit tests pass. Follows XDG Base Directory Specification for proper state file management with persistence across reboots. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-10Fix hexai-tmux-edit to open in current working directoryPaul Buetow
hexai-tmux-edit was opening in the wrong directory because the tmux popup wasn't being told which directory to use. This fix: - Updates bind-key example to cd into pane's current path - Passes working directory to popup via -d flag using os.Getwd() - Updates all documentation with corrected bind-key examples Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08Fix Claude agent clearing to use readline instead of vim commandsPaul Buetow
Claude Code's prompt input field does not support vim commands for clearing. The previous sequence 'Escape gg C-v G d i' resulted in literal text 'gGdijo' appearing in the prompt instead of clearing it. Changed to 'C-a C-k' (Emacs/readline style): - C-a: Move cursor to start of line - C-k: Kill (delete) from cursor to end of line Also added 150ms delay after Escape key in sendClearSequence to ensure mode transitions complete before subsequent keys are sent (though Claude uses readline, this helps other potential vim-based agents). Changes: - internal/tmuxedit/claude_agent.go: clearKeys "C-a C-k" instead of vim - internal/tmuxedit/claude_agent_test.go: Update test expectations - internal/tmuxedit/agentutil.go: Add time import and Escape delay - docs/usage.md: Update claude clear method documentation - docs/tmux.md: Clarify claude uses readline not vim - config.toml.example: Update claude description Integration tested: - Extracted: "final verification test" - Sent: "FINAL REPLACED TEXT NO VIM COMMANDS" - Result: Clean replacement with NO vim command artifacts - All unit tests pass (67/67) - Coverage: 80.9% Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08Fix amp agent prompt extraction to use TUI box patternPaul Buetow
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>
2026-02-08refactor tmuxedit to Agent interface with cursor/claude/config implementationsPaul Buetow
Replace monolithic AgentConfig struct with an Agent interface backed by baseAgent defaults and separate implementations for cursor (box-drawing extraction, bulk backspace clearing) and claude (section-scoped extraction with continuation lines, vim clearing). Simple agents (amp, aider) and user-defined agents use configAgent with baseAgent defaults. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08fix hexai-tmux-edit agent detection, multi-line extraction, and clearingPaul Buetow
- Reorder agents: cursor first to avoid false positive from "Claude 4.5 Sonnet" model name appearing in cursor panes - Change cursor detect pattern to box-drawing UI elements instead of name-based matching - Change claude detect pattern to ❯ prompt instead of generic "claude" - Support multi-line prompt extraction using last-contiguous-block algorithm to ignore command-review and dialog boxes - Fix deduplicateText to always return full edited text (clear + resend) instead of stripping original prefix which caused double-removal - Replace vim-style clear (Escape gg dG i) with universal End+BSpace*200 since cursor's prompt is not actually vim - Add Key*N repeat syntax in ClearKeys (parsed by parseKeyRepeat, sent via tmux send-keys -N) - Add 300ms sleep after clear to let TUI drain queued backspaces before new text arrives - Add debug logging to /tmp/hexai-tmux-edit.log - Add strip pattern for "ctrl+c to stop" noise in cursor prompt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08add hexai-tmux-edit: tmux popup editor for AI agent promptsPaul Buetow
New tool that opens $EDITOR in a tmux popup for composing longer prompts when working with AI CLI agents (Claude Code, Cursor, Amp, Aider, etc.). Captures existing prompt text from the target pane, pre-fills the editor, and sends edited text back via tmux send-keys. Config-driven agent detection via regex patterns in [tmux_edit] config section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>