Skip to main content
Use the CLI when you want a generated project instead of setting up the dependency wiring by hand.

Current availability

The CLI source lives in this repository under packages/create-roll-codes. Build it locally before using it.
cd packages/create-roll-codes
npm ci
npm run build

Primary command

node /path/to/roll.codes/packages/create-roll-codes/dist/index.js contract <name>

Example

node /path/to/roll.codes/packages/create-roll-codes/dist/index.js contract my-game --yes --skip-install
cd my-game
forge install roll.codes=jarrodwatts/roll.codes@main --no-git
forge install forge-std=foundry-rs/forge-std --no-git
forge build --zksync
forge test --zksync -vvv

Useful flags

FlagPurpose
--yesRun non-interactively for scripts or agents.
--dir <path>Write the generated project to a custom directory.
--git-ref <ref>Pin the roll.codes dependency to a specific ref.
--skip-installGenerate files without running forge install.
--forceAllow generation in a non-empty directory.

Generated starter files

  • src/DiceDuelConsumer.sol
  • test/DiceDuelConsumer.t.sol
  • script/DeployDiceDuelConsumer.s.sol
  • foundry.toml
  • remappings.txt
The generated starter uses the public IVRFSystem surface:
  • requestRandomNumberWithTraceId(uint256)
  • requestFee()
  • randomNumberCallback(uint256,uint256)

When to use the CLI

Choose the CLI when you want:
  • the fastest path to a working sample
  • a known-good test and deploy scaffold
  • a reproducible non-interactive setup flow
If you already have an existing Foundry project, use Install and setup instead.

Quickstart

Follow the end-to-end starter flow after scaffolding.

Install and setup

Wire an existing project manually if you do not want a generated starter.

Troubleshooting

Debug install failures, remapping issues, and callback problems.
Last modified on March 9, 2026