# Git source bindings

A binding connects one package to a repository, subpath, and tracked branch.
Several packages can use different subpaths in the same repository.

```sh
threetopia source bind . \
  --repository https://github.com/OWNER/REPO \
  --branch main --subpath regions/coast
threetopia sources --json
threetopia source reconcile
```

The server records the stable GitHub repository ID. It resolves branch updates
to exact commit SHAs before reading any file. A build reads `threetopia.json` and
its declared files from that commit. Bump the package version for each update.

A signed push webhook queues a source event. Scheduled reconciliation checks each
tracked branch at most once per 15 minutes and recovers missed deliveries. Duplicate commit events are safe.
A source build creates a private package version. A valid region creates a world
candidate. A push never directly changes the live world.

## Service setup

Point the GitHub App's push webhook at
`https://creators.threetopia.com/api/sources/github`.
Set `GITHUB_WEBHOOK_SECRET` to the matching signing secret. `GITHUB_TOKEN` is
recommended for larger source packages and GitHub API quotas. Transient API failures retry after one hour, up to three attempts. Keep both values out of Git.
Set `WORLD_REVIEWERS` to the creator handles that can review canonical changes.

Public repositories are supported. Private repositories fail until an
installation-to-creator permission binding is configured in the product.
A reachable URL alone does not prove permission to read private source.

Review source build failures in **Creators → World review**. Fix deterministic
source or contract errors, bump the version, and push a new commit.
