feat: add CI/CD workflows, persistent chat, shell completions, and testing
- Add Gitea CI workflow for testing, linting, and building
- Add release workflow for multi-platform builds and GitHub releases
- Implement persistent chat history with JSON storage
- Add shell completion generation for bash, zsh, fish, powershell
- Introduce custom error types and logging system
- Add interfaces for git and AI client for better testability
- Enhance config with temperature and timeout settings
- Add comprehensive unit tests for config, errors, git, grok, and logger
- Update README with installation, features, and development instructions
- Make model flag persistent across commands
- Add context timeouts to API requests
2026-03-01 12:17:22 +00:00
|
|
|
package errors
|
|
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
|
|
// GitError represents errors from git operations
|
|
|
|
|
type GitError struct {
|
|
|
|
|
Command string
|
|
|
|
|
Err error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *GitError) Error() string {
|
chore(lint): enhance golangci configuration and add security annotations
- Expand .golangci.yml with more linters (bodyclose, errcheck, etc.), settings for govet, revive, gocritic, gosec
- Add // nolint:gosec comments for intentional file operations and subprocesses
- Change file write permissions from 0644 to 0600 for better security
- Refactor loops, error handling, and test parallelism with t.Parallel()
- Minor fixes: ignore unused args, use errors.Is, adjust mkdir permissions to 0750
2026-03-04 20:00:32 +00:00
|
|
|
_ = e.Err // keep field used for error message
|
feat: add CI/CD workflows, persistent chat, shell completions, and testing
- Add Gitea CI workflow for testing, linting, and building
- Add release workflow for multi-platform builds and GitHub releases
- Implement persistent chat history with JSON storage
- Add shell completion generation for bash, zsh, fish, powershell
- Introduce custom error types and logging system
- Add interfaces for git and AI client for better testability
- Enhance config with temperature and timeout settings
- Add comprehensive unit tests for config, errors, git, grok, and logger
- Update README with installation, features, and development instructions
- Make model flag persistent across commands
- Add context timeouts to API requests
2026-03-01 12:17:22 +00:00
|
|
|
return fmt.Sprintf("git %s failed: %v", e.Command, e.Err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *GitError) Unwrap() error {
|
|
|
|
|
return e.Err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// APIError represents errors from Grok API calls
|
|
|
|
|
type APIError struct {
|
|
|
|
|
StatusCode int
|
|
|
|
|
Message string
|
|
|
|
|
Err error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *APIError) Error() string {
|
|
|
|
|
if e.StatusCode > 0 {
|
|
|
|
|
return fmt.Sprintf("API error (status %d): %s", e.StatusCode, e.Message)
|
|
|
|
|
}
|
|
|
|
|
return fmt.Sprintf("API error: %s", e.Message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *APIError) Unwrap() error {
|
|
|
|
|
return e.Err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FileError represents file operation errors
|
|
|
|
|
type FileError struct {
|
|
|
|
|
Path string
|
|
|
|
|
Op string
|
|
|
|
|
Err error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *FileError) Error() string {
|
|
|
|
|
return fmt.Sprintf("file %s failed for %s: %v", e.Op, e.Path, e.Err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *FileError) Unwrap() error {
|
|
|
|
|
return e.Err
|
|
|
|
|
}
|