0a3351d396c2334559868ca5653e21dea598d884
Shell History Automation Tool
A CLI tool that analyzes shell command history to find patterns and suggest automation. It learns repetitive command sequences and offers to create aliases or scripts.
Features
- Fuzzy Search: Search through shell history with configurable similarity thresholds
- Pattern Detection: Detect repetitive command sequences and common patterns
- Auto-Alias Suggestions: Automatically suggest shell aliases for detected command sequences
- Time-Based Analysis: Analyze time-based patterns and suggest automation based on when commands are run
- Script Export: Export detected patterns to executable shell scripts
- Multi-Shell Support: Support for bash and zsh history formats
Installation
pip install -e .
Quick Start
# Search history with fuzzy matching
shellhist search "git status"
# Detect repetitive patterns
shellhist patterns
# Get alias suggestions
shellhist suggest-aliases
# Analyze time-based patterns
shellhist analyze-time --daily
# Export patterns to script
shellhist export-script --output ./scripts/
Commands Overview
search
Search shell history with fuzzy matching.
shellhist search "git commit" --threshold 70 --limit 10
patterns
Detect repetitive command sequences and patterns.
shellhist patterns --min-frequency 3
suggest-aliases
Generate alias suggestions for detected patterns.
shellhist suggest-aliases --auto-create
analyze-time
Analyze time-based patterns in command history.
shellhist analyze-time --daily --time-range 7d
export-script
Export detected patterns to executable shell scripts.
shellhist export-script --output ./scripts/ --name myscript
Configuration
The tool uses the following environment variables:
HISTFILE: Path to shell history file (default: ~/.bash_history or ~/.zsh_history)HISTSIZE: Number of history entries to loadSHELL: Detects bash vs zsh for format parsing
Examples
Find similar commands you run frequently
$ shellhist search "deploy"
Found 5 similar commands:
1. npm run deploy (85% match)
2. ./deploy.sh production (78% match)
3. git push origin main (72% match)
Detect and create an alias for a common sequence
$ shellhist suggest-aliases
Detected pattern: git add . && git commit -m "update" && git push
Suggested alias: gup='git add . && git commit -m "update" && git push'
Create this alias? [Y/n]
Contributing
Pull requests are welcome. For major changes, please open an issue first.
License
MIT