44 getConfigFromWorkDir ,
55} from "../../middlewares/napiConfig.ts" ;
66import { join , normalize , relative , SEPARATOR } from "@std/path" ;
7- import type z from "zod" ;
7+ import z from "zod" ;
88import type { localConfigSchema } from "../../middlewares/napiConfig.ts" ;
99import pythonStdlibList from "../../../scripts/generate_python_stdlib_list/output.json" with {
1010 type : "json" ,
@@ -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 & {
@@ -749,12 +754,25 @@ async function createNewProject(apiService: ApiService): Promise<number> {
749754 } ,
750755 } ) ;
751756
757+ const projectRepoUrl = await input ( {
758+ message : "Enter the URL of your project repository:" ,
759+ validate : ( value ) => {
760+ if ( ! value . trim ( ) ) return "Project repository URL cannot be empty" ;
761+ const result = z . string ( ) . url ( ) . safeParse ( value ) ;
762+ if ( ! result . success ) {
763+ return result . error . message ;
764+ }
765+ return true ;
766+ } ,
767+ } ) ;
768+
752769 try {
753770 const createProjectResponse = await apiService . performRequest (
754771 "POST" ,
755772 "/projects" ,
756773 {
757774 name : projectName ,
775+ repoUrl : projectRepoUrl ,
758776 workspaceId : selectedWorkspaceId ,
759777 maxCodeCharPerSymbol : 100 ,
760778 maxCodeCharPerFile : 1000 ,
@@ -1018,6 +1036,61 @@ export async function generateConfig(
10181036 // Show final file selection to the user
10191037 showFinalFileSelection ( workDir , includePatterns , excludePatterns ) ;
10201038
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+
10211094 // Build the config object
10221095 const config : z . infer < typeof localConfigSchema > = {
10231096 language : language ,
@@ -1039,5 +1112,10 @@ export async function generateConfig(
10391112 config . c = cConfig ;
10401113 }
10411114
1115+ // Add labeling config if it exists
1116+ if ( labelingConfig ) {
1117+ config . labeling = labelingConfig ;
1118+ }
1119+
10421120 return config ;
10431121}
0 commit comments