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

> ## Agent Instructions
> ## XenoCI Box CI
> To move a repository's macOS CI jobs onto box, follow https://docs.xenoci.com/ci/agent.md. The user only presses Install on GitHub or makes one GitLab runner token; the agent does the rest.
> - Check: `box ci status` (exit 4: sign in first, https://docs.xenoci.com/setup.md).
> - GitHub organization: `box ci connect --org --no-browser --no-wait`, give the user the printed link (https://github.com/apps/xenoci-with-organizations/installations/new), then repeat `box ci accounts` until the owner appears. Personal account: `--personal` (https://github.com/apps/xenoci-with-personal/installations/new).
> - GitHub workflow: change only `runs-on: macos-*` to `runs-on: xenoci` on a branch and open a pull request.
> - GitLab: the user makes a project runner with tag `xenoci` and gives you the `glrt-` token; pipe it to `box ci gitlab connect -` (self-managed: `--url <gitlab url>`), then add `tags: [xenoci]` to the macOS jobs.
> - Watch: `box ci jobs`, `box ci logs <job id> --follow`. Failed job: `box ci jobs --failed`, then `box ci debug <job id>` (failing step, hint, last 200 log lines).

# Set up CI with your agent

> A runbook your coding agent follows to move your macOS CI jobs onto box: the person clicks Install once (GitHub) or makes one runner token (GitLab); the agent does the rest

Give your agent one line:

```text theme={"system"}
Move our macOS CI jobs to XenoCI Box with https://docs.xenoci.com/ci/agent
```

Your first sign-in adds \$10 of credit, about 200 Mac minutes (once per GitHub account).

The rest of this page is written for the agent. The person does one thing: press **Install** on a GitHub page, or make one GitLab runner token. The agent installs box, connects the account, changes the workflow and watches the first job.

## Rules for agents

* Show the user each command you run. Nothing here needs sudo.
* Never ask for a box key, GitHub password or code in the chat. A GitLab runner token goes to box through stdin (step G2), never into a file, a commit or the shell history.
* Installing a GitHub App and topping up are the user's actions. Give them the link and keep going; do not click for them.
* Change only the line that picks the machine (`runs-on` or `tags`) in jobs that need macOS. Leave Linux and Windows jobs as they are.
* Open a branch and a pull request for the change. Do not push to the default branch.

## 1. box installed and signed in

```sh theme={"system"}
box ci status
```

Lines `accounts`, `balance`, `ci` (exit 0): go to 2. `box: command not found`, or exit 4 (not signed in): follow steps 1 and 2 of [Agent setup](https://docs.xenoci.com/setup), then run `box ci status` again.

`balance   $0.00` means no CI job will start until the user runs `box topup`. Jobs wait in GitHub's or GitLab's queue and nothing is charged; tell the user once and carry on.

## 2. Which CI

Look at the repository: `.github/workflows/*.yml` is GitHub Actions (go to GitHub), `.gitlab-ci.yml` is GitLab CI (go to GitLab). Both: do both.

## GitHub Actions

### G1. Connect the account

Find the owner of the repository (`git remote get-url origin`). An organization uses `--org`; a personal account uses `--personal`.

```sh theme={"system"}
box ci connect --org --no-browser --no-wait
```

```text theme={"system"}
https://github.com/apps/xenoci-with-organizations/installations/new
box: open the link, pick the organization and its repositories, press Install on "XenoCI with Organizations"; ...
```

Send the user that link in one message: "Open this, pick `<owner>` and the repositories, press Install." The two links are:

| Owner | App | Install link |
| - | - | - |
| Organization (you must be an owner of it) | XenoCI with Organizations | [https://github.com/apps/xenoci-with-organizations/installations/new](https://github.com/apps/xenoci-with-organizations/installations/new) |
| Personal account (the GitHub account signed in to box) | XenoCI with Personal | [https://github.com/apps/xenoci-with-personal/installations/new](https://github.com/apps/xenoci-with-personal/installations/new) |

Then wait for it without asking the user:

```sh theme={"system"}
box ci accounts
```

Repeat every 15 seconds until the owner appears as a row (`provider github`), for up to 10 minutes. If it never appears, ask the user once whether they pressed Install on the account that owns the repository.

The app asks only for what runner registration needs (see [GitHub Actions](https://docs.xenoci.com/ci/github.md)); it cannot read or change code, pull requests or workflow files. That is why the workflow change in G2 is yours to make.

### G2. Change the workflow in a pull request

In each workflow job that runs on macOS (`runs-on: macos-latest`, `macos-15`, `macos-26` and so on), change only that line:

```yaml theme={"system"}
runs-on: xenoci
```

Then:

```sh theme={"system"}
git switch -c xenoci-ci
git commit -am "ci: run macOS jobs on XenoCI Box"
git push -u origin xenoci-ci
gh pr create --fill
```

Without `gh`, push the branch and give the user the compare link GitHub prints.

### G3. Watch the first job

The pull request starts the workflow. Within a minute:

```sh theme={"system"}
box ci jobs --limit 5
box ci logs <job id> --follow
```

A row with your repository and `running` or `succeeded` means it works: tell the user the pull request is ready to merge. If GitHub shows the job waiting with no row here after 5 minutes, check that `runs-on` is exactly `xenoci` and that the repository was picked in G1 (`box ci accounts`).

## GitLab CI

### L1. Ask for a runner token

GitLab makes runner tokens only in its web page, so this is the user's step. Send them:

> In GitLab open the project (or group) **Settings > CI/CD > Runners > New project runner**. Set Tags to `xenoci`, leave **Run untagged jobs** off, press **Create runner**, and paste me the token that starts with `glrt-`.

### L2. Connect it

Pass the token on stdin so it stays out of the shell history:

```sh theme={"system"}
printf '%s\n' "$TOKEN" | box ci gitlab connect -
```

For a self-managed GitLab add `--url https://gitlab.example.com`. Check it:

```sh theme={"system"}
box ci accounts
```

A row with `provider gitlab` is the runner. Do not keep the token anywhere after this.

### L3. Tag the macOS jobs

In `.gitlab-ci.yml`, give each job that needs macOS the tag, on a branch with a merge request:

```yaml theme={"system"}
test-ios:
  tags: [xenoci]
```

This runner takes only jobs tagged exactly `xenoci`. An untagged job or one with other tags is failed before any Mac starts (no charge) and the runner is paused; fix the tags in GitLab, then connect again.

Watch the first job the same way: `box ci jobs`, then `box ci logs <job id> --follow`.

## When a CI job fails

```sh theme={"system"}
box ci jobs --failed
box ci debug <job id>
```

`box ci debug` prints the job, the step that failed, a hint and the last 200 log lines. Fix the cause in the repository and push again; to try a fix on a Mac without a CI run, use [`box exec`](https://docs.xenoci.com/ios/exec) or [`box test`](https://docs.xenoci.com/ios/test) in the same folder.

## MCP

With the box MCP server connected (`box setup`), the same steps are the tools `ci_status`, `ci_connect` (returns `install_url` at once), `ci_accounts`, `ci_gitlab_connect`, `ci_jobs`, `ci_logs` and `ci_debug`. Every CLI command above also takes `--json`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.