CLI
Every Dex command and its options.
Run npx dex <command> in your project, at or below dex.config.ts. --help lists the commands, and --version prints the version.
Set up and maintain
| Command | Does |
|---|---|
npm create dex@latest [folder] |
Sets up Dex. See below. init is the same command, kept for older scripts. |
agents add <agent> |
Registers the MCP server for claude, codex, cursor, copilot or opencode. |
components [--json] [--components <folder>] |
Lists the design system’s components and their imports. With --components, scans that folder and prints the designSystem.components value for it. |
doctor |
Checks the setup, and exits with an error when something is wrong. |
upgrade [--dry-run] |
Moves a studio set up by an older version to the current layout. See Upgrading. |
create options
In an empty folder, create starts a new project from a starter. In an existing project, it adds a studio in studio/. In a monorepo, it gives the studio its own app (apps/studio) or puts it in the app that has the components.
It shows what it found and the files it will write, and asks before it writes. Run it again in a set-up project, and it plans only what differs from what this version writes. It never touches DESIGN.md, provider.tsx or your files.
| Flag | Sets |
|---|---|
--template vite|standalone|turborepo |
The starter, in an empty folder. Default: vite. |
--components <folder>|none |
The components folder, which skips the search. |
--import <specifier> |
How views import the components. |
--shadcn |
Sets up shadcn when no components are found. |
--preset <code>, --base base|radix|aria |
How shadcn init sets it up: a preset’s name or the code ui.shadcn.com/create gives, and the component library. Either one implies --shadcn. |
--styles <file>|none |
Your global CSS. |
--primitives |
Builds the interface’s buttons, menus and dialogs from your components, which must be shadcn on Base UI. Off by default. |
--provider <module>|none |
The module that wraps every view. |
--design-md draft|<path>|<url>|none |
How DESIGN.md starts. Default: a draft from your design system. |
--agent <ids>|none |
The agents to connect, as a comma-separated list. |
--app <name>, --in <package>, --dir <folder> |
Where the studio goes. |
--pm bun|pnpm|yarn|npm |
The package manager. Default: the one running create. |
--studio <spec> |
Where to install @dexhq/canvas from, such as a version or a .tgz file. |
--skip-install |
Writes the files without installing. |
--yes |
Accepts what it found without asking. Without a terminal, this is the default. |
--dry-run |
Shows the plan and writes nothing. |
--json |
Prints one event per line: a question for each choice it can’t make, with the flags that answer it, and a hint for each step left to your agent. |
Flags go after --, as in npm create dex@latest -- --yes. create exits with 2 when nothing it found is safe to accept, and 1 when the install fails.
Run
| Command | Does |
|---|---|
dev |
Starts Dex at http://localhost:3008. If the port is taken, it moves to the next free one, unless STUDIO_PORT is set. |
build |
Checks, then builds a read-only static site to outDir. |
preview |
Serves the build. |
stop |
Stops this checkout’s Dex, and no other. |
extension |
Prints where the Snapshot extension is and how to install it. |
app install |
On a Mac, makes ~/Applications/Dex.app, which starts Dex when it isn’t running. Run it again after moving the project or changing its port. |
app remove |
Removes that app. |
Work
Agents run these. A file is named by its slug with --slug, and a person with --person.
| Command | Does |
|---|---|
whoami |
Says who you are, from your GitHub account or git user. |
new --title "<title>" [--person <slug>] [--description "<question>"] |
Creates a file, with its first view and canvas. |
contributor --name "<name>" --git "<git user>" --discipline product|brand|engineering |
Adds a contributor and their folder. |
threads [--slug <file>] [--all] |
Prints the threads waiting for an agent as JSON, or every thread with --all. |
thread --id <id> [--note "<reply>"] [--acknowledge | --resolve | --dismiss] [--agent "<name>"] |
Replies to a thread, changes its status, or both. |
check |
Validates files, canvases and imports, the same way build does. |
scope --person <slug> [--base main] |
Lists changes that person may not make. |
presence --slug <file> --view <view> [--agent "<name>"] [--clear] |
Shows which view an agent is editing. Claude Code’s hook runs this for you. |
snapshot --slug <file> [--view <view>] |
Screenshots every frame in light and dark, and lists console errors and overflow. Needs Dex running and Playwright. |
Agents and environment variables
| Name | Does |
|---|---|
claude [...] |
Starts Claude Code with comments arriving in the session as you post them. Other options go to claude. |
mcp [--agent "<name>"] |
Runs the MCP server over stdio. |
hook |
The Claude Code hook for guidelines and presence. create adds it to .claude/settings.json. |
STUDIO_PORT |
The port for dev and preview. |
DEX_NO_UPDATE_CHECK |
Set it to stop dev checking npm for a newer Dex. |