This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the documentation repository for Legend's open-source projects, containing both legacy Astro-based documentation and a new FumaDocs-based migration. The repository serves documentation for Legend-State, Legend-Motion, and Legend-List projects.
- Location: Monorepo workspace packages in
packages/directory - Framework: Astro with Starlight theme, React-Live for interactive examples
- Packages:
state/,motion/,list/,state-v2/,shared/ - Status: Original documentation system, still functional
- Location: Standalone Next.js application in
docs/directory - Framework: FumaDocs with Next.js 15, TypeScript, Tailwind CSS
- Purpose: Modern documentation platform with versioned docs and improved navigation
# Run FumaDocs development server
cd docs
bun dev
# Validate all MDX links (runs automatically before build)
cd docs
bun validate-links
# Build FumaDocs for production (includes prebuild link validation)
cd docs
bun build
# Start production server
cd docs
bun start# Run individual package docs (legacy)
cd packages/state
bun i && bun dev
cd packages/motion
bun i && bun dev
cd packages/list
bun i && bun devThe FumaDocs implementation supports multiple documentation packages with versioned content:
- Package Routes:
/listand/statewith dedicated homepages - Versioned Documentation:
/list/docs/v1,/list/docs/v2,/state/docs/v1,/state/docs/v2 - Unified Navigation: Custom navbar with "Home", "List", "State" links
source.config.ts: Defines separate document collections (listDocs,stateDocs) for package-specific content- Generated Sources: Auto-generated
.source/index.tswith runtime document mapping - Package Sources:
src/lib/sources/list.tsandsrc/lib/sources/state.tsfilter content for each package
- Custom Navbar:
src/components/navbar.tsxreplaces default FumaDocs navigation - Layout Integration: Custom navbar injected into docs layouts with
nav={{ component: <CustomNavbar /> }} - Sidebar Tabs: Version switching (V1/V2) implemented using FumaDocs sidebar tabs
docs/content/
├── list/
│ ├── v1/index.mdx + meta.json
│ └── v2/index.mdx + meta.json
└── state/
├── v1/index.mdx + meta.json
└── v2/index.mdx + meta.json
docs/src/app/
├── list/
│ ├── page.tsx (homepage)
│ └── docs/[[...slug]]/page.tsx (versioned docs)
├── state/
│ ├── page.tsx (homepage)
│ └── docs/[[...slug]]/page.tsx (versioned docs)
└── layout.config.tsx (shared navigation config)
source.config.ts: Document collections and MDX configurationnext.config.mjs: Next.js configuration with FumaDocs optimizationssrc/lib/sources/*.ts: Package-specific source loaderssrc/app/layout.config.tsx: Shared layout and navigation configuration
astro.config.mjs: Astro and Starlight configuration (per package)tailwind.config.cjs: Tailwind CSS configuration (per package)
Uses bun as the primary package manager across both systems. The FumaDocs system includes postinstall: "fumadocs-mdx" for automatic source generation.
FumaDocs implements version tabs using meta.json files with "root": true property to create sidebar tab navigation between documentation versions. Each package maintains separate V1 and V2 documentation branches.
The repository includes a comprehensive link validation system:
- Script Location:
scripts/validate-links.ts- TypeScript-based validator for MDX links - Automatic Validation: Runs automatically during
bun buildviaprebuildhook - Coverage: Validates all relative links in MDX files under
docs/content/ - Features: Supports
.mdx/.mdextensions, index file resolution, and anchor link parsing - Build Integration: Build process fails if broken links are detected, ensuring documentation quality