Skip to content

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

add format check + coverage to CI, add pre-commit hook, fix cdp.go formatting

Lcd43563443a8
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
new file mode 100755
index 00000000..ac532849
--- /dev/null
+++ b/.githooks/pre-commit
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Pre-commit hook: format, vet, test
+
+set -e
+
+echo "🦀 pre-commit: gofmt..."
+unformatted=$(gofmt -l .)
+if [ -n "$unformatted" ]; then
+ echo "Files not formatted (run 'gofmt -w .'):"
+ echo "$unformatted"
+ exit 1
+fi
+
+echo "🦀 pre-commit: go vet..."
+go vet ./...
+
+echo "🦀 pre-commit: go test..."
+go test ./... -count=1 -timeout=30s
+
+echo "🦀 PINCH! All checks passed."
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d752b915..3b17fef5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,14 +23,26 @@ jobs:
- name: Download deps
run: go mod download
+ - name: Format check
+ run: |
+ unformatted=$(gofmt -l .)
+ if [ -n "$unformatted" ]; then
+ echo "Files not formatted:"
+ echo "$unformatted"
+ exit 1
+ fi
+
- name: Vet
run: go vet ./...
- name: Build
run: go build -o pinchtab .
- - name: Test
- run: go test ./... -v -count=1
+ - name: Test with coverage
+ run: go test ./... -v -count=1 -coverprofile=coverage.out -covermode=atomic
+
+ - name: Coverage summary
+ run: go tool cover -func=coverage.out | tail -1
lint:
name: Lint
diff --git a/.gitignore b/.gitignore
index dffc758e..f8d8794c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
node_modules/
browser-bridge
pinchtab
+coverage.out
diff --git a/cdp.go b/cdp.go
index a4533eb8..1dd8a4d6 100644
--- a/cdp.go
+++ b/cdp.go
@@ -31,7 +31,7 @@ func navigatePage(ctx context.Context, url string) error {
}),
// Brief sleep to let the page start rendering — not a full load wait.
// Agents should use /snapshot to confirm readiness.
- chromedp.Sleep(500 * time.Millisecond),
+ chromedp.Sleep(500*time.Millisecond),
)
}