summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/run.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-07 14:39:22 +0300
committerPaul Buetow <paul@buetow.org>2025-09-07 14:39:22 +0300
commit4c93677c79983560eea13c372a20ed78f02af4f9 (patch)
tree5002ece7e13b8fafb54325ec29f1ae69151ea8a9 /internal/hexaiaction/run.go
parent90e586831c0351fb5808ef5c1eca0692178731c9 (diff)
feat: add 'Simplify and improve' action; configurable prompts in config; wire into LSP and TUI
Diffstat (limited to 'internal/hexaiaction/run.go')
-rw-r--r--internal/hexaiaction/run.go34
1 files changed, 19 insertions, 15 deletions
diff --git a/internal/hexaiaction/run.go b/internal/hexaiaction/run.go
index a8d4243..5417d3f 100644
--- a/internal/hexaiaction/run.go
+++ b/internal/hexaiaction/run.go
@@ -46,10 +46,10 @@ func Run(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer) error {
}
func executeAction(ctx context.Context, kind ActionKind, parts InputParts, cfg appconfig.App, client chatDoer, stderr io.Writer) (string, error) {
- switch kind {
- case ActionSkip:
- return parts.Selection, nil
- case ActionRewrite:
+ switch kind {
+ case ActionSkip:
+ return parts.Selection, nil
+ case ActionRewrite:
instr, cleaned := ExtractInstruction(parts.Selection)
if strings.TrimSpace(instr) == "" {
fmt.Fprintln(stderr, logging.AnsiBase+"hexai-tmux-action: no inline instruction found; echoing input"+logging.AnsiReset)
@@ -62,17 +62,21 @@ func executeAction(ctx context.Context, kind ActionKind, parts InputParts, cfg a
cctx, cancel := timeout10s(ctx)
defer cancel()
return runDiagnostics(cctx, cfg, client, parts.Diagnostics, parts.Selection)
- case ActionDocument:
- cctx, cancel := timeout10s(ctx)
- defer cancel()
- return runDocument(cctx, cfg, client, parts.Selection)
- case ActionGoTest:
- cctx, cancel := timeout8s(ctx)
- defer cancel()
- return runGoTest(cctx, cfg, client, parts.Selection)
- default:
- return parts.Selection, nil
- }
+ case ActionDocument:
+ cctx, cancel := timeout10s(ctx)
+ defer cancel()
+ return runDocument(cctx, cfg, client, parts.Selection)
+ case ActionGoTest:
+ cctx, cancel := timeout8s(ctx)
+ defer cancel()
+ return runGoTest(cctx, cfg, client, parts.Selection)
+ case ActionSimplify:
+ cctx, cancel := timeout10s(ctx)
+ defer cancel()
+ return runSimplify(cctx, cfg, client, parts.Selection)
+ default:
+ return parts.Selection, nil
+ }
}
// client construction is shared via internal/llmutils