33 createConfig ,
44 getConfigFromWorkDir ,
55} from "../../middlewares/napiConfig.ts" ;
6- import { join , normalize , relative } from "@std/path" ;
6+ import { join , normalize , relative , SEPARATOR } from "@std/path" ;
77import type z from "zod" ;
88import type { localConfigSchema } from "../../middlewares/napiConfig.ts" ;
99import pythonStdlibList from "../../../scripts/generate_python_stdlib_list/output.json" with {
@@ -80,7 +80,7 @@ async function handler(
8080 if ( confirmSave ) {
8181 createConfig ( napiConfig , argv . workdir ) ;
8282 console . info ( "\n✅ Configuration saved successfully!" ) ;
83- console . info ( `📄 Created: ${ argv . workdir } / .napirc` ) ;
83+ console . info ( `📄 Created: ${ argv . workdir } ${ SEPARATOR } .napirc` ) ;
8484 console . info ( "🎉 Your NanoAPI project is ready!" ) ;
8585 } else {
8686 console . info ( "❌ Configuration not saved" ) ;
@@ -238,8 +238,8 @@ async function collectIncludePatterns(
238238Include patterns define which files NanoAPI will process and analyze.
239239
240240Examples:
241- - '**/ *.py' for all Python files
242- - 'src/ **' for all files in src directory
241+ - '**${ SEPARATOR } *.py' for all Python files
242+ - 'src${ SEPARATOR } **' for all files in src directory
243243- '*.py' for all Python files in the root directory
244244` ,
245245 ) ;
@@ -281,7 +281,8 @@ Examples:
281281
282282 while ( continueAdding ) {
283283 const pattern = await input ( {
284- message : "Enter glob pattern (e.g., '**/*.py', 'src/**')" ,
284+ message :
285+ `Enter glob pattern (e.g., '**${ SEPARATOR } *.py', 'src${ SEPARATOR } **')` ,
285286 validate : ( value ) => {
286287 if ( ! value . trim ( ) ) return "Pattern cannot be empty" ;
287288 try {
@@ -363,9 +364,9 @@ async function collectExcludePatterns(
363364Exclude patterns define which files NanoAPI will ignore during processing.
364365
365366Examples:
366- - 'node_modules/ **' to exclude all node modules
367- - '**/ *.test.js' to exclude all JavaScript test files
368- - '.git/ **' to exclude git directory
367+ - 'node_modules${ SEPARATOR } **' to exclude all node modules
368+ - '**${ SEPARATOR } *.test.js' to exclude all JavaScript test files
369+ - '.git${ SEPARATOR } **' to exclude git directory
369370` ,
370371 ) ;
371372
@@ -410,7 +411,8 @@ Examples:
410411
411412 while ( continueAdding ) {
412413 const pattern = await input ( {
413- message : "Enter glob pattern (e.g., 'node_modules/**', '**/*.test.js')" ,
414+ message :
415+ `Enter glob pattern (e.g., 'node_modules${ SEPARATOR } **', '**${ SEPARATOR } *.test.js')` ,
414416 validate : ( value ) => {
415417 if ( ! value . trim ( ) ) return "Pattern cannot be empty" ;
416418 try {
@@ -488,45 +490,67 @@ function suggestIncludePatterns(
488490 // Language-specific suggestions
489491 if ( language === pythonLanguage ) {
490492 // Check for common Python project structures
491- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 src/" ) ) ) {
492- suggestions . push ( "src/**/*.py" ) ;
493+ if (
494+ projectStructure . some ( ( entry ) => entry . includes ( `📂 src${ SEPARATOR } ` ) )
495+ ) {
496+ suggestions . push ( `src${ SEPARATOR } **${ SEPARATOR } *.py` ) ;
493497 }
494- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 lib/" ) ) ) {
495- suggestions . push ( "lib/**/*.py" ) ;
498+ if (
499+ projectStructure . some ( ( entry ) => entry . includes ( `📂 lib${ SEPARATOR } ` ) )
500+ ) {
501+ suggestions . push ( `lib${ SEPARATOR } **${ SEPARATOR } *.py` ) ;
496502 }
497503 if ( suggestions . length === 0 ) {
498- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 app/" ) ) ) {
499- suggestions . push ( "app/**/*.py" ) ;
504+ if (
505+ projectStructure . some ( ( entry ) => entry . includes ( `📂 app${ SEPARATOR } ` ) )
506+ ) {
507+ suggestions . push ( `app${ SEPARATOR } **${ SEPARATOR } *.py` ) ;
500508 }
501509 }
502510
503511 // If no specific directories found, suggest all Python files
504512 if ( suggestions . length === 0 ) {
505- suggestions . push ( "**/ *.py" ) ;
513+ suggestions . push ( `** ${ SEPARATOR } *.py` ) ;
506514 }
507515 } else if ( language === csharpLanguage ) {
508516 // Check for common C# project structures
509- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 src/" ) ) ) {
517+ if (
518+ projectStructure . some ( ( entry ) => entry . includes ( `📂 src${ SEPARATOR } ` ) )
519+ ) {
510520 suggestions . push ( "src/**/*.cs" ) ;
511521 }
512- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 lib/" ) ) ) {
513- suggestions . push ( "lib/**/*.cs" ) ;
522+ if (
523+ projectStructure . some ( ( entry ) => entry . includes ( `📂 lib${ SEPARATOR } ` ) )
524+ ) {
525+ suggestions . push ( `lib${ SEPARATOR } **${ SEPARATOR } *.cs` ) ;
514526 }
515527 if ( suggestions . length === 0 ) {
516- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 Controllers/" ) ) ) {
517- suggestions . push ( "Controllers/**/*.cs" ) ;
528+ if (
529+ projectStructure . some ( ( entry ) =>
530+ entry . includes ( `📂 Controllers${ SEPARATOR } ` )
531+ )
532+ ) {
533+ suggestions . push ( `Controllers${ SEPARATOR } **${ SEPARATOR } *.cs` ) ;
518534 }
519- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 Models/" ) ) ) {
520- suggestions . push ( "Models/**/*.cs" ) ;
535+ if (
536+ projectStructure . some ( ( entry ) =>
537+ entry . includes ( `📂 Models${ SEPARATOR } ` )
538+ )
539+ ) {
540+ suggestions . push ( `Models${ SEPARATOR } **${ SEPARATOR } *.cs` ) ;
521541 }
522- if ( projectStructure . some ( ( entry ) => entry . includes ( "📂 Services/" ) ) ) {
523- suggestions . push ( "Services/**/*.cs" ) ;
542+ if (
543+ projectStructure . some ( ( entry ) =>
544+ entry . includes ( `📂 Services${ SEPARATOR } ` )
545+ )
546+ ) {
547+ suggestions . push ( `Services${ SEPARATOR } **${ SEPARATOR } *.cs` ) ;
524548 }
525549 }
526550
527551 // If no specific directories found, suggest all C# files
528552 if ( suggestions . length === 0 ) {
529- suggestions . push ( "**/ *.cs" ) ;
553+ suggestions . push ( `** ${ SEPARATOR } *.cs` ) ;
530554 }
531555 }
532556
@@ -544,36 +568,36 @@ function suggestExcludePatterns(
544568 const suggestions : string [ ] = [ ] ;
545569
546570 // add outDir to the suggestions
547- suggestions . push ( `${ outDir } / **` ) ;
571+ suggestions . push ( `${ outDir } ${ SEPARATOR } **` ) ;
548572
549573 // Common exclusions for all languages
550- suggestions . push ( " .git/**" ) ;
551- suggestions . push ( "**/ dist/**" ) ;
552- suggestions . push ( "**/ build/**" ) ;
574+ suggestions . push ( ` .git${ SEPARATOR } **` ) ;
575+ suggestions . push ( `** ${ SEPARATOR } dist${ SEPARATOR } **` ) ;
576+ suggestions . push ( `** ${ SEPARATOR } build${ SEPARATOR } **` ) ;
553577
554578 // Language-specific suggestions
555579 if ( language === pythonLanguage ) {
556- suggestions . push ( "**/ __pycache__/**" ) ;
557- suggestions . push ( "**/ *.pyc" ) ;
558- suggestions . push ( "**/ .pytest_cache/**" ) ;
559- suggestions . push ( "**/ venv/**" ) ;
560- suggestions . push ( "**/ .env/**" ) ;
561- suggestions . push ( "**/ *.egg-info/**" ) ;
562- suggestions . push ( "**/ .tox/**" ) ;
563- suggestions . push ( "**/ .coverage" ) ;
564- suggestions . push ( "**/ htmlcov/**" ) ;
565- suggestions . push ( "**/ .mypy_cache/**" ) ;
580+ suggestions . push ( `** ${ SEPARATOR } __pycache__${ SEPARATOR } **` ) ;
581+ suggestions . push ( `** ${ SEPARATOR } *.pyc` ) ;
582+ suggestions . push ( `** ${ SEPARATOR } .pytest_cache${ SEPARATOR } **` ) ;
583+ suggestions . push ( `** ${ SEPARATOR } venv${ SEPARATOR } **` ) ;
584+ suggestions . push ( `** ${ SEPARATOR } .env${ SEPARATOR } **` ) ;
585+ suggestions . push ( `** ${ SEPARATOR } *.egg-info${ SEPARATOR } **` ) ;
586+ suggestions . push ( `** ${ SEPARATOR } .tox${ SEPARATOR } **` ) ;
587+ suggestions . push ( `** ${ SEPARATOR } .coverage` ) ;
588+ suggestions . push ( `** ${ SEPARATOR } htmlcov${ SEPARATOR } **` ) ;
589+ suggestions . push ( `** ${ SEPARATOR } .mypy_cache${ SEPARATOR } **` ) ;
566590 } else if ( language === csharpLanguage ) {
567- suggestions . push ( "**/ bin/**" ) ;
568- suggestions . push ( "**/ obj/**" ) ;
569- suggestions . push ( "**/ packages/**" ) ;
570- suggestions . push ( "**/ .vs/**" ) ;
571- suggestions . push ( "**/ TestResults/**" ) ;
572- suggestions . push ( "**/ *.user" ) ;
573- suggestions . push ( "**/ *.suo" ) ;
574- suggestions . push ( "**/ .nuget/**" ) ;
575- suggestions . push ( "**/ artifacts/**" ) ;
576- suggestions . push ( "**/ packages/**" ) ;
591+ suggestions . push ( `** ${ SEPARATOR } bin${ SEPARATOR } **` ) ;
592+ suggestions . push ( `** ${ SEPARATOR } obj${ SEPARATOR } **` ) ;
593+ suggestions . push ( `** ${ SEPARATOR } packages${ SEPARATOR } **` ) ;
594+ suggestions . push ( `** ${ SEPARATOR } .vs${ SEPARATOR } **` ) ;
595+ suggestions . push ( `** ${ SEPARATOR } TestResults${ SEPARATOR } **` ) ;
596+ suggestions . push ( `** ${ SEPARATOR } *.user` ) ;
597+ suggestions . push ( `** ${ SEPARATOR } *.suo` ) ;
598+ suggestions . push ( `** ${ SEPARATOR } .nuget${ SEPARATOR } **` ) ;
599+ suggestions . push ( `** ${ SEPARATOR } artifacts${ SEPARATOR } **` ) ;
600+ suggestions . push ( `** ${ SEPARATOR } packages${ SEPARATOR } **` ) ;
577601 }
578602
579603 return suggestions ;
0 commit comments