Setup & Scanning Commands

These commands handle initialization, design file parsing, code scaffolding, and credential management.

Initialization

CommandWhat it does
ptb initInitializes PTB in the current directory. Detects fresh vs existing repo. Scaffolds packages/ui if fresh, writes ptb.config.json, registers you as Lead.
ptb mcp setupAuto-detects installed AI IDEs and writes MCP config files. Run after ptb init. See MCP Setup.

Credentials

CommandWhat it does
ptb token set <value>Stores a token in ~/.config/calibrate-ds/credentials.json. Works for CLI and MCP server without env vars.
ptb token showShows where the active token comes from (env var or credentials file).
ptb token clearRemoves the stored token.
ptb token listLists all active tokens and their sources.

See Token Commands for the full reference.

Scanning & Generation

CommandWhat it does
ptb scanFetches the Figma file via REST API (or reads imported-tokens.json), normalizes it into DesignSystemModel, saves snapshot, exports AI context files.
ptb generate-components [name]Scaffolds typed component shells using the framework generator (React tsx files).
ptb generate-tokensGenerates --ptb-* CSS custom property files from Figma Variables.
ptb export contextExports all component context files to .ptb/context/. Commit these — AI IDEs and CI read from them.
ptb import-tokens <path>Imports a CalibrateDS plugin token export directly (alternative to dropping imported-tokens.json in .ptb/).

Next Steps

Review the State & Freshness Commands reference.