@@ -20,6 +20,11 @@ import {
2020import { ApiService } from "../../../apiService/index.ts" ;
2121import type { globalConfigSchema } from "../../middlewares/globalConfig.ts" ;
2222import { isAuthenticatedMiddleware } from "../../middlewares/isAuthenticated.ts" ;
23+ import {
24+ ANTHROPIC_PROVIDER ,
25+ GOOGLE_PROVIDER ,
26+ OPENAI_PROVIDER ,
27+ } from "../../../manifest/dependencyManifest/labeling/model.ts" ;
2328
2429function builder (
2530 yargs : Arguments & {
@@ -1031,6 +1036,61 @@ export async function generateConfig(
10311036 // Show final file selection to the user
10321037 showFinalFileSelection ( workDir , includePatterns , excludePatterns ) ;
10331038
1039+ // Labeling configuration
1040+ console . info ( "\n🏷️ LABELING CONFIGURATION" ) ;
1041+ console . info (
1042+ "Labeling helps categorize and organize your code dependencies using AI models." ,
1043+ ) ;
1044+
1045+ const enableLabeling = await confirm ( {
1046+ message : "Would you like to enable AI-powered labeling?" ,
1047+ default : false ,
1048+ } ) ;
1049+
1050+ let labelingConfig :
1051+ | z . infer < typeof localConfigSchema > [ "labeling" ]
1052+ | undefined = undefined ;
1053+
1054+ if ( enableLabeling ) {
1055+ console . info ( "\n🤖 AI MODEL SELECTION" ) ;
1056+ console . info (
1057+ "Choose an AI provider for labeling your dependencies:" ,
1058+ ) ;
1059+
1060+ const modelProvider = await select ( {
1061+ message : "Select AI model provider:" ,
1062+ choices : [
1063+ { name : "OpenAI (GPT-4o-mini)" , value : OPENAI_PROVIDER } ,
1064+ { name : "Google (Gemini 2.5 Flash)" , value : GOOGLE_PROVIDER } ,
1065+ { name : "Anthropic (Claude 3.5 Sonnet)" , value : ANTHROPIC_PROVIDER } ,
1066+ ] ,
1067+ } ) as
1068+ | typeof OPENAI_PROVIDER
1069+ | typeof GOOGLE_PROVIDER
1070+ | typeof ANTHROPIC_PROVIDER ;
1071+
1072+ const maxConcurrency = await input ( {
1073+ message : "Enter maximum concurrent requests (leave empty for unlimited):" ,
1074+ validate : ( value ) => {
1075+ if ( ! value . trim ( ) ) return true ; // Allow empty for unlimited
1076+ const num = parseInt ( value ) ;
1077+ if ( isNaN ( num ) || num <= 0 ) {
1078+ return "Please enter a positive number or leave empty for unlimited" ;
1079+ }
1080+ return true ;
1081+ } ,
1082+ } ) ;
1083+
1084+ labelingConfig = {
1085+ modelProvider,
1086+ maxConcurrency : maxConcurrency . trim ( )
1087+ ? parseInt ( maxConcurrency )
1088+ : undefined ,
1089+ } ;
1090+
1091+ console . info ( "✅ Labeling configuration added" ) ;
1092+ }
1093+
10341094 // Build the config object
10351095 const config : z . infer < typeof localConfigSchema > = {
10361096 language : language ,
@@ -1052,5 +1112,10 @@ export async function generateConfig(
10521112 config . c = cConfig ;
10531113 }
10541114
1115+ // Add labeling config if it exists
1116+ if ( labelingConfig ) {
1117+ config . labeling = labelingConfig ;
1118+ }
1119+
10551120 return config ;
10561121}
0 commit comments