Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

chore: add portable pre-commit hook with install script

Mario8f0648a1f8d1
diff --git a/internal/bridge/api.go b/internal/bridge/api.go
index f2a6d11e..dc724e28 100644
--- a/internal/bridge/api.go
+++ b/internal/bridge/api.go
@@ -123,3 +123,5 @@ type InstanceTab struct {
URL string `json:"url"`
Title string `json:"title"`
}
+
+// test
diff --git a/scripts/install-hooks.sh b/scripts/install-hooks.sh
new file mode 100755
index 00000000..26801e90
--- /dev/null
+++ b/scripts/install-hooks.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cp "$(dirname "$0")/pre-commit" "$(git rev-parse --show-toplevel)/.git/hooks/pre-commit"
+chmod +x "$(git rev-parse --show-toplevel)/.git/hooks/pre-commit"
+echo "✅ Git hooks installed"
diff --git a/scripts/pre-commit b/scripts/pre-commit
new file mode 100755
index 00000000..fd505cf1
--- /dev/null
+++ b/scripts/pre-commit
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Pre-commit hook: gofmt + golangci-lint on staged Go files
+
+staged=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$' || true)
+if [ -z "$staged" ]; then
+ exit 0
+fi
+
+# 1. gofmt check
+unformatted=$(gofmt -l $staged 2>/dev/null || true)
+if [ -n "$unformatted" ]; then
+ echo "❌ gofmt: files not formatted:"
+ echo "$unformatted"
+ echo "Run: gofmt -w $unformatted"
+ exit 1
+fi
+
+# 2. golangci-lint (if available)
+if command -v golangci-lint &>/dev/null; then
+ # Get unique directories of staged files
+ dirs=$(echo "$staged" | xargs -n1 dirname | sort -u | sed 's|$|/...|')
+ golangci-lint run --timeout=5m $dirs
+ if [ $? -ne 0 ]; then
+ echo "❌ golangci-lint: issues found"
+ exit 1
+ fi
+else
+ echo "⚠️ golangci-lint not found, skipping lint check"
+fi
+
+echo "✅ pre-commit checks passed"