@forgespace/siza-gen 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2369 @@
1
+ import Database from 'better-sqlite3';
2
+ import * as pino from 'pino';
3
+ import pino__default, { Logger } from 'pino';
4
+ import { z } from 'zod';
5
+
6
+ /**
7
+ * Type definitions for the ML subsystem.
8
+ */
9
+
10
+ /** A vector embedding with its source metadata. */
11
+ interface IEmbedding {
12
+ /** The source entity ID (e.g., component snippet ID or prompt hash). */
13
+ sourceId: string;
14
+ /** The source type. */
15
+ sourceType: 'component' | 'prompt' | 'description' | 'rule' | 'token' | 'pattern' | 'example';
16
+ /** The text that was embedded. */
17
+ text: string;
18
+ /** The embedding vector (Float32). */
19
+ vector: Float32Array;
20
+ /** Dimensionality of the vector. */
21
+ dimensions: number;
22
+ /** Timestamp of creation. */
23
+ createdAt: number;
24
+ }
25
+ /** Cosine similarity search result. */
26
+ interface ISimilarityResult {
27
+ /** The matched entity ID. */
28
+ id: string;
29
+ /** Cosine similarity score (0-1). */
30
+ similarity: number;
31
+ /** The original text that was embedded. */
32
+ text: string;
33
+ }
34
+ /** Configuration for the embedding model. */
35
+ interface IEmbeddingConfig {
36
+ /** HuggingFace model identifier. */
37
+ modelId: string;
38
+ /** Local cache directory for the downloaded model. */
39
+ cacheDir: string;
40
+ /** Expected dimensionality of embeddings. */
41
+ dimensions: number;
42
+ }
43
+ /** A training example for LoRA fine-tuning. */
44
+ interface ITrainingExample {
45
+ /** The user prompt that triggered generation. */
46
+ prompt: string;
47
+ /** The generated code. */
48
+ code: string;
49
+ /** Feedback score (-1 to 2, where >0 = accepted). */
50
+ score: number;
51
+ /** Generation parameters used. */
52
+ params: Record<string, string>;
53
+ }
54
+ /** Configuration for LoRA training. */
55
+ interface ILoRAConfig {
56
+ /** LoRA rank (lower = smaller adapter). */
57
+ rank: number;
58
+ /** Number of training epochs. */
59
+ epochs: number;
60
+ /** Batch size (CPU-friendly). */
61
+ batchSize: number;
62
+ /** Learning rate. */
63
+ learningRate: number;
64
+ }
65
+ /** Adapter types for the sidecar model. */
66
+ type AdapterType = 'quality-scorer' | 'prompt-enhancer' | 'style-recommender';
67
+ /** Status of a training job. */
68
+ interface ITrainingStatus {
69
+ adapter: AdapterType;
70
+ status: 'idle' | 'preparing' | 'training' | 'complete' | 'failed';
71
+ progress: number;
72
+ error?: string;
73
+ startedAt?: number;
74
+ completedAt?: number;
75
+ }
76
+
77
+ /**
78
+ * Sentence embeddings using Transformers.js (ONNX runtime).
79
+ *
80
+ * Downloads `all-MiniLM-L6-v2` on first use (~80MB), cached in `.uiforge/models/`.
81
+ * Runs entirely on CPU — ~50-100ms per embedding on modern hardware.
82
+ */
83
+
84
+ /**
85
+ * Override default embedding configuration.
86
+ */
87
+ declare function configureEmbeddings(overrides: Partial<IEmbeddingConfig>): void;
88
+ /**
89
+ * Get the embedding configuration.
90
+ */
91
+ declare function getEmbeddingConfig(): IEmbeddingConfig;
92
+ /**
93
+ * Generate an embedding vector for a single text string.
94
+ */
95
+ declare function embed(text: string): Promise<Float32Array>;
96
+ /**
97
+ * Generate embeddings for multiple texts in batch.
98
+ * More efficient than calling embed() in a loop.
99
+ */
100
+ declare function embedBatch(texts: string[]): Promise<Float32Array[]>;
101
+ /**
102
+ * Create a full IEmbedding object from text.
103
+ */
104
+ declare function createEmbedding(sourceId: string, sourceType: IEmbedding['sourceType'], text: string): Promise<IEmbedding>;
105
+ /**
106
+ * Compute cosine similarity between two vectors.
107
+ * Assumes both vectors are already normalized (which they are from the pipeline).
108
+ */
109
+ declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
110
+ /**
111
+ * Find the most similar embeddings to a query vector.
112
+ */
113
+ declare function findSimilar(queryVector: Float32Array, candidates: IEmbedding[], topK?: number, threshold?: number): ISimilarityResult[];
114
+ /**
115
+ * Check if the embedding model is loaded.
116
+ */
117
+ declare function isModelLoaded(): boolean;
118
+ /**
119
+ * Unload the model to free memory.
120
+ */
121
+ declare function unloadModel(): void;
122
+
123
+ /**
124
+ * Persistent embedding store backed by SQLite.
125
+ * Stores and retrieves vector embeddings for semantic search.
126
+ * Uses sqlite-vss HNSW index when available, brute-force fallback otherwise.
127
+ */
128
+
129
+ /**
130
+ * Store an embedding in the database.
131
+ */
132
+ declare function storeEmbedding(embedding: IEmbedding, db: Database.Database): void;
133
+ /**
134
+ * Store multiple embeddings in a single transaction.
135
+ */
136
+ declare function storeEmbeddings(embeddings: IEmbedding[], db: Database.Database): void;
137
+ /**
138
+ * Load all embeddings of a given source type.
139
+ */
140
+ declare function loadEmbeddings(sourceType: IEmbedding['sourceType'], db: Database.Database): IEmbedding[];
141
+ /**
142
+ * Get a single embedding by source ID and type.
143
+ */
144
+ declare function getEmbedding(sourceId: string, sourceType: IEmbedding['sourceType'], db: Database.Database): IEmbedding | undefined;
145
+ /**
146
+ * Semantic search: find the most similar embeddings to a query vector.
147
+ * Uses sqlite-vss HNSW index when available (O(log n)), falls back to
148
+ * in-memory brute-force cosine similarity otherwise.
149
+ */
150
+ declare function semanticSearch(queryVector: Float32Array, sourceType: IEmbedding['sourceType'], db: Database.Database, topK?: number, threshold?: number): ISimilarityResult[];
151
+ /**
152
+ * Get the count of stored embeddings by type.
153
+ */
154
+ declare function getEmbeddingCount(sourceType: IEmbedding['sourceType'], db: Database.Database): number;
155
+ /**
156
+ * Delete embeddings by source type.
157
+ */
158
+ declare function deleteEmbeddings(sourceType: IEmbedding['sourceType'], db: Database.Database): number;
159
+
160
+ /**
161
+ * Training data exporter — extracts feedback data from SQLite
162
+ * and writes JSONL files suitable for LoRA fine-tuning.
163
+ *
164
+ * Produces adapter-specific datasets:
165
+ * - quality-scorer: prompt + code → score (regression)
166
+ * - prompt-enhancer: original prompt → improved prompt (text-to-text)
167
+ * - style-recommender: prompt → style label (classification)
168
+ */
169
+
170
+ /** A single JSONL row for quality-scorer training. */
171
+ interface IQualityScorerRow {
172
+ instruction: string;
173
+ input: string;
174
+ output: string;
175
+ }
176
+ /** A single JSONL row for prompt-enhancer training. */
177
+ interface IPromptEnhancerRow {
178
+ instruction: string;
179
+ input: string;
180
+ output: string;
181
+ }
182
+ /** A single JSONL row for style-recommender training. */
183
+ interface IStyleRecommenderRow {
184
+ instruction: string;
185
+ input: string;
186
+ output: string;
187
+ }
188
+ /**
189
+ * Export raw training examples from the feedback table.
190
+ * Returns scored feedback entries with all available metadata.
191
+ */
192
+ declare function exportRawExamples(db: Database.Database, opts?: {
193
+ minAbsScore?: number;
194
+ limit?: number;
195
+ }): ITrainingExample[];
196
+ /**
197
+ * Build quality-scorer training data.
198
+ * Format: instruction-following where the model predicts acceptance score.
199
+ */
200
+ declare function buildQualityScorerData(examples: ITrainingExample[]): IQualityScorerRow[];
201
+ /**
202
+ * Build prompt-enhancer training data.
203
+ * Pairs low-scored prompts with high-scored prompts for the same component type.
204
+ */
205
+ declare function buildPromptEnhancerData(examples: ITrainingExample[]): IPromptEnhancerRow[];
206
+ /**
207
+ * Build style-recommender training data.
208
+ * Format: prompt → recommended style name.
209
+ */
210
+ declare function buildStyleRecommenderData(examples: ITrainingExample[]): IStyleRecommenderRow[];
211
+ /**
212
+ * Write training data to a JSONL file.
213
+ * Creates parent directories if needed.
214
+ */
215
+ declare function writeJsonl<T extends object>(rows: T[], filePath: string): number;
216
+ /**
217
+ * Export adapter-specific training data to JSONL files.
218
+ * Returns the count of examples written per adapter.
219
+ */
220
+ declare function exportForAdapter(adapter: AdapterType, db: Database.Database, outputDir: string): {
221
+ path: string;
222
+ count: number;
223
+ };
224
+ /**
225
+ * Check if enough training data is available for a given adapter.
226
+ */
227
+ declare function hasEnoughData(adapter: AdapterType, db: Database.Database, includeSynthetic?: boolean): {
228
+ ready: boolean;
229
+ count: number;
230
+ required: number;
231
+ };
232
+
233
+ /**
234
+ * Model manager — handles model/adapter paths, directory setup,
235
+ * and model availability checks for the sidecar model system.
236
+ *
237
+ * All models and adapters are stored in `.uiforge/` (gitignored).
238
+ * Models are downloaded on first use and cached locally.
239
+ */
240
+
241
+ /** Model registry — known models and their download URLs. */
242
+ declare const MODEL_REGISTRY: {
243
+ readonly 'qwen2.5-0.5b': {
244
+ readonly filename: "qwen2.5-0.5b-instruct-q4_k_m.gguf";
245
+ readonly size: "~350MB";
246
+ readonly url: "https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/qwen2.5-0.5b-instruct-q4_k_m.gguf";
247
+ };
248
+ };
249
+ type ModelId = keyof typeof MODEL_REGISTRY;
250
+ /** Paths configuration for the ML subsystem. */
251
+ interface IModelPaths {
252
+ base: string;
253
+ models: string;
254
+ adapters: string;
255
+ trainingData: string;
256
+ embeddings: string;
257
+ }
258
+ /**
259
+ * Configure the base directory for all ML artifacts.
260
+ * Must be called before any other model-manager function.
261
+ */
262
+ declare function configureModelDir(baseDir: string): void;
263
+ /**
264
+ * Get the current base directory.
265
+ */
266
+ declare function getBaseDir(): string;
267
+ /**
268
+ * Get all standard paths for the ML subsystem.
269
+ */
270
+ declare function getModelPaths(): IModelPaths;
271
+ /**
272
+ * Ensure all required directories exist.
273
+ * Creates them recursively if missing.
274
+ */
275
+ declare function ensureDirectories(): IModelPaths;
276
+ /**
277
+ * Get the full path to a base model GGUF file.
278
+ */
279
+ declare function getModelPath(modelId: ModelId): string;
280
+ /**
281
+ * Get the full path to a LoRA adapter file.
282
+ */
283
+ declare function getAdapterPath(adapter: AdapterType): string;
284
+ /**
285
+ * Get the full path to a training data JSONL file.
286
+ */
287
+ declare function getTrainingDataPath(adapter: AdapterType): string;
288
+ /**
289
+ * Check if a base model is available locally.
290
+ */
291
+ declare function isModelAvailable(modelId: ModelId): boolean;
292
+ /**
293
+ * Check if a LoRA adapter is available locally.
294
+ */
295
+ declare function isAdapterAvailable(adapter: AdapterType): boolean;
296
+ /**
297
+ * Get the download URL for a model.
298
+ */
299
+ declare function getModelDownloadUrl(modelId: ModelId): string;
300
+ /**
301
+ * Get info about all available adapters.
302
+ */
303
+ declare function listAdapters(): Array<{
304
+ adapter: AdapterType;
305
+ available: boolean;
306
+ path: string;
307
+ sizeBytes: number;
308
+ }>;
309
+ /**
310
+ * Get info about all available models.
311
+ */
312
+ declare function listModels(): Array<{
313
+ modelId: ModelId;
314
+ available: boolean;
315
+ path: string;
316
+ sizeBytes: number;
317
+ }>;
318
+ /**
319
+ * Get total disk usage of all ML artifacts.
320
+ * Recursively calculates directory sizes.
321
+ */
322
+ declare function getDiskUsage(): {
323
+ totalBytes: number;
324
+ breakdown: Record<string, number>;
325
+ };
326
+
327
+ /**
328
+ * Training pipeline — orchestrates LoRA fine-tuning jobs.
329
+ *
330
+ * Flow: check readiness → export data → spawn training → track status → save adapter.
331
+ *
332
+ * Training runs as a background process via child_process so the MCP server
333
+ * stays responsive. Status is tracked in the SQLite training_jobs table.
334
+ *
335
+ * Note: Actual LoRA training requires the llama.cpp `finetune` binary
336
+ * or a Python training script. This module manages the orchestration layer.
337
+ */
338
+
339
+ /** Default LoRA configuration optimized for N100 CPU. */
340
+ declare const DEFAULT_LORA_CONFIG: ILoRAConfig;
341
+ /**
342
+ * Create a new training job record in the database.
343
+ */
344
+ declare function createTrainingJob(adapter: AdapterType, examplesCount: number, db: Database.Database): number;
345
+ /**
346
+ * Update training job status.
347
+ */
348
+ declare function updateJobStatus(jobId: number, status: ITrainingStatus['status'], progress: number, db: Database.Database, error?: string): void;
349
+ /**
350
+ * Get the latest training job status for an adapter.
351
+ */
352
+ declare function getLatestJobStatus(adapter: AdapterType, db: Database.Database): ITrainingStatus | null;
353
+ /**
354
+ * Get status of all training jobs.
355
+ */
356
+ declare function getAllJobStatuses(db: Database.Database): ITrainingStatus[];
357
+ /**
358
+ * Check if a training job is currently running for an adapter.
359
+ */
360
+ declare function isTraining(adapter: AdapterType): boolean;
361
+ /**
362
+ * Pre-flight check: verify all prerequisites for training.
363
+ */
364
+ declare function checkTrainingReadiness(adapter: AdapterType, modelId: ModelId, db: Database.Database): {
365
+ ready: boolean;
366
+ issues: string[];
367
+ };
368
+ /**
369
+ * Start a LoRA training job for the specified adapter.
370
+ *
371
+ * This exports training data, then spawns an external training process.
372
+ * The process can be:
373
+ * 1. llama.cpp `finetune` binary (if available)
374
+ * 2. A Python training script (if Python + PEFT are available)
375
+ * 3. A mock/stub for testing
376
+ *
377
+ * Returns the job ID for status tracking.
378
+ */
379
+ declare function startTrainingJob(adapter: AdapterType, modelId: ModelId, db: Database.Database, config?: ILoRAConfig, trainingCommand?: string): {
380
+ jobId: number;
381
+ status: ITrainingStatus;
382
+ };
383
+ /**
384
+ * Cancel a running training job.
385
+ */
386
+ declare function cancelTrainingJob(adapter: AdapterType, db: Database.Database): boolean;
387
+ /**
388
+ * Get a summary of the training pipeline state.
389
+ */
390
+ declare function getTrainingSummary(db: Database.Database): {
391
+ jobs: ITrainingStatus[];
392
+ dataReadiness: Record<AdapterType, {
393
+ ready: boolean;
394
+ count: number;
395
+ required: number;
396
+ }>;
397
+ activeCount: number;
398
+ };
399
+
400
+ /**
401
+ * Quality scorer — predicts whether generated code will be accepted by the user.
402
+ *
403
+ * Uses the sidecar model when available, otherwise falls back to
404
+ * heuristic scoring based on code structure analysis.
405
+ *
406
+ * Score range: 0-10 (0 = likely rejected, 10 = likely accepted).
407
+ */
408
+ /** Quality score result. */
409
+ interface IQualityScore {
410
+ /** Score from 0-10. */
411
+ score: number;
412
+ /** Confidence in the score (0-1). */
413
+ confidence: number;
414
+ /** Whether the score came from the model or heuristics. */
415
+ source: 'model' | 'heuristic';
416
+ /** Breakdown of heuristic factors (when source is 'heuristic'). */
417
+ factors?: Record<string, number>;
418
+ /** Inference latency in ms. */
419
+ latencyMs: number;
420
+ }
421
+ declare function scoreQuality(prompt: string, generatedCode: string, params?: {
422
+ componentType?: string;
423
+ framework?: string;
424
+ style?: string;
425
+ }): Promise<IQualityScore>;
426
+ /**
427
+ * Enhanced quality scoring with RAG-based a11y compliance checks.
428
+ * Retrieves relevant axe-core rules and checks violations against them.
429
+ */
430
+ declare function scoreQualityWithRAG(prompt: string, generatedCode: string, params?: {
431
+ componentType?: string;
432
+ framework?: string;
433
+ style?: string;
434
+ }): Promise<IQualityScore>;
435
+ /**
436
+ * Quick check: is the code likely acceptable? (score >= 6)
437
+ */
438
+ declare function isLikelyAccepted(prompt: string, generatedCode: string, params?: {
439
+ componentType?: string;
440
+ framework?: string;
441
+ style?: string;
442
+ }): Promise<boolean>;
443
+
444
+ /**
445
+ * Prompt enhancer — improves user prompts before sending to the host LLM.
446
+ *
447
+ * Uses the sidecar model when available, otherwise applies rule-based
448
+ * enhancement to add specificity, style hints, and structure guidance.
449
+ *
450
+ * Enhancement strategies:
451
+ * 1. Add missing context (framework, style, accessibility)
452
+ * 2. Expand vague terms into specific design tokens
453
+ * 3. Inject best-practice hints based on component type
454
+ */
455
+ /** Enhancement result. */
456
+ interface IEnhancedPrompt {
457
+ /** The enhanced prompt text. */
458
+ enhanced: string;
459
+ /** The original prompt text. */
460
+ original: string;
461
+ /** Whether the enhancement came from the model or rules. */
462
+ source: 'model' | 'rules';
463
+ /** What was added/changed. */
464
+ additions: string[];
465
+ /** Latency in ms. */
466
+ latencyMs: number;
467
+ }
468
+ /** Context for prompt enhancement. */
469
+ interface IEnhancementContext {
470
+ componentType?: string;
471
+ framework?: string;
472
+ style?: string;
473
+ mood?: string;
474
+ industry?: string;
475
+ }
476
+ /**
477
+ * Enhance a user prompt for better generation results.
478
+ */
479
+ declare function enhancePrompt(prompt: string, context?: IEnhancementContext): Promise<IEnhancedPrompt>;
480
+ /**
481
+ * Enhance using rule-based strategies.
482
+ */
483
+ declare function enhanceWithRules(prompt: string, context?: IEnhancementContext, start?: number): IEnhancedPrompt;
484
+ /**
485
+ * Async RAG-enhanced prompt enhancement.
486
+ * Retrieves relevant ARIA patterns and a11y rules to enrich the prompt.
487
+ */
488
+ declare function enhancePromptWithRAG(prompt: string, context?: IEnhancementContext): Promise<IEnhancedPrompt>;
489
+ /**
490
+ * Check if a prompt would benefit from enhancement.
491
+ */
492
+ declare function needsEnhancement(prompt: string): boolean;
493
+
494
+ /**
495
+ * Style recommender — suggests design tokens based on prompt context.
496
+ *
497
+ * Uses RAG retrieval from ingested design tokens (Material Design 3, Primer)
498
+ * to recommend appropriate styling. Falls back to heuristic industry/mood
499
+ * lookup when no embeddings are available.
500
+ */
501
+
502
+ interface IStyleRecommendation {
503
+ primaryColor: string;
504
+ secondaryColor: string;
505
+ fontFamily: string;
506
+ spacing: string;
507
+ borderRadius: string;
508
+ designSystem: string;
509
+ confidence: number;
510
+ source: 'rag' | 'heuristic';
511
+ matchedTokens: ISimilarityResult[];
512
+ }
513
+ interface IStyleContext {
514
+ industry?: string;
515
+ mood?: string;
516
+ }
517
+ declare function recommendStyle(prompt: string, context?: IStyleContext): Promise<IStyleRecommendation>;
518
+
519
+ type ComponentCategory = 'atom' | 'molecule' | 'organism';
520
+ type MoodTag = 'bold' | 'calm' | 'playful' | 'professional' | 'premium' | 'energetic' | 'minimal' | 'editorial' | 'futuristic' | 'warm' | 'corporate' | 'creative';
521
+ type IndustryTag = 'saas' | 'fintech' | 'ecommerce' | 'healthcare' | 'education' | 'startup' | 'agency' | 'media' | 'devtools' | 'general';
522
+ type VisualStyleId = 'glassmorphism' | 'neubrutalism' | 'soft-depth' | 'bento-grid' | 'gradient-mesh' | 'dark-premium' | 'minimal-editorial' | 'linear-modern' | 'retro-playful' | 'corporate-trust';
523
+ interface IComponentA11y {
524
+ roles: string[];
525
+ ariaAttributes: string[];
526
+ htmlAttributes?: string[];
527
+ keyboardNav: string;
528
+ contrastRatio: string;
529
+ focusVisible: boolean;
530
+ reducedMotion: boolean;
531
+ }
532
+ interface IComponentSeo {
533
+ semanticElement: string;
534
+ headingLevel?: string;
535
+ landmark?: string;
536
+ }
537
+ interface IComponentResponsive {
538
+ strategy: 'mobile-first' | 'container-query';
539
+ breakpoints: string[];
540
+ }
541
+ interface IComponentQuality {
542
+ antiGeneric: string[];
543
+ inspirationSource: string;
544
+ craftDetails: string[];
545
+ }
546
+ interface IComponentSnippet {
547
+ id: string;
548
+ name: string;
549
+ category: ComponentCategory;
550
+ type: string;
551
+ variant: string;
552
+ tags: string[];
553
+ mood: MoodTag[];
554
+ industry: IndustryTag[];
555
+ visualStyles: VisualStyleId[];
556
+ jsx: string;
557
+ tailwindClasses: Record<string, string>;
558
+ css?: string;
559
+ animations?: string[];
560
+ dependencies?: string[];
561
+ a11y: IComponentA11y;
562
+ seo?: IComponentSeo;
563
+ responsive: IComponentResponsive;
564
+ quality: IComponentQuality;
565
+ }
566
+ type AnimationCategory = 'entrance' | 'hover' | 'scroll' | 'loading' | 'text' | 'transition' | 'feedback' | 'background' | 'button' | 'card' | 'list' | 'modal' | 'navigation' | 'chart';
567
+ type AnimationPurpose = 'user-feedback' | 'attention' | 'delight' | 'confirmation' | 'orientation' | 'progress';
568
+ interface IMicroInteraction {
569
+ id: string;
570
+ name: string;
571
+ category: AnimationCategory;
572
+ purpose: AnimationPurpose[];
573
+ tailwindClasses: string;
574
+ css?: string;
575
+ keyframes?: string;
576
+ reducedMotionFallback: string;
577
+ duration: string;
578
+ description: string;
579
+ }
580
+ interface IComponentQuery {
581
+ type?: string;
582
+ variant?: string;
583
+ mood?: MoodTag;
584
+ industry?: IndustryTag;
585
+ style?: VisualStyleId;
586
+ category?: ComponentCategory;
587
+ tags?: string[];
588
+ }
589
+ interface ISearchResult {
590
+ snippet: IComponentSnippet;
591
+ score: number;
592
+ }
593
+
594
+ /**
595
+ * Image Design Analyzer
596
+ *
597
+ * Extracts structured design patterns from UI screenshots/mockups for ML training.
598
+ * Does NOT store images - only extracts and stores structured design data.
599
+ */
600
+
601
+ interface IDesignAnalysis {
602
+ /** Detected color palette */
603
+ colors: {
604
+ primary: string[];
605
+ secondary: string[];
606
+ accent: string[];
607
+ background: string[];
608
+ text: string[];
609
+ };
610
+ /** Typography information */
611
+ typography: {
612
+ fontFamilies: string[];
613
+ headingSizes: string[];
614
+ bodySizes: string[];
615
+ weights: string[];
616
+ };
617
+ /** Spacing and layout */
618
+ spacing: {
619
+ system: string;
620
+ padding: string[];
621
+ margin: string[];
622
+ gap: string[];
623
+ };
624
+ /** Detected UI components */
625
+ components: Array<{
626
+ type: string;
627
+ variant?: string;
628
+ description: string;
629
+ }>;
630
+ /** Layout patterns */
631
+ layout: {
632
+ type: string;
633
+ structure: string;
634
+ responsive: boolean;
635
+ };
636
+ /** Visual style classification */
637
+ visualStyle: {
638
+ primary: VisualStyleId;
639
+ characteristics: string[];
640
+ };
641
+ /** Inferred mood and industry */
642
+ mood: MoodTag[];
643
+ industry: IndustryTag[];
644
+ /** Overall design quality score (0-1) */
645
+ qualityScore: number;
646
+ /** Additional metadata */
647
+ metadata: {
648
+ complexity: 'simple' | 'moderate' | 'complex';
649
+ modernityScore: number;
650
+ accessibilityNotes: string[];
651
+ };
652
+ }
653
+ /**
654
+ * Analyze an image description and generated code to extract design patterns.
655
+ * This function processes the output from image_to_component to extract structured design data.
656
+ */
657
+ declare function extractDesignPatterns(imageDescription: string, generatedCode: string, componentTypes: string[]): IDesignAnalysis;
658
+
659
+ /**
660
+ * Design-to-Training-Data Converter
661
+ *
662
+ * Converts extracted design patterns into ML training data format.
663
+ * Integrates with existing feedback system and pattern detection.
664
+ */
665
+
666
+ interface ITrainingDataResult {
667
+ snippetsCreated: number;
668
+ feedbackEntriesCreated: number;
669
+ patternsDetected: number;
670
+ summary: string;
671
+ }
672
+ /**
673
+ * Convert design analysis into training data and store in database.
674
+ * This is the main entry point for the image-to-training-data pipeline.
675
+ */
676
+ declare function storeDesignLearning(analysis: IDesignAnalysis, generatedCode: string, componentName: string, framework: string, db: Database.Database): ITrainingDataResult;
677
+
678
+ interface IDesignContext {
679
+ typography: {
680
+ fontFamily: string;
681
+ headingFont?: string;
682
+ fontSize: {
683
+ xs: string;
684
+ sm: string;
685
+ base: string;
686
+ lg: string;
687
+ xl: string;
688
+ '2xl': string;
689
+ '3xl': string;
690
+ };
691
+ fontWeight: {
692
+ normal: string;
693
+ medium: string;
694
+ semibold: string;
695
+ bold: string;
696
+ };
697
+ lineHeight: {
698
+ tight: string;
699
+ normal: string;
700
+ relaxed: string;
701
+ };
702
+ };
703
+ colorPalette: {
704
+ primary: string;
705
+ primaryForeground: string;
706
+ secondary: string;
707
+ secondaryForeground: string;
708
+ accent: string;
709
+ accentForeground: string;
710
+ background: string;
711
+ foreground: string;
712
+ muted: string;
713
+ mutedForeground: string;
714
+ border: string;
715
+ destructive: string;
716
+ destructiveForeground: string;
717
+ };
718
+ spacing: {
719
+ unit: number;
720
+ scale: number[];
721
+ };
722
+ borderRadius: {
723
+ sm: string;
724
+ md: string;
725
+ lg: string;
726
+ full: string;
727
+ };
728
+ shadows: {
729
+ sm: string;
730
+ md: string;
731
+ lg: string;
732
+ };
733
+ iconSet?: string;
734
+ animationLib?: string;
735
+ buttonVariants?: IButtonVariant[];
736
+ }
737
+ interface IButtonVariant {
738
+ name: string;
739
+ className: string;
740
+ styles: Record<string, string>;
741
+ }
742
+ interface IGeneratedFile {
743
+ path: string;
744
+ content: string;
745
+ encoding?: 'utf-8' | 'base64';
746
+ }
747
+ interface IScreenElement {
748
+ id: string;
749
+ type: 'heading' | 'text' | 'button' | 'input' | 'image' | 'card' | 'nav' | 'list' | 'container' | 'icon' | 'divider';
750
+ label?: string;
751
+ placeholder?: string;
752
+ children?: IScreenElement[];
753
+ styles?: Record<string, string>;
754
+ action?: string;
755
+ }
756
+ interface ITransition {
757
+ from: string;
758
+ to: string;
759
+ trigger: 'click' | 'tap' | 'hover' | 'auto';
760
+ animation?: 'fade' | 'slide-left' | 'slide-right' | 'slide-up' | 'none';
761
+ targetElement?: string;
762
+ }
763
+ interface IFigmaVariable {
764
+ name: string;
765
+ type: 'COLOR' | 'FLOAT' | 'STRING';
766
+ value: string | number;
767
+ collection?: string;
768
+ }
769
+ interface IFigmaDesignToken {
770
+ name: string;
771
+ type: string;
772
+ value: string | number;
773
+ category: 'color' | 'spacing' | 'typography' | 'borderRadius' | 'shadow';
774
+ }
775
+ interface ITailwindMapping {
776
+ className: string;
777
+ cssProperty: string;
778
+ value: string;
779
+ }
780
+ type Framework = 'react' | 'nextjs' | 'vue' | 'angular' | 'svelte' | 'html';
781
+ type Architecture = 'flat' | 'feature-based' | 'atomic';
782
+ type StateManagement$1 = 'useState' | 'zustand' | 'pinia' | 'signals' | 'stores' | 'none';
783
+ type ImageType = 'wireframe' | 'mockup' | 'component_preview';
784
+ type ComponentLibraryId = 'shadcn' | 'radix' | 'headlessui' | 'primevue' | 'material' | 'none';
785
+ type PageTemplateType = 'landing' | 'dashboard' | 'auth_login' | 'auth_signup' | 'pricing' | 'settings' | 'crud_table' | 'blog_list' | 'onboarding' | 'error_404' | 'ecommerce_plp' | 'ecommerce_pdp' | 'ecommerce_cart' | 'ecommerce_checkout' | 'ai_chat' | 'changelog' | 'team_members' | 'settings_billing' | 'api_keys' | 'analytics' | 'profile' | 'file_manager' | 'kanban' | 'calendar' | 'docs' | 'faq' | 'blog_post';
786
+ type AccessibilitySeverity = 'error' | 'warning' | 'info';
787
+ interface IAccessibilityIssue {
788
+ rule: string;
789
+ severity: AccessibilitySeverity;
790
+ message: string;
791
+ element?: string;
792
+ suggestion: string;
793
+ wcagCriteria?: string;
794
+ }
795
+ interface IAccessibilityReport {
796
+ score: number;
797
+ issues: IAccessibilityIssue[];
798
+ summary: {
799
+ errors: number;
800
+ warnings: number;
801
+ info: number;
802
+ };
803
+ passed: string[];
804
+ }
805
+ interface IFontPairing {
806
+ name: string;
807
+ heading: {
808
+ family: string;
809
+ weights: number[];
810
+ googleFontsUrl: string;
811
+ };
812
+ body: {
813
+ family: string;
814
+ weights: number[];
815
+ googleFontsUrl: string;
816
+ };
817
+ accent?: {
818
+ family: string;
819
+ weights: number[];
820
+ googleFontsUrl: string;
821
+ };
822
+ mood: string[];
823
+ bestFor: string[];
824
+ cssImport: string;
825
+ }
826
+ interface IColorSystem {
827
+ name: string;
828
+ description: string;
829
+ mood: string[];
830
+ light: Record<string, string>;
831
+ dark: Record<string, string>;
832
+ tailwindExtend: Record<string, Record<string, string>>;
833
+ }
834
+ interface ISpacingSystem {
835
+ baseUnit: number;
836
+ scale: Record<string, string>;
837
+ breakpoints: Record<string, string>;
838
+ containers: Record<string, string>;
839
+ borderRadius: Record<string, string>;
840
+ shadows: Record<string, string>;
841
+ }
842
+ interface IIconLibrary {
843
+ name: string;
844
+ style: string;
845
+ count: string;
846
+ importPackage: Record<string, string>;
847
+ cdnUrl?: string;
848
+ recommended: string[];
849
+ }
850
+ interface IAnimationPreset {
851
+ name: string;
852
+ category: 'transition' | 'micro-interaction' | 'loading' | 'scroll';
853
+ css: string;
854
+ tailwindClass?: string;
855
+ duration: string;
856
+ }
857
+ interface ILayoutPattern {
858
+ name: string;
859
+ description: string;
860
+ components: string[];
861
+ useCase: string[];
862
+ responsiveBehavior: string;
863
+ tailwindClasses: Record<string, string>;
864
+ }
865
+ interface IComponentLibrary {
866
+ name: string;
867
+ description: string;
868
+ frameworks: string[];
869
+ installPackage: Record<string, string>;
870
+ docsUrl: string;
871
+ features: string[];
872
+ recommended: boolean;
873
+ }
874
+ interface IInspirationSource {
875
+ name: string;
876
+ url: string;
877
+ category: 'gallery' | 'design-system' | 'typography' | 'color' | 'icons';
878
+ description: string;
879
+ priority: number;
880
+ }
881
+ interface IScrapedPage {
882
+ url: string;
883
+ title: string;
884
+ screenshot?: Buffer;
885
+ colors: string[];
886
+ fonts: string[];
887
+ fontSizes: string[];
888
+ spacing: string[];
889
+ layoutPatterns: string[];
890
+ componentTypes: string[];
891
+ meta: Record<string, string>;
892
+ }
893
+ interface IImageAnalysis {
894
+ label: string;
895
+ dominantColors: Array<{
896
+ hex: string;
897
+ percentage: number;
898
+ }>;
899
+ layoutRegions: Array<{
900
+ role: string;
901
+ bounds: {
902
+ x: number;
903
+ y: number;
904
+ width: number;
905
+ height: number;
906
+ };
907
+ }>;
908
+ detectedComponents: string[];
909
+ dimensions: {
910
+ width: number;
911
+ height: number;
912
+ };
913
+ }
914
+ interface IPatternMatch {
915
+ category: 'color' | 'typography' | 'layout' | 'component' | 'spacing';
916
+ pattern: string;
917
+ confidence: number;
918
+ sources: string[];
919
+ }
920
+ interface IDesignAnalysisResult {
921
+ references: Array<{
922
+ source: string;
923
+ colors: string[];
924
+ fonts: string[];
925
+ layouts: string[];
926
+ components: string[];
927
+ }>;
928
+ commonPatterns: IPatternMatch[];
929
+ suggestedContext: Partial<IDesignContext>;
930
+ screenshots: Array<{
931
+ source: string;
932
+ data: string;
933
+ }>;
934
+ }
935
+
936
+ /**
937
+ * Component library types supported by UIForge
938
+ */
939
+ type ComponentLibrary = 'shadcn' | 'radix' | 'headlessui' | 'primevue' | 'material' | 'none';
940
+ /**
941
+ * Abstract base class for all framework generators
942
+ * Provides common functionality and enforces consistent interface
943
+ */
944
+ declare abstract class BaseGenerator {
945
+ protected readonly framework: Framework;
946
+ protected readonly logger: pino.Logger;
947
+ constructor(framework: Framework);
948
+ /**
949
+ * Generate a complete project
950
+ * @param projectName Project name
951
+ * @param architecture Architecture pattern
952
+ * @param stateManagement State management approach
953
+ * @param designContext Design context
954
+ * @returns Array of generated files
955
+ */
956
+ abstract generateProject(projectName: string, architecture: Architecture, stateManagement: StateManagement$1, designContext: IDesignContext): IGeneratedFile[];
957
+ /**
958
+ * Generate a UI component
959
+ * @param componentType Component type
960
+ * @param props Component props
961
+ * @param designContext Design context
962
+ * @param componentLibrary Component library to use
963
+ * @returns Array of generated files
964
+ */
965
+ abstract generateComponent(componentType: string, props: Record<string, unknown>, designContext: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
966
+ /**
967
+ * Get the framework this generator handles
968
+ * @returns Framework type
969
+ */
970
+ getFramework(): Framework;
971
+ /**
972
+ * Get component library dependencies for the current framework
973
+ * @param componentLibrary Component library type
974
+ * @returns Array of dependency names
975
+ */
976
+ protected getComponentLibraryDependencies(componentLibrary: ComponentLibrary): string[];
977
+ /**
978
+ * Get component library imports for the current framework
979
+ * @param componentLibrary Component library type
980
+ * @returns Array of import statements
981
+ */
982
+ protected getComponentLibraryImports(componentLibrary: ComponentLibrary): string[];
983
+ /**
984
+ * Generate component library-specific component code
985
+ * @param componentType Component type
986
+ * @param props Component props
987
+ * @param componentLibrary Component library type
988
+ * @returns Generated component code
989
+ */
990
+ protected generateComponentLibraryCode(componentType: string, props: Record<string, unknown>, componentLibrary: ComponentLibrary): string;
991
+ protected abstract getShadcnDependencies(): string[];
992
+ protected abstract getRadixDependencies(): string[];
993
+ protected abstract getHeadlessUIDependencies(): string[];
994
+ protected abstract getPrimeVueDependencies(): string[];
995
+ protected abstract getMaterialDependencies(): string[];
996
+ protected abstract getShadcnImports(): string[];
997
+ protected abstract getRadixImports(): string[];
998
+ protected abstract getHeadlessUIImports(): string[];
999
+ protected abstract getPrimeVueImports(): string[];
1000
+ protected abstract getMaterialImports(): string[];
1001
+ protected abstract generateShadcnComponent(componentType: string, props: Record<string, unknown>): string;
1002
+ protected abstract generateRadixComponent(componentType: string, props: Record<string, unknown>): string;
1003
+ protected abstract generateHeadlessUIComponent(componentType: string, props: Record<string, unknown>): string;
1004
+ protected abstract generatePrimeVueComponent(componentType: string, props: Record<string, unknown>): string;
1005
+ protected abstract generateMaterialComponent(componentType: string, props: Record<string, unknown>): string;
1006
+ protected abstract generateTailwindComponent(componentType: string, props: Record<string, unknown>): string;
1007
+ /**
1008
+ * Validate generation parameters
1009
+ * @param params Parameters to validate
1010
+ * @returns Validation result
1011
+ */
1012
+ protected validateParams(params: {
1013
+ projectName?: string;
1014
+ componentType?: string;
1015
+ architecture?: Architecture;
1016
+ stateManagement?: StateManagement$1;
1017
+ }): {
1018
+ valid: boolean;
1019
+ errors: string[];
1020
+ };
1021
+ /**
1022
+ * Format component name based on framework conventions
1023
+ * @param componentType Component type
1024
+ * @returns Formatted component name
1025
+ */
1026
+ protected formatComponentName(componentType: string): string;
1027
+ /**
1028
+ * Get file extension for this framework
1029
+ * @returns File extension
1030
+ */
1031
+ protected getFileExtension(): string;
1032
+ /**
1033
+ * Create a basic package.json for the project
1034
+ * @param projectName Project name
1035
+ * @param dependencies Project dependencies
1036
+ * @param devDependencies Development dependencies
1037
+ * @returns Package.json content
1038
+ */
1039
+ protected createPackageJson(projectName: string, dependencies: Record<string, string>, devDependencies: Record<string, string>): string;
1040
+ /**
1041
+ * Get default scripts for package.json
1042
+ * @returns Default scripts object
1043
+ */
1044
+ protected getDefaultScripts(): Record<string, string>;
1045
+ /**
1046
+ * Create TypeScript configuration
1047
+ * @returns TypeScript config content
1048
+ */
1049
+ protected createTsConfig(): string;
1050
+ /**
1051
+ * Create Vite configuration
1052
+ * @returns Vite config content
1053
+ */
1054
+ protected createViteConfig(): string;
1055
+ /**
1056
+ * Get Vite plugin import statement
1057
+ * @returns Import statement
1058
+ */
1059
+ protected getVitePluginImport(): string;
1060
+ /**
1061
+ * Get Vite plugin package
1062
+ * @returns Package name
1063
+ */
1064
+ protected getVitePluginPackage(): string;
1065
+ /**
1066
+ * Get Vite plugin configuration
1067
+ * @returns Plugin configuration
1068
+ */
1069
+ protected getVitePluginConfig(): string;
1070
+ /**
1071
+ * Create README.md content
1072
+ * @param projectName Project name
1073
+ * @returns README content
1074
+ */
1075
+ protected createReadme(projectName: string): string;
1076
+ /**
1077
+ * Get framework documentation URL
1078
+ * @returns Documentation URL
1079
+ */
1080
+ protected getFrameworkDocsUrl(): string;
1081
+ /**
1082
+ * Log generation start
1083
+ * @param type Generation type
1084
+ * @param target Target name
1085
+ */
1086
+ protected logStart(type: 'project' | 'component', target: string): void;
1087
+ /**
1088
+ * Log generation completion
1089
+ * @param type Generation type
1090
+ * @param target Target name
1091
+ * @param fileCount Number of files generated
1092
+ */
1093
+ protected logComplete(type: 'project' | 'component', target: string, fileCount: number): void;
1094
+ }
1095
+
1096
+ type GeneratorConstructor = new (framework: Framework) => BaseGenerator;
1097
+ /**
1098
+ * Generator Factory - Creates and manages framework generators
1099
+ * Provides a unified interface for creating generators and ensures consistent behavior
1100
+ */
1101
+ declare class GeneratorFactory {
1102
+ private static instance;
1103
+ private generators;
1104
+ private instances;
1105
+ private constructor();
1106
+ /**
1107
+ * Get singleton instance
1108
+ * @returns GeneratorFactory instance
1109
+ */
1110
+ static getInstance(): GeneratorFactory;
1111
+ /**
1112
+ * Register a generator class for a framework
1113
+ * @param framework Framework type
1114
+ * @param generatorClass Generator class constructor
1115
+ */
1116
+ registerGenerator(framework: Framework, generatorClass: GeneratorConstructor): void;
1117
+ /**
1118
+ * Create a generator instance for the specified framework
1119
+ * @param framework Framework type
1120
+ * @returns Generator instance
1121
+ */
1122
+ createGenerator(framework: Framework): BaseGenerator;
1123
+ /**
1124
+ * Generate a project using the specified framework
1125
+ * @param framework Framework type
1126
+ * @param projectName Project name
1127
+ * @param architecture Architecture pattern
1128
+ * @param stateManagement State management approach
1129
+ * @param designContext Design context
1130
+ * @returns Array of generated files
1131
+ */
1132
+ generateProject(framework: Framework, projectName: string, architecture: Architecture, stateManagement: StateManagement$1, designContext?: IDesignContext): IGeneratedFile[];
1133
+ /**
1134
+ * Generate a UI component
1135
+ * @param framework Target framework
1136
+ * @param componentType Component type
1137
+ * @param props Component props
1138
+ * @param designContext Design context
1139
+ * @param componentLibrary Component library to use
1140
+ * @returns Array of generated files
1141
+ */
1142
+ generateComponent(framework: Framework, componentType: string, props: Record<string, unknown>, designContext?: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1143
+ /**
1144
+ * Get list of supported frameworks
1145
+ * @returns Array of supported framework types
1146
+ */
1147
+ getSupportedFrameworks(): Framework[];
1148
+ /**
1149
+ * Check if a framework is supported
1150
+ * @param framework Framework to check
1151
+ * @returns True if supported
1152
+ */
1153
+ isFrameworkSupported(framework: string): framework is Framework;
1154
+ /**
1155
+ * Get generator information for all supported frameworks
1156
+ * @returns Array of generator information
1157
+ */
1158
+ getGeneratorInfo(): Array<{
1159
+ framework: Framework;
1160
+ className: string;
1161
+ isInstantiated: boolean;
1162
+ }>;
1163
+ /**
1164
+ * Clear all cached instances
1165
+ */
1166
+ clearInstances(): void;
1167
+ /**
1168
+ * Clear instance for a specific framework
1169
+ * @param framework Framework to clear
1170
+ */
1171
+ clearInstance(framework: Framework): void;
1172
+ /**
1173
+ * Unregister a generator
1174
+ * @param framework Framework to unregister
1175
+ */
1176
+ unregisterGenerator(framework: Framework): void;
1177
+ /**
1178
+ * Get default design context
1179
+ * @returns Default design context
1180
+ */
1181
+ private getDefaultContext;
1182
+ /**
1183
+ * Register default generators for all supported frameworks
1184
+ */
1185
+ private registerDefaultGenerators;
1186
+ }
1187
+ /**
1188
+ * Convenience function to generate a component
1189
+ * @param framework Framework type
1190
+ * @param componentType Component type
1191
+ * @param props Component props
1192
+ * @param designContext Design context
1193
+ * @param componentLibrary Component library to use
1194
+ * @returns Array of generated files
1195
+ */
1196
+ declare function generateComponent(framework: Framework, componentType: string, props: Record<string, unknown>, designContext?: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1197
+
1198
+ /**
1199
+ * Default design context constant
1200
+ * Shared across the application for consistent default values
1201
+ */
1202
+ declare const DEFAULT_DESIGN_CONTEXT: IDesignContext;
1203
+
1204
+ /**
1205
+ * React Generator - Generates React components and projects
1206
+ */
1207
+ declare class ReactGenerator extends BaseGenerator {
1208
+ constructor(framework: Framework);
1209
+ /**
1210
+ * Generate a complete React project
1211
+ */
1212
+ generateProject(projectName: string, architecture: Architecture, stateManagement: StateManagement$1, designContext: IDesignContext): IGeneratedFile[];
1213
+ /**
1214
+ * Generate a React component
1215
+ */
1216
+ generateComponent(componentType: string, props: Record<string, unknown>, designContext: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1217
+ private createPackageJsonFile;
1218
+ private createTsConfigFile;
1219
+ private createViteConfigFile;
1220
+ private createReadmeFile;
1221
+ private createAppComponent;
1222
+ private createIndexHtmlFile;
1223
+ private createTailwindConfig;
1224
+ private createStateManagementFiles;
1225
+ private createComponentFile;
1226
+ private createStorybookFile;
1227
+ private createTestFile;
1228
+ protected getShadcnDependencies(): string[];
1229
+ protected getRadixDependencies(): string[];
1230
+ protected getHeadlessUIDependencies(): string[];
1231
+ protected getPrimeVueDependencies(): string[];
1232
+ protected getMaterialDependencies(): string[];
1233
+ protected getShadcnImports(): string[];
1234
+ protected getRadixImports(): string[];
1235
+ protected getHeadlessUIImports(): string[];
1236
+ protected getPrimeVueImports(): string[];
1237
+ protected getMaterialImports(): string[];
1238
+ protected generateShadcnComponent(componentType: string, props: Record<string, unknown>): string;
1239
+ protected generateRadixComponent(componentType: string, props: Record<string, unknown>): string;
1240
+ protected generateHeadlessUIComponent(componentType: string, props: Record<string, unknown>): string;
1241
+ protected generatePrimeVueComponent(componentType: string, props: Record<string, unknown>): string;
1242
+ protected generateMaterialComponent(componentType: string, props: Record<string, unknown>): string;
1243
+ protected generateTailwindComponent(componentType: string, props: Record<string, unknown>): string;
1244
+ private generatePropsInterface;
1245
+ private getHtmlElementForComponentType;
1246
+ private getTailwindClassesForComponentType;
1247
+ }
1248
+
1249
+ /**
1250
+ * Vue Generator - Generates Vue components and projects
1251
+ */
1252
+ declare class VueGenerator extends BaseGenerator {
1253
+ constructor(framework: Framework);
1254
+ generateProject(projectName: string, _architecture: Architecture, _stateManagement: StateManagement$1, _designContext: IDesignContext): IGeneratedFile[];
1255
+ generateComponent(componentType: string, props: Record<string, unknown>, designContext: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1256
+ protected getShadcnDependencies(): string[];
1257
+ protected getRadixDependencies(): string[];
1258
+ protected getHeadlessUIDependencies(): string[];
1259
+ protected getPrimeVueDependencies(): string[];
1260
+ protected getMaterialDependencies(): string[];
1261
+ protected getShadcnImports(): string[];
1262
+ protected getRadixImports(): string[];
1263
+ protected getHeadlessUIImports(): string[];
1264
+ protected getPrimeVueImports(): string[];
1265
+ protected getMaterialImports(): string[];
1266
+ protected generateShadcnComponent(componentType: string, _props: Record<string, unknown>): string;
1267
+ protected generateRadixComponent(componentType: string, _props: Record<string, unknown>): string;
1268
+ protected generateHeadlessUIComponent(componentType: string, _props: Record<string, unknown>): string;
1269
+ protected generatePrimeVueComponent(componentType: string, _props: Record<string, unknown>): string;
1270
+ protected generateMaterialComponent(componentType: string, _props: Record<string, unknown>): string;
1271
+ protected generateTailwindComponent(componentType: string, _props: Record<string, unknown>): string;
1272
+ private createComponentFile;
1273
+ private createTestFile;
1274
+ }
1275
+
1276
+ /**
1277
+ * Angular Generator - Generates Angular components and projects
1278
+ */
1279
+ declare class AngularGenerator extends BaseGenerator {
1280
+ constructor(framework: Framework);
1281
+ generateProject(projectName: string, _architecture: Architecture, _stateManagement: StateManagement$1, _designContext: IDesignContext): IGeneratedFile[];
1282
+ generateComponent(componentType: string, props: Record<string, unknown>, designContext: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1283
+ protected getShadcnDependencies(): string[];
1284
+ protected getRadixDependencies(): string[];
1285
+ protected getHeadlessUIDependencies(): string[];
1286
+ protected getPrimeVueDependencies(): string[];
1287
+ protected getMaterialDependencies(): string[];
1288
+ protected getShadcnImports(): string[];
1289
+ protected getRadixImports(): string[];
1290
+ protected getHeadlessUIImports(): string[];
1291
+ protected getPrimeVueImports(): string[];
1292
+ protected getMaterialImports(): string[];
1293
+ protected generateShadcnComponent(componentType: string, _props: Record<string, unknown>): string;
1294
+ protected generateRadixComponent(componentType: string, _props: Record<string, unknown>): string;
1295
+ protected generateHeadlessUIComponent(componentType: string, _props: Record<string, unknown>): string;
1296
+ protected generatePrimeVueComponent(componentType: string, _props: Record<string, unknown>): string;
1297
+ protected generateMaterialComponent(componentType: string, _props: Record<string, unknown>): string;
1298
+ protected generateTailwindComponent(componentType: string, _props: Record<string, unknown>): string;
1299
+ private createComponentFile;
1300
+ private createTestFile;
1301
+ }
1302
+
1303
+ /**
1304
+ * Svelte Generator - Generates Svelte components and projects
1305
+ */
1306
+ declare class SvelteGenerator extends BaseGenerator {
1307
+ constructor(framework: Framework);
1308
+ generateProject(projectName: string, _architecture: Architecture, _stateManagement: StateManagement$1, _designContext: IDesignContext): IGeneratedFile[];
1309
+ generateComponent(componentType: string, props: Record<string, unknown>, designContext: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1310
+ protected getShadcnDependencies(): string[];
1311
+ protected getRadixDependencies(): string[];
1312
+ protected getHeadlessUIDependencies(): string[];
1313
+ protected getPrimeVueDependencies(): string[];
1314
+ protected getMaterialDependencies(): string[];
1315
+ protected getShadcnImports(): string[];
1316
+ protected getRadixImports(): string[];
1317
+ protected getHeadlessUIImports(): string[];
1318
+ protected getPrimeVueImports(): string[];
1319
+ protected getMaterialImports(): string[];
1320
+ protected generateShadcnComponent(componentType: string, _props: Record<string, unknown>): string;
1321
+ protected generateRadixComponent(componentType: string, _props: Record<string, unknown>): string;
1322
+ protected generateHeadlessUIComponent(componentType: string, _props: Record<string, unknown>): string;
1323
+ protected generatePrimeVueComponent(componentType: string, _props: Record<string, unknown>): string;
1324
+ protected generateMaterialComponent(componentType: string, _props: Record<string, unknown>): string;
1325
+ protected generateTailwindComponent(componentType: string, _props: Record<string, unknown>): string;
1326
+ private createComponentFile;
1327
+ private createTestFile;
1328
+ }
1329
+
1330
+ /**
1331
+ * HTML Generator - Generates HTML components and projects
1332
+ */
1333
+ declare class HtmlGenerator extends BaseGenerator {
1334
+ constructor(framework: Framework);
1335
+ generateProject(projectName: string, _architecture: Architecture, _stateManagement: StateManagement$1, _designContext: IDesignContext): IGeneratedFile[];
1336
+ generateComponent(componentType: string, props: Record<string, unknown>, designContext: IDesignContext, componentLibrary?: ComponentLibrary): IGeneratedFile[];
1337
+ protected getShadcnDependencies(): string[];
1338
+ protected getRadixDependencies(): string[];
1339
+ protected getHeadlessUIDependencies(): string[];
1340
+ protected getPrimeVueDependencies(): string[];
1341
+ protected getMaterialDependencies(): string[];
1342
+ protected getShadcnImports(): string[];
1343
+ protected getRadixImports(): string[];
1344
+ protected getHeadlessUIImports(): string[];
1345
+ protected getPrimeVueImports(): string[];
1346
+ protected getMaterialImports(): string[];
1347
+ protected generateShadcnComponent(componentType: string, _props: Record<string, unknown>): string;
1348
+ protected generateRadixComponent(componentType: string, _props: Record<string, unknown>): string;
1349
+ protected generateHeadlessUIComponent(componentType: string, _props: Record<string, unknown>): string;
1350
+ protected generatePrimeVueComponent(componentType: string, _props: Record<string, unknown>): string;
1351
+ protected generateMaterialComponent(componentType: string, _props: Record<string, unknown>): string;
1352
+ protected generateTailwindComponent(componentType: string, _props: Record<string, unknown>): string;
1353
+ private createComponentFile;
1354
+ }
1355
+
1356
+ /**
1357
+ * Register a component snippet into the knowledge base.
1358
+ * Validates input and normalizes fields for consistent searching.
1359
+ */
1360
+ declare function registerSnippet(snippet: IComponentSnippet): void;
1361
+ /**
1362
+ * Clear the registry (for testing).
1363
+ */
1364
+ declare function clearRegistry(): void;
1365
+ /**
1366
+ * Register multiple snippets at once.
1367
+ */
1368
+ declare function registerSnippets(snippets: IComponentSnippet[]): void;
1369
+ /**
1370
+ * Get a snippet by exact ID.
1371
+ */
1372
+ declare function getSnippetById(id: string): IComponentSnippet | undefined;
1373
+ /**
1374
+ * Get all registered snippets count.
1375
+ */
1376
+ declare function getRegistrySize(): number;
1377
+ /**
1378
+ * Get a shallow copy of all registered snippets.
1379
+ */
1380
+ declare function getAllSnippets(): IComponentSnippet[];
1381
+ /**
1382
+ * Search components using tag-based fuzzy scoring.
1383
+ * Scores are computed by matching mood, industry, style, type, tags, and category.
1384
+ */
1385
+ declare function searchComponents(query: IComponentQuery): ISearchResult[];
1386
+ /**
1387
+ * Get all variants for a given component type.
1388
+ */
1389
+ declare function getVariants(type: string): IComponentSnippet[];
1390
+ /**
1391
+ * Get all component types available in the registry.
1392
+ */
1393
+ declare function getAvailableTypes(): string[];
1394
+ /**
1395
+ * Get all snippets for a given category.
1396
+ */
1397
+ declare function getByCategory(category: ComponentCategory): IComponentSnippet[];
1398
+ /**
1399
+ * Get snippets matching a mood.
1400
+ */
1401
+ declare function getByMood(mood: MoodTag): IComponentSnippet[];
1402
+ /**
1403
+ * Get snippets matching an industry.
1404
+ */
1405
+ declare function getByIndustry(industry: IndustryTag): IComponentSnippet[];
1406
+ /**
1407
+ * Apply a visual style layer onto a component snippet.
1408
+ * Returns a new snippet with modified tailwind classes.
1409
+ */
1410
+ declare function applyVisualStyle(snippet: IComponentSnippet, styleId: VisualStyleId): IComponentSnippet;
1411
+ /**
1412
+ * Inject micro-interaction animations into a snippet.
1413
+ * Returns a new snippet with animation classes added.
1414
+ */
1415
+ declare function injectAnimations(snippet: IComponentSnippet, animationIds: string[]): IComponentSnippet;
1416
+ /**
1417
+ * Compose a full section by searching for an organism and optionally applying style + animations.
1418
+ */
1419
+ declare function composeSection(sectionType: string, options?: {
1420
+ style?: VisualStyleId;
1421
+ mood?: MoodTag;
1422
+ industry?: IndustryTag;
1423
+ }): IComponentSnippet | undefined;
1424
+ /**
1425
+ * Get the best matching snippet for a component type, falling back gracefully.
1426
+ * This is the main entry point for the generation tools.
1427
+ */
1428
+ declare function getBestMatch(type: string, options?: {
1429
+ variant?: string;
1430
+ mood?: MoodTag;
1431
+ industry?: IndustryTag;
1432
+ style?: VisualStyleId;
1433
+ }): IComponentSnippet | undefined;
1434
+ /**
1435
+ * Get the best matching snippet with feedback boosting.
1436
+ * Uses feedback data to re-rank search results based on user acceptance patterns.
1437
+ */
1438
+ declare function getBestMatchWithFeedback(type: string, options?: {
1439
+ variant?: string;
1440
+ mood?: MoodTag;
1441
+ industry?: IndustryTag;
1442
+ style?: VisualStyleId;
1443
+ }, db?: Database.Database): IComponentSnippet | undefined;
1444
+ /**
1445
+ * Trigger pattern promotion cycle.
1446
+ * Promotes high-performing code patterns from feedback to the registry.
1447
+ */
1448
+ declare function triggerPatternPromotion(db: Database.Database): number;
1449
+
1450
+ /**
1451
+ * Initialize the full component registry with all atoms, molecules, organisms,
1452
+ * visual styles, and micro-interactions.
1453
+ *
1454
+ * Call this once at startup before using any registry search/retrieval functions.
1455
+ */
1456
+ declare function initializeRegistry(): void;
1457
+
1458
+ type BackendCategory = 'api-route' | 'middleware' | 'architecture' | 'database' | 'security' | 'observability' | 'performance' | 'documentation';
1459
+ type BackendFramework = 'express' | 'nextjs-api' | 'nextjs-server-actions' | 'hono' | 'fastify' | 'framework-agnostic';
1460
+ type BackendPattern = 'clean-architecture' | 'service-layer' | 'repository' | 'middleware-chain' | 'event-driven' | 'cqrs' | 'factory' | 'strategy' | 'observer' | 'decorator' | 'singleton';
1461
+ interface IBackendQuality {
1462
+ securityChecks: string[];
1463
+ performanceConsiderations: string[];
1464
+ antiPatterns: string[];
1465
+ inspirationSource: string;
1466
+ }
1467
+ interface IBackendSnippet {
1468
+ id: string;
1469
+ name: string;
1470
+ category: BackendCategory;
1471
+ type: string;
1472
+ variant: string;
1473
+ tags: string[];
1474
+ framework: BackendFramework[];
1475
+ patterns: BackendPattern[];
1476
+ typescript: string;
1477
+ dependencies: string[];
1478
+ envVars?: string[];
1479
+ quality: IBackendQuality;
1480
+ testHint: string;
1481
+ }
1482
+
1483
+ declare function searchBackendSnippets(query: {
1484
+ category?: BackendCategory;
1485
+ framework?: BackendFramework;
1486
+ tags?: string[];
1487
+ type?: string;
1488
+ }): IBackendSnippet[];
1489
+ declare function initializeBackendRegistry(): Promise<void>;
1490
+
1491
+ /**
1492
+ * SQLite-backed graph store for the RAG component registry.
1493
+ * Uses better-sqlite3 for embedded, zero-cost persistence.
1494
+ *
1495
+ * Static TypeScript files remain the source of truth.
1496
+ * The DB is a runtime index rebuilt from static files when missing.
1497
+ */
1498
+
1499
+ /**
1500
+ * Get or create the SQLite database connection.
1501
+ * Defaults to `.uiforge/rag.sqlite` in the project root.
1502
+ */
1503
+ declare function getDatabase(customPath?: string): Database.Database;
1504
+ /**
1505
+ * Close the database connection.
1506
+ */
1507
+ declare function closeDatabase(): void;
1508
+
1509
+ declare const FONT_PAIRINGS: readonly IFontPairing[];
1510
+ declare const DEFAULT_FONT_PAIRING = "manrope-inter";
1511
+ declare function getFontPairing(name: string): IFontPairing | undefined;
1512
+ declare function getFontPairingsByMood(mood: string): IFontPairing[];
1513
+ declare const TYPE_SCALE: Record<string, string>;
1514
+
1515
+ declare const COLOR_SYSTEMS: readonly IColorSystem[];
1516
+ declare const DEFAULT_COLOR_SYSTEM = "zinc";
1517
+ declare function getColorSystem(name: string): IColorSystem | undefined;
1518
+ declare function getColorSystemsByMood(mood: string): IColorSystem[];
1519
+
1520
+ declare const SPACING_SYSTEM: ISpacingSystem;
1521
+
1522
+ declare const ICON_LIBRARIES: readonly IIconLibrary[];
1523
+ declare function getDefaultIconLibrary(framework: string): IIconLibrary;
1524
+
1525
+ declare const ANIMATION_PRESETS: readonly IAnimationPreset[];
1526
+ declare function getAnimationsByCategory(category: IAnimationPreset['category']): IAnimationPreset[];
1527
+
1528
+ declare const LAYOUT_PATTERNS: readonly ILayoutPattern[];
1529
+ declare function getLayoutPattern(name: string): ILayoutPattern | undefined;
1530
+ declare function getLayoutPatternsByUseCase(useCase: string): ILayoutPattern[];
1531
+
1532
+ declare const INSPIRATION_SOURCES: readonly IInspirationSource[];
1533
+ declare function getInspirationByCategory(category: IInspirationSource['category']): IInspirationSource[];
1534
+ declare function getInspirationByPriority(maxPriority?: number): IInspirationSource[];
1535
+ declare function getPrimaryDesignReference(): IInspirationSource;
1536
+ declare function getFallbackDesignReference(): IInspirationSource;
1537
+
1538
+ declare const COMPONENT_LIBRARIES: readonly IComponentLibrary[];
1539
+ declare function getComponentLibrariesForFramework(framework: string): IComponentLibrary[];
1540
+ declare function getRecommendedLibrary(framework: string): IComponentLibrary | undefined;
1541
+
1542
+ declare const DEFAULT_PRESET = "zinc-manrope";
1543
+ interface IPresetConfig {
1544
+ colorSystem: string;
1545
+ fontPairing: string;
1546
+ }
1547
+ declare const PRESETS: Record<string, IPresetConfig>;
1548
+ declare function getPreset(name?: string): IDesignContext;
1549
+ declare function listPresets(): string[];
1550
+
1551
+ interface IPageSection {
1552
+ id: string;
1553
+ name: string;
1554
+ query: IComponentQuery;
1555
+ fallbackSnippetId?: string;
1556
+ containerClasses: string;
1557
+ darkModeClasses?: string;
1558
+ }
1559
+ interface IPageComposition {
1560
+ id: string;
1561
+ name: string;
1562
+ description: string;
1563
+ templateType: PageTemplateType;
1564
+ sections: IPageSection[];
1565
+ layout: 'single-column' | 'sidebar-left' | 'sidebar-right' | 'split';
1566
+ layoutClasses: string;
1567
+ mood: MoodTag[];
1568
+ industry: IndustryTag[];
1569
+ visualStyles: VisualStyleId[];
1570
+ quality: {
1571
+ antiGeneric: string[];
1572
+ inspirationSource: string;
1573
+ designPhilosophy: string;
1574
+ };
1575
+ }
1576
+
1577
+ declare function registerComposition(comp: IPageComposition): void;
1578
+ declare function getComposition(id: string): IPageComposition | undefined;
1579
+ interface IFindOptions {
1580
+ mood?: MoodTag[];
1581
+ industry?: IndustryTag[];
1582
+ visualStyle?: VisualStyleId;
1583
+ }
1584
+ declare function findBestComposition(templateType: PageTemplateType, options?: IFindOptions): IPageComposition | undefined;
1585
+ interface IComposeOptions {
1586
+ mood?: MoodTag[];
1587
+ industry?: IndustryTag[];
1588
+ visualStyle?: VisualStyleId;
1589
+ }
1590
+ interface IComposedSection {
1591
+ id: string;
1592
+ name: string;
1593
+ jsx: string;
1594
+ snippetId?: string;
1595
+ }
1596
+ interface IComposedPage {
1597
+ jsx: string;
1598
+ sections: IComposedSection[];
1599
+ metadata: {
1600
+ compositionId: string;
1601
+ compositionName: string;
1602
+ layout: string;
1603
+ mood: MoodTag[];
1604
+ industry: IndustryTag[];
1605
+ visualStyles: VisualStyleId[];
1606
+ };
1607
+ }
1608
+ declare function composePageFromTemplate(compositionId: string, options?: IComposeOptions): IComposedPage | null;
1609
+ declare function clearCompositions(): void;
1610
+ declare function getAllCompositions(): IPageComposition[];
1611
+
1612
+ interface ITemplatePack {
1613
+ id: string;
1614
+ name: string;
1615
+ description: string;
1616
+ appType: string;
1617
+ pages: {
1618
+ path: string;
1619
+ compositionId: string;
1620
+ title: string;
1621
+ isIndex: boolean;
1622
+ }[];
1623
+ theme: {
1624
+ colorSystemId: string;
1625
+ fontPairingId: string;
1626
+ visualStyle: VisualStyleId;
1627
+ mood: MoodTag;
1628
+ };
1629
+ sharedComponents: string[];
1630
+ quality: {
1631
+ antiGeneric: string[];
1632
+ designPhilosophy: string;
1633
+ inspirationSources: string[];
1634
+ };
1635
+ }
1636
+
1637
+ declare function registerPack(pack: ITemplatePack): void;
1638
+ declare function getPack(id: string): ITemplatePack | undefined;
1639
+ declare function getAllPacks(): ITemplatePack[];
1640
+ declare function searchPacks(appType?: string): ITemplatePack[];
1641
+
1642
+ declare function registerInteraction(interaction: IMicroInteraction): void;
1643
+ declare function registerInteractions(items: IMicroInteraction[]): void;
1644
+ declare function getMicroInteraction(id: string): IMicroInteraction | undefined;
1645
+ declare function getInteractionsByCategory(category: AnimationCategory): IMicroInteraction[];
1646
+ /**
1647
+ * Get all registered micro-interactions as a frozen shallow copy.
1648
+ * Note: This is a shallow freeze - nested objects within interactions are not frozen.
1649
+ * For deep immutability, consider using a deep freeze utility or immutable data structures.
1650
+ */
1651
+ declare function getAllInteractions(): readonly IMicroInteraction[];
1652
+ /**
1653
+ * Clear all registered interactions (for testing).
1654
+ */
1655
+ declare function clearAllMicroInteractions(): void;
1656
+ declare function initializeInteractions(): void;
1657
+
1658
+ type ProjectType = 'next-saas' | 'next-app' | 'express-api' | 'fullstack-mono' | 'react-spa';
1659
+ type AppType = 'saas' | 'ecommerce' | 'dashboard' | 'landing' | 'api';
1660
+ type Scale = 'solo' | 'team' | 'enterprise';
1661
+ type DeployTarget = 'vercel' | 'cloudflare' | 'docker' | 'aws';
1662
+ type StateManagement = 'zustand' | 'redux-toolkit' | 'tanstack-query' | 'jotai';
1663
+ interface IProjectTemplate {
1664
+ id: ProjectType;
1665
+ name: string;
1666
+ description: string;
1667
+ appTypes: AppType[];
1668
+ scales: Scale[];
1669
+ structure: IDirectoryStructure;
1670
+ dependencies: Record<string, string>;
1671
+ devDependencies: Record<string, string>;
1672
+ scripts: Record<string, string>;
1673
+ configFiles: IConfigFile[];
1674
+ features: string[];
1675
+ }
1676
+ interface IDirectoryStructure {
1677
+ [path: string]: 'file' | 'directory' | IDirectoryStructure;
1678
+ }
1679
+ interface IConfigFile {
1680
+ path: string;
1681
+ content: string;
1682
+ }
1683
+ interface IScaffoldOptions {
1684
+ projectName: string;
1685
+ projectType: ProjectType;
1686
+ appType?: AppType;
1687
+ scale?: Scale;
1688
+ deployTarget?: DeployTarget;
1689
+ stateManagement?: StateManagement;
1690
+ features?: string[];
1691
+ }
1692
+
1693
+ declare function getTemplate(projectType: ProjectType): IProjectTemplate;
1694
+ declare function getAllTemplates(): IProjectTemplate[];
1695
+ interface ITemplateSelectionCriteria {
1696
+ appType?: AppType;
1697
+ scale?: Scale;
1698
+ features?: string[];
1699
+ needsMonorepo?: boolean;
1700
+ needsBackend?: boolean;
1701
+ }
1702
+ declare function selectTemplate(criteria: ITemplateSelectionCriteria): ProjectType;
1703
+ declare function customizeTemplate(template: IProjectTemplate, options: IScaffoldOptions): IProjectTemplate;
1704
+ declare function getRecommendations(criteria: ITemplateSelectionCriteria): {
1705
+ primary: ProjectType;
1706
+ alternatives: ProjectType[];
1707
+ reasoning: string;
1708
+ };
1709
+
1710
+ declare const zustandPatterns: {
1711
+ basic: {
1712
+ name: string;
1713
+ description: string;
1714
+ code: string;
1715
+ };
1716
+ withSelectors: {
1717
+ name: string;
1718
+ description: string;
1719
+ code: string;
1720
+ };
1721
+ withMiddleware: {
1722
+ name: string;
1723
+ description: string;
1724
+ code: string;
1725
+ };
1726
+ async: {
1727
+ name: string;
1728
+ description: string;
1729
+ code: string;
1730
+ };
1731
+ slices: {
1732
+ name: string;
1733
+ description: string;
1734
+ code: string;
1735
+ };
1736
+ };
1737
+
1738
+ declare const reduxToolkitPattern: {
1739
+ id: string;
1740
+ name: string;
1741
+ code: string;
1742
+ };
1743
+
1744
+ declare const tanstackQueryPattern: {
1745
+ id: string;
1746
+ name: string;
1747
+ code: string;
1748
+ };
1749
+
1750
+ declare const stateManagementPatterns: {
1751
+ zustand: {
1752
+ name: string;
1753
+ description: string;
1754
+ pros: string[];
1755
+ cons: string[];
1756
+ bestFor: string[];
1757
+ };
1758
+ 'redux-toolkit': {
1759
+ name: string;
1760
+ description: string;
1761
+ pros: string[];
1762
+ cons: string[];
1763
+ bestFor: string[];
1764
+ };
1765
+ 'tanstack-query': {
1766
+ name: string;
1767
+ description: string;
1768
+ pros: string[];
1769
+ cons: string[];
1770
+ bestFor: string[];
1771
+ };
1772
+ jotai: {
1773
+ name: string;
1774
+ description: string;
1775
+ pros: string[];
1776
+ cons: string[];
1777
+ bestFor: string[];
1778
+ };
1779
+ };
1780
+
1781
+ declare const nextSaasTemplate: IProjectTemplate;
1782
+
1783
+ declare const nextAppTemplate: IProjectTemplate;
1784
+
1785
+ declare const expressApiTemplate: IProjectTemplate;
1786
+
1787
+ declare const fullstackMonoTemplate: IProjectTemplate;
1788
+
1789
+ declare const reactSpaTemplate: IProjectTemplate;
1790
+
1791
+ declare const templates: Record<ProjectType, IProjectTemplate>;
1792
+ declare const templateList: IProjectTemplate[];
1793
+
1794
+ /**
1795
+ * Type definitions for the feedback & self-learning system.
1796
+ */
1797
+ /** A recorded generation event. */
1798
+ interface IGeneration {
1799
+ id: string;
1800
+ tool: 'generate_ui_component' | 'generate_page_template';
1801
+ params: Record<string, string>;
1802
+ componentType: string;
1803
+ framework: string;
1804
+ outputHash: string;
1805
+ timestamp: number;
1806
+ sessionId: string;
1807
+ prompt?: string;
1808
+ variant?: string;
1809
+ mood?: string;
1810
+ industry?: string;
1811
+ style?: string;
1812
+ codeHash?: string;
1813
+ }
1814
+ /** Feedback for a generation (explicit or implicit). */
1815
+ interface IFeedback {
1816
+ id: string;
1817
+ generationId: string;
1818
+ rating: 'positive' | 'negative' | 'neutral';
1819
+ source: 'explicit' | 'implicit';
1820
+ score: number;
1821
+ confidence: number;
1822
+ comment?: string;
1823
+ timestamp: number;
1824
+ }
1825
+ /** A detected code pattern from generated outputs. */
1826
+ interface ICodePattern {
1827
+ id: string;
1828
+ skeletonHash: string;
1829
+ skeleton: string;
1830
+ snippet: string;
1831
+ frequency: number;
1832
+ avgScore: number;
1833
+ promoted: boolean;
1834
+ }
1835
+ /** Implicit signal derived from analyzing the next prompt. */
1836
+ interface IImplicitSignal {
1837
+ type: 'new_task' | 'minor_tweak' | 'major_redo' | 'praise' | 'time_gap' | 'rapid_followup';
1838
+ score: number;
1839
+ confidence: number;
1840
+ reason: string;
1841
+ }
1842
+ /** Input for the submit_feedback MCP tool. */
1843
+ interface IExplicitFeedbackInput {
1844
+ generationId: string;
1845
+ rating: 'positive' | 'negative';
1846
+ comment?: string;
1847
+ }
1848
+ /** Result of classifying a prompt pair. */
1849
+ interface IPromptClassification {
1850
+ signals: IImplicitSignal[];
1851
+ combinedScore: number;
1852
+ combinedConfidence: number;
1853
+ }
1854
+
1855
+ /**
1856
+ * Feedback tracker — records generation events and manages the implicit feedback loop.
1857
+ *
1858
+ * Stores generation history in SQLite and uses the prompt classifier
1859
+ * to derive implicit feedback scores from consecutive generations.
1860
+ */
1861
+
1862
+ /**
1863
+ * Record a generation event.
1864
+ * If a previous generation exists for this session, implicit feedback is derived.
1865
+ */
1866
+ declare function recordGeneration$1(gen: IGeneration, generatedCode: string, db: Database.Database, promptContext?: string): {
1867
+ implicitFeedback?: IFeedback;
1868
+ };
1869
+ /**
1870
+ * Record explicit user feedback for a generation.
1871
+ */
1872
+ declare function recordExplicitFeedback(generationId: string, rating: 'positive' | 'negative', db: Database.Database, comment?: string): IFeedback;
1873
+ /**
1874
+ * Get the aggregate feedback score for a component snippet or pattern.
1875
+ * Returns a value between -1 and 2, or 0 if no feedback exists.
1876
+ */
1877
+ declare function getAggregateScore(componentType: string, db: Database.Database): number;
1878
+ /**
1879
+ * Get feedback count (useful for determining training readiness).
1880
+ */
1881
+ declare function getFeedbackCount(db: Database.Database): number;
1882
+ /**
1883
+ * Get feedback statistics.
1884
+ */
1885
+ declare function getFeedbackStats(db: Database.Database): {
1886
+ total: number;
1887
+ explicit: number;
1888
+ implicit: number;
1889
+ avgScore: number;
1890
+ positive: number;
1891
+ negative: number;
1892
+ neutral: number;
1893
+ };
1894
+ /**
1895
+ * Export training data as JSONL-style array for LoRA fine-tuning.
1896
+ */
1897
+ declare function exportTrainingData(db: Database.Database, minScore?: number): Array<{
1898
+ prompt: string;
1899
+ score: number;
1900
+ componentType: string | null;
1901
+ style: string | null;
1902
+ }>;
1903
+ /**
1904
+ * Clear the in-memory session cache (useful for testing).
1905
+ */
1906
+ declare function clearSessionCache(): void;
1907
+
1908
+ /**
1909
+ * Feedback-boosted search — merges feedback scores into registry search results.
1910
+ *
1911
+ * Replaces raw `searchComponents()` with a version that boosts results
1912
+ * based on accumulated user feedback, so the RAG system learns over time.
1913
+ */
1914
+
1915
+ /**
1916
+ * Search components with feedback-based score boosting.
1917
+ *
1918
+ * 1. Runs the base registry search (in-memory scoring).
1919
+ * 2. Looks up aggregate feedback scores per component type from SQLite.
1920
+ * 3. Boosts/penalizes results by up to ±30% based on feedback history.
1921
+ */
1922
+ declare function feedbackBoostedSearch(query: IComponentQuery, db: Database.Database): ISearchResult[];
1923
+ /**
1924
+ * Get the feedback boost factor for a specific component type.
1925
+ * Returns a multiplier between 0.7 and 1.3 (±30%).
1926
+ */
1927
+ declare function getFeedbackBoost(componentType: string, db: Database.Database): number;
1928
+
1929
+ /**
1930
+ * Pattern promotion — auto-expand the registry from proven user-accepted patterns.
1931
+ *
1932
+ * When a code pattern is generated frequently with high feedback scores,
1933
+ * it gets promoted to a first-class registry snippet so the RAG system
1934
+ * returns it directly in future searches.
1935
+ */
1936
+
1937
+ /**
1938
+ * Ensure the patterns table exists in the database.
1939
+ */
1940
+ declare function ensurePatternsTable(db: Database.Database): void;
1941
+ /**
1942
+ * Record or update a code pattern from a generation.
1943
+ */
1944
+ declare function recordPattern(skeletonHash: string, skeleton: string, code: string, componentType: string | undefined, category: ComponentCategory | undefined, feedbackScore: number, db: Database.Database): ICodePattern;
1945
+ /**
1946
+ * Get all patterns eligible for promotion.
1947
+ */
1948
+ declare function getPromotablePatternsFromDb(db: Database.Database): ICodePattern[];
1949
+ /**
1950
+ * Promote a pattern to a registry snippet.
1951
+ * Creates a new IComponentSnippet from the pattern and registers it.
1952
+ */
1953
+ declare function promotePattern(pattern: ICodePattern, componentType: string, category: ComponentCategory, db: Database.Database): IComponentSnippet | null;
1954
+ /**
1955
+ * Run the promotion cycle: find eligible patterns and promote them.
1956
+ * Returns the count of newly promoted patterns.
1957
+ */
1958
+ declare function runPromotionCycle(db: Database.Database): number;
1959
+ /**
1960
+ * Get pattern statistics.
1961
+ */
1962
+ declare function getPatternStats(db: Database.Database): {
1963
+ total: number;
1964
+ promoted: number;
1965
+ eligible: number;
1966
+ avgFrequency: number;
1967
+ avgScore: number;
1968
+ };
1969
+
1970
+ /**
1971
+ * Rule-based prompt classifier for implicit feedback.
1972
+ *
1973
+ * Analyzes consecutive generation calls to infer user satisfaction
1974
+ * without requiring any external ML model or API.
1975
+ */
1976
+
1977
+ /**
1978
+ * Classify a pair of consecutive generation events to produce implicit feedback
1979
+ * for the previous generation.
1980
+ *
1981
+ * @param prev The previous generation event
1982
+ * @param curr The current generation event
1983
+ * @param promptContext Optional text context from the current prompt/description
1984
+ */
1985
+ declare function classifyPromptPair(prev: IGeneration, curr: IGeneration, promptContext?: string): IPromptClassification;
1986
+ /**
1987
+ * Classify a single keyword context without a previous generation.
1988
+ * Useful for explicit prompt analysis.
1989
+ */
1990
+ declare function classifyPromptText(promptContext: string): IPromptClassification;
1991
+
1992
+ /**
1993
+ * Code pattern detection — extracts structural skeletons from generated code
1994
+ * and hashes them for cross-session pattern recognition.
1995
+ */
1996
+
1997
+ /**
1998
+ * Extract a structural skeleton from JSX/HTML code.
1999
+ *
2000
+ * Strips class names, text content, and attribute values,
2001
+ * keeping only the element hierarchy and semantic roles.
2002
+ *
2003
+ * Example:
2004
+ * Input: <div className="flex gap-4"><h2 className="text-2xl">Title</h2><button>CTA</button></div>
2005
+ * Output: div>h2+button
2006
+ */
2007
+ declare function extractSkeleton(code: string): string;
2008
+ /**
2009
+ * Hash a skeleton string to create a consistent fingerprint.
2010
+ */
2011
+ declare function hashSkeleton(skeleton: string): string;
2012
+ /**
2013
+ * Extract skeleton and hash from code in one step.
2014
+ */
2015
+ declare function fingerprint(code: string): {
2016
+ skeleton: string;
2017
+ hash: string;
2018
+ };
2019
+ /**
2020
+ * Check if a pattern meets promotion criteria.
2021
+ */
2022
+ declare function isPromotable(pattern: ICodePattern): boolean;
2023
+
2024
+ interface IValidationResult {
2025
+ valid: boolean;
2026
+ errors: string[];
2027
+ warnings: string[];
2028
+ }
2029
+ declare function validateSnippet(snippet: IComponentSnippet): IValidationResult;
2030
+ declare function validateSnippetStrict(snippet: IComponentSnippet): IValidationResult;
2031
+
2032
+ declare function recordGeneration(snippet: IComponentSnippet): void;
2033
+ declare function isDuplicateConsecutive(type: string, variant: string): boolean;
2034
+ declare function suggestDiverseVariant(type: string, available: string[]): string | undefined;
2035
+ declare function clearHistory(): void;
2036
+
2037
+ type ArtifactType = 'component' | 'page' | 'module' | 'api-route' | 'project';
2038
+ interface IComponentStructure {
2039
+ component: string;
2040
+ category: 'atom' | 'molecule' | 'organism';
2041
+ children?: IComponentStructure[];
2042
+ props?: Record<string, unknown>;
2043
+ layout?: string;
2044
+ tokens?: Record<string, string>;
2045
+ }
2046
+ interface IGeneratedArtifact {
2047
+ id: string;
2048
+ type: ArtifactType;
2049
+ category?: string;
2050
+ prompt: string;
2051
+ code: string;
2052
+ structure?: IComponentStructure;
2053
+ metadata?: Record<string, unknown>;
2054
+ qualityScore?: number;
2055
+ feedbackScore?: number;
2056
+ inspirationSources?: string[];
2057
+ createdAt: number;
2058
+ }
2059
+ interface IArtifactQuery {
2060
+ type?: ArtifactType;
2061
+ category?: string;
2062
+ minQualityScore?: number;
2063
+ minFeedbackScore?: number;
2064
+ limit?: number;
2065
+ }
2066
+ interface ILearningStats {
2067
+ totalArtifacts: number;
2068
+ avgQualityScore: number;
2069
+ avgFeedbackScore: number;
2070
+ topPatterns: Array<{
2071
+ category: string;
2072
+ count: number;
2073
+ }>;
2074
+ promotionCandidates: number;
2075
+ }
2076
+
2077
+ declare function resetSchemaInit(): void;
2078
+ declare function generateArtifactId(prompt: string, type: ArtifactType): string;
2079
+ declare function storeArtifact(artifact: IGeneratedArtifact, db: Database.Database): void;
2080
+ declare function getArtifact(id: string, db: Database.Database): IGeneratedArtifact | undefined;
2081
+ declare function queryArtifacts(query: IArtifactQuery, db: Database.Database): IGeneratedArtifact[];
2082
+ declare function updateFeedbackScore(id: string, score: number, db: Database.Database): boolean;
2083
+ declare function updateQualityScore(id: string, score: number, db: Database.Database): boolean;
2084
+ declare function getArtifactCount(db: Database.Database, type?: ArtifactType): number;
2085
+ declare function getTopArtifacts(db: Database.Database, limit?: number): IGeneratedArtifact[];
2086
+ declare function deleteArtifact(id: string, db: Database.Database): boolean;
2087
+
2088
+ declare function recordGeneratedArtifact(prompt: string, code: string, type: IGeneratedArtifact['type'], db: Database.Database, options?: {
2089
+ category?: string;
2090
+ qualityScore?: number;
2091
+ structure?: IGeneratedArtifact['structure'];
2092
+ metadata?: Record<string, unknown>;
2093
+ inspirationSources?: string[];
2094
+ }): IGeneratedArtifact;
2095
+ declare function getPromotionCandidates(db: Database.Database): IGeneratedArtifact[];
2096
+ declare function getLearningStats(db: Database.Database): ILearningStats;
2097
+ declare function getRecentArtifacts(db: Database.Database, limit?: number): IGeneratedArtifact[];
2098
+ declare function getSimilarArtifacts(type: IGeneratedArtifact['type'], category: string, db: Database.Database, limit?: number): IGeneratedArtifact[];
2099
+
2100
+ declare const DEFAULT_CONTEXT: IDesignContext;
2101
+ declare class DesignContextStore {
2102
+ private context;
2103
+ constructor();
2104
+ get(): IDesignContext;
2105
+ set(ctx: IDesignContext): void;
2106
+ update(partial: Partial<IDesignContext>): void;
2107
+ selectPreset(name: string): IDesignContext;
2108
+ listPresets(): string[];
2109
+ reset(): void;
2110
+ }
2111
+ declare const designContextStore: DesignContextStore;
2112
+
2113
+ /**
2114
+ * Component Libraries Integration
2115
+ *
2116
+ * Centralized access to all component library integrations including:
2117
+ * - shadcn/ui
2118
+ * - Radix UI
2119
+ * - Headless UI
2120
+ * - Material-UI
2121
+ */
2122
+
2123
+ /**
2124
+ * Component library interface
2125
+ */
2126
+ interface ComponentLibraryIntegration {
2127
+ name: string;
2128
+ id: ComponentLibraryId;
2129
+ description: string;
2130
+ setupProject(options: ComponentLibrarySetupOptions): IGeneratedFile[];
2131
+ generateComponent(name: string, designContext: IDesignContext, customizations?: Record<string, unknown>): IGeneratedFile[];
2132
+ getAvailableComponents(): string[];
2133
+ getAvailablePatterns(): string[];
2134
+ }
2135
+ /**
2136
+ * Component library setup options
2137
+ */
2138
+ interface ComponentLibrarySetupOptions {
2139
+ framework: Framework;
2140
+ projectName: string;
2141
+ components?: string[];
2142
+ patterns?: string[];
2143
+ designContext?: IDesignContext;
2144
+ customizations?: Record<string, unknown>;
2145
+ }
2146
+ /**
2147
+ * Get component library integration by ID
2148
+ */
2149
+ declare function getComponentLibrary(libraryId: ComponentLibraryId): ComponentLibraryIntegration | undefined;
2150
+ /**
2151
+ * Get all available component libraries
2152
+ */
2153
+ declare function getAvailableComponentLibraries(): ComponentLibraryIntegration[];
2154
+ /**
2155
+ * Setup component library project
2156
+ */
2157
+ declare function setupComponentLibraryProject(libraryId: ComponentLibraryId, options: ComponentLibrarySetupOptions): IGeneratedFile[];
2158
+ /**
2159
+ * Generate component from library
2160
+ */
2161
+ declare function generateComponentFromLibrary(libraryId: ComponentLibraryId, componentName: string, designContext: IDesignContext, customizations?: Record<string, unknown>): IGeneratedFile[];
2162
+ /**
2163
+ * Get available components for library
2164
+ */
2165
+ declare function getAvailableComponentsForLibrary(libraryId: ComponentLibraryId): string[];
2166
+ /**
2167
+ * Get available patterns for library
2168
+ */
2169
+ declare function getAvailablePatternsForLibrary(libraryId: ComponentLibraryId): string[];
2170
+
2171
+ declare const configSchema: z.ZodObject<{
2172
+ NODE_ENV: z.ZodDefault<z.ZodEnum<{
2173
+ production: "production";
2174
+ development: "development";
2175
+ test: "test";
2176
+ }>>;
2177
+ FIGMA_ACCESS_TOKEN: z.ZodOptional<z.ZodString>;
2178
+ LOG_LEVEL: z.ZodDefault<z.ZodEnum<{
2179
+ error: "error";
2180
+ warn: "warn";
2181
+ info: "info";
2182
+ debug: "debug";
2183
+ }>>;
2184
+ }, z.core.$strip>;
2185
+ type Config = z.infer<typeof configSchema>;
2186
+ declare function loadConfig(): Config;
2187
+ declare function getConfig(): Config;
2188
+ /**
2189
+ * Safely parse JSON with fallback.
2190
+ * @param jsonString - JSON string to parse
2191
+ * @param defaultValue - Fallback value if parsing fails
2192
+ */
2193
+ declare function safeJSONParse<T>(jsonString: string | null | undefined, defaultValue: T): T;
2194
+ declare function safeJSONParse<T extends Record<string, unknown>>(jsonString: string | null | undefined): T;
2195
+
2196
+ declare const logger: pino__default.Logger;
2197
+ declare function createLogger(name: string): Logger;
2198
+
2199
+ /**
2200
+ * Consolidated utility functions for UIForge MCP
2201
+ * Removes duplication and provides a clean, organized interface
2202
+ */
2203
+ /**
2204
+ * Convert string to PascalCase (e.g., "button" → "Button", "nav-bar" → "NavBar")
2205
+ */
2206
+ declare function toPascalCase(str: string): string;
2207
+ /**
2208
+ * Convert string to kebab-case (e.g., "NavBar" → "nav-bar", "Button" → "button")
2209
+ */
2210
+ declare function toKebabCase(str: string): string;
2211
+ /**
2212
+ * Convert string to camelCase (e.g., "nav-bar" → "navBar", "Button" → "button")
2213
+ */
2214
+ declare function toCamelCase(str: string): string;
2215
+ /**
2216
+ * Convert string to snake_case (e.g., "NavBar" → "nav_bar", "button" → "button")
2217
+ */
2218
+ declare function toSnakeCase(str: string): string;
2219
+ /**
2220
+ * Capitalize first letter of string
2221
+ */
2222
+ declare function capitalize(str: string): string;
2223
+ /**
2224
+ * Simple pluralization for common English words
2225
+ */
2226
+ declare function pluralize(str: string): string;
2227
+ /**
2228
+ * Sanitize string for CSS class names
2229
+ */
2230
+ declare function sanitizeClassName(str: string): string;
2231
+ /**
2232
+ * Generate random ID with optional prefix
2233
+ */
2234
+ declare function generateRandomId(prefix?: string): string;
2235
+ /**
2236
+ * Truncate string to specified length with ellipsis
2237
+ */
2238
+ declare function truncate(str: string, maxLength: number, suffix?: string): string;
2239
+ /**
2240
+ * Escape HTML special characters
2241
+ */
2242
+ declare function escapeHtml(str: string): string;
2243
+ /**
2244
+ * Convert JSX attributes to HTML attributes
2245
+ */
2246
+ declare function jsxToHtmlAttributes(jsxCode: string): string;
2247
+ /**
2248
+ * Convert React event handlers to HTML event attributes
2249
+ */
2250
+ declare function reactEventsToHtml(jsxCode: string): string;
2251
+ /**
2252
+ * Convert React event handlers to Svelte event syntax
2253
+ */
2254
+ declare function reactEventsToSvelte(jsxCode: string): string;
2255
+ /**
2256
+ * Remove JSX-specific syntax
2257
+ */
2258
+ declare function cleanJsxSyntax(jsxCode: string): string;
2259
+ /**
2260
+ * Full JSX to HTML conversion
2261
+ */
2262
+ declare function jsxToHtml(jsxCode: string): string;
2263
+ /**
2264
+ * Full JSX to Svelte conversion
2265
+ */
2266
+ declare function jsxToSvelte(jsxCode: string): string;
2267
+ /**
2268
+ * Convert HTML attributes object to JSX attributes string
2269
+ */
2270
+ declare function htmlToJsxAttributes(attributes: Record<string, string>): string;
2271
+ /**
2272
+ * Convert style object to CSS string
2273
+ */
2274
+ declare function convertStyleObjectToString(styleObject: Record<string, string | number>): string;
2275
+ /**
2276
+ * Parse CSS style string to object
2277
+ */
2278
+ declare function parseStyleString(styleString: string): Record<string, string>;
2279
+ /**
2280
+ * Merge multiple style objects
2281
+ */
2282
+ declare function mergeStyles(...styles: (Record<string, string | number> | undefined)[]): Record<string, string | number>;
2283
+ /**
2284
+ * Validate email format
2285
+ */
2286
+ declare function isValidEmail(email: string): boolean;
2287
+ /**
2288
+ * Validate URL format
2289
+ */
2290
+ declare function isValidUrl(url: string): boolean;
2291
+ /**
2292
+ * Validate hex color format
2293
+ */
2294
+ declare function isValidHexColor(color: string): boolean;
2295
+ /**
2296
+ * Validate component name (kebab-case)
2297
+ */
2298
+ declare function isValidComponentName(name: string): boolean;
2299
+ /**
2300
+ * Validate project name
2301
+ */
2302
+ declare function isValidProjectName(name: string): boolean;
2303
+ /**
2304
+ * Get file extension from path
2305
+ */
2306
+ declare function getFileExtension(path: string): string;
2307
+ /**
2308
+ * Get filename without extension
2309
+ */
2310
+ declare function getFileName(path: string): string;
2311
+ /**
2312
+ * Convert file path to different framework conventions
2313
+ */
2314
+ declare function convertPathForFramework(path: string, framework: string): string;
2315
+ /**
2316
+ * Remove duplicates from array
2317
+ */
2318
+ declare function unique<T>(array: T[]): T[];
2319
+ /**
2320
+ * Group array items by key
2321
+ */
2322
+ declare function groupBy<T>(array: T[], key: keyof T): Record<string, T[]>;
2323
+ /**
2324
+ * Sort array of objects by key
2325
+ */
2326
+ declare function sortBy<T>(array: T[], key: keyof T, direction?: 'asc' | 'desc'): T[];
2327
+ /**
2328
+ * Check if array includes value (case-insensitive for strings)
2329
+ */
2330
+ declare function includesCaseInsensitive<T>(array: T[], value: T): boolean;
2331
+ /**
2332
+ * Type guard for strings
2333
+ */
2334
+ declare function isString(value: unknown): value is string;
2335
+ /**
2336
+ * Type guard for numbers
2337
+ */
2338
+ declare function isNumber(value: unknown): value is number;
2339
+ /**
2340
+ * Type guard for objects
2341
+ */
2342
+ declare function isObject(value: unknown): value is Record<string, unknown>;
2343
+ /**
2344
+ * Type guard for arrays
2345
+ */
2346
+ declare function isArray<T>(value: unknown): value is T[];
2347
+ /**
2348
+ * Type guard for functions
2349
+ */
2350
+ declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
2351
+ /**
2352
+ * Create standardized error object
2353
+ */
2354
+ declare function createError(message: string, code?: string, details?: Record<string, unknown>): {
2355
+ message: string;
2356
+ code: string;
2357
+ details: Record<string, unknown>;
2358
+ timestamp: string;
2359
+ };
2360
+ /**
2361
+ * Check if error is a network error
2362
+ */
2363
+ declare function isNetworkError(error: unknown): boolean;
2364
+ /**
2365
+ * Retry function with exponential backoff
2366
+ */
2367
+ declare function retry<T>(fn: () => Promise<T>, maxAttempts?: number, delay?: number): Promise<T>;
2368
+
2369
+ export { ANIMATION_PRESETS, type AdapterType, AngularGenerator, type AppType, type Architecture, type ArtifactType, type BackendCategory, type BackendFramework, BaseGenerator, COLOR_SYSTEMS, COMPONENT_LIBRARIES, type ComponentCategory, type ComponentLibrary, type ComponentLibraryId, type ComponentLibraryIntegration, type ComponentLibrarySetupOptions, type Config, DEFAULT_COLOR_SYSTEM, DEFAULT_CONTEXT, DEFAULT_DESIGN_CONTEXT, DEFAULT_FONT_PAIRING, DEFAULT_LORA_CONFIG, DEFAULT_PRESET, type DeployTarget, FONT_PAIRINGS, type Framework, GeneratorFactory, HtmlGenerator, type IAccessibilityIssue, type IAccessibilityReport, type IArtifactQuery, type IBackendSnippet, ICON_LIBRARIES, type ICodePattern, type IComponentLibrary, type IComponentQuery, type IComponentSnippet, type IComponentStructure, type IConfigFile, type IDesignAnalysisResult, type IDesignContext, type IDirectoryStructure, type IEmbedding, type IEmbeddingConfig, type IEnhancedPrompt, type IEnhancementContext, type IExplicitFeedbackInput, type IFeedback, type IFigmaDesignToken, type IFigmaVariable, type IGeneratedArtifact, type IGeneratedFile, type IGeneration, type IImageAnalysis, type IImplicitSignal, type ILearningStats, type ILoRAConfig, type IModelPaths, INSPIRATION_SOURCES, type IPatternMatch, type IPresetConfig, type IProjectTemplate, type IPromptClassification, type IQualityScore, type IScaffoldOptions, type IScrapedPage, type IScreenElement, type ISearchResult, type ISimilarityResult, type IStyleContext, type IStyleRecommendation, type ITailwindMapping, type ITemplateSelectionCriteria, type ITrainingExample, type ITrainingStatus, type ITransition, type IValidationResult, type ImageType, type IndustryTag, LAYOUT_PATTERNS, type ModelId, type MoodTag, PRESETS, type PageTemplateType, type ProjectType, ReactGenerator, SPACING_SYSTEM, type Scale, type StateManagement$1 as StateManagement, SvelteGenerator, TYPE_SCALE, type VisualStyleId, VueGenerator, applyVisualStyle, buildPromptEnhancerData, buildQualityScorerData, buildStyleRecommenderData, cancelTrainingJob, capitalize, checkTrainingReadiness, classifyPromptPair, classifyPromptText, cleanJsxSyntax, clearAllMicroInteractions, clearCompositions, clearHistory as clearDiversityHistory, clearRegistry, clearSessionCache, closeDatabase, composePageFromTemplate, composeSection, configureEmbeddings, configureModelDir, convertPathForFramework, convertStyleObjectToString, cosineSimilarity, createEmbedding, createError, createLogger, createTrainingJob, customizeTemplate, deleteArtifact, deleteEmbeddings, designContextStore, embed, embedBatch, enhancePrompt, enhancePromptWithRAG, enhanceWithRules, ensureDirectories, ensurePatternsTable, escapeHtml, exportForAdapter, exportRawExamples, exportTrainingData, expressApiTemplate, extractDesignPatterns, extractSkeleton, feedbackBoostedSearch, findBestComposition, findSimilar, fingerprint, fullstackMonoTemplate, generateArtifactId, generateComponent, generateComponentFromLibrary, generateRandomId, getAdapterPath, getAggregateScore, getAllCompositions, getAllInteractions, getAllJobStatuses, getAllPacks, getAllSnippets, getAllTemplates, getAnimationsByCategory, getArtifact, getArtifactCount, getAvailableComponentLibraries, getAvailableComponentsForLibrary, getAvailablePatternsForLibrary, getAvailableTypes, getBaseDir, getBestMatch, getBestMatchWithFeedback, getByCategory, getByIndustry, getByMood, getColorSystem, getColorSystemsByMood, getComponentLibrariesForFramework, getComponentLibrary, getComposition, getConfig, getDatabase, getDefaultIconLibrary, getDiskUsage, getEmbedding, getEmbeddingConfig, getEmbeddingCount, getFallbackDesignReference, getFeedbackBoost, getFeedbackCount, getFeedbackStats, getFileExtension, getFileName, getFontPairing, getFontPairingsByMood, getInspirationByCategory, getInspirationByPriority, getInteractionsByCategory, getLatestJobStatus, getLayoutPattern, getLayoutPatternsByUseCase, getLearningStats, getMicroInteraction, getModelDownloadUrl, getModelPath, getModelPaths, getPack, getPatternStats, getPreset, getPrimaryDesignReference, getPromotablePatternsFromDb, getPromotionCandidates, getRecentArtifacts, getRecommendations, getRecommendedLibrary, getRegistrySize, getSimilarArtifacts, getSnippetById, getTemplate, getTopArtifacts, getTrainingDataPath, getTrainingSummary, getVariants, groupBy, hasEnoughData, hashSkeleton, htmlToJsxAttributes, includesCaseInsensitive, initializeBackendRegistry, initializeInteractions, initializeRegistry, injectAnimations, isAdapterAvailable, isArray, isDuplicateConsecutive, isFunction, isLikelyAccepted, isModelAvailable, isModelLoaded, isNetworkError, isNumber, isObject, isPromotable, isString, isTraining, isValidComponentName, isValidEmail, isValidHexColor, isValidProjectName, isValidUrl, jsxToHtml, jsxToHtmlAttributes, jsxToSvelte, listAdapters, listModels, listPresets, loadConfig, loadEmbeddings, logger, mergeStyles, needsEnhancement, nextAppTemplate, nextSaasTemplate, parseStyleString, pluralize, promotePattern, queryArtifacts, reactEventsToHtml, reactEventsToSvelte, reactSpaTemplate, recommendStyle, recordGeneration as recordDiversityGeneration, recordExplicitFeedback, recordGeneratedArtifact, recordGeneration$1 as recordGeneration, recordPattern, reduxToolkitPattern as reduxToolkitPatterns, registerComposition, registerInteraction, registerInteractions, registerPack, registerSnippet, registerSnippets, resetSchemaInit, retry, runPromotionCycle, safeJSONParse, sanitizeClassName, scoreQuality, scoreQualityWithRAG, searchBackendSnippets, searchComponents, searchPacks, selectTemplate, semanticSearch, setupComponentLibraryProject, sortBy, startTrainingJob, stateManagementPatterns, storeArtifact, storeDesignLearning, storeEmbedding, storeEmbeddings, suggestDiverseVariant, tanstackQueryPattern as tanstackQueryPatterns, templateList, templates, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, triggerPatternPromotion, truncate, unique, unloadModel, updateFeedbackScore, updateJobStatus, updateQualityScore, validateSnippet, validateSnippetStrict, writeJsonl, zustandPatterns };