# UI inventory schema

Store the inventory as JSON and a readable Markdown report.

## Root object

```json
{
  "generated_at": "ISO-8601 timestamp",
  "root": "absolute or repository-relative path",
  "framework": {},
  "style_entries": [],
  "dependencies": [],
  "components": [],
  "layouts": [],
  "themes": [],
  "duplicate_class_signatures": [],
  "hard_coded_design_values": [],
  "summary": {}
}
```

## Framework

Record evidence for:

```json
{
  "name": "Next.js",
  "version": "detected version or null",
  "react_version": "detected version or null",
  "typescript": true,
  "tailwind_version": "detected version or null",
  "router": "app|pages|other|unknown",
  "package_manager": "pnpm|npm|yarn|bun|unknown"
}
```

## Component item

```json
{
  "name": "Button",
  "path": "src/components/button.tsx",
  "kind": "primitive|pattern|layout|content-adapter|application|unknown",
  "exports": ["Button", "buttonVariants"],
  "imports": ["radix-ui", "motion/react"],
  "style_sources": ["Tailwind", "CSS variables"],
  "usage_count": 14,
  "usage_files": [],
  "variants": ["primary", "outline"],
  "sizes": ["sm", "md", "lg"],
  "states": ["disabled", "loading", "focus-visible"],
  "breakpoints": ["sm", "lg"],
  "application_dependencies": [],
  "hard_coded_values": [],
  "candidate_target": "src/primitives/button.tsx",
  "candidate_basis": "existing|mm-ui|radix|shadcn|react-aria|floating-ui|motion|adapter",
  "notes": []
}
```

Automated detection may leave classification, variants and candidate fields unresolved. Complete them through source inspection.

## Layout item

Record:

- route or template locations;
- named visual regions;
- responsive rearrangement;
- fixed or sticky behavior;
- nested providers;
- data loading or route coupling;
- slots that can be separated;
- candidate layout package.

## Theme item

Record:

- selector or provider id;
- global CSS entry;
- raw palettes;
- semantic variables;
- hard-coded values outside the theme;
- light/dark `color-scheme`;
- typography, radius, spacing, shadow and motion variables;
- chart and status colors;
- missing states or contrast concerns.

## Duplicate class signature

A duplicate class signature is an identical normalized `className` string or a highly similar cluster. Store:

```json
{
  "signature": "normalized classes",
  "count": 4,
  "locations": [],
  "candidate": "Button|Surface|Stack|unknown"
}
```

Do not automatically convert every repeated class string into a component. Repetition is evidence, not sufficient architecture.

## Hard-coded design value

Capture direct hexadecimal, RGB, HSL, OKLCH, pixel radius, box shadow, z-index, transition duration and nonstandard breakpoint values with source locations. Mark whether each value is:

- intentional content;
- raw palette;
- semantic token candidate;
- component-specific functional style;
- unexplained duplication.

## Summary

At minimum include:

```json
{
  "component_files": 0,
  "tsx_files": 0,
  "css_files": 0,
  "radix_imports": 0,
  "motion_imports": 0,
  "tailwind_class_occurrences": 0,
  "duplicate_class_groups": 0,
  "hard_coded_color_occurrences": 0,
  "candidate_primitives": 0,
  "candidate_patterns": 0,
  "candidate_layouts": 0,
  "application_owned": 0
}
```

## Extraction map

Create a separate Markdown table after inventory review:

| Family | Source locations | Classification | Existing variants | Target import | Basis | Tokens | Migration batch | Verification | Rollback |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |

Do not begin implementation while rows lack a basis, target, and verification method.
