GEMS - AI Component Generator CLI/Web

GEMS β¨
Generate & manage web components with local and cloud LLMs βοΈ
GEMS is a blazing-fast CLI tool for rapid prototyping of web components for WordPress websites. Generate beautiful, accessible components through natural language prompts - all with a local-first approach that respects your privacy and works offline.
π Live Demo | π¦ Demo Repository
β¨ Key Features
- π€ Claude Code Integration - Use Claude Sonnet 4 & Opus 4 with your existing subscription
- π― Natural Language Generation - Describe what you want, get production-ready components
- π Local-First - Primary AI via Claude Code or LM Studio, fallback to cloud when needed
- β‘ Lightning Fast - Built with Bun for superior performance
- π WordPress Ready - Components work seamlessly with WordPress
- ποΈ Live Preview - Interactive preview server with component management
- π SHARDS - Create and browse multiple versions of your components
- π¨ Style Presets - Define consistent design guidelines for all components
- π¨ Interactive Mode - User-friendly CLI with visual menus
- πΈ Screenshot to Component - Turn any design into code instantly
- π Multi-Framework Output - Export to React, Vue, or vanilla JS
- π§ͺ Visual Regression Testing - Built-in testing for your components
- π€ Voice Input - Speak your ideas into existence with local Whisper WASM
π Quick Start
# Install GEMS globally via npm
npm install -g gems-cli
# Or with Bun (faster!)
bun install -g gems-cli
# Generate your first component
gems create hero
# Start interactive mode
gems
# Preview your components
gems preview
# Configure AI endpoints
gems config ai
π οΈ Tech Stack
- Runtime: Bun (primary) with Node.js compatibility
- Language: TypeScript 5.0+
- CLI Framework: Cliffy - Type-safe CLI framework
- AI Integration:
- Claude Code for Sonnet 4 & Opus 4 models
- LM Studio for local models
- OpenRouter for cloud models
- Preview Server: Custom-built with glassmorphic UI
- Component Output: Web Components (vanilla JS)
π Requirements
- Node.js 18+ or Bun 1.0+
- Claude Code CLI (optional, for Claude models without API costs)
- LM Studio (optional, for local AI)
- OpenRouter API key (optional, for cloud AI)
π¦ Installation
Global Installation
# Install globally with npm
npm install -g gems-cli
# Or with Bun (faster!)
bun install -g gems-cli
# Start using GEMS
gems
Development Setup
# Clone the repository
git clone https://github.com/yourusername/gems.git
cd gems
# Install dependencies
bun install
# Link for local development
bun link
# Run the CLI
gems
π Project Structure
gems/
βββ src/
β βββ cli/ # CLI commands and interface
β βββ services/ # Core services (AI, storage, etc.)
β βββ generators/ # Component generation logic
β βββ templates/ # Component templates
β βββ preview/ # Preview server
β βββ utils/ # Utilities and helpers
βββ tests/ # Test suites
βββ prompts/ # AI prompt templates
βββ examples/ # Example components
π SHARDS - Component Versioning
SHARDS let you create multiple versions of any component directly from the preview server:
- View a component in the preview server
- Click "New SHARD" to create a variation
- Describe the changes you want (e.g., "make it more colorful", "add animations")
- Browse versions with the version slider
- Copy any version independently
Each SHARD maintains the original component's structure while applying your requested modifications.
π¨ Style Presets
Style Presets let you define consistent design guidelines that are automatically applied to all generated components. This ensures brand consistency across your entire component library.
How It Works
- Create a style preset with your brand colors, typography, and design principles
- Enable styles in the settings (off by default to maintain existing behavior)
- Select an active preset from your collection
- Generate components - they'll automatically follow your style guidelines
Creating Style Presets
In the preview server:
- Click the Settings button (βοΈ)
- Navigate to the Style Presets section
- Click Create New Style
- Define your guidelines including:
- Color palette (primary, secondary, accent colors)
- Typography (fonts, sizes, weights)
- Visual style (modern, classic, playful, professional)
- Layout preferences (spacing, borders, shadows)
- Any specific design patterns
Benefits
- Consistency - All components follow the same design language
- Efficiency - No need to specify styles for each component
- Flexibility - Switch between different brands or themes instantly
- Works with both GEMs and SHARDs - Style presets apply to both new components and variations
Style presets are stored in the styles/
directory and can be version controlled with your project.
π‘ Usage Examples
Basic Component Generation
# Generate a hero section
gems create hero --brand "Bun" --style "cute"
# Generate a pricing table
gems create pricing --columns 3 --currency USD
# Generate from description
gems create "A testimonial carousel with customer photos and ratings"
AI Model Selection
# Use Claude Code with Sonnet 4 (default)
gems create nav --model claude-code
# Use Claude Code with Opus 4 for complex components
gems create "complex dashboard with real-time charts" --model claude-code-opus
# Use local AI model (LM Studio)
gems create hero --model local
# Use cloud AI model (OpenRouter)
gems create testimonial --model cloud
# Interactive mode for easy creation
gems
βοΈ Configuration
# Configure Claude Code model preference
gems config set ai.claudeCode.model "opus-4" # or "sonnet-4"
# Set up LM Studio endpoint
gems config set ai.local.endpoint "http://10.0.0.###:1234"
# Configure OpenRouter
gems config set ai.openrouter.key "your-api-key"
# Set default AI provider
gems config set ai.defaultModel "claude-code" # or "local" or "cloud"
# Set default output format
gems config set output.format "webcomponent"
π€ AI Providers
GEMS uses a smart routing system for AI with three providers:
Claude Code (NEW! - Default)
- Uses your existing Claude Code subscription
- Access to Claude Sonnet 4 and Opus 4 models
- No additional API costs
- Requires Claude Code CLI to be installed
Local Models (via LM Studio)
- Default: Devstral at
http://10.0.0.237:1234
- Privacy-first, no data leaves your network
- Works offline
Cloud Models (via OpenRouter)
- Fallback when Claude Code and local unavailable
- Access to latest models
- Requires API key
π§© Supported Components
- Hero Sections - Stunning landing page heroes
- Navigation - Responsive nav bars and menus
- Forms - Contact, signup, and custom forms
- CTAs - Call-to-action sections
- Grids - Feature and product grids
- Testimonials - Social proof sections
- Footers - Complete footer sections
- Custom - Anything you can imagine!
π§ Development
# Run in development mode
bun run dev
# Run tests
bun test
# Run tests in watch mode
bun test --watch
# Lint code
bun run lint
# Format code
bun run format
# Type checking
bun run typecheck
# Build for production
bun run build
πΊοΈ Roadmap
- β Natural language component generation
- β Local-first AI with LM Studio
- β Cloud AI fallback with OpenRouter
- β Interactive CLI mode
- β Live preview server
- β WordPress-ready output
- β SHARDS versioning system (NEW!)
- β npm package distribution (NEW!)
- π Screenshot to component
- π Multi-framework output
- π Visual regression testing
- π Voice input support
π Acknowledgments
- Built with love using Bun
- AI powered by OpenRouter and LM Studio
- CLI magic by Cliffy
License: MIT Β© John Farmer