High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
refactor: make doctor.sh handle both verification and setup
Datab7eb5fb6dbe6
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.mdindex 9b710b42..9988b86e 100644--- a/DEVELOPMENT.md+++ b/DEVELOPMENT.md@@ -13,18 +13,15 @@git clone https://github.com/pinchtab/pinchtab.gitcd pinchtab-# 2. Check environment (optional but recommended)+# 2. Setup (checks environment, installs hooks, downloads deps)./doctor.sh-# 3. Setup (installs git hooks, downloads deps)-./setup.sh--# 4. Build and run+# 3. Build and rungo build ./cmd/pinchtab./pinchtab```-That's it! Git hooks are installed automatically and will run on every commit.+That's it! `doctor.sh` verifies your environment and auto-installs what it can (git hooks, dependencies). Git hooks will run automatically on every commit.## Detailed Setup@@ -35,35 +32,26 @@ git clone https://github.com/pinchtab/pinchtab.gitcd pinchtab```-### 2. Run setup script+### 2. Run doctor script```bash-./setup.sh+./doctor.sh```This will:-- Install git hooks (gofmt + golangci-lint checks before commit)-- Download Go dependencies-- Verify your environment--### 3. Verify environment (optional)--Check your development environment anytime:--```bash-./doctor.sh-```+- **Check** Go 1.25+ and golangci-lint (tells you to install if missing)+- **Auto-install** git hooks (gofmt + golangci-lint checks before commit)+- **Auto-download** Go dependencies+- **Check** Node.js / Bun for dashboard (optional, warns if missing)-This checks:-- ✅ Go version (critical: 1.25+)-- ✅ golangci-lint (critical: required for pre-commit)-- ⚠️ Git hooks installed-- ⚠️ Node.js / Bun (for dashboard development)+### 3. Install missing tools (if needed)-### 4. Install golangci-lint (required)+If doctor.sh finds missing critical tools, install them:-Required for pre-commit hooks:+**Go 1.25+:**+- Download from https://go.dev/dl/+**golangci-lint (required for pre-commit hooks):**```bash# macOS/Linuxbrew install golangci-lint@@ -72,7 +60,7 @@ brew install golangci-lintgo install github.com/golangci/golangci-lint/cmd/golangci-lint@latest```-The pre-commit hook will warn and allow commits without it, but CI will fail.+After installing, run `./doctor.sh` again to verify.## Before Committing@@ -201,9 +189,8 @@ Validate docs: `./scripts/check-docs-json.sh````bash# Setup & Verification-./doctor.sh # Check development environment-./setup.sh # Setup dev environment (run once)-./scripts/install-hooks.sh # Re-install git hooks+./doctor.sh # Check environment + auto-install hooks/deps+./scripts/install-hooks.sh # Manually re-install git hooks# Build & Rungo build ./cmd/pinchtab # Build pinchtab binarydiff --git a/README.md b/README.mdindex 2a90ea0d..de7bb5d2 100644--- a/README.md+++ b/README.md@@ -181,8 +181,7 @@ Want to contribute? See [DEVELOPMENT.md](DEVELOPMENT.md) for setup instructions.```bashgit clone https://github.com/pinchtab/pinchtab.gitcd pinchtab-./doctor.sh # Check your environment (optional)-./setup.sh # Installs git hooks, downloads deps+./doctor.sh # Verifies environment, installs hooks/depsgo build ./cmd/pinchtab # Build pinchtab binary```diff --git a/doctor.sh b/doctor.shindex 63780aa8..afe78f17 100755--- a/doctor.sh+++ b/doctor.sh@@ -1,8 +1,9 @@#!/usr/bin/env bashset -euo pipefail-# doctor.sh - Verify development environment for pinchtab-# Checks requirements for Go backend and React dashboard development+# doctor.sh - Verify and setup development environment for pinchtab+# Checks requirements and auto-installs what it can (hooks, dependencies)+# Tells you what you need to install manually (Go, golangci-lint)RED='\033[0;31m'YELLOW='\033[1;33m'@@ -12,9 +13,10 @@ NC='\033[0m' # No ColorCRITICAL_FAIL=0WARNINGS=0+INSTALLED_SOMETHING=falseecho -e "${BLUE}🩺 Pinchtab Doctor${NC}"-echo -e "${BLUE}Checking development environment...${NC}"+echo -e "${BLUE}Verifying and setting up development environment...${NC}"echo ""# Critical check@@ -71,18 +73,31 @@ elsecheck_critical "golangci-lint" "fail" "Required for pre-commit checks. Install: brew install golangci-lint or go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"fi-# Git hooks (warning)+# Git hooks (auto-install if missing)if [ -f ".git/hooks/pre-commit" ]; thencheck_warning "Git hooks installed" "ok"else- check_warning "Git hooks" "fail" "Run: ./scripts/install-hooks.sh"+ echo -e "${YELLOW}⚠️${NC} Git hooks not installed"+ echo -e " ${BLUE}Installing git hooks...${NC}"+ ./scripts/install-hooks.sh+ echo -e "${GREEN} ✅ Git hooks installed${NC}"+ INSTALLED_SOMETHING=truefi-# Go modules (info)+# Go modules (auto-download if needed)if [ -f "go.mod" ]; then- check_warning "go.mod present" "ok"+ # Check if dependencies are downloaded+ if go list -m all &>/dev/null; then+ check_warning "Go dependencies" "ok"+ else+ echo -e "${YELLOW}⚠️${NC} Go dependencies not downloaded"+ echo -e " ${BLUE}Downloading dependencies...${NC}"+ go mod download+ echo -e "${GREEN} ✅ Dependencies downloaded${NC}"+ INSTALLED_SOMETHING=true+ fielse- check_warning "go.mod" "fail" "Run: go mod download"+ check_warning "go.mod" "fail" "go.mod not found"fiecho ""@@ -128,18 +143,26 @@ 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}"+ if [ "$INSTALLED_SOMETHING" = true ]; then+ echo -e "${GREEN}✅ Setup complete! Auto-installed missing components.${NC}"+ else+ echo -e "${GREEN}✅ All checks passed! You're ready to develop.${NC}"+ fi+ echo ""+ echo "Next steps:"+ echo " go build ./cmd/pinchtab # Build pinchtab"+ echo " go test ./... # Run tests"exit 0elif [ $CRITICAL_FAIL -eq 0 ]; then+ if [ "$INSTALLED_SOMETHING" = true ]; then+ echo -e "${GREEN}✅ Auto-installed what I could.${NC}"+ fiecho -e "${YELLOW}⚠️ $WARNINGS warning(s). Development is possible but some tools are missing.${NC}"exit 0else- echo -e "${RED}❌ $CRITICAL_FAIL critical issue(s). Fix these before developing.${NC}"+ echo -e "${RED}❌ $CRITICAL_FAIL critical issue(s). Install these manually:${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"+ echo "After installing, run ./doctor.sh again."exit 1fidiff --git a/setup.sh b/setup.shdeleted file mode 100755index 486037c2..00000000--- a/setup.sh+++ /dev/null@@ -1,36 +0,0 @@-#!/usr/bin/env bash-set -euo pipefail--echo "🔧 Pinchtab Development Setup"-echo ""--# Verify environment first (runs doctor.sh)-if ! ./doctor.sh; then- echo ""- echo "❌ Setup aborted. Fix critical issues above and run ./setup.sh again."- exit 1-fi--echo ""-echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"-echo ""-echo "📦 Installing development tools..."-echo ""--# Install git hooks-echo " 📌 Installing git hooks..."-./scripts/install-hooks.sh--# Download dependencies-echo " 📦 Downloading Go dependencies..."-go mod download--echo ""-echo "✅ Setup complete!"-echo ""-echo "Next steps:"-echo " go build ./cmd/pinchtab # Build pinchtab"-echo " go test ./... # Run tests"-echo ""-echo "Git hooks will run automatically on commit."-echo "Run ./doctor.sh anytime to re-verify your environment."