summaryrefslogtreecommitdiff
path: root/Magefile.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-08 11:14:36 +0200
committerPaul Buetow <paul@buetow.org>2026-02-08 11:14:36 +0200
commit5e825543dc55a2c649e68dce6341844ad71fa217 (patch)
treef7aae1c1d130f08c383f95a23413bdde7843dc0f /Magefile.go
parent023ed82e612451caa38ec46106ed9d148ab9a595 (diff)
add hexai-tmux-edit: tmux popup editor for AI agent prompts
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>
Diffstat (limited to 'Magefile.go')
-rw-r--r--Magefile.go50
1 files changed, 31 insertions, 19 deletions
diff --git a/Magefile.go b/Magefile.go
index 1644f08..fb43238 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -24,7 +24,7 @@ var (
// Build builds binaries.
func Build() error {
- mg.Deps(BuildHexaiLSP, BuildHexaiCLI, BuildHexaiTmuxAction)
+ mg.Deps(BuildHexaiLSP, BuildHexaiCLI, BuildHexaiTmuxAction, BuildHexaiTmuxEdit)
printCoverage()
return nil
}
@@ -47,6 +47,12 @@ func BuildHexaiTmuxAction() error {
return sh.RunV("go", "build", "-o", "hexai-tmux-action", "cmd/hexai-tmux-action/main.go")
}
+// BuildHexaiTmuxEdit builds the hexai-tmux-edit popup editor binary.
+func BuildHexaiTmuxEdit() error {
+ printCoverage()
+ return sh.RunV("go", "build", "-o", "hexai-tmux-edit", "cmd/hexai-tmux-edit/main.go")
+}
+
// Dev runs tests, vet, lint, then builds with race for both binaries.
func Dev() error {
printCoverage()
@@ -57,7 +63,10 @@ func Dev() error {
if err := sh.RunV("go", "build", "-race", "-o", "hexai", "cmd/hexai/main.go"); err != nil {
return err
}
- return sh.RunV("go", "build", "-race", "-o", "hexai-tmux-action", "cmd/hexai-tmux-action/main.go")
+ if err := sh.RunV("go", "build", "-race", "-o", "hexai-tmux-action", "cmd/hexai-tmux-action/main.go"); err != nil {
+ return err
+ }
+ return sh.RunV("go", "build", "-race", "-o", "hexai-tmux-edit", "cmd/hexai-tmux-edit/main.go")
}
// Run launches the LSP server via go run (useful during development).
@@ -97,7 +106,10 @@ func Install() error {
if err := sh.RunV("cp", "-v", "./hexai", bin+"/"); err != nil {
return err
}
- return sh.RunV("cp", "-v", "./hexai-tmux-action", bin+"/")
+ if err := sh.RunV("cp", "-v", "./hexai-tmux-action", bin+"/"); err != nil {
+ return err
+ }
+ return sh.RunV("cp", "-v", "./hexai-tmux-edit", bin+"/")
}
// RunTmuxAction runs the hexai-tmux-action TUI via go run (reads stdin).
@@ -109,8 +121,8 @@ func RunTmuxAction() error {
// printCoverage prints a warning if an existing coverage profile shows total < coverateThreshold.
func printCoverage() {
- // Ensure the top-level coverage profile is refreshed at least once per day.
- ensureDailyCoverage(24 * time.Hour)
+ // Ensure the top-level coverage profile is refreshed at least once per day.
+ ensureDailyCoverage(24 * time.Hour)
select {
case coveragePrinted <- struct{}{}:
default:
@@ -126,20 +138,20 @@ func printCoverage() {
fmt.Println("[coverage] No coverage profile found (run 'mage cover' or 'mage coverall').")
return
}
- pct, ok := totalCoveragePercent(profile)
- if !ok {
- // Attempt a one-time regen if the profile is malformed
- if err := Coverage(); err == nil {
- if p2, ok2 := totalCoveragePercent(profile); ok2 {
- pct = p2
- ok = true
- }
- }
- }
- if !ok {
- fmt.Println("[coverage] Could not parse total coverage from", profile)
- return
- }
+ pct, ok := totalCoveragePercent(profile)
+ if !ok {
+ // Attempt a one-time regen if the profile is malformed
+ if err := Coverage(); err == nil {
+ if p2, ok2 := totalCoveragePercent(profile); ok2 {
+ pct = p2
+ ok = true
+ }
+ }
+ }
+ if !ok {
+ fmt.Println("[coverage] Could not parse total coverage from", profile)
+ return
+ }
if pct < coverageThreshold {
fmt.Printf("[coverage] WARNING: total test coverage is %.1f%% (< %.1f%%)\n", pct, coverageThreshold)
} else {