real-prototypes-skill 0.1.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 (60) hide show
  1. package/.claude/skills/agent-browser-skill/SKILL.md +252 -0
  2. package/.claude/skills/real-prototypes-skill/.gitignore +188 -0
  3. package/.claude/skills/real-prototypes-skill/ACCESSIBILITY.md +668 -0
  4. package/.claude/skills/real-prototypes-skill/INSTALL.md +259 -0
  5. package/.claude/skills/real-prototypes-skill/LICENSE +21 -0
  6. package/.claude/skills/real-prototypes-skill/PUBLISH.md +310 -0
  7. package/.claude/skills/real-prototypes-skill/QUICKSTART.md +240 -0
  8. package/.claude/skills/real-prototypes-skill/README.md +442 -0
  9. package/.claude/skills/real-prototypes-skill/SKILL.md +375 -0
  10. package/.claude/skills/real-prototypes-skill/capture/capture-engine.js +1153 -0
  11. package/.claude/skills/real-prototypes-skill/capture/config.schema.json +170 -0
  12. package/.claude/skills/real-prototypes-skill/cli.js +596 -0
  13. package/.claude/skills/real-prototypes-skill/docs/TROUBLESHOOTING.md +278 -0
  14. package/.claude/skills/real-prototypes-skill/docs/schemas/capture-config.md +167 -0
  15. package/.claude/skills/real-prototypes-skill/docs/schemas/design-tokens.md +183 -0
  16. package/.claude/skills/real-prototypes-skill/docs/schemas/manifest.md +169 -0
  17. package/.claude/skills/real-prototypes-skill/examples/CLAUDE.md.example +73 -0
  18. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/CLAUDE.md +136 -0
  19. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/FEATURES.md +222 -0
  20. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/README.md +82 -0
  21. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/design-tokens.json +87 -0
  22. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/screenshots/homepage-viewport.png +0 -0
  23. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/screenshots/prototype-chatbot-final.png +0 -0
  24. package/.claude/skills/real-prototypes-skill/examples/amazon-chatbot/references/screenshots/prototype-fullpage-v2.png +0 -0
  25. package/.claude/skills/real-prototypes-skill/references/accessibility-fixes.md +298 -0
  26. package/.claude/skills/real-prototypes-skill/references/accessibility-report.json +253 -0
  27. package/.claude/skills/real-prototypes-skill/scripts/CAPTURE-ENHANCEMENTS.md +344 -0
  28. package/.claude/skills/real-prototypes-skill/scripts/IMPLEMENTATION-SUMMARY.md +517 -0
  29. package/.claude/skills/real-prototypes-skill/scripts/QUICK-START.md +229 -0
  30. package/.claude/skills/real-prototypes-skill/scripts/QUICKSTART-layout-analysis.md +148 -0
  31. package/.claude/skills/real-prototypes-skill/scripts/README-analyze-layout.md +407 -0
  32. package/.claude/skills/real-prototypes-skill/scripts/analyze-layout.js +880 -0
  33. package/.claude/skills/real-prototypes-skill/scripts/capture-platform.js +203 -0
  34. package/.claude/skills/real-prototypes-skill/scripts/comprehensive-capture.js +597 -0
  35. package/.claude/skills/real-prototypes-skill/scripts/create-manifest.js +338 -0
  36. package/.claude/skills/real-prototypes-skill/scripts/enterprise-pipeline.js +428 -0
  37. package/.claude/skills/real-prototypes-skill/scripts/extract-tokens.js +468 -0
  38. package/.claude/skills/real-prototypes-skill/scripts/full-site-capture.js +738 -0
  39. package/.claude/skills/real-prototypes-skill/scripts/generate-tailwind-config.js +296 -0
  40. package/.claude/skills/real-prototypes-skill/scripts/integrate-accessibility.sh +161 -0
  41. package/.claude/skills/real-prototypes-skill/scripts/manifest-schema.json +302 -0
  42. package/.claude/skills/real-prototypes-skill/scripts/setup-prototype.sh +167 -0
  43. package/.claude/skills/real-prototypes-skill/scripts/test-analyze-layout.js +338 -0
  44. package/.claude/skills/real-prototypes-skill/scripts/test-validation.js +307 -0
  45. package/.claude/skills/real-prototypes-skill/scripts/validate-accessibility.js +598 -0
  46. package/.claude/skills/real-prototypes-skill/scripts/validate-manifest.js +499 -0
  47. package/.claude/skills/real-prototypes-skill/scripts/validate-output.js +361 -0
  48. package/.claude/skills/real-prototypes-skill/scripts/validate-prerequisites.js +319 -0
  49. package/.claude/skills/real-prototypes-skill/scripts/verify-layout-analysis.sh +77 -0
  50. package/.claude/skills/real-prototypes-skill/templates/dashboard-widget.tsx.template +91 -0
  51. package/.claude/skills/real-prototypes-skill/templates/data-table.tsx.template +193 -0
  52. package/.claude/skills/real-prototypes-skill/templates/form-section.tsx.template +250 -0
  53. package/.claude/skills/real-prototypes-skill/templates/modal-dialog.tsx.template +239 -0
  54. package/.claude/skills/real-prototypes-skill/templates/nav-item.tsx.template +265 -0
  55. package/.claude/skills/real-prototypes-skill/validation/validation-engine.js +559 -0
  56. package/.env.example +74 -0
  57. package/LICENSE +21 -0
  58. package/README.md +444 -0
  59. package/bin/cli.js +319 -0
  60. package/package.json +59 -0
@@ -0,0 +1,428 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ENTERPRISE PLATFORM PROTOTYPING PIPELINE
4
+ *
5
+ * This is the ONLY entry point for generating prototypes.
6
+ * It enforces all validation gates and prevents bad outputs.
7
+ *
8
+ * Pipeline:
9
+ * ┌─────────┐ ┌──────────────┐ ┌──────────┐ ┌──────────────┐ ┌────────┐
10
+ * │ Capture │ ──▶ │ Validate Pre │ ──▶ │ Generate │ ──▶ │ Validate Out │ ──▶ │ Output │
11
+ * └─────────┘ └──────────────┘ └──────────┘ └──────────────┘ └────────┘
12
+ * │ │ │
13
+ * │ └── BLOCKS if tokens missing └── BLOCKS if colors wrong
14
+ * └── Extracts ALL colors, clicks ALL buttons
15
+ *
16
+ * Usage:
17
+ * node enterprise-pipeline.js capture --url https://app.example.com --pages /dashboard,/settings
18
+ * node enterprise-pipeline.js validate-pre
19
+ * node enterprise-pipeline.js validate-post
20
+ * node enterprise-pipeline.js full --url https://app.example.com
21
+ */
22
+
23
+ const { execSync } = require('child_process');
24
+ const fs = require('fs');
25
+ const path = require('path');
26
+
27
+ const SCRIPTS_DIR = __dirname;
28
+ const ROOT_DIR = process.cwd();
29
+
30
+ // ANSI colors for terminal output
31
+ const colors = {
32
+ reset: '\x1b[0m',
33
+ bright: '\x1b[1m',
34
+ red: '\x1b[31m',
35
+ green: '\x1b[32m',
36
+ yellow: '\x1b[33m',
37
+ blue: '\x1b[34m',
38
+ cyan: '\x1b[36m'
39
+ };
40
+
41
+ function log(level, message) {
42
+ const prefixes = {
43
+ info: `${colors.blue}ℹ${colors.reset}`,
44
+ success: `${colors.green}✓${colors.reset}`,
45
+ error: `${colors.red}✗${colors.reset}`,
46
+ warning: `${colors.yellow}⚠${colors.reset}`,
47
+ step: `${colors.cyan}→${colors.reset}`
48
+ };
49
+ console.log(`${prefixes[level] || '•'} ${message}`);
50
+ }
51
+
52
+ function header(text) {
53
+ const line = '═'.repeat(60);
54
+ console.log(`\n${colors.bright}${line}${colors.reset}`);
55
+ console.log(`${colors.bright} ${text}${colors.reset}`);
56
+ console.log(`${colors.bright}${line}${colors.reset}\n`);
57
+ }
58
+
59
+ function runScript(scriptName, args = []) {
60
+ const scriptPath = path.join(SCRIPTS_DIR, scriptName);
61
+ const cmd = `node "${scriptPath}" ${args.join(' ')}`;
62
+
63
+ try {
64
+ execSync(cmd, { stdio: 'inherit' });
65
+ return true;
66
+ } catch (error) {
67
+ return false;
68
+ }
69
+ }
70
+
71
+ // ============================================================
72
+ // CAPTURE PHASE
73
+ // ============================================================
74
+ async function runCapture(options) {
75
+ header('PHASE 1: COMPREHENSIVE CAPTURE');
76
+
77
+ if (!options.url) {
78
+ log('error', 'URL is required. Use --url https://your-platform.com');
79
+ return false;
80
+ }
81
+
82
+ const args = [options.url];
83
+ if (options.pages) {
84
+ args.push(...options.pages.split(','));
85
+ }
86
+
87
+ log('step', `Capturing platform: ${options.url}`);
88
+ log('info', 'This will click all interactive elements to capture all states');
89
+
90
+ const success = runScript('comprehensive-capture.js', args);
91
+
92
+ if (success) {
93
+ log('success', 'Capture completed successfully');
94
+ return true;
95
+ } else {
96
+ log('error', 'Capture failed');
97
+ return false;
98
+ }
99
+ }
100
+
101
+ // ============================================================
102
+ // PRE-GENERATION VALIDATION
103
+ // ============================================================
104
+ async function runPreValidation(options = {}) {
105
+ header('PHASE 2: PRE-GENERATION VALIDATION');
106
+
107
+ log('step', 'Validating captured references...');
108
+
109
+ const args = [];
110
+ if (options.page) {
111
+ args.push('--page', options.page);
112
+ }
113
+
114
+ const success = runScript('validate-prerequisites.js', args);
115
+
116
+ if (success) {
117
+ log('success', 'Pre-generation validation passed');
118
+ return true;
119
+ } else {
120
+ log('error', 'Pre-generation validation FAILED');
121
+ log('error', '>>> GENERATION BLOCKED <<<');
122
+ log('info', 'Fix the issues above before proceeding');
123
+ return false;
124
+ }
125
+ }
126
+
127
+ // ============================================================
128
+ // POST-GENERATION VALIDATION
129
+ // ============================================================
130
+ async function runPostValidation(options = {}) {
131
+ header('PHASE 4: POST-GENERATION VALIDATION');
132
+
133
+ log('step', 'Validating generated prototype...');
134
+
135
+ const args = [];
136
+ if (options.prototypeDir) {
137
+ args.push('--dir', options.prototypeDir);
138
+ }
139
+
140
+ const success = runScript('validate-output.js', args);
141
+
142
+ if (success) {
143
+ log('success', 'Post-generation validation passed');
144
+ log('success', 'All colors match the captured design tokens');
145
+ return true;
146
+ } else {
147
+ log('error', 'Post-generation validation FAILED');
148
+ log('error', 'Generated code contains invalid colors');
149
+ log('info', 'Fix the issues above - do NOT deliver this prototype');
150
+ return false;
151
+ }
152
+ }
153
+
154
+ // ============================================================
155
+ // STATUS CHECK
156
+ // ============================================================
157
+ async function runStatus() {
158
+ header('PIPELINE STATUS CHECK');
159
+
160
+ const checks = [
161
+ {
162
+ name: 'References directory',
163
+ check: () => fs.existsSync('references'),
164
+ fix: 'Run: node enterprise-pipeline.js capture --url <your-url>'
165
+ },
166
+ {
167
+ name: 'Design tokens',
168
+ check: () => fs.existsSync('references/design-tokens.json'),
169
+ fix: 'Run capture phase first'
170
+ },
171
+ {
172
+ name: 'Screenshots',
173
+ check: () => {
174
+ const dir = 'references/screenshots';
175
+ return fs.existsSync(dir) && fs.readdirSync(dir).filter(f => f.endsWith('.png')).length > 0;
176
+ },
177
+ fix: 'Run capture phase first'
178
+ },
179
+ {
180
+ name: 'Manifest',
181
+ check: () => fs.existsSync('references/manifest.json'),
182
+ fix: 'Run capture phase first'
183
+ },
184
+ {
185
+ name: 'Prototype directory',
186
+ check: () => fs.existsSync('prototype'),
187
+ fix: 'Run: npx create-next-app@latest prototype'
188
+ },
189
+ {
190
+ name: 'Prototype source',
191
+ check: () => fs.existsSync('prototype/src'),
192
+ fix: 'Scaffold prototype first'
193
+ }
194
+ ];
195
+
196
+ let allPassed = true;
197
+ checks.forEach(({ name, check, fix }) => {
198
+ const passed = check();
199
+ if (passed) {
200
+ log('success', name);
201
+ } else {
202
+ log('error', `${name} - ${fix}`);
203
+ allPassed = false;
204
+ }
205
+ });
206
+
207
+ // Show design token summary if available
208
+ if (fs.existsSync('references/design-tokens.json')) {
209
+ console.log('\n📊 Design Token Summary:');
210
+ const tokens = JSON.parse(fs.readFileSync('references/design-tokens.json', 'utf8'));
211
+ console.log(` Primary color: ${tokens.colors?.primary || 'NOT FOUND'}`);
212
+ console.log(` Font family: ${tokens.fonts?.primary || 'NOT FOUND'}`);
213
+ console.log(` Total colors: ${tokens.totalColorsFound || 'unknown'}`);
214
+ }
215
+
216
+ return allPassed;
217
+ }
218
+
219
+ // ============================================================
220
+ // GENERATE COLOR CONSTANTS
221
+ // ============================================================
222
+ async function generateColorConstants() {
223
+ header('GENERATE COLOR CONSTANTS');
224
+
225
+ if (!fs.existsSync('references/design-tokens.json')) {
226
+ log('error', 'Design tokens not found. Run capture first.');
227
+ return false;
228
+ }
229
+
230
+ const tokens = JSON.parse(fs.readFileSync('references/design-tokens.json', 'utf8'));
231
+
232
+ // Generate TypeScript constants file
233
+ const tsContent = `/**
234
+ * AUTO-GENERATED DESIGN TOKENS
235
+ * DO NOT EDIT MANUALLY
236
+ *
237
+ * Generated from: references/design-tokens.json
238
+ * Generated at: ${new Date().toISOString()}
239
+ *
240
+ * Use these constants in your components instead of hardcoded colors.
241
+ */
242
+
243
+ export const colors = {
244
+ // Primary/Accent color - use for buttons, links, active states
245
+ primary: '${tokens.colors?.primary || '#1c64f2'}',
246
+
247
+ // Sidebar colors
248
+ sidebar: {
249
+ background: '${tokens.colors?.sidebar?.dark || '#0e2933'}',
250
+ text: '${tokens.colors?.sidebar?.text || '#6e7f85'}',
251
+ },
252
+
253
+ // Text colors
254
+ text: {
255
+ primary: '${tokens.colors?.text?.primary || '#191918'}',
256
+ secondary: '${tokens.colors?.text?.secondary || '#6b7280'}',
257
+ muted: '${tokens.colors?.text?.muted || '#9ca3af'}',
258
+ },
259
+
260
+ // Background colors
261
+ background: {
262
+ white: '${tokens.colors?.background?.white || '#ffffff'}',
263
+ light: '${tokens.colors?.background?.light || '#f6f6f5'}',
264
+ gray: '${tokens.colors?.background?.gray || '#f9fafb'}',
265
+ },
266
+
267
+ // Border colors
268
+ border: {
269
+ default: '${tokens.colors?.border?.default || '#e7e7e6'}',
270
+ light: '${tokens.colors?.border?.light || '#e5e7eb'}',
271
+ },
272
+
273
+ // Status colors
274
+ status: {
275
+ success: '${tokens.colors?.status?.success || '#00913D'}',
276
+ error: '${tokens.colors?.status?.error || '#e02424'}',
277
+ }
278
+ } as const;
279
+
280
+ export const fonts = {
281
+ primary: '${tokens.fonts?.primary || 'Inter, system-ui'}',
282
+ } as const;
283
+
284
+ // Type exports for TypeScript
285
+ export type ColorKey = keyof typeof colors;
286
+ export type FontKey = keyof typeof fonts;
287
+ `;
288
+
289
+ // Ensure prototype src directory exists
290
+ const outputDir = 'prototype/src/styles';
291
+ if (!fs.existsSync(outputDir)) {
292
+ fs.mkdirSync(outputDir, { recursive: true });
293
+ }
294
+
295
+ const outputPath = path.join(outputDir, 'design-tokens.ts');
296
+ fs.writeFileSync(outputPath, tsContent);
297
+
298
+ log('success', `Generated: ${outputPath}`);
299
+ log('info', 'Import this file in your components:');
300
+ console.log(`\n import { colors, fonts } from '@/styles/design-tokens';\n`);
301
+
302
+ return true;
303
+ }
304
+
305
+ // ============================================================
306
+ // MAIN CLI
307
+ // ============================================================
308
+ async function main() {
309
+ const args = process.argv.slice(2);
310
+ const command = args[0];
311
+
312
+ // Parse options
313
+ const options = {};
314
+ for (let i = 1; i < args.length; i++) {
315
+ if (args[i] === '--url' && args[i + 1]) {
316
+ options.url = args[i + 1];
317
+ i++;
318
+ } else if (args[i] === '--pages' && args[i + 1]) {
319
+ options.pages = args[i + 1];
320
+ i++;
321
+ } else if (args[i] === '--page' && args[i + 1]) {
322
+ options.page = args[i + 1];
323
+ i++;
324
+ } else if (args[i] === '--dir' && args[i + 1]) {
325
+ options.prototypeDir = args[i + 1];
326
+ i++;
327
+ }
328
+ }
329
+
330
+ switch (command) {
331
+ case 'capture':
332
+ const captureSuccess = await runCapture(options);
333
+ process.exit(captureSuccess ? 0 : 1);
334
+ break;
335
+
336
+ case 'validate-pre':
337
+ case 'validate:pre':
338
+ const preSuccess = await runPreValidation(options);
339
+ process.exit(preSuccess ? 0 : 1);
340
+ break;
341
+
342
+ case 'validate-post':
343
+ case 'validate:post':
344
+ const postSuccess = await runPostValidation(options);
345
+ process.exit(postSuccess ? 0 : 1);
346
+ break;
347
+
348
+ case 'generate-tokens':
349
+ case 'tokens':
350
+ const tokensSuccess = await generateColorConstants();
351
+ process.exit(tokensSuccess ? 0 : 1);
352
+ break;
353
+
354
+ case 'status':
355
+ const statusOk = await runStatus();
356
+ process.exit(statusOk ? 0 : 1);
357
+ break;
358
+
359
+ case 'full':
360
+ // Full pipeline
361
+ header('ENTERPRISE PROTOTYPING PIPELINE');
362
+ console.log('Running full pipeline with validation gates...\n');
363
+
364
+ // Step 1: Capture
365
+ if (!await runCapture(options)) {
366
+ log('error', 'Pipeline STOPPED at capture phase');
367
+ process.exit(1);
368
+ }
369
+
370
+ // Step 2: Pre-validation (GATE)
371
+ if (!await runPreValidation(options)) {
372
+ log('error', 'Pipeline BLOCKED at pre-validation gate');
373
+ process.exit(1);
374
+ }
375
+
376
+ // Step 3: Generate tokens
377
+ await generateColorConstants();
378
+
379
+ log('success', '\nPipeline ready for prototype generation');
380
+ log('info', 'Generate your prototype, then run:');
381
+ console.log(' node enterprise-pipeline.js validate-post\n');
382
+ break;
383
+
384
+ default:
385
+ console.log(`
386
+ ${colors.bright}Enterprise Platform Prototyping Pipeline${colors.reset}
387
+
388
+ Usage:
389
+ node enterprise-pipeline.js <command> [options]
390
+
391
+ Commands:
392
+ ${colors.cyan}capture${colors.reset} Capture platform (screenshots, HTML, tokens)
393
+ --url <url> Platform URL (required)
394
+ --pages <paths> Comma-separated paths (optional)
395
+
396
+ ${colors.cyan}validate-pre${colors.reset} Validate before generation (GATE)
397
+ --page <name> Specific page to validate
398
+
399
+ ${colors.cyan}validate-post${colors.reset} Validate after generation (GATE)
400
+ --dir <path> Prototype directory (default: prototype)
401
+
402
+ ${colors.cyan}tokens${colors.reset} Generate TypeScript color constants
403
+
404
+ ${colors.cyan}status${colors.reset} Check pipeline status
405
+
406
+ ${colors.cyan}full${colors.reset} Run full capture + validation pipeline
407
+ --url <url> Platform URL (required)
408
+
409
+ Examples:
410
+ # Capture a platform
411
+ node enterprise-pipeline.js capture --url https://app.sprouts.ai --pages /dashboard,/settings
412
+
413
+ # Check if ready for generation
414
+ node enterprise-pipeline.js validate-pre
415
+
416
+ # After generating code, validate output
417
+ node enterprise-pipeline.js validate-post
418
+
419
+ # Full pipeline
420
+ node enterprise-pipeline.js full --url https://app.sprouts.ai
421
+ `);
422
+ }
423
+ }
424
+
425
+ main().catch(error => {
426
+ console.error(error);
427
+ process.exit(1);
428
+ });