@echo off setlocal enabledelayedexpansion rem Sync TSL Playbook snapshot to project root. rem - Copies docs\standards\tsl_playbook\.agents -> .agents rem - Copies docs\standards\tsl_playbook\.gitattributes -> .gitattributes rem Existing targets are backed up before overwrite. for /f "delims=" %%R in ('git rev-parse --show-toplevel 2^>nul') do set "ROOT=%%R" if "%ROOT%"=="" set "ROOT=%cd%" set "SRC=%ROOT%\docs\standards\tsl_playbook" set "AGENTS_SRC=%SRC%\.agents" set "GITATTR_SRC=%SRC%\.gitattributes" set "AGENTS_DST=%ROOT%\.agents" set "GITATTR_DST=%ROOT%\.gitattributes" if not exist "%AGENTS_SRC%" ( echo ERROR: Playbook snapshot not found at "%AGENTS_SRC%". echo Run: git subtree add --prefix docs/standards/tsl_playbook ^ main --squash exit /b 1 ) if exist "%AGENTS_DST%" ( set "RAND=%RANDOM%" set "BAK_NAME=.agents.bak.!RAND!" ren "%AGENTS_DST%" "!BAK_NAME!" echo Backed up existing .agents -> !BAK_NAME! ) xcopy "%AGENTS_SRC%" "%AGENTS_DST%\" /e /i /y >nul if errorlevel 1 ( echo ERROR: failed to copy .agents exit /b 1 ) echo Synced .agents from Playbook. if exist "%GITATTR_SRC%" ( if exist "%GITATTR_DST%" ( set "RAND=%RANDOM%" set "BAK_NAME=.gitattributes.bak.!RAND!" ren "%GITATTR_DST%" "!BAK_NAME!" echo Backed up existing .gitattributes -> !BAK_NAME! ) copy /y "%GITATTR_SRC%" "%GITATTR_DST%" >nul echo Synced .gitattributes from Playbook. ) echo Done. endlocal