|
| 1 | +# Installation Guide |
| 2 | + |
| 3 | +This guide covers advanced installation and setup for running AsyncReview locally with the full web UI and API server. |
| 4 | + |
| 5 | +<img width="2000" height="1296" alt="image" src="https://github.com/user-attachments/assets/41955d76-00d9-4987-9ea8-3e5243c895f7" /> |
| 6 | + |
| 7 | + |
| 8 | +<img width="1146" height="609" alt="Screenshot 2026-01-24 at 10 37 53 PM" src="https://github.com/user-attachments/assets/1b67cf2d-6923-46b8-8fac-83e6bf707ce3" /> |
| 9 | + |
| 10 | + |
| 11 | +> **Note:** If you just want to review GitHub PRs/Issues, you don't need to install anything! Just use `npx asyncreview` (see main [README](README.md)). |
| 12 | +
|
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- **Python 3.11+** |
| 16 | +- **Node.js 18+** (or Bun) |
| 17 | +- **uv** (recommended for Python package management) |
| 18 | +- **Deno** (Required for sandboxed code execution) |
| 19 | + |
| 20 | +### Installing Prerequisites |
| 21 | + |
| 22 | +**macOS:** |
| 23 | +```bash |
| 24 | +# Install uv (Python package manager) |
| 25 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 26 | + |
| 27 | +# Install Deno |
| 28 | +curl -fsSL https://deno.land/install.sh | sh |
| 29 | + |
| 30 | +# Install Bun (optional, alternative to npm) |
| 31 | +curl -fsSL https://bun.sh/install | bash |
| 32 | +``` |
| 33 | + |
| 34 | +**Linux:** |
| 35 | +```bash |
| 36 | +# Install uv |
| 37 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 38 | + |
| 39 | +# Install Deno |
| 40 | +curl -fsSL https://deno.land/install.sh | sh |
| 41 | +``` |
| 42 | + |
| 43 | +**Windows:** |
| 44 | +```powershell |
| 45 | +# Install uv |
| 46 | +powershell -c "irm https://astral.sh/uv/install.ps1 | iex" |
| 47 | +
|
| 48 | +# Install Deno |
| 49 | +irm https://deno.land/install.ps1 | iex |
| 50 | +``` |
| 51 | + |
| 52 | +## Full Setup |
| 53 | + |
| 54 | +### 1. Clone the Repository |
| 55 | + |
| 56 | +```bash |
| 57 | +git clone https://github.com/AsyncFuncAI/AsyncReview.git |
| 58 | +cd AsyncReview |
| 59 | +``` |
| 60 | + |
| 61 | +### 2. Install Backend (cr) |
| 62 | + |
| 63 | +```bash |
| 64 | +# Using uv (Recommended) |
| 65 | +uv pip install -e . |
| 66 | + |
| 67 | +# Or standard pip |
| 68 | +pip install -e . |
| 69 | + |
| 70 | +# Pre-cache Deno dependencies (speeds up first run) |
| 71 | +deno cache npm:pyodide/pyodide.js |
| 72 | +``` |
| 73 | + |
| 74 | +### 3. Install Frontend (web) |
| 75 | + |
| 76 | +```bash |
| 77 | +cd web |
| 78 | +bun install # or npm install |
| 79 | +``` |
| 80 | + |
| 81 | +### 4. Environment Setup |
| 82 | + |
| 83 | +Copy `.env.example` to `.env` and fill in your API keys: |
| 84 | + |
| 85 | +```bash |
| 86 | +cp .env.example .env |
| 87 | +``` |
| 88 | + |
| 89 | +**Required environment variables:** |
| 90 | + |
| 91 | +```bash |
| 92 | +# .env file |
| 93 | +GEMINI_API_KEY=your_gemini_api_key_here |
| 94 | +GITHUB_TOKEN=your_github_token_here # Optional for npx, required for web UI |
| 95 | +``` |
| 96 | + |
| 97 | +**Getting your API keys:** |
| 98 | + |
| 99 | +- **Gemini API Key**: Get from [Google AI Studio](https://aistudio.google.com/app/apikey) |
| 100 | +- **GitHub Token**: |
| 101 | + - Quick: `gh auth token` (if you have GitHub CLI) |
| 102 | + - Manual: [Create Personal Access Token](https://github.com/settings/tokens) |
| 103 | + - Select `repo` scope for private repositories |
| 104 | + - Select `public_repo` for public repositories only |
| 105 | + |
| 106 | +## Running AsyncReview Locally |
| 107 | + |
| 108 | +### Option 1: Using the API Server + Web UI |
| 109 | + |
| 110 | +**Start the API Server:** |
| 111 | +```bash |
| 112 | +cr serve |
| 113 | +# or |
| 114 | +uv run uvicorn cr.server:app --reload |
| 115 | +``` |
| 116 | + |
| 117 | +Server runs at `http://127.0.0.1:8000`. |
| 118 | + |
| 119 | +**Start the Web UI:** |
| 120 | +```bash |
| 121 | +cd web |
| 122 | +bun dev # or npm run dev |
| 123 | +``` |
| 124 | + |
| 125 | +Open `http://localhost:3000` in your browser. |
| 126 | + |
| 127 | +### Option 2: Using the CLI (Local Codebase) |
| 128 | + |
| 129 | +The `cr` CLI allows you to review local codebases: |
| 130 | + |
| 131 | +```bash |
| 132 | +# Interactive Q&A mode |
| 133 | +cr ask |
| 134 | + |
| 135 | +# One-shot review |
| 136 | +cr review -q "What does this repo do?" |
| 137 | + |
| 138 | +# Review specific files |
| 139 | +cr review -q "Analyze src/main.py for bugs" |
| 140 | + |
| 141 | +# Get help |
| 142 | +cr --help |
| 143 | +``` |
| 144 | + |
| 145 | +### Option 3: Using npx (GitHub PRs/Issues) |
| 146 | + |
| 147 | +No installation needed - works from anywhere: |
| 148 | + |
| 149 | +```bash |
| 150 | +npx asyncreview review --url https://github.com/org/repo/pull/123 -q "Review this PR" |
| 151 | +``` |
| 152 | + |
| 153 | +See the main [README](README.md) for npx usage details. |
| 154 | + |
| 155 | +## Troubleshooting |
| 156 | + |
| 157 | +### Deno/Pyodide Issues |
| 158 | + |
| 159 | +If you see errors like `Could not find npm:pyodide`, run: |
| 160 | +```bash |
| 161 | +deno cache npm:pyodide/pyodide.js |
| 162 | +``` |
| 163 | + |
| 164 | +### Slow First Run |
| 165 | + |
| 166 | +The first run may take longer as Deno downloads and compiles Pyodide (~50MB). Subsequent runs are instant. |
| 167 | + |
| 168 | +### Python Version Issues |
| 169 | + |
| 170 | +Ensure you're using Python 3.11+: |
| 171 | +```bash |
| 172 | +python --version |
| 173 | +# or |
| 174 | +python3 --version |
| 175 | +``` |
| 176 | + |
| 177 | +If needed, install Python 3.11+ from [python.org](https://www.python.org/downloads/). |
| 178 | + |
| 179 | +### uv Installation Issues |
| 180 | + |
| 181 | +If `uv` commands fail, ensure it's in your PATH: |
| 182 | +```bash |
| 183 | +# Add to ~/.bashrc or ~/.zshrc |
| 184 | +export PATH="$HOME/.cargo/bin:$PATH" |
| 185 | +``` |
| 186 | + |
| 187 | +### Port Already in Use |
| 188 | + |
| 189 | +If port 8000 is already in use: |
| 190 | +```bash |
| 191 | +# Use a different port |
| 192 | +uvicorn cr.server:app --port 8001 |
| 193 | +``` |
| 194 | + |
| 195 | +## Development |
| 196 | + |
| 197 | +### Running Tests |
| 198 | + |
| 199 | +```bash |
| 200 | +# Run all tests |
| 201 | +pytest |
| 202 | + |
| 203 | +# Run specific test file |
| 204 | +pytest tests/test_github.py |
| 205 | + |
| 206 | +# Run with coverage |
| 207 | +pytest --cov=cr |
| 208 | +``` |
| 209 | + |
| 210 | +### Type Checking |
| 211 | + |
| 212 | +```bash |
| 213 | +# Run mypy |
| 214 | +mypy cr/ |
| 215 | +``` |
| 216 | + |
| 217 | +### Code Formatting |
| 218 | + |
| 219 | +```bash |
| 220 | +# Format with black |
| 221 | +black cr/ tests/ |
| 222 | + |
| 223 | +# Sort imports |
| 224 | +isort cr/ tests/ |
| 225 | +``` |
| 226 | + |
| 227 | +## Architecture Overview |
| 228 | + |
| 229 | +AsyncReview consists of three main components: |
| 230 | + |
| 231 | +1. **`cr` (Python Backend)**: Core RLM engine with Pyodide sandbox |
| 232 | +2. **`web` (Next.js Frontend)**: Interactive web UI for PR reviews |
| 233 | +3. **`npx asyncreview` (CLI)**: Zero-install command for GitHub PR/Issue reviews |
| 234 | + |
| 235 | +For more details, see the [main README](README.md). |
0 commit comments