Skip to content
Skip to main content
CONTACT SALESSTART BUILDING

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 builder CLI once, then run commands directly. On macOS and Linux, run curl -fsSL https://www.builder.io/install.sh | bash. On Windows, run irm https://www.builder.io/install.ps1 | iex. If you can't install a binary, npx @builder.io/buildercode works on any system with Node.js 22 or later, with a slower startup.
  • The connect-repo command isn't available in builder yet. Keep using the npx form for it until it's migrated. The figma auth, figma publish, figma migrate, and figma report commands 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.

builder auth
builder auth

To your current authentication status:

builder auth status
builder auth status

To reset your credentials and log out, include the --reset flag.

builder auth --reset
builder auth --reset
FlagDescription

--force

Force re-authentication even if already authenticated

--reset

Clear all stored credentials and log out

--spaceId

Your Space's Public API Key

doctor

builder doctor
builder doctor
FlagDescription

--verbose

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.

builder index-repo
builder index-repo

The index-repo command can take the following flags:

flagdescription

--addDirectory, --add

Add an additional directory to include. Repeatable.

--ci

Run in CI mode without interactive prompts.

--components

Allow the re-indexing process to focus on a specific component or list of components. This is useful when testing or refining document creation.

--components="Button" or --components="Button,Input"

--cwd

Provide the working directory for the command.

--createFusionExample

Create a Builder Code example project after indexing.

--dryrun

Preview what would be indexed without making changes.

--debug

When set to true, enables debug logging with API call details.

--designSystemName

User-friendly name for your design system.

--designSystemPackage

Provide a specific package or scope to focus the command, such as --designSystemPackage @company/ui. Consider running within design system repo instead.

--exclude, -e

Exclude glob patterns. Repeatable.

--force

When set to true, forces operation despite warnings.

--include, -i

Include glob patterns. Repeatable.

--includeDirectories

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: --includeDirectories "/your/path, /your/other/path"

--instructions

Extra instructions to guide the indexing process.

--skipDetailedGrouping

Skip detailed component grouping.

--skipInstallation

Skip the package installation step.

--skipHeader

Skip the display headers. Useful for CI or automation.

--spaceId

Your Space's Public API Key

--uploadCustomDocs

Path to a folder of custom documentation to upload.

--verbose

When set to true, enable verbose output.

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.

builder
builder

The builder command can take the following flags:

flagdescription

--accept

Auto-accept follow-up prompts.

--cwd

Working directory for the command.

--prompt

Run non-interactively with a specific prompt

--privacyMode

Encrypt data sent during code generation.

--spaceId

Your Space's Public API Key.

--url

Output from the Builder Figma plugin to start generation from, such as a vcp:// link.

launch

Requirements: a local repository

Use the launch command to launch Builder from the command line for a local repository.

builder launch
builder launch

The launch command can take the following flags:

flagdescription

--acceptSelfSigned

Handles when the server uses self-signed certificates.

--app

Launch within the Desktop Application.

--autoDetectDevServer

Automatically detect the dev server URL and port from command output.

--branchName

Branch name for remote container sessions.

-c, --command

Runs a command. For example, -c "npm run dev".

--chat

Launch in chat only mode.

--configJson

Inline JSON configuration.

--configPath

Path to a fusion.config.json file.

-https

Enable HTTPS.

--jsonOutput, --json

Structured JSON output. Useful for CI or programmatic use.

--local

Enable local dev mode with automatic port detection.

--localHttpsDomain

Custom local domain to use instead of localhost.

--no-open

Do not open a browser when the command is run. The terminal shows the URL for manual opening.

--nativeApp, --native

Native app mode. Disables the proxy server.

--p, --port

HTTP port where your dev server runs.

--privacyMode

Encrypt data sent during the session.

--serverUrl

Specify the development server URL to connect to.

--projectId

Project ID for remote container sessions.

--session

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.

npx builder.io@latest connect-repo
npx "@builder.io/devtools@latest" connect-repo
flagdescription

--cwd

Working directory for the command.

--dryrun

Preview the setup without creating a project.

--installCommand

Install command to use, for example npm install or pnpm install.

--spaceId

Your Space's Public API Key.

push

The push command pushes local git commits to your remote and ensures a matching Builder branch exists.

builder push
builder push
flagdescription

--project, --projectId

Override the pinned project ID.

--dryrun

Run git push --dry-run only, without pushing.

--ci

Run in CI mode.

pull

The pull command pulls a Builder branch into your local git repository.

builder pull <builder-branch>
builder pull <builder-branch>
flagdescription

<builder-branch>

Required. Builder branch name or ID to pull.

--project, --projectId

Override the pinned project ID.

--dryrun

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.

  1. Install builder using the commands in What to know.
  2. Replace the npx prefix with builder, using the table below. The separate Windows form, npx "@builder.io/devtools@latest", is no longer needed.
  3. Run builder doctor to confirm your install and connection.
BeforeAfter
npx builder.io@latest authbuilder auth (or builder login)
npx builder.io@latest auth statusbuilder auth status
npx builder.io@latest auth --resetbuilder auth --reset (or builder logout)
npx builder.io@latest doctorbuilder doctor
npx builder.io@latest index-repobuilder index-repo
npx builder.io@latest fusion launchbuilder launch
npx builder.io@latest pushbuilder push
npx builder.io@latest pull builder pull
npx builder.io@latest code generatebuilder
npx builder.io@latest figma auth | report | publish | migrateDeprecated and removed. These commands now print a deprecation notice and exit with an error. There is no builder equivalent.
npx builder.io@latest connect-repoNot 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.

Was this article helpful?