claude-yes 1.152.0 → 1.153.2
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/default.config.yaml +10 -0
- package/dist/SUPPORTED_CLIS-BsfuhkaH.js +8 -0
- package/dist/{SUPPORTED_CLIS-Cc_CQLNY.js → SUPPORTED_CLIS-DsOUGcZj.js} +2 -2
- package/dist/cli.js +22 -11
- package/dist/index.js +2 -2
- package/dist/{schedule-C0IBT9Dv.js → schedule-Bxei036B.js} +4 -4
- package/dist/{serve-BQUBdYgC.js → serve-CoUlCHxT.js} +5 -5
- package/dist/{setup-BNxr7dVS.js → setup-CSgScgPD.js} +2 -2
- package/dist/{subcommands-DCXK2hqQ.js → subcommands-6M1qZllB.js} +1 -1
- package/dist/{subcommands-D-zxJ5pJ.js → subcommands-CapfwHNa.js} +4 -4
- package/dist/{ts-42ZzA2qb.js → ts-C4ZmPc5P.js} +2 -2
- package/dist/{versionChecker-BqnxJ5wI.js → versionChecker-CqRHax_g.js} +2 -2
- package/package.json +1 -1
- package/ts/buildRustArgs.spec.ts +33 -5
- package/ts/buildRustArgs.ts +31 -13
- package/dist/SUPPORTED_CLIS-3sP7QMdT.js +0 -8
package/default.config.yaml
CHANGED
|
@@ -64,6 +64,16 @@ clis:
|
|
|
64
64
|
- pattern: "API Error.*Overloaded"
|
|
65
65
|
flags: i
|
|
66
66
|
- Overloaded
|
|
67
|
+
# "API Error: Response stalled mid-stream. The response above may be
|
|
68
|
+
# incomplete." — the streamed response wedged and the client aborted
|
|
69
|
+
# mid-token. Transient + server-side like Overloaded, so retry with
|
|
70
|
+
# backoff instead of dying. Anchored on the literal "API Error:" chrome
|
|
71
|
+
# the CLI emits, so an agent merely *discussing* a stalled mid-stream
|
|
72
|
+
# (docs, commits, this very feature's PR) can't self-trigger a retry —
|
|
73
|
+
# only the real error banner does. `[\s\S]{0,40}` spans the prefix→phrase
|
|
74
|
+
# gap across a line-wrap; `\s+`/`\s*` tolerate wraps inside the phrase.
|
|
75
|
+
- pattern: 'API Error:[\s\S]{0,40}Response\s+stalled\s+mid-\s*stream'
|
|
76
|
+
flags: i
|
|
67
77
|
# Any 5xx API error (e.g. "API Error: 529 Overloaded", "API Error: 503 …",
|
|
68
78
|
# or a 529 rendered as a raw JSON error blob) is server-side + transient —
|
|
69
79
|
# retry with backoff regardless of the wording. Anchored to "API Error" so
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./ts-C4ZmPc5P.js";
|
|
2
|
+
import "./logger-CDIsZ-Pp.js";
|
|
3
|
+
import "./versionChecker-CqRHax_g.js";
|
|
4
|
+
import "./pidStore-fqXqTKkh.js";
|
|
5
|
+
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DsOUGcZj.js";
|
|
7
|
+
|
|
8
|
+
export { SUPPORTED_CLIS };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts-C4ZmPc5P.js";
|
|
2
2
|
|
|
3
3
|
//#region ts/SUPPORTED_CLIS.ts
|
|
4
4
|
const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
|
|
5
5
|
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SUPPORTED_CLIS as t };
|
|
8
|
-
//# sourceMappingURL=SUPPORTED_CLIS-
|
|
8
|
+
//# sourceMappingURL=SUPPORTED_CLIS-DsOUGcZj.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { t as invokedCliName } from "./invokedCli-uqM2YYA7.js";
|
|
3
3
|
import { n as logger } from "./logger-CDIsZ-Pp.js";
|
|
4
|
-
import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-
|
|
4
|
+
import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-CqRHax_g.js";
|
|
5
5
|
import { argv } from "process";
|
|
6
6
|
import { execFileSync, spawn } from "child_process";
|
|
7
7
|
import ms from "ms";
|
|
@@ -443,17 +443,28 @@ async function getRustBinary(options = {}) {
|
|
|
443
443
|
/**
|
|
444
444
|
* Build arguments for the Rust binary from process.argv.
|
|
445
445
|
*
|
|
446
|
-
* IMPORTANT: The CLI name (e.g. "claude") must be
|
|
447
|
-
*
|
|
448
|
-
* which means once a positional arg is encountered, all
|
|
449
|
-
* treated as positional — so any flags (like
|
|
450
|
-
* would be silently
|
|
446
|
+
* IMPORTANT: The CLI name (e.g. "claude") must be passed via a leading `--cli=`
|
|
447
|
+
* flag, NOT as a bare positional. The Rust binary uses clap with
|
|
448
|
+
* `trailing_var_arg`, which means once a positional arg is encountered, all
|
|
449
|
+
* subsequent args are treated as positional — so any agent-yes flags (like
|
|
450
|
+
* `--cwd` or `--timeout`) placed AFTER a positional CLI name would be silently
|
|
451
|
+
* swallowed and forwarded to the target CLI (which then errors on the unknown
|
|
452
|
+
* option). The documented `ay <cli> --cwd <dir>` form is exactly this shape, so
|
|
453
|
+
* we rewrite a bare positional CLI name into `--cli=<name>` here.
|
|
451
454
|
*/
|
|
452
455
|
function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
453
456
|
const rawRustArgs = argv.slice(2).filter((arg) => arg !== "--rust" && !arg.startsWith("--rust="));
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
+
if (rawRustArgs.some((arg) => arg === "--swarm" || arg.startsWith("--swarm="))) return rawRustArgs;
|
|
458
|
+
if (rawRustArgs.some((arg) => arg.startsWith("--cli=") || arg === "--cli")) return rawRustArgs;
|
|
459
|
+
const dashIndex = rawRustArgs.indexOf("--");
|
|
460
|
+
const optionEnd = dashIndex === -1 ? rawRustArgs.length : dashIndex;
|
|
461
|
+
const cliPositionalIndex = rawRustArgs.findIndex((arg, i) => i < optionEnd && supportedClis.includes(arg));
|
|
462
|
+
if (cliPositionalIndex !== -1) {
|
|
463
|
+
const cli = rawRustArgs[cliPositionalIndex];
|
|
464
|
+
const rest = rawRustArgs.filter((_, i) => i !== cliPositionalIndex);
|
|
465
|
+
return [`--cli=${cli}`, ...rest];
|
|
466
|
+
}
|
|
467
|
+
if (cliFromScript) return [`--cli=${cliFromScript}`, ...rawRustArgs];
|
|
457
468
|
return rawRustArgs;
|
|
458
469
|
}
|
|
459
470
|
|
|
@@ -470,7 +481,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
470
481
|
const rawArg = process.argv[2];
|
|
471
482
|
const managerCommands = !invokedCliName(process.argv);
|
|
472
483
|
const isHelpFlag = rawArg === "-h" || rawArg === "--help";
|
|
473
|
-
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-
|
|
484
|
+
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-6M1qZllB.js");
|
|
474
485
|
if (isHelpFlag && process.argv.length === 3) {
|
|
475
486
|
cmdHelp(managerCommands);
|
|
476
487
|
process.exit(0);
|
|
@@ -503,7 +514,7 @@ if (config.useRust) {
|
|
|
503
514
|
}
|
|
504
515
|
}
|
|
505
516
|
if (rustBinary) {
|
|
506
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
517
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BsfuhkaH.js");
|
|
507
518
|
const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
|
|
508
519
|
if (config.verbose) {
|
|
509
520
|
console.log(`[rust] Using binary: ${rustBinary}`);
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-C4ZmPc5P.js";
|
|
2
2
|
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-
|
|
3
|
+
import "./versionChecker-CqRHax_g.js";
|
|
4
4
|
import "./pidStore-fqXqTKkh.js";
|
|
5
5
|
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./ts-
|
|
1
|
+
import "./ts-C4ZmPc5P.js";
|
|
2
2
|
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-
|
|
3
|
+
import "./versionChecker-CqRHax_g.js";
|
|
4
4
|
import "./pidStore-fqXqTKkh.js";
|
|
5
5
|
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
6
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DsOUGcZj.js";
|
|
7
7
|
import { i as resolveSpawnCwd } from "./workspaceConfig-B9VX8tVO.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
|
|
@@ -141,4 +141,4 @@ async function cmdSchedule(rest) {
|
|
|
141
141
|
|
|
142
142
|
//#endregion
|
|
143
143
|
export { cmdSchedule };
|
|
144
|
-
//# sourceMappingURL=schedule-
|
|
144
|
+
//# sourceMappingURL=schedule-Bxei036B.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "./ts-
|
|
1
|
+
import "./ts-C4ZmPc5P.js";
|
|
2
2
|
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
3
|
+
import { r as getInstalledPackage } from "./versionChecker-CqRHax_g.js";
|
|
4
4
|
import "./pidStore-fqXqTKkh.js";
|
|
5
5
|
import { a as updateGlobalPidStatus } from "./globalPidIndex-DlmmJlO8.js";
|
|
6
6
|
import { t as pgidForWrapper } from "./reaper-C-eWAxIj.js";
|
|
7
7
|
import "./configShared-C1C04bbq.js";
|
|
8
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
8
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DsOUGcZj.js";
|
|
9
9
|
import "./e2e-ClOI_aqV.js";
|
|
10
10
|
import "./webrtcLink-BWhuA74k.js";
|
|
11
11
|
import "./remotes-qK6uozO4.js";
|
|
12
12
|
import { i as resolveSpawnCwd, r as isProvisionAllowed, t as getProvisionRoot } from "./workspaceConfig-B9VX8tVO.js";
|
|
13
|
-
import { C as snapshotStatus, T as writeToIpc, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-
|
|
13
|
+
import { C as snapshotStatus, T as writeToIpc, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-CapfwHNa.js";
|
|
14
14
|
import yargs from "yargs";
|
|
15
15
|
import { mkdir, open, readFile, stat, writeFile } from "fs/promises";
|
|
16
16
|
import { homedir, hostname, userInfo } from "os";
|
|
@@ -1265,4 +1265,4 @@ Options:
|
|
|
1265
1265
|
|
|
1266
1266
|
//#endregion
|
|
1267
1267
|
export { cmdServe };
|
|
1268
|
-
//# sourceMappingURL=serve-
|
|
1268
|
+
//# sourceMappingURL=serve-CoUlCHxT.js.map
|
|
@@ -32,7 +32,7 @@ async function cmdSetup(rest) {
|
|
|
32
32
|
if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
|
|
33
33
|
if (noShare) return 0;
|
|
34
34
|
process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
|
|
35
|
-
const { cmdServe } = await import("./serve-
|
|
35
|
+
const { cmdServe } = await import("./serve-CoUlCHxT.js");
|
|
36
36
|
return cmdServe([
|
|
37
37
|
"install",
|
|
38
38
|
"--share",
|
|
@@ -42,4 +42,4 @@ async function cmdSetup(rest) {
|
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
export { cmdSetup };
|
|
45
|
-
//# sourceMappingURL=setup-
|
|
45
|
+
//# sourceMappingURL=setup-CSgScgPD.js.map
|
|
@@ -4,6 +4,6 @@ import "./configShared-C1C04bbq.js";
|
|
|
4
4
|
import "./e2e-ClOI_aqV.js";
|
|
5
5
|
import "./webrtcLink-BWhuA74k.js";
|
|
6
6
|
import "./remotes-qK6uozO4.js";
|
|
7
|
-
import { C as snapshotStatus, S as runSubcommand, T as writeToIpc, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as stopTipForCli, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-
|
|
7
|
+
import { C as snapshotStatus, S as runSubcommand, T as writeToIpc, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as stopTipForCli, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-CapfwHNa.js";
|
|
8
8
|
|
|
9
9
|
export { cmdHelp, isSubcommand, runSubcommand };
|
|
@@ -554,15 +554,15 @@ async function runSubcommand(argv) {
|
|
|
554
554
|
case "restart": return await cmdRestart(rest);
|
|
555
555
|
case "note": return await cmdNote(rest);
|
|
556
556
|
case "serve": {
|
|
557
|
-
const { cmdServe } = await import("./serve-
|
|
557
|
+
const { cmdServe } = await import("./serve-CoUlCHxT.js");
|
|
558
558
|
return cmdServe(rest);
|
|
559
559
|
}
|
|
560
560
|
case "setup": {
|
|
561
|
-
const { cmdSetup } = await import("./setup-
|
|
561
|
+
const { cmdSetup } = await import("./setup-CSgScgPD.js");
|
|
562
562
|
return cmdSetup(rest);
|
|
563
563
|
}
|
|
564
564
|
case "schedule": {
|
|
565
|
-
const { cmdSchedule } = await import("./schedule-
|
|
565
|
+
const { cmdSchedule } = await import("./schedule-Bxei036B.js");
|
|
566
566
|
return cmdSchedule(rest);
|
|
567
567
|
}
|
|
568
568
|
case "remote": {
|
|
@@ -2626,4 +2626,4 @@ async function cmdResultSet(rest) {
|
|
|
2626
2626
|
|
|
2627
2627
|
//#endregion
|
|
2628
2628
|
export { snapshotStatus as C, runSubcommand as S, writeToIpc as T, readPtysize as _, cursorAbs as a, resolveOne as b, extractTaskCounts as c, isExitRequest as d, isPidAlive as f, readNotes as g, matchKeyword as h, controlCodeFromName as i, finalizedLines as l, listRecords as m, READ_PAGE_DEFAULT as n, deriveLiveStatus as o, isSubcommand as p, cmdHelp as r, extractNeedsInput as s, GRACEFUL_EXIT_COMMANDS as t, isAgentStuck as u, renderRawLog as v, stopTipForCli as w, resolveReadWindow as x, renderRawLogLines as y };
|
|
2629
|
-
//# sourceMappingURL=subcommands-
|
|
2629
|
+
//# sourceMappingURL=subcommands-CapfwHNa.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
2
|
+
import { r as getInstalledPackage } from "./versionChecker-CqRHax_g.js";
|
|
3
3
|
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
4
4
|
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-V4qvXgAw.js";
|
|
5
5
|
import { t as PidStore } from "./pidStore-fqXqTKkh.js";
|
|
@@ -1802,4 +1802,4 @@ function sleep(ms) {
|
|
|
1802
1802
|
|
|
1803
1803
|
//#endregion
|
|
1804
1804
|
export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
|
|
1805
|
-
//# sourceMappingURL=ts-
|
|
1805
|
+
//# sourceMappingURL=ts-C4ZmPc5P.js.map
|
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
|
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name = "claude-yes";
|
|
10
|
-
var version = "1.
|
|
10
|
+
var version = "1.153.2";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region ts/versionChecker.ts
|
|
@@ -215,4 +215,4 @@ async function displayVersion() {
|
|
|
215
215
|
|
|
216
216
|
//#endregion
|
|
217
217
|
export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
|
|
218
|
-
//# sourceMappingURL=versionChecker-
|
|
218
|
+
//# sourceMappingURL=versionChecker-CqRHax_g.js.map
|
package/package.json
CHANGED
package/ts/buildRustArgs.spec.ts
CHANGED
|
@@ -110,9 +110,9 @@ describe("buildRustArgs", () => {
|
|
|
110
110
|
// ─── CLI name detection in args ────────────────────────────────────
|
|
111
111
|
|
|
112
112
|
describe("does not duplicate CLI name if already in args", () => {
|
|
113
|
-
it("
|
|
113
|
+
it("hoists a positional CLI name into a leading --cli= flag", () => {
|
|
114
114
|
const result = buildRustArgs(argv("--timeout", "30s", "claude"), "claude", SUPPORTED_CLIS);
|
|
115
|
-
expect(result).toEqual(["--
|
|
115
|
+
expect(result).toEqual(["--cli=claude", "--timeout", "30s"]);
|
|
116
116
|
expect(result.filter((a) => a.includes("claude"))).toHaveLength(1);
|
|
117
117
|
});
|
|
118
118
|
|
|
@@ -140,11 +140,38 @@ describe("buildRustArgs", () => {
|
|
|
140
140
|
for (const cli of ["gemini", "codex", "copilot", "cursor", "grok"]) {
|
|
141
141
|
const result = buildRustArgs(argv("--timeout", "1m", cli), "claude", SUPPORTED_CLIS);
|
|
142
142
|
expect(result).not.toContain("--cli=claude");
|
|
143
|
-
expect(result).
|
|
143
|
+
expect(result[0]).toBe(`--cli=${cli}`);
|
|
144
|
+
expect(result).toContain("--timeout");
|
|
144
145
|
}
|
|
145
146
|
});
|
|
146
147
|
});
|
|
147
148
|
|
|
149
|
+
// ─── Regression: agent-yes flags AFTER a positional CLI name ───────
|
|
150
|
+
// `ay <cli> --cwd <dir>` is the documented form. The CLI name must be hoisted
|
|
151
|
+
// to a leading --cli= flag, otherwise clap's trailing_var_arg swallows --cwd
|
|
152
|
+
// and forwards it to the target CLI (which errors on the unknown option).
|
|
153
|
+
|
|
154
|
+
describe("regression: flags after a positional CLI name are not swallowed", () => {
|
|
155
|
+
it("hoists CLI name so --cwd is parsed by agent-yes, not forwarded", () => {
|
|
156
|
+
const result = buildRustArgs(
|
|
157
|
+
argv("claude", "--cwd", "../qa1", "--", "do", "the", "thing"),
|
|
158
|
+
"claude",
|
|
159
|
+
SUPPORTED_CLIS,
|
|
160
|
+
);
|
|
161
|
+
expect(result).toEqual(["--cli=claude", "--cwd", "../qa1", "--", "do", "the", "thing"]);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("works for the ay generic entry (cliFromScript undefined)", () => {
|
|
165
|
+
const result = buildRustArgs(argv("codex", "--cwd", "/tmp/x"), undefined, SUPPORTED_CLIS);
|
|
166
|
+
expect(result).toEqual(["--cli=codex", "--cwd", "/tmp/x"]);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("does not treat a supported-CLI word after -- as the CLI selector", () => {
|
|
170
|
+
const result = buildRustArgs(argv("--cwd", "/tmp/x", "--", "ask", "claude"), "claude", SUPPORTED_CLIS);
|
|
171
|
+
expect(result).toEqual(["--cli=claude", "--cwd", "/tmp/x", "--", "ask", "claude"]);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
148
175
|
// ─── Swarm mode ────────────────────────────────────────────────────
|
|
149
176
|
|
|
150
177
|
describe("swarm mode skips CLI name", () => {
|
|
@@ -272,8 +299,9 @@ describe("buildRustArgs", () => {
|
|
|
272
299
|
undefined,
|
|
273
300
|
SUPPORTED_CLIS,
|
|
274
301
|
);
|
|
275
|
-
// cliFromScript is undefined (agent-yes)
|
|
276
|
-
|
|
302
|
+
// cliFromScript is undefined (agent-yes); the positional CLI name is hoisted
|
|
303
|
+
// to --cli= so --timeout isn't swallowed by clap's trailing_var_arg.
|
|
304
|
+
expect(result).toEqual(["--cli=claude", "--timeout", "1h"]);
|
|
277
305
|
});
|
|
278
306
|
|
|
279
307
|
it("agent-yes --rust --swarm my-project --timeout 1h", () => {
|
package/ts/buildRustArgs.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build arguments for the Rust binary from process.argv.
|
|
3
3
|
*
|
|
4
|
-
* IMPORTANT: The CLI name (e.g. "claude") must be
|
|
5
|
-
*
|
|
6
|
-
* which means once a positional arg is encountered, all
|
|
7
|
-
* treated as positional — so any flags (like
|
|
8
|
-
* would be silently
|
|
4
|
+
* IMPORTANT: The CLI name (e.g. "claude") must be passed via a leading `--cli=`
|
|
5
|
+
* flag, NOT as a bare positional. The Rust binary uses clap with
|
|
6
|
+
* `trailing_var_arg`, which means once a positional arg is encountered, all
|
|
7
|
+
* subsequent args are treated as positional — so any agent-yes flags (like
|
|
8
|
+
* `--cwd` or `--timeout`) placed AFTER a positional CLI name would be silently
|
|
9
|
+
* swallowed and forwarded to the target CLI (which then errors on the unknown
|
|
10
|
+
* option). The documented `ay <cli> --cwd <dir>` form is exactly this shape, so
|
|
11
|
+
* we rewrite a bare positional CLI name into `--cli=<name>` here.
|
|
9
12
|
*/
|
|
10
13
|
export function buildRustArgs(
|
|
11
14
|
argv: string[],
|
|
@@ -15,17 +18,32 @@ export function buildRustArgs(
|
|
|
15
18
|
// Filter out --rust flag (already handled by TS layer)
|
|
16
19
|
const rawRustArgs = argv.slice(2).filter((arg) => arg !== "--rust" && !arg.startsWith("--rust="));
|
|
17
20
|
|
|
18
|
-
//
|
|
21
|
+
// Swarm mode runs without a target CLI — leave args untouched.
|
|
19
22
|
const hasSwarmArg = rawRustArgs.some((arg) => arg === "--swarm" || arg.startsWith("--swarm="));
|
|
23
|
+
if (hasSwarmArg) return rawRustArgs;
|
|
20
24
|
|
|
21
|
-
//
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
rawRustArgs.some((arg) => supportedClis.includes(arg));
|
|
25
|
+
// An explicit --cli=/--cli flag already selects the CLI; don't second-guess it.
|
|
26
|
+
const hasCliFlag = rawRustArgs.some((arg) => arg.startsWith("--cli=") || arg === "--cli");
|
|
27
|
+
if (hasCliFlag) return rawRustArgs;
|
|
25
28
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
// A supported-CLI word after `--` is prompt text, not the CLI selector.
|
|
30
|
+
const dashIndex = rawRustArgs.indexOf("--");
|
|
31
|
+
const optionEnd = dashIndex === -1 ? rawRustArgs.length : dashIndex;
|
|
32
|
+
|
|
33
|
+
// CLI name given as a bare positional (e.g. `cy claude --cwd X`): hoist it into
|
|
34
|
+
// a leading `--cli=` flag so clap parses the agent-yes flags that follow it
|
|
35
|
+
// instead of swallowing them into trailing_var_arg.
|
|
36
|
+
const cliPositionalIndex = rawRustArgs.findIndex(
|
|
37
|
+
(arg, i) => i < optionEnd && supportedClis.includes(arg),
|
|
38
|
+
);
|
|
39
|
+
if (cliPositionalIndex !== -1) {
|
|
40
|
+
const cli = rawRustArgs[cliPositionalIndex];
|
|
41
|
+
const rest = rawRustArgs.filter((_, i) => i !== cliPositionalIndex);
|
|
42
|
+
return [`--cli=${cli}`, ...rest];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// No CLI in args — fall back to the script-inferred name (cy → claude).
|
|
46
|
+
if (cliFromScript) {
|
|
29
47
|
return [`--cli=${cliFromScript}`, ...rawRustArgs];
|
|
30
48
|
}
|
|
31
49
|
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./ts-42ZzA2qb.js";
|
|
2
|
-
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-BqnxJ5wI.js";
|
|
4
|
-
import "./pidStore-fqXqTKkh.js";
|
|
5
|
-
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Cc_CQLNY.js";
|
|
7
|
-
|
|
8
|
-
export { SUPPORTED_CLIS };
|