@houtini/lm 1.0.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.
Files changed (260) hide show
  1. package/CHANGELOG.md +273 -0
  2. package/LICENSE +21 -0
  3. package/README.md +203 -0
  4. package/dist/cache/analysis-cache.d.ts +33 -0
  5. package/dist/cache/analysis-cache.d.ts.map +1 -0
  6. package/dist/cache/analysis-cache.js +56 -0
  7. package/dist/cache/analysis-cache.js.map +1 -0
  8. package/dist/cache/cache-manager.d.ts +29 -0
  9. package/dist/cache/cache-manager.d.ts.map +1 -0
  10. package/dist/cache/cache-manager.js +85 -0
  11. package/dist/cache/cache-manager.js.map +1 -0
  12. package/dist/cache/index.d.ts +16 -0
  13. package/dist/cache/index.d.ts.map +1 -0
  14. package/dist/cache/index.js +17 -0
  15. package/dist/cache/index.js.map +1 -0
  16. package/dist/cache/prompt-cache.d.ts +33 -0
  17. package/dist/cache/prompt-cache.d.ts.map +1 -0
  18. package/dist/cache/prompt-cache.js +61 -0
  19. package/dist/cache/prompt-cache.js.map +1 -0
  20. package/dist/config.d.ts +43 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +70 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/core/ThreeStagePromptManager.d.ts +39 -0
  25. package/dist/core/ThreeStagePromptManager.d.ts.map +1 -0
  26. package/dist/core/ThreeStagePromptManager.js +176 -0
  27. package/dist/core/ThreeStagePromptManager.js.map +1 -0
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +230 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/plugins/base-plugin.d.ts +47 -0
  33. package/dist/plugins/base-plugin.d.ts.map +1 -0
  34. package/dist/plugins/base-plugin.js +90 -0
  35. package/dist/plugins/base-plugin.js.map +1 -0
  36. package/dist/plugins/index.d.ts +58 -0
  37. package/dist/plugins/index.d.ts.map +1 -0
  38. package/dist/plugins/index.js +161 -0
  39. package/dist/plugins/index.js.map +1 -0
  40. package/dist/plugins/types.d.ts +5 -0
  41. package/dist/plugins/types.d.ts.map +1 -0
  42. package/dist/plugins/types.js +5 -0
  43. package/dist/plugins/types.js.map +1 -0
  44. package/dist/prompts/analyze/code-quality.d.ts +116 -0
  45. package/dist/prompts/analyze/code-quality.d.ts.map +1 -0
  46. package/dist/prompts/analyze/code-quality.js +433 -0
  47. package/dist/prompts/analyze/code-quality.js.map +1 -0
  48. package/dist/prompts/analyze/compare-integration.d.ts +130 -0
  49. package/dist/prompts/analyze/compare-integration.d.ts.map +1 -0
  50. package/dist/prompts/analyze/compare-integration.js +543 -0
  51. package/dist/prompts/analyze/compare-integration.js.map +1 -0
  52. package/dist/prompts/analyze/count-files.d.ts +109 -0
  53. package/dist/prompts/analyze/count-files.d.ts.map +1 -0
  54. package/dist/prompts/analyze/count-files.js +399 -0
  55. package/dist/prompts/analyze/count-files.js.map +1 -0
  56. package/dist/prompts/analyze/database-queries.d.ts +156 -0
  57. package/dist/prompts/analyze/database-queries.d.ts.map +1 -0
  58. package/dist/prompts/analyze/database-queries.js +759 -0
  59. package/dist/prompts/analyze/database-queries.js.map +1 -0
  60. package/dist/prompts/analyze/dependencies.d.ts +97 -0
  61. package/dist/prompts/analyze/dependencies.d.ts.map +1 -0
  62. package/dist/prompts/analyze/dependencies.js +333 -0
  63. package/dist/prompts/analyze/dependencies.js.map +1 -0
  64. package/dist/prompts/analyze/diff-signatures.d.ts +139 -0
  65. package/dist/prompts/analyze/diff-signatures.d.ts.map +1 -0
  66. package/dist/prompts/analyze/diff-signatures.js +702 -0
  67. package/dist/prompts/analyze/diff-signatures.js.map +1 -0
  68. package/dist/prompts/analyze/find-patterns.d.ts +128 -0
  69. package/dist/prompts/analyze/find-patterns.d.ts.map +1 -0
  70. package/dist/prompts/analyze/find-patterns.js +520 -0
  71. package/dist/prompts/analyze/find-patterns.js.map +1 -0
  72. package/dist/prompts/analyze/find-unused-css.d.ts +151 -0
  73. package/dist/prompts/analyze/find-unused-css.d.ts.map +1 -0
  74. package/dist/prompts/analyze/find-unused-css.js +754 -0
  75. package/dist/prompts/analyze/find-unused-css.js.map +1 -0
  76. package/dist/prompts/analyze/n8n-workflow.d.ts +137 -0
  77. package/dist/prompts/analyze/n8n-workflow.d.ts.map +1 -0
  78. package/dist/prompts/analyze/n8n-workflow.js +529 -0
  79. package/dist/prompts/analyze/n8n-workflow.js.map +1 -0
  80. package/dist/prompts/analyze/project-structure.d.ts +126 -0
  81. package/dist/prompts/analyze/project-structure.d.ts.map +1 -0
  82. package/dist/prompts/analyze/project-structure.js +569 -0
  83. package/dist/prompts/analyze/project-structure.js.map +1 -0
  84. package/dist/prompts/analyze/security-audit.d.ts +142 -0
  85. package/dist/prompts/analyze/security-audit.d.ts.map +1 -0
  86. package/dist/prompts/analyze/security-audit.js +637 -0
  87. package/dist/prompts/analyze/security-audit.js.map +1 -0
  88. package/dist/prompts/analyze/single-file.d.ts +162 -0
  89. package/dist/prompts/analyze/single-file.d.ts.map +1 -0
  90. package/dist/prompts/analyze/single-file.js +665 -0
  91. package/dist/prompts/analyze/single-file.js.map +1 -0
  92. package/dist/prompts/analyze/trace-execution.d.ts +126 -0
  93. package/dist/prompts/analyze/trace-execution.d.ts.map +1 -0
  94. package/dist/prompts/analyze/trace-execution.js +609 -0
  95. package/dist/prompts/analyze/trace-execution.js.map +1 -0
  96. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +116 -0
  97. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +1 -0
  98. package/dist/prompts/analyze/wordpress-plugin-audit.js +454 -0
  99. package/dist/prompts/analyze/wordpress-plugin-audit.js.map +1 -0
  100. package/dist/prompts/analyze/wordpress-security.d.ts +146 -0
  101. package/dist/prompts/analyze/wordpress-security.d.ts.map +1 -0
  102. package/dist/prompts/analyze/wordpress-security.js +698 -0
  103. package/dist/prompts/analyze/wordpress-security.js.map +1 -0
  104. package/dist/prompts/analyze/wordpress-theme-audit.d.ts +114 -0
  105. package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +1 -0
  106. package/dist/prompts/analyze/wordpress-theme-audit.js +538 -0
  107. package/dist/prompts/analyze/wordpress-theme-audit.js.map +1 -0
  108. package/dist/prompts/custom/custom-prompt.d.ts +135 -0
  109. package/dist/prompts/custom/custom-prompt.d.ts.map +1 -0
  110. package/dist/prompts/custom/custom-prompt.js +419 -0
  111. package/dist/prompts/custom/custom-prompt.js.map +1 -0
  112. package/dist/prompts/fun/arcade-game.d.ts +152 -0
  113. package/dist/prompts/fun/arcade-game.d.ts.map +1 -0
  114. package/dist/prompts/fun/arcade-game.js +653 -0
  115. package/dist/prompts/fun/arcade-game.js.map +1 -0
  116. package/dist/prompts/fun/create_text_adventure.d.ts +100 -0
  117. package/dist/prompts/fun/create_text_adventure.d.ts.map +1 -0
  118. package/dist/prompts/fun/create_text_adventure.js +397 -0
  119. package/dist/prompts/fun/create_text_adventure.js.map +1 -0
  120. package/dist/prompts/fun/css-art-generator.d.ts +168 -0
  121. package/dist/prompts/fun/css-art-generator.d.ts.map +1 -0
  122. package/dist/prompts/fun/css-art-generator.js +827 -0
  123. package/dist/prompts/fun/css-art-generator.js.map +1 -0
  124. package/dist/prompts/generate/project-documentation.d.ts +137 -0
  125. package/dist/prompts/generate/project-documentation.d.ts.map +1 -0
  126. package/dist/prompts/generate/project-documentation.js +666 -0
  127. package/dist/prompts/generate/project-documentation.js.map +1 -0
  128. package/dist/prompts/generate/refactoring.d.ts +164 -0
  129. package/dist/prompts/generate/refactoring.d.ts.map +1 -0
  130. package/dist/prompts/generate/refactoring.js +621 -0
  131. package/dist/prompts/generate/refactoring.js.map +1 -0
  132. package/dist/prompts/generate/responsive-component.d.ts +147 -0
  133. package/dist/prompts/generate/responsive-component.d.ts.map +1 -0
  134. package/dist/prompts/generate/responsive-component.js +955 -0
  135. package/dist/prompts/generate/responsive-component.js.map +1 -0
  136. package/dist/prompts/generate/typescript-conversion.d.ts +144 -0
  137. package/dist/prompts/generate/typescript-conversion.d.ts.map +1 -0
  138. package/dist/prompts/generate/typescript-conversion.js +527 -0
  139. package/dist/prompts/generate/typescript-conversion.js.map +1 -0
  140. package/dist/prompts/generate/unit-tests.d.ts +139 -0
  141. package/dist/prompts/generate/unit-tests.d.ts.map +1 -0
  142. package/dist/prompts/generate/unit-tests.js +578 -0
  143. package/dist/prompts/generate/unit-tests.js.map +1 -0
  144. package/dist/prompts/generate/wordpress-plugin.d.ts +179 -0
  145. package/dist/prompts/generate/wordpress-plugin.d.ts.map +1 -0
  146. package/dist/prompts/generate/wordpress-plugin.js +763 -0
  147. package/dist/prompts/generate/wordpress-plugin.js.map +1 -0
  148. package/dist/prompts/generate/wordpress-theme-from-static.d.ts +177 -0
  149. package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +1 -0
  150. package/dist/prompts/generate/wordpress-theme-from-static.js +695 -0
  151. package/dist/prompts/generate/wordpress-theme-from-static.js.map +1 -0
  152. package/dist/prompts/shared/cache-manager.d.ts +45 -0
  153. package/dist/prompts/shared/cache-manager.d.ts.map +1 -0
  154. package/dist/prompts/shared/cache-manager.js +129 -0
  155. package/dist/prompts/shared/cache-manager.js.map +1 -0
  156. package/dist/prompts/shared/helpers.d.ts +39 -0
  157. package/dist/prompts/shared/helpers.d.ts.map +1 -0
  158. package/dist/prompts/shared/helpers.js +151 -0
  159. package/dist/prompts/shared/helpers.js.map +1 -0
  160. package/dist/prompts/shared/templates.d.ts +35 -0
  161. package/dist/prompts/shared/templates.d.ts.map +1 -0
  162. package/dist/prompts/shared/templates.js +77 -0
  163. package/dist/prompts/shared/templates.js.map +1 -0
  164. package/dist/prompts/shared/types.d.ts +112 -0
  165. package/dist/prompts/shared/types.d.ts.map +1 -0
  166. package/dist/prompts/shared/types.js +5 -0
  167. package/dist/prompts/shared/types.js.map +1 -0
  168. package/dist/prompts/system/find-unused-files.d.ts +106 -0
  169. package/dist/prompts/system/find-unused-files.d.ts.map +1 -0
  170. package/dist/prompts/system/find-unused-files.js +353 -0
  171. package/dist/prompts/system/find-unused-files.js.map +1 -0
  172. package/dist/security/index.d.ts +39 -0
  173. package/dist/security/index.d.ts.map +1 -0
  174. package/dist/security/index.js +46 -0
  175. package/dist/security/index.js.map +1 -0
  176. package/dist/security/integration-helpers.d.ts +121 -0
  177. package/dist/security/integration-helpers.d.ts.map +1 -0
  178. package/dist/security/integration-helpers.js +190 -0
  179. package/dist/security/integration-helpers.js.map +1 -0
  180. package/dist/security/output-encoder.d.ts +94 -0
  181. package/dist/security/output-encoder.d.ts.map +1 -0
  182. package/dist/security/output-encoder.js +295 -0
  183. package/dist/security/output-encoder.js.map +1 -0
  184. package/dist/security/prompt-injection-guard.d.ts +59 -0
  185. package/dist/security/prompt-injection-guard.d.ts.map +1 -0
  186. package/dist/security/prompt-injection-guard.js +249 -0
  187. package/dist/security/prompt-injection-guard.js.map +1 -0
  188. package/dist/security/sanitisation.d.ts +67 -0
  189. package/dist/security/sanitisation.d.ts.map +1 -0
  190. package/dist/security/sanitisation.js +398 -0
  191. package/dist/security/sanitisation.js.map +1 -0
  192. package/dist/security/security-service.d.ts +103 -0
  193. package/dist/security/security-service.d.ts.map +1 -0
  194. package/dist/security/security-service.js +303 -0
  195. package/dist/security/security-service.js.map +1 -0
  196. package/dist/security-config.d.ts +45 -0
  197. package/dist/security-config.d.ts.map +1 -0
  198. package/dist/security-config.js +63 -0
  199. package/dist/security-config.js.map +1 -0
  200. package/dist/system/function-list.d.ts +61 -0
  201. package/dist/system/function-list.d.ts.map +1 -0
  202. package/dist/system/function-list.js +111 -0
  203. package/dist/system/function-list.js.map +1 -0
  204. package/dist/system/function-registry.d.ts +23 -0
  205. package/dist/system/function-registry.d.ts.map +1 -0
  206. package/dist/system/function-registry.js +136 -0
  207. package/dist/system/function-registry.js.map +1 -0
  208. package/dist/system/health-check.d.ts +33 -0
  209. package/dist/system/health-check.d.ts.map +1 -0
  210. package/dist/system/health-check.js +98 -0
  211. package/dist/system/health-check.js.map +1 -0
  212. package/dist/system/path-resolver.d.ts +55 -0
  213. package/dist/system/path-resolver.d.ts.map +1 -0
  214. package/dist/system/path-resolver.js +90 -0
  215. package/dist/system/path-resolver.js.map +1 -0
  216. package/dist/templates/plugin-template.d.ts +121 -0
  217. package/dist/templates/plugin-template.d.ts.map +1 -0
  218. package/dist/templates/plugin-template.js +450 -0
  219. package/dist/templates/plugin-template.js.map +1 -0
  220. package/dist/types/chunking-types.d.ts +88 -0
  221. package/dist/types/chunking-types.d.ts.map +1 -0
  222. package/dist/types/chunking-types.js +18 -0
  223. package/dist/types/chunking-types.js.map +1 -0
  224. package/dist/types/prompt-stages.d.ts +42 -0
  225. package/dist/types/prompt-stages.d.ts.map +1 -0
  226. package/dist/types/prompt-stages.js +6 -0
  227. package/dist/types/prompt-stages.js.map +1 -0
  228. package/dist/types.d.ts +46 -0
  229. package/dist/types.d.ts.map +1 -0
  230. package/dist/types.js +6 -0
  231. package/dist/types.js.map +1 -0
  232. package/dist/utils/css-parser.d.ts +26 -0
  233. package/dist/utils/css-parser.d.ts.map +1 -0
  234. package/dist/utils/css-parser.js +117 -0
  235. package/dist/utils/css-parser.js.map +1 -0
  236. package/dist/utils/path-resolver.d.ts +13 -0
  237. package/dist/utils/path-resolver.d.ts.map +1 -0
  238. package/dist/utils/path-resolver.js +78 -0
  239. package/dist/utils/path-resolver.js.map +1 -0
  240. package/dist/utils/plugin-utilities.d.ts +171 -0
  241. package/dist/utils/plugin-utilities.d.ts.map +1 -0
  242. package/dist/utils/plugin-utilities.js +221 -0
  243. package/dist/utils/plugin-utilities.js.map +1 -0
  244. package/dist/utils/streamHandler.d.ts +3 -0
  245. package/dist/utils/streamHandler.d.ts.map +1 -0
  246. package/dist/utils/streamHandler.js +137 -0
  247. package/dist/utils/streamHandler.js.map +1 -0
  248. package/dist/validation/output-validator.d.ts +136 -0
  249. package/dist/validation/output-validator.d.ts.map +1 -0
  250. package/dist/validation/output-validator.js +262 -0
  251. package/dist/validation/output-validator.js.map +1 -0
  252. package/dist/validation/response-factory.d.ts +44 -0
  253. package/dist/validation/response-factory.d.ts.map +1 -0
  254. package/dist/validation/response-factory.js +202 -0
  255. package/dist/validation/response-factory.js.map +1 -0
  256. package/dist/validation/schemas.d.ts +519 -0
  257. package/dist/validation/schemas.d.ts.map +1 -0
  258. package/dist/validation/schemas.js +6 -0
  259. package/dist/validation/schemas.js.map +1 -0
  260. package/package.json +72 -0
@@ -0,0 +1,955 @@
1
+ /**
2
+ * Plugin Template - Modern v4.2 (Single Source of Truth)
3
+ *
4
+ * Universal template that intelligently handles both single-file and multi-file analysis
5
+ * Automatically detects analysis type based on provided parameters
6
+ *
7
+ * Copy this template for creating any new plugin - it adapts to your needs
8
+ */
9
+ import { BasePlugin } from '../../plugins/base-plugin.js';
10
+ import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
11
+ import { withSecurity } from '../../security/integration-helpers.js';
12
+ import { ModelSetup, ResponseProcessor, ErrorHandler, MultiFileAnalysis } from '../../utils/plugin-utilities.js';
13
+ import { getAnalysisCache } from '../../cache/index.js';
14
+ // Common Node.js modules - Use these instead of require()
15
+ import { basename } from 'path';
16
+ export class ResponsiveComponentGenerator extends BasePlugin {
17
+ constructor() {
18
+ super();
19
+ this.name = 'generate_responsive_component';
20
+ this.category = 'generate';
21
+ this.description = 'Generate responsive, accessible HTML/CSS components with modern best practices';
22
+ // Universal parameter set - supports both single and multi-file scenarios
23
+ this.parameters = {
24
+ // Component generation parameters
25
+ name: {
26
+ type: 'string',
27
+ description: 'Component name',
28
+ required: true
29
+ },
30
+ type: {
31
+ type: 'string',
32
+ description: 'Component type',
33
+ required: true,
34
+ enum: ['button', 'form', 'card', 'modal', 'navigation', 'layout', 'custom']
35
+ },
36
+ framework: {
37
+ type: 'string',
38
+ description: 'Framework to use',
39
+ required: false,
40
+ enum: ['vanilla', 'react', 'vue', 'angular', 'svelte'],
41
+ default: 'vanilla'
42
+ },
43
+ designSystem: {
44
+ type: 'string',
45
+ description: 'Design system to follow',
46
+ required: false,
47
+ default: 'custom'
48
+ },
49
+ responsive: {
50
+ type: 'boolean',
51
+ description: 'Make component responsive',
52
+ required: false,
53
+ default: true
54
+ },
55
+ accessible: {
56
+ type: 'boolean',
57
+ description: 'Include accessibility features',
58
+ required: false,
59
+ default: true
60
+ },
61
+ animations: {
62
+ type: 'boolean',
63
+ description: 'Include animations',
64
+ required: false,
65
+ default: false
66
+ },
67
+ darkMode: {
68
+ type: 'boolean',
69
+ description: 'Include dark mode support',
70
+ required: false,
71
+ default: false
72
+ },
73
+ saveDirectory: {
74
+ type: 'string',
75
+ description: 'Directory to save the component project (e.g., "C:\\dev\\my-project"). If not provided, user will be prompted to specify location.',
76
+ required: false
77
+ },
78
+ context: {
79
+ type: 'object',
80
+ description: 'Rich context object with brand information, design references, content, colors, typography, and technical requirements',
81
+ required: false
82
+ }
83
+ };
84
+ this.analysisCache = getAnalysisCache();
85
+ this.multiFileAnalysis = new MultiFileAnalysis();
86
+ // Cache and analysis utilities are initialized above
87
+ }
88
+ async execute(params, llmClient) {
89
+ return await withSecurity(this, params, llmClient, async (secureParams) => {
90
+ try {
91
+ // Validate required parameters
92
+ if (!secureParams.name || !secureParams.type) {
93
+ throw new Error('name and type are required parameters');
94
+ }
95
+ // Handle directory specification
96
+ if (!secureParams.saveDirectory) {
97
+ return {
98
+ success: false,
99
+ requiresUserInput: true,
100
+ message: `Please specify where to save the ${secureParams.name} component project.`,
101
+ prompt: `Where would you like to save the component project?`,
102
+ suggestions: [
103
+ `C:\\dev\\${secureParams.name.toLowerCase()}-component`,
104
+ `C:\\projects\\${secureParams.name.toLowerCase()}-component`,
105
+ `C:\\components\\${secureParams.name.toLowerCase()}-component`
106
+ ],
107
+ nextAction: {
108
+ function: 'generate_responsive_component',
109
+ parameters: {
110
+ ...secureParams,
111
+ saveDirectory: '[USER_WILL_SPECIFY]'
112
+ }
113
+ }
114
+ };
115
+ }
116
+ // Setup model
117
+ const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
118
+ // Generate component (this is always a generation task, not file analysis)
119
+ const promptStages = this.getComponentGenerationStages(secureParams);
120
+ // Execute with appropriate method
121
+ const promptManager = new ThreeStagePromptManager(contextLength);
122
+ const needsChunking = promptManager.needsChunking(promptStages);
123
+ let response;
124
+ if (needsChunking) {
125
+ const conversation = promptManager.createChunkedConversation(promptStages);
126
+ const messages = [
127
+ conversation.systemMessage,
128
+ ...conversation.dataMessages,
129
+ conversation.analysisMessage
130
+ ];
131
+ response = await ResponseProcessor.executeChunked(messages, model, contextLength, 'generate_responsive_component', 'single');
132
+ }
133
+ else {
134
+ response = await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'generate_responsive_component');
135
+ }
136
+ // Auto-save the generated component to the specified directory
137
+ if (response.success && response.data?.content) {
138
+ try {
139
+ const saveResult = await this.autoSaveComponent(secureParams, response.data.content);
140
+ // Add save information to the response
141
+ response.data.savedFiles = saveResult;
142
+ response.data.projectPath = saveResult.projectPath;
143
+ response.data.demoUrl = saveResult.demoUrl;
144
+ response.data.instructions = [
145
+ `✅ Component project created at: ${saveResult.projectPath}`,
146
+ `🌐 Open demo in browser: ${saveResult.demoUrl}`,
147
+ `📁 Ready for GitHub: Complete project structure with README.md`,
148
+ `🔧 Development ready: ${secureParams.framework !== 'vanilla' ? 'Run npm install to get started' : 'All files ready to use'}`
149
+ ];
150
+ }
151
+ catch (saveError) {
152
+ // Don't fail the entire operation if saving fails
153
+ response.data.saveError = `Failed to auto-save component: ${saveError.message}`;
154
+ }
155
+ }
156
+ return response;
157
+ }
158
+ catch (error) {
159
+ return ErrorHandler.createExecutionError('generate_responsive_component', error);
160
+ }
161
+ });
162
+ }
163
+ /**
164
+ * Generate component creation prompt stages
165
+ */
166
+ getComponentGenerationStages(params) {
167
+ const { name, type, framework, designSystem, responsive, accessible, animations, darkMode, context } = params;
168
+ const systemAndContext = `You are an expert frontend developer and UI/UX engineer with 15+ years of experience creating production-ready, accessible web components.
169
+
170
+ **YOUR EXPERTISE:**
171
+ - Modern web standards (HTML5, CSS Grid/Flexbox, ES6+)
172
+ - Accessibility compliance (WCAG 2.1 AA standards)
173
+ - Performance optimization (Core Web Vitals, progressive enhancement)
174
+ - Cross-browser compatibility and responsive design
175
+ - Framework-specific best practices and patterns
176
+ - Design system implementation and theming
177
+
178
+ **COMPONENT SPECIFICATIONS:**
179
+ - Component Name: ${name}
180
+ - Component Type: ${type}
181
+ - Target Framework: ${framework}
182
+ - Design System: ${designSystem}
183
+ - Responsive Design: ${responsive ? 'Mobile-first approach with fluid layouts' : 'Fixed-width design'}
184
+ - Accessibility: ${accessible ? 'Full WCAG 2.1 AA compliance with semantic markup' : 'Basic accessibility'}
185
+ - Animations: ${animations ? 'Performance-optimized CSS animations and transitions' : 'Static component without animations'}
186
+ - Dark Mode: ${darkMode ? 'System preference detection with CSS custom properties' : 'Single theme implementation'}
187
+
188
+ ${context ? this.buildContextSection(context) : ''}
189
+
190
+ **QUALITY STANDARDS:**
191
+ You must create enterprise-grade components that are production-ready, maintainable, and follow industry best practices. Focus on creating components that developers will be excited to use and proud to ship.`;
192
+ const dataPayload = `**COMPONENT REQUIREMENTS:**
193
+
194
+ **Functional Requirements:**
195
+ - Component must be fully functional and interactive
196
+ - All states and edge cases properly handled
197
+ - Consistent behavior across different screen sizes
198
+ - Graceful degradation for older browsers
199
+
200
+ **Technical Requirements:**
201
+ - Semantic HTML5 markup with proper structure
202
+ - Modern CSS with custom properties for theming
203
+ - Clean, maintainable JavaScript/TypeScript code
204
+ - Performance-optimized with minimal bundle impact
205
+ - Cross-browser compatible (Chrome 90+, Firefox 88+, Safari 14+, Edge 90+)
206
+
207
+ **Framework-Specific Considerations:**
208
+ ${this.getFrameworkRequirements(framework)}
209
+
210
+ **Accessibility Requirements:**
211
+ ${accessible ? `
212
+ - Proper ARIA labels, roles, and properties
213
+ - Keyboard navigation support (Tab, Enter, Escape, Arrow keys)
214
+ - Screen reader compatibility with descriptive content
215
+ - Focus management and visual focus indicators
216
+ - Color contrast ratios meeting WCAG AA standards
217
+ - Error messaging and form validation feedback
218
+ ` : '- Basic accessibility with semantic HTML'}
219
+
220
+ **Responsive Design Requirements:**
221
+ ${responsive ? `
222
+ - Mobile-first CSS approach with progressive enhancement
223
+ - Flexible grid systems and fluid typography
224
+ - Touch-friendly interaction targets (minimum 44px)
225
+ - Optimized for common breakpoints: 320px, 768px, 1024px, 1440px
226
+ - Container queries where beneficial
227
+ ` : '- Fixed-width design optimized for desktop'}
228
+
229
+ ${context ? this.buildContextRequirements(context) : ''}`;
230
+ const outputInstructions = `**GENERATE COMPLETE COMPONENT PACKAGE WITH STRUCTURED SECTIONS:**
231
+
232
+ **IMPORTANT**: Structure your response with clear section markers for automatic file extraction.
233
+
234
+ ## 1. Component Implementation
235
+
236
+ \`\`\`${framework === 'react' ? 'tsx' : framework === 'vue' ? 'vue' : framework === 'angular' ? 'ts' : framework === 'svelte' ? 'svelte' : 'js'}
237
+ // Complete ${framework} component code here
238
+ \`\`\`
239
+
240
+ ## 2. HTML Structure ${framework === 'vanilla' ? '(Main Implementation)' : '(Reference)'}
241
+
242
+ \`\`\`html
243
+ <!-- Semantic HTML5 markup with proper ARIA attributes -->
244
+ \`\`\`
245
+
246
+ ## 3. CSS Styles
247
+
248
+ \`\`\`css
249
+ /* Complete component styles with custom properties for theming */
250
+ /* Include responsive design, dark mode (if enabled), and animations (if enabled) */
251
+ \`\`\`
252
+
253
+ ## 4. Usage Examples
254
+
255
+ \`\`\`${framework === 'react' ? 'tsx' : framework === 'vue' ? 'vue' : 'js'}
256
+ // Basic usage example
257
+ // Advanced configuration example
258
+ \`\`\`
259
+
260
+ ## 5. Customization Guide
261
+ - CSS custom properties available
262
+ - Component configuration options
263
+ - Theming instructions
264
+
265
+ ## 6. Accessibility Features
266
+ - Keyboard navigation support
267
+ - Screen reader compatibility
268
+ - ARIA patterns implemented
269
+
270
+ ## 7. Browser Support & Performance
271
+ - Compatibility matrix
272
+ - Performance optimizations included
273
+
274
+ **COMPONENT WILL BE AUTO-SAVED TO:** \`${params.saveDirectory || 'C:/DEV/components/' + name.toLowerCase() + '-component'}\`
275
+ - Component file: \`src/${name}.${this.getComponentExtension(framework)}\`
276
+ - Styles: \`styles/${name}.css\`
277
+ - Demo: \`demo/index.html\` (open in browser to test immediately)
278
+ - Documentation: \`README.md\`
279
+ ${framework !== 'vanilla' ? `- Package: \`package.json\`${framework === 'react' ? ' (with React dependencies)' : framework === 'vue' ? ' (with Vue dependencies)' : ''}` : ''}
280
+
281
+ Generate production-quality code that developers can immediately use, test in browser, and commit to GitHub!`;
282
+ return { systemAndContext, dataPayload, outputInstructions };
283
+ }
284
+ /**
285
+ * Get framework-specific requirements for better component generation
286
+ */
287
+ getFrameworkRequirements(framework) {
288
+ const requirements = {
289
+ 'react': `
290
+ **React-Specific Requirements:**
291
+ - Functional component with TypeScript interfaces
292
+ - Props validation and default values
293
+ - Ref forwarding for DOM access
294
+ - Custom hooks for complex state management
295
+ - Memo optimization where appropriate
296
+ - Error boundary considerations`,
297
+ 'vue': `
298
+ **Vue-Specific Requirements:**
299
+ - Composition API with TypeScript support
300
+ - Props definition with validation
301
+ - Emitted events documentation
302
+ - Scoped styles and CSS modules
303
+ - Reactive properties and computed values
304
+ - Template reference variables`,
305
+ 'angular': `
306
+ **Angular-Specific Requirements:**
307
+ - Component class with decorators
308
+ - Input/Output property bindings
309
+ - Change detection strategy optimization
310
+ - Dependency injection patterns
311
+ - Angular Material integration (if applicable)
312
+ - OnPush change detection where beneficial`,
313
+ 'svelte': `
314
+ **Svelte-Specific Requirements:**
315
+ - Component script with TypeScript
316
+ - Reactive declarations and stores
317
+ - Component events and slots
318
+ - Built-in transition animations
319
+ - Style encapsulation
320
+ - Progressive enhancement patterns`,
321
+ 'vanilla': `
322
+ **Vanilla JavaScript Requirements:**
323
+ - ES6+ module pattern or class-based approach
324
+ - Web Components compatibility (Custom Elements API)
325
+ - Event delegation for performance
326
+ - DOM manipulation helpers
327
+ - Progressive enhancement approach
328
+ - No framework dependencies`
329
+ };
330
+ return requirements[framework] || requirements['vanilla'];
331
+ }
332
+ /**
333
+ * Required for backwards compatibility
334
+ */
335
+ getPromptStages(params) {
336
+ return this.getComponentGenerationStages(params);
337
+ }
338
+ // Generation-specific helper methods
339
+ async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
340
+ // For component generation, we don't typically need file discovery
341
+ // But the template requires this method
342
+ return [];
343
+ }
344
+ async performMultiFileAnalysis(files, params, model, contextLength) {
345
+ // Component generation doesn't use multi-file analysis
346
+ // But template requires this method for consistency
347
+ return {
348
+ summary: `Component generation request for ${params.name}`,
349
+ findings: [],
350
+ data: {
351
+ componentSpecs: params
352
+ }
353
+ };
354
+ }
355
+ async analyzeIndividualFile(file, params, model) {
356
+ // Not used for component generation, but required by template
357
+ return {
358
+ filePath: file,
359
+ fileName: basename(file),
360
+ size: 0,
361
+ lines: 0
362
+ };
363
+ }
364
+ getFileExtensions(analysisType) {
365
+ // Component generation doesn't use file extensions in the same way
366
+ // But template requires this method
367
+ return ['.js', '.ts', '.jsx', '.tsx', '.html', '.css'];
368
+ }
369
+ generateCacheKey(files, params) {
370
+ const paramHash = JSON.stringify(params);
371
+ return `component_${paramHash}`.substring(0, 64);
372
+ }
373
+ /**
374
+ * Auto-save the generated component to a specified directory structure ready for browser testing and GitHub
375
+ */
376
+ async autoSaveComponent(params, generatedContent) {
377
+ const { name, framework, saveDirectory } = params;
378
+ const componentName = name.charAt(0).toUpperCase() + name.slice(1); // Capitalize first letter
379
+ // Use specified directory or default to DEV folder
380
+ const baseDir = saveDirectory || `C:/DEV/components/${componentName.toLowerCase()}-component`;
381
+ // Normalize path separators for consistency
382
+ const normalizedBaseDir = baseDir.replace(/\\/g, '/');
383
+ // Create directory structure
384
+ await this.ensureDirectory(normalizedBaseDir);
385
+ await this.ensureDirectory(`${normalizedBaseDir}/src`);
386
+ await this.ensureDirectory(`${normalizedBaseDir}/styles`);
387
+ await this.ensureDirectory(`${normalizedBaseDir}/demo`);
388
+ const savedFiles = [];
389
+ try {
390
+ // Extract different sections from the generated content
391
+ const sections = this.extractSections(generatedContent);
392
+ // Save component file
393
+ if (sections.component) {
394
+ const componentExtension = this.getComponentExtension(framework);
395
+ const componentPath = `${normalizedBaseDir}/src/${componentName}.${componentExtension}`;
396
+ await this.writeFile(componentPath, sections.component);
397
+ savedFiles.push(componentPath);
398
+ }
399
+ // Save CSS file
400
+ if (sections.css) {
401
+ const cssPath = `${normalizedBaseDir}/styles/${componentName}.css`;
402
+ await this.writeFile(cssPath, sections.css);
403
+ savedFiles.push(cssPath);
404
+ }
405
+ // Save demo HTML file
406
+ const demoHtml = this.generateDemoHtml(componentName, sections, params);
407
+ const demoPath = `${normalizedBaseDir}/demo/index.html`;
408
+ await this.writeFile(demoPath, demoHtml);
409
+ savedFiles.push(demoPath);
410
+ // Save README.md with documentation
411
+ const readme = this.generateReadme(componentName, sections, params);
412
+ const readmePath = `${normalizedBaseDir}/README.md`;
413
+ await this.writeFile(readmePath, readme);
414
+ savedFiles.push(readmePath);
415
+ // Save package.json for npm projects
416
+ if (framework !== 'vanilla') {
417
+ const packageJson = this.generatePackageJson(componentName, framework);
418
+ const packagePath = `${normalizedBaseDir}/package.json`;
419
+ await this.writeFile(packagePath, JSON.stringify(packageJson, null, 2));
420
+ savedFiles.push(packagePath);
421
+ }
422
+ return {
423
+ success: true,
424
+ projectPath: normalizedBaseDir,
425
+ savedFiles,
426
+ demoUrl: `file://${normalizedBaseDir.replace(/\//g, '\\\\')}\\\\demo\\\\index.html`,
427
+ message: `Component saved successfully! Open ${normalizedBaseDir}/demo/index.html in browser to test.`
428
+ };
429
+ }
430
+ catch (error) {
431
+ return {
432
+ success: false,
433
+ error: error.message,
434
+ partialFiles: savedFiles
435
+ };
436
+ }
437
+ }
438
+ /**
439
+ * Extract different sections from the generated markdown content
440
+ */
441
+ extractSections(content) {
442
+ const sections = {};
443
+ // Extract component code (TypeScript/JavaScript)
444
+ const componentMatch = content.match(/```(?:tsx?|jsx?|js|ts)\n([\s\S]*?)\n```/);
445
+ if (componentMatch) {
446
+ sections.component = componentMatch[1];
447
+ }
448
+ // Extract CSS
449
+ const cssMatch = content.match(/```css\n([\s\S]*?)\n```/);
450
+ if (cssMatch) {
451
+ sections.css = cssMatch[1];
452
+ }
453
+ // Extract HTML structure
454
+ const htmlMatch = content.match(/```html\n([\s\S]*?)\n```/);
455
+ if (htmlMatch) {
456
+ sections.html = htmlMatch[1];
457
+ }
458
+ // Extract usage examples
459
+ const usageMatch = content.match(/## (?:5\\.)?\\s*Usage Examples[\\s\\S]*?```(?:tsx?|jsx?)\n([\\s\\S]*?)\n```/);
460
+ if (usageMatch) {
461
+ sections.usage = usageMatch[1];
462
+ }
463
+ return sections;
464
+ }
465
+ /**
466
+ * Generate a demo HTML file for immediate browser testing
467
+ */
468
+ generateDemoHtml(componentName, sections, params) {
469
+ const { framework, responsive, darkMode } = params;
470
+ const title = `${componentName} Demo`;
471
+ const cssLink = framework === 'vanilla'
472
+ ? `<link rel="stylesheet" href="../styles/${componentName}.css">`
473
+ : `<link rel="stylesheet" href="../styles/${componentName}.css">`;
474
+ const darkModeToggle = darkMode ? `
475
+ <div class="demo-controls">
476
+ <button onclick="toggleDarkMode()" class="theme-toggle">🌓 Toggle Dark Mode</button>
477
+ </div>` : '';
478
+ return `<!DOCTYPE html>
479
+ <html lang="en">
480
+ <head>
481
+ <meta charset="UTF-8">
482
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
483
+ <title>${title}</title>
484
+ ${cssLink}
485
+ <style>
486
+ body {
487
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
488
+ margin: 0;
489
+ padding: 20px;
490
+ background: #f5f5f5;
491
+ min-height: 100vh;
492
+ transition: background-color 0.3s ease;
493
+ }
494
+
495
+ .demo-container {
496
+ max-width: 1200px;
497
+ margin: 0 auto;
498
+ }
499
+
500
+ .demo-header {
501
+ text-align: center;
502
+ margin-bottom: 40px;
503
+ }
504
+
505
+ .demo-controls {
506
+ margin-bottom: 20px;
507
+ text-align: center;
508
+ }
509
+
510
+ .theme-toggle {
511
+ padding: 8px 16px;
512
+ background: #007bff;
513
+ color: white;
514
+ border: none;
515
+ border-radius: 4px;
516
+ cursor: pointer;
517
+ font-size: 14px;
518
+ }
519
+
520
+ .theme-toggle:hover {
521
+ background: #0056b3;
522
+ }
523
+
524
+ .demo-grid {
525
+ display: grid;
526
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
527
+ gap: 20px;
528
+ margin-bottom: 40px;
529
+ }
530
+
531
+ .demo-section {
532
+ background: white;
533
+ padding: 20px;
534
+ border-radius: 8px;
535
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
536
+ }
537
+
538
+ .demo-section h3 {
539
+ margin-top: 0;
540
+ color: #333;
541
+ }
542
+
543
+ @media (prefers-color-scheme: dark) {
544
+ body { background: #121212; }
545
+ .demo-section { background: #1e1e1e; color: #fff; }
546
+ .demo-section h3 { color: #fff; }
547
+ }
548
+
549
+ /* Component specific demo styles */
550
+ .component-showcase {
551
+ padding: 40px 20px;
552
+ background: white;
553
+ border-radius: 12px;
554
+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);
555
+ margin-bottom: 40px;
556
+ }
557
+
558
+ ${responsive ? '@media (max-width: 768px) { .demo-grid { grid-template-columns: 1fr; } }' : ''}
559
+ </style>
560
+ </head>
561
+ <body>
562
+ <div class="demo-container">
563
+ <header class="demo-header">
564
+ <h1>${title}</h1>
565
+ <p>Interactive demo of the ${componentName} component</p>
566
+ </header>
567
+
568
+ ${darkModeToggle}
569
+
570
+ <div class="component-showcase">
571
+ <h2>Live Component Demo</h2>
572
+ <div class="demo-grid">
573
+ <div class="demo-section">
574
+ <h3>Default Configuration</h3>
575
+ ${this.generateComponentDemo(componentName, sections, params, 'default')}
576
+ </div>
577
+
578
+ <div class="demo-section">
579
+ <h3>With Custom Props</h3>
580
+ ${this.generateComponentDemo(componentName, sections, params, 'custom')}
581
+ </div>
582
+
583
+ ${responsive ? `
584
+ <div class="demo-section">
585
+ <h3>Responsive Behavior</h3>
586
+ <p>Resize your browser window to see responsive behavior in action.</p>
587
+ </div>` : ''}
588
+ </div>
589
+ </div>
590
+
591
+ <div class="demo-section">
592
+ <h3>Component Features</h3>
593
+ <ul>
594
+ <li>Framework: ${framework}</li>
595
+ <li>Responsive: ${responsive ? 'Yes' : 'No'}</li>
596
+ <li>Accessible: ${params.accessible ? 'Yes' : 'No'}</li>
597
+ <li>Dark Mode: ${darkMode ? 'Yes' : 'No'}</li>
598
+ <li>Animations: ${params.animations ? 'Yes' : 'No'}</li>
599
+ </ul>
600
+ </div>
601
+ </div>
602
+
603
+ ${framework === 'vanilla' ? this.generateVanillaScript(sections) : ''}
604
+
605
+ ${darkMode ? `
606
+ <script>
607
+ function toggleDarkMode() {
608
+ document.body.classList.toggle('dark-mode');
609
+ }
610
+ </script>` : ''}
611
+ </body>
612
+ </html>`;
613
+ }
614
+ /**
615
+ * Generate component demo instances for the HTML demo
616
+ */
617
+ generateComponentDemo(componentName, sections, params, variant) {
618
+ const { framework, type } = params;
619
+ if (framework === 'vanilla') {
620
+ // Generate vanilla HTML demo
621
+ return sections.html || `<div class="${componentName.toLowerCase()}-demo">Component demo placeholder</div>`;
622
+ }
623
+ else {
624
+ // For framework components, show placeholder that would be replaced by actual framework rendering
625
+ return `<div class="component-placeholder">
626
+ <p><strong>${componentName}</strong> component would render here</p>
627
+ <p><em>This is a ${variant} configuration</em></p>
628
+ <p>In a real ${framework} app, this would be:</p>
629
+ <code>&lt;${componentName} ${variant === 'custom' ? 'customProp="value"' : ''}/&gt;</code>
630
+ </div>`;
631
+ }
632
+ }
633
+ /**
634
+ * Generate vanilla JavaScript for interactive demo
635
+ */
636
+ generateVanillaScript(sections) {
637
+ if (!sections.component)
638
+ return '';
639
+ return `
640
+ <script>
641
+ // Component initialization and demo functionality
642
+ document.addEventListener('DOMContentLoaded', function() {
643
+ // Initialize component demos
644
+ console.log('Component demo initialized');
645
+ });
646
+ </script>`;
647
+ }
648
+ /**
649
+ * Generate README.md with full documentation
650
+ */
651
+ generateReadme(componentName, sections, params) {
652
+ const { framework, type, responsive, accessible, darkMode, animations } = params;
653
+ return `# ${componentName} Component
654
+
655
+ Generated responsive ${type} component for ${framework}
656
+
657
+ ## Features
658
+
659
+ - ✅ **Responsive Design**: ${responsive ? 'Mobile-first responsive layout' : 'Fixed-width design'}
660
+ - ✅ **Accessibility**: ${accessible ? 'WCAG 2.1 AA compliant' : 'Basic accessibility'}
661
+ - ✅ **Dark Mode**: ${darkMode ? 'System preference detection' : 'Single theme'}
662
+ - ✅ **Animations**: ${animations ? 'Smooth CSS animations' : 'Static component'}
663
+ - ✅ **Framework**: ${framework}
664
+ - ✅ **Production Ready**: Enterprise-grade code quality
665
+
666
+ ## Quick Start
667
+
668
+ ### Demo
669
+ Open \`demo/index.html\` in your browser to see the component in action.
670
+
671
+ ### Installation
672
+ ${framework !== 'vanilla' ? `
673
+ \`\`\`bash
674
+ npm install
675
+ \`\`\`
676
+ ` : ''}
677
+
678
+ ### Usage
679
+ ${framework === 'react' ? `
680
+ \`\`\`tsx
681
+ import ${componentName} from './src/${componentName}';
682
+
683
+ function App() {
684
+ return (
685
+ <${componentName}
686
+ // Add your props here
687
+ />
688
+ );
689
+ }
690
+ \`\`\`
691
+ ` : framework === 'vue' ? `
692
+ \`\`\`vue
693
+ <template>
694
+ <${componentName} />
695
+ </template>
696
+
697
+ <script>
698
+ import ${componentName} from './src/${componentName}.vue';
699
+
700
+ export default {
701
+ components: {
702
+ ${componentName}
703
+ }
704
+ }
705
+ </script>
706
+ \`\`\`
707
+ ` : `
708
+ \`\`\`html
709
+ <link rel="stylesheet" href="styles/${componentName}.css">
710
+ <!-- Add your HTML structure here -->
711
+ \`\`\`
712
+ `}
713
+
714
+ ## File Structure
715
+
716
+ \`\`\`
717
+ ${componentName.toLowerCase()}-component/
718
+ ├── src/
719
+ │ └── ${componentName}.${this.getComponentExtension(framework)}
720
+ ├── styles/
721
+ │ └── ${componentName}.css
722
+ ├── demo/
723
+ │ └── index.html
724
+ ${framework !== 'vanilla' ? '├── package.json' : ''}
725
+ └── README.md
726
+ \`\`\`
727
+
728
+ ## Customization
729
+
730
+ The component uses CSS custom properties for easy theming:
731
+
732
+ \`\`\`css
733
+ :root {
734
+ --${componentName.toLowerCase()}-primary-color: #007bff;
735
+ --${componentName.toLowerCase()}-background: #ffffff;
736
+ /* Add more custom properties as needed */
737
+ }
738
+ \`\`\`
739
+
740
+ ## Browser Support
741
+
742
+ - Chrome 90+
743
+ - Firefox 88+
744
+ - Safari 14+
745
+ - Edge 90+
746
+
747
+ ## Contributing
748
+
749
+ This component was generated using an AI assistant. Feel free to modify and enhance as needed for your specific use case.
750
+
751
+ ## License
752
+
753
+ MIT License - feel free to use in your projects!
754
+ `;
755
+ }
756
+ /**
757
+ * Generate package.json for framework projects
758
+ */
759
+ generatePackageJson(componentName, framework) {
760
+ const basePackage = {
761
+ name: `${componentName.toLowerCase()}-component`,
762
+ version: "1.0.0",
763
+ description: `Responsive ${componentName} component for ${framework}`,
764
+ main: `src/${componentName}.${this.getComponentExtension(framework)}`,
765
+ scripts: {
766
+ start: "npm run dev",
767
+ dev: "echo 'Add your dev server command here'",
768
+ build: "echo 'Add your build command here'",
769
+ test: "echo 'Add your test command here'"
770
+ },
771
+ keywords: [
772
+ componentName.toLowerCase(),
773
+ framework,
774
+ "component",
775
+ "responsive",
776
+ "accessible"
777
+ ],
778
+ author: "AI Assistant",
779
+ license: "MIT"
780
+ };
781
+ // Add framework-specific dependencies
782
+ if (framework === 'react') {
783
+ basePackage['dependencies'] = {
784
+ "react": "^18.0.0",
785
+ "react-dom": "^18.0.0"
786
+ };
787
+ basePackage['devDependencies'] = {
788
+ "@types/react": "^18.0.0",
789
+ "@types/react-dom": "^18.0.0",
790
+ "typescript": "^5.0.0"
791
+ };
792
+ }
793
+ else if (framework === 'vue') {
794
+ basePackage['dependencies'] = {
795
+ "vue": "^3.0.0"
796
+ };
797
+ basePackage['devDependencies'] = {
798
+ "@vitejs/plugin-vue": "^4.0.0",
799
+ "typescript": "^5.0.0",
800
+ "vite": "^4.0.0"
801
+ };
802
+ }
803
+ return basePackage;
804
+ }
805
+ /**
806
+ * Build rich context section from provided context object
807
+ */
808
+ buildContextSection(context) {
809
+ let contextSection = '\n**PROJECT CONTEXT & BRAND REQUIREMENTS:**\n';
810
+ // Project information
811
+ if (context.project) {
812
+ contextSection += `- Project: ${context.project}\n`;
813
+ }
814
+ if (context.reference) {
815
+ contextSection += `- Design Reference: ${context.reference}\n`;
816
+ }
817
+ if (context.target_audience) {
818
+ contextSection += `- Target Audience: ${context.target_audience}\n`;
819
+ }
820
+ if (context.brand_positioning) {
821
+ contextSection += `- Brand Position: ${context.brand_positioning}\n`;
822
+ }
823
+ // Brand colors
824
+ if (context.brand_colors) {
825
+ contextSection += '\n**BRAND COLORS:**\n';
826
+ Object.entries(context.brand_colors).forEach(([key, value]) => {
827
+ contextSection += `- ${key}: ${value}\n`;
828
+ });
829
+ }
830
+ // Typography
831
+ if (context.typography) {
832
+ contextSection += '\n**TYPOGRAPHY:**\n';
833
+ Object.entries(context.typography).forEach(([key, value]) => {
834
+ contextSection += `- ${key}: ${value}\n`;
835
+ });
836
+ }
837
+ // Hero content
838
+ if (context.hero_content) {
839
+ contextSection += '\n**HERO SECTION CONTENT:**\n';
840
+ Object.entries(context.hero_content).forEach(([key, value]) => {
841
+ contextSection += `- ${key}: ${value}\n`;
842
+ });
843
+ }
844
+ // Navigation
845
+ if (context.navigation) {
846
+ contextSection += '\n**NAVIGATION:**\n';
847
+ contextSection += `- Brand: ${context.navigation.brand}\n`;
848
+ contextSection += `- Greeting: ${context.navigation.greeting}\n`;
849
+ if (context.navigation.links) {
850
+ contextSection += `- Links: ${context.navigation.links.join(', ')}\n`;
851
+ }
852
+ }
853
+ // Stats data
854
+ if (context.stats_data && Array.isArray(context.stats_data)) {
855
+ contextSection += '\n**STATISTICS TO SHOWCASE:**\n';
856
+ context.stats_data.forEach((stat, index) => {
857
+ contextSection += `${index + 1}. ${stat.number} - ${stat.label} (${stat.context})\n`;
858
+ });
859
+ }
860
+ // Key features
861
+ if (context.key_features && Array.isArray(context.key_features)) {
862
+ contextSection += '\n**KEY FEATURES TO HIGHLIGHT:**\n';
863
+ context.key_features.forEach((feature, index) => {
864
+ contextSection += `${index + 1}. **${feature.title}**: ${feature.description}\n`;
865
+ });
866
+ }
867
+ // Design reference HTML
868
+ if (context.design_reference_html) {
869
+ contextSection += '\n**DESIGN REFERENCE HTML:**\n';
870
+ contextSection += `Reference structure to inspire layout and styling:\n${context.design_reference_html}\n`;
871
+ }
872
+ // Technical requirements
873
+ if (context.technical_requirements) {
874
+ contextSection += '\n**TECHNICAL REQUIREMENTS:**\n';
875
+ Object.entries(context.technical_requirements).forEach(([key, value]) => {
876
+ if (Array.isArray(value)) {
877
+ contextSection += `- ${key}: ${value.join(', ')}\n`;
878
+ }
879
+ else {
880
+ contextSection += `- ${key}: ${value}\n`;
881
+ }
882
+ });
883
+ }
884
+ contextSection += '\n**CONTEXT INTEGRATION REQUIREMENT:**\nYou MUST incorporate ALL the provided context information into the component design. Use the brand colors, typography, hero content, navigation structure, statistics, and key features exactly as specified. This is not optional context - it is required content that must appear in the final component.\n';
885
+ return contextSection;
886
+ }
887
+ /**
888
+ * Build context-specific implementation requirements
889
+ */
890
+ buildContextRequirements(context) {
891
+ let requirements = '\n**CONTEXT-SPECIFIC IMPLEMENTATION REQUIREMENTS:**\n';
892
+ if (context.brand_colors) {
893
+ requirements += '- Implement exact brand colors using CSS custom properties\n';
894
+ requirements += '- Ensure proper color contrast ratios for accessibility\n';
895
+ }
896
+ if (context.hero_content) {
897
+ requirements += '- Create prominent hero section with provided headline and description\n';
898
+ requirements += '- Style CTAs according to brand guidelines\n';
899
+ }
900
+ if (context.stats_data) {
901
+ requirements += '- Design statistics section showcasing provided data points\n';
902
+ requirements += '- Make statistics visually impactful and easy to scan\n';
903
+ }
904
+ if (context.key_features) {
905
+ requirements += '- Create feature section highlighting provided benefits\n';
906
+ requirements += '- Use icons or visual elements to enhance feature presentation\n';
907
+ }
908
+ if (context.navigation) {
909
+ requirements += '- Implement navigation with provided brand name and links\n';
910
+ requirements += '- Include brand greeting element in appropriate location\n';
911
+ }
912
+ if (context.design_reference_html) {
913
+ requirements += '- Use design reference as structural and styling inspiration\n';
914
+ requirements += '- Adapt reference patterns to fit provided content\n';
915
+ }
916
+ if (context.technical_requirements) {
917
+ requirements += '- Meet all specified technical requirements\n';
918
+ requirements += '- Optimize for provided breakpoints and performance targets\n';
919
+ }
920
+ requirements += '\n**CONTENT PRIORITY:**\nAll provided content (headlines, descriptions, statistics, features) must be prominently featured. This is a real project with specific content requirements, not a generic template.\n';
921
+ return requirements;
922
+ }
923
+ /**
924
+ * Get appropriate file extension for the framework
925
+ */
926
+ getComponentExtension(framework) {
927
+ const extensions = {
928
+ 'react': 'tsx',
929
+ 'vue': 'vue',
930
+ 'angular': 'ts',
931
+ 'svelte': 'svelte',
932
+ 'vanilla': 'js'
933
+ };
934
+ return extensions[framework] || 'js';
935
+ }
936
+ /**
937
+ * Ensure directory exists, create if it doesn't
938
+ */
939
+ async ensureDirectory(path) {
940
+ try {
941
+ await import('fs/promises').then(fs => fs.mkdir(path, { recursive: true }));
942
+ }
943
+ catch (error) {
944
+ // Directory might already exist, that's okay
945
+ }
946
+ }
947
+ /**
948
+ * Write file with error handling
949
+ */
950
+ async writeFile(path, content) {
951
+ await import('fs/promises').then(fs => fs.writeFile(path, content, 'utf-8'));
952
+ }
953
+ }
954
+ export default ResponsiveComponentGenerator;
955
+ //# sourceMappingURL=responsive-component.js.map