claude-yes 1.33.0 → 1.34.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 +114 -36
- package/dist/index.js +51 -10
- package/package.json +5 -5
- package/ts/index.ts +63 -11
- package/ts/logger.ts +0 -1
package/dist/cli.js
CHANGED
|
@@ -20881,8 +20881,12 @@ function getDefaultConfig() {
|
|
|
20881
20881
|
},
|
|
20882
20882
|
claude: {
|
|
20883
20883
|
promptArg: "last-arg",
|
|
20884
|
-
install:
|
|
20885
|
-
|
|
20884
|
+
install: {
|
|
20885
|
+
powershell: "irm https://claude.ai/install.ps1 | iex",
|
|
20886
|
+
bash: "curl -fsSL https://claude.ai/install.sh | bash",
|
|
20887
|
+
npm: "npm i -g @anthropic-ai/claude-code@latest"
|
|
20888
|
+
},
|
|
20889
|
+
ready: [/^\? for shortcuts/, /^> /],
|
|
20886
20890
|
typingRespond: {
|
|
20887
20891
|
"1\n": [/│ Do you want to use this API key\?/]
|
|
20888
20892
|
},
|
|
@@ -21319,6 +21323,26 @@ ${prompt}` : prefix;
|
|
|
21319
21323
|
logger.warn(`Unknown promptArg format: ${cliConf.promptArg}`);
|
|
21320
21324
|
}
|
|
21321
21325
|
}
|
|
21326
|
+
const getInstallCommand = (installConfig) => {
|
|
21327
|
+
if (typeof installConfig === "string") {
|
|
21328
|
+
return installConfig;
|
|
21329
|
+
}
|
|
21330
|
+
const isWindows = process.platform === "win32";
|
|
21331
|
+
const platform3 = isWindows ? "windows" : "unix";
|
|
21332
|
+
if (installConfig[platform3]) {
|
|
21333
|
+
return installConfig[platform3];
|
|
21334
|
+
}
|
|
21335
|
+
if (isWindows && installConfig.powershell) {
|
|
21336
|
+
return installConfig.powershell;
|
|
21337
|
+
}
|
|
21338
|
+
if (!isWindows && installConfig.bash) {
|
|
21339
|
+
return installConfig.bash;
|
|
21340
|
+
}
|
|
21341
|
+
if (installConfig.npm) {
|
|
21342
|
+
return installConfig.npm;
|
|
21343
|
+
}
|
|
21344
|
+
return null;
|
|
21345
|
+
};
|
|
21322
21346
|
const spawn2 = () => {
|
|
21323
21347
|
const cliCommand = cliConf?.binary || cli;
|
|
21324
21348
|
let [bin, ...args] = [...parseCommandString(cliCommand), ...cliArgs];
|
|
@@ -21333,14 +21357,19 @@ ${prompt}` : prefix;
|
|
|
21333
21357
|
logger.error(`Fatal: Failed to start ${cli}.`);
|
|
21334
21358
|
const isNotFound = isCommandNotFoundError(error);
|
|
21335
21359
|
if (cliConf?.install && isNotFound) {
|
|
21336
|
-
|
|
21360
|
+
const installCmd = getInstallCommand(cliConf.install);
|
|
21361
|
+
if (!installCmd) {
|
|
21362
|
+
logger.error(`No suitable install command found for ${cli} on this platform`);
|
|
21363
|
+
throw error;
|
|
21364
|
+
}
|
|
21365
|
+
logger.info(`Please install the cli by run ${installCmd}`);
|
|
21337
21366
|
if (install) {
|
|
21338
21367
|
logger.info(`Attempting to install ${cli}...`);
|
|
21339
|
-
execaCommandSync(
|
|
21368
|
+
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
21340
21369
|
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
21341
21370
|
return spawn2();
|
|
21342
21371
|
} else {
|
|
21343
|
-
logger.error(`If you did not installed it yet, Please install it first: ${
|
|
21372
|
+
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
21344
21373
|
throw error;
|
|
21345
21374
|
}
|
|
21346
21375
|
}
|
|
@@ -21375,7 +21404,10 @@ ${prompt}` : prefix;
|
|
|
21375
21404
|
stdinReady.unready();
|
|
21376
21405
|
const agentCrashed = exitCode2 !== 0;
|
|
21377
21406
|
if (shouldRestartWithoutContinue) {
|
|
21378
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21407
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21408
|
+
exitReason: "restarted",
|
|
21409
|
+
exitCode: exitCode2 ?? undefined
|
|
21410
|
+
});
|
|
21379
21411
|
shouldRestartWithoutContinue = false;
|
|
21380
21412
|
isFatal = false;
|
|
21381
21413
|
const cliCommand = cliConf?.binary || cli;
|
|
@@ -21396,10 +21428,16 @@ ${prompt}` : prefix;
|
|
|
21396
21428
|
return;
|
|
21397
21429
|
}
|
|
21398
21430
|
if (isFatal) {
|
|
21399
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21431
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21432
|
+
exitReason: "fatal",
|
|
21433
|
+
exitCode: exitCode2 ?? undefined
|
|
21434
|
+
});
|
|
21400
21435
|
return pendingExitCode.resolve(exitCode2);
|
|
21401
21436
|
}
|
|
21402
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21437
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21438
|
+
exitReason: "restarted",
|
|
21439
|
+
exitCode: exitCode2 ?? undefined
|
|
21440
|
+
});
|
|
21403
21441
|
logger.info(`${cli} crashed, restarting...`);
|
|
21404
21442
|
let restoreArgs = conf.restoreArgs;
|
|
21405
21443
|
if (cli === "codex") {
|
|
@@ -21418,7 +21456,10 @@ ${prompt}` : prefix;
|
|
|
21418
21456
|
return;
|
|
21419
21457
|
}
|
|
21420
21458
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
21421
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21459
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21460
|
+
exitReason,
|
|
21461
|
+
exitCode: exitCode2 ?? undefined
|
|
21462
|
+
});
|
|
21422
21463
|
return pendingExitCode.resolve(exitCode2);
|
|
21423
21464
|
});
|
|
21424
21465
|
process.stdout.on("resize", () => {
|
|
@@ -21835,6 +21876,26 @@ ${prompt}` : prefix;
|
|
|
21835
21876
|
logger.warn(`Unknown promptArg format: ${cliConf.promptArg}`);
|
|
21836
21877
|
}
|
|
21837
21878
|
}
|
|
21879
|
+
const getInstallCommand = (installConfig) => {
|
|
21880
|
+
if (typeof installConfig === "string") {
|
|
21881
|
+
return installConfig;
|
|
21882
|
+
}
|
|
21883
|
+
const isWindows = process.platform === "win32";
|
|
21884
|
+
const platform3 = isWindows ? "windows" : "unix";
|
|
21885
|
+
if (installConfig[platform3]) {
|
|
21886
|
+
return installConfig[platform3];
|
|
21887
|
+
}
|
|
21888
|
+
if (isWindows && installConfig.powershell) {
|
|
21889
|
+
return installConfig.powershell;
|
|
21890
|
+
}
|
|
21891
|
+
if (!isWindows && installConfig.bash) {
|
|
21892
|
+
return installConfig.bash;
|
|
21893
|
+
}
|
|
21894
|
+
if (installConfig.npm) {
|
|
21895
|
+
return installConfig.npm;
|
|
21896
|
+
}
|
|
21897
|
+
return null;
|
|
21898
|
+
};
|
|
21838
21899
|
const spawn2 = () => {
|
|
21839
21900
|
const cliCommand = cliConf?.binary || cli;
|
|
21840
21901
|
let [bin, ...args] = [...parseCommandString(cliCommand), ...cliArgs];
|
|
@@ -21849,14 +21910,19 @@ ${prompt}` : prefix;
|
|
|
21849
21910
|
logger.error(`Fatal: Failed to start ${cli}.`);
|
|
21850
21911
|
const isNotFound = isCommandNotFoundError(error);
|
|
21851
21912
|
if (cliConf?.install && isNotFound) {
|
|
21852
|
-
|
|
21913
|
+
const installCmd = getInstallCommand(cliConf.install);
|
|
21914
|
+
if (!installCmd) {
|
|
21915
|
+
logger.error(`No suitable install command found for ${cli} on this platform`);
|
|
21916
|
+
throw error;
|
|
21917
|
+
}
|
|
21918
|
+
logger.info(`Please install the cli by run ${installCmd}`);
|
|
21853
21919
|
if (install) {
|
|
21854
21920
|
logger.info(`Attempting to install ${cli}...`);
|
|
21855
|
-
execaCommandSync(
|
|
21921
|
+
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
21856
21922
|
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
21857
21923
|
return spawn2();
|
|
21858
21924
|
} else {
|
|
21859
|
-
logger.error(`If you did not installed it yet, Please install it first: ${
|
|
21925
|
+
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
21860
21926
|
throw error;
|
|
21861
21927
|
}
|
|
21862
21928
|
}
|
|
@@ -21891,7 +21957,10 @@ ${prompt}` : prefix;
|
|
|
21891
21957
|
stdinReady.unready();
|
|
21892
21958
|
const agentCrashed = exitCode2 !== 0;
|
|
21893
21959
|
if (shouldRestartWithoutContinue) {
|
|
21894
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21960
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21961
|
+
exitReason: "restarted",
|
|
21962
|
+
exitCode: exitCode2 ?? undefined
|
|
21963
|
+
});
|
|
21895
21964
|
shouldRestartWithoutContinue = false;
|
|
21896
21965
|
isFatal = false;
|
|
21897
21966
|
const cliCommand = cliConf?.binary || cli;
|
|
@@ -21912,10 +21981,16 @@ ${prompt}` : prefix;
|
|
|
21912
21981
|
return;
|
|
21913
21982
|
}
|
|
21914
21983
|
if (isFatal) {
|
|
21915
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21984
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21985
|
+
exitReason: "fatal",
|
|
21986
|
+
exitCode: exitCode2 ?? undefined
|
|
21987
|
+
});
|
|
21916
21988
|
return pendingExitCode.resolve(exitCode2);
|
|
21917
21989
|
}
|
|
21918
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21990
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21991
|
+
exitReason: "restarted",
|
|
21992
|
+
exitCode: exitCode2 ?? undefined
|
|
21993
|
+
});
|
|
21919
21994
|
logger.info(`${cli} crashed, restarting...`);
|
|
21920
21995
|
let restoreArgs = conf.restoreArgs;
|
|
21921
21996
|
if (cli === "codex") {
|
|
@@ -21934,7 +22009,10 @@ ${prompt}` : prefix;
|
|
|
21934
22009
|
return;
|
|
21935
22010
|
}
|
|
21936
22011
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
21937
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
22012
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
22013
|
+
exitReason,
|
|
22014
|
+
exitCode: exitCode2 ?? undefined
|
|
22015
|
+
});
|
|
21938
22016
|
return pendingExitCode.resolve(exitCode2);
|
|
21939
22017
|
});
|
|
21940
22018
|
process.stdout.on("resize", () => {
|
|
@@ -27577,10 +27655,10 @@ var package_default = {
|
|
|
27577
27655
|
url: "git+https://github.com/snomiao/agent-yes.git"
|
|
27578
27656
|
},
|
|
27579
27657
|
bin: {
|
|
27580
|
-
ay: "./dist/agent-yes.js",
|
|
27581
27658
|
"agent-yes": "./dist/agent-yes.js",
|
|
27582
27659
|
"amp-yes": "./dist/amp-yes.js",
|
|
27583
27660
|
"auggie-yes": "./dist/auggie-yes.js",
|
|
27661
|
+
ay: "./dist/agent-yes.js",
|
|
27584
27662
|
"claude-yes": "./dist/claude-yes.js",
|
|
27585
27663
|
"codex-yes": "./dist/codex-yes.js",
|
|
27586
27664
|
"copilot-yes": "./dist/copilot-yes.js",
|
|
@@ -27593,10 +27671,10 @@ var package_default = {
|
|
|
27593
27671
|
doc: "docs"
|
|
27594
27672
|
},
|
|
27595
27673
|
files: [
|
|
27596
|
-
"dist/**/*.js",
|
|
27597
|
-
"!dist/**/*.map",
|
|
27598
27674
|
"scripts",
|
|
27599
|
-
"ts/*.ts"
|
|
27675
|
+
"ts/*.ts",
|
|
27676
|
+
"!dist/**/*.map",
|
|
27677
|
+
"dist/**/*.js"
|
|
27600
27678
|
],
|
|
27601
27679
|
type: "module",
|
|
27602
27680
|
module: "ts/index.ts",
|
|
@@ -27629,20 +27707,6 @@ var package_default = {
|
|
|
27629
27707
|
},
|
|
27630
27708
|
devDependencies: {
|
|
27631
27709
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
27632
|
-
"cpu-wait": "^0.0.10",
|
|
27633
|
-
execa: "^9.6.1",
|
|
27634
|
-
ink: "^6.6.0",
|
|
27635
|
-
ms: "^2.1.3",
|
|
27636
|
-
openai: "^6.16.0",
|
|
27637
|
-
"p-map": "^7.0.4",
|
|
27638
|
-
phpdie: "^1.7.0",
|
|
27639
|
-
rambda: "^11.0.1",
|
|
27640
|
-
sflow: "^1.27.0",
|
|
27641
|
-
"strip-ansi-control-characters": "^2.0.0",
|
|
27642
|
-
"terminal-render": "^1.2.2",
|
|
27643
|
-
"tsa-composer": "^3.0.3",
|
|
27644
|
-
winston: "^3.19.0",
|
|
27645
|
-
yargs: "^18.0.0",
|
|
27646
27710
|
"@semantic-release/changelog": "^6.0.3",
|
|
27647
27711
|
"@semantic-release/exec": "^7.1.0",
|
|
27648
27712
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -27652,14 +27716,28 @@ var package_default = {
|
|
|
27652
27716
|
"@types/ms": "^2.1.0",
|
|
27653
27717
|
"@types/node": "^25.0.10",
|
|
27654
27718
|
"@types/yargs": "^17.0.35",
|
|
27719
|
+
"cpu-wait": "^0.0.10",
|
|
27720
|
+
execa: "^9.6.1",
|
|
27655
27721
|
husky: "^9.1.7",
|
|
27722
|
+
ink: "^6.6.0",
|
|
27656
27723
|
"lint-staged": "^16.2.7",
|
|
27724
|
+
ms: "^2.1.3",
|
|
27657
27725
|
"node-pty": "^1.1.0",
|
|
27726
|
+
openai: "^6.16.0",
|
|
27658
27727
|
oxfmt: "^0.26.0",
|
|
27659
27728
|
oxlint: "^1.41.0",
|
|
27729
|
+
"p-map": "^7.0.4",
|
|
27730
|
+
phpdie: "^1.7.0",
|
|
27731
|
+
rambda: "^11.0.1",
|
|
27660
27732
|
"semantic-release": "^25.0.2",
|
|
27733
|
+
sflow: "^1.27.0",
|
|
27661
27734
|
"standard-version": "^9.5.0",
|
|
27662
|
-
|
|
27735
|
+
"strip-ansi-control-characters": "^2.0.0",
|
|
27736
|
+
"terminal-render": "^1.2.2",
|
|
27737
|
+
"tsa-composer": "^3.0.3",
|
|
27738
|
+
vitest: "^4.0.17",
|
|
27739
|
+
winston: "^3.19.0",
|
|
27740
|
+
yargs: "^18.0.0"
|
|
27663
27741
|
},
|
|
27664
27742
|
peerDependencies: {
|
|
27665
27743
|
"node-pty": "latest",
|
|
@@ -27972,5 +28050,5 @@ var { exitCode } = await cliYes(config3);
|
|
|
27972
28050
|
console.log("exiting process");
|
|
27973
28051
|
process.exit(exitCode ?? 1);
|
|
27974
28052
|
|
|
27975
|
-
//# debugId=
|
|
28053
|
+
//# debugId=12710EC867DEB2CA64756E2164756E21
|
|
27976
28054
|
//# sourceMappingURL=cli.js.map
|
package/dist/index.js
CHANGED
|
@@ -20879,8 +20879,12 @@ function getDefaultConfig() {
|
|
|
20879
20879
|
},
|
|
20880
20880
|
claude: {
|
|
20881
20881
|
promptArg: "last-arg",
|
|
20882
|
-
install:
|
|
20883
|
-
|
|
20882
|
+
install: {
|
|
20883
|
+
powershell: "irm https://claude.ai/install.ps1 | iex",
|
|
20884
|
+
bash: "curl -fsSL https://claude.ai/install.sh | bash",
|
|
20885
|
+
npm: "npm i -g @anthropic-ai/claude-code@latest"
|
|
20886
|
+
},
|
|
20887
|
+
ready: [/^\? for shortcuts/, /^> /],
|
|
20884
20888
|
typingRespond: {
|
|
20885
20889
|
"1\n": [/│ Do you want to use this API key\?/]
|
|
20886
20890
|
},
|
|
@@ -21295,6 +21299,26 @@ ${prompt}` : prefix;
|
|
|
21295
21299
|
logger.warn(`Unknown promptArg format: ${cliConf.promptArg}`);
|
|
21296
21300
|
}
|
|
21297
21301
|
}
|
|
21302
|
+
const getInstallCommand = (installConfig) => {
|
|
21303
|
+
if (typeof installConfig === "string") {
|
|
21304
|
+
return installConfig;
|
|
21305
|
+
}
|
|
21306
|
+
const isWindows = process.platform === "win32";
|
|
21307
|
+
const platform3 = isWindows ? "windows" : "unix";
|
|
21308
|
+
if (installConfig[platform3]) {
|
|
21309
|
+
return installConfig[platform3];
|
|
21310
|
+
}
|
|
21311
|
+
if (isWindows && installConfig.powershell) {
|
|
21312
|
+
return installConfig.powershell;
|
|
21313
|
+
}
|
|
21314
|
+
if (!isWindows && installConfig.bash) {
|
|
21315
|
+
return installConfig.bash;
|
|
21316
|
+
}
|
|
21317
|
+
if (installConfig.npm) {
|
|
21318
|
+
return installConfig.npm;
|
|
21319
|
+
}
|
|
21320
|
+
return null;
|
|
21321
|
+
};
|
|
21298
21322
|
const spawn2 = () => {
|
|
21299
21323
|
const cliCommand = cliConf?.binary || cli;
|
|
21300
21324
|
let [bin, ...args] = [...parseCommandString(cliCommand), ...cliArgs];
|
|
@@ -21309,14 +21333,19 @@ ${prompt}` : prefix;
|
|
|
21309
21333
|
logger.error(`Fatal: Failed to start ${cli}.`);
|
|
21310
21334
|
const isNotFound = isCommandNotFoundError(error);
|
|
21311
21335
|
if (cliConf?.install && isNotFound) {
|
|
21312
|
-
|
|
21336
|
+
const installCmd = getInstallCommand(cliConf.install);
|
|
21337
|
+
if (!installCmd) {
|
|
21338
|
+
logger.error(`No suitable install command found for ${cli} on this platform`);
|
|
21339
|
+
throw error;
|
|
21340
|
+
}
|
|
21341
|
+
logger.info(`Please install the cli by run ${installCmd}`);
|
|
21313
21342
|
if (install) {
|
|
21314
21343
|
logger.info(`Attempting to install ${cli}...`);
|
|
21315
|
-
execaCommandSync(
|
|
21344
|
+
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
21316
21345
|
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
21317
21346
|
return spawn2();
|
|
21318
21347
|
} else {
|
|
21319
|
-
logger.error(`If you did not installed it yet, Please install it first: ${
|
|
21348
|
+
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
21320
21349
|
throw error;
|
|
21321
21350
|
}
|
|
21322
21351
|
}
|
|
@@ -21351,7 +21380,10 @@ ${prompt}` : prefix;
|
|
|
21351
21380
|
stdinReady.unready();
|
|
21352
21381
|
const agentCrashed = exitCode2 !== 0;
|
|
21353
21382
|
if (shouldRestartWithoutContinue) {
|
|
21354
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21383
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21384
|
+
exitReason: "restarted",
|
|
21385
|
+
exitCode: exitCode2 ?? undefined
|
|
21386
|
+
});
|
|
21355
21387
|
shouldRestartWithoutContinue = false;
|
|
21356
21388
|
isFatal = false;
|
|
21357
21389
|
const cliCommand = cliConf?.binary || cli;
|
|
@@ -21372,10 +21404,16 @@ ${prompt}` : prefix;
|
|
|
21372
21404
|
return;
|
|
21373
21405
|
}
|
|
21374
21406
|
if (isFatal) {
|
|
21375
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21407
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21408
|
+
exitReason: "fatal",
|
|
21409
|
+
exitCode: exitCode2 ?? undefined
|
|
21410
|
+
});
|
|
21376
21411
|
return pendingExitCode.resolve(exitCode2);
|
|
21377
21412
|
}
|
|
21378
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21413
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21414
|
+
exitReason: "restarted",
|
|
21415
|
+
exitCode: exitCode2 ?? undefined
|
|
21416
|
+
});
|
|
21379
21417
|
logger.info(`${cli} crashed, restarting...`);
|
|
21380
21418
|
let restoreArgs = conf.restoreArgs;
|
|
21381
21419
|
if (cli === "codex") {
|
|
@@ -21394,7 +21432,10 @@ ${prompt}` : prefix;
|
|
|
21394
21432
|
return;
|
|
21395
21433
|
}
|
|
21396
21434
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
21397
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21435
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21436
|
+
exitReason,
|
|
21437
|
+
exitCode: exitCode2 ?? undefined
|
|
21438
|
+
});
|
|
21398
21439
|
return pendingExitCode.resolve(exitCode2);
|
|
21399
21440
|
});
|
|
21400
21441
|
process.stdout.on("resize", () => {
|
|
@@ -21613,5 +21654,5 @@ export {
|
|
|
21613
21654
|
CLIS_CONFIG
|
|
21614
21655
|
};
|
|
21615
21656
|
|
|
21616
|
-
//# debugId=
|
|
21657
|
+
//# debugId=6BCBE693D722CAEF64756E2164756E21
|
|
21617
21658
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-yes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"url": "git+https://github.com/snomiao/agent-yes.git"
|
|
30
30
|
},
|
|
31
31
|
"bin": {
|
|
32
|
-
"ay": "./dist/agent-yes.js",
|
|
33
32
|
"agent-yes": "./dist/agent-yes.js",
|
|
34
33
|
"amp-yes": "./dist/amp-yes.js",
|
|
35
34
|
"auggie-yes": "./dist/auggie-yes.js",
|
|
35
|
+
"ay": "./dist/agent-yes.js",
|
|
36
36
|
"claude-yes": "./dist/claude-yes.js",
|
|
37
37
|
"codex-yes": "./dist/codex-yes.js",
|
|
38
38
|
"copilot-yes": "./dist/copilot-yes.js",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"doc": "docs"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
|
-
"dist/**/*.js",
|
|
49
|
-
"!dist/**/*.map",
|
|
50
48
|
"scripts",
|
|
51
|
-
"ts/*.ts"
|
|
49
|
+
"ts/*.ts",
|
|
50
|
+
"!dist/**/*.map",
|
|
51
|
+
"dist/**/*.js"
|
|
52
52
|
],
|
|
53
53
|
"type": "module",
|
|
54
54
|
"module": "ts/index.ts",
|
package/ts/index.ts
CHANGED
|
@@ -21,13 +21,14 @@ import { createFifoStream } from "./beta/fifo.ts";
|
|
|
21
21
|
import { PidStore } from "./pidStore.ts";
|
|
22
22
|
import { SUPPORTED_CLIS } from "./SUPPORTED_CLIS.ts";
|
|
23
23
|
import winston from "winston";
|
|
24
|
-
import { mapObject, pipe } from "rambda";
|
|
25
24
|
|
|
26
25
|
export { removeControlCharacters };
|
|
27
26
|
|
|
28
27
|
export type AgentCliConfig = {
|
|
29
28
|
// cli
|
|
30
|
-
install?:
|
|
29
|
+
install?:
|
|
30
|
+
| string
|
|
31
|
+
| { powershell?: string; bash?: string; npm?: string; unix?: string; windows?: string }; // hint user for install command if not installed
|
|
31
32
|
version?: string; // hint user for version command to check if installed
|
|
32
33
|
binary?: string; // actual binary name if different from cli, e.g. cursor -> cursor-agent
|
|
33
34
|
defaultArgs?: string[]; // function to ensure certain args are present
|
|
@@ -328,6 +329,41 @@ export default async function agentYes({
|
|
|
328
329
|
}
|
|
329
330
|
// Determine the actual cli command to run
|
|
330
331
|
|
|
332
|
+
// Helper function to get install command based on platform/availability
|
|
333
|
+
const getInstallCommand = (
|
|
334
|
+
installConfig:
|
|
335
|
+
| string
|
|
336
|
+
| { powershell?: string; bash?: string; npm?: string; unix?: string; windows?: string },
|
|
337
|
+
): string | null => {
|
|
338
|
+
if (typeof installConfig === "string") {
|
|
339
|
+
return installConfig;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const isWindows = process.platform === "win32";
|
|
343
|
+
const platform = isWindows ? "windows" : "unix";
|
|
344
|
+
|
|
345
|
+
// Try platform-specific commands first
|
|
346
|
+
if (installConfig[platform]) {
|
|
347
|
+
return installConfig[platform];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Try shell-specific commands
|
|
351
|
+
if (isWindows && installConfig.powershell) {
|
|
352
|
+
return installConfig.powershell;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!isWindows && installConfig.bash) {
|
|
356
|
+
return installConfig.bash;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Fallback to npm if available
|
|
360
|
+
if (installConfig.npm) {
|
|
361
|
+
return installConfig.npm;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return null;
|
|
365
|
+
};
|
|
366
|
+
|
|
331
367
|
const spawn = () => {
|
|
332
368
|
const cliCommand = cliConf?.binary || cli;
|
|
333
369
|
let [bin, ...args] = [...parseCommandString(cliCommand), ...cliArgs];
|
|
@@ -348,17 +384,21 @@ export default async function agentYes({
|
|
|
348
384
|
|
|
349
385
|
const isNotFound = isCommandNotFoundError(error);
|
|
350
386
|
if (cliConf?.install && isNotFound) {
|
|
351
|
-
|
|
387
|
+
const installCmd = getInstallCommand(cliConf.install);
|
|
388
|
+
if (!installCmd) {
|
|
389
|
+
logger.error(`No suitable install command found for ${cli} on this platform`);
|
|
390
|
+
throw error;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
logger.info(`Please install the cli by run ${installCmd}`);
|
|
352
394
|
|
|
353
395
|
if (install) {
|
|
354
396
|
logger.info(`Attempting to install ${cli}...`);
|
|
355
|
-
execaCommandSync(
|
|
397
|
+
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
356
398
|
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
357
399
|
return spawn();
|
|
358
400
|
} else {
|
|
359
|
-
logger.error(
|
|
360
|
-
`If you did not installed it yet, Please install it first: ${cliConf.install}`,
|
|
361
|
-
);
|
|
401
|
+
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
362
402
|
throw error;
|
|
363
403
|
}
|
|
364
404
|
}
|
|
@@ -415,7 +455,10 @@ export default async function agentYes({
|
|
|
415
455
|
// Handle restart without continue args (e.g., "No conversation found to continue")
|
|
416
456
|
// logger.debug(``, { shouldRestartWithoutContinue, robust })
|
|
417
457
|
if (shouldRestartWithoutContinue) {
|
|
418
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
458
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
459
|
+
exitReason: "restarted",
|
|
460
|
+
exitCode: exitCode ?? undefined,
|
|
461
|
+
});
|
|
419
462
|
shouldRestartWithoutContinue = false; // reset flag
|
|
420
463
|
isFatal = false; // reset fatal flag to allow restart
|
|
421
464
|
|
|
@@ -445,11 +488,17 @@ export default async function agentYes({
|
|
|
445
488
|
return;
|
|
446
489
|
}
|
|
447
490
|
if (isFatal) {
|
|
448
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
491
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
492
|
+
exitReason: "fatal",
|
|
493
|
+
exitCode: exitCode ?? undefined,
|
|
494
|
+
});
|
|
449
495
|
return pendingExitCode.resolve(exitCode);
|
|
450
496
|
}
|
|
451
497
|
|
|
452
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
498
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
499
|
+
exitReason: "restarted",
|
|
500
|
+
exitCode: exitCode ?? undefined,
|
|
501
|
+
});
|
|
453
502
|
logger.info(`${cli} crashed, restarting...`);
|
|
454
503
|
|
|
455
504
|
// For codex, try to use stored session ID for this directory
|
|
@@ -472,7 +521,10 @@ export default async function agentYes({
|
|
|
472
521
|
return;
|
|
473
522
|
}
|
|
474
523
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
475
|
-
await pidStore.updateStatus(shell.pid, "exited", {
|
|
524
|
+
await pidStore.updateStatus(shell.pid, "exited", {
|
|
525
|
+
exitReason,
|
|
526
|
+
exitCode: exitCode ?? undefined,
|
|
527
|
+
});
|
|
476
528
|
return pendingExitCode.resolve(exitCode);
|
|
477
529
|
});
|
|
478
530
|
|
package/ts/logger.ts
CHANGED