Skip to content

Commit f5a34be

Browse files
committed
fix(cli): keep bare taskless -d <path> on the wizard / agent-index path
1 parent d75cd64 commit f5a34be

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎packages/cli/src/index.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ const main = defineCommand({
105105
// unknown flags should fall through to citty's default help instead of
106106
// silently launching the wizard. (`--help`/`-h` and `--version`/`-v`
107107
// never reach here — they are intercepted before dispatch below.)
108-
const onlyInitFlags = flags.every((flag) => DIR_FLAGS.has(flag));
108+
// Compared by name before any `=`: argv arrives with `-d <path>` already
109+
// joined into `--dir=<path>` (see joinDirectoryValues).
110+
const onlyInitFlags = flags.every((flag) =>
111+
DIR_FLAGS.has(flag.split("=", 1)[0]!)
112+
);
109113
if (!onlyInitFlags) {
110114
await showUsage(cmd);
111115
return;

‎packages/cli/test/cli.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@ describe("cli", () => {
9292
]);
9393
expect(JSON.parse(stdout.trim())).toHaveProperty("version");
9494
});
95+
96+
// With no subcommand, `-d` alone still reaches the wizard / agent-index
97+
// fallback rather than usage, in both spellings, once argv is joined.
98+
it.each([["-d"], ["--dir="]])(
99+
"routes a bare %s<path> to the agent index when not a TTY",
100+
async (flag) => {
101+
const argv =
102+
flag === "-d"
103+
? ["-d", temporaryDirectory]
104+
: [`--dir=${temporaryDirectory}`];
105+
const { stderr } = await execFileAsync("node", [binPath, ...argv]);
106+
expect(stderr).toContain("non-interactive context detected");
107+
}
108+
);
95109
});
96110

97111
describe("init", () => {

0 commit comments

Comments
 (0)