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