|
| 1 | +--- |
| 2 | +name: generate-web-reports |
| 3 | +description: "Generates an interactive HTML dashboard from complexity-report.csv, serves it locally, and opens the browser. Produces tabbed ECharts with search, developer filtering, and 20+ chart types across basic, team, risk, fairness, and advanced categories. Use when the user asks to generate reports, view the dashboard, open the web report, visualize complexity data, or see engineering intelligence charts." |
| 4 | +--- |
| 5 | + |
| 6 | +# Generate Web Reports |
| 7 | + |
| 8 | +Produces an interactive HTML dashboard (`reports/index.html`) with 20+ dynamic ECharts organized in tabs: Basic, Team, Risk, Fairness, Advanced. Includes global chart search and per-developer filtering. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +- `complexity-report.csv` in project root (from `complexity-cli batch-analyze`) |
| 13 | +- Python packages: `pandas`, `numpy`, `matplotlib` |
| 14 | +- `teams.cfg` must exist for team-level charts |
| 15 | + |
| 16 | +## Workflow |
| 17 | + |
| 18 | +### Step 1: Ensure Data Exists |
| 19 | + |
| 20 | +If `complexity-report.csv` is missing or stale, generate it first: |
| 21 | + |
| 22 | +```bash |
| 23 | +complexity-cli batch-analyze --all-repos --days 30 -o complexity-report.csv --provider anthropic |
| 24 | +``` |
| 25 | + |
| 26 | +### Step 2: Generate Reports |
| 27 | + |
| 28 | +```bash |
| 29 | +complexity-cli generate-reports -i complexity-report.csv -o reports |
| 30 | +``` |
| 31 | + |
| 32 | +This runs all report functions in parallel (~10 seconds), produces PNG charts, a master composite, and the interactive `reports/index.html` dashboard. |
| 33 | + |
| 34 | +### Step 3: Serve & Open Browser |
| 35 | + |
| 36 | +```bash |
| 37 | +python -m http.server 8080 -d reports & |
| 38 | +open http://localhost:8080 |
| 39 | +``` |
| 40 | + |
| 41 | +On Linux use `xdg-open` instead of `open`. |
| 42 | + |
| 43 | +### Step 4: Stop Server When Done |
| 44 | + |
| 45 | +```bash |
| 46 | +# Find and kill the server |
| 47 | +lsof -ti:8080 | xargs kill 2>/dev/null |
| 48 | +``` |
| 49 | + |
| 50 | +## What the Dashboard Shows |
| 51 | + |
| 52 | +| Tab | Charts | |
| 53 | +|-----|--------| |
| 54 | +| **Basic** | Velocity over time, velocity by month, PR count vs complexity, rolling avg complexity, merge cycle time, high-risk PR % | |
| 55 | +| **Team** | Complexity distribution (boxplot), Gini coefficient, velocity per team per dev, merge cycle by team, complexity vs cycle time, developer velocity (stacked bar), complexity vs PR count (scatter) | |
| 56 | +| **Risk** | Complexity by merge weekday, complexity distribution histogram | |
| 57 | +| **Fairness** | PR size vs complexity (correlation check), PR count vs avg complexity (anti-splitting) | |
| 58 | +| **Advanced** | Developer velocity by week (multi-line with picker), team velocity trend (rolling 4w), cumulative velocity | |
| 59 | + |
| 60 | +## Quick One-Liner |
| 61 | + |
| 62 | +```bash |
| 63 | +complexity-cli generate-reports && python -m http.server 8080 -d reports & sleep 1 && open http://localhost:8080 |
| 64 | +``` |
| 65 | + |
| 66 | +## Public Dashboard (Auto-Deploy) |
| 67 | + |
| 68 | +The dashboard is also deployed automatically to GitHub Pages on every push of `complexity-report.csv` to `main`. |
| 69 | + |
| 70 | +**URL:** `https://riveryio.github.io/complexity-analyzer/` (password-protected via StatiCrypt) |
| 71 | + |
| 72 | +To update the public dashboard: |
| 73 | + |
| 74 | +```bash |
| 75 | +git add complexity-report.csv |
| 76 | +git commit -m "data: update complexity report" |
| 77 | +git push |
| 78 | +``` |
| 79 | + |
| 80 | +GitHub Actions generates reports and deploys a password-protected version. The workflow lives in `.github/workflows/deploy-reports.yml`. |
0 commit comments