Grokkit is a fast Go CLI integrating Grok AI with git workflows and general chat/edit functionality.
Go to file
Greg Gauthier 643b904db4
All checks were successful
CI / Test (push) Successful in 27s
CI / Lint (push) Successful in 17s
CI / Build (push) Successful in 12s
docs(analyze): refine grokkit analyze command spec
Update the feature description to include educational report details and prompt discovery mechanism.
Add automatic prompt loading from project or global config paths, with error handling for missing prompts.
Revise acceptance criteria, implementation plan, and add proposed CLI usage and flags.
Include default prompt for Go and user-guide updates for custom prompts.
2026-03-28 12:14:33 +00:00
.gitea/workflows chore(ci): remove auto-complete TODO workflow 2026-03-04 18:27:48 +00:00
.grokkit/recipes Update .grokkit/recipes/result-refactor.md 2026-03-09 13:31:32 +00:00
cmd test: add tests for recipe package and disable parallelism in cmd tests 2026-03-08 12:53:01 +00:00
config chore(lint): enhance golangci configuration and add security annotations 2026-03-04 20:00:32 +00:00
docs docs: refactor README and docs structure for better organization 2026-03-07 22:42:43 +00:00
internal test: add tests for recipe package and disable parallelism in cmd tests 2026-03-08 12:53:01 +00:00
scripts fix(build): use consistent dashed naming for release assets 2026-03-01 23:33:51 +00:00
todo docs(analyze): refine grokkit analyze command spec 2026-03-28 12:14:33 +00:00
.env.example stub out project 2026-02-28 18:03:12 +00:00
.gitignore chore(gitignore): add .grok/ and *.patch ignores, remove grokkit 2026-03-07 11:47:28 +00:00
.golangci.yml chore(lint): simplify golangci-lint configuration 2026-03-04 20:04:43 +00:00
CHANGELOG.md docs(changelog): add entry for v0.2.0 2026-03-08 12:59:34 +00:00
config.toml.example feat(config): add per-command model defaults 2026-03-02 16:56:56 +00:00
go.mod test(cmd): add tests for scaffold command 2026-03-03 15:24:06 +00:00
go.sum test(cmd): add tests for scaffold command 2026-03-03 15:24:06 +00:00
install.sh feat(install): add installation script 2026-02-28 23:13:35 +00:00
main.go refactor(cmd): remove unnecessary last modified comments and timestamps 2026-02-28 22:59:16 +00:00
Makefile feat(cmd): add AI documentation generation and command tests 2026-03-02 20:13:50 +00:00
README.md docs(readme): update test coverage badge and details 2026-03-08 12:58:04 +00:00
release.sh feat(release): add release.sh script 2026-03-03 22:21:29 +00:00
safe_shell_commands.yaml.example feat(safety): make safe shell commands user-configurable 2026-03-07 18:22:39 +00:00
UNLICENSE chore(license): add Unlicense file 2026-03-01 13:29:14 +00:00

Grokkit

Grokkit is a fast Go CLI integrating Grok AI with git workflows and general chat/edit functionality.

Test Coverage Go Version License

Requirements

  • Go 1.24.2 (for building)
  • Git (for git-related commands)
  • XAI API key

🚀 Quick Start Installation

VERSION=0.1.3  # Replace with latest version tag (omit 'v')
curl -L https://repos.gmgauthier.com/gmgauthier/grokkit/releases/download/v${VERSION}/grokkit-install.sh | VERSION=${VERSION} bash -

From Source (for development)

# Set your API key
export XAI_API_KEY=sk-...

# Install from source
git clone https://repos.gmgauthier.com/gmgauthier/grokkit.git
cd grokkit
make test
make build
make install

Verify:

grokkit version

Configuration

Environment Variables

export XAI_API_KEY=sk-...       # Required: Your xAI API key
export XAI_API_KEY=$(vault read -field=key secret/grokkit) # Recommended for secure storage

Config File (Optional)

Create ~/.config/grokkit/config.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"
fast = "grok-4-1-fast-non-reasoning"

[chat]
history_file = "~/.config/grokkit/chat_history.json"

See also: docs/developer-guide/CONFIGURATION.md for advanced configuration options.

📖 Commands

See The User Guide 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

Logging

Logs are written to ~/.config/grokkit/grokkit.log in JSON format.

# 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

Common usage patterns to integrate Grokkit into your development cycle.

Read the Workflows Guide

Shell Completions

Generate shell completions for faster command entry:

Read the full Completion Guide

Flags

Global Flags (work with all commands)

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

Examples

# Use different model
grokkit chat -m grok-beta

# Debug API issues
grokkit edit main.go "refactor" --debug

# Verbose logging
grokkit review -v

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
  • Safe file editing - Preview and confirmation, leverage git for rollbacks
  • Git workflow integration - Commit messages, reviews, PR descriptions
  • Multi-language linting - 9 languages supported with AI-powered fixes
  • AI documentation generation - 8 doc styles (godoc, PEP 257, Doxygen, JSDoc, rustdoc, YARD, Javadoc, shell)
  • 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

Quality & Testing

  • Test coverage 54%+ - Comprehensive unit tests including all command message builders
  • Coverage gate in CI - Builds fail if coverage drops below 50%
  • 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
  • Interface-based design - Testable and maintainable
  • Zero external dependencies - Only stdlib + well-known libs

Observability

Logged metrics:

  • API request/response timing and sizes
  • Git command execution and output
  • File operations with size tracking
  • Error context with full details

Example log entry:

{
  "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"
}

Development

Comprehensive build instructions, project structure details, and the Grokkit development workflow.

Read the Development Overview Guide

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:

# 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

See docs/developer-guide/TROUBLESHOOTING.md for more details.

License

Unlicense - Free for any use, no attribution required.


Made with ❤️ using Grok AI