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 init

The 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-run prints 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
  1. Detects the framework: Next.js (App Router), Vite or React Router (framework mode).
  2. Detects the package manager from packageManager in package.json or the lockfile: npm, pnpm, Yarn or Bun.
  3. Installs @meridui/react, unless it is already a dependency.
  4. 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.
  5. Removes the global styles the project generator wrote that would override Merid (see below).
  6. Asks whether to add the rules file (AGENTS.md, .cursor/rules/merid.mdc, CLAUDE.md). A CLAUDE.md that already imports @AGENTS.md is left as it is.
  7. Asks whether to add the MCP config (.mcp.json, .cursor/mcp.json, .vscode/mcp.json). Other servers in those files are kept.
FrameworkDetected byStylesheet goes into
Next.jsnext dependencyapp/layout.tsx or src/app/layout.tsx
React Router@react-router/dev or react-router.config.tsapp/root.tsx
Vitevite 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:

TemplateFileRemoved
Vitesrc/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 Tailwindapp/globals.cssthe Arial body rule
Next.js without Tailwindapp/globals.css* { padding: 0; margin: 0 }, a { color: inherit }, Arial and colours on body, dark color-scheme
React Routerapp/app.cssthe 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 settings

Copies 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.

PatternPage
app-shellNavigation layouts
settingsSettings pages
authAuthentication
data-tableData tables
formsForms
confirmationsConfirmations
empty-and-loadingEmpty and loading states

mcp

npx @meridui/cli mcp --client cursor

Writes the MCP server config only. --client takes claude, cursor, vscode or all (the default), comma-separated.

doctor

npx @meridui/cli doctor

Checks 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

OptionCommandsEffect
--yes, -yallAnswer yes to every prompt, including overwriting files. Diffs are still printed.
--dry-runallPrint diffs and commands; write and run nothing.
--rules, --no-rulesinitAdd or skip the rules file without asking.
--mcp, --no-mcpinitAdd or skip the MCP config without asking.
--client <list>init, mcpclaude, cursor, vscode or all.
--dir <path>addFolder for pattern files.
--no-installinit, addDo not run the package manager; print the command instead.
--cwd <path>allRun in another folder.

In CI

npx @meridui/cli init --yes --no-install --rules --no-mcp
npx @meridui/cli doctor