Gitea MCP server expects: - GITEA_API_URL (not GITEA_URL) - must include /api/v1 - GITEA_API_TOKEN (not GITEA_TOKEN) NetBox MCP server expects: - NETBOX_API_URL (not NETBOX_URL) - must include /api - NETBOX_API_TOKEN (not NETBOX_TOKEN) Changes: - Update all setup commands to use correct variable names - Update docs/CONFIGURATION.md with correct variables and URL format - Update scripts/setup.sh templates - Update CLAUDE.md hybrid configuration reference - Remove GITEA_ORG from system-level config (it's project-level) - Fix API URL paths in curl commands (remove redundant /api/v1) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7.5 KiB
description
| description |
|---|
| Interactive setup wizard for pr-review plugin - configures Gitea MCP and project settings |
PR Review Setup Wizard
This command sets up the pr-review plugin. It shares the Gitea MCP server with projman, so if you've already run /initial-setup for projman, most of the work is done.
Important Context
- This command uses Bash, Read, Write, and AskUserQuestion tools - NOT MCP tools
- MCP tools won't work until after setup + session restart
- Shares Gitea MCP server with projman plugin
Phase 1: Check Existing Setup
Step 1.1: Check if Gitea MCP is Already Configured
First, check if the system configuration already exists (from projman or previous setup):
cat ~/.config/claude/gitea.env 2>/dev/null || echo "FILE_NOT_FOUND"
If file exists with valid values (no placeholders):
- Skip to Phase 3 (Project Configuration)
- Inform user: "Gitea configuration found. Skipping system setup."
If file doesn't exist or has placeholders:
- Continue to Phase 2
Step 1.2: Check if projman is Installed
Check if projman plugin exists (they share MCP server):
find ~/.claude ~/.config/claude -name "projman" -type d 2>/dev/null | head -1
If projman exists:
- Suggest: "The projman plugin is installed and shares the same Gitea MCP server. Consider running
/initial-setupfrom projman for the full setup wizard."
Use AskUserQuestion:
- Question: "How would you like to proceed with setup?"
- Header: "Setup"
- Options:
- "Continue with pr-review setup (Recommended if not using projman)"
- "I'll use projman's /initial-setup instead"
If user chooses projman setup: End here with instructions to run projman's setup.
Phase 2: System Setup (if needed)
This is a condensed version focusing on what pr-review needs.
Step 2.1: Python and MCP Server
Check Python version:
python3 --version
If below 3.10, stop and inform user.
Locate and set up the MCP server:
find ~/.claude ~/.config/claude -name "mcp_server" -path "*gitea*" 2>/dev/null | head -5
If venv doesn't exist, create it:
cd /path/to/mcp-servers/gitea && python3 -m venv .venv && source .venv/bin/activate && pip install --upgrade pip && pip install -r requirements.txt && deactivate
Step 2.2: Gitea Configuration
Create config directory:
mkdir -p ~/.config/claude
Use AskUserQuestion:
- Question: "What is your Gitea server URL?"
- Header: "Gitea URL"
- Options:
- "https://gitea.hotserv.cloud"
- "Other (I'll provide the URL)"
Create configuration file (credentials only, org is per-project):
cat > ~/.config/claude/gitea.env << 'EOF'
# Gitea API Configuration
# Generated by pr-review /initial-setup
# Note: GITEA_ORG is configured per-project in .env
GITEA_API_URL=<USER_PROVIDED_URL>
GITEA_API_TOKEN=PASTE_YOUR_TOKEN_HERE
EOF
chmod 600 ~/.config/claude/gitea.env
Step 2.3: Token Instructions
Display these instructions:
Action Required: Add Your Gitea API Token
I've created ~/.config/claude/gitea.env but you need to add your API token manually.
Steps:
- Open:
nano ~/.config/claude/gitea.env - Generate token in Gitea: Settings → Applications → Generate New Token
- Permissions needed:
repo,read:org,read:user
- Permissions needed:
- Replace
PASTE_YOUR_TOKEN_HEREwith your token - Save the file
Use AskUserQuestion:
- Question: "Have you added your Gitea token?"
- Header: "Token"
- Options:
- "Yes, I've added the token"
- "Skip for now"
Phase 3: Project Configuration
Step 3.1: Check Current Directory
pwd && git rev-parse --show-toplevel 2>/dev/null || echo "NOT_A_GIT_REPO"
Step 3.2: Check Existing Project Config
cat .env 2>/dev/null | grep GITEA_REPO || echo "NOT_FOUND"
If GITEA_REPO is already set, skip to Phase 4.
Step 3.3: Detect Organization and Repository
Extract organization:
git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\)\/[^/]*$/\1/'
Extract repository:
git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\)\.git$/\1/' | sed 's/.*\/\([^/]*\)$/\1/'
Step 3.4: Validate Repository via Gitea API
source ~/.config/claude/gitea.env
curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos/<detected-org>/<detected-repo>"
| HTTP Code | Action |
|---|---|
| 200 | Auto-fill - "Verified: / exists" - skip to Step 3.7 |
| 404 | Not found - proceed to Step 3.5 |
| 401/403 | Permission issue - warn, proceed to Step 3.5 |
Step 3.5: Confirm Organization (only if validation failed)
Use AskUserQuestion:
- Question: "Repository not found. Is '' the correct organization?"
- Header: "Organization"
- Options:
- "Yes, that's correct"
- "No, let me specify"
Step 3.6: Confirm Repository (only if validation failed)
Use AskUserQuestion:
- Question: "Is '' the correct repository?"
- Header: "Repository"
- Options:
- "Yes, that's correct"
- "No, let me specify"
After corrections, re-validate via API (Step 3.4).
Step 3.7: Create/Update Project Config
If .env exists, append:
echo "GITEA_ORG=<ORG_NAME>" >> .env
echo "GITEA_REPO=<REPO_NAME>" >> .env
If .env doesn't exist:
cat > .env << 'EOF'
# Project Configuration
GITEA_ORG=<ORG_NAME>
GITEA_REPO=<REPO_NAME>
EOF
Step 3.5: PR Review Settings (Optional)
Use AskUserQuestion:
- Question: "Do you want to configure PR review settings?"
- Header: "Settings"
- Options:
- "Use defaults (Recommended)"
- "Let me customize"
If customize, ask about:
PR_REVIEW_CONFIDENCE_THRESHOLD(default: 0.5)PR_REVIEW_AUTO_SUBMIT(default: false)
Phase 4: Validation and Next Steps
Step 4.1: Test Configuration (if token was added)
source ~/.config/claude/gitea.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/user"
Report result:
- 200: Success
- 401: Invalid token
- Other: Connection issue
Step 4.2: Summary
╔════════════════════════════════════════════════════════════╗
║ PR-REVIEW SETUP COMPLETE ║
╠════════════════════════════════════════════════════════════╣
║ MCP Server (Gitea): ✓ Ready ║
║ System Config: ✓ ~/.config/claude/gitea.env ║
║ Project Config: ✓ ./.env ║
╚════════════════════════════════════════════════════════════╝
Step 4.3: Session Restart Notice
⚠️ Session Restart Required
Restart your Claude Code session for MCP tools to become available.
After restart, you can:
- Run
/pr-review <PR_NUMBER>to review a pull request - Run
/pr-summary <PR_NUMBER>for a quick summary - Run
/pr-findings <PR_NUMBER>to list actionable findings
Available Commands After Setup
| Command | Description |
|---|---|
/pr-review <number> |
Full multi-agent PR review with confidence scoring |
/pr-summary <number> |
Quick PR summary |
/pr-findings <number> |
List findings with severity and line numbers |