Livestream: Let Your Whole Team Build on Your Real Codebase

Announcing Visual Copilot - Figma to production in half the time

Builder.io
Builder.io

Livestream: Let Your Whole Team Build on Your Real Codebase

Announcing Visual Copilot - Figma to production in half the time

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.

FlagDescription

--force

Force re-authentication even if already authenticated

--reset

Clear all stored credentials and log out

--spaceId

Your Space's Public API Key

Space type: Fusion or Publish Space

FlagDescription

--verbose

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.

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 Fusion 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.

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:

flagdescription

--accept

Auto-accept follow-up prompts.

--cwd

Working directory for the command.

--index

Run index-repo before generating.

--prompt

Run non-interactively with a specific prompt

--privacyMode

Encrypt data sent during code generation.

--spaceId

Your Space's Public API Key.

--url

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:

flagdescription

--figmaToken

Your Figma personal access token.

--spaceId

Your Space's Public API Key.

--force

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:

flagdescription

--spaceId

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:

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.

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.

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.

Space type: Fusion Space

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

flagdescription

--project, --projectId

Override the pinned project ID.

--dryrun

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

--ci

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>
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.

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.

flagdescription

--ci

Run in CI mode without interactive prompts.

--clearMappings

Publish zero mappings, removing all existing mappings from Builder.

--dryrun

Validate and preview without publishing.

--force

Publish even if there are errors.

--spaceId

Your Space's Public API Key.

--verbose

Print full JSON output.

--yes

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.

flagdescription

--force

Force migration even with warnings.

--spaceId

Your Space's Public API Key.

--yes

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.

Was this article helpful?