---
name: rac-build
description: Run authorized remote Cargo or pnpm builds with RAC, retrieve outputs, and use the RCI companion for configured CI workflows.
---

# Remote builds with RAC

`rac cargo` and `rac pnpm` submit finite builds and stream their output and exit
status. `rci` is the companion behind `rac ci`, `rac leg` and publication
commands; it is not a separate generic build service. Inspect the installed
command's scoped `--help` before selecting flags.

## Configure the project's builder

Use the endpoint, authentication and budget provisioned for this project.
Public API/search access alone does not grant remote-build access. The default
Redgold builder fleet is for its own repository; arbitrary Cargo workspaces
require a dedicated builder advertising source-tree support. Do not upload a
customer project to a guessed or internal fleet endpoint.

For a provisioned Cargo source-tree builder, set
`RAC_CARGO_SOURCE_TREE_REMOTE` to its URL. Inject the approved bearer through the
project's secret manager as `RAC_CARGO_REMOTE_TOKEN`; the build client also
supports its managed `RG_INJECT_SK` identity. A standalone `REDGOLD_API_KEY`
is not automatically the builder credential in all releases. Use the same key
only when that builder explicitly authorizes it, without printing its value.

```sh
rac cargo --source-tree check -p my-crate
rac cargo --source-tree test -p my-crate
rac cargo --source-tree --artifact-target-root .build-artifacts build -p my-crate --bin my-tool
```

Source-tree sync includes uncommitted source. Review the upload scope and
exclude credentials and unrelated private files before submitting. Returned
executables are builder-native; check their OS and architecture before running
them locally. Remote execution does not make a Linux executable run on macOS.

For a configured pnpm builder, run from the package directory:

```sh
rac pnpm --remote "$PROJECT_PNPM_BUILDER_URL" --timeout-secs 900 run build
rac pnpm --remote "$PROJECT_PNPM_BUILDER_URL" --fetch path/from/workspace/root/dist run build
```

`PROJECT_PNPM_BUILDER_URL` is a project-specific example, not a built-in default.
Use the workspace-relative output path returned by the actual project. Without
`--fetch`, pnpm output remains on the builder. Cargo-generated repository files
also require explicit, repeatable `--fetch <workspace-relative-path>` arguments.
Do not send persistent servers or watch commands to these finite build routes.

## Finish and maintain

Follow the original request handle through its bounded deadline. A lost
response may follow an accepted build: inspect the request before submitting
another. Report build exit status and which outputs were actually downloaded.
Use `rac out read` for retained full output rather than rebuilding to recover a
truncated summary.

Install `rci` alongside `rac` with the official
https://redgold.ai/install.sh bootstrap; leave off `--without-rci`. Use
`rac ci --help`, `rac leg --help` and the project's existing CI configuration
for automation. Installing the companion does not authorize publishing,
deployment or changes to the project's infrastructure.

<!-- redgold-ui-revision:a14101e51ab517569a935684f926cfc3c5f68b24 -->
