Development guide
How code gets from a branch to the dev server. AGENTS.md holds the short rules; this guide holds the steps. Nightlies, stable releases, fixes and feature stages are in the release guide.
Branches#
| Branch | Purpose | Receives |
|---|---|---|
main |
The only long-lived branch and the default branch. See Branches | Every PR, by squash merge |
release-<product>-X.Y |
Fixes for an older stable line | Cherry-picked fix PRs. See Fix a stable release |
Work on a short-lived branch cut from main, open a PR into main, and delete the branch after it merges.
git fetch --prune
git switch -c fix-restart-timeout origin/mainbranch 'fix-restart-timeout' set up to track 'origin/main'.
Switched to a new branch 'fix-restart-timeout'A PR into a release-* branch fails the branch-flow job of ci unless every commit in it, other than a merge commit, is a cherry-pick (git cherry-pick -x) of a commit already in main.
Commit messages#
Every commit subject is a Conventional Commit: <type>(<scope>): <description>. A commit-msg hook in .githooks checks it. pnpm install turns it on through the prepare script, which runs git config core.hooksPath .githooks.
git commit -m "Add the nightly channel"commit-msg: "Add the nightly channel" is not a Conventional Commit: expected <type>(<scope>): <description>, with type one of feat, fix, docs, style, refactor, perf, test, build, ci, chore, revertThe hook lets merge, revert, fixup!, squash! and amend! messages through, since git writes them. Because a squash merge turns the PR title into the commit subject on main, give the PR the same format.
Checks#
The ci workflow runs on every commit pushed to a PR into main or a release-* branch, and on every push to those branches. A new commit never cancels the run of the previous one. A changes job filters pull requests so build jobs only run for areas the PR touches; pushes to main and release-* run everything.
| Job | What it proves | Run it locally |
|---|---|---|
lint |
Biome, .env.example and the env table match env-keys.ts, every relative doc link resolves, and every Mermaid diagram parses |
pnpm lint |
typecheck |
tsc passes in every package |
pnpm typecheck |
test |
Every test passes, and the run leaves the tree clean | pnpm test |
image |
The image builds, starts and /healthz reports the commit. Skipped on pushes to main, where deploy-dev builds it |
docker build -t sculk . && docker run --rm -p 8080:8080 sculk |
oauthmc |
Rust fmt, clippy, unit tests, musl release build, Minecraft client matrix, lane mc-join e2e test, and Docker healthcheck smoke run |
cargo test --manifest-path crates/oauthmc/Cargo.toml |
sculkworm |
Rust fmt, clippy, unit tests, musl release build, Minecraft client verification, and Docker smoke run | cargo test --manifest-path crates/sculkworm/Cargo.toml |
branch-flow |
A PR into a release-* branch carries only cherry-picks of commits in main (pull requests only) |
|
ci-ok |
All of the above succeeded |
ci-ok exists so that one name can be marked as required. GitHub offers branch protection and rulesets on private repositories only on a paid plan, and the YellowUmbrellaDev organisation is on Free, so nothing blocks a merge with a red check today. The rule is: merge a PR only when every check is green. When the plan changes, or the repository goes public, require ci-ok and a PR on main and release-*.
Dev server#
Every merge to main runs deploy-dev:
publishbuilds the image and pushesghcr.io/yellowumbrelladev/sculk.network:sha-<7 chars>and:dev.deployjoins the tailnet astag:ciwith Tailscale in userspace networking (the runner has no root), connects to the dev host over SSH on port 2222 and passes the new tag. Port 22 on the tailnet address is Tailscale SSH, which ignores the forced command of the key, so the host runs a secondsshdlistener for it.- The host pulls that tag and restarts the container.
deploythen pollshttps://dev.sculk.network/healthzuntilcommitequals the pushed commit, and fails after five minutes.
Deploys queue in order and never cancel each other, so the server ends on the last merge. Run the workflow again from the Actions tab (workflow_dispatch) to redeploy the dev server.
The dev server is https://dev.sculk.network on the host 0-0-0. Its stack lives in the homelab repository (hosts/0-0-0/services/sculk-qa, which is being renamed sculk-dev), with its secrets in 1Password. It runs the same image as production with SCULK_PUBLIC=1. Treat its data as disposable.
One-time setup#
These steps need an owner of the GitHub organisation and of the tailnet. Do them once.
- Tailnet policy: add
tag:citotagOwners. No access rule is needed while the default grant allows every connection; once it is restricted, allowtag:cito reach0-0-0:2222. - Tailscale admin, Settings, OAuth clients: create a client with the
auth_keysscope and the tagtag:ci. - On
0-0-0, create the deploy key and authorise it with a forced command, so the key can do nothing but deploy a tag. - In the repository settings, create the environment
dev, then add:
| Kind | Name | Value |
|---|---|---|
| Secret | TS_OAUTH_SECRET |
Secret of the OAuth client |
| Secret | DEV_SSH_KEY |
Private half of the deploy key |
| Variable | DEV_SSH_HOST |
Tailnet name of the dev host, 0-0-0 |
| Variable | DEV_SSH_USER |
User the forced command runs as |
| Variable | DEV_SSH_KNOWN_HOSTS |
Output of ssh-keyscan 0-0-0 taken from a trusted machine |
| Variable | DEV_URL |
https://dev.sculk.network |
- Sign-in redirect URIs of the Google, Discord and GitHub App registrations: add
https://dev.sculk.network/auth/<provider>/callback. The GitHub App's first callback URL is thegithubone.
Roll back dev#
Run the workflow deploy-dev from the Actions tab, choosing the older commit's ref, or on the host run the deploy command with the old tag. Both pull that exact image.
If a migration merged after that commit, the older image refuses the database, which it does not know (see Switch channels on an instance). The dev data is disposable: delete the data volume on the host and let the older image start from an empty database, or roll forward with a fix instead.
Teaser#
While the product is in development, https://sculk.network serves a one-page teaser from apps/teaser: a Cloudflare
Worker named sculk-teaser with static assets only, attached to the apex domain as a custom domain. The deploy-teaser
workflow builds and deploys it on every push to main that changes apps/teaser, packages/brand, the font license or
the lockfile, then checks that the live page matches the build. Run it from the Actions tab to redeploy.
Try a change locally with node apps/teaser/build.mjs, then open apps/teaser/dist/index.html through any static
server (the page loads its fonts and icons from /). Deploy by hand with:
CLOUDFLARE_API_TOKEN=<token> pnpm --filter @sculk/teaser run deployUploaded sculk-teaser
Deployed sculk-teaser triggers
sculk.network (custom domain)The token lives in the GitHub environment teaser as CLOUDFLARE_TEASER_TOKEN. It is an account-owned token named
sculk-teaser-deploy (GitHub Actions) with Workers Scripts Write and Read on the account and Workers Routes Write and
Zone Read on the sculk.network zone, nothing else.
The logo, the favicon and the ink colour come from packages/brand, which the web app also draws from: change the mark
there and both the app and the teaser follow.
Documentation site#
The documentation for sculk.network, OAuthMC and sculkworm is built by apps/docs/build.mjs into static HTML and
served by two Cloudflare Workers (static assets only, same pattern as apps/teaser):
| Channel | Worker | Host | Source | Deployed by |
|---|---|---|---|---|
| Nightly | sculk-docs-nightly |
https://nightly.docs.sculk.network |
main working tree |
deploy-docs on every push to main touching documented files |
| Stable | sculk-docs |
https://docs.sculk.network |
Each product's latest stable tag (vX.Y.Z, oauthmc-vX.Y.Z, sculkworm-vX.Y.Z) |
deploy-docs-stable (dispatched by release after a stable release, or run manually) |
Every page shows its channel/version badge and a link to the other channel. Internal documents listed in EXCLUDED_DOCS
in apps/docs/src/config.mjs (docs/decisiones.md, docs/design-t*.md, docs/especificacion-aileen.md and
docs/presentacion-aileen.html) are omitted. On the stable channel, any product without a stable tag yet renders a
"not released yet" page linking to the nightly channel instead of failing the build.
Preview a change locally by building the site and serving apps/docs/dist with any static server:
node apps/docs/build.mjs
npx --yes serve apps/docs/distPass --channel=stable to preview the stable channel against local git tags (node apps/docs/build.mjs --channel=stable).
Deploy by hand with:
CLOUDFLARE_API_TOKEN=<token> pnpm --filter @sculk/docs run deploy:nightly
CLOUDFLARE_API_TOKEN=<token> pnpm --filter @sculk/docs run deploy:stableThe token lives in the GitHub environment docs as CLOUDFLARE_DOCS_TOKEN. Create an account-owned Cloudflare API
token named sculk-docs-deploy (GitHub Actions) with Workers Scripts Write and Read on the account and Workers Routes
Write and Zone Read on the sculk.network zone, matching the teaser token's least-privilege permissions.
Everyday routines#
| Routine | Command |
|---|---|
| Find branches that did not land | git fetch --prune && git branch -r --no-merged origin/main |
Check a branch is already in main after a squash merge |
git cherry origin/main <branch> (- means it is) |
| Add an env variable | Edit apps/server/src/config/env-keys.ts, then node scripts/gen-env-docs.mjs |
| Add a migration | New apps/server/migrations/S<nn>-<name>.sql; never edit a merged one |
| Prove a UI or API change | pnpm lane up, then the verify-sculk skill |
| Run one package's tests | pnpm --filter @sculk/server test |
| Build or change the sync jar and the installer | clients/sync.md |