Files
stanza/apps/web/content/docs/cli.mdx
T
jake 678b5bc1af feat: add ui-shadcn-base, ui-shadcn-radix, and ui-tailwind modules; rename styling category to ui
- Rename `styling` → `ui` across the entire codebase (CATEGORIES array, docs, AGENTS.md, CLI tests, resolver, template tests, codemod runner); `ui` is `home: package` so shadcn installs into `packages/ui/` as a workspace dep rather than wiring directly into the app shell
- Add `ui-shadcn-base` (Tailwind v4 / CSS-first, no Radix peer) and `ui-shadcn-radix` (Tailwind v4 + Radix primitives) with full per-framework template sets for Next.js and TanStack Start: `components.json`, `globals.css`, `postcss.config.mjs`, `theme-provider.tsx`, shared `Button` + `utils.ts`; light/dark logos inlined from svgl
- Rename `styling-tailwind` → `ui-tailwind` to match the new category id; update its module definition to `category: "ui"` and `home: package`
- Add four new codemod builtins with tests: `add-array-entry-in-call` (inserts an element into a named array argument of any `CallExpression`), `replace-import` (rewrites a specifier in an existing import declaration), `set-html-attributes` (sets attributes on an HTML/JSX element by tag name or selector), `set-tsconfig-paths` (merges `compilerOptions` entries into a `tsconfig.json` AST node); register all four in the builtins index and export from `@stanza/codemods`
- Add `wrap-root-layout` builtin tests
- Update registry.mdx, concepts.mdx, cli.mdx, getting-started.mdx, agents.mdx, index.mdx, AGENTS.md, README.md, TODO.md, and SKILL.md to reflect the category rename and new modules
2026-05-25 15:26:08 -04:00

4.5 KiB

title, description
title description
CLI The Stanza command-line verbs, flags, and environment variables.

Stanza ships five verbs against the category taxonomy. Run any verb with --help for its full flag list:

npx stanza-cli add --help

init

Scaffold a new monorepo. Without flags it launches an interactive wizard; with --yes it takes every pick from flags.

npx stanza-cli init [name] --yes --framework=next --orm=drizzle --db=postgres --pm=pnpm
  • name — project directory name (positional; prompted if omitted).
  • --yes — non-interactive; take selections from category flags.
  • --<category>=<ids> — pick modules for a category. One flag per category (--framework, --ui, --db, --orm, --auth, --tooling, --testing); single-choice categories take one id, multi-choice categories take a comma-separated list. Omitted categories are skipped — --yes chooses no defaults.
  • --pm=<pnpm|bun|npm> — package manager recorded in the manifest.

init always scaffolds a single web app today — { id: "web", dir: "apps/web", kind: "web" } in stanza.json — and tags every app-home record with apps: ["web"]. Multi-app init (scaffolding apps/native alongside apps/web, for example) is planned; the schema and runtime already support it. See Concepts → Apps.

add

Add one module to an existing project.

npx stanza-cli add <category> <module> [--app=<id>]

Resolves peers, selects the matching adapter, and writes the module's templates, deps, env, and scripts to the right home. Adding a module to a single-choice category that's already filled fails until you remove the existing one — and that limit is per app for home: "app" categories (so picking a framework for one app doesn't block a different framework for another).

  • --app=<id> — pick which app the install targets. Required for app-relevant modules when the project has multiple apps and you're not running inside one of them. Single-app projects auto-target; multi-app projects also auto-pick when cwd is inside one app's directory. Interactive runs (TTY, no --yes) fall back to a prompt; non-interactive runs error out asking for the flag.
  • The flag is meaningless for home: "repo" modules like tooling.

remove

Remove a module and sweep the files (regions) it owns.

npx stanza-cli remove <category> [id] [--app=<id>]

For single-choice categories the id is optional; for multi-choice categories (like testing) it's required. --app=<id> scopes removal in projects with multiple apps — without it, remove looks across every app for a matching record.

The package-dir sweep (when removing the last module under packages/<dir>/) strips the workspace:* dep from every app's package.json, not just the first one.

list

Print installed modules, grouped by category, from the nearest stanza.json.

npx stanza-cli list

List registry modules and their category/id pairs. Pass a query to filter.

npx stanza-cli search [query]

Use the printed id (not the display label) when passing a module to add.

**Planned:** `swap` (replace a module with another in the same category) and `update` (re-pull a module at a newer version) are on the roadmap. The manifest already reserves the fields they need; the verbs aren't implemented yet.

Global flags

These apply to the mutating verbs (init, add, remove):

  • --dry-run — print the actions that would be taken and write nothing.
  • --dangerously-allow-dirty — allow a mutating command to run with a dirty git working tree. By default Stanza refuses, so its edits never mix with uncommitted changes. Commit or stash first when you can.
  • --no-telemetry — disable anonymous usage events for this invocation.

Environment variables

  • STANZA_REGISTRY=<url-or-path> — use a custom or self-hosted registry (HTTP URL or filesystem path) instead of the default.
  • STANZA_NO_NPM_LOOKUP=1 — skip npm version lookups and write dependency ranges verbatim.
  • STANZA_NPM_REGISTRY=<url> — override the npm registry used for version lookups.
  • STANZA_TELEMETRY=0 / DO_NOT_TRACK=1 — disable telemetry persistently. Telemetry is also auto-skipped in CI.

Dependency versioning

On init and add, Stanza bumps each ^/~ dependency range to the latest npm version that satisfies it, keeping the modifier. Other ranges and workspace:* specifiers are written as-is. When offline, it falls back to the range declared in the module.