From 30e39b5c6fd64650adef383b5810b975077f7240 Mon Sep 17 00:00:00 2001 From: donald Date: Sat, 6 Dec 2025 00:18:28 +0800 Subject: [PATCH] feat: Add start-dev.bat and improve app.py error reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added Windows-optimized launcher: - start-dev.bat: Simple batch file using npm run dev - Automatically kills processes on ports 3001 and 5173 - Uses concurrently to run both services - Single window, simpler than Python launcher - Recommended for Windows users Improved app.py: - Better error output capture and display - Increased wait time to 3 seconds - Shows last 500 characters of error output Windows users now have 3 options: 1. start-dev.bat (simplest - recommended) 2. python app.py (advanced with port management) 3. npm run dev (manual) 🤖 Generated with Claude Code Co-Authored-By: Claude --- app.py | 11 ++++++++++- start-dev.bat | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 start-dev.bat diff --git a/app.py b/app.py index 9a42d9b..8bfaca7 100644 --- a/app.py +++ b/app.py @@ -179,7 +179,7 @@ class AppLauncher: ) # Wait a bit and check if process started successfully - time.sleep(2) + time.sleep(3) if self.backend_process.poll() is None: self.print_success("Backend server started successfully") @@ -187,6 +187,15 @@ class AppLauncher: return True else: self.print_error("Backend server failed to start") + # Try to read error output + if self.backend_process.stdout: + try: + output = self.backend_process.stdout.read() + if output: + print(f"\n{Color.FAIL}Error output:{Color.ENDC}") + print(output[-500:] if len(output) > 500 else output) # Last 500 chars + except: + pass return False except Exception as e: diff --git a/start-dev.bat b/start-dev.bat new file mode 100644 index 0000000..bddbaf3 --- /dev/null +++ b/start-dev.bat @@ -0,0 +1,33 @@ +@echo off +REM 5 Why Root Cause Analyzer - Simple Dev Launcher +REM Uses npm dev which runs both services with concurrently + +echo. +echo ====================================================================== +echo 5 Why Root Cause Analyzer - v1.0.0 +echo Starting Development Servers... +echo ====================================================================== +echo. + +REM Kill any existing processes on ports 3001 and 5173 +echo Cleaning up ports... +for /f "tokens=5" %%a in ('netstat -ano ^| findstr :3001 ^| findstr LISTENING') do taskkill /F /PID %%a 2>nul +for /f "tokens=5" %%a in ('netstat -ano ^| findstr :5173 ^| findstr LISTENING') do taskkill /F /PID %%a 2>nul + +echo. +echo Starting services with npm dev... +echo. +echo Access Points: +echo Frontend: http://localhost:5173 +echo Backend: http://localhost:3001 +echo. +echo Test Accounts: +echo Admin: admin@example.com / Admin@123456 +echo User1: user001@example.com / User@123456 +echo User2: user002@example.com / User@123456 +echo. +echo Press Ctrl+C to stop all services +echo ====================================================================== +echo. + +npm run dev