← Public packages
@kentcdodds/asteroids
Classic canvas Asteroids game with vector graphics, touch controls, and a saved high score.
AGENTS.md
16 lines · 2.3 KB · Markdown@kentcdodds/asteroids — agent notes
Human overview: README.md.
- Package app;
kody.app.entryis./app/router.ts. Routes:/game,/about,/manifest.webmanifest,/sw.js,/version.json,/health, and/a/*images. No secrets, storage, outbound requests, orkody:deps (keep it that way so the capability set stays empty). - Files:
app/game.ts(game + audio),app/about.ts,app/pwa.ts(manifest, service worker, client PWA glue),app/ui.ts(shared look + head/og tags), generatedapp/build-info.tsandapp/assets.ts. - Always run
npm run buildbefore committing.scripts/build-info.mjshashesapp/+public/intoBUILD.buildId(the service-worker cache version and update signal) and embedspublic/images intoapp/assets.ts. Forgetting it ships stale images and no update prompt. - Art:
npm run artre-renderspublic/og.jpg,public/icons/*, and.kody/icon.pngfrom SVG inscripts/render-art.mjswith headless Chrome (needsplaywright-core; setCHROME_PATH), then palette-quantizes the PNGs. - og:image URLs are absolute, built from the request's
X-Forwarded-Host/Host(fallbackhttps://asteroids.kentcdodds.com). - Service worker: cache
asteroids-<buildId>, pages cache-first from that build, manifest network-first. A new worker waits; the page shows UPDATE AVAILABLE and sendsSKIP_WAITINGon tap. First install claims immediately. - All game code lives in
app/game.ts(gameScriptinlined intohtml). No layout-shifting text: HUD uses fixed-width spans and the overlay togglesvisibility. - Public and internet-visible (served at https://asteroids.kentcdodds.com). The only routes are the game page and
/health; keep it that way, with no storage, secrets, or outbound requests. - Audio is synthesized in
gameScriptwith Web Audio (no assets). The AudioContext is created on the first pointer/key gesture.window.__asteroids.audioexposes{ ctx, soundOn, musicOn, step }for tests. - Test:
npm testbuildsdist/index.htmland runs a headless Chromium smoke test (scripts/smoke.mjs) that checks for console/page errors, starts a game, fires and thrusts. It needsplaywrightresolvable. - Icon:
.kody/icon.png(512px, ship + asteroid), source.kody/icon.svg(generated bynpm run art). - Publish with the local CLI only:
npx @kodycodes/cli package publish @kentcdodds/asteroids.