Terminal error detection and auto-fix assistant. Detects errors in your shell, queries AI for a fix, applies it if you confirm.
Project description
goCLI
Terminal error detection and auto-fix assistant. Runs as an interactive shell wrapper, watches for errors in command output, queries an AI for a fix, and applies it if you confirm.
Works on Windows, macOS, and Linux. Available in Python and Go.
Install
Python
pip install gocli-terminal
The gocli command is available globally after install.
Go (macOS / Linux)
curl -fsSL https://raw.githubusercontent.com/nopedal/cmd-tree/main/go/install.sh | sh
Go (Windows, PowerShell)
irm https://raw.githubusercontent.com/nopedal/cmd-tree/main/go/install.ps1 | iex
Both install scripts download the right pre-built binary for your platform from GitHub Releases. No Go installation required.
Publish a new release (Go)
The Go repo can stay private. Users download pre-built binaries from GitHub Releases — they never see the source.
- In the
go/directory, run the build script:
# Windows
release.bat
# macOS / Linux
chmod +x release.sh && ./release.sh
- Go to
github.com/nopedal/cmd-tree/releases/new - Create a tag (e.g.
v0.1.0) - Upload all files from
go/dist/ - Publish the release
Users can then install with the one-liners above.
Publish to PyPI (Python)
# Windows
publish.bat
# macOS / Linux
chmod +x publish.sh && ./publish.sh
You need a PyPI account and API token. Create one at https://pypi.org/manage/account/token/
Configure
Set your Gemini API key as an environment variable:
# Linux / macOS
export GOCLI_API_KEY="your-api-key"
# Windows (cmd)
set GOCLI_API_KEY=your-api-key
# Windows (PowerShell)
$env:GOCLI_API_KEY = "your-api-key"
A default key is included for testing. Replace it with your own for production use.
To use a different Gemini model:
export GOCLI_MODEL="gemini-flash-latest"
Use
Start a goCLI session:
gocli
Use it like a normal terminal. When a command fails and goCLI recognises the error pattern, it queries the AI and shows:
goCLI detected an error
fix pip install requests
run? [Y/n]
Press Enter or Y to apply the fix. Press N to skip.
Type exit or quit to leave the session.
Auto-start
To wrap every new terminal session automatically:
Linux / macOS (.bashrc or .zshrc)
if command -v gocli &> /dev/null && [ -z "$GOCLI_ACTIVE" ]; then
export GOCLI_ACTIVE=1
exec gocli
fi
Windows (PowerShell profile)
if ((Get-Command gocli -ErrorAction SilentlyContinue) -and -not $env:GOCLI_ACTIVE) {
$env:GOCLI_ACTIVE = "1"
gocli
exit
}
Error detection
goCLI recognises these error categories out of the box:
- Python missing module and import errors
- Node.js missing package errors
- Permission denied errors
- Command not found errors (including Windows "not recognized" errors)
- Port already in use errors
- Docker errors
- Git errors
- Rust compiler errors
- Python tracebacks
The error patterns live in watcher.py (Python) or internal/watcher/watcher.go (Go) and can be extended.
Architecture
Python
gocli/
__init__.py
main.py entry point, command-loop shell wrapper
watcher.py error pattern detection
ai.py Gemini API integration
fix.py suggestion UI and command execution
config.py API key, colours, constants, Windows ANSI setup
Go
go/
cmd/gocli/main.go entry point, command-loop shell wrapper
internal/config/config.go API key, colours, constants
internal/config/ansi_windows.go Windows ANSI setup (build-tagged)
internal/config/ansi_other.go no-op on Unix (build-tagged)
internal/watcher/watcher.go error pattern detection
internal/ai/ai.go Gemini API integration
internal/fix/fix.go suggestion UI and command execution
install.sh macOS / Linux installer
install.ps1 Windows installer
release.sh / release.bat build all platform binaries for release
The AI backend is isolated in a single file. To swap from Gemini to another provider, replace ai.py or internal/ai/ai.go while keeping the same function signature.
Dependencies
Python
None beyond the standard library.
Go
None beyond the standard library. Zero external modules.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gocli_terminal-0.1.0.tar.gz.
File metadata
- Download URL: gocli_terminal-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d7a4d1ee1afcb28fda398c223fceaa5930982bc519fd8a10fb1a85ceb59ce5f
|
|
| MD5 |
34ab26eeb2adc89b89c30a65f000ac41
|
|
| BLAKE2b-256 |
1a7a225959b84dff94b457c3e8c391e13b8616b1712b461a10261200ad3b27d1
|
File details
Details for the file gocli_terminal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gocli_terminal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0a7e148300871fee14334f604355cceff4e7c3143f0e3b2dec1f5466cce33bc
|
|
| MD5 |
ab5e3a1260b19e60b969b7bbdfd73efd
|
|
| BLAKE2b-256 |
fdb741dd21600f098784c6f320d0152f0d40db61a6571da5bc456389b3c14bf2
|