No description
  • TypeScript 65.8%
  • JavaScript 26.7%
  • CSS 6.2%
  • Python 1%
  • HCL 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nelson 9f190fbf1f
All checks were successful
Suite tofu / scope (push) Successful in 51s
Suite cluster-service / scope (push) Successful in 51s
Suite cluster-service / check-manifests (push) Has been skipped
Suite cluster-service / check-image (push) Has been skipped
Suite cluster-service / publish (push) Has been skipped
Suite web-app / scope (push) Successful in 53s
Suite cluster-service / reused-checks (push) Has been skipped
Suite web-app / publish (push) Has been skipped
Suite web-app / reused-checks (push) Has been skipped
Suite web-app / check-test (frontend) (push) Has been skipped
Suite tofu / check-plan (push) Has been skipped
Suite tofu / apply (push) Has been skipped
Suite tofu / reused-checks (push) Has been skipped
Suite web-app / check-image (push) Has been skipped
Suite web-app / publish-static (push) Has been skipped
Suite web-app / check-test (backend) (push) Has been skipped
Pin romainecr.azurecr.io/chess-tactics v0.1.546 (#1024)
2026-11-30 18:05:05 -08:00
.claude Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
.codex/environments Remove named-environment session hook (#530) 2026-07-29 13:07:10 -07:00
.forgejo/workflows Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
backend Take newer packages (#1023) 2026-11-30 17:01:31 -08:00
bin Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
docs Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
frontend Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
k8s Pin romainecr.azurecr.io/chess-tactics v0.1.546 (#1024) 2026-11-30 18:05:05 -08:00
packages/board-render The Event Log marks defeat, the clock, and gold (#939) 2026-08-12 12:30:42 -07:00
scripts CI from the suites; Argo CD deploys main through pin PRs; the image tests itself (#1000) 2026-11-16 20:10:28 -08:00
tofu Music metadata sync runs as an hourly CronJob under its own workload identity (#1017) 2026-11-30 14:08:25 -08:00
tools Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
.dockerignore Move runtime assets behind the live backend (#479) 2026-07-12 15:38:46 -07:00
.gitattributes Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
.gitignore CI from the suites; Argo CD deploys main through pin PRs; the image tests itself (#1000) 2026-11-16 20:10:28 -08:00
.nvmrc The repo's Node major is in .nvmrc, not pipeline-templates' fleet.json (PIPT-33) (#1003) 2026-11-17 23:51:47 -08:00
AGENTS.md One CI workflow in the home web-app shape (#994) 2026-11-13 14:16:07 -08:00
CLAUDE.md Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
Dockerfile Write the backend's logs as the estate's log line (AHT-204) (#1011) 2026-11-26 14:29:35 -08:00
newrocks-code.txt Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00
README.md Fix markdown, newline and ShellCheck findings for the shared CI's lints (#1020) 2026-11-30 14:56:05 -08:00

Chess Tactics

Chess-based squad combat prototype.

The sample is a small tactical browser game served by Node/Express. Three hybrid chess units defend anchors against enemy telegraphs across six breaches.

Local Dev

Use Vite for local development. It dynamically acquires a frontend port and spawns the backend on its own free port, then proxies /api through Vite. Open the local URL printed by Vite.

cd frontend
npm install
npm run dev

Windows Codex desktop environments are named on the auth.romaine.life approval page opened during worktree setup. The approved name returns beside the development token, then setup starts Vite through devctl and registers the dynamic port with the workstation's loopback Caddy router, producing a stable URL such as:

http://loading-feature.chess-tactics.localhost

The ignored .codex-session/environment.json is the non-secret source of truth for that environment identity. The auth grant, agent URL discovery, browser verification, screenshots, and user handoff all use the same name without a project lifecycle hook. See ADR-0199. The responsibilities are deliberately separate: Caddy only routes, devctl persists and recovers the top-level Vite launch, and Vite alone owns backend child recovery. See ADR-0308.

For baked preview:

cd frontend
npm install
npm run build

cd backend
npm install
npm start

Open http://localhost:3000.

The browser app is built by Vite. Express serves frontend/dist as the baked frontend; source files live under frontend/src. Runtime media resolves through backend-owned semantic /assets/<slot> routes backed by Postgres and private object storage. frontend/public is limited to non-media code and legal text.

Local Backend

Level Editor documents use a stable /editor/level?document=<opaque-id>&levelId=<id> URL. The opaque document id is global; the level id remains account-local. For authenticated editors, changes autosave to a durable server-side working copy; Save promotes that working copy to the canonical level, while Discard changes replaces it with the canonical saved level. Copying the browser URL is side-effect free: it does not save, publish, grant access, or create another document. Gameplay and thumbnails read only canonical saved levels. Browser storage is a crash/offline fallback, not the cloud persistence model.

Fresh worktrees do not have backend/node_modules; that is expected every time. npm run dev installs/refreshes backend dependencies before Vite starts the backend child process.

The server uses auth.romaine.life as an OIDC provider for Microsoft sign-in. Authorization code + PKCE runs through the backend, which keeps access and refresh tokens in host-only HttpOnly cookies. Optional env:

  • AUTH_BASE_URL defaults to https://auth.romaine.life.
  • OIDC_CLIENT_ID defaults to chess-tactics.
  • PUBLIC_ORIGIN defaults to https://chess-tactics.com and pins callback URLs.
  • FRONTEND_DIR defaults to the built frontend/dist directory.
  • STATIC_FRONTEND_DIR defaults to /var/run/chess-tactics-static-override.
  • HOT_BACKEND_DIR defaults to /var/run/chess-tactics-hot.
  • LIVE_MEDIA_CONTAINER_URL selects the private production object store.
  • LIVE_MEDIA_STORAGE_DIR selects isolated local/test object storage; it is mutually exclusive with the container URL and requires a disposable database.
  • SCHEMA_MIGRATIONS controls DB schema readiness: check (default, read-only), auto (apply missing migrations), or off (skip readiness checks).

The container starts backend/supervisor.js as PID 1. The supervisor prepares the runtime server entrypoint, runs it with NODE_PATH pointed at the baked dependencies, and reloads the child process when PID 1 receives SIGHUP.

Test-slot validation should deploy the CI-built image for the pushed ref with Glimmung deploy_image_to_test_slot, so backend code, frontend assets, and runtime wiring are exercised from the same image that PR CI proved.

Persistence

Durable game/design data and live asset metadata live in Azure Database for PostgreSQL, reached passwordlessly through Entra workload identity. Runtime, review, candidate, and source-media bytes are content-addressed in private Blob Storage; the backend resolves their database-owned semantic slots. No runtime media is shipped from frontend/public. The database and storage are self-provisioned by this repo's tofu/. Local backend startup defaults to read-only schema checks. Run cd backend && npm run schema:migrate when you intentionally want to apply missing migrations; the dedicated command verifies the resulting schema and exits instead of starting an application server. It prints the sanitized target mode, host, database, and user before any DDL; it never prints the password. See docs/persistence.md and docs/runtime-asset-contract.md for the schema, auth model, backups, failure behavior, and the one post-tofu apply value to pin.

New board-unit geometry has one supported entry point: python scripts/generate-unit-art.py, which renders the calibrated Blender turntable at eight exact facings. Resizing already accepted art uses Unit Art's Recapture editor instead: it deterministically reduces the approved 6-palette x 8-direction set to the chosen delivery raster and creates a review-only storage-backed candidate with explicit source and resampling provenance. See docs/art/unit-concepts/README.md.

Checks

cd backend
npm test

The backend smoke-test exercises the Postgres-backed endpoints, so it needs a Postgres. It uses DATABASE_URL if set, otherwise self-provisions a throwaway local Postgres from system binaries (as on the GitHub-hosted CI runners). Hosts without Postgres binaries should set DATABASE_URL. The smoke-test explicitly runs with SCHEMA_MIGRATIONS=auto because its database is throwaway/reset. Backend npm test builds the production shell exercised by its HTTP smoke test and the DOM-free trainer bundle required by its solver smoke test, but does not own frontend validation. The frontend gate runs without a database:

cd frontend
npm run check   # node checks + vitest + tsc

CI comes from pipeline-templates' suites (its fleet.json entry, ADR-0645): on a pull request the web-app suite runs each package's npm run lint and npm test (the backend against a PostgreSQL service it starts) and builds the image and runs its --self-test, each only when its inputs changed; a pull request that changes only Markdown runs only the Markdown guards (.forgejo/workflows/checks.yaml).

Deploy

Forgejo owns CI and releases through pipeline-templates' suites (PIPT-12, ADR-0645). Azure retains the existing app registration through Forgejo OIDC; this application has no publish script or local publishing command.

The app is deployed from k8s/ on main by ArgoCD. Pull requests build and self-test the image but publish nothing. A merge that changes the application releases the next v0.1.N: the web-app suite pushes the image to ACR and opens a pin PR on main writing its tag and digest and the build provenance (the release commit and the PR it merged) into k8s/values.yaml, which merge-queue lands. No second release gesture is required after merge.