> For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt.

# Running locally

```sh
hod local run                                  # a push to the current branch
hod local run --event pull_request --base main # changed files since HEAD left main, as the server lists them
hod local run --event tag --ref v1.2.0         # a tag
hod local run --event manual                   # a manual run, as `hod run trigger` would start on a server
hod local run --event schedule --schedule nightly # a run of the nightly schedule
hod local run --changed docs/a.md,docs/b.md    # say which files changed
hod local run --job build                      # only build and the jobs it needs
hod local run -j 2                             # at most two jobs at once (default: CPUs, up to 4)
hod local run --no-cache                       # run every step: ignore the step cache
hod local run --files out                      # copy each job's files into out/<job>/ (out/ in .gitignore)
hod local run --keep-workspaces                # keep the jobs' workspaces, to look around after
hod local run --secret NPM_TOKEN=env:NPM_TOKEN # where a granted secret comes from
hod local run --identity token=file:token.jwt  # where an identity token comes from
```

`hod plan` takes the same event flags and prints, without running anything, which jobs and steps would run and why the others wouldn't. Both also take `--event-file event.json` (a `hod.v1.Event` in proto JSON) and `--file` for a pipeline somewhere other than `.hod/pipeline.yaml`. `hod validate -o json` prints the compiled pipeline as JSON.

**What a job sees.** When the run starts, Hod copies your project once: tracked files and untracked files that aren't ignored by `.gitignore`, as they are on disk, so uncommitted changes are tested. Ignored files (`node_modules/`, `target/`) are left out. Every job starts from that copy, so editing files while a run goes on doesn't affect it. The repository's `.git` is copied too and mounted read-only, so `git describe` and `git log` work in steps.

**Docker in a job.** `docker: true` on a job gives it its own Docker daemon, in a privileged container next to the job's. Steps can `docker build`, `docker run` and `docker compose up` without touching your machine's Docker:

```yaml
version: 0
on: [push]
jobs:
  image:
    image: docker:29-cli
    docker: true
    steps:
      - run: docker build -t app .
```

**Logs** are printed as the run goes, prefixed with the job's name, and kept in `~/.cache/hod/runs/<run>/logs/<job>/`, one file per step. The last 20 runs are kept. The step cache and dependency caches are in `~/.cache/hod` too; `HOD_CACHE_DIR` moves all of it. Hod also keeps its compiled CEL checker there (`HOD_CELCHECK_CACHE` moves just that); unused copies are deleted after a week.
