From 8228c20d473ec4e612481fa249ddea8bbfa80163 Mon Sep 17 00:00:00 2001 From: lmiranda Date: Wed, 21 Jan 2026 11:53:04 -0500 Subject: [PATCH] fix: rename environment variables to match MCP server expectations 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 --- CLAUDE.md | 2 +- docs/CONFIGURATION.md | 28 +++++++++---------- .../cmdb-assistant/commands/initial-setup.md | 6 ++-- plugins/pr-review/commands/initial-setup.md | 8 +++--- plugins/pr-review/commands/project-init.md | 4 +-- plugins/pr-review/commands/project-sync.md | 4 +-- plugins/projman/commands/initial-setup.md | 12 ++++---- plugins/projman/commands/project-init.md | 4 +-- plugins/projman/commands/project-sync.md | 4 +-- scripts/setup.sh | 18 ++++++------ 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8427a4e..f5338c3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -140,7 +140,7 @@ leo-claude-mktplace/ | Level | Location | Purpose | |-------|----------|---------| -| System | `~/.config/claude/gitea.env` | Credentials (GITEA_URL, GITEA_TOKEN) | +| System | `~/.config/claude/gitea.env` | Credentials (GITEA_API_URL, GITEA_API_TOKEN) | | Project | `.env` in project root | Repository specification (GITEA_ORG, GITEA_REPO) | **Note:** `GITEA_ORG` is at project level since different projects may belong to different organizations. diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 858f17e..5975449 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -160,8 +160,8 @@ This marketplace uses a **hybrid configuration** approach: │ SYSTEM-LEVEL (once per machine) │ │ ~/.config/claude/ │ ├─────────────────────────────────────────────────────────────────┤ -│ gitea.env │ GITEA_URL, GITEA_TOKEN │ -│ netbox.env │ NETBOX_URL, NETBOX_TOKEN │ +│ gitea.env │ GITEA_API_URL, GITEA_API_TOKEN │ +│ netbox.env │ NETBOX_API_URL, NETBOX_API_TOKEN │ │ git-flow.env │ GIT_WORKFLOW_STYLE, GIT_DEFAULT_BASE, etc. │ └─────────────────────────────────────────────────────────────────┘ │ @@ -250,8 +250,8 @@ mkdir -p ~/.config/claude # Gitea configuration (credentials only) cat > ~/.config/claude/gitea.env << 'EOF' -GITEA_URL=https://gitea.example.com -GITEA_TOKEN=your_token_here +GITEA_API_URL=https://gitea.example.com +GITEA_API_TOKEN=your_token_here EOF chmod 600 ~/.config/claude/gitea.env ``` @@ -298,14 +298,14 @@ Located in `~/.config/claude/`: ```bash # ~/.config/claude/gitea.env -GITEA_URL=https://gitea.example.com -GITEA_TOKEN=your_gitea_token_here +GITEA_API_URL=https://gitea.example.com/api/v1 +GITEA_API_TOKEN=your_gitea_token_here ``` | Variable | Description | Example | |----------|-------------|---------| -| `GITEA_URL` | Gitea base URL (no `/api/v1`) | `https://gitea.example.com` | -| `GITEA_TOKEN` | Personal access token | `abc123...` | +| `GITEA_API_URL` | Gitea API endpoint (with `/api/v1`) | `https://gitea.example.com/api/v1` | +| `GITEA_API_TOKEN` | Personal access token | `abc123...` | **Note:** `GITEA_ORG` is configured at the project level (see below) since different projects may belong to different organizations. @@ -323,14 +323,14 @@ GITEA_TOKEN=your_gitea_token_here ```bash # ~/.config/claude/netbox.env -NETBOX_URL=https://netbox.example.com -NETBOX_TOKEN=your_netbox_token_here +NETBOX_API_URL=https://netbox.example.com +NETBOX_API_TOKEN=your_netbox_token_here ``` | Variable | Description | Example | |----------|-------------|---------| -| `NETBOX_URL` | NetBox base URL | `https://netbox.example.com` | -| `NETBOX_TOKEN` | API token | `abc123...` | +| `NETBOX_API_URL` | NetBox base URL | `https://netbox.example.com` | +| `NETBOX_API_TOKEN` | API token | `abc123...` | ### Git-Flow Configuration @@ -456,7 +456,7 @@ This helps when you: ```bash source ~/.config/claude/gitea.env -curl -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/user" +curl -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/user" ``` ### Verify Project Setup @@ -492,7 +492,7 @@ stat ~/.config/claude/gitea.env ```bash # Test token directly source ~/.config/claude/gitea.env -curl -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/user" +curl -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/user" ``` If you get 401, regenerate your token in Gitea. diff --git a/plugins/cmdb-assistant/commands/initial-setup.md b/plugins/cmdb-assistant/commands/initial-setup.md index 948f10f..5a26b9a 100644 --- a/plugins/cmdb-assistant/commands/initial-setup.md +++ b/plugins/cmdb-assistant/commands/initial-setup.md @@ -84,8 +84,8 @@ cat > ~/.config/claude/netbox.env << 'EOF' # NetBox API Configuration # Generated by cmdb-assistant /initial-setup -NETBOX_URL= -NETBOX_TOKEN=PASTE_YOUR_TOKEN_HERE +NETBOX_API_URL= +NETBOX_API_TOKEN=PASTE_YOUR_TOKEN_HERE EOF chmod 600 ~/.config/claude/netbox.env ``` @@ -120,7 +120,7 @@ Use AskUserQuestion: ### Step 4.1: Test Configuration (if token was added) ```bash -source ~/.config/claude/netbox.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Token $NETBOX_TOKEN" "$NETBOX_URL/api/" +source ~/.config/claude/netbox.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Token $NETBOX_API_TOKEN" "$NETBOX_API_URL/api/" ``` Report result: diff --git a/plugins/pr-review/commands/initial-setup.md b/plugins/pr-review/commands/initial-setup.md index 476ce3d..6be1847 100644 --- a/plugins/pr-review/commands/initial-setup.md +++ b/plugins/pr-review/commands/initial-setup.md @@ -97,8 +97,8 @@ cat > ~/.config/claude/gitea.env << 'EOF' # Generated by pr-review /initial-setup # Note: GITEA_ORG is configured per-project in .env -GITEA_URL= -GITEA_TOKEN=PASTE_YOUR_TOKEN_HERE +GITEA_API_URL= +GITEA_API_TOKEN=PASTE_YOUR_TOKEN_HERE EOF chmod 600 ~/.config/claude/gitea.env ``` @@ -163,7 +163,7 @@ git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\)\.git$/\1/' | sed ```bash source ~/.config/claude/gitea.env -curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos//" +curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos//" ``` | HTTP Code | Action | @@ -229,7 +229,7 @@ If customize, ask about: ### Step 4.1: Test Configuration (if token was added) ```bash -source ~/.config/claude/gitea.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/user" +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: diff --git a/plugins/pr-review/commands/project-init.md b/plugins/pr-review/commands/project-init.md index a7492a9..b1d6af7 100644 --- a/plugins/pr-review/commands/project-init.md +++ b/plugins/pr-review/commands/project-init.md @@ -18,7 +18,7 @@ Fast setup for a new project when system-level configuration is already complete ### Step 1: Verify System Configuration ```bash -cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" +cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_API_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" ``` **If SYSTEM_MISSING:** @@ -67,7 +67,7 @@ git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\)\.git$/\1/' | sed ```bash source ~/.config/claude/gitea.env -curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos//" +curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos//" ``` | HTTP Code | Action | diff --git a/plugins/pr-review/commands/project-sync.md b/plugins/pr-review/commands/project-sync.md index d5b7838..c082e31 100644 --- a/plugins/pr-review/commands/project-sync.md +++ b/plugins/pr-review/commands/project-sync.md @@ -17,7 +17,7 @@ Updates project configuration when the git remote URL has changed. ## Step 1: Verify System Configuration ```bash -cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" +cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_API_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" ``` **If SYSTEM_MISSING:** Run `/initial-setup` first. @@ -59,7 +59,7 @@ Extract organization and repository from URL. ```bash source ~/.config/claude/gitea.env -curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos//" +curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos//" ``` | Code | Action | diff --git a/plugins/projman/commands/initial-setup.md b/plugins/projman/commands/initial-setup.md index 3c82137..a126798 100644 --- a/plugins/projman/commands/initial-setup.md +++ b/plugins/projman/commands/initial-setup.md @@ -19,7 +19,7 @@ This command guides the user through complete projman setup interactively. It ha **FIRST**, check if system-level setup is already complete: ```bash -cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep -v "example.com" | grep "GITEA_TOKEN=" && echo "SYSTEM_CONFIGURED" || echo "SYSTEM_NEEDS_SETUP" +cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep -v "example.com" | grep "GITEA_API_TOKEN=" && echo "SYSTEM_CONFIGURED" || echo "SYSTEM_NEEDS_SETUP" ``` **If SYSTEM_CONFIGURED:** @@ -168,8 +168,8 @@ cat > ~/.config/claude/gitea.env << 'EOF' # Generated by /initial-setup # Note: GITEA_ORG is configured per-project in .env -GITEA_URL= -GITEA_TOKEN=PASTE_YOUR_TOKEN_HERE +GITEA_API_URL= +GITEA_API_TOKEN=PASTE_YOUR_TOKEN_HERE EOF chmod 600 ~/.config/claude/gitea.env ``` @@ -225,7 +225,7 @@ Use AskUserQuestion: Read the config file and verify it has non-placeholder values: ```bash -source ~/.config/claude/gitea.env && echo "URL: $GITEA_URL" && echo "TOKEN_LENGTH: ${#GITEA_TOKEN}" +source ~/.config/claude/gitea.env && echo "URL: $GITEA_API_URL" && echo "TOKEN_LENGTH: ${#GITEA_API_TOKEN}" ``` If TOKEN_LENGTH is less than 10 or contains "PASTE" or "your_", the token hasn't been set properly. @@ -235,7 +235,7 @@ If TOKEN_LENGTH is less than 10 or contains "PASTE" or "your_", the token hasn't **Test connectivity (optional but recommended):** ```bash -source ~/.config/claude/gitea.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/user" +source ~/.config/claude/gitea.env && curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/user" ``` - **200:** Success! Credentials are valid. @@ -329,7 +329,7 @@ git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\)\.git$/\1/' | sed ```bash source ~/.config/claude/gitea.env -curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos//" +curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos//" ``` **Based on response:** diff --git a/plugins/projman/commands/project-init.md b/plugins/projman/commands/project-init.md index dda79bd..fb081c0 100644 --- a/plugins/projman/commands/project-init.md +++ b/plugins/projman/commands/project-init.md @@ -24,7 +24,7 @@ Fast setup for a new project when system-level configuration is already complete Quickly verify system setup is complete: ```bash -cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" +cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_API_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" ``` **If SYSTEM_MISSING:** @@ -107,7 +107,7 @@ Verify the repository exists and is accessible: ```bash source ~/.config/claude/gitea.env -curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos//" +curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos//" ``` | HTTP Code | Action | diff --git a/plugins/projman/commands/project-sync.md b/plugins/projman/commands/project-sync.md index 7f8e180..66bf4dd 100644 --- a/plugins/projman/commands/project-sync.md +++ b/plugins/projman/commands/project-sync.md @@ -17,7 +17,7 @@ Updates project configuration when the git remote URL has changed (repository mo ## Step 1: Verify System Configuration ```bash -cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" +cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_API_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING" ``` **If SYSTEM_MISSING:** Stop and instruct user to run `/initial-setup` first. @@ -109,7 +109,7 @@ Verify the new repository exists and is accessible: ```bash source ~/.config/claude/gitea.env -curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos//" +curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_API_TOKEN" "$GITEA_API_URL/repos//" ``` | HTTP Code | Action | diff --git a/scripts/setup.sh b/scripts/setup.sh index d2c3078..c043c04 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -134,10 +134,10 @@ setup_config_templates() { cat > "$config_dir/gitea.env" << 'EOF' # Gitea API Configuration # Update these values with your Gitea instance details +# Note: GITEA_ORG is configured per-project in .env -GITEA_URL=https://gitea.example.com -GITEA_TOKEN=your_gitea_token_here -GITEA_ORG=your_organization_name +GITEA_API_URL=https://gitea.example.com/api/v1 +GITEA_API_TOKEN=your_gitea_token_here EOF chmod 600 "$config_dir/gitea.env" log_success "gitea.env template created" @@ -152,8 +152,8 @@ EOF # NetBox API Configuration # Update these values with your NetBox instance details -NETBOX_URL=https://netbox.example.com -NETBOX_TOKEN=your_netbox_token_here +NETBOX_API_URL=https://netbox.example.com/api +NETBOX_API_TOKEN=your_netbox_token_here EOF chmod 600 "$config_dir/netbox.env" log_success "netbox.env template created" @@ -189,8 +189,8 @@ validate_config() { # Check Gitea config has real values if [[ -f "$config_dir/gitea.env" ]]; then source "$config_dir/gitea.env" - if [[ "${GITEA_TOKEN:-}" == "your_gitea_token_here" ]] || [[ -z "${GITEA_TOKEN:-}" ]]; then - log_todo "Update GITEA_TOKEN in ~/.config/claude/gitea.env" + if [[ "${GITEA_API_TOKEN:-}" == "your_gitea_token_here" ]] || [[ -z "${GITEA_API_TOKEN:-}" ]]; then + log_todo "Update GITEA_API_TOKEN in ~/.config/claude/gitea.env" else log_success "Gitea configuration appears valid" fi @@ -199,8 +199,8 @@ validate_config() { # Check NetBox config has real values if [[ -f "$config_dir/netbox.env" ]]; then source "$config_dir/netbox.env" - if [[ "${NETBOX_TOKEN:-}" == "your_netbox_token_here" ]] || [[ -z "${NETBOX_TOKEN:-}" ]]; then - log_todo "Update NETBOX_TOKEN in ~/.config/claude/netbox.env" + if [[ "${NETBOX_API_TOKEN:-}" == "your_netbox_token_here" ]] || [[ -z "${NETBOX_API_TOKEN:-}" ]]; then + log_todo "Update NETBOX_API_TOKEN in ~/.config/claude/netbox.env" else log_success "NetBox configuration appears valid" fi