@@ -81,30 +81,31 @@ export function registerInit(program: Command): void {
8181 } else if ( options . host === undefined ) {
8282 // Auto-detect from project directory markers
8383 const detected = await detectHosts ( options . root ) ;
84- if ( detected . length === 1 ) {
85- hostIds = detected ;
86- } else if ( detected . length > 1 ) {
87- if ( process . stdin . isTTY && options . yes !== true ) {
88- const { select } = await import ( "@inquirer/prompts" ) ;
89- const choices : Array < { name : string ; value : string } > = [
90- ...detected . map ( ( h ) => ( { name : getAdapter ( h ) . displayName , value : h } ) ) ,
91- { name : t ( lang , "cli.init.promptHostAll" ) , value : "__all__" } ,
92- { name : t ( lang , "cli.init.promptHostSkip" ) , value : "__skip__" } ,
93- ] ;
94- const answer = await select ( {
95- message : t ( lang , "cli.init.promptHostSelect" ) ,
96- choices,
97- } ) ;
98- if ( answer === "__all__" ) {
99- hostIds = detected ;
100- } else if ( answer !== "__skip__" ) {
101- hostIds = [ answer as HostId ] ;
102- }
103- } else {
104- console . log (
105- `Multiple hosts detected: ${ detected . join ( ", " ) } . Use --host to specify one.` ,
106- ) ;
84+ if ( process . stdin . isTTY && options . yes !== true ) {
85+ const { select } = await import ( "@inquirer/prompts" ) ;
86+ // Build choices: detected hosts first, then remaining hosts
87+ const detectedSet = new Set < string > ( detected ) ;
88+ const otherHosts = VALID_HOSTS . filter ( ( h ) => ! detectedSet . has ( h ) ) ;
89+ const choices : Array < { name : string ; value : string } > = [
90+ ...detected . map ( ( h ) => ( {
91+ name : `${ getAdapter ( h ) . displayName } (detected)` ,
92+ value : h ,
93+ } ) ) ,
94+ ...otherHosts . map ( ( h ) => ( {
95+ name : getAdapter ( h ) . displayName ,
96+ value : h ,
97+ } ) ) ,
98+ { name : t ( lang , "cli.init.promptHostSkip" ) , value : "__skip__" } ,
99+ ] ;
100+ const answer = await select ( {
101+ message : t ( lang , "cli.init.promptHostSelect" ) ,
102+ choices,
103+ } ) ;
104+ if ( answer !== "__skip__" ) {
105+ hostIds = [ answer as HostId ] ;
107106 }
107+ } else if ( detected . length > 0 ) {
108+ hostIds = [ detected [ 0 ] ] ;
108109 }
109110 } else {
110111 // Explicit single host
0 commit comments