ui-copilot / README.md
ksri77's picture
chore: add Dockerfile for HuggingFace Spaces (port 7860, DB_PATH env var)
f03da16
|
Raw
History Blame Contribute Delete
7.44 kB
metadata
title: UICopilot
emoji: 🎨
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
license: mit

UICopilot

AI UI/UX Engineering Platform β€” analyze, score, and improve the visual quality of your application.

UICopilot reviews screenshots, HTML, and CSS, scores interface quality across the dimensions that actually make software look professional, and turns every issue it finds into a prioritized, explainable fix β€” not just a grade.

Built for developers who say "I can build software, but I can't make it look good."


Why UICopilot

Most UI checkers stop at "here's your score." UICopilot is built on a different premise: the score is not the product β€” the prioritized action plan is.

UI Score: 82/100

Increase card padding from 12px to 20px       (+4 points)
Make table headers 13px uppercase             (+3 points)
Standardize primary button styling            (+2 points)

Every issue UICopilot surfaces includes the problem, the evidence, why it matters, the recommended fix, and the expected score impact. No vague suggestions.

What It Does

  • Scores your UI across visual hierarchy, typography, spacing, consistency, accessibility, contrast, and component quality.
  • Detects issues with severity, confidence, and an estimated point gain for fixing each one.
  • Finds inconsistency β€” e.g. six different button styles where there should be one β€” and tells you how to consolidate.
  • Teaches as it goes: every recommendation explains why it matters, with reference points from products like Stripe, Linear, and Notion.
  • Generates fixes: CSS variables, design tokens, semantic HTML/ARIA improvements, and a ready-to-paste prompt for Claude Code.
  • Tracks progress over time, so you can see whether today's changes actually improved your UI.

Architecture

Frontend
   ↓
FastAPI Backend
   ↓
Analysis Engine
   β”œβ”€β”€ Screenshot Analyzer        β”œβ”€β”€ Color Analyzer
   β”œβ”€β”€ HTML Analyzer              β”œβ”€β”€ Dashboard Analyzer
   β”œβ”€β”€ CSS Analyzer               β”œβ”€β”€ Table Analyzer
   β”œβ”€β”€ Component Analyzer         β”œβ”€β”€ Mobile Analyzer
   β”œβ”€β”€ Accessibility Analyzer     └── Design System Analyzer
   β”œβ”€β”€ Typography Analyzer
   └── Spacing Analyzer
   ↓
Recommendation Engine β†’ Score Engine β†’ Learning Engine β†’ Claude Prompt Generator
   ↓
SQLite (DuckDB planned for analytics & trend history)

Layered design throughout: API β†’ Services β†’ Analyzers β†’ Rules β†’ Repositories. Analyzers have no UI logic and no direct database access; scoring weights and thresholds are configuration-driven, not hard-coded.

Project Structure

ui-copilot/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ api/            # FastAPI routes β€” no business logic here
β”‚   β”œβ”€β”€ services/        # Orchestration layer
β”‚   β”œβ”€β”€ analyzers/       # Screenshot / HTML / CSS / component analyzers
β”‚   β”œβ”€β”€ rules/           # spacing_rules.py, typography_rules.py, contrast_rules.py, ...
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ repositories/
β”‚   └── utils/
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ pages/
β”‚   └── assets/
β”œβ”€β”€ tests/
β”œβ”€β”€ docs/                # REQUIREMENTS.md, specs/, ADRs
β”œβ”€β”€ samples/
β”œβ”€β”€ reports/
β”œβ”€β”€ data/
β”œβ”€β”€ config/               # scoring weights, thresholds β€” not in code
β”œβ”€β”€ scripts/
└── requirements.txt

Getting Started

# Clone
git clone https://github.com/<your-org>/ui-copilot.git
cd ui-copilot

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate

# Install dependencies (Python 3.9+)
pip install -r requirements.txt

# Start the server
uvicorn backend.api.main:app --reload

Then open http://localhost:8000 β€” the Developer Dashboard loads automatically.

The API docs are at http://localhost:8000/docs (Swagger UI).

Running tests

python -m pytest tests/ -v

Linting

ruff check backend/ tests/

V1 Modules β€” Status

Module Description Status
1 Project Management (SQLite + CRUD) βœ… Done
2 Page Analyzer (HTML + CSS parser) βœ… Done
3 Screenshot Analysis (CV, no API calls) βœ… Done
4 Design System Detection (6 rules) βœ… Done
5 Scoring Engine (7 categories, config-driven) βœ… Done
6 Issue Detection (severity, confidence, evidence) βœ… Done
7 Improvement Roadmap (7 buckets) βœ… Done
8 Learning Mode (why + references on every issue) βœ… Done
9 Claude Prompt Generator βœ… Done
10 CSS Generator βœ… Done
11 HTML Improvements (ARIA, semantic, responsive) βœ… Done
12 Design Token Generator (colors, spacing, elevation, animation, dark mode) βœ… Done
13 Accessibility Review (WCAG A/AA, keyboard/ARIA hints) βœ… Done
14 Dashboard Analyzer βœ… Done
15 Mobile Analyzer βœ… Done
16 Consistency Checker (cross-page divergence) βœ… Done
17 UI Trend Analysis (score over time) βœ… Done
18 Achievements / Gamification (14 badges) βœ… Done
22 Developer Dashboard (workspace UI at /) βœ… Done

API Endpoints

POST /api/v1/analyze              β€” analyze HTML (+ optional CSS)
POST /api/v1/analyze/screenshot   β€” analyze a screenshot

GET  /api/v1/projects             β€” list projects
POST /api/v1/projects             β€” create project
GET  /api/v1/projects/{id}        β€” get project
DELETE /api/v1/projects/{id}      β€” delete project
GET  /api/v1/projects/{id}/pages  β€” list pages
POST /api/v1/projects/{id}/pages  β€” add page
GET  /api/v1/projects/{id}/trend        β€” score-over-time (all pages)
GET  /api/v1/projects/{id}/consistency  β€” cross-page consistency report
GET  /api/v1/projects/{id}/achievements β€” badges & gamification

GET  /api/v1/pages/{id}           β€” get page
GET  /api/v1/pages/{id}/analyses  β€” list analyses
GET  /api/v1/pages/{id}/trend     β€” score-over-time (one page)

GET  /health                      β€” health check
GET  /docs                        β€” Swagger UI

Roadmap

UICopilot Version 1 covers screenshot, HTML, and CSS analysis with scoring, issue detection, the improvement roadmap, learning mode, and the Claude prompt generator. See ROADMAP.md for the full path: GitHub PR integration β†’ browser extension β†’ Figma plugin β†’ VS Code extension β†’ CI/CD quality gates.

Full module breakdown and detailed scope live in docs/REQUIREMENTS.md, the project's living requirements document.

Scoring Model

Category Weight
Visual Hierarchy 20%
Typography 15%
Spacing 15%
Consistency 15%
Accessibility 15%
Contrast 10%
Component Quality 10%

Scores are 0–100, per page, with category-level breakdowns and a trend view across reviews over time.

Contributing

See CONTRIBUTING.md. New analyzers and rules should follow the single-responsibility pattern already used in backend/rules/ β€” each rule returns an issue, severity, confidence score, and fix recommendation, and reads its thresholds from config/, not from hard-coded values.

License

MIT β€” see LICENSE.