claude-yes 1.21.0 → 1.22.0
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/README.md +26 -0
- package/dist/claude-yes.js +23 -19
- package/dist/cli.js +23 -19
- package/dist/cli.js.map +3 -3
- package/dist/codex-yes.js +23 -19
- package/dist/copilot-yes.js +23 -19
- package/dist/cursor-yes.js +23 -19
- package/dist/gemini-yes.js +23 -19
- package/dist/grok-yes.js +342 -0
- package/dist/index.js +23 -19
- package/dist/index.js.map +3 -3
- package/index.ts +39 -36
- package/package.json +14 -13
- package/postbuild.ts +10 -1
package/README.md
CHANGED
|
@@ -42,6 +42,11 @@ Learn more: https://www.anthropic.com/claude-code
|
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### Cursor
|
|
45
|
+
### Grok
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @vibe-kit/grok-cli
|
|
48
|
+
```
|
|
49
|
+
Learn more: https://github.com/vibe-kit/grok-cli
|
|
45
50
|
```bash
|
|
46
51
|
# Install Cursor agent CLI
|
|
47
52
|
# Check Cursor's documentation for installation instructions
|
|
@@ -81,6 +86,26 @@ claude-yes --cli=codex "refactor this function"
|
|
|
81
86
|
claude-yes --cli=copilot "generate unit tests"
|
|
82
87
|
|
|
83
88
|
# Use Cursor
|
|
89
|
+
# Use Grok
|
|
90
|
+
**Direct Commands:**
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Use Codex directly
|
|
94
|
+
codex-yes "refactor this function"
|
|
95
|
+
|
|
96
|
+
# Use Grok directly
|
|
97
|
+
grok-yes "help me with this code"
|
|
98
|
+
|
|
99
|
+
# Use Copilot directly
|
|
100
|
+
copilot-yes "generate unit tests"
|
|
101
|
+
|
|
102
|
+
# Use Cursor directly
|
|
103
|
+
cursor-yes "optimize performance"
|
|
104
|
+
|
|
105
|
+
# Use Gemini directly
|
|
106
|
+
gemini-yes "debug this code"
|
|
107
|
+
```
|
|
108
|
+
claude-yes --cli=grok "help me with this code"
|
|
84
109
|
claude-yes --cli=cursor "optimize performance"
|
|
85
110
|
```
|
|
86
111
|
|
|
@@ -103,6 +128,7 @@ claude-code-execute claude-yes "your task here"
|
|
|
103
128
|
| Codex | `codex` | Microsoft's Codex CLI |
|
|
104
129
|
| Copilot | `copilot` | GitHub Copilot CLI |
|
|
105
130
|
| Cursor | `cursor` | Cursor agent CLI |
|
|
131
|
+
| Grok | `grok` | Vibe Kit\'s Grok CLI |
|
|
106
132
|
|
|
107
133
|
The tool will:
|
|
108
134
|
|
package/dist/claude-yes.js
CHANGED
|
@@ -25,7 +25,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
25
25
|
|
|
26
26
|
// dist/index.js
|
|
27
27
|
import { fromReadable, fromWritable } from "from-node-stream";
|
|
28
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
28
|
+
import { appendFile, mkdir, writeFile } from "fs/promises";
|
|
29
29
|
import path from "path";
|
|
30
30
|
import DIE from "phpdie";
|
|
31
31
|
import sflow from "sflow";
|
|
@@ -70,7 +70,8 @@ function removeControlCharacters(str) {
|
|
|
70
70
|
var CLI_CONFIGURES = {
|
|
71
71
|
grok: {
|
|
72
72
|
install: "npm install -g @vibe-kit/grok-cli",
|
|
73
|
-
ready: [/^
|
|
73
|
+
ready: [/^ │ ❯ /],
|
|
74
|
+
enter: [/^ 1. Yes/]
|
|
74
75
|
},
|
|
75
76
|
claude: {
|
|
76
77
|
install: "npm install -g @anthropic-ai/claude-code",
|
|
@@ -78,7 +79,7 @@ var CLI_CONFIGURES = {
|
|
|
78
79
|
enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],
|
|
79
80
|
fatal: [
|
|
80
81
|
/No conversation found to continue/,
|
|
81
|
-
/⎿
|
|
82
|
+
/⎿ Claude usage limit reached\./
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
85
|
gemini: {
|
|
@@ -90,7 +91,10 @@ var CLI_CONFIGURES = {
|
|
|
90
91
|
codex: {
|
|
91
92
|
install: "npm install -g @openai/codex-cli",
|
|
92
93
|
ready: [/⏎ send/],
|
|
93
|
-
enter: [
|
|
94
|
+
enter: [
|
|
95
|
+
/\b▌ \> 1\. Approve and run now/,
|
|
96
|
+
/\b\> 1\. Yes, allow Codex to work in this folder/
|
|
97
|
+
],
|
|
94
98
|
fatal: [/Error: The cursor position could not be read within/],
|
|
95
99
|
ensureArgs: (args) => {
|
|
96
100
|
if (!args.includes("--search"))
|
|
@@ -109,7 +113,7 @@ var CLI_CONFIGURES = {
|
|
|
109
113
|
binary: "cursor-agent",
|
|
110
114
|
ready: [/\/ commands/],
|
|
111
115
|
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
112
|
-
fatal: []
|
|
116
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
119
|
async function claudeYes({
|
|
@@ -165,7 +169,6 @@ async function claudeYes({
|
|
|
165
169
|
return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(", ")} currently, not ${cli}`);
|
|
166
170
|
}
|
|
167
171
|
if (isFatal) {
|
|
168
|
-
console.log(`${cli} crashed with "No conversation found to continue", exiting...`);
|
|
169
172
|
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
170
173
|
}
|
|
171
174
|
console.log(`${cli} crashed, restarting...`);
|
|
@@ -192,6 +195,8 @@ async function claudeYes({
|
|
|
192
195
|
console.log("[${cli}-yes] ${cli} is idle, exiting...");
|
|
193
196
|
await exitAgent();
|
|
194
197
|
});
|
|
198
|
+
console.log(`[${cli}-yes] Started ${cli} with args: ${[cliCommand, ...cliArgs].join(" ")}`);
|
|
199
|
+
shell.write("\x1B[1;1R");
|
|
195
200
|
sflow(fromReadable(process.stdin)).map((buffer) => buffer.toString()).by({
|
|
196
201
|
writable: new WritableStream({
|
|
197
202
|
write: async (data) => {
|
|
@@ -206,13 +211,11 @@ async function claudeYes({
|
|
|
206
211
|
return;
|
|
207
212
|
if (text.includes("\x1B[6n"))
|
|
208
213
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
`).length + 1;
|
|
212
|
-
const col = (rendered.split(`
|
|
213
|
-
`).slice(-1)[0]?.length || 0) + 1;
|
|
214
|
+
const { col, row } = terminalRender.getCursorPosition();
|
|
215
|
+
console.log(`[${cli}-yes] Responding cursor position: row=${row}, col=${col}`);
|
|
214
216
|
shell.write(`\x1B[${row};${col}R`);
|
|
215
|
-
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).
|
|
217
|
+
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).forEach((e2) => appendFile("io.log", "output|" + JSON.stringify(e2) + `
|
|
218
|
+
`)).forEach(async (e2, i) => {
|
|
216
219
|
const conf = CLI_CONFIGURES[cli] || null;
|
|
217
220
|
if (!conf)
|
|
218
221
|
return;
|
|
@@ -221,15 +224,16 @@ async function claudeYes({
|
|
|
221
224
|
return;
|
|
222
225
|
stdinReady.ready();
|
|
223
226
|
}
|
|
224
|
-
if (conf.enter?.some((rx) => e2.match(rx)))
|
|
227
|
+
if (conf.enter?.some((rx) => e2.match(rx))) {
|
|
225
228
|
await sendEnter(300);
|
|
226
|
-
|
|
229
|
+
}
|
|
230
|
+
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
227
231
|
isFatal = true;
|
|
232
|
+
await exitAgent();
|
|
233
|
+
}
|
|
228
234
|
}).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);
|
|
229
235
|
if (prompt)
|
|
230
|
-
|
|
231
|
-
await sendMessage(prompt);
|
|
232
|
-
})();
|
|
236
|
+
await sendMessage(prompt);
|
|
233
237
|
const exitCode = await pendingExitCode.promise;
|
|
234
238
|
console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
235
239
|
if (logFile) {
|
|
@@ -268,7 +272,7 @@ async function claudeYes({
|
|
|
268
272
|
}
|
|
269
273
|
function getTerminalDimensions() {
|
|
270
274
|
return {
|
|
271
|
-
cols:
|
|
275
|
+
cols: process.stdout.columns,
|
|
272
276
|
rows: process.stdout.rows
|
|
273
277
|
};
|
|
274
278
|
}
|
|
@@ -334,5 +338,5 @@ var { exitCode, logs } = await claudeYes({
|
|
|
334
338
|
});
|
|
335
339
|
process.exit(exitCode ?? 1);
|
|
336
340
|
|
|
337
|
-
//# debugId=
|
|
341
|
+
//# debugId=F98366DB626CC88164756E2164756E21
|
|
338
342
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
25
25
|
|
|
26
26
|
// dist/index.js
|
|
27
27
|
import { fromReadable, fromWritable } from "from-node-stream";
|
|
28
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
28
|
+
import { appendFile, mkdir, writeFile } from "fs/promises";
|
|
29
29
|
import path from "path";
|
|
30
30
|
import DIE from "phpdie";
|
|
31
31
|
import sflow from "sflow";
|
|
@@ -70,7 +70,8 @@ function removeControlCharacters(str) {
|
|
|
70
70
|
var CLI_CONFIGURES = {
|
|
71
71
|
grok: {
|
|
72
72
|
install: "npm install -g @vibe-kit/grok-cli",
|
|
73
|
-
ready: [/^
|
|
73
|
+
ready: [/^ │ ❯ /],
|
|
74
|
+
enter: [/^ 1. Yes/]
|
|
74
75
|
},
|
|
75
76
|
claude: {
|
|
76
77
|
install: "npm install -g @anthropic-ai/claude-code",
|
|
@@ -78,7 +79,7 @@ var CLI_CONFIGURES = {
|
|
|
78
79
|
enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],
|
|
79
80
|
fatal: [
|
|
80
81
|
/No conversation found to continue/,
|
|
81
|
-
/⎿
|
|
82
|
+
/⎿ Claude usage limit reached\./
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
85
|
gemini: {
|
|
@@ -90,7 +91,10 @@ var CLI_CONFIGURES = {
|
|
|
90
91
|
codex: {
|
|
91
92
|
install: "npm install -g @openai/codex-cli",
|
|
92
93
|
ready: [/⏎ send/],
|
|
93
|
-
enter: [
|
|
94
|
+
enter: [
|
|
95
|
+
/\b▌ \> 1\. Approve and run now/,
|
|
96
|
+
/\b\> 1\. Yes, allow Codex to work in this folder/
|
|
97
|
+
],
|
|
94
98
|
fatal: [/Error: The cursor position could not be read within/],
|
|
95
99
|
ensureArgs: (args) => {
|
|
96
100
|
if (!args.includes("--search"))
|
|
@@ -109,7 +113,7 @@ var CLI_CONFIGURES = {
|
|
|
109
113
|
binary: "cursor-agent",
|
|
110
114
|
ready: [/\/ commands/],
|
|
111
115
|
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
112
|
-
fatal: []
|
|
116
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
119
|
async function claudeYes({
|
|
@@ -165,7 +169,6 @@ async function claudeYes({
|
|
|
165
169
|
return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(", ")} currently, not ${cli}`);
|
|
166
170
|
}
|
|
167
171
|
if (isFatal) {
|
|
168
|
-
console.log(`${cli} crashed with "No conversation found to continue", exiting...`);
|
|
169
172
|
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
170
173
|
}
|
|
171
174
|
console.log(`${cli} crashed, restarting...`);
|
|
@@ -192,6 +195,8 @@ async function claudeYes({
|
|
|
192
195
|
console.log("[${cli}-yes] ${cli} is idle, exiting...");
|
|
193
196
|
await exitAgent();
|
|
194
197
|
});
|
|
198
|
+
console.log(`[${cli}-yes] Started ${cli} with args: ${[cliCommand, ...cliArgs].join(" ")}`);
|
|
199
|
+
shell.write("\x1B[1;1R");
|
|
195
200
|
sflow(fromReadable(process.stdin)).map((buffer) => buffer.toString()).by({
|
|
196
201
|
writable: new WritableStream({
|
|
197
202
|
write: async (data) => {
|
|
@@ -206,13 +211,11 @@ async function claudeYes({
|
|
|
206
211
|
return;
|
|
207
212
|
if (text.includes("\x1B[6n"))
|
|
208
213
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
`).length + 1;
|
|
212
|
-
const col = (rendered.split(`
|
|
213
|
-
`).slice(-1)[0]?.length || 0) + 1;
|
|
214
|
+
const { col, row } = terminalRender.getCursorPosition();
|
|
215
|
+
console.log(`[${cli}-yes] Responding cursor position: row=${row}, col=${col}`);
|
|
214
216
|
shell.write(`\x1B[${row};${col}R`);
|
|
215
|
-
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).
|
|
217
|
+
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).forEach((e2) => appendFile("io.log", "output|" + JSON.stringify(e2) + `
|
|
218
|
+
`)).forEach(async (e2, i) => {
|
|
216
219
|
const conf = CLI_CONFIGURES[cli] || null;
|
|
217
220
|
if (!conf)
|
|
218
221
|
return;
|
|
@@ -221,15 +224,16 @@ async function claudeYes({
|
|
|
221
224
|
return;
|
|
222
225
|
stdinReady.ready();
|
|
223
226
|
}
|
|
224
|
-
if (conf.enter?.some((rx) => e2.match(rx)))
|
|
227
|
+
if (conf.enter?.some((rx) => e2.match(rx))) {
|
|
225
228
|
await sendEnter(300);
|
|
226
|
-
|
|
229
|
+
}
|
|
230
|
+
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
227
231
|
isFatal = true;
|
|
232
|
+
await exitAgent();
|
|
233
|
+
}
|
|
228
234
|
}).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);
|
|
229
235
|
if (prompt)
|
|
230
|
-
|
|
231
|
-
await sendMessage(prompt);
|
|
232
|
-
})();
|
|
236
|
+
await sendMessage(prompt);
|
|
233
237
|
const exitCode = await pendingExitCode.promise;
|
|
234
238
|
console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
235
239
|
if (logFile) {
|
|
@@ -268,7 +272,7 @@ async function claudeYes({
|
|
|
268
272
|
}
|
|
269
273
|
function getTerminalDimensions() {
|
|
270
274
|
return {
|
|
271
|
-
cols:
|
|
275
|
+
cols: process.stdout.columns,
|
|
272
276
|
rows: process.stdout.rows
|
|
273
277
|
};
|
|
274
278
|
}
|
|
@@ -334,5 +338,5 @@ var { exitCode, logs } = await claudeYes({
|
|
|
334
338
|
});
|
|
335
339
|
process.exit(exitCode ?? 1);
|
|
336
340
|
|
|
337
|
-
//# debugId=
|
|
341
|
+
//# debugId=F98366DB626CC88164756E2164756E21
|
|
338
342
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"sources": ["../cli.ts", "index.js"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"#!/usr/bin/env node\nimport enhancedMs from 'enhanced-ms';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport claudeYes from '.';\n\n// cli entry point\nconst argv = yargs(hideBin(process.argv))\n .usage('Usage: $0 [options] [claude args] [--] [prompts...]')\n .example(\n '$0 --exit-on-idle=30s --continue-on-crash \"help me solve all todos in my codebase\"',\n 'Run Claude with a 30 seconds idle timeout and continue on crash',\n )\n .option('continue-on-crash', {\n type: 'boolean',\n default: true,\n description:\n 'spawn Claude with --continue if it crashes, only works for claude',\n })\n .option('log-file', {\n type: 'string',\n description: 'Log file to write to',\n })\n .option('cli', {\n type: 'string',\n description:\n 'Claude CLI command, e.g. \"claude,gemini,codex,cursor,copilot\", default is \"claude\"',\n })\n .option('prompt', {\n type: 'string',\n description: 'Prompt to send to Claude',\n alias: 'p',\n })\n .option('verbose', {\n type: 'boolean',\n description: 'Enable verbose logging',\n default: false,\n })\n .option('exit-on-idle', {\n type: 'string',\n description: 'Exit after a period of inactivity, e.g., \"5s\" or \"1m\"',\n })\n .parserConfiguration({\n 'unknown-options-as-args': true,\n 'halt-at-non-option': true,\n })\n .parseSync();\n\n// detect cli name for cli, while package.json have multiple bin link: {\"claude-yes\": \"cli.js\", \"codex-yes\": \"cli.js\", \"gemini-yes\": \"cli.js\"}\nif (!argv.cli) {\n const cliName = process.argv[1]?.split('/').pop()?.split('-')[0];\n argv.cli = cliName || 'claude';\n}\n\n// Support: everything after a literal `--` is a prompt string. Example:\n// claude-yes --exit-on-idle=30s -- \"help me refactor this\"\n// In that example the prompt will be `help me refactor this` and won't be\n// passed as args to the underlying CLI binary.\nconst rawArgs = process.argv.slice(2);\nconst dashIndex = rawArgs.indexOf('--');\nlet promptFromDash: string | undefined = undefined;\nlet cliArgsForSpawn: string[] = [];\nif (dashIndex !== -1) {\n // join everything after `--` into a single prompt string\n const after = rawArgs.slice(dashIndex + 1);\n promptFromDash = after.join(' ');\n // use everything before `--` as the cli args\n cliArgsForSpawn = rawArgs.slice(0, dashIndex).map(String);\n} else {\n // fallback to yargs parsed positional args when `--` is not used\n cliArgsForSpawn = argv._.map((e) => String(e));\n}\n\nconsole.clear();\nconst { exitCode, logs } = await claudeYes({\n cli: argv.cli,\n // prefer explicit --prompt / -p; otherwise use the text after `--` if present\n prompt: argv.prompt || promptFromDash,\n exitOnIdle: argv.exitOnIdle ? enhancedMs(argv.exitOnIdle) : undefined,\n cliArgs: cliArgsForSpawn,\n continueOnCrash: argv.continueOnCrash,\n logFile: argv.logFile,\n verbose: argv.verbose,\n});\n\nprocess.exit(exitCode ?? 1);\n",
|
|
6
|
-
"import { createRequire } from \"node:module\";\nvar __create = Object.create;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __toESM = (mod, isNodeMode, target) => {\n target = mod != null ? __create(__getProtoOf(mod)) : {};\n const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target;\n for (let key of __getOwnPropNames(mod))\n if (!__hasOwnProp.call(to, key))\n __defProp(to, key, {\n get: () => mod[key],\n enumerable: true\n });\n return to;\n};\nvar __require = /* @__PURE__ */ createRequire(import.meta.url);\n\n// index.ts\nimport { fromReadable, fromWritable } from \"from-node-stream\";\nimport { mkdir, writeFile } from \"fs/promises\";\nimport path from \"path\";\nimport DIE from \"phpdie\";\nimport sflow from \"sflow\";\nimport { TerminalTextRender } from \"terminal-render\";\n\n// idleWaiter.ts\nclass IdleWaiter {\n lastActivityTime = Date.now();\n checkInterval = 100;\n constructor() {\n this.ping();\n }\n ping() {\n this.lastActivityTime = Date.now();\n return this;\n }\n async wait(ms) {\n while (this.lastActivityTime >= Date.now() - ms)\n await new Promise((resolve) => setTimeout(resolve, this.checkInterval));\n }\n}\n\n// ReadyManager.ts\nclass ReadyManager {\n isReady = false;\n readyQueue = [];\n wait() {\n if (this.isReady)\n return;\n return new Promise((resolve) => this.readyQueue.push(resolve));\n }\n unready() {\n this.isReady = false;\n }\n ready() {\n this.isReady = true;\n if (!this.readyQueue.length)\n return;\n this.readyQueue.splice(0).map((resolve) => resolve());\n }\n}\n\n// removeControlCharacters.ts\nfunction removeControlCharacters(str) {\n return str.replace(/[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, \"\");\n}\n\n// index.ts\nvar CLI_CONFIGURES = {\n grok: {\n install: \"npm install -g @vibe-kit/grok-cli\",\n ready: [/^
|
|
6
|
+
"import { createRequire } from \"node:module\";\nvar __create = Object.create;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __toESM = (mod, isNodeMode, target) => {\n target = mod != null ? __create(__getProtoOf(mod)) : {};\n const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target;\n for (let key of __getOwnPropNames(mod))\n if (!__hasOwnProp.call(to, key))\n __defProp(to, key, {\n get: () => mod[key],\n enumerable: true\n });\n return to;\n};\nvar __require = /* @__PURE__ */ createRequire(import.meta.url);\n\n// index.ts\nimport { fromReadable, fromWritable } from \"from-node-stream\";\nimport { appendFile, mkdir, writeFile } from \"fs/promises\";\nimport path from \"path\";\nimport DIE from \"phpdie\";\nimport sflow from \"sflow\";\nimport { TerminalTextRender } from \"terminal-render\";\n\n// idleWaiter.ts\nclass IdleWaiter {\n lastActivityTime = Date.now();\n checkInterval = 100;\n constructor() {\n this.ping();\n }\n ping() {\n this.lastActivityTime = Date.now();\n return this;\n }\n async wait(ms) {\n while (this.lastActivityTime >= Date.now() - ms)\n await new Promise((resolve) => setTimeout(resolve, this.checkInterval));\n }\n}\n\n// ReadyManager.ts\nclass ReadyManager {\n isReady = false;\n readyQueue = [];\n wait() {\n if (this.isReady)\n return;\n return new Promise((resolve) => this.readyQueue.push(resolve));\n }\n unready() {\n this.isReady = false;\n }\n ready() {\n this.isReady = true;\n if (!this.readyQueue.length)\n return;\n this.readyQueue.splice(0).map((resolve) => resolve());\n }\n}\n\n// removeControlCharacters.ts\nfunction removeControlCharacters(str) {\n return str.replace(/[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, \"\");\n}\n\n// index.ts\nvar CLI_CONFIGURES = {\n grok: {\n install: \"npm install -g @vibe-kit/grok-cli\",\n ready: [/^ │ ❯ /],\n enter: [/^ 1. Yes/]\n },\n claude: {\n install: \"npm install -g @anthropic-ai/claude-code\",\n ready: [/^> /],\n enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],\n fatal: [\n /No conversation found to continue/,\n /⎿ Claude usage limit reached\\./\n ]\n },\n gemini: {\n install: \"npm install -g @google/gemini-cli\",\n ready: [/Type your message/],\n enter: [/│ ● 1. Yes, allow once/],\n fatal: []\n },\n codex: {\n install: \"npm install -g @openai/codex-cli\",\n ready: [/⏎ send/],\n enter: [\n /\\b▌ \\> 1\\. Approve and run now/,\n /\\b\\> 1\\. Yes, allow Codex to work in this folder/\n ],\n fatal: [/Error: The cursor position could not be read within/],\n ensureArgs: (args) => {\n if (!args.includes(\"--search\"))\n return [\"--search\", ...args];\n return args;\n }\n },\n copilot: {\n install: \"npm install -g @github/copilot\",\n ready: [/^ > /],\n enter: [/ │ ❯ 1. Yes, proceed/, /❯ 1. Yes/],\n fatal: []\n },\n cursor: {\n install: \"open https://cursor.com/ja/docs/cli/installation\",\n binary: \"cursor-agent\",\n ready: [/\\/ commands/],\n enter: [/→ Run \\(once\\) \\(y\\) \\(enter\\)/, /▶ \\[a\\] Trust this workspace/],\n fatal: [/^ Error: You've hit your usage limit/]\n }\n};\nasync function claudeYes({\n cli = \"claude\",\n cliArgs = [],\n prompt,\n continueOnCrash,\n cwd,\n env,\n exitOnIdle,\n logFile,\n removeControlCharactersFromStdout = false,\n verbose = false\n} = {}) {\n const continueArgs = {\n codex: \"resume --last\".split(\" \"),\n claude: \"--continue\".split(\" \"),\n gemini: []\n };\n process.stdin.setRawMode?.(true);\n let isFatal = false;\n const stdinReady = new ReadyManager;\n const shellOutputStream = new TransformStream;\n const outputWriter = shellOutputStream.writable.getWriter();\n const pty = await import(\"node-pty\").catch(async () => await import(\"bun-pty\")).catch(async () => DIE(\"Please install node-pty or bun-pty, run this: bun install bun-pty\"));\n const getPtyOptions = () => ({\n name: \"xterm-color\",\n ...getTerminalDimensions(),\n cwd: cwd ?? process.cwd(),\n env: env ?? process.env\n });\n const cliConf = CLI_CONFIGURES[cli] || {};\n cliArgs = cliConf.ensureArgs?.(cliArgs) ?? cliArgs;\n const cliCommand = cliConf?.binary || cli;\n let shell = tryCatch(() => pty.spawn(cliCommand, cliArgs, getPtyOptions()), (error) => {\n console.error(`Fatal: Failed to start ${cliCommand}.`);\n if (cliConf?.install)\n console.error(`If you did not installed it yet, Please install it first: ${cliConf.install}`);\n throw error;\n });\n const pendingExitCode = Promise.withResolvers();\n let pendingExitCodeValue = null;\n async function onData(data) {\n await outputWriter.write(data);\n }\n shell.onData(onData);\n shell.onExit(function onExit({ exitCode: exitCode2 }) {\n stdinReady.unready();\n const agentCrashed = exitCode2 !== 0;\n const continueArg = continueArgs[cli];\n if (agentCrashed && continueOnCrash && continueArg) {\n if (!continueArg) {\n return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(\", \")} currently, not ${cli}`);\n }\n if (isFatal) {\n return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);\n }\n console.log(`${cli} crashed, restarting...`);\n shell = pty.spawn(cli, continueArg, getPtyOptions());\n shell.onData(onData);\n shell.onExit(onExit);\n return;\n }\n return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);\n });\n process.stdout.on(\"resize\", () => {\n const { cols, rows } = getTerminalDimensions();\n shell.resize(cols, rows);\n });\n const terminalRender = new TerminalTextRender;\n const isStillWorkingQ = () => terminalRender.render().replace(/\\s+/g, \" \").match(/esc to interrupt|to run in background/);\n const idleWaiter = new IdleWaiter;\n if (exitOnIdle)\n idleWaiter.wait(exitOnIdle).then(async () => {\n if (isStillWorkingQ()) {\n console.log(\"[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet\");\n return;\n }\n console.log(\"[${cli}-yes] ${cli} is idle, exiting...\");\n await exitAgent();\n });\n console.log(`[${cli}-yes] Started ${cli} with args: ${[cliCommand, ...cliArgs].join(\" \")}`);\n shell.write(\"\\x1B[1;1R\");\n sflow(fromReadable(process.stdin)).map((buffer) => buffer.toString()).by({\n writable: new WritableStream({\n write: async (data) => {\n await stdinReady.wait();\n shell.write(data);\n }\n }),\n readable: shellOutputStream.readable\n }).forEach(() => idleWaiter.ping()).forEach((text) => {\n terminalRender.write(text);\n if (process.stdin.isTTY)\n return;\n if (text.includes(\"\\x1B[6n\"))\n return;\n const { col, row } = terminalRender.getCursorPosition();\n console.log(`[${cli}-yes] Responding cursor position: row=${row}, col=${col}`);\n shell.write(`\\x1B[${row};${col}R`);\n }).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll(\"\\r\", \"\")).forEach((e2) => appendFile(\"io.log\", \"output|\" + JSON.stringify(e2) + `\n`)).forEach(async (e2, i) => {\n const conf = CLI_CONFIGURES[cli] || null;\n if (!conf)\n return;\n if (conf.ready?.some((rx) => e2.match(rx))) {\n if (cli === \"gemini\" && i <= 80)\n return;\n stdinReady.ready();\n }\n if (conf.enter?.some((rx) => e2.match(rx))) {\n await sendEnter(300);\n }\n if (conf.fatal?.some((rx) => e2.match(rx))) {\n isFatal = true;\n await exitAgent();\n }\n }).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);\n if (prompt)\n await sendMessage(prompt);\n const exitCode = await pendingExitCode.promise;\n console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);\n if (logFile) {\n verbose && console.log(`[${cli}-yes] Writing rendered logs to ${logFile}`);\n const logFilePath = path.resolve(logFile);\n await mkdir(path.dirname(logFilePath), { recursive: true }).catch(() => null);\n await writeFile(logFilePath, terminalRender.render());\n }\n return { exitCode, logs: terminalRender.render() };\n async function sendEnter(waitms = 1000) {\n const st = Date.now();\n await idleWaiter.wait(waitms);\n const et = Date.now();\n process.stdout.write(`\\ridleWaiter.wait(${waitms}) took ${et - st}ms\\r`);\n shell.write(\"\\r\");\n }\n async function sendMessage(message) {\n await stdinReady.wait();\n shell.write(message);\n idleWaiter.ping();\n await sendEnter();\n }\n async function exitAgent() {\n continueOnCrash = false;\n await sendMessage(\"/exit\");\n let exited = false;\n await Promise.race([\n pendingExitCode.promise.then(() => exited = true),\n new Promise((resolve) => setTimeout(() => {\n if (exited)\n return;\n shell.kill();\n resolve();\n }, 5000))\n ]);\n }\n function getTerminalDimensions() {\n return {\n cols: process.stdout.columns,\n rows: process.stdout.rows\n };\n }\n}\nfunction tryCatch(fn, catchFn) {\n try {\n return fn();\n } catch (error) {\n return catchFn(error);\n }\n}\nexport {\n removeControlCharacters,\n claudeYes as default,\n CLI_CONFIGURES\n};\n\n//# debugId=725F10399412016964756E2164756E21\n//# sourceMappingURL=index.js.map\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;;;ACiBA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,WAAW;AAAA,EACf,mBAAmB,KAAK,IAAI;AAAA,EAC5B,gBAAgB;AAAA,EAChB,WAAW,GAAG;AAAA,IACZ,KAAK,KAAK;AAAA;AAAA,EAEZ,IAAI,GAAG;AAAA,IACL,KAAK,mBAAmB,KAAK,IAAI;AAAA,IACjC,OAAO;AAAA;AAAA,OAEH,KAAI,CAAC,IAAI;AAAA,IACb,OAAO,KAAK,oBAAoB,KAAK,IAAI,IAAI;AAAA,MAC3C,MAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,KAAK,aAAa,CAAC;AAAA;AAE5E;AAAA;AAGA,MAAM,aAAa;AAAA,EACjB,UAAU;AAAA,EACV,aAAa,CAAC;AAAA,EACd,IAAI,GAAG;AAAA,IACL,IAAI,KAAK;AAAA,MACP;AAAA,IACF,OAAO,IAAI,QAAQ,CAAC,YAAY,KAAK,WAAW,KAAK,OAAO,CAAC;AAAA;AAAA,EAE/D,OAAO,GAAG;AAAA,IACR,KAAK,UAAU;AAAA;AAAA,EAEjB,KAAK,GAAG;AAAA,IACN,KAAK,UAAU;AAAA,IACf,IAAI,CAAC,KAAK,WAAW;AAAA,MACnB;AAAA,IACF,KAAK,WAAW,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,QAAQ,CAAC;AAAA;AAExD;AAGA,SAAS,uBAAuB,CAAC,KAAK;AAAA,EACpC,OAAO,IAAI,QAAQ,+EAA+E,EAAE;AAAA;AAItG,IAAI,iBAAiB;AAAA,EACnB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO,CAAC,SA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AE/B,kBAAkB,QAAQ,MAAM,GAAG,SAAS,EAAE,IAAI,MAAM;AAC1D,EAAO;AAAA,EAEL,kBAAkB,KAAK,EAAE,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC;AAAA;AAG/C,QAAQ,MAAM;AACd,MAAQ,UAAU,SAAS,MAAM,UAAU;AAAA,EACzC,KAAK,KAAK;AAAA,EAEV,QAAQ,KAAK,UAAU;AAAA,EACvB,YAAY,KAAK,aAAa,WAAW,KAAK,UAAU,IAAI;AAAA,EAC5D,SAAS;AAAA,EACT,iBAAiB,KAAK;AAAA,EACtB,SAAS,KAAK;AAAA,EACd,SAAS,KAAK;AAChB,CAAC;AAED,QAAQ,KAAK,YAAY,CAAC;",
|
|
9
|
+
"debugId": "F98366DB626CC88164756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/codex-yes.js
CHANGED
|
@@ -25,7 +25,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
25
25
|
|
|
26
26
|
// dist/index.js
|
|
27
27
|
import { fromReadable, fromWritable } from "from-node-stream";
|
|
28
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
28
|
+
import { appendFile, mkdir, writeFile } from "fs/promises";
|
|
29
29
|
import path from "path";
|
|
30
30
|
import DIE from "phpdie";
|
|
31
31
|
import sflow from "sflow";
|
|
@@ -70,7 +70,8 @@ function removeControlCharacters(str) {
|
|
|
70
70
|
var CLI_CONFIGURES = {
|
|
71
71
|
grok: {
|
|
72
72
|
install: "npm install -g @vibe-kit/grok-cli",
|
|
73
|
-
ready: [/^
|
|
73
|
+
ready: [/^ │ ❯ /],
|
|
74
|
+
enter: [/^ 1. Yes/]
|
|
74
75
|
},
|
|
75
76
|
claude: {
|
|
76
77
|
install: "npm install -g @anthropic-ai/claude-code",
|
|
@@ -78,7 +79,7 @@ var CLI_CONFIGURES = {
|
|
|
78
79
|
enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],
|
|
79
80
|
fatal: [
|
|
80
81
|
/No conversation found to continue/,
|
|
81
|
-
/⎿
|
|
82
|
+
/⎿ Claude usage limit reached\./
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
85
|
gemini: {
|
|
@@ -90,7 +91,10 @@ var CLI_CONFIGURES = {
|
|
|
90
91
|
codex: {
|
|
91
92
|
install: "npm install -g @openai/codex-cli",
|
|
92
93
|
ready: [/⏎ send/],
|
|
93
|
-
enter: [
|
|
94
|
+
enter: [
|
|
95
|
+
/\b▌ \> 1\. Approve and run now/,
|
|
96
|
+
/\b\> 1\. Yes, allow Codex to work in this folder/
|
|
97
|
+
],
|
|
94
98
|
fatal: [/Error: The cursor position could not be read within/],
|
|
95
99
|
ensureArgs: (args) => {
|
|
96
100
|
if (!args.includes("--search"))
|
|
@@ -109,7 +113,7 @@ var CLI_CONFIGURES = {
|
|
|
109
113
|
binary: "cursor-agent",
|
|
110
114
|
ready: [/\/ commands/],
|
|
111
115
|
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
112
|
-
fatal: []
|
|
116
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
119
|
async function claudeYes({
|
|
@@ -165,7 +169,6 @@ async function claudeYes({
|
|
|
165
169
|
return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(", ")} currently, not ${cli}`);
|
|
166
170
|
}
|
|
167
171
|
if (isFatal) {
|
|
168
|
-
console.log(`${cli} crashed with "No conversation found to continue", exiting...`);
|
|
169
172
|
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
170
173
|
}
|
|
171
174
|
console.log(`${cli} crashed, restarting...`);
|
|
@@ -192,6 +195,8 @@ async function claudeYes({
|
|
|
192
195
|
console.log("[${cli}-yes] ${cli} is idle, exiting...");
|
|
193
196
|
await exitAgent();
|
|
194
197
|
});
|
|
198
|
+
console.log(`[${cli}-yes] Started ${cli} with args: ${[cliCommand, ...cliArgs].join(" ")}`);
|
|
199
|
+
shell.write("\x1B[1;1R");
|
|
195
200
|
sflow(fromReadable(process.stdin)).map((buffer) => buffer.toString()).by({
|
|
196
201
|
writable: new WritableStream({
|
|
197
202
|
write: async (data) => {
|
|
@@ -206,13 +211,11 @@ async function claudeYes({
|
|
|
206
211
|
return;
|
|
207
212
|
if (text.includes("\x1B[6n"))
|
|
208
213
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
`).length + 1;
|
|
212
|
-
const col = (rendered.split(`
|
|
213
|
-
`).slice(-1)[0]?.length || 0) + 1;
|
|
214
|
+
const { col, row } = terminalRender.getCursorPosition();
|
|
215
|
+
console.log(`[${cli}-yes] Responding cursor position: row=${row}, col=${col}`);
|
|
214
216
|
shell.write(`\x1B[${row};${col}R`);
|
|
215
|
-
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).
|
|
217
|
+
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).forEach((e2) => appendFile("io.log", "output|" + JSON.stringify(e2) + `
|
|
218
|
+
`)).forEach(async (e2, i) => {
|
|
216
219
|
const conf = CLI_CONFIGURES[cli] || null;
|
|
217
220
|
if (!conf)
|
|
218
221
|
return;
|
|
@@ -221,15 +224,16 @@ async function claudeYes({
|
|
|
221
224
|
return;
|
|
222
225
|
stdinReady.ready();
|
|
223
226
|
}
|
|
224
|
-
if (conf.enter?.some((rx) => e2.match(rx)))
|
|
227
|
+
if (conf.enter?.some((rx) => e2.match(rx))) {
|
|
225
228
|
await sendEnter(300);
|
|
226
|
-
|
|
229
|
+
}
|
|
230
|
+
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
227
231
|
isFatal = true;
|
|
232
|
+
await exitAgent();
|
|
233
|
+
}
|
|
228
234
|
}).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);
|
|
229
235
|
if (prompt)
|
|
230
|
-
|
|
231
|
-
await sendMessage(prompt);
|
|
232
|
-
})();
|
|
236
|
+
await sendMessage(prompt);
|
|
233
237
|
const exitCode = await pendingExitCode.promise;
|
|
234
238
|
console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
235
239
|
if (logFile) {
|
|
@@ -268,7 +272,7 @@ async function claudeYes({
|
|
|
268
272
|
}
|
|
269
273
|
function getTerminalDimensions() {
|
|
270
274
|
return {
|
|
271
|
-
cols:
|
|
275
|
+
cols: process.stdout.columns,
|
|
272
276
|
rows: process.stdout.rows
|
|
273
277
|
};
|
|
274
278
|
}
|
|
@@ -334,5 +338,5 @@ var { exitCode, logs } = await claudeYes({
|
|
|
334
338
|
});
|
|
335
339
|
process.exit(exitCode ?? 1);
|
|
336
340
|
|
|
337
|
-
//# debugId=
|
|
341
|
+
//# debugId=F98366DB626CC88164756E2164756E21
|
|
338
342
|
//# sourceMappingURL=cli.js.map
|
package/dist/copilot-yes.js
CHANGED
|
@@ -25,7 +25,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
25
25
|
|
|
26
26
|
// dist/index.js
|
|
27
27
|
import { fromReadable, fromWritable } from "from-node-stream";
|
|
28
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
28
|
+
import { appendFile, mkdir, writeFile } from "fs/promises";
|
|
29
29
|
import path from "path";
|
|
30
30
|
import DIE from "phpdie";
|
|
31
31
|
import sflow from "sflow";
|
|
@@ -70,7 +70,8 @@ function removeControlCharacters(str) {
|
|
|
70
70
|
var CLI_CONFIGURES = {
|
|
71
71
|
grok: {
|
|
72
72
|
install: "npm install -g @vibe-kit/grok-cli",
|
|
73
|
-
ready: [/^
|
|
73
|
+
ready: [/^ │ ❯ /],
|
|
74
|
+
enter: [/^ 1. Yes/]
|
|
74
75
|
},
|
|
75
76
|
claude: {
|
|
76
77
|
install: "npm install -g @anthropic-ai/claude-code",
|
|
@@ -78,7 +79,7 @@ var CLI_CONFIGURES = {
|
|
|
78
79
|
enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],
|
|
79
80
|
fatal: [
|
|
80
81
|
/No conversation found to continue/,
|
|
81
|
-
/⎿
|
|
82
|
+
/⎿ Claude usage limit reached\./
|
|
82
83
|
]
|
|
83
84
|
},
|
|
84
85
|
gemini: {
|
|
@@ -90,7 +91,10 @@ var CLI_CONFIGURES = {
|
|
|
90
91
|
codex: {
|
|
91
92
|
install: "npm install -g @openai/codex-cli",
|
|
92
93
|
ready: [/⏎ send/],
|
|
93
|
-
enter: [
|
|
94
|
+
enter: [
|
|
95
|
+
/\b▌ \> 1\. Approve and run now/,
|
|
96
|
+
/\b\> 1\. Yes, allow Codex to work in this folder/
|
|
97
|
+
],
|
|
94
98
|
fatal: [/Error: The cursor position could not be read within/],
|
|
95
99
|
ensureArgs: (args) => {
|
|
96
100
|
if (!args.includes("--search"))
|
|
@@ -109,7 +113,7 @@ var CLI_CONFIGURES = {
|
|
|
109
113
|
binary: "cursor-agent",
|
|
110
114
|
ready: [/\/ commands/],
|
|
111
115
|
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
112
|
-
fatal: []
|
|
116
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
119
|
async function claudeYes({
|
|
@@ -165,7 +169,6 @@ async function claudeYes({
|
|
|
165
169
|
return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(", ")} currently, not ${cli}`);
|
|
166
170
|
}
|
|
167
171
|
if (isFatal) {
|
|
168
|
-
console.log(`${cli} crashed with "No conversation found to continue", exiting...`);
|
|
169
172
|
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
170
173
|
}
|
|
171
174
|
console.log(`${cli} crashed, restarting...`);
|
|
@@ -192,6 +195,8 @@ async function claudeYes({
|
|
|
192
195
|
console.log("[${cli}-yes] ${cli} is idle, exiting...");
|
|
193
196
|
await exitAgent();
|
|
194
197
|
});
|
|
198
|
+
console.log(`[${cli}-yes] Started ${cli} with args: ${[cliCommand, ...cliArgs].join(" ")}`);
|
|
199
|
+
shell.write("\x1B[1;1R");
|
|
195
200
|
sflow(fromReadable(process.stdin)).map((buffer) => buffer.toString()).by({
|
|
196
201
|
writable: new WritableStream({
|
|
197
202
|
write: async (data) => {
|
|
@@ -206,13 +211,11 @@ async function claudeYes({
|
|
|
206
211
|
return;
|
|
207
212
|
if (text.includes("\x1B[6n"))
|
|
208
213
|
return;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
`).length + 1;
|
|
212
|
-
const col = (rendered.split(`
|
|
213
|
-
`).slice(-1)[0]?.length || 0) + 1;
|
|
214
|
+
const { col, row } = terminalRender.getCursorPosition();
|
|
215
|
+
console.log(`[${cli}-yes] Responding cursor position: row=${row}, col=${col}`);
|
|
214
216
|
shell.write(`\x1B[${row};${col}R`);
|
|
215
|
-
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).
|
|
217
|
+
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).forEach((e2) => appendFile("io.log", "output|" + JSON.stringify(e2) + `
|
|
218
|
+
`)).forEach(async (e2, i) => {
|
|
216
219
|
const conf = CLI_CONFIGURES[cli] || null;
|
|
217
220
|
if (!conf)
|
|
218
221
|
return;
|
|
@@ -221,15 +224,16 @@ async function claudeYes({
|
|
|
221
224
|
return;
|
|
222
225
|
stdinReady.ready();
|
|
223
226
|
}
|
|
224
|
-
if (conf.enter?.some((rx) => e2.match(rx)))
|
|
227
|
+
if (conf.enter?.some((rx) => e2.match(rx))) {
|
|
225
228
|
await sendEnter(300);
|
|
226
|
-
|
|
229
|
+
}
|
|
230
|
+
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
227
231
|
isFatal = true;
|
|
232
|
+
await exitAgent();
|
|
233
|
+
}
|
|
228
234
|
}).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);
|
|
229
235
|
if (prompt)
|
|
230
|
-
|
|
231
|
-
await sendMessage(prompt);
|
|
232
|
-
})();
|
|
236
|
+
await sendMessage(prompt);
|
|
233
237
|
const exitCode = await pendingExitCode.promise;
|
|
234
238
|
console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
235
239
|
if (logFile) {
|
|
@@ -268,7 +272,7 @@ async function claudeYes({
|
|
|
268
272
|
}
|
|
269
273
|
function getTerminalDimensions() {
|
|
270
274
|
return {
|
|
271
|
-
cols:
|
|
275
|
+
cols: process.stdout.columns,
|
|
272
276
|
rows: process.stdout.rows
|
|
273
277
|
};
|
|
274
278
|
}
|
|
@@ -334,5 +338,5 @@ var { exitCode, logs } = await claudeYes({
|
|
|
334
338
|
});
|
|
335
339
|
process.exit(exitCode ?? 1);
|
|
336
340
|
|
|
337
|
-
//# debugId=
|
|
341
|
+
//# debugId=F98366DB626CC88164756E2164756E21
|
|
338
342
|
//# sourceMappingURL=cli.js.map
|