agent-yes 1.31.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 snomiao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,504 @@
1
+ # Agent-Yes! for Claude/Codex/Gemini/Cursor/Copilot/Qwen/Auggie
2
+
3
+ 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.
4
+
5
+ ⚠️ **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.
6
+
7
+ ## Features
8
+
9
+ - **Multi-CLI Support**: Works with Claude, Gemini, Codex, Copilot, and Cursor CLI tools
10
+ - **Auto-Response**: Automatically responds to common prompts like "Yes, proceed" and "Yes"
11
+ - **Continuous Operation**: Keeps the AI assistant running until your task is done, waiting for your next prompt
12
+ - **Interactive Control**: You can still queue more prompts or cancel executing tasks with `ESC` or `Ctrl+C`
13
+ - **Crash Recovery**: Automatically restarts crashed processes (where supported)
14
+ - **Idle Detection**: Optional auto-exit when the AI becomes idle
15
+ - **Named Pipe Input (Linux)**: On Linux systems, automatically creates a FIFO (named pipe) at `/tmp/agent-yes-YYYYMMDDHHMMSSXXX.stdin` for additional input streams
16
+
17
+ ## Agent Clis
18
+
19
+ Install the AI CLI tool(s) you want to use:
20
+
21
+ ### Claude
22
+
23
+ ```bash
24
+ npm install -g @anthropic-ai/claude-code
25
+ ```
26
+
27
+ Learn more: https://www.anthropic.com/claude-code
28
+
29
+ ### Gemini
30
+
31
+ ```bash
32
+ # Install Gemini CLI (if available)
33
+ # Check Google's documentation for installation instructions
34
+ ```
35
+
36
+ ### Codex
37
+
38
+ ```bash
39
+ # Install Codex CLI (if available)
40
+ # Check Microsoft's documentation for installation instructions
41
+ ```
42
+
43
+ ### GitHub Copilot
44
+
45
+ ```bash
46
+ # Install GitHub Copilot CLI
47
+ # Check GitHub's documentation for installation instructions
48
+ ```
49
+
50
+ ### Cursor
51
+
52
+ ```bash
53
+ # Install Cursor agent CLI
54
+ # Check Cursor's documentation for installation instructions
55
+ ```
56
+
57
+ ### Grok
58
+
59
+ ```bash
60
+ npm install -g @vibe-kit/grok-cli
61
+ ```
62
+
63
+ Learn more: https://github.com/vibe-kit/grok-cli
64
+
65
+ ### Auggie
66
+
67
+ ```bash
68
+ npm install -g @augmentcode-inc/auggie-cli
69
+ ```
70
+
71
+ Learn more: https://www.augmentcode.com/
72
+
73
+ Then install this project:
74
+
75
+ ```bash
76
+ npm install agent-yes -g
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ ### Command Line Interface
82
+
83
+ ```bash
84
+ claude-yes [--exit-on-idle=60s] [tool-command] [prompts]
85
+ ```
86
+
87
+ #### Examples
88
+
89
+ **Claude (default):**
90
+
91
+ ```bash
92
+ claude-yes -- run all tests and commit current changes
93
+ bunx claude-yes "Solve TODO.md"
94
+ ```
95
+
96
+ **Other AI tools:**
97
+
98
+ ```bash
99
+ # Use Codex directly
100
+ codex-yes -- refactor this function
101
+
102
+ # Use Grok directly
103
+ grok-yes -- help me with this code
104
+
105
+ # Use Copilot directly
106
+ copilot-yes -- generate unit tests
107
+
108
+ # Use Cursor directly
109
+ cursor-yes -- optimize performance
110
+
111
+ # Use Gemini directly
112
+ gemini-yes -- debug this code
113
+
114
+ # Use Auggie directly
115
+ auggie-yes -- analyze code patterns
116
+
117
+ claude-yes "help me with this code"
118
+ claude-yes "optimize performance"
119
+ ```
120
+
121
+ **Auto-exit when idle (useful for automation):**
122
+
123
+ ```bash
124
+ claude-yes --exit-on-idle=60s "run all tests and commit current changes"
125
+ ```
126
+
127
+ **Alternative with claude-code-execute:**
128
+
129
+ ```bash
130
+ claude-code-execute claude-yes "your task here"
131
+ ```
132
+
133
+ ### Docker Usage
134
+
135
+ You can run `agent-yes` in a Docker container with all AI CLI tools pre-installed.
136
+
137
+ **Pull the image:**
138
+
139
+ ```bash
140
+ # From GitHub Container Registry (recommended)
141
+ docker pull ghcr.io/snomiao/agent-yes:latest
142
+
143
+ # Or from Docker Hub
144
+ docker pull snomiao/agent-yes:latest
145
+ ```
146
+
147
+ **Basic usage:**
148
+
149
+ ```bash
150
+ # Run with Claude (default)
151
+ docker run --rm -v $(pwd):/workspace -w /workspace \
152
+ ghcr.io/snomiao/agent-yes:latest \
153
+ -- run all tests
154
+
155
+ # Run with other AI tools
156
+ docker run --rm -v $(pwd):/workspace -w /workspace \
157
+ ghcr.io/snomiao/agent-yes:latest \
158
+ --cli=gemini -- debug this code
159
+ ```
160
+
161
+ **Persisting credentials:**
162
+
163
+ To persist API keys and configuration across container runs, mount the config directories:
164
+
165
+ ```bash
166
+ # For Claude
167
+ docker run --rm \
168
+ -v $(pwd):/workspace \
169
+ -v ~/.config/claude:/root/.config/claude \
170
+ -v ~/.anthropic:/root/.anthropic \
171
+ -w /workspace \
172
+ ghcr.io/snomiao/agent-yes:latest \
173
+ -- help me with this code
174
+
175
+ # For multiple AI tools (mount all config directories)
176
+ docker run --rm \
177
+ -v $(pwd):/workspace \
178
+ -v ~/.config:/root/.config \
179
+ -v ~/.anthropic:/root/.anthropic \
180
+ -v ~/.openai:/root/.openai \
181
+ -v ~/.cursor:/root/.cursor \
182
+ -w /workspace \
183
+ ghcr.io/snomiao/agent-yes:latest \
184
+ --cli=claude -- optimize performance
185
+ ```
186
+
187
+ **Complete example with environment variables:**
188
+
189
+ ```bash
190
+ # Pass API keys via environment variables
191
+ docker run --rm \
192
+ -v $(pwd):/workspace \
193
+ -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
194
+ -e OPENAI_API_KEY=$OPENAI_API_KEY \
195
+ -e GOOGLE_API_KEY=$GOOGLE_API_KEY \
196
+ -w /workspace \
197
+ ghcr.io/snomiao/agent-yes:latest \
198
+ -- refactor this module
199
+
200
+ # Or use an env file
201
+ docker run --rm \
202
+ -v $(pwd):/workspace \
203
+ --env-file .env \
204
+ -w /workspace \
205
+ ghcr.io/snomiao/agent-yes:latest \
206
+ --exit-on-idle=60s -- run all tests and commit
207
+ ```
208
+
209
+ **Docker Compose example:**
210
+
211
+ ```yaml
212
+ version: '3.8'
213
+ services:
214
+ agent-yes:
215
+ image: ghcr.io/snomiao/agent-yes:latest
216
+ volumes:
217
+ - .:/workspace
218
+ - ~/.config/claude:/root/.config/claude
219
+ - ~/.anthropic:/root/.anthropic
220
+ working_dir: /workspace
221
+ environment:
222
+ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
223
+ command: ["--", "help me solve all todos"]
224
+ ```
225
+
226
+ **Available platforms:**
227
+
228
+ - `linux/amd64` (x86_64)
229
+ - `linux/arm64` (aarch64)
230
+
231
+ **Cloud deployment:**
232
+
233
+ For deploying to cloud platforms like Google Cloud Run, AWS, Azure, see [Cloud Deployment Guide](./docs/clouds.md).
234
+
235
+ ### Supported CLI Tools
236
+
237
+ | Tool | CLI Name | Description | Installation/Update |
238
+ | ------- | --------- | --------------------------------- | --------------------------------------------------- |
239
+ | Claude | `claude` | Anthropic's Claude Code (default) | `npm install -g @anthropic-ai/claude-code@latest` |
240
+ | Gemini | `gemini` | Google's Gemini CLI | `npm install -g @google/gemini-cli@latest` |
241
+ | Codex | `codex` | OpenAI's Codex CLI | `npm install -g @openai/codex-cli@latest` |
242
+ | Copilot | `copilot` | GitHub Copilot CLI | `npm install -g @github/copilot@latest` |
243
+ | Cursor | `cursor` | Cursor agent CLI | See https://cursor.com/ja/docs/cli/installation |
244
+ | Grok | `grok` | Vibe Kit's Grok CLI | `npm install -g @vibe-kit/grok-cli@latest` |
245
+ | Qwen | `qwen` | Alibaba's Qwen Code CLI | `npm install -g @qwen-code/qwen-code@latest` |
246
+ | Auggie | `auggie` | Augment Code's Auggie CLI | `npm install -g @augmentcode-inc/auggie-cli@latest` |
247
+
248
+ The tool will:
249
+
250
+ 1. Run the specified AI CLI tool
251
+ 2. Automatically respond "Yes" to common yes/no prompts
252
+ 3. Handle tool-specific patterns and responses
253
+ 4. When using `--exit-on-idle` flag, automatically exit when the tool becomes idle
254
+
255
+ ## CLI Tools Comparison
256
+
257
+ ### Pros & Cons Analysis
258
+
259
+ #### Claude Code CLI (Anthropic)
260
+
261
+ **Pros:**
262
+
263
+ - Industry-leading performance on SWE-bench (72.5%) and Terminal-bench (43.2%)
264
+ - Advanced checkpointing feature for code state management
265
+ - Deep terminal integration with Unix philosophy support
266
+ - Enterprise-ready with AWS/GCP deployment options
267
+ - Excellent at complex refactoring and debugging tasks
268
+
269
+ **Cons:**
270
+
271
+ - Higher cost compared to alternatives ($5+ per session)
272
+ - Terminal-based interface may not suit all developers
273
+ - Closed ecosystem with limited community plugins
274
+ - Requires API subscription for full features
275
+
276
+ #### Gemini CLI (Google)
277
+
278
+ **Pros:**
279
+
280
+ - Free tier with generous limits (60 requests/min, 1,000/day)
281
+ - Fully open source (Apache 2.0 license)
282
+ - 1 million token context window
283
+ - MCP integration for extensibility
284
+ - GitHub Actions integration at no cost
285
+
286
+ **Cons:**
287
+
288
+ - Currently in preview with potential stability issues
289
+ - Shared quotas between CLI and Code Assist
290
+ - May produce factually incorrect outputs
291
+ - Limited to English language support
292
+
293
+ #### Codex CLI (OpenAI/Microsoft)
294
+
295
+ **Pros:**
296
+
297
+ - Cloud-based scalability for team collaboration
298
+ - Powers GitHub Copilot ecosystem
299
+ - Supports multimodal input (images, diagrams)
300
+ - Strong GitHub integration
301
+ - Flexible API for custom implementations
302
+
303
+ **Cons:**
304
+
305
+ - Requires more setup and technical knowledge
306
+ - Internet dependency for all operations
307
+ - Less mature/polished than competitors
308
+ - Higher computational requirements
309
+
310
+ #### Copilot CLI (GitHub)
311
+
312
+ **Pros:**
313
+
314
+ - Seamless GitHub integration
315
+ - Terminal-native development experience
316
+ - Wide language and model support
317
+ - Command explanation and suggestion features
318
+ - Enterprise policy controls available
319
+
320
+ **Cons:**
321
+
322
+ - Requires active subscription
323
+ - English-only support
324
+ - May struggle with complex/uncommon commands
325
+ - Organization admin approval needed for business users
326
+
327
+ #### Cursor CLI
328
+
329
+ **Pros:**
330
+
331
+ - Superior performance in setup and deployment
332
+ - Multi-model support from various providers
333
+ - Excellent context awareness with RAG system
334
+ - Enterprise features for CI/CD integration
335
+ - Can run multiple agents in parallel
336
+
337
+ **Cons:**
338
+
339
+ - Steeper learning curve
340
+ - UI/UX can be clunky with cramped interface
341
+ - Manual context management required
342
+ - Screen real estate limitations
343
+
344
+ #### Grok CLI (xAI/Vibe Kit)
345
+
346
+ **Pros:**
347
+
348
+ - Open source and free for basic use
349
+ - Cost-effective premium tier ($30/month)
350
+ - Real-time data access via X integration
351
+ - Strong community support
352
+ - Cross-platform compatibility
353
+
354
+ **Cons:**
355
+
356
+ - Requires API key for advanced features
357
+ - Internet dependency for AI features
358
+ - Additional setup and authentication needed
359
+ - Newer with less mature ecosystem
360
+
361
+ #### Qwen Code CLI (Alibaba)
362
+
363
+ **Pros:**
364
+
365
+ - Fully open source (Apache 2.0)
366
+ - Exceptional benchmark performance (87.9 on MultiPL-E)
367
+ - 256K-1M token context support
368
+ - No subscription required
369
+ - Enterprise-ready with full infrastructure control
370
+
371
+ **Cons:**
372
+
373
+ - Newer entrant with developing ecosystem
374
+ - Geopolitical considerations for adoption
375
+ - Less established tooling and integrations
376
+ - Regional trust and security concerns
377
+
378
+ #### Auggie CLI (Augment Code)
379
+
380
+ **Pros:**
381
+
382
+ - AI-powered code assistant with context awareness
383
+ - Supports multiple programming languages
384
+ - Real-time code suggestions and completions
385
+ - Integration with popular IDEs
386
+ - Team collaboration features
387
+
388
+ **Cons:**
389
+
390
+ - Requires subscription for full features
391
+ - Newer product with evolving feature set
392
+ - Limited documentation compared to established tools
393
+ - May require configuration for optimal performance
394
+
395
+ ### Choosing the Right Tool
396
+
397
+ - **For Solo Developers:** Claude Code (complex tasks) or Grok CLI (cost-conscious)
398
+ - **For Teams:** Codex CLI (cloud collaboration) or Cursor CLI (parallel agents)
399
+ - **For Enterprises:** Claude Code (performance) or Qwen Code (self-hosted)
400
+ - **For Budget-Conscious:** Gemini CLI (free tier) or Qwen Code (open source)
401
+ - **For GitHub Users:** Copilot CLI (native integration)
402
+
403
+ <!-- TODO: add usage As lib: call await claudeYes() and it returns render result -->
404
+
405
+ ## Options
406
+
407
+ - `--cli=<tool>`: Specify which AI CLI tool to use (claude, gemini, codex, copilot, cursor, grok, qwen, auggie). Defaults to `claude`.
408
+ - `--exit-on-idle=<seconds>`: Automatically exit when the AI tool becomes idle for the specified duration. Useful for automation scripts.
409
+ - `--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.
410
+
411
+ ## Advanced Features
412
+
413
+ ### Named Pipe Input (Linux Only)
414
+
415
+ On Linux systems, `agent-yes` automatically creates a named pipe (FIFO) for additional input streams. This allows you to send input to the CLI from multiple sources simultaneously.
416
+
417
+ **How it works:**
418
+
419
+ - When started on Linux, a FIFO is created at `/tmp/agent-yes-YYYYMMDDHHMMSSXXX.stdin`
420
+ - The FIFO path is displayed in the console output
421
+ - You can write to this FIFO from another terminal or script
422
+ - Input from both the FIFO and standard stdin are merged together
423
+
424
+ **Example usage:**
425
+
426
+ ```bash
427
+ # Terminal 1: Start the CLI
428
+ claude-yes "help me with my code"
429
+ # Output will show: [claude-yes] Created FIFO at /tmp/agent-yes-20260109123456abc.stdin
430
+
431
+ # Terminal 2: Send additional input via the FIFO
432
+ echo "also check the tests" > /tmp/agent-yes-20260109123456abc.stdin
433
+ ```
434
+
435
+ This feature is useful for:
436
+
437
+ - Scripting complex interactions
438
+ - Sending input from multiple sources
439
+ - Integrating with other tools and automation systems
440
+
441
+ ## Library Usage
442
+
443
+ You can also use this as a library in your Node.js projects:
444
+
445
+ ```typescript
446
+ import claudeYes from "claude-yes";
447
+
448
+ // Use Claude
449
+ await claudeYes({
450
+ prompt: "help me solve all todos in my codebase",
451
+ cli: "claude",
452
+ cliArgs: ["--verbose"],
453
+ exitOnIdle: 30000, // exit after 30 seconds of idle
454
+ continueOnCrash: true,
455
+ logFile: "claude.log",
456
+ });
457
+
458
+ // Use other tools
459
+ await claudeYes({
460
+ prompt: "debug this function",
461
+ cli: "gemini",
462
+ exitOnIdle: 60000,
463
+ });
464
+
465
+ // Use Auggie
466
+ await claudeYes({
467
+ prompt: "analyze code patterns",
468
+ cli: "auggie",
469
+ exitOnIdle: 60000,
470
+ });
471
+ ```
472
+
473
+ ## Implementation
474
+
475
+ The tool uses `node-pty` to spawn and manage AI CLI processes, with a sophisticated pattern-matching system that:
476
+
477
+ 1. **Detects Ready States**: Recognizes when each CLI tool is ready to accept input
478
+ 2. **Auto-Responds**: Automatically sends "Yes" responses to common prompts
479
+ 3. **Handles Fatal Errors**: Detects and responds to fatal error conditions
480
+ 4. **Manages Process Lifecycle**: Handles crashes, restarts, and graceful exits
481
+
482
+ Each supported CLI has its own configuration defining:
483
+
484
+ - **Ready patterns**: Regex patterns that indicate the tool is ready for input
485
+ - **Enter patterns**: Patterns that trigger automatic "Yes" responses
486
+ - **Fatal patterns**: Patterns that indicate fatal errors requiring exit
487
+ - **Binary mapping**: Maps logical names to actual executable names
488
+ - **Argument handling**: Special argument processing (e.g., adding `--search` to Codex)
489
+
490
+ ## Dependencies
491
+
492
+ - `node-pty` or `bun-pty` - For spawning and managing AI CLI processes
493
+ - `from-node-stream` - Stream processing utilities
494
+ - `sflow` - Functional stream processing
495
+ - `terminal-render` - Terminal rendering and text processing
496
+ - `phpdie` - Error handling utilities
497
+
498
+ ## Inspiration
499
+
500
+ This project was inspired by: [Claude Code full auto while I sleep : r/ClaudeAI](https://www.reddit.com/r/ClaudeAI/comments/1klk6aw/claude_code_full_auto_while_i_sleep/)
501
+
502
+ ## License
503
+
504
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ await import('./cli.js')
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ await import('./cli.js')
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ await import('./cli.js')
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ await import('./cli.js')