claude-yes 1.15.1 → 1.16.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 +8 -7
- package/dist/cli.js +11 -7
- package/dist/cli.js.map +170 -0
- package/dist/index.js +11 -7
- package/dist/index.js.map +128 -0
- package/index.ts +15 -11
- package/package.json +40 -40
package/index.ts
CHANGED
|
@@ -21,21 +21,22 @@ import { mkdir } from 'fs/promises';
|
|
|
21
21
|
* @param options.removeControlCharactersFromStdout - Remove ANSI control characters from stdout. Defaults to !process.stdout.isTTY
|
|
22
22
|
*/
|
|
23
23
|
export default async function claudeYes({
|
|
24
|
-
continueOnCrash,
|
|
25
|
-
exitOnIdle,
|
|
26
24
|
claudeArgs = [],
|
|
25
|
+
continueOnCrash,
|
|
27
26
|
cwd = process.cwd(),
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
env = process.env as Record<string, string>,
|
|
28
|
+
exitOnIdle,
|
|
30
29
|
logFile,
|
|
30
|
+
removeControlCharactersFromStdout = false, // = !process.stdout.isTTY,
|
|
31
31
|
verbose = false,
|
|
32
32
|
}: {
|
|
33
|
-
continueOnCrash?: boolean;
|
|
34
|
-
exitOnIdle?: number;
|
|
35
33
|
claudeArgs?: string[];
|
|
34
|
+
continueOnCrash?: boolean;
|
|
36
35
|
cwd?: string;
|
|
37
|
-
|
|
36
|
+
env?: Record<string, string>;
|
|
37
|
+
exitOnIdle?: number;
|
|
38
38
|
logFile?: string;
|
|
39
|
+
removeControlCharactersFromStdout?: boolean;
|
|
39
40
|
verbose?: boolean;
|
|
40
41
|
} = {}) {
|
|
41
42
|
if (verbose) {
|
|
@@ -63,7 +64,10 @@ export default async function claudeYes({
|
|
|
63
64
|
|
|
64
65
|
const shellOutputStream = new TransformStream<string, string>();
|
|
65
66
|
const outputWriter = shellOutputStream.writable.getWriter();
|
|
66
|
-
const pty =
|
|
67
|
+
// const pty = await import('node-pty');
|
|
68
|
+
|
|
69
|
+
// recommened to use bun pty in windows
|
|
70
|
+
const pty = process.versions.bun
|
|
67
71
|
? await import('bun-pty')
|
|
68
72
|
: await import('node-pty');
|
|
69
73
|
let shell = pty.spawn('claude', claudeArgs, {
|
|
@@ -71,7 +75,7 @@ export default async function claudeYes({
|
|
|
71
75
|
cols: process.stdout.columns - PREFIXLENGTH,
|
|
72
76
|
rows: process.stdout.rows,
|
|
73
77
|
cwd,
|
|
74
|
-
env
|
|
78
|
+
env,
|
|
75
79
|
});
|
|
76
80
|
let pendingExitCode = Promise.withResolvers<number | null>();
|
|
77
81
|
// TODO handle error if claude is not installed, show msg:
|
|
@@ -92,12 +96,12 @@ export default async function claudeYes({
|
|
|
92
96
|
return pendingExitCode.resolve(exitCode);
|
|
93
97
|
}
|
|
94
98
|
console.log('Claude crashed, restarting...');
|
|
95
|
-
shell = pty.spawn('claude', ['continue', '
|
|
99
|
+
shell = pty.spawn('claude', ['--continue', 'continue'], {
|
|
96
100
|
name: 'xterm-color',
|
|
97
101
|
cols: process.stdout.columns - PREFIXLENGTH,
|
|
98
102
|
rows: process.stdout.rows,
|
|
99
103
|
cwd,
|
|
100
|
-
env
|
|
104
|
+
env,
|
|
101
105
|
});
|
|
102
106
|
shell.onData(onData);
|
|
103
107
|
shell.onExit(onExit);
|
package/package.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-yes",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "snomiao <snomiao@gmail.com>",
|
|
3
|
+
"version": "1.16.1",
|
|
4
|
+
"description": "A wrapper tool that automates interactions with the Claude CLI by automatically handling common prompts and responses.",
|
|
7
5
|
"keywords": [
|
|
8
6
|
"claude",
|
|
9
7
|
"ai",
|
|
@@ -14,29 +12,58 @@
|
|
|
14
12
|
"anthropic",
|
|
15
13
|
"auto-response"
|
|
16
14
|
],
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
],
|
|
21
|
-
"bin": {
|
|
22
|
-
"claude-yes": "dist/cli.js"
|
|
15
|
+
"homepage": "https://github.com/snomiao/claude-yes#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/snomiao/claude-yes/issues"
|
|
23
18
|
},
|
|
24
19
|
"repository": {
|
|
25
20
|
"type": "git",
|
|
26
21
|
"url": "git+https://github.com/snomiao/claude-yes.git"
|
|
27
22
|
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "snomiao <snomiao@gmail.com>",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"types": "./index.ts"
|
|
29
|
+
},
|
|
30
|
+
"main": "index.js",
|
|
31
|
+
"module": "index.ts",
|
|
32
|
+
"types": "./index.ts",
|
|
33
|
+
"bin": {
|
|
34
|
+
"claude-yes": "dist/cli.js"
|
|
35
|
+
},
|
|
36
|
+
"directories": {
|
|
37
|
+
"doc": "docs"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"*.ts",
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
28
43
|
"scripts": {
|
|
44
|
+
"build": "bun build index.ts cli.ts --outdir=dist --external=node-pty --external=bun-pty --target=node --sourcemap",
|
|
29
45
|
"dev": "tsx index.ts",
|
|
30
|
-
"
|
|
31
|
-
"test": "vitest",
|
|
46
|
+
"fmt": "prettier -w .",
|
|
32
47
|
"prepare": "husky",
|
|
33
|
-
"
|
|
48
|
+
"test": "vitest"
|
|
49
|
+
},
|
|
50
|
+
"lint-staged": {
|
|
51
|
+
"*.{ts,js,json,md}": [
|
|
52
|
+
"prettier --write"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"bun-pty": "^0.3.2",
|
|
57
|
+
"node-pty": "^1.0.0"
|
|
34
58
|
},
|
|
35
59
|
"devDependencies": {
|
|
60
|
+
"terminal-render": "^1.1.0",
|
|
61
|
+
"yargs": "^18.0.0",
|
|
36
62
|
"@types/bun": "^1.2.18",
|
|
37
63
|
"@types/jest": "^30.0.0",
|
|
38
64
|
"@types/node": "^24.0.10",
|
|
39
65
|
"@types/yargs": "^17.0.33",
|
|
66
|
+
"sflow": "^1.20.2",
|
|
40
67
|
"enhanced-ms": "^4.1.0",
|
|
41
68
|
"execa": "^9.6.0",
|
|
42
69
|
"from-node-stream": "^0.0.11",
|
|
@@ -44,38 +71,11 @@
|
|
|
44
71
|
"lint-staged": "^16.1.4",
|
|
45
72
|
"prettier": "^3.6.2",
|
|
46
73
|
"semantic-release": "^24.2.6",
|
|
47
|
-
"sflow": "^1.20.2",
|
|
48
74
|
"strip-ansi-control-characters": "^2.0.0",
|
|
49
75
|
"tsx": "^4.20.3",
|
|
50
76
|
"vitest": "^3.2.4"
|
|
51
77
|
},
|
|
52
78
|
"peerDependencies": {
|
|
53
79
|
"typescript": "^5.8.3"
|
|
54
|
-
},
|
|
55
|
-
"type": "module",
|
|
56
|
-
"exports": {
|
|
57
|
-
"import": "./dist/index.js",
|
|
58
|
-
"types": "./index.ts"
|
|
59
|
-
},
|
|
60
|
-
"module": "index.ts",
|
|
61
|
-
"types": "./index.ts",
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"bun-pty": "^0.3.2",
|
|
64
|
-
"node-pty": "^1.0.0",
|
|
65
|
-
"terminal-render": "^1.1.0",
|
|
66
|
-
"yargs": "^18.0.0"
|
|
67
|
-
},
|
|
68
|
-
"lint-staged": {
|
|
69
|
-
"*.{ts,js,json,md}": [
|
|
70
|
-
"prettier --write"
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
"description": "A wrapper tool that automates interactions with the Claude CLI by automatically handling common prompts and responses.",
|
|
74
|
-
"main": "index.js",
|
|
75
|
-
"directories": {
|
|
76
|
-
"doc": "docs"
|
|
77
|
-
},
|
|
78
|
-
"bugs": {
|
|
79
|
-
"url": "https://github.com/snomiao/claude-yes/issues"
|
|
80
80
|
}
|
|
81
81
|
}
|