@@ -215,18 +215,7 @@ async function _createFlow() {
215215 clack . log . info ( status ) ;
216216 }
217217
218- // 检查必须工具是否缺失
219- const missingRequired = getMissingRequiredTools ( envSummary ) ;
220- if ( missingRequired . length > 0 ) {
221- clack . log . error (
222- chalk . red (
223- `${ missingRequired . map ( ( m ) => m . name ) . join ( ", " ) } ${ t ( "envRequired" ) } ` ,
224- ) ,
225- ) ;
226- process . exit ( 1 ) ;
227- }
228-
229- // 处理缺失的可选工具
218+ // 处理所有缺失的工具(必要 + 可选)
230219 const missing = getMissingTools ( envSummary ) ;
231220 if ( missing . length > 0 ) {
232221 const shouldInstall = await clack . confirm ( { message : t ( "envMissing" ) } ) ;
@@ -235,7 +224,10 @@ async function _createFlow() {
235224 if ( shouldInstall ) {
236225 const toInstall = await clack . multiselect ( {
237226 message : `${ t ( "envSelectInstall" ) } ${ chalk . dim ( t ( "multiselectHint" ) ) } ` ,
238- options : missing . map ( ( m ) => ( { value : m . command , label : m . name } ) ) ,
227+ options : missing . map ( ( m ) => ( {
228+ value : m . command ,
229+ label : `${ m . name } ${ m . required ? chalk . yellow ( `(${ t ( "envRequired" ) } )` ) : chalk . dim ( `(${ t ( "envOptional" ) } )` ) } ` ,
230+ } ) ) ,
239231 initialValues : missing . map ( ( m ) => m . command ) ,
240232 } ) ;
241233 if ( clack . isCancel ( toInstall ) ) onCancel ( ) ;
@@ -252,6 +244,18 @@ async function _createFlow() {
252244 }
253245 }
254246 }
247+
248+ // 安装后重新检测必要工具是否就绪
249+ const recheck = await checkEnvironment ( ) ;
250+ const stillMissing = getMissingRequiredTools ( recheck ) ;
251+ if ( stillMissing . length > 0 ) {
252+ clack . log . error (
253+ chalk . red (
254+ `${ stillMissing . map ( ( m ) => m . name ) . join ( ", " ) } ${ t ( "envRequired" ) } ` ,
255+ ) ,
256+ ) ;
257+ process . exit ( 1 ) ;
258+ }
255259 }
256260
257261 // ─── 项目配置 ───
0 commit comments