Overview
motion-core addUsage
motion-core add <component-slug> [...slugs] [options]motion-core add <component-slug> [...slugs] [options]Examples:
# Install a single component
motion-core add glass-pane
# Install multiple components and all of their internal dependencies
motion-core add glass-pane image-trail
# Preview without writing
motion-core add logo-carousel --dry-run# Install a single component
motion-core add glass-pane
# Install multiple components and all of their internal dependencies
motion-core add glass-pane image-trail
# Preview without writing
motion-core add logo-carousel --dry-runOptions & environment variables
| Flag/Env | Description |
|---|---|
--dry-run | Computes the full plan (download manifests, resolve internal dependencies, diff files, check npm spec satisfaction, show barrel/dep updates) but does not touch the filesystem or run package managers. Perfect for code review and CI validation. |
-y--yes | Skips every interactive prompt, including “Apply this plan?” and individual file overwrite confirmations. |
MOTION_CORE_CLI_ASSUME_YES=1 | Environment equivalent of --yes |
CI=1 | When CI--dry-run |
Install workflow
- Registry sync – pulls the registry summary and builds a map of all available component slugs, including internal Motion Core dependencies that must accompany the requested component.
- Plan generation – determines the install order (requested components first, then transitives), prints a grouped “Install plan” section, and fetches the binary file contents for every record.
- Destination resolution – maps each remote file to your workspace using aliases. Targets like
motion-core.json,helpers,utils, orassetsredirect files to their respective folders while default files go underroot.aliases.components.filesystem - Conflict handling – before writing a file the CLI looks for a local version. If one exists it computes a colored diff and lets you keep your local file. Declining a prompt marks that component file as “kept” while the rest of the component continues installing.
- Barrel export sync – once the component’s entry files are written the CLI updates , adding both default exports and any
exports.components.barreldeclarations listed in the manifest. Relative import paths are rewritten automatically even if you move the barrel.export type - Dependency installation – gathers every runtime/dev dependency declared by the installed components and compares them against your . Missing specs are installed via the detected package manager; if none was detected a warning tells you which packages to install manually.
package.json - Completion summary – prints per-file statuses (,
created,updated,unchanged) and encourages you to import components from the barrel file.skipped
Handling existing files
- Without the CLI pauses on every conflicting file and displays a diff that looks like Git output (
--dry-runfor incoming changes,+for removed lines). Declining an overwrite retains the local file and marks the item as “skipped”.- - With the same conflicts are listed, but no prompts are shown. Instead, the CLI explains which files would have been overwritten.
--dry-run - With ,
--yes, orMOTION_CORE_CLI_ASSUME_YESthe CLI automatically overwrites conflicting files and notes the behavior so you know the decision was automated.CI=1
Dependency insights
- Dependencies are compared using semver ranges, so if your project already satisfies no install occurs.
gsap@^^3.14.2 - When no package manager can be detected you still get the missing package list (e.g. ). Install them yourself and rerun the command to let Motion Core finish file syncing.
install runtime dependencies manually: tailwind-merge@^3.0.0
Tips
- Combine with
motion-core add <slug> --dry-runto understand upcoming changes before accepting them.git diff - If you reorganize your component directories, update first and rerun the
motion-core.jsoncommand; the CLI respects your new alias paths immediately.add - When scripting, prefer so your pipeline does not block waiting for user input.
MOTION_CORE_CLI_ASSUME_YES=1 motion-core add ...