# @xstate/cli
These XState v4 docs are no longer maintained
XState v5 is out now! Read more about XState v5 (opens new window) and check out the XState v5 docs (opens new window).
The @xstate/cli package (opens new window) contains commands for running typegen. It's pretty small right now, but we're planning on adding many cool features.
# Installation
- Run
npm install @xstate/cli
# Commands
# xstate typegen <files>
xstate typegen "src/**/*.ts?(x)"
Run the typegen against a glob. This will scan every file targeted, and generate a typegen file accompanying it. It will also import the typegen into your file, as described in our typegen documentation (opens new window).
Ensure you wrap your glob in quotes so that it executes correctly. If it isn't wrapped in quotes, it will be interpreted as a list of files, not a glob. This will give unexpected results.
# Options
xstate typegen "src/**/*.ts?(x)" --watch
Runs the task on a watch, monitoring for changed files and running the typegen script against them.