CLI Yes Automation Skill

snomiao/claude-yes

A skill for automating AI CLI tool interactions by handling common prompts and managing continuous operation.

5 stars
2 forks
TypeScript
31 views

SKILL.md

CLI Yes Automation Skill

A skill for automating AI CLI tool interactions by handling common prompts and managing continuous operation.

Description

This skill helps you work with the cli-yes wrapper tool, which automates interactions with various AI CLI tools (Claude, Gemini, Codex, Copilot, Cursor, Grok, Qwen) by automatically responding to common prompts and keeping the tools running continuously.

When to Use This Skill

  • Setting up automated AI CLI workflows
  • Configuring continuous operation with AI assistants
  • Implementing auto-response patterns for yes/no prompts
  • Managing crash recovery and idle detection
  • Running AI CLI tools in automation scripts or CI/CD pipelines

Key Capabilities

Multi-CLI Support

Works with multiple AI coding assistants:

  • Claude Code (Anthropic) - Industry-leading performance
  • Gemini CLI (Google) - Free tier with generous limits
  • Codex CLI (OpenAI/Microsoft) - Cloud-based collaboration
  • Copilot CLI (GitHub) - Seamless GitHub integration
  • Cursor CLI - Multi-model support with RAG
  • Grok CLI (xAI) - Real-time data access
  • Qwen Code CLI (Alibaba) - Open source, high performance

Automation Features

  • Auto-Response: Automatically responds "Yes" to common prompts
  • Continuous Operation: Keeps AI running until task completion
  • Crash Recovery: Automatic process restart on crashes
  • Idle Detection: Optional auto-exit when AI becomes idle
  • Interactive Control: Queue prompts or cancel with ESC/Ctrl+C

Usage Examples

Basic Command Line Usage

# Use Claude (default)
cli-yes claude -- run all tests and commit current changes
bunx cli-yes claude "Solve TODO.md"

# Use other AI tools
cli-yes codex -- refactor this function
cli-yes grok -- help me with this code
cli-yes copilot -- generate unit tests
cli-yes cursor -- optimize performance
cli-yes gemini -- debug this code
cli-yes qwen -- implement new feature

# Auto-exit when idle (for automation)
cli-yes claude --exit-on-idle=60s "run all tests and commit current changes"

Library Usage in Node.js

import cliYes from 'cli-yes';

// Use Claude
await cliYes({
  prompt: 'help me solve all todos in my codebase',
  cli: 'claude',
  cliArgs: ['--verbose'],
  exitOnIdle: 30000, // exit after 30 seconds of idle
  continueOnCrash: true,
  logFile: 'claude.log',
});

// Use other tools
await cliYes({
  prompt: 'debug this function',
  cli: 'gemini',
  exitOnIdle: 60000,
});

Configuration Options

  • --cli=<tool>: Specify AI CLI tool (claude, gemini, codex, copilot, cursor, grok, qwen)
  • --exit-on-idle=<duration>: Auto-exit after specified idle time (e.g., "60s", "5m")
  • Custom CLI args can be passed through for tool-specific options

Security Considerations

⚠️ Important: Only run on trusted repositories. This tool:

  • Automatically responds to prompts without user confirmation
  • Can execute commands automatically
  • May be vulnerable to prompt injection attacks in malicious code/files

Always review repositories before running automated tools.

Implementation Details

Uses node-pty or bun-pty to manage AI CLI processes with:

  • Pattern matching: Detects ready states, prompts, and errors
  • Auto-response system: Sends "Yes" to common prompts
  • Process lifecycle management: Handles crashes and graceful exits
  • Tool-specific configurations: Custom patterns for each CLI

Installation

# Install the wrapper tool globally
npm install cli-yes -g

# Install your preferred AI CLI
npm install -g @anthropic-ai/claude-code  # Claude
npm install -g @vibe-kit/grok-cli         # Grok
# See documentation for other CLI installation

Best Practices

  1. Start small: Test with simple tasks before complex automation
  2. Use idle timeout: Set --exit-on-idle for automated scripts
  3. Review output: Check logs and results regularly
  4. Trust repositories only: Never run on untrusted code
  5. Choose the right CLI: Match tool to task requirements
    • Complex tasks → Claude Code
    • Budget-conscious → Gemini or Qwen
    • GitHub integration → Copilot
    • Team collaboration → Codex or Cursor

Resources

License

MIT - See project repository for details

README

Cli Yes! Claude/Gemini/Cursor/Copilot/Qwen

A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses. Originally designed for Claude CLI, now supports multiple AI coding assistants.

⚠️ Important Security Warning: Only run this on trusted repositories. This tool automatically responds to prompts and can execute commands without user confirmation. Be aware of potential prompt injection attacks where malicious code or instructions could be embedded in files or user inputs to manipulate the automated responses.

Features

  • Multi-CLI Support: Works with Claude, Gemini, Codex, Copilot, and Cursor CLI tools
  • Auto-Response: Automatically responds to common prompts like "Yes, proceed" and "Yes"
  • Continuous Operation: Keeps the AI assistant running until your task is done, waiting for your next prompt
  • Interactive Control: You can still queue more prompts or cancel executing tasks with ESC or Ctrl+C
  • Crash Recovery: Automatically restarts crashed processes (where supported)
  • Idle Detection: Optional auto-exit when the AI becomes idle

Prerequisites

Install the AI CLI tool(s) you want to use:

Claude

npm install -g @anthropic-ai/claude-code

Learn more: https://www.anthropic.com/claude-code

Gemini

# Install Gemini CLI (if available)
# Check Google's documentation for installation instructions

Codex

# Install Codex CLI (if available)
# Check Microsoft's documentation for installation instructions

GitHub Copilot

# Install GitHub Copilot CLI
# Check GitHub's documentation for installation instructions

Cursor

# Install Cursor agent CLI
# Check Cursor's documentation for installation instructions

Grok

npm install -g @vibe-kit/grok-cli

Learn more: https://github.com/vibe-kit/grok-cli

Then install this project:

npm install cli-yes -g

Usage

Command Line Interface

claude-yes [--exit-on-idle=60s] [tool-command] [prompts]

Examples

Claude (default):

claude-yes -- run all tests and commit current changes
bunx claude-yes "Solve TODO.md"

Other AI tools:

# Use Codex directly
codex-yes -- refactor this function

# Use Grok directly
grok-yes -- help me with this code

# Use Copilot directly
copilot-yes -- generate unit tests

# Use Cursor directly
cursor-yes -- optimize performance

# Use Gemini directly
gemini-yes -- debug this code

claude-yes "help me with this code"
claude-yes "optimize performance"

Auto-exit when idle (useful for automation):

claude-yes --exit-on-idle=60s "run all tests and commit current changes"

Alternative with claude-code-execute:

claude-code-execute claude-yes "your task here"

Supported CLI Tools

Tool CLI Name Description Installation/Update
Claude claude Anthropic's Claude Code (default) npm install -g @anthropic-ai/claude-code@latest
Gemini gemini Google's Gemini CLI npm install -g @google/gemini-cli@latest
Codex codex OpenAI's Codex CLI npm install -g @openai/codex-cli@latest
Copilot copilot GitHub Copilot CLI npm install -g @github/copilot@latest
Cursor cursor Cursor agent CLI See https://cursor.com/ja/docs/cli/installation
Grok grok Vibe Kit's Grok CLI npm install -g @vibe-kit/grok-cli@latest
Qwen qwen Alibaba's Qwen Code CLI npm install -g @qwen-code/qwen-code@latest

The tool will:

  1. Run the specified AI CLI tool
  2. Automatically respond "Yes" to common yes/no prompts
  3. Handle tool-specific patterns and responses
  4. When using --exit-on-idle flag, automatically exit when the tool becomes idle

CLI Tools Comparison

Pros & Cons Analysis

Claude Code CLI (Anthropic)

Pros:

  • Industry-leading performance on SWE-bench (72.5%) and Terminal-bench (43.2%)
  • Advanced checkpointing feature for code state management
  • Deep terminal integration with Unix philosophy support
  • Enterprise-ready with AWS/GCP deployment options
  • Excellent at complex refactoring and debugging tasks

Cons:

  • Higher cost compared to alternatives ($5+ per session)
  • Terminal-based interface may not suit all developers
  • Closed ecosystem with limited community plugins
  • Requires API subscription for full features

Gemini CLI (Google)

Pros:

  • Free tier with generous limits (60 requests/min, 1,000/day)
  • Fully open source (Apache 2.0 license)
  • 1 million token context window
  • MCP integration for extensibility
  • GitHub Actions integration at no cost

Cons:

  • Currently in preview with potential stability issues
  • Shared quotas between CLI and Code Assist
  • May produce factually incorrect outputs
  • Limited to English language support

Codex CLI (OpenAI/Microsoft)

Pros:

  • Cloud-based scalability for team collaboration
  • Powers GitHub Copilot ecosystem
  • Supports multimodal input (images, diagrams)
  • Strong GitHub integration
  • Flexible API for custom implementations

Cons:

  • Requires more setup and technical knowledge
  • Internet dependency for all operations
  • Less mature/polished than competitors
  • Higher computational requirements

Copilot CLI (GitHub)

Pros:

  • Seamless GitHub integration
  • Terminal-native development experience
  • Wide language and model support
  • Command explanation and suggestion features
  • Enterprise policy controls available

Cons:

  • Requires active subscription
  • English-only support
  • May struggle with complex/uncommon commands
  • Organization admin approval needed for business users

Cursor CLI

Pros:

  • Superior performance in setup and deployment
  • Multi-model support from various providers
  • Excellent context awareness with RAG system
  • Enterprise features for CI/CD integration
  • Can run multiple agents in parallel

Cons:

  • Steeper learning curve
  • UI/UX can be clunky with cramped interface
  • Manual context management required
  • Screen real estate limitations

Grok CLI (xAI/Vibe Kit)

Pros:

  • Open source and free for basic use
  • Cost-effective premium tier ($30/month)
  • Real-time data access via X integration
  • Strong community support
  • Cross-platform compatibility

Cons:

  • Requires API key for advanced features
  • Internet dependency for AI features
  • Additional setup and authentication needed
  • Newer with less mature ecosystem

Qwen Code CLI (Alibaba)

Pros:

  • Fully open source (Apache 2.0)
  • Exceptional benchmark performance (87.9 on MultiPL-E)
  • 256K-1M token context support
  • No subscription required
  • Enterprise-ready with full infrastructure control

Cons:

  • Newer entrant with developing ecosystem
  • Geopolitical considerations for adoption
  • Less established tooling and integrations
  • Regional trust and security concerns

Choosing the Right Tool

  • For Solo Developers: Claude Code (complex tasks) or Grok CLI (cost-conscious)
  • For Teams: Codex CLI (cloud collaboration) or Cursor CLI (parallel agents)
  • For Enterprises: Claude Code (performance) or Qwen Code (self-hosted)
  • For Budget-Conscious: Gemini CLI (free tier) or Qwen Code (open source)
  • For GitHub Users: Copilot CLI (native integration)

Options

  • --cli=<tool>: Specify which AI CLI tool to use (claude, gemini, codex, copilot, cursor). Defaults to claude.
  • --exit-on-idle=<seconds>: Automatically exit when the AI tool becomes idle for the specified duration. Useful for automation scripts.
  • --use-skills: Automatically discover and prepend SKILL.md headers from the directory hierarchy (walks from current directory up to git root). Multiple SKILL.md files are merged with most specific first. Particularly useful to bring Claude Skills-like context to non-Claude agents such as Codex or Gemini. Supports nested skills for monorepos.

Library Usage

You can also use this as a library in your Node.js projects:

import claudeYes from 'claude-yes';

// Use Claude
await claudeYes({
  prompt: 'help me solve all todos in my codebase',
  cli: 'claude',
  cliArgs: ['--verbose'],
  exitOnIdle: 30000, // exit after 30 seconds of idle
  continueOnCrash: true,
  logFile: 'claude.log',
});

// Use other tools
await claudeYes({
  prompt: 'debug this function',
  cli: 'gemini',
  exitOnIdle: 60000,
});

Implementation

The tool uses node-pty to spawn and manage AI CLI processes, with a sophisticated pattern-matching system that:

  1. Detects Ready States: Recognizes when each CLI tool is ready to accept input
  2. Auto-Responds: Automatically sends "Yes" responses to common prompts
  3. Handles Fatal Errors: Detects and responds to fatal error conditions
  4. Manages Process Lifecycle: Handles crashes, restarts, and graceful exits

Each supported CLI has its own configuration defining:

  • Ready patterns: Regex patterns that indicate the tool is ready for input
  • Enter patterns: Patterns that trigger automatic "Yes" responses
  • Fatal patterns: Patterns that indicate fatal errors requiring exit
  • Binary mapping: Maps logical names to actual executable names
  • Argument handling: Special argument processing (e.g., adding --search to Codex)

Dependencies

  • node-pty or bun-pty - For spawning and managing AI CLI processes
  • from-node-stream - Stream processing utilities
  • sflow - Functional stream processing
  • terminal-render - Terminal rendering and text processing
  • phpdie - Error handling utilities

Inspiration

This project was inspired by: Claude Code full auto while I sleep : r/ClaudeAI

License

MIT