CLI Commands
Doodle Engine’s command-line tools come from the @doodle-engine/cli package, which every project includes as a development dependency. You never invoke that package by name except once, to create a project. Inside a project, each tool runs as an npm script:
npm run devstarts the development servernpm run buildcreates a production buildnpm run validatechecks the game contentnpm run previewserves a finished build locallynpm run typecheckchecks the game’s TypeScriptnpm run theme -- <template>changes the default renderer’s theme
npx doodle-engine create
Section titled “npx doodle-engine create”Create a game project in the current folder:
npx doodle-engine create my-gameThis is the one command that runs outside a project. doodle-engine is a small npm package that launches the Doodle Engine CLI, so the command works with nothing installed beyond Node.js. The command asks the same questions as Studio’s New Project window, with the same option names:
- Playable example story creates a small connected game you can explore and replace piece by piece.
- Minimal project with one starting location leaves the other content sections ready for your work.
You will also choose how the project stores text: English text with a locale starter file writes English directly in the content, and English and Swedish localization example demonstrates translation keys. Either localization choice works with either starting-content choice.
The default React renderer provides a ready-to-use React interface. Choose Starter RPG, Minimal, Prose, or Fable for its initial theme.
When it finishes, follow the printed next steps:
cd my-gamenpm installnpm run devnpm run theme
Section titled “npm run theme”Change the theme of a project that uses the default React renderer:
npm run theme -- proseThe available names are starter-rpg, minimal, prose, and fable. The command replaces src/renderer-theme.css and updates the theme’s local font packages. It never replaces src/renderer-overrides.css, which is where project-specific colors, spacing, and other CSS overrides belong. Run npm install afterward when the command reports that font dependencies changed.
npm run dev
Section titled “npm run dev”Start the development server with content hot-reload.
npm run devWhat it does
Section titled “What it does”- Starts a Vite dev server on port 3000
- Loads all content from
content/directory - Parses
.yamlfiles as entities and.dlgfiles as dialogues - Serves content via the
/api/contentendpoint as JSON - Generates the asset manifest for each request and serves it at
/api/manifest - Watches
content/**/*for changes using chokidar - Validates content on every file change and prints errors to the terminal
- Triggers full page reload when content files change
- Serves the app in development mode. Generated apps pass
devTools={import.meta.env.DEV}, which exposeswindow.doodlewhile the game is running.
Content and validation
Section titled “Content and validation”The server loads the project files into the registry served by /api/content. Content Registry documents how each directory and special file is represented.
When content changes, the server runs the same checks as npm run validate. Problems appear in the terminal without stopping the server. See Content Validation for the complete set of checks and example fixes.
Browser dev tools
Section titled “Browser dev tools”Generated applications expose window.doodle while the development build is running and omit it from production builds. Debugging with Dev Tools lists the commands and shows how to prepare test state in the browser console.
npm run build
Section titled “npm run build”Build the game for production.
npm run buildWhat it does
Section titled “What it does”- Validates all content first and fails if errors are found
- Generates the asset manifest and fails if referenced local assets under
assets/are missing - Runs a Vite production build with relative URLs, so the output works at a domain root or hosted under a folder
- Outputs to
dist/directory - Copies project assets to
dist/assets/ - Builds with Vite production settings. Generated applications omit
window.doodlefrom production builds. - Writes
dist/asset-manifest.jsonlisting all game assets with types, sizes, and tiers - Generates
dist/sw.js, a service worker that caches the app, the content, and the assets, so the game keeps working offline after the first visit - Writes manifest to
dist/api/manifestsonpm run previewcan serve it
Validation errors stop the build and return exit code 1. The terminal displays each error to fix before building again.
npm run preview
Section titled “npm run preview”Serve the finished build from dist/ locally, so you can check it before uploading:
npm run previewRun it after npm run build.
npm run validate
Section titled “npm run validate”Validate all game content without building or running the dev server.
npm run validateWhat it validates
Section titled “What it validates”The command checks file syntax and required fields, IDs, dialogue routes, conditions and effects, references between content, maps, and localization keys. Content Validation is the authoritative list of checks and explains where asset-file checks differ.
Exit codes
Section titled “Exit codes”- 0: No validation errors found
- 1: Validation errors found
Example output
Section titled “Example output”🐾 Validating Doodle Engine content...
✓ No validation errorsOr with errors:
🐾 Validating Doodle Engine content...
✗ Found 3 validation errors:
content/dialogues/bartender_greeting.dlg Node "greet" GOTO "continue" points to non-existent node Add NODE continue or fix the GOTO target
content/dialogues/bartender_greeting.dlg Node "ask_rumors" condition "hasFlag" missing required "flag" argument
content/characters/merchant.yaml Character "merchant" references non-existent dialogue "merchant_chat" Create dialogue "merchant_chat" or fix the referenceWhen to use
Section titled “When to use”- Before committing: Validate content changes before pushing to version control
- Continuous integration (CI): Add
npm run validateto an automated check for pushed changes - Manual testing: Run validation without starting the full dev server