Design: antd bug & antd bug-cli Commands#
Overview#
Two new commands for reporting issues directly from the CLI:
antd bug— report antd component library issues toant-design/ant-designantd bug-cli— report CLI tool issues toant-design/ant-design-cli
Designed for an agentic workflow: Code Agents auto-collect environment info, assemble the issue content, preview it to the user for confirmation, then submit via gh CLI. The entire feedback loop stays in the terminal — no browser required.
This brings the total command count from 12 to 14. spec.md must be updated accordingly.
Agentic Flow#
- Agent encounters a suspected bug → runs
antd doctor/antd infoto diagnose - Confirms it's a bug → runs
antd bug --title "..." --steps "..." --format json(no--submit) to preview - Shows the assembled issue content to the user for review
- User confirms → Agent runs
antd bug --title "..." --steps "..." --submitto create the issue - Issue URL is returned — done
Commands#
antd bug#
Report a bug to the antd repository. Uses the same issue body format as antd-issue-helper.
antd bug --title "DatePicker crashes with dayjs 2.0"
antd bug --title "..." --steps "1. Open DatePicker" --expected "Works" --actual "Crashes"
antd bug --title "..." --reproduction "https://codesandbox.io/s/xxx"
antd bug --title "..." --submit # submit via gh CLI
antd bug --format json # structured output for agent to preview
Parameters:
| Parameter | Required | Description |
|---|---|---|
--title <title> | Yes | Issue title |
--reproduction <url> | No | Reproduction link (CodeSandbox/StackBlitz URL) |
--steps <text> | No | Steps to reproduce |
--expected <text> | No | Expected behavior |
--actual <text> | No | Actual behavior |
--extra <text> | No | Additional comments |
--submit | No | Submit via gh issue create instead of previewing |
Auto-collected environment info (from project node_modules and system):
- antd version (from
node_modules/antd/package.json, falls back to"unknown"if not found) - React version (from
node_modules/react/package.json, falls back to"unknown") - System (OS + version via
process.platform+os.release()) - Browser (placeholder
"-"— not detectable from CLI context)
Global flag behavior:
--version: If passed, overrides auto-detected antd version in the environment table--lang: No effect — issue content is always in English (GitHub issue convention)--detail: No effect on these commands--format: Supportsjson,text, andmarkdown(markdown outputs raw body only)
antd bug-cli#
Report a bug to the ant-design-cli repository.
antd bug-cli --title "antd info crashes on v4 components"
antd bug-cli --title "..." --description "Detailed description..."
antd bug-cli --title "..." --submit
antd bug-cli --format json
Parameters:
| Parameter | Required | Description |
|---|---|---|
--title <title> | Yes | Issue title |
--description <desc> | No | Problem description |
--steps <text> | No | Steps to reproduce |
--expected <text> | No | Expected behavior |
--actual <text> | No | Actual behavior |
--extra <text> | No | Additional comments |
--submit | No | Submit via gh issue create instead of previewing |
Auto-collected environment info:
- @ant-design/cli version (from
__CLI_VERSION__) - Node version (
process.version) - System (OS + version)
Global flag behavior: Same as antd bug (--lang, --detail, --version have no effect).
Issue Body Templates#
antd bug body (matches antd-issue-helper format)#
<!-- generated by @ant-design/cli. DO NOT REMOVE -->
### Reproduction link
[{reproduction}]({reproduction})
### Steps to reproduce
{steps}
### What is expected?
{expected}
### What is actually happening?
{actual}
| Environment | Info |
| --- | --- |
| antd | {antdVersion} |
| React | {reactVersion} |
| System | {system} |
| Browser | {browser} |
---
{extra}
Empty fields use placeholder text: "_No response_".
antd bug-cli body#
### Description
{description}
### Steps to Reproduce
{steps}
### Expected Behavior
{expected}
### Actual Behavior
{actual}
### Environment
| Info | Value |
|------|-------|
| @ant-design/cli | {cliVersion} |
| Node | {nodeVersion} |
| System | {system} |
Output Formats#
Preview mode (no --submit) — text format#
Shows the full assembled issue content so the agent can present it to the user:
Repository: ant-design/ant-design
Title: DatePicker crashes with dayjs 2.0
--- Issue Body ---
<!-- generated by @ant-design/cli. DO NOT REMOVE -->
### Reproduction link
...
--- End ---
To submit, re-run with --submit flag.
Preview mode — json format#
{
"repo": "ant-design/ant-design",
"title": "DatePicker crashes with dayjs 2.0",
"body": "<!-- generated by @ant-design/cli... -->",
"url": "https://github.com/ant-design/ant-design/issues/new?title=...&body=..."
}
JSON output always includes the pre-filled GitHub URL as a fallback (in case gh is not available).
Preview mode — markdown format#
Outputs just the raw issue body (no decoration), same as other commands' markdown format behavior.
--submit — text format#
Issue created: https://github.com/ant-design/ant-design/issues/12345
--submit — json format#
{
"repo": "ant-design/ant-design",
"title": "DatePicker crashes with dayjs 2.0",
"issueNumber": 12345,
"url": "https://github.com/ant-design/ant-design/issues/12345"
}
Submit Flow#
- Validate
--titleis provided → if not, errorTITLE_REQUIRED(exit 1) - Check if
ghCLI is available (which gh) → if not, errorGH_NOT_FOUND(exit 1), suggestion: installghCLI or use the pre-filled URL from preview mode - Run
gh issue create --repo {repo} --title {title} --body {body}- For
antd bug: repo isant-design/ant-design - For
antd bug-cli: repo isant-design/ant-design-cli - No
--labelflag (avoid errors if label doesn't exist; labels can be added manually)
- For
- If
ghcommand fails → errorGH_SUBMIT_FAILED(exit 2) - Parse the returned issue URL and output
Exit Codes#
0— success (preview generated or issue created)1— user error (TITLE_REQUIRED,GH_NOT_FOUND)2— system error (GH_SUBMIT_FAILED)
URL Length Handling#
GitHub new issue URLs have ~8000 character limit. If the encoded URL exceeds this:
- Truncate body and append
\n\n(Content truncated. Please add remaining details after opening.) - JSON output always includes the full, untruncated body
Architecture#
New Files#
src/commands/bug.ts— exportsregisterBugCommand(program)andregisterBugCliCommand(program)src/utils/issue.ts— shared utilities:collectAntdEnv(cwd, versionOverride?)— reads antd/React versions from node_modules (falls back to"unknown")collectCliEnv()— reads CLI/Node versionsbuildAntdIssueBody(fields)— generates antd-issue-helper format bodybuildCliIssueBody(fields)— generates CLI issue bodybuildIssueUrl(repo, title, body)— URL-encodes into GitHub new issue URL with truncation handlingsubmitViaGh(repo, title, body)— executesgh issue create, returns issue URL
Registration#
In src/index.ts, register under a new comment block:
// Issue Reporting commands
registerBugCommand(program);
registerBugCliCommand(program);
Error Codes#
Add to src/output/error.ts:
TITLE_REQUIRED—--titleis missing (exit 1)GH_NOT_FOUND—ghCLI not available when--submitis used (exit 1)GH_SUBMIT_FAILED—gh issue createreturned an error (exit 2)
Skill File Update#
Update skills/antd/SKILL.md with two changes:
1. Add allowed-tools#
allowed-tools:
- Bash(antd bug*)
- Bash(antd bug-cli*)
2. Add Scenario 8: Reporting issues#
Guide agents through the agentic feedback flow:
When to report: After using antd doctor, antd info, antd lint to diagnose, and confirming the issue is a genuine bug that can't be resolved locally.
Workflow for antd bugs:
# Step 1: Preview — assemble issue content for user review
antd bug --title "DatePicker crashes when ..." \
--reproduction "https://codesandbox.io/s/xxx" \
--steps "1. Open DatePicker 2. Click OK" \
--expected "Date selected" \
--actual "Component crashes" \
--format json
# Step 2: Show the assembled body to the user and ask for confirmation
# Step 3: Submit after user confirms
antd bug --title "DatePicker crashes when ..." \
--reproduction "https://codesandbox.io/s/xxx" \
--steps "1. Open DatePicker 2. Click OK" \
--expected "Date selected" \
--actual "Component crashes" \
--submit
Workflow for CLI bugs:
# Step 1: Preview
antd bug-cli --title "antd info shows wrong props" \
--description "Running antd info Select shows incorrect data" \
--steps "1. Run antd info Select --version 5.0.0" \
--expected "Shows 5.0.0 props" \
--actual "Shows latest props" \
--format json
# Step 2: Show to user and ask for confirmation
# Step 3: Submit
antd bug-cli --title "antd info shows wrong props" \
--description "Running antd info Select shows incorrect data" \
--steps "1. Run antd info Select --version 5.0.0" \
--expected "Shows 5.0.0 props" \
--actual "Shows latest props" \
--submit
Key rules:
- Always diagnose first (
antd doctor,antd info,antd lint) before reporting - Always preview and get user confirmation before submitting
- Include reproduction links when possible for antd bugs
- Provide clear, specific steps to reproduce