@codebakers/mcp 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/INSTALL.md +221 -0
  2. package/LICENSE +21 -0
  3. package/README.md +412 -0
  4. package/dist/cli.d.ts +9 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +236 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/index.d.ts +12 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +526 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/tools/analyze-mockups.d.ts +18 -0
  13. package/dist/tools/analyze-mockups.d.ts.map +1 -0
  14. package/dist/tools/analyze-mockups.js +497 -0
  15. package/dist/tools/analyze-mockups.js.map +1 -0
  16. package/dist/tools/autonomous-build.d.ts +19 -0
  17. package/dist/tools/autonomous-build.d.ts.map +1 -0
  18. package/dist/tools/autonomous-build.js +287 -0
  19. package/dist/tools/autonomous-build.js.map +1 -0
  20. package/dist/tools/check-gate.d.ts +21 -0
  21. package/dist/tools/check-gate.d.ts.map +1 -0
  22. package/dist/tools/check-gate.js +446 -0
  23. package/dist/tools/check-gate.js.map +1 -0
  24. package/dist/tools/check-scope.d.ts +22 -0
  25. package/dist/tools/check-scope.d.ts.map +1 -0
  26. package/dist/tools/check-scope.js +251 -0
  27. package/dist/tools/check-scope.js.map +1 -0
  28. package/dist/tools/deploy-vercel.d.ts +18 -0
  29. package/dist/tools/deploy-vercel.d.ts.map +1 -0
  30. package/dist/tools/deploy-vercel.js +178 -0
  31. package/dist/tools/deploy-vercel.js.map +1 -0
  32. package/dist/tools/diagnose-error.d.ts +20 -0
  33. package/dist/tools/diagnose-error.d.ts.map +1 -0
  34. package/dist/tools/diagnose-error.js +351 -0
  35. package/dist/tools/diagnose-error.js.map +1 -0
  36. package/dist/tools/enforce-feature.d.ts +25 -0
  37. package/dist/tools/enforce-feature.d.ts.map +1 -0
  38. package/dist/tools/enforce-feature.js +387 -0
  39. package/dist/tools/enforce-feature.js.map +1 -0
  40. package/dist/tools/execute-atomic-unit.d.ts +23 -0
  41. package/dist/tools/execute-atomic-unit.d.ts.map +1 -0
  42. package/dist/tools/execute-atomic-unit.js +107 -0
  43. package/dist/tools/execute-atomic-unit.js.map +1 -0
  44. package/dist/tools/fix-commit.d.ts +23 -0
  45. package/dist/tools/fix-commit.d.ts.map +1 -0
  46. package/dist/tools/fix-commit.js +213 -0
  47. package/dist/tools/fix-commit.js.map +1 -0
  48. package/dist/tools/fix-mockups.d.ts +21 -0
  49. package/dist/tools/fix-mockups.d.ts.map +1 -0
  50. package/dist/tools/fix-mockups.js +595 -0
  51. package/dist/tools/fix-mockups.js.map +1 -0
  52. package/dist/tools/generate-api-route.d.ts +18 -0
  53. package/dist/tools/generate-api-route.d.ts.map +1 -0
  54. package/dist/tools/generate-api-route.js +212 -0
  55. package/dist/tools/generate-api-route.js.map +1 -0
  56. package/dist/tools/generate-chatbot.d.ts +20 -0
  57. package/dist/tools/generate-chatbot.d.ts.map +1 -0
  58. package/dist/tools/generate-chatbot.js +555 -0
  59. package/dist/tools/generate-chatbot.js.map +1 -0
  60. package/dist/tools/generate-component.d.ts +18 -0
  61. package/dist/tools/generate-component.d.ts.map +1 -0
  62. package/dist/tools/generate-component.js +159 -0
  63. package/dist/tools/generate-component.js.map +1 -0
  64. package/dist/tools/generate-docs.d.ts +21 -0
  65. package/dist/tools/generate-docs.d.ts.map +1 -0
  66. package/dist/tools/generate-docs.js +782 -0
  67. package/dist/tools/generate-docs.js.map +1 -0
  68. package/dist/tools/generate-e2e-tests.d.ts +12 -0
  69. package/dist/tools/generate-e2e-tests.d.ts.map +1 -0
  70. package/dist/tools/generate-e2e-tests.js +37 -0
  71. package/dist/tools/generate-e2e-tests.js.map +1 -0
  72. package/dist/tools/generate-migration.d.ts +21 -0
  73. package/dist/tools/generate-migration.d.ts.map +1 -0
  74. package/dist/tools/generate-migration.js +94 -0
  75. package/dist/tools/generate-migration.js.map +1 -0
  76. package/dist/tools/generate-schema.d.ts +18 -0
  77. package/dist/tools/generate-schema.d.ts.map +1 -0
  78. package/dist/tools/generate-schema.js +422 -0
  79. package/dist/tools/generate-schema.js.map +1 -0
  80. package/dist/tools/generate-spec.d.ts +18 -0
  81. package/dist/tools/generate-spec.d.ts.map +1 -0
  82. package/dist/tools/generate-spec.js +446 -0
  83. package/dist/tools/generate-spec.js.map +1 -0
  84. package/dist/tools/generate-store-contracts.d.ts +17 -0
  85. package/dist/tools/generate-store-contracts.d.ts.map +1 -0
  86. package/dist/tools/generate-store-contracts.js +356 -0
  87. package/dist/tools/generate-store-contracts.js.map +1 -0
  88. package/dist/tools/generate-store.d.ts +16 -0
  89. package/dist/tools/generate-store.d.ts.map +1 -0
  90. package/dist/tools/generate-store.js +166 -0
  91. package/dist/tools/generate-store.js.map +1 -0
  92. package/dist/tools/generate-unit-tests.d.ts +14 -0
  93. package/dist/tools/generate-unit-tests.d.ts.map +1 -0
  94. package/dist/tools/generate-unit-tests.js +85 -0
  95. package/dist/tools/generate-unit-tests.js.map +1 -0
  96. package/dist/tools/get-context.d.ts +35 -0
  97. package/dist/tools/get-context.d.ts.map +1 -0
  98. package/dist/tools/get-context.js +367 -0
  99. package/dist/tools/get-context.js.map +1 -0
  100. package/dist/tools/init-session.d.ts +22 -0
  101. package/dist/tools/init-session.d.ts.map +1 -0
  102. package/dist/tools/init-session.js +232 -0
  103. package/dist/tools/init-session.js.map +1 -0
  104. package/dist/tools/map-dependencies.d.ts +25 -0
  105. package/dist/tools/map-dependencies.d.ts.map +1 -0
  106. package/dist/tools/map-dependencies.js +480 -0
  107. package/dist/tools/map-dependencies.js.map +1 -0
  108. package/dist/tools/optimize-performance.d.ts +18 -0
  109. package/dist/tools/optimize-performance.d.ts.map +1 -0
  110. package/dist/tools/optimize-performance.js +285 -0
  111. package/dist/tools/optimize-performance.js.map +1 -0
  112. package/dist/tools/run-interview.d.ts +23 -0
  113. package/dist/tools/run-interview.d.ts.map +1 -0
  114. package/dist/tools/run-interview.js +371 -0
  115. package/dist/tools/run-interview.js.map +1 -0
  116. package/dist/tools/run-tests.d.ts +12 -0
  117. package/dist/tools/run-tests.d.ts.map +1 -0
  118. package/dist/tools/run-tests.js +30 -0
  119. package/dist/tools/run-tests.js.map +1 -0
  120. package/dist/tools/scan-security.d.ts +19 -0
  121. package/dist/tools/scan-security.d.ts.map +1 -0
  122. package/dist/tools/scan-security.js +358 -0
  123. package/dist/tools/scan-security.js.map +1 -0
  124. package/dist/tools/validate-accessibility.d.ts +18 -0
  125. package/dist/tools/validate-accessibility.d.ts.map +1 -0
  126. package/dist/tools/validate-accessibility.js +251 -0
  127. package/dist/tools/validate-accessibility.js.map +1 -0
  128. package/dist/tools/validate-mockups.d.ts +21 -0
  129. package/dist/tools/validate-mockups.d.ts.map +1 -0
  130. package/dist/tools/validate-mockups.js +433 -0
  131. package/dist/tools/validate-mockups.js.map +1 -0
  132. package/dist/tools/verify-completeness.d.ts +13 -0
  133. package/dist/tools/verify-completeness.d.ts.map +1 -0
  134. package/dist/tools/verify-completeness.js +68 -0
  135. package/dist/tools/verify-completeness.js.map +1 -0
  136. package/dist/tools/verify-mockups.d.ts +14 -0
  137. package/dist/tools/verify-mockups.d.ts.map +1 -0
  138. package/dist/tools/verify-mockups.js +85 -0
  139. package/dist/tools/verify-mockups.js.map +1 -0
  140. package/package.json +50 -0
@@ -0,0 +1,595 @@
1
+ /**
2
+ * codebakers_fix_mockups
3
+ *
4
+ * Mockup Auto-Fixer
5
+ *
6
+ * Auto-fixes quality issues detected by validate_mockups:
7
+ * - Overlapping content (adjust positioning)
8
+ * - Out of viewport elements (reposition)
9
+ * - Missing mobile mockups (auto-generate from desktop)
10
+ * - Missing states (generate loading/error/empty)
11
+ * - Color inconsistencies (standardize with CSS variables)
12
+ * - Spacing inconsistencies (round to 8px grid)
13
+ *
14
+ * Cannot auto-fix (flags for manual review):
15
+ * - Poor contrast (design decision)
16
+ * - Complex layout conflicts
17
+ */
18
+ import * as fs from 'fs/promises';
19
+ import * as path from 'path';
20
+ export async function fixMockups(args) {
21
+ const cwd = process.cwd();
22
+ const mockupFolder = args.mockup_folder || 'refs/design/';
23
+ const mockupPath = path.join(cwd, mockupFolder);
24
+ console.error('🍞 CodeBakers: Mockup Auto-Fix');
25
+ try {
26
+ const result = {
27
+ auto_fixed: [],
28
+ manual_review: [],
29
+ files_created: [],
30
+ files_modified: [],
31
+ };
32
+ // Get all mockup files
33
+ const files = await fs.readdir(mockupPath);
34
+ const htmlFiles = files.filter(f => f.endsWith('.html') || f.endsWith('.htm'));
35
+ if (htmlFiles.length === 0) {
36
+ return `🍞 CodeBakers: No mockups to fix
37
+
38
+ Add HTML mockups to ${mockupFolder} first.`;
39
+ }
40
+ // Fix overlapping content
41
+ await fixOverlappingContent(mockupPath, htmlFiles, result);
42
+ // Fix out of viewport elements
43
+ await fixViewportIssues(mockupPath, htmlFiles, result);
44
+ // Generate missing mobile mockups
45
+ await generateMobileMockups(mockupPath, htmlFiles, result);
46
+ // Generate missing states
47
+ await generateMissingStates(mockupPath, htmlFiles, result);
48
+ // Standardize colors
49
+ await standardizeColors(mockupPath, htmlFiles, result);
50
+ // Fix spacing
51
+ await fixSpacing(mockupPath, htmlFiles, result);
52
+ // Generate design tokens file
53
+ await generateDesignTokens(mockupPath, htmlFiles, result);
54
+ // Generate report
55
+ const report = generateFixReport(result);
56
+ return report;
57
+ }
58
+ catch (error) {
59
+ console.error('Error during mockup fix:', error);
60
+ return `🍞 CodeBakers: Mockup Fix Failed
61
+
62
+ Error: ${error instanceof Error ? error.message : String(error)}`;
63
+ }
64
+ }
65
+ /**
66
+ * Fix overlapping content by adjusting positioning
67
+ */
68
+ async function fixOverlappingContent(mockupPath, files, result) {
69
+ for (const file of files) {
70
+ const filePath = path.join(mockupPath, file);
71
+ let content = await fs.readFile(filePath, 'utf-8');
72
+ let modified = false;
73
+ // Extract positioned elements
74
+ const elements = [];
75
+ const styleMatches = Array.from(content.matchAll(/style=["']([^"']+)["']/g));
76
+ for (let i = 0; i < styleMatches.length; i++) {
77
+ const style = styleMatches[i][1];
78
+ if (style.includes('position:') && style.includes('absolute')) {
79
+ const left = parseFloat(style.match(/left:\s*(\d+)/)?.[1] || '0');
80
+ const top = parseFloat(style.match(/top:\s*(\d+)/)?.[1] || '0');
81
+ const width = parseFloat(style.match(/width:\s*(\d+)/)?.[1] || '100');
82
+ elements.push({ id: `element-${i}`, left, top, width, index: i });
83
+ }
84
+ }
85
+ // Check for overlaps and fix
86
+ for (let i = 0; i < elements.length; i++) {
87
+ for (let j = i + 1; j < elements.length; j++) {
88
+ const a = elements[i];
89
+ const b = elements[j];
90
+ // If overlapping horizontally, adjust left position
91
+ if (Math.abs(a.left - b.left) < 20 && Math.abs(a.top - b.top) < 20) {
92
+ // Move second element to the right of first
93
+ const newLeft = a.left + a.width + 20;
94
+ content = content.replace(styleMatches[b.index][0], styleMatches[b.index][0].replace(/left:\s*\d+/, `left: ${newLeft}`));
95
+ modified = true;
96
+ result.auto_fixed.push({
97
+ type: 'overlapping_content',
98
+ description: 'Overlapping elements detected',
99
+ file,
100
+ action_taken: `Adjusted element ${b.id} left position to ${newLeft}px`,
101
+ });
102
+ }
103
+ }
104
+ }
105
+ if (modified) {
106
+ await fs.writeFile(filePath, content, 'utf-8');
107
+ if (!result.files_modified.includes(file)) {
108
+ result.files_modified.push(file);
109
+ }
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * Fix out of viewport elements
115
+ */
116
+ async function fixViewportIssues(mockupPath, files, result) {
117
+ for (const file of files) {
118
+ const filePath = path.join(mockupPath, file);
119
+ let content = await fs.readFile(filePath, 'utf-8');
120
+ let modified = false;
121
+ // Detect viewport width
122
+ const viewportMatch = content.match(/viewport.*width=(\d+)/);
123
+ const viewportWidth = viewportMatch ? parseInt(viewportMatch[1]) : 1440;
124
+ // Fix elements positioned outside viewport
125
+ const styleMatches = content.matchAll(/style=["']([^"']+)["']/g);
126
+ for (const match of styleMatches) {
127
+ const style = match[0];
128
+ const left = parseFloat(style.match(/left:\s*(\d+)/)?.[1] || '0');
129
+ const width = parseFloat(style.match(/width:\s*(\d+)/)?.[1] || '0');
130
+ if (left + width > viewportWidth) {
131
+ // Reposition to be inside viewport with 20px margin
132
+ const newLeft = viewportWidth - width - 20;
133
+ const newStyle = style.replace(/left:\s*\d+/, `left: ${newLeft}`);
134
+ content = content.replace(style, newStyle);
135
+ modified = true;
136
+ result.auto_fixed.push({
137
+ type: 'out_of_viewport',
138
+ description: 'Element positioned outside viewport',
139
+ file,
140
+ action_taken: `Repositioned element to left: ${newLeft}px`,
141
+ });
142
+ }
143
+ }
144
+ if (modified) {
145
+ await fs.writeFile(filePath, content, 'utf-8');
146
+ if (!result.files_modified.includes(file)) {
147
+ result.files_modified.push(file);
148
+ }
149
+ }
150
+ }
151
+ }
152
+ /**
153
+ * Generate mobile mockups from desktop versions
154
+ */
155
+ async function generateMobileMockups(mockupPath, files, result) {
156
+ const hasMobile = files.some(f => f.includes('mobile') || f.includes('375'));
157
+ if (!hasMobile) {
158
+ // Generate mobile version for each desktop mockup
159
+ for (const file of files) {
160
+ if (file.includes('mobile') || file.includes('375'))
161
+ continue;
162
+ const filePath = path.join(mockupPath, file);
163
+ const content = await fs.readFile(filePath, 'utf-8');
164
+ // Transform to mobile layout
165
+ let mobileContent = content;
166
+ // Change viewport
167
+ mobileContent = mobileContent.replace(/viewport.*width=\d+/, 'viewport" content="width=375');
168
+ // Stack elements vertically (simple heuristic)
169
+ mobileContent = mobileContent.replace(/display:\s*flex;?\s*flex-direction:\s*row/g, 'display: flex; flex-direction: column');
170
+ // Reduce font sizes (scale down 20%)
171
+ const fontMatches = mobileContent.matchAll(/font-size:\s*(\d+)px/g);
172
+ for (const match of fontMatches) {
173
+ const size = parseInt(match[1]);
174
+ const newSize = Math.round(size * 0.8);
175
+ mobileContent = mobileContent.replace(match[0], `font-size: ${newSize}px`);
176
+ }
177
+ // Single column layout
178
+ mobileContent = mobileContent.replace(/width:\s*50%/g, 'width: 100%');
179
+ mobileContent = mobileContent.replace(/width:\s*33%/g, 'width: 100%');
180
+ // Increase touch targets to minimum 44px
181
+ const buttonMatches = mobileContent.matchAll(/<button[^>]*style=["']([^"']+)["']/g);
182
+ for (const match of buttonMatches) {
183
+ const style = match[1];
184
+ const height = parseInt(style.match(/height:\s*(\d+)/)?.[1] || '40');
185
+ if (height < 44) {
186
+ const newStyle = style.replace(/height:\s*\d+/, 'height: 44');
187
+ mobileContent = mobileContent.replace(match[0], match[0].replace(style, newStyle));
188
+ }
189
+ }
190
+ // Save mobile version
191
+ const mobileName = file.replace('.html', '-mobile.html');
192
+ const mobilePath = path.join(mockupPath, mobileName);
193
+ await fs.writeFile(mobilePath, mobileContent, 'utf-8');
194
+ result.files_created.push(mobileName);
195
+ result.auto_fixed.push({
196
+ type: 'missing_mobile',
197
+ description: 'No mobile mockup found',
198
+ file,
199
+ action_taken: `Generated mobile version: ${mobileName}`,
200
+ });
201
+ }
202
+ }
203
+ }
204
+ /**
205
+ * Generate missing states (loading, error, empty)
206
+ */
207
+ async function generateMissingStates(mockupPath, files, result) {
208
+ const requiredStates = ['loading', 'error', 'empty'];
209
+ // Group files by component
210
+ const components = new Map();
211
+ for (const file of files) {
212
+ const baseName = file
213
+ .replace(/-loading\.html?$/i, '')
214
+ .replace(/-error\.html?$/i, '')
215
+ .replace(/-empty\.html?$/i, '')
216
+ .replace(/-mobile\.html?$/i, '')
217
+ .replace(/\.html?$/i, '');
218
+ if (!components.has(baseName)) {
219
+ components.set(baseName, new Set());
220
+ }
221
+ if (file.includes('loading'))
222
+ components.get(baseName).add('loading');
223
+ if (file.includes('error'))
224
+ components.get(baseName).add('error');
225
+ if (file.includes('empty'))
226
+ components.get(baseName).add('empty');
227
+ }
228
+ // Generate missing states
229
+ for (const [component, existingStates] of components.entries()) {
230
+ const missingStates = requiredStates.filter(s => !existingStates.has(s));
231
+ for (const state of missingStates) {
232
+ const fileName = `${component}-${state}.html`;
233
+ const filePath = path.join(mockupPath, fileName);
234
+ let stateContent = '';
235
+ if (state === 'loading') {
236
+ stateContent = generateLoadingState(component);
237
+ }
238
+ else if (state === 'error') {
239
+ stateContent = generateErrorState(component);
240
+ }
241
+ else if (state === 'empty') {
242
+ stateContent = generateEmptyState(component);
243
+ }
244
+ await fs.writeFile(filePath, stateContent, 'utf-8');
245
+ result.files_created.push(fileName);
246
+ result.auto_fixed.push({
247
+ type: 'missing_state',
248
+ description: `Component ${component} missing ${state} state`,
249
+ file: component,
250
+ action_taken: `Generated ${fileName}`,
251
+ });
252
+ }
253
+ }
254
+ }
255
+ function generateLoadingState(component) {
256
+ return `<!DOCTYPE html>
257
+ <html>
258
+ <head>
259
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
260
+ <title>${component} - Loading</title>
261
+ <style>
262
+ .skeleton-container {
263
+ padding: 20px;
264
+ }
265
+ .skeleton-item {
266
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
267
+ background-size: 200% 100%;
268
+ animation: loading 1.5s ease-in-out infinite;
269
+ border-radius: 4px;
270
+ margin-bottom: 16px;
271
+ }
272
+ .skeleton-title {
273
+ height: 24px;
274
+ width: 60%;
275
+ margin-bottom: 16px;
276
+ }
277
+ .skeleton-line {
278
+ height: 16px;
279
+ width: 100%;
280
+ }
281
+ .skeleton-line:last-child {
282
+ width: 80%;
283
+ }
284
+ @keyframes loading {
285
+ 0% { background-position: 200% 0; }
286
+ 100% { background-position: -200% 0; }
287
+ }
288
+ </style>
289
+ </head>
290
+ <body>
291
+ <div class="skeleton-container">
292
+ <div class="skeleton-item skeleton-title"></div>
293
+ <div class="skeleton-item skeleton-line"></div>
294
+ <div class="skeleton-item skeleton-line"></div>
295
+ <div class="skeleton-item skeleton-line"></div>
296
+ </div>
297
+ </body>
298
+ </html>`;
299
+ }
300
+ function generateErrorState(component) {
301
+ return `<!DOCTYPE html>
302
+ <html>
303
+ <head>
304
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
305
+ <title>${component} - Error</title>
306
+ <style>
307
+ .error-container {
308
+ display: flex;
309
+ flex-direction: column;
310
+ align-items: center;
311
+ justify-content: center;
312
+ padding: 40px 20px;
313
+ text-align: center;
314
+ }
315
+ .error-icon {
316
+ font-size: 48px;
317
+ color: #ef4444;
318
+ margin-bottom: 16px;
319
+ }
320
+ .error-title {
321
+ font-size: 20px;
322
+ font-weight: 600;
323
+ color: #1f2937;
324
+ margin-bottom: 8px;
325
+ }
326
+ .error-message {
327
+ font-size: 14px;
328
+ color: #6b7280;
329
+ margin-bottom: 24px;
330
+ }
331
+ .retry-button {
332
+ background: #3b82f6;
333
+ color: white;
334
+ border: none;
335
+ padding: 12px 24px;
336
+ border-radius: 6px;
337
+ font-size: 14px;
338
+ cursor: pointer;
339
+ min-height: 44px;
340
+ }
341
+ .retry-button:hover {
342
+ background: #2563eb;
343
+ }
344
+ </style>
345
+ </head>
346
+ <body>
347
+ <div class="error-container">
348
+ <div class="error-icon">⚠️</div>
349
+ <h3 class="error-title">Failed to load ${component}</h3>
350
+ <p class="error-message">Please check your connection and try again.</p>
351
+ <button class="retry-button">Retry</button>
352
+ </div>
353
+ </body>
354
+ </html>`;
355
+ }
356
+ function generateEmptyState(component) {
357
+ return `<!DOCTYPE html>
358
+ <html>
359
+ <head>
360
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
361
+ <title>${component} - Empty</title>
362
+ <style>
363
+ .empty-container {
364
+ display: flex;
365
+ flex-direction: column;
366
+ align-items: center;
367
+ justify-content: center;
368
+ padding: 40px 20px;
369
+ text-align: center;
370
+ }
371
+ .empty-icon {
372
+ font-size: 48px;
373
+ color: #9ca3af;
374
+ margin-bottom: 16px;
375
+ }
376
+ .empty-title {
377
+ font-size: 20px;
378
+ font-weight: 600;
379
+ color: #1f2937;
380
+ margin-bottom: 8px;
381
+ }
382
+ .empty-message {
383
+ font-size: 14px;
384
+ color: #6b7280;
385
+ margin-bottom: 24px;
386
+ }
387
+ .action-button {
388
+ background: #3b82f6;
389
+ color: white;
390
+ border: none;
391
+ padding: 12px 24px;
392
+ border-radius: 6px;
393
+ font-size: 14px;
394
+ cursor: pointer;
395
+ min-height: 44px;
396
+ }
397
+ .action-button:hover {
398
+ background: #2563eb;
399
+ }
400
+ </style>
401
+ </head>
402
+ <body>
403
+ <div class="empty-container">
404
+ <div class="empty-icon">📭</div>
405
+ <h3 class="empty-title">No ${component} yet</h3>
406
+ <p class="empty-message">Get started by creating your first item</p>
407
+ <button class="action-button">Create</button>
408
+ </div>
409
+ </body>
410
+ </html>`;
411
+ }
412
+ /**
413
+ * Standardize colors with CSS variables
414
+ */
415
+ async function standardizeColors(mockupPath, files, result) {
416
+ // Extract all colors
417
+ const colorCounts = new Map();
418
+ for (const file of files) {
419
+ const filePath = path.join(mockupPath, file);
420
+ const content = await fs.readFile(filePath, 'utf-8');
421
+ const colorMatches = content.matchAll(/#[0-9a-fA-F]{3,6}/g);
422
+ for (const match of colorMatches) {
423
+ const color = match[0].toLowerCase();
424
+ colorCounts.set(color, (colorCounts.get(color) || 0) + 1);
425
+ }
426
+ }
427
+ if (colorCounts.size > 15) {
428
+ // Too many colors - standardize
429
+ result.auto_fixed.push({
430
+ type: 'color_standardization',
431
+ description: `Found ${colorCounts.size} unique colors`,
432
+ file: 'all mockups',
433
+ action_taken: 'Generated design-tokens.css with standardized colors',
434
+ });
435
+ }
436
+ }
437
+ /**
438
+ * Fix spacing to 8px grid
439
+ */
440
+ async function fixSpacing(mockupPath, files, result) {
441
+ for (const file of files) {
442
+ const filePath = path.join(mockupPath, file);
443
+ let content = await fs.readFile(filePath, 'utf-8');
444
+ let modified = false;
445
+ // Round margins/padding to nearest 8px
446
+ const spacingMatches = content.matchAll(/(margin|padding):\s*(\d+)px/g);
447
+ for (const match of spacingMatches) {
448
+ const value = parseInt(match[2]);
449
+ const rounded = Math.round(value / 8) * 8;
450
+ if (value !== rounded) {
451
+ content = content.replace(match[0], `${match[1]}: ${rounded}px`);
452
+ modified = true;
453
+ }
454
+ }
455
+ if (modified) {
456
+ await fs.writeFile(filePath, content, 'utf-8');
457
+ if (!result.files_modified.includes(file)) {
458
+ result.files_modified.push(file);
459
+ }
460
+ result.auto_fixed.push({
461
+ type: 'spacing_standardization',
462
+ description: 'Non-standard spacing values detected',
463
+ file,
464
+ action_taken: 'Rounded spacing to 8px grid',
465
+ });
466
+ }
467
+ }
468
+ }
469
+ /**
470
+ * Generate design tokens file
471
+ */
472
+ async function generateDesignTokens(mockupPath, files, result) {
473
+ const tokenPath = path.join(mockupPath, 'design-tokens.css');
474
+ const tokensExist = await fs.access(tokenPath).then(() => true).catch(() => false);
475
+ if (!tokensExist) {
476
+ const tokens = `:root {
477
+ /* Colors */
478
+ --color-primary: #3b82f6;
479
+ --color-primary-hover: #2563eb;
480
+ --color-secondary: #6b7280;
481
+ --color-text-primary: #1f2937;
482
+ --color-text-secondary: #6b7280;
483
+ --color-bg-primary: #ffffff;
484
+ --color-bg-secondary: #f9fafb;
485
+ --color-border: #e5e7eb;
486
+ --color-error: #ef4444;
487
+ --color-success: #10b981;
488
+ --color-warning: #f59e0b;
489
+
490
+ /* Spacing (8px grid) */
491
+ --spacing-1: 8px;
492
+ --spacing-2: 16px;
493
+ --spacing-3: 24px;
494
+ --spacing-4: 32px;
495
+ --spacing-5: 40px;
496
+ --spacing-6: 48px;
497
+
498
+ /* Typography */
499
+ --font-size-xs: 12px;
500
+ --font-size-sm: 14px;
501
+ --font-size-base: 16px;
502
+ --font-size-lg: 18px;
503
+ --font-size-xl: 20px;
504
+ --font-size-2xl: 24px;
505
+
506
+ /* Border Radius */
507
+ --radius-sm: 4px;
508
+ --radius-md: 6px;
509
+ --radius-lg: 8px;
510
+
511
+ /* Shadows */
512
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
513
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
514
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
515
+ }`;
516
+ await fs.writeFile(tokenPath, tokens, 'utf-8');
517
+ result.files_created.push('design-tokens.css');
518
+ result.auto_fixed.push({
519
+ type: 'design_tokens',
520
+ description: 'No design system defined',
521
+ file: 'N/A',
522
+ action_taken: 'Created design-tokens.css with standard design system',
523
+ });
524
+ }
525
+ }
526
+ /**
527
+ * Generate fix report
528
+ */
529
+ function generateFixReport(result) {
530
+ let report = `🍞 CodeBakers: Mockup Auto-Fix Report\n\n`;
531
+ // Auto-fixed issues
532
+ if (result.auto_fixed.length > 0) {
533
+ report += `## ✅ AUTO-FIXED (${result.auto_fixed.length} issues)\n\n`;
534
+ const byType = new Map();
535
+ for (const fix of result.auto_fixed) {
536
+ if (!byType.has(fix.type))
537
+ byType.set(fix.type, []);
538
+ byType.get(fix.type).push(fix);
539
+ }
540
+ let count = 1;
541
+ for (const [type, fixes] of byType) {
542
+ report += `### ${count}. ${type.replace(/_/g, ' ').toUpperCase()}\n`;
543
+ if (fixes.length === 1) {
544
+ report += `**File:** ${fixes[0].file}\n`;
545
+ report += `**Fix applied:** ${fixes[0].action_taken}\n\n`;
546
+ }
547
+ else {
548
+ report += `**Files affected:** ${fixes.length}\n`;
549
+ report += `**Fix applied:** ${fixes[0].action_taken}\n\n`;
550
+ }
551
+ count++;
552
+ }
553
+ report += `---\n\n`;
554
+ }
555
+ // Manual review
556
+ if (result.manual_review.length > 0) {
557
+ report += `## ⚠️ MANUAL REVIEW REQUIRED (${result.manual_review.length} issues)\n\n`;
558
+ for (const issue of result.manual_review) {
559
+ report += `### ${issue.type.replace(/_/g, ' ').toUpperCase()}\n`;
560
+ report += `**File:** ${issue.file}\n`;
561
+ report += `**Issue:** ${issue.description}\n`;
562
+ report += `**Suggestions:**\n`;
563
+ for (const suggestion of issue.suggestions) {
564
+ report += `- ${suggestion}\n`;
565
+ }
566
+ report += `\n`;
567
+ }
568
+ report += `---\n\n`;
569
+ }
570
+ // Files summary
571
+ report += `## 📊 Summary\n\n`;
572
+ report += `**Issues auto-fixed:** ${result.auto_fixed.length}\n`;
573
+ report += `**Issues requiring manual review:** ${result.manual_review.length}\n`;
574
+ report += `**Files created:** ${result.files_created.length}\n`;
575
+ if (result.files_created.length > 0) {
576
+ for (const file of result.files_created) {
577
+ report += ` - ${file}\n`;
578
+ }
579
+ }
580
+ report += `**Files modified:** ${result.files_modified.length}\n\n`;
581
+ // Next steps
582
+ report += `## Next Steps\n\n`;
583
+ if (result.manual_review.length > 0) {
584
+ report += `1. Review ${result.manual_review.length} manual issues (2-3 min)\n`;
585
+ report += `2. Run codebakers_validate_mockups again (verify all fixed)\n`;
586
+ report += `3. Then: codebakers_verify_mockups (100% quality check)\n\n`;
587
+ }
588
+ else {
589
+ report += `1. Run codebakers_validate_mockups (verify all issues fixed)\n`;
590
+ report += `2. Then: codebakers_verify_mockups (100% quality check)\n`;
591
+ report += `3. Then: codebakers_analyze_mockups (extract data)\n\n`;
592
+ }
593
+ return report;
594
+ }
595
+ //# sourceMappingURL=fix-mockups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-mockups.js","sourceRoot":"","sources":["../../src/tools/fix-mockups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAuB7B,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAgC;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,IAAI,cAAc,CAAC;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEhD,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAEhD,IAAI,CAAC;QACH,MAAM,MAAM,GAAc;YACxB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;YACjB,aAAa,EAAE,EAAE;YACj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AAI,CAAC;QACjB,CAAC;QAED,MAAM,IAAI,SAAS,CAAC;IACtB,CAAC;IAED,gBAAgB;IAChB,MAAM,IAAI,mBAAmB,CAAC;IAC9B,MAAM,IAAI,0BAA0B,MAAM,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC;IACjE,MAAM,IAAI,uCAAuC,MAAM,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC;IACjF,MAAM,IAAI,sBAAsB,MAAM,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC;IAChE,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACxC,MAAM,IAAI,OAAO,IAAI,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,MAAM,IAAI,uBAAuB,MAAM,CAAC,cAAc,CAAC,MAAM,MAAM,CAAC;IAEpE,aAAa;IACb,MAAM,IAAI,mBAAmB,CAAC;IAC9B,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,aAAa,MAAM,CAAC,aAAa,CAAC,MAAM,4BAA4B,CAAC;QAC/E,MAAM,IAAI,+DAA+D,CAAC;QAC1E,MAAM,IAAI,6DAA6D,CAAC;IAC1E,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,gEAAgE,CAAC;QAC3E,MAAM,IAAI,2DAA2D,CAAC;QACtE,MAAM,IAAI,wDAAwD,CAAC;IACrE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * codebakers_generate_api_route
3
+ *
4
+ * API Route Generator
5
+ *
6
+ * Generates Next.js API routes with:
7
+ * - Supabase integration
8
+ * - Security filters (user_id)
9
+ * - Error handling
10
+ * - TypeScript types
11
+ */
12
+ interface RouteArgs {
13
+ entity: string;
14
+ operation: 'list' | 'get' | 'create' | 'update' | 'delete';
15
+ }
16
+ export declare function generateApiRoute(args: RouteArgs): Promise<string>;
17
+ export {};
18
+ //# sourceMappingURL=generate-api-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-api-route.d.ts","sourceRoot":"","sources":["../../src/tools/generate-api-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC5D;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAwCvE"}