@@ -952,16 +952,34 @@ async function installSemantic(gpuMode: GpuMode = 'cpu'): Promise<BootstrapResul
952952 * @returns Bootstrap result
953953 */
954954async function bootstrapVenv ( ) : Promise < BootstrapResult > {
955+ const warnings : string [ ] = [ ] ;
956+
955957 // Prefer UV if available (faster package resolution and installation)
956958 if ( await isUvAvailable ( ) ) {
957959 console . log ( '[CodexLens] Using UV for bootstrap...' ) ;
958- return bootstrapWithUv ( ) ;
960+ try {
961+ const uvResult = await bootstrapWithUv ( ) ;
962+ if ( uvResult . success ) {
963+ return uvResult ;
964+ }
965+
966+ console . log ( '[CodexLens] UV bootstrap failed, falling back to pip:' , uvResult . error ) ;
967+ warnings . push ( `UV bootstrap failed: ${ uvResult . error || 'Unknown error' } ` ) ;
968+ } catch ( uvErr ) {
969+ const message = uvErr instanceof Error ? uvErr . message : String ( uvErr ) ;
970+ console . log ( '[CodexLens] UV bootstrap error, falling back to pip:' , message ) ;
971+ warnings . push ( `UV bootstrap error: ${ message } ` ) ;
972+ }
959973 }
960974
961975 // Pre-flight: verify Python is available and compatible
962976 const preFlightError = preFlightCheck ( ) ;
963977 if ( preFlightError ) {
964- return { success : false , error : `Pre-flight failed: ${ preFlightError } ` } ;
978+ return {
979+ success : false ,
980+ error : `Pre-flight failed: ${ preFlightError } ` ,
981+ warnings : warnings . length > 0 ? warnings : undefined ,
982+ } ;
965983 }
966984
967985 // Auto-repair corrupted venv before proceeding
@@ -976,19 +994,23 @@ async function bootstrapVenv(): Promise<BootstrapResult> {
976994 }
977995
978996 // Create venv if not exists
979- if ( ! existsSync ( venvDir ) ) {
980- try {
981- console . log ( '[CodexLens] Creating virtual environment...' ) ;
982- const pythonCmd = getSystemPython ( ) ;
983- execSync ( `${ pythonCmd } -m venv "${ venvDir } "` , { stdio : 'inherit' , timeout : EXEC_TIMEOUTS . PROCESS_SPAWN } ) ;
984- } catch ( err ) {
985- return { success : false , error : `Failed to create venv: ${ ( err as Error ) . message } ` } ;
997+ if ( ! existsSync ( venvDir ) ) {
998+ try {
999+ console . log ( '[CodexLens] Creating virtual environment...' ) ;
1000+ const pythonCmd = getSystemPython ( ) ;
1001+ execSync ( `${ pythonCmd } -m venv "${ venvDir } "` , { stdio : 'inherit' , timeout : EXEC_TIMEOUTS . PROCESS_SPAWN } ) ;
1002+ } catch ( err ) {
1003+ return {
1004+ success : false ,
1005+ error : `Failed to create venv: ${ ( err as Error ) . message } ` ,
1006+ warnings : warnings . length > 0 ? warnings : undefined ,
1007+ } ;
1008+ }
9861009 }
987- }
9881010
989- // Install codex-lens
990- try {
991- console . log ( '[CodexLens] Installing codex-lens package...' ) ;
1011+ // Install codex-lens
1012+ try {
1013+ console . log ( '[CodexLens] Installing codex-lens package...' ) ;
9921014 const pipPath = getCodexLensPip ( ) ;
9931015
9941016 // Try local path using unified discovery
@@ -1006,9 +1028,13 @@ async function bootstrapVenv(): Promise<BootstrapResult> {
10061028 // Clear cache after successful installation
10071029 clearVenvStatusCache ( ) ;
10081030 clearSemanticStatusCache ( ) ;
1009- return { success : true } ;
1031+ return { success : true , warnings : warnings . length > 0 ? warnings : undefined } ;
10101032 } catch ( err ) {
1011- return { success : false , error : `Failed to install codex-lens: ${ ( err as Error ) . message } ` } ;
1033+ return {
1034+ success : false ,
1035+ error : `Failed to install codex-lens: ${ ( err as Error ) . message } ` ,
1036+ warnings : warnings . length > 0 ? warnings : undefined ,
1037+ } ;
10121038 }
10131039}
10141040
0 commit comments