claude-yes 1.20.0 → 1.21.1
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 +43 -37
- package/dist/cli.js +43 -37
- package/dist/cli.js.map +3 -3
- package/dist/codex-yes.js +43 -37
- package/dist/copilot-yes.js +43 -37
- package/dist/cursor-yes.js +43 -37
- package/dist/gemini-yes.js +43 -37
- package/dist/grok-yes.js +338 -0
- package/dist/index.js +43 -37
- package/dist/index.js.map +3 -3
- package/index.ts +58 -57
- package/package.json +14 -13
- package/postbuild.ts +10 -1
package/dist/grok-yes.js
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// cli.ts
|
|
22
|
+
import enhancedMs from "enhanced-ms";
|
|
23
|
+
import yargs from "yargs";
|
|
24
|
+
import { hideBin } from "yargs/helpers";
|
|
25
|
+
|
|
26
|
+
// dist/index.js
|
|
27
|
+
import { fromReadable, fromWritable } from "from-node-stream";
|
|
28
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
29
|
+
import path from "path";
|
|
30
|
+
import DIE from "phpdie";
|
|
31
|
+
import sflow from "sflow";
|
|
32
|
+
import { TerminalTextRender } from "terminal-render";
|
|
33
|
+
class IdleWaiter {
|
|
34
|
+
lastActivityTime = Date.now();
|
|
35
|
+
checkInterval = 100;
|
|
36
|
+
constructor() {
|
|
37
|
+
this.ping();
|
|
38
|
+
}
|
|
39
|
+
ping() {
|
|
40
|
+
this.lastActivityTime = Date.now();
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
async wait(ms) {
|
|
44
|
+
while (this.lastActivityTime >= Date.now() - ms)
|
|
45
|
+
await new Promise((resolve) => setTimeout(resolve, this.checkInterval));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class ReadyManager {
|
|
50
|
+
isReady = false;
|
|
51
|
+
readyQueue = [];
|
|
52
|
+
wait() {
|
|
53
|
+
if (this.isReady)
|
|
54
|
+
return;
|
|
55
|
+
return new Promise((resolve) => this.readyQueue.push(resolve));
|
|
56
|
+
}
|
|
57
|
+
unready() {
|
|
58
|
+
this.isReady = false;
|
|
59
|
+
}
|
|
60
|
+
ready() {
|
|
61
|
+
this.isReady = true;
|
|
62
|
+
if (!this.readyQueue.length)
|
|
63
|
+
return;
|
|
64
|
+
this.readyQueue.splice(0).map((resolve) => resolve());
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function removeControlCharacters(str) {
|
|
68
|
+
return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
|
69
|
+
}
|
|
70
|
+
var CLI_CONFIGURES = {
|
|
71
|
+
grok: {
|
|
72
|
+
install: "npm install -g @vibe-kit/grok-cli",
|
|
73
|
+
ready: [/^ │ ❯ /],
|
|
74
|
+
enter: [/^ 1. Yes/]
|
|
75
|
+
},
|
|
76
|
+
claude: {
|
|
77
|
+
install: "npm install -g @anthropic-ai/claude-code",
|
|
78
|
+
ready: [/^> /],
|
|
79
|
+
enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],
|
|
80
|
+
fatal: [
|
|
81
|
+
/No conversation found to continue/,
|
|
82
|
+
/⎿ Claude usage limit reached\./
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
gemini: {
|
|
86
|
+
install: "npm install -g @google/gemini-cli",
|
|
87
|
+
ready: [/Type your message/],
|
|
88
|
+
enter: [/│ ● 1. Yes, allow once/],
|
|
89
|
+
fatal: []
|
|
90
|
+
},
|
|
91
|
+
codex: {
|
|
92
|
+
install: "npm install -g @openai/codex-cli",
|
|
93
|
+
ready: [/⏎ send/],
|
|
94
|
+
enter: [/ > 1. Approve/, /> 1. Yes, allow Codex to work in this folder/],
|
|
95
|
+
fatal: [/Error: The cursor position could not be read within/],
|
|
96
|
+
ensureArgs: (args) => {
|
|
97
|
+
if (!args.includes("--search"))
|
|
98
|
+
return ["--search", ...args];
|
|
99
|
+
return args;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
copilot: {
|
|
103
|
+
install: "npm install -g @github/copilot",
|
|
104
|
+
ready: [/^ > /],
|
|
105
|
+
enter: [/ │ ❯ 1. Yes, proceed/, /❯ 1. Yes/],
|
|
106
|
+
fatal: []
|
|
107
|
+
},
|
|
108
|
+
cursor: {
|
|
109
|
+
install: "open https://cursor.com/ja/docs/cli/installation",
|
|
110
|
+
binary: "cursor-agent",
|
|
111
|
+
ready: [/\/ commands/],
|
|
112
|
+
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
113
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
async function claudeYes({
|
|
117
|
+
cli = "claude",
|
|
118
|
+
cliArgs = [],
|
|
119
|
+
prompt,
|
|
120
|
+
continueOnCrash,
|
|
121
|
+
cwd,
|
|
122
|
+
env,
|
|
123
|
+
exitOnIdle,
|
|
124
|
+
logFile,
|
|
125
|
+
removeControlCharactersFromStdout = false,
|
|
126
|
+
verbose = false
|
|
127
|
+
} = {}) {
|
|
128
|
+
const continueArgs = {
|
|
129
|
+
codex: "resume --last".split(" "),
|
|
130
|
+
claude: "--continue".split(" "),
|
|
131
|
+
gemini: []
|
|
132
|
+
};
|
|
133
|
+
process.stdin.setRawMode?.(true);
|
|
134
|
+
let isFatal = false;
|
|
135
|
+
const stdinReady = new ReadyManager;
|
|
136
|
+
const shellOutputStream = new TransformStream;
|
|
137
|
+
const outputWriter = shellOutputStream.writable.getWriter();
|
|
138
|
+
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"));
|
|
139
|
+
const getPtyOptions = () => ({
|
|
140
|
+
name: "xterm-color",
|
|
141
|
+
...getTerminalDimensions(),
|
|
142
|
+
cwd: cwd ?? process.cwd(),
|
|
143
|
+
env: env ?? process.env
|
|
144
|
+
});
|
|
145
|
+
const cliConf = CLI_CONFIGURES[cli] || {};
|
|
146
|
+
cliArgs = cliConf.ensureArgs?.(cliArgs) ?? cliArgs;
|
|
147
|
+
const cliCommand = cliConf?.binary || cli;
|
|
148
|
+
let shell = tryCatch(() => pty.spawn(cliCommand, cliArgs, getPtyOptions()), (error) => {
|
|
149
|
+
console.error(`Fatal: Failed to start ${cliCommand}.`);
|
|
150
|
+
if (cliConf?.install)
|
|
151
|
+
console.error(`If you did not installed it yet, Please install it first: ${cliConf.install}`);
|
|
152
|
+
throw error;
|
|
153
|
+
});
|
|
154
|
+
const pendingExitCode = Promise.withResolvers();
|
|
155
|
+
let pendingExitCodeValue = null;
|
|
156
|
+
async function onData(data) {
|
|
157
|
+
await outputWriter.write(data);
|
|
158
|
+
}
|
|
159
|
+
shell.onData(onData);
|
|
160
|
+
shell.onExit(function onExit({ exitCode: exitCode2 }) {
|
|
161
|
+
stdinReady.unready();
|
|
162
|
+
const agentCrashed = exitCode2 !== 0;
|
|
163
|
+
const continueArg = continueArgs[cli];
|
|
164
|
+
if (agentCrashed && continueOnCrash && continueArg) {
|
|
165
|
+
if (!continueArg) {
|
|
166
|
+
return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(", ")} currently, not ${cli}`);
|
|
167
|
+
}
|
|
168
|
+
if (isFatal) {
|
|
169
|
+
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
170
|
+
}
|
|
171
|
+
console.log(`${cli} crashed, restarting...`);
|
|
172
|
+
shell = pty.spawn(cli, continueArg, getPtyOptions());
|
|
173
|
+
shell.onData(onData);
|
|
174
|
+
shell.onExit(onExit);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
178
|
+
});
|
|
179
|
+
process.stdout.on("resize", () => {
|
|
180
|
+
const { cols, rows } = getTerminalDimensions();
|
|
181
|
+
shell.resize(cols, rows);
|
|
182
|
+
});
|
|
183
|
+
const terminalRender = new TerminalTextRender;
|
|
184
|
+
const isStillWorkingQ = () => terminalRender.render().replace(/\s+/g, " ").match(/esc to interrupt|to run in background/);
|
|
185
|
+
const idleWaiter = new IdleWaiter;
|
|
186
|
+
if (exitOnIdle)
|
|
187
|
+
idleWaiter.wait(exitOnIdle).then(async () => {
|
|
188
|
+
if (isStillWorkingQ()) {
|
|
189
|
+
console.log("[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet");
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
console.log("[${cli}-yes] ${cli} is idle, exiting...");
|
|
193
|
+
await exitAgent();
|
|
194
|
+
});
|
|
195
|
+
sflow(fromReadable(process.stdin)).map((buffer) => buffer.toString()).by({
|
|
196
|
+
writable: new WritableStream({
|
|
197
|
+
write: async (data) => {
|
|
198
|
+
await stdinReady.wait();
|
|
199
|
+
shell.write(data);
|
|
200
|
+
}
|
|
201
|
+
}),
|
|
202
|
+
readable: shellOutputStream.readable
|
|
203
|
+
}).forEach(() => idleWaiter.ping()).forEach((text) => {
|
|
204
|
+
terminalRender.write(text);
|
|
205
|
+
if (process.stdin.isTTY)
|
|
206
|
+
return;
|
|
207
|
+
if (text.includes("\x1B[6n"))
|
|
208
|
+
return;
|
|
209
|
+
const rendered = terminalRender.render();
|
|
210
|
+
const row = rendered.split(`
|
|
211
|
+
`).length + 1;
|
|
212
|
+
const col = (rendered.split(`
|
|
213
|
+
`).slice(-1)[0]?.length || 0) + 1;
|
|
214
|
+
shell.write(`\x1B[${row};${col}R`);
|
|
215
|
+
}).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).lines({ EOL: "NONE" }).forEach(async (e2, i) => {
|
|
216
|
+
const conf = CLI_CONFIGURES[cli] || null;
|
|
217
|
+
if (!conf)
|
|
218
|
+
return;
|
|
219
|
+
if (conf.ready?.some((rx) => e2.match(rx))) {
|
|
220
|
+
if (cli === "gemini" && i <= 80)
|
|
221
|
+
return;
|
|
222
|
+
stdinReady.ready();
|
|
223
|
+
}
|
|
224
|
+
if (conf.enter?.some((rx) => e2.match(rx)))
|
|
225
|
+
await sendEnter(300);
|
|
226
|
+
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
227
|
+
isFatal = true;
|
|
228
|
+
await exitAgent();
|
|
229
|
+
}
|
|
230
|
+
}).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);
|
|
231
|
+
if (prompt)
|
|
232
|
+
await sendMessage(prompt);
|
|
233
|
+
const exitCode = await pendingExitCode.promise;
|
|
234
|
+
console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
235
|
+
if (logFile) {
|
|
236
|
+
verbose && console.log(`[${cli}-yes] Writing rendered logs to ${logFile}`);
|
|
237
|
+
const logFilePath = path.resolve(logFile);
|
|
238
|
+
await mkdir(path.dirname(logFilePath), { recursive: true }).catch(() => null);
|
|
239
|
+
await writeFile(logFilePath, terminalRender.render());
|
|
240
|
+
}
|
|
241
|
+
return { exitCode, logs: terminalRender.render() };
|
|
242
|
+
async function sendEnter(waitms = 1000) {
|
|
243
|
+
const st = Date.now();
|
|
244
|
+
await idleWaiter.wait(waitms);
|
|
245
|
+
const et = Date.now();
|
|
246
|
+
process.stdout.write(`\ridleWaiter.wait(${waitms}) took ${et - st}ms\r`);
|
|
247
|
+
shell.write("\r");
|
|
248
|
+
}
|
|
249
|
+
async function sendMessage(message) {
|
|
250
|
+
await stdinReady.wait();
|
|
251
|
+
shell.write(message);
|
|
252
|
+
idleWaiter.ping();
|
|
253
|
+
await sendEnter();
|
|
254
|
+
}
|
|
255
|
+
async function exitAgent() {
|
|
256
|
+
continueOnCrash = false;
|
|
257
|
+
await sendMessage("/exit");
|
|
258
|
+
let exited = false;
|
|
259
|
+
await Promise.race([
|
|
260
|
+
pendingExitCode.promise.then(() => exited = true),
|
|
261
|
+
new Promise((resolve) => setTimeout(() => {
|
|
262
|
+
if (exited)
|
|
263
|
+
return;
|
|
264
|
+
shell.kill();
|
|
265
|
+
resolve();
|
|
266
|
+
}, 5000))
|
|
267
|
+
]);
|
|
268
|
+
}
|
|
269
|
+
function getTerminalDimensions() {
|
|
270
|
+
return {
|
|
271
|
+
cols: process.stdout.columns,
|
|
272
|
+
rows: process.stdout.rows
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function tryCatch(fn, catchFn) {
|
|
277
|
+
try {
|
|
278
|
+
return fn();
|
|
279
|
+
} catch (error) {
|
|
280
|
+
return catchFn(error);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// cli.ts
|
|
285
|
+
var argv = yargs(hideBin(process.argv)).usage("Usage: $0 [options] [claude args] [--] [prompts...]").example('$0 --exit-on-idle=30s --continue-on-crash "help me solve all todos in my codebase"', "Run Claude with a 30 seconds idle timeout and continue on crash").option("continue-on-crash", {
|
|
286
|
+
type: "boolean",
|
|
287
|
+
default: true,
|
|
288
|
+
description: "spawn Claude with --continue if it crashes, only works for claude"
|
|
289
|
+
}).option("log-file", {
|
|
290
|
+
type: "string",
|
|
291
|
+
description: "Log file to write to"
|
|
292
|
+
}).option("cli", {
|
|
293
|
+
type: "string",
|
|
294
|
+
description: 'Claude CLI command, e.g. "claude,gemini,codex,cursor,copilot", default is "claude"'
|
|
295
|
+
}).option("prompt", {
|
|
296
|
+
type: "string",
|
|
297
|
+
description: "Prompt to send to Claude",
|
|
298
|
+
alias: "p"
|
|
299
|
+
}).option("verbose", {
|
|
300
|
+
type: "boolean",
|
|
301
|
+
description: "Enable verbose logging",
|
|
302
|
+
default: false
|
|
303
|
+
}).option("exit-on-idle", {
|
|
304
|
+
type: "string",
|
|
305
|
+
description: 'Exit after a period of inactivity, e.g., "5s" or "1m"'
|
|
306
|
+
}).parserConfiguration({
|
|
307
|
+
"unknown-options-as-args": true,
|
|
308
|
+
"halt-at-non-option": true
|
|
309
|
+
}).parseSync();
|
|
310
|
+
if (!argv.cli) {
|
|
311
|
+
const cliName = process.argv[1]?.split("/").pop()?.split("-")[0];
|
|
312
|
+
argv.cli = cliName || "claude";
|
|
313
|
+
}
|
|
314
|
+
var rawArgs = process.argv.slice(2);
|
|
315
|
+
var dashIndex = rawArgs.indexOf("--");
|
|
316
|
+
var promptFromDash = undefined;
|
|
317
|
+
var cliArgsForSpawn = [];
|
|
318
|
+
if (dashIndex !== -1) {
|
|
319
|
+
const after = rawArgs.slice(dashIndex + 1);
|
|
320
|
+
promptFromDash = after.join(" ");
|
|
321
|
+
cliArgsForSpawn = rawArgs.slice(0, dashIndex).map(String);
|
|
322
|
+
} else {
|
|
323
|
+
cliArgsForSpawn = argv._.map((e) => String(e));
|
|
324
|
+
}
|
|
325
|
+
console.clear();
|
|
326
|
+
var { exitCode, logs } = await claudeYes({
|
|
327
|
+
cli: argv.cli,
|
|
328
|
+
prompt: argv.prompt || promptFromDash,
|
|
329
|
+
exitOnIdle: argv.exitOnIdle ? enhancedMs(argv.exitOnIdle) : undefined,
|
|
330
|
+
cliArgs: cliArgsForSpawn,
|
|
331
|
+
continueOnCrash: argv.continueOnCrash,
|
|
332
|
+
logFile: argv.logFile,
|
|
333
|
+
verbose: argv.verbose
|
|
334
|
+
});
|
|
335
|
+
process.exit(exitCode ?? 1);
|
|
336
|
+
|
|
337
|
+
//# debugId=7D0CC0B4FDA115C064756E2164756E21
|
|
338
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/index.js
CHANGED
|
@@ -69,21 +69,29 @@ function removeControlCharacters(str) {
|
|
|
69
69
|
|
|
70
70
|
// index.ts
|
|
71
71
|
var CLI_CONFIGURES = {
|
|
72
|
+
grok: {
|
|
73
|
+
install: "npm install -g @vibe-kit/grok-cli",
|
|
74
|
+
ready: [/^ │ ❯ /],
|
|
75
|
+
enter: [/^ 1. Yes/]
|
|
76
|
+
},
|
|
72
77
|
claude: {
|
|
73
|
-
|
|
78
|
+
install: "npm install -g @anthropic-ai/claude-code",
|
|
79
|
+
ready: [/^> /],
|
|
74
80
|
enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],
|
|
75
81
|
fatal: [
|
|
76
82
|
/No conversation found to continue/,
|
|
77
|
-
/⎿
|
|
83
|
+
/⎿ Claude usage limit reached\./
|
|
78
84
|
]
|
|
79
85
|
},
|
|
80
86
|
gemini: {
|
|
81
|
-
|
|
87
|
+
install: "npm install -g @google/gemini-cli",
|
|
88
|
+
ready: [/Type your message/],
|
|
82
89
|
enter: [/│ ● 1. Yes, allow once/],
|
|
83
90
|
fatal: []
|
|
84
91
|
},
|
|
85
92
|
codex: {
|
|
86
|
-
|
|
93
|
+
install: "npm install -g @openai/codex-cli",
|
|
94
|
+
ready: [/⏎ send/],
|
|
87
95
|
enter: [/ > 1. Approve/, /> 1. Yes, allow Codex to work in this folder/],
|
|
88
96
|
fatal: [/Error: The cursor position could not be read within/],
|
|
89
97
|
ensureArgs: (args) => {
|
|
@@ -93,15 +101,17 @@ var CLI_CONFIGURES = {
|
|
|
93
101
|
}
|
|
94
102
|
},
|
|
95
103
|
copilot: {
|
|
96
|
-
|
|
104
|
+
install: "npm install -g @github/copilot",
|
|
105
|
+
ready: [/^ > /],
|
|
97
106
|
enter: [/ │ ❯ 1. Yes, proceed/, /❯ 1. Yes/],
|
|
98
107
|
fatal: []
|
|
99
108
|
},
|
|
100
109
|
cursor: {
|
|
110
|
+
install: "open https://cursor.com/ja/docs/cli/installation",
|
|
101
111
|
binary: "cursor-agent",
|
|
102
|
-
ready: /\/ commands
|
|
112
|
+
ready: [/\/ commands/],
|
|
103
113
|
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
104
|
-
fatal: []
|
|
114
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
105
115
|
}
|
|
106
116
|
};
|
|
107
117
|
async function claudeYes({
|
|
@@ -136,7 +146,12 @@ async function claudeYes({
|
|
|
136
146
|
const cliConf = CLI_CONFIGURES[cli] || {};
|
|
137
147
|
cliArgs = cliConf.ensureArgs?.(cliArgs) ?? cliArgs;
|
|
138
148
|
const cliCommand = cliConf?.binary || cli;
|
|
139
|
-
let shell = pty.spawn(cliCommand, cliArgs, getPtyOptions())
|
|
149
|
+
let shell = tryCatch(() => pty.spawn(cliCommand, cliArgs, getPtyOptions()), (error) => {
|
|
150
|
+
console.error(`Fatal: Failed to start ${cliCommand}.`);
|
|
151
|
+
if (cliConf?.install)
|
|
152
|
+
console.error(`If you did not installed it yet, Please install it first: ${cliConf.install}`);
|
|
153
|
+
throw error;
|
|
154
|
+
});
|
|
140
155
|
const pendingExitCode = Promise.withResolvers();
|
|
141
156
|
let pendingExitCodeValue = null;
|
|
142
157
|
async function onData(data) {
|
|
@@ -152,7 +167,6 @@ async function claudeYes({
|
|
|
152
167
|
return console.warn(`continueOnCrash is only supported for ${Object.keys(continueArgs).join(", ")} currently, not ${cli}`);
|
|
153
168
|
}
|
|
154
169
|
if (isFatal) {
|
|
155
|
-
console.log(`${cli} crashed with "No conversation found to continue", exiting...`);
|
|
156
170
|
return pendingExitCode.resolve(pendingExitCodeValue = exitCode2);
|
|
157
171
|
}
|
|
158
172
|
console.log(`${cli} crashed, restarting...`);
|
|
@@ -203,35 +217,20 @@ async function claudeYes({
|
|
|
203
217
|
const conf = CLI_CONFIGURES[cli] || null;
|
|
204
218
|
if (!conf)
|
|
205
219
|
return;
|
|
206
|
-
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
for (const rx of conf.enter) {
|
|
217
|
-
if (e2.match(rx))
|
|
218
|
-
return await sendEnter();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if (conf.fatal && Array.isArray(conf.fatal)) {
|
|
222
|
-
for (const rx of conf.fatal) {
|
|
223
|
-
if (e2.match(rx))
|
|
224
|
-
return isFatal = true;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
} catch (err) {
|
|
228
|
-
return;
|
|
220
|
+
if (conf.ready?.some((rx) => e2.match(rx))) {
|
|
221
|
+
if (cli === "gemini" && i <= 80)
|
|
222
|
+
return;
|
|
223
|
+
stdinReady.ready();
|
|
224
|
+
}
|
|
225
|
+
if (conf.enter?.some((rx) => e2.match(rx)))
|
|
226
|
+
await sendEnter(300);
|
|
227
|
+
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
228
|
+
isFatal = true;
|
|
229
|
+
await exitAgent();
|
|
229
230
|
}
|
|
230
231
|
}).run()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout)).then(() => null);
|
|
231
232
|
if (prompt)
|
|
232
|
-
|
|
233
|
-
await sendMessage(prompt);
|
|
234
|
-
})();
|
|
233
|
+
await sendMessage(prompt);
|
|
235
234
|
const exitCode = await pendingExitCode.promise;
|
|
236
235
|
console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
237
236
|
if (logFile) {
|
|
@@ -270,16 +269,23 @@ async function claudeYes({
|
|
|
270
269
|
}
|
|
271
270
|
function getTerminalDimensions() {
|
|
272
271
|
return {
|
|
273
|
-
cols:
|
|
272
|
+
cols: process.stdout.columns,
|
|
274
273
|
rows: process.stdout.rows
|
|
275
274
|
};
|
|
276
275
|
}
|
|
277
276
|
}
|
|
277
|
+
function tryCatch(fn, catchFn) {
|
|
278
|
+
try {
|
|
279
|
+
return fn();
|
|
280
|
+
} catch (error) {
|
|
281
|
+
return catchFn(error);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
278
284
|
export {
|
|
279
285
|
removeControlCharacters,
|
|
280
286
|
claudeYes as default,
|
|
281
287
|
CLI_CONFIGURES
|
|
282
288
|
};
|
|
283
289
|
|
|
284
|
-
//# debugId=
|
|
290
|
+
//# debugId=8E417C3F5F6C5D9864756E2164756E21
|
|
285
291
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../index.ts", "../idleWaiter.ts", "../ReadyManager.ts", "../removeControlCharacters.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { 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';\nimport { IdleWaiter } from './idleWaiter';\nimport { ReadyManager } from './ReadyManager';\nimport { removeControlCharacters } from './removeControlCharacters';\n\nexport const CLI_CONFIGURES: Record<\n string,\n {\n binary?: string; // actual binary name if different from cli\n ready?: RegExp; // regex matcher for stdin ready, or line index for gemini\n enter?: RegExp[]; // array of regex to match for sending Enter\n fatal?: RegExp[]; // array of regex to match for fatal errors\n ensureArgs?: (args: string[]) => string[]; // function to ensure certain args are present\n }\n> = {\n claude: {\n ready: /^> /, // regex matcher for stdin ready,\n enter: [/❯ 1. Yes/, /❯ 1. Dark mode✔/, /Press Enter to continue…/],\n fatal: [\n /No conversation found to continue/,\n /⎿ {2}Claude usage limit reached\\./,\n ],\n },\n gemini: {\n // match the agent prompt after initial lines; handled by index logic using line index\n ready: /Type your message/, // used with line index check\n enter: [/│ ● 1. Yes, allow once/],\n fatal: [],\n },\n codex: {\n ready: /⏎ send/,\n enter: [/ > 1. Approve/, /> 1. Yes, allow Codex to work in this folder/],\n fatal: [/Error: The cursor position could not be read within/],\n // add to codex --search by default when not provided by the user\n ensureArgs: (args: string[]) => {\n if (!args.includes('--search')) return ['--search', ...args];\n return args;\n },\n },\n copilot: {\n ready: /^ > /,\n enter: [/ │ ❯ 1. Yes, proceed/, /❯ 1. Yes/],\n fatal: [],\n },\n cursor: {\n // map logical \"cursor\" cli name to actual binary name\n binary: 'cursor-agent',\n ready: /\\/ commands/,\n enter: [/→ Run \\(once\\) \\(y\\) \\(enter\\)/, /▶ \\[a\\] Trust this workspace/],\n fatal: [],\n },\n};\n/**\n * Main function to run Claude with automatic yes/no responses\n * @param options Configuration options\n * @param options.continueOnCrash - If true, automatically restart Claude when it crashes:\n * 1. Shows message 'Claude crashed, restarting..'\n * 2. Spawns a new 'claude --continue' process\n * 3. Re-attaches the new process to the shell stdio (pipes new process stdin/stdout)\n * 4. If it crashes with \"No conversation found to continue\", exits the process\n * @param options.exitOnIdle - Exit when Claude is idle. Boolean or timeout in milliseconds, recommended 5000 - 60000, default is false\n * @param options.claudeArgs - Additional arguments to pass to the Claude CLI\n * @param options.removeControlCharactersFromStdout - Remove ANSI control characters from stdout. Defaults to !process.stdout.isTTY\n *\n * @example\n * ```typescript\n * import claudeYes from 'claude-yes';\n * await claudeYes({\n * prompt: 'help me solve all todos in my codebase',\n *\n * // optional\n * cli: 'claude',\n * cliArgs: ['--verbose'], // additional args to pass to claude\n * exitOnIdle: 30000, // exit after 30 seconds of idle\n * continueOnCrash: true, // restart if claude crashes, default is true\n * logFile: 'claude.log', // save logs to file\n * });\n * ```\n */\nexport default async function claudeYes({\n cli = 'claude',\n cliArgs = [],\n prompt,\n continueOnCrash,\n cwd,\n env,\n exitOnIdle,\n logFile,\n removeControlCharactersFromStdout = false, // = !process.stdout.isTTY,\n verbose = false,\n}: {\n cli?: (string & {}) | keyof typeof CLI_CONFIGURES;\n cliArgs?: string[];\n prompt?: string;\n continueOnCrash?: boolean;\n cwd?: string;\n env?: Record<string, string>;\n exitOnIdle?: number;\n logFile?: string;\n removeControlCharactersFromStdout?: boolean;\n verbose?: boolean;\n} = {}) {\n const continueArgs = {\n codex: 'resume --last'.split(' '),\n claude: '--continue'.split(' '),\n gemini: [], // not possible yet\n };\n\n // if (verbose) {\n // console.log('calling claudeYes: ', {\n // cli,\n // continueOnCrash,\n // exitOnIdle,\n // cliArgs,\n // cwd,\n // removeControlCharactersFromStdout,\n // logFile,\n // verbose,\n // });\n // }\n // console.log(\n // `⭐ Starting ${cli}, automatically responding to yes/no prompts...`\n // );\n // console.log(\n // '⚠️ 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.'\n // );\n\n process.stdin.setRawMode?.(true); // must be called any stdout/stdin usage\n let isFatal = false; // match 'No conversation found to continue'\n const stdinReady = new ReadyManager();\n\n const shellOutputStream = new TransformStream<string, string>();\n const outputWriter = shellOutputStream.writable.getWriter();\n // const pty = await import('node-pty');\n\n // its recommened to use bun-pty in windows\n const pty = await import('node-pty')\n .catch(async () => await import('bun-pty'))\n .catch(async () =>\n DIE('Please install node-pty or bun-pty, run this: bun install bun-pty'),\n );\n\n const getPtyOptions = () => ({\n name: 'xterm-color',\n ...getTerminalDimensions(),\n cwd: cwd ?? process.cwd(),\n env: env ?? (process.env as Record<string, string>),\n });\n\n // Apply CLI specific configurations (moved to CLI_CONFIGURES)\n const cliConf = (CLI_CONFIGURES as Record<string, any>)[cli] || {};\n cliArgs = cliConf.ensureArgs?.(cliArgs) ?? cliArgs;\n const cliCommand = cliConf?.binary || cli;\n\n let shell = pty.spawn(cliCommand, cliArgs, getPtyOptions());\n const pendingExitCode = Promise.withResolvers<number | null>();\n let pendingExitCodeValue = null;\n\n // TODO handle error if claude is not installed, show msg:\n // npm install -g @anthropic-ai/claude-code\n\n async function onData(data: string) {\n // append data to the buffer, so we can process it later\n await outputWriter.write(data);\n }\n\n shell.onData(onData);\n shell.onExit(function onExit({ exitCode }) {\n stdinReady.unready(); // start buffer stdin\n const agentCrashed = exitCode !== 0;\n const continueArg = (continueArgs as Record<string, string[]>)[cli];\n\n if (agentCrashed && continueOnCrash && continueArg) {\n if (!continueArg) {\n return console.warn(\n `continueOnCrash is only supported for ${Object.keys(continueArgs).join(', ')} currently, not ${cli}`,\n );\n }\n if (isFatal) {\n console.log(\n `${cli} crashed with \"No conversation found to continue\", exiting...`,\n );\n return pendingExitCode.resolve((pendingExitCodeValue = exitCode));\n }\n console.log(`${cli} crashed, restarting...`);\n\n shell = pty.spawn(cli, continueArg, getPtyOptions());\n shell.onData(onData);\n shell.onExit(onExit);\n return;\n }\n return pendingExitCode.resolve((pendingExitCodeValue = exitCode));\n });\n\n // when current tty resized, resize the pty\n process.stdout.on('resize', () => {\n const { cols, rows } = getTerminalDimensions(); // minimum 80 columns to avoid layout issues\n shell.resize(cols, rows); // minimum 80 columns to avoid layout issues\n });\n\n const terminalRender = new TerminalTextRender();\n const isStillWorkingQ = () =>\n terminalRender\n .render()\n .replace(/\\s+/g, ' ')\n .match(/esc to interrupt|to run in background/);\n\n const idleWaiter = new IdleWaiter();\n if (exitOnIdle)\n idleWaiter.wait(exitOnIdle).then(async () => {\n if (isStillWorkingQ()) {\n console.log(\n '[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet',\n );\n return;\n }\n\n console.log('[${cli}-yes] ${cli} is idle, exiting...');\n await exitAgent();\n });\n\n // Message streaming\n sflow(fromReadable<Buffer>(process.stdin))\n .map((buffer) => buffer.toString())\n // .map((e) => e.replaceAll('\\x1a', '')) // remove ctrl+z from user's input (seems bug)\n // .forEach(e => appendFile('.cache/io.log', \"input |\" + JSON.stringify(e) + '\\n')) // for debugging\n // pipe\n .by({\n writable: new WritableStream<string>({\n write: async (data) => {\n await stdinReady.wait();\n // await idleWaiter.wait(20); // wait for idle for 200ms to avoid messing up claude's input\n shell.write(data);\n },\n }),\n readable: shellOutputStream.readable,\n })\n .forEach(() => idleWaiter.ping())\n .forEach((text) => {\n terminalRender.write(text);\n // todo: .onStatus((msg)=> shell.write(msg))\n if (process.stdin.isTTY) return; // only handle it when stdin is not tty\n if (text.includes('\\u001b[6n')) return; // only asked\n\n // todo: use terminalRender API to get cursor position when new version is available\n // xterm replies CSI row; column R if asked cursor position\n // https://en.wikipedia.org/wiki/ANSI_escape_code#:~:text=citation%20needed%5D-,xterm%20replies,-CSI%20row%C2%A0%3B\n // when agent asking position, respond with row; col\n const rendered = terminalRender.render();\n const row = rendered.split('\\n').length + 1;\n const col = (rendered.split('\\n').slice(-1)[0]?.length || 0) + 1;\n shell.write(`\\u001b[${row};${col}R`);\n })\n\n // auto-response\n .forkTo((e) =>\n e\n .map((e) => removeControlCharacters(e))\n .map((e) => e.replaceAll('\\r', '')) // remove carriage return\n .lines({ EOL: 'NONE' })\n // Generic auto-response handler driven by CLI_CONFIGURES\n .forEach(async (e, i) => {\n const conf =\n CLI_CONFIGURES[cli as keyof typeof CLI_CONFIGURES] || null;\n if (!conf) return;\n\n try {\n // ready matcher: if matched, mark stdin ready\n if (conf.ready) {\n // special-case gemini to avoid initial prompt noise: only after many lines\n if (cli === 'gemini' && conf.ready instanceof RegExp) {\n if (e.match(conf.ready) && i > 80) return stdinReady.ready();\n } else if (e.match(conf.ready)) {\n return stdinReady.ready();\n }\n }\n\n // enter matchers: send Enter when any enter regex matches\n if (conf.enter && Array.isArray(conf.enter)) {\n for (const rx of conf.enter) {\n if (e.match(rx)) return await sendEnter();\n }\n }\n\n // fatal matchers: set isFatal flag when matched\n if (conf.fatal && Array.isArray(conf.fatal)) {\n for (const rx of conf.fatal) {\n if (e.match(rx)) return (isFatal = true);\n }\n }\n } catch (err) {\n // defensive: if e.match throws (e.g., not a string), ignore\n return;\n }\n })\n // .forEach(e => appendFile('.cache/io.log', \"output|\" + JSON.stringify(e) + '\\n')) // for debugging\n .run(),\n )\n .map((e) =>\n removeControlCharactersFromStdout ? removeControlCharacters(e) : e,\n )\n .to(fromWritable(process.stdout))\n .then(() => null); // run it immediately without await\n\n // wait for cli ready and send prompt if provided\n if (prompt)\n (async () => {\n // console.log(`[${cli}-yes] Ready to send prompt to ${cli}: ${prompt}`);\n // idleWaiter.ping();\n // console.log(\n // 'await idleWaiter.wait(1000); // wait a bit for claude to start'\n // );\n // await idleWaiter.wait(1000); // wait a bit for claude to start\n // console.log('await stdinReady.wait();');\n // await stdinReady.wait();\n // console.log(`[${cli}-yes] Waiting for ${cli} to be ready...`);\n // console.log('await idleWaiter.wait(200);');\n // await idleWaiter.wait(200);\n // console.log(`[${cli}-yes] Sending prompt to ${cli}: ${prompt}`);\n await sendMessage(prompt);\n })();\n\n const exitCode = await pendingExitCode.promise; // wait for the shell to exit\n console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);\n\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(\n () => null,\n );\n await writeFile(logFilePath, terminalRender.render());\n }\n\n return { exitCode, logs: terminalRender.render() };\n\n async function sendEnter(waitms = 1000) {\n // wait for idle for a bit to let agent cli finish rendering\n const st = Date.now();\n\n await idleWaiter.wait(waitms);\n const et = Date.now();\n process.stdout.write(`\\ridleWaiter.wait(${waitms}) took ${et - st}ms\\r`);\n\n shell.write('\\r');\n }\n\n async function sendMessage(message: string) {\n await stdinReady.wait();\n // show in-place message: write msg and move cursor back start\n shell.write(message);\n idleWaiter.ping(); // just sent a message, wait for echo\n await sendEnter();\n }\n\n async function exitAgent() {\n continueOnCrash = false;\n // send exit command to the shell, must sleep a bit to avoid claude treat it as pasted input\n await sendMessage('/exit');\n\n // wait for shell to exit or kill it with a timeout\n let exited = false;\n await Promise.race([\n pendingExitCode.promise.then(() => (exited = true)), // resolve when shell exits\n\n // if shell doesn't exit in 5 seconds, kill it\n new Promise<void>((resolve) =>\n setTimeout(() => {\n if (exited) return; // if shell already exited, do nothing\n shell.kill(); // kill the shell process if it doesn't exit in time\n resolve();\n }, 5000),\n ), // 5 seconds timeout\n ]);\n }\n\n function getTerminalDimensions() {\n return {\n cols: Math.max(process.stdout.columns, 80),\n rows: process.stdout.rows,\n };\n }\n}\n\nexport { removeControlCharacters };\n",
|
|
5
|
+
"import { 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';\nimport { IdleWaiter } from './idleWaiter';\nimport { ReadyManager } from './ReadyManager';\nimport { removeControlCharacters } from './removeControlCharacters';\n\nexport const CLI_CONFIGURES: Record<\n string,\n {\n install?: string; // hint user for install command if not installed\n binary?: string; // actual binary name if different from cli\n ready?: RegExp[]; // regex matcher for stdin ready, or line index for gemini\n enter?: RegExp[]; // array of regex to match for sending Enter\n fatal?: RegExp[]; // array of regex to match for fatal errors\n ensureArgs?: (args: string[]) => string[]; // function to ensure certain args are present\n }\n> = {\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: [/^> /], // regex matcher for stdin 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 // match the agent prompt after initial lines; handled by index logic using line index\n ready: [/Type your message/], // used with line index check\n enter: [/│ ● 1. Yes, allow once/],\n fatal: [],\n },\n codex: {\n install: 'npm install -g @openai/codex-cli',\n ready: [/⏎ send/],\n enter: [/ > 1. Approve/, /> 1. Yes, allow Codex to work in this folder/],\n fatal: [/Error: The cursor position could not be read within/],\n // add to codex --search by default when not provided by the user\n ensureArgs: (args: string[]) => {\n if (!args.includes('--search')) 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 // map logical \"cursor\" cli name to actual binary name\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};\n/**\n * Main function to run Claude with automatic yes/no responses\n * @param options Configuration options\n * @param options.continueOnCrash - If true, automatically restart Claude when it crashes:\n * 1. Shows message 'Claude crashed, restarting..'\n * 2. Spawns a new 'claude --continue' process\n * 3. Re-attaches the new process to the shell stdio (pipes new process stdin/stdout)\n * 4. If it crashes with \"No conversation found to continue\", exits the process\n * @param options.exitOnIdle - Exit when Claude is idle. Boolean or timeout in milliseconds, recommended 5000 - 60000, default is false\n * @param options.claudeArgs - Additional arguments to pass to the Claude CLI\n * @param options.removeControlCharactersFromStdout - Remove ANSI control characters from stdout. Defaults to !process.stdout.isTTY\n *\n * @example\n * ```typescript\n * import claudeYes from 'claude-yes';\n * await claudeYes({\n * prompt: 'help me solve all todos in my codebase',\n *\n * // optional\n * cli: 'claude',\n * cliArgs: ['--verbose'], // additional args to pass to claude\n * exitOnIdle: 30000, // exit after 30 seconds of idle\n * continueOnCrash: true, // restart if claude crashes, default is true\n * logFile: 'claude.log', // save logs to file\n * });\n * ```\n */\nexport default async function claudeYes({\n cli = 'claude',\n cliArgs = [],\n prompt,\n continueOnCrash,\n cwd,\n env,\n exitOnIdle,\n logFile,\n removeControlCharactersFromStdout = false, // = !process.stdout.isTTY,\n verbose = false,\n}: {\n cli?: (string & {}) | keyof typeof CLI_CONFIGURES;\n cliArgs?: string[];\n prompt?: string;\n continueOnCrash?: boolean;\n cwd?: string;\n env?: Record<string, string>;\n exitOnIdle?: number;\n logFile?: string;\n removeControlCharactersFromStdout?: boolean;\n verbose?: boolean;\n} = {}) {\n const continueArgs = {\n codex: 'resume --last'.split(' '),\n claude: '--continue'.split(' '),\n gemini: [], // not possible yet\n };\n\n // if (verbose) {\n // console.log('calling claudeYes: ', {\n // cli,\n // continueOnCrash,\n // exitOnIdle,\n // cliArgs,\n // cwd,\n // removeControlCharactersFromStdout,\n // logFile,\n // verbose,\n // });\n // }\n // console.log(\n // `⭐ Starting ${cli}, automatically responding to yes/no prompts...`\n // );\n // console.log(\n // '⚠️ 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.'\n // );\n\n process.stdin.setRawMode?.(true); // must be called any stdout/stdin usage\n let isFatal = false; // when true, do not restart on crash, and exit agent\n const stdinReady = new ReadyManager();\n\n const shellOutputStream = new TransformStream<string, string>();\n const outputWriter = shellOutputStream.writable.getWriter();\n // const pty = await import('node-pty');\n\n // its recommened to use bun-pty in windows\n const pty = await import('node-pty')\n .catch(async () => await import('bun-pty'))\n .catch(async () =>\n DIE('Please install node-pty or bun-pty, run this: bun install bun-pty'),\n );\n\n const getPtyOptions = () => ({\n name: 'xterm-color',\n ...getTerminalDimensions(),\n cwd: cwd ?? process.cwd(),\n env: env ?? (process.env as Record<string, string>),\n });\n\n // Apply CLI specific configurations (moved to CLI_CONFIGURES)\n const cliConf = (CLI_CONFIGURES as Record<string, any>)[cli] || {};\n cliArgs = cliConf.ensureArgs?.(cliArgs) ?? cliArgs;\n const cliCommand = cliConf?.binary || cli;\n\n let shell = tryCatch(\n () => pty.spawn(cliCommand, cliArgs, getPtyOptions()),\n (error: unknown) => {\n console.error(`Fatal: Failed to start ${cliCommand}.`);\n if (cliConf?.install)\n console.error(\n `If you did not installed it yet, Please install it first: ${cliConf.install}`,\n );\n throw error;\n },\n );\n const pendingExitCode = Promise.withResolvers<number | null>();\n let pendingExitCodeValue = null;\n\n // TODO handle error if claude is not installed, show msg:\n // npm install -g @anthropic-ai/claude-code\n\n async function onData(data: string) {\n // append data to the buffer, so we can process it later\n await outputWriter.write(data);\n }\n\n shell.onData(onData);\n shell.onExit(function onExit({ exitCode }) {\n stdinReady.unready(); // start buffer stdin\n const agentCrashed = exitCode !== 0;\n const continueArg = (continueArgs as Record<string, string[]>)[cli];\n\n if (agentCrashed && continueOnCrash && continueArg) {\n if (!continueArg) {\n return console.warn(\n `continueOnCrash is only supported for ${Object.keys(continueArgs).join(', ')} currently, not ${cli}`,\n );\n }\n if (isFatal) {\n return pendingExitCode.resolve((pendingExitCodeValue = exitCode));\n }\n\n console.log(`${cli} crashed, restarting...`);\n\n shell = pty.spawn(cli, continueArg, getPtyOptions());\n shell.onData(onData);\n shell.onExit(onExit);\n return;\n }\n return pendingExitCode.resolve((pendingExitCodeValue = exitCode));\n });\n\n // when current tty resized, resize the pty\n process.stdout.on('resize', () => {\n const { cols, rows } = getTerminalDimensions(); // minimum 80 columns to avoid layout issues\n shell.resize(cols, rows); // minimum 80 columns to avoid layout issues\n });\n\n const terminalRender = new TerminalTextRender();\n const isStillWorkingQ = () =>\n terminalRender\n .render()\n .replace(/\\s+/g, ' ')\n .match(/esc to interrupt|to run in background/);\n\n const idleWaiter = new IdleWaiter();\n if (exitOnIdle)\n idleWaiter.wait(exitOnIdle).then(async () => {\n if (isStillWorkingQ()) {\n console.log(\n '[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet',\n );\n return;\n }\n\n console.log('[${cli}-yes] ${cli} is idle, exiting...');\n await exitAgent();\n });\n\n // Message streaming\n sflow(fromReadable<Buffer>(process.stdin))\n .map((buffer) => buffer.toString())\n // .map((e) => e.replaceAll('\\x1a', '')) // remove ctrl+z from user's input (seems bug)\n // .forEach(e => appendFile('.cache/io.log', \"input |\" + JSON.stringify(e) + '\\n')) // for debugging\n // pipe\n .by({\n writable: new WritableStream<string>({\n write: async (data) => {\n await stdinReady.wait();\n // await idleWaiter.wait(20); // wait for idle for 200ms to avoid messing up claude's input\n shell.write(data);\n },\n }),\n readable: shellOutputStream.readable,\n })\n .forEach(() => idleWaiter.ping())\n .forEach((text) => {\n terminalRender.write(text);\n // todo: .onStatus((msg)=> shell.write(msg))\n if (process.stdin.isTTY) return; // only handle it when stdin is not tty\n if (text.includes('\\u001b[6n')) return; // only asked\n\n // todo: use terminalRender API to get cursor position when new version is available\n // xterm replies CSI row; column R if asked cursor position\n // https://en.wikipedia.org/wiki/ANSI_escape_code#:~:text=citation%20needed%5D-,xterm%20replies,-CSI%20row%C2%A0%3B\n // when agent asking position, respond with row; col\n const rendered = terminalRender.render();\n const row = rendered.split('\\n').length + 1;\n const col = (rendered.split('\\n').slice(-1)[0]?.length || 0) + 1;\n shell.write(`\\u001b[${row};${col}R`);\n })\n\n // auto-response\n .forkTo((e) =>\n e\n .map((e) => removeControlCharacters(e))\n .map((e) => e.replaceAll('\\r', '')) // remove carriage return\n .lines({ EOL: 'NONE' })\n // Generic auto-response handler driven by CLI_CONFIGURES\n .forEach(async (e, i) => {\n const conf =\n CLI_CONFIGURES[cli as keyof typeof CLI_CONFIGURES] || null;\n if (!conf) return;\n\n // ready matcher: if matched, mark stdin ready\n if (conf.ready?.some((rx: RegExp) => e.match(rx))) {\n if (cli === 'gemini' && i <= 80) return; // gemini initial noise, only after many lines\n stdinReady.ready();\n }\n\n // enter matchers: send Enter when any enter regex matches\n if (conf.enter?.some((rx: RegExp) => e.match(rx)))\n await sendEnter(300); // send Enter after 300ms idle wait\n\n // fatal matchers: set isFatal flag when matched\n if (conf.fatal?.some((rx: RegExp) => e.match(rx))) {\n isFatal = true;\n await exitAgent();\n }\n })\n // .forEach(e => appendFile('.cache/io.log', \"output|\" + JSON.stringify(e) + '\\n')) // for debugging\n .run(),\n )\n .map((e) =>\n removeControlCharactersFromStdout ? removeControlCharacters(e) : e,\n )\n .to(fromWritable(process.stdout))\n .then(() => null); // run it immediately without await\n\n // wait for cli ready and send prompt if provided\n if (prompt) await sendMessage(prompt);\n\n const exitCode = await pendingExitCode.promise; // wait for the shell to exit\n console.log(`[${cli}-yes] ${cli} exited with code ${exitCode}`);\n\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(\n () => null,\n );\n await writeFile(logFilePath, terminalRender.render());\n }\n\n return { exitCode, logs: terminalRender.render() };\n\n async function sendEnter(waitms = 1000) {\n // wait for idle for a bit to let agent cli finish rendering\n const st = Date.now();\n\n await idleWaiter.wait(waitms);\n const et = Date.now();\n process.stdout.write(`\\ridleWaiter.wait(${waitms}) took ${et - st}ms\\r`);\n\n shell.write('\\r');\n }\n\n async function sendMessage(message: string) {\n await stdinReady.wait();\n // show in-place message: write msg and move cursor back start\n shell.write(message);\n idleWaiter.ping(); // just sent a message, wait for echo\n await sendEnter();\n }\n\n async function exitAgent() {\n continueOnCrash = false;\n // send exit command to the shell, must sleep a bit to avoid claude treat it as pasted input\n await sendMessage('/exit');\n\n // wait for shell to exit or kill it with a timeout\n let exited = false;\n await Promise.race([\n pendingExitCode.promise.then(() => (exited = true)), // resolve when shell exits\n\n // if shell doesn't exit in 5 seconds, kill it\n new Promise<void>((resolve) =>\n setTimeout(() => {\n if (exited) return; // if shell already exited, do nothing\n shell.kill(); // kill the shell process if it doesn't exit in time\n resolve();\n }, 5000),\n ), // 5 seconds timeout\n ]);\n }\n\n function getTerminalDimensions() {\n return {\n // TODO: enforce minimum cols/rows to avoid layout issues\n // cols: Math.max(process.stdout.columns, 80),\n cols: process.stdout.columns,\n rows: process.stdout.rows,\n };\n }\n}\n\nexport { removeControlCharacters };\n\nfunction tryCatch<T, R>(fn: () => T, catchFn: (error: unknown) => R): T | R {\n try {\n return fn();\n } catch (error) {\n return catchFn(error);\n }\n}\n",
|
|
6
6
|
"/**\n * A utility class to wait for idle periods based on activity pings.\n *\n * @example\n * const idleWaiter = new IdleWaiter();\n *\n * // Somewhere in your code, when activity occurs:\n * idleWaiter.ping();\n *\n * // To wait for an idle period of 5 seconds:\n * await idleWaiter.wait(5000);\n * console.log('System has been idle for 5 seconds');\n */\nexport class IdleWaiter {\n lastActivityTime = Date.now();\n checkInterval = 100; // Default check interval in milliseconds\n\n constructor() {\n this.ping();\n }\n\n ping() {\n this.lastActivityTime = Date.now();\n return this;\n }\n\n async wait(ms: number) {\n while (this.lastActivityTime >= Date.now() - ms)\n await new Promise((resolve) => setTimeout(resolve, this.checkInterval));\n }\n}\n",
|
|
7
7
|
"export class ReadyManager {\n private isReady = false;\n private readyQueue: (() => void)[] = [];\n wait() {\n if (this.isReady) return;\n return new Promise<void>((resolve) => this.readyQueue.push(resolve));\n }\n unready() {\n this.isReady = false;\n }\n ready() {\n this.isReady = true;\n if (!this.readyQueue.length) return; // check len for performance\n this.readyQueue.splice(0).map((resolve) => resolve());\n }\n}\n",
|
|
8
8
|
"export function removeControlCharacters(str: string): string {\n // Matches control characters in the C0 and C1 ranges, including Delete (U+007F)\n return str.replace(\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n '',\n );\n}\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;ACQO,MAAM,WAAW;AAAA,EACtB,mBAAmB,KAAK,IAAI;AAAA,EAC5B,gBAAgB;AAAA,EAEhB,WAAW,GAAG;AAAA,IACZ,KAAK,KAAK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