Repository navigation
refactor(cli): replace --compact/--brief with --detail flag - #634
Conversation
Replace the separate --compact, --brief, and --brief-all boolean flags with a single --detail <level> global option (full|compact|brief). API decision informed by Claude Opus prompts asking about CLI design patterns from three angles: OSS user UX, AI agent token efficiency, and general CLI conventions. The consensus was that mutually exclusive boolean flags are a code smell and a single enum flag is cleaner, scales better, and avoids ambiguous --compact --brief combinations. Changes: - Add --detail <level> global option (defaults to 'full') - Remove --compact, --brief, --brief-all per-command options - xds --detail brief component --list replaces --brief-all - Update all docs, skill files, AGENTS.md, CLAUDE.md, vibe test scripts to reference the new flag - All 197 tests pass
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Test planAll 197 CLI tests pass. Manual verification of every combination:
|
Test Plan — Manual VerificationAll 197 CLI tests pass ( Below is the actual output from every
|
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
— | Accessible label; used as aria-label for icon-only buttons. (required) |
variant |
`'primary' | 'secondary' | 'ghost' |
size |
`'sm' | 'md' | 'lg'` |
isLoading |
boolean |
false |
Shows a loading spinner and disables interaction. |
isDisabled |
boolean |
false |
Disables the button. |
icon |
ReactNode |
— | Icon element. When provided without children the button renders as a square icon-only button. |
children |
ReactNode |
— | Button content. When provided alongside icon, the text is rendered next to the icon. |
endSlot |
`ReactElement | ReactElement` | — |
tooltip |
string |
— | Tooltip text shown on hover. |
onClick |
(e: MouseEvent) => void |
— | Standard click handler (passed through from ButtonHTMLAttributes). |
onClickAction |
`(e: MouseEvent) => void | Promise` | — |
Usage
Basic
<XDSButton label="Click me" variant="primary" />With size
<XDSButton label="Large button" variant="primary" size="lg" />Loading state
<XDSButton label="Saving..." variant="primary" isLoading />Notes
- XDSButtonVariant type is derived from the variants StyleX object using keyof typeof variants.
- Hover/active states use backgroundImage with linear-gradient to layer overlay colors on top of the base background.
- Destructive variant uses colorTokens.negative for its focus outline color.
- endSlot is wrapped in a with color: inherit so icons/badges match the button text color across all variants.
- When icon is provided without children, the button becomes icon-only: it renders as a perfect square (aspectRatio: 1/1), and label is used as aria-label (not rendered visually). Works with any ReactNode as the icon — SVG components, emoji, or text.
- endSlot is ignored for icon-only buttons (when icon is provided without children) to preserve the square aspect ratio.
- Prefer XDSButton over or for accessibility — it provides keyboard navigation, focus management, and screen reader support.
- Icon-only buttons are suitable for toolbars, action grids, and compact controls.
### `xds --detail brief component Button`
XDSButton(variant: primary|secondary|ghost|destructive, size: sm|md|lg, endSlot: ReactElement|ReactElement, onClickAction: (e: MouseEvent) => void|Promise) ← from '@xds/core/Button'
XDSButton component with multiple variants, sizes, and isLoading state support.
label: string · isLoading · isDisabled · icon · children · tooltip · onClick
### `xds --detail compact --lang zh component Button`
Button
XDSButton 组件,支持多种变体、尺寸和加载状态。
Import
import { XDSButton } from '@xds/core/Button';Features
- 变体:'primary'、'secondary'、'ghost'、'destructive'
- 尺寸:sm(28px)、md(32px)、lg(36px)
- 加载状态:显示加载旋转器,禁用交互
- 焦点可见:带有变体特定颜色的无障碍焦点轮廓
- 悬停/激活状态:通过 backgroundImage 使用叠加颜色,实现一致的层级效果
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
— | 无障碍标签;纯图标按钮时用作 aria-label。 (required) |
variant |
`'primary' | 'secondary' | 'ghost' |
size |
`'sm' | 'md' | 'lg'` |
isLoading |
boolean |
false |
显示加载旋转器并禁用交互。 |
isDisabled |
boolean |
false |
禁用按钮。 |
icon |
ReactNode |
— | 图标元素。仅提供 icon 而不提供 children 时,按钮渲染为正方形的纯图标按钮。 |
children |
ReactNode |
— | 按钮内容。与 icon 同时提供时,文本渲染在图标旁边。 |
endSlot |
`ReactElement | ReactElement` | — |
tooltip |
string |
— | 悬停时显示的提示文本。 |
onClick |
(e: MouseEvent) => void |
— | 标准点击处理函数(从 ButtonHTMLAttributes 透传)。 |
onClickAction |
`(e: MouseEvent) => void | Promise` | — |
Usage
基础用法
<XDSButton label="Click me" variant="primary" />指定尺寸
<XDSButton label="Large button" variant="primary" size="lg" />加载状态
<XDSButton label="Saving..." variant="primary" isLoading />Notes
- XDSButtonVariant 类型通过 keyof typeof variants 从 variants StyleX 对象派生。
- 悬停/激活状态使用 backgroundImage 和 linear-gradient 在基础背景上叠加覆盖颜色。
- destructive 变体使用 colorTokens.negative 作为焦点轮廓颜色。
- endSlot 包裹在带有 color: inherit 的 中,使图标/徽章在所有变体中匹配按钮文本颜色。
- 仅提供 icon 而不提供 children 时,按钮变为纯图标模式:渲染为正方形(aspectRatio: 1/1),label 用作 aria-label(不可视渲染)。支持任何 ReactNode 作为图标——SVG 组件、emoji 或文本。
- 纯图标按钮(提供 icon 但不提供 children 时)会忽略 endSlot,以保持正方形的宽高比。
- 为了无障碍性,优先使用 XDSButton 而非 或 ——它提供键盘导航、焦点管理和屏幕阅读器支持。
- 纯图标按钮适用于工具栏、操作网格和紧凑控件。
### `xds --detail compact --lang dense component Button`
Button
button w/ multiple variants, sizes, loading state
Import
import { XDSButton } from '@xds/core/Button';Features
- variants: primary, secondary, ghost, destructive
- sizes: sm(28px), md(32px), lg(36px)
- loading state: shows spinner+disables interaction
- focus visible: accessible focus outline w/ variant-specific colors
- hover/active: overlay colors via backgroundImage for consistent layering
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
— | accessible label; aria-label for icon-only buttons (required) |
variant |
`'primary' | 'secondary' | 'ghost' |
size |
`'sm' | 'md' | 'lg'` |
isLoading |
boolean |
false |
shows spinner+disables interaction |
isDisabled |
boolean |
false |
Disables the button. |
icon |
ReactNode |
— | icon element; w/o children renders square icon-only button |
children |
ReactNode |
— | w/ icon, text rendered next to icon |
endSlot |
`ReactElement | ReactElement` | — |
tooltip |
string |
— | tooltip on hover |
onClick |
(e: MouseEvent) => void |
— | standard click handler |
onClickAction |
`(e: MouseEvent) => void | Promise` | — |
Usage
Basic
<XDSButton label="Click me" variant="primary" />With size
<XDSButton label="Large button" variant="primary" size="lg" />Loading state
<XDSButton label="Saving..." variant="primary" isLoading />Notes
- XDSButtonVariant derived from keyof typeof variants StyleX object
- hover/active use backgroundImage linear-gradient overlay on base bg
- destructive variant uses colorTokens.negative for focus outline
- endSlot wrapped in w/ color:inherit, matches button text across variants
- icon w/o children=icon-only: square (aspectRatio:1/1), label=aria-label, any ReactNode as icon
- endSlot ignored for icon-only to preserve square ratio
- prefer XDSButton over for a11y: keyboard nav, focus management, screen reader
- icon-only suits toolbars, action grids, compact controls
### `xds --detail brief --lang dense component Button`
XDSButton(variant: primary|secondary|ghost|destructive, size: sm|md|lg, endSlot: ReactElement|ReactElement, onClickAction: (e: MouseEvent) => void|Promise) ← from '@xds/core/Button'
button w/ multiple variants, sizes, loading state
label: string · isLoading · isDisabled · icon · children · tooltip · onClick
### `xds component --list`
Layout:
AspectRatio
Center
Grid
GridSpan
HStack
Layout
LayoutContent
LayoutFooter
LayoutHeader
LayoutPanel
Stack
StackItem
VStack
...(truncated)
### `xds --detail brief component --list` (replaces --brief-all)
Layout
XDSAspectRatio ← from '@xds/core/AspectRatio'
Maintains a specific aspect ratio for its children.
children: ReactNode · ratio: number · xstyle
<XDSAspectRatio ratio={16 / 9}>
XDSCenter(axis: both|horizontal|vertical, width: number|string, height: number|string) ← from '@xds/core/Center'
Centers children horizontally and/or vertically using flexbox.
isInline · children · xstyle
XDSGrid(width: number|string, height: number|string) ← from '@xds/core/Grid'
Grid container with fixed or responsive auto-fit columns.
columns · minChildWidth · gap · rowGap · columnGap · align · justify · children · xstyle
XDSGridSpan ← from '@xds/core/Grid'
Source code for core UI components.
...(truncated)
### `xds --detail brief component --category Input`
...(truncated)
### `xds component Button --props`
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
— | Accessible label; used as aria-label for icon-only buttons. (required) |
variant |
`'primary' | 'secondary' | 'ghost' |
size |
`'sm' | 'md' | 'lg'` |
isLoading |
boolean |
false |
Shows a loading spinner and disables interaction. |
isDisabled |
boolean |
false |
Disables the button. |
icon |
ReactNode |
— | Icon element. When provided without children the button renders as a square icon-only button. |
children |
ReactNode |
— | Button content. When provided alongside icon, the text is rendered next to the icon. |
endSlot |
`ReactElement | ReactElement` | — |
tooltip |
string |
— | Tooltip text shown on hover. |
onClick |
(e: MouseEvent) => void |
— | Standard click handler (passed through from ButtonHTMLAttributes). |
onClickAction |
`(e: MouseEvent) => void | Promise` | — |
### `xds --zh component Button` (legacy flag)
Button
XDSButton 组件,支持多种变体、尺寸和加载状态。
Features
### `xds --dense component Button` (legacy flag)
Button
button w/ multiple variants, sizes, loading state
Features
### `xds --detail banana component Button` (invalid value)
### `xds component Buton` (fuzzy match)
Component "Buton" not found. Did you mean one of these?
Button
### `xds --help`
Usage: xds [options] [command]
XDS design system CLI — components, themes, and tooling
Options:
-V, --version output the version number
--zh Output docs in Chinese Simplified
--dense Output docs in compressed dense format
(token-efficient)
--lang Output docs in specified language/format
(en, zh, dense)
--detail Output detail level (full, compact, brief)
(default: "full")
-h, --help display help for command
Commands:
init Interactive XDS initialization wizard
component [options] [name] List components or print component docs
docs [topic] Print XDS reference docs (principles,
tokens)
swizzle [options] [component] Copy component source for customization
agent-docs [options] Install/update XDS component index in
AGENTS.md (and CLAUDE.md if present)
template [options] [name] [path] Inject a page template
gap-report [options] Report a gap in the XDS design system
upgrade [options] Run codemods to migrate between XDS
versions
theme Theme tools — build, export, and manage XDS
themes
help Show all commands
### `xds component --help`
Usage: xds component [options] [name]
List components or print component docs
Options:
--list List all components grouped by category
--category List components in a specific category
--props Print only the props table
--source Print component source code
-h, --help display help for command
* refactor(cli): replace --compact/--brief with --detail flag Replace the separate --compact, --brief, and --brief-all boolean flags with a single --detail <level> global option (full|compact|brief). API decision informed by Claude Opus prompts asking about CLI design patterns from three angles: OSS user UX, AI agent token efficiency, and general CLI conventions. The consensus was that mutually exclusive boolean flags are a code smell and a single enum flag is cleaner, scales better, and avoids ambiguous --compact --brief combinations. Changes: - Add --detail <level> global option (defaults to 'full') - Remove --compact, --brief, --brief-all per-command options - xds --detail brief component --list replaces --brief-all - Update all docs, skill files, AGENTS.md, CLAUDE.md, vibe test scripts to reference the new flag - All 197 tests pass * fix(cli): validate --detail flag values --------- Co-authored-by: Joey's Navi <[email protected]>
* refactor(cli): replace --compact/--brief with --detail flag Replace the separate --compact, --brief, and --brief-all boolean flags with a single --detail <level> global option (full|compact|brief). API decision informed by Claude Opus prompts asking about CLI design patterns from three angles: OSS user UX, AI agent token efficiency, and general CLI conventions. The consensus was that mutually exclusive boolean flags are a code smell and a single enum flag is cleaner, scales better, and avoids ambiguous --compact --brief combinations. Changes: - Add --detail <level> global option (defaults to 'full') - Remove --compact, --brief, --brief-all per-command options - xds --detail brief component --list replaces --brief-all - Update all docs, skill files, AGENTS.md, CLAUDE.md, vibe test scripts to reference the new flag - All 197 tests pass * fix(cli): validate --detail flag values --------- Co-authored-by: Joey's Navi <[email protected]>
* refactor(cli): replace --compact/--brief with --detail flag Replace the separate --compact, --brief, and --brief-all boolean flags with a single --detail <level> global option (full|compact|brief). API decision informed by Claude Opus prompts asking about CLI design patterns from three angles: OSS user UX, AI agent token efficiency, and general CLI conventions. The consensus was that mutually exclusive boolean flags are a code smell and a single enum flag is cleaner, scales better, and avoids ambiguous --compact --brief combinations. Changes: - Add --detail <level> global option (defaults to 'full') - Remove --compact, --brief, --brief-all per-command options - xds --detail brief component --list replaces --brief-all - Update all docs, skill files, AGENTS.md, CLAUDE.md, vibe test scripts to reference the new flag - All 197 tests pass * fix(cli): validate --detail flag values ---------
Replaces the separate
--compact,--brief, and--brief-allboolean flags with a single--detail <level>global option (full|compact|brief).Why
Having both
--compactand--briefas separate booleans was messy.--compact --briefwas ambiguous, and--brief-allwas a special case bolted on. We asked Claude Opus about this from three angles (OSS user UX, AI agent token efficiency, CLI design conventions) and the consensus was clear: mutually exclusive booleans are a code smell. A single enum flag is cleaner and scales better.What changed
--detail <level>option (defaults tofull)--compact,--brief,--brief-allper-command optionsxds --detail brief component --listreplaces the old--brief-allUsage
All 197 tests pass.