# Installation

Werewolf installs with one CLI, published on npm as `werewolf-ui@0.1.0-beta.4` (beta). `init` sets up your app once, `add` copies the components you need into it, and `theme` changes the look.

## 1. Requirements

Init checks all of these and lists every one your app misses.

- React 19, declared in `package.json` and installed, in a Next.js, Vite or other React TypeScript app (not Next.js and Vite in one `package.json`).
- Tailwind CSS v4, declared and installed, and one app CSS file with a single `@import "tailwindcss";` (`app/globals.css` or `src/app/globals.css` in Next.js, `src/index.css` in Vite), or pass `--css <file>`.
- TypeScript with an import alias for your components, for example `"@/*": ["./src/*"]` in `tsconfig.json`.
- Run the commands in the app root, not a workspace root, or select the app with `--cwd`.
- Node 20+, and one lockfile from npm, pnpm, yarn or bun, or pass `--package-manager`.

## 2. Initialize your app

```bash
npx werewolf-ui init
```

Run init once. It creates `werewolf.json`, `tokens/seed.json` and `styles/werewolf.css`, adds the CSS import after your Tailwind import, and installs the agent rules. An existing valid seed is preserved. You do not need to add a CSS import by hand. Both light and dark tokens are installed. `:root` takes the mode your app already shows, or light for a new app, and you choose it with `--color-mode light|dark|system`.

Init writes `AGENTS.md`, the [design skill](https://www.werewolf-ui.dev/docs/design-skill.md) and the rule file of each coding agent it finds (Cursor's rule is always included). Name your agents with `--agent`, for example `--agent claude,copilot`; [AI agents and MCP](https://www.werewolf-ui.dev/docs/agents.md) lists the files per agent.

The CLI detects your package manager from the lockfile or the `packageManager` field. If neither exists, choose one explicitly, for example with `--package-manager npm`. If several lockfiles exist or they disagree, select the app and package manager explicitly.

## 3. Add components

```bash
npx werewolf-ui add button
npx werewolf-ui add button input dialog
```

After init, add one or more components by name. Add installs their component and package dependencies, maps imports to your app's compiler aliases (by default `@/components/ui/<name>`) and preserves your seed and generated theme. Identical files are skipped.

The CLI carries its own copy of the catalog. A component that is newer than your CLI version returns `WW_COMPONENT`; install it from the registry instead, as shown in [Troubleshooting](https://www.werewolf-ui.dev/docs/troubleshooting.md).

## Native apps

```bash
npx werewolf-ui init --platform ios
npx werewolf-ui init --platform android
npx werewolf-ui add button --platform ios
npx werewolf-ui add button --platform android
```

`init --platform ios` or `init --platform android` writes `werewolf.json`, the seed when it is absent, the token files and the runtime. It does not run a package manager and it does not install web components. `--project` selects one Xcode project when the directory contains several. `--module` selects a Gradle module, including a library module or a multi-module root.

iOS files go in `Sources/Generated`, or `native.ios.directory` when that is set. Tokens go in `Tokens` and the runtime in `Runtime`. Android uses `native.android.package` when that is set, otherwise the app module namespace, otherwise `package` in `src/main/AndroidManifest.xml`, otherwise `dev.werewolfui`. The folder is `src/main/kotlin/<package>`, with `tokens` and `runtime` under it. Kotlin packages are `<package>.tokens` and `<package>.runtime`.

Init checks Geist and JetBrains Mono by font file name and names only the families that are missing, with the SIL Open Font License, Version 1.1. It never adds font files.

Native components today: Accordion, Alert, AlertDialog, AttachmentPreview, Avatar, AvatarStack, Badge, BottomNav, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Chart, Checkbox, Checklist, CodeBlock, ColorPicker, Combobox, Composer, ContextMenu, ConversationList, Counter, DataTrend, DatePicker, Dialog, DropdownMenu, EmojiPicker, EmptyState, Field, GroupAvatar, Image, Input, Kbd, Label, Link, List, MessageActions, MessageBubble, MessageList, Metadata, NumberInput, OtpInput, Pagination, Popover, Progress, RadioGroup, Rating, Select, Separator, Sheet, Skeleton, Slider, SortableList, Spinner, Stepper, Switch, Table, Tabs, Textarea, Timeline, TimePicker, Toast, Toggle, ToggleGroup, Token, Tokenizer, Tooltip. `add <name> --platform ios` writes the Swift file beside `Tokens`. `add <name> --platform android` writes the Kotlin file beside `tokens` and rewrites the package. A component with no native status returns `WW_NATIVE_UNSUPPORTED`. A remote name or an item URL with `--platform` is rejected. [CLI](https://www.werewolf-ui.dev/docs/cli.md) lists every code.

## 4. Customize your theme

Preview a theme with the Theme panel in the header: accent, gray tint and radius. Copy command gives you the theme command with your choices, or replace `<hex>` below with your own color. The command updates your seed and regenerates the stylesheet; omitted choices are preserved. [Theming](https://www.werewolf-ui.dev/docs/theming.md) covers every option.

```bash
npx werewolf-ui theme --accent "<hex>"
```

## 5. Give your agent the rules

Have your agent read the [design skill](https://www.werewolf-ui.dev/docs/design-skill.md) before it writes UI. To let it look up components and tokens on its own, connect the [MCP server](https://www.werewolf-ui.dev/docs/agents.md). Init does not change your MCP client's settings.

## 6. Check the result

```bash
npx werewolf-ui lint src
npx werewolf-ui lint src --fix
```

Lint reports hardcoded colors, unknown tokens, arbitrary spacing and other styling the system does not allow. `--fix` applies only proven edits.

## Let your agent run the setup

Prefer not to type commands? Paste this into your coding agent from the app directory. Replace `<id>` with your agent's id, or leave it: the prompt lists the ids, so the agent can pick its own.

```text
Run `npx werewolf-ui init --agent <id> --yes --json`. Use your tool's id: cursor, claude, copilot, windsurf, gemini, cline, codex, or other for anything else. Don't add --overwrite. If there's a conflict, stop and show me. Then tell me which files were created, updated or unchanged.
```

## Next steps

- [Using components](https://www.werewolf-ui.dev/docs/usage.md): sizes, token classes, dark and light mode.
- [Theming](https://www.werewolf-ui.dev/docs/theming.md): accent, gray tint, radius and token export.
- [AI agents and MCP](https://www.werewolf-ui.dev/docs/agents.md): rule files per agent and the MCP server.
- [CLI](https://www.werewolf-ui.dev/docs/cli.md): every command, option and exit code.

## Alternative: registry and manual setup

Every component also has a registry item URL, and `add` takes that URL in place of a name. Like any `add`, it needs `init` first. It sends no keys, refuses redirects and keeps the theme `init` wrote.

```bash
npx werewolf-ui add https://www.werewolf-ui.dev/r/button.json
```

To set up the styles without the CLI, save the token stylesheet as `styles/werewolf.css` and import it once in your root CSS, after `@import "tailwindcss"`, using a path relative to that file. From `app/globals.css`, the import is:

```css
@import "../styles/werewolf.css";
```

For this manual setup, use the Theme panel in the header (Copy CSS or Download) and replace `styles/werewolf.css`. Copy the [design skill](https://www.werewolf-ui.dev/docs/design-skill.md) into the folder your agent reads rules from.

Need only the default token stylesheet? [Download tokens.css](https://www.werewolf-ui.dev/tokens.css).
