Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 50 additions & 56 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,70 @@
# golangci-lint configuration for dev-cli
# Focused on Docker API safety and common Go bugs
# Run: golangci-lint run ./...

run:
timeout: 5m
modules-download-mode: readonly
tests: true
relative-path-mode: cfg
issues-exit-code: 1

output:
formats:
- format: colored-line-number # Best for CLI usage
print-issued-lines: true
print-linter-name: true

linters:
disable-all: true
enable:
# Critical for Docker SDK - catch unhandled errors
- errcheck
# Static analysis for common bugs
- staticcheck
# Lightweight linter, catches common mistakes
- revive
# Detect ineffectual assignments
- ineffassign
# Check for unchecked type assertions
- unconvert
# Detect unused code
- unused
# Check for goroutine leaks (important for streaming logs)
- govet
# Check printf-style functions
- goprintffuncname
- errcheck # Checks for unchecked errors
- govet # Official Go tool
- ineffassign # Detects unused assignments
- typecheck # Parses and type-checks Go code
- unused # Checks for unused constants, variables, functions

disable:
# Too noisy for dev tools
- gocritic
- gocyclo
- funlen
- gocognit
- staticcheck # Massive set of best practice & style rules

linters-settings:
errcheck:
# Check for ignored errors in defer statements
check-blank: true
# Don't report on explicitly ignored errors with _
exclude-functions:
- io.Copy
- (io.Closer).Close
- revive # Faster, configurable replacement for deprecated 'golint'
- gosec # Security scanner (SQL injection, hardcoded creds)
- godoclint # (New 2025) Validates comments against Go standards [web:101]

- bodyclose # Checks if HTTP response bodies are closed
- noctx # Ensures you send context.Context to functions that need it
- dogsled # Checks for too many blank identifiers (e.g. _, _, _, err)
- unconvert # Remove unnecessary type conversions
- goconst # Finds repeated strings that could be constants
- exportloopref # Checks for pointers to enclosing loop variables

linters-settings:
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: error-return
- name: error-strings
- name: exported
- name: increment-decrement
- name: var-declaration
severity: warning
disabled: false
arguments: ["disableStuttering"] # Check for types like "UserUser"
- name: package-comments
disabled: true # Not needed for internal packages
severity: warning
disabled: false

staticcheck:
checks:
- all
- -SA1019 # Ignore deprecation warnings for now
# gosec:
# excludes:
# - G101 # "Potential hardcoded credential" (often false positives in tests)
# config:
# G306: "0600" # Allow only strict file permissions
#
# staticcheck:
# checks: ["all", "-ST1000"] # Enable all, but disable package comment check

issues:
# Maximum issues count per one linter
max-issues-per-linter: 50
max-same-issues: 10
# Goconst
goconst:
min-len: 3
min-occurrences: 3

issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
# Exclude some linters from running on test files
- path: _test\.go
linters:
- gosec
- errcheck

# Exclude lll issues for long lines in go.mod
- path: go\.mod
- path: tools/
linters:
- lll
- gochecknoglobals
11 changes: 5 additions & 6 deletions cmd/ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package cmd

import (
"bytes"
"dev-cli/internal/ai"
"dev-cli/internal/core"
"encoding/json"
"fmt"
"io"
Expand All @@ -10,9 +12,6 @@ import (
"strings"
"time"

"dev-cli/internal/config"
"dev-cli/internal/llm"

"github.com/briandowns/spinner"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -47,7 +46,7 @@ Two modes:
os.Setenv("DEV_CLI_FORCE_LOCAL", "1")
}

if err := llm.EnsureOllamaRunning(); err != nil {
if err := ai.EnsureOllamaRunning(); err != nil {
fmt.Fprintf(os.Stderr, "\033[33m⚠\033[0m Ollama not available: %v\n", err)

}
Expand Down Expand Up @@ -105,7 +104,7 @@ func looksLikeToolName(args []string) bool {
}

func fetchSolutions(query string) {
client := llm.NewHybridClient()
client := ai.NewHybridClient()

backend := "Ollama"
if client.HasPerplexity() {
Expand Down Expand Up @@ -166,7 +165,7 @@ func fetchSolutions(query string) {
}

func fetchCommands(toolName, topic string, count int) {
cfg := config.Load()
cfg := core.LoadConfig()
baseURL := cfg.OllamaURL
model := cfg.OllamaModel

Expand Down
Loading
Loading