--- name: zard-migration description: Migrates a project whose installed zard/ui component source predates the current registry — components are copied into the project by zard-cli, so nothing upgrades them on its own. Applies when a project's zard/ui source uses a name the current registry no longer publishes (`divider`, `loader`, `radio`, `progress-bar`, `toast`, `menu`, `form`, `tree`, `layout`, `segmented`), when a component's shape doesn't match its current documentation (card, pagination, input-group), or when asked to "migrate to the latest zard-ui", "upgrade this project's zard components", or "why doesn't zard-cli add match what's already here". Not for a fresh install — that's the `zard` skill. user-invocable: true allowed-tools: Bash(npx zard-cli *), Bash(pnpm dlx zard-cli *), Bash(bunx --bun zard-cli *) --- # zard-migration Migrates a project's installed zard/ui component source to match the current registry. ## Why this is invoked explicitly The `zard` skill is `user-invocable: false` — it engages passively, on any zard/ui work. This one is `user-invocable: true`: overwriting installed component files is consequential and worth a deliberate ask ("migrate this project to the latest zard-ui"), not something that should fire silently the moment an assistant notices an old selector while doing unrelated work. Read [../zard/SKILL.md](../zard/SKILL.md) first if this project has not been worked on this session — it covers `components.json`, the CLI, the registry and the MCP server, all of which this guide assumes. ## What you will lose **`zard-cli add --overwrite` replaces the local files wholesale.** Any edit made inside a component's own files — a tweaked class, an added input, a changed template — is discarded, silently, file by file. Edits kept in the theme CSS, in a new CVA variant, or in a wrapper component survive, because those files are not part of the registry item. Never run `--overwrite` without the user's explicit approval, and **diff before you overwrite**: read the installed file and the registry's current version (`get-component` over MCP, or the published `https://zardui.com/docs/components/.md`) before deciding whether the local copy has changes worth keeping. ## 1. Detect what version this project is on There is no version field in `components.json` — a project on the current registry and a project two years behind both look identical at that level. The signal is in the installed files themselves. ### Fast check: does anything installed no longer exist in the registry? List the components directory (`aliases.components` in `components.json`) and compare its folder names against `apps/web/public/r/registry.json` (or `list-components` over MCP). A folder whose name is not a current registry item — `divider`, `loader`, `radio`, `progress-bar`, `toast`, `menu`, `form`, `tree`, `layout`, `segmented` — is source from before that name was renamed, split, or removed. See [renames.md](./renames.md) for the full table. ### Slower check: does an installed component's shape match its current docs? A folder can share today's name and still be out of date — `card`, `pagination` and `input-group` were not renamed, they were **recomposed**: the files are still called `card.component.ts`, but what they export changed shape. Compare the installed file against `get-component-docs` / the component's published Markdown. See [recompositions.md](./recompositions.md) for the concrete before/after of each. ### Concrete markers, if a fast grep is more useful than reading file by file | Found in the project | Means | | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | `@import '/css/tailwind'` in the global CSS (instead of `.../css/zard`) | Predates the `core` → `core` + `utilities` split ([927f8232](https://github.com/zard-ui/zardui/commit/927f8232)) | | A bare, unscoped `::-webkit-scrollbar { ... }` block appended to the global CSS | Predates the opt-in `scrollbar-thin` utility ([6c9e21ce](https://github.com/zard-ui/zardui/commit/6c9e21ce)) | | `ZardButtonGroupDividerComponent` / `z-button-group-divider` anywhere | Predates the button-group divider → separator rename ([93391360](https://github.com/zard-ui/zardui/commit/93391360)) | | A `toast` directory, or `ZardToastComponent` / `z-toast` / `z-toaster` | Predates the toast → sonner rename ([1fd63f15](https://github.com/zard-ui/zardui/commit/1fd63f15)) | | `textarea[z-input]` on a `