claude-yes 1.10.0 → 1.10.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 +19 -11
- package/dist/index.js +19 -11
- package/index.ts +20 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5090,6 +5090,7 @@ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {})
|
|
|
5090
5090
|
process.stdin.setRawMode?.(true);
|
|
5091
5091
|
const prefix = "";
|
|
5092
5092
|
const PREFIXLENGTH = prefix.length;
|
|
5093
|
+
let errorNoConversation = false;
|
|
5093
5094
|
const shellOutputStream = new TransformStream;
|
|
5094
5095
|
const outputWriter = shellOutputStream.writable.getWriter();
|
|
5095
5096
|
let shell = pty.spawn("claude", claudeArgs, {
|
|
@@ -5103,18 +5104,21 @@ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {})
|
|
|
5103
5104
|
}
|
|
5104
5105
|
shell.onData(onData);
|
|
5105
5106
|
shell.onExit(function onExit({ exitCode }) {
|
|
5106
|
-
if (continueOnCrash) {
|
|
5107
|
-
if (
|
|
5108
|
-
console.log(
|
|
5109
|
-
|
|
5110
|
-
cols: process.stdout.columns - PREFIXLENGTH,
|
|
5111
|
-
rows: process.stdout.rows,
|
|
5112
|
-
cwd: process.cwd(),
|
|
5113
|
-
env: process.env
|
|
5114
|
-
});
|
|
5115
|
-
shell.onData(onData);
|
|
5116
|
-
shell.onExit(onExit);
|
|
5107
|
+
if (continueOnCrash && exitCode !== 0) {
|
|
5108
|
+
if (errorNoConversation) {
|
|
5109
|
+
console.log('Claude crashed with "No conversation found to continue", exiting...');
|
|
5110
|
+
process.exit(exitCode);
|
|
5117
5111
|
}
|
|
5112
|
+
console.log("Claude crashed, restarting...");
|
|
5113
|
+
shell = pty.spawn("claude", ["continue", "--continue"], {
|
|
5114
|
+
cols: process.stdout.columns - PREFIXLENGTH,
|
|
5115
|
+
rows: process.stdout.rows,
|
|
5116
|
+
cwd: process.cwd(),
|
|
5117
|
+
env: process.env
|
|
5118
|
+
});
|
|
5119
|
+
shell.onData(onData);
|
|
5120
|
+
shell.onExit(onExit);
|
|
5121
|
+
return;
|
|
5118
5122
|
}
|
|
5119
5123
|
process.exit(exitCode);
|
|
5120
5124
|
});
|
|
@@ -5161,6 +5165,10 @@ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {})
|
|
|
5161
5165
|
await sleepms(200);
|
|
5162
5166
|
shell.write("\r");
|
|
5163
5167
|
}
|
|
5168
|
+
}).forEach((e2) => {
|
|
5169
|
+
if (e2.match(/No conversation found to continue/)) {
|
|
5170
|
+
errorNoConversation = true;
|
|
5171
|
+
}
|
|
5164
5172
|
}).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));
|
|
5165
5173
|
}
|
|
5166
5174
|
// node_modules/enhanced-ms/dist/index.js
|
package/dist/index.js
CHANGED
|
@@ -4870,6 +4870,7 @@ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {})
|
|
|
4870
4870
|
process.stdin.setRawMode?.(true);
|
|
4871
4871
|
const prefix = "";
|
|
4872
4872
|
const PREFIXLENGTH = prefix.length;
|
|
4873
|
+
let errorNoConversation = false;
|
|
4873
4874
|
const shellOutputStream = new TransformStream;
|
|
4874
4875
|
const outputWriter = shellOutputStream.writable.getWriter();
|
|
4875
4876
|
let shell = pty.spawn("claude", claudeArgs, {
|
|
@@ -4883,18 +4884,21 @@ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {})
|
|
|
4883
4884
|
}
|
|
4884
4885
|
shell.onData(onData);
|
|
4885
4886
|
shell.onExit(function onExit({ exitCode }) {
|
|
4886
|
-
if (continueOnCrash) {
|
|
4887
|
-
if (
|
|
4888
|
-
console.log(
|
|
4889
|
-
|
|
4890
|
-
cols: process.stdout.columns - PREFIXLENGTH,
|
|
4891
|
-
rows: process.stdout.rows,
|
|
4892
|
-
cwd: process.cwd(),
|
|
4893
|
-
env: process.env
|
|
4894
|
-
});
|
|
4895
|
-
shell.onData(onData);
|
|
4896
|
-
shell.onExit(onExit);
|
|
4887
|
+
if (continueOnCrash && exitCode !== 0) {
|
|
4888
|
+
if (errorNoConversation) {
|
|
4889
|
+
console.log('Claude crashed with "No conversation found to continue", exiting...');
|
|
4890
|
+
process.exit(exitCode);
|
|
4897
4891
|
}
|
|
4892
|
+
console.log("Claude crashed, restarting...");
|
|
4893
|
+
shell = pty.spawn("claude", ["continue", "--continue"], {
|
|
4894
|
+
cols: process.stdout.columns - PREFIXLENGTH,
|
|
4895
|
+
rows: process.stdout.rows,
|
|
4896
|
+
cwd: process.cwd(),
|
|
4897
|
+
env: process.env
|
|
4898
|
+
});
|
|
4899
|
+
shell.onData(onData);
|
|
4900
|
+
shell.onExit(onExit);
|
|
4901
|
+
return;
|
|
4898
4902
|
}
|
|
4899
4903
|
process.exit(exitCode);
|
|
4900
4904
|
});
|
|
@@ -4941,6 +4945,10 @@ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {})
|
|
|
4941
4945
|
await sleepms(200);
|
|
4942
4946
|
shell.write("\r");
|
|
4943
4947
|
}
|
|
4948
|
+
}).forEach((e2) => {
|
|
4949
|
+
if (e2.match(/No conversation found to continue/)) {
|
|
4950
|
+
errorNoConversation = true;
|
|
4951
|
+
}
|
|
4944
4952
|
}).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));
|
|
4945
4953
|
}
|
|
4946
4954
|
export {
|
package/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ export default async function claudeYes({ continueOnCrash, exitOnIdle, claudeArg
|
|
|
24
24
|
process.stdin.setRawMode?.(true) //must be called any stdout/stdin usage
|
|
25
25
|
const prefix = '' // "YESC|"
|
|
26
26
|
const PREFIXLENGTH = prefix.length;
|
|
27
|
-
|
|
27
|
+
let errorNoConversation = false; // match 'No conversation found to continue'
|
|
28
28
|
|
|
29
29
|
// TODO: implement this flag to continue on crash
|
|
30
30
|
// 1. if it crashes, show message 'claude crashed, restarting..'
|
|
@@ -51,18 +51,21 @@ export default async function claudeYes({ continueOnCrash, exitOnIdle, claudeArg
|
|
|
51
51
|
shell.onData(onData)
|
|
52
52
|
// when claude process exits, exit the main process with the same exit code
|
|
53
53
|
shell.onExit(function onExit({ exitCode }) {
|
|
54
|
-
if (continueOnCrash) {
|
|
55
|
-
if (
|
|
56
|
-
console.log('Claude crashed,
|
|
57
|
-
|
|
58
|
-
cols: process.stdout.columns - PREFIXLENGTH,
|
|
59
|
-
rows: process.stdout.rows,
|
|
60
|
-
cwd: process.cwd(),
|
|
61
|
-
env: process.env,
|
|
62
|
-
});
|
|
63
|
-
shell.onData(onData)
|
|
64
|
-
shell.onExit(onExit);
|
|
54
|
+
if (continueOnCrash && exitCode !== 0) {
|
|
55
|
+
if (errorNoConversation) {
|
|
56
|
+
console.log('Claude crashed with "No conversation found to continue", exiting...');
|
|
57
|
+
void process.exit(exitCode);
|
|
65
58
|
}
|
|
59
|
+
console.log('Claude crashed, restarting...');
|
|
60
|
+
shell = pty.spawn('claude', ['continue', '--continue'], {
|
|
61
|
+
cols: process.stdout.columns - PREFIXLENGTH,
|
|
62
|
+
rows: process.stdout.rows,
|
|
63
|
+
cwd: process.cwd(),
|
|
64
|
+
env: process.env,
|
|
65
|
+
});
|
|
66
|
+
shell.onData(onData)
|
|
67
|
+
shell.onExit(onExit);
|
|
68
|
+
return
|
|
66
69
|
}
|
|
67
70
|
void process.exit(exitCode);
|
|
68
71
|
});
|
|
@@ -124,6 +127,11 @@ export default async function claudeYes({ continueOnCrash, exitOnIdle, claudeArg
|
|
|
124
127
|
shell.write("\r")
|
|
125
128
|
}
|
|
126
129
|
})
|
|
130
|
+
.forEach(e => {
|
|
131
|
+
if (e.match(/No conversation found to continue/)) {
|
|
132
|
+
errorNoConversation = true; // set flag to true if error message is found
|
|
133
|
+
}
|
|
134
|
+
})
|
|
127
135
|
// .forEach(e => appendFile('.cache/io.log', "output|" + JSON.stringify(e) + '\n')) // for debugging
|
|
128
136
|
.run()
|
|
129
137
|
)
|