# Install

> Install cigen from source with cargo. Written so an agent can follow it.

cigen is a Rust command-line tool. There are no prebuilt binaries for the current code yet (the v0.1.0 release predates
it), so install it from source.

## What you need

- **Rust**, edition 2024 (Rust 1.85 or later), from [rustup](https://rustup.rs).
- **protoc**, the Protocol Buffers compiler. cigen compiles its plugin protocol at build time.
  - macOS: `brew install protobuf`
  - Debian or Ubuntu: `apt-get install -y protobuf-compiler`
- **git**. `cigen hash` uses `git ls-files` to find the files a pattern matches.

## Install

cigen runs each CI provider as a separate binary, so install all three:

```sh
cargo install --locked --git https://github.com/DocSpring/cigen \
  cigen cigen-provider-github cigen-provider-circleci
```

cargo puts them in `~/.cargo/bin`. cigen looks for the provider binaries next to its own binary, so keep the three
together. To keep them somewhere else, set `CIGEN_PLUGIN_DIR` to their directory.

## Check it

```sh
cigen --version
```

Then follow the [quick start](/docs/quick-start/).

## Optional

- The [CircleCI CLI](https://circleci.com/docs/local-cli/). When `circleci` is on your `PATH`, cigen runs
  `circleci config validate` on the CircleCI config it generates and fails if the config is invalid.

## For agents

To set cigen up in a repository:

1. Install it as above, and run `cigen --version` to check.
2. Write a `cigen.yml` at the repository root. Start from the example in the [quick start](/docs/quick-start/). The
   schema is in [configuration](/docs/configuration/) and [jobs](/docs/jobs/).
3. Run `cigen generate`. Fix any error it prints: each one names the file and key and says what to change.
4. Commit `cigen.yml` and the generated files together. Never edit the generated files by hand. Change `cigen.yml` and
   generate again.

Every docs page is available as Markdown by adding `.md` to its address, and [`/llms-full.txt`](/llms-full.txt) has
them all in one file.
