Skip to content

Salvo - GitHub Copilot SDK experiment with games

Notifications You must be signed in to change notification settings

falrefaei-debug/cli-battle

 
 

Repository files navigation

SALVO - A Battleship Experiment in Reasoning

SALVO is a Phaser + Next.js Battleship experience that pits you against Copilot via the Copilot CLI.

Main screen

Requirements

  • Node.js 18+ (tested with 23)
  • Copilot CLI installed locally and available in PATH (required for AI mode)

Usage

npm install
npm run dev

Open http://localhost:3000.

Gameplay

  • Place ships by clicking your board.
  • Press R to rotate orientation.
  • Click the enemy board to fire.
  • The battle log records every move and Copilot response.

Architecture

  • app/components/GameClient.tsx: UI shell, log, and Copilot calls.
  • lib/scene.ts: Phaser scene, rendering, placement, and battle logic.
  • app/api/ai/route.ts: Copilot CLI bridge (shot selection + endgame message).
  • app/api/models/route.ts: runtime list of Copilot models available to the user.
  • lib/aiPrompts.ts: system prompts for move selection and endgame messages.
  • lib/aiParsers.ts: parsing helpers for Copilot responses.

Copilot mode

This mode uses the GitHub Copilot SDK, which talks to the Copilot CLI in the background. The model selector is populated by querying the CLI at runtime (/api/models).

Configure the CLI and model before starting the server:

export COPILOT_MODEL=gpt-4.1

You can also switch the model from the UI (top selector).

Prompt and response logs are printed to the browser/server console by default. To disable:

export COPILOT_DEBUG=0

Desktop packaging (Windows/macOS) - Electron

SALVO is intended to run with the Copilot CLI available on the local machine. The Electron wrapper starts the local Next.js server automatically in production builds.

Development (two terminals):

npm run dev
npm run electron:dev

If the dev server uses a non-3000 port, set ELECTRON_DEV_URL:

ELECTRON_DEV_URL=http://localhost:3001 npm run electron:dev

Production build:

npm run electron:build

Packaged apps are emitted to dist/. Ensure Copilot CLI is installed and authenticated on the target machine.

If you update public/favicon.svg, regenerate the desktop icon:

npm run generate:icons

Splash screen (Remotion)

The splash animation is authored in Remotion and rendered to public/splash.mp4, which the Electron splash window plays on launch.

Preview the composition:

npm run remotion:preview

Render the splash video:

npm run remotion:render:splash

If public/splash.mp4 is missing, the splash window falls back to a static title screen.

GitHub Actions release

Tag a release to trigger cross-platform builds:

git tag v0.0.13
git push origin v0.0.13

Artifacts are uploaded to the GitHub Release from dist/ for macOS and Windows.

Tests

npm test

Notes

  • AI mode requires GitHub Copilot SDK + Copilot CLI; if the CLI is unavailable the UI blocks with setup instructions.
  • With COPILOT_DEBUG=0, prompt and response logs are hidden in the browser/server console.
  • Static export/GitHub Pages builds are not supported.
  • Nothing is installed outside this folder.

About

Salvo - GitHub Copilot SDK experiment with games

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 75.8%
  • JavaScript 12.3%
  • CSS 8.6%
  • HTML 3.3%