CLI
@meridui/cli sets up Merid in an existing project. It detects the framework and package manager, installs @meridui/react, imports the stylesheet, and can add the AI rules file and MCP config. It can also copy the docs patterns into your code.
npx @meridui/cli initThe short form npx meridui init does the same thing. Inside a project that has @meridui/cli installed, the command is merid: npx merid init.
Safe by default
- Every change to a file is printed as a diff before it is written.
- An existing file is never overwritten without a yes. In a non-interactive shell (CI) existing files are skipped unless you pass
--yes. --dry-runprints the diffs and commands and writes or runs nothing.- Running a command twice changes nothing the second time.
- The CLI has no runtime dependencies and makes no network requests of its own; only the package manager does, when it installs.
Commands
init
npx @meridui/cli init- Detects the framework: Next.js (App Router), Vite or React Router (framework mode).
- Detects the package manager from
packageManagerinpackage.jsonor the lockfile: npm, pnpm, Yarn or Bun. - Installs
@meridui/react, unless it is already a dependency. - Adds
import "@meridui/react/styles.css";to the app entry, before your own CSS imports. When one of those loads Tailwind v4, the import goes after it instead, and the Tailwind file gets@layer theme, base, merid, components, utilities;so Preflight cannot override Merid. - Removes the global styles the project generator wrote that would override Merid (see below).
- Asks whether to add the rules file (
AGENTS.md,.cursor/rules/merid.mdc,CLAUDE.md). ACLAUDE.mdthat already imports@AGENTS.mdis left as it is. - Asks whether to add the MCP config (
.mcp.json,.cursor/mcp.json,.vscode/mcp.json). Other servers in those files are kept.
| Framework | Detected by | Stylesheet goes into |
|---|---|---|
| Next.js | next dependency | app/layout.tsx or src/app/layout.tsx |
| React Router | @react-router/dev or react-router.config.ts | app/root.tsx |
| Vite | vite dependency or vite.config.* | src/main.tsx |
Template styles
create-vite, create-next-app and create-react-router write global CSS outside any cascade layer, so it beats Merid's. init knows the rules each generator writes and removes the ones that clash with Merid:
| Template | File | Removed |
|---|---|---|
| Vite | src/index.css, src/App.css | :root font and colours, heading sizes, p, code, #root column; in templates before create-vite 9 also a, button and the flex-centred body |
| Next.js with Tailwind | app/globals.css | the Arial body rule |
| Next.js without Tailwind | app/globals.css | * { padding: 0; margin: 0 }, a { color: inherit }, Arial and colours on body, dark color-scheme |
| React Router | app/app.css | the html, body background |
A rule is only removed while it still matches what the generator wrote; once you edit it, it is yours. body { margin: 0 } and layout rules unrelated to Merid are kept. The file is shown as a diff and changed only after a yes, or with --yes. The installation guide explains why the rules are removed rather than moved into a layer.
add
npx @meridui/cli add settingsCopies a pattern's source into components/merid/ (or src/components/merid/, or app/components/merid/ for React Router) and offers to install what it imports. Pass --dir to choose the folder. The files are yours to change; running add again shows a diff against your copy and asks before replacing it.
| Pattern | Page |
|---|---|
app-shell | Navigation layouts |
settings | Settings pages |
auth | Authentication |
data-table | Data tables |
forms | Forms |
confirmations | Confirmations |
empty-and-loading | Empty and loading states |
mcp
npx @meridui/cli mcp --client cursorWrites the MCP server config only. --client takes claude, cursor, vscode or all (the default), comma-separated.
doctor
npx @meridui/cli doctorChecks that @meridui/react and React 18+ are installed, the stylesheet is imported, and whether the rules file and MCP config are present. It also warns when template styles that override Merid are still in your CSS, and when Tailwind's Preflight is layered above Merid. Exits with code 1 when a required check fails, so it can run in CI; the style warnings do not fail it.
Options
| Option | Commands | Effect |
|---|---|---|
--yes, -y | all | Answer yes to every prompt, including overwriting files. Diffs are still printed. |
--dry-run | all | Print diffs and commands; write and run nothing. |
--rules, --no-rules | init | Add or skip the rules file without asking. |
--mcp, --no-mcp | init | Add or skip the MCP config without asking. |
--client <list> | init, mcp | claude, cursor, vscode or all. |
--dir <path> | add | Folder for pattern files. |
--no-install | init, add | Do not run the package manager; print the command instead. |
--cwd <path> | all | Run in another folder. |
In CI
npx @meridui/cli init --yes --no-install --rules --no-mcp
npx @meridui/cli doctor