CLI
The stoaken command connects a project to a Brand and writes its live tokens as files you commit.
Connect a project
npx stoaken initIt asks how to sign in (browser, or paste an API key from Settings > Developer access) and which Brand the project is for, then writes stoaken.config.json (commit it), .stoaken/credentials.json (already git-ignored) and a skill file that tells AI agents how to work with your tokens.
In a project (CLI 0.8.0 or later) it also looks around on your machine: the framework in package.json, Tailwind, token files like tokens.json, where your components are, and a Figma link in the README. Then it offers the rest in one go: export targets in stoaken.config.json, and one GitHub workflow, .github/workflows/stoaken-tokens.yml, that checks token files on every pull request, opens a pull request when a release is published, and sends your components on every push to your main branch. It never replaces a workflow that’s already there unless you say so, and it lists what’s left to do on GitHub (the STOAKEN_TOKEN secret, letting Actions open pull requests).
From CLI 0.11.0, init asks which branch the workflow’s pull requests go to, offering your repository’s default branch (from origin/HEAD; else the branch you’re on, git worktrees included), or takes --base <branch>; the choice is saved in stoaken.config.json. The workflow runs a pinned CLI line, npx --yes stoaken@0.11 (the newest 0.11.x), never @latest, so a breaking release never lands unasked; its first line says which, and where to change it.
A folder with no sign-in says so: This folder isn’t signed in to Stoaken., with the two fixes (run npx stoaken init there, or set STOAKEN_TOKEN to an API key). In a git worktree, the CLI uses the sign-in of your main checkout (its .stoaken/credentials.json) and renews it there; it never looks in parent folders.
What you’ll see when you sign in with the browser
- Choose Sign in with browser. Your browser opens Stoaken’s sign-in page.
- Sign in the way you usually do.
- A consent screen asks whether Stoaken CLI may use your account. Check the name, then allow it.
- Back in the terminal:
Signed in as you@example.com.
The CLI names itself with a published client document, https://www.stoaken.com/oauth/cli-client.json (a Client ID Metadata Document), so nothing is registered. If the sign-in service doesn’t accept that, the CLI registers itself once instead (Dynamic Client Registration). The sign-in is saved in .stoaken/credentials.json, readable only by you, and renews itself. When it can’t, the CLI says Your Stoaken sign-in ended. Run npx stoaken init to sign in again.
Company sign-in works here too. If your company signs you in to Stoaken with its own sign-in, the browser opens it, and you sign in the way you do at work. An API key keeps working either way: keys aren’t tied to how you sign in, so revoke one on Settings > Developer access when it’s no longer needed.
Export tokens
npx stoaken export --theme Default --format css --out src/tokens.css
npx stoaken export --format compose --mode color-scheme:dark --out app/src/main/java/Tokens.kt--theme- What it does
- Theme name or id (needed when the Brand has more than one).
--format- What it does
- One of css, css-auto, json-dtcg, json-sd4, js, ts, scss, tailwind, tailwind4, swift, compose, android. See export formats.
--mode- What it does
- A mode combination for one-mode formats, e.g.
color-scheme:dark.
--prefix- What it does
- CSS: a prefix for every variable name.
--release- What it does
- A release id instead of the theme's latest published release. On its own (CLI 0.6.0 or later), every saved export runs from that release.
--out- What it does
- File to write, or
-for stdout.
--check- What it does
- Write nothing; exit 1 if the file on disk is out of date.
--report- What it does
- With --check (needs CLI 0.6.0 or later): once every check passes, tell Stoaken this release path (its name or id) landed on the release that was checked. The CLI first says which release that was. Light or Team plan; the API key’s person must own the path.
| Option | What it does |
|---|---|
--theme | Theme name or id (needed when the Brand has more than one). |
--format | One of css, css-auto, json-dtcg, json-sd4, js, ts, scss, tailwind, tailwind4, swift, compose, android. See export formats. |
--mode | A mode combination for one-mode formats, e.g. color-scheme:dark. |
--prefix | CSS: a prefix for every variable name. |
--release | A release id instead of the theme's latest published release. On its own (CLI 0.6.0 or later), every saved export runs from that release. |
--out | File to write, or - for stdout. |
--check | Write nothing; exit 1 if the file on disk is out of date. |
--report | With --check (needs CLI 0.6.0 or later): once every check passes, tell Stoaken this release path (its name or id) landed on the release that was checked. The CLI first says which release that was. Light or Team plan; the API key’s person must own the path. |
Files have no timestamps, so a re-export with no token changes produces no diff.
Saved targets
List targets in stoaken.config.json and run npx stoaken export with no options to write them all:
{
"brandId": "…",
"brandName": "Acme",
"serverUrl": "https://www.stoaken.com",
"exports": [
{ "theme": "Default", "format": "css-auto", "out": "src/tokens.css" },
{ "theme": "Default", "format": "swift", "mode": "color-scheme:dark", "out": "ios/TokensDark.swift" }
]
}In CI
Create an API key, store it as a secret named STOAKEN_TOKEN (with CLI 0.6.0 or later, STOAKEN_API_KEY works too), and fail the build when committed tokens are behind the live release:
name: Tokens up to date
on: [pull_request]
jobs:
tokens:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: npx stoaken export --check
env:
STOAKEN_TOKEN: ${{ secrets.STOAKEN_TOKEN }}--check ignores CRLF against LF line endings, so Windows runners that check files out with CRLF still pass. The same command works on GitLab CI, Bitbucket Pipelines, Azure Pipelines and in a Vercel build. To have a pipeline open a pull request with the new tokens when a release is published, pair it with a webhook.
Push components
stoaken components push sends your components from code to a Brand. It works the import plan out on your computer (every component, what each one uses, which values are on tokens), uploads only the files the Brand doesn’t hold yet, and prints a review link: the plan opens in the app’s Review, where you answer any questions and import. Stoaken never reads your repository. In the app, Components › Import › From your code shows the command with your Brand’s id.
npx stoaken components push --brand <brand id>
npx stoaken components push --check # the plan in your terminal; sends nothing
npx stoaken components push --yes # CI: imports what needs no decision
npx stoaken components push --check --drift # CI: fails when a linked component drifts from Figma--check is free on every plan. Sending a plan and importing it come with the Light and Team plans (the 14-day trial includes it); the API key’s person needs Editor on the Brand. With --yes, only components with no open question are imported; the rest wait in the Review, and nothing is decided for anyone. Refusals come back as problem documents with a code (plan_limit, not_allowed, duplicate_ident, too_large, bad_unit); see the API.
What a preview carries (CLI 0.11.0): React and three class helpers, clsx, tailwind-merge (with extendTailwindMerge) and class-variance-authority, so components built with cn, clsx or cva draw; a helper imported from another file you send (like cn in lib/utils) travels with the component. next/link, next/image, next/navigation, next/font, next/head and router links are drawn as plain equivalents. Anything else is drawn as a labelled dashed placeholder (OTPInput (input-otp)): --check prints Not carried, drawn as labelled placeholders: … with each file that uses one, counts them on the headline (1 import previews can’t have), and lists Pictures previews can’t load (an address served by your app, or from the internet). With --yes, components that use a package previews don’t carry wait in the Review with that note. Components sent before 0.11 keep their old code until you push them again.
From CLI 0.9.0, --check --drift compares each component in the folder that is linked to a Figma twin (on the Components page, or in the import Review) with that twin, on your computer: props and variant names that differ, states one side lacks, a raw value where Figma binds a token, and any token the Brand doesn’t have. It exits 1 when one drifts, with each reason and its fix in plain words, and sends nothing. It reads the pairs with GET /api/brands/{brandId}/component-pairs (Viewer or above, so it needs a key). In the GitHub Action, fail-on-drift: 'true' runs it first.
Export icons
From CLI 0.10.0, stoaken icons export writes the Brand’s icons as code, the same files the Icons page’s Export downloads, from the newest live release that carries them (--working for the icons as they are now). Formats: svg, sprite, css, scss, tailwind, tailwind4, react, js, ts, json, swift, xcassets, compose and android. Save a list as "icons": ["css", "react"] in stoaken.config.json to run it with no options. --check writes nothing and exits 1 when a committed file is behind; in the GitHub Action, icons: 'true' runs it. It reads GET /api/brands/{brandId}/icons/export (Viewer or above).
npx stoaken icons export --format css,react --out src/icons
npx stoaken icons export --format android --out app/src/main/res
npx stoaken icons export --format swift,xcassets --out ios/Icons
npx stoaken icons export --check # CI: fails when committed icons are behindToken sets and modes
From CLI 0.12.0, stoaken sets create makes a token set (empty, or --from a DTCG file) and stoaken modes add adds a mode to a theme, making its axis when the theme has none of that key. Both change the Brand’s working copy (Editor on the Brand); nothing is live until a person approves a release. With --theme, a set whose tokens would give existing tokens new values is not added: the CLI lists the first 12 (path before → after (from set)) and exits 2; run it again with --accept-overrides to add it anyway. --propose --version <x.y.z> also sends a release of that theme for review, with an optional --title.
npx stoaken sets create Mobile --from tokens/mobile.json --theme Default
npx stoaken sets create Mobile --theme Default --accept-overrides --propose --version 1.4.0 --title "Mobile sizes"
npx stoaken modes add --theme Default --axis color-scheme --mode dark --set DarkOnly the icons you use
From the next CLI release, stoaken icons scan [folder…] reads your project on your machine (it never runs it; node_modules, builds and lock files are skipped) and lists the icons your code uses, set by set, with exact names and where each is used: imports (lucide-react, @heroicons/react/24/outline, @mui/icons-material, every react-icons pack, Phosphor with its weight, Tabler, Font Awesome, Radix, Ant Design, Fluent, @mdi/js, Expo vector icons, ng-icons…), Iconify ids (icon="mdi:home", ~icons/mdi/home, i-mdi-home), class names (fa-solid fa-house, bi bi-house, bx, ri-, mdi-, ph, pi…), Material Icons and Symbols text, SVG files your code imports and sprite <use> ids. It also says which sets package.json installs that the code never names, what has no public source (Font Awesome Pro, Themify) and packages it doesn’t know. It sends nothing until you add --add: then the drawings come from the public Iconify API (one request per set), are cleaned on your machine and go to the Brand’s working copy 100 at a time, each with its source, pinned version and licence. --json prints the report. stoaken icons add adds by name: lucide:search, or bare names with --set, or --from a file with one per line.
npx stoaken icons scan src
npx stoaken icons scan src --add
npx stoaken icons add lucide:search lucide:x mdi:home
npx stoaken icons add --set material-icons home settings arrow_backstoaken icons push refuses a folder inside node_modules with more than 100 SVGs (that’s a whole published set) and points to icons scan; add --whole-package if you really want every one.
Icons and logos
From CLI 0.13.0, stoaken icons push sends SVG icons (folders, .svg files and .zip files) and stoaken logos push sends logo files (SVG, PNG, WebP, JPEG or ICO, up to 3 MB each) to the Brand’s working copy. Names come from file names: lowercase letters and digits joined by dashes or underscores (arrow_back stays arrow_back; Arrow Right.svg becomes arrow-right). Each file is cleaned on your machine first, so --check shows exactly what would go in and changes nothing; Stoaken cleans it again when it arrives. Two files that give one name are listed and neither is sent. --replace updates a changed drawing of a name the Brand already has. Icons go 100 a request; a Brand holds up to 2,000 icons (32 KB each, cleaned) and 300 logos in up to 50 sets. Nothing is live until a person approves a release: --propose --version <x.y.z> files one on the Brand’s main theme, which always waits for a person.
npx stoaken icons push assets/icons --check
npx stoaken icons push assets/icons icons.zip --replace
npx stoaken logos push assets/logos --set Primary --background light --propose --version 1.5.0 --title "Icons and logos"A step for icons push in the GitHub workflow Stoaken writes is not added yet; run it by hand or add it yourself.
Troubleshooting
From CLI 0.6.0, two commands help when something’s off. npx stoaken status checks this project’s setup: the Brand, the server, the sign-in and when it ends, that you can still see the Brand (and your role on it), and whether the AI tool’s config and the .gitignore entry are there. It ends with the one thing to do next and exits 1 if a check fails. It changes nothing, except that an expired browser sign-in is renewed and saved, as export does. It works as a CI preflight too. npx stoaken help lists the commands.
npx stoaken status
npx stoaken help export- Stoaken doesn’t accept the API key
- What to do
- It may be revoked or mistyped. Make a new one on Settings > Developer access, then run
npx stoaken initagain.
- The browser sign-in isn’t accepted, or has ended
- What to do
- Run
npx stoaken init, choose Sign in again if asked, then Sign in with browser.
- Sign-in was cancelled or refused in the browser
- What to do
- Run
npx stoaken initagain, or choose Paste an API key.
- The browser didn’t open
- What to do
- From CLI 0.6.0 the terminal prints the address to visit. Open it yourself, or paste an API key instead.
- Port 51820 is busy
- What to do
- Another
stoaken initis probably still running. Close it and retry, or choose Paste an API key.
- It can’t reach Stoaken
- What to do
- Check your connection, or the
--serveryou passed.
- There are no Brands to pick
- What to do
- Your account can’t see any Brands yet. Create one in the app, or ask an Admin to invite you, then run init again. Signed in with the wrong account? Run init again and choose Sign in with browser (sign out of the other account in the browser first), or Paste an API key from the right account.
- You chose “None for now” and want an AI tool after all
- What to do
- Run
npx stoaken init --client claude-code(or another tool’s name: claude-code, claude-desktop, cursor, codex, copilot, v0, windsurf, zed, gemini-cli, jetbrains, cline, lovable, bolt, replit) and choose Continue with your Brand.
export --checkfails in CI- What to do
- The committed files are behind the live release. Run
npx stoaken export, commit the files, and push. If it can’t sign in, check theSTOAKEN_TOKENsecret.
| If | What to do |
|---|---|
| Stoaken doesn’t accept the API key | It may be revoked or mistyped. Make a new one on Settings > Developer access, then run npx stoaken init again. |
| The browser sign-in isn’t accepted, or has ended | Run npx stoaken init, choose Sign in again if asked, then Sign in with browser. |
| Sign-in was cancelled or refused in the browser | Run npx stoaken init again, or choose Paste an API key. |
| The browser didn’t open | From CLI 0.6.0 the terminal prints the address to visit. Open it yourself, or paste an API key instead. |
| Port 51820 is busy | Another stoaken init is probably still running. Close it and retry, or choose Paste an API key. |
| It can’t reach Stoaken | Check your connection, or the --server you passed. |
| There are no Brands to pick | Your account can’t see any Brands yet. Create one in the app, or ask an Admin to invite you, then run init again. Signed in with the wrong account? Run init again and choose Sign in with browser (sign out of the other account in the browser first), or Paste an API key from the right account. |
| You chose “None for now” and want an AI tool after all | Run npx stoaken init --client claude-code (or another tool’s name: claude-code, claude-desktop, cursor, codex, copilot, v0, windsurf, zed, gemini-cli, jetbrains, cline, lovable, bolt, replit) and choose Continue with your Brand. |
export --check fails in CI | The committed files are behind the live release. Run npx stoaken export, commit the files, and push. If it can’t sign in, check the STOAKEN_TOKEN secret. |
Using an AI tool? See AI agents troubleshooting.