This phase outlines @nexcraft/forge's strategic pivot toward becoming the first AI-native component library, positioning us for the future of AI-assisted development. Rather than competing on traditional component features, we're building the metadata infrastructure that enables AI tools to generate better, more semantic, and more accessible code.
Current State: AI tools generate technically correct but semantically poor component implementations:
- Generic TypeScript types without context
- No understanding of design systems or accessibility
- Struggles with proper component composition
- Lacks performance and UX best practices
Our Vision: The first component library designed for AI agents, not just human developers.
Instead of treating metadata as documentation, we treat it as AI training data:
// Current Approach (Human-Centric)
interface ButtonProps {
variant?: 'primary' | 'secondary';
size?: 'sm' | 'md' | 'lg';
onClick?: () => void;
}
// AI-Native Approach (Agent-Centric)
interface ButtonMetadata extends ComponentMetadata {
purpose: "Primary action trigger with semantic meaning";
usagePatterns: [
"form submission", "modal triggers", "navigation actions"
];
contextualRules: [
"never use primary variant for destructive actions",
"always provide accessible labels for icon-only buttons",
"prefer loading state over disabled for async operations"
];
aiPrompts: {
codeGeneration: "Generate button with semantic HTML and proper ARIA",
designSystem: "Maintain consistent spacing using design tokens",
accessibility: "Ensure WCAG 2.1 AA compliance automatically"
};
performanceHints: [
"lazy load when not in viewport",
"debounce rapid clicks by default"
];
compositionPatterns: {
"with-icons": "Use icon-start or icon-end props, not nested elements",
"in-forms": "Automatically handle form submission and validation states",
"in-modals": "Integrate with modal focus management"
};
}Decision: Focus on Web Components with rich AI metadata rather than framework-specific wrappers.
Rationale:
- Future-Proof: Web standards outlast framework churn
- AI Training: Metadata works across all frameworks
- Maintenance: Single implementation with universal AI guidance
- Competitive Advantage: Rich metadata becomes our moat
AI should generate code that is:
- Accessible by default: WCAG 2.1 AA compliance automatic
- Performance optimized: Built-in performance best practices
- Design system compliant: Consistent with design tokens
- Semantically correct: Proper HTML semantics and ARIA
export interface AIComponentMetadata {
// Core Identity
purpose: string;
semanticRole: string;
category: 'atom' | 'molecule' | 'organism';
// AI Generation Guidance
usagePatterns: string[];
antiPatterns: string[];
contextualRules: string[];
// Code Generation
aiPrompts: {
codeGeneration: string;
accessibility: string;
performance: string;
designSystem: string;
};
// Framework Examples
codeExamples: {
react: string;
vue: string;
angular: string;
vanilla: string;
};
// Design Integration
designTokens: Record<string, any>;
layoutPatterns: string[];
// Performance
performanceHints: string[];
bundleImpact: 'minimal' | 'moderate' | 'significant';
// Accessibility
a11yGuidelines: string[];
ariaPatterns: string[];
keyboardInteractions: string[];
// Composition
compositionPatterns: Record<string, string>;
childComponents: string[];
parentComponents: string[];
// Testing
testingPatterns: string[];
commonTestCases: string[];
}// VS Code extension that provides context-aware suggestions
interface AIAssistance {
generateComponent(context: ComponentContext): string;
suggestProps(component: string, usage: string): PropSuggestion[];
validateAccessibility(code: string): A11yIssue[];
optimizePerformance(code: string): PerformanceHint[];
}{
"forge-button": {
"training_examples": [
{
"context": "form submission",
"good_example": "<forge-button type=\"submit\" variant=\"primary\">Save Changes</forge-button>",
"explanation": "Primary variant appropriate for main form action"
},
{
"context": "destructive action",
"bad_example": "<forge-button variant=\"primary\">Delete Account</forge-button>",
"good_example": "<forge-button variant=\"danger\">Delete Account</forge-button>",
"explanation": "Use danger variant for destructive actions"
}
]
}
}// AI-powered development hints
export class AIDevHelper {
analyzeComponent(element: HTMLElement): ComponentAnalysis {
return {
semanticCorrectness: this.checkSemantics(element),
accessibilityScore: this.auditA11y(element),
performanceImpact: this.analyzePerformance(element),
suggestions: this.generateSuggestions(element)
};
}
}- Better AI Code β Happy Developers β More Usage β More Training Data β Even Better AI
- Each usage improves the system for everyone
- Investment Barrier: Rich metadata requires significant effort to create
- First-Mover Advantage: Establishing the standard for AI-native libraries
- Data Advantage: Usage patterns improve our AI guidance
- AI Tool Partnerships: Integration partnerships with coding assistants
- Cloud Providers: Featured library for AI development platforms
- Design Tool Makers: AI-powered design-to-code workflows
β Schema & Generator Implementation
- β ai-manifest.schema.json - Schema with examples established
- β
Generator:
scripts/generate-ai-manifest.js- Merges CEM + TS types + examples - β
Build Integration:
npm run buildemits/ai-manifest.jsonand/dist/ai-manifest.json - β CI Validation: Schema validation + broken-link checks for examples
β Component Population
- β CRITICAL FIXED: AI manifest now contains 31 components (was empty array)
- β Basic Metadata: Props, events, slots generated from custom-elements.json
- β Storybook Panel: AI panel shows manifest entries for components
- β
Documentation:
docs/ai-manifest.md, contributor guide for AI metadata
β AI Methods Implementation - MAJOR BREAKTHROUGH
- β
All 30 components now implement
getPossibleActions(),explainState(), andaiStategetter - β
Enhanced AI manifest with extracted method implementations for 11 components showing:
- Specific actions each component supports (e.g., 'toggle', 'check', 'increment', 'focus')
- Availability conditions for actions (e.g.,
this.closable && !this.closing) - Possible states for components (e.g., 'checked', 'unchecked', 'indeterminate', 'error')
- β
Comprehensive documentation created at
docs/ai-methods.mdwith examples and best practices - β AI agent discovery through manifest, TypeScript definitions, and runtime inspection
β Current Status - Foundation Complete
- β ai-manifest.json populated with all 31 components
- β Build system generates manifest at build time
- β Storybook integration shows AI metadata in panel
- β CI validation ensures manifest stays in sync
β Enhanced Metadata Complete (AI Tool Ready)
- β
examples: {}- SSR fallback examples implemented (ADR-018 compliant) - β
slots: []- Rich slot documentation with descriptions - β
a11y: {}- Comprehensive accessibility information (ADR-012 compliant)
π― Current Priority: AI Tools Integration
π§ IN PROGRESS: AI Tool Integration
- AI Tool Integration: Basic integration with Cursor, GitHub Copilot
- Tool Schemas:
ai-tools/react/<component>.jsonfor priority components - React Examples: Client + SSR sample implementations
β COMPLETED: Rich Metadata Population
- β Accessibility Information: ARIA roles, keyboard navigation, screen reader guidance (all 30 components)
- β SSR Examples: Semantic HTML fallbacks for server-side rendering
- β Slot Documentation: Rich slot objects with names and descriptions
- β Schema Compliance: ai-manifest.json validates against updated schema
Deliverables 9.1 Enhanced:
- β Foundation: AI manifest system working (30 components)
- β AI Methods: explainState(), getPossibleActions(), aiState implemented
- β Rich Metadata: Examples, slots, accessibility information (COMPLETE)
- π§ AI Tool Integration: Basic AI coding assistant compatibility (IN PROGRESS)
Preferred approach: Add JSDoc comments with @slot tags for CEM extraction.
Atoms (with slots):
forge-alert- Default slot for alert contentforge-aspect-ratio- Default slot for content with aspect ratioforge-badge- Default slot for badge content (if not using count)forge-button- Default slot for button text/contentforge-input-prefix,suffix+ default slot (for input content)forge-progress- Default slot for progress labelforge-progress-circle- Default slot for progress label
Molecules (with multiple slots):
forge-card-media,header,footer,actions+ default slotforge-modal-header,footer+ default slotforge-toast-icon,action+ default slotforge-tooltip- Default slot for tooltip content
Organisms (with complex slots):
forge-data-grid- Multiple slots for custom cells, headers, actionsforge-navigation-bar- Navigation item slotsforge-tabs- Tab content slots
/**
* @slot media - Media content like images, videos, or graphics
* @slot header - Custom header content (overrides title/subtitle)
* @slot - Default slot for main card content
* @slot footer - Footer content like metadata or links
* @slot actions - Action buttons or controls
*/
@customElement('forge-card')
export class ForgeCard extends BaseElement {
// ... component implementation
}Week 3: Remaining Atom Components
- forge-icon: Semantic icon usage, accessibility labels
- forge-checkbox: Form integration, validation states
- forge-badge: Status indication patterns, positioning rules
- forge-switch: Toggle patterns, state management
- forge-radio-group: Selection patterns, group semantics
- forge-select: Dropdown patterns, accessibility compliance
- forge-progress: Loading states, progress indication
- forge-skeleton: Loading placeholders, content anticipation
- forge-aspect-ratio: Layout patterns, responsive design
- forge-avatar: Identity representation, fallback patterns
Week 4: Molecule & Organism Components
- Molecules: forge-form-field, forge-multi-select, forge-date-picker, forge-dropdown, forge-toast
- Organisms: forge-data-grid, forge-tabs, forge-pagination, forge-navigation-bar, forge-accordion, forge-tree-view
- AI Prompt Templates: Create standardized prompts for code generation
- Framework Examples: React, Vue, Angular, vanilla JS examples for each component
Deliverables 9.1b:
- All 27+ components with complete AI metadata
- Comprehensive AI prompt template system
- Framework-specific code examples for all components
- Metadata export system for AI training
Week 5-6: VS Code Extension Development
- Create Forge component IntelliSense extension
- Implement context-aware component suggestions
- Add accessibility linting based on AI metadata
- Build performance hint integration
Week 7: AI Training Data Export
- Build metadata serialization system
- Create AI model training data format
- Implement usage pattern collection system
- Generate component examples dataset
Week 8-9: AI Tool Integration
- GitHub Copilot integration prototype
- Cursor IDE integration
- Claude/ChatGPT prompt optimization
- Community AI tool compatibility testing
Week 10: Runtime AI Analysis
- Component usage analyzer
- Real-time accessibility checker
- Performance impact analyzer
- Semantic correctness validator
Deliverables 9.2:
- Production-ready VS Code extension
- AI training data export system
- Partnerships with 2+ AI coding tools
- Runtime analysis toolkit
Week 11-12: Smart Component Suggestions
- Context analysis engine (form vs layout vs navigation)
- Component recommendation system
- Automatic prop suggestion based on usage context
- Design pattern detection and suggestions
Week 13-14: Accessibility Automation
- WCAG 2.1 AA compliance checker
- Automatic ARIA attribute generation
- Keyboard navigation validation
- Screen reader compatibility analysis
Week 15-16: Performance Optimization
- Bundle impact analyzer
- Lazy loading recommendations
- Performance regression detection
- Optimization suggestion engine
Week 17-18: Design System Enforcement
- Design token consistency checker
- Brand compliance validation
- Component composition rules
- Style guide adherence monitoring
Deliverables 9.3:
- Context-aware component recommendation engine
- Automated accessibility compliance system
- Performance optimization toolkit
- Design system consistency enforcer
Week 19-21: Usage Data Collection
- Anonymous usage telemetry system
- Developer feedback collection
- Component misuse pattern detection
- A/B testing framework for AI suggestions
Week 22-24: Model Training
- Component usage prediction model
- Code quality scoring system
- Accessibility compliance predictor
- Performance impact estimator
Week 25-27: AI Code Generation
- Component composition generator
- Form layout optimizer
- Dashboard template generator
- Responsive design assistant
Week 28-30: Feedback Systems
- Continuous learning pipeline
- Developer satisfaction tracking
- Model performance monitoring
- Community contribution system
Deliverables 9.4:
- Production AI models for component usage
- AI-powered code generation system
- Continuous improvement feedback loops
- Community-driven AI enhancement platform
- Define a stable
ai-manifest.jsonformat (derived from CEM + TS types + curated examples). - Generate the manifest at build time and ship it with releases (root and
dist/). - Provide function-style tool schemas (e.g.,
ai-tools/react/*.json) to enable LLM function-calling workflows. - Preview and validate in Storybook via an "AI" panel.
- Author contributor guidance and CI validation to keep manifest in sync.
- Shipping runtime-only AI logic. Keep AI metadata out of production bundles.
- Implementing full editor plugins (provide a minimal reference, not a full product).
- β
ai-manifest.schema.json(schema + examples) - β
Generator:
scripts/generate-ai-manifest.js(mergescustom-elements.json, TS types, examples) - β
Build integration:
npm run buildemits/ai-manifest.jsonand (optionally)/dist/ai-manifest.json - β Tool specs:
ai-tools/react/<component>.jsonfor priority components - β Storybook addon/panel: panel that renders the manifest entry for the active component
- β
Docs:
docs/ai-manifest.md, contributor guide for adding AI metadata per component - β CI: schema validation + broken-link checks for examples
- β CRITICAL: Populated ai-manifest.json with all 31 components
- β CRITICAL: AI methods implemented on all components (explainState, getPossibleActions)
- β CRITICAL: AI method implementations extracted into manifest (11/30 components with full details)
- β CRITICAL: AI usage documentation and examples (docs/ai-methods.md)
- β CRITICAL: Enhanced metadata with a11y and SSR examples (ADR-012, ADR-018 compliant)
- π§ CRITICAL: Integration with popular AI coding tools (Cursor, GitHub Copilot) - IN PROGRESS
- Week 1
- Define schema; implement generator POC
- Seed 5 components (Button, Input, Select, Modal, Alert)
- Add build step + CI validation
- Week 2
- Emit React tool schemas; document mapping rules
- Storybook AI panel + examples verification
- Docs and contributor workflow finalized
- ADR-014: AI-Ready Components β Manifest fields capture semantics, patterns, a11y, performance hints
- ADR-017: AI-Native Development Strategy β Canonical strategy and rollout phases
- ADR-007: Framework Integration β Provide React wrappers and examples; future Vue/Angular mappings
- ADR-018: Unified SSR Architecture β Include SSR fallback examples in manifest
- ADR-009: Documentation Strategy β Storybook central pane; docs auto-link from manifest
- ADR-010: Versioning & Release β Manifest versioned alongside package; no runtime coupling
- ADR-003: Theming β Reference tokens; avoid leaking runtime token values
- β
npm run buildproduces a validatedai-manifest.json(schema passes) andai-tools/react/* - β CRITICAL: ai-manifest.json contains metadata for all 31 components (fixed empty array issue)
- β CRITICAL: AI methods (explainState, getPossibleActions) implemented on all 30 components
- β CRITICAL: AI method implementations extracted into manifest with specific actions and states
- β CRITICAL: Comprehensive AI methods documentation created (docs/ai-methods.md)
- β Storybook AI panel shows correct props/events/slots and examples for all components
- β React examples compile and run (client + SSR sample)
- β CI fails on manifest drift (schema or link validation errors)
- β Docs explain how to add/extend AI metadata; contributors can follow without maintainers
- β CRITICAL: AI tools can discover and understand component capabilities
- β CRITICAL: Developers can use AI assistance for component usage
- Drift between code and manifest β Generate from sources + CI validation
- Overly broad scope β Start with 5 components; template for the rest
- Bundle size concerns β Keep manifest out of runtime imports; ship as artifact only
- Cross-framework differences β Begin with React; design schema to be framework-agnostic
- Inputs:
custom-elements.json,dist/**/*.d.ts, curated examples indocs/components/*(orexamples/<tag>/*). - Prereqs: type emit stable; CEM available or generator falls back gracefully.
- Versioned schema with
manifestVersionand additive-only policy. - React tool schema mapping rules documented (props/events/slots β parameters, children handling, enums).
- Read CEM + d.ts, merge examples, produce
ai-manifest.jsonin repo root (and optionallydist/). - Validate against schema; skip gracefully if inputs missing.
- Local addon to render manifest for active component; copy Web/React/SSR examples.
validate:aichecks schema conformity and existence/compilation of referenced examples.
- Enhanced BaseElement with comprehensive metadata support
- TypeScript 5.0+ for advanced type inference
- Build system updates for metadata bundling
- CI/CD pipeline for AI model deployment
- AI/ML engineer for model development (Phase 9.4)
- VS Code extension developer (Phase 9.2)
- Partnership development for AI tool integrations
- Community manager for developer feedback collection
- Metadata storage and versioning system
- AI model serving infrastructure
- Telemetry and analytics platform
- Community feedback and contribution platform
- AI Suggestion Accuracy: >85% helpful suggestions
- Code Quality Improvement: 40% reduction in accessibility issues
- Development Speed: 30% faster component implementation
- Error Reduction: 50% fewer component misuse patterns
- AI Tool Integrations: Partnerships with 3+ major AI coding tools
- Developer Adoption: 10k+ developers using AI features monthly
- Enterprise Interest: 50+ enterprise inquiries about AI-assisted development
- Competitive Differentiation: Only component library with comprehensive AI metadata
- Metadata Coverage: 100% components with complete metadata
- Performance Impact: <5% bundle size increase for metadata
- Accuracy: 90% correct AI-generated code on first attempt
- Accessibility: 95% WCAG 2.1 AA compliance in AI-generated code
Mitigation: Build incrementally, provide value to current users while positioning for future
Mitigation: Open source metadata format, actively engage with tool creators
Mitigation: Build network effects and data advantages that are hard to replicate
Mitigation: Start with proven use cases, expand based on developer feedback
- Material-UI: Human-centric documentation, basic TypeScript types
- Ant Design: Comprehensive but not AI-optimized
- Chakra UI: Good DX but no AI integration
- Mantine: Modern but traditional approach
- Only library built for AI agents
- Comprehensive semantic metadata
- Cross-framework AI assistance
- Performance-optimized AI suggestions
- AI-First Positioning: "The only component library built for the AI age"
- Developer Education: Blog series on AI-assisted development
- Community Building: AI-native development Discord/Slack community
- ROI Messaging: Faster development, fewer bugs, better accessibility
- Pilot Programs: Free AI features for enterprise evaluation
- Training Programs: AI-assisted development workshops
- AI Tool Vendors: Integration partnerships with coding assistants
- Cloud Providers: Featured library for AI development platforms
- Design Tool Makers: AI-powered design-to-code workflows
By positioning @nexcraft/forge as the first AI-native component library, we're not just building componentsβwe're building the infrastructure for the future of development. This strategy leverages our web components foundation while creating a sustainable competitive advantage through AI metadata and tooling.
The investment in AI-native features positions us to capture the massive wave of AI-assisted development adoption, while our focus on semantic metadata and accessibility ensures we're building the right foundation for both current and future needs.
Current Status: Phase 9.1 foundation is complete with AI methods implemented. Next priority is rich metadata population (examples, slots, accessibility) to make the AI manifest truly useful for AI coding tools.
Related: ADR-014, ADR-017, ADR-007, ADR-018, ADR-009, ADR-010, ADR-003