@@ -116,12 +116,14 @@ def log_error_details(self, component, error_output):
116116 f"[red]❌ { component } build failed (use --verbose for details)[/red]"
117117 )
118118
119- def run_subprocess_with_logging (self , cmd , component_name , cwd = None , realtime = False ):
119+ def run_subprocess_with_logging (
120+ self , cmd , component_name , cwd = None , realtime = False
121+ ):
120122 """Run subprocess with standardized logging"""
121123 if realtime :
122124 # Real-time output for long-running processes like npm install
123125 self .console .print (f"[cyan]Running: { ' ' .join (cmd )} [/cyan]" )
124-
126+
125127 try :
126128 process = subprocess .Popen (
127129 cmd ,
@@ -130,28 +132,37 @@ def run_subprocess_with_logging(self, cmd, component_name, cwd=None, realtime=Fa
130132 text = True ,
131133 cwd = cwd ,
132134 bufsize = 1 ,
133- universal_newlines = True
135+ universal_newlines = True ,
134136 )
135-
137+
136138 output_lines = []
137139 while True :
138140 output = process .stdout .readline ()
139- if output == '' and process .poll () is not None :
141+ if output == "" and process .poll () is not None :
140142 break
141143 if output :
142144 line = output .strip ()
143145 output_lines .append (line )
144146 # Show progress for npm commands
145- if 'npm' in ' ' .join (cmd ):
146- if any (keyword in line .lower () for keyword in ['downloading' , 'installing' , 'added' , 'updated' , 'audited' ]):
147+ if "npm" in " " .join (cmd ):
148+ if any (
149+ keyword in line .lower ()
150+ for keyword in [
151+ "downloading" ,
152+ "installing" ,
153+ "added" ,
154+ "updated" ,
155+ "audited" ,
156+ ]
157+ ):
147158 self .console .print (f"[dim] { line } [/dim]" )
148- elif ' warn' in line .lower ():
159+ elif " warn" in line .lower ():
149160 self .console .print (f"[yellow] { line } [/yellow]" )
150- elif ' error' in line .lower ():
161+ elif " error" in line .lower ():
151162 self .console .print (f"[red] { line } [/red]" )
152-
163+
153164 return_code = process .poll ()
154-
165+
155166 if return_code != 0 :
156167 error_msg = f"""Command failed: { " " .join (cmd )}
157168Working directory: { cwd or os .getcwd ()}
@@ -162,11 +173,13 @@ def run_subprocess_with_logging(self, cmd, component_name, cwd=None, realtime=Fa
162173 print (error_msg )
163174 self .log_error_details (component_name , error_msg )
164175 return False , error_msg
165-
176+
166177 return True , None # Success, no result object needed for real-time
167-
178+
168179 except Exception as e :
169- error_msg = f"Failed to execute command: { ' ' .join (cmd )} \n Error: { str (e )} "
180+ error_msg = (
181+ f"Failed to execute command: { ' ' .join (cmd )} \n Error: { str (e )} "
182+ )
170183 self .log_error_details (component_name , error_msg )
171184 return False , error_msg
172185 else :
@@ -1176,7 +1189,9 @@ def validate_ui_build(self):
11761189 return
11771190
11781191 # Run npm install first
1179- self .console .print ("[cyan]📦 Installing UI dependencies (this may take a while)...[/cyan]" )
1192+ self .console .print (
1193+ "[cyan]📦 Installing UI dependencies (this may take a while)...[/cyan]"
1194+ )
11801195 success , result = self .run_subprocess_with_logging (
11811196 ["npm" , "install" ], "UI npm install" , ui_dir , realtime = True
11821197 )
@@ -1185,7 +1200,9 @@ def validate_ui_build(self):
11851200 raise Exception ("npm install failed" )
11861201
11871202 # Run npm run build to validate ESLint/Prettier
1188- self .console .print ("[cyan]🔨 Building UI (validating ESLint/Prettier)...[/cyan]" )
1203+ self .console .print (
1204+ "[cyan]🔨 Building UI (validating ESLint/Prettier)...[/cyan]"
1205+ )
11891206 success , result = self .run_subprocess_with_logging (
11901207 ["npm" , "run" , "build" ], "UI build validation" , ui_dir , realtime = True
11911208 )
0 commit comments