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

# Aspect CLI tasks

> Overview of built-in Aspect CLI AXL tasks including aspect build, test, format, lint, delivery, gazelle, and buildifier on any Bazel CI system.

A task is a named unit of work you run with `aspect <task>`: build and test, format, lint, generate BUILD files, deliver artifacts. Tasks that run Bazel add what CI needs on top of it: status checks, PR comments, artifact upload and retries on transient errors. Every task runs the same on your machine and on any CI system.

The Aspect CLI ships with the built-in tasks listed below, and you customize them in `.aspect/config.axl`. You can also add your own: a custom task is an `.axl` file in `.aspect/`, discovered automatically and run the same way as a built-in one. [Run and define tasks](https://aspect.build/docs/cli/guides/basic.md) shows how to write one.

On Aspect Workflows CI runners, tasks configure Bazel for the runner; see [Aspect Workflows runners](https://aspect.build/docs/cli/tasks-ci.md#aspect-workflows-runners).

> [!TIP]
>
> Run `aspect help` from inside your repo to list every task available, built-in and custom. `aspect <task> --help` shows a task's flags with their defaults.

## Built-in tasks

### Build & test

| Command | What it does |
| - | - |
| [`aspect build`](https://aspect.build/docs/cli/tasks/build_test) | Build Bazel targets |
| [`aspect test`](https://aspect.build/docs/cli/tasks/build_test) | Run Bazel tests |
| [`aspect run`](https://aspect.build/docs/cli/tasks/run) | Build and run a binary target |

### Formatting & linting

| Command | What it does |
| - | - |
| [`aspect format`](https://aspect.build/docs/cli/tasks/format) | Format source files |
| [`aspect buildifier`](https://aspect.build/docs/cli/tasks/buildifier) | Format Starlark files (opt-in via `format.alias()`) |
| [`aspect lint`](https://aspect.build/docs/cli/tasks/lint) | Run linters |

### BUILD file generation

| Command | What it does |
| - | - |
| [`aspect gazelle`](https://aspect.build/docs/cli/tasks/gazelle) | Generate and sync BUILD files |

### Delivery

| Command | What it does |
| - | - |
| [`aspect delivery`](https://aspect.build/docs/cli/tasks/delivery) | Deliver build artifacts |

### Affected targets

| Command | What it does |
| - | - |
| [`aspect cache diff`](https://aspect.build/docs/cli/tasks/cache_diff) | List test targets affected by the current tree vs. the remote cache |

### Agents

| Command | What it does |
| - | - |
| [`aspect mcp`](https://aspect.build/docs/cli/tasks/mcp) | Serve read-only build and test results to AI agents over MCP |

### CI runners

| Command | What it does |
| - | - |
| [`aspect ci warming`](https://aspect.build/docs/cli/tasks/ci_warming) | Fill a runner's Bazel caches and upload the warming archive |
| [`aspect ci runner-health-check`](https://aspect.build/docs/cli/tasks/ci_runner_health_check) | Run the Workflows runner health check |
| [`aspect ci runner-metadata`](https://aspect.build/docs/cli/tasks/ci_runner_metadata) | Print the Workflows runner metadata |

### Setup

| Command | What it does |
| - | - |
| [`aspect init`](https://aspect.build/docs/cli/tasks/init) | Scaffold a new Bazel workspace from a preset |
| [`aspect axl add`](https://aspect.build/docs/cli/tasks/axl_add) | Add an AXL module from a GitHub release to `MODULE.aspect` |
| [`aspect setup bazelrc`](https://aspect.build/docs/cli/tasks/setup_bazelrc) | Write a Bazel rc so vanilla `bazel` calls reach your deployment. Also reachable as `aspect ci bazelrc` |
| [`aspect setup tools-bazel-wrapper`](https://aspect.build/docs/cli/tasks/setup_tools_bazel_wrapper) | Install the `tools/bazel` wrapper that routes `bazel` through `aspect` |
| [`aspect setup workspace-data`](https://aspect.build/docs/cli/tasks/setup_workspace_data) | Print build metadata as Bazel workspace status |

### Housekeeping

| Command | What it does |
| - | - |
| [`aspect gc`](https://aspect.build/docs/cli/tasks/gc) | Reclaim Bazel output bases and download-cache entries nothing is using |
| [`aspect output-bases`](https://aspect.build/docs/cli/tasks/output_bases) | List this machine's output bases: state, server memory, branch, workspace and size |

### Worktrees

A pool of reusable worktree slots that keep their Bazel output base — and its server — across branches. See the [worktrees guide](https://aspect.build/docs/cli/guides/worktrees.md).

| Command | What it does |
| - | - |
| [`aspect worktree add`](https://aspect.build/docs/cli/worktrees/add) | Check a branch out into the warmest free slot |
| [`aspect worktree release`](https://aspect.build/docs/cli/worktrees/release) | Give a slot back, keeping its output base for the next branch |
| [`aspect worktree list`](https://aspect.build/docs/cli/worktrees/list) | Report every slot in the pool and what it has kept |
| [`aspect worktree path`](https://aspect.build/docs/cli/worktrees/path) | Print one slot's path — the call agents make |
| [`aspect worktree inspect`](https://aspect.build/docs/cli/worktrees/inspect) | Report one slot in detail |
| [`aspect worktree prune`](https://aspect.build/docs/cli/worktrees/prune) | Release slots nothing is using any more |

### Authentication

| Command | What it does |
| - | - |
| [`aspect auth`](https://aspect.build/docs/cli/authentication) | Log in, and configure and switch deployments (`login`, `logout`, `status`, `configure`, `use`, `remove`) |

### GitHub App

| Command | What it does |
| - | - |
| [`aspect github token`](https://aspect.build/docs/cli/tasks/github_token) | Mint a short-lived GitHub App token for a repository |

## Discovery commands

These aren't tasks. `aspect help` lists them under **Commands**.

| Command | What it does |
| - | - |
| [`aspect describe`](https://aspect.build/docs/cli/guides/agents) | Print the command index and feature names as JSON; `aspect describe '<task>'` prints one task's flags with their effective defaults |
| [`aspect feature`](https://aspect.build/docs/cli/reference/features) | List the built-in features; `aspect feature <name>` shows a feature's flags |
| [`aspect version`](https://aspect.build/docs/cli/tasks/version) | Print the CLI version this repository resolves to |

## Flags every task accepts

| Flag | What it does |
| - | - |
| `--task:name=<name>` | Short name identifying this invocation (`A-Za-z0-9`, `_`, `-`). Set it on every CI invocation: status checks, artifacts and delivery state are keyed on it. Defaults to a name derived from the CI job on CI, and `<kind>-<random suffix>` off CI. See [Task name](https://aspect.build/docs/cli/tasks-ci.md#task-name). |
| `--task:friendly-name=<label>` | Human-readable label shown on status surfaces. Defaults to `--task:name`. |
| `--task:id=<uuid>` | UUID identifying this invocation. Generated when unset. |
| `--task:timing-summary=<level>` | Phase-timing breakdown after the completion line: `none`, `total`, `short`, or `detailed` (default). |

Configure tasks in `.aspect/config.axl` ([AXL](https://aspect.build/docs/cli/axl.md)), pin the CLI version in `.aspect/version.axl` ([version pinning](https://aspect.build/docs/cli/version-pinning.md)), and see [Running tasks in CI](https://aspect.build/docs/cli/tasks-ci.md) for pipeline YAML for each CI provider.


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