Builder CLI
The Builder CLI is a command-line tool that powers several key functions for developers including code generation, code sync, and more.
What to know
- Install the
builderCLI once, then run commands directly. On macOS and Linux, runcurl -fsSL https://www.builder.io/install.sh | bash. On Windows, runirm https://www.builder.io/install.ps1 | iex. If you can't install a binary,npx @builder.io/buildercodeworks on any system with Node.js 22 or later, with a slower startup. - The
connect-repocommand isn't available inbuilderyet. Keep using thenpxform for it until it's migrated. Thefigma auth,figma publish,figma migrate, andfigma reportcommands are deprecated and removed. See Migrating from npx.
Commands
auth
The auth command re-triggers authentication from the command line. This is useful should you need to change your authenticated Space or you are having any issues with authentication.
To your current authentication status:
To reset your credentials and log out, include the --reset flag.
| Flag | Description |
| Force re-authentication even if already authenticated |
| Clear all stored credentials and log out |
| Your Space's Public API Key |
doctor
| Flag | Description |
| Show detailed diagnostic output |
index-repo
Requirements: a local repository
The index-repo command analyzes your entire repository to understand your component architecture and typically achieves high mapping accuracy, enabling effective code generation.
The index-repo command can take the following flags:
| flag | description |
| Add an additional directory to include. Repeatable. |
| Run in CI mode without interactive prompts. |
| Allow the re-indexing process to focus on a specific component or list of components. This is useful when testing or refining document creation.
|
| Provide the working directory for the command. |
| Create a Builder Code example project after indexing. |
| Preview what would be indexed without making changes. |
| When set to |
| User-friendly name for your design system. |
| Provide a specific package or scope to focus the command, such as |
| Exclude glob patterns. Repeatable. |
| When set to |
| Include glob patterns. Repeatable. |
| Increase the scope of indexing outside of the current directory by providing a comma-separated list of absolute paths. This is not necessary if component definitions are in the workspace you are indexing. Use this syntax: |
| Extra instructions to guide the indexing process. |
| Skip detailed component grouping. |
| Skip the package installation step. |
| Skip the display headers. Useful for CI or automation. |
| Your Space's Public API Key |
| Path to a folder of custom documentation to upload. |
| When set to |
builder (code generation)
Requirements: a local repository
Run builder with no command to start an interactive, AI-powered code generation session that analyzes your project and generates or modifies code. Pass --url with the output from the Builder Figma plugin, such as a vcp:// link, to start from a design, or --prompt to run a single task and exit.
The builder command can take the following flags:
| flag | description |
| Auto-accept follow-up prompts. |
| Working directory for the command. |
| Run non-interactively with a specific prompt |
| Encrypt data sent during code generation. |
| Your Space's Public API Key. |
| Output from the Builder Figma plugin to start generation from, such as a |
launch
Requirements: a local repository
Use the launch command to launch Builder from the command line for a local repository.
The launch command can take the following flags:
| flag | description |
| Handles when the server uses self-signed certificates. |
| Launch within the Desktop Application. |
| Automatically detect the dev server URL and port from command output. |
| Branch name for remote container sessions. |
| Runs a command. For example, |
| Launch in chat only mode. |
| Inline JSON configuration. |
| Path to a |
| Enable HTTPS. |
| Structured JSON output. Useful for CI or programmatic use. |
| Enable local dev mode with automatic port detection. |
| Custom local domain to use instead of localhost. |
| Do not open a browser when the command is run. The terminal shows the URL for manual opening. |
| Native app mode. Disables the proxy server. |
| HTTP port where your dev server runs. |
| Encrypt data sent during the session. |
| Specify the development server URL to connect to. |
| Project ID for remote container sessions. |
| Resume a previous session by ID. |
connect-repo
Requirements: a local repository
Alias: repo-connect
The connect-repo command connects an existing git repository to Builder and creates a new Builder Code project. It detects your repo metadata, collects configuration, and runs setup.
| flag | description |
| Working directory for the command. |
| Preview the setup without creating a project. |
| Install command to use, for example |
| Your Space's Public API Key. |
push
The push command pushes local git commits to your remote and ensures a matching Builder branch exists.
| flag | description |
| Override the pinned project ID. |
| Run |
| Run in CI mode. |
pull
The pull command pulls a Builder branch into your local git repository.
| flag | description |
| Required. Builder branch name or ID to pull. |
| Override the pinned project ID. |
| Show what would be pulled without making changes. |
Migrating from npx
If you ran commands with npx builder.io@latest or npx @builder.io/dev-tools, switch to the installed builder CLI. Your existing credentials carry over because builder and the legacy CLI share ~/.builder, so you don't need to sign in again.
- Install
builderusing the commands in What to know. - Replace the
npxprefix withbuilder, using the table below. The separate Windows form,npx "@builder.io/devtools@latest", is no longer needed. - Run
builder doctorto confirm your install and connection.
| Before | After |
|---|---|
npx builder.io@latest auth | builder auth (or builder login) |
npx builder.io@latest auth status | builder auth status |
npx builder.io@latest auth --reset | builder auth --reset (or builder logout) |
npx builder.io@latest doctor | builder doctor |
npx builder.io@latest index-repo | builder index-repo |
npx builder.io@latest fusion launch | builder launch |
npx builder.io@latest push | builder push |
npx builder.io@latest pull | builder pull |
npx builder.io@latest code generate | builder |
npx builder.io@latest figma auth | report | publish | migrate | Deprecated and removed. These commands now print a deprecation notice and exit with an error. There is no builder equivalent. |
npx builder.io@latest connect-repo | Not migrated yet. Keep using npx. |
What's next
To instead generate code using a web interface, visit Figma to Builder. If you'd rather generate code through a command-line interface, Generate Code with Builder CLI.