Skip to content
Browse documentation

Add tools to an existing game

Add modules without losing custom code, handle conflicts, and validate changes before publishing an update.

View Markdown
On this page

1. Save a working baseline

Commit your working game or make a separate backup before changing modules. Record what currently passes: lint, build, installed tests, and a short playthrough. Keep game.config.json, .spawn/state.json, and your lockfile; they describe the generated project and its dependency state.

Inspect and verify the current project
git status --short
pnpm lint
pnpm build

If the folder is not a Git repository, use your backup workflow instead of the Git command. Do not delete edited files to make an addition succeed.

2. Preview a module addition

Inspect available modules and proposed changes
pnpm dlx @spawnkit/cli addons --json
pnpm dlx @spawnkit/cli add vitest --dry-run

The ownership record lets SpawnKit compare the original generated file, the new generated file, and your current file. Compatible JSON fields can be merged; conflicting edits stop the operation. The CLI does not switch renderers through pnpm dlx @spawnkit/cli add.

3. Apply and inspect

Add tests, then install their dependencies
pnpm dlx @spawnkit/cli add vitest
pnpm install
git diff --stat
git diff

Review and accept the CLI confirmation before installation. In automation, pass --yes only after reviewing a resolved dry run. Review source and configuration changes, not just the file count. Keep your game-specific logic, listing, and user-written AGENTS.md instructions. Commit the updated lockfile with the addition. --yes accepts a resolved plan; it cannot force an overwrite of conflicting edits.

Handle conflicts

ProblemSafe next step
Edited file conflicts with the new moduleRead the proposed changes, compare against a separate generated project, and merge intentionally.
Incompatible selected add-onsInspect pnpm dlx @spawnkit/cli addons and the dry run. Use --replace <names> only when you intend to replace those components.
Missing or unsupported ownership recordRun the command from your generated project root. Do not fabricate or edit .spawn/state.json.
Different renderer desiredCreate a new project and port game logic and assets deliberately.
Create a comparison project in a new directory
pnpm dlx @spawnkit/cli init comparison-game --add phaser,vitest --dry-run
pnpm dlx @spawnkit/cli init comparison-game --add phaser,vitest

Choose your actual renderer and modules; the example uses Phaser. The destination must not already exist. A comparison project is a reference, not a replacement for the original.

4. Verify and release

After adding the Vitest module
pnpm lint
pnpm test
pnpm build
pnpm preview

Play through existing behavior and the feature you changed. If the checks pass, review the diff and save the new baseline. Follow Publishing an update to target the same hosted project.

If the addition fails verification, preserve any new work before restoring your known-good baseline. Reinstall from the restored lockfile and repeat the checks. Hosted rollback is a separate operation; it restores retained release artifacts and does not undo database migrations.

Need a hand? Get support

Explore the guides

Build your first game

Download a standalone game kit, run it locally, and make your first change.

Create and build a game with @spawnkit/cli

Start in a parent folder, generate your game, then run every development command inside the new game folder.

Upload an existing browser game

Upload a self-contained browser build. Your original source, engine, and build tools can stay as they are.

Publish your game

The dashboard accepts a ZIP of your built game. You will need an account to deploy it.

Use the SpawnKit dashboard

The dashboard manages your hosted games. Your editor or AI agent remains where you change and build your game source.

Make a browser game with Codex

Use Codex with a standalone TypeScript game kit. Start with a working scene and improve it one playable change at a time.

Make a browser game with Claude Code

Use Claude Code with a standalone TypeScript game kit. Start with a working scene and improve it one playable change at a time.

Make a browser game with Cursor

Use Cursor with a standalone TypeScript game kit. Start with a working scene and improve it one playable change at a time.

Extend your game

Find the right files, make a focused change, and check it in a playable build.

A complete publishing example

Follow a small example from editable source to a ZIP with index.html at its root. Use your own game title, description, and artwork.

Add tools to an existing game

Keep a recoverable baseline, inspect the proposed changes, and verify one addition at a time.

Test and debug your game

Combine automated checks with a short playthrough of the production build. A successful build alone does not verify gameplay.

Project structure and configuration

Your downloaded kit is a standalone TypeScript project. Its files belong to you and do not depend on the SpawnKit repository.

SpawnKit CLI reference

A command-by-command reference to the implemented CLI. Local generation works without an account; hosted operations require access to a project.

Accounts and access

Building locally is account-free. Publishing requires an account with access to the target project.

Agents and API resources

Public discovery endpoints are account-free. Use the dashboard or @spawnkit/cli for publishing.

16 guides available