# Install/run via CLI

1. **Prerequisites:** Before proceeding, ensure you've completed all necessary [**prerequisites for self-hosted**](/ai-code-reviews-in-git/install-run-as-a-self-hosted-service/prerequisites.md) AI Code Review Agent.
2. **Start Docker:** Ensure Docker is running on your machine.
3. **Repository Download:** [**Download the AI Code Review Agent**](https://github.com/gitbito/codereviewagent) GitHub repository to your machine.
4. **Extract and Navigate:**

* Extract the downloaded .zip file to a preferred location.

<figure><img src="/files/8UZSySOOxdJbh0qjBCc8" alt=""><figcaption></figcaption></figure>

* Navigate to the extracted folder and then to the “cra-scripts” subfolder.

<figure><img src="/files/nHci20o7QaY5yUAB2Bjy" alt=""><figcaption></figcaption></figure>

* Note the full path to the “cra-scripts” folder for later use.

<figure><img src="/files/y4lsk7SE4PpBcL34TCUv" alt=""><figcaption></figcaption></figure>

5. **Open Command Line:**
   * Use Bash for Linux and macOS.
   * Use PowerShell for Windows.
6. **Set Directory:**
   * Change the current directory in Bash/PowerShell to the “cra-scripts” folder.
   * Example command: `cd [Path to cra-scripts folder]`
   * Adjust the path based on your extraction location.

<figure><img src="/files/bDr6c2IEPxRrKJVRb2aA" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/VrheEQTD8qgwKyAvNya0" alt=""><figcaption></figcaption></figure>

7. **Configure Properties:**
   * Open the **bito-cra.properties** file in a text editor from the “cra-scripts” folder. Detailed information for each property is provided on [**Agent Configuration: bito-cra.properties File**](/ai-code-reviews-in-git/install-run-as-a-self-hosted-service/agent-configuration-bito-cra.properties-file.md) page.
   * Set mandatory properties:
     * mode = cli
     * pr\_url
     * bito\_cli.bito.access\_key
     * git.provider
     * git.access\_token

{% hint style="info" %}
**Note:** Valid values for git.provider are GITHUB, GITLAB, or BITBUCKET.
{% endhint %}

* Optional properties (can be skipped or set as needed):
  * git.domain
  * code\_feedback
  * static\_analysis
  * dependency\_check
  * dependency\_check.snyk\_auth\_token
  * review\_scope
  * exclude\_branches
  * exclude\_files
  * exclude\_draft\_pr

{% hint style="info" %}
**Note:** Detailed information for each property is provided on [**Agent Configuration: bito-cra.properties File**](/ai-code-reviews-in-git/install-run-as-a-self-hosted-service/agent-configuration-bito-cra.properties-file.md) page.
{% endhint %}

{% hint style="info" %}
Check the [**Required Access Tokens**](/ai-code-reviews-in-git/install-run-as-a-self-hosted-service/prerequisites.md#required-access-tokens) guide to learn more about creating the access tokens needed to configure the Agent.
{% endhint %}

<figure><img src="/files/kFjFxy6BxiN4HoO4KGYF" alt=""><figcaption></figcaption></figure>

8. **Run the Agent:**
   * On Linux/macOS in Bash: Run `./bito-cra.sh bito-cra.properties`
   * On Windows in PowerShell: Run `./bito-cra.ps1 bito-cra.properties`

{% hint style="info" %}
This step might take time initially as it pulls the Docker image and performs the code review.
{% endhint %}

<figure><img src="/files/82eyf5HS4mIQMNPqGfaz" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/eiym334Z8I082L9HUz3m" alt=""><figcaption></figcaption></figure>

9. **Final Steps:**
   * The script may prompt values of mandatory/optional properties if they are not preconfigured.
   * Upon completion, a code review comment is automatically posted on the Pull Request specified in the **pr\_url** property.

{% hint style="info" %}
**Note:** To improve efficiency, the AI Code Review Agent is disabled by default for pull requests involving the **"main"** branch. This prevents unnecessary processing and token usage, as changes to the **"main"** branch are typically already reviewed in release or feature branches. To change this default behavior and include the **"main"** branch, please [**contact support**](mailto:support@bito.ai).
{% endhint %}

## Screenshots

### Screenshot # 1

{% hint style="info" %}
*AI-generated pull request (PR) summary*
{% endhint %}

<figure><img src="/files/RxexT09jakJeCJTjyOlI" alt=""><figcaption></figcaption></figure>

### Screenshot # 2

{% hint style="info" %}
**Changelist** showing key changes and impacted files in a pull request.
{% endhint %}

<figure><img src="/files/B546WeVmhUFbAADtHF5M" alt=""><figcaption><p>Changelist in AI Code Review Agent's feedback.</p></figcaption></figure>

### Screenshot # 3

{% hint style="info" %}
*AI code review feedback posted as comments on the pull request.*
{% endhint %}

<figure><img src="/files/OYJFi6UdihvkgDkblsaV" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bito.ai/ai-code-reviews-in-git/install-run-as-a-self-hosted-service/install-run-via-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
