Live demo on GitHub Pages; rename GALLERY.md -> SHOWCASE.md

- Live demo: scripts/build_demo.py injects a seeded mock-API layer into the real
  frontend/index.html (no backend); .github/workflows/pages.yml builds it into _site/
  and deploys to GitHub Pages on every push to main (one-time: Settings -> Pages ->
  Source = "GitHub Actions"). README gains a `demo | live` badge + a Live demo section
  linking https://alpaq92.github.io/CounselScorecard/.
- Rename GALLERY.md -> SHOWCASE.md (title -> Showcase); update README + CLAUDE references
  and the repo map; gitignore the generated demo builds (_site/, index.demo.html).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-12 14:42:04 +02:00
co-authored by Claude Opus 4.8
parent 1f053cb188
commit 2ce428ef2e
6 changed files with 202 additions and 8 deletions
+42
View File
@@ -0,0 +1,42 @@
name: Deploy live demo to Pages
# Builds the seeded, backend-free demo (frontend/index.html + a mock API) and publishes it to
# GitHub Pages. One-time setup: Settings -> Pages -> Source = "GitHub Actions".
on:
push:
branches: [main]
paths:
- 'frontend/index.html'
- 'scripts/build_demo.py'
- '.github/workflows/pages.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build demo into _site/
run: python scripts/build_demo.py _site
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: _site
- id: deployment
uses: actions/deploy-pages@v4
+3
View File
@@ -17,6 +17,9 @@ venv/
dist/
build/
*.log
# Generated demo builds (GitHub Pages output + local screenshot build)
_site/
frontend/index.demo.html
# Docker / data
pgdata/
+3 -2
View File
@@ -27,7 +27,8 @@ backend/alembic/ env + the single frozen migration 0001
backend/tests/ unit (DB-free) + integration (Postgres)
backend/scripts/license_gate.py
frontend/index.html the entire admin console (one static file, no build)
gallery/ screenshots (referenced by GALLERY.md)
scripts/build_demo.py builds the GitHub Pages live demo (index.html + seeded mock API)
gallery/ screenshots (referenced by SHOWCASE.md)
assets/ app icon — icon.svg + icon.png (Tabler square + percentage, Open Color orange)
db/init/ extensions + least-privilege roles (run as superuser)
observability/ otel-collector-config.yaml
@@ -40,7 +41,7 @@ session) → `services/` (domain logic; never builds raw SQL) → `models/` (ORM
**Project docs live in the sibling `../Counsel-Scorecard/` folder (hyphenated), NOT in
this repo.** Review reports, the UX spec, and remediation tracking go there
(e.g. `code-rereview-2026-06-11.md`, `open-mercato-like_ux_spec.md`, `REALIZATION-REPORT.md`).
Code-repo docs that DO live here: `README.md`, `CREDITS.md`, `CLAUDE.md`, `GALLERY.md`, `LICENSE`, `NOTICE`.
Code-repo docs that DO live here: `README.md`, `CREDITS.md`, `CLAUDE.md`, `SHOWCASE.md`, `LICENSE`, `NOTICE`.
## Commands
+18 -5
View File
@@ -12,12 +12,13 @@
> composite score per firm, turning relationship-based panel management into a measurable,
> auditable, defensible process.
[![Live demo](https://img.shields.io/badge/demo-live-success)](https://alpaq92.github.io/CounselScorecard/)
[![CI](https://img.shields.io/github/actions/workflow/status/Alpaq92/CounselScorecard/ci.yml?branch=main&label=CI)](https://github.com/Alpaq92/CounselScorecard/actions/workflows/ci.yml)
![Tests](https://img.shields.io/badge/tests-88%20passed-brightgreen)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
![Python](https://img.shields.io/badge/python-3.12-blue.svg)
**License:** Apache-2.0 · **Status:** MVP-0 (qualitative core loop) · 📸 **[Screenshots](GALLERY.md)**
**License:** Apache-2.0 · **Status:** MVP-0 (qualitative core loop) · ▶ **[Live demo](https://alpaq92.github.io/CounselScorecard/)** · 📸 **[Screenshots](SHOWCASE.md)**
Built from the product/architecture spec in `../Counsel-Scorecard/`.
@@ -37,7 +38,8 @@ bootstrap admin from your `.env`. Full walkthrough, observability, and local-dev
## Contents
- [Screenshots](GALLERY.md)
- [Live demo](#live-demo)
- [Screenshots](SHOWCASE.md)
- [Credits & licenses](CREDITS.md)
- [Highlights](#highlights)
- [Tech stack](#tech-stack)
@@ -57,6 +59,16 @@ bootstrap admin from your `.env`. Full walkthrough, observability, and local-dev
---
## Live demo
A seeded, **backend-free** build of the admin console runs in the browser on **GitHub Pages** — no install, no login:
> **▶ Live demo:** **<https://alpaq92.github.io/CounselScorecard/>**
It's the real [`frontend/index.html`](frontend/index.html) with a mock API layer injected by [`scripts/build_demo.py`](scripts/build_demo.py), published by [`.github/workflows/pages.yml`](.github/workflows/pages.yml) on every push to `main`. Try the **EN/PL** and **system / light / dark** toggles (top-right) — it follows your OS theme by default.
---
## Highlights
| Requirement | How it's delivered |
@@ -451,14 +463,15 @@ Postgres 16, `alembic upgrade head && python -m app.seed`, then `pytest`.
```
.
├── README.md · CREDITS.md · CLAUDE.md · GALLERY.md docs · credits/licenses · guidance · screenshots
├── README.md · CREDITS.md · CLAUDE.md · SHOWCASE.md docs · credits/licenses · guidance · screenshots
├── docker-compose.yml app stack (postgres · migrate · backend · caddy)
├── Caddyfile reverse proxy (also serves the admin console)
├── .env.example · .gitattributes config template · LF normalization
├── .github/workflows/ci.yml Postgres test job + license gate
├── .github/workflows/ ci.yml (Postgres tests + license gate) · pages.yml (Pages demo)
├── scripts/build_demo.py builds the GitHub Pages live demo (index.html + mock API)
├── frontend/index.html static admin console (Open Mercato-inspired UI)
├── assets/ app icon (icon.svg + icon.png)
├── gallery/ screenshots (referenced by GALLERY.md)
├── gallery/ screenshots (referenced by SHOWCASE.md)
├── db/init/ extensions + least-privilege roles (run as superuser)
├── observability/ otel-collector-config.yaml
└── backend/
+1 -1
View File
@@ -1,4 +1,4 @@
# Gallery
# Showcase
Screenshots of the **Counsel Scorecard** admin console — the single static
[`frontend/index.html`](frontend/index.html) (Open Mercato–inspired), built on the
+135
View File
@@ -0,0 +1,135 @@
#!/usr/bin/env python3
"""Build the public live-demo page = frontend/index.html + a seeded mock-API layer (no backend).
Usage: python scripts/build_demo.py [outdir] (default outdir: _site)
Run from the repo root. Writes <outdir>/index.html (+ .nojekyll) for GitHub Pages.
The real frontend/index.html is never modified."""
import os
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SRC = os.path.join(ROOT, "frontend", "index.html")
OUTDIR = sys.argv[1] if len(sys.argv) > 1 else "_site"
html = open(SRC, encoding="utf-8").read()
MOCK = r"""
<script>
/* ===== DEMO MODE — seeded sample data, no backend. For screenshots only; not part of the app. ===== */
(function(){
var ME={id:'u-admin',email:'admin@counsel.example',full_name:'Avery Admin',role:'admin',is_active:true};
var OPTS5=[{id:'a1',value:1,label:'Poor',display_order:1},{id:'a2',value:2,label:'Below expectations',display_order:2},{id:'a3',value:3,label:'Meets expectations',display_order:3},{id:'a4',value:4,label:'Strong',display_order:4},{id:'a5',value:5,label:'Exceptional',display_order:5}];
var ENUMS={
firm_status:['active','inactive','blacklisted'],
matter_status:['open','in_progress','closed','cancelled'],
matter_type:['transactional','advisory','litigation','regulatory','dispute'],
complexity_band:['routine','standard','complex','bet_the_company'],
value_band:['lt_50k','50k_250k','250k_1m','1m_10m','gt_10m'],
user_role:['admin','legal_ops','matter_owner','viewer'],
questionnaire_status:['draft','active','archived'],
response_status:['draft','submitted','locked'],
ranking_status:['top_performer','solid','watch','at_risk','provisional','remove_candidate'],
answer_type:['scale','single_choice','boolean','numeric','text'],
question_category:['qualitative','quantitative']
};
var PAS=[{id:'pa1',code:'MA',label:'M&A'},{id:'pa2',code:'LIT',label:'Litigation'},{id:'pa3',code:'IP',label:'Intellectual Property'},{id:'pa4',code:'EMP',label:'Employment'},{id:'pa5',code:'REG',label:'Regulatory'}];
var JURS=[{id:'j1',code:'US-NY',label:'New York'},{id:'j2',code:'US-DE',label:'Delaware'},{id:'j3',code:'UK',label:'United Kingdom'},{id:'j4',code:'DE',label:'Germany'}];
var FIRMS=[
{id:'f1',name:'Sterling & Cooper LLP',legal_name:'Sterling Cooper LLP',status:'active',website:'https://sterlingcooper.example'},
{id:'f2',name:'Wachtell Brooks',legal_name:'Wachtell Brooks LLP',status:'active',website:'https://wbrooks.example'},
{id:'f3',name:'Hale & Dorr Partners',legal_name:'Hale Dorr Partners LLP',status:'active',website:''},
{id:'f4',name:'Greenfield Legal',legal_name:'Greenfield Legal GmbH',status:'inactive',website:''},
{id:'f5',name:'Crane, Poole & Schmidt',legal_name:'Crane Poole Schmidt',status:'blacklisted',website:''}
];
var USERS=[
{id:'u-admin',email:'admin@counsel.example',full_name:'Avery Admin',role:'admin',is_active:true},
{id:'u-ops',email:'lee.ops@counsel.example',full_name:'Lee Operations',role:'legal_ops',is_active:true},
{id:'u-own',email:'morgan.owner@counsel.example',full_name:'Morgan Owner',role:'matter_owner',is_active:true},
{id:'u-view',email:'sam.viewer@counsel.example',full_name:'Sam Viewer',role:'viewer',is_active:false}
];
var MATTERS=[
{id:'m1',reference:'M-2026-001',title:'Acquisition of NorthStar Tech',firm_id:'f1',practice_area_id:'pa1',jurisdiction_id:'j2',matter_type:'transactional',complexity_band:'complex',status:'closed'},
{id:'m2',reference:'M-2026-002',title:'Patent dispute - Acme v. Globex',firm_id:'f2',practice_area_id:'pa3',jurisdiction_id:'j1',matter_type:'litigation',complexity_band:'bet_the_company',status:'in_progress'},
{id:'m3',reference:'M-2026-003',title:'GDPR compliance review',firm_id:'f3',practice_area_id:'pa5',jurisdiction_id:'j4',matter_type:'regulatory',complexity_band:'standard',status:'open'},
{id:'m4',reference:'M-2026-004',title:'Executive employment agreements',firm_id:'f1',practice_area_id:'pa4',jurisdiction_id:'j1',matter_type:'advisory',complexity_band:'routine',status:'closed'},
{id:'m5',reference:'M-2026-005',title:'Series C financing',firm_id:'f2',practice_area_id:'pa1',jurisdiction_id:'j2',matter_type:'transactional',complexity_band:'complex',status:'closed'},
{id:'m6',reference:'M-2026-006',title:'Trademark portfolio audit',firm_id:'f3',practice_area_id:'pa3',jurisdiction_id:'j3',matter_type:'advisory',complexity_band:'standard',status:'open'}
];
var QS=[
{id:'q1',key:'responsiveness',label:'Responsiveness & communication',category:'qualitative',answer_type:'scale',scale_min:1,scale_max:5,options:OPTS5},
{id:'q2',key:'legal_quality',label:'Quality of legal work',category:'qualitative',answer_type:'scale',scale_min:1,scale_max:5,options:OPTS5},
{id:'q3',key:'commercial',label:'Commercial / practical judgment',category:'qualitative',answer_type:'scale',scale_min:1,scale_max:5,options:OPTS5},
{id:'q4',key:'efficiency',label:'Efficiency & matter management',category:'qualitative',answer_type:'scale',scale_min:1,scale_max:5,options:OPTS5},
{id:'q5',key:'expertise',label:'Subject-matter expertise',category:'qualitative',answer_type:'scale',scale_min:1,scale_max:5,options:OPTS5},
{id:'q6',key:'budget_accuracy',label:'Budget accuracy (%)',category:'quantitative',answer_type:'numeric',scale_min:0,scale_max:100,options:[]},
{id:'q7',key:'on_time_rate',label:'On-time delivery rate (%)',category:'quantitative',answer_type:'numeric',scale_min:0,scale_max:100,options:[]},
{id:'q8',key:'would_recommend',label:'Would recommend',category:'quantitative',answer_type:'boolean',scale_min:0,scale_max:1,options:[]}
];
var QNNS=[{id:'qn1',key:'counsel_evaluation',title:'Counsel Evaluation',version:1,status:'active',description:'Standard post-matter counsel evaluation.',items:[
{question_id:'q1',weight:0.2,display_order:1},{question_id:'q2',weight:0.25,display_order:2},{question_id:'q3',weight:0.2,display_order:3},{question_id:'q4',weight:0.15,display_order:4},{question_id:'q5',weight:0.2,display_order:5},
{question_id:'q6',weight:0,display_order:6},{question_id:'q7',weight:0,display_order:7},{question_id:'q8',weight:0,display_order:8}
]}];
var CYCLES=[
{id:'c1',name:'Q1 2026 Review',start_date:'2026-01-01',end_date:'2026-03-31',min_evaluations:3,status:'closed'},
{id:'c2',name:'Q2 2026 Review',start_date:'2026-04-01',end_date:'2026-06-30',min_evaluations:3,status:'open'}
];
var SNAPS={c1:[
{firm_id:'f2',composite_score:92,data_completeness:1.0,evaluation_count:6,ranking_status:'top_performer'},
{firm_id:'f1',composite_score:84,data_completeness:0.9,evaluation_count:5,ranking_status:'solid'},
{firm_id:'f3',composite_score:71,data_completeness:0.8,evaluation_count:4,ranking_status:'watch'},
{firm_id:'f4',composite_score:58,data_completeness:0.6,evaluation_count:3,ranking_status:'at_risk'},
{firm_id:'f5',composite_score:0,data_completeness:0.0,evaluation_count:1,ranking_status:'provisional'}
]};
function searchHits(q){
q=(q||'').toLowerCase();
var all=[].concat(
FIRMS.map(function(f){return {type:'firm',id:f.id,title:f.name,rank:0.92};}),
MATTERS.map(function(m){return {type:'matter',id:m.id,title:m.reference+' - '+m.title,rank:0.81};}),
QS.map(function(x){return {type:'question',id:x.id,title:x.label,rank:0.64};})
);
if(!q) return all.slice(0,6);
return all.filter(function(h){return h.title.toLowerCase().indexOf(q)>=0;}).slice(0,8);
}
function GET(path){
var p=path.split('?')[0];
if(p==='/auth/me') return ME;
if(p==='/enums') return ENUMS;
if(p==='/practice-areas') return PAS;
if(p==='/jurisdictions') return JURS;
if(p==='/firms') return FIRMS;
if(p==='/matters') return MATTERS;
if(p==='/questionnaires') return QNNS;
if(p==='/questions') return QS;
if(p==='/review-cycles') return CYCLES;
if(p==='/users') return USERS;
if(p.indexOf('/review-cycles/')===0 && p.indexOf('/snapshots')>0){ return SNAPS[p.split('/')[2]]||[]; }
if(p.indexOf('/search')===0){ var q='',qi=path.indexOf('q='); if(qi>=0){ q=decodeURIComponent(path.slice(qi+2).split('&')[0]); } return {hits:searchHits(q)}; }
if(p.indexOf('/history')>0) return [];
return {};
}
var _id=100;
window.api=function(method,path,body){
var out;
if(method==='GET') out=GET(path);
else if(path.indexOf('/responses')===0 && path.indexOf('/history')<0){ out={id:'r-'+(++_id),score:88,status:(body&&body.submit)?'submitted':'draft'}; }
else { out={}; for(var k in (body||{})) out[k]=body[k]; out.id='demo-'+(++_id); }
try{ if(typeof log==='function') log(method+' '+path+' -> 200 (demo)', out); }catch(e){}
return Promise.resolve(out);
};
// The real boot may have already called restore() with the original api (which 404s on a backend-less
// static server); neutralize showLogin so that late rejection can't flip back to the login screen.
window.showLogin=function(){};
try{ state.token='demo'; }catch(e){}
if(typeof restore==='function') restore();
})();
</script>
"""
marker = "</body>"
assert html.count(marker) >= 1, "no </body> in source"
# insert before the LAST </body>
idx = html.rfind(marker)
out = html[:idx] + MOCK + "\n" + html[idx:]
os.makedirs(OUTDIR, exist_ok=True)
open(os.path.join(OUTDIR, "index.html"), "w", encoding="utf-8").write(out)
open(os.path.join(OUTDIR, ".nojekyll"), "w").close()
print(f"wrote {OUTDIR}/index.html ({len(out)} bytes) + .nojekyll")