ai-code-battle/starters/typescript
jedarden fe04cd275d fix(starter-kits): complete incomplete refactoring and fix build errors
The starter kits had uncommitted changes from a refactoring that broke
the Rust and TypeScript builds. This commit completes the refactoring
and fixes the build errors.

**Rust starter fixes:**
- Add `http::header` import to fix `header::HeaderName` reference
- Replace `hmac::compare_digest` (non-existent) with constant-time comparison

**TypeScript starter fixes:**
- Rename `GameState` -> `VisibleState` and `MoveResponse` -> `TurnResponse`
- Fix `strategy.ts` to use `bot.position.row` instead of `bot.row`
- Fix Move type to use `position: {row, col}` structure

**Go starter fixes:**
- Remove unused `strings` import

All 8 starter kits now build successfully with their respective toolchains.

Closes: bf-2rwz

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 22:40:37 -04:00
..
.github/workflows feat(starter-typescript): add TypeScript/Node.js starter kit with Fastify 2026-05-08 10:30:21 -04:00
src fix(starter-kits): complete incomplete refactoring and fix build errors 2026-05-25 22:40:37 -04:00
.dockerignore feat(starter-typescript): add TypeScript/Node.js starter kit with Fastify 2026-05-08 10:30:21 -04:00
.gitignore feat(starter-typescript): add TypeScript/Node.js starter kit with Fastify 2026-05-08 10:30:21 -04:00
Dockerfile feat(starter-typescript): add TypeScript/Node.js starter kit with Fastify 2026-05-08 10:30:21 -04:00
package-lock.json fix(starter-kits): complete incomplete refactoring and fix build errors 2026-05-25 22:40:37 -04:00
package.json fix(starter-kits): complete incomplete refactoring and fix build errors 2026-05-25 22:40:37 -04:00
README.md fix(starter-kits): complete incomplete refactoring and fix build errors 2026-05-25 22:40:37 -04:00
tsconfig.json feat(starter-typescript): add TypeScript/Node.js starter kit with Fastify 2026-05-08 10:30:21 -04:00

AI Code Battle - TypeScript Starter Bot

A minimal TypeScript bot for AI Code Battle using Fastify framework with full type definitions.

Quick Start

  1. Copy this bot to your own repository
  2. Edit src/strategy.ts to implement your bot's logic
  3. Install: npm install
  4. Build: npm run build
  5. Run: SHARED_SECRET=test npm start
  6. Test: curl http://localhost:8080/health should return "OK"

Strategy Interface

Edit src/strategy.ts:

export function computeMoves(state: VisibleState): Move[] {
    return state.bots
        .filter(bot => bot.owner === state.you.id)
        .map(bot => ({
            position: bot.position,
            direction: "" // Hold position
        }));
}

Deployment

Build Docker image and push to registry, then register at https://ai-code-battle.pages.dev/#/register