⚠️ 注意: このプロジェクトのコードとドキュメントは、すべてClaude Codeによって作成されています。
Historia は、ディレクトリ別にコマンド履歴を管理し、高速なインクリメンタルサーチを提供するRust製CLIツールです。
- 🗂️ ディレクトリ別履歴管理 - プロジェクトごとに履歴を分離
- ⚡ 高速検索 - SQLiteベースで2.8ms/search の高速性能
- 🔍 インクリメンタルサーチ - fzf、peco、skなどの外部ツールと連携
- 🐚 シェル統合 - Zsh、Bash、Fish で透明に動作
- 📊 多様な出力形式 - Simple、Detailed、JSON、CSV対応
- 🎯 重複管理 - 同一コマンドの実行回数を自動カウント
- 🚀 パフォーマンス最適化 - WALモード、インデックス最適化
- ⚙️ 設定可能 - 無視パターン、プライバシー設定
# Rust環境が必要です
git clone https://github.com/your-username/historia.git
cd historia
cargo install --path .# コマンドを手動で追加
historia add "ls -la" --exit-code 0
# 履歴を表示
historia
# 検索
historia list "git"
# 統計情報
historia stats
# 外部ツールでインクリメンタルサーチ
historia search --tool fzf# Zshの場合
echo 'eval "$(historia init zsh)"' >> ~/.zshrc
# Bashの場合
echo 'eval "$(historia init bash)"' >> ~/.bashrc
# Fishの場合
echo 'eval (historia init fish)' >> ~/.config/fish/config.fishシェル統合後は、コマンドが自動的に記録され、Ctrl+Rでインクリメンタルサーチが利用できます。
| コマンド | 説明 | 例 |
|---|---|---|
add |
コマンドを履歴に追加 | historia add "npm test" --exit-code 1 |
list |
履歴を一覧表示/検索 | historia list "docker" |
search |
外部ツールで検索 | historia search --tool fzf --multi |
stats |
統計情報を表示 | historia stats |
tools |
利用可能な外部ツール | historia tools |
optimize |
データベース最適化 | historia optimize |
init |
シェル統合スクリプト生成 | historia init zsh |
| オプション | 短縮形 | 説明 | 例 |
|---|---|---|---|
--format |
-f |
出力形式 | --format json |
--limit |
-l |
結果数制限 | --limit 50 |
--directory |
-d |
対象ディレクトリ | --directory /home/user |
--verbose |
-v |
詳細表示 | --verbose |
# シンプル(デフォルト)
historia
# git status
# npm test
# cargo build
# 詳細
historia --format detailed
# [2025-07-31 10:30:15] git status (executed 5 times) - ✓
# [2025-07-31 10:25:30] npm test (executed 2 times) - ✗ (1)
# JSON
historia --format json
# [{"command": "git status", "timestamp": 1753920615, ...}]
# CSV
historia --format csv
# command,timestamp,directory,execution_count,exit_code,duration
# "git status",1753920615,"/home/user/project",5,0,120- fzf - 高機能ファジーファインダー(推奨)
- peco - シンプルなインタラクティブフィルタ
- sk - Rust製のfzf代替
- rofi - X11用メニューシステム
- dmenu - X11用動的メニュー
# fzfでマルチ選択
historia search --tool fzf --multi
# カスタムオプション付き
historia search --tool fzf --tool-options "--height 80% --preview 'echo {}'"
# パイプライン使用
historia | fzf --height 40%設定ファイル: ~/.local/share/historia/config.toml
[storage]
max_entries = 10000
cleanup_after_days = 365
[behavior]
record_duplicates = true
inherit_parent_history = false
ignore_patterns = [
"^ls$",
"^cd ",
"^pwd$"
]
[integration]
shell_hooks = ["zsh", "bash"]
default_search_tool = "fzf"
search_tool_options = "--height 40% --reverse"
[privacy]
exclude_patterns = [
".*password.*",
".*token.*",
".*secret.*"
]
hash_sensitive_commands = false| 操作 | 実行時間 | 備考 |
|---|---|---|
| 検索(100回) | 0.31秒 | 3.1ms/search |
| 一覧表示(50回) | 0.14秒 | 2.8ms/list |
| JSON出力(20回) | 0.06秒 | 3.0ms/export |
| データベース最適化 | 0.005秒 | VACUUM + ANALYZE |
# データベース最適化実行
historia optimize
# Before optimization:
# Total entries: 10000
# Database size: 2.1 MB
# After optimization:
# Total entries: 10000
# Database size: 1.8 MB
# Size reduced by: 0.3 MB (14.3%)Historia
├── Core Engine (Rust)
│ ├── SQLite Database (WAL mode)
│ ├── Command Parser
│ └── Search Engine
├── Shell Integration
│ ├── Zsh hooks
│ ├── Bash hooks
│ └── Fish hooks
└── External Tool Interface
├── fzf integration
├── peco integration
└── Custom output formats
CREATE TABLE command_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
directory TEXT NOT NULL,
command TEXT NOT NULL,
timestamp INTEGER NOT NULL,
duration INTEGER,
exit_code INTEGER,
execution_count INTEGER DEFAULT 1,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
);
-- 最適化されたインデックス
CREATE INDEX idx_directory_timestamp ON command_history(directory, timestamp DESC);
CREATE INDEX idx_directory_command ON command_history(directory, command);- ローカル保存のみ - データは外部に送信されません
- 機密情報フィルタ - パスワードやトークンを自動除外
- 設定可能な除外パターン - カスタム無視ルール
- 履歴暗号化オプション - 将来のバージョンで対応予定
# プロジェクトクローン
git clone https://github.com/your-username/historia.git
cd historia
# 依存関係インストール
cargo build
# テスト実行
cargo test
# ベンチマーク実行
cargo bench
# 開発用実行
cargo run -- --help# 簡易パフォーマンステスト
./simple_perf_test.sh
# 最適化版テスト
./optimized_perf_test.shバグ報告や機能リクエストは Issues へお願いします。
プルリクエストも歓迎します:
- フォークする
- フィーチャーブランチを作成 (
git checkout -b feature/amazing-feature) - コミット (
git commit -m 'Add amazing feature') - プッシュ (
git push origin feature/amazing-feature) - プルリクエストを作成
このプロジェクトは MIT ライセンスの下で公開されています。詳細は LICENSE ファイルをご覧ください。
- Fish シェル完全対応
- AI支援コマンド推薦
- 履歴の暗号化オプション
- プラグインシステム
- チーム間履歴共有
- Web インターフェース
- Docker/Git 統合
- カスタムフォーマット対応
Historia で、より効率的なコマンドライン作業を始めましょう! 🚀