sa5er-cli
v1.0.0
Published
CLI wrapper that explains terminal errors with sarcastic Egyptian Arabic humor, powered by Gemini AI ๐ช๐ฌ
Maintainers
Readme
โก Sa5er CLI
Your Sarcastic Egyptian Senior Developer ๐ช๐ฌ
A CLI tool that wraps terminal commands. When they fail, it explains the error with Egyptian humor and provides the actual fix.
๐ค What is Sa5er?
Sa5er (ุณุงุฎุฑ โ meaning "sarcastic" in Arabic) is a CLI wrapper that runs any terminal command. If the command fails, Sa5er intercepts the error and gives you:
- ๐ A sarcastic explanation in Egyptian Arabic (like a senior dev roasting you at the office)
- โ The actual fix with clear, actionable steps
Instead of Googling cryptic error messages, just prefix your command with sa5er and let the Egyptian senior handle it!
๐ Quick Start
# Install globally
npm install -g sa5er-cli
# (Optional) Add AI key for unknown errors โ Groq is FREE!
sa5er auth gsk_YOUR_GROQ_KEY
# Use it!
sa5er npm run build
sa5er node app.js
sa5er git push origin main๐ก Get a free Groq API key: console.groq.com/keys Sa5er works without an API key for 40+ common errors!
๐ธ Examples
โ Missing npm script
$ sa5er npm run doesnotexist
โ ุงูุฃู
ุฑ ูุดู! (exit code: 1)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐จ Sa5er Error Handler โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ
โ ๐ ุฑุฃู ุงูุณููููุฑ: โ
โ ูุง ุนู
ุ ุฅูุช ุจุชุดุบูู ุณูุฑูุจุช ู
ุด ู
ูุฌูุฏ โ
โ ูู ุงูู package.json! ๐ โ
โ โ
โ โ
ุงูุญู: โ
โ 1. ุงูุชุญ package.json ูุดูู ุงูู scripts โ
โ 2. ุชุฃูุฏ ู
ู ุงุณู
ุงูุณูุฑูุจุช โ
โ 3. ุฌุฑุจ npm run ุนุดุงู ุชุดูู ุงูู
ุชุงุญ โ
โ โ
โ [ู
ู ุงูุฃุฑุดูู ๐] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ File not found
$ sa5er node app.js
๐ "ุงูู
ูุฏููู ุฏู ุงุฎุชูู ุฒู ู
ุง ุจุชุฎุชูู ุงูุณุญููุฉ ูุฑุง ุงูุชูุงุฌุฉ! ๐ฆ"โ Git in wrong directory
$ sa5er git push origin main
๐ "ูุง ุจุงุดุงุ ุฅูุช ู
ุด ูู git repo ุฃุตูุงู! ๐ ุฏู ุฒู ู
ุง ุชุทูุจ ูููุฉ ูู ุตูุฏููุฉ!"๐ง How It Works โ 3-Tier Error Handling
Sa5er uses a smart 3-tier system to minimize API calls:
Command fails โ stderr captured
โ
โโโ ๐ Layer 1: Local Error Database (40+ patterns)
โ โโโ Instant! No internet needed
โ
โโโ ๐ Layer 2: Dynamic Cache (~/.sa5er/cache.json)
โ โโโ Previously seen errors, instant response
โ
โโโ ๐ค Layer 3: AI (Groq/Gemini)
โโโ Unknown errors โ AI explains โ cached for next time| Layer | Speed | Internet | API Key | |-------|-------|----------|---------| | 1. Error DB | โก Instant | โ No | โ No | | 2. Cache | โก Instant | โ No | โ No | | 3. AI | ~2 seconds | โ Yes | โ Yes |
Most common errors are handled by Layer 1 โ no API key needed!
๐ Authentication
Sa5er supports two AI providers for Layer 3:
Option 1: Groq (Recommended โ Free! โ )
# 1. Get a free key from: https://console.groq.com/keys
# 2. Save it:
sa5er auth gsk_YOUR_GROQ_KEY- โ Free โ 14,400 requests/day
- โ Fast โ powered by custom LPU chips
- โ Global โ works everywhere
- Uses Llama 3.3 70B model
Option 2: Google Gemini
# 1. Get a key from: https://aistudio.google.com/app/apikey
# 2. Save it:
sa5er auth AIzaSyXXXXXXXXXX- May require billing in some regions
- Uses Gemini 2.0 Flash model
- Auto-fallback to Gemini 2.0 Flash Lite
Auto-detection: Sa5er automatically detects the provider from your key format (
gsk_โ Groq,AIzaโ Gemini)
๐ Commands
| Command | Description |
|---------|-------------|
| sa5er <command> | Run any terminal command with error handling |
| sa5er auth <key> | Save your AI API key (Groq or Gemini) |
| sa5er cache | Show cache statistics |
| sa5er cache-clear | Clear the error cache |
| sa5er --help | Show help |
| sa5er --version | Show version |
๐ฆ Built-in Error Patterns (Layer 1)
Sa5er recognizes 40+ common errors without needing any API key:
| Category | Errors |
|----------|--------|
| Node.js | MODULE_NOT_FOUND, SyntaxError, ReferenceError, TypeError, Maximum call stack size exceeded |
| npm | Missing script, ERESOLVE, ELIFECYCLE, deprecated warnings, audit vulnerabilities |
| Git | Not a git repository, merge conflicts, authentication failed |
| Network | ECONNREFUSED, ETIMEDOUT, CORS, ECONNRESET |
| File System | ENOENT, EACCES, EPERM, ENOSPC, ENAMETOOLONG |
| React | Hydration errors, invalid hook calls, key prop warnings |
| Next.js | SSR/SSG errors, prerendering failures |
| TypeScript | Type errors, TS2345, TS2322, file extension issues |
| Build Tools | Vite, Webpack, esbuild, Rollup errors |
| Docker | Daemon not running, image not found |
| Python | ModuleNotFoundError, pip not found |
| SSH | Connection refused, permission denied, host key verification |
| Database | Connection refused on common ports |
| ESLint | Parsing errors, rule violations |
| Environment | Missing .env variables, REACT_APP_, VITE_, NEXT_PUBLIC_ |
| Windows | PowerShell execution policy, path too long |
| Security | OpenSSL errors (ERR_OSSL_EVP_UNSUPPORTED) |
๐๏ธ Architecture
sa5er-cli/
โโโ bin/sa5er.js # CLI entry point
โโโ src/
โ โโโ index.js # CLI router (Commander.js)
โ โโโ commands/
โ โ โโโ auth.js # API key management
โ โ โโโ run.js # Command execution + 3-tier system
โ โโโ services/
โ โ โโโ errorMatcher.js # Layer 1: Regex pattern matching
โ โ โโโ cache.js # Layer 2: SHA-256 hashed cache
โ โ โโโ gemini.js # Layer 3: AI (Groq + Gemini)
โ โโโ utils/
โ โ โโโ config.js # Config management (~/.sa5er/)
โ โ โโโ display.js # Terminal UI + colored boxes
โ โ โโโ bidi.js # Arabic text rendering (RTL + shaping)
โ โโโ data/
โ โโโ errors.json # 40+ pre-loaded error patterns
โโโ package.json๐ Arabic Text Rendering
Sa5er properly renders Arabic text in terminals that don't natively support RTL:
- Letter Shaping โ Uses
arabic-reshaperto connect Arabic letters (Presentation Forms) - Bidi Reordering โ Uses
bidi-js(Unicode Bidirectional Algorithm) to display RTL text correctly in LTR terminals - Mixed Text โ English words (like
package.json) stay LTR within Arabic sentences
๐ค Contributing
Want to add more error patterns? Edit src/data/errors.json:
{
"pattern": "your regex pattern here",
"response": {
"sarcasm": "ุชุนููู ุณุงุฎุฑ ุจุงูุนุฑุจู ุงูู
ุตุฑู ๐",
"fix": "1. ุงูุฎุทูุฉ ุงูุฃููู\n2. ุงูุฎุทูุฉ ุงูุชุงููุฉ"
}
}Pull requests are welcome! ๐
๐ License
MIT ยฉ Sa5er CLI
Made with โ and Egyptian humor
ููุง ูุง ููุฏุณุฉุ ุงูููุฏ ู ุด ูููุชุจ ููุณู! ๐ช๐ฌ
