summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/cmdentry.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-25 08:49:02 +0300
committerPaul Buetow <paul@buetow.org>2026-04-25 08:49:02 +0300
commite33cd60277bc717ad7a8c73cf01c7bedad0d1837 (patch)
treecf3e72b6e16223a207883c7049ae200ac57aee2d /internal/hexaiaction/cmdentry.go
parentcaa7876ac8bdb5cc23e12db4d4cb65cf86861151 (diff)
Release v0.35.0: fix-typos action and tmux popup for hexai-tmux-action
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/hexaiaction/cmdentry.go')
-rw-r--r--internal/hexaiaction/cmdentry.go26
1 files changed, 12 insertions, 14 deletions
diff --git a/internal/hexaiaction/cmdentry.go b/internal/hexaiaction/cmdentry.go
index 78c315b..d60f172 100644
--- a/internal/hexaiaction/cmdentry.go
+++ b/internal/hexaiaction/cmdentry.go
@@ -10,17 +10,16 @@ import (
"codeberg.org/snonux/hexai/internal/llm"
"codeberg.org/snonux/hexai/internal/tmux"
- "golang.org/x/term"
)
// Options configures the command-line orchestration for hexai-tmux-action.
type Options struct {
- Infile string
- Outfile string
- UIChild bool
- TmuxTarget string
- TmuxSplit string // "v" or "h"
- TmuxPercent int // 1-100
+ Infile string
+ Outfile string
+ UIChild bool
+ TmuxTarget string
+ TmuxPopupWidth string // popup width, e.g. "80%" or "120"
+ TmuxPopupHeight string // popup height, e.g. "80%" or "40"
}
// RunCommand is the CLI orchestrator used by cmd/hexai-tmux-action. It runs in tmux
@@ -30,14 +29,13 @@ func RunCommand(ctx context.Context, opts Options, stdin io.Reader, stdout, stde
if opts.UIChild {
return runChild(ctx, opts.Infile, opts.Outfile, stdout, stderr)
}
- // Always use tmux path
- return runInTmuxParent(ctx, stdin, stdout, opts.TmuxTarget, opts.TmuxSplit, opts.TmuxPercent)
+ // Always use tmux popup path
+ return runInTmuxParent(ctx, stdin, stdout, opts.TmuxTarget, opts.TmuxPopupWidth, opts.TmuxPopupHeight)
}
// seams for unit tests
var (
- isTTYFn = func(fd uintptr) bool { return term.IsTerminal(int(fd)) }
- splitRunFn = tmux.SplitRun
+ popupRunFn = tmux.PopupRun
osExecutableFn = os.Executable
runFn = Run
)
@@ -99,7 +97,7 @@ func runChild(ctx context.Context, infile, outfile string, stdout, stderr io.Wri
return os.Rename(tmp, outfile)
}
-func runInTmuxParent(ctx context.Context, stdin io.Reader, stdout io.Writer, target, split string, percent int) error {
+func runInTmuxParent(ctx context.Context, stdin io.Reader, stdout io.Writer, target, popupWidth, popupHeight string) error {
dir, err := os.MkdirTemp("", "hexai-tmux-action-")
if err != nil {
return err
@@ -115,8 +113,8 @@ func runInTmuxParent(ctx context.Context, stdin io.Reader, stdout io.Writer, tar
return err
}
argv := []string{exe, "-ui-child", "-infile", inPath, "-outfile", outPath}
- opts := tmux.SplitOpts{Target: target, Vertical: split != "h", Percent: percent}
- if err := splitRunFn(opts, argv); err != nil {
+ opts := tmux.PopupOpts{Target: target, Width: popupWidth, Height: popupHeight}
+ if err := popupRunFn(opts, argv); err != nil {
return err
}
if err := waitForFile(ctx, outPath, 60*time.Second); err != nil {