From 47c4b6d855a8c57591bc278e07aa148486db358f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 05:49:34 +0000 Subject: [PATCH 1/5] Initial plan From 03625fe0d0ea47174a90b4e685a9b6ef5098c49d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 05:51:34 +0000 Subject: [PATCH 2/5] Make pre-commit installation consistent between bash and Windows scripts Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com> --- setup_dev.bat | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup_dev.bat b/setup_dev.bat index f9e615e..8e2cc97 100644 --- a/setup_dev.bat +++ b/setup_dev.bat @@ -60,10 +60,14 @@ if exist "requirements-dev.txt" ( REM Install pre-commit hooks echo. echo 🔧 Setting up pre-commit hooks... -python -m pip install pre-commit --quiet +where pre-commit >nul 2>&1 if errorlevel 1 ( - echo ❌ Error: Failed to install pre-commit - exit /b 1 + echo ⚠️ pre-commit not found. Installing... + python -m pip install pre-commit --quiet + if errorlevel 1 ( + echo ❌ Error: Failed to install pre-commit + exit /b 1 + ) ) pre-commit install if errorlevel 1 ( From 89c81e1da0a9aa0323c40aa5077baba8833c63c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 05:53:31 +0000 Subject: [PATCH 3/5] Improve pre-commit check to include pip package verification Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com> --- setup_dev.bat | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/setup_dev.bat b/setup_dev.bat index 8e2cc97..82705ac 100644 --- a/setup_dev.bat +++ b/setup_dev.bat @@ -60,8 +60,20 @@ if exist "requirements-dev.txt" ( REM Install pre-commit hooks echo. echo 🔧 Setting up pre-commit hooks... +REM Check if pre-commit exists (either as command or pip package) where pre-commit >nul 2>&1 -if errorlevel 1 ( +if not errorlevel 1 ( + set PRE_COMMIT_EXISTS=1 +) else ( + python -m pip show pre-commit >nul 2>&1 + if not errorlevel 1 ( + set PRE_COMMIT_EXISTS=1 + ) else ( + set PRE_COMMIT_EXISTS=0 + ) +) + +if %PRE_COMMIT_EXISTS%==0 ( echo ⚠️ pre-commit not found. Installing... python -m pip install pre-commit --quiet if errorlevel 1 ( @@ -69,6 +81,7 @@ if errorlevel 1 ( exit /b 1 ) ) + pre-commit install if errorlevel 1 ( echo ❌ Error: Failed to install pre-commit hooks From 8463faebc666d811a6db9599d5e3ed1d3bea736f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 05:54:15 +0000 Subject: [PATCH 4/5] Fix variable comparison syntax in Windows script Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com> --- setup_dev.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_dev.bat b/setup_dev.bat index 82705ac..d279073 100644 --- a/setup_dev.bat +++ b/setup_dev.bat @@ -73,7 +73,7 @@ if not errorlevel 1 ( ) ) -if %PRE_COMMIT_EXISTS%==0 ( +if "%PRE_COMMIT_EXISTS%"=="0" ( echo ⚠️ pre-commit not found. Installing... python -m pip install pre-commit --quiet if errorlevel 1 ( From 9d4228d6a29dfe0320d291f6348fbe3bf49ca1f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 06:01:57 +0000 Subject: [PATCH 5/5] Pin pre-commit version in requirements-dev.txt for supply-chain security Co-authored-by: omsherikar <180152315+omsherikar@users.noreply.github.com> --- requirements-dev.txt | 1 + setup_dev.bat | 22 ---------------------- setup_dev.sh | 11 ++--------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 03552f6..621f445 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,6 +10,7 @@ black>=23.0.0 mypy>=1.0.0 flake8>=6.0.0 isort>=5.12.0 +pre-commit==4.5.1 # Documentation sphinx>=7.0.0 diff --git a/setup_dev.bat b/setup_dev.bat index d279073..19bf0e5 100644 --- a/setup_dev.bat +++ b/setup_dev.bat @@ -60,28 +60,6 @@ if exist "requirements-dev.txt" ( REM Install pre-commit hooks echo. echo 🔧 Setting up pre-commit hooks... -REM Check if pre-commit exists (either as command or pip package) -where pre-commit >nul 2>&1 -if not errorlevel 1 ( - set PRE_COMMIT_EXISTS=1 -) else ( - python -m pip show pre-commit >nul 2>&1 - if not errorlevel 1 ( - set PRE_COMMIT_EXISTS=1 - ) else ( - set PRE_COMMIT_EXISTS=0 - ) -) - -if "%PRE_COMMIT_EXISTS%"=="0" ( - echo ⚠️ pre-commit not found. Installing... - python -m pip install pre-commit --quiet - if errorlevel 1 ( - echo ❌ Error: Failed to install pre-commit - exit /b 1 - ) -) - pre-commit install if errorlevel 1 ( echo ❌ Error: Failed to install pre-commit hooks diff --git a/setup_dev.sh b/setup_dev.sh index 71f2bde..847c5f1 100755 --- a/setup_dev.sh +++ b/setup_dev.sh @@ -58,15 +58,8 @@ fi # Install pre-commit hooks echo "" echo "🔧 Setting up pre-commit hooks..." -if command -v pre-commit &> /dev/null || pip show pre-commit &> /dev/null; then - pre-commit install - echo "✅ Pre-commit hooks installed" -else - echo "⚠️ pre-commit not found. Installing..." - pip install pre-commit --quiet - pre-commit install - echo "✅ Pre-commit hooks installed" -fi +pre-commit install +echo "✅ Pre-commit hooks installed" # Verify installation echo ""