codezero 0.0.6

A CLI setup wizard for running CodeZero locally
# hydra

`codezero` — a CLI setup wizard for running [CodeZero](https://codezero.build) locally. Answer a few
prompts and it renders your configuration, brings the runtime up, and gives you commands to check
on it, add/remove actions, and upgrade it going forward.

## Prerequisites

- [Docker]https://docs.docker.com/get-docker/ with the Compose v2 plugin (`docker compose version`
  should work). `codezero` checks for both before running any command and tells you what's missing.

## Install

**Homebrew** (macOS/Linux):

```sh
brew install code0-tech/tap/codezero
```

**Cargo:**

```sh
cargo install codezero
```

**npm** (Node.js 18+):

```sh
npm install -g @code0-tech/cli
```

The npm package is a thin wrapper: on install it downloads the prebuilt `codezero` binary for your
OS/arch from the matching GitHub release and verifies it against `checksums.txt`. If install
scripts are skipped (`--ignore-scripts`, pnpm without `trustedDependencies`, ...), the binary is
downloaded on first run instead. Prebuilt binaries cover Linux x86_64, macOS x86_64/arm64 and
Windows x86_64.

**mise:**

```sh
mise use -g github:code0-tech/hydra
```

[mise](https://mise.jdx.dev) installs the prebuilt binary straight from the GitHub releases, so it
covers the same platforms as the npm package. To pin a version per project instead, drop `-g` and
add a version (`mise use github:code0-tech/hydra@0.0.4`), which writes it to that directory's
`mise.toml`:

```toml
[tools]
"github:code0-tech/hydra" = "0.0.4"
```

**Prebuilt binary:** grab the archive for your OS/arch from the
[latest release](https://github.com/code0-tech/hydra/releases/latest) and put the extracted
`codezero` on your `PATH`.

**From source:**

```sh
git clone https://github.com/code0-tech/hydra.git
cd hydra
cargo build --release
./target/release/codezero --help
```

Every method ends up with the same standalone binary — neither the setup wizard nor the action catalog is
baked in. Both are fetched live at runtime (the wizard bundle from `reticulum`, the action catalog
from `centaurus`), so it works from any directory without those repos checked out nearby, and
updating either never requires a new `codezero` release. `--bundle`/`--index` still let you point
at a directory on disk instead, useful when developing against an edited bundle.
`CODEZERO_RETICULUM_BRANCH=<branch> codezero setup` fetches the bundle from a specific reticulum
branch instead of `main` — useful for testing an unmerged reticulum change.

## Quick start

```sh
codezero setup
```

Walks you through a short wizard (admin account, runtime profiles, image registry/version), writes
`.codezero/.env` and `.codezero/docker-compose.yml`, then pulls and starts everything. When it's
done it prints the URL CodeZero is running at.

## Commands

| Command | What it does |
|---|---|
| `codezero setup [--dev]` | Interactive first-time setup. `--dev` skips every prompt, using manifest defaults and the latest in-progress reticulum build — for CodeZero developers, not a typical install. |
| `codezero start` | Start a previously configured stack. |
| `codezero stop` | Stop the stack and free its resources. |
| `codezero status` | Show each service's current state. |
| `codezero logs [service] [-f] [--tail N]` | Stream logs for one service, or everything. |
| `codezero configure` | Re-run the setup wizard against your existing install — prompts are pre-filled with current values, existing secrets are kept as-is. |
| `codezero plugin ls` | List every action in the catalog (fetched live from centaurus) and which ones you've installed, plus any actions you've `register`ed locally (shown as `registered`). |
| `codezero plugin install <name>` | Add an action (e.g. `codezero plugin install gls-action`, or `gls-action@1.2.3` for a specific version). Fails with a clear message if the action needs a capability (like `rest-action`) your setup doesn't have enabled. |
| `codezero plugin uninstall <name>` | Remove a previously installed action. |
| `codezero plugin register <identifier>` | For developing a new action: registers an identifier with Aquila (no catalog entry, no managed container) and prints the `AQUILA_URL`/`AUTH_TOKEN` to point your locally-running action at. |
| `codezero plugin unregister <identifier>` | Remove a previously `register`ed identifier. |
| `codezero reset` | Stop everything, wipe `.codezero/`, and run `setup` again from scratch. Destructive — generates fresh secrets and passwords. Prefer `configure` if you just want to change something. |

## Staying up to date

On every run `codezero` kicks off a detached background check (throttled to once a day) for a newer
in-progress build and caches the result, so no command ever waits on the network. When a newer build
than your pinned version is available, the next run prints a one-line reminder.

To apply it there's an **experimental** `--upgrade` flag (a dedicated `upgrade` command will replace
it later):

```sh
codezero --upgrade --dev            # move to the latest in-progress build
codezero --upgrade --tag <version>  # or pin a specific version
```

It asks for confirmation (a refreshed bundle may bring breaking changes), then refetches the bundle
from reticulum, bumps both the core-platform and action image tags, and recreates only what changed.
Your secrets, admin account, and installed actions are kept — the render is seeded from your whole
existing `.env`, so nothing you've configured is lost. `--registry`/`--edition`/`--bundle` fine-tune
the source the same way `setup` does.

## How it's put together

- The whole bundle (`manifest.json`, `docker-compose.yml`, `.env`, `service.configuration.json.tera`)
  is fetched live at runtime from a single place: `reticulum`'s `docker-compose/` folder. Reticulum
  is the canonical source for the actual compose stack, so neither `docker-compose.yml` nor `.env`
  is hand-copied here; `manifest.json` lives alongside them there too, so the whole bundle updates in
  one place. `manifest.json` declares the setup wizard: each prompt, its section/type/default, which
  values are auto-generated secrets, and which templates to render.
- `.env` isn't a Tera template — it's reticulum's own vendored file, patched in place: only the keys
  the wizard actually collects (steps + generated secrets) get overwritten; every other setting
  (ports, hosts, log levels, ...) keeps whatever default reticulum already ships, so `manifest.json`
  never has to duplicate them. Every value `docker-compose.yml` needs that varies per install is a
  `${VAR}` reference Docker Compose resolves from the resulting `.codezero/.env` at runtime.
- This repo has no local copy of the bundle — `--bundle <path>` points at any directory on disk with
  the same layout (e.g. a local `reticulum` checkout's `docker-compose/` folder) for developing
  against an edited bundle without a network round-trip.
- Installed actions each get their own compose fragment under `.codezero/actions/`, merged on top of
  the base stack via `docker compose -f base.yml -f actions/*.yml`.


## Releasing

Pushing a `vX.Y.Z` tag runs `.github/workflows/release.yml`: it builds the binaries for every
supported platform, attaches them (plus `checksums.txt`) to a GitHub release, then publishes the
`codezero` crate to crates.io and `@code0-tech/cli` to npm. The version comes from the tag, so
`Cargo.toml`/`package.json` never need a manual bump. Both registries use trusted publishing (OIDC
from the `packages` environment), with no static tokens.