claude-yes 1.12.0-beta.1 → 1.12.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/dist/cli.js CHANGED
@@ -5076,15 +5076,6 @@ function sleepms(ms) {
5076
5076
  }
5077
5077
 
5078
5078
  // index.ts
5079
- if (__require.main == __require.module)
5080
- await main();
5081
- async function main() {
5082
- await claudeYes({
5083
- continueOnCrash: true,
5084
- exitOnIdle: 1e4,
5085
- claudeArgs: ["say hello and exit"]
5086
- });
5087
- }
5088
5079
  async function claudeYes({
5089
5080
  continueOnCrash,
5090
5081
  exitOnIdle,
@@ -5182,7 +5173,7 @@ async function claudeYes({
5182
5173
  errorNoConversation = true;
5183
5174
  return;
5184
5175
  }
5185
- }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).map((e) => !process.stdout.isTTY ? removeControlCharacters(e) : e).to(fromWritable(process.stdout));
5176
+ }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).to(fromWritable(process.stdout));
5186
5177
  }
5187
5178
  // node_modules/enhanced-ms/dist/index.js
5188
5179
  var units = {
package/dist/index.js CHANGED
@@ -4856,15 +4856,6 @@ function sleepms(ms) {
4856
4856
  }
4857
4857
 
4858
4858
  // index.ts
4859
- if (__require.main == __require.module)
4860
- await main();
4861
- async function main() {
4862
- await claudeYes({
4863
- continueOnCrash: true,
4864
- exitOnIdle: 1e4,
4865
- claudeArgs: ["say hello and exit"]
4866
- });
4867
- }
4868
4859
  async function claudeYes({
4869
4860
  continueOnCrash,
4870
4861
  exitOnIdle,
@@ -4962,7 +4953,7 @@ async function claudeYes({
4962
4953
  errorNoConversation = true;
4963
4954
  return;
4964
4955
  }
4965
- }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).map((e) => !process.stdout.isTTY ? removeControlCharacters(e) : e).to(fromWritable(process.stdout));
4956
+ }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).to(fromWritable(process.stdout));
4966
4957
  }
4967
4958
  export {
4968
4959
  removeControlCharacters,
package/index.ts CHANGED
@@ -4,15 +4,15 @@ import { createIdleWatcher } from "./createIdleWatcher";
4
4
  import { removeControlCharacters } from "./removeControlCharacters";
5
5
  import { sleepms } from "./utils";
6
6
 
7
- if (import.meta.main) await main();
8
-
9
- async function main() {
10
- await claudeYes({
11
- continueOnCrash: true,
12
- exitOnIdle: 10000,
13
- claudeArgs: ["say hello and exit"]
14
- })
15
- }
7
+ // for debug only
8
+ // if (import.meta.main) await main();
9
+ // async function main() {
10
+ // await claudeYes({
11
+ // continueOnCrash: true,
12
+ // exitOnIdle: 10000,
13
+ // claudeArgs: ["say hello and exit"]
14
+ // })
15
+ // }
16
16
 
17
17
  /**
18
18
  * Main function to run Claude with automatic yes/no respojnses
@@ -41,10 +41,10 @@ export default async function claudeYes({
41
41
  typeof exitOnIdle === "number" ? exitOnIdle : defaultTimeout;
42
42
 
43
43
  console.log(
44
- "⭐ Starting claude, automatically responding to yes/no prompts..."
44
+ "⭐ Starting claude, automatically responding to yes/no prompts...",
45
45
  );
46
46
  console.log(
47
- "⚠️ 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."
47
+ "⚠️ 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.",
48
48
  );
49
49
 
50
50
  process.stdin.setRawMode?.(true); //must be called any stdout/stdin usage
@@ -55,8 +55,8 @@ export default async function claudeYes({
55
55
  const shellOutputStream = new TransformStream<string, string>();
56
56
  const outputWriter = shellOutputStream.writable.getWriter();
57
57
  const pty = globalThis.Bun
58
- ? await import('bun-pty')
59
- : await import('node-pty');
58
+ ? await import("bun-pty")
59
+ : await import("node-pty");
60
60
  let shell = pty.spawn("claude", claudeArgs, {
61
61
  name: "xterm-color",
62
62
  cols: process.stdout.columns - PREFIXLENGTH,
@@ -77,7 +77,7 @@ export default async function claudeYes({
77
77
  if (continueOnCrash && exitCode !== 0) {
78
78
  if (errorNoConversation) {
79
79
  console.log(
80
- 'Claude crashed with "No conversation found to continue", exiting...'
80
+ 'Claude crashed with "No conversation found to continue", exiting...',
81
81
  );
82
82
  void process.exit(exitCode);
83
83
  }
@@ -112,7 +112,7 @@ export default async function claudeYes({
112
112
  shell.onExit(() => {
113
113
  resolve();
114
114
  exited = true;
115
- })
115
+ }),
116
116
  ), // resolve when shell exits
117
117
  // if shell doesn't exit in 5 seconds, kill it
118
118
  new Promise<void>((resolve) =>
@@ -120,7 +120,7 @@ export default async function claudeYes({
120
120
  if (exited) return; // if shell already exited, do nothing
121
121
  shell.kill(); // kill the shell process if it doesn't exit in time
122
122
  resolve();
123
- }, 5000)
123
+ }, 5000),
124
124
  ), // 5 seconds timeout
125
125
  ]);
126
126
  };
@@ -134,7 +134,7 @@ export default async function claudeYes({
134
134
  const shellStdio = {
135
135
  writable: new WritableStream<string>({
136
136
  write: (data) => shell.write(data),
137
- close: () => { },
137
+ close: () => {},
138
138
  }),
139
139
  readable: shellOutputStream.readable,
140
140
  };
@@ -167,11 +167,11 @@ export default async function claudeYes({
167
167
  }
168
168
  })
169
169
  // .forEach(e => appendFile('.cache/io.log', "output|" + JSON.stringify(e) + '\n')) // for debugging
170
- .run()
170
+ .run(),
171
171
  )
172
172
  .replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line) // add prefix
173
173
  .forEach(() => idleWatcher.ping()) // ping the idle watcher on output for last active time to keep track of claude status
174
- .map((e) => (!process.stdout.isTTY ? removeControlCharacters(e) : e)) // remove control characters if output is not a TTY
174
+ // .map((e) => (!process.stdout.isTTY ? removeControlCharacters(e) : e)) // remove control characters if output is not a TTY
175
175
  .to(fromWritable(process.stdout));
176
176
  }
177
177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.12.0-beta.1",
3
+ "version": "1.12.1",
4
4
  "homepage": "https://github.com/snomiao/claude-yes#readme",
5
5
  "license": "MIT",
6
6
  "author": "snomiao <snomiao@gmail.com>",