Files

6.7 KiB

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:

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
  • Authenticate: gh auth login
  • Verify:
    gh --version && gh auth status
    

GitLab

CLI: glab

  • Install: brew install glab or glab.readthedocs.io
  • Authenticate: glab auth login
  • Verify:
    glab --version && glab auth status
    

Bitbucket

CLI: bb or API access

Azure DevOps

CLI: az with DevOps extension

  • Install: brew install azure-cli or 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:
    az --version && az devops
    

Find Open PR/MR

Get the PR/MR number for the current branch:

GitHub

gh pr list --head <branch-name> --state open --json number,title

GitLab

glab mr list --source-branch <branch-name> --state opened

Bitbucket

bb pr list --source-branch <branch-name> --state OPEN

Azure DevOps

az repos pr list --source-branch <branch-name> --status active --output json

Fetch Review Comments

Qodo posts both summary comments (PR-level) and inline review comments (per-line). Fetch both.

GitHub

# PR-level comments (includes the summary comment with all issues)
gh pr view <pr-number> --json comments

# Inline review comments (per-line comments on specific code)
gh api repos/{owner}/{repo}/pulls/<pr-number>/comments

GitLab

# All MR notes including inline comments
glab mr view <mr-iid> --comments

Bitbucket

# All PR comments including inline comments
bb pr view <pr-id> --comments

Azure DevOps

# PR-level threads (includes summary comments)
az repos pr show --id <pr-id> --output json

# All PR threads including inline comments
az repos pr policy list --id <pr-id> --output json
az repos pr thread list --id <pr-id> --output json

Reply to Inline Comments

Use the inline comment ID preserved during deduplication to reply directly to Qodo's comments.

GitHub

gh api repos/{owner}/{repo}/pulls/<pr-number>/comments/<inline-comment-id>/replies \
  -X POST \
  -f body='<reply-body>'

Reply format:

  • Fixed: ✅ **Fixed** — <brief description of what was changed>
  • Deferred: ⏭️ **Deferred** — <reason for deferring>

GitLab

glab api "/projects/:id/merge_requests/<mr-iid>/discussions/<discussion-id>/notes" \
  -X POST \
  -f body='<reply-body>'

Bitbucket

bb api "/2.0/repositories/{workspace}/{repo}/pullrequests/<pr-id>/comments" \
  -X POST \
  -f 'content.raw=<reply-body>' \
  -f 'parent.id=<inline-comment-id>'

Azure DevOps

az repos pr thread comment add \
  --id <pr-id> \
  --thread-id <thread-id> \
  --content '<reply-body>'

Post Summary Comment

After reviewing all issues, post a summary comment to the PR/MR.

GitHub

gh pr comment <pr-number> --body '<comment-body>'

GitLab

glab mr comment <mr-iid> --message '<comment-body>'

Bitbucket

bb pr comment <pr-id> '<comment-body>'

Azure DevOps

az repos pr thread create \
  --id <pr-id> \
  --comment-content '<comment-body>'

Summary format:

## 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

# 1. Fetch comments to find the comment ID
gh pr view <pr-number> --json comments

# 2. React with thumbs up to acknowledge
gh api "repos/{owner}/{repo}/issues/comments/<comment-id>/reactions" \
  -X POST \
  -f content='+1'

GitLab

# 1. Fetch discussions to find the discussion ID
glab api "/projects/:id/merge_requests/<mr-iid>/discussions"

# 2. Resolve the discussion
glab api "/projects/:id/merge_requests/<mr-iid>/discussions/<discussion-id>" \
  -X PUT \
  -f resolved=true

Bitbucket

# Fetch comments via bb api, find the comment ID, then update to resolved status
bb api "/2.0/repositories/{workspace}/{repo}/pullrequests/<pr-id>/comments/<comment-id>" \
  -X PUT \
  -f 'resolved=true'

Azure DevOps

# Mark the thread as resolved
az repos pr thread update \
  --id <pr-id> \
  --thread-id <thread-id> \
  --status resolved

Create PR/MR (Special Case)

If no PR/MR exists for the current branch, offer to create one.

GitHub

gh pr create --title '<title>' --body '<body>'

GitLab

glab mr create --title '<title>' --description '<body>'

Bitbucket

bb pr create --title '<title>' --description '<body>'

Azure DevOps

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