The particles command-line tool lets you pull tokens into your codebase, export CSS, push existing token files, and automate syncing in CI. Developers use it to consume tokens; designers and admins can also push token files to bootstrap or migrate a project.
Fetch tokens and write them to outputDestination (configured during init). Works like npm install — by default it pulls the latest published release. If no releases exist yet, it falls back to the branch HEAD. This command replaces the entire output file — it is the source of truth, not a partial update.
# Pull latest release (default — recommended for production)
particles token-studio sync
# Pull from a branch HEAD (useful during active development)
particles token-studio sync --branch rebrand-2025
# Pin to a specific release snapshot
particles token-studio sync --version 1.2.3
# Sync and fail CI if any contrast pairs fail WCAG AA
particles token-studio sync --wcag-level AA
Token variables are sorted alphabetically by type group, then by group path and name (with numeric-aware ordering so 100 sorts before 200 and 1000), matching the order you see in the Studio token list.
token-studio export
Export resolved tokens in a chosen format — useful for piping into other tools or generating multiple artifacts from one source of truth.
# Tailwind v4 CSS (default)
particles token-studio export --format tailwind-v4
# Write to a file instead of stdout
particles token-studio export --format css --output ./styles/tokens.css
# Export from a specific branch
particles token-studio export --format scss --branch rebrand-2025
# Pin to a published release snapshot
particles token-studio export --version 1.2.3 --format tailwind-v4
# TypeScript theme object — drops into MUI createTheme() or styled-components ThemeProvider
particles token-studio export --format ts --output ./src/theme.ts
# Plain JS theme object (same shape, no type annotations)
particles token-studio export --format js --output ./src/theme.js
# Other formats
particles token-studio export --format style-dictionary
particles token-studio export --format dtcg
particles token-studio export --format json
# Pipe into another tool
particles token-studio export --format json | jq '.[] | select(.type == "color")'
The ts and js formats emit a single named export grouped by token type — colors, spacing, fontSize, radii, shadows, and so on — with groupPath nested underneath. Composition tokens are emitted as parsed nested objects. The TS variant appends as const and an export type Theme = typeof theme alias so consumers get autocomplete for every token path. Semantic tokens emit fully resolved values (a snapshot) since JS objects can't reference siblings cleanly.
Push a local token file into a project branch — useful for bootstrapping a new project from an existing design file, migrating a legacy token library, or scripting bulk token updates from CI. Targets main by default; use --branch to push to a feature branch.
Push requires the tokens:write permission, which is granted to Admin and Designer roles. Developer accounts have read-only CLI access and cannot push.
# Preview changes without applying them (dry run)
particles token-studio push --file ./tokens/globals.json --dry-run
# Apply changes — JSON is auto-detected (DTCG, Tokens Studio, Style Dictionary, or Particles)
particles token-studio push --file ./tokens/globals.json
# Push to a feature branch instead of main
particles token-studio push --file ./tokens/globals.json --branch rebrand-2025
# Push a CSS file (custom properties are parsed automatically)
particles token-studio push --file ./styles/tokens.css
# Push SCSS variables
particles token-studio push --file ./styles/_tokens.scss
# Push a TypeScript theme object (evaluated locally, then uploaded as DTCG)
particles token-studio push --file ./src/theme.ts
# Same for plain JS
particles token-studio push --file ./src/theme.js
# Override the default tier assigned to tokens that don't declare one
particles token-studio push --file ./tokens/globals.json --tier semantic
The format is detected from the file extension. A --dry-run prints a summary of what would change without modifying any data in the project:
Dry run (no changes applied):
+ 12 tokens added
~ 3 tokens updated
- 1 token removed
Extension
Parsed as
.json
Auto-detected: DTCG/W3C, Tokens Studio, Style Dictionary, or Particles JSON
TypeScript theme object — as const and export type lines are stripped before evaluation
JS and TS files are evaluated locally in a sandboxed context before upload — no code runs on the Particles platform. Composition tokens represented as nested objects in JS/TS become individual flat leaf tokens after import. Use DTCG JSON if you need to preserve composition token structure.
token-studio branch create
Create a new branch forked from an existing one. Tokens from the source branch are copied into the new branch so you can experiment without touching the original. Defaults to forking from main.
Requires the branch:create permission — granted to Admin role or Designers with elevated branch permissions on the project.
# Fork from main (default)
particles token-studio branch create rebrand-2025
# Fork from a specific branch
particles token-studio branch create rebrand-sub --from rebrand-2025
migrate --scalable
Make Scalable — turn a flat or messy token set into a layered primitive → semantic system. It extracts cleanly-named primitives from your raw values and re-points the genuine semantics onto them in place, so token ids and names are preserved and every rendered value stays identical (non-breaking). High-confidence mappings are applied automatically; weaker ones are listed in a report for you to review.
# Preview + apply on the current branch
particles migrate --scalable
# Target a branch and only auto-accept very confident mappings
particles migrate --scalable --branch rebrand-2025 --min-confidence 0.85
Make Scalable is a Business plan capability. The same flow is available as a button in Studio and the Figma plugin, and a single Revert last run restores the pre-migration state.
Theme commands
Manage sub-brand themes and generate per-theme CSS blocks. Themes are project-scoped token overrides applied via a data-theme attribute.
theme list
particles theme list
theme generate
Generate a [data-theme="name"] { … } CSS block for a single theme.
# Write to stdout
particles theme generate dark
# Write to a file
particles theme generate dark --out src/themes/dark.css
theme generate-all
Generate one CSS file per theme into a directory.
particles theme generate-all --out-dir src/themes
Multi-level modules
For a multi-level product that consumes Foundation / Brand modules, check whether any linked module has a newer release than the one your product is pinned to, and preview the diff before adopting it in the Studio. Both commands are read-only — accepting an update is done in Project → Token modules.
# List linked modules — pinned release vs latest, and updates available
particles token-studio modules status
# Dry-run diff of a pending module update (added / removed / changed / conflicts)
particles token-studio modules preview <refId>
Standalone projects have no modules — modules status simply reports that. The older foundation sync command is deprecated in favour of modules; see Token architecture.
CI / GitHub Actions
A typical CI step that syncs tokens and enforces WCAG AA contrast:
.github/workflows/tokens.yml
- name: Sync design tokens
run: |
npx @particlesui/cli auth login # uses PARTICLES_TOKEN env from CI secrets
npx @particlesui/cli token-studio sync --version ${{ github.ref_name }} --wcag-level AA