Skip to content

@theme-kit/cli

CI & Automation

Run everywhere

theme-kit (installed) or npx --yes @theme-kit/cli behaves the same on npm, pnpm, yarn, bun, cmd, PowerShell, bash, and zsh. Prefer a project-local install in CI so the version is locked and reviewed:

json
{
  "scripts": {
    "theme:validate": "theme-kit validate themes/"
  }
}

Exit codes make it a gate

validate fails with a nonzero exit code, so an invalid theme stops the pipeline:

CodeMeaning
0Success
1Command/runtime error
2Invalid arguments
3Validation failed
bash
theme-kit validate themes/
if [ $? -ne 0 ]; then
  echo "theme invalid — rejecting"
  exit 1
fi

GitHub Actions

yaml
1name: Validate Themes
2
3on:
4  pull_request:
5  push:
6    branches: [main]
7
8jobs:
9  themes:
10    runs-on: ubuntu-latest
11    steps:
12      - uses: actions/checkout@v4
13      - uses: pnpm/action-setup@v4
14      - uses: actions/setup-node@v4
15        with:
16          node-version: 22
17      - run: pnpm install --frozen-lockfile
18      - run: pnpm exec theme-kit validate themes/

Automation-friendly behaviours

  • No prompts. The CLI never asks for input.
  • File writes are explicit. Only --output writes; the default is stdout.
  • Deterministic per project. A script in package.json fixes the version, so machines agree.
  • Pre-build step. Run theme:generate before next build, vite build, or a Tailwind pass so theme.json / theme.css exist first.

Next: Reference.

CLI in CI — Theme Kit