Skip to content

ant-design/ant-design-cli

Repository files navigation


Ant Design

@ant-design/cli

Ant Design on your command line.
Query component knowledge, analyze project usage, and guide migrations — fully offline.


npm version npm downloads CI License: MIT

English · 中文 · Changelog


🤔 Why

Code agents (Claude Code, Codex, Gemini CLI) write better antd code when they have instant access to the right API data. This CLI gives them exactly that — every prop, token, demo, and changelog entry for antd v4 / v5 / v6, bundled locally, queryable in milliseconds.

npx skills add ant-design/ant-design-cli    # install as an agent skill

✨ Highlights

  • 📦 Fully offline — All metadata ships with the package. No network calls, no latency, no API keys.
  • 🎯 Version-accurate — 55+ per-minor snapshots across v4/v5/v6. Query the exact API surface of [email protected], not just "latest v5".
  • 🤖 Agent-optimized--format json on every command. Structured errors with codes and suggestions. Clean stdout/stderr separation.
  • 🌍 Bilingual — Every component name, description, and doc has both English and Chinese. Switch with --lang zh.
  • 🔮 Smart matching — Typo Buttn? The CLI suggests Button using Levenshtein distance, with first-letter preference.
  • 🧩 13 commands — From prop lookup to project-wide lint, from design token queries to cross-version API diffing.

📦 Install

npm install -g @ant-design/cli
Other package managers
pnpm add -g @ant-design/cli
bun add -g @ant-design/cli

🤖 Agent Integration

The CLI ships with a skill file that teaches code agents when and how to use each command:

npx skills add ant-design/ant-design-cli

Or simply tell your code agent:

Install @ant-design/cli and the antd skill from ant-design/ant-design-cli

The agent will handle npm install, npx skills add, and start using the CLI automatically.

Works with Claude Code, Cursor, Codex, Gemini CLI, and any agent supporting the skills protocol.


🚀 Quick Start

antd info Button                    # Component props, types, defaults
antd demo Select basic              # Runnable demo source code
antd token DatePicker               # Design Token values (v5+)
antd semantic Table                 # classNames / styles structure
antd changelog 4.24.0 5.0.0 Select  # API diff across versions
antd doctor                         # Diagnose project issues
antd lint ./src                     # Check deprecated APIs & best practices
antd migrate 4 5 --apply ./src      # Agent-ready migration prompt

📖 Commands

📚 Knowledge Query

Command Description
antd list List all components with bilingual names, categories, and since versions
antd info <Component> Props table with types, defaults, since, and deprecated status
antd doc <Component> Full markdown documentation for a component
antd demo <Component> [name] Runnable demo source code (TSX)
antd token [Component] Global or component-level Design Tokens
antd semantic <Component> Semantic classNames / styles structure with usage examples
antd changelog Changelog entries, version ranges, or cross-version API diff

🔍 Project Analysis

Command Description
antd doctor 10 diagnostic checks: React compat, duplicates, peer deps, SSR, babel plugins
antd usage [dir] Import stats, sub-component breakdown (Form.Item), non-component exports
antd lint [target] Deprecated APIs, accessibility gaps, performance issues, best practices
antd migrate <from> <to> Migration checklist with auto-fixable/manual split and --apply agent prompt

🐛 Issue Reporting

Command Description
antd bug File a bug to ant-design/ant-design with auto-collected environment info
antd bug-cli File a bug to ant-design/ant-design-cli


antd list

antd list                           # all components
antd list --version 5.0.0           # components available in v5.0.0
Example output
Component       组件名     Description                                                Since
--------------  -------  -------------------------------------------------------  ------
Button          按钮       To trigger an operation.                                  4.0.0
Table           表格       A table displays rows of data.                            4.0.0
Form            表单       High performance Form component with data scope management. 4.0.0
Select          选择器      Select component to select value from options.            4.0.0
Modal           对话框      Modal dialogs.                                            4.0.0
ColorPicker     颜色选择器   Used for color selection.                                 5.5.0
...

antd info <Component>

antd info Button                    # props table
antd info Button --detail           # + descriptions, since, deprecated, FAQ
antd info Button --version 4.24.0   # v4 API snapshot
Example output
Button (按钮) — To trigger an operation.

Property         Type                                          Default   Since
---------------  --------------------------------------------  --------  ------
autoInsertSpace  boolean                                       true      5.17.0
block            boolean                                       false     -
classNames       Record<SemanticDOM, string>                   -         5.4.0
disabled         boolean                                       false     -
href             string                                        -         -
icon             ReactNode                                     -         -
loading          boolean | { delay: number, icon: ReactNode }  false     -
size             large | middle | small                        middle    -
type             primary | default | dashed | text | link      default   -
variant          outlined | dashed | solid | filled | text     -         5.13.0
onClick          (event: React.MouseEvent) => void             -         -

antd doc <Component>

antd doc Button                     # full markdown docs to stdout
antd doc Button --format json       # { name, doc }
antd doc Button --lang zh           # Chinese documentation

antd demo <Component> [name]

antd demo Button                    # list all available demos
antd demo Button basic              # get demo source code

antd token [Component]

antd token                          # global tokens (colorPrimary, borderRadius, ...)
antd token Button                   # component-level tokens

antd semantic <Component>

antd semantic Table
Example output
Table Semantic Structure:
├── header    # Table header area
├── body      # Table body area
├── footer    # Table footer area
├── cell      # Table cell
├── row       # Table row
└── wrapper   # Outer wrapper

Usage:
  <Table classNames={{ header: 'my-header' }} />
  <Table styles={{ header: { background: '#fff' } }} />

antd changelog [v1] [v2] [component]

antd changelog 5.22.0               # single version
antd changelog 5.21.0..5.24.0       # version range (inclusive)
antd changelog 4.24.0 5.0.0         # API diff between two versions
antd changelog 4.24.0 5.0.0 Select  # API diff for Select only

antd doctor

Runs 10 checks against your project: antd installed, React version compat, duplicate antd/dayjs/cssinjs installs, peer dependency satisfaction, theme config, babel-plugin-import usage, and CSS-in-JS setup.

antd doctor
antd doctor --format json

antd usage [dir]

antd usage                          # scan current directory
antd usage ./src                    # scan specific directory
antd usage -f Button                # filter to one component

antd lint [target]

Four rule categories: deprecated, a11y, performance, best-practice. Deprecation rules are derived from metadata at runtime, so they're always version-accurate.

antd lint ./src
antd lint ./src --only deprecated
antd lint ./src --only a11y

antd migrate <from> <to>

v4→v5 covers 25+ migration steps; v5→v6 covers 30+. Each step includes component name, breaking flag, search pattern, and before/after code.

antd migrate 4 5                    # full checklist
antd migrate 4 5 --component Select # component-specific
antd migrate 4 5 --apply ./src      # generate agent migration prompt
Example output
Migration Guide: v4 → v5

  Select:
    🔧 [BREAKING] Prop `dropdownClassName` renamed to `popupClassName`
    🔧 [BREAKING] Prop `dropdownMatchSelectWidth` renamed to `popupMatchSelectWidth`

Total: 2 steps (2 auto-fixable, 0 manual)

antd bug

antd bug --title "DatePicker crashes with dayjs 2.0"
antd bug --title "..." --steps "1. Click" --expected "Works" --actual "Crashes"
antd bug --title "..." --submit     # submit via gh CLI

antd bug-cli

antd bug-cli --title "info command crashes on v4"
antd bug-cli --title "..." --submit

⚙️ Global Flags

Flag Description Default
--format json|text|markdown Output format text
--version <v> Target antd version (e.g. 5.20.0) auto-detect
--lang en|zh Output language en
--detail Include extended information false
-V, --cli-version Print CLI version

Version auto-detection: --version flag → node_modules/antdpackage.json dependencies → fallback 5.24.0


📄 License

MIT © Ant Design

About

Ant Design on your command line. Query component knowledge, analyze project usage, and guide migrations — fully offline.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors