Skip to content

Commit d812bef

Browse files
committed
🐛 refactor: update chat.go and dependencies in go.mod
Refactor chat.go for improved readability and maintainability. Update go.mod to include new dependencies and their versions, ensuring compatibility with the latest features and bug fixes.
1 parent 29f567a commit d812bef

4 files changed

Lines changed: 186 additions & 78 deletions

File tree

cmd/vibeaura/chat.go

Lines changed: 85 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@ import (
1313
"sort"
1414
"strings"
1515
"sync"
16-
"time"
17-
18-
"golang.design/x/clipboard"
19-
20-
"github.com/charmbracelet/bubbles/textarea"
21-
22-
"github.com/charmbracelet/bubbles/viewport" tea "github.com/charmbracelet/bubbletea"
23-
"github.com/charmbracelet/lipgloss"
24-
"github.com/google/uuid"
25-
"github.com/nathfavour/vibeauracle/brain"
26-
"github.com/nathfavour/vibeauracle/internal/doctor"
27-
vmodel "github.com/nathfavour/vibeauracle/model"
28-
"github.com/nathfavour/vibeauracle/prompt"
29-
"github.com/nathfavour/vibeauracle/reactor"
30-
"github.com/nathfavour/vibeauracle/sys"
31-
"github.com/nathfavour/vibeauracle/tooling"
32-
)
16+
"time"
17+
18+
"golang.design/x/clipboard"
19+
"github.com/charmbracelet/bubbles/textarea"
20+
"github.com/charmbracelet/bubbles/viewport"
21+
tea "github.com/charmbracelet/bubbletea"
22+
"github.com/charmbracelet/lipgloss"
23+
"github.com/google/uuid"
24+
"github.com/nathfavour/vibeauracle/brain"
25+
"github.com/nathfavour/vibeauracle/internal/doctor"
26+
vmodel "github.com/nathfavour/vibeauracle/model"
27+
"github.com/nathfavour/vibeauracle/prompt"
28+
"github.com/nathfavour/vibeauracle/reactor"
29+
"github.com/nathfavour/vibeauracle/sys"
30+
"github.com/nathfavour/vibeauracle/tooling"
31+
)
3332

3433
type focus int
3534

@@ -2094,39 +2093,75 @@ func (m *model) handleSlashCommand(cmd string) (tea.Model, tea.Cmd) {
20942093
}
20952094
}
20962095

2097-
if lastUser != "" && lastAI != "" {
2098-
formatted := fmt.Sprintf("Question: %s\n\nAnswer: %s", strings.TrimSpace(lastUser), strings.TrimSpace(lastAI))
2099-
2100-
// 1. Try native Go clipboard (talks to X11/Wayland/Win/Mac APIs directly)
2101-
clipboard.Write(clipboard.FmtText, []byte(formatted))
2102-
2103-
// We assume success if it didn't panic (native lib design)
2104-
// But we still check for Termux as it's a special sandbox
2105-
if _, tErr := exec.LookPath("termux-clipboard-set"); tErr == nil {
2106-
cmd := exec.Command("termux-clipboard-set")
2107-
cmd.Stdin = strings.NewReader(formatted)
2108-
_ = cmd.Run()
2109-
}
2110-
2111-
m.messages = append(m.messages, subtleStyle.Render("✓ Copied Q&A block to clipboard"))
2112-
} else {
2113-
m.messages = append(m.messages, errorStyle.Render(" COPY ERROR ")+"\nNo Q&A block found to copy.")
2114-
}
2115-
return m, m.asyncRender() case "/shot": return m.takeScreenshot()
2116-
case "/record":
2117-
return m.toggleRecording()
2118-
case "/show-tree", "/sidebar":
2119-
m.showTree = !m.showTree
2120-
// trigger resize
2121-
return m, func() tea.Msg { return tea.WindowSizeMsg{Width: m.width, Height: m.height} }
2122-
case "/clear":
2123-
m.messages = []string{}
2124-
m.historyRendered = ""
2125-
ensureBanner(&m.messages, m.banner)
2126-
m.messages = append(m.messages, "Type "+systemStyle.Render("/help")+" to see available commands.")
2127-
m.saveState()
2128-
return m, m.asyncRenderWithPos(true, false, 0)
2129-
case "/heal":
2096+
if lastUser != "" && lastAI != "" {
2097+
2098+
formatted := fmt.Sprintf("Question: %s\n\nAnswer: %s", strings.TrimSpace(lastUser), strings.TrimSpace(lastAI))
2099+
2100+
2101+
2102+
// 1. Try native Go clipboard (talks to X11/Wayland/Win/Mac APIs directly)
2103+
2104+
clipboard.Write(clipboard.FmtText, []byte(formatted))
2105+
2106+
2107+
2108+
// We assume success if it didn't panic (native lib design)
2109+
2110+
// But we still check for Termux as it's a special sandbox
2111+
2112+
if _, tErr := exec.LookPath("termux-clipboard-set"); tErr == nil {
2113+
2114+
cmd := exec.Command("termux-clipboard-set")
2115+
2116+
cmd.Stdin = strings.NewReader(formatted)
2117+
2118+
_ = cmd.Run()
2119+
2120+
}
2121+
2122+
2123+
2124+
m.messages = append(m.messages, subtleStyle.Render("✓ Copied Q&A block to clipboard"))
2125+
2126+
} else {
2127+
2128+
m.messages = append(m.messages, errorStyle.Render(" COPY ERROR ")+"\nNo Q&A block found to copy.")
2129+
2130+
}
2131+
2132+
return m, m.asyncRender()
2133+
2134+
case "/shot":
2135+
2136+
return m.takeScreenshot()
2137+
2138+
case "/record":
2139+
2140+
return m.toggleRecording()
2141+
2142+
case "/show-tree", "/sidebar":
2143+
2144+
m.showTree = !m.showTree
2145+
2146+
// trigger resize
2147+
2148+
return m, func() tea.Msg { return tea.WindowSizeMsg{Width: m.width, Height: m.height} }
2149+
2150+
case "/clear":
2151+
2152+
m.messages = []string{}
2153+
2154+
m.historyRendered = ""
2155+
2156+
ensureBanner(&m.messages, m.banner)
2157+
2158+
m.messages = append(m.messages, "Type "+systemStyle.Render("/help")+" to see available commands.")
2159+
2160+
m.saveState()
2161+
2162+
return m, m.asyncRenderWithPos(true, false, 0)
2163+
2164+
case "/heal":
21302165
issue := "Analyze and fix current project failures"
21312166
if len(parts) > 1 {
21322167
issue = strings.Join(parts[1:], " ")

cmd/vibeaura/go.mod

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,48 @@ module github.com/nathfavour/vibeauracle/cmd/vibeaura
33
go 1.25.5
44

55
require (
6+
github.com/charmbracelet/bubbles v0.21.1
67
github.com/charmbracelet/bubbletea v1.3.10
78
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834
8-
github.com/mattn/go-runewidth v0.0.16
9+
github.com/google/uuid v1.6.0
10+
github.com/mattn/go-runewidth v0.0.19
911
github.com/nathfavour/vibeauracle/brain v0.0.0
1012
github.com/nathfavour/vibeauracle/daemon v0.0.0
1113
github.com/nathfavour/vibeauracle/internal/doctor v0.0.0-00010101000000-000000000000
14+
github.com/nathfavour/vibeauracle/reactor v0.0.0-00010101000000-000000000000
1215
github.com/nathfavour/vibeauracle/sys v0.0.0
1316
github.com/nathfavour/vibeauracle/tooling v0.0.0-00010101000000-000000000000
1417
github.com/spf13/cobra v1.10.2
18+
golang.design/x/clipboard v0.7.1
1519
golang.org/x/mod v0.32.0
1620
)
1721

1822
require (
19-
github.com/google/uuid v1.6.0 // indirect
23+
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
24+
github.com/atotto/clipboard v0.1.4 // indirect
25+
github.com/aymerick/douceur v0.2.0 // indirect
26+
github.com/charmbracelet/glamour v0.10.0 // indirect
27+
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
28+
github.com/clipperhouse/displaywidth v0.9.0 // indirect
29+
github.com/clipperhouse/stringish v0.1.1 // indirect
30+
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
31+
github.com/gorilla/css v1.0.1 // indirect
32+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
33+
github.com/muesli/reflow v0.3.0 // indirect
2034
github.com/philippgille/chromem-go v0.7.0 // indirect
2135
github.com/segmentio/asm v1.1.3 // indirect
2236
github.com/segmentio/encoding v0.3.4 // indirect
37+
github.com/yuin/goldmark v1.7.8 // indirect
38+
github.com/yuin/goldmark-emoji v1.0.5 // indirect
2339
go.lsp.dev/jsonrpc2 v0.10.0 // indirect
2440
go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 // indirect
2541
go.lsp.dev/protocol v0.12.0 // indirect
2642
go.lsp.dev/uri v0.3.0 // indirect
2743
go.uber.org/multierr v1.11.0 // indirect
2844
go.uber.org/zap v1.27.0 // indirect
45+
golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476 // indirect
46+
golang.org/x/image v0.28.0 // indirect
47+
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f // indirect
2948
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
3049
google.golang.org/grpc v1.78.0 // indirect
3150
google.golang.org/protobuf v1.36.10 // indirect
@@ -37,10 +56,10 @@ require (
3756
github.com/99designs/keyring v1.2.2 // indirect
3857
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
3958
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
40-
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
41-
github.com/charmbracelet/x/ansi v0.10.1 // indirect
42-
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
43-
github.com/charmbracelet/x/term v0.2.1 // indirect
59+
github.com/charmbracelet/colorprofile v0.4.1 // indirect
60+
github.com/charmbracelet/x/ansi v0.11.5 // indirect
61+
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
62+
github.com/charmbracelet/x/term v0.2.2 // indirect
4463
github.com/cli/go-gh/v2 v2.13.0 // indirect
4564
github.com/cli/safeexec v1.0.0 // indirect
4665
github.com/danieljoos/wincred v1.1.2 // indirect
@@ -57,7 +76,7 @@ require (
5776
github.com/google/jsonschema-go v0.4.2 // indirect
5877
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
5978
github.com/inconshreveable/mousetrap v1.1.0 // indirect
60-
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
79+
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
6180
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
6281
github.com/mattn/go-isatty v0.0.20 // indirect
6382
github.com/mattn/go-localereader v0.0.1 // indirect
@@ -70,7 +89,7 @@ require (
7089
github.com/nathfavour/vibeauracle/copilot v0.0.0 // indirect
7190
github.com/nathfavour/vibeauracle/internal/vibe v0.0.0 // indirect
7291
github.com/nathfavour/vibeauracle/model v0.0.0
73-
github.com/nathfavour/vibeauracle/prompt v0.0.0 // indirect
92+
github.com/nathfavour/vibeauracle/prompt v0.0.0
7493
github.com/nathfavour/vibeauracle/vault v0.0.0-00010101000000-000000000000 // indirect
7594
github.com/ollama/ollama v0.13.5 // indirect
7695
github.com/pelletier/go-toml/v2 v2.2.4 // indirect

0 commit comments

Comments
 (0)