File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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" , ( ) => {
You can’t perform that action at this time.
0 commit comments