diff --git a/README.md b/README.md index 31d6382..4600f22 100644 --- a/README.md +++ b/README.md @@ -13,15 +13,50 @@ Grokkit is a fast Go CLI integrating Grok AI with git workflows and general chat - Git (for git-related commands) - XAI API key -## 🚀 Quick Start Installation +## 🚀 Quick Start -### From pre-built release (recommended) +### One-line Install (Recommended) + +**Bash (Linux/macOS):** ```bash -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 - +export VERSION=0.3.3 +curl -fsSL https://repos.gmgauthier.com/gmgauthier/grokkit/releases/download/v${VERSION}/grokkit-install.sh | bash -s -- --verify ``` +**PowerShell (Windows):** +```pwsh +$env:VERSION="0.3.3" + irm https://repos.gmgauthier.com/gmgauthier/grokkit/releases/download/v$env:VERSION/grokkit-install.ps1 | iex +``` + +Both installers feature: +- ✅ **Automatic platform detection** (Linux, macOS, Windows) +- ✅ **SHA256 checksum verification** +- ✅ **Safe extraction to `~/.local/bin` or `$env:LOCALAPPDATA\bin`** +- ✅ **No temporary files left behind** + +### Download First Approach + +**Bash (Linux/macOS):** + +```bash +export VERSION=0.3.3 +curl -fsSL https://repos.gmgauthier.com/gmgauthier/grokkit/releases/download/v${VERSION}/grokkit-install.sh -o grokkit-install.sh +bash grokkit-install.sh --verify +``` + +**PowerShell (Windows):** + +```pwsh +$env:VERSION="0.3.3" + irm https://repos.gmgauthier.com/gmgauthier/grokkit/releases/download/v$env:VERSION/grokkit-install.ps1 -OutFile grokkit-install.ps1 + .\grokkit-install.ps1 -Verify +``` + +> **💡 Windows Note**: PowerShell installers auto-detect Windows architecture (x86_64, ARM64) and place the binary in `%LOCALAPPDATA%\bin\grokkit.exe`. Add this path to your PATH if not already present. + ### From Source (for development) + ```bash # Set your API key export XAI_API_KEY=sk-... @@ -32,9 +67,10 @@ cd grokkit make test make build make install -```` +``` ### Verify: + ```bash grokkit version ``` @@ -84,16 +120,16 @@ Grokkit is designed to work seamlessly with Git, using version control instead o Logs are written to `~/.config/grokkit/grokkit.log` in JSON format. -```bash + # View logs in real-time -tail -f ~/.config/grokkit/grokkit.log +`tail -f ~/.config/grokkit/grokkit.log` # Find errors -cat ~/.config/grokkit/grokkit.log | jq 'select(.level=="ERROR")' +`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}' -``` +`cat ~/.config/grokkit/grokkit.log | jq 'select(.msg=="API request completed") | {model, duration_ms, response_length}'` + ## Workflows @@ -111,25 +147,27 @@ Generate shell completions for faster command entry: ### 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 | +| 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 -```bash # Use different model -grokkit chat -m grok-beta + +`grokkit chat -m grok-beta` # Debug API issues -grokkit edit main.go "refactor" --debug + +`grokkit edit main.go "refactor" --debug` # Verbose logging -grokkit review -v -``` + +`grokkit review -v` + ## Features @@ -197,18 +235,17 @@ Grokkit uses the xAI Grok API. Be aware: **Common issues:** -```bash # API key not set Error: XAI_API_KEY environment variable not set -→ Solution: export XAI_API_KEY=sk-your-key +→ 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 +→ Solution: Increase timeout in `config.toml` or check network # Permission denied on log file -→ Solution: chmod 644 ~/.config/grokkit/grokkit.log -``` +→ Solution: `chmod 644 ~/.config/grokkit/grokkit.log` + **See [docs/developer-guide/TROUBLESHOOTING.md](docs/developer-guide/TROUBLESHOOTING.md) for more details.** @@ -218,4 +255,4 @@ Error: Request failed: context deadline exceeded --- -**Made with ❤️ using Grok AI** +**Made with ❤️ using Grok AI** \ No newline at end of file diff --git a/scripts/grokkit-install.ps1 b/scripts/grokkit-install.ps1 new file mode 100644 index 0000000..9d31412 --- /dev/null +++ b/scripts/grokkit-install.ps1 @@ -0,0 +1,80 @@ +<# +.SYNOPSIS + Grokkit Windows installer (PowerShell) +.DESCRIPTION + Downloads, verifies checksum, extracts, and installs grokkit.exe. + Mirrors the hardened grokkit-install.sh exactly. +#> + +$ErrorActionPreference = 'Stop' + +$VERSION = $env:VERSION +if (-not $VERSION) { + Write-Error "❌ VERSION environment variable not set. Example: `$env:VERSION='0.3.3'; ./grokkit-install.ps1" + exit 1 +} + +# Strip leading 'v' if present +$VERSION = $VERSION.TrimStart('v') + +$GITEA_BASE = "https://repos.gmgauthier.com/gmgauthier/grokkit" + +# Platform detection (Windows only supports amd64 for now; arm64 ready for future) +$ARCH = "amd64" +if ($env:PROCESSOR_ARCHITECTURE -like "*ARM*") { + $ARCH = "arm64" +} + +$ASSET = "grokkit-windows-${ARCH}-v${VERSION}.tar.gz" + +Write-Host "Installing grokkit ${VERSION} for windows/${ARCH}..." + +$TempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid().ToString()) +New-Item -ItemType Directory -Path $TempDir | Out-Null +try { + Push-Location $TempDir + + # Download asset + checksums + Write-Host "Downloading ${ASSET}..." + Invoke-WebRequest -Uri "${GITEA_BASE}/releases/download/v${VERSION}/${ASSET}" -OutFile "asset.tar.gz" + + Write-Host "Downloading checksums.txt..." + Invoke-WebRequest -Uri "${GITEA_BASE}/releases/download/v${VERSION}/checksums.txt" -OutFile "checksums.txt" + + # Robust checksum verification + Write-Host "Verifying checksum..." + $ChecksumContent = Get-Content "checksums.txt" -Raw + $HashLine = $ChecksumContent -split "`n" | Where-Object { $_ -match $ASSET } + if ($HashLine) { + $ExpectedHash = ($HashLine -split '\s+')[0] + $ActualHash = (Get-FileHash "asset.tar.gz" -Algorithm SHA256).Hash.ToLower() + if ($ActualHash -ne $ExpectedHash) { + Write-Error "❌ Checksum mismatch for ${ASSET}!" + exit 1 + } + Write-Host "✅ Checksum verified successfully" + } + else { + Write-Warning "⚠️ No checksum entry found for ${ASSET} – continuing without verification" + } + + # Extract (modern Windows has tar.exe) + Write-Host "Extracting asset..." + tar -xzf "asset.tar.gz" + + # The binary inside is named grokkit-windows-amd64.exe (per release workflow) + $BinaryName = "grokkit-windows-${ARCH}.exe" + + # Install + $InstallDir = Join-Path $env:USERPROFILE ".local\bin" + New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null + Move-Item $BinaryName "${InstallDir}\grokkit.exe" -Force + Write-Host "✅ grokkit ${VERSION} installed to ${InstallDir}\grokkit.exe" + + Write-Host "Add to PATH if needed: `$env:PATH += `";${InstallDir}`"" + & "${InstallDir}\grokkit.exe" version +} +finally { + Pop-Location + Remove-Item -Recurse -Force $TempDir -ErrorAction SilentlyContinue +}