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.
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.
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 |
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.
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 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
Alias: code gen, code g
The code generate command runs AI-powered code generation and analyzes your project, generates or modifies code, and presents an undo, refine, and accept workflow.
The 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.
The 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.
The 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
Alias: fusion
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. |
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.
| 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.
| 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.
| 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
The figma migrate command downloads your existing Figma component mappings from Builder and saves them as local .mapper.tsx files.
| 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.