@flayerlabs/gamemode-cli
v0.9.1
Published
Create and validate Flaunch Game Modes
Downloads
953
Readme
@flayerlabs/gamemode-cli
Create a playable Flaunch Game Mode, check that its rules use deterministic inputs and bundle the rules for upload.
Requirements
You need Node.js 20 or later and pnpm.
Create a game
Run:
pnpm dlx @flayerlabs/gamemode-cli new my-game
cd my-game
pnpm install
pnpm devThe command creates a working number game. It includes:
- server-authoritative rules in
src/game/rules.ts - the round's config and length in
src/game/config.ts - a browser game that uses the offline room
- rule tests and a deterministic rules check
- an
AGENTS.mdfile with the rules an agent must follow - a
$build-game-moderepository skill for supported agents
The offline room runs the real rules without a gate, chain or wallet. The scaffold does not create a gate: Flaunch runs one per chain, and you upload the built game.
Check an existing rules file
Install the CLI in the game project, then run the check:
pnpm add --save-dev @flayerlabs/gamemode-cli
pnpm exec gamemode check src/game/rules.tsThe check rejects known uses of clocks, random values, network access and system access. It also
rejects top-level let and var declarations. Run the project's tests and type check as well.
Bundle the rules for upload
The generated build script is vite build && gamemode bundle. Run the bundle on its own with:
pnpm exec gamemode bundleIt writes two files to dist/, beside index.html:
gamemode.rules.js: the rules module fromsrc/game/rules.tsas a classic script that assigns itsGameModuletoglobalThis.gamemodeRules, at most 2 MiBgamemode.json: the manifest, withtier: "rules", the ceiling fromrewardBounds(config), androundDurationMsandconfigfromsrc/game/config.ts
It refuses rules that fail the check below, in the entry and in every local file it imports, and a
config that is not a plain object. Zip the contents of dist/ and upload the ZIP at
https://flaunch.gg/game-mode/dashboard.
Build a secure game
Use the repository guidance to continue:
- build a Game Mode
- read the generated-game agent rules
- compare the quiz and arrow examples
- review the Game Mode SDK repository
See what changed
This package ships CHANGELOG.md and MIGRATING.md, shared by all four Game Mode packages. Read
them on GitHub: changelog and
migration guide.
