@@ -34,6 +34,7 @@ import { isWindows, isTermux } from '../utils/platform';
3434import { resolveAiOutputLanguage , selectScriptLanguage } from '../utils/prompts' ;
3535import { formatApiKeyDisplay } from '../utils/validator' ;
3636import { readZcfConfig , updateZcfConfig } from '../utils/zcf-config' ;
37+ import { selectMcpServices } from '../utils/mcp-selector' ;
3738
3839export interface InitOptions {
3940 lang ?: SupportedLang ;
@@ -291,39 +292,13 @@ export async function init(options: InitOptions = {}) {
291292 ) ;
292293 }
293294
294- // Create choices array with "All" option first
295- const choices = [
296- {
297- title : ansis . bold ( i18n . allServices ) ,
298- value : 'ALL' ,
299- selected : false ,
300- } ,
301- ...MCP_SERVICES . map ( ( service ) => ( {
302- title : `${ service . name [ scriptLang ] } - ${ ansis . gray ( service . description [ scriptLang ] ) } ` ,
303- value : service . id ,
304- selected : false ,
305- } ) ) ,
306- ] ;
307-
308- const { services } = await inquirer . prompt < { services : string [ ] } > ( {
309- type : 'checkbox' ,
310- name : 'services' ,
311- message : i18n . selectMcpServices + ' ' + ansis . gray ( i18n . spaceToSelectReturn ) ,
312- choices,
313- } ) ;
314-
315- if ( services === undefined ) {
316- console . log ( ansis . yellow ( i18n . cancelled ) ) ;
295+ // Use common MCP selector
296+ const selectedServices = await selectMcpServices ( scriptLang ) ;
297+
298+ if ( selectedServices === undefined ) {
317299 process . exit ( 0 ) ;
318300 }
319301
320- let selectedServices = services || [ ] ;
321-
322- // If "ALL" is selected, select all services
323- if ( selectedServices . includes ( 'ALL' ) ) {
324- selectedServices = MCP_SERVICES . map ( ( s ) => s . id ) ;
325- }
326-
327302 if ( selectedServices . length > 0 ) {
328303 // Backup existing MCP config if exists
329304 const mcpBackupPath = backupMcpConfig ( ) ;
0 commit comments