← Public packages
@kentcdodds/starsnake
Starsnake: steer a snake-like ship Asteroids style, grow a crystal tail, and spend crystals on towers to defend your core. Mobile friendly.
Files
@kentcdodds/starsnake: agent notes
Human overview: README.md.
Layout
kody.app.entryis./app/router.ts. Routes:/game page,/manifest.webmanifest,/health, and/a/*images (embedded bytes). Everything else is 404. Only GET and HEAD are allowed.client/game.jsis the whole game (plain browser JS, one canvas, DOM HUD and screens).scripts/build.mjsinlines it intoapp/client.ts.app/page.tshas the HTML shell, CSS, head tags (og and twitter meta with absolute URLs) and the manifest.app/router.tsbuilds the public origin fromX-Forwarded-HostorHost(fallbackhttps://starsnake.kentcdodds.com).- Generated, committed files:
app/client.ts,app/assets.ts,app/build-info.ts. Runnpm run buildbefore every commit.kody.dev.prebuilddoes not run at publish. - Art:
npm run artredraws icons (scripts/icons.mjs, headless Chrome), quantizes PNGs (scripts/shrink-icons.py), and buildspublic/og.jpgfrom real gameplay screenshots (scripts/og.mjs, useswindow.__starsnake.scene()). Needsplaywright-coreandCHROME_PATH(default/usr/bin/google-chrome)..kody/icon.pngis the Kody package icon.
Test
npm testbuilds, then runsscripts/smoke.mjsagainstdist/index.html(runnpm run dumpfirst ifdist/is missing). It drives real touch input through CDP at 390x844, a landscape size and 1280x800, and fails on console errors. SetSHOTS=<dir>for screenshots, orURL=<page>to test a served copy.- Test hooks:
window.__starsnakeexposessnap,state,give(n),setTail(n),scene()(staged scene for art),freeze().?seed=Nmakes spawns repeatable,?autostartskips the title. - Serve locally with
kody dev(mock target) andkody dev fetch /.
Tail combat
- Beads damage rocks.
TAIL_DMGis 2, +1 when ship speed is aboveTAIL_WHIP_SPEED. A bead can hit once perTAIL_BEAD_CDand a rock can be hit by the tail once perTAIL_ROCK_CD, so the tail cannot grind. Hit rocks get a 150 unit knockback. Children of a split rock ignore the tail for 0.3 s. - Boss rocks take 1 damage per tail touch and knock that bead off (tail shrinks by one). A rock that hits the ship head still costs 2 beads.
- Kills by the tail increment
tailKills(shown on game over, exposed insnap).window.__starsnake.tailTest(size)parks a rock on a bead for tests.
Rules
- Keep the capability set empty: no secrets, storage, outbound fetches, jobs, or
kody:imports other thankody:runtime. The app is internet-visible and has no login, so every route must be safe for anonymous callers. - No em dashes in copy. Keep HUD text fixed-width so nothing shifts.
- Tuning constants sit at the top of
client/game.js(TOWER,GUN_COSTS,ROCK,MAX_TAIL,GEMS_PER_SEG,SHORT_SIDE). - Visibility: public and internet-visible, custom hostname
starsnake.kentcdodds.com(set up withkody:@kentcdodds/cloudflare/custom-domain). Do not touch otherkentcdodds.comDNS records. - Publish with the Kody CLI:
kody package publish @kentcdodds/starsnake.