Linux / Docker コマンド学習用のモック CLI ゲームです。
実環境には触れず、仮想ファイルシステムと仮想 Docker 状態だけを更新します。
- Linux / macOS / Docker の学習モードを選べます
quizとchallengeの 2 モードでコマンド練習できます- Tab キーで補完候補を表示・選択できます(難易度で候補数が変わります)
- 同義コマンドも正解として判定します
- セッション保存、再開、成績確認ができます
- 実際のマシンには変更を加えません
clone せずに使う導線は brew と uv を含めて用意します。
現時点では HEAD install です。
brew install --HEAD https://raw.githubusercontent.com/torifo/cmd-mock-cli/main/Formula/cmdock.rb
cmdock補足:
- Homebrew が内部で source checkout と build を行います
- 利用者が手動で
git cloneする必要はありません - Rust toolchain は Homebrew 側で build dependency として解決します
uv では GitHub 上の installer package から cmdock を入れられます。
uv tool install "git+https://github.com/torifo/cmd-mock-cli@main#subdirectory=python/uv-installer"
cmdock補足:
- インストールされる
cmdockは lightweight bootstrapper です - 初回実行時に GitHub Release から対応バイナリを取得して実行します
- 利用者が手動で
git cloneする必要はありません
一時実行だけなら以下でも使えます。
uvx --from "git+https://github.com/torifo/cmd-mock-cli@main#subdirectory=python/uv-installer" cmdock --helpcurl -fsSL https://raw.githubusercontent.com/torifo/cmd-mock-cli/main/install.sh | bashバイナリは ~/.local/bin/cmdock に配置されます。~/.local/bin が PATH に含まれていない場合は、スクリプトが案内します。
前提: Rust toolchain / Cargo
git clone git@github.com:torifo/cmd-mock-cli.git
cd cmd-mock-cli
cargo install --path .
cmdock --helpcmdock引数なしで起動するとオンボーディングが始まります。
Welcome to cmdock!
Try typing this command to confirm the virtual environment is working:
ls
Press Enter to run it.
> ls
readme.txt
--- Virtual environment OK ---
Select play mode:
1) quiz Answer prompts with the correct command
2) challenge Complete multi-step tasks then type submit
> 1
Select difficulty:
1) easy Detailed hints, basic commands
2) normal Minimal hints, wider range
3) hard No hints, broadest range
> 2
--- Game Start! ---
フラグで直接起動することもできます。
cmdock --learning-mode docker --difficulty hard
cmdock --play-mode challenge --no-completion
cmdock --list # 全オプションを確認すべてのモードは起動時の CLI フラグで指定します。
cmdock --listAvailable options for cmdock:
--learning-mode <MODE> Target environment to learn
linux Linux shell commands (default)
macos macOS shell commands
docker Docker CLI commands
--play-mode <MODE> Game mode
quiz Answer prompts with the correct command (default)
challenge Complete multi-step tasks then type submit
--difficulty <LEVEL> Hint and range control
easy Detailed hints, basic commands (default)
normal Minimal hints, wider range
hard No hints, broadest range
--no-completion Disable tab completion
┌─────────────────────────────────────────────────────────┐
│ [linux] [quiz] [easy] [completion:on] │ ← ステータスバー
├─────────────────────────────────────────────────────────┤
│ Question │ ← 問題文
│ 現在のディレクトリ配下から `app.log` を探してください。 │
├─────────────────────────────────────────────────────────┤
│ Input (Tab: complete Shift+Tab: prev Ctrl+C: quit) │ ← 入力欄
│ > find . -name app.log█ │
├─────────────────────────────────────────────────────────┤
│ Completions │ ← 補完候補(Tab で表示)
│ ▶ find . -name app.log │
├─────────────────────────────────────────────────────────┤
│ History │ ← フィードバック履歴
│ correct │
│ explanation: find . -name で再帰検索します │
└─────────────────────────────────────────────────────────┘
ゲーム中に使えるメタコマンドです。
help このヘルプを表示
result 正答率・モード別・難易度別の成績を表示
resume 保存済みセッションを再開
submit 課題の採点 (challenge モードのみ)
quit 終了
| コマンド | 対応フラグ |
|---|---|
pwd |
— |
ls |
-a, -l, -la |
cd |
— |
mkdir |
-p (親ディレクトリ自動作成) |
touch |
— |
cat |
— |
cp |
— |
mv |
— |
rm |
-r, -rf (再帰削除) |
find |
-name, -type |
grep |
ファイル引数指定 |
echo |
— |
| コマンド | 対応フラグ |
|---|---|
docker images |
— |
docker pull <image> |
— |
docker run <image> |
--name, -d, -p, -e, -v |
docker ps |
-a |
docker stop <name> |
— |
docker rm <name> |
— |
docker logs <name> |
— |
docker exec <name> <cmd> |
— |
result で以下を確認できます。
answered: 12 correct: 10 accuracy: 83.3%
by play mode:
quiz: 8/10 (80.0%)
challenge: 2/2 (100.0%)
by difficulty:
easy: 6/7 (85.7%)
hard: 4/5 (80.0%)
most missed commands:
find: 2 times
grep: 1 times
$ cmdock --learning-mode docker --play-mode quiz
# TUI が起動し、問題文と入力欄が表示されます
docker run --name web2 nginx → correct
docker image ls → correct (synonym accepted)
cargo run # 起動
cargo test # テスト (20件)
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt- CI:
.github/workflows/ci.yml(fmt / clippy / test) - Release:
.github/workflows/release.yml(タグv*.*.*で Linux/macOS/Windows バイナリを自動生成)
- macOS 専用の問題セットはまだ Linux と共通です
- 問題セットはまだ最小限です(shell 8問、docker 6問)