@@ -263,6 +263,7 @@ async function collectExcludePatterns(
263263 workDir : string ,
264264 includePatterns : string [ ] ,
265265 language : string ,
266+ outDir : string ,
266267) : Promise < string [ ] > {
267268 console . info ( "\n❌ Specifying files to exclude from your project" ) ;
268269 console . info (
@@ -277,7 +278,11 @@ Examples:
277278 ) ;
278279
279280 // Suggest intelligent defaults based on include patterns
280- const suggestedExcludes = suggestExcludePatterns ( includePatterns , language ) ;
281+ const suggestedExcludes = suggestExcludePatterns (
282+ includePatterns ,
283+ language ,
284+ outDir ,
285+ ) ;
281286 console . info ( "\nSuggested exclude patterns (based on included files):" ) ;
282287 suggestedExcludes . forEach ( ( pattern ) => console . info ( `- ${ pattern } ` ) ) ;
283288
@@ -442,9 +447,13 @@ function suggestIncludePatterns(
442447function suggestExcludePatterns (
443448 _includePatterns : string [ ] ,
444449 language : string ,
450+ outDir : string ,
445451) : string [ ] {
446452 const suggestions : string [ ] = [ ] ;
447453
454+ // add outDir to the suggestions
455+ suggestions . push ( `${ outDir } /**` ) ;
456+
448457 // Common exclusions for all languages
449458 suggestions . push ( ".git/**" ) ;
450459 suggestions . push ( "**/dist/**" ) ;
@@ -513,21 +522,6 @@ export async function generateConfig(
513522 }
514523 }
515524
516- console . info ( "\n🔍 ANALYZING PROJECT STRUCTURE..." ) ;
517-
518- // Collect include patterns
519- const includePatterns = await collectIncludePatterns ( workDir , language ) ;
520-
521- // Collect exclude patterns
522- const excludePatterns = await collectExcludePatterns (
523- workDir ,
524- includePatterns ,
525- language ,
526- ) ;
527-
528- // Show final file selection to the user
529- await showFinalFileSelection ( workDir , includePatterns , excludePatterns ) ;
530-
531525 // Output directory - must be a valid directory name within the project
532526 const outDir = await input ( {
533527 message : "Enter the output directory for NanoAPI artifacts" ,
@@ -552,19 +546,6 @@ export async function generateConfig(
552546 return "A file with this name already exists. Please choose a different name" ;
553547 }
554548
555- // Check if the output directory would conflict with project source directories
556- if (
557- includePatterns . some ( ( pattern ) => {
558- const patternBase = pattern
559- . split ( "/" ) [ 0 ]
560- . replace ( "**" , "" )
561- . replace ( "*" , "" ) ;
562- return patternBase === value ;
563- } )
564- ) {
565- return "Output directory should not conflict with your source directories" ;
566- }
567-
568549 return true ;
569550 } catch ( error ) {
570551 if ( error instanceof Error ) {
@@ -575,6 +556,22 @@ export async function generateConfig(
575556 } ,
576557 } ) ;
577558
559+ console . info ( "\n🔍 ANALYZING PROJECT STRUCTURE..." ) ;
560+
561+ // Collect include patterns
562+ const includePatterns = await collectIncludePatterns ( workDir , language ) ;
563+
564+ // Collect exclude patterns
565+ const excludePatterns = await collectExcludePatterns (
566+ workDir ,
567+ includePatterns ,
568+ language ,
569+ outDir ,
570+ ) ;
571+
572+ // Show final file selection to the user
573+ await showFinalFileSelection ( workDir , includePatterns , excludePatterns ) ;
574+
578575 // Provide information about metrics before asking
579576 console . info (
580577 `
0 commit comments