Skip to content

Commit 7841fee

Browse files
Merge pull request #2 from RiveryIO/feat/ohad/generate-web-reports-skill
feat: auto-deploy password-protected dashboard to GitHub Pages
2 parents 9f0399f + 8c9abc5 commit 7841fee

5 files changed

Lines changed: 3029 additions & 25 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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`.
Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
---
22
name: weekly-velocity-graph
3-
description: Generates R&D velocity-by-week graph from complexity-report.csv. Use when the user asks for a weekly velocity chart, R&D velocity graph, or to visualize PR throughput by week.
3+
description: "DEPRECATED — use the generate-web-reports skill instead, which produces an interactive HTML dashboard with all charts (including velocity by week). This skill generated a static PNG bar chart and is no longer maintained."
44
---
55

6-
# Weekly Velocity Graph
6+
# Weekly Velocity Graph (DEPRECATED)
77

8-
Generates a two-panel bar chart showing R&D velocity by week: PRs merged per week and complexity-weighted velocity (sum of scores).
8+
**This skill is deprecated.** Use `generate-web-reports` instead, which produces an interactive HTML dashboard with tabbed charts, search, and developer filtering — including the velocity-by-week chart this skill used to generate.
99

10-
## Prerequisites
10+
```bash
11+
# Instead of this:
12+
# python scripts/velocity_by_week.py
1113

12-
- `complexity-report.csv` in project root (from `complexity-cli batch-analyze`)
13-
- `matplotlib`: `pip install matplotlib`
14-
- `GH_TOKEN` or `gh auth token` (for fetching merge dates)
15-
16-
## Workflow
17-
18-
1. **Ensure data exists**: If `complexity-report.csv` is missing or stale, run:
19-
```bash
20-
complexity-cli batch-analyze --all-repos --days 14 -o complexity-report.csv --provider anthropic
21-
```
22-
23-
2. **Generate the graph**:
24-
```bash
25-
python scripts/velocity_by_week.py
26-
```
27-
28-
3. **Output**: `velocity-by-week.png` in project root
29-
30-
## Optional: Custom CSV path
31-
32-
The script reads `complexity-report.csv` from the project root. To use a different file, pass it via env or modify the script's `csv_path` variable.
14+
# Use:
15+
complexity-cli generate-reports -i complexity-report.csv -o reports
16+
python -m http.server 8080 -d reports &
17+
open http://localhost:8080
18+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy Reports
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- complexity-report.csv
8+
- reports/**/*.py
9+
- cli/**/*.py
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: true
20+
21+
jobs:
22+
deploy:
23+
runs-on: ubuntu-latest
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.11"
34+
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: "20"
38+
39+
- name: Install Python dependencies
40+
run: pip install -e .
41+
42+
- name: Generate reports
43+
run: python -m cli.main generate-reports -i complexity-report.csv -o _site
44+
45+
- name: Password-protect dashboard
46+
run: npx staticrypt@3 _site/index.html -p "${{ secrets.DASHBOARD_PASSWORD }}" --short --remember 30 -o _site/index.html
47+
48+
- uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: _site
51+
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Thumbs.db
5050

5151
# Results/data files
5252
*.csv
53+
!complexity-report.csv
5354
*.png
5455
results/
5556

0 commit comments

Comments
 (0)