feat(hooks): add cross-platform safety and status hooks

This commit is contained in:
Julian lechner
2026-09-11 14:42:57 +02:00
parent 54820797fa
commit 0189323e8f
11 changed files with 342 additions and 0 deletions
@@ -0,0 +1,5 @@
param([Parameter(Mandatory=$true)][string]$Command, [string]$Workspace = (Get-Location).Path)
$dangerous = @('git reset --hard','git clean -fd','git clean -fx','Remove-Item -Recurse','rm -rf','format c:','del /s /q')
foreach ($pattern in $dangerous) { if ($Command.IndexOf($pattern, [StringComparison]::OrdinalIgnoreCase) -ge 0) { Write-Error "Blocked potentially destructive command: $pattern"; exit 1 } }
if ($Command -match '(?i)(^|\s)([A-Z]:\\|/)(?!.*' + [regex]::Escape($Workspace) + ')') { Write-Error 'Blocked command containing an absolute path outside the workspace.'; exit 1 }
Write-Output 'PASS command safety'