@ia-ccun/code-agent-cli 0.0.1

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 (87) hide show
  1. package/README.md +211 -0
  2. package/bin/cli.js +83 -0
  3. package/config/agent/APPEND_SYSTEM.md +48 -0
  4. package/config/agent/SYSTEM.md +33 -0
  5. package/config/agent/bin/fd +0 -0
  6. package/config/agent/extensions/context.ts +578 -0
  7. package/config/agent/extensions/custom-footer.ts +170 -0
  8. package/config/agent/extensions/custom.ts +289 -0
  9. package/config/agent/extensions/review.ts +1281 -0
  10. package/config/agent/extensions/working-msg.ts +96 -0
  11. package/config/agent/help.md +364 -0
  12. package/config/agent/models.json +56 -0
  13. package/config/agent/prompts/feat.md +106 -0
  14. package/config/agent/prompts/git-commit.md +159 -0
  15. package/config/agent/prompts/git-rollback.md +91 -0
  16. package/config/agent/prompts/git-worktree.md +277 -0
  17. package/config/agent/prompts/help.md +10 -0
  18. package/config/agent/prompts/init-project.md +53 -0
  19. package/config/agent/prompts/workflow.md +194 -0
  20. package/config/agent/settings.json +7 -0
  21. package/config/agent/skills/code-review/SKILL.md +50 -0
  22. package/config/agent/skills/commit/SKILL.md +51 -0
  23. package/config/agent/skills/csv-data-summarizer/SKILL.md +149 -0
  24. package/config/agent/skills/csv-data-summarizer/analyze.py +182 -0
  25. package/config/agent/skills/csv-data-summarizer/examples/showcase_financial_pl_data.csv +46 -0
  26. package/config/agent/skills/csv-data-summarizer/requirements.txt +4 -0
  27. package/config/agent/skills/csv-data-summarizer/resources/sample.csv +22 -0
  28. package/config/agent/skills/find-skills/SKILL.md +133 -0
  29. package/config/agent/skills/frontend-design/LICENSE.txt +177 -0
  30. package/config/agent/skills/frontend-design/SKILL.md +42 -0
  31. package/config/agent/skills/github/SKILL.md +47 -0
  32. package/config/agent/skills/hello/SKILL.md +23 -0
  33. package/config/agent/skills/librarian/SKILL.md +195 -0
  34. package/config/agent/skills/markdown-to-html/SKILL.md +62 -0
  35. package/config/agent/skills/pr/SKILL.md +56 -0
  36. package/config/agent/skills/refactor/SKILL.md +37 -0
  37. package/config/agent/skills/skill-creator/LICENSE.txt +202 -0
  38. package/config/agent/skills/skill-creator/SKILL.md +356 -0
  39. package/config/agent/skills/skill-creator/references/output-patterns.md +82 -0
  40. package/config/agent/skills/skill-creator/references/workflows.md +28 -0
  41. package/config/agent/skills/skill-creator/scripts/init_skill.py +303 -0
  42. package/config/agent/skills/skill-creator/scripts/package_skill.py +110 -0
  43. package/config/agent/skills/skill-creator/scripts/quick_validate.py +95 -0
  44. package/config/agent/skills/ui-ux-pro-max/SKILL.md +264 -0
  45. package/config/agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  46. package/config/agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  47. package/config/agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  48. package/config/agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  49. package/config/agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  50. package/config/agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  51. package/config/agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  52. package/config/agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  53. package/config/agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  54. package/config/agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  55. package/config/agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  56. package/config/agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  57. package/config/agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  58. package/config/agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  59. package/config/agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  60. package/config/agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
  61. package/config/agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  62. package/config/agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  63. package/config/agent/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  64. package/config/agent/skills/ui-ux-pro-max/scripts/analyze.py +434 -0
  65. package/config/agent/skills/ui-ux-pro-max/scripts/core.py +238 -0
  66. package/config/agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
  67. package/config/agent/skills/unit-test/SKILL.md +115 -0
  68. package/config/agent/themes/catppuccin-mocha.json +99 -0
  69. package/config.json +6 -0
  70. package/dist/banner.d.ts +10 -0
  71. package/dist/banner.d.ts.map +1 -0
  72. package/dist/banner.js +32 -0
  73. package/dist/banner.js.map +1 -0
  74. package/dist/config-loader.d.ts +17 -0
  75. package/dist/config-loader.d.ts.map +1 -0
  76. package/dist/config-loader.js +60 -0
  77. package/dist/config-loader.js.map +1 -0
  78. package/dist/config.d.ts +23 -0
  79. package/dist/config.d.ts.map +1 -0
  80. package/dist/config.js +12 -0
  81. package/dist/config.js.map +1 -0
  82. package/dist/index.d.ts +11 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +14 -0
  85. package/dist/index.js.map +1 -0
  86. package/package.json +69 -0
  87. package/scripts/postinstall.js +197 -0
@@ -0,0 +1,100 @@
1
+ No,Category,Issue,Platform,Description,Do,Don't,Code Example Good,Code Example Bad,Severity
2
+ 1,Navigation,Smooth Scroll,Web,Anchor links should scroll smoothly to target section,Use scroll-behavior: smooth on html element,Jump directly without transition,html { scroll-behavior: smooth; },<a href='#section'> without CSS,High
3
+ 2,Navigation,Sticky Navigation,Web,Fixed nav should not obscure content,Add padding-top to body equal to nav height,Let nav overlap first section content,pt-20 (if nav is h-20),No padding compensation,Medium
4
+ 3,Navigation,Active State,All,Current page/section should be visually indicated,Highlight active nav item with color/underline,No visual feedback on current location,text-primary border-b-2,All links same style,Medium
5
+ 4,Navigation,Back Button,Mobile,Users expect back to work predictably,Preserve navigation history properly,Break browser/app back button behavior,history.pushState(),location.replace(),High
6
+ 5,Navigation,Deep Linking,All,URLs should reflect current state for sharing,Update URL on state/view changes,Static URLs for dynamic content,Use query params or hash,Single URL for all states,Medium
7
+ 6,Navigation,Breadcrumbs,Web,Show user location in site hierarchy,Use for sites with 3+ levels of depth,Use for flat single-level sites,Home > Category > Product,Only on deep nested pages,Low
8
+ 7,Animation,Excessive Motion,All,Too many animations cause distraction and motion sickness,Animate 1-2 key elements per view maximum,Animate everything that moves,Single hero animation,animate-bounce on 5+ elements,High
9
+ 8,Animation,Duration Timing,All,Animations should feel responsive not sluggish,Use 150-300ms for micro-interactions,Use animations longer than 500ms for UI,transition-all duration-200,duration-1000,Medium
10
+ 9,Animation,Reduced Motion,All,Respect user's motion preferences,Check prefers-reduced-motion media query,Ignore accessibility motion settings,@media (prefers-reduced-motion: reduce),No motion query check,High
11
+ 10,Animation,Loading States,All,Show feedback during async operations,Use skeleton screens or spinners,Leave UI frozen with no feedback,animate-pulse skeleton,Blank screen while loading,High
12
+ 11,Animation,Hover vs Tap,All,Hover effects don't work on touch devices,Use click/tap for primary interactions,Rely only on hover for important actions,onClick handler,onMouseEnter only,High
13
+ 12,Animation,Continuous Animation,All,Infinite animations are distracting,Use for loading indicators only,Use for decorative elements,animate-spin on loader,animate-bounce on icons,Medium
14
+ 13,Animation,Transform Performance,Web,Some CSS properties trigger expensive repaints,Use transform and opacity for animations,Animate width/height/top/left properties,transform: translateY(),top: 10px animation,Medium
15
+ 14,Animation,Easing Functions,All,Linear motion feels robotic,Use ease-out for entering ease-in for exiting,Use linear for UI transitions,ease-out,linear,Low
16
+ 15,Layout,Z-Index Management,Web,Stacking context conflicts cause hidden elements,Define z-index scale system (10 20 30 50),Use arbitrary large z-index values,z-10 z-20 z-50,z-[9999],High
17
+ 16,Layout,Overflow Hidden,Web,Hidden overflow can clip important content,Test all content fits within containers,Blindly apply overflow-hidden,overflow-auto with scroll,overflow-hidden truncating content,Medium
18
+ 17,Layout,Fixed Positioning,Web,Fixed elements can overlap or be inaccessible,Account for safe areas and other fixed elements,Stack multiple fixed elements carelessly,Fixed nav + fixed bottom with gap,Multiple overlapping fixed elements,Medium
19
+ 18,Layout,Stacking Context,Web,New stacking contexts reset z-index,Understand what creates new stacking context,Expect z-index to work across contexts,Parent with z-index isolates children,z-index: 9999 not working,Medium
20
+ 19,Layout,Content Jumping,Web,Layout shift when content loads is jarring,Reserve space for async content,Let images/content push layout around,aspect-ratio or fixed height,No dimensions on images,High
21
+ 20,Layout,Viewport Units,Web,100vh can be problematic on mobile browsers,Use dvh or account for mobile browser chrome,Use 100vh for full-screen mobile layouts,min-h-dvh or min-h-screen,h-screen on mobile,Medium
22
+ 21,Layout,Container Width,Web,Content too wide is hard to read,Limit max-width for text content (65-75ch),Let text span full viewport width,max-w-prose or max-w-3xl,Full width paragraphs,Medium
23
+ 22,Touch,Touch Target Size,Mobile,Small buttons are hard to tap accurately,Minimum 44x44px touch targets,Tiny clickable areas,min-h-[44px] min-w-[44px],w-6 h-6 buttons,High
24
+ 23,Touch,Touch Spacing,Mobile,Adjacent touch targets need adequate spacing,Minimum 8px gap between touch targets,Tightly packed clickable elements,gap-2 between buttons,gap-0 or gap-1,Medium
25
+ 24,Touch,Gesture Conflicts,Mobile,Custom gestures can conflict with system,Avoid horizontal swipe on main content,Override system gestures,Vertical scroll primary,Horizontal swipe carousel only,Medium
26
+ 25,Touch,Tap Delay,Mobile,300ms tap delay feels laggy,Use touch-action CSS or fastclick,Default mobile tap handling,touch-action: manipulation,No touch optimization,Medium
27
+ 26,Touch,Pull to Refresh,Mobile,Accidental refresh is frustrating,Disable where not needed,Enable by default everywhere,overscroll-behavior: contain,Default overscroll,Low
28
+ 27,Touch,Haptic Feedback,Mobile,Tactile feedback improves interaction feel,Use for confirmations and important actions,Overuse vibration feedback,navigator.vibrate(10),Vibrate on every tap,Low
29
+ 28,Interaction,Focus States,All,Keyboard users need visible focus indicators,Use visible focus rings on interactive elements,Remove focus outline without replacement,focus:ring-2 focus:ring-blue-500,outline-none without alternative,High
30
+ 29,Interaction,Hover States,Web,Visual feedback on interactive elements,Change cursor and add subtle visual change,No hover feedback on clickable elements,hover:bg-gray-100 cursor-pointer,No hover style,Medium
31
+ 30,Interaction,Active States,All,Show immediate feedback on press/click,Add pressed/active state visual change,No feedback during interaction,active:scale-95,No active state,Medium
32
+ 31,Interaction,Disabled States,All,Clearly indicate non-interactive elements,Reduce opacity and change cursor,Confuse disabled with normal state,opacity-50 cursor-not-allowed,Same style as enabled,Medium
33
+ 32,Interaction,Loading Buttons,All,Prevent double submission during async actions,Disable button and show loading state,Allow multiple clicks during processing,disabled={loading} spinner,Button clickable while loading,High
34
+ 33,Interaction,Error Feedback,All,Users need to know when something fails,Show clear error messages near problem,Silent failures with no feedback,Red border + error message,No indication of error,High
35
+ 34,Interaction,Success Feedback,All,Confirm successful actions to users,Show success message or visual change,No confirmation of completed action,Toast notification or checkmark,Action completes silently,Medium
36
+ 35,Interaction,Confirmation Dialogs,All,Prevent accidental destructive actions,Confirm before delete/irreversible actions,Delete without confirmation,Are you sure modal,Direct delete on click,High
37
+ 36,Accessibility,Color Contrast,All,Text must be readable against background,Minimum 4.5:1 ratio for normal text,Low contrast text,#333 on white (7:1),#999 on white (2.8:1),High
38
+ 37,Accessibility,Color Only,All,Don't convey information by color alone,Use icons/text in addition to color,Red/green only for error/success,Red text + error icon,Red border only for error,High
39
+ 38,Accessibility,Alt Text,All,Images need text alternatives,Descriptive alt text for meaningful images,Empty or missing alt attributes,alt='Dog playing in park',alt='' for content images,High
40
+ 39,Accessibility,Heading Hierarchy,Web,Screen readers use headings for navigation,Use sequential heading levels h1-h6,Skip heading levels or misuse for styling,h1 then h2 then h3,h1 then h4,Medium
41
+ 40,Accessibility,ARIA Labels,All,Interactive elements need accessible names,Add aria-label for icon-only buttons,Icon buttons without labels,aria-label='Close menu',<button><Icon/></button>,High
42
+ 41,Accessibility,Keyboard Navigation,Web,All functionality accessible via keyboard,Tab order matches visual order,Keyboard traps or illogical tab order,tabIndex for custom order,Unreachable elements,High
43
+ 42,Accessibility,Screen Reader,All,Content should make sense when read aloud,Use semantic HTML and ARIA properly,Div soup with no semantics,<nav> <main> <article>,<div> for everything,Medium
44
+ 43,Accessibility,Form Labels,All,Inputs must have associated labels,Use label with for attribute or wrap input,Placeholder-only inputs,<label for='email'>,placeholder='Email' only,High
45
+ 44,Accessibility,Error Messages,All,Error messages must be announced,Use aria-live or role=alert for errors,Visual-only error indication,role='alert',Red border only,High
46
+ 45,Accessibility,Skip Links,Web,Allow keyboard users to skip navigation,Provide skip to main content link,No skip link on nav-heavy pages,Skip to main content link,100 tabs to reach content,Medium
47
+ 46,Performance,Image Optimization,All,Large images slow page load,Use appropriate size and format (WebP),Unoptimized full-size images,srcset with multiple sizes,4000px image for 400px display,High
48
+ 47,Performance,Lazy Loading,All,Load content as needed,Lazy load below-fold images and content,Load everything upfront,loading='lazy',All images eager load,Medium
49
+ 48,Performance,Code Splitting,Web,Large bundles slow initial load,Split code by route/feature,Single large bundle,dynamic import(),All code in main bundle,Medium
50
+ 49,Performance,Caching,Web,Repeat visits should be fast,Set appropriate cache headers,No caching strategy,Cache-Control headers,Every request hits server,Medium
51
+ 50,Performance,Font Loading,Web,Web fonts can block rendering,Use font-display swap or optional,Invisible text during font load,font-display: swap,FOIT (Flash of Invisible Text),Medium
52
+ 51,Performance,Third Party Scripts,Web,External scripts can block rendering,Load non-critical scripts async/defer,Synchronous third-party scripts,async or defer attribute,<script src='...'> in head,Medium
53
+ 52,Performance,Bundle Size,Web,Large JavaScript slows interaction,Monitor and minimize bundle size,Ignore bundle size growth,Bundle analyzer,No size monitoring,Medium
54
+ 53,Performance,Render Blocking,Web,CSS/JS can block first paint,Inline critical CSS defer non-critical,Large blocking CSS files,Critical CSS inline,All CSS in head,Medium
55
+ 54,Forms,Input Labels,All,Every input needs a visible label,Always show label above or beside input,Placeholder as only label,<label>Email</label><input>,placeholder='Email' only,High
56
+ 55,Forms,Error Placement,All,Errors should appear near the problem,Show error below related input,Single error message at top of form,Error under each field,All errors at form top,Medium
57
+ 56,Forms,Inline Validation,All,Validate as user types or on blur,Validate on blur for most fields,Validate only on submit,onBlur validation,Submit-only validation,Medium
58
+ 57,Forms,Input Types,All,Use appropriate input types,Use email tel number url etc,Text input for everything,type='email',type='text' for email,Medium
59
+ 58,Forms,Autofill Support,Web,Help browsers autofill correctly,Use autocomplete attribute properly,Block or ignore autofill,autocomplete='email',autocomplete='off' everywhere,Medium
60
+ 59,Forms,Required Indicators,All,Mark required fields clearly,Use asterisk or (required) text,No indication of required fields,* required indicator,Guess which are required,Medium
61
+ 60,Forms,Password Visibility,All,Let users see password while typing,Toggle to show/hide password,No visibility toggle,Show/hide password button,Password always hidden,Medium
62
+ 61,Forms,Submit Feedback,All,Confirm form submission status,Show loading then success/error state,No feedback after submit,Loading -> Success message,Button click with no response,High
63
+ 62,Forms,Input Affordance,All,Inputs should look interactive,Use distinct input styling,Inputs that look like plain text,Border/background on inputs,Borderless inputs,Medium
64
+ 63,Forms,Mobile Keyboards,Mobile,Show appropriate keyboard for input type,Use inputmode attribute,Default keyboard for all inputs,inputmode='numeric',Text keyboard for numbers,Medium
65
+ 64,Responsive,Mobile First,Web,Design for mobile then enhance for larger,Start with mobile styles then add breakpoints,Desktop-first causing mobile issues,Default mobile + md: lg: xl:,Desktop default + max-width queries,Medium
66
+ 65,Responsive,Breakpoint Testing,Web,Test at all common screen sizes,Test at 320 375 414 768 1024 1440,Only test on your device,Multiple device testing,Single device development,Medium
67
+ 66,Responsive,Touch Friendly,Web,Mobile layouts need touch-sized targets,Increase touch targets on mobile,Same tiny buttons on mobile,Larger buttons on mobile,Desktop-sized targets on mobile,High
68
+ 67,Responsive,Readable Font Size,All,Text must be readable on all devices,Minimum 16px body text on mobile,Tiny text on mobile,text-base or larger,text-xs for body text,High
69
+ 68,Responsive,Viewport Meta,Web,Set viewport for mobile devices,Use width=device-width initial-scale=1,Missing or incorrect viewport,<meta name='viewport'...>,No viewport meta tag,High
70
+ 69,Responsive,Horizontal Scroll,Web,Avoid horizontal scrolling,Ensure content fits viewport width,Content wider than viewport,max-w-full overflow-x-hidden,Horizontal scrollbar on mobile,High
71
+ 70,Responsive,Image Scaling,Web,Images should scale with container,Use max-width: 100% on images,Fixed width images overflow,max-w-full h-auto,width='800' fixed,Medium
72
+ 71,Responsive,Table Handling,Web,Tables can overflow on mobile,Use horizontal scroll or card layout,Wide tables breaking layout,overflow-x-auto wrapper,Table overflows viewport,Medium
73
+ 72,Typography,Line Height,All,Adequate line height improves readability,Use 1.5-1.75 for body text,Cramped or excessive line height,leading-relaxed (1.625),leading-none (1),Medium
74
+ 73,Typography,Line Length,Web,Long lines are hard to read,Limit to 65-75 characters per line,Full-width text on large screens,max-w-prose,Full viewport width text,Medium
75
+ 74,Typography,Font Size Scale,All,Consistent type hierarchy aids scanning,Use consistent modular scale,Random font sizes,Type scale (12 14 16 18 24 32),Arbitrary sizes,Medium
76
+ 75,Typography,Font Loading,Web,Fonts should load without layout shift,Reserve space with fallback font,Layout shift when fonts load,font-display: swap + similar fallback,No fallback font,Medium
77
+ 76,Typography,Contrast Readability,All,Body text needs good contrast,Use darker text on light backgrounds,Gray text on gray background,text-gray-900 on white,text-gray-400 on gray-100,High
78
+ 77,Typography,Heading Clarity,All,Headings should stand out from body,Clear size/weight difference,Headings similar to body text,Bold + larger size,Same size as body,Medium
79
+ 78,Feedback,Loading Indicators,All,Show system status during waits,Show spinner/skeleton for operations > 300ms,No feedback during loading,Skeleton or spinner,Frozen UI,High
80
+ 79,Feedback,Empty States,All,Guide users when no content exists,Show helpful message and action,Blank empty screens,No items yet. Create one!,Empty white space,Medium
81
+ 80,Feedback,Error Recovery,All,Help users recover from errors,Provide clear next steps,Error without recovery path,Try again button + help link,Error message only,Medium
82
+ 81,Feedback,Progress Indicators,All,Show progress for multi-step processes,Step indicators or progress bar,No indication of progress,Step 2 of 4 indicator,No step information,Medium
83
+ 82,Feedback,Toast Notifications,All,Transient messages for non-critical info,Auto-dismiss after 3-5 seconds,Toasts that never disappear,Auto-dismiss toast,Persistent toast,Medium
84
+ 83,Feedback,Confirmation Messages,All,Confirm successful actions,Brief success message,Silent success,Saved successfully toast,No confirmation,Medium
85
+ 84,Content,Truncation,All,Handle long content gracefully,Truncate with ellipsis and expand option,Overflow or broken layout,line-clamp-2 with expand,Overflow or cut off,Medium
86
+ 85,Content,Date Formatting,All,Use locale-appropriate date formats,Use relative or locale-aware dates,Ambiguous date formats,2 hours ago or locale format,01/02/03,Low
87
+ 86,Content,Number Formatting,All,Format large numbers for readability,Use thousand separators or abbreviations,Long unformatted numbers,"1.2K or 1,234",1234567,Low
88
+ 87,Content,Placeholder Content,All,Show realistic placeholders during dev,Use realistic sample data,Lorem ipsum everywhere,Real sample content,Lorem ipsum,Low
89
+ 88,Onboarding,User Freedom,All,Users should be able to skip tutorials,Provide Skip and Back buttons,Force linear unskippable tour,Skip Tutorial button,Locked overlay until finished,Medium
90
+ 89,Search,Autocomplete,Web,Help users find results faster,Show predictions as user types,Require full type and enter,Debounced fetch + dropdown,No suggestions,Medium
91
+ 90,Search,No Results,Web,Dead ends frustrate users,Show 'No results' with suggestions,Blank screen or '0 results',Try searching for X instead,No results found.,Medium
92
+ 91,Data Entry,Bulk Actions,Web,Editing one by one is tedious,Allow multi-select and bulk edit,Single row actions only,Checkbox column + Action bar,Repeated actions per row,Low
93
+ 92,AI Interaction,Disclaimer,All,Users need to know they talk to AI,Clearly label AI generated content,Present AI as human,AI Assistant label,Fake human name without label,High
94
+ 93,AI Interaction,Streaming,All,Waiting for full text is slow,Stream text response token by token,Show loading spinner for 10s+,Typewriter effect,Spinner until 100% complete,Medium
95
+ 94,Spatial UI,Gaze Hover,VisionOS,Elements should respond to eye tracking before pinch,Scale/highlight element on look,Static element until pinch,hoverEffect(),onTap only,High
96
+ 95,Spatial UI,Depth Layering,VisionOS,UI needs Z-depth to separate content from environment,Use glass material and z-offset,Flat opaque panels blocking view,.glassBackgroundEffect(),bg-white,Medium
97
+ 96,Sustainability,Auto-Play Video,Web,Video consumes massive data and energy,Click-to-play or pause when off-screen,Auto-play high-res video loops,playsInline muted preload='none',autoplay loop,Medium
98
+ 97,Sustainability,Asset Weight,Web,Heavy 3D/Image assets increase carbon footprint,Compress and lazy load 3D models,Load 50MB textures,Draco compression,Raw .obj files,Medium
99
+ 98,AI Interaction,Feedback Loop,All,AI needs user feedback to improve,Thumps up/down or 'Regenerate',Static output only,Feedback component,Read-only text,Low
100
+ 99,Accessibility,Motion Sensitivity,All,Parallax/Scroll-jacking causes nausea,Respect prefers-reduced-motion,Force scroll effects,@media (prefers-reduced-motion),ScrollTrigger.create(),High
@@ -0,0 +1,434 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ UI/UX Pro Max Analyzer - Detect design patterns in existing codebases
5
+ """
6
+
7
+ import os
8
+ import re
9
+ import sys
10
+ import json
11
+ from pathlib import Path
12
+ from collections import Counter, defaultdict
13
+ from math import sqrt
14
+
15
+ # ============ CONFIGURATION ============
16
+ DATA_DIR = Path(__file__).parent.parent / "data"
17
+
18
+ # File patterns to scan
19
+ SCAN_PATTERNS = [
20
+ "**/*.css", "**/*.scss", "**/*.sass", "**/*.less",
21
+ "**/*.html", "**/*.htm", "**/*.jsx", "**/*.tsx",
22
+ "**/*.vue", "**/*.svelte", "**/*.astro",
23
+ "**/*.swift", "**/*.dart", "**/*.kt",
24
+ "tailwind.config.js", "tailwind.config.ts",
25
+ "**/*.module.css", "**/*.styled.js", "**/*.styled.ts"
26
+ ]
27
+
28
+ # Skip directories
29
+ SKIP_DIRS = {
30
+ "node_modules", ".git", "dist", "build", ".next", ".nuxt",
31
+ ".svelte-kit", "vendor", ".cache", "coverage", "__pycache__"
32
+ }
33
+
34
+ # ============ COLOR DETECTION ============
35
+ HEX_PATTERN = re.compile(r'#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})\b')
36
+ RGB_PATTERN = re.compile(r'rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)')
37
+ HSL_PATTERN = re.compile(r'hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%?\s*,\s*(\d+)%?')
38
+
39
+ # Tailwind color classes
40
+ TAILWIND_COLORS = {
41
+ "slate": ["#f8fafc", "#f1f5f9", "#e2e8f0", "#cbd5e1", "#94a3b8", "#64748b", "#475569", "#334155", "#1e293b", "#0f172a"],
42
+ "gray": ["#f9fafb", "#f3f4f6", "#e5e7eb", "#d1d5db", "#9ca3af", "#6b7280", "#4b5563", "#374151", "#1f2937", "#111827"],
43
+ "red": ["#fef2f2", "#fee2e2", "#fecaca", "#fca5a5", "#f87171", "#ef4444", "#dc2626", "#b91c1c", "#991b1b", "#7f1d1d"],
44
+ "orange": ["#fff7ed", "#ffedd5", "#fed7aa", "#fdba74", "#fb923c", "#f97316", "#ea580c", "#c2410c", "#9a3412", "#7c2d12"],
45
+ "amber": ["#fffbeb", "#fef3c7", "#fde68a", "#fcd34d", "#fbbf24", "#f59e0b", "#d97706", "#b45309", "#92400e", "#78350f"],
46
+ "yellow": ["#fefce8", "#fef9c3", "#fef08a", "#fde047", "#facc15", "#eab308", "#ca8a04", "#a16207", "#854d0e", "#713f12"],
47
+ "lime": ["#f7fee7", "#ecfccb", "#d9f99d", "#bef264", "#a3e635", "#84cc16", "#65a30d", "#4d7c0f", "#3f6212", "#365314"],
48
+ "green": ["#f0fdf4", "#dcfce7", "#bbf7d0", "#86efac", "#4ade80", "#22c55e", "#16a34a", "#15803d", "#166534", "#14532d"],
49
+ "teal": ["#f0fdfa", "#ccfbf1", "#99f6e4", "#5eead4", "#2dd4bf", "#14b8a6", "#0d9488", "#0f766e", "#115e59", "#134e4a"],
50
+ "cyan": ["#ecfeff", "#cffafe", "#a5f3fc", "#67e8f9", "#22d3ee", "#06b6d4", "#0891b2", "#0e7490", "#155e75", "#164e63"],
51
+ "blue": ["#eff6ff", "#dbeafe", "#bfdbfe", "#93c5fd", "#60a5fa", "#3b82f6", "#2563eb", "#1d4ed8", "#1e40af", "#1e3a8a"],
52
+ "indigo": ["#eef2ff", "#e0e7ff", "#c7d2fe", "#a5b4fc", "#818cf8", "#6366f1", "#4f46e5", "#4338ca", "#3730a3", "#312e81"],
53
+ "violet": ["#f5f3ff", "#ede9fe", "#ddd6fe", "#c4b5fd", "#a78bfa", "#8b5cf6", "#7c3aed", "#6d28d9", "#5b21b6", "#4c1d95"],
54
+ "purple": ["#faf5ff", "#f3e8ff", "#e9d5ff", "#d8b4fe", "#c084fc", "#a855f7", "#9333ea", "#7e22ce", "#6b21a8", "#581c87"],
55
+ "pink": ["#fdf2f8", "#fce7f3", "#fbcfe8", "#f9a8d4", "#f472b6", "#ec4899", "#db2777", "#be185d", "#9d174d", "#831843"],
56
+ "rose": ["#fff1f2", "#ffe4e6", "#fecdd3", "#fda4af", "#fb7185", "#f43f5e", "#e11d48", "#be123c", "#9f1239", "#881337"],
57
+ }
58
+
59
+ # ============ STYLE PATTERN DETECTION ============
60
+ STYLE_INDICATORS = {
61
+ "Glassmorphism": {
62
+ "css": [r"backdrop-filter", r"blur\s*\(", r"rgba\s*\([^)]+,\s*0\.[1-4]", r"bg-white/[1-4]0", r"bg-opacity-[1-4]0"],
63
+ "classes": ["backdrop-blur", "bg-white/", "bg-opacity-", "border-white/"],
64
+ "weight": 1.5
65
+ },
66
+ "Neumorphism": {
67
+ "css": [r"box-shadow:[^;]*-\d+px\s+-\d+px[^;]*\d+px\s+\d+px", r"inset\s+\d+px", r"shadow-inner"],
68
+ "classes": ["shadow-inner", "shadow-xl", "rounded-2xl", "rounded-3xl"],
69
+ "weight": 1.3
70
+ },
71
+ "Brutalism": {
72
+ "css": [r"border:\s*[2-5]px\s+solid\s+(#000|black)", r"box-shadow:\s*\d+px\s+\d+px\s+0"],
73
+ "classes": ["border-2", "border-4", "border-black", "shadow-none", "rounded-none"],
74
+ "weight": 1.4
75
+ },
76
+ "Neubrutalism": {
77
+ "css": [r"box-shadow:\s*[3-6]px\s+[3-6]px\s+0\s*(#000|black)", r"border:\s*[2-4]px\s+solid"],
78
+ "classes": ["shadow-[", "border-2", "border-3", "border-black", "rounded-lg"],
79
+ "weight": 1.5
80
+ },
81
+ "Minimalism": {
82
+ "css": [r"max-width:\s*(680|720|768|800)px", r"font-weight:\s*(300|400)", r"letter-spacing:\s*-?0\.\d"],
83
+ "classes": ["max-w-2xl", "max-w-3xl", "font-light", "tracking-tight", "space-y-", "leading-relaxed"],
84
+ "weight": 1.0
85
+ },
86
+ "Dark Mode": {
87
+ "css": [r"background(-color)?:\s*(#0[0-3]|#1[0-9a-f]|rgb\s*\(\s*[0-3]\d)", r"color-scheme:\s*dark", r"prefers-color-scheme:\s*dark"],
88
+ "classes": ["dark:", "bg-gray-900", "bg-slate-900", "bg-black", "text-white", "bg-zinc-900"],
89
+ "weight": 1.2
90
+ },
91
+ "Bento Grid": {
92
+ "css": [r"grid-template-columns:[^;]*(repeat|minmax)", r"grid-column:\s*span\s*[2-4]", r"grid-row:\s*span"],
93
+ "classes": ["col-span-2", "col-span-3", "row-span-2", "grid-cols-", "gap-4", "gap-6"],
94
+ "weight": 1.3
95
+ },
96
+ "Flat Design": {
97
+ "css": [r"box-shadow:\s*none", r"border-radius:\s*0", r"background:\s*#[0-9a-f]{6}\s*;"],
98
+ "classes": ["shadow-none", "rounded-none", "bg-blue-500", "bg-red-500", "bg-green-500"],
99
+ "weight": 0.9
100
+ },
101
+ "Claymorphism": {
102
+ "css": [r"border-radius:\s*(16|20|24|32)px", r"box-shadow:[^;]*inset[^;]*,"],
103
+ "classes": ["rounded-2xl", "rounded-3xl", "shadow-xl", "bg-gradient-to"],
104
+ "weight": 1.2
105
+ },
106
+ "Aurora UI": {
107
+ "css": [r"linear-gradient\s*\([^)]*,\s*[^)]*,\s*[^)]*\)", r"background-size:\s*\d{3,}%", r"animation.*gradient"],
108
+ "classes": ["bg-gradient-to-", "from-", "via-", "to-", "animate-"],
109
+ "weight": 1.3
110
+ },
111
+ "Retro-Futurism": {
112
+ "css": [r"text-shadow:[^;]*#(ff|00|0f)", r"font-family:[^;]*(mono|pixel|retro)", r"animation.*glow"],
113
+ "classes": ["font-mono", "text-cyan-", "text-pink-", "text-purple-", "animate-pulse"],
114
+ "weight": 1.1
115
+ }
116
+ }
117
+
118
+ # ============ FONT DETECTION ============
119
+ FONT_PATTERN = re.compile(r'font-family:\s*["\']?([^"\';\n,]+)', re.IGNORECASE)
120
+ GOOGLE_FONTS_PATTERN = re.compile(r'fonts\.googleapis\.com/css2?\?family=([^"&\s]+)', re.IGNORECASE)
121
+ TAILWIND_FONT_CLASSES = re.compile(r'font-(sans|serif|mono|display|body)')
122
+
123
+ # ============ ANALYSIS FUNCTIONS ============
124
+
125
+ def normalize_hex(color):
126
+ """Normalize hex color to 6-digit uppercase"""
127
+ color = color.upper()
128
+ if len(color) == 3:
129
+ color = ''.join([c*2 for c in color])
130
+ return f"#{color}"
131
+
132
+ def rgb_to_hex(r, g, b):
133
+ """Convert RGB to hex"""
134
+ return f"#{int(r):02X}{int(g):02X}{int(b):02X}"
135
+
136
+ def hex_to_rgb(hex_color):
137
+ """Convert hex to RGB tuple"""
138
+ hex_color = hex_color.lstrip('#')
139
+ if len(hex_color) == 3:
140
+ hex_color = ''.join([c*2 for c in hex_color])
141
+ return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
142
+
143
+ def color_distance(c1, c2):
144
+ """Calculate Euclidean distance between two colors"""
145
+ r1, g1, b1 = hex_to_rgb(c1)
146
+ r2, g2, b2 = hex_to_rgb(c2)
147
+ return sqrt((r1-r2)**2 + (g1-g2)**2 + (b1-b2)**2)
148
+
149
+ def find_closest_tailwind(hex_color):
150
+ """Find closest Tailwind color"""
151
+ min_dist = float('inf')
152
+ closest = None
153
+ for name, shades in TAILWIND_COLORS.items():
154
+ for i, shade in enumerate(shades):
155
+ dist = color_distance(hex_color, shade)
156
+ if dist < min_dist:
157
+ min_dist = dist
158
+ shade_num = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900][i]
159
+ closest = f"{name}-{shade_num}"
160
+ return closest if min_dist < 50 else None
161
+
162
+ def scan_directory(directory):
163
+ """Scan directory for relevant files"""
164
+ files = []
165
+ directory = Path(directory)
166
+
167
+ for pattern in SCAN_PATTERNS:
168
+ for file_path in directory.glob(pattern):
169
+ # Skip excluded directories
170
+ if any(skip in file_path.parts for skip in SKIP_DIRS):
171
+ continue
172
+ if file_path.is_file():
173
+ files.append(file_path)
174
+
175
+ return files
176
+
177
+ def extract_colors(content):
178
+ """Extract all colors from content"""
179
+ colors = []
180
+
181
+ # Hex colors
182
+ for match in HEX_PATTERN.finditer(content):
183
+ colors.append(normalize_hex(match.group(1)))
184
+
185
+ # RGB colors
186
+ for match in RGB_PATTERN.finditer(content):
187
+ r, g, b = match.groups()
188
+ colors.append(rgb_to_hex(r, g, b))
189
+
190
+ return colors
191
+
192
+ def extract_fonts(content):
193
+ """Extract font families from content"""
194
+ fonts = set()
195
+
196
+ # CSS font-family
197
+ for match in FONT_PATTERN.finditer(content):
198
+ font = match.group(1).strip().split(',')[0].strip("'\"")
199
+ if font and font.lower() not in ['inherit', 'initial', 'unset', 'sans-serif', 'serif', 'monospace']:
200
+ fonts.add(font)
201
+
202
+ # Google Fonts
203
+ for match in GOOGLE_FONTS_PATTERN.finditer(content):
204
+ font = match.group(1).replace('+', ' ').split(':')[0]
205
+ fonts.add(font)
206
+
207
+ return fonts
208
+
209
+ def detect_style_patterns(content):
210
+ """Detect UI style patterns in content"""
211
+ scores = defaultdict(float)
212
+ matches = defaultdict(list)
213
+
214
+ content_lower = content.lower()
215
+
216
+ for style, config in STYLE_INDICATORS.items():
217
+ # Check CSS patterns
218
+ for pattern in config.get("css", []):
219
+ found = re.findall(pattern, content_lower)
220
+ if found:
221
+ scores[style] += len(found) * config["weight"]
222
+ matches[style].extend(found[:3]) # Keep first 3 matches as evidence
223
+
224
+ # Check Tailwind classes
225
+ for cls in config.get("classes", []):
226
+ count = content_lower.count(cls.lower())
227
+ if count > 0:
228
+ scores[style] += count * 0.5 * config["weight"]
229
+ if cls not in matches[style]:
230
+ matches[style].append(cls)
231
+
232
+ return dict(scores), dict(matches)
233
+
234
+ def extract_tailwind_classes(content):
235
+ """Extract Tailwind-specific classes"""
236
+ patterns = {
237
+ "spacing": re.compile(r'\b(?:p|m|gap|space)-[xy]?-?\d+'),
238
+ "colors": re.compile(r'\b(?:bg|text|border|ring)-(?:slate|gray|zinc|red|orange|amber|yellow|green|teal|cyan|blue|indigo|violet|purple|pink|rose)-\d{2,3}'),
239
+ "typography": re.compile(r'\b(?:text-(?:xs|sm|base|lg|xl|[2-9]xl)|font-(?:thin|light|normal|medium|semibold|bold|extrabold|black)|tracking-(?:tighter|tight|normal|wide|wider|widest)|leading-(?:none|tight|snug|normal|relaxed|loose))'),
240
+ "layout": re.compile(r'\b(?:flex|grid|block|inline|hidden|container|max-w-\w+)'),
241
+ "effects": re.compile(r'\b(?:shadow-(?:sm|md|lg|xl|2xl|inner|none)|rounded-(?:none|sm|md|lg|xl|2xl|3xl|full)|opacity-\d+|blur-(?:sm|md|lg|xl)?)'),
242
+ }
243
+
244
+ results = {}
245
+ for category, pattern in patterns.items():
246
+ # Use findall with full match (no capture groups with ?:)
247
+ found = pattern.findall(content)
248
+ if found:
249
+ results[category] = Counter(found).most_common(10)
250
+
251
+ return results
252
+
253
+ def analyze_codebase(directory):
254
+ """Main analysis function"""
255
+ directory = Path(directory).resolve()
256
+
257
+ if not directory.exists():
258
+ return {"error": f"Directory not found: {directory}"}
259
+
260
+ files = scan_directory(directory)
261
+
262
+ if not files:
263
+ return {"error": "No relevant files found to analyze"}
264
+
265
+ # Aggregated results
266
+ all_colors = []
267
+ all_fonts = set()
268
+ style_scores = defaultdict(float)
269
+ style_evidence = defaultdict(list)
270
+ tailwind_usage = defaultdict(Counter)
271
+ file_count = 0
272
+
273
+ for file_path in files:
274
+ try:
275
+ content = file_path.read_text(encoding='utf-8', errors='ignore')
276
+ file_count += 1
277
+
278
+ # Colors
279
+ colors = extract_colors(content)
280
+ all_colors.extend(colors)
281
+
282
+ # Fonts
283
+ fonts = extract_fonts(content)
284
+ all_fonts.update(fonts)
285
+
286
+ # Style patterns
287
+ scores, evidence = detect_style_patterns(content)
288
+ for style, score in scores.items():
289
+ style_scores[style] += score
290
+ for style, evid in evidence.items():
291
+ style_evidence[style].extend(evid)
292
+
293
+ # Tailwind classes
294
+ tw_classes = extract_tailwind_classes(content)
295
+ for category, items in tw_classes.items():
296
+ for item, count in items:
297
+ tailwind_usage[category][item] += count
298
+
299
+ except Exception as e:
300
+ continue
301
+
302
+ # Process colors
303
+ color_counts = Counter(all_colors)
304
+ top_colors = color_counts.most_common(10)
305
+
306
+ # Map to Tailwind
307
+ color_mapping = []
308
+ for color, count in top_colors:
309
+ tw_match = find_closest_tailwind(color)
310
+ color_mapping.append({
311
+ "hex": color,
312
+ "count": count,
313
+ "tailwind": tw_match
314
+ })
315
+
316
+ # Determine primary style
317
+ sorted_styles = sorted(style_scores.items(), key=lambda x: x[1], reverse=True)
318
+ primary_style = sorted_styles[0] if sorted_styles else ("Unknown", 0)
319
+ secondary_styles = sorted_styles[1:4] if len(sorted_styles) > 1 else []
320
+
321
+ # Trim evidence
322
+ for style in style_evidence:
323
+ style_evidence[style] = list(set(style_evidence[style]))[:5]
324
+
325
+ return {
326
+ "directory": str(directory),
327
+ "files_analyzed": file_count,
328
+ "primary_style": {
329
+ "name": primary_style[0],
330
+ "confidence": min(primary_style[1] / 50, 1.0), # Normalize to 0-1
331
+ "evidence": style_evidence.get(primary_style[0], [])
332
+ },
333
+ "secondary_styles": [
334
+ {"name": s[0], "score": s[1], "evidence": style_evidence.get(s[0], [])}
335
+ for s in secondary_styles if s[1] > 5
336
+ ],
337
+ "colors": {
338
+ "palette": color_mapping,
339
+ "total_unique": len(color_counts)
340
+ },
341
+ "fonts": list(all_fonts),
342
+ "tailwind": {
343
+ category: dict(counter.most_common(5))
344
+ for category, counter in tailwind_usage.items()
345
+ }
346
+ }
347
+
348
+ def format_output(results):
349
+ """Format analysis results for display"""
350
+ if "error" in results:
351
+ return f"Error: {results['error']}"
352
+
353
+ output = []
354
+ output.append(f"## UI/UX Analysis Report")
355
+ output.append(f"**Directory:** {results['directory']}")
356
+ output.append(f"**Files Analyzed:** {results['files_analyzed']}")
357
+ output.append("")
358
+
359
+ # Primary Style
360
+ primary = results['primary_style']
361
+ confidence_pct = int(primary['confidence'] * 100)
362
+ output.append(f"### Detected Style: {primary['name']}")
363
+ output.append(f"**Confidence:** {confidence_pct}%")
364
+ if primary['evidence']:
365
+ output.append(f"**Evidence:** `{', '.join(primary['evidence'][:3])}`")
366
+ output.append("")
367
+
368
+ # Secondary Styles
369
+ if results['secondary_styles']:
370
+ output.append("### Secondary Patterns")
371
+ for style in results['secondary_styles']:
372
+ output.append(f"- **{style['name']}** (score: {style['score']:.1f})")
373
+ output.append("")
374
+
375
+ # Colors
376
+ output.append("### Color Palette")
377
+ for color in results['colors']['palette'][:6]:
378
+ tw = f" → {color['tailwind']}" if color['tailwind'] else ""
379
+ output.append(f"- `{color['hex']}` ({color['count']} uses){tw}")
380
+ output.append(f"- *{results['colors']['total_unique']} unique colors total*")
381
+ output.append("")
382
+
383
+ # Fonts
384
+ if results['fonts']:
385
+ output.append("### Typography")
386
+ for font in results['fonts'][:5]:
387
+ output.append(f"- {font}")
388
+ output.append("")
389
+
390
+ # Tailwind Usage
391
+ if results['tailwind']:
392
+ output.append("### Tailwind Patterns")
393
+ for category, classes in results['tailwind'].items():
394
+ if classes:
395
+ # Handle both dict and list of tuples
396
+ if isinstance(classes, dict):
397
+ class_names = list(classes.keys())[:3]
398
+ else:
399
+ class_names = [c[0] if isinstance(c, tuple) else c for c in classes[:3]]
400
+ top_classes = ', '.join(str(c) for c in class_names)
401
+ output.append(f"- **{category.title()}:** `{top_classes}`")
402
+
403
+ return '\n'.join(output)
404
+
405
+ # ============ CLI ============
406
+
407
+ def main():
408
+ import argparse
409
+
410
+ parser = argparse.ArgumentParser(
411
+ description="Analyze codebase for UI/UX design patterns",
412
+ formatter_class=argparse.RawDescriptionHelpFormatter,
413
+ epilog="""
414
+ Examples:
415
+ python3 analyze.py /path/to/project
416
+ python3 analyze.py . --json
417
+ python3 analyze.py ~/my-app --verbose
418
+ """
419
+ )
420
+ parser.add_argument("directory", nargs="?", default=".", help="Directory to analyze (default: current)")
421
+ parser.add_argument("--json", action="store_true", help="Output as JSON")
422
+ parser.add_argument("--verbose", "-v", action="store_true", help="Show detailed output")
423
+
424
+ args = parser.parse_args()
425
+
426
+ results = analyze_codebase(args.directory)
427
+
428
+ if args.json:
429
+ print(json.dumps(results, indent=2))
430
+ else:
431
+ print(format_output(results))
432
+
433
+ if __name__ == "__main__":
434
+ main()