> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SCM Integration & PR Tools

> Manage pull requests, code reviews, and comments across GitHub, GitLab, Bitbucket, and Azure DevOps

CodeAnt CLI provides a unified interface for managing pull requests, code reviews, and comments across all major SCM platforms. All PR commands auto-detect your SCM platform and repository from the git remote.

## Supported Platforms

| Platform         | Hosting                                       |
| ---------------- | --------------------------------------------- |
| **GitHub**       | github.com, GitHub Enterprise (self-hosted)   |
| **GitLab**       | gitlab.com, self-hosted GitLab                |
| **Bitbucket**    | bitbucket.org, Bitbucket Server / Data Center |
| **Azure DevOps** | dev.azure.com, visualstudio.com               |

## Auto-Detection

CodeAnt automatically detects your SCM platform, repository name, and default branch from your git remote:

```bash theme={null}
# These are equivalent — auto-detection handles it
codeant pr list
codeant pr list --remote github --name owner/repo
```

**How it works:**

1. Parses `git remote get-url origin` (supports both SSH and HTTPS URLs)
2. Maps the host to a platform (e.g., `github.com` → `github`)
3. Extracts `owner/repo` from the URL path
4. Detects the default branch from `refs/remotes/origin/HEAD`

For self-hosted instances, CodeAnt uses hostname heuristics (e.g., a host containing "gitlab" maps to GitLab). You can always override with `--remote` and `--name` flags.

## Authentication

See [Setup — SCM Platform Tokens](/cli/setup#scm-platform-tokens) for authentication configuration.

## Pull Request Management

### pr list

List pull requests (or merge requests) in the repository.

```bash theme={null}
codeant pr list [options]
```

| Option                      | Description                                                            |
| --------------------------- | ---------------------------------------------------------------------- |
| `--name <repo>`             | Repository name (`owner/repo`) — auto-detected                         |
| `--remote <provider>`       | SCM platform: `github`, `gitlab`, `bitbucket`, `azure` — auto-detected |
| `--default-branch <branch>` | Default branch name — auto-detected                                    |
| `--source-branch <branch>`  | Filter by source branch (partial match)                                |
| `--author <login>`          | Filter by author (fuzzy match)                                         |
| `--state <state>`           | `open` or `closed` (default: `open`)                                   |
| `--limit <n>`               | Maximum results (default: 20, max: 100)                                |
| `--offset <n>`              | Pagination offset (default: 0)                                         |

**Examples:**

```bash theme={null}
# List open PRs
codeant pr list

# List closed PRs by a specific author
codeant pr list --state closed --author johndoe

# Filter by source branch
codeant pr list --source-branch feature/

# Paginate results
codeant pr list --limit 10 --offset 20
```

**Output:** Returns JSON with PR number, title, state, author, source/target branches, and URLs.

***

### pr get

Get detailed information about a specific pull request, including review analysis data.

```bash theme={null}
codeant pr get [options]
```

| Option                      | Description                     |
| --------------------------- | ------------------------------- |
| `--pr-number <n>`           | PR number (**required**)        |
| `--name <repo>`             | Repository name — auto-detected |
| `--remote <provider>`       | SCM platform — auto-detected    |
| `--default-branch <branch>` | Default branch — auto-detected  |

**Example:**

```bash theme={null}
codeant pr get --pr-number 42
```

**Output:** Returns JSON with PR details including additions, deletions, changed files, and review summary.

***

### pr comments

List all comments on a pull request with optional filtering.

```bash theme={null}
codeant pr comments [options]
```

| Option                       | Description                                      |
| ---------------------------- | ------------------------------------------------ |
| `--pr-number <n>`            | PR number (**required**)                         |
| `--name <repo>`              | Repository name — auto-detected                  |
| `--remote <provider>`        | SCM platform — auto-detected                     |
| `--default-branch <branch>`  | Default branch — auto-detected                   |
| `--codeant-generated <bool>` | Filter by CodeAnt authorship (`true` or `false`) |
| `--addressed`                | Filter by resolved/addressed status              |
| `--created-after <date>`     | ISO 8601 date filter (e.g., `2026-01-01`)        |
| `--created-before <date>`    | ISO 8601 date filter                             |

**Examples:**

```bash theme={null}
# List all comments on PR #42
codeant pr comments --pr-number 42

# List only CodeAnt-generated comments
codeant pr comments --pr-number 42 --codeant-generated true

# List unresolved comments from the last week
codeant pr comments --pr-number 42 --addressed false --created-after 2026-03-13
```

**Output:** Returns JSON with both inline review comments and general issue comments, including reply relationships.

### pr resolve

Resolve a comment thread or conversation on a pull request.

```bash theme={null}
codeant pr resolve [options]
```

| Option                 | Description                                      |
| ---------------------- | ------------------------------------------------ |
| `--pr-number <n>`      | PR number (**required**)                         |
| `--name <repo>`        | Repository name — auto-detected                  |
| `--remote <provider>`  | SCM platform — auto-detected                     |
| `--comment-id <id>`    | Comment ID (GitHub, Bitbucket)                   |
| `--thread-id <id>`     | Thread or node ID (GitHub GraphQL, Azure DevOps) |
| `--discussion-id <id>` | Discussion ID (GitLab)                           |

The ID type to use depends on your platform:

| Platform     | Use                                               |
| ------------ | ------------------------------------------------- |
| GitHub       | `--comment-id` or `--thread-id` (GraphQL node ID) |
| GitLab       | `--discussion-id`                                 |
| Bitbucket    | `--comment-id`                                    |
| Azure DevOps | `--thread-id`                                     |

**Example:**

```bash theme={null}
codeant pr resolve --pr-number 42 --comment-id 987654321
```

***

## Code Review Management

### code-review list

List code reviews with optional filtering.

```bash theme={null}
codeant code-review list [options]
```

| Option                      | Description                                        |
| --------------------------- | -------------------------------------------------- |
| `--name <repo>`             | Repository name — auto-detected                    |
| `--remote <provider>`       | SCM platform — auto-detected                       |
| `--default-branch <branch>` | Default branch — auto-detected                     |
| `--pr-number <n>`           | Filter by PR number                                |
| `--status <status>`         | Filter by status: `PENDING`, `COMPLETED`, `FAILED` |
| `--limit <n>`               | Maximum results (default: 20)                      |
| `--offset <n>`              | Pagination offset (default: 0)                     |

**Examples:**

```bash theme={null}
# List all code reviews
codeant code-review list

# List reviews for a specific PR
codeant code-review list --pr-number 42

# List only completed reviews
codeant code-review list --status COMPLETED
```

***

### code-review get

Get detailed information for a specific code review.

```bash theme={null}
codeant code-review get [options]
```

| Option                | Description                     |
| --------------------- | ------------------------------- |
| `--pr-number <n>`     | PR number (**required**)        |
| `--review-id <id>`    | Code review ID (**required**)   |
| `--name <repo>`       | Repository name — auto-detected |
| `--remote <provider>` | SCM platform — auto-detected    |

**Example:**

```bash theme={null}
codeant code-review get --pr-number 42 --review-id rev_abc123
```

**Output:** Returns JSON with review metadata, comments, and line-level feedback.

## Comment Search

### comments search

Search across all CodeAnt comments in a repository.

```bash theme={null}
codeant comments search [options]
```

| Option                   | Description                                            |
| ------------------------ | ------------------------------------------------------ |
| `--query <term>`         | Search term (**required**)                             |
| `--name <repo>`          | Repository name — auto-detected                        |
| `--remote <provider>`    | SCM platform — auto-detected                           |
| `--limit <n>`            | Maximum results (default: 10, max: 50)                 |
| `--include-addressed`    | Include resolved/addressed comments (default: `false`) |
| `--created-after <date>` | ISO 8601 date filter                                   |

**Examples:**

```bash theme={null}
# Search for comments about SQL injection
codeant comments search --query "SQL injection"

# Include resolved comments, limit to 5
codeant comments search --query "authentication" --include-addressed --limit 5

# Search comments created after a specific date
codeant comments search --query "performance" --created-after 2026-01-01
```

**Output:** Returns JSON with matching comments. Search is case-insensitive and searches comment bodies by default. Only CodeAnt-authored comments are included.

## Platform-Specific Notes

### GitHub

* Uses the Octokit SDK under the hood
* Aggregates both review comments (inline) and issue comments
* Supports GitHub Enterprise with custom API URLs

### GitLab

* Uses the GitBeaker SDK
* Works with merge request and approval APIs
* Supports self-hosted instances

### Bitbucket

* Uses the Bitbucket SDK
* Supports both Cloud and Server/Data Center deployments
* Adapts PR/MR terminology automatically

### Azure DevOps

* Uses the Azure DevOps Node API SDK
* Works with organization/project/repository structure
* Supports both `dev.azure.com` and `visualstudio.com` URLs
