- Drop this repo’s
zshrcinto~/zshrcand the AI helper into~/ai_helper.py. - Set API keys:
export OPENAI_API_KEY="<your-openai-key>"and (optional)export GEMINI_API_KEY="<your-gemini-key>". - Reload shell:
source ~/zshrc(or runreload). - Use AI in terminal:
aiask <question>– Ask anything.aidebug <error text>– Paste an error to diagnose.aihelp <command>– Execute a command and get AI analysis + verdict.aistatus– Verify installation.
- A colorful, productivity-focused
zshconfiguration tailored for macOS. - Auto-check and optional auto-install of enhanced CLI tools (Homebrew packages).
- A rich alias/function suite for navigation, files, Git, search, processes, network, and system info.
- A comprehensive, category-driven help system (
help,help nav,help git, …). - An AI Terminal Assistant integrated into your shell using OpenAI and Google Gemini for:
- Asking questions (
aiask) - Debugging errors (
aidebug) - Analyzing executed commands with a success/failure verdict (
aihelp)
- Asking questions (
- macOS with
zsh(default on modern macOS) - Homebrew (for optional auto-install of tools):
https://brew.sh - Python 3.9+ with
pip3 - Python packages:
google-genaiandrich(and optionallyopenai)
brew install python
pip3 install google-genai rich openai- Place files
- Copy repo
zshrcto~/zshrc(backup your current one first). - Copy repo
ai_helper.pyto~/ai_helper.pyand ensure it’s executable:
cp ./zshrc ~/zshrc
cp ./ai_helper.py ~/ai_helper.py
chmod +x ~/ai_helper.py- Configure API keys
- OpenAI (required for OpenAI fallback and features):
echo 'export OPENAI_API_KEY="sk-..."' >> ~/zshrc- Gemini (optional but recommended):
- The script uses
google-genai; configure via environment variable you prefer (e.g.GEMINI_API_KEYorGOOGLE_API_KEY). Updateai_helper.pyif needed to read your chosen variable.
- The script uses
echo 'export GEMINI_API_KEY="..."' >> ~/zshrc- Reload your shell
source ~/zshrc
# or simply open a new terminal sessionThe AI helper script (~/ai_helper.py) supports both providers with smart fallback.
-
aiask <question>- Sends a context-aware prompt (OS, shell, cwd) and returns a concise Markdown answer optimized for macOS.
-
aidebug <error text>- Paste an error or issue description to get diagnosis, concrete fix commands, explanation, prevention, and alternatives.
-
aihelp <command>- Executes the command first, shows raw output, then AI provides a structured analysis including a mandatory success/failure verdict derived from the return code.
- Example:
aihelp git status
aihelp find . -name "*.log"
aihelp chmod +x script.sh-
aistatus- Verifies that
~/ai_helper.py, Python, and required modules are available.
- Verifies that
-
install_ai_helper- Installs Python dependencies and writes a fresh
~/ai_helper.pyif you need a quick bootstrap.
- Installs Python dependencies and writes a fresh
Notes
- Do not commit API keys. Prefer exporting keys in
~/zshrcor using macOS Keychain. - The script prints provider fallback status so you know which model answered.
Below are examples of the AI-enhanced command analysis and terminal output presentation:
On interactive shells, zshrc checks for handy tools and offers to install missing ones via Homebrew:
- bat, eza, fd, ripgrep (rg), tree, htop, fzf, qrencode
If you agree, it installs them and enables enhanced aliases like pretty ls (via eza) and syntax-highlighted cat (via bat). You can later re-run reload to source updates.
Below is a quick, high-signal tour. Use the built-in help for full details: help, help nav, help git, help files, help search, help process, help system, help network, help history, help utils, help workspace, or help all.
Navigation
.. ... .... ~ -– Quick directory movesd,1,2,3– Directory stack and jumpsworkspace,ws,desktop,documents,downloads,down– One-tap jumpsmkcd <dir>– Create directory and enter it
Files & Listing
ls ll la l lh lt ltr lsize– Colorful ls variants (eza if available)cat– Usesbatif installed, falls back tocattree– Color tree view- Safer ops:
cp/mv/rmprompt by default;mkdir -pv,rmdir -v - Utilities:
cpcontent(file → clipboard),cppath(pwd → clipboard),finder,preview,extract <archive>,backup <file>
Search
grep,fgrep,egrep– Colorizedfindfile <name>,finddir <name>,findin <text>– Handy wrappers
Git
- Shorthands:
g,ga,gaa,gc,gca,gco,gcb - Status/diff/log:
gs,gss,gd,gds,gl,gll,gtree - Sync:
gp,gpl,gf,gm,gb - Resets:
gundo,greset,gclean,gst,gstp
Processes & System
- Views:
processes,ptop,pscpu,psmem,top,htop,myps - Kill:
kpid <pid>,kname <name>(interactive),kport <port>,fkill <pid|name> - Disk/Env:
df,du,sizes,biggest,env,path,aliases,reload
Network
myip,localip,ping,wifi,ports,speedtest
History (auto-logged with timestamp + path)
viewhistory/vh– Last 100 commandssearchhistory/sh– Search; also-path,-time,-date(supportstoday/yesterday)historystat/hs– Stats: totals, top commands, most active directoriescleanhistory/ch– Keep last 10,000 entries (auto-clean runs periodically)
Built-in Help System
help– Main menuhelp <category>–nav,git,files,search,process,system,network,history,utils,workspacehelp all– One-shot list of everythinghelp <command>– Quick synopsis + examples
Custom Project Shortcuts
- Env:
activate– Activate a pre-configured Python venv - Folders:
dl(Dennis Labs),proj(Projects) - Remote:
connectdietnerd,connectdietnerdstaging(SSH with provided keys)
- Prefer precise prompts (include the goal, context, and constraints).
- For failures, paste the exact error into
aidebug. - For “what happened?” questions, wrap the real command with
aihelpto get a deterministic verdict based on the return code. - Use
aistatusif something feels off.
-
AI keys
- Ensure
OPENAI_API_KEYis exported. For Gemini, exportGEMINI_API_KEY(or adjustai_helper.pyto your env var).
- Ensure
-
Python modules
pip3 install google-genai rich openai
-
Homebrew
- If missing, the
zshrcwill offer to install it and required tools. You can also install manually.
- If missing, the
-
Aliases overriding each other
- If you enable
ezaaliases early and later seelsrevert to classicls -G, search~/zshrcfor multiplealias ls=...lines and keep only the variant you prefer.
- If you enable
-
Workspace helpers
- The help system documents workspace commands (e.g.,
sss,go*). If they’re not yet defined on your machine, add or adapt them as needed.
- The help system documents workspace commands (e.g.,
- Do not commit API keys. Use environment variables or a secrets manager.
- Review
~/zshrcfor any hardcoded keys and replace with env vars.
Personal configuration meant to be customized. Adapt freely within your environment.

