claude-yes 1.12.1 → 1.13.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/dist/cli.js CHANGED
@@ -5080,7 +5080,8 @@ async function claudeYes({
5080
5080
  continueOnCrash,
5081
5081
  exitOnIdle,
5082
5082
  claudeArgs = [],
5083
- cwd = process.cwd()
5083
+ cwd = process.cwd(),
5084
+ removeControlCharactersFromStdout = false
5084
5085
  } = {}) {
5085
5086
  const defaultTimeout = 5000;
5086
5087
  const idleTimeout = typeof exitOnIdle === "number" ? exitOnIdle : defaultTimeout;
@@ -5173,7 +5174,7 @@ async function claudeYes({
5173
5174
  errorNoConversation = true;
5174
5175
  return;
5175
5176
  }
5176
- }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).to(fromWritable(process.stdout));
5177
+ }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout));
5177
5178
  }
5178
5179
  // node_modules/enhanced-ms/dist/index.js
5179
5180
  var units = {
package/dist/index.js CHANGED
@@ -4860,7 +4860,8 @@ async function claudeYes({
4860
4860
  continueOnCrash,
4861
4861
  exitOnIdle,
4862
4862
  claudeArgs = [],
4863
- cwd = process.cwd()
4863
+ cwd = process.cwd(),
4864
+ removeControlCharactersFromStdout = false
4864
4865
  } = {}) {
4865
4866
  const defaultTimeout = 5000;
4866
4867
  const idleTimeout = typeof exitOnIdle === "number" ? exitOnIdle : defaultTimeout;
@@ -4953,7 +4954,7 @@ async function claudeYes({
4953
4954
  errorNoConversation = true;
4954
4955
  return;
4955
4956
  }
4956
- }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).to(fromWritable(process.stdout));
4957
+ }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).map((e) => removeControlCharactersFromStdout ? removeControlCharacters(e) : e).to(fromWritable(process.stdout));
4957
4958
  }
4958
4959
  export {
4959
4960
  removeControlCharacters,
package/index.ts CHANGED
@@ -24,17 +24,21 @@ import { sleepms } from "./utils";
24
24
  * 4. If it crashes with "No conversation found to continue", exits the process
25
25
  * @param options.exitOnIdle - Exit when Claude is idle. Boolean or timeout in milliseconds
26
26
  * @param options.claudeArgs - Additional arguments to pass to the Claude CLI
27
+ * @param options.removeControlCharactersFromStdout - Remove ANSI control characters from stdout. Defaults to !process.stdout.isTTY
27
28
  */
28
29
  export default async function claudeYes({
29
30
  continueOnCrash,
30
31
  exitOnIdle,
31
32
  claudeArgs = [],
32
33
  cwd = process.cwd(),
34
+ // removeControlCharactersFromStdout = !process.stdout.isTTY,
35
+ removeControlCharactersFromStdout = false,
33
36
  }: {
34
37
  continueOnCrash?: boolean;
35
38
  exitOnIdle?: boolean | number;
36
39
  claudeArgs?: string[];
37
40
  cwd?: string;
41
+ removeControlCharactersFromStdout?: boolean;
38
42
  } = {}) {
39
43
  const defaultTimeout = 5e3; // 5 seconds idle timeout
40
44
  const idleTimeout =
@@ -171,7 +175,9 @@ export default async function claudeYes({
171
175
  )
172
176
  .replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line) // add prefix
173
177
  .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
178
+ .map((e) =>
179
+ removeControlCharactersFromStdout ? removeControlCharacters(e) : e,
180
+ )
175
181
  .to(fromWritable(process.stdout));
176
182
  }
177
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "homepage": "https://github.com/snomiao/claude-yes#readme",
5
5
  "license": "MIT",
6
6
  "author": "snomiao <snomiao@gmail.com>",