CLI Guide

How to use the Motion Core CLI to manage your workspace.


The Motion Core CLI is the primary way to integrate components into your project. It automates the setup, dependency installation, and component scaffolding.

Installation

You can run the CLI directly using

npx
,
bunx
, or
pnpm dlx
without installation:

npx @motion-core/cli init
npx @motion-core/cli init

Commands

init

Initialize your project for Motion Core. This command will:

  • Detect your framework (SvelteKit or Vite + Svelte).
  • Detect your package manager.
  • Create a
    motion-core.json
    file.
  • Scaffold required directories and base utility files (
    cn.ts
    ).
  • Install base dependencies (
    clsx
    ,
    tailwind-merge
    ).
motion-core init
motion-core init

add

Add a component from the registry to your project.

motion-core add [component-slug]
motion-core add [component-slug]

Options:

  • --dry-run
    : See what would be installed without making any changes.
  • -y, --yes
    : Skip confirmation prompts.

list

List all available components in the registry.

motion-core list
motion-core list

cache

Manage the local cache for registry data and assets.

motion-core cache --clear --force
motion-core cache --clear --force

Configuration

The

motion-core.json
file allows you to customize where components and utilities are installed.

{
	"$schema": "https://motion-core.dev/registry/schema/config-schema.json",
	"tailwind": {
		"css": "src/routes/layout.css"
	},
	"aliases": {
		"components": {
			"filesystem": "src/lib/motion-core",
			"import": "$lib/motion-core"
		},
		"helpers": {
			"filesystem": "src/lib/motion-core/helpers",
			"import": "$lib/motion-core/helpers"
		},
		"utils": {
			"filesystem": "src/lib/motion-core/utils",
			"import": "$lib/motion-core/utils"
		}
	},
	"aliasPrefixes": {
		"components": "$lib/motion-core"
	},
	"exports": {
		"components": {
			"barrel": "src/lib/motion-core/index.ts",
			"strategy": "named"
		}
	}
}
{
	"$schema": "https://motion-core.dev/registry/schema/config-schema.json",
	"tailwind": {
		"css": "src/routes/layout.css"
	},
	"aliases": {
		"components": {
			"filesystem": "src/lib/motion-core",
			"import": "$lib/motion-core"
		},
		"helpers": {
			"filesystem": "src/lib/motion-core/helpers",
			"import": "$lib/motion-core/helpers"
		},
		"utils": {
			"filesystem": "src/lib/motion-core/utils",
			"import": "$lib/motion-core/utils"
		}
	},
	"aliasPrefixes": {
		"components": "$lib/motion-core"
	},
	"exports": {
		"components": {
			"barrel": "src/lib/motion-core/index.ts",
			"strategy": "named"
		}
	}
}