/ shell.nix
shell.nix
1 { pkgs ? import <nixpkgs> {} }: 2 3 pkgs.mkShell { 4 name = "333-method-automation"; 5 6 buildInputs = with pkgs; [ 7 # Node.js ecosystem 8 nodejs_22 9 nodePackages.npm 10 11 # Python for Streamlit (later phases) 12 python311 13 python311Packages.pip 14 python311Packages.virtualenv 15 16 # Database tools 17 sqlite 18 19 # Playwright dependencies 20 chromium 21 22 # Build tools for native modules (better-sqlite3, sharp) 23 gcc 24 gnumake 25 pkg-config 26 27 # Image processing (for sharp) 28 vips 29 30 # Security tools 31 snyk 32 33 # System utilities 34 util-linux # Provides ionice for I/O priority control 35 36 claude-code 37 git 38 gh 39 ]; 40 41 # Environment variables 42 shellHook = '' 43 echo "🚀 333 Method Automation Development Environment" 44 echo "" 45 echo "Node version: $(node --version)" 46 echo "npm version: $(npm --version)" 47 echo "Python version: $(python --version)" 48 echo "" 49 50 # Set up Playwright to use system chromium (via stable symlink) 51 # PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 prevents Playwright from downloading its own browsers 52 # The code auto-detects chromium via 'which chromium' (stable symlink in /etc/profiles) 53 export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 54 55 # Optional: Explicitly set chromium path (stable symlink, auto-updates on NixOS rebuild) 56 # export CHROMIUM_PATH=$(which chromium) # /etc/profiles/per-user/jason/bin/chromium 57 58 # Set up Python virtual environment for later phases 59 if [ ! -d ".venv" ]; then 60 echo "Creating Python virtual environment..." 61 python -m venv .venv 62 fi 63 64 # Add node_modules/.bin to PATH 65 export PATH="$PWD/node_modules/.bin:$PATH" 66 67 # Install missing npm dependencies if needed 68 if [ ! -d "node_modules" ] || [ ! -d "node_modules/globals" ]; then 69 echo "📦 Installing/updating npm dependencies..." 70 npm install 71 echo "" 72 fi 73 74 # Install dashboard Python dependencies if needed 75 if [ -f "dashboard/requirements.txt" ] && [ ! -f ".venv/dashboard_installed" ]; then 76 echo "📊 Installing dashboard dependencies (first time only)..." 77 source .venv/bin/activate 78 python -m pip install -r dashboard/requirements.txt 79 if [ $? -eq 0 ]; then 80 touch .venv/dashboard_installed 81 echo "✅ Dashboard dependencies installed!" 82 else 83 echo "❌ Dashboard installation failed. Run 'npm run dashboard:install' to retry." 84 fi 85 deactivate 86 echo "" 87 fi 88 89 echo "✅ Environment ready!" 90 echo "" 91 echo "📋 Stage-Based Pipeline (Recommended):" 92 echo " • npm run all - Run complete pipeline" 93 echo " • npm run all -- --limit 10 - Run with limit per stage" 94 echo " • npm run all -- --skip keywords - Skip specific stages" 95 echo "" 96 echo "📋 Individual Stages:" 97 echo " • npm run keywords - Keyword selection" 98 echo " • npm run serps - SERP scraping" 99 echo " • npm run assets - Screenshot capture" 100 echo " • npm run scoring - AI conversion scoring" 101 echo " • npm run rescoring - Rescore low-scoring sites" 102 echo " • npm run enrich - Enrich contacts for rescored sites" 103 echo " • npm run proposals - Generate proposals" 104 echo " • npm run outreach - Multi-channel delivery" 105 echo " • npm run replies - Process inbound replies" 106 echo "" 107 echo "📋 Statistics & Management:" 108 echo " • npm run <stage> stats - View stage statistics" 109 echo " • npm run keywords list - List all keywords" 110 echo " • npm run outreach retry - Retry failed outreaches" 111 echo "" 112 echo "📋 Legacy Commands (Still Available):" 113 echo " • npm run poc \"keyword\" N - POC pipeline (headed browser)" 114 echo " • npm run mvp run \"keyword\" - MVP pipeline (headless)" 115 echo " • npm run process N - Process N sites from queue" 116 echo "" 117 echo "📋 Quality Tools:" 118 echo " • npm run lint:fix - Auto-fix code issues" 119 echo " • npm run format - Format code" 120 echo " • npm test - Run unit tests" 121 echo " • npm run quality-check - Full quality check" 122 echo "" 123 echo "📊 Dashboard:" 124 echo " • npm run dashboard - Start analytics dashboard (auto-installed)" 125 echo " • npm run dashboard:install - Force reinstall deps (if needed)" 126 echo " • Access at http://localhost:8501" 127 echo "" 128 echo "🚀 Quick start:" 129 echo " 1. Ensure .env has your API keys (npm run init-db if first time)" 130 echo " 2. npm run keywords add \"plumber seattle\" 8" 131 echo " 3. npm run all -- --limit 10" 132 echo "" 133 echo "💡 See README.md for full command reference" 134 echo "" 135 ''; 136 137 # Fix for native modules and PyArrow 138 NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ 139 pkgs.stdenv.cc.cc 140 pkgs.stdenv.cc.cc.lib 141 pkgs.vips 142 ]; 143 144 # Export LD_LIBRARY_PATH for dynamic linking (required for PyArrow) 145 LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ 146 pkgs.stdenv.cc.cc.lib 147 pkgs.vips 148 ]; 149 }