Skip to content

host452b/auto-yes

Repository files navigation

auto-yes (ay)

Auto-respond to AI CLI prompts. Never get blocked by interactive yes/no dialogs again.

Go PyPI License: MIT Tests Platforms

auto-yes (shorthand: ay) wraps any CLI command in a PTY (pseudo-terminal) proxy, watches the output stream for interactive prompts, and automatically injects the correct response — so your overnight AI agent loops, CI pipelines, and automation scripts never block waiting for a human.

Works out-of-the-box with Claude Code, Cursor, Gemini CLI, OpenAI Codex, GitHub Copilot, Amazon Q, Aider, Windsurf, and 10+ more AI coding tools. Also handles generic [y/n], Continue?, SSH fingerprint, Terraform yes, multi-choice menus, and any custom regex you define.

╭─ without auto-yes ─────────────────────────────────────────╮
│  $ claude "refactor auth module"                            │
│  > Trust this folder?  1. Yes  2. No   ← blocks forever   │
╰─────────────────────────────────────────────────────────────╯

╭─ with auto-yes ────────────────────────────────────────────╮
│  $ ay claude "refactor auth module"                         │
│  > Trust this folder?  1. Yes  2. No                       │
│  [auto-yes] responded 'y' (matched: ❯ 1. Yes, I trust…)   │
│  ✓ Continuing automatically…                               │
╰─────────────────────────────────────────────────────────────╯

30-second tutorial

pip install auto-yes          # install
ay claude "fix the tests"     # done — prompts answered automatically

That's it. ay detects when Claude Code asks "Trust this folder?", "Allow once?", "Do you want to proceed?" and responds for you.


Installation

# pip (any platform, recommended)
pip install auto-yes

# Go
go install github.com/host452b/auto-yes/cmd/auto-yes@latest

# Or download binary from GitHub Releases
# → https://github.com/host452b/auto-yes/releases

# Build from source (auto-installs Go if needed)
git clone https://github.com/host452b/auto-yes.git && cd auto-yes && make build

Both auto-yes and ay commands are installed. They are identical.


Quick start

auto-yes and ay are the same command. Use whichever you prefer.

Wrap any AI agent CLI — just add ay in front

# Claude Code
ay claude "fix the tests"
ay claude "refactor the auth module"

# Cursor Agent (profile "cursor" maps to binary "agent")
ay cursor chat "add unit tests"
ay cursor chat "fix the bug in main.go"

# Google Gemini CLI
ay gemini "review this PR"

# OpenAI Codex
ay codex "explain this function"

# Aider
ay aider --model gpt-4o
ay aider --model claude-3.5-sonnet

# GitHub Copilot (profile "copilot" maps to "gh copilot")
ay copilot

# Amazon Q Developer (profile "amazonq" maps to binary "q")
ay amazonq chat "help me deploy"

# Windsurf / Codeium
ay windsurf "fix linting errors"

# OpenHands
ay openhands "run the migration"

# Qwen
ay qwen "optimize this query"

# Sourcegraph Amp
ay amp

# xAI Grok
ay grok "summarize this repo"

# Augment Code
ay auggie

Run ay list to see all 14 profiles and which binary each maps to.

Run arbitrary commands

# Any command that has interactive prompts
ay run -- ./deploy.sh
ay run -- apt install nginx
ay run -- terraform apply
ay run -- ssh user@server

# Specify which AI profile patterns to load
ay run --cli claude -- claude "fix tests"
ay run --cli claude --cli generic -- ./my-script.sh

# Custom response text
ay run --response "yes" -- ssh user@server

# Extra one-off pattern
ay run --pattern 'deploy to prod\?' -- ./deploy.sh

# Debug mode: log raw PTY output
ay run --log debug.log --cli claude -- claude "fix tests"

Shell session mode

# Start a shell where all prompts are auto-answered
ay shell --cli claude
ay --on --cli claude          # equivalent

# Load all profiles at once
ay shell --cli all

# Inside the shell, use tools normally:
#   claude "fix tests"        ← prompts auto-answered
#   cursor chat "add tests"   ← prompts auto-answered
#   exit                      ← leave session

Overnight / unattended automation

# --auto = all profiles + 0.05s cooldown + verbose
ay run --auto -- claude "work through the backlog"

# Add heartbeat to keep agent responsive
ay run --auto --heartbeat 30 -- claude "big refactor"

# Batch loop
for task in tasks/*.md; do
    ay run --auto -- claude "$(cat $task)"
done

# Parallel agents
auto-yes run --auto -- orchestrator --agents 5 --task "migrate database"

--auto loads ALL 14 profiles, sets cooldown to 0.05s, enables verbose logging.

Agent conversational multi-choice

When an AI agent presents multiple options (A/B/C) and asks you to choose, auto-yes responds with:

"I'll go with your recommended option"

Works for any agent that accepts natural language input in multi-choice scenarios.

Human-in-loop session control

Control a running session from another terminal — pause for manual interaction, then resume:

# Terminal 1: running auto-yes
ay run --auto -- claude "big refactor"

# Terminal 2: take over for a moment
ay ls                   # see running sessions and PIDs
ay toggle 12345         # pause ↔ resume
ay pause all            # pause every session
ay continue all         # resume all

# Check status
ay status               # am I inside an auto-yes session?

How it works

Built as a Go binary with a multi-goroutine pipeline architecture:

stdin ──▶ [g2: Stdin Reader] ──▶ ┌────────────┐
                                  │            │
child ──▶ [g1: PTY Reader]  ──▶  │   Proxy    │ ──▶ PTY master write
           │                      │  (select)  │
           ▼                      │            │
        [Cleaner] ──▶ [Scanner]   └─────┬──────┘
                         │              │
                         ▼              │
                     [Injector] ────────┘
                    (5 timing guards)

Four-stage text cleaning pipeline

Stage Operation Why
1 Expand ESC[nC → spaces Claude Code 2.x word separators
2 Strip ANSI/OSC sequences Remove visual formatting
3 Remove control characters Null bytes, bells, etc.
4 Resolve \r overwrites Handle \r\r\n from Claude Code 2.x

Five-layer anti-false-positive guards

Guard Threshold What it prevents
Typing suppress 1s User's own keystrokes triggering auto-responses
Match cooldown 50ms Terminal redraws re-triggering the same prompt
Response cooldown 0.5s (configurable) Rapid-fire duplicate responses
Session pause file-based External pause control from another terminal
Approval delay configurable Queued response with cancel window

Supported tools (14 profiles)

Profile Binary Tool Key patterns
claude claude Anthropic Claude Code Trust folder, Allow once/always, Proceed?
cursor agent Cursor Agent (y), [a] Trust this workspace
gemini gemini Google Gemini CLI Allow once/session/always
codex codex OpenAI Codex Yes, Approve and run now
copilot gh copilot GitHub Copilot Yes proceed, Allow Copilot
aider aider Aider AI Coding (Y)es/(N)o, Run shell command?
openhands openhands OpenHands Agent Execute action?, Approve
windsurf windsurf Codeium Windsurf Accept changes?, Run command?
qwen qwen Alibaba Qwen Code Yes, Approve execution?
amazonq q Amazon Q Developer Approve action?, Accept suggestion?
grok grok xAI Grok Yes
auggie auggie Augment Code Enable indexing
amp amp Sourcegraph Amp Approve
generic Universal y/n [y/n], SSH, Terraform, Press Enter
ay list                  # see all profiles
ay patterns claude       # inspect patterns for a specific tool

Generic patterns (loaded with --cli generic or --auto)

  • Bracket/styled choices: [y/n], [Y/n], [yes/no], [Y]es / [N]o
  • Question prompts: Continue?, Proceed?, Are you sure?
  • Action prompts: Allow?, Approve?, Accept?, Download?, Enable?
  • SSH: continue connecting (yes/no)? → responds yes
  • Terraform: Only 'yes' will be accepted → responds yes
  • Press Enter: Press Enter to continue → responds with empty string
  • Excluded (safety): Overwrite?, Delete?, Remove?, Replace?, Upgrade?, Restart?

CLI reference

All commands work with both ay and auto-yes.

ay <profile> [ARGS...]          wrap an AI CLI tool directly (recommended)
ay run [OPTIONS] -- CMD...      run a single command with auto-yes
ay shell / --on [OPTIONS]       start an auto-yes shell session
ay list                         list all available CLI profiles
ay patterns [CATEGORY...]       list prompt patterns
ay add-pattern REGEX            persist a custom regex pattern
ay del-pattern REGEX            remove a custom pattern
ay ls                           list running sessions
ay toggle <pid|all>             pause ↔ resume
ay pause / continue <pid|all>   pause or resume only
ay status                       check if auto-yes is active
ay off                          help for exiting a session
ay --version                    print version
ay --help                       show help

Options

Flag Description Default
--auto Overnight mode: all profiles, 0.05s cooldown, verbose off
--response TEXT Text to send when a prompt is detected y
--cooldown FLOAT Seconds between auto-responses 0.5
--delay FLOAT Approval delay; press any key to cancel 0
--heartbeat SECONDS Send Enter every N seconds of inactivity 0
--verbose, -v Print each auto-response off
--quiet, -q Suppress all output off
--pattern REGEX Extra prompt pattern (repeatable)
--cli NAME AI CLI profile to load (repeatable, or all)
--log FILE Debug log (raw bytes, cleaned text, detections)

Configuration

Config file: ~/.config/auto-yes/config.yaml (Linux/macOS) or %APPDATA%\auto-yes\config.yaml (Windows)

response: "y"
cooldown: 0.5
verbose: false
delay: 0.0
heartbeat: 0.0

Custom patterns: ~/.config/auto-yes/patterns.yaml

patterns:
  - regex: 'my-internal-tool.*confirm'
    response: "y"
  - regex: 'deploy to staging.*\?'
    exclude: true  # never auto-confirm this

Upgrading from Python version? Config is auto-migrated from config.json to config.yaml on first run.


Adding a new AI CLI profile

Create a YAML file in pattern/builtin/:

name: my-tool
description: "My AI Tool CLI"
command: ["my-tool"]
patterns:
  - regex: 'approve action\?'
  - regex: 'type yes to confirm'
    response: "yes"
  - regex: 'press enter to continue'
    type: enter
    response: ""

Run auto-yes list to verify it appears. No other code changes needed.


Comparison with yes(1)

yes | cmd auto-yes run -- cmd
Prompt detection None — floods stdin blindly Smart regex, bottom-up scan
User can still type No Yes, fully interactive
PTY (colors / progress bars) Broken Preserved
False-positive protection None 5-layer timing guards
AI-specific prompts No 14 tool profiles built-in
Multi-choice support No Menus + conversational
Custom patterns No Persisted or one-off
Cross-platform Unix only Linux + macOS + Windows

Platform support

Platform Method Notes
Linux PTY + goroutines Full PTY, zero external deps
macOS PTY + goroutines Full PTY, zero external deps
Windows conpty (planned) Stub exists, full implementation coming

Development

git clone https://github.com/host452b/auto-yes.git
cd auto-yes

# Build (auto-installs Go if needed)
make build

# Test
make test

# Lint
make lint

# Show build environment
make info

# Release: cross-compile 6 platforms + build .whl wheels
make release     # → release/wheels/auto_yes-<ver>-py3-none-any.whl

# Publish to PyPI
make publish     # → release + twine upload

# Clean all artifacts
make clean

# Help
make help

Golden test cases

Drop a YAML file in testdata/cases/ and it becomes a test automatically:

name: "My edge case"
category: claude
raw: "❯ 1. Yes, I trust this folder"
expect:
  matched: true
  source: claude

See testdata/cases/README.md for 8 reusable templates covering all interaction scenarios: yes/no, numbered menus, agent multi-choice, Press Enter, SSH/Terraform, ANSI-encoded, dangerous actions (excluded), and long-output prompts. Plus real-world samples for Claude Code, Cursor, Gemini, Aider, and Terraform.

Architecture

cmd/auto-yes/   → entry point
cli/             → cobra commands (wrap, run, shell, session, list, patterns)
proxy/           → core engine (goroutine orchestration, timing guards, injection)
term/            → Terminal interface (Unix PTY, Windows conpty)
detect/          → text cleaning pipeline + bottom-up scanner
pattern/         → YAML pattern registry (14 builtin + external + CLI)
config/          → config loading (YAML, JSON migration) + session management
testdata/cases/  → golden test cases (drop-in YAML)
packaging/       → Python pip wrapper (execvp, ~30 lines)
scripts/         → build_wheels.py (goreleaser → .whl)

FAQ

Q: What's the difference between ay and auto-yes? A: Nothing. They are the same binary. Use whichever you prefer.

Q: Will it auto-approve dangerous operations like rm -rf or DROP TABLE? A: No. Prompts containing overwrite, delete, remove, replace, upgrade, restart, reboot are excluded by default. You can override with --pattern if needed.

Q: Can I use it with tools not in the 14 profiles? A: Yes. Use ay run --cli generic -- your-command for universal y/n matching, or add --pattern 'your-regex' for custom prompts.

Q: How do I debug when a prompt isn't being detected? A: Run with --log debug.log to capture raw PTY output, cleaned text, and detection events. Then create a golden test case in testdata/cases/ to reproduce.

Q: Does it work inside Docker / CI containers? A: Yes. make build auto-installs Go if missing. Works as root without sudo.


License

MIT

About

Auto-respond to Claude Code, Cursor Agent, Gemini, Codex & 10+ AI CLI prompts via PTY proxy. Never block overnight AI agent loops again. Zero deps, cross-platform Python.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors