CLI
Command-line tool for managing Hareru UI components and CSS imports
@hareru/cli generates CSS imports, inspects component details, and auto-detects your project setup.
Installation
npm install -g @hareru/cli
# or use directly with npx
npx @hareru/cliCommands
hareru list
List all components grouped by category.
hareru list
hareru list --group form
hareru list --jsonhareru info <name>
Show details for a component or task bundle. Output includes variants, props, slot tree (compound components), states, accessibility notes, and usage examples when available.
hareru info Button
hareru info agent-chat-shellhareru init
Initialize Hareru UI in your project. Generates a managed CSS block and hareru.json config.
hareru init # Dry-run preview (auto-detects mode + framework)
hareru init --write # Apply changes
hareru init --write --mode tailwind # Specify CSS mode
hareru init --write --force # Overwrite existing configThe init command:
- Auto-detects your framework (Next.js, Vite, Remix, Astro) and recommends a CSS mode
- Creates a managed block in your CSS file with
/* hareru:start managed */markers - Generates
hareru.jsonconfiguration in your project root - Adopts existing
@hareru/imports into the managed block automatically - Validates Tailwind CSS import ordering when using
tailwindmode
Managed block example (standalone):
/* hareru:start managed */
@import '@hareru/ui/styles.css';
/* hareru:end */Managed block example (tailwind):
/* hareru:start managed */
@layer theme, base, hui, components, utilities;
@import '@hareru/tokens/css';
@import '@hareru/ui/styles/components.layer.css';
/* hareru:end */
@import 'tailwindcss'; /* app-managed, outside the block */The
@import 'tailwindcss'line is not included in the managed block. You manage it yourself.
Init options:
| Flag | Description |
|---|---|
--mode <mode> | CSS mode: standalone, portable, tailwind (auto-detected if omitted) |
--css-file <path> | CSS file to write to (resolved from cwd; auto-detected if omitted) |
--framework <fw> | Framework: next, vite, remix, astro (auto-detected if omitted) |
--write | Apply changes (without this flag, shows dry-run preview) |
--scope | Add styles/scope.css import |
--baseline | Add styles/baseline.css import |
--layer | Use layer-wrapped CSS variant |
--force | Overwrite existing config and managed block |
--json | JSON output |
hareru add <name>
Generate CSS import statements for a component or bundle.
hareru add Dialog
hareru add Dialog --mode tailwind
hareru add agent-chat-shell --writehareru update
Change the CSS mode of an existing project. Only modifies content inside the managed block.
hareru update --mode portable # Preview changes
hareru update --mode portable --write # Apply changes
hareru update --scope --write # Add scope.css without changing modeThe update command:
- Reads
hareru.jsonand the managed block from your CSS file - Shows a diff of what will change (imports to add/remove)
- Only touches content inside
/* hareru:start managed */.../* hareru:end */ - Warns about any
@hareru/imports found outside the managed block - Updates
hareru.jsonmode when--writeis applied
Update options:
| Flag | Description |
|---|---|
--mode <mode> | New CSS mode: standalone, portable, tailwind (keeps current if omitted) |
--scope | Add styles/scope.css import |
--baseline | Add styles/baseline.css import |
--layer | Use layer-wrapped CSS variant |
--write | Apply changes (diff preview by default) |
--json | JSON output |
@import 'tailwindcss'is app-managed. Theupdatecommand does not add or remove it.
CSS Modes
| Mode | Description | Available in |
|---|---|---|
standalone | All-in-one bundle (styles.css) | init, update, add |
portable | Tokens + component bundle, no reset | init, update, add |
tailwind | Cascade Layers for Tailwind v4 coexistence | init, update, add |
per-component | Individual CSS files for minimal bundle | add only |
adddefaults toper-componentwhen--modeis not specified.initauto-detects the best mode based on your project (Tailwind detected →tailwind, existing CSS reset →portable, otherwise →standalone).
Auto-Detection
The CLI automatically detects:
- CSS entry file — Searches common paths (
globals.css,index.css,app.css, etc.) - Package manager — pnpm, npm, yarn, bun (monorepo-aware lockfile discovery)
- Framework — Next.js, Vite, Remix, Astro (for
initcommand) - CSS mode — Recommends
tailwindwhen Tailwind is detected,portablewith existing resets,standaloneotherwise