rcmd

CLI のための個人コマンド知識ベース

WindowsmacOSLinux

シェル履歴から「残す価値のあるコマンド」だけをキュレーション。 {{プレースホルダー}} 置換・タグ・全文検索で素早く呼び出し、そのまま実行。 ストレージはローカルの TOML ファイル一枚。依存は typer だけ。

GitHub で見る インストール

rcmd を選ぶ理由

履歴の「検索」ではなく「キュレーション」

atuinfzfhstr はライブ履歴を検索するツール。rcmd は「また使いたいコマンド」だけを手元に残すためのツールです。ノイズのない自分専用コマンド集を育てられます。

{{プレースホルダー}} 置換

コマンドに {{image}}{{path}} を埋め込んでおき、呼び出し時に --set image=alpine で差し込み。汎用テンプレートとして繰り返し再利用できます。

タグ & 全文検索

-t docker -t dev でタグ付け、rcmd search docker で絞り込み。出力は 1 行ずつなので fzf との組み合わせも自然です。

ローカル TOML、dotfiles で同期

ストレージは ~/.config/rcmd/store.toml(または %APPDATA%\rcmd\store.toml)の TOML ファイル 1 枚。手で編集でき、dotfiles リポジトリに入れるだけで複数マシンへ展開できます。

シェル履歴から一括インポート

rcmd history --unique --reverse | fzf | rcmd save -d "説明" のパイプ一発で、既存の履歴から選んで登録。まっさらなところからでもすぐ始められます。

依存 1 つ、すぐ動く

依存は typer のみ。uv sync && uv run rcmd --help で即起動。Python の煩雑な環境構築なし。

インストール

1. リポジトリをクローン

git clone https://github.com/ymatsuza/rcmd.git && cd rcmd

2. 依存を解決して起動(uv 推奨)

uv sync
uv run rcmd --help

uv が入っていない場合は astral.sh/uv を参照してください。

使い方

コマンドを保存する

# プレースホルダー付きで保存
rcmd save "docker run --rm -it -v {{path}}:/work {{image}} bash" \
    -d "カレントディレクトリをマウントしてインタラクティブシェル" \
    -t docker -t dev

# シェル履歴から fzf で選んで保存
rcmd history --unique --reverse | fzf | rcmd save -d "説明を書く" -t imported

検索・一覧

# キーワード検索(fzf と組み合わせやすい 1 行出力)
rcmd search docker

# タグで絞り込み
rcmd list -t git

# 詳細表示(man ページ風)
rcmd show k3f9

呼び出し・実行

# 標準出力に展開($(rcmd get ...) や clip で活用)
rcmd get k3f9 --set path=$PWD --set image=alpine
rcmd get k3f9 --set path=. --set image=alpine | clip      # Windows
rcmd get k3f9 --set path=. --set image=alpine | pbcopy    # macOS

# そのまま実行(--dry-run でプレビュー)
rcmd run k3f9 --set path=. --set image=alpine
rcmd run k3f9 --set path=. --set image=alpine --dry-run

編集・削除

rcmd edit k3f9 -d "新しい説明" -t docker
rcmd rm k3f9

ストア場所

  • 環境変数で上書き$RCMD_STORE に任意のパスを指定
  • macOS / Linux~/.config/rcmd/store.toml(XDG 準拠)
  • Windows%APPDATA%\rcmd\store.toml

プレーンな TOML なのでテキストエディタで手編集可能。dotfiles リポジトリに入れて複数マシン間で同期できます。

rcmd

A personal command knowledge base for the CLI

WindowsmacOSLinux

Curate the commands worth keeping from your shell history. Recall them instantly with {{placeholder}} substitution, tags, and full-text search — or run them directly. Storage is a single local TOML file. One dependency: typer.

View on GitHub Install

Why rcmd

Curation, not just search

atuin, fzf, and hstr search your live history. rcmd curates the commands worth keeping. Build a personal reference you’ll actually reuse, without the noise of ten thousand transient invocations.

{{placeholder}} substitution

Embed {{image}} or {{path}} in a saved command, then fill them at recall time with --set image=alpine. Turn any one-off command into a reusable template.

Tags & full-text search

Tag with -t docker -t dev, then narrow with rcmd search docker. One-line output keeps it fzf-friendly.

Local TOML, sync via dotfiles

The store lives at ~/.config/rcmd/store.toml (or %APPDATA%\rcmd\store.toml on Windows). Plain TOML — hand-edit it, commit it to your dotfiles repo, and you’re synced across machines.

Import from shell history

rcmd history --unique --reverse | fzf | rcmd save -d "desc" — pipe your existing history through fzf and save the good ones in one shot.

One dependency, runs immediately

Just typer. uv sync && uv run rcmd --help and you’re done. No environment wrangling.

Install

1. Clone the repo

git clone https://github.com/ymatsuza/rcmd.git && cd rcmd

2. Install deps and run (uv recommended)

uv sync
uv run rcmd --help

Don’t have uv yet? See astral.sh/uv.

Usage

Save a command

# Save with placeholders
rcmd save "docker run --rm -it -v {{path}}:/work {{image}} bash" \
    -d "mount cwd, interactive shell" \
    -t docker -t dev

# Import from shell history via fzf
rcmd history --unique --reverse | fzf | rcmd save -d "describe me" -t imported

Search & list

# Keyword search (one-line output, fzf-friendly)
rcmd search docker

# Filter by tag
rcmd list -t git

# Inspect one entry (man-page view)
rcmd show k3f9

Recall & run

# Print to stdout (use with $() or a clipboard tool)
rcmd get k3f9 --set path=$PWD --set image=alpine
rcmd get k3f9 --set path=. --set image=alpine | clip      # Windows
rcmd get k3f9 --set path=. --set image=alpine | pbcopy    # macOS

# Run it directly (--dry-run to preview first)
rcmd run k3f9 --set path=. --set image=alpine
rcmd run k3f9 --set path=. --set image=alpine --dry-run

Edit & remove

rcmd edit k3f9 -d "new description" -t docker
rcmd rm k3f9

Store location

  • Override via env var — set $RCMD_STORE to any path
  • macOS / Linux~/.config/rcmd/store.toml (XDG)
  • Windows%APPDATA%\rcmd\store.toml

Plain TOML — hand-edit it or commit it to your dotfiles to sync across machines.