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-agentsWhen components render unstyled or throw, run marigold doctor --format json to diagnose the project's setup (packages, versions, provider, theme, Tailwind, React peer deps) and apply the returned suggestion for each issue:
marigold doctor --format jsonThe 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 doctor
Diagnose why Marigold isn't working in a project and print a checklist with actionable fixes, ideal when components render unstyled or throw, and for AI agents to self-diagnose and repair a setup. All checks read the filesystem only; the freshness check additionally makes a short, best-effort fetch of the docs manifest (skipped with --offline).
marigold doctor # run from your project root
marigold doctor --format json # structured report for AI agents / CI
marigold doctor --offline # skip the network; freshness uses the cache only| Flag | Description | Default |
|---|---|---|
--format | text or json output | text |
--offline | Skip the network; the freshness check uses the cache only |
It checks, against the current working directory:
- Packages installed —
@marigold/components,@marigold/system, and a theme (@marigold/theme-rui) are declared. - Package versions aligned — installed
@marigold/componentsand@marigold/systemmatch (they are released together). - Up to date — installed versions are the latest published (best-effort; skipped when offline).
- MarigoldProvider wraps the app — the root layout wraps the app in
<MarigoldProvider>. - Theme passed to MarigoldProvider — a
themeprop is passed to the provider. - Tailwind configured for Marigold — the CSS entry imports
tailwindcssand@marigold/theme-rui/theme.css, declares@sourcefornode_modules/@marigold, and the framework build plugin is wired up. - React version compatible — installed React satisfies
@marigold/components's peer requirement.
Safe for CI
Only deterministic, definitely-broken findings (a missing core package, or a
components/system version mismatch) are errors; everything heuristic is a
warning. marigold doctor exits 1 only when there is an error. --format json emits { errors, warnings, passed, text }, so an agent can derive
health from errors.length === 0 and act on each suggestion.
marigold migrate
Apply codemods for a breaking Marigold release, to your theme files and your application code. Run it after upgrading @marigold/components, from your project root.
marigold migrate v18 # migrate the current directory
marigold migrate v18 ./src --dry-run # report what would change, write nothing
marigold migrate # detect the installed version and confirm
marigold migrate v18 --only rename-imports # apply a subset, non-interactively| Flag | Description | Default |
|---|---|---|
--dry-run | Report what would change without writing files | |
--only <names> | Apply only these changes (comma-separated), skipping the selection step |
Both positionals are optional. Without a version, the installed @marigold/components is detected and the applicable migration is proposed for confirmation. Without a path, the current directory is used.
It anchors on imports rather than on file names or directory layout, so it works whatever your project structure is:
- Theme files (anchored on
ThemeComponent<'X'>from@marigold/system): restructures single-style components into the slot shape the new version requires, moving your classes verbatim, swaps a baseline style only when it still matches the old baseline byte for byte (proof you never customized it), stubs new slots ascva({}), and scaffolds theme files for components the new version requires. - Application code (anchored on
@marigold/componentsand@marigold/icons): renamed exports such as the icon migration, renamed compound components, renamed and removed props. - Design tokens: report-only, since token values are yours. Covers renamed or removed tokens you still reference, new tokens that component internals hardcode but your CSS does not define, and tokens that kept their name but changed meaning.
Anything that cannot be decided from the source, a spread that hides slots, a customized style, a DOM change your own CSS may target, becomes a warning pointing at the release notes, never a guess.
Dry run first
--dry-run prints the full report and writes nothing. Interactive runs
pre-analyze the project and list the changes that actually fire, so you can
deselect any of them before applying; report-only checks always run. Applying
twice is a no-op, so a partial run can be completed later. After an applied
run, your typechecker is the completeness check: the slot Records in
@marigold/system are exhaustive.
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 carries no identifier — no account, user, machine, or session ID. Nothing links one command to another or to you, so there is no usage history to build, export, or hand over. Events are sent fire-and-forget from a detached background process, so telemetry never blocks your command, delays output, or surfaces a network error.
What is sent
One event per command invocation, with these fields and nothing else:
| Field | Example | Notes |
|---|---|---|
command | docs | Which command ran |
args | { component: "Button" } | Flag presence and closed-set values only, see below |
cliVersion | 1.4.0 | Which release is in use |
nodeVersion | v24.3.0 | Which Node versions we still need to support |
platform | darwin | darwin, linux, or win32 |
exitCode | 0 | Whether the command succeeded |
durationBucket | 100-500 | A coarse bucket in ms, never an exact timing |
cacheHit | true | Whether the local docs cache was used |
isTTY | false | Whether output went to a terminal or a pipe |
isAIAgent | true | Whether an agent runtime env var was set |
receivedAt | 2026-07-30T14:00:00Z | Added server-side, truncated to the hour |
args keeps only flag presence and values from a closed set. Enum flags (--format, --section, --limit) are recorded as their validated value, or as invalid if unrecognised, so a typo is never echoed back. Identifier-shaped positionals (a component name, an example slug, a --category) are recorded only when they look like an identifier. Free-text is never sent — a marigold search query or a list --search term is recorded as used, so we learn that search was used but not what you searched for.
receivedAt is deliberately hour-granular: exact timestamps would let separate events be stitched back into a per-session sequence by timing alone, undoing the point of having no identifier.
What is never sent
- Your source code, file contents, file paths, or project names
- Search queries and any other free-form text you type
- Your name, email, username, hostname, or any account data
- Any persistent identifier, of any kind
- Your IP address is not stored. It's necessarily visible to our host in transit, as with any HTTP request, but it is never written into a telemetry record.
Events are deleted after 90 days, which covers release-over-release comparison, the longest window we analyse.
Why it's opt-out
Because there's nothing to consent to storing. We removed the per-machine identifier the CLI used to send, which means we can count invocations, not people — unique-user numbers come from public npm download counts instead. In exchange, the data stops being personal data, the CLI stops writing an identifier onto your device, and no per-user history exists to secure or hand over. An opt-in prompt would also be close to meaningless here: most runs are non-interactive, driven by AI agents in pipelines where no human is at a prompt to ask.
If this ever changes
This reasoning holds only as long as the payload stays identifier-free. If a future version needs to link events to a person or a machine, the default has to flip to opt-in rather than being disclosed after the fact.
Turning it off
marigold telemetry disable persists the preference for the machine. Per-invocation, either env var works:
MARIGOLD_TELEMETRY_DISABLED=1 marigold docs Button
DO_NOT_TRACK=1 marigold docs ButtonDO_NOT_TRACK follows the consoledonottrack.com convention, so setting it once opts you out of every tool that honours it. Telemetry is also suppressed automatically, with no configuration, when 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 (stores the telemetry preference) |
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 |