From bd997237557b2e9d9efcb32a034ba7559ff235b5 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 08:51:28 +0000 Subject: [PATCH] Initial upload: Shell History Alias Generator with full test suite --- README.md | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae72056..29bd3c5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,114 @@ -# shell-history-alias-generator +# Shell History Alias Generator -A CLI tool that analyzes terminal command history to discover frequently used long commands and generates shell aliases \ No newline at end of file +A CLI tool that analyzes your terminal command history to automatically discover frequently used long commands and generates shell aliases for them. + +## Features + +- **Multi-shell Support**: Parse history from Bash, Zsh, and Fish shells +- **Smart Analysis**: Calculate frequency scores and identify commands worth aliasing +- **Interactive Review**: Review suggested aliases before adding them with a rich terminal UI +- **Multi-format Export**: Export to bashrc, zshrc, or fish formats +- **Easy Installation**: Direct installation to shell configuration files + +## Installation + +```bash +pip install shell-history-alias-generator +``` + +Or from source: + +```bash +git clone https://7000pct.gitea.bloupla.net/7000pctAUTO/shell-history-alias-generator.git +cd shell-history-alias-generator +pip install -e . +``` + +## Usage + +### Analyze history and generate aliases + +```bash +shell-alias-gen analyze +``` + +With a specific history file: + +```bash +shell-alias-gen analyze ~/.bash_history --shell bash +``` + +### Interactive mode + +Review and select aliases interactively: + +```bash +shell-alias-gen analyze --min-frequency 3 +``` + +### Export to file + +```bash +shell-alias-gen analyze --export bash --output aliases.sh +``` + +### Install directly to shell rc file + +```bash +shell-alias-gen install --format bash +``` + +### View supported shells + +```bash +shell-alias-gen shells +``` + +### Show history file locations + +```bash +shell-alias-gen locations +``` + +## Options + +| Option | Description | +|--------|-------------| +| `--shell` | Shell type: bash, zsh, fish, or auto | +| `--min-length` | Minimum command length (default: 15) | +| `--min-frequency` | Minimum command frequency (default: 2) | +| `--export` | Export format: bash, zsh, or fish | +| `--output` | Output file path for export | +| `--non-interactive` | Skip interactive review mode | + +## How It Works + +1. **Parse History**: Reads shell history files in shell-specific formats +2. **Analyze Commands**: Counts command frequency and calculates complexity scores +3. **Generate Aliases**: Creates short, meaningful alias names +4. **Review**: Allows interactive review of suggested aliases +5. **Export**: Outputs aliases in your shell's format + +## Alias Name Generation + +Aliases are generated based on: +- First letters of command words (e.g., `git checkout` → `gc`) +- Common keywords (e.g., `docker`, `npm`) +- Minimum length and complexity requirements + +## Development + +```bash +# Install in development mode +pip install -e ".[dev]" + +# Run tests +pytest tests/ -v + +# Lint with ruff +ruff check . +``` + +## License + +MIT License