7000pctAUTO 4fb0b6ff88
Some checks failed
CI / test (push) Has been cancelled
Shellhist CI / build (push) Has been cancelled
Shellhist CI / test (push) Has been cancelled
test: add -> None return type annotations to all test methods
2026-01-31 14:21:27 +00:00
2026-01-31 13:12:59 +00:00
2026-01-31 14:19:05 +00:00
2026-01-31 13:13:00 +00:00
2026-01-31 13:13:01 +00:00

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 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 load
  • SHELL: 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

Description
A CLI tool that analyzes shell command history to find patterns and suggest automation. Features fuzzy search, pattern detection, auto-alias suggestions, time-based analysis, and script export for developers.
Readme MIT 149 KiB
v0.1.0 Latest
2026-01-31 13:13:26 +00:00
Languages
Python 100%