You're reading the 2.x docs. quantum-forge 3.0 is out: this page in 3.x / migration guide

Skip to content

CLI tools ​

The CLI ships in the engine package (quantum-forge-engine) and covers scaffolding, adding systems, validating architecture, and diagnosing the environment.

Every command below goes through quantum-forge-engine. From core 2.7.0 the core package also carries a quantum-forge command that hands every argument to the engine CLI, so npx quantum-forge <command> is a synonym. On older core releases that spelling fails with "could not determine executable to run", because the core package had no executable.

init ​

Scaffold a new game project:

bash
npx quantum-forge-engine init my-game                         # prompts for the rest
npx quantum-forge-engine init my-game --template starter      # starter template
npx quantum-forge-engine init my-game --template quantum-pong # full example
npx quantum-forge-engine init my-game --edition qubit         # qubit edition (20 qubits)
npx quantum-forge-engine init my-game --platforms web,desktop # add an Electron target
npx quantum-forge-engine init                                 # prompts for everything

The init keyword is optional, so npx quantum-forge-engine my-game also works. Spell it out anyway. The same bin serves the other subcommands, and an explicit init keeps the intent unambiguous.

Flags ​

FlagValuesDefault
--templatestarter, quantum-pongstarter
--editionqutrit, qubitqutrit
--platformscomma-separated web, desktop, ios, androidweb
--claude-skillinstall the /quantum-forge skill for Claude Codeprompts
--no-claude-skillskip the skillprompts
--no-installwrite the project without running npm install; the Claude skill needs node_modules, so it is skipped tooinstalls

web is always included, so --platforms desktop produces a web plus desktop project. Desktop targets go through Electron, iOS and Android through Capacitor.

Anything you leave off becomes a prompt: project name, template, platforms, edition, and the Claude Code skill.

Non-interactive ​

Pass every flag and nothing prompts, which is what CI and AI agents need:

bash
npx -y quantum-forge-engine init my-game \
  --template starter --platforms web --edition qutrit --no-claude-skill

Editions ​

The edition determines the WASM build variant bundled with your project:

EditionDimensionsMax QuditsTrade-off
Qutrit (default)2–312Supports qutrits (3-state properties) but fewer total qudits
Qubit2 only20More quantum objects, but locked to binary states

The Qubit edition generates code that calls useQuantumForgeBuild("qubit") before ensureLoaded() to load the qubit-optimized variant. The Qutrit edition uses the default build and needs no extra configuration. See Quantum Setup: Editions for runtime details.

Templates ​

Starter (default): a minimal game with a movable player circle. You get package.json, tsconfig.json, vite.config.ts (dev server on port 3000, WASM plugin, vitest config), index.html, and a src/ tree split into pure logic, an Engine subclass, a PixiJS renderer, a controller in main.ts, and a vitest file. From quantum-forge-engine 1.3.0 the scaffold also writes CLAUDE.md and AGENTS.md so coding agents pick up the project conventions.

Quantum Pong: a complete working game with quantum mechanics, audio, an AI opponent, and 75 tests. Adds a QuantumRegistry, pure pong logic, and bundled audio assets on top of the same skeleton.

What it does ​

  1. Validates the project name
  2. Prompts for anything not passed as a flag
  3. Creates the project directory and generates the files
  4. Runs npm install
  5. Installs the Claude Code skill, if you asked for it
  6. Initializes a git repository with an initial commit

add-system ​

Requires quantum-forge-engine 1.3.0 or later

add-system, validate, and doctor became subcommands of the engine bin in 1.3.0. On earlier versions they were monorepo-only scripts and cannot be run from a scaffolded project at all. Scaffolded projects have no npm run add-system script, so use the npx form.

Add optional packages to an existing game:

bash
npx quantum-forge-engine add-system

Interactive selection from ten systems:

SystemDescription
Entity ManagerEntity tracking with spatial queries, tagging, lifecycle
Input ManagerKeyboard, mouse, touch, gamepad with action mapping
Collision DetectionAABB, circle, point collision with spatial grid optimization
Audio ManagerWeb Audio API wrapper for sounds and music
Particle SystemVisual effects with burst, trail, and continuous modes
Animation SystemTweening with easing functions, multi-value animation
State MachineGeneric FSM for AI behavior, game phases, menu flows
Timer ManagerGame-aware timers with time scaling and pause/resume
Save ManagerSave/load state with versioning, migration, and auto-save
Scene ManagerStack-based scene lifecycle with transitions

Writes src/systems-integration.ts with the imports and usage examples for whatever you picked.

validate ​

Check that a game follows the framework's architectural patterns:

bash
npx quantum-forge-engine validate [path]

Checks ​

  1. Project structure: required files present (main.ts, index.html, engine/)
  2. Engine pattern: engine extends the base Engine class
  3. Pure functions: no timing or animation code in the engine
  4. Console usage: uses the logger instead of console.*
  5. Quantum integration: Quantum Forge initialized properly
  6. TypeScript config: path aliases configured

Score ​

  • 100%: perfect architecture
  • 70-99%: good, minor issues
  • < 70%: needs refactoring

Use in CI:

bash
npx quantum-forge-engine validate || exit 1

doctor ​

Diagnose environment issues:

bash
npx quantum-forge-engine doctor

Checks Node.js, npm, git, and TypeScript versions, whether the Quantum Forge packages and their dependencies are installed, whether the WASM artifacts and built libraries are present, and whether port 3000 is free.

Common workflows ​

Start a new game:

bash
npx quantum-forge-engine init my-game
cd my-game
npm run dev

Add features as you go:

bash
npx quantum-forge-engine add-system   # audio, particles, and the rest
npx quantum-forge-engine validate     # check architecture

Diagnose problems:

bash
npx quantum-forge-engine doctor

Powered by Quantum Forge