@echo off
rem install-hooks.cmd -- installs the LearnSpace pre-commit hook on Windows
rem Usage: scripts\install-hooks.cmd
rem Or via npm: npm run hooks:install

for /f "tokens=*" %%i in ('git rev-parse --show-toplevel') do set REPO=%%i
set HOOK=%REPO%\.git\hooks\pre-commit

(
echo #!/bin/sh
echo # LearnSpace pre-commit hook ^(auto-generated -- edit scripts/pre-commit.js^)
echo REPO="$(git rev-parse --show-toplevel)"
echo node "$REPO/scripts/pre-commit.js" ^|^| exit 1
) > "%HOOK%"

echo Pre-commit hook installed at: %HOOK%
echo Bypass anytime with: git commit --no-verify
