# CLI

Use the Zenos command-line tool to find components, set up AI, and add editable recipes.

The CLI is a tool you run in your terminal. Use it to find a component, help your AI use Zenos, or add a ready-made feature such as a date picker.

Choose what you want to do:

- **Find a component:** `zenos component Dialog` → Import path + docs. Read the answer in your terminal.
- **Set up your AI:** `zenos init --features agents` → AGENTS.md. Instructions your assistant can read.
- **Add a date picker:** `zenos add calendar` → Editable files in your app. Recipe source + its extra dependency.

## Start here

Open a terminal in your app's folder, where `package.json` lives. You need Node.js 20 or newer. For recipes, [install Zenos UI](/getting-started/installation/) first.

### Run the CLI directly

You can use the CLI without installing it in your project. Run `bunx @zentara-co/zenos-cli <command>`, `npx @zentara-co/zenos-cli <command>`, or use another package runner such as `pnpm dlx` or `yarn dlx`.

Choose your package manager below. Your selection applies to every command on this page.

```bash
pnpm dlx @zentara-co/zenos-cli component Dialog
npx @zentara-co/zenos-cli component Dialog
yarn dlx @zentara-co/zenos-cli component Dialog
bunx @zentara-co/zenos-cli component Dialog
```

You should see the component's import path and documentation link:

```text
Dialog (component)
Import: @zentara-co/zenos-ui
Docs path: /components/dialog/
```

The command also reminds you to check the installed types for exact props. Lookups print information; they do not change your app.

<details>
<summary>Prefer a local CLI installation?</summary>

You can optionally add the CLI to your development dependencies to pin its version:

```bash
pnpm add -D @zentara-co/zenos-cli
npm install -D @zentara-co/zenos-cli
yarn add -D @zentara-co/zenos-cli
bun add -d @zentara-co/zenos-cli
```

Commit `package.json` and your lockfile so your team uses the same version. Run the installed executable with `pnpm exec zenos <command>`, `npm exec -- zenos <command>`, `yarn exec zenos <command>`, or `bunx --no-install zenos <command>`.

The examples below run the published package directly.

</details>

## Find a component

List the catalog, then look up the component you need:

```bash
pnpm dlx @zentara-co/zenos-cli component --list
npx @zentara-co/zenos-cli component --list
yarn dlx @zentara-co/zenos-cli component --list
bunx @zentara-co/zenos-cli component --list
```

Names such as `Dialog`, `Stack`, `useTheme`, and `split-button` all work. A lookup gives you a public import path, a docs path, and any component-specific notes. Read the linked docs for examples and the installed TypeScript declarations for exact props.

For shorter output to give an AI, add `--dense`:

```bash
pnpm dlx @zentara-co/zenos-cli component Dialog --dense
npx @zentara-co/zenos-cli component Dialog --dense
yarn dlx @zentara-co/zenos-cli component Dialog --dense
bunx @zentara-co/zenos-cli component Dialog --dense
```

You can also look up a shared rule, such as the prop naming conventions:

```bash
pnpm dlx @zentara-co/zenos-cli docs api --dense
npx @zentara-co/zenos-cli docs api --dense
yarn dlx @zentara-co/zenos-cli docs api --dense
bunx @zentara-co/zenos-cli docs api --dense
```

<details>
<summary>All guidance topics and version details</summary>

Available topics: `accessibility`, `api`, `architecture`, `organization`, `react`, `recipes`, `security`, `styling`, `testing`, and `typescript`.

The catalog ships with the CLI. Keep your CLI and UI versions aligned; when they differ, the installed UI types determine which APIs you can use. The CLI does not inspect the UI package to build its catalog.

</details>

## Set up your AI

```bash
pnpm dlx @zentara-co/zenos-cli init --features agents
npx @zentara-co/zenos-cli init --features agents
yarn dlx @zentara-co/zenos-cli init --features agents
bunx @zentara-co/zenos-cli init --features agents
```

This creates or updates the Zenos instructions inside `AGENTS.md`. Your AI reads them to learn which commands and components to use. Your own instructions outside the Zenos block stay in place.

Continue to [Working with AI](/getting-started/working-with-ai/) to choose your tool and try your first prompt.

For an optional workflow that guides feature development, install the skill:

```bash
pnpm dlx @zentara-co/zenos-cli init --features skills
npx @zentara-co/zenos-cli init --features skills
yarn dlx @zentara-co/zenos-cli init --features skills
bunx @zentara-co/zenos-cli init --features skills
```

This writes `zenos-app-development` under `.agents/skills` for Codex and Cursor. Use `--agent claude` for `.claude/skills`, or `--agent all` for both locations. Add `--dry-run` to preview. Existing skill contents are preserved unless you explicitly use `--overwrite`.

See [Add the development skill](/getting-started/working-with-ai/#add-the-development-skill) for usage and updates.

## Add a recipe

A recipe is component source copied into your app. You can edit it. It also installs any extra library that the feature needs.

Try Calendar, which includes a calendar, date picker, and date-range picker:

### 1. Preview the changes

```bash
pnpm dlx @zentara-co/zenos-cli add calendar --dry-run
npx @zentara-co/zenos-cli add calendar --dry-run
yarn dlx @zentara-co/zenos-cli add calendar --dry-run
bunx @zentara-co/zenos-cli add calendar --dry-run
```

In an interactive terminal, the CLI first asks for a directory. Press Enter to accept the detected folder, or type another path. You will then see the destination files and any missing dependencies. `--dry-run` makes no changes to your project.

### 2. Install the files

```bash
pnpm dlx @zentara-co/zenos-cli add calendar
npx @zentara-co/zenos-cli add calendar
yarn dlx @zentara-co/zenos-cli add calendar
bunx @zentara-co/zenos-cli add calendar
```

The CLI installs `@daypicker/react` if needed and copies three files into your component folder:

```text
Your component folder/
├── calendar.tsx
├── date-picker.tsx
└── date-range-picker.tsx
```

### 3. Use the component

Check the paths printed by the command. For example, if it created `src/components/date-picker.tsx`, a file in `src/pages` can import it like this:

```tsx
import { DatePicker } from "../components/date-picker";
```

Follow the [Calendar examples](/recipes/calendar/) to render it, then run your app's checks. You own the copied files and can adjust their styling and behavior.

<details>
<summary>Other recipes you can add</summary>

- [animated-number](/recipes/animated-number/): `animated-number.tsx`, using `@number-flow/react`.
- [animated-label](/recipes/animated-label/): `animated-label.tsx`, using native browser animations with no extra dependency.

Replace `calendar` in the command with one of these names:

- [carousel](/recipes/carousel/): `carousel.tsx`, using `embla-carousel-react`.
- [chart](/recipes/chart/): `chart.tsx`, using `recharts`, plus missing chart theme tokens.
- [data-table](/recipes/data-table/): `data-table.tsx`, using `@tanstack/react-table`.
- [file-upload](/recipes/file-upload/): `file-upload.tsx`, using `react-dropzone`.
- [time-picker](/recipes/time-picker/): `time-picker.tsx`, `time-range-picker.tsx`, and `time-picker.css`, using `timepicker-ui-react` and `timepicker-ui`.

Only missing dependencies are installed.

</details>

## Options and troubleshooting

<details>
<summary>Where do files go? Which package manager runs?</summary>

The CLI starts at the nearest `package.json`. Choose a destination with `--dir`:

```bash
pnpm dlx @zentara-co/zenos-cli add calendar --dir src/_components/ui
npx @zentara-co/zenos-cli add calendar --dir src/_components/ui
yarn dlx @zentara-co/zenos-cli add calendar --dir src/_components/ui
bunx @zentara-co/zenos-cli add calendar --dir src/_components/ui
```

Relative paths are resolved from that project root, even when you run the command from a nested folder. Absolute paths are also accepted. A missing destination is created during installation; quote paths containing spaces. `--dir=src/_components/ui` is equivalent. Use the same option with `--dry-run` to preview files or `--overwrite` to replace recipe files at that destination. Adjust your recipe imports to match the selected folder.

Without `--dir`, an interactive terminal asks where to put the recipe files. Press Enter to accept the suggested directory or type a relative or absolute path. Ctrl+C or end-of-input cancels before dependencies are installed or files are copied. Passing `--dir` skips the prompt. Non-interactive runs, including piped commands, use the detected directory automatically.

The suggested directory comes from existing UI folders checked in this order:

```text
src/_components/ui → src/components/ui
src/app/_components/ui → src/app/components/ui
app/_components/ui → app/components/ui
_components/ui → components/ui
```

If none exists, it checks `_components` and `components` under the same roots and in the same order. Within a root, `_components` takes precedence. Only existing directories qualify; a file named `ui` is ignored. If no component directory exists, an alias pointing into `src` selects `src/components/ui`. Otherwise, it creates `src/components` when `src` exists, or `components` at the project root.

Lockfiles select the package manager: pnpm, Bun, Yarn, then npm, checked from the project directory upward. Without a lockfile, the CLI checks `packageManager` in `package.json`, then falls back to npm. Use `--dry-run` to see the detected manager and destination.

</details>

<details>
<summary>Recipe files already exist</summary>

The CLI stops before installing or copying anything. To keep your edits, leave the files in place. To replace all files in the recipe, review or commit your changes first, then run:

```bash
pnpm dlx @zentara-co/zenos-cli add calendar --overwrite
npx @zentara-co/zenos-cli add calendar --overwrite
yarn dlx @zentara-co/zenos-cli add calendar --overwrite
bunx @zentara-co/zenos-cli add calendar --overwrite
```

`--overwrite` replaces recipe source. It does not downgrade a dependency already declared by your app.

</details>

<details>
<summary>Chart tokens and missing stylesheets</summary>

Chart adds missing `--chart-1` through `--chart-5`, `--chart-grid`, `--chart-axis`, and `--chart-tooltip` tokens to the first recognized global stylesheet. Existing tokens stay unchanged.

If no stylesheet is found, the CLI reports it and the component uses its built-in fallback colors. See the [Chart guide](/recipes/chart/) for theme customization.

</details>

**No package.json found:** open the terminal in your app's folder.

**Zenos UI is missing:** follow [Installation](/getting-started/installation/) before adding a recipe.

**Command not found:** use the full package-runner command shown above, including `@zentara-co/zenos-cli`. Check that your chosen package runner is available.

For available commands and options:

```bash
pnpm dlx @zentara-co/zenos-cli --help
npx @zentara-co/zenos-cli --help
yarn dlx @zentara-co/zenos-cli --help
bunx @zentara-co/zenos-cli --help
```

Source: https://zenos-ui.pages.dev/getting-started/cli/