Skip to content

garn-ui

CLI reference

The npm package garn-ui provides the garn command — run it as npx garn-ui <command>, no global install. To set up a project step by step, start with the installation guide.

Commands

Most projects only need install, add, and status. Setup walkthroughs — new projects, Vite, agent setup, the shadcn CLI — live in the installation guide.

  • installStart here
    npx garn-ui install [name...]

    Runs init and add in one command. Use it when you want to set up garn and copy in your first components.

  • initSet up the project
    npx garn-ui init [--registry <url|dir>] [--force]

    Creates garn.json, adds the shared helper and theme, wires the global stylesheet when it can, and writes the project rules file.

  • addAdd components
    npx garn-ui add [name...]

    Resolves registry dependencies, copies source into your project, and installs the packages that source imports. With no names in a terminal, it offers a checklist.

  • listBrowse the registry
    npx garn-ui list

    Prints the components available from the registry configured for the current project.

  • statusCheck local edits
    npx garn-ui status

    Compares tracked files with their recorded integrity and reports each component as unmodified, edited, missing, or untracked (added before integrity was recorded).

  • mcp installConnect an AI client
    npx garn-ui mcp install [--client <name>] [--direct]

    Registers the garn MCP server with Claude Code, Cursor, or VS Code so an agent can query and review the component system.

  • mcpRun the MCP server
    npx garn-ui mcp

    Runs the MCP server over stdio, sub-loading garn-mcp. This is what a registered client executes; you rarely run it by hand.

Options

--yes
Accept prompts. Useful for scripts, CI, and agent-run setup.
--registry <url|dir>
Use a different registry URL or a local registry directory.
--force
init: overwrite an existing garn.json.
--overwrite
Replace files that differ from the registry copy.
--no-overwrite
Keep existing files that differ from the registry copy.
--no-mcp
init/install: skip the offer to register the MCP server.
--no-install
init/install: skip the missing-peer package installs.
--no-input
Force non-interactive behavior, even in a terminal.
--client <name>
Choose claude, cursor, or vscode for mcp install.
--direct
Register garn-mcp directly instead of routing through garn-ui.
--allow-http
Allow a non-loopback http:// registry explicitly.

The CLI also prints the complete command reference:

npx garn-ui --help

What gets written

garn is source-first. The CLI writes into your project and records enough context for you to understand what it added.

garn.json
Registry URL, component and library aliases, and the provenance manifest used by status.
components/ui/*
The component source, mapped to your configured ui alias.
lib/* and garn-theme.css
Shared helpers, hooks, and the Tailwind v4 token theme required by the components.
.garn/rules.md
Project guidance for keeping garn usage, tokens, and accessibility consistent.

Existing files are never silently treated as disposable. In a terminal, garn asks before replacing changed files; in a non-interactive run it reports the overwrite unless you pass --no-overwrite.

Local edits and updates

garn does not merge component updates into your implementation. You decide when to replace a copied file, and status shows what would be affected.

Reviewnpx garn-ui status

Find components that are unmodified, locally edited, missing, or untracked.

Keep local codenpx garn-ui add button --no-overwrite

Leave changed files untouched while adding anything new.

Accept an updatenpx garn-ui add button --overwrite

Replace the copied file with the current registry version.

Treat --overwrite as an intentional update. Review the resulting diff and keep your project changes in version control.

Registry and trust

garn uses the hosted registry by default:

default registry
https://garn.ohuba.com/r

Use --registry <url|dir> for a different HTTPS registry or a local directory. The environment variable GARN_REGISTRY is also supported.

Review what you add

  • Registry items are validated before the first file is written.
  • Items can only write component, library, app, and garn configuration paths.
  • The CLI blocks traversal, protected directories, and unsafe package-manager arguments.
  • Adding a component can run your package manager, so review both source and dependencies.
  • HTTPS is required for remote registries; plaintext HTTP requires an explicit opt-in.

The registry origin is the trust boundary. garn validates the shape and destination of registry content, but it does not pin a remote registry to immutable content hashes.

Next steps