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

# Installation & Setup

> Install the CodeAnt AI CLI and configure authentication for your SCM platform

## Installation

Install CodeAnt CLI globally using npm:

```bash theme={null}
npm install -g codeant-cli
```

Verify the installation:

```bash theme={null}
codeant --version
codeant --help
```

## Authentication

### Login with CodeAnt AI

Authenticate with your CodeAnt AI account using browser-based OAuth:

```bash theme={null}
codeant login
```

This opens a browser window at `app.codeant.ai` for authentication. The CLI polls for login completion automatically (timeout: 10 minutes).

Your API key is saved to `~/.codeant/config.json`.

To log out:

```bash theme={null}
codeant logout
```

### SCM Platform Tokens

To use PR management and code review features, store authentication tokens for your SCM platform:

```bash theme={null}
codeant set-token github <your-github-token>
codeant set-token gitlab <your-gitlab-token>
codeant set-token bitbucket <your-bitbucket-token>
codeant set-token azure <your-azure-devops-pat>
```

**Alternative: Environment Variables**

You can also authenticate via environment variables (these take priority over stored tokens):

| Platform     | Environment Variables                    |
| ------------ | ---------------------------------------- |
| GitHub       | `GITHUB_TOKEN`, `GH_TOKEN`               |
| GitLab       | `GITLAB_TOKEN`                           |
| Bitbucket    | `BITBUCKET_TOKEN`                        |
| Azure DevOps | `AZURE_DEVOPS_TOKEN`, `AZURE_DEVOPS_PAT` |

**Alternative: Platform CLI Tools**

If you have GitHub CLI (`gh`) or GitLab CLI (`glab`) installed and authenticated, CodeAnt will automatically use their tokens as a fallback.

**Token Resolution Order:**

1. Environment variables (highest priority)
2. Platform CLI tools (`gh auth token`, `glab auth token`)
3. Stored tokens in `~/.codeant/config.json`

## Self-Hosted / Enterprise Setup

### Custom API Base URL

For self-hosted CodeAnt deployments, set a custom API base URL:

```bash theme={null}
codeant set-base-url https://your-codeant-instance.example.com
```

Check the current API base URL and its source:

```bash theme={null}
codeant get-base-url
```

You can also set this via the `CODEANT_API_URL` environment variable.

### Self-Hosted SCM Platforms

CodeAnt auto-detects self-hosted SCM instances from your git remote URL. You can also explicitly configure base URLs:

| Platform           | Environment Variables                   | Config Key         |
| ------------------ | --------------------------------------- | ------------------ |
| GitHub Enterprise  | `GITHUB_API_URL`, `GH_ENTERPRISE_URL`   | `githubBaseUrl`    |
| Self-hosted GitLab | `GITLAB_URL`, `GITLAB_HOST`             | `gitlabBaseUrl`    |
| Bitbucket Server   | `BITBUCKET_URL`, `BITBUCKET_SERVER_URL` | `bitbucketBaseUrl` |

## Quick Start

Once installed and authenticated, try scanning your staged files:

```bash theme={null}
# Scan for secrets
codeant secrets

# AI-powered code review
codeant review
```

See the [Commands](/cli/commands) reference for all available options.
