Skip to content

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

feat: add doctor script to verify development environment

Datab7040c713d4b
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 745a182e..1ddceb85 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -13,10 +13,13 @@
git clone https://github.com/pinchtab/pinchtab.git
cd pinchtab
-# 2. Setup (installs git hooks, downloads deps)
+# 2. Check environment (optional but recommended)
+./doctor.sh
+
+# 3. Setup (installs git hooks, downloads deps)
./setup.sh
-# 3. Build and run
+# 4. Build and run
go build ./cmd/pinchtab
./pinchtab
```
@@ -43,7 +46,21 @@ This will:
- Download Go dependencies
- Verify your environment
-### 3. (Optional) Install golangci-lint
+### 3. Verify environment (optional)
+
+Check your development environment anytime:
+
+```bash
+./doctor.sh
+```
+
+This checks:
+- ✅ Go version (critical: 1.25+)
+- ⚠️ golangci-lint (recommended)
+- ⚠️ Git hooks installed
+- ⚠️ Node.js / Bun (for dashboard development)
+
+### 4. (Optional) Install golangci-lint
For local linting (recommended):
@@ -183,7 +200,8 @@ Validate docs: `./scripts/check-docs-json.sh`
## Useful Commands
```bash
-# Setup
+# Setup & Verification
+./doctor.sh # Check development environment
./setup.sh # Setup dev environment (run once)
./scripts/install-hooks.sh # Re-install git hooks
diff --git a/README.md b/README.md
index 1c255100..2a90ea0d 100644
--- a/README.md
+++ b/README.md
@@ -181,6 +181,7 @@ Want to contribute? See [DEVELOPMENT.md](DEVELOPMENT.md) for setup instructions.
```bash
git clone https://github.com/pinchtab/pinchtab.git
cd pinchtab
+./doctor.sh # Check your environment (optional)
./setup.sh # Installs git hooks, downloads deps
go build ./cmd/pinchtab # Build pinchtab binary
```
diff --git a/doctor.sh b/doctor.sh
new file mode 100755
index 00000000..6bb136d5
--- /dev/null
+++ b/doctor.sh
@@ -0,0 +1,145 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# doctor.sh - Verify development environment for pinchtab
+# Checks requirements for Go backend and React dashboard development
+
+RED='\033[0;31m'
+YELLOW='\033[1;33m'
+GREEN='\033[0;32m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
+CRITICAL_FAIL=0
+WARNINGS=0
+
+echo -e "${BLUE}🩺 Pinchtab Doctor${NC}"
+echo -e "${BLUE}Checking development environment...${NC}"
+echo ""
+
+# Critical check
+check_critical() {
+ local name="$1"
+ local result="$2"
+
+ if [ "$result" = "ok" ]; then
+ echo -e "${GREEN}✅${NC} $name"
+ else
+ echo -e "${RED}❌${NC} $name"
+ echo -e " ${RED}$3${NC}"
+ CRITICAL_FAIL=$((CRITICAL_FAIL + 1))
+ fi
+}
+
+# Warning check
+check_warning() {
+ local name="$1"
+ local result="$2"
+
+ if [ "$result" = "ok" ]; then
+ echo -e "${GREEN}✅${NC} $name"
+ else
+ echo -e "${YELLOW}⚠️${NC} $name"
+ echo -e " ${YELLOW}$3${NC}"
+ WARNINGS=$((WARNINGS + 1))
+ fi
+}
+
+echo -e "${BLUE}━━━ Go Backend Requirements ━━━${NC}"
+echo ""
+
+# Go version (critical)
+if command -v go &>/dev/null; then
+ GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//')
+ GO_MAJOR=$(echo "$GO_VERSION" | cut -d. -f1)
+ GO_MINOR=$(echo "$GO_VERSION" | cut -d. -f2)
+
+ if [ "$GO_MAJOR" -ge 1 ] && [ "$GO_MINOR" -ge 25 ]; then
+ check_critical "Go $GO_VERSION" "ok"
+ else
+ check_critical "Go $GO_VERSION" "fail" "Go 1.25+ required. Install from https://go.dev/dl/"
+ fi
+else
+ check_critical "Go" "fail" "Go not found. Install from https://go.dev/dl/"
+fi
+
+# golangci-lint (warning)
+if command -v golangci-lint &>/dev/null; then
+ LINT_VERSION=$(golangci-lint --version 2>/dev/null | head -1 | awk '{print $4}')
+ check_warning "golangci-lint $LINT_VERSION" "ok"
+else
+ check_warning "golangci-lint" "fail" "Optional but recommended. Install: brew install golangci-lint"
+fi
+
+# Git hooks (warning)
+if [ -f ".git/hooks/pre-commit" ]; then
+ check_warning "Git hooks installed" "ok"
+else
+ check_warning "Git hooks" "fail" "Run: ./scripts/install-hooks.sh"
+fi
+
+# Go modules (info)
+if [ -f "go.mod" ]; then
+ check_warning "go.mod present" "ok"
+else
+ check_warning "go.mod" "fail" "Run: go mod download"
+fi
+
+echo ""
+echo -e "${BLUE}━━━ Dashboard Requirements (React/TypeScript) ━━━${NC}"
+echo ""
+
+# Check if dashboard directory exists
+if [ -d "dashboard" ]; then
+ # Node.js (critical for dashboard)
+ if command -v node &>/dev/null; then
+ NODE_VERSION=$(node -v | sed 's/v//')
+ NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1)
+
+ if [ "$NODE_MAJOR" -ge 18 ]; then
+ check_warning "Node.js $NODE_VERSION" "ok"
+ else
+ check_warning "Node.js $NODE_VERSION" "fail" "Node 18+ recommended. Current: $NODE_VERSION"
+ fi
+ else
+ check_warning "Node.js" "fail" "Optional for dashboard. Install from https://nodejs.org"
+ fi
+
+ # Bun (warning)
+ if command -v bun &>/dev/null; then
+ BUN_VERSION=$(bun -v)
+ check_warning "Bun $BUN_VERSION" "ok"
+ else
+ check_warning "Bun" "fail" "Optional for dashboard. Install: curl -fsSL https://bun.sh/install | bash"
+ fi
+
+ # Dashboard deps installed
+ if [ -d "dashboard/node_modules" ]; then
+ check_warning "Dashboard dependencies" "ok"
+ else
+ check_warning "Dashboard dependencies" "fail" "Run: cd dashboard && bun install (or npm install)"
+ fi
+else
+ echo -e "${YELLOW}⚠️${NC} Dashboard not found (optional)"
+fi
+
+echo ""
+echo -e "${BLUE}━━━ Summary ━━━${NC}"
+echo ""
+
+if [ $CRITICAL_FAIL -eq 0 ] && [ $WARNINGS -eq 0 ]; then
+ echo -e "${GREEN}✅ All checks passed! You're ready to develop.${NC}"
+ exit 0
+elif [ $CRITICAL_FAIL -eq 0 ]; then
+ echo -e "${YELLOW}⚠️ $WARNINGS warning(s). Development is possible but some tools are missing.${NC}"
+ exit 0
+else
+ echo -e "${RED}❌ $CRITICAL_FAIL critical issue(s). Fix these before developing.${NC}"
+ [ $WARNINGS -gt 0 ] && echo -e "${YELLOW}⚠️ $WARNINGS warning(s).${NC}"
+ echo ""
+ echo "Next steps:"
+ echo " 1. Fix critical issues above"
+ echo " 2. Run: ./doctor.sh to verify"
+ echo " 3. Run: ./setup.sh to complete setup"
+ exit 1
+fi
diff --git a/setup.sh b/setup.sh
index f4b601f2..4d5100ef 100755
--- a/setup.sh
+++ b/setup.sh
@@ -1,7 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
-echo "🔧 Setting up pinchtab development environment..."
+echo "🔧 Pinchtab Development Setup"
+echo ""
+
+# Run doctor to check prerequisites
+echo "📋 Checking prerequisites..."
+if ! ./doctor.sh; then
+ echo ""
+ echo "❌ Setup aborted. Fix critical issues above."
+ exit 1
+fi
+
+echo ""
+echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Install git hooks
@@ -12,22 +24,8 @@ echo "📌 Installing git hooks..."
echo "📦 Downloading Go dependencies..."
go mod download
-# Verify environment
-echo "✅ Verifying Go environment..."
-go version
-echo ""
-
-# Optional: Check for golangci-lint
-if command -v golangci-lint &>/dev/null; then
- echo "✅ golangci-lint found: $(golangci-lint --version | head -1)"
-else
- echo "⚠️ golangci-lint not found (optional for local linting)"
- echo " Install: brew install golangci-lint"
- echo " Or: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
-fi
-
echo ""
-echo "✅ Development environment ready!"
+echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo " go build ./cmd/pinchtab # Build pinchtab"
@@ -35,3 +33,4 @@ echo " go test ./... # Run tests"
echo " gofmt -w . # Format code"
echo ""
echo "Git hooks will run automatically on commit."
+echo "Run ./doctor.sh anytime to check your environment."