The Builder CLI is a command-line tool that powers several key functions for developers including code generation, code sync, and more.
- Command-line scripts are accessible through the builder.io/dev-tools NPM package.
- Some commands are for Publish Spaces, some for Fusion Spaces, and some work with both.
- On Windows, replace
npx builder.io@latestwithnpx "@builder.io/dev-tools@latest"in all commands below.
Prerequisite for Publish
If you have a Publish Space, you must have integrated your codebase with Builder to use the Builder CLI. For more details, see Publish Quickstart.
Space type: Fusion or Publish Space
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.
# Mac and Linux
npx builder.io@latest authTo your current authentication status:
# Mac and Linux
npx builder.io@latest auth statusTo reset your credentials and log out, include the --reset flag.
# Mac and Linux
npx builder.io@latest auth --reset| Flag | Description |
|---|---|
| Clear all stored credentials and log out |
| Force re-authentication even if already authenticated |
| Your Space's Public API Key |
Space type: Fusion or Publish Space
# Mac and Linux
npx builder.io@latest doctor| Flag | Description |
|---|---|
| Show detailed diagnostic output |
Space type: a Fusion Space
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.
# Mac and Linux
npx builder.io@latest index-repoThe 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 Fusion 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 |
Space type: Fusion or Publish Space
Requirements: a local repository
The code generate command—aliases: code gen, code g—runs AI-powered code generation and analyzes your project, generates or modifies code, and presents an undo, refine, and accept workflow.
# Mac and Linux
npx builder.io@latest code generateThe code generate command can take the following flags:
| flag | description |
|---|---|
| Auto-accept follow-up prompts. |
| Working directory for the command. |
| Run index-repo before generating. |
| Run non-interactively with a specific prompt |
| Encrypt data sent during code generation. |
| Your Space's Public API Key. |
| URL to start generation from, such as a Figma design URL. |
Space type: Fusion or Publish Space
The figma auth command authenticates your CLI with Figma and Builder. Run figma auth when you first connect Figma or need to update your Figma credentials.
# Mac and Linux
npx builder.io@latest figma authThe figma auth command can take the following flags:
| flag | description |
|---|---|
| Your Figma personal access token. |
| Your Space's Public API Key. |
| Force re-authentication even if already authenticated. |
Space type: Fusion or Publish Space
The figma report command generates a report of your Figma components and teams relative to your Builder Space.
# Mac and Linux
npx builder.io@latest figma reportThe figma report command can take the following flags:
| flag | description |
|---|---|
| Your Space's Public API Key. |
Space type: a Fusion Space
Requirements: a local repository
Use the launch command—alias: fusion—to launch Builder from the command line for a local repository.
# Mac and Linux
npx builder.io@latest launchThe 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. |
Space type: Fusion Space
Requirements: a local repository
Alias: repo-connect
The connect-repo command connects an existing git repository to Builder and creates a new Fusion project. It detects your repo metadata, collects configuration, and runs setup.
# Mac and Linux
npx builder.io@latest connect-repo| 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. |
Space type: Fusion Space
The push command pushes local git commits to your remote and ensures a matching Builder branch exists.
# Mac and Linux
npx builder.io@latest push| flag | description |
|---|---|
| Override the pinned project ID. |
| Run |
| Run in CI mode. |
Space type: Fusion Space
The pull command pulls a Builder branch into your local git repository.
# Mac and Linux
npx builder.io@latest pull <builder-branch>| flag | description |
|---|---|
| Required. Builder branch name or ID to pull. |
| Override the pinned project ID. |
| Show what would be pulled without making changes. |
Space type: Publish Space
Alias: figma p
The figma publish command publishes your local Figma component mappings to Builder. It validates TypeScript before publishing and warns on errors.
# Mac and Linux
npx builder.io@latest figma publish| flag | description |
|---|---|
| Run in CI mode without interactive prompts. |
| Publish zero mappings, removing all existing mappings from Builder. |
| Validate and preview without publishing. |
| Publish even if there are errors. |
| Your Space's Public API Key. |
| Print full JSON output. |
| Auto-confirm all prompts. |
Space type: Publish Space
Alias: figma p
The figma migrate command downloads your existing Figma component mappings from Builder and saves them as local .mapper.tsx files.
# Mac and Linux
npx builder.io@latest figma publish| flag | description |
|---|---|
| Force migration even with warnings. |
| Your Space's Public API Key. |
| Auto-confirm all prompts. |
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.