Skip to content

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

add comprehensive pre-push check script

bot99fa9ae464cc
diff --git a/AGENTS.md b/AGENTS.md
index 9fb73896..93c3485e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -7,6 +7,9 @@ git config core.hooksPath .githooks # one-time setup
go build -o pinchtab . # build
go test ./... -count=1 # test
golangci-lint run ./... # lint (v2.9.0+)
+
+# Pre-push checks (matches CI exactly)
+./scripts/check.sh # run all CI checks locally
```
## Project Structure
@@ -44,10 +47,34 @@ Single Go package (`main`), no subdirectories. ~1100 lines across 13 files:
### Git
- Branch: **`main`** only
- Always **rebase before push**: `git pull --rebase && git push`
+- **ALWAYS run pre-push checks**: `./scripts/check.sh` before committing
- Pre-commit hook runs: `gofmt` check → `go vet` → `go test`
- If push is rejected, rebase — never force push unless you know why
- Commit messages: imperative, lowercase, concise. `fix lint: unchecked error return`
+### Pre-Push Workflow
+```bash
+# 1. Make your changes
+vim some_file.go
+
+# 2. Run comprehensive checks (matches CI exactly)
+./scripts/check.sh
+
+# 3. If checks pass, commit and push
+git add -A
+git commit -m "your changes"
+git push
+```
+
+**The check script runs:**
+- Format check (`gofmt -l .`)
+- Go vet (`go vet ./...`)
+- Build test (`go build`)
+- All tests with coverage
+- Lint (if golangci-lint installed)
+
+This prevents CI failures and ensures code quality.
+
### CI
CI runs on every push to `main`:
- **Build & Vet** on Go 1.24 + 1.25
diff --git a/scripts/check.sh b/scripts/check.sh
new file mode 100755
index 00000000..453007c5
--- /dev/null
+++ b/scripts/check.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+set -e
+
+echo "🔍 Running pre-push checks (matches GitHub Actions CI)..."
+
+# Color codes for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+check_step() {
+ local step_name="$1"
+ echo -e "\n${YELLOW}📋 $step_name${NC}"
+}
+
+success_step() {
+ local step_name="$1"
+ echo -e "${GREEN}✅ $step_name - PASSED${NC}"
+}
+
+error_step() {
+ local step_name="$1"
+ echo -e "${RED}❌ $step_name - FAILED${NC}"
+ exit 1
+}
+
+# Step 1: Format check (exactly like CI)
+check_step "Format Check"
+unformatted=$(gofmt -l .)
+if [ -n "$unformatted" ]; then
+ echo -e "${RED}Files not formatted:${NC}"
+ echo "$unformatted"
+ echo -e "${YELLOW}Run: gofmt -w .${NC}"
+ error_step "Format Check"
+fi
+success_step "Format Check"
+
+# Step 2: Go vet
+check_step "Go Vet"
+if ! go vet ./...; then
+ error_step "Go Vet"
+fi
+success_step "Go Vet"
+
+# Step 3: Build
+check_step "Build"
+if ! go build -o pinchtab .; then
+ error_step "Build"
+fi
+success_step "Build"
+
+# Step 4: Tests with coverage
+check_step "Tests with Coverage"
+if ! go test ./... -v -count=1 -coverprofile=coverage.out -covermode=atomic; then
+ error_step "Tests"
+fi
+
+# Show coverage summary (like CI)
+echo -e "\n${YELLOW}📊 Coverage Summary:${NC}"
+go tool cover -func=coverage.out | tail -1
+success_step "Tests with Coverage"
+
+# Step 5: Lint check (if golangci-lint is available)
+check_step "Lint Check"
+if command -v golangci-lint >/dev/null 2>&1; then
+ if ! golangci-lint run ./...; then
+ error_step "Lint Check"
+ fi
+ success_step "Lint Check"
+else
+ echo -e "${YELLOW}⚠️ golangci-lint not installed - skipping lint check${NC}"
+ echo -e "${YELLOW} Install with: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest${NC}"
+fi
+
+# Step 6: Clean up
+rm -f pinchtab coverage.out
+
+echo -e "\n${GREEN}🎉 All checks passed! Ready to push.${NC}"
\ No newline at end of file