Documents
2026-03-23-bug-report-commands-design
2026-03-23-bug-report-commands-design
Type
External
Status
Published
Created
Jun 12, 2026
Updated
Jun 12, 2026
Source
View

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 to ant-design/ant-design
  • antd bug-cli — report CLI tool issues to ant-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#

  1. Agent encounters a suspected bug → runs antd doctor / antd info to diagnose
  2. Confirms it's a bug → runs antd bug --title "..." --steps "..." --format json (no --submit) to preview
  3. Shows the assembled issue content to the user for review
  4. User confirms → Agent runs antd bug --title "..." --steps "..." --submit to create the issue
  5. 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:

ParameterRequiredDescription
--title <title>YesIssue title
--reproduction <url>NoReproduction link (CodeSandbox/StackBlitz URL)
--steps <text>NoSteps to reproduce
--expected <text>NoExpected behavior
--actual <text>NoActual behavior
--extra <text>NoAdditional comments
--submitNoSubmit 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: Supports json, text, and markdown (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:

ParameterRequiredDescription
--title <title>YesIssue title
--description <desc>NoProblem description
--steps <text>NoSteps to reproduce
--expected <text>NoExpected behavior
--actual <text>NoActual behavior
--extra <text>NoAdditional comments
--submitNoSubmit 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#

  1. Validate --title is provided → if not, error TITLE_REQUIRED (exit 1)
  2. Check if gh CLI is available (which gh) → if not, error GH_NOT_FOUND (exit 1), suggestion: install gh CLI or use the pre-filled URL from preview mode
  3. Run gh issue create --repo {repo} --title {title} --body {body}
    • For antd bug: repo is ant-design/ant-design
    • For antd bug-cli: repo is ant-design/ant-design-cli
    • No --label flag (avoid errors if label doesn't exist; labels can be added manually)
  4. If gh command fails → error GH_SUBMIT_FAILED (exit 2)
  5. 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 — exports registerBugCommand(program) and registerBugCliCommand(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 versions
    • buildAntdIssueBody(fields) — generates antd-issue-helper format body
    • buildCliIssueBody(fields) — generates CLI issue body
    • buildIssueUrl(repo, title, body) — URL-encodes into GitHub new issue URL with truncation handling
    • submitViaGh(repo, title, body) — executes gh 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--title is missing (exit 1)
  • GH_NOT_FOUNDgh CLI not available when --submit is used (exit 1)
  • GH_SUBMIT_FAILEDgh issue create returned 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