Marigold CLI
Component docs, discovery, and project setup, straight from the terminal.
The @marigold/cli package brings the Marigold documentation into your terminal: fetch component docs, discover components and pages, scaffold Marigold into an existing project, and more. It's useful on its own and is built to ground AI coding agents on the canonical component API.
Installation
Install the CLI globally with npm or pnpm, or run it one-off with npx:
Install globally so marigold is available everywhere:
npm install -g @marigold/cliInstall globally with pnpm:
pnpm add -g @marigold/cliRun a single command without installing anything:
npx @marigold/cli docs ButtonRequirements
The CLI requires Node 22 or newer. For instant component tab-completion,
install it globally rather than relying on npx / pnpm dlx.
Usage with AI agents
AI coding agents are the CLI's primary audience. When invoked by an agent, prefer --format json together with --section props to get a structured, precise payload instead of formatted markdown:
# Structured prop data (recommended for AI agents)
marigold docs Select --section props --format json
# Discover components before writing code
marigold list --category form
marigold list --search dateTo adopt a whole feature pattern rather than a single component, use marigold examples to discover and retrieve application-level patterns, then read the framework-transformation note once:
marigold examples list
marigold examples get filter --format json
marigold docs getting-started/examples-for-agentsThe CLI detects common agent runtimes (Claude Code, Cursor, VS Code agent mode, Codex, or a generic AI_AGENT=1) via environment variables. For the full set of connection options (the MCP server and the public manifest / markdown endpoints), see Usage with AI.
Commands
marigold docs
Fetch and print the documentation for a component or a docs page.
marigold docs Button
marigold docs button --section props
marigold docs TextField --section props --format json
marigold docs select --format plain
marigold docs foundations/spacing
marigold docs getting-started/installationA request like marigold docs Badge --section props prints a focused, terminal-rendered view of just that section:
Props
Badge
| Prop | Type | Default | Description |
| :------- | :-------- | :------ | :------------------------ |
| children | ReactNode | - | Children of the component || Flag | Description | Default |
|---|---|---|
--section <name> | props, usage, examples, or all | all |
--format <name> | markdown, json, or plain | markdown |
--fresh | Bypass the local cache | |
--offline | Use only the local cache, fail if missing |
Pass a component name (case-insensitive, so Button, button, and BUTTON all resolve to the same component) or the slug of a non-component docs page (e.g. foundations/spacing, getting-started/installation). The props section is component-only. Requesting it for a page emits a note instead.
Output formats
The default markdown output is a best-effort terminal render. For
non-trivial docs prefer --format json (the recommended path for AI agents, a
structured payload) or --format plain (ANSI-stripped, ideal for piping into
other tools).
marigold list
List all available components and docs pages.
marigold list
marigold list --category form
marigold list --category foundations
marigold list --search date
marigold list --format json
marigold list --freshComponents and pages are grouped by category. For example, marigold list --category form prints:
Form
Autocomplete — A searchfield that displays a dynamic list of suggestions.
Calendar — A date selection interface for choosing dates from a calendar view.
Checkbox — Component to select one or more options.
ComboBox — A text-field that allows the user to select values from a provided items array.
…
TextField — Component for input forms.
TimeField — Component for entering time in forms.| Flag | Description | Default |
|---|---|---|
--category <name> | Filter by category: component categories (actions, form, layout, …) and page categories (foundations, patterns, getting-started) | |
--search <term> | Substring filter on component and page names | |
--format <name> | markdown, json, or plain | markdown |
--fresh | Bypass the local cache | |
--offline | Use only the local cache, fail if missing |
marigold examples
Browse application-level reference patterns: multi-file compositions that show how Marigold components combine into real features (filterable tables, multi-section forms, component inventories). For how to adapt one to your own framework, see Adapting examples for agents.
marigold examples list # all available patterns
marigold examples get filter # one pattern's source + metadata
marigold examples get filter --format jsonSubcommands:
list: print every available example (slug, title, brief, mapped patterns)get <slug>: fetch a single example: its source files, the canonical pattern docs it maps to, the mock-data shapes it depends on, which files are load-bearing vs. framework scaffolding, and its peer dependencies
| Flag | Description | Default |
|---|---|---|
--format <name> | markdown, json, or plain | markdown |
--fresh | Bypass the local cache | |
--offline | Use only the local cache, fail if missing |
Adapting examples
Examples are authored Next.js App Router-first. Before porting one to another
framework, read the transformation note with marigold docs getting-started/examples-for-agents. It covers stripping 'use client',
swapping router / URL-state libraries, the export split, @/ alias
adjustments, and replacing the docs-internal mock data.
marigold init
Interactive wizard to set up Marigold in an existing project.
marigold init
marigold init --yes # skip prompts, accept Tailwind + package install
marigold init --skip-install # apply config edits without running the install| Flag | Description | Default |
|---|---|---|
--yes | Skip prompts, accept the Tailwind and package install | |
--skip-install | Apply config edits without running the package install |
It detects Next.js or Vite, then:
- Installs
@marigold/components,@marigold/system,@marigold/theme-rui, plus Tailwind v4 and the framework adapter (@tailwindcss/postcssfor Next.js,@tailwindcss/vitefor Vite) if Tailwind isn't already present. The Tailwind install is gated behind a confirmation prompt unless--yesis passed. - Patches your global CSS (
app/globals.css,src/app/globals.css,src/index.css, orstyles/globals.css) with the required@importand@sourcelines, preserving existing rules. - Patches
vite.config.ts(Vite) or writespostcss.config.mjs(Next.js) if missing. - Wraps the root: creates
app/providers.tsxand wraps{children}inapp/layout.tsx(Next.js), or wraps<App />insrc/main.tsx(Vite).
Safe to re-run
Re-running marigold init leaves already-configured files untouched, so
running it more than once is safe. If a file's shape can't be recognized, the
CLI prints a manual fallback for that step instead of guessing.
marigold completion
Print a tab-completion script for bash, zsh, or fish. Source it once per shell, or write it to your shell's completion directory for persistence.
# bash: current shell
source <(marigold completion bash)
# bash: persistent (with bash-completion installed)
marigold completion bash > ~/.local/share/bash-completion/completions/marigold
# zsh: persistent (ensure $fpath includes the dir, then run compinit)
marigold completion zsh > "${fpath[1]}/_marigold"
# fish
marigold completion fish > ~/.config/fish/completions/marigold.fishTab-completes subcommands, flag names, enum values (e.g. --format markdown|json|plain), categories (marigold list --category <TAB>), and component names (marigold docs <TAB>). Component and category suggestions are sourced from the local manifest cache. Run marigold list once to warm it.
PowerShell not supported
Tab-completion is available for bash, zsh, and fish only. PowerShell is
not yet supported.
marigold telemetry
Opt in or out of anonymous usage telemetry.
marigold telemetry status
marigold telemetry disable
marigold telemetry enableTelemetry is on by default and sent fire-and-forget via a detached background process. It never blocks the foreground command or surfaces network errors. Each event records the command name, CLI version, Node version, platform, exit code, a coarse duration bucket, cache hit/miss, a stable anonymous UUID, whether stdout is a TTY, whether the CLI was invoked by an AI agent, and which flags were passed (values redacted, only flag presence or enum value is kept, and free-form --search terms are recorded as used, never the term itself).
Telemetry is automatically suppressed when:
MARIGOLD_TELEMETRY_DISABLED=1is setDO_NOT_TRACK=1is set (consoledonottrack.com standard)- CI is detected (via
ci-info, covering GitHub Actions, GitLab CI, CircleCI, etc.)
Global flags
| Flag | Description |
|---|---|
-h, --help | Print usage |
-v, --version | Print the installed CLI version |
Configuration
Every variable below is optional, the CLI works out of the box. Set one only to override a default (e.g. point at a self-hosted docs site, change the cache TTL, or opt out of telemetry).
| Variable | Description |
|---|---|
MARIGOLD_DOCS_URL | Override the docs site base URL (default: https://www.marigold-ui.io) |
MARIGOLD_CACHE_TTL_MS | Override the default 24h cache TTL (in milliseconds) |
MARIGOLD_CACHE_DIR | Override the cache directory location |
MARIGOLD_CONFIG_DIR | Override the config directory (telemetry preference + anonymous ID) |
MARIGOLD_TELEMETRY_DISABLED=1 | Opt out of telemetry |
DO_NOT_TRACK=1 | Opt out of telemetry (standard) |
CI | Auto-detected, suppresses telemetry when set |
CLAUDECODE, CURSOR_AGENT, VSCODE_AGENT, CODEX_SANDBOX, AI_AGENT | When set, the run is tagged as agent-driven in telemetry |
Default cache and config locations:
| Linux / macOS | Windows | |
|---|---|---|
| Cache | $XDG_CACHE_HOME/marigold | %LOCALAPPDATA%\marigold |
| Config | $XDG_CONFIG_HOME/marigold | %APPDATA%\marigold |