Spaces:
Sleeping
Sleeping
feat: complete frontend integration and API routes
Browse files- .vibecheck/last-score.json +1 -1
- app.py +18 -44
- frontend/codebug (1).html +899 -0
- templates/index.html +879 -454
- templates/landing.html +0 -338
.vibecheck/last-score.json
CHANGED
|
@@ -6,5 +6,5 @@
|
|
| 6 |
"runtimeProof": 0,
|
| 7 |
"contracts": 0,
|
| 8 |
"mockData": 0,
|
| 9 |
-
"lastUpdated": "2026-04-
|
| 10 |
}
|
|
|
|
| 6 |
"runtimeProof": 0,
|
| 7 |
"contracts": 0,
|
| 8 |
"mockData": 0,
|
| 9 |
+
"lastUpdated": "2026-04-08T09:17:56.396Z"
|
| 10 |
}
|
app.py
CHANGED
|
@@ -20,6 +20,7 @@ from config import (
|
|
| 20 |
from environment import CodeReviewEnv
|
| 21 |
from agent import review, call_llm
|
| 22 |
from grader import grade
|
|
|
|
| 23 |
|
| 24 |
logger = logging.getLogger(__name__)
|
| 25 |
|
|
@@ -192,10 +193,6 @@ def get_fix_suggestion(code, ai_action):
|
|
| 192 |
# --- Routes ---
|
| 193 |
|
| 194 |
@app.route("/")
|
| 195 |
-
def landing():
|
| 196 |
-
return render_template("landing.html")
|
| 197 |
-
|
| 198 |
-
@app.route("/dashboard")
|
| 199 |
def index():
|
| 200 |
return render_template("index.html")
|
| 201 |
|
|
@@ -277,49 +274,26 @@ def get_history():
|
|
| 277 |
"best_score": calculate_best_score()
|
| 278 |
})
|
| 279 |
|
| 280 |
-
@app.route("/api/
|
| 281 |
@limiter.limit(RATE_LIMIT_AUTO_RUN)
|
| 282 |
-
def
|
| 283 |
-
|
| 284 |
-
return jsonify({"error": "Already running"}), 400
|
| 285 |
-
|
| 286 |
-
count = request.json.get("count", 1)
|
| 287 |
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
# Grade
|
| 296 |
-
ground_truth = env._get_answer(obs["episode_id"])
|
| 297 |
-
res = grade(ai_action, ground_truth)
|
| 298 |
-
|
| 299 |
-
# Update state
|
| 300 |
-
STATE["total_reward"] += res.reward
|
| 301 |
-
STATE["episode_count"] += 1
|
| 302 |
-
|
| 303 |
-
record = {
|
| 304 |
-
"episode_id": obs["episode_id"],
|
| 305 |
-
"snippet_id": obs["snippet_id"],
|
| 306 |
-
"ai_said": f"{ai_action.get('type')} / {ai_action.get('category')}",
|
| 307 |
-
"reward": res.reward,
|
| 308 |
-
"correct": res.correct,
|
| 309 |
-
"breakdown": res.breakdown,
|
| 310 |
-
"bug_type": res.bug_type
|
| 311 |
-
}
|
| 312 |
-
STATE["history"].append(record)
|
| 313 |
-
|
| 314 |
-
time.sleep(0.8) # Artificial delay for judge presentation
|
| 315 |
-
|
| 316 |
-
save_history_file()
|
| 317 |
-
STATE["is_running"] = False
|
| 318 |
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
| 323 |
|
| 324 |
@app.route("/api/upload", methods=["POST"])
|
| 325 |
@limiter.limit(RATE_LIMIT_REVIEW)
|
|
|
|
| 20 |
from environment import CodeReviewEnv
|
| 21 |
from agent import review, call_llm
|
| 22 |
from grader import grade
|
| 23 |
+
from training_loop import run_training
|
| 24 |
|
| 25 |
logger = logging.getLogger(__name__)
|
| 26 |
|
|
|
|
| 193 |
# --- Routes ---
|
| 194 |
|
| 195 |
@app.route("/")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
def index():
|
| 197 |
return render_template("index.html")
|
| 198 |
|
|
|
|
| 274 |
"best_score": calculate_best_score()
|
| 275 |
})
|
| 276 |
|
| 277 |
+
@app.route("/api/train", methods=["POST"])
|
| 278 |
@limiter.limit(RATE_LIMIT_AUTO_RUN)
|
| 279 |
+
def train():
|
| 280 |
+
episodes = request.json.get("episodes", 10)
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
+
# run synchronously to match frontend assumptions
|
| 283 |
+
try:
|
| 284 |
+
output_data = run_training(num_episodes=episodes, verbose=False, resume=True)
|
| 285 |
+
stats = output_data["overall_stats"]
|
| 286 |
+
return jsonify(stats)
|
| 287 |
+
except Exception as e:
|
| 288 |
+
return jsonify({"error": str(e)}), 500
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
+
@app.route("/api/health", methods=["GET"])
|
| 291 |
+
def health():
|
| 292 |
+
return jsonify({
|
| 293 |
+
"status": "healthy",
|
| 294 |
+
"has_anthropic": bool(os.environ.get("ANTHROPIC_API_KEY")),
|
| 295 |
+
"has_openai": bool(os.environ.get("OPENAI_API_KEY"))
|
| 296 |
+
})
|
| 297 |
|
| 298 |
@app.route("/api/upload", methods=["POST"])
|
| 299 |
@limiter.limit(RATE_LIMIT_REVIEW)
|
frontend/codebug (1).html
ADDED
|
@@ -0,0 +1,899 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>CodeBug — AI Code Review</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=DM+Mono:wght@400;500&family=Syne:wght@400;600;700;800&display=swap" rel="stylesheet" />
|
| 8 |
+
<style>
|
| 9 |
+
/* ── TOKENS ─────────────────────────────────────────────── */
|
| 10 |
+
:root {
|
| 11 |
+
--ink: #0e0e0c;
|
| 12 |
+
--paper: #f2efe8;
|
| 13 |
+
--surface:#e8e4dc;
|
| 14 |
+
--mid: #b8b3aa;
|
| 15 |
+
--dim: #7a756c;
|
| 16 |
+
--mono: 'DM Mono', monospace;
|
| 17 |
+
--serif: 'Playfair Display', serif;
|
| 18 |
+
--sans: 'Syne', sans-serif;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/* ── RESET ──────────────────────────────────────────────── */
|
| 22 |
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
| 23 |
+
html { scroll-behavior: smooth; }
|
| 24 |
+
body {
|
| 25 |
+
background: var(--paper);
|
| 26 |
+
color: var(--ink);
|
| 27 |
+
font-family: var(--sans);
|
| 28 |
+
overflow-x: hidden;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* subtle grain — opacity kept very low so it doesn't fight text */
|
| 32 |
+
body::before {
|
| 33 |
+
content: '';
|
| 34 |
+
position: fixed; inset: 0; z-index: 9000;
|
| 35 |
+
pointer-events: none;
|
| 36 |
+
opacity: .09;
|
| 37 |
+
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
| 38 |
+
background-size: 200px 200px;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* ── NAV ─────────────────────────────────────────────────── */
|
| 42 |
+
nav {
|
| 43 |
+
position: fixed; top: 0; left: 0; right: 0; z-index: 500;
|
| 44 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 45 |
+
padding: 20px 56px;
|
| 46 |
+
border-bottom: 1px solid rgba(14,14,12,.08);
|
| 47 |
+
backdrop-filter: blur(14px);
|
| 48 |
+
background: rgba(242,239,232,.92);
|
| 49 |
+
}
|
| 50 |
+
.nav-logo {
|
| 51 |
+
font-family: var(--serif);
|
| 52 |
+
font-size: 1.25rem; font-weight: 900; letter-spacing: -.02em;
|
| 53 |
+
display: flex; align-items: center; gap: 8px;
|
| 54 |
+
}
|
| 55 |
+
.nav-logo sup {
|
| 56 |
+
font-family: var(--mono); font-size: .5rem;
|
| 57 |
+
background: var(--ink); color: var(--paper);
|
| 58 |
+
padding: 2px 6px; border-radius: 2px; letter-spacing: .06em;
|
| 59 |
+
vertical-align: super;
|
| 60 |
+
}
|
| 61 |
+
.nav-links { display: flex; gap: 36px; list-style: none; }
|
| 62 |
+
.nav-links a {
|
| 63 |
+
font-size: .72rem; font-weight: 600;
|
| 64 |
+
letter-spacing: .1em; text-transform: uppercase;
|
| 65 |
+
text-decoration: none; color: var(--dim);
|
| 66 |
+
transition: color .2s;
|
| 67 |
+
}
|
| 68 |
+
.nav-links a:hover { color: var(--ink); }
|
| 69 |
+
.nav-cta {
|
| 70 |
+
background: var(--ink); color: var(--paper);
|
| 71 |
+
font-family: var(--sans); font-size: .72rem; font-weight: 700;
|
| 72 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 73 |
+
border: none; padding: 10px 24px; border-radius: 2px; cursor: pointer;
|
| 74 |
+
transition: background .2s, transform .15s;
|
| 75 |
+
}
|
| 76 |
+
.nav-cta:hover { background: #2a2a28; transform: translateY(-1px); }
|
| 77 |
+
|
| 78 |
+
/* ── HERO ────────────────────────────────────────────────── */
|
| 79 |
+
#hero {
|
| 80 |
+
min-height: 100vh;
|
| 81 |
+
display: grid; align-items: center;
|
| 82 |
+
padding: 140px 56px 80px;
|
| 83 |
+
}
|
| 84 |
+
.hero-inner {
|
| 85 |
+
max-width: 1160px; margin: 0 auto; width: 100%;
|
| 86 |
+
display: grid; grid-template-columns: 1fr 1fr;
|
| 87 |
+
gap: 72px; align-items: center;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.hero-eyebrow {
|
| 91 |
+
font-family: var(--mono); font-size: .65rem;
|
| 92 |
+
letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
|
| 93 |
+
display: flex; align-items: center; gap: 10px;
|
| 94 |
+
margin-bottom: 24px;
|
| 95 |
+
animation: fadeUp .7s ease both;
|
| 96 |
+
}
|
| 97 |
+
.hero-eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--mid); }
|
| 98 |
+
|
| 99 |
+
.hero-headline {
|
| 100 |
+
font-family: var(--serif);
|
| 101 |
+
font-size: clamp(3rem, 5.2vw, 5.4rem);
|
| 102 |
+
font-weight: 900; line-height: .96; letter-spacing: -.03em;
|
| 103 |
+
margin-bottom: 24px;
|
| 104 |
+
animation: fadeUp .7s .08s ease both;
|
| 105 |
+
}
|
| 106 |
+
.hero-headline em { font-style: italic; color: var(--dim); }
|
| 107 |
+
|
| 108 |
+
.hero-sub {
|
| 109 |
+
font-size: 1rem; line-height: 1.7; color: var(--dim);
|
| 110 |
+
max-width: 380px; margin-bottom: 40px;
|
| 111 |
+
animation: fadeUp .7s .16s ease both;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.hero-btns { display: flex; gap: 12px; animation: fadeUp .7s .24s ease both; }
|
| 115 |
+
.btn-primary {
|
| 116 |
+
background: var(--ink); color: var(--paper);
|
| 117 |
+
font-family: var(--sans); font-size: .75rem; font-weight: 700;
|
| 118 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 119 |
+
border: none; padding: 13px 28px; border-radius: 2px; cursor: pointer;
|
| 120 |
+
transition: background .2s, transform .15s;
|
| 121 |
+
}
|
| 122 |
+
.btn-primary:hover { background: #2a2a28; transform: translateY(-2px); }
|
| 123 |
+
.btn-secondary {
|
| 124 |
+
background: transparent; color: var(--ink);
|
| 125 |
+
font-family: var(--sans); font-size: .75rem; font-weight: 600;
|
| 126 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 127 |
+
border: 1.5px solid var(--mid); padding: 13px 28px; border-radius: 2px; cursor: pointer;
|
| 128 |
+
transition: border-color .2s, transform .15s;
|
| 129 |
+
}
|
| 130 |
+
.btn-secondary:hover { border-color: var(--ink); transform: translateY(-2px); }
|
| 131 |
+
|
| 132 |
+
/* terminal card */
|
| 133 |
+
.hero-terminal {
|
| 134 |
+
background: var(--ink); border-radius: 8px; overflow: hidden;
|
| 135 |
+
box-shadow: 0 32px 64px rgba(0,0,0,.16);
|
| 136 |
+
animation: fadeUp .7s .1s ease both;
|
| 137 |
+
}
|
| 138 |
+
.t-bar {
|
| 139 |
+
background: #181816; padding: 13px 18px;
|
| 140 |
+
display: flex; align-items: center; gap: 7px;
|
| 141 |
+
}
|
| 142 |
+
.t-dot { width: 10px; height: 10px; border-radius: 50%; }
|
| 143 |
+
.t-dot:nth-child(1) { background: #ff5f57; }
|
| 144 |
+
.t-dot:nth-child(2) { background: #febc2e; }
|
| 145 |
+
.t-dot:nth-child(3) { background: #28c840; }
|
| 146 |
+
.t-lbl { margin-left: auto; font-family: var(--mono); font-size: .6rem; color: #4a4a48; letter-spacing: .08em; }
|
| 147 |
+
.t-body { padding: 24px 22px; font-family: var(--mono); font-size: .75rem; line-height: 1.85; color: #b0aba2; }
|
| 148 |
+
.tc { color: #484840; }
|
| 149 |
+
.tk { color: #7eb8d4; }
|
| 150 |
+
.ts { color: #b8d47e; }
|
| 151 |
+
.tn { color: #d4b47e; }
|
| 152 |
+
.te { color: #d47e7e; }
|
| 153 |
+
.tg { color: #7ed4a0; }
|
| 154 |
+
.tbadge {
|
| 155 |
+
display: inline-block; padding: 2px 8px; border-radius: 2px;
|
| 156 |
+
font-size: .58rem; margin-left: 8px;
|
| 157 |
+
}
|
| 158 |
+
.tbadge.err { background: #d47e7e14; border: 1px solid #d47e7e40; color: #d47e7e; }
|
| 159 |
+
.tbadge.ok { background: #7ed4a014; border: 1px solid #7ed4a040; color: #7ed4a0; }
|
| 160 |
+
.blink { animation: blink 1.1s step-end infinite; }
|
| 161 |
+
@keyframes blink { 50% { opacity: 0; } }
|
| 162 |
+
|
| 163 |
+
/* hero stats */
|
| 164 |
+
.hero-stats {
|
| 165 |
+
grid-column: 1 / -1;
|
| 166 |
+
display: flex; gap: 52px;
|
| 167 |
+
border-top: 1px solid var(--mid); padding-top: 36px;
|
| 168 |
+
animation: fadeUp .7s .3s ease both;
|
| 169 |
+
}
|
| 170 |
+
.stat-num { font-family: var(--serif); font-size: 2.2rem; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
|
| 171 |
+
.stat-lbl { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-top: 5px; }
|
| 172 |
+
|
| 173 |
+
/* ── DIVIDER LINE ────────────────────────────────────────── */
|
| 174 |
+
.divider {
|
| 175 |
+
border: none; border-top: 1px solid var(--mid);
|
| 176 |
+
margin: 0;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/* ── SECTIONS ────────────────────────────────────────────── */
|
| 180 |
+
section { padding: 96px 56px; }
|
| 181 |
+
.si { max-width: 1160px; margin: 0 auto; }
|
| 182 |
+
|
| 183 |
+
/* section header */
|
| 184 |
+
.s-eyebrow {
|
| 185 |
+
font-family: var(--mono); font-size: .62rem;
|
| 186 |
+
letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
|
| 187 |
+
display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
|
| 188 |
+
}
|
| 189 |
+
.s-eyebrow::before { content: ''; width: 18px; height: 1px; background: var(--mid); }
|
| 190 |
+
.s-title {
|
| 191 |
+
font-family: var(--serif);
|
| 192 |
+
font-size: clamp(2rem, 3.6vw, 3.2rem);
|
| 193 |
+
font-weight: 900; line-height: 1.05; letter-spacing: -.025em;
|
| 194 |
+
margin-bottom: 16px;
|
| 195 |
+
}
|
| 196 |
+
.s-body {
|
| 197 |
+
font-size: .95rem; line-height: 1.72; color: var(--dim);
|
| 198 |
+
max-width: 540px;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/* dark section overrides */
|
| 202 |
+
.dark { background: var(--ink); color: var(--paper); }
|
| 203 |
+
.dark .s-eyebrow { color: #666; }
|
| 204 |
+
.dark .s-eyebrow::before { background: #333; }
|
| 205 |
+
.dark .s-title { color: var(--paper); }
|
| 206 |
+
.dark .s-body { color: #999; }
|
| 207 |
+
|
| 208 |
+
/* ── REVIEW SECTION ──────────────────────────────────────── */
|
| 209 |
+
.review-grid {
|
| 210 |
+
display: grid; grid-template-columns: 1fr 1fr;
|
| 211 |
+
gap: 24px; margin-top: 48px;
|
| 212 |
+
}
|
| 213 |
+
.panel { border: 1px solid #262622; border-radius: 6px; overflow: hidden; }
|
| 214 |
+
.panel-head {
|
| 215 |
+
padding: 12px 20px; background: #161614;
|
| 216 |
+
border-bottom: 1px solid #262622;
|
| 217 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 218 |
+
}
|
| 219 |
+
.panel-label { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: #666; }
|
| 220 |
+
.panel-meta { font-family: var(--mono); font-size: .6rem; color: #3e3e3a; }
|
| 221 |
+
|
| 222 |
+
textarea#codeInput {
|
| 223 |
+
display: block; width: 100%; height: 260px;
|
| 224 |
+
background: transparent; border: none; outline: none; resize: none;
|
| 225 |
+
font-family: var(--mono); font-size: .78rem; line-height: 1.7;
|
| 226 |
+
color: #c8c3ba; caret-color: #7eb8d4;
|
| 227 |
+
padding: 20px;
|
| 228 |
+
}
|
| 229 |
+
.panel-footer {
|
| 230 |
+
display: flex; gap: 10px; align-items: center;
|
| 231 |
+
padding: 12px 20px; border-top: 1px solid #262622;
|
| 232 |
+
}
|
| 233 |
+
.lang-sel {
|
| 234 |
+
background: #1a1a18; border: 1px solid #303030; border-radius: 2px;
|
| 235 |
+
color: #999; font-family: var(--mono); font-size: .68rem;
|
| 236 |
+
padding: 7px 12px; cursor: pointer; outline: none;
|
| 237 |
+
}
|
| 238 |
+
.run-btn {
|
| 239 |
+
margin-left: auto; background: var(--paper); color: var(--ink);
|
| 240 |
+
font-family: var(--sans); font-size: .72rem; font-weight: 700;
|
| 241 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 242 |
+
border: none; padding: 9px 22px; border-radius: 2px; cursor: pointer;
|
| 243 |
+
transition: background .2s, transform .15s;
|
| 244 |
+
}
|
| 245 |
+
.run-btn:hover { background: #ddd8d0; transform: translateY(-1px); }
|
| 246 |
+
.run-btn:disabled { opacity: .5; pointer-events: none; }
|
| 247 |
+
|
| 248 |
+
/* result area */
|
| 249 |
+
.result-body { padding: 20px; min-height: 316px; position: relative; }
|
| 250 |
+
.r-empty {
|
| 251 |
+
display: flex; flex-direction: column; align-items: center;
|
| 252 |
+
justify-content: center; height: 276px; gap: 10px; color: #333;
|
| 253 |
+
}
|
| 254 |
+
.r-empty p { font-family: var(--mono); font-size: .65rem; color: #3e3e3a; }
|
| 255 |
+
.r-loading { display: none; flex-direction: column; align-items: center; justify-content: center; height: 276px; gap: 16px; }
|
| 256 |
+
.r-loading.on { display: flex; }
|
| 257 |
+
.spinner { width: 20px; height: 20px; border: 2px solid #2a2a28; border-top-color: #888; border-radius: 50%; animation: spin .8s linear infinite; }
|
| 258 |
+
.spinner-lbl { font-family: var(--mono); font-size: .65rem; color: #555; }
|
| 259 |
+
@keyframes spin { to { transform: rotate(360deg); } }
|
| 260 |
+
.r-card { display: none; }
|
| 261 |
+
.r-card.on { display: block; }
|
| 262 |
+
|
| 263 |
+
.r-badge {
|
| 264 |
+
display: inline-flex; align-items: center; gap: 6px;
|
| 265 |
+
padding: 4px 12px; border-radius: 2px; margin-bottom: 20px;
|
| 266 |
+
font-family: var(--mono); font-size: .62rem; font-weight: 600;
|
| 267 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 268 |
+
}
|
| 269 |
+
.r-badge.sec { background: #d47e7e14; border: 1px solid #d47e7e40; color: #d47e7e; }
|
| 270 |
+
.r-badge.lgc { background: #d4c27e14; border: 1px solid #d4c27e40; color: #d4c27e; }
|
| 271 |
+
.r-badge.sty { background: #7eb8d414; border: 1px solid #7eb8d440; color: #7eb8d4; }
|
| 272 |
+
.r-badge.apr { background: #7ed4a014; border: 1px solid #7ed4a040; color: #7ed4a0; }
|
| 273 |
+
|
| 274 |
+
.r-field { margin-bottom: 16px; }
|
| 275 |
+
.r-field-label {
|
| 276 |
+
font-family: var(--mono); font-size: .58rem;
|
| 277 |
+
letter-spacing: .12em; text-transform: uppercase; color: #4a4a48;
|
| 278 |
+
margin-bottom: 5px;
|
| 279 |
+
}
|
| 280 |
+
.r-field-value { font-family: var(--mono); font-size: .78rem; color: #c0bbb2; line-height: 1.6; }
|
| 281 |
+
.sev-dots { display: flex; gap: 5px; margin-top: 4px; }
|
| 282 |
+
.sd { width: 9px; height: 9px; border-radius: 50%; background: #2a2a28; }
|
| 283 |
+
.sd.on { background: #d47e7e; }
|
| 284 |
+
.r-fix {
|
| 285 |
+
background: #161614; border: 1px solid #262622; border-radius: 4px;
|
| 286 |
+
padding: 14px 16px; margin-top: 6px;
|
| 287 |
+
font-family: var(--mono); font-size: .73rem; color: #7ed4a0;
|
| 288 |
+
white-space: pre-wrap; line-height: 1.65;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/* ── FEATURES ────────────────────────────────────────────── */
|
| 292 |
+
#features { background: var(--surface); }
|
| 293 |
+
.feat-grid {
|
| 294 |
+
display: grid; grid-template-columns: repeat(3, 1fr);
|
| 295 |
+
border: 1px solid var(--mid); border-radius: 6px; overflow: hidden;
|
| 296 |
+
margin-top: 48px;
|
| 297 |
+
}
|
| 298 |
+
.fc {
|
| 299 |
+
padding: 36px 30px; position: relative;
|
| 300 |
+
border-right: 1px solid var(--mid); border-bottom: 1px solid var(--mid);
|
| 301 |
+
transition: background .2s;
|
| 302 |
+
}
|
| 303 |
+
.fc:hover { background: var(--paper); }
|
| 304 |
+
.fc:nth-child(3n) { border-right: none; }
|
| 305 |
+
.fc:nth-last-child(-n+3) { border-bottom: none; }
|
| 306 |
+
.fc-num {
|
| 307 |
+
position: absolute; top: 14px; right: 18px;
|
| 308 |
+
font-family: var(--mono); font-size: .56rem; color: var(--mid);
|
| 309 |
+
}
|
| 310 |
+
.fc-icon {
|
| 311 |
+
width: 36px; height: 36px; background: var(--ink); border-radius: 3px;
|
| 312 |
+
display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
|
| 313 |
+
}
|
| 314 |
+
.fc-icon svg { width: 16px; height: 16px; }
|
| 315 |
+
.fc-title { font-size: .95rem; font-weight: 700; margin-bottom: 9px; }
|
| 316 |
+
.fc-desc { font-size: .88rem; line-height: 1.65; color: var(--dim); }
|
| 317 |
+
|
| 318 |
+
/* ── API TABLE ───────────────────────────────────────────── */
|
| 319 |
+
.ep-table { margin-top: 44px; width: 100%; border-collapse: collapse; }
|
| 320 |
+
.ep-table th {
|
| 321 |
+
text-align: left;
|
| 322 |
+
font-family: var(--mono); font-size: .6rem; letter-spacing: .12em;
|
| 323 |
+
text-transform: uppercase; color: var(--dim);
|
| 324 |
+
padding: 10px 16px; border-bottom: 1.5px solid var(--mid);
|
| 325 |
+
background: var(--surface);
|
| 326 |
+
}
|
| 327 |
+
.ep-table td {
|
| 328 |
+
padding: 15px 16px; border-bottom: 1px solid #ddd8d0; vertical-align: top;
|
| 329 |
+
}
|
| 330 |
+
.ep-table tr:last-child td { border-bottom: none; }
|
| 331 |
+
.ep-table tr:hover td { background: rgba(0,0,0,.018); }
|
| 332 |
+
.method {
|
| 333 |
+
display: inline-block; padding: 3px 9px; border-radius: 2px;
|
| 334 |
+
font-family: var(--mono); font-size: .62rem; font-weight: 600;
|
| 335 |
+
}
|
| 336 |
+
.mget { background: #7eb8d410; border: 1px solid #7eb8d440; color: #3a7fa0; }
|
| 337 |
+
.mpost { background: #7ed4a010; border: 1px solid #7ed4a040; color: #2a8050; }
|
| 338 |
+
.ep-route { font-family: var(--mono); font-size: .78rem; font-weight: 500; color: var(--ink); }
|
| 339 |
+
.ep-desc { font-size: .9rem; color: var(--dim); }
|
| 340 |
+
.ep-param { font-family: var(--mono); font-size: .68rem; color: var(--dim); }
|
| 341 |
+
|
| 342 |
+
/* ── TRAINING ────────────────────────────────────────────── */
|
| 343 |
+
.train-layout {
|
| 344 |
+
display: grid; grid-template-columns: 1fr 1.5fr;
|
| 345 |
+
gap: 56px; align-items: start; margin-top: 48px;
|
| 346 |
+
}
|
| 347 |
+
.ctrl-label {
|
| 348 |
+
font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
|
| 349 |
+
text-transform: uppercase; color: #666; display: block; margin-bottom: 10px;
|
| 350 |
+
}
|
| 351 |
+
.ep-display {
|
| 352 |
+
font-family: var(--serif); font-size: 3.4rem; font-weight: 900;
|
| 353 |
+
letter-spacing: -.04em; line-height: 1; margin-bottom: 12px;
|
| 354 |
+
}
|
| 355 |
+
input[type=range] { width: 100%; accent-color: var(--paper); }
|
| 356 |
+
.train-btn {
|
| 357 |
+
display: block; width: 100%; margin-top: 20px;
|
| 358 |
+
background: var(--paper); color: var(--ink);
|
| 359 |
+
font-family: var(--sans); font-size: .75rem; font-weight: 700;
|
| 360 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 361 |
+
border: none; padding: 14px; border-radius: 2px; cursor: pointer;
|
| 362 |
+
transition: background .2s, transform .15s;
|
| 363 |
+
}
|
| 364 |
+
.train-btn:hover { background: #ddd8d0; transform: translateY(-1px); }
|
| 365 |
+
.train-status { margin-top: 12px; font-family: var(--mono); font-size: .68rem; color: #555; min-height: 20px; }
|
| 366 |
+
|
| 367 |
+
.rew-card { border: 1px solid #262622; border-radius: 6px; overflow: hidden; }
|
| 368 |
+
.rew-head {
|
| 369 |
+
padding: 14px 20px; background: #161614; border-bottom: 1px solid #262622;
|
| 370 |
+
font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
|
| 371 |
+
text-transform: uppercase; color: #666;
|
| 372 |
+
}
|
| 373 |
+
.rew-list { padding: 4px 0; }
|
| 374 |
+
.rew-row {
|
| 375 |
+
display: flex; justify-content: space-between; align-items: center;
|
| 376 |
+
padding: 12px 20px;
|
| 377 |
+
font-family: var(--mono); font-size: .75rem; color: #888;
|
| 378 |
+
border-bottom: 1px solid #1c1c1a;
|
| 379 |
+
}
|
| 380 |
+
.rew-row:last-child { border-bottom: none; }
|
| 381 |
+
.rv { font-weight: 500; }
|
| 382 |
+
.rv.pos { color: #7ed4a0; }
|
| 383 |
+
.rv.neg { color: #d47e7e; }
|
| 384 |
+
|
| 385 |
+
/* ── FOOTER ──────────────────────────────────────────────── */
|
| 386 |
+
footer {
|
| 387 |
+
background: var(--ink); border-top: 1px solid #1c1c1a;
|
| 388 |
+
padding: 44px 56px 32px;
|
| 389 |
+
}
|
| 390 |
+
.footer-inner {
|
| 391 |
+
max-width: 1160px; margin: 0 auto;
|
| 392 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 393 |
+
}
|
| 394 |
+
.f-logo { font-family: var(--serif); font-size: 1.4rem; font-weight: 900; color: var(--paper); letter-spacing: -.02em; }
|
| 395 |
+
.f-copy { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: #4a4a48; }
|
| 396 |
+
.f-links { display: flex; gap: 24px; list-style: none; }
|
| 397 |
+
.f-links a { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: #4a4a48; transition: color .2s; }
|
| 398 |
+
.f-links a:hover { color: var(--mid); }
|
| 399 |
+
|
| 400 |
+
/* ── ANIMATIONS ──────────────────────────────────────────── */
|
| 401 |
+
@keyframes fadeUp {
|
| 402 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 403 |
+
to { opacity: 1; transform: translateY(0); }
|
| 404 |
+
}
|
| 405 |
+
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .65s ease, transform .65s ease; }
|
| 406 |
+
.reveal.v { opacity: 1; transform: none; }
|
| 407 |
+
|
| 408 |
+
/* ── SCROLLBAR ───────────────────────────────────────────── */
|
| 409 |
+
::-webkit-scrollbar { width: 4px; }
|
| 410 |
+
::-webkit-scrollbar-thumb { background: var(--mid); border-radius: 2px; }
|
| 411 |
+
|
| 412 |
+
/* ── RESPONSIVE ──────────────────────────────────────────── */
|
| 413 |
+
@media (max-width: 860px) {
|
| 414 |
+
nav { padding: 16px 24px; }
|
| 415 |
+
.nav-links { display: none; }
|
| 416 |
+
section { padding: 72px 24px; }
|
| 417 |
+
#hero { padding: 120px 24px 64px; }
|
| 418 |
+
.hero-inner { grid-template-columns: 1fr; gap: 40px; }
|
| 419 |
+
.hero-stats { flex-wrap: wrap; gap: 28px; }
|
| 420 |
+
.review-grid { grid-template-columns: 1fr; }
|
| 421 |
+
.feat-grid { grid-template-columns: 1fr; }
|
| 422 |
+
.fc { border-right: none; }
|
| 423 |
+
.train-layout { grid-template-columns: 1fr; }
|
| 424 |
+
.footer-inner { flex-direction: column; gap: 20px; text-align: center; }
|
| 425 |
+
.f-links { display: none; }
|
| 426 |
+
}
|
| 427 |
+
</style>
|
| 428 |
+
</head>
|
| 429 |
+
<body>
|
| 430 |
+
|
| 431 |
+
<!-- ── NAV ──────────────────────────────────────────────── -->
|
| 432 |
+
<nav>
|
| 433 |
+
<div class="nav-logo">CodeBug<sup>β</sup></div>
|
| 434 |
+
<ul class="nav-links">
|
| 435 |
+
<li><a href="#review">Review</a></li>
|
| 436 |
+
<li><a href="#features">Features</a></li>
|
| 437 |
+
<li><a href="#api">API</a></li>
|
| 438 |
+
<li><a href="#train">Training</a></li>
|
| 439 |
+
</ul>
|
| 440 |
+
<button class="nav-cta" onclick="scroll2('review')">Try Now ↗</button>
|
| 441 |
+
</nav>
|
| 442 |
+
|
| 443 |
+
<!-- ── HERO ─────────────────────────────────────────────── -->
|
| 444 |
+
<section id="hero">
|
| 445 |
+
<div class="hero-inner">
|
| 446 |
+
|
| 447 |
+
<div>
|
| 448 |
+
<div class="hero-eyebrow">AI-Powered Code Review</div>
|
| 449 |
+
<h1 class="hero-headline">Bugs Found.<br><em>Before They</em><br>Ship.</h1>
|
| 450 |
+
<p class="hero-sub">CodeBug combines Claude + GPT-4o to catch security flaws, logic errors, and style issues — with a reinforcement-learning grader that improves over time.</p>
|
| 451 |
+
<div class="hero-btns">
|
| 452 |
+
<button class="btn-primary" onclick="scroll2('review')">Review Code ↗</button>
|
| 453 |
+
<button class="btn-secondary" onclick="scroll2('api')">View API</button>
|
| 454 |
+
</div>
|
| 455 |
+
</div>
|
| 456 |
+
|
| 457 |
+
<div class="hero-terminal">
|
| 458 |
+
<div class="t-bar">
|
| 459 |
+
<div class="t-dot"></div>
|
| 460 |
+
<div class="t-dot"></div>
|
| 461 |
+
<div class="t-dot"></div>
|
| 462 |
+
<span class="t-lbl">codebug — review</span>
|
| 463 |
+
</div>
|
| 464 |
+
<div class="t-body">
|
| 465 |
+
<span class="tc"># POST /api/review</span>
|
| 466 |
+
<span class="tc">──────────────────────</span>
|
| 467 |
+
<span class="tk">language</span> <span class="ts">"python"</span>
|
| 468 |
+
<span class="tk">analyzing</span> <span class="tc">get_user.py …</span>
|
| 469 |
+
|
| 470 |
+
<span class="tk">type</span> <span class="te">bug</span><span class="tbadge err">security</span>
|
| 471 |
+
<span class="tk">severity</span> <span class="te">5 / 5</span>
|
| 472 |
+
<span class="tk">line</span> <span class="tn">14</span>
|
| 473 |
+
<span class="tk">comment</span> SQL injection via
|
| 474 |
+
f-string interpolation
|
| 475 |
+
|
| 476 |
+
<span class="tk">fix</span>
|
| 477 |
+
<span class="ts">cursor.execute(</span>
|
| 478 |
+
<span class="ts"> "SELECT * FROM users</span>
|
| 479 |
+
<span class="ts"> WHERE id = ?", (uid,))</span>
|
| 480 |
+
|
| 481 |
+
<span class="tk">reward</span> <span class="tg">+43</span><span class="tbadge ok">correct</span>
|
| 482 |
+
<span class="blink">█</span>
|
| 483 |
+
</div>
|
| 484 |
+
</div>
|
| 485 |
+
|
| 486 |
+
<div class="hero-stats">
|
| 487 |
+
<div><div class="stat-num">15+</div><div class="stat-lbl">Bug Patterns</div></div>
|
| 488 |
+
<div><div class="stat-num">3</div><div class="stat-lbl">Languages</div></div>
|
| 489 |
+
<div><div class="stat-num">2</div><div class="stat-lbl">LLM Backends</div></div>
|
| 490 |
+
<div><div class="stat-num">RL</div><div class="stat-lbl">Self-Improving</div></div>
|
| 491 |
+
</div>
|
| 492 |
+
</div>
|
| 493 |
+
</section>
|
| 494 |
+
|
| 495 |
+
<hr class="divider" />
|
| 496 |
+
|
| 497 |
+
<!-- ── LIVE REVIEW ───────────────────────────────────────── -->
|
| 498 |
+
<section id="review" class="dark">
|
| 499 |
+
<div class="si">
|
| 500 |
+
<div class="s-eyebrow">Live Demo</div>
|
| 501 |
+
<h2 class="s-title">Review Your Code.</h2>
|
| 502 |
+
<p class="s-body">Paste any snippet. CodeBug calls <code style="font-family:var(--mono)">POST /api/review</code> and returns a structured result — type, severity, comment, and a fix snippet.</p>
|
| 503 |
+
|
| 504 |
+
<div class="review-grid reveal">
|
| 505 |
+
<!-- input panel -->
|
| 506 |
+
<div class="panel">
|
| 507 |
+
<div class="panel-head">
|
| 508 |
+
<span class="panel-label">Input</span>
|
| 509 |
+
<span class="panel-meta">max 5 000 chars</span>
|
| 510 |
+
</div>
|
| 511 |
+
<textarea id="codeInput" placeholder="# Paste your code here…
|
| 512 |
+
# e.g.:
|
| 513 |
+
def get_user(uid):
|
| 514 |
+
q = f"SELECT * FROM users WHERE id={uid}"
|
| 515 |
+
cursor.execute(q)
|
| 516 |
+
return cursor.fetchone()"></textarea>
|
| 517 |
+
<div class="panel-footer">
|
| 518 |
+
<select class="lang-sel" id="langSel">
|
| 519 |
+
<option value="python">Python</option>
|
| 520 |
+
<option value="javascript">JavaScript</option>
|
| 521 |
+
<option value="java">Java</option>
|
| 522 |
+
</select>
|
| 523 |
+
<button class="run-btn" id="runBtn" onclick="doReview()">
|
| 524 |
+
<span id="runLbl">Analyze ↗</span>
|
| 525 |
+
</button>
|
| 526 |
+
</div>
|
| 527 |
+
</div>
|
| 528 |
+
|
| 529 |
+
<!-- output panel -->
|
| 530 |
+
<div class="panel">
|
| 531 |
+
<div class="panel-head">
|
| 532 |
+
<span class="panel-label">Result</span>
|
| 533 |
+
<span class="panel-meta" id="rTs"></span>
|
| 534 |
+
</div>
|
| 535 |
+
<div class="result-body">
|
| 536 |
+
<div class="r-empty" id="rEmpty">
|
| 537 |
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#333" stroke-width="1.2">
|
| 538 |
+
<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/>
|
| 539 |
+
</svg>
|
| 540 |
+
<p>Awaiting analysis…</p>
|
| 541 |
+
</div>
|
| 542 |
+
<div class="r-loading" id="rLoading">
|
| 543 |
+
<div class="spinner"></div>
|
| 544 |
+
<span class="spinner-lbl">Calling Claude API…</span>
|
| 545 |
+
</div>
|
| 546 |
+
<div class="r-card" id="rCard">
|
| 547 |
+
<div id="rBadge" class="r-badge"></div>
|
| 548 |
+
<div class="r-field">
|
| 549 |
+
<div class="r-field-label">Category</div>
|
| 550 |
+
<div class="r-field-value" id="rCat">—</div>
|
| 551 |
+
</div>
|
| 552 |
+
<div class="r-field">
|
| 553 |
+
<div class="r-field-label">Severity</div>
|
| 554 |
+
<div class="sev-dots" id="rSev"></div>
|
| 555 |
+
</div>
|
| 556 |
+
<div class="r-field">
|
| 557 |
+
<div class="r-field-label">Line Hint</div>
|
| 558 |
+
<div class="r-field-value" id="rLine">—</div>
|
| 559 |
+
</div>
|
| 560 |
+
<div class="r-field">
|
| 561 |
+
<div class="r-field-label">Comment</div>
|
| 562 |
+
<div class="r-field-value" id="rComment">—</div>
|
| 563 |
+
</div>
|
| 564 |
+
<div class="r-field">
|
| 565 |
+
<div class="r-field-label">Suggested Fix</div>
|
| 566 |
+
<pre class="r-fix" id="rFix"></pre>
|
| 567 |
+
</div>
|
| 568 |
+
</div>
|
| 569 |
+
</div>
|
| 570 |
+
</div>
|
| 571 |
+
</div>
|
| 572 |
+
</div>
|
| 573 |
+
</section>
|
| 574 |
+
|
| 575 |
+
<!-- ── FEATURES ─────────────────────────────────────────── -->
|
| 576 |
+
<section id="features">
|
| 577 |
+
<div class="si">
|
| 578 |
+
<div class="s-eyebrow">Capabilities</div>
|
| 579 |
+
<h2 class="s-title">Every Layer,<br>Covered.</h2>
|
| 580 |
+
<div class="feat-grid reveal">
|
| 581 |
+
|
| 582 |
+
<div class="fc">
|
| 583 |
+
<span class="fc-num">01</span>
|
| 584 |
+
<div class="fc-icon">
|
| 585 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 586 |
+
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
|
| 587 |
+
</svg>
|
| 588 |
+
</div>
|
| 589 |
+
<div class="fc-title">Security Detection</div>
|
| 590 |
+
<p class="fc-desc">Catches SQL injection, hardcoded secrets, and plain-text passwords — each severity-scored from 1 to 5.</p>
|
| 591 |
+
</div>
|
| 592 |
+
|
| 593 |
+
<div class="fc">
|
| 594 |
+
<span class="fc-num">02</span>
|
| 595 |
+
<div class="fc-icon">
|
| 596 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 597 |
+
<circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3"/>
|
| 598 |
+
</svg>
|
| 599 |
+
</div>
|
| 600 |
+
<div class="fc-title">Logic Analysis</div>
|
| 601 |
+
<p class="fc-desc">Off-by-one errors, wrong comparisons, missing null checks, and divide-by-zero traps across all supported languages.</p>
|
| 602 |
+
</div>
|
| 603 |
+
|
| 604 |
+
<div class="fc">
|
| 605 |
+
<span class="fc-num">03</span>
|
| 606 |
+
<div class="fc-icon">
|
| 607 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 608 |
+
<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>
|
| 609 |
+
</svg>
|
| 610 |
+
</div>
|
| 611 |
+
<div class="fc-title">Multi-Language</div>
|
| 612 |
+
<p class="fc-desc">Python, JavaScript, and Java — each with language-idiomatic bug patterns in the bug bank.</p>
|
| 613 |
+
</div>
|
| 614 |
+
|
| 615 |
+
<div class="fc">
|
| 616 |
+
<span class="fc-num">04</span>
|
| 617 |
+
<div class="fc-icon">
|
| 618 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 619 |
+
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
|
| 620 |
+
</svg>
|
| 621 |
+
</div>
|
| 622 |
+
<div class="fc-title">Dual LLM Fallback</div>
|
| 623 |
+
<p class="fc-desc">Claude Haiku runs first. Any exception silently falls back to GPT-4o-mini with no disruption to the API response.</p>
|
| 624 |
+
</div>
|
| 625 |
+
|
| 626 |
+
<div class="fc">
|
| 627 |
+
<span class="fc-num">05</span>
|
| 628 |
+
<div class="fc-icon">
|
| 629 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 630 |
+
<line x1="18" y1="20" x2="18" y2="10"/>
|
| 631 |
+
<line x1="12" y1="20" x2="12" y2="4"/>
|
| 632 |
+
<line x1="6" y1="20" x2="6" y2="14"/>
|
| 633 |
+
</svg>
|
| 634 |
+
</div>
|
| 635 |
+
<div class="fc-title">RL Reward Grading</div>
|
| 636 |
+
<p class="fc-desc">Every review earns a reward score. +25 for critical security catches, −25 for missed criticals. The model learns.</p>
|
| 637 |
+
</div>
|
| 638 |
+
|
| 639 |
+
<div class="fc">
|
| 640 |
+
<span class="fc-num">06</span>
|
| 641 |
+
<div class="fc-icon">
|
| 642 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 643 |
+
<ellipse cx="12" cy="5" rx="9" ry="3"/>
|
| 644 |
+
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
|
| 645 |
+
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
|
| 646 |
+
</svg>
|
| 647 |
+
</div>
|
| 648 |
+
<div class="fc-title">Review History</div>
|
| 649 |
+
<p class="fc-desc">All reviews and training runs stored in SQLite. Query via /api/history and /api/stats endpoints.</p>
|
| 650 |
+
</div>
|
| 651 |
+
|
| 652 |
+
</div>
|
| 653 |
+
</div>
|
| 654 |
+
</section>
|
| 655 |
+
|
| 656 |
+
<!-- ── API REFERENCE ─────────────────────────────────────── -->
|
| 657 |
+
<section id="api">
|
| 658 |
+
<div class="si">
|
| 659 |
+
<div class="s-eyebrow">REST API</div>
|
| 660 |
+
<h2 class="s-title">Five Endpoints.<br>Zero Config.</h2>
|
| 661 |
+
<p class="s-body">Rate-limited to 20 req/min per IP. All responses are JSON. Start the server with <code style="font-family:var(--mono)">python app.py</code>.</p>
|
| 662 |
+
|
| 663 |
+
<table class="ep-table reveal">
|
| 664 |
+
<thead>
|
| 665 |
+
<tr>
|
| 666 |
+
<th>Method</th>
|
| 667 |
+
<th>Route</th>
|
| 668 |
+
<th>Description</th>
|
| 669 |
+
<th>Params</th>
|
| 670 |
+
</tr>
|
| 671 |
+
</thead>
|
| 672 |
+
<tbody>
|
| 673 |
+
<tr>
|
| 674 |
+
<td><span class="method mpost">POST</span></td>
|
| 675 |
+
<td class="ep-route">/api/review</td>
|
| 676 |
+
<td class="ep-desc">Submit code for AI review. Returns type, category, severity, comment, and fix snippet.</td>
|
| 677 |
+
<td class="ep-param">code, language?</td>
|
| 678 |
+
</tr>
|
| 679 |
+
<tr>
|
| 680 |
+
<td><span class="method mpost">POST</span></td>
|
| 681 |
+
<td class="ep-route">/api/train</td>
|
| 682 |
+
<td class="ep-desc">Run N RL training episodes. Auto-saves checkpoint. Returns full stats dict.</td>
|
| 683 |
+
<td class="ep-param">episodes? (≤ 100)</td>
|
| 684 |
+
</tr>
|
| 685 |
+
<tr>
|
| 686 |
+
<td><span class="method mget">GET</span></td>
|
| 687 |
+
<td class="ep-route">/api/history</td>
|
| 688 |
+
<td class="ep-desc">Returns paginated list of past reviews from the SQLite database.</td>
|
| 689 |
+
<td class="ep-param">limit? (≤ 200)</td>
|
| 690 |
+
</tr>
|
| 691 |
+
<tr>
|
| 692 |
+
<td><span class="method mget">GET</span></td>
|
| 693 |
+
<td class="ep-route">/api/stats</td>
|
| 694 |
+
<td class="ep-desc">Aggregate stats: training runs, review counts, average reward, top bug categories.</td>
|
| 695 |
+
<td class="ep-param">—</td>
|
| 696 |
+
</tr>
|
| 697 |
+
<tr>
|
| 698 |
+
<td><span class="method mget">GET</span></td>
|
| 699 |
+
<td class="ep-route">/api/health</td>
|
| 700 |
+
<td class="ep-desc">Health check. Returns model name and DB connection status.</td>
|
| 701 |
+
<td class="ep-param">—</td>
|
| 702 |
+
</tr>
|
| 703 |
+
</tbody>
|
| 704 |
+
</table>
|
| 705 |
+
</div>
|
| 706 |
+
</section>
|
| 707 |
+
|
| 708 |
+
<!-- ── TRAINING ──────────────────────────────────────────── -->
|
| 709 |
+
<section id="train" class="dark">
|
| 710 |
+
<div class="si">
|
| 711 |
+
<div class="s-eyebrow">Reinforcement Learning</div>
|
| 712 |
+
<h2 class="s-title">Train the<br>Reviewer.</h2>
|
| 713 |
+
<p class="s-body">Run RL episodes against the bug bank. The grader rewards precision and penalises misses. Checkpoints auto-save and are fully resumable.</p>
|
| 714 |
+
|
| 715 |
+
<div class="train-layout reveal">
|
| 716 |
+
<div>
|
| 717 |
+
<label class="ctrl-label">Episodes to run</label>
|
| 718 |
+
<div class="ep-display" id="epDisplay">20</div>
|
| 719 |
+
<input type="range" min="1" max="100" value="20" id="epRange"
|
| 720 |
+
oninput="document.getElementById('epDisplay').textContent = this.value" />
|
| 721 |
+
<button class="train-btn" onclick="doTrain()">Run Training ↗</button>
|
| 722 |
+
<div class="train-status" id="trainStatus"></div>
|
| 723 |
+
</div>
|
| 724 |
+
|
| 725 |
+
<div class="rew-card">
|
| 726 |
+
<div class="rew-head">Reward Schedule</div>
|
| 727 |
+
<div class="rew-list">
|
| 728 |
+
<div class="rew-row"><span>Correct — Security</span> <span class="rv pos">+25</span></div>
|
| 729 |
+
<div class="rew-row"><span>Correct — Logic</span> <span class="rv pos">+15</span></div>
|
| 730 |
+
<div class="rew-row"><span>Correct — Other</span> <span class="rv pos">+10</span></div>
|
| 731 |
+
<div class="rew-row"><span>Correct — Approve</span> <span class="rv pos">+5</span></div>
|
| 732 |
+
<div class="rew-row"><span>Severity exact match</span><span class="rv pos">+5</span></div>
|
| 733 |
+
<div class="rew-row"><span>Detailed comment</span> <span class="rv pos">+5</span></div>
|
| 734 |
+
<div class="rew-row"><span>Non-empty fix field</span> <span class="rv pos">+3</span></div>
|
| 735 |
+
<div class="rew-row"><span>Line hint provided</span> <span class="rv pos">+3</span></div>
|
| 736 |
+
<div class="rew-row"><span>False positive</span> <span class="rv neg">−10</span></div>
|
| 737 |
+
<div class="rew-row"><span>Missed critical bug</span> <span class="rv neg">−25</span></div>
|
| 738 |
+
<div class="rew-row"><span>Missed high severity</span><span class="rv neg">−20</span></div>
|
| 739 |
+
</div>
|
| 740 |
+
</div>
|
| 741 |
+
</div>
|
| 742 |
+
</div>
|
| 743 |
+
</section>
|
| 744 |
+
|
| 745 |
+
<!-- ── FOOTER ────────────────────────────────────────────── -->
|
| 746 |
+
<footer>
|
| 747 |
+
<div class="footer-inner">
|
| 748 |
+
<div class="f-logo">CodeBug</div>
|
| 749 |
+
<span class="f-copy">© 2025 — Flask · Claude · SQLite</span>
|
| 750 |
+
<ul class="f-links">
|
| 751 |
+
<li><a href="#review">Review</a></li>
|
| 752 |
+
<li><a href="#api">API</a></li>
|
| 753 |
+
<li><a href="#train">Train</a></li>
|
| 754 |
+
</ul>
|
| 755 |
+
</div>
|
| 756 |
+
</footer>
|
| 757 |
+
|
| 758 |
+
<script>
|
| 759 |
+
/* scroll helper */
|
| 760 |
+
function scroll2(id) {
|
| 761 |
+
document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
+
/* reveal on scroll */
|
| 765 |
+
const revealObs = new IntersectionObserver(entries => {
|
| 766 |
+
entries.forEach(e => {
|
| 767 |
+
if (e.isIntersecting) { e.target.classList.add('v'); revealObs.unobserve(e.target); }
|
| 768 |
+
});
|
| 769 |
+
}, { threshold: 0.1 });
|
| 770 |
+
document.querySelectorAll('.reveal').forEach(el => revealObs.observe(el));
|
| 771 |
+
|
| 772 |
+
/* ── REVIEW ─────────────────────────────────────────────── */
|
| 773 |
+
async function doReview() {
|
| 774 |
+
const code = document.getElementById('codeInput').value.trim();
|
| 775 |
+
const lang = document.getElementById('langSel').value;
|
| 776 |
+
const btn = document.getElementById('runBtn');
|
| 777 |
+
|
| 778 |
+
if (!code) { showFlash('Paste some code first.'); return; }
|
| 779 |
+
if (code.length > 5000) { showFlash('Code exceeds 5 000 characters.'); return; }
|
| 780 |
+
|
| 781 |
+
btn.disabled = true;
|
| 782 |
+
document.getElementById('runLbl').textContent = 'Analyzing…';
|
| 783 |
+
document.getElementById('rEmpty').style.display = 'none';
|
| 784 |
+
document.getElementById('rCard').classList.remove('on');
|
| 785 |
+
document.getElementById('rLoading').classList.add('on');
|
| 786 |
+
|
| 787 |
+
try {
|
| 788 |
+
const res = await fetch('/api/review', {
|
| 789 |
+
method: 'POST',
|
| 790 |
+
headers: { 'Content-Type': 'application/json' },
|
| 791 |
+
body: JSON.stringify({ code, language: lang })
|
| 792 |
+
});
|
| 793 |
+
const data = await res.json();
|
| 794 |
+
if (!res.ok) throw new Error(data.error || 'API error');
|
| 795 |
+
renderResult(data);
|
| 796 |
+
} catch {
|
| 797 |
+
renderResult(mockReview(code));
|
| 798 |
+
} finally {
|
| 799 |
+
btn.disabled = false;
|
| 800 |
+
document.getElementById('runLbl').textContent = 'Analyze ↗';
|
| 801 |
+
document.getElementById('rLoading').classList.remove('on');
|
| 802 |
+
}
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
function mockReview(code) {
|
| 806 |
+
if (/f["'].*?(select|insert|delete|update)/i.test(code))
|
| 807 |
+
return { type:'bug', category:'security', severity:5, line_hint:3,
|
| 808 |
+
comment:'SQL injection via f-string interpolation. User input flows directly into the query string.',
|
| 809 |
+
fix:'cursor.execute("SELECT * FROM users WHERE id = ?", (uid,))' };
|
| 810 |
+
if (/password\s*=\s*["']/.test(code))
|
| 811 |
+
return { type:'bug', category:'security', severity:5, line_hint:2,
|
| 812 |
+
comment:'Plain-text password storage detected. Use bcrypt or a similar hashing library.',
|
| 813 |
+
fix:'pw_hash = bcrypt.hashpw(password.encode(), bcrypt.gensalt())' };
|
| 814 |
+
if (/api_key\s*=\s*["']|secret\s*=\s*["']|token\s*=\s*["']/.test(code))
|
| 815 |
+
return { type:'bug', category:'security', severity:4, line_hint:1,
|
| 816 |
+
comment:'Hardcoded secret detected. Move sensitive values to environment variables.',
|
| 817 |
+
fix:'api_key = os.getenv("API_KEY")' };
|
| 818 |
+
if (/range\s*\(\s*len\s*\(.*?\)\s*-\s*1\s*\)/.test(code))
|
| 819 |
+
return { type:'bug', category:'logic', severity:3, line_hint:2,
|
| 820 |
+
comment:'Off-by-one: range(len(x) - 1) skips the last element.',
|
| 821 |
+
fix:'for i in range(len(items)):' };
|
| 822 |
+
return { type:'approve', category:'style', severity:1, line_hint:null,
|
| 823 |
+
comment:'No obvious bugs detected. Code looks clean.', fix:'' };
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
function renderResult(d) {
|
| 827 |
+
const badgeCls = d.category === 'security' ? 'sec'
|
| 828 |
+
: d.category === 'logic' ? 'lgc'
|
| 829 |
+
: d.type === 'approve' ? 'apr' : 'sty';
|
| 830 |
+
const badge = document.getElementById('rBadge');
|
| 831 |
+
badge.className = 'r-badge ' + badgeCls;
|
| 832 |
+
badge.textContent = d.type === 'approve' ? '✓ Approved' : '⚠ ' + (d.category || d.type);
|
| 833 |
+
|
| 834 |
+
document.getElementById('rCat').textContent = d.category || d.type || '—';
|
| 835 |
+
document.getElementById('rLine').textContent = d.line_hint ? 'Line ' + d.line_hint : 'Not specified';
|
| 836 |
+
document.getElementById('rComment').textContent = d.comment || '—';
|
| 837 |
+
document.getElementById('rFix').textContent = d.fix || (d.type === 'approve' ? '(no fix required)' : '—');
|
| 838 |
+
|
| 839 |
+
const dotsEl = document.getElementById('rSev');
|
| 840 |
+
dotsEl.innerHTML = '';
|
| 841 |
+
for (let i = 1; i <= 5; i++) {
|
| 842 |
+
const dot = document.createElement('div');
|
| 843 |
+
dot.className = 'sd' + (i <= (d.severity || 0) ? ' on' : '');
|
| 844 |
+
dotsEl.appendChild(dot);
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
document.getElementById('rTs').textContent = new Date().toLocaleTimeString();
|
| 848 |
+
document.getElementById('rCard').classList.add('on');
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
function showFlash(msg) {
|
| 852 |
+
const el = document.getElementById('rEmpty');
|
| 853 |
+
el.style.display = 'flex';
|
| 854 |
+
el.innerHTML = `
|
| 855 |
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d47e7e" stroke-width="1.4">
|
| 856 |
+
<circle cx="12" cy="12" r="10"/>
|
| 857 |
+
<line x1="12" y1="8" x2="12" y2="12"/>
|
| 858 |
+
<line x1="12" y1="16" x2="12.01" y2="16"/>
|
| 859 |
+
</svg>
|
| 860 |
+
<p style="color:#d47e7e">${msg}</p>`;
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
/* ── TRAINING ───────────────────────────────────────────── */
|
| 864 |
+
async function doTrain() {
|
| 865 |
+
const ep = parseInt(document.getElementById('epRange').value);
|
| 866 |
+
const btn = document.querySelector('.train-btn');
|
| 867 |
+
const st = document.getElementById('trainStatus');
|
| 868 |
+
|
| 869 |
+
btn.disabled = true;
|
| 870 |
+
btn.textContent = 'Running…';
|
| 871 |
+
st.textContent = `Starting ${ep} episodes…`;
|
| 872 |
+
st.style.color = '#555';
|
| 873 |
+
|
| 874 |
+
try {
|
| 875 |
+
const res = await fetch('/api/train', {
|
| 876 |
+
method: 'POST',
|
| 877 |
+
headers: { 'Content-Type': 'application/json' },
|
| 878 |
+
body: JSON.stringify({ episodes: ep })
|
| 879 |
+
});
|
| 880 |
+
const data = await res.json();
|
| 881 |
+
if (!res.ok) throw new Error(data.error);
|
| 882 |
+
st.textContent = `✓ Done — reward: ${(data.total_reward || 0).toFixed(1)}, accuracy: ${((data.accuracy || 0) * 100).toFixed(0)}%`;
|
| 883 |
+
st.style.color = '#7ed4a0';
|
| 884 |
+
} catch {
|
| 885 |
+
st.textContent = 'Connect Flask backend to run real training.';
|
| 886 |
+
st.style.color = '#555';
|
| 887 |
+
} finally {
|
| 888 |
+
btn.disabled = false;
|
| 889 |
+
btn.textContent = 'Run Training ↗';
|
| 890 |
+
}
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
/* Cmd/Ctrl+Enter to run review */
|
| 894 |
+
document.addEventListener('keydown', e => {
|
| 895 |
+
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') doReview();
|
| 896 |
+
});
|
| 897 |
+
</script>
|
| 898 |
+
</body>
|
| 899 |
+
</html>
|
templates/index.html
CHANGED
|
@@ -1,478 +1,903 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
</div>
|
| 127 |
-
<
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
</div>
|
| 133 |
-
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
<div class="
|
| 138 |
-
|
| 139 |
-
|
| 140 |
</div>
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
<
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
</div>
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
<div style="text-align:right; margin-top:1rem;">
|
| 153 |
-
<button class="btn-primary" onclick="analyseText()">Analyse Paste</button>
|
| 154 |
</div>
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
<!-- Comparison Panel (Feature 2) -->
|
| 159 |
-
<div id="comparison-panel" class="comparison-panel">
|
| 160 |
-
<div class="card-header">
|
| 161 |
-
<span>Before vs After Training Comparison</span>
|
| 162 |
-
<button class="btn-outline" style="padding:4px 12px; font-size:10px" onclick="document.getElementById('comparison-panel').style.display='none'">Close</button>
|
| 163 |
-
</div>
|
| 164 |
-
<div class="comp-grid">
|
| 165 |
-
<div class="comp-inner untrained">
|
| 166 |
-
<div class="card-header" style="color:var(--error); margin-bottom:0.5rem;">❌ Untrained AI</div>
|
| 167 |
-
<div class="line-hint" style="margin-bottom:1rem;">Standard Baseline Model</div>
|
| 168 |
-
<div class="code-container" style="max-height:180px; font-size:0.7rem;" id="comp-code-untrained"></div>
|
| 169 |
-
<div style="font-size:1.5rem; font-weight:800; text-align:center; color:var(--error); margin-top:1rem;" id="comp-score-untrained">-25</div>
|
| 170 |
-
<div style="text-align:center; font-size:0.7rem; font-weight:700; color:var(--error);">MISSED BUG</div>
|
| 171 |
</div>
|
| 172 |
-
<div
|
| 173 |
-
|
| 174 |
-
|
| 175 |
</div>
|
| 176 |
-
<div class="
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
<div class="code-container" style="max-height:180px; font-size:0.7rem;" id="comp-code-trained"></div>
|
| 180 |
-
<div style="font-size:1.5rem; font-weight:800; text-align:center; color:var(--success); margin-top:1rem;" id="comp-score-trained">+38</div>
|
| 181 |
-
<div style="text-align:center; font-size:0.7rem; font-weight:700; color:var(--success);">BUG CAUGHT</div>
|
| 182 |
</div>
|
|
|
|
| 183 |
</div>
|
|
|
|
| 184 |
</div>
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
<
|
| 200 |
-
|
| 201 |
-
<div id="verdict-ui" class="line-hint">No review performed yet.</div>
|
| 202 |
-
</div>
|
| 203 |
-
|
| 204 |
-
<!-- Fix Panel (Feature 4) -->
|
| 205 |
-
<div id="fix-panel" class="fix-panel card">
|
| 206 |
-
<div class="card-header">
|
| 207 |
-
<span style="color:var(--primary)">🔧 SUGGESTED FIX</span>
|
| 208 |
-
<button class="btn-outline" style="padding:4px 10px; font-size:10px;" onclick="copyFix()">Copy Fix</button>
|
| 209 |
-
</div>
|
| 210 |
-
<div id="fix-changes" style="margin: 0.5rem 0;"></div>
|
| 211 |
-
<div id="fix-expl" class="line-hint" style="font-style:italic; margin-bottom:1rem;"></div>
|
| 212 |
-
<div class="diff-grid">
|
| 213 |
-
<div class="diff-box diff-before">
|
| 214 |
-
<div class="card-header" style="color:#ef4444; margin-bottom:5px;">BUGGY</div>
|
| 215 |
-
<div id="diff-before-view"></div>
|
| 216 |
-
</div>
|
| 217 |
-
<div class="diff-box diff-after">
|
| 218 |
-
<div class="card-header" style="color:#10b981; margin-bottom:5px;">FIXED</div>
|
| 219 |
-
<div id="diff-after-view"></div>
|
| 220 |
-
</div>
|
| 221 |
-
</div>
|
| 222 |
-
</div>
|
| 223 |
</div>
|
| 224 |
-
|
| 225 |
-
<
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
<div id="progress" style="width:0%; height:100%; background:var(--primary); transition:0.3s;"></div>
|
| 235 |
-
</div>
|
| 236 |
-
<div class="line-hint" style="text-align:right; margin-top:5px;" id="count-ui">Episode 0 of 50</div>
|
| 237 |
-
|
| 238 |
-
<div class="card-header" style="margin-top:2rem;">Ground Truth Breakdown</div>
|
| 239 |
-
<div id="breakdown-ui" class="line-hint">Ready for analysis.</div>
|
| 240 |
-
|
| 241 |
-
<div style="display:flex; flex-direction:column; gap:0.75rem; margin-top:auto;">
|
| 242 |
-
<button class="btn-primary" style="padding:1.25rem;" onclick="runEpisode()">Review Next Episode</button>
|
| 243 |
-
<div style="display:grid; grid-template-columns:1fr 1fr; gap:0.75rem;">
|
| 244 |
-
<button class="btn-outline" onclick="autoRun(5)">Auto x5</button>
|
| 245 |
-
<button class="btn-outline" onclick="loadComparison()">Compare AI</button>
|
| 246 |
-
</div>
|
| 247 |
-
<button class="btn-outline" style="width:100%; border:none; color:#94a3b8;" onclick="resetDemo()">Reset Session</button>
|
| 248 |
-
</div>
|
| 249 |
-
</div>
|
| 250 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
const c = Math.floor(p * (e - s) + s);
|
| 436 |
-
o.innerText = (c >= 0 ? '+' : '') + c;
|
| 437 |
-
if(p < 1) requestAnimationFrame(step);
|
| 438 |
-
};
|
| 439 |
-
requestAnimationFrame(step);
|
| 440 |
-
}
|
| 441 |
-
function setupDND() {
|
| 442 |
-
const dz = document.getElementById('drop-zone');
|
| 443 |
-
dz.ondragover = e => { e.preventDefault(); dz.style.background = "rgba(124,58,237,0.06)"; };
|
| 444 |
-
dz.ondragleave = () => dz.style.background = "rgba(124,58,237,0.02)";
|
| 445 |
-
dz.ondrop = async e => {
|
| 446 |
-
e.preventDefault(); dz.style.background = "rgba(124,58,237,0.02)";
|
| 447 |
-
const f = e.dataTransfer.files[0];
|
| 448 |
-
const fd = new FormData(); fd.append('file', f);
|
| 449 |
-
const res = await (await fetch('/api/upload', { method: 'POST', body: fd })).json();
|
| 450 |
-
processResponse(res, res.code);
|
| 451 |
-
};
|
| 452 |
-
}
|
| 453 |
-
function switchTab(t) {
|
| 454 |
-
document.getElementById('upload-content').style.display = t === 'upload' ? 'block' : 'none';
|
| 455 |
-
document.getElementById('paste-content').style.display = t === 'paste' ? 'block' : 'none';
|
| 456 |
-
document.getElementById('tab-up').style.color = t === 'upload' ? 'var(--primary)' : 'var(--text-muted)';
|
| 457 |
-
document.getElementById('tab-up').style.borderBottom = t === 'upload' ? '3px solid var(--primary)' : 'none';
|
| 458 |
-
document.getElementById('tab-pt').style.color = t === 'paste' ? 'var(--primary)' : 'var(--text-muted)';
|
| 459 |
-
document.getElementById('tab-pt').style.borderBottom = t === 'paste' ? '3px solid var(--primary)' : 'none';
|
| 460 |
-
}
|
| 461 |
-
async function analyseText() {
|
| 462 |
-
const code = document.getElementById('paste-area').value;
|
| 463 |
-
const res = await (await fetch('/api/review-text', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ code }) })).json();
|
| 464 |
-
processResponse(res, code);
|
| 465 |
-
}
|
| 466 |
-
async function autoRun(count) {
|
| 467 |
-
await fetch('/api/auto-run', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ count }) });
|
| 468 |
-
const iv = setInterval(async () => {
|
| 469 |
-
const s = await (await fetch('/api/history')).json();
|
| 470 |
-
updateStats();
|
| 471 |
-
if(!s.is_running) clearInterval(iv);
|
| 472 |
-
}, 1000);
|
| 473 |
-
}
|
| 474 |
-
function resetDemo() { fetch('/api/reset').then(() => updateStats()); }
|
| 475 |
-
function copyFix() { navigator.clipboard.writeText(window.lastFix); alert('Copied!'); }
|
| 476 |
-
</script>
|
| 477 |
</body>
|
| 478 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>CodeBug — AI Code Review</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=DM+Mono:wght@400;500&family=Syne:wght@400;600;700;800&display=swap" rel="stylesheet" />
|
| 8 |
+
<style>
|
| 9 |
+
/* ── TOKENS ─────────────────────────────────────────────── */
|
| 10 |
+
:root {
|
| 11 |
+
--ink: #0e0e0c;
|
| 12 |
+
--paper: #f2efe8;
|
| 13 |
+
--surface:#e8e4dc;
|
| 14 |
+
--mid: #b8b3aa;
|
| 15 |
+
--dim: #7a756c;
|
| 16 |
+
--mono: 'DM Mono', monospace;
|
| 17 |
+
--serif: 'Playfair Display', serif;
|
| 18 |
+
--sans: 'Syne', sans-serif;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/* ── RESET ──────────────────────────────────────────────── */
|
| 22 |
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
| 23 |
+
html { scroll-behavior: smooth; }
|
| 24 |
+
body {
|
| 25 |
+
background: var(--paper);
|
| 26 |
+
color: var(--ink);
|
| 27 |
+
font-family: var(--sans);
|
| 28 |
+
overflow-x: hidden;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* subtle grain — opacity kept very low so it doesn't fight text */
|
| 32 |
+
body::before {
|
| 33 |
+
content: '';
|
| 34 |
+
position: fixed; inset: 0; z-index: 9000;
|
| 35 |
+
pointer-events: none;
|
| 36 |
+
opacity: .09;
|
| 37 |
+
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
| 38 |
+
background-size: 200px 200px;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* ── NAV ─────────────────────────────────────────────────── */
|
| 42 |
+
nav {
|
| 43 |
+
position: fixed; top: 0; left: 0; right: 0; z-index: 500;
|
| 44 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 45 |
+
padding: 20px 56px;
|
| 46 |
+
border-bottom: 1px solid rgba(14,14,12,.08);
|
| 47 |
+
backdrop-filter: blur(14px);
|
| 48 |
+
background: rgba(242,239,232,.92);
|
| 49 |
+
}
|
| 50 |
+
.nav-logo {
|
| 51 |
+
font-family: var(--serif);
|
| 52 |
+
font-size: 1.25rem; font-weight: 900; letter-spacing: -.02em;
|
| 53 |
+
display: flex; align-items: center; gap: 8px;
|
| 54 |
+
}
|
| 55 |
+
.nav-logo sup {
|
| 56 |
+
font-family: var(--mono); font-size: .5rem;
|
| 57 |
+
background: var(--ink); color: var(--paper);
|
| 58 |
+
padding: 2px 6px; border-radius: 2px; letter-spacing: .06em;
|
| 59 |
+
vertical-align: super;
|
| 60 |
+
}
|
| 61 |
+
.nav-links { display: flex; gap: 36px; list-style: none; }
|
| 62 |
+
.nav-links a {
|
| 63 |
+
font-size: .72rem; font-weight: 600;
|
| 64 |
+
letter-spacing: .1em; text-transform: uppercase;
|
| 65 |
+
text-decoration: none; color: var(--dim);
|
| 66 |
+
transition: color .2s;
|
| 67 |
+
}
|
| 68 |
+
.nav-links a:hover { color: var(--ink); }
|
| 69 |
+
.nav-cta {
|
| 70 |
+
background: var(--ink); color: var(--paper);
|
| 71 |
+
font-family: var(--sans); font-size: .72rem; font-weight: 700;
|
| 72 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 73 |
+
border: none; padding: 10px 24px; border-radius: 2px; cursor: pointer;
|
| 74 |
+
transition: background .2s, transform .15s;
|
| 75 |
+
}
|
| 76 |
+
.nav-cta:hover { background: #2a2a28; transform: translateY(-1px); }
|
| 77 |
+
|
| 78 |
+
/* ── HERO ────────────────────────────────────────────────── */
|
| 79 |
+
#hero {
|
| 80 |
+
min-height: 100vh;
|
| 81 |
+
display: grid; align-items: center;
|
| 82 |
+
padding: 140px 56px 80px;
|
| 83 |
+
}
|
| 84 |
+
.hero-inner {
|
| 85 |
+
max-width: 1160px; margin: 0 auto; width: 100%;
|
| 86 |
+
display: grid; grid-template-columns: 1fr 1fr;
|
| 87 |
+
gap: 72px; align-items: center;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.hero-eyebrow {
|
| 91 |
+
font-family: var(--mono); font-size: .65rem;
|
| 92 |
+
letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
|
| 93 |
+
display: flex; align-items: center; gap: 10px;
|
| 94 |
+
margin-bottom: 24px;
|
| 95 |
+
animation: fadeUp .7s ease both;
|
| 96 |
+
}
|
| 97 |
+
.hero-eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--mid); }
|
| 98 |
+
|
| 99 |
+
.hero-headline {
|
| 100 |
+
font-family: var(--serif);
|
| 101 |
+
font-size: clamp(3rem, 5.2vw, 5.4rem);
|
| 102 |
+
font-weight: 900; line-height: .96; letter-spacing: -.03em;
|
| 103 |
+
margin-bottom: 24px;
|
| 104 |
+
animation: fadeUp .7s .08s ease both;
|
| 105 |
+
}
|
| 106 |
+
.hero-headline em { font-style: italic; color: var(--dim); }
|
| 107 |
+
|
| 108 |
+
.hero-sub {
|
| 109 |
+
font-size: 1rem; line-height: 1.7; color: var(--dim);
|
| 110 |
+
max-width: 380px; margin-bottom: 40px;
|
| 111 |
+
animation: fadeUp .7s .16s ease both;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.hero-btns { display: flex; gap: 12px; animation: fadeUp .7s .24s ease both; }
|
| 115 |
+
.btn-primary {
|
| 116 |
+
background: var(--ink); color: var(--paper);
|
| 117 |
+
font-family: var(--sans); font-size: .75rem; font-weight: 700;
|
| 118 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 119 |
+
border: none; padding: 13px 28px; border-radius: 2px; cursor: pointer;
|
| 120 |
+
transition: background .2s, transform .15s;
|
| 121 |
+
}
|
| 122 |
+
.btn-primary:hover { background: #2a2a28; transform: translateY(-2px); }
|
| 123 |
+
.btn-secondary {
|
| 124 |
+
background: transparent; color: var(--ink);
|
| 125 |
+
font-family: var(--sans); font-size: .75rem; font-weight: 600;
|
| 126 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 127 |
+
border: 1.5px solid var(--mid); padding: 13px 28px; border-radius: 2px; cursor: pointer;
|
| 128 |
+
transition: border-color .2s, transform .15s;
|
| 129 |
+
}
|
| 130 |
+
.btn-secondary:hover { border-color: var(--ink); transform: translateY(-2px); }
|
| 131 |
+
|
| 132 |
+
/* terminal card */
|
| 133 |
+
.hero-terminal {
|
| 134 |
+
background: var(--ink); border-radius: 8px; overflow: hidden;
|
| 135 |
+
box-shadow: 0 32px 64px rgba(0,0,0,.16);
|
| 136 |
+
animation: fadeUp .7s .1s ease both;
|
| 137 |
+
}
|
| 138 |
+
.t-bar {
|
| 139 |
+
background: #181816; padding: 13px 18px;
|
| 140 |
+
display: flex; align-items: center; gap: 7px;
|
| 141 |
+
}
|
| 142 |
+
.t-dot { width: 10px; height: 10px; border-radius: 50%; }
|
| 143 |
+
.t-dot:nth-child(1) { background: #ff5f57; }
|
| 144 |
+
.t-dot:nth-child(2) { background: #febc2e; }
|
| 145 |
+
.t-dot:nth-child(3) { background: #28c840; }
|
| 146 |
+
.t-lbl { margin-left: auto; font-family: var(--mono); font-size: .6rem; color: #4a4a48; letter-spacing: .08em; }
|
| 147 |
+
.t-body { padding: 24px 22px; font-family: var(--mono); font-size: .75rem; line-height: 1.85; color: #b0aba2; }
|
| 148 |
+
.tc { color: #484840; }
|
| 149 |
+
.tk { color: #7eb8d4; }
|
| 150 |
+
.ts { color: #b8d47e; }
|
| 151 |
+
.tn { color: #d4b47e; }
|
| 152 |
+
.te { color: #d47e7e; }
|
| 153 |
+
.tg { color: #7ed4a0; }
|
| 154 |
+
.tbadge {
|
| 155 |
+
display: inline-block; padding: 2px 8px; border-radius: 2px;
|
| 156 |
+
font-size: .58rem; margin-left: 8px;
|
| 157 |
+
}
|
| 158 |
+
.tbadge.err { background: #d47e7e14; border: 1px solid #d47e7e40; color: #d47e7e; }
|
| 159 |
+
.tbadge.ok { background: #7ed4a014; border: 1px solid #7ed4a040; color: #7ed4a0; }
|
| 160 |
+
.blink { animation: blink 1.1s step-end infinite; }
|
| 161 |
+
@keyframes blink { 50% { opacity: 0; } }
|
| 162 |
+
|
| 163 |
+
/* hero stats */
|
| 164 |
+
.hero-stats {
|
| 165 |
+
grid-column: 1 / -1;
|
| 166 |
+
display: flex; gap: 52px;
|
| 167 |
+
border-top: 1px solid var(--mid); padding-top: 36px;
|
| 168 |
+
animation: fadeUp .7s .3s ease both;
|
| 169 |
+
}
|
| 170 |
+
.stat-num { font-family: var(--serif); font-size: 2.2rem; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
|
| 171 |
+
.stat-lbl { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-top: 5px; }
|
| 172 |
+
|
| 173 |
+
/* ── DIVIDER LINE ────────────────────────────────────────── */
|
| 174 |
+
.divider {
|
| 175 |
+
border: none; border-top: 1px solid var(--mid);
|
| 176 |
+
margin: 0;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/* ── SECTIONS ─────────────────────���──────────────────────── */
|
| 180 |
+
section { padding: 96px 56px; }
|
| 181 |
+
.si { max-width: 1160px; margin: 0 auto; }
|
| 182 |
+
|
| 183 |
+
/* section header */
|
| 184 |
+
.s-eyebrow {
|
| 185 |
+
font-family: var(--mono); font-size: .62rem;
|
| 186 |
+
letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
|
| 187 |
+
display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
|
| 188 |
+
}
|
| 189 |
+
.s-eyebrow::before { content: ''; width: 18px; height: 1px; background: var(--mid); }
|
| 190 |
+
.s-title {
|
| 191 |
+
font-family: var(--serif);
|
| 192 |
+
font-size: clamp(2rem, 3.6vw, 3.2rem);
|
| 193 |
+
font-weight: 900; line-height: 1.05; letter-spacing: -.025em;
|
| 194 |
+
margin-bottom: 16px;
|
| 195 |
+
}
|
| 196 |
+
.s-body {
|
| 197 |
+
font-size: .95rem; line-height: 1.72; color: var(--dim);
|
| 198 |
+
max-width: 540px;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/* dark section overrides */
|
| 202 |
+
.dark { background: var(--ink); color: var(--paper); }
|
| 203 |
+
.dark .s-eyebrow { color: #666; }
|
| 204 |
+
.dark .s-eyebrow::before { background: #333; }
|
| 205 |
+
.dark .s-title { color: var(--paper); }
|
| 206 |
+
.dark .s-body { color: #999; }
|
| 207 |
+
|
| 208 |
+
/* ── REVIEW SECTION ──────────────────────────────────────── */
|
| 209 |
+
.review-grid {
|
| 210 |
+
display: grid; grid-template-columns: 1fr 1fr;
|
| 211 |
+
gap: 24px; margin-top: 48px;
|
| 212 |
+
}
|
| 213 |
+
.panel { border: 1px solid #262622; border-radius: 6px; overflow: hidden; }
|
| 214 |
+
.panel-head {
|
| 215 |
+
padding: 12px 20px; background: #161614;
|
| 216 |
+
border-bottom: 1px solid #262622;
|
| 217 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 218 |
+
}
|
| 219 |
+
.panel-label { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: #666; }
|
| 220 |
+
.panel-meta { font-family: var(--mono); font-size: .6rem; color: #3e3e3a; }
|
| 221 |
+
|
| 222 |
+
textarea#codeInput {
|
| 223 |
+
display: block; width: 100%; height: 260px;
|
| 224 |
+
background: transparent; border: none; outline: none; resize: none;
|
| 225 |
+
font-family: var(--mono); font-size: .78rem; line-height: 1.7;
|
| 226 |
+
color: #c8c3ba; caret-color: #7eb8d4;
|
| 227 |
+
padding: 20px;
|
| 228 |
+
}
|
| 229 |
+
.panel-footer {
|
| 230 |
+
display: flex; gap: 10px; align-items: center;
|
| 231 |
+
padding: 12px 20px; border-top: 1px solid #262622;
|
| 232 |
+
}
|
| 233 |
+
.lang-sel {
|
| 234 |
+
background: #1a1a18; border: 1px solid #303030; border-radius: 2px;
|
| 235 |
+
color: #999; font-family: var(--mono); font-size: .68rem;
|
| 236 |
+
padding: 7px 12px; cursor: pointer; outline: none;
|
| 237 |
+
}
|
| 238 |
+
.run-btn {
|
| 239 |
+
margin-left: auto; background: var(--paper); color: var(--ink);
|
| 240 |
+
font-family: var(--sans); font-size: .72rem; font-weight: 700;
|
| 241 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 242 |
+
border: none; padding: 9px 22px; border-radius: 2px; cursor: pointer;
|
| 243 |
+
transition: background .2s, transform .15s;
|
| 244 |
+
}
|
| 245 |
+
.run-btn:hover { background: #ddd8d0; transform: translateY(-1px); }
|
| 246 |
+
.run-btn:disabled { opacity: .5; pointer-events: none; }
|
| 247 |
+
|
| 248 |
+
/* result area */
|
| 249 |
+
.result-body { padding: 20px; min-height: 316px; position: relative; }
|
| 250 |
+
.r-empty {
|
| 251 |
+
display: flex; flex-direction: column; align-items: center;
|
| 252 |
+
justify-content: center; height: 276px; gap: 10px; color: #333;
|
| 253 |
+
}
|
| 254 |
+
.r-empty p { font-family: var(--mono); font-size: .65rem; color: #3e3e3a; }
|
| 255 |
+
.r-loading { display: none; flex-direction: column; align-items: center; justify-content: center; height: 276px; gap: 16px; }
|
| 256 |
+
.r-loading.on { display: flex; }
|
| 257 |
+
.spinner { width: 20px; height: 20px; border: 2px solid #2a2a28; border-top-color: #888; border-radius: 50%; animation: spin .8s linear infinite; }
|
| 258 |
+
.spinner-lbl { font-family: var(--mono); font-size: .65rem; color: #555; }
|
| 259 |
+
@keyframes spin { to { transform: rotate(360deg); } }
|
| 260 |
+
.r-card { display: none; }
|
| 261 |
+
.r-card.on { display: block; }
|
| 262 |
+
|
| 263 |
+
.r-badge {
|
| 264 |
+
display: inline-flex; align-items: center; gap: 6px;
|
| 265 |
+
padding: 4px 12px; border-radius: 2px; margin-bottom: 20px;
|
| 266 |
+
font-family: var(--mono); font-size: .62rem; font-weight: 600;
|
| 267 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 268 |
+
}
|
| 269 |
+
.r-badge.sec { background: #d47e7e14; border: 1px solid #d47e7e40; color: #d47e7e; }
|
| 270 |
+
.r-badge.lgc { background: #d4c27e14; border: 1px solid #d4c27e40; color: #d4c27e; }
|
| 271 |
+
.r-badge.sty { background: #7eb8d414; border: 1px solid #7eb8d440; color: #7eb8d4; }
|
| 272 |
+
.r-badge.apr { background: #7ed4a014; border: 1px solid #7ed4a040; color: #7ed4a0; }
|
| 273 |
+
|
| 274 |
+
.r-field { margin-bottom: 16px; }
|
| 275 |
+
.r-field-label {
|
| 276 |
+
font-family: var(--mono); font-size: .58rem;
|
| 277 |
+
letter-spacing: .12em; text-transform: uppercase; color: #4a4a48;
|
| 278 |
+
margin-bottom: 5px;
|
| 279 |
+
}
|
| 280 |
+
.r-field-value { font-family: var(--mono); font-size: .78rem; color: #c0bbb2; line-height: 1.6; }
|
| 281 |
+
.sev-dots { display: flex; gap: 5px; margin-top: 4px; }
|
| 282 |
+
.sd { width: 9px; height: 9px; border-radius: 50%; background: #2a2a28; }
|
| 283 |
+
.sd.on { background: #d47e7e; }
|
| 284 |
+
.r-fix {
|
| 285 |
+
background: #161614; border: 1px solid #262622; border-radius: 4px;
|
| 286 |
+
padding: 14px 16px; margin-top: 6px;
|
| 287 |
+
font-family: var(--mono); font-size: .73rem; color: #7ed4a0;
|
| 288 |
+
white-space: pre-wrap; line-height: 1.65;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/* ── FEATURES ────────────────────────────────────────────── */
|
| 292 |
+
#features { background: var(--surface); }
|
| 293 |
+
.feat-grid {
|
| 294 |
+
display: grid; grid-template-columns: repeat(3, 1fr);
|
| 295 |
+
border: 1px solid var(--mid); border-radius: 6px; overflow: hidden;
|
| 296 |
+
margin-top: 48px;
|
| 297 |
+
}
|
| 298 |
+
.fc {
|
| 299 |
+
padding: 36px 30px; position: relative;
|
| 300 |
+
border-right: 1px solid var(--mid); border-bottom: 1px solid var(--mid);
|
| 301 |
+
transition: background .2s;
|
| 302 |
+
}
|
| 303 |
+
.fc:hover { background: var(--paper); }
|
| 304 |
+
.fc:nth-child(3n) { border-right: none; }
|
| 305 |
+
.fc:nth-last-child(-n+3) { border-bottom: none; }
|
| 306 |
+
.fc-num {
|
| 307 |
+
position: absolute; top: 14px; right: 18px;
|
| 308 |
+
font-family: var(--mono); font-size: .56rem; color: var(--mid);
|
| 309 |
+
}
|
| 310 |
+
.fc-icon {
|
| 311 |
+
width: 36px; height: 36px; background: var(--ink); border-radius: 3px;
|
| 312 |
+
display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
|
| 313 |
+
}
|
| 314 |
+
.fc-icon svg { width: 16px; height: 16px; }
|
| 315 |
+
.fc-title { font-size: .95rem; font-weight: 700; margin-bottom: 9px; }
|
| 316 |
+
.fc-desc { font-size: .88rem; line-height: 1.65; color: var(--dim); }
|
| 317 |
+
|
| 318 |
+
/* ── API TABLE ───────────────────────────────────────────── */
|
| 319 |
+
.ep-table { margin-top: 44px; width: 100%; border-collapse: collapse; }
|
| 320 |
+
.ep-table th {
|
| 321 |
+
text-align: left;
|
| 322 |
+
font-family: var(--mono); font-size: .6rem; letter-spacing: .12em;
|
| 323 |
+
text-transform: uppercase; color: var(--dim);
|
| 324 |
+
padding: 10px 16px; border-bottom: 1.5px solid var(--mid);
|
| 325 |
+
background: var(--surface);
|
| 326 |
+
}
|
| 327 |
+
.ep-table td {
|
| 328 |
+
padding: 15px 16px; border-bottom: 1px solid #ddd8d0; vertical-align: top;
|
| 329 |
+
}
|
| 330 |
+
.ep-table tr:last-child td { border-bottom: none; }
|
| 331 |
+
.ep-table tr:hover td { background: rgba(0,0,0,.018); }
|
| 332 |
+
.method {
|
| 333 |
+
display: inline-block; padding: 3px 9px; border-radius: 2px;
|
| 334 |
+
font-family: var(--mono); font-size: .62rem; font-weight: 600;
|
| 335 |
+
}
|
| 336 |
+
.mget { background: #7eb8d410; border: 1px solid #7eb8d440; color: #3a7fa0; }
|
| 337 |
+
.mpost { background: #7ed4a010; border: 1px solid #7ed4a040; color: #2a8050; }
|
| 338 |
+
.ep-route { font-family: var(--mono); font-size: .78rem; font-weight: 500; color: var(--ink); }
|
| 339 |
+
.ep-desc { font-size: .9rem; color: var(--dim); }
|
| 340 |
+
.ep-param { font-family: var(--mono); font-size: .68rem; color: var(--dim); }
|
| 341 |
+
|
| 342 |
+
/* ── TRAINING ────────────────────────────────────────────── */
|
| 343 |
+
.train-layout {
|
| 344 |
+
display: grid; grid-template-columns: 1fr 1.5fr;
|
| 345 |
+
gap: 56px; align-items: start; margin-top: 48px;
|
| 346 |
+
}
|
| 347 |
+
.ctrl-label {
|
| 348 |
+
font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
|
| 349 |
+
text-transform: uppercase; color: #666; display: block; margin-bottom: 10px;
|
| 350 |
+
}
|
| 351 |
+
.ep-display {
|
| 352 |
+
font-family: var(--serif); font-size: 3.4rem; font-weight: 900;
|
| 353 |
+
letter-spacing: -.04em; line-height: 1; margin-bottom: 12px;
|
| 354 |
+
}
|
| 355 |
+
input[type=range] { width: 100%; accent-color: var(--paper); }
|
| 356 |
+
.train-btn {
|
| 357 |
+
display: block; width: 100%; margin-top: 20px;
|
| 358 |
+
background: var(--paper); color: var(--ink);
|
| 359 |
+
font-family: var(--sans); font-size: .75rem; font-weight: 700;
|
| 360 |
+
letter-spacing: .08em; text-transform: uppercase;
|
| 361 |
+
border: none; padding: 14px; border-radius: 2px; cursor: pointer;
|
| 362 |
+
transition: background .2s, transform .15s;
|
| 363 |
+
}
|
| 364 |
+
.train-btn:hover { background: #ddd8d0; transform: translateY(-1px); }
|
| 365 |
+
.train-status { margin-top: 12px; font-family: var(--mono); font-size: .68rem; color: #555; min-height: 20px; }
|
| 366 |
+
|
| 367 |
+
.rew-card { border: 1px solid #262622; border-radius: 6px; overflow: hidden; }
|
| 368 |
+
.rew-head {
|
| 369 |
+
padding: 14px 20px; background: #161614; border-bottom: 1px solid #262622;
|
| 370 |
+
font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
|
| 371 |
+
text-transform: uppercase; color: #666;
|
| 372 |
+
}
|
| 373 |
+
.rew-list { padding: 4px 0; }
|
| 374 |
+
.rew-row {
|
| 375 |
+
display: flex; justify-content: space-between; align-items: center;
|
| 376 |
+
padding: 12px 20px;
|
| 377 |
+
font-family: var(--mono); font-size: .75rem; color: #888;
|
| 378 |
+
border-bottom: 1px solid #1c1c1a;
|
| 379 |
+
}
|
| 380 |
+
.rew-row:last-child { border-bottom: none; }
|
| 381 |
+
.rv { font-weight: 500; }
|
| 382 |
+
.rv.pos { color: #7ed4a0; }
|
| 383 |
+
.rv.neg { color: #d47e7e; }
|
| 384 |
+
|
| 385 |
+
/* ── FOOTER ──────────────────────────────────────────────── */
|
| 386 |
+
footer {
|
| 387 |
+
background: var(--ink); border-top: 1px solid #1c1c1a;
|
| 388 |
+
padding: 44px 56px 32px;
|
| 389 |
+
}
|
| 390 |
+
.footer-inner {
|
| 391 |
+
max-width: 1160px; margin: 0 auto;
|
| 392 |
+
display: flex; align-items: center; justify-content: space-between;
|
| 393 |
+
}
|
| 394 |
+
.f-logo { font-family: var(--serif); font-size: 1.4rem; font-weight: 900; color: var(--paper); letter-spacing: -.02em; }
|
| 395 |
+
.f-copy { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: #4a4a48; }
|
| 396 |
+
.f-links { display: flex; gap: 24px; list-style: none; }
|
| 397 |
+
.f-links a { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: #4a4a48; transition: color .2s; }
|
| 398 |
+
.f-links a:hover { color: var(--mid); }
|
| 399 |
+
|
| 400 |
+
/* ── ANIMATIONS ──────────────────────────────────────────── */
|
| 401 |
+
@keyframes fadeUp {
|
| 402 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 403 |
+
to { opacity: 1; transform: translateY(0); }
|
| 404 |
+
}
|
| 405 |
+
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .65s ease, transform .65s ease; }
|
| 406 |
+
.reveal.v { opacity: 1; transform: none; }
|
| 407 |
+
|
| 408 |
+
/* ── SCROLLBAR ───────────────────────────────────────────── */
|
| 409 |
+
::-webkit-scrollbar { width: 4px; }
|
| 410 |
+
::-webkit-scrollbar-thumb { background: var(--mid); border-radius: 2px; }
|
| 411 |
+
|
| 412 |
+
/* ── RESPONSIVE ──────────────────────────────────────────── */
|
| 413 |
+
@media (max-width: 860px) {
|
| 414 |
+
nav { padding: 16px 24px; }
|
| 415 |
+
.nav-links { display: none; }
|
| 416 |
+
section { padding: 72px 24px; }
|
| 417 |
+
#hero { padding: 120px 24px 64px; }
|
| 418 |
+
.hero-inner { grid-template-columns: 1fr; gap: 40px; }
|
| 419 |
+
.hero-stats { flex-wrap: wrap; gap: 28px; }
|
| 420 |
+
.review-grid { grid-template-columns: 1fr; }
|
| 421 |
+
.feat-grid { grid-template-columns: 1fr; }
|
| 422 |
+
.fc { border-right: none; }
|
| 423 |
+
.train-layout { grid-template-columns: 1fr; }
|
| 424 |
+
.footer-inner { flex-direction: column; gap: 20px; text-align: center; }
|
| 425 |
+
.f-links { display: none; }
|
| 426 |
+
}
|
| 427 |
+
</style>
|
| 428 |
</head>
|
| 429 |
<body>
|
| 430 |
|
| 431 |
+
<!-- ── NAV ──────────────────────────────────────────────── -->
|
| 432 |
+
<nav>
|
| 433 |
+
<div class="nav-logo">CodeBug<sup>β</sup></div>
|
| 434 |
+
<ul class="nav-links">
|
| 435 |
+
<li><a href="#review">Review</a></li>
|
| 436 |
+
<li><a href="#features">Features</a></li>
|
| 437 |
+
<li><a href="#api">API</a></li>
|
| 438 |
+
<li><a href="#train">Training</a></li>
|
| 439 |
+
</ul>
|
| 440 |
+
<button class="nav-cta" onclick="scroll2('review')">Try Now ↗</button>
|
| 441 |
+
</nav>
|
| 442 |
+
|
| 443 |
+
<!-- ── HERO ─────────────────────────────────────────────── -->
|
| 444 |
+
<section id="hero">
|
| 445 |
+
<div class="hero-inner">
|
| 446 |
+
|
| 447 |
+
<div>
|
| 448 |
+
<div class="hero-eyebrow">AI-Powered Code Review</div>
|
| 449 |
+
<h1 class="hero-headline">Bugs Found.<br><em>Before They</em><br>Ship.</h1>
|
| 450 |
+
<p class="hero-sub">CodeBug combines Claude + GPT-4o to catch security flaws, logic errors, and style issues — with a reinforcement-learning grader that improves over time.</p>
|
| 451 |
+
<div class="hero-btns">
|
| 452 |
+
<button class="btn-primary" onclick="scroll2('review')">Review Code ↗</button>
|
| 453 |
+
<button class="btn-secondary" onclick="scroll2('api')">View API</button>
|
| 454 |
+
</div>
|
| 455 |
+
</div>
|
| 456 |
+
|
| 457 |
+
<div class="hero-terminal">
|
| 458 |
+
<div class="t-bar">
|
| 459 |
+
<div class="t-dot"></div>
|
| 460 |
+
<div class="t-dot"></div>
|
| 461 |
+
<div class="t-dot"></div>
|
| 462 |
+
<span class="t-lbl">codebug — review</span>
|
| 463 |
+
</div>
|
| 464 |
+
<div class="t-body">
|
| 465 |
+
<span class="tc"># POST /api/review</span>
|
| 466 |
+
<span class="tc">──────────────────────</span>
|
| 467 |
+
<span class="tk">language</span> <span class="ts">"python"</span>
|
| 468 |
+
<span class="tk">analyzing</span> <span class="tc">get_user.py …</span>
|
| 469 |
+
|
| 470 |
+
<span class="tk">type</span> <span class="te">bug</span><span class="tbadge err">security</span>
|
| 471 |
+
<span class="tk">severity</span> <span class="te">5 / 5</span>
|
| 472 |
+
<span class="tk">line</span> <span class="tn">14</span>
|
| 473 |
+
<span class="tk">comment</span> SQL injection via
|
| 474 |
+
f-string interpolation
|
| 475 |
+
|
| 476 |
+
<span class="tk">fix</span>
|
| 477 |
+
<span class="ts">cursor.execute(</span>
|
| 478 |
+
<span class="ts"> "SELECT * FROM users</span>
|
| 479 |
+
<span class="ts"> WHERE id = ?", (uid,))</span>
|
| 480 |
+
|
| 481 |
+
<span class="tk">reward</span> <span class="tg">+43</span><span class="tbadge ok">correct</span>
|
| 482 |
+
<span class="blink">█</span>
|
| 483 |
+
</div>
|
| 484 |
+
</div>
|
| 485 |
+
|
| 486 |
+
<div class="hero-stats">
|
| 487 |
+
<div><div class="stat-num">15+</div><div class="stat-lbl">Bug Patterns</div></div>
|
| 488 |
+
<div><div class="stat-num">3</div><div class="stat-lbl">Languages</div></div>
|
| 489 |
+
<div><div class="stat-num">2</div><div class="stat-lbl">LLM Backends</div></div>
|
| 490 |
+
<div><div class="stat-num">RL</div><div class="stat-lbl">Self-Improving</div></div>
|
| 491 |
+
</div>
|
| 492 |
+
</div>
|
| 493 |
+
</section>
|
| 494 |
+
|
| 495 |
+
<hr class="divider" />
|
| 496 |
+
|
| 497 |
+
<!-- ── LIVE REVIEW ───────────────────────────────────────── -->
|
| 498 |
+
<section id="review" class="dark">
|
| 499 |
+
<div class="si">
|
| 500 |
+
<div class="s-eyebrow">Live Demo</div>
|
| 501 |
+
<h2 class="s-title">Review Your Code.</h2>
|
| 502 |
+
<p class="s-body">Paste any snippet. CodeBug calls <code style="font-family:var(--mono)">POST /api/review</code> and returns a structured result — type, severity, comment, and a fix snippet.</p>
|
| 503 |
+
|
| 504 |
+
<div class="review-grid reveal">
|
| 505 |
+
<!-- input panel -->
|
| 506 |
+
<div class="panel">
|
| 507 |
+
<div class="panel-head">
|
| 508 |
+
<span class="panel-label">Input</span>
|
| 509 |
+
<span class="panel-meta">max 5 000 chars</span>
|
| 510 |
</div>
|
| 511 |
+
<textarea id="codeInput" placeholder="# Paste your code here…
|
| 512 |
+
# e.g.:
|
| 513 |
+
def get_user(uid):
|
| 514 |
+
q = f"SELECT * FROM users WHERE id={uid}"
|
| 515 |
+
cursor.execute(q)
|
| 516 |
+
return cursor.fetchone()"></textarea>
|
| 517 |
+
<div class="panel-footer">
|
| 518 |
+
<select class="lang-sel" id="langSel">
|
| 519 |
+
<option value="python">Python</option>
|
| 520 |
+
<option value="javascript">JavaScript</option>
|
| 521 |
+
<option value="java">Java</option>
|
| 522 |
+
</select>
|
| 523 |
+
<button class="run-btn" id="runBtn" onclick="doReview()">
|
| 524 |
+
<span id="runLbl">Analyze ↗</span>
|
| 525 |
+
</button>
|
| 526 |
</div>
|
| 527 |
+
</div>
|
| 528 |
|
| 529 |
+
<!-- output panel -->
|
| 530 |
+
<div class="panel">
|
| 531 |
+
<div class="panel-head">
|
| 532 |
+
<span class="panel-label">Result</span>
|
| 533 |
+
<span class="panel-meta" id="rTs"></span>
|
| 534 |
</div>
|
| 535 |
+
<div class="result-body">
|
| 536 |
+
<div class="r-empty" id="rEmpty">
|
| 537 |
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#333" stroke-width="1.2">
|
| 538 |
+
<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/>
|
| 539 |
+
</svg>
|
| 540 |
+
<p>Awaiting analysis…</p>
|
| 541 |
+
</div>
|
| 542 |
+
<div class="r-loading" id="rLoading">
|
| 543 |
+
<div class="spinner"></div>
|
| 544 |
+
<span class="spinner-lbl">Calling Claude API…</span>
|
| 545 |
+
</div>
|
| 546 |
+
<div class="r-card" id="rCard">
|
| 547 |
+
<div id="rBadge" class="r-badge"></div>
|
| 548 |
+
<div class="r-field">
|
| 549 |
+
<div class="r-field-label">Category</div>
|
| 550 |
+
<div class="r-field-value" id="rCat">—</div>
|
| 551 |
</div>
|
| 552 |
+
<div class="r-field">
|
| 553 |
+
<div class="r-field-label">Severity</div>
|
| 554 |
+
<div class="sev-dots" id="rSev"></div>
|
|
|
|
|
|
|
| 555 |
</div>
|
| 556 |
+
<div class="r-field">
|
| 557 |
+
<div class="r-field-label">Line Hint</div>
|
| 558 |
+
<div class="r-field-value" id="rLine">—</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
</div>
|
| 560 |
+
<div class="r-field">
|
| 561 |
+
<div class="r-field-label">Comment</div>
|
| 562 |
+
<div class="r-field-value" id="rComment">—</div>
|
| 563 |
</div>
|
| 564 |
+
<div class="r-field">
|
| 565 |
+
<div class="r-field-label">Suggested Fix</div>
|
| 566 |
+
<pre class="r-fix" id="rFix"></pre>
|
|
|
|
|
|
|
|
|
|
| 567 |
</div>
|
| 568 |
+
</div>
|
| 569 |
</div>
|
| 570 |
+
</div>
|
| 571 |
</div>
|
| 572 |
+
</div>
|
| 573 |
+
</section>
|
| 574 |
+
|
| 575 |
+
<!-- ── FEATURES ─────────────────────────────────────────── -->
|
| 576 |
+
<section id="features">
|
| 577 |
+
<div class="si">
|
| 578 |
+
<div class="s-eyebrow">Capabilities</div>
|
| 579 |
+
<h2 class="s-title">Every Layer,<br>Covered.</h2>
|
| 580 |
+
<div class="feat-grid reveal">
|
| 581 |
+
|
| 582 |
+
<div class="fc">
|
| 583 |
+
<span class="fc-num">01</span>
|
| 584 |
+
<div class="fc-icon">
|
| 585 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 586 |
+
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
|
| 587 |
+
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
</div>
|
| 589 |
+
<div class="fc-title">Security Detection</div>
|
| 590 |
+
<p class="fc-desc">Catches SQL injection, hardcoded secrets, and plain-text passwords — each severity-scored from 1 to 5.</p>
|
| 591 |
+
</div>
|
| 592 |
+
|
| 593 |
+
<div class="fc">
|
| 594 |
+
<span class="fc-num">02</span>
|
| 595 |
+
<div class="fc-icon">
|
| 596 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 597 |
+
<circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3"/>
|
| 598 |
+
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
</div>
|
| 600 |
+
<div class="fc-title">Logic Analysis</div>
|
| 601 |
+
<p class="fc-desc">Off-by-one errors, wrong comparisons, missing null checks, and divide-by-zero traps across all supported languages.</p>
|
| 602 |
+
</div>
|
| 603 |
+
|
| 604 |
+
<div class="fc">
|
| 605 |
+
<span class="fc-num">03</span>
|
| 606 |
+
<div class="fc-icon">
|
| 607 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 608 |
+
<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>
|
| 609 |
+
</svg>
|
| 610 |
+
</div>
|
| 611 |
+
<div class="fc-title">Multi-Language</div>
|
| 612 |
+
<p class="fc-desc">Python, JavaScript, and Java — each with language-idiomatic bug patterns in the bug bank.</p>
|
| 613 |
+
</div>
|
| 614 |
+
|
| 615 |
+
<div class="fc">
|
| 616 |
+
<span class="fc-num">04</span>
|
| 617 |
+
<div class="fc-icon">
|
| 618 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 619 |
+
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
|
| 620 |
+
</svg>
|
| 621 |
+
</div>
|
| 622 |
+
<div class="fc-title">Dual LLM Fallback</div>
|
| 623 |
+
<p class="fc-desc">Claude Haiku runs first. Any exception silently falls back to GPT-4o-mini with no disruption to the API response.</p>
|
| 624 |
+
</div>
|
| 625 |
+
|
| 626 |
+
<div class="fc">
|
| 627 |
+
<span class="fc-num">05</span>
|
| 628 |
+
<div class="fc-icon">
|
| 629 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 630 |
+
<line x1="18" y1="20" x2="18" y2="10"/>
|
| 631 |
+
<line x1="12" y1="20" x2="12" y2="4"/>
|
| 632 |
+
<line x1="6" y1="20" x2="6" y2="14"/>
|
| 633 |
+
</svg>
|
| 634 |
+
</div>
|
| 635 |
+
<div class="fc-title">RL Reward Grading</div>
|
| 636 |
+
<p class="fc-desc">Every review earns a reward score. +25 for critical security catches, −25 for missed criticals. The model learns.</p>
|
| 637 |
+
</div>
|
| 638 |
+
|
| 639 |
+
<div class="fc">
|
| 640 |
+
<span class="fc-num">06</span>
|
| 641 |
+
<div class="fc-icon">
|
| 642 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
|
| 643 |
+
<ellipse cx="12" cy="5" rx="9" ry="3"/>
|
| 644 |
+
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
|
| 645 |
+
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
|
| 646 |
+
</svg>
|
| 647 |
+
</div>
|
| 648 |
+
<div class="fc-title">Review History</div>
|
| 649 |
+
<p class="fc-desc">All reviews and training runs stored in SQLite. Query via /api/history and /api/stats endpoints.</p>
|
| 650 |
+
</div>
|
| 651 |
|
| 652 |
+
</div>
|
| 653 |
+
</div>
|
| 654 |
+
</section>
|
| 655 |
+
|
| 656 |
+
<!-- ── API REFERENCE ────────────────────────────��────────── -->
|
| 657 |
+
<section id="api">
|
| 658 |
+
<div class="si">
|
| 659 |
+
<div class="s-eyebrow">REST API</div>
|
| 660 |
+
<h2 class="s-title">Five Endpoints.<br>Zero Config.</h2>
|
| 661 |
+
<p class="s-body">Rate-limited to 20 req/min per IP. All responses are JSON. Start the server with <code style="font-family:var(--mono)">python app.py</code>.</p>
|
| 662 |
+
|
| 663 |
+
<table class="ep-table reveal">
|
| 664 |
+
<thead>
|
| 665 |
+
<tr>
|
| 666 |
+
<th>Method</th>
|
| 667 |
+
<th>Route</th>
|
| 668 |
+
<th>Description</th>
|
| 669 |
+
<th>Params</th>
|
| 670 |
+
</tr>
|
| 671 |
+
</thead>
|
| 672 |
+
<tbody>
|
| 673 |
+
<tr>
|
| 674 |
+
<td><span class="method mpost">POST</span></td>
|
| 675 |
+
<td class="ep-route">/api/review</td>
|
| 676 |
+
<td class="ep-desc">Submit code for AI review. Returns type, category, severity, comment, and fix snippet.</td>
|
| 677 |
+
<td class="ep-param">code, language?</td>
|
| 678 |
+
</tr>
|
| 679 |
+
<tr>
|
| 680 |
+
<td><span class="method mpost">POST</span></td>
|
| 681 |
+
<td class="ep-route">/api/train</td>
|
| 682 |
+
<td class="ep-desc">Run N RL training episodes. Auto-saves checkpoint. Returns full stats dict.</td>
|
| 683 |
+
<td class="ep-param">episodes? (≤ 100)</td>
|
| 684 |
+
</tr>
|
| 685 |
+
<tr>
|
| 686 |
+
<td><span class="method mget">GET</span></td>
|
| 687 |
+
<td class="ep-route">/api/history</td>
|
| 688 |
+
<td class="ep-desc">Returns paginated list of past reviews from the SQLite database.</td>
|
| 689 |
+
<td class="ep-param">limit? (≤ 200)</td>
|
| 690 |
+
</tr>
|
| 691 |
+
<tr>
|
| 692 |
+
<td><span class="method mget">GET</span></td>
|
| 693 |
+
<td class="ep-route">/api/stats</td>
|
| 694 |
+
<td class="ep-desc">Aggregate stats: training runs, review counts, average reward, top bug categories.</td>
|
| 695 |
+
<td class="ep-param">—</td>
|
| 696 |
+
</tr>
|
| 697 |
+
<tr>
|
| 698 |
+
<td><span class="method mget">GET</span></td>
|
| 699 |
+
<td class="ep-route">/api/health</td>
|
| 700 |
+
<td class="ep-desc">Health check. Returns model name and DB connection status.</td>
|
| 701 |
+
<td class="ep-param">—</td>
|
| 702 |
+
</tr>
|
| 703 |
+
</tbody>
|
| 704 |
+
</table>
|
| 705 |
+
</div>
|
| 706 |
+
</section>
|
| 707 |
+
|
| 708 |
+
<!-- ── TRAINING ──────────────────────────────────────────── -->
|
| 709 |
+
<section id="train" class="dark">
|
| 710 |
+
<div class="si">
|
| 711 |
+
<div class="s-eyebrow">Reinforcement Learning</div>
|
| 712 |
+
<h2 class="s-title">Train the<br>Reviewer.</h2>
|
| 713 |
+
<p class="s-body">Run RL episodes against the bug bank. The grader rewards precision and penalises misses. Checkpoints auto-save and are fully resumable.</p>
|
| 714 |
+
|
| 715 |
+
<div class="train-layout reveal">
|
| 716 |
+
<div>
|
| 717 |
+
<label class="ctrl-label">Episodes to run</label>
|
| 718 |
+
<div class="ep-display" id="epDisplay">20</div>
|
| 719 |
+
<input type="range" min="1" max="100" value="20" id="epRange"
|
| 720 |
+
oninput="document.getElementById('epDisplay').textContent = this.value" />
|
| 721 |
+
<button class="train-btn" onclick="doTrain()">Run Training ↗</button>
|
| 722 |
+
<div class="train-status" id="trainStatus"></div>
|
| 723 |
+
</div>
|
| 724 |
+
|
| 725 |
+
<div class="rew-card">
|
| 726 |
+
<div class="rew-head">Reward Schedule</div>
|
| 727 |
+
<div class="rew-list">
|
| 728 |
+
<div class="rew-row"><span>Correct — Security</span> <span class="rv pos">+25</span></div>
|
| 729 |
+
<div class="rew-row"><span>Correct — Logic</span> <span class="rv pos">+15</span></div>
|
| 730 |
+
<div class="rew-row"><span>Correct — Other</span> <span class="rv pos">+10</span></div>
|
| 731 |
+
<div class="rew-row"><span>Correct — Approve</span> <span class="rv pos">+5</span></div>
|
| 732 |
+
<div class="rew-row"><span>Severity exact match</span><span class="rv pos">+5</span></div>
|
| 733 |
+
<div class="rew-row"><span>Detailed comment</span> <span class="rv pos">+5</span></div>
|
| 734 |
+
<div class="rew-row"><span>Non-empty fix field</span> <span class="rv pos">+3</span></div>
|
| 735 |
+
<div class="rew-row"><span>Line hint provided</span> <span class="rv pos">+3</span></div>
|
| 736 |
+
<div class="rew-row"><span>False positive</span> <span class="rv neg">−10</span></div>
|
| 737 |
+
<div class="rew-row"><span>Missed critical bug</span> <span class="rv neg">−25</span></div>
|
| 738 |
+
<div class="rew-row"><span>Missed high severity</span><span class="rv neg">−20</span></div>
|
| 739 |
</div>
|
| 740 |
+
</div>
|
| 741 |
</div>
|
| 742 |
+
</div>
|
| 743 |
+
</section>
|
| 744 |
+
|
| 745 |
+
<!-- ── FOOTER ────────────────────────────────────────────── -->
|
| 746 |
+
<footer>
|
| 747 |
+
<div class="footer-inner">
|
| 748 |
+
<div class="f-logo">CodeBug</div>
|
| 749 |
+
<span class="f-copy">© 2025 — Flask · Claude · SQLite</span>
|
| 750 |
+
<ul class="f-links">
|
| 751 |
+
<li><a href="#review">Review</a></li>
|
| 752 |
+
<li><a href="#api">API</a></li>
|
| 753 |
+
<li><a href="#train">Train</a></li>
|
| 754 |
+
</ul>
|
| 755 |
+
</div>
|
| 756 |
+
</footer>
|
| 757 |
+
|
| 758 |
+
<script>
|
| 759 |
+
/* scroll helper */
|
| 760 |
+
function scroll2(id) {
|
| 761 |
+
document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
+
/* reveal on scroll */
|
| 765 |
+
const revealObs = new IntersectionObserver(entries => {
|
| 766 |
+
entries.forEach(e => {
|
| 767 |
+
if (e.isIntersecting) { e.target.classList.add('v'); revealObs.unobserve(e.target); }
|
| 768 |
+
});
|
| 769 |
+
}, { threshold: 0.1 });
|
| 770 |
+
document.querySelectorAll('.reveal').forEach(el => revealObs.observe(el));
|
| 771 |
+
|
| 772 |
+
/* ── REVIEW ─────────────────────────────────────────────── */
|
| 773 |
+
async function doReview() {
|
| 774 |
+
const code = document.getElementById('codeInput').value.trim();
|
| 775 |
+
const lang = document.getElementById('langSel').value;
|
| 776 |
+
const btn = document.getElementById('runBtn');
|
| 777 |
+
|
| 778 |
+
if (!code) { showFlash('Paste some code first.'); return; }
|
| 779 |
+
if (code.length > 5000) { showFlash('Code exceeds 5 000 characters.'); return; }
|
| 780 |
+
|
| 781 |
+
btn.disabled = true;
|
| 782 |
+
document.getElementById('runLbl').textContent = 'Analyzing…';
|
| 783 |
+
document.getElementById('rEmpty').style.display = 'none';
|
| 784 |
+
document.getElementById('rCard').classList.remove('on');
|
| 785 |
+
document.getElementById('rLoading').classList.add('on');
|
| 786 |
+
|
| 787 |
+
try {
|
| 788 |
+
const res = await fetch('/api/review', {
|
| 789 |
+
method: 'POST',
|
| 790 |
+
headers: { 'Content-Type': 'application/json' },
|
| 791 |
+
body: JSON.stringify({ code, language: lang })
|
| 792 |
+
});
|
| 793 |
+
const data = await res.json();
|
| 794 |
+
if (!res.ok) throw new Error(data.error || 'API error');
|
| 795 |
+
renderResult(data);
|
| 796 |
+
} catch {
|
| 797 |
+
renderResult(mockReview(code));
|
| 798 |
+
} finally {
|
| 799 |
+
btn.disabled = false;
|
| 800 |
+
document.getElementById('runLbl').textContent = 'Analyze ↗';
|
| 801 |
+
document.getElementById('rLoading').classList.remove('on');
|
| 802 |
+
}
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
function mockReview(code) {
|
| 806 |
+
if (/f["'].*?(select|insert|delete|update)/i.test(code))
|
| 807 |
+
return { type:'bug', category:'security', severity:5, line_hint:3,
|
| 808 |
+
comment:'SQL injection via f-string interpolation. User input flows directly into the query string.',
|
| 809 |
+
fix:'cursor.execute("SELECT * FROM users WHERE id = ?", (uid,))' };
|
| 810 |
+
if (/password\s*=\s*["']/.test(code))
|
| 811 |
+
return { type:'bug', category:'security', severity:5, line_hint:2,
|
| 812 |
+
comment:'Plain-text password storage detected. Use bcrypt or a similar hashing library.',
|
| 813 |
+
fix:'pw_hash = bcrypt.hashpw(password.encode(), bcrypt.gensalt())' };
|
| 814 |
+
if (/api_key\s*=\s*["']|secret\s*=\s*["']|token\s*=\s*["']/.test(code))
|
| 815 |
+
return { type:'bug', category:'security', severity:4, line_hint:1,
|
| 816 |
+
comment:'Hardcoded secret detected. Move sensitive values to environment variables.',
|
| 817 |
+
fix:'api_key = os.getenv("API_KEY")' };
|
| 818 |
+
if (/range\s*\(\s*len\s*\(.*?\)\s*-\s*1\s*\)/.test(code))
|
| 819 |
+
return { type:'bug', category:'logic', severity:3, line_hint:2,
|
| 820 |
+
comment:'Off-by-one: range(len(x) - 1) skips the last element.',
|
| 821 |
+
fix:'for i in range(len(items)):' };
|
| 822 |
+
return { type:'approve', category:'style', severity:1, line_hint:null,
|
| 823 |
+
comment:'No obvious bugs detected. Code looks clean.', fix:'' };
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
function renderResult(d) {
|
| 827 |
+
// If the backend wraps the result in ai_action, extract it.
|
| 828 |
+
const action = d.ai_action || d;
|
| 829 |
+
const fixString = (d.fix && d.fix.fixed_code) ? d.fix.fixed_code : action.fix;
|
| 830 |
+
|
| 831 |
+
const badgeCls = action.category === 'security' ? 'sec'
|
| 832 |
+
: action.category === 'logic' ? 'lgc'
|
| 833 |
+
: action.type === 'approve' ? 'apr' : 'sty';
|
| 834 |
+
const badge = document.getElementById('rBadge');
|
| 835 |
+
badge.className = 'r-badge ' + badgeCls;
|
| 836 |
+
badge.textContent = action.type === 'approve' ? '✓ Approved' : '⚠ ' + (action.category || action.type);
|
| 837 |
+
|
| 838 |
+
document.getElementById('rCat').textContent = action.category || action.type || '—';
|
| 839 |
+
document.getElementById('rLine').textContent = action.line_hint ? 'Line ' + action.line_hint : 'Not specified';
|
| 840 |
+
document.getElementById('rComment').textContent = action.comment || '—';
|
| 841 |
+
document.getElementById('rFix').textContent = fixString || (action.type === 'approve' ? '(no fix required)' : '—');
|
| 842 |
+
|
| 843 |
+
const dotsEl = document.getElementById('rSev');
|
| 844 |
+
dotsEl.innerHTML = '';
|
| 845 |
+
for (let i = 1; i <= 5; i++) {
|
| 846 |
+
const dot = document.createElement('div');
|
| 847 |
+
dot.className = 'sd' + (i <= (action.severity || 0) ? ' on' : '');
|
| 848 |
+
dotsEl.appendChild(dot);
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
document.getElementById('rTs').textContent = new Date().toLocaleTimeString();
|
| 852 |
+
document.getElementById('rCard').classList.add('on');
|
| 853 |
+
}
|
| 854 |
+
|
| 855 |
+
function showFlash(msg) {
|
| 856 |
+
const el = document.getElementById('rEmpty');
|
| 857 |
+
el.style.display = 'flex';
|
| 858 |
+
el.innerHTML = `
|
| 859 |
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d47e7e" stroke-width="1.4">
|
| 860 |
+
<circle cx="12" cy="12" r="10"/>
|
| 861 |
+
<line x1="12" y1="8" x2="12" y2="12"/>
|
| 862 |
+
<line x1="12" y1="16" x2="12.01" y2="16"/>
|
| 863 |
+
</svg>
|
| 864 |
+
<p style="color:#d47e7e">${msg}</p>`;
|
| 865 |
+
}
|
| 866 |
+
|
| 867 |
+
/* ── TRAINING ───────────────────────────────────────────── */
|
| 868 |
+
async function doTrain() {
|
| 869 |
+
const ep = parseInt(document.getElementById('epRange').value);
|
| 870 |
+
const btn = document.querySelector('.train-btn');
|
| 871 |
+
const st = document.getElementById('trainStatus');
|
| 872 |
+
|
| 873 |
+
btn.disabled = true;
|
| 874 |
+
btn.textContent = 'Running…';
|
| 875 |
+
st.textContent = `Starting ${ep} episodes…`;
|
| 876 |
+
st.style.color = '#555';
|
| 877 |
+
|
| 878 |
+
try {
|
| 879 |
+
const res = await fetch('/api/train', {
|
| 880 |
+
method: 'POST',
|
| 881 |
+
headers: { 'Content-Type': 'application/json' },
|
| 882 |
+
body: JSON.stringify({ episodes: ep })
|
| 883 |
+
});
|
| 884 |
+
const data = await res.json();
|
| 885 |
+
if (!res.ok) throw new Error(data.error);
|
| 886 |
+
st.textContent = `✓ Done — reward: ${(data.total_reward || 0).toFixed(1)}, accuracy: ${((data.accuracy || 0) * 100).toFixed(0)}%`;
|
| 887 |
+
st.style.color = '#7ed4a0';
|
| 888 |
+
} catch {
|
| 889 |
+
st.textContent = 'Connect Flask backend to run real training.';
|
| 890 |
+
st.style.color = '#555';
|
| 891 |
+
} finally {
|
| 892 |
+
btn.disabled = false;
|
| 893 |
+
btn.textContent = 'Run Training ↗';
|
| 894 |
+
}
|
| 895 |
+
}
|
| 896 |
+
|
| 897 |
+
/* Cmd/Ctrl+Enter to run review */
|
| 898 |
+
document.addEventListener('keydown', e => {
|
| 899 |
+
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') doReview();
|
| 900 |
+
});
|
| 901 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 902 |
</body>
|
| 903 |
</html>
|
templates/landing.html
DELETED
|
@@ -1,338 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>CodeReview AI | The RL-Powered Code Review Agent</title>
|
| 7 |
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
| 8 |
-
<style>
|
| 9 |
-
:root {
|
| 10 |
-
--primary: #7c3aed;
|
| 11 |
-
--secondary: #a78bfa;
|
| 12 |
-
--success: #10b981;
|
| 13 |
-
--bg: #ffffff;
|
| 14 |
-
--bg-accent: #f8f7ff;
|
| 15 |
-
--text: #0f172a;
|
| 16 |
-
--text-muted: #64748b;
|
| 17 |
-
--border: #e2e8f0;
|
| 18 |
-
--radius: 12px;
|
| 19 |
-
--radius-pill: 999px;
|
| 20 |
-
--shadow: 0 4px 24px rgba(124, 58, 237, 0.08);
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 24 |
-
body { font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--text); overflow-x: hidden; }
|
| 25 |
-
|
| 26 |
-
/* --- Navbar --- */
|
| 27 |
-
nav {
|
| 28 |
-
position: fixed; top: 0; left: 0; right: 0; height: 64px;
|
| 29 |
-
background: rgba(255, 255, 255, 0.85);
|
| 30 |
-
backdrop-filter: blur(12px);
|
| 31 |
-
border-bottom: 1px solid var(--border);
|
| 32 |
-
z-index: 1000;
|
| 33 |
-
display: flex; align-items: center; justify-content: center;
|
| 34 |
-
}
|
| 35 |
-
.nav-container { width: 100%; max-width: 1200px; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; }
|
| 36 |
-
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.25rem; }
|
| 37 |
-
.logo-circle { width: 24px; height: 24px; background: #000; border-radius: 50%; }
|
| 38 |
-
.logo-ai { background: #f3efff; color: var(--primary); padding: 2px 8px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 800; }
|
| 39 |
-
.nav-links { display: flex; gap: 2rem; }
|
| 40 |
-
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
|
| 41 |
-
.btn-pill { background: var(--primary); color: white; padding: 10px 24px; border-radius: var(--radius-pill); text-decoration: none; font-weight: 600; font-size: 0.9rem; transition: transform 0.2s; }
|
| 42 |
-
.btn-pill:hover { transform: scale(1.03); }
|
| 43 |
-
|
| 44 |
-
/* --- Hero --- */
|
| 45 |
-
.hero {
|
| 46 |
-
position: relative; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 47 |
-
background: radial-gradient(circle at center, rgba(124, 58, 237, 0.03) 0%, #ffffff 70%);
|
| 48 |
-
padding: 0 2rem; text-align: center;
|
| 49 |
-
}
|
| 50 |
-
.dot-grid { position: absolute; inset: 0; background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 32px 32px; opacity: 0.2; pointer-events: none; }
|
| 51 |
-
.hero-orb { position: absolute; width: 600px; height: 600px; background: linear-gradient(135deg, var(--primary), var(--secondary)); opacity: 0.12; filter: blur(80px); border-radius: 50%; animation: orbit 20s infinite linear; pointer-events: none; }
|
| 52 |
-
@keyframes orbit { from { transform: rotate(0deg) translateX(150px) rotate(0deg); } to { transform: rotate(360deg) translateX(150px) rotate(-360deg); } }
|
| 53 |
-
|
| 54 |
-
.hero-content { z-index: 10; max-width: 800px; }
|
| 55 |
-
.hero-pill { display: inline-block; background: #f3efff; color: var(--primary); padding: 4px 16px; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 700; margin-bottom: 1.5rem; }
|
| 56 |
-
h1 { font-size: 3.5rem; font-weight: 800; line-height: 1.1; margin-bottom: 1.5rem; letter-spacing: -0.03em; }
|
| 57 |
-
.purple-gradient { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
|
| 58 |
-
.hero-sub { font-size: 1.125rem; color: var(--text-muted); max-width: 500px; margin: 0 auto 2.5rem; }
|
| 59 |
-
.cta-row { display: flex; gap: 1rem; justify-content: center; }
|
| 60 |
-
.btn-hero { padding: 14px 32px; border-radius: var(--radius-pill); font-weight: 700; font-size: 1rem; text-decoration: none; transition: 0.2s; border: 1px solid transparent; }
|
| 61 |
-
.btn-primary { background: var(--primary); color: white; }
|
| 62 |
-
.btn-secondary { background: white; border-color: var(--primary); color: var(--primary); }
|
| 63 |
-
|
| 64 |
-
/* --- Floating Cards --- */
|
| 65 |
-
.float-card { position: absolute; background: white; border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); z-index: 5; animation: float 3s infinite ease-in-out; }
|
| 66 |
-
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
|
| 67 |
-
.fc-1 { top: 20%; left: 10%; animation-delay: 0s; }
|
| 68 |
-
.fc-2 { top: 15%; right: 12%; animation-delay: 1.5s; }
|
| 69 |
-
.fc-3 { bottom: 15%; left: 15%; background: var(--text); color: white; animation-delay: 0.8s; }
|
| 70 |
-
.fc-4 { bottom: 20%; right: 10%; animation-delay: 2s; }
|
| 71 |
-
.avatar-small { width: 20px; height: 20px; background: var(--primary); border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 8px; }
|
| 72 |
-
|
| 73 |
-
/* --- Sections --- */
|
| 74 |
-
section { padding: 100px 0; display: flex; flex-direction: column; align-items: center; }
|
| 75 |
-
.section-light { background: var(--bg-accent); }
|
| 76 |
-
.section-title { font-size: 2.25rem; font-weight: 800; margin-bottom: 1rem; text-align: center; }
|
| 77 |
-
.section-sub { color: var(--text-muted); text-align: center; max-width: 600px; margin-bottom: 4rem; }
|
| 78 |
-
|
| 79 |
-
/* --- Stats --- */
|
| 80 |
-
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; width: 100%; max-width: 1200px; padding: 0 2rem; }
|
| 81 |
-
.stat-card { background: white; padding: 2rem; border-radius: 16px; text-align: center; border-top: 3px solid var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
|
| 82 |
-
.stat-num { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin-bottom: 0.5rem; }
|
| 83 |
-
|
| 84 |
-
/* --- Features --- */
|
| 85 |
-
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; width: 100%; max-width: 1200px; padding: 0 2rem; }
|
| 86 |
-
.feature-card { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 2rem; transition: all 0.3s; }
|
| 87 |
-
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
|
| 88 |
-
.icon-circle { width: 44px; height: 44px; border-radius: 50%; margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: center; }
|
| 89 |
-
|
| 90 |
-
/* --- How It Works --- */
|
| 91 |
-
.how-grid { display: flex; justify-content: center; gap: 4rem; width: 100%; max-width: 1200px; position: relative; }
|
| 92 |
-
.how-grid::after { content: ''; position: absolute; top: 22px; width: 60%; height: 2px; border-top: 2px dashed var(--border); z-index: -1; }
|
| 93 |
-
.step { flex: 1; text-align: center; max-width: 300px; }
|
| 94 |
-
.step-num { width: 44px; height: 44px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 2rem; font-weight: 700; border: 4px solid white; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2); }
|
| 95 |
-
.step-preview { background: white; border: 1px solid var(--border); border-radius: 12px; height: 120px; margin-top: 1.5rem; padding: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 0.7rem; font-family: monospace; }
|
| 96 |
-
|
| 97 |
-
/* --- Mockup --- */
|
| 98 |
-
.mockup { background: white; border: 1px solid var(--border); border-radius: 20px; width: 100%; max-width: 900px; box-shadow: 0 40px 100px -20px rgba(15, 23, 42, 0.15); overflow: hidden; }
|
| 99 |
-
.mockup-header { background: #0f172a; padding: 8px 16px; display: flex; align-items: center; gap: 8px; color: white; font-size: 0.75rem; }
|
| 100 |
-
.dots { display: flex; gap: 6px; }
|
| 101 |
-
.dot { width: 10px; height: 10px; border-radius: 50%; }
|
| 102 |
-
.mockup-content { padding: 40px; background: #fcfbff; display: grid; grid-template-columns: 1fr 0.6fr 0.8fr; gap: 20px; height: 300px; }
|
| 103 |
-
|
| 104 |
-
/* --- Footer --- */
|
| 105 |
-
footer { background: #0f172a; color: white; padding: 80px 0 40px; display: flex; flex-direction: column; align-items: center; }
|
| 106 |
-
.footer-content { width: 100%; max-width: 1200px; border-bottom: 1px solid #1e293b; padding-bottom: 40px; margin-bottom: 40px; display: flex; justify-content: space-between; padding: 0 2rem; }
|
| 107 |
-
.footer-tag { color: var(--text-muted); font-size: 0.9rem; max-width: 300px; margin-top: 1rem; }
|
| 108 |
-
.footer-links { display: flex; gap: 4rem; }
|
| 109 |
-
.f-col h4 { font-size: 1rem; margin-bottom: 1.5rem; }
|
| 110 |
-
.f-col a { display: block; color: var(--text-muted); text-decoration: none; margin-bottom: 0.75rem; font-size: 0.9rem; }
|
| 111 |
-
.copy { color: #475569; font-size: 0.8rem; }
|
| 112 |
-
|
| 113 |
-
.fade-in-section { opacity: 0; transform: translateY(30px); transition: all 0.8s ease; }
|
| 114 |
-
.fade-in-section.visible { opacity: 1; transform: translateY(0); }
|
| 115 |
-
</style>
|
| 116 |
-
</head>
|
| 117 |
-
<body>
|
| 118 |
-
|
| 119 |
-
<nav>
|
| 120 |
-
<div class="nav-container">
|
| 121 |
-
<div class="logo">
|
| 122 |
-
<div class="logo-circle"></div>
|
| 123 |
-
CodeReview <span class="logo-ai">AI</span>
|
| 124 |
-
</div>
|
| 125 |
-
<div class="nav-links">
|
| 126 |
-
<a href="#">Home</a>
|
| 127 |
-
<a href="#features">Features</a>
|
| 128 |
-
<a href="#how">How It Works</a>
|
| 129 |
-
<a href="#" onclick="alert('Demo coming soon! Hit the launch button.')">Pricing</a>
|
| 130 |
-
</div>
|
| 131 |
-
<a href="/dashboard" class="btn-pill">View Dashboard →</a>
|
| 132 |
-
</div>
|
| 133 |
-
</nav>
|
| 134 |
-
|
| 135 |
-
<div class="hero">
|
| 136 |
-
<div class="dot-grid"></div>
|
| 137 |
-
<div class="hero-orb"></div>
|
| 138 |
-
|
| 139 |
-
<!-- Floating Cards -->
|
| 140 |
-
<div class="float-card fc-1">
|
| 141 |
-
<div class="avatar-small"></div> <span>ep_003</span>
|
| 142 |
-
<div style="font-size: 0.7rem; color: var(--text-muted); margin-top: 4px;">SQL Injection Found</div>
|
| 143 |
-
<div style="width: 100px; height: 4px; background: rgba(16,185,129,0.1); border-radius: 2px; margin-top: 8px;">
|
| 144 |
-
<div style="width: 80%; height: 100%; background: var(--success); border-radius: 2px;"></div>
|
| 145 |
-
</div>
|
| 146 |
-
</div>
|
| 147 |
-
<div class="float-card fc-2">
|
| 148 |
-
<span style="font-size: 0.6rem; background: #fee2e2; color: #ef4444; font-weight: 800; padding: 2px 6px; border-radius: 4px;">SECURITY</span>
|
| 149 |
-
<div style="font-size: 0.9rem; font-weight: 700; margin: 4px 0;">+38 points</div>
|
| 150 |
-
<div style="font-size: 0.7rem; color: #10b981;">Correct Catch ✓</div>
|
| 151 |
-
</div>
|
| 152 |
-
<div class="float-card fc-3">
|
| 153 |
-
<div class="avatar-small" style="background:#fff"></div> <span style="font-size:0.8rem">Trained AI</span>
|
| 154 |
-
<div style="font-size: 1.1rem; font-weight: 800; margin-top: 4px; color: var(--success);">94.2% Accurate</div>
|
| 155 |
-
</div>
|
| 156 |
-
<div class="float-card fc-4" style="width: 160px; font-family: monospace; font-size: 0.6rem;">
|
| 157 |
-
<div style="color: var(--primary); margin-bottom: 4px;">Fix Suggested:</div>
|
| 158 |
-
<div style="background: #f8fafc; padding: 8px; border-radius: 4px; border: 1px solid var(--border);">
|
| 159 |
-
<span style="color: #ef4444">- query = f"..."</span><br>
|
| 160 |
-
<span style="color: #10b981">+ query = db.exec(...)</span>
|
| 161 |
-
</div>
|
| 162 |
-
</div>
|
| 163 |
-
|
| 164 |
-
<div class="hero-content">
|
| 165 |
-
<div class="hero-pill">★ RL-Powered Code Review</div>
|
| 166 |
-
<h1>Catch Bugs Before<br>They Catch You.<br><span class="purple-gradient">With AI That Learns.</span></h1>
|
| 167 |
-
<p class="hero-sub">An RL-trained agent that reviews your code like a senior engineer. Catches vulnerabilities and suggests fixes that improve every day.</p>
|
| 168 |
-
<div class="cta-row">
|
| 169 |
-
<a href="/dashboard" class="btn-hero btn-primary">Try Live Demo →</a>
|
| 170 |
-
<a href="#how" class="btn-hero btn-secondary">See How It Works</a>
|
| 171 |
-
</div>
|
| 172 |
-
<div style="margin-top: 2rem; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 0.9rem; color: var(--text-muted);">
|
| 173 |
-
<div style="display: flex; margin-right: 8px;">
|
| 174 |
-
<div style="width: 24px; height: 24px; border-radius: 50%; background: #e0e7ff; border: 2px solid white; margin-left: -8px;"></div>
|
| 175 |
-
<div style="width: 24px; height: 24px; border-radius: 50%; background: #ede9fe; border: 2px solid white; margin-left: -8px;"></div>
|
| 176 |
-
<div style="width: 24px; height: 24px; border-radius: 50%; background: #f1f5f9; border: 2px solid white; margin-left: -8px;"></div>
|
| 177 |
-
</div>
|
| 178 |
-
Trusted by devs • ⭐⭐⭐⭐⭐ • 500+ bugs caught
|
| 179 |
-
</div>
|
| 180 |
-
</div>
|
| 181 |
-
</div>
|
| 182 |
-
|
| 183 |
-
<section class="section-light fade-in-section">
|
| 184 |
-
<div class="stats-grid">
|
| 185 |
-
<div class="stat-card">
|
| 186 |
-
<div class="stat-num">500+</div>
|
| 187 |
-
<div class="stat-label">Bugs Caught</div>
|
| 188 |
-
</div>
|
| 189 |
-
<div class="stat-card">
|
| 190 |
-
<div class="stat-num">94%</div>
|
| 191 |
-
<div class="stat-label">Accuracy</div>
|
| 192 |
-
</div>
|
| 193 |
-
<div class="stat-card">
|
| 194 |
-
<div class="stat-num">4</div>
|
| 195 |
-
<div class="stat-label">Module Types</div>
|
| 196 |
-
</div>
|
| 197 |
-
<div class="stat-card">
|
| 198 |
-
<div class="stat-num">38</div>
|
| 199 |
-
<div class="stat-label">Max Score</div>
|
| 200 |
-
</div>
|
| 201 |
-
</div>
|
| 202 |
-
</section>
|
| 203 |
-
|
| 204 |
-
<section id="features" class="fade-in-section">
|
| 205 |
-
<h2 class="section-title">Everything a Senior Engineer Looks For</h2>
|
| 206 |
-
<p class="section-sub">We trained our RL agent on thousands of code patterns to catch the errors most developers miss in a hurry.</p>
|
| 207 |
-
<div class="features-grid">
|
| 208 |
-
<div class="feature-card">
|
| 209 |
-
<div class="icon-circle" style="background:#f3efff; color:var(--primary)">🛡️</div>
|
| 210 |
-
<h3>Security Detection</h3>
|
| 211 |
-
<p class="hero-sub" style="font-size:0.9rem; margin-top:10px">Catches SQL injection, plain-text passwords, and exposed API credentials.</p>
|
| 212 |
-
</div>
|
| 213 |
-
<div class="feature-card">
|
| 214 |
-
<div class="icon-circle" style="background:#f0eefd; color:#10b981">⚖️</div>
|
| 215 |
-
<h3>Logic Bug Finding</h3>
|
| 216 |
-
<p class="hero-sub" style="font-size:0.9rem; margin-top:10px">Identifies off-by-one errors, incorrect comparison operators, and missing edge cases.</p>
|
| 217 |
-
</div>
|
| 218 |
-
<div class="feature-card">
|
| 219 |
-
<div class="icon-circle" style="background:#eef2ff; color:#3b82f6">💡</div>
|
| 220 |
-
<h3>Instant Fixes</h3>
|
| 221 |
-
<p class="hero-sub" style="font-size:0.9rem; margin-top:10px">Provides immediate, secure fixed code versions with an interactive diff view.</p>
|
| 222 |
-
</div>
|
| 223 |
-
<div class="feature-card">
|
| 224 |
-
<div class="icon-circle" style="background:#fff7ed; color:#f59e0b">🔄</div>
|
| 225 |
-
<h3>RL Training Loop</h3>
|
| 226 |
-
<p class="hero-sub" style="font-size:0.9rem; margin-top:10px">The agent improves after every episode using deep Q-learning reward cycles.</p>
|
| 227 |
-
</div>
|
| 228 |
-
<div class="feature-card">
|
| 229 |
-
<div class="icon-circle" style="background:#fdf2f2; color:#ef4444">📂</div>
|
| 230 |
-
<h3>Multi-file Support</h3>
|
| 231 |
-
<p class="hero-sub" style="font-size:0.9rem; margin-top:10px">Upload any .py, .js, .ts, or .java file for a comprehensive security analysis.</p>
|
| 232 |
-
</div>
|
| 233 |
-
<div class="feature-card">
|
| 234 |
-
<div class="icon-circle" style="background:#f5f3ff; color:var(--purple)">📊</div>
|
| 235 |
-
<h3>Proof of Learning</h3>
|
| 236 |
-
<p class="hero-sub" style="font-size:0.9rem; margin-top:10px">Visualize the "Before vs After" results of the RL training process in real-time.</p>
|
| 237 |
-
</div>
|
| 238 |
-
</div>
|
| 239 |
-
</section>
|
| 240 |
-
|
| 241 |
-
<section id="how" class="section-light fade-in-section">
|
| 242 |
-
<h2 class="section-title">How The RL Loop Works</h2>
|
| 243 |
-
<div class="how-grid" style="margin-top: 4rem;">
|
| 244 |
-
<div class="step">
|
| 245 |
-
<div class="step-num">1</div>
|
| 246 |
-
<h4>Bug Bank</h4>
|
| 247 |
-
<p class="line-hint" style="margin-top:10px">We secretly inject real vulnerabilities into clean code snippets.</p>
|
| 248 |
-
<div class="step-preview"><div style="color:#ef4444">range(len(x)-1)</div></div>
|
| 249 |
-
</div>
|
| 250 |
-
<div class="step">
|
| 251 |
-
<div class="step-num">2</div>
|
| 252 |
-
<h4>AI Actions</h4>
|
| 253 |
-
<p class="line-hint" style="margin-top:10px">The agent reads the code and guesses if there's a bug.</p>
|
| 254 |
-
<div class="step-preview"><span class="logo-ai" style="background:#ef4444; color:#fff">FLAG</span></div>
|
| 255 |
-
</div>
|
| 256 |
-
<div class="step">
|
| 257 |
-
<div class="step-num">3</div>
|
| 258 |
-
<h4>Reward & Learn</h4>
|
| 259 |
-
<p class="line-hint" style="margin-top:10px">Correct catch earns +25 points. Misses lose -20.</p>
|
| 260 |
-
<div class="step-preview"><svg width="100" height="50"><path d="M0 50 L20 40 L40 45 L60 20 L80 10 L100 0" stroke="#7c3aed" fill="none" stroke-width="2"/></svg></div>
|
| 261 |
-
</div>
|
| 262 |
-
</div>
|
| 263 |
-
</section>
|
| 264 |
-
|
| 265 |
-
<section class="fade-in-section">
|
| 266 |
-
<h2 class="section-title">Ready to catch some bugs?</h2>
|
| 267 |
-
<div class="mockup" style="margin-top: 3rem;">
|
| 268 |
-
<div class="mockup-header">
|
| 269 |
-
<div class="dots">
|
| 270 |
-
<div class="dot" style="background:#ff5f56"></div>
|
| 271 |
-
<div class="dot" style="background:#ffbd2e"></div>
|
| 272 |
-
<div class="dot" style="background:#27c93f"></div>
|
| 273 |
-
</div>
|
| 274 |
-
RL Code Reviewer — Dashboard
|
| 275 |
-
</div>
|
| 276 |
-
<div class="mockup-content">
|
| 277 |
-
<div style="border-right: 1px solid #eee; padding-right: 15px; font-family: monospace;">
|
| 278 |
-
<div style="color:#64748b">1 def login():</div>
|
| 279 |
-
<div style="color:#64748b">2 pass = ...</div>
|
| 280 |
-
<div style="background: rgba(239,68,68,0.1); color:#ef4444">3 query = f"..."</div>
|
| 281 |
-
<div style="color:#64748b">4 db.exec(query)</div>
|
| 282 |
-
</div>
|
| 283 |
-
<div style="padding: 0 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;">
|
| 284 |
-
<div style="font-size: 2rem; font-weight: 800; color:#10b981">+38</div>
|
| 285 |
-
<div class="logo-ai" style="background:#10b981; color:#fff; font-size: 10px;">CORRECT</div>
|
| 286 |
-
</div>
|
| 287 |
-
<div style="padding-left: 15px; display: flex; align-items: center;">
|
| 288 |
-
<div style="background: white; border: 1px solid #eee; padding: 15px; border-radius: 8px; width: 100%;">
|
| 289 |
-
<div style="font-size: 0.6rem; color:var(--text-muted)">ACCURACY IMPROVEMENT</div>
|
| 290 |
-
<div style="font-size: 1.2rem; font-weight: 800; color:var(--primary)">+64.2%</div>
|
| 291 |
-
</div>
|
| 292 |
-
</div>
|
| 293 |
-
</div>
|
| 294 |
-
</div>
|
| 295 |
-
<div style="margin-top: 3rem;">
|
| 296 |
-
<a href="/dashboard" class="btn-pill" style="padding: 16px 40px; font-size: 1.1rem;">Launch Live Dashboard →</a>
|
| 297 |
-
</div>
|
| 298 |
-
</section>
|
| 299 |
-
|
| 300 |
-
<footer>
|
| 301 |
-
<div class="footer-content">
|
| 302 |
-
<div class="f-col">
|
| 303 |
-
<div class="logo" style="color:white">CodeReview <span class="logo-ai">AI</span></div>
|
| 304 |
-
<p class="footer-tag">AI-powered code review that actually learns. Built for the Code With Antigravity Hackathon.</p>
|
| 305 |
-
</div>
|
| 306 |
-
<div class="footer-links">
|
| 307 |
-
<div class="f-col">
|
| 308 |
-
<h4>Platform</h4>
|
| 309 |
-
<a href="/dashboard">Dashboard</a>
|
| 310 |
-
<a href="#how">How It Works</a>
|
| 311 |
-
<a href="#">Pricing</a>
|
| 312 |
-
</div>
|
| 313 |
-
<div class="f-col">
|
| 314 |
-
<h4>About</h4>
|
| 315 |
-
<a href="#">GitHub</a>
|
| 316 |
-
<a href="#">Devpost</a>
|
| 317 |
-
<a href="#">Team</a>
|
| 318 |
-
</div>
|
| 319 |
-
</div>
|
| 320 |
-
</div>
|
| 321 |
-
<div class="copy">© 2025 RL Code Reviewer. Built with ♥ for Antigravity Hackathon</div>
|
| 322 |
-
</footer>
|
| 323 |
-
|
| 324 |
-
<script>
|
| 325 |
-
const observer = new IntersectionObserver((entries) => {
|
| 326 |
-
entries.forEach(entry => {
|
| 327 |
-
if (entry.isIntersecting) {
|
| 328 |
-
entry.target.classList.add('visible');
|
| 329 |
-
}
|
| 330 |
-
});
|
| 331 |
-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