Skip to content

Commit 5e75a3d

Browse files
committed
chore: bump ecosystem deps to v0.5.0
1 parent 6ea45fe commit 5e75a3d

24 files changed

Lines changed: 27 additions & 591 deletions

‎cmd/agent.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"fmt"
55
"os"
66
"path/filepath"
7-
"strings"
87
"text/tabwriter"
98

109
"github.com/GrayCodeAI/hawk/agents"
1110
"github.com/spf13/cobra"
11+
"golang.org/x/text/cases"
12+
"golang.org/x/text/language"
1213
)
1314

1415
var agentCmd = &cobra.Command{
@@ -118,7 +119,7 @@ You are a specialized agent. Complete tasks according to your expertise.
118119
- Be precise and focused
119120
- Follow project conventions
120121
- Report results clearly
121-
`, name, desc, modelLine, strings.Title(name))
122+
`, name, desc, modelLine, cases.Title(language.English).String(name))
122123

123124
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
124125
return err

‎cmd/away_summary.go‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ func awaySummary(messages []displayMsg, lastActivity time.Time) string {
2323

2424
// Collect the most recent user and assistant messages for a recap.
2525
var userTopics []string
26-
var assistantSummaries []string
2726
var toolsUsed []string
2827

2928
// Look at the last 10 messages for context
@@ -40,12 +39,6 @@ func awaySummary(messages []displayMsg, lastActivity time.Time) string {
4039
} else {
4140
userTopics = append(userTopics, msg.content)
4241
}
43-
case "assistant":
44-
if len(msg.content) > 100 {
45-
assistantSummaries = append(assistantSummaries, msg.content[:100]+"...")
46-
} else {
47-
assistantSummaries = append(assistantSummaries, msg.content)
48-
}
4942
case "tool_use":
5043
toolsUsed = append(toolsUsed, msg.content)
5144
}

‎cmd/bugfind.go‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"fmt"
55
"os"
6-
"os/exec"
76
"path/filepath"
87
"strings"
98
)
@@ -121,22 +120,4 @@ func formatBugReport(findings string) string {
121120
return b.String()
122121
}
123122

124-
// gitDiffContent returns the output of `git diff` in the current directory.
125-
func gitDiffContent() (string, error) {
126-
cmd := exec.Command("git", "diff")
127-
out, err := cmd.CombinedOutput()
128-
if err != nil {
129-
return "", fmt.Errorf("git diff: %w", err)
130-
}
131-
return strings.TrimSpace(string(out)), nil
132-
}
133123

134-
// gitDiffStagedContent returns the output of `git diff --staged` in the current directory.
135-
func gitDiffStagedContent() (string, error) {
136-
cmd := exec.Command("git", "diff", "--staged")
137-
out, err := cmd.CombinedOutput()
138-
if err != nil {
139-
return "", fmt.Errorf("git diff --staged: %w", err)
140-
}
141-
return strings.TrimSpace(string(out)), nil
142-
}

‎cmd/chat_config_panel.go‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,6 @@ func (m chatModel) configModelView() string {
250250
return b.String()
251251
}
252252

253-
func (m chatModel) openConfigPanel() chatModel {
254-
m.configOpen = true
255-
m.configMenu = "provider"
256-
m.configSel = 0
257-
m.configNotice = ""
258-
m.viewDirty = true
259-
return m
260-
}
261-
262253
func (m chatModel) closeConfigPanel() chatModel {
263254
m.configOpen = false
264255
m.configMenu = ""

‎cmd/chat_model.go‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,10 @@ var (
2626
dimColor = lipgloss.Color("#666666")
2727
errorColor = lipgloss.Color("#e05555")
2828
toolColor = lipgloss.Color("#FFD700")
29-
userStyle = lipgloss.NewStyle().Foreground(tealColor).Bold(true)
30-
assistStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFFFFF"))
3129
dimStyle = lipgloss.NewStyle().Foreground(dimColor)
3230
errorStyle = lipgloss.NewStyle().Foreground(errorColor)
33-
headerStyle = lipgloss.NewStyle().Foreground(tealColor).Bold(true)
3431
toolStyle = lipgloss.NewStyle().Foreground(toolColor).Bold(true)
3532
toolDimStyle = lipgloss.NewStyle().Foreground(dimColor)
36-
diffAddStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#4ECDC4"))
37-
diffDelStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#e05555"))
3833
)
3934

4035
// Hawk spinner frames: dot-by-dot build then reverse (like Droid)

‎cmd/chat_view.go‎

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ func sanitizeIdentity(s string) string {
2828
return s
2929
}
3030

31-
// reBold matches markdown **bold** syntax.
32-
var reBold = regexp.MustCompile(`\*\*(.+?)\*\*`)
33-
34-
// renderInlineMarkdown converts inline markdown to ANSI terminal formatting.
35-
// Currently handles **bold** → ANSI bold.
36-
func renderInlineMarkdown(s string) string {
37-
return reBold.ReplaceAllString(s, "\033[1m${1}\033[22m")
38-
}
39-
4031
// wrapText wraps text to fit within width columns total (including indent).
4132
// The first line has no indent (caller provides the prefix).
4233
// Continuation lines get indent prepended.
@@ -175,15 +166,6 @@ func wrapText(text string, width int, prefixWidth int) string {
175166
return strings.TrimRight(result.String(), "\n")
176167
}
177168

178-
func (m *chatModel) hasRealMessages() bool {
179-
for _, msg := range m.messages {
180-
if msg.role != "welcome" {
181-
return true
182-
}
183-
}
184-
return m.waiting
185-
}
186-
187169
func (m *chatModel) updateViewportContent() {
188170
viewWidth := m.width
189171
if viewWidth <= 0 {
@@ -442,43 +424,6 @@ func (m chatModel) View() string {
442424
return m.viewport.View() + "\n" + bottomBar.String()
443425
}
444426

445-
func formatDiff(diff string) string {
446-
var b strings.Builder
447-
lineNum := 0
448-
for _, line := range strings.Split(diff, "\n") {
449-
switch {
450-
case strings.HasPrefix(line, "--- ") || strings.HasPrefix(line, "+++ "):
451-
// File headers
452-
b.WriteString(lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("#FFFFFF")).Render(line))
453-
case strings.HasPrefix(line, "@@"):
454-
// Hunk headers — extract line numbers
455-
b.WriteString(lipgloss.NewStyle().Foreground(lipgloss.Color("#888888")).Render(line))
456-
// Parse starting line from @@ -X,Y +Z,W @@
457-
if idx := strings.Index(line, "+"); idx >= 0 {
458-
fmt.Sscanf(line[idx:], "+%d", &lineNum)
459-
if lineNum > 0 {
460-
lineNum-- // will be incremented on first content line
461-
}
462-
}
463-
case strings.HasPrefix(line, "+"):
464-
lineNum++
465-
num := fmt.Sprintf("%4d ", lineNum)
466-
b.WriteString(lipgloss.NewStyle().Foreground(dimColor).Render(num))
467-
b.WriteString(diffAddStyle.Render(line))
468-
case strings.HasPrefix(line, "-"):
469-
b.WriteString(lipgloss.NewStyle().Foreground(dimColor).Render(" "))
470-
b.WriteString(diffDelStyle.Render(line))
471-
default:
472-
lineNum++
473-
num := fmt.Sprintf("%4d ", lineNum)
474-
b.WriteString(lipgloss.NewStyle().Foreground(dimColor).Render(num))
475-
b.WriteString(line)
476-
}
477-
b.WriteString("\n")
478-
}
479-
return strings.TrimRight(b.String(), "\n")
480-
}
481-
482427
// renderPermissionBox renders a visually distinct permission prompt box.
483428
func renderPermissionBox(summary string, width int) string {
484429
boxW := width - 4

‎cmd/chat_welcome.go‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ More:
189189
/config set <key> <value>`, provider, model, configuredKeyList())
190190
}
191191

192-
func modelConfigSummary(provider, model string) string {
193-
return fmt.Sprintf("Provider: %s\nModel: %s\n\nUse\n /model <name>\n /config provider <name>", displayConfigValue(provider), displayConfigValue(model))
194-
}
195-
196192
func apiKeyConfigSummary() string {
197193
return "API keys (from environment)\n" + indentedAPIKeyLines()
198194
}
@@ -229,21 +225,11 @@ func apiKeyStatusLines() []string {
229225
return lines
230226
}
231227

232-
func activeProviderKeyStatus(settings hawkconfig.Settings) string {
233-
provider := strings.TrimSpace(settings.Provider)
234-
if provider == "" {
235-
return "select provider first"
236-
}
237-
return hawkconfig.EnvKeyStatus(provider)
238-
}
239-
240228
func displayConfigValue(value string) string {
241229
if strings.TrimSpace(value) == "" {
242230
return "(empty)"
243231
}
244232
return value
245233
}
246234

247-
func providerHint(provider, model string) string {
248-
return fmt.Sprintf("Provider: %s\nModel: %s", displayConfigValue(provider), displayConfigValue(model))
249-
}
235+

‎cmd/container_boot.go‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ ENV TERM=xterm-256color LANG=C.UTF-8
6868
// Default: ALWAYS (like herm). Container-first, no fallback.
6969
// User can opt out with --no-container for host mode.
7070
func shouldUseContainer() bool {
71-
if noContainer {
72-
return false
73-
}
74-
return true
71+
return !noContainer
7572
}
7673

7774
// bootContainerCmd starts the container in the background and sends status
@@ -83,7 +80,7 @@ func bootContainerCmd(projectDir string) tea.Cmd {
8380
if !sandbox.DockerAvailable() {
8481
return containerStatusMsg{
8582
status: "docker not running",
86-
err: fmt.Errorf("Docker is not running. Start Docker and try again."),
83+
err: fmt.Errorf("docker is not running: start Docker and try again"),
8784
}
8885
}
8986

‎cmd/dx.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func doctorOutput(settings hawkconfig.Settings) string {
5252
if v == "" {
5353
v = "(dev)"
5454
}
55-
b.WriteString(fmt.Sprintf("\nHawk:\n"))
55+
b.WriteString("\nHawk:\n")
5656
b.WriteString(fmt.Sprintf(" Version: %s\n", v))
5757
if buildDate != "" && buildDate != "unknown" {
5858
b.WriteString(fmt.Sprintf(" Build date: %s\n", buildDate))
@@ -63,7 +63,7 @@ func doctorOutput(settings hawkconfig.Settings) string {
6363
if effectiveProvider == "" {
6464
effectiveProvider = "(not configured)"
6565
}
66-
b.WriteString(fmt.Sprintf("\nProvider:\n"))
66+
b.WriteString("\nProvider:\n")
6767
b.WriteString(fmt.Sprintf(" Provider: %s\n", effectiveProvider))
6868
b.WriteString(fmt.Sprintf(" API key: %s\n", maskedKeyStatus(settings.Provider)))
6969

@@ -75,7 +75,7 @@ func doctorOutput(settings hawkconfig.Settings) string {
7575
b.WriteString(fmt.Sprintf(" Model: %s\n", effectiveModel))
7676

7777
// Session directory status
78-
b.WriteString(fmt.Sprintf("\nSession directory:\n"))
78+
b.WriteString("\nSession directory:\n")
7979
home, _ := os.UserHomeDir()
8080
sessDir := filepath.Join(home, ".hawk", "sessions")
8181
if info, err := os.Stat(sessDir); err != nil {
@@ -117,7 +117,7 @@ func doctorOutput(settings hawkconfig.Settings) string {
117117
}
118118

119119
// Git repo status
120-
b.WriteString(fmt.Sprintf("\nGit:\n"))
120+
b.WriteString("\nGit:\n")
121121
branch, err := gitOutput("rev-parse", "--abbrev-ref", "HEAD")
122122
if err != nil || branch == "" {
123123
b.WriteString(" Not a git repository\n")
@@ -201,7 +201,7 @@ func debugOutput(sess *engine.Session, sessionID string) string {
201201
// Memory usage
202202
var memStats runtime.MemStats
203203
runtime.ReadMemStats(&memStats)
204-
b.WriteString(fmt.Sprintf("\nMemory:\n"))
204+
b.WriteString("\nMemory:\n")
205205
b.WriteString(fmt.Sprintf(" Alloc: %s\n", formatBytes(memStats.Alloc)))
206206
b.WriteString(fmt.Sprintf(" TotalAlloc: %s\n", formatBytes(memStats.TotalAlloc)))
207207
b.WriteString(fmt.Sprintf(" Sys: %s\n", formatBytes(memStats.Sys)))

‎cmd/errors.go‎

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"time"
1515

1616
hawkconfig "github.com/GrayCodeAI/hawk/config"
17-
"github.com/GrayCodeAI/hawk/session"
1817
)
1918

2019
// ─── friendlyError ────────────────────────────────────────────────────────────
@@ -174,6 +173,7 @@ func friendlyError(err error) string {
174173
// Catches panics, saves the current session state, logs the stack trace to
175174
// ~/.hawk/crash.log, and exits with a user-friendly message.
176175

176+
//lint:ignore U1000 Infrastructure wired in main.go for production builds
177177
func panicRecovery(saveFn func()) {
178178
if r := recover(); r != nil {
179179
stack := string(debug.Stack())
@@ -221,6 +221,7 @@ func panicRecovery(saveFn func()) {
221221
// Handles SIGTERM, SIGINT, and SIGHUP gracefully. Calls the provided save
222222
// function before exiting to ensure the current session is persisted.
223223

224+
//lint:ignore U1000 Infrastructure wired in main.go for production builds
224225
func signalHandler(saveFn func()) {
225226
sigCh := make(chan os.Signal, 1)
226227
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
@@ -261,9 +262,11 @@ type errorLoggerT struct {
261262
path string
262263
}
263264

265+
//lint:ignore U1000 Singleton used by logError below
264266
var errLogger *errorLoggerT
265267
var errLoggerOnce sync.Once
266268

269+
//lint:ignore U1000 Infrastructure used by logError
267270
func getErrorLogger() *errorLoggerT {
268271
errLoggerOnce.Do(func() {
269272
home, _ := os.UserHomeDir()
@@ -324,11 +327,6 @@ func (l *errorLoggerT) LogErrorf(format string, args ...interface{}) {
324327
f.WriteString(entry)
325328
}
326329

327-
// logError is a package-level convenience that uses the singleton error logger.
328-
func logError(context string, err error) {
329-
getErrorLogger().LogError(context, err)
330-
}
331-
332330
// ─── validateStartup ─────────────────────────────────────────────────────────
333331
// Checks essential prerequisites before starting a session:
334332
// - API key is set for the configured provider
@@ -424,25 +422,4 @@ func providerDNSHost(provider string) string {
424422
}
425423
}
426424

427-
// ─── Helpers used by session save in panic/signal paths ───────────────────────
428-
429-
// saveSessionSafe is a helper for use in panic recovery and signal handlers.
430-
// It wraps session.Save with error recovery so it never panics.
431-
func saveSessionSafe(sessionID string, model, provider string, messages []session.Message) {
432-
defer func() { recover() }()
433425

434-
if len(messages) == 0 || sessionID == "" {
435-
return
436-
}
437-
438-
s := &session.Session{
439-
ID: sessionID,
440-
Model: model,
441-
Provider: provider,
442-
Messages: messages,
443-
CreatedAt: time.Now(),
444-
}
445-
if err := session.Save(s); err != nil {
446-
logError("save_session_panic", err)
447-
}
448-
}

0 commit comments

Comments
 (0)