# Getting started

> Set a repository up with bareci init, check it with bareci doctor, and run its tests on a BareCI machine with bareci run.

Source: https://bareci.com/docs/getting-started

This guide takes a repository from nothing to its first run on BareCI. You need the repository on GitHub, a local clone, and permission to install a GitHub App on its owner.

## 1. Install the CLI

The `bareci` CLI is one static binary. Check it is on your path:

```sh
bareci --version
```

## 2. Set the repository up

Run `init` in the repository's root:

```sh
bareci init
```

`init` does every step of setup and shows you what it changed:

1. **Signs you in** with a one-time code in the browser, as `gh auth login` does. No token is pasted anywhere. The token goes to the operating system's keychain.
2. **Checks the GitHub App** on the repository's owner and links you to install it if it is missing.
3. **Opts the repository in**, so its jobs can run on BareCI.
4. **Writes `.bareci/config.yml` and `.bareci/image.sh`** from what it detects in the repository: Bun or Node, Playwright, Postgres, Docker. The image script is what the repository's machine image is baked from.
5. **Points `runs-on:` at BareCI** through a repository variable with a fallback, for example `${{ vars.BARECI_RUNNER_4 || 'ubuntu-latest' }}`, so any job can return to its previous runner by changing one variable.
6. **Opens a pull request** with all of it.

Useful flags:

| Flag                | What it does                                                         |
| ------------------- | -------------------------------------------------------------------- |
| `--dry-run`         | Show the diff and what would happen; change nothing                  |
| `--no-pr`           | Write the files into this checkout instead of opening a pull request |
| `--label bareci-8`  | The default pool size (default `bareci-4`)                           |
| `--repo owner/name` | The repository, when it is not the `origin` remote                   |

## 3. Check the setup

```sh
bareci doctor
```

`doctor` checks each step of `init` and prints the one fix for each failure.

## 4. Run the tests on BareCI

```sh
bareci run -- bun test
```

`run` packs your worktree as it is, uncommitted changes included, runs the command on a fresh machine built from the repository's image, streams the output, and exits with the command's exit code. With no command, it runs the install and test commands from `.bareci/config.yml`.

Bring files back with `--collect` and test reports with `--junit`:

```sh
bareci run --junit junit.xml -- bun test --reporter=junit --reporter-outfile=junit.xml
```

## 5. Push, and ask whether it is ready

After you merge the `init` pull request, CI jobs run on BareCI. On any pull request:

```sh
bareci ready --wait
```

`ready` gives the [Gate's](https://bareci.com/docs/modules/gate) verdict: ready, or every reason it is not yet with the command that fixes it. `--wait` holds until nothing is pending.

## Next

- Connect your agent with [MCP setup](https://bareci.com/docs/agents/mcp).
- Read the [CLI reference](https://bareci.com/docs/cli).
- See how the modules fit in [the pull request lifecycle](https://bareci.com/docs/concepts/lifecycle).
