@@ -12,6 +12,7 @@ export function initCommand(): Command {
1212 return new Command ( 'init' )
1313 . description ( 'Set up Yavy for your AI tools (skills + MCP config)' )
1414 . option ( '--tool <name>' , 'Configure a specific tool only' )
15+ . option ( '--projects <slugs>' , 'Comma-separated project slugs to configure (skips interactive selection)' )
1516 . option ( '--yes' , 'Non-interactive mode: configure all detected tools + all projects' )
1617 . action ( async ( options : InitOptions ) => {
1718 try {
@@ -133,6 +134,30 @@ async function selectTools(options: InitOptions): Promise<AiTool[]> {
133134}
134135
135136async function selectProjects ( projects : ApiProject [ ] , options : InitOptions ) : Promise < ApiProject [ ] > {
137+ if ( options . projects ) {
138+ const requestedSlugs = new Set (
139+ options . projects
140+ . split ( ',' )
141+ . map ( ( s ) => s . trim ( ) )
142+ . filter ( Boolean ) ,
143+ ) ;
144+ const matched = projects . filter ( ( proj ) => requestedSlugs . has ( proj . slug ) ) ;
145+
146+ if ( matched . length === 0 ) {
147+ p . log . error ( 'No matching projects found for the provided slugs.' ) ;
148+ p . log . info ( `Available: ${ projects . map ( ( proj ) => proj . slug ) . join ( ', ' ) } ` ) ;
149+ process . exit ( 1 ) ;
150+ }
151+
152+ const unmatched = [ ...requestedSlugs ] . filter ( ( s ) => ! matched . some ( ( proj ) => proj . slug === s ) ) ;
153+ if ( unmatched . length > 0 ) {
154+ warn ( `Skipping unknown slugs: ${ unmatched . join ( ', ' ) } ` ) ;
155+ }
156+
157+ p . log . info ( `Selected ${ matched . length } project(s) via --projects` ) ;
158+ return matched ;
159+ }
160+
136161 if ( options . yes ) {
137162 p . log . info ( `Auto-selecting all ${ projects . length } project(s)` ) ;
138163 return projects ;
0 commit comments