# Git Provider Commands Reference This document contains all provider-specific CLI commands and API interactions for the Qodo PR Resolver skill. Reference this file when implementing provider-specific operations. ## Supported Providers - GitHub (via `gh` CLI) - GitLab (via `glab` CLI) - Bitbucket (via `bb` CLI) - Azure DevOps (via `az` CLI with DevOps extension) ## Provider Detection Detect the git provider from the remote URL: ```bash git remote get-url origin ``` Match against: - `github.com` → GitHub - `gitlab.com` → GitLab - `bitbucket.org` → Bitbucket - `dev.azure.com` → Azure DevOps ## Prerequisites by Provider ### GitHub **CLI:** `gh` - **Install:** `brew install gh` or [cli.github.com](https://cli.github.com/) - **Authenticate:** `gh auth login` - **Verify:** ```bash gh --version && gh auth status ``` ### GitLab **CLI:** `glab` - **Install:** `brew install glab` or [glab.readthedocs.io](https://glab.readthedocs.io/) - **Authenticate:** `glab auth login` - **Verify:** ```bash glab --version && glab auth status ``` ### Bitbucket **CLI:** `bb` or API access - **Install:** See [bitbucket.org/product/cli](https://bitbucket.org/product/cli) - **Verify:** ```bash bb --version ``` ### Azure DevOps **CLI:** `az` with DevOps extension - **Install:** `brew install azure-cli` or [docs.microsoft.com/cli/azure](https://docs.microsoft.com/cli/azure) - **Install extension:** `az extension add --name azure-devops` - **Authenticate:** `az login` then `az devops configure --defaults organization=https://dev.azure.com/yourorg project=yourproject` - **Verify:** ```bash az --version && az devops ``` ## Find Open PR/MR Get the PR/MR number for the current branch: ### GitHub ```bash gh pr list --head --state open --json number,title ``` ### GitLab ```bash glab mr list --source-branch --state opened ``` ### Bitbucket ```bash bb pr list --source-branch --state OPEN ``` ### Azure DevOps ```bash az repos pr list --source-branch --status active --output json ``` ## Fetch Review Comments Qodo posts both **summary comments** (PR-level) and **inline review comments** (per-line). Fetch both. ### GitHub ```bash # PR-level comments (includes the summary comment with all issues) gh pr view --json comments # Inline review comments (per-line comments on specific code) gh api repos/{owner}/{repo}/pulls//comments ``` ### GitLab ```bash # All MR notes including inline comments glab mr view --comments ``` ### Bitbucket ```bash # All PR comments including inline comments bb pr view --comments ``` ### Azure DevOps ```bash # PR-level threads (includes summary comments) az repos pr show --id --output json # All PR threads including inline comments az repos pr policy list --id --output json az repos pr thread list --id --output json ``` ## Reply to Inline Comments Use the inline comment ID preserved during deduplication to reply directly to Qodo's comments. ### GitHub ```bash gh api repos/{owner}/{repo}/pulls//comments//replies \ -X POST \ -f body='' ``` **Reply format:** - **Fixed:** `✅ **Fixed** — ` - **Deferred:** `⏭️ **Deferred** — ` ### GitLab ```bash glab api "/projects/:id/merge_requests//discussions//notes" \ -X POST \ -f body='' ``` ### Bitbucket ```bash bb api "/2.0/repositories/{workspace}/{repo}/pullrequests//comments" \ -X POST \ -f 'content.raw=' \ -f 'parent.id=' ``` ### Azure DevOps ```bash az repos pr thread comment add \ --id \ --thread-id \ --content '' ``` ## Post Summary Comment After reviewing all issues, post a summary comment to the PR/MR. ### GitHub ```bash gh pr comment --body '' ``` ### GitLab ```bash glab mr comment --message '' ``` ### Bitbucket ```bash bb pr comment '' ``` ### Azure DevOps ```bash az repos pr thread create \ --id \ --comment-content '' ``` **Summary format:** ```markdown ## Qodo Fix Summary Reviewed and addressed Qodo review issues: ### ✅ Fixed Issues - **Issue Title** (Severity) - Brief description of what was fixed ### ⏭️ Deferred Issues - **Issue Title** (Severity) - Reason for deferring --- *Generated by Qodo PR Resolver skill* ``` ## Resolve Qodo Review Comment After posting the summary, resolve the main Qodo review comment. **Steps:** 1. Fetch all PR/MR comments 2. Find the Qodo bot comment containing "Code Review by Qodo" 3. Resolve or react to the comment ### GitHub ```bash # 1. Fetch comments to find the comment ID gh pr view --json comments # 2. React with thumbs up to acknowledge gh api "repos/{owner}/{repo}/issues/comments//reactions" \ -X POST \ -f content='+1' ``` ### GitLab ```bash # 1. Fetch discussions to find the discussion ID glab api "/projects/:id/merge_requests//discussions" # 2. Resolve the discussion glab api "/projects/:id/merge_requests//discussions/" \ -X PUT \ -f resolved=true ``` ### Bitbucket ```bash # Fetch comments via bb api, find the comment ID, then update to resolved status bb api "/2.0/repositories/{workspace}/{repo}/pullrequests//comments/" \ -X PUT \ -f 'resolved=true' ``` ### Azure DevOps ```bash # Mark the thread as resolved az repos pr thread update \ --id \ --thread-id \ --status resolved ``` ## Create PR/MR (Special Case) If no PR/MR exists for the current branch, offer to create one. ### GitHub ```bash gh pr create --title '' --body '<body>' ``` ### GitLab ```bash glab mr create --title '<title>' --description '<body>' ``` ### Bitbucket ```bash bb pr create --title '<title>' --description '<body>' ``` ### Azure DevOps ```bash az repos pr create \ --title '<title>' \ --description '<body>' \ --source-branch <branch-name> \ --target-branch main ``` ## Error Handling ### Missing CLI Tool If the detected provider's CLI is not installed: 1. Inform the user: "❌ Missing required CLI tool: `<cli-name>`" 2. Provide installation instructions from the Prerequisites section 3. Exit the skill ### Unsupported Provider If the remote URL doesn't match any supported provider: 1. Inform: "❌ Unsupported git provider detected: `<url>`" 2. List supported providers: GitHub, GitLab, Bitbucket, Azure DevOps 3. Exit the skill ### API Failures If inline reply or summary posting fails: - Log the error - Continue with remaining operations - The workflow should not abort due to comment posting failures