summaryrefslogtreecommitdiff
path: root/internal/askcli/command_edit.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-11 00:28:27 +0300
committerPaul Buetow <paul@buetow.org>2026-06-11 00:28:27 +0300
commitb4f06c656d8d8733a9bf2e2e2a5eb2a7a48389bb (patch)
tree7df0eac26ded2b4854225711dfde8f40d80a0400 /internal/askcli/command_edit.go
parent2b2f4110da53a03742faff89cdec17c55e091a90 (diff)
Extract shared chatrun package to eliminate chat-runner DRY violations
The CLI, LSP server and tmux code-action tool each carried near-identical chat-running logic: invoking the LLM (streaming-aware), collecting the response, and accounting sent/received bytes into the stats package. Introduce internal/chatrun with: - Invoke: streaming-aware LLM call that collects the full response and optionally mirrors chunks to a writer (nil writer = collect only). - SentBytes / Account: shared byte counting and stats.Update. Wire all three surfaces to it: - hexaicli: runChatRequest delegates to chatrun.Invoke; summarizeChatRun uses chatrun.Account. Removed the duplicated streaming/simple helpers. - hexaiaction: runOnce uses chatrun.Invoke + chatrun.Account, keeping the tmux status update local. - lsp: chatWithStats and the completion path use chatrun.SentBytes/Invoke; extracted unavailableClientError to keep chatWithStats small. chatrun has 100% test coverage; full suite passes with -race. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/askcli/command_edit.go')
0 files changed, 0 insertions, 0 deletions