A humble command-line helper for your shell. alias-gen watches your command history, spots the sequences you repeat, and turns them into simple, memorable shortcuts—so you can focus on your work instead of your typing.
I kept finding myself typing the same long command chains—sometimes dozens of keystrokes—just to get simple tasks done. It felt backward, like I was teaching the computer instead of the other way around. alias-gen learns from your own history and suggests concise aliases or tiny functions that fit how you work.
- Download and install curl -sSL https://github.com/Pranav435/alias-gen/raw/v1.0.0/install.sh | bash
- Configure your OpenAI API key and choose a UI alias_gen config
- Preview what alias-gen found alias_gen scan
- Merge your favorites into your shell alias_gen install
- Activate the new shortcuts open a new shell or run source ~/.bashrc (or the RC file for your shell)
alias-gen combines straightforward heuristics with a dash of AI to suggest shortcuts you’ll actually use:
-
Load your history • Reads up to the last 10 000 commands from your shell’s history (bash, zsh, fish) or PowerShell’s PSReadLine log • Drops blank lines and exact duplicates—so you get real patterns, not noise
-
Detect repeating sequences • Uses “sliding windows” of length 1, 2, and 3 to collect command sequences • Counts occurrences: only keeps pairs/triplets that appear at least 3 times by default • Single-command rules: a one-liner must either be at least 30 characters long or contain multiple tokens • Filters out trivial commands: skips simple built-ins like ls, pwd, echo or any patterns you’ve asked to ignore (brew install, curl -fsSL, etc.) • Whitelists special workflows: sequences like cd project && source venv/bin/activate get through even if rare • Normalizes paths: turns cd ~/projects/foo into cd foo, so your alias is reusable across directories • Deduplicates by normalized form and ranks by frequency
-
Generate suggestions with AI • Packages the top patterns into a single prompt for GPT-4-mini (or your chosen model) with a clear system message • Receives back alias definitions or small shell functions, e.g.: alias gs='git status' # check git status in one keystroke function go() { cd "$1"; ls; } # jump into a folder and list • You can tweak model, temperature, token limits and ignore-patterns via alias_gen config
-
Safely install into your shell • Backs up your RC file (~/.bashrc, ~/.zshrc, etc.) with a timestamp • Inserts or updates the block between
…your new aliases…
• Leaves everything else untouched—so you can review, revert or adjust by hand
alias_gen [--history-file PATH] [--ui terminal|tui|web]
• --history-file PATH use a custom history file instead of the default • --ui MODE override saved UI mode (terminal, tui, or web)
• config set or update your OpenAI API key and UI mode • scan preview AI-generated alias suggestions without writing to your shell • install apply selected aliases/functions to your RC file • edit review, rename or delete entries in your alias-gen block • manual enter a custom alias or function by hand
• Preview suggestions: alias_gen scan
• Install them: alias_gen install
• Tweak what’s there: alias_gen edit
• Reconfigure or switch UI: alias_gen config
- git clone https://github.com/Pranav435/alias-gen.git
- cd alias-gen
- pip install --user openai InquirerPy flask pyinstaller
- pyinstaller --onefile alias_gen.py (executable appears at dist/alias_gen)
Bugs, ideas or pull requests? Open an issue or send a PR: https://github.com/Pranav435/alias-gen
YouTube: https://youtube.com/@imtheblindiephoenix Twitter: https://twitter.com/blindiephoenix
I’m a college student with limited funds. If alias-gen saves you time (or typos), any support helps keep me coding (and caffeinated):
https://paypal.me/theblindiephoenix
Thank you for trying alias-gen!