スキル一覧に戻る
eli0shin

test-cli

by eli0shin

1🍴 0📅 2025年12月27日
GitHubで見るManusで実行

SKILL.md


name: test-cli description: Start tmux sessions, send prompts to the CLI, capture output, and verify behavior using helper scripts. Use when testing the CLI, interactive mode, TUI components, or when the user mentions tmux sessions. allowed-tools:

  • Bash
  • Read

Test CLI Skill

This skill helps test the interactive CLI application using tmux sessions via bash commands, providing a real terminal environment for testing OpenTUI-based interactive components.

Quick Start: Use Helper Scripts First

IMPORTANT: Always use these helper scripts for testing. Only use raw tmux commands (documented below) if the scripts don't support your specific use case.

All scripts are located at .claude/skills/test-cli/scripts/ and should be run from your project root directory.

Basic Testing Workflow

# 1. Start a test session
PANE_ID=$(./.claude/skills/test-cli/scripts/start-cli-test.sh)

# 2. Send a prompt to the CLI
./.claude/skills/test-cli/scripts/send-prompt.sh $PANE_ID "your prompt here" --submit

# 3. Wait for response and capture output
sleep 5
tmux capture-pane -t $PANE_ID -p

# 4. Exit CLI cleanly
./.claude/skills/test-cli/scripts/exit-cli-test.sh $PANE_ID

# 5. Cleanup sessions
./.claude/skills/test-cli/scripts/cleanup-cli-tests.sh

Helper Scripts Reference

start-cli-test.sh

Creates a tmux session and launches the CLI. Returns the pane ID.

# Auto-generated session name
PANE_ID=$(./.claude/skills/test-cli/scripts/start-cli-test.sh)

# Custom session name
PANE_ID=$(./.claude/skills/test-cli/scripts/start-cli-test.sh my-test)

send-prompt.sh

Sends text character-by-character (simulates realistic typing).

# Send text without submitting
./.claude/skills/test-cli/scripts/send-prompt.sh $PANE_ID "hello world"

# Send text and press Enter
./.claude/skills/test-cli/scripts/send-prompt.sh $PANE_ID "hello world" --submit

exit-cli-test.sh

Properly exits the CLI (sends two Ctrl+C within 3 seconds).

./.claude/skills/test-cli/scripts/exit-cli-test.sh $PANE_ID

cleanup-cli-tests.sh

Kills test sessions matching a pattern.

# Kill all "cli-test-*" sessions
./.claude/skills/test-cli/scripts/cleanup-cli-tests.sh

# Custom pattern
./.claude/skills/test-cli/scripts/cleanup-cli-tests.sh "my-test-*"

CLI-Specific Behavior

Exit Confirmation

The CLI requires two Ctrl+C presses within 3 seconds to exit (src/tui/components/TUIApp.tsx:111-123). The exit-cli-test.sh script handles this automatically.

Essential tmux Commands for Debugging

# Capture output (use after sending prompts)
tmux capture-pane -t $PANE_ID -p              # Current screen
tmux capture-pane -t $PANE_ID -p -S -100      # Last 100 lines
tmux capture-pane -t $PANE_ID -p -S -500      # Last 500 lines

# List all sessions
tmux list-sessions

IMPORTANT: Never use tmux attach - it blocks execution. Always use capture-pane to read output.

Troubleshooting

  • No output after sending prompt: Add sleep 5-10 before capturing output
  • Pane not found: Check session exists with tmux list-sessions
  • Need to see what happened: Capture more lines with tmux capture-pane -t $PANE_ID -p -S -500
  • CLI seems stuck: Capture output to see current state, don't attach to session
  • testing-cli-with-tmux.md - Original documentation and learnings
  • interactive-tests/ - Interactive test suite using tmux
  • src/tui/components/TUIApp.tsx - CLI exit behavior implementation

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です