Major improvements to plugin setup experience: Setup Commands: - Redesign /initial-setup as interactive wizard (MCP + system + project config) - Add /project-init for quick project-only setup - Add /project-sync for handling repository moves/renames - Add Gitea API validation to auto-fill org/repo when verified Configuration Changes: - Move GITEA_ORG from system to project level (supports multi-org users) - System config now only contains GITEA_URL and GITEA_TOKEN - Project .env now contains GITEA_ORG and GITEA_REPO Automation: - Add SessionStart hook for projman and pr-review - Automatically detects git remote vs .env mismatch - Warns user to run /project-sync when mismatch found Documentation: - Unify configuration docs (remove duplicate in plugins/projman) - Add flow diagrams to CONFIGURATION.md - Add setup script review guidance to UPDATING.md - Update COMMANDS-CHEATSHEET.md with new commands and hooks Files added: - plugins/projman/commands/project-init.md - plugins/projman/commands/project-sync.md - plugins/projman/hooks/hooks.json - plugins/pr-review/commands/initial-setup.md - plugins/pr-review/commands/project-init.md - plugins/pr-review/commands/project-sync.md - plugins/pr-review/hooks/hooks.json - plugins/cmdb-assistant/commands/initial-setup.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.5 KiB
description
| description |
|---|
| Sync project configuration with current git remote - use after changing repository location or organization |
Project Sync
Updates project configuration when the git remote URL has changed (repository moved, renamed, or organization changed).
Use this when:
- You moved the repository to a different organization
- You renamed the repository
- You changed the git remote URL
- The SessionStart hook detected a mismatch
Step 1: Verify System Configuration
cat ~/.config/claude/gitea.env 2>/dev/null | grep -v "^#" | grep -v "PASTE_YOUR" | grep "GITEA_TOKEN=" && echo "SYSTEM_OK" || echo "SYSTEM_MISSING"
If SYSTEM_MISSING: Stop and instruct user to run /initial-setup first.
Step 2: Read Current Configuration
Read the current .env values:
cat .env 2>/dev/null
Extract current values:
CURRENT_ORGfromGITEA_ORG=...CURRENT_REPOfromGITEA_REPO=...
If .env doesn't exist or has no GITEA values: Redirect to /project-init.
Step 3: Detect Git Remote Values
Get the current git remote:
git remote get-url origin 2>/dev/null
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 4: Compare Values
Compare current .env values with detected git remote values:
| Scenario | Action |
|---|---|
| Both match | Display "Configuration is in sync" and exit |
| Organization changed | Proceed to Step 5 |
| Repository changed | Proceed to Step 5 |
| Both changed | Proceed to Step 5 |
If already in sync:
╔══════════════════════════════════════════════════════════════╗
║ CONFIGURATION IN SYNC ║
╠══════════════════════════════════════════════════════════════╣
║ Organization: <ORG_NAME> ║
║ Repository: <REPO_NAME> ║
║ Git Remote: matches .env ║
╚══════════════════════════════════════════════════════════════╝
Exit here if in sync.
Step 5: Show Detected Changes
Display the detected changes to the user:
╔══════════════════════════════════════════════════════════════╗
║ REPOSITORY CHANGE DETECTED ║
╠══════════════════════════════════════════════════════════════╣
║ Current .env │ Git Remote ║
║ Organization: <OLD_ORG> │ <NEW_ORG> ║
║ Repository: <OLD_REPO> │ <NEW_REPO> ║
╚══════════════════════════════════════════════════════════════╝
Step 6: Validate New Repository via Gitea API
Verify the new repository exists and is accessible:
source ~/.config/claude/gitea.env
curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos/<NEW_ORG>/<NEW_REPO>"
| HTTP Code | Action |
|---|---|
| 200 | Repository verified - proceed to Step 7 |
| 404 | Repository not found - ask user to confirm (Step 6a) |
| 401/403 | Permission issue - warn and ask to confirm |
Step 6a: Confirm if API Validation Failed
Use AskUserQuestion:
- Question: "The new repository '<NEW_ORG>/<NEW_REPO>' was not found via API. Update configuration anyway?"
- Header: "Not Found"
- Options:
- "Yes, update anyway (I'll fix the remote later)"
- "No, let me fix the git remote first"
- "Let me specify different values"
If "specify different values": Ask for correct org and repo, then re-validate.
Step 7: Confirm Update
Use AskUserQuestion:
- Question: "Update project configuration to match git remote?"
- Header: "Confirm"
- Options:
- "Yes, update .env (Recommended)"
- "No, keep current configuration"
If "No": Exit without changes.
Step 8: Update Configuration
Update the .env file with new values:
# Update GITEA_ORG
sed -i 's/^GITEA_ORG=.*/GITEA_ORG=<NEW_ORG>/' .env
# Update GITEA_REPO
sed -i 's/^GITEA_REPO=.*/GITEA_REPO=<NEW_REPO>/' .env
Alternatively, if sed doesn't work well, read the file, replace values, and write back.
Step 9: Verify Update
Read the updated .env and display confirmation:
╔══════════════════════════════════════════════════════════════╗
║ CONFIGURATION UPDATED ║
╠══════════════════════════════════════════════════════════════╣
║ Organization: <NEW_ORG> ║
║ Repository: <NEW_REPO> ║
║ Status: In sync with git remote ║
╚══════════════════════════════════════════════════════════════╝
Your project configuration has been updated.
MCP tools will now use the new repository.
Troubleshooting
"Repository not found" but it exists:
- Check your Gitea token has access to the new organization
- Verify the repository name matches exactly (case-sensitive)
- Ensure your token has
repopermissions
Git remote URL is wrong:
- Fix it first:
git remote set-url origin <correct-url> - Then run
/project-syncagain
Want to revert the change:
- Edit
.envmanually:nano .env - Or run
/project-syncafter fixing the git remote