-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCEMENT_REMOTE_WORK.bat
More file actions
65 lines (55 loc) · 2.05 KB
/
Copy pathCEMENT_REMOTE_WORK.bat
File metadata and controls
65 lines (55 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@echo off
REM ============================================================================
REM HECTON-8 — CEMENT REMOTE AGENT WORK
REM Fixes delivered by the remote (cloud) agent land in the working tree as
REM UNCOMMITTED changes. A `git reset --hard` / `git checkout .` / `git stash`
REM by any local agent wipes them silently. Run this right after remote work
REM arrives, and BEFORE any local agent performs a git operation.
REM
REM Safe by design: only `git add -A` + `git commit`. Never resets, never
REM discards, never switches branches, never pushes.
REM ============================================================================
setlocal
cd /d "%~dp0"
echo.
echo === HECTON-8 : cementing working-tree changes ===
echo Repo: %CD%
echo.
git rev-parse --is-inside-work-tree >nul 2>&1
if errorlevel 1 (
echo [BLOCKED] Not a git repository: %CD%
goto :end
)
for /f "delims=" %%b in ('git rev-parse --abbrev-ref HEAD 2^>nul') do set BRANCH=%%b
echo Branch: %BRANCH%
echo.
git config user.email >nul 2>&1
if errorlevel 1 git config user.email "agent@hecton8.local"
git config user.name >nul 2>&1
if errorlevel 1 git config user.name "HECTON8 Agent"
echo --- changes about to be committed ---
git status --porcelain
echo.
for /f %%c in ('git status --porcelain ^| find /c /v ""') do set CHANGES=%%c
if "%CHANGES%"=="0" (
echo [OK] Working tree already clean - nothing to cement.
goto :end
)
git add -A
if errorlevel 1 (
echo [BLOCKED] git add failed.
goto :end
)
for /f "tokens=1-3 delims=/. " %%a in ("%DATE%") do set STAMP=%%c-%%b-%%a
git commit -m "chore(agent): cement working-tree changes %STAMP% %TIME:~0,5%" -m "Automated safety commit. Includes remote-agent fixes (R95-R98 terrain/voxel/shader) and any local work present at commit time. Created by CEMENT_REMOTE_WORK.bat so a later reset/checkout/stash cannot silently discard them."
if errorlevel 1 (
echo [BLOCKED] git commit failed - resolve the message above, then re-run.
goto :end
)
echo.
echo [OK] Committed. Recovery point:
git --no-pager log -1 --oneline
:end
echo.
pause
endlocal