Refactor code structure for improved readability and maintainability

This commit is contained in:
Zied
2026-02-26 11:40:51 +01:00
parent f88fde08b2
commit 689a825411
265 changed files with 25535 additions and 4503 deletions

View File

@@ -15,15 +15,17 @@ IF %ERRORLEVEL% NEQ 0 (
)
:: ===== Auto-Update Skills from GitHub =====
echo [INFO] Checking for skill updates...
:: Method 1: Try Git first (if available)
WHERE git >nul 2>nul
IF %ERRORLEVEL% NEQ 0 goto :NO_GIT
goto :HAS_GIT
IF %ERRORLEVEL% EQU 0 goto :USE_GIT
:NO_GIT
echo [WARN] Git is not installed. Skipping auto-update.
goto :SKIP_UPDATE
:: Method 2: Try PowerShell download (fallback)
echo [INFO] Git not found. Using alternative download method...
goto :USE_POWERSHELL
:HAS_GIT
:USE_GIT
:: Add upstream remote if not already set
git remote get-url upstream >nul 2>nul
IF %ERRORLEVEL% EQU 0 goto :DO_FETCH
@@ -31,23 +33,69 @@ echo [INFO] Adding upstream remote...
git remote add upstream https://github.com/sickn33/antigravity-awesome-skills.git
:DO_FETCH
echo [INFO] Checking for skill updates from original repo...
echo [INFO] Fetching latest skills from original repo...
git fetch upstream >nul 2>nul
IF %ERRORLEVEL% NEQ 0 goto :FETCH_FAIL
goto :DO_MERGE
:FETCH_FAIL
echo [WARN] Could not fetch updates. Continuing with local version...
goto :SKIP_UPDATE
echo [WARN] Could not fetch updates via Git. Trying alternative method...
goto :USE_POWERSHELL
:DO_MERGE
git merge upstream/main --ff-only >nul 2>nul
:: Surgically extract ONLY the /skills/ folder from upstream to avoid all merge conflicts
git checkout upstream/main -- skills >nul 2>nul
IF %ERRORLEVEL% NEQ 0 goto :MERGE_FAIL
:: Save the updated skills to local history silently
git commit -m "auto-update: sync latest skills from upstream" >nul 2>nul
echo [INFO] Skills updated successfully from original repo!
goto :SKIP_UPDATE
:MERGE_FAIL
echo [WARN] Could not merge updates. Continuing with local version...
echo [WARN] Could not update skills via Git. Trying alternative method...
goto :USE_POWERSHELL
:USE_POWERSHELL
echo [INFO] Downloading latest skills via HTTPS...
if exist "update_temp" rmdir /S /Q "update_temp" >nul 2>nul
if exist "update.zip" del "update.zip" >nul 2>nul
:: Download the latest repository as ZIP
powershell -Command "Invoke-WebRequest -Uri 'https://github.com/sickn33/antigravity-awesome-skills/archive/refs/heads/main.zip' -OutFile 'update.zip' -UseBasicParsing" >nul 2>nul
IF %ERRORLEVEL% NEQ 0 goto :DOWNLOAD_FAIL
:: Extract and update skills
echo [INFO] Extracting latest skills...
powershell -Command "Expand-Archive -Path 'update.zip' -DestinationPath 'update_temp' -Force" >nul 2>nul
IF %ERRORLEVEL% NEQ 0 goto :EXTRACT_FAIL
:: Copy only the skills folder
if exist "update_temp\antigravity-awesome-skills-main\skills" (
echo [INFO] Updating skills directory...
xcopy /E /Y /I "update_temp\antigravity-awesome-skills-main\skills" "skills" >nul 2>nul
echo [INFO] Skills updated successfully without Git!
) else (
echo [WARN] Could not find skills folder in downloaded archive.
goto :UPDATE_FAIL
)
:: Cleanup
del "update.zip" >nul 2>nul
rmdir /S /Q "update_temp" >nul 2>nul
goto :SKIP_UPDATE
:DOWNLOAD_FAIL
echo [WARN] Failed to download skills update (network issue or no internet).
goto :UPDATE_FAIL
:EXTRACT_FAIL
echo [WARN] Failed to extract downloaded skills archive.
goto :UPDATE_FAIL
:UPDATE_FAIL
echo [INFO] Continuing with local skills version...
echo [INFO] To manually update skills later, run: npm run update:skills
:SKIP_UPDATE