diff --git a/installation-samples/install-global/verify-aikido-hook.ps1 b/installation-samples/install-global/verify-aikido-hook.ps1 new file mode 100644 index 0000000..236f4d2 --- /dev/null +++ b/installation-samples/install-global/verify-aikido-hook.ps1 @@ -0,0 +1,32 @@ +#!/usr/bin/env pwsh + +$ErrorActionPreference = "Stop" + +# Check if core.hooksPath is set +$hooksPath = git config --global core.hooksPath 2>$null + +if (-not $hooksPath) { + Write-Host "❌ core.hooksPath is not set" -ForegroundColor Red + exit 1 +} + +Write-Host "✅ core.hooksPath is set to: $hooksPath" -ForegroundColor Green + +# Check if pre-commit hook exists +$hookScript = Join-Path $hooksPath "pre-commit" +if (-not (Test-Path $hookScript)) { + Write-Host "❌ Pre-commit hook file not found at: $hookScript" -ForegroundColor Red + exit 1 +} + +# Check if aikido-local-scanner is mentioned in the hook +$hookContent = Get-Content $hookScript -Raw +if ($hookContent -notmatch "aikido-local-scanner") { + Write-Host "❌ aikido-local-scanner not found in pre-commit hook" -ForegroundColor Red + exit 1 +} + +Write-Host "✅ aikido-local-scanner found in pre-commit hook" -ForegroundColor Green +Write-Host "" +Write-Host "✅ Verification complete: Aikido pre-commit hook is installed" -ForegroundColor Green + diff --git a/installation-samples/install-global/verify-aikido-hook.sh b/installation-samples/install-global/verify-aikido-hook.sh new file mode 100755 index 0000000..2360e4f --- /dev/null +++ b/installation-samples/install-global/verify-aikido-hook.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Check if core.hooksPath is set +HOOKS_PATH="$(git config --global core.hooksPath || echo '')" + +if [ -z "${HOOKS_PATH}" ]; then + echo "❌ core.hooksPath is not set" + exit 1 +fi + +echo "✅ core.hooksPath is set to: ${HOOKS_PATH}" + +# Check if pre-commit hook exists +HOOK_SCRIPT="${HOOKS_PATH}/pre-commit" +if [ ! -f "${HOOK_SCRIPT}" ]; then + echo "❌ Pre-commit hook file not found at: ${HOOK_SCRIPT}" + exit 1 +fi + +# Check if aikido-local-scanner is mentioned in the hook +if ! grep -q "aikido-local-scanner" "${HOOK_SCRIPT}"; then + echo "❌ aikido-local-scanner not found in pre-commit hook" + exit 1 +fi + +echo "✅ aikido-local-scanner found in pre-commit hook" +echo "" +echo "✅ Verification complete: Aikido pre-commit hook is installed" +