2026-02-28 19:56:23 +00:00
|
|
|
# Grokkit
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
Grokkit is a fast Go CLI integrating Grok AI with git workflows and general chat/edit functionality.
|
|
|
|
|
|
2026-03-01 14:26:47 +00:00
|
|
|
|
2026-03-02 22:23:48 +00:00
|
|
|
[]()
|
2026-03-02 18:56:20 +00:00
|
|
|
[]()
|
2026-03-01 12:57:08 +00:00
|
|
|
[]()
|
2026-02-28 19:56:23 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
## Requirements
|
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
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
- Go 1.24.2 (for building)
|
|
|
|
|
- Git (for git-related commands)
|
|
|
|
|
- XAI API key
|
2026-02-28 19:56:23 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
## 🚀 Quick Start Installation
|
2026-03-01 23:25:31 +00:00
|
|
|
|
|
|
|
|
### From pre-built release (recommended)
|
|
|
|
|
```bash
|
2026-03-02 18:56:20 +00:00
|
|
|
VERSION=0.1.3 # Replace with latest version tag (omit 'v')
|
2026-03-01 23:25:31 +00:00
|
|
|
curl -L https://repos.gmgauthier.com/gmgauthier/grokkit/releases/download/v${VERSION}/grokkit-install.sh | VERSION=${VERSION} bash -
|
|
|
|
|
```
|
2026-03-01 12:57:08 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
### From Source (for development)
|
2026-03-01 12:57:08 +00:00
|
|
|
```bash
|
2026-03-07 22:42:43 +00:00
|
|
|
# Set your API key
|
|
|
|
|
export XAI_API_KEY=sk-...
|
2026-02-28 19:56:23 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
# Install from source
|
|
|
|
|
git clone https://repos.gmgauthier.com/gmgauthier/grokkit.git
|
|
|
|
|
cd grokkit
|
|
|
|
|
make test
|
|
|
|
|
make build
|
|
|
|
|
make install
|
|
|
|
|
````
|
feat(lint): add lint command with AI-powered fixes
Introduce new `grokkit lint` command for automatic language detection,
linting, and AI-suggested fixes. Supports 9 languages including Go, Python,
JavaScript, TypeScript, Rust, Ruby, Java, C/C++, and Shell.
- Add cmd/lint.go for command implementation
- Create internal/linter package with detection and execution logic
- Update README.md with usage examples and workflows
- Enhance docs/ARCHITECTURE.md and docs/TROUBLESHOOTING.md
- Add comprehensive tests for linter functionality
2026-03-01 13:21:44 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
### Verify:
|
feat(lint): add lint command with AI-powered fixes
Introduce new `grokkit lint` command for automatic language detection,
linting, and AI-suggested fixes. Supports 9 languages including Go, Python,
JavaScript, TypeScript, Rust, Ruby, Java, C/C++, and Shell.
- Add cmd/lint.go for command implementation
- Create internal/linter package with detection and execution logic
- Update README.md with usage examples and workflows
- Enhance docs/ARCHITECTURE.md and docs/TROUBLESHOOTING.md
- Add comprehensive tests for linter functionality
2026-03-01 13:21:44 +00:00
|
|
|
```bash
|
2026-03-07 22:42:43 +00:00
|
|
|
grokkit version
|
feat(lint): add lint command with AI-powered fixes
Introduce new `grokkit lint` command for automatic language detection,
linting, and AI-suggested fixes. Supports 9 languages including Go, Python,
JavaScript, TypeScript, Rust, Ruby, Java, C/C++, and Shell.
- Add cmd/lint.go for command implementation
- Create internal/linter package with detection and execution logic
- Update README.md with usage examples and workflows
- Enhance docs/ARCHITECTURE.md and docs/TROUBLESHOOTING.md
- Add comprehensive tests for linter functionality
2026-03-01 13:21:44 +00:00
|
|
|
```
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
### Environment Variables
|
2026-02-28 19:56:23 +00:00
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
```bash
|
|
|
|
|
export XAI_API_KEY=sk-... # Required: Your xAI API key
|
2026-03-07 22:42:43 +00:00
|
|
|
export XAI_API_KEY=$(vault read -field=key secret/grokkit) # Recommended for secure storage
|
2026-02-28 19:56:23 +00:00
|
|
|
```
|
2026-03-01 12:57:08 +00:00
|
|
|
|
|
|
|
|
### Config File (Optional)
|
|
|
|
|
|
|
|
|
|
Create `~/.config/grokkit/config.toml`:
|
|
|
|
|
|
|
|
|
|
```toml
|
|
|
|
|
default_model = "grok-4"
|
|
|
|
|
temperature = 0.7
|
|
|
|
|
timeout = 60 # API timeout in seconds
|
|
|
|
|
log_level = "info" # debug, info, warn, error
|
|
|
|
|
|
|
|
|
|
[aliases]
|
|
|
|
|
beta = "grok-beta-2"
|
2026-03-02 18:56:20 +00:00
|
|
|
fast = "grok-4-1-fast-non-reasoning"
|
2026-03-01 12:57:08 +00:00
|
|
|
|
|
|
|
|
[chat]
|
|
|
|
|
history_file = "~/.config/grokkit/chat_history.json"
|
|
|
|
|
```
|
|
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
**See also:** [docs/developer-guide/CONFIGURATION.md](docs/developer-guide/CONFIGURATION.md) for advanced configuration options.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 📖 Commands
|
|
|
|
|
|
|
|
|
|
See [The User Guide](docs/user-guide/index.md) for complete details on command usage.
|
|
|
|
|
|
|
|
|
|
## 🛡️ Safety & Change Management
|
|
|
|
|
|
|
|
|
|
Grokkit is designed to work seamlessly with Git, using version control instead of redundant backup files to manage changes and rollbacks.
|
|
|
|
|
|
|
|
|
|
[Read the Safety & Change Management Guide](docs/user-guide/safety.md)
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
|
|
|
|
|
### Logging
|
|
|
|
|
|
|
|
|
|
Logs are written to `~/.config/grokkit/grokkit.log` in JSON format.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# View logs in real-time
|
|
|
|
|
tail -f ~/.config/grokkit/grokkit.log
|
|
|
|
|
|
|
|
|
|
# Find errors
|
|
|
|
|
cat ~/.config/grokkit/grokkit.log | jq 'select(.level=="ERROR")'
|
|
|
|
|
|
|
|
|
|
# Track API performance
|
|
|
|
|
cat ~/.config/grokkit/grokkit.log | jq 'select(.msg=="API request completed") | {model, duration_ms, response_length}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Workflows
|
|
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
Common usage patterns to integrate Grokkit into your development cycle.
|
feat(cmd): add AI documentation generation and command tests
- Implemented `grokkit docs` command for generating language-specific documentation comments (godoc, PEP 257, Doxygen, etc.) with previews, backups, and auto-apply option
- Extracted message builder functions for commit, history, pr-describe, and review commands
- Added comprehensive unit tests for all command message builders (commit_test.go, docs_test.go, history_test.go, lint_test.go, prdescribe_test.go, review_test.go)
- Enforced 70% test coverage threshold in CI workflow
- Added .golangci.yml configuration with linters like govet, errcheck, staticcheck
- Updated Makefile to include -race in tests and add help target
- Updated README.md with new docs command details, workflows, and quality features
- Added .claude/ to .gitignore
- Configured default model for docs command in config.go
2026-03-02 20:13:50 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
[Read the Workflows Guide](docs/user-guide/workflows.md)
|
feat(cmd): add AI documentation generation and command tests
- Implemented `grokkit docs` command for generating language-specific documentation comments (godoc, PEP 257, Doxygen, etc.) with previews, backups, and auto-apply option
- Extracted message builder functions for commit, history, pr-describe, and review commands
- Added comprehensive unit tests for all command message builders (commit_test.go, docs_test.go, history_test.go, lint_test.go, prdescribe_test.go, review_test.go)
- Enforced 70% test coverage threshold in CI workflow
- Added .golangci.yml configuration with linters like govet, errcheck, staticcheck
- Updated Makefile to include -race in tests and add help target
- Updated README.md with new docs command details, workflows, and quality features
- Added .claude/ to .gitignore
- Configured default model for docs command in config.go
2026-03-02 20:13:50 +00:00
|
|
|
|
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
|
|
|
## Shell Completions
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
Generate shell completions for faster command entry:
|
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
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
[Read the full Completion Guide](docs/user-guide/completion.md)
|
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
|
|
|
|
2026-02-28 19:56:23 +00:00
|
|
|
## Flags
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
### Global Flags (work with all commands)
|
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
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
| Flag | Short | Description |
|
|
|
|
|
|------|-------|-------------|
|
|
|
|
|
| `--model` | `-m` | Override model (e.g., grok-4, grok-beta) |
|
|
|
|
|
| `--debug` | | Enable debug logging (stderr + file) |
|
|
|
|
|
| `--verbose` | `-v` | Enable verbose logging |
|
|
|
|
|
| `--help` | `-h` | Show help |
|
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
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
### Examples
|
2026-03-01 12:35:21 +00:00
|
|
|
|
|
|
|
|
```bash
|
2026-03-01 12:57:08 +00:00
|
|
|
# Use different model
|
|
|
|
|
grokkit chat -m grok-beta
|
2026-03-01 12:35:21 +00:00
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
# Debug API issues
|
|
|
|
|
grokkit edit main.go "refactor" --debug
|
2026-03-01 12:35:21 +00:00
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
# Verbose logging
|
|
|
|
|
grokkit review -v
|
2026-03-01 12:35:21 +00:00
|
|
|
```
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
## Features
|
|
|
|
|
|
|
|
|
|
### Core Features
|
|
|
|
|
- ✅ **Structured logging with slog** - JSON logs with request tracing, timing, and context
|
|
|
|
|
- ✅ **Context-aware HTTP requests** - 60s timeout, proper cancellation
|
|
|
|
|
- ✅ **Comprehensive error handling** - Custom error types with context
|
|
|
|
|
- ✅ **Persistent chat history** - Never lose your conversations
|
|
|
|
|
- ✅ **Configurable parameters** - Temperature, timeout, model selection
|
|
|
|
|
- ✅ **Shell completions** - Bash, Zsh, Fish, PowerShell
|
2026-03-03 20:49:27 +00:00
|
|
|
- ✅ **Safe file editing** - Preview and confirmation, leverage git for rollbacks
|
2026-03-01 12:57:08 +00:00
|
|
|
- ✅ **Git workflow integration** - Commit messages, reviews, PR descriptions
|
feat(lint): add lint command with AI-powered fixes
Introduce new `grokkit lint` command for automatic language detection,
linting, and AI-suggested fixes. Supports 9 languages including Go, Python,
JavaScript, TypeScript, Rust, Ruby, Java, C/C++, and Shell.
- Add cmd/lint.go for command implementation
- Create internal/linter package with detection and execution logic
- Update README.md with usage examples and workflows
- Enhance docs/ARCHITECTURE.md and docs/TROUBLESHOOTING.md
- Add comprehensive tests for linter functionality
2026-03-01 13:21:44 +00:00
|
|
|
- ✅ **Multi-language linting** - 9 languages supported with AI-powered fixes
|
feat(cmd): add AI documentation generation and command tests
- Implemented `grokkit docs` command for generating language-specific documentation comments (godoc, PEP 257, Doxygen, etc.) with previews, backups, and auto-apply option
- Extracted message builder functions for commit, history, pr-describe, and review commands
- Added comprehensive unit tests for all command message builders (commit_test.go, docs_test.go, history_test.go, lint_test.go, prdescribe_test.go, review_test.go)
- Enforced 70% test coverage threshold in CI workflow
- Added .golangci.yml configuration with linters like govet, errcheck, staticcheck
- Updated Makefile to include -race in tests and add help target
- Updated README.md with new docs command details, workflows, and quality features
- Added .claude/ to .gitignore
- Configured default model for docs command in config.go
2026-03-02 20:13:50 +00:00
|
|
|
- ✅ **AI documentation generation** - 8 doc styles (godoc, PEP 257, Doxygen, JSDoc, rustdoc, YARD, Javadoc, shell)
|
2026-03-07 21:12:21 +00:00
|
|
|
- ✅ **AI unit test generation** - Go (table-driven), Python (pytest), C (Check), C++ (GTest)
|
|
|
|
|
- ✅ **AI file scaffolding** - Create new files with project-aware style matching
|
|
|
|
|
- ✅ **Transactional Recipes** - Markdown-based multi-step AI workflows
|
2026-03-01 12:57:08 +00:00
|
|
|
|
|
|
|
|
### Quality & Testing
|
2026-03-02 22:23:48 +00:00
|
|
|
- ✅ **Test coverage 68%+** - Comprehensive unit tests including all command message builders
|
|
|
|
|
- ✅ **Coverage gate in CI** - Builds fail if coverage drops below 65%
|
feat(cmd): add AI documentation generation and command tests
- Implemented `grokkit docs` command for generating language-specific documentation comments (godoc, PEP 257, Doxygen, etc.) with previews, backups, and auto-apply option
- Extracted message builder functions for commit, history, pr-describe, and review commands
- Added comprehensive unit tests for all command message builders (commit_test.go, docs_test.go, history_test.go, lint_test.go, prdescribe_test.go, review_test.go)
- Enforced 70% test coverage threshold in CI workflow
- Added .golangci.yml configuration with linters like govet, errcheck, staticcheck
- Updated Makefile to include -race in tests and add help target
- Updated README.md with new docs command details, workflows, and quality features
- Added .claude/ to .gitignore
- Configured default model for docs command in config.go
2026-03-02 20:13:50 +00:00
|
|
|
- ✅ **CI/CD with Gitea Actions** - Tests must pass before lint and build jobs run
|
|
|
|
|
- ✅ **Golangci-lint configured** - `.golangci.yml` with govet, errcheck, staticcheck, and more
|
2026-03-01 12:57:08 +00:00
|
|
|
- ✅ **Interface-based design** - Testable and maintainable
|
|
|
|
|
- ✅ **Zero external dependencies** - Only stdlib + well-known libs
|
|
|
|
|
|
|
|
|
|
### Observability
|
|
|
|
|
|
2026-03-01 12:35:21 +00:00
|
|
|
**Logged metrics:**
|
|
|
|
|
- API request/response timing and sizes
|
|
|
|
|
- Git command execution and output
|
|
|
|
|
- File operations with size tracking
|
2026-03-01 12:57:08 +00:00
|
|
|
- Error context with full details
|
|
|
|
|
|
|
|
|
|
**Example log entry:**
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"time": "2026-03-01T10:30:47.890Z",
|
|
|
|
|
"level": "INFO",
|
|
|
|
|
"msg": "API request completed",
|
|
|
|
|
"model": "grok-4",
|
|
|
|
|
"response_length": 1024,
|
|
|
|
|
"chunks_received": 42,
|
|
|
|
|
"duration_ms": 2434,
|
|
|
|
|
"duration": "2.434s"
|
|
|
|
|
}
|
|
|
|
|
```
|
2026-03-01 12:35:21 +00:00
|
|
|
|
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
|
|
|
## Development
|
|
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
Comprehensive build instructions, project structure details, and the Grokkit development workflow.
|
2026-03-02 18:56:20 +00:00
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
[Read the Development Overview Guide](docs/developer-guide/overview.md)
|
2026-03-01 12:57:08 +00:00
|
|
|
|
|
|
|
|
## API Usage & Costs
|
|
|
|
|
|
|
|
|
|
Grokkit uses the xAI Grok API. Be aware:
|
|
|
|
|
- API calls consume credits/tokens
|
|
|
|
|
- Default timeout: 60 seconds
|
|
|
|
|
- Streaming reduces perceived latency
|
|
|
|
|
- Consider using model aliases for different use cases (fast/expensive)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
**Common issues:**
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# API key not set
|
|
|
|
|
Error: XAI_API_KEY environment variable not set
|
|
|
|
|
→ Solution: export XAI_API_KEY=sk-your-key
|
|
|
|
|
|
|
|
|
|
# Request timeout
|
|
|
|
|
Error: Request failed: context deadline exceeded
|
|
|
|
|
→ Solution: Increase timeout in config.toml or check network
|
|
|
|
|
|
|
|
|
|
# Permission denied on log file
|
|
|
|
|
→ Solution: chmod 644 ~/.config/grokkit/grokkit.log
|
|
|
|
|
```
|
|
|
|
|
|
2026-03-07 22:42:43 +00:00
|
|
|
**See [docs/developer-guide/TROUBLESHOOTING.md](docs/developer-guide/TROUBLESHOOTING.md) for more details.**
|
2026-02-28 19:56:23 +00:00
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
2026-03-01 12:57:08 +00:00
|
|
|
[Unlicense](https://unlicense.org/) - Free for any use, no attribution required.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
**Made with ❤️ using Grok AI**
|