Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

web.tsx

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

web.tsxBlame4798 lines · 3 contributors
fc1817aClaude1/**
2 * Web UI routes — browse repositories, code, commits, diffs.
06d5ffeClaude3 * Now auth-aware with user profiles, repo creation, stars, and syntax highlighting.
fc1817aClaude4 */
5
6import { Hono } from "hono";
79136bbClaude7import { html } from "hono/html";
8e9f1d9Claude8import { eq, and, desc, inArray, sql } from "drizzle-orm";
06d5ffeClaude9import { db } from "../db";
ea52715copilot-swe-agent[bot]10import { config } from "../lib/config";
3951454Claude11import {
12 users,
13 repositories,
14 stars,
15 commitVerifications,
16} from "../db/schema";
fc1817aClaude17import { Layout } from "../views/layout";
cb5a796Claude18import { PendingCommentsBanner as RepoHomePendingBanner } from "../views/pending-comments-banner";
fc1817aClaude19import {
20 RepoHeader,
21 RepoNav,
22 Breadcrumb,
23 FileTable,
06d5ffeClaude24 RepoCard,
25 BranchSwitcher,
26 HighlightedCode,
27 PlainCode,
fc1817aClaude28} from "../views/components";
ea9ed4cClaude29import { DiffView } from "../views/diff-view";
fc1817aClaude30import {
31 getTree,
32 getBlob,
33 listCommits,
34 getCommit,
35 getCommitFullMessage,
36 getDiff,
37 getReadme,
38 getDefaultBranch,
39 listBranches,
398a10cClaude40 listTags,
fc1817aClaude41 repoExists,
06d5ffeClaude42 initBareRepo,
79136bbClaude43 getBlame,
44 getRawBlob,
45 searchCode,
398a10cClaude46 getRepoPath,
fc1817aClaude47} from "../git/repository";
79136bbClaude48import { renderMarkdown, markdownCss } from "../lib/markdown";
06d5ffeClaude49import { highlightCode } from "../lib/highlight";
50import { softAuth, requireAuth } from "../middleware/auth";
51import type { AuthEnv } from "../middleware/auth";
8f50ed0Claude52import { trackByName } from "../lib/traffic";
534f04aClaude53import { LandingPage, type LandingLiveFeed } from "../views/landing";
52ad8b1Claude54import { computePublicStats, type PublicStats } from "../lib/public-stats";
534f04aClaude55import {
56 listQueuedAiBuildIssues,
57 listRecentAutoMerges,
58 listRecentAiReviews,
59 countAiReviewsSince,
60 listDemoActivityFeed,
61} from "../lib/demo-activity";
fc1817aClaude62
06d5ffeClaude63const web = new Hono<AuthEnv>();
64
65// Soft auth on all web routes — c.get("user") available but may be null
66web.use("*", softAuth);
fc1817aClaude67
efb11c5Claude68/**
69 * Shared CSS for the polished code-browse surfaces (parallel session 3.E).
70 *
71 * Inlined here rather than in `src/views/layout.tsx` because session 3.E's
72 * scope is route-local and `layout.tsx` is locked. Each polished handler
73 * injects this via a `<style>` tag; the rules are namespaced by surface
74 * prefix (`.new-repo-*`, `.profile-*`, `.tree-*`, `.blob-*`, `.commits-*`,
75 * `.commit-detail-*`, `.blame-*`, `.search-*`) so nothing bleeds into the
76 * `.repo-home-*` styling Agent A already shipped.
77 */
78const codeBrowseCss = `
79 /* ───────── shared primitives ───────── */
80 .cb-hairline::before,
81 .new-repo-hero::before,
82 .profile-hero::before,
83 .commits-hero::before,
84 .commit-detail-card::before,
85 .search-hero::before {
86 content: '';
87 position: absolute;
88 top: 0; left: 0; right: 0;
89 height: 2px;
90 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
91 opacity: 0.7;
92 pointer-events: none;
93 }
94 @keyframes cbHeroOrb {
95 0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.55; }
96 50% { transform: scale(1.1) translate(-10px, 8px); opacity: 0.8; }
97 }
98 @media (prefers-reduced-motion: reduce) {
99 .new-repo-hero-orb,
100 .profile-hero-orb,
101 .commits-hero-orb { animation: none; }
102 }
103
104 /* ───────── new-repo ───────── */
105 .new-repo-hero {
106 position: relative;
107 margin-bottom: var(--space-5);
108 padding: var(--space-5) var(--space-6);
109 background: var(--bg-elevated);
110 border: 1px solid var(--border);
111 border-radius: 16px;
112 overflow: hidden;
113 }
114 .new-repo-hero-orb-wrap {
115 position: absolute;
116 inset: -25% -10% auto auto;
117 width: 360px;
118 height: 360px;
119 pointer-events: none;
120 z-index: 0;
121 }
122 .new-repo-hero-orb {
123 position: absolute;
124 inset: 0;
125 background: radial-gradient(circle, rgba(140,109,255,0.18), rgba(54,197,214,0.09) 45%, transparent 70%);
126 filter: blur(80px);
127 opacity: 0.7;
128 animation: cbHeroOrb 14s ease-in-out infinite;
129 }
130 .new-repo-hero-inner { position: relative; z-index: 1; }
131 .new-repo-eyebrow {
132 font-size: 12px;
133 font-family: var(--font-mono);
134 color: var(--text-muted);
135 letter-spacing: 0.1em;
136 text-transform: uppercase;
137 margin-bottom: var(--space-2);
138 }
139 .new-repo-eyebrow strong { color: var(--accent); font-weight: 600; }
140 .new-repo-title {
141 font-family: var(--font-display);
142 font-weight: 800;
143 letter-spacing: -0.028em;
144 font-size: clamp(28px, 4vw, 40px);
145 line-height: 1.05;
146 margin: 0 0 var(--space-2);
147 color: var(--text-strong);
148 }
149 .new-repo-sub {
150 font-size: 15px;
151 color: var(--text-muted);
152 margin: 0;
153 line-height: 1.55;
154 max-width: 620px;
155 }
156 .new-repo-form {
157 max-width: 680px;
158 }
159 .new-repo-error {
160 background: rgba(218, 54, 51, 0.12);
161 border: 1px solid rgba(218, 54, 51, 0.35);
162 color: #ffb3b3;
163 padding: 10px 14px;
164 border-radius: 10px;
165 margin-bottom: var(--space-4);
166 font-size: 14px;
167 }
168 .new-repo-form-grid {
169 display: flex;
170 flex-direction: column;
171 gap: var(--space-4);
172 }
173 .new-repo-row { display: flex; flex-direction: column; gap: 6px; }
174 .new-repo-label {
175 font-size: 13px;
176 color: var(--text-strong);
177 font-weight: 600;
178 }
179 .new-repo-label-optional {
180 color: var(--text-muted);
181 font-weight: 400;
182 font-size: 12px;
183 }
184 .new-repo-input {
185 appearance: none;
186 width: 100%;
187 background: var(--bg);
188 border: 1px solid var(--border);
189 color: var(--text-strong);
190 border-radius: 10px;
191 padding: 10px 12px;
192 font-size: 14px;
193 font-family: inherit;
194 transition: border-color var(--t-fast, 0.15s) ease, box-shadow var(--t-fast, 0.15s) ease;
195 }
196 .new-repo-input:focus {
197 outline: none;
198 border-color: var(--accent);
199 box-shadow: 0 0 0 3px rgba(140,109,255,0.18);
200 }
201 .new-repo-input-disabled {
202 color: var(--text-muted);
203 background: var(--bg-secondary);
204 cursor: not-allowed;
205 }
206 .new-repo-hint {
207 font-size: 12px;
208 color: var(--text-muted);
209 margin: 4px 0 0;
210 }
211 .new-repo-hint code {
212 font-family: var(--font-mono);
213 font-size: 11.5px;
214 background: var(--bg-secondary);
215 border: 1px solid var(--border);
216 border-radius: 5px;
217 padding: 1px 5px;
218 color: var(--text-strong);
219 }
220 .new-repo-visibility {
221 display: grid;
222 grid-template-columns: 1fr 1fr;
223 gap: var(--space-2);
224 }
225 @media (max-width: 600px) {
226 .new-repo-visibility { grid-template-columns: 1fr; }
227 }
228 .new-repo-vis-card {
229 display: flex;
230 gap: 10px;
231 padding: 14px;
232 background: var(--bg);
233 border: 1px solid var(--border);
234 border-radius: 12px;
235 cursor: pointer;
236 transition: border-color var(--t-fast, 0.15s) ease, background var(--t-fast, 0.15s) ease;
237 }
238 .new-repo-vis-card:hover { border-color: var(--border-strong, var(--border)); }
239 .new-repo-vis-card:has(input:checked) {
240 border-color: rgba(140,109,255,0.55);
241 background: rgba(140,109,255,0.06);
242 box-shadow: 0 0 0 1px rgba(140,109,255,0.25);
243 }
244 .new-repo-vis-radio {
245 margin-top: 3px;
246 accent-color: var(--accent);
247 }
248 .new-repo-vis-body { display: flex; flex-direction: column; gap: 4px; }
249 .new-repo-vis-label {
250 font-size: 14px;
251 font-weight: 600;
252 color: var(--text-strong);
253 }
254 .new-repo-vis-desc {
255 font-size: 12.5px;
256 color: var(--text-muted);
257 line-height: 1.45;
258 }
259 .new-repo-callout {
260 margin-top: var(--space-2);
261 padding: var(--space-3) var(--space-4);
262 background: var(--accent-gradient-faint, rgba(140,109,255,0.06));
263 border: 1px solid rgba(140,109,255,0.2);
264 border-radius: 12px;
265 }
266 .new-repo-callout-eyebrow {
267 font-size: 11px;
268 font-family: var(--font-mono);
269 text-transform: uppercase;
270 letter-spacing: 0.12em;
271 color: var(--accent);
272 font-weight: 700;
273 margin-bottom: 4px;
274 }
275 .new-repo-callout-body {
276 font-size: 13px;
277 color: var(--text);
278 line-height: 1.5;
279 margin: 0;
280 }
281 .new-repo-callout-body code {
282 font-family: var(--font-mono);
283 font-size: 12px;
284 color: var(--accent);
285 background: rgba(140,109,255,0.1);
286 border-radius: 4px;
287 padding: 1px 5px;
288 }
398a10cClaude289 .new-repo-templates {
290 display: flex;
291 flex-wrap: wrap;
292 gap: 8px;
293 margin-top: 4px;
294 }
295 .new-repo-template-chip {
296 position: relative;
297 display: inline-flex;
298 align-items: center;
299 gap: 6px;
300 padding: 8px 14px;
301 background: var(--bg);
302 border: 1px solid var(--border);
303 border-radius: 999px;
304 font-size: 13px;
305 color: var(--text);
306 cursor: pointer;
307 transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
308 }
309 .new-repo-template-chip input { position: absolute; opacity: 0; pointer-events: none; }
310 .new-repo-template-chip:hover {
311 border-color: var(--border-strong, var(--border));
312 color: var(--text-strong);
313 }
314 .new-repo-template-chip:has(input:checked) {
315 border-color: rgba(140,109,255,0.55);
316 background: rgba(140,109,255,0.10);
317 color: var(--text-strong);
318 box-shadow: 0 0 0 1px rgba(140,109,255,0.25);
319 }
320 .new-repo-template-chip-dot {
321 width: 8px; height: 8px;
322 border-radius: 999px;
323 background: var(--text-faint, var(--text-muted));
324 transition: background 140ms ease, box-shadow 140ms ease;
325 }
326 .new-repo-template-chip:has(input:checked) .new-repo-template-chip-dot {
327 background: linear-gradient(135deg, #8c6dff, #36c5d6);
328 box-shadow: 0 0 8px rgba(140,109,255,0.6);
329 }
efb11c5Claude330 .new-repo-actions {
331 display: flex;
332 gap: var(--space-2);
333 margin-top: var(--space-2);
398a10cClaude334 align-items: center;
335 }
336 .new-repo-submit {
337 min-width: 180px;
338 border: 1px solid rgba(140,109,255,0.45);
339 background: linear-gradient(135deg, #8c6dff 0%, #36c5d6 100%);
340 color: #fff;
341 font-weight: 700;
342 box-shadow: 0 8px 20px -8px rgba(140,109,255,0.55);
343 transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
344 }
345 .new-repo-submit:hover {
346 transform: translateY(-1px);
347 box-shadow: 0 12px 24px -8px rgba(140,109,255,0.7);
348 filter: brightness(1.06);
349 }
350 .new-repo-submit:focus-visible {
351 outline: 3px solid rgba(140,109,255,0.45);
352 outline-offset: 2px;
efb11c5Claude353 }
354
355 /* ───────── profile ───────── */
356 .profile-hero {
357 position: relative;
358 margin-bottom: var(--space-5);
359 padding: var(--space-5) var(--space-6);
360 background: var(--bg-elevated);
361 border: 1px solid var(--border);
362 border-radius: 16px;
363 overflow: hidden;
364 }
365 .profile-hero-orb-wrap {
366 position: absolute;
367 inset: -25% -10% auto auto;
368 width: 360px;
369 height: 360px;
370 pointer-events: none;
371 z-index: 0;
372 }
373 .profile-hero-orb {
374 position: absolute;
375 inset: 0;
376 background: radial-gradient(circle, rgba(140,109,255,0.18), rgba(54,197,214,0.09) 45%, transparent 70%);
377 filter: blur(80px);
378 opacity: 0.7;
379 animation: cbHeroOrb 14s ease-in-out infinite;
380 }
381 .profile-hero-inner {
382 position: relative;
383 z-index: 1;
384 display: flex;
385 align-items: flex-start;
386 gap: var(--space-5);
387 }
388 .profile-hero-avatar {
389 flex: 0 0 auto;
390 width: 88px;
391 height: 88px;
392 border-radius: 50%;
393 background: linear-gradient(135deg, #8c6dff 0%, #36c5d6 100%);
394 color: #fff;
395 display: flex;
396 align-items: center;
397 justify-content: center;
398 font-size: 38px;
399 font-weight: 700;
400 font-family: var(--font-display);
401 box-shadow: 0 8px 24px -8px rgba(140,109,255,0.55);
402 }
403 .profile-hero-text { flex: 1; min-width: 0; }
404 .profile-eyebrow {
405 font-size: 12px;
406 font-family: var(--font-mono);
407 color: var(--text-muted);
408 letter-spacing: 0.1em;
409 text-transform: uppercase;
410 margin-bottom: var(--space-2);
411 }
412 .profile-eyebrow strong { color: var(--accent); font-weight: 600; }
413 .profile-name {
414 font-family: var(--font-display);
415 font-weight: 800;
416 letter-spacing: -0.028em;
417 font-size: clamp(28px, 3.6vw, 36px);
418 line-height: 1.05;
419 margin: 0 0 4px;
420 color: var(--text-strong);
421 }
422 .profile-handle {
423 font-family: var(--font-mono);
424 font-size: 13px;
425 color: var(--text-muted);
426 margin-bottom: var(--space-2);
427 }
428 .profile-bio {
429 font-size: 14.5px;
430 color: var(--text);
431 line-height: 1.55;
432 margin: 0 0 var(--space-3);
433 max-width: 640px;
434 }
435 .profile-meta {
436 display: flex;
437 align-items: center;
438 gap: var(--space-4);
439 flex-wrap: wrap;
440 font-size: 13px;
441 }
442 .profile-meta-link {
443 color: var(--text-muted);
444 transition: color var(--t-fast, 0.15s) ease;
445 }
446 .profile-meta-link:hover { color: var(--accent); text-decoration: none; }
447 .profile-meta-link strong {
448 color: var(--text-strong);
449 font-weight: 600;
450 font-variant-numeric: tabular-nums;
451 }
452 .profile-follow-form { margin: 0; }
453 @media (max-width: 600px) {
454 .profile-hero-inner { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
455 .profile-hero-avatar { width: 64px; height: 64px; font-size: 28px; }
456 }
457 .profile-readme {
458 margin-bottom: var(--space-6);
459 background: var(--bg-elevated);
460 border: 1px solid var(--border);
461 border-radius: 12px;
462 overflow: hidden;
463 }
464 .profile-readme-head {
465 display: flex;
466 align-items: center;
467 gap: 8px;
468 padding: 10px 16px;
469 background: var(--bg-secondary);
470 border-bottom: 1px solid var(--border);
471 font-size: 13px;
472 color: var(--text-muted);
473 }
474 .profile-readme-icon { color: var(--accent); font-size: 14px; }
475 .profile-readme-body { padding: var(--space-5) var(--space-6); }
476 .profile-section-head {
477 display: flex;
478 align-items: baseline;
479 gap: var(--space-2);
480 margin-bottom: var(--space-3);
481 }
482 .profile-section-title {
483 font-family: var(--font-display);
484 font-weight: 700;
485 font-size: 20px;
486 letter-spacing: -0.015em;
487 margin: 0;
488 color: var(--text-strong);
489 }
490 .profile-section-count {
491 font-family: var(--font-mono);
492 font-size: 12px;
493 color: var(--text-muted);
494 background: var(--bg-secondary);
495 border: 1px solid var(--border);
496 border-radius: 999px;
497 padding: 2px 10px;
498 font-variant-numeric: tabular-nums;
499 }
500 .profile-empty {
501 display: flex;
502 align-items: center;
503 justify-content: space-between;
504 gap: var(--space-3);
505 padding: var(--space-4) var(--space-5);
506 background: var(--bg-elevated);
507 border: 1px dashed var(--border);
508 border-radius: 12px;
509 }
510 .profile-empty-text { color: var(--text-muted); font-size: 14px; margin: 0; }
511
512 /* ───────── tree (file browser) ───────── */
513 .tree-header {
514 margin-bottom: var(--space-3);
515 display: flex;
516 flex-direction: column;
517 gap: var(--space-2);
518 }
519 .tree-header-row {
520 display: flex;
521 align-items: center;
522 justify-content: space-between;
523 gap: var(--space-3);
524 flex-wrap: wrap;
525 }
526 .tree-header-stats {
527 display: flex;
528 align-items: center;
529 gap: var(--space-3);
530 font-size: 12px;
531 color: var(--text-muted);
532 }
533 .tree-stat strong {
534 color: var(--text-strong);
535 font-weight: 600;
536 font-variant-numeric: tabular-nums;
537 }
538 .tree-stat-link {
539 color: var(--text-muted);
540 padding: 4px 10px;
541 border-radius: 999px;
542 border: 1px solid var(--border);
543 background: var(--bg-elevated);
544 transition: color var(--t-fast, 0.15s) ease, border-color var(--t-fast, 0.15s) ease;
545 }
546 .tree-stat-link:hover {
547 color: var(--accent);
548 border-color: rgba(140,109,255,0.45);
549 text-decoration: none;
550 }
551 .tree-breadcrumb-row {
552 font-size: 13px;
553 }
554
555 /* ───────── blob (file viewer) ───────── */
556 .blob-toolbar {
557 margin-bottom: var(--space-3);
558 display: flex;
559 flex-direction: column;
560 gap: var(--space-2);
561 }
562 .blob-breadcrumb { font-size: 13px; }
563 .blob-card {
564 background: var(--bg-elevated);
565 border: 1px solid var(--border);
566 border-radius: 12px;
567 overflow: hidden;
568 }
569 .blob-header-polished {
570 display: flex;
571 align-items: center;
572 justify-content: space-between;
573 gap: var(--space-3);
574 padding: 10px 14px;
575 background: var(--bg-secondary);
576 border-bottom: 1px solid var(--border);
577 }
578 .blob-header-meta {
579 display: flex;
580 align-items: center;
581 gap: var(--space-2);
582 min-width: 0;
583 flex: 1;
584 }
585 .blob-header-icon { font-size: 14px; opacity: 0.85; }
586 .blob-header-name {
587 font-family: var(--font-mono);
588 font-size: 13px;
589 color: var(--text-strong);
590 font-weight: 600;
591 overflow: hidden;
592 text-overflow: ellipsis;
593 white-space: nowrap;
594 }
595 .blob-header-size {
596 font-family: var(--font-mono);
597 font-size: 11.5px;
598 color: var(--text-muted);
599 font-variant-numeric: tabular-nums;
600 border-left: 1px solid var(--border);
601 padding-left: var(--space-2);
602 margin-left: 2px;
603 }
604 .blob-header-actions {
605 display: flex;
606 gap: 6px;
607 flex-shrink: 0;
608 }
609 .blob-pill {
610 display: inline-flex;
611 align-items: center;
612 padding: 4px 12px;
613 font-size: 12px;
614 font-weight: 500;
615 color: var(--text);
616 background: var(--bg-elevated);
617 border: 1px solid var(--border);
618 border-radius: 999px;
619 transition: color var(--t-fast, 0.15s) ease, border-color var(--t-fast, 0.15s) ease, background var(--t-fast, 0.15s) ease;
620 }
621 .blob-pill:hover {
622 color: var(--accent);
623 border-color: rgba(140,109,255,0.45);
624 text-decoration: none;
625 background: rgba(140,109,255,0.06);
626 }
627 .blob-pill-accent {
628 color: var(--accent);
629 border-color: rgba(140,109,255,0.35);
630 background: rgba(140,109,255,0.08);
631 }
632 .blob-pill-accent:hover {
633 background: rgba(140,109,255,0.14);
634 }
635 .blob-binary {
636 padding: var(--space-5);
637 color: var(--text-muted);
638 text-align: center;
639 font-size: 13px;
640 background: var(--bg);
641 }
642
643 /* ───────── commits list ───────── */
644 .commits-hero {
645 position: relative;
646 margin-bottom: var(--space-4);
647 padding: var(--space-5) var(--space-6);
648 background: var(--bg-elevated);
649 border: 1px solid var(--border);
650 border-radius: 16px;
651 overflow: hidden;
652 }
653 .commits-hero-orb-wrap {
654 position: absolute;
655 inset: -25% -10% auto auto;
656 width: 320px;
657 height: 320px;
658 pointer-events: none;
659 z-index: 0;
660 }
661 .commits-hero-orb {
662 position: absolute;
663 inset: 0;
664 background: radial-gradient(circle, rgba(140,109,255,0.16), rgba(54,197,214,0.08) 45%, transparent 70%);
665 filter: blur(80px);
666 opacity: 0.7;
667 animation: cbHeroOrb 14s ease-in-out infinite;
668 }
669 .commits-hero-inner { position: relative; z-index: 1; }
670 .commits-eyebrow {
671 font-size: 12px;
672 font-family: var(--font-mono);
673 color: var(--text-muted);
674 letter-spacing: 0.1em;
675 text-transform: uppercase;
676 margin-bottom: var(--space-2);
677 }
678 .commits-eyebrow strong { color: var(--accent); font-weight: 600; }
679 .commits-title {
680 font-family: var(--font-display);
681 font-weight: 800;
682 letter-spacing: -0.025em;
683 font-size: clamp(22px, 3vw, 30px);
684 line-height: 1.15;
685 margin: 0 0 var(--space-2);
686 color: var(--text-strong);
687 }
688 .commits-branch {
689 font-family: var(--font-mono);
690 font-size: 0.7em;
691 color: var(--text);
692 background: var(--bg-secondary);
693 border: 1px solid var(--border);
694 border-radius: 6px;
695 padding: 2px 8px;
696 font-weight: 500;
697 vertical-align: middle;
698 }
699 .commits-sub {
700 font-size: 14px;
701 color: var(--text-muted);
702 margin: 0;
703 line-height: 1.55;
704 max-width: 640px;
705 }
398a10cClaude706 .commits-toolbar {
707 display: flex;
708 justify-content: space-between;
709 align-items: center;
710 flex-wrap: wrap;
711 gap: var(--space-2);
712 margin-bottom: var(--space-3);
713 }
714 .commits-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
715 .commits-toolbar-link {
716 display: inline-flex;
717 align-items: center;
718 gap: 6px;
719 padding: 6px 12px;
720 font-size: 12.5px;
721 font-weight: 500;
722 color: var(--text-muted);
723 background: rgba(255,255,255,0.025);
724 border: 1px solid var(--border);
725 border-radius: 8px;
726 text-decoration: none;
727 transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
728 }
729 .commits-toolbar-link:hover {
730 border-color: var(--border-strong);
731 color: var(--text-strong);
732 background: rgba(255,255,255,0.04);
733 text-decoration: none;
734 }
efb11c5Claude735 .commits-list-wrap {
736 background: var(--bg-elevated);
737 border: 1px solid var(--border);
398a10cClaude738 border-radius: 14px;
efb11c5Claude739 overflow: hidden;
398a10cClaude740 position: relative;
741 }
742 .commits-list-wrap::before {
743 content: '';
744 position: absolute;
745 top: 0; left: 0; right: 0;
746 height: 2px;
747 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
748 opacity: 0.55;
749 pointer-events: none;
750 }
751 .commits-day-head {
752 display: flex;
753 align-items: center;
754 gap: 10px;
755 padding: 10px 18px;
756 font-size: 11.5px;
757 font-family: var(--font-mono);
758 text-transform: uppercase;
759 letter-spacing: 0.08em;
760 color: var(--text-muted);
761 background: var(--bg-secondary);
762 border-bottom: 1px solid var(--border);
763 }
764 .commits-day-head:not(:first-child) { border-top: 1px solid var(--border); }
765 .commits-day-head-dot {
766 width: 6px; height: 6px;
767 border-radius: 9999px;
768 background: linear-gradient(135deg, #8c6dff, #36c5d6);
769 }
770 .commits-row {
771 display: flex;
772 align-items: flex-start;
773 gap: 14px;
774 padding: 14px 18px;
775 border-bottom: 1px solid var(--border-subtle);
776 transition: background 120ms ease;
777 }
778 .commits-row:last-child { border-bottom: none; }
779 .commits-row:hover { background: rgba(255,255,255,0.022); }
780 .commits-avatar {
781 width: 34px; height: 34px;
782 border-radius: 9999px;
783 background: linear-gradient(135deg, rgba(140,109,255,0.30), rgba(54,197,214,0.25));
784 color: #fff;
785 display: inline-flex;
786 align-items: center;
787 justify-content: center;
788 font-family: var(--font-display);
789 font-weight: 700;
790 font-size: 13.5px;
791 flex-shrink: 0;
792 box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
793 }
794 .commits-row-body { flex: 1; min-width: 0; }
795 .commits-row-msg {
796 display: flex;
797 align-items: center;
798 gap: 8px;
799 flex-wrap: wrap;
800 }
801 .commits-row-msg a {
802 font-family: var(--font-display);
803 font-weight: 600;
804 font-size: 14px;
805 color: var(--text-strong);
806 text-decoration: none;
807 letter-spacing: -0.005em;
808 }
809 .commits-row-msg a:hover { color: var(--accent); text-decoration: none; }
810 .commits-row-verified {
811 font-size: 9.5px;
812 padding: 1px 7px;
813 border-radius: 9999px;
814 background: rgba(52,211,153,0.16);
815 color: #6ee7b7;
816 box-shadow: inset 0 0 0 1px rgba(52,211,153,0.30);
817 text-transform: uppercase;
818 letter-spacing: 0.06em;
819 font-weight: 700;
820 }
821 .commits-row-meta {
822 margin-top: 4px;
823 display: flex;
824 align-items: center;
825 gap: 8px;
826 flex-wrap: wrap;
827 font-size: 12.5px;
828 color: var(--text-muted);
829 }
830 .commits-row-meta strong { color: var(--text); font-weight: 600; }
831 .commits-row-meta .sep { opacity: 0.4; }
832 .commits-row-time {
833 font-variant-numeric: tabular-nums;
834 }
835 .commits-row-side {
836 display: flex;
837 align-items: center;
838 gap: 8px;
839 flex-shrink: 0;
840 }
841 .commits-row-sha {
842 display: inline-flex;
843 align-items: center;
844 padding: 4px 10px;
845 border-radius: 9999px;
846 font-family: var(--font-mono);
847 font-size: 11.5px;
848 font-weight: 600;
849 color: var(--text-strong);
850 background: rgba(255,255,255,0.04);
851 border: 1px solid var(--border);
852 text-decoration: none;
853 letter-spacing: 0.04em;
854 transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
855 }
856 .commits-row-sha:hover {
857 border-color: rgba(140,109,255,0.55);
858 color: var(--accent);
859 background: rgba(140,109,255,0.08);
860 text-decoration: none;
861 }
862 .commits-row-copy {
863 display: inline-flex;
864 align-items: center;
865 justify-content: center;
866 width: 28px; height: 28px;
867 padding: 0;
868 border-radius: 8px;
869 background: transparent;
870 border: 1px solid var(--border);
871 color: var(--text-muted);
872 cursor: pointer;
873 transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
efb11c5Claude874 }
398a10cClaude875 .commits-row-copy:hover {
876 border-color: var(--border-strong);
877 color: var(--text);
878 background: rgba(255,255,255,0.04);
879 }
880 .commits-row-copy.is-copied { color: #6ee7b7; border-color: rgba(52,211,153,0.35); }
efb11c5Claude881 .commits-empty {
398a10cClaude882 position: relative;
883 overflow: hidden;
884 padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 36px);
efb11c5Claude885 text-align: center;
398a10cClaude886 background: var(--bg-elevated);
887 border: 1px dashed var(--border-strong);
888 border-radius: 16px;
889 }
890 .commits-empty-orb {
891 position: absolute;
892 inset: -40% 30% auto 30%;
893 height: 280px;
894 background: radial-gradient(circle, rgba(140,109,255,0.18), rgba(54,197,214,0.10) 45%, transparent 70%);
895 filter: blur(70px);
896 opacity: 0.7;
897 pointer-events: none;
898 z-index: 0;
899 }
900 .commits-empty-inner { position: relative; z-index: 1; }
901 .commits-empty-icon {
902 width: 56px; height: 56px;
903 border-radius: 9999px;
904 background: linear-gradient(135deg, rgba(140,109,255,0.25), rgba(54,197,214,0.20));
905 box-shadow: inset 0 0 0 1px rgba(140,109,255,0.40);
906 display: inline-flex;
907 align-items: center;
908 justify-content: center;
909 color: #c4b5fd;
910 margin: 0 auto 14px;
911 }
912 .commits-empty-title {
913 font-family: var(--font-display);
914 font-size: 18px;
915 font-weight: 700;
916 margin: 0 0 6px;
917 color: var(--text-strong);
918 }
919 .commits-empty-sub {
920 margin: 0 auto 0;
921 font-size: 13.5px;
efb11c5Claude922 color: var(--text-muted);
398a10cClaude923 max-width: 420px;
924 line-height: 1.5;
925 }
926
927 /* ───────── branches list ───────── */
928 .branches-list {
efb11c5Claude929 background: var(--bg-elevated);
398a10cClaude930 border: 1px solid var(--border);
931 border-radius: 14px;
932 overflow: hidden;
933 position: relative;
934 }
935 .branches-list::before {
936 content: '';
937 position: absolute;
938 top: 0; left: 0; right: 0;
939 height: 2px;
940 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
941 opacity: 0.55;
942 pointer-events: none;
943 }
944 .branches-row {
945 display: flex;
946 align-items: center;
947 gap: var(--space-3);
948 padding: 14px 18px;
949 border-bottom: 1px solid var(--border-subtle);
950 transition: background 120ms ease;
951 flex-wrap: wrap;
952 }
953 .branches-row:last-child { border-bottom: none; }
954 .branches-row:hover { background: rgba(255,255,255,0.022); }
955 .branches-row-icon {
956 width: 32px; height: 32px;
957 border-radius: 8px;
958 background: rgba(140,109,255,0.10);
959 color: #c4b5fd;
960 display: inline-flex;
961 align-items: center;
962 justify-content: center;
963 flex-shrink: 0;
964 box-shadow: inset 0 0 0 1px rgba(140,109,255,0.22);
965 }
966 .branches-row-main { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
967 .branches-row-name {
968 display: inline-flex;
969 align-items: center;
970 gap: 8px;
971 flex-wrap: wrap;
972 }
973 .branches-row-name a {
974 font-family: var(--font-mono);
975 font-size: 13.5px;
976 color: var(--text-strong);
977 font-weight: 600;
978 text-decoration: none;
979 }
980 .branches-row-name a:hover { color: var(--accent); text-decoration: none; }
981 .branches-row-default {
982 font-size: 10px;
983 padding: 2px 8px;
984 border-radius: 9999px;
985 background: rgba(140,109,255,0.14);
986 color: #c4b5fd;
987 box-shadow: inset 0 0 0 1px rgba(140,109,255,0.30);
988 text-transform: uppercase;
989 letter-spacing: 0.08em;
990 font-weight: 700;
991 font-family: var(--font-mono);
992 }
993 .branches-row-meta {
994 display: flex;
995 align-items: center;
996 gap: 8px;
997 flex-wrap: wrap;
998 font-size: 12.5px;
999 color: var(--text-muted);
1000 font-variant-numeric: tabular-nums;
1001 }
1002 .branches-row-meta .sep { opacity: 0.4; }
1003 .branches-row-meta strong { color: var(--text); font-weight: 600; }
1004 .branches-row-side {
1005 display: flex;
1006 align-items: center;
1007 gap: 10px;
1008 flex-shrink: 0;
1009 flex-wrap: wrap;
1010 }
1011 .branches-row-divergence {
1012 display: inline-flex;
1013 align-items: center;
1014 gap: 8px;
1015 font-family: var(--font-mono);
1016 font-size: 11.5px;
1017 color: var(--text-muted);
1018 padding: 4px 10px;
1019 border-radius: 9999px;
1020 background: rgba(255,255,255,0.035);
1021 border: 1px solid var(--border);
1022 font-variant-numeric: tabular-nums;
1023 }
1024 .branches-row-divergence .ahead { color: #6ee7b7; }
1025 .branches-row-divergence .behind { color: #fca5a5; }
1026 .branches-row-actions {
1027 display: flex;
1028 align-items: center;
1029 gap: 6px;
1030 }
1031 .branches-btn {
1032 display: inline-flex;
1033 align-items: center;
1034 gap: 5px;
1035 padding: 6px 12px;
1036 border-radius: 9999px;
1037 font-size: 12px;
1038 font-weight: 600;
1039 text-decoration: none;
1040 border: 1px solid var(--border);
1041 background: transparent;
1042 color: var(--text-muted);
1043 cursor: pointer;
1044 font: inherit;
1045 transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
1046 }
1047 .branches-btn:hover {
1048 border-color: var(--border-strong);
1049 color: var(--text);
1050 background: rgba(255,255,255,0.04);
1051 text-decoration: none;
1052 }
1053 .branches-btn-danger {
1054 color: #fca5a5;
1055 border-color: rgba(248,113,113,0.30);
1056 }
1057 .branches-btn-danger:hover {
1058 border-style: dashed;
1059 border-color: rgba(248,113,113,0.65);
1060 background: rgba(248,113,113,0.06);
1061 color: #fecaca;
1062 }
1063
1064 /* ───────── tags list ───────── */
1065 .tags-list {
1066 background: var(--bg-elevated);
1067 border: 1px solid var(--border);
1068 border-radius: 14px;
1069 overflow: hidden;
1070 position: relative;
1071 }
1072 .tags-list::before {
1073 content: '';
1074 position: absolute;
1075 top: 0; left: 0; right: 0;
1076 height: 2px;
1077 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
1078 opacity: 0.55;
1079 pointer-events: none;
1080 }
1081 .tags-row {
1082 display: flex;
1083 align-items: center;
1084 gap: var(--space-3);
1085 padding: 14px 18px;
1086 border-bottom: 1px solid var(--border-subtle);
1087 transition: background 120ms ease;
1088 flex-wrap: wrap;
1089 }
1090 .tags-row:last-child { border-bottom: none; }
1091 .tags-row:hover { background: rgba(255,255,255,0.022); }
1092 .tags-row-icon {
1093 width: 32px; height: 32px;
1094 border-radius: 8px;
1095 background: rgba(54,197,214,0.10);
1096 color: #67e8f9;
1097 display: inline-flex;
1098 align-items: center;
1099 justify-content: center;
1100 flex-shrink: 0;
1101 box-shadow: inset 0 0 0 1px rgba(54,197,214,0.22);
1102 }
1103 .tags-row-main { flex: 1; min-width: 240px; }
1104 .tags-row-name {
1105 display: inline-flex;
1106 align-items: center;
1107 gap: 8px;
1108 flex-wrap: wrap;
1109 }
1110 .tags-row-version {
1111 display: inline-flex;
1112 align-items: center;
1113 padding: 3px 11px;
1114 border-radius: 9999px;
1115 font-family: var(--font-mono);
1116 font-size: 13px;
1117 font-weight: 700;
1118 color: #67e8f9;
1119 background: rgba(54,197,214,0.12);
1120 box-shadow: inset 0 0 0 1px rgba(54,197,214,0.30);
1121 letter-spacing: 0.01em;
1122 }
1123 .tags-row-meta {
1124 margin-top: 4px;
1125 display: flex;
1126 align-items: center;
1127 gap: 8px;
1128 flex-wrap: wrap;
1129 font-size: 12.5px;
1130 color: var(--text-muted);
1131 font-variant-numeric: tabular-nums;
1132 }
1133 .tags-row-meta .sep { opacity: 0.4; }
1134 .tags-row-sha {
1135 font-family: var(--font-mono);
1136 font-size: 11.5px;
1137 color: var(--text-strong);
1138 padding: 2px 8px;
1139 border-radius: 6px;
1140 background: rgba(255,255,255,0.04);
1141 border: 1px solid var(--border);
1142 text-decoration: none;
1143 letter-spacing: 0.04em;
1144 }
1145 .tags-row-sha:hover { border-color: var(--border-strong); color: var(--accent); text-decoration: none; }
1146 .tags-row-side {
1147 display: flex;
1148 align-items: center;
1149 gap: 6px;
1150 flex-shrink: 0;
1151 flex-wrap: wrap;
1152 }
1153 .tags-row-link {
1154 display: inline-flex;
1155 align-items: center;
1156 gap: 5px;
1157 padding: 6px 12px;
1158 border-radius: 9999px;
1159 font-size: 12px;
1160 font-weight: 600;
1161 text-decoration: none;
1162 color: var(--text-muted);
1163 background: rgba(255,255,255,0.025);
1164 border: 1px solid var(--border);
1165 transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
1166 }
1167 .tags-row-link:hover {
1168 border-color: rgba(140,109,255,0.45);
1169 color: var(--text-strong);
1170 background: rgba(140,109,255,0.06);
1171 text-decoration: none;
efb11c5Claude1172 }
1173
1174 /* ───────── commit detail ───────── */
1175 .commit-detail-card {
1176 position: relative;
1177 margin-bottom: var(--space-5);
1178 padding: var(--space-5) var(--space-5);
1179 background: var(--bg-elevated);
1180 border: 1px solid var(--border);
1181 border-radius: 14px;
1182 overflow: hidden;
1183 }
1184 .commit-detail-eyebrow {
1185 display: flex;
1186 align-items: center;
1187 gap: var(--space-2);
1188 font-size: 12px;
1189 font-family: var(--font-mono);
1190 text-transform: uppercase;
1191 letter-spacing: 0.1em;
1192 color: var(--text-muted);
1193 margin-bottom: var(--space-2);
1194 }
1195 .commit-detail-eyebrow strong { color: var(--accent); font-weight: 600; }
1196 .commit-detail-sha-pill {
1197 font-family: var(--font-mono);
1198 font-size: 11.5px;
1199 color: var(--text-strong);
1200 background: var(--bg-secondary);
1201 border: 1px solid var(--border);
1202 border-radius: 999px;
1203 padding: 2px 10px;
1204 letter-spacing: 0.04em;
1205 }
1206 .commit-detail-verify {
1207 font-size: 10px;
1208 padding: 2px 8px;
1209 border-radius: 999px;
1210 text-transform: uppercase;
1211 letter-spacing: 0.06em;
1212 font-weight: 700;
1213 color: #fff;
1214 }
1215 .commit-detail-verify-ok {
1216 background: linear-gradient(135deg, #2ea043, #34d399);
1217 }
1218 .commit-detail-verify-warn {
1219 background: linear-gradient(135deg, #d29922, #f59e0b);
1220 }
1221 .commit-detail-title {
1222 font-family: var(--font-display);
1223 font-weight: 700;
1224 letter-spacing: -0.018em;
1225 font-size: clamp(20px, 2.5vw, 26px);
1226 line-height: 1.25;
1227 margin: 0 0 var(--space-2);
1228 color: var(--text-strong);
1229 }
1230 .commit-detail-body {
1231 white-space: pre-wrap;
1232 color: var(--text-muted);
1233 font-size: 14px;
1234 line-height: 1.55;
1235 margin: 0 0 var(--space-3);
1236 font-family: var(--font-mono);
1237 background: var(--bg);
1238 border: 1px solid var(--border);
1239 border-radius: 8px;
1240 padding: var(--space-3) var(--space-4);
1241 max-height: 280px;
1242 overflow: auto;
1243 }
1244 .commit-detail-meta {
1245 display: flex;
1246 flex-wrap: wrap;
1247 gap: var(--space-3);
1248 font-size: 13px;
1249 color: var(--text-muted);
1250 margin-bottom: var(--space-3);
1251 }
1252 .commit-detail-author strong { color: var(--text-strong); font-weight: 600; }
1253 .commit-detail-parents { font-size: 13px; color: var(--text-muted); }
1254 .commit-detail-sha-link {
1255 font-family: var(--font-mono);
1256 font-size: 12.5px;
1257 color: var(--accent);
1258 background: rgba(140,109,255,0.08);
1259 border-radius: 6px;
1260 padding: 1px 6px;
1261 margin-left: 2px;
1262 }
1263 .commit-detail-sha-link:hover { background: rgba(140,109,255,0.16); text-decoration: none; }
1264 .commit-detail-stats {
1265 display: flex;
1266 flex-wrap: wrap;
1267 align-items: center;
1268 gap: var(--space-3);
1269 padding-top: var(--space-3);
1270 border-top: 1px solid var(--border);
1271 font-size: 13px;
1272 color: var(--text-muted);
1273 }
1274 .commit-detail-stat {
1275 display: inline-flex;
1276 align-items: center;
1277 gap: 4px;
1278 font-variant-numeric: tabular-nums;
1279 }
1280 .commit-detail-stat strong { color: var(--text-strong); font-weight: 600; }
1281 .commit-detail-stat-add strong { color: #34d399; }
1282 .commit-detail-stat-del strong { color: #f87171; }
1283 .commit-detail-stat-mark {
1284 font-family: var(--font-mono);
1285 font-weight: 700;
1286 font-size: 14px;
1287 }
1288 .commit-detail-stat-add .commit-detail-stat-mark { color: #34d399; }
1289 .commit-detail-stat-del .commit-detail-stat-mark { color: #f87171; }
1290 .commit-detail-sha-full {
1291 margin-left: auto;
1292 font-family: var(--font-mono);
1293 font-size: 11.5px;
1294 color: var(--text-faint);
1295 letter-spacing: 0.02em;
1296 overflow: hidden;
1297 text-overflow: ellipsis;
1298 white-space: nowrap;
1299 max-width: 100%;
1300 }
1301 .commit-detail-checks {
1302 margin-top: var(--space-3);
1303 padding-top: var(--space-3);
1304 border-top: 1px solid var(--border);
1305 }
1306 .commit-detail-checks-head {
1307 display: flex;
1308 align-items: center;
1309 gap: var(--space-2);
1310 font-size: 13px;
1311 color: var(--text-muted);
1312 margin-bottom: 8px;
1313 }
1314 .commit-detail-checks-head strong { color: var(--text-strong); font-weight: 600; }
1315 .commit-detail-check-state-success { color: #34d399; font-weight: 600; }
1316 .commit-detail-check-state-failure { color: #f87171; font-weight: 600; }
1317 .commit-detail-check-state-pending { color: #d29922; font-weight: 600; }
1318 .commit-detail-check-row { display: flex; flex-wrap: wrap; gap: 6px; }
1319 .commit-detail-check {
1320 font-size: 11px;
1321 padding: 2px 8px;
1322 border-radius: 999px;
1323 color: #fff;
1324 font-weight: 500;
1325 }
398a10cClaude1326 .commit-detail-check a { color: inherit; text-decoration: none; }
1327 .commit-detail-check-success { background: #2ea043; }
1328 .commit-detail-check-pending { background: #d29922; }
1329 .commit-detail-check-failure { background: #da3633; }
1330
1331 /* ───────── blame ───────── */
1332 .blame-head { margin-bottom: var(--space-5); }
1333 .blame-eyebrow {
1334 display: inline-flex;
1335 align-items: center;
1336 gap: 8px;
1337 text-transform: uppercase;
1338 font-family: var(--font-mono);
1339 font-size: 11px;
1340 letter-spacing: 0.16em;
1341 color: var(--text-muted);
1342 font-weight: 600;
1343 margin-bottom: 10px;
1344 }
1345 .blame-eyebrow-dot {
1346 width: 8px; height: 8px;
1347 border-radius: 9999px;
1348 background: linear-gradient(135deg, #8c6dff, #36c5d6);
1349 box-shadow: 0 0 0 3px rgba(140,109,255,0.18);
1350 }
1351 .blame-title {
1352 font-family: var(--font-display);
1353 font-size: clamp(22px, 3vw, 30px);
1354 font-weight: 800;
1355 letter-spacing: -0.025em;
1356 line-height: 1.15;
1357 margin: 0 0 6px;
1358 color: var(--text-strong);
1359 }
1360 .blame-title code {
1361 font-family: var(--font-mono);
1362 font-size: 0.78em;
1363 color: var(--text-strong);
1364 font-weight: 700;
1365 }
1366 .blame-sub {
1367 margin: 0;
1368 font-size: 14px;
1369 color: var(--text-muted);
1370 line-height: 1.5;
1371 max-width: 700px;
1372 }
efb11c5Claude1373 .blame-toolbar {
398a10cClaude1374 display: flex;
1375 justify-content: space-between;
1376 align-items: center;
1377 gap: var(--space-3);
efb11c5Claude1378 margin-bottom: var(--space-3);
398a10cClaude1379 flex-wrap: wrap;
efb11c5Claude1380 font-size: 13px;
1381 }
398a10cClaude1382 .blame-toolbar-actions { display: flex; gap: 6px; }
1383 .blame-card {
1384 background: var(--bg-elevated);
1385 border: 1px solid var(--border);
1386 border-radius: 14px;
1387 overflow: hidden;
1388 position: relative;
1389 }
1390 .blame-card::before {
1391 content: '';
1392 position: absolute;
1393 top: 0; left: 0; right: 0;
1394 height: 2px;
1395 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
1396 opacity: 0.55;
1397 pointer-events: none;
1398 }
efb11c5Claude1399 .blame-header {
1400 display: flex;
1401 align-items: center;
1402 justify-content: space-between;
1403 gap: var(--space-3);
1404 padding: 10px 14px;
1405 background: var(--bg-secondary);
1406 border-bottom: 1px solid var(--border);
1407 }
1408 .blame-header-meta {
1409 display: flex;
1410 align-items: center;
1411 gap: var(--space-2);
1412 min-width: 0;
1413 flex-wrap: wrap;
1414 }
1415 .blame-header-icon { color: var(--accent); font-size: 14px; }
1416 .blame-header-name {
1417 font-family: var(--font-mono);
1418 font-size: 13px;
1419 color: var(--text-strong);
1420 font-weight: 600;
1421 }
1422 .blame-header-tag {
1423 font-size: 10.5px;
1424 text-transform: uppercase;
1425 letter-spacing: 0.08em;
1426 font-family: var(--font-mono);
1427 background: rgba(140,109,255,0.12);
1428 color: var(--accent);
1429 border-radius: 999px;
1430 padding: 2px 8px;
1431 font-weight: 600;
1432 }
1433 .blame-header-stats {
1434 font-family: var(--font-mono);
1435 font-size: 11.5px;
1436 color: var(--text-muted);
1437 font-variant-numeric: tabular-nums;
1438 border-left: 1px solid var(--border);
1439 padding-left: var(--space-2);
1440 }
1441 .blame-header-actions { display: flex; gap: 6px; flex-shrink: 0; }
398a10cClaude1442 .blame-table {
1443 width: 100%;
1444 border-collapse: collapse;
1445 font-family: var(--font-mono);
1446 font-size: 12.5px;
1447 line-height: 1.6;
1448 }
1449 .blame-table tr { border-bottom: 1px solid transparent; }
1450 .blame-table tr.blame-row-first { border-top: 1px solid var(--border); }
1451 .blame-table tr:first-child.blame-row-first { border-top: 0; }
1452 .blame-table tr:hover .blame-line-content { background: rgba(255,255,255,0.025); }
1453 .blame-gutter {
1454 width: 220px;
1455 min-width: 220px;
1456 padding: 0 12px;
1457 vertical-align: top;
1458 background: rgba(255,255,255,0.012);
1459 border-right: 1px solid var(--border-subtle);
1460 font-variant-numeric: tabular-nums;
1461 color: var(--text-muted);
1462 font-size: 11px;
1463 white-space: nowrap;
1464 overflow: hidden;
1465 text-overflow: ellipsis;
1466 padding-top: 2px;
1467 padding-bottom: 2px;
1468 }
1469 .blame-gutter-inner {
1470 display: inline-flex;
1471 align-items: center;
1472 gap: 7px;
1473 max-width: 100%;
1474 overflow: hidden;
1475 }
1476 .blame-gutter-sha {
1477 font-family: var(--font-mono);
1478 font-size: 10.5px;
1479 font-weight: 600;
1480 color: #c4b5fd;
1481 background: rgba(140,109,255,0.10);
1482 padding: 1px 7px;
1483 border-radius: 9999px;
1484 box-shadow: inset 0 0 0 1px rgba(140,109,255,0.22);
1485 text-decoration: none;
1486 letter-spacing: 0.04em;
1487 flex-shrink: 0;
1488 transition: background 120ms ease, box-shadow 120ms ease, color 120ms ease;
1489 }
1490 .blame-gutter-sha:hover {
1491 background: rgba(140,109,255,0.22);
1492 color: #ddd6fe;
1493 box-shadow: inset 0 0 0 1px rgba(140,109,255,0.50);
1494 text-decoration: none;
1495 }
1496 .blame-gutter-author {
1497 color: var(--text);
1498 overflow: hidden;
1499 text-overflow: ellipsis;
1500 white-space: nowrap;
1501 font-size: 11px;
1502 font-family: var(--font-sans, inherit);
1503 }
1504 .blame-line-num {
1505 width: 1%;
1506 min-width: 50px;
1507 padding: 0 12px;
1508 text-align: right;
1509 color: var(--text-faint);
1510 user-select: none;
1511 border-right: 1px solid var(--border-subtle);
1512 font-variant-numeric: tabular-nums;
1513 }
1514 .blame-line-content {
1515 padding: 0 14px;
1516 white-space: pre;
1517 color: var(--text);
1518 transition: background 120ms ease;
1519 }
efb11c5Claude1520
1521 /* ───────── search ───────── */
1522 .search-hero {
1523 position: relative;
1524 margin-bottom: var(--space-4);
1525 padding: var(--space-5) var(--space-6);
1526 background: var(--bg-elevated);
1527 border: 1px solid var(--border);
1528 border-radius: 16px;
1529 overflow: hidden;
1530 }
1531 .search-eyebrow {
1532 font-size: 12px;
1533 font-family: var(--font-mono);
1534 color: var(--text-muted);
1535 letter-spacing: 0.1em;
1536 text-transform: uppercase;
1537 margin-bottom: var(--space-2);
1538 }
1539 .search-eyebrow strong { color: var(--accent); font-weight: 600; }
1540 .search-title {
1541 font-family: var(--font-display);
1542 font-weight: 800;
1543 letter-spacing: -0.025em;
1544 font-size: clamp(22px, 3vw, 30px);
1545 line-height: 1.15;
1546 margin: 0 0 var(--space-3);
1547 color: var(--text-strong);
1548 }
1549 .search-form {
1550 display: flex;
1551 gap: var(--space-2);
1552 align-items: stretch;
1553 }
1554 .search-input-wrap {
1555 position: relative;
1556 flex: 1;
1557 display: flex;
1558 align-items: center;
1559 }
1560 .search-input-icon {
1561 position: absolute;
1562 left: 12px;
1563 color: var(--text-muted);
1564 font-size: 15px;
1565 pointer-events: none;
1566 }
1567 .search-input {
1568 appearance: none;
1569 width: 100%;
1570 padding: 10px 12px 10px 34px;
1571 background: var(--bg);
1572 border: 1px solid var(--border);
1573 border-radius: 10px;
1574 color: var(--text-strong);
1575 font-size: 14px;
1576 font-family: inherit;
1577 transition: border-color var(--t-fast, 0.15s) ease, box-shadow var(--t-fast, 0.15s) ease;
1578 }
1579 .search-input:focus {
1580 outline: none;
1581 border-color: var(--accent);
1582 box-shadow: 0 0 0 3px rgba(140,109,255,0.18);
1583 }
1584 .search-submit { min-width: 96px; }
1585 .search-results-head {
1586 display: flex;
1587 align-items: baseline;
1588 gap: var(--space-2);
1589 margin-bottom: var(--space-3);
1590 font-size: 13px;
1591 color: var(--text-muted);
1592 }
1593 .search-results-count strong {
1594 color: var(--text-strong);
1595 font-weight: 600;
1596 font-variant-numeric: tabular-nums;
1597 }
1598 .search-results-q { color: var(--text-strong); font-weight: 600; }
1599 .search-results-head code {
1600 font-family: var(--font-mono);
1601 font-size: 12px;
1602 background: var(--bg-secondary);
1603 border: 1px solid var(--border);
1604 border-radius: 5px;
1605 padding: 1px 6px;
1606 color: var(--text);
1607 }
1608 .search-empty {
1609 padding: var(--space-5) var(--space-6);
1610 background: var(--bg-elevated);
1611 border: 1px dashed var(--border);
1612 border-radius: 12px;
1613 color: var(--text-muted);
1614 font-size: 14px;
1615 }
1616 .search-empty strong { color: var(--text-strong); }
1617 .search-results {
1618 display: flex;
1619 flex-direction: column;
1620 gap: var(--space-3);
1621 }
1622 .search-file-head {
1623 display: flex;
1624 align-items: center;
1625 justify-content: space-between;
1626 gap: var(--space-2);
1627 }
1628 .search-file-link {
1629 font-family: var(--font-mono);
1630 font-size: 13px;
1631 color: var(--text-strong);
1632 font-weight: 600;
1633 }
1634 .search-file-link:hover { color: var(--accent); text-decoration: none; }
1635 .search-file-count {
1636 font-family: var(--font-mono);
1637 font-size: 11.5px;
1638 color: var(--text-muted);
1639 font-variant-numeric: tabular-nums;
1640 }
1641`;
1642
fc1817aClaude1643// Home page
06d5ffeClaude1644web.get("/", async (c) => {
1645 const user = c.get("user");
1646
1647 if (user) {
0316dbbClaude1648 return c.redirect("/dashboard");
06d5ffeClaude1649 }
1650
8e9f1d9Claude1651 let stats: { publicRepos?: number; users?: number } | undefined;
52ad8b1Claude1652 let publicStats: PublicStats | null = null;
8e9f1d9Claude1653 try {
1654 const [repoRow] = await db
1655 .select({ n: sql<number>`count(*)::int` })
1656 .from(repositories)
1657 .where(eq(repositories.isPrivate, false));
1658 const [userRow] = await db
1659 .select({ n: sql<number>`count(*)::int` })
1660 .from(users);
1661 stats = {
1662 publicRepos: Number(repoRow?.n ?? 0),
1663 users: Number(userRow?.n ?? 0),
1664 };
1665 } catch {
1666 stats = undefined;
1667 }
1668
52ad8b1Claude1669 // Block L4 — public stats counters (5-min in-memory cache; never throws).
1670 try {
1671 publicStats = await computePublicStats();
1672 } catch {
1673 publicStats = null;
1674 }
1675
534f04aClaude1676 // Block M1 — initial SSR snapshot for the live-now demo feed.
1677 // The helpers in lib/demo-activity.ts never throw, but we still wrap
1678 // in try/catch so a freak module-level explosion can't take down /.
1679 let liveFeed: LandingLiveFeed | null = null;
1680 try {
1681 const [queued, merges, reviewList, reviewCount, feed] = await Promise.all([
1682 listQueuedAiBuildIssues(3),
1683 listRecentAutoMerges(3, 24),
1684 listRecentAiReviews(3, 24),
1685 countAiReviewsSince(24),
1686 listDemoActivityFeed(10),
1687 ]);
1688 liveFeed = {
1689 queued: queued.map((i) => ({
1690 repo: i.repo,
1691 number: i.number,
1692 title: i.title,
1693 createdAt: i.createdAt,
1694 })),
1695 merges: merges.map((m) => ({
1696 repo: m.repo,
1697 number: m.number,
1698 title: m.title,
1699 mergedAt: m.mergedAt,
1700 })),
1701 reviews: reviewList.map((r) => ({
1702 repo: r.repo,
1703 prNumber: r.prNumber,
1704 commentSnippet: r.commentSnippet,
1705 createdAt: r.createdAt,
1706 })),
1707 reviewCount,
1708 feed: feed.map((e) => ({
1709 kind: e.kind,
1710 repo: e.repo,
1711 ref: e.ref,
1712 at: e.at,
1713 })),
1714 };
1715 } catch {
1716 liveFeed = null;
1717 }
1718
fc1817aClaude1719 return c.html(
5f2e749Claude1720 <Layout
1721 user={null}
1722 // Block L10 — SEO + Open Graph for the public landing.
1723 fullTitle="Gluecron — The git host built around Claude"
1724 description="Label an issue. Walk away. Wake up to a merged PR. Gluecron is the AI-native git host with built-in code review, auto-merge, and a Claude-first toolchain."
1725 ogTitle="Gluecron — The git host built around Claude"
1726 ogDescription="Label an issue. Walk away. Wake up to a merged PR. Gluecron is the AI-native git host with built-in code review, auto-merge, and a Claude-first toolchain."
1727 ogType="website"
1728 twitterCard="summary_large_image"
1729 >
534f04aClaude1730 <LandingPage stats={stats} publicStats={publicStats} liveFeed={liveFeed} />
fc1817aClaude1731 </Layout>
1732 );
1733});
1734
06d5ffeClaude1735// New repository form
1736web.get("/new", requireAuth, (c) => {
1737 const user = c.get("user")!;
1738 const error = c.req.query("error");
1739
1740 return c.html(
1741 <Layout title="New repository" user={user}>
efb11c5Claude1742 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
1743 <div class="new-repo-hero">
1744 <div class="new-repo-hero-orb-wrap" aria-hidden="true">
1745 <div class="new-repo-hero-orb" />
1746 </div>
1747 <div class="new-repo-hero-inner">
1748 <div class="new-repo-eyebrow">
1749 <strong>Create</strong> · {user.username}
1750 </div>
1751 <h1 class="new-repo-title">
1752 Spin up a <span class="gradient-text">repository</span>.
1753 </h1>
1754 <p class="new-repo-sub">
1755 Push your first commit, and Gluecron wires up gate checks, AI review,
1756 and auto-merge from the moment your branch lands.
1757 </p>
1758 </div>
1759 </div>
06d5ffeClaude1760 <div class="new-repo-form">
efb11c5Claude1761 {error && (
1762 <div class="new-repo-error" role="alert">
1763 {decodeURIComponent(error)}
1764 </div>
1765 )}
1766 <form method="post" action="/new" class="new-repo-form-grid">
1767 <div class="new-repo-row">
1768 <label class="new-repo-label">Owner</label>
1769 <input
1770 type="text"
1771 value={user.username}
1772 disabled
1773 aria-label="Owner"
1774 class="new-repo-input new-repo-input-disabled"
1775 />
06d5ffeClaude1776 </div>
efb11c5Claude1777 <div class="new-repo-row">
1778 <label class="new-repo-label" for="name">
1779 Repository name
1780 </label>
06d5ffeClaude1781 <input
1782 type="text"
1783 id="name"
1784 name="name"
1785 required
1786 pattern="^[a-zA-Z0-9._-]+$"
1787 placeholder="my-project"
1788 autocomplete="off"
efb11c5Claude1789 class="new-repo-input"
06d5ffeClaude1790 />
efb11c5Claude1791 <p class="new-repo-hint">
1792 Lowercase, numbers, dots, dashes, and underscores. The URL will be{" "}
1793 <code>{user.username}/&lt;name&gt;</code>.
1794 </p>
06d5ffeClaude1795 </div>
efb11c5Claude1796 <div class="new-repo-row">
1797 <label class="new-repo-label" for="description">
1798 Description{" "}
1799 <span class="new-repo-label-optional">(optional)</span>
1800 </label>
06d5ffeClaude1801 <input
1802 type="text"
1803 id="description"
1804 name="description"
1805 placeholder="A short description of your repository"
efb11c5Claude1806 class="new-repo-input"
06d5ffeClaude1807 />
1808 </div>
efb11c5Claude1809 <div class="new-repo-row">
1810 <span class="new-repo-label">Visibility</span>
1811 <div class="new-repo-visibility">
1812 <label class="new-repo-vis-card">
1813 <input
1814 type="radio"
1815 name="visibility"
1816 value="public"
1817 checked
1818 class="new-repo-vis-radio"
1819 />
1820 <span class="new-repo-vis-body">
1821 <span class="new-repo-vis-label">Public</span>
1822 <span class="new-repo-vis-desc">
1823 Anyone can see this repository. You choose who can commit.
1824 </span>
1825 </span>
1826 </label>
1827 <label class="new-repo-vis-card">
1828 <input
1829 type="radio"
1830 name="visibility"
1831 value="private"
1832 class="new-repo-vis-radio"
1833 />
1834 <span class="new-repo-vis-body">
1835 <span class="new-repo-vis-label">Private</span>
1836 <span class="new-repo-vis-desc">
1837 Only you (and collaborators you invite) can see this
1838 repository.
1839 </span>
1840 </span>
1841 </label>
1842 </div>
1843 </div>
398a10cClaude1844 <div class="new-repo-row">
1845 <span class="new-repo-label">
1846 Starter content{" "}
1847 <span class="new-repo-label-optional">(cosmetic — your first push wins)</span>
1848 </span>
1849 <div class="new-repo-templates" role="radiogroup" aria-label="Starter content">
1850 <label class="new-repo-template-chip">
1851 <input type="radio" name="starter" value="empty" checked />
1852 <span class="new-repo-template-chip-dot" aria-hidden="true" />
1853 Empty
1854 </label>
1855 <label class="new-repo-template-chip">
1856 <input type="radio" name="starter" value="readme" />
1857 <span class="new-repo-template-chip-dot" aria-hidden="true" />
1858 README
1859 </label>
1860 <label class="new-repo-template-chip">
1861 <input type="radio" name="starter" value="readme-mit" />
1862 <span class="new-repo-template-chip-dot" aria-hidden="true" />
1863 README + MIT
1864 </label>
1865 <label class="new-repo-template-chip">
1866 <input type="radio" name="starter" value="node" />
1867 <span class="new-repo-template-chip-dot" aria-hidden="true" />
1868 Node + .gitignore
1869 </label>
1870 </div>
1871 <p class="new-repo-hint">
1872 Just a UI hint — push your own commits to fill the repo.
1873 </p>
1874 </div>
efb11c5Claude1875 <div class="new-repo-callout">
1876 <div class="new-repo-callout-eyebrow">AI-native by default</div>
1877 <p class="new-repo-callout-body">
1878 Every push is gate-checked and reviewed by Claude automatically.
1879 Label an issue <code>ai-build</code> and Gluecron will open the PR
1880 for you.
1881 </p>
1882 </div>
1883 <div class="new-repo-actions">
398a10cClaude1884 <button type="submit" class="btn new-repo-submit">
efb11c5Claude1885 Create repository
1886 </button>
1887 <a href="/dashboard" class="btn new-repo-cancel">
1888 Cancel
1889 </a>
06d5ffeClaude1890 </div>
1891 </form>
1892 </div>
1893 </Layout>
1894 );
1895});
1896
1897web.post("/new", requireAuth, async (c) => {
1898 const user = c.get("user")!;
1899 const body = await c.req.parseBody();
1900 const name = String(body.name || "").trim();
1901 const description = String(body.description || "").trim();
1902 const isPrivate = body.visibility === "private";
1903
1904 if (!name) {
1905 return c.redirect("/new?error=Repository+name+is+required");
1906 }
1907
c63b860Claude1908 // P4 — plan-quota gate. Fail-open inside the helper so a billing
1909 // outage never blocks repo creation.
1910 const { checkRepoCreateAllowed } = await import("../lib/repo-create-gate");
1911 const gate = await checkRepoCreateAllowed(user.id);
1912 if (!gate.ok) {
1913 return c.redirect(`/new?error=${encodeURIComponent(gate.reason)}`);
1914 }
1915
06d5ffeClaude1916 if (!/^[a-zA-Z0-9._-]+$/.test(name)) {
1917 return c.redirect("/new?error=Invalid+repository+name");
1918 }
1919
1920 if (await repoExists(user.username, name)) {
1921 return c.redirect("/new?error=Repository+already+exists");
1922 }
1923
1924 const diskPath = await initBareRepo(user.username, name);
1925
3ef4c9dClaude1926 const [newRepo] = await db
1927 .insert(repositories)
1928 .values({
1929 name,
1930 ownerId: user.id,
1931 description: description || null,
1932 isPrivate,
1933 diskPath,
1934 })
1935 .returning();
1936
1937 if (newRepo) {
1938 const { bootstrapRepository } = await import("../lib/repo-bootstrap");
1939 await bootstrapRepository({
1940 repositoryId: newRepo.id,
1941 ownerUserId: user.id,
1942 defaultBranch: "main",
1943 });
1944 }
06d5ffeClaude1945
1946 return c.redirect(`/${user.username}/${name}`);
1947});
1948
1949// User profile
fc1817aClaude1950web.get("/:owner", async (c) => {
06d5ffeClaude1951 const { owner: ownerName } = c.req.param();
1952 const user = c.get("user");
1953
1954 // Avoid clashing with fixed routes
1955 if (
1956 ["login", "register", "logout", "new", "settings", "api"].includes(
1957 ownerName
1958 )
1959 ) {
1960 return c.notFound();
1961 }
1962
1963 let ownerUser;
1964 try {
1965 const [found] = await db
1966 .select()
1967 .from(users)
1968 .where(eq(users.username, ownerName))
1969 .limit(1);
1970 ownerUser = found;
1971 } catch {
1972 // DB not available — check if repos exist on disk
1973 ownerUser = null;
1974 }
1975
1976 // Even without DB, show repos if they exist on disk
1977 let repos: any[] = [];
1978 if (ownerUser) {
1979 const allRepos = await db
1980 .select()
1981 .from(repositories)
1982 .where(eq(repositories.ownerId, ownerUser.id))
1983 .orderBy(desc(repositories.updatedAt));
1984
1985 // Show public repos to everyone, private only to owner
1986 repos =
1987 user?.id === ownerUser.id
1988 ? allRepos
1989 : allRepos.filter((r) => !r.isPrivate);
1990 }
1991
7aa8b99Claude1992 // Block J4 — follow counts + viewer's follow state
1993 let followState = {
1994 followers: 0,
1995 following: 0,
1996 viewerFollows: false,
1997 };
1998 if (ownerUser) {
1999 try {
2000 const { followCounts, isFollowing } = await import("../lib/follows");
2001 const counts = await followCounts(ownerUser.id);
2002 followState.followers = counts.followers;
2003 followState.following = counts.following;
2004 if (user && user.id !== ownerUser.id) {
2005 followState.viewerFollows = await isFollowing(user.id, ownerUser.id);
2006 }
2007 } catch {
2008 // DB hiccup — fall back to zeros.
2009 }
2010 }
2011 const canFollow = !!user && !!ownerUser && user.id !== ownerUser.id;
2012
d412586Claude2013 // Block J5 — profile README. Render owner/owner repo's README on the
2014 // profile page (GitHub convention). Tries "<user>/<user>" first, falling
2015 // back to "<user>/.github" for org-style profile repos.
2016 let profileReadmeHtml: string | null = null;
2017 try {
2018 const candidates = [ownerName, ".github"];
2019 for (const rname of candidates) {
2020 if (await repoExists(ownerName, rname)) {
2021 const ref = (await getDefaultBranch(ownerName, rname)) || "main";
2022 const md = await getReadme(ownerName, rname, ref);
2023 if (md) {
2024 profileReadmeHtml = renderMarkdown(md);
2025 break;
2026 }
2027 }
2028 }
2029 } catch {
2030 profileReadmeHtml = null;
2031 }
2032
efb11c5Claude2033 const displayName = ownerUser?.displayName || ownerName;
2034 const memberSince = ownerUser?.createdAt
2035 ? new Date(ownerUser.createdAt as unknown as string | number | Date)
2036 : null;
2037
fc1817aClaude2038 return c.html(
06d5ffeClaude2039 <Layout title={ownerName} user={user}>
efb11c5Claude2040 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
2041 <div class="profile-hero">
2042 <div class="profile-hero-orb-wrap" aria-hidden="true">
2043 <div class="profile-hero-orb" />
06d5ffeClaude2044 </div>
efb11c5Claude2045 <div class="profile-hero-inner">
2046 <div class="profile-hero-avatar" aria-hidden="true">
2047 {displayName[0].toUpperCase()}
2048 </div>
2049 <div class="profile-hero-text">
2050 <div class="profile-eyebrow">
2051 <strong>Developer</strong>
2052 {memberSince && !Number.isNaN(memberSince.getTime()) && (
2053 <>
2054 {" "}· Joined{" "}
2055 {memberSince.toLocaleDateString("en-US", {
2056 month: "short",
2057 year: "numeric",
2058 })}
2059 </>
2060 )}
2061 </div>
2062 <h1 class="profile-name">
2063 <span class="gradient-text">{displayName}</span>
2064 </h1>
2065 <div class="profile-handle">@{ownerName}</div>
2066 {ownerUser?.bio && <p class="profile-bio">{ownerUser.bio}</p>}
2067 <div class="profile-meta">
2068 <a href={`/${ownerName}/followers`} class="profile-meta-link">
2069 <strong>{followState.followers}</strong> follower
2070 {followState.followers === 1 ? "" : "s"}
2071 </a>
2072 <a href={`/${ownerName}/following`} class="profile-meta-link">
2073 <strong>{followState.following}</strong> following
2074 </a>
2075 <a href={`/${ownerName}`} class="profile-meta-link">
2076 <strong>{repos.length}</strong> repo
2077 {repos.length === 1 ? "" : "s"}
2078 </a>
2079 {canFollow && (
2080 <form
2081 method="post"
2082 action={`/${ownerName}/${
2083 followState.viewerFollows ? "unfollow" : "follow"
2084 }`}
2085 class="profile-follow-form"
7aa8b99Claude2086 >
efb11c5Claude2087 <button
2088 type="submit"
2089 class={`btn ${
2090 followState.viewerFollows ? "" : "btn-primary"
2091 } btn-sm`}
2092 >
2093 {followState.viewerFollows ? "Unfollow" : "Follow"}
2094 </button>
2095 </form>
2096 )}
2097 </div>
7aa8b99Claude2098 </div>
06d5ffeClaude2099 </div>
2100 </div>
d412586Claude2101 {profileReadmeHtml && (
efb11c5Claude2102 <div class="profile-readme">
2103 <div class="profile-readme-head">
2104 <span class="profile-readme-icon">{"☰"}</span>
2105 <span>{ownerName}/{ownerName} README.md</span>
2106 </div>
2107 <div
2108 class="markdown-body profile-readme-body"
2109 dangerouslySetInnerHTML={{ __html: profileReadmeHtml }}
2110 />
2111 </div>
d412586Claude2112 )}
efb11c5Claude2113 <div class="profile-section-head">
2114 <h2 class="profile-section-title">Repositories</h2>
2115 <span class="profile-section-count">{repos.length}</span>
2116 </div>
06d5ffeClaude2117 {repos.length === 0 ? (
efb11c5Claude2118 <div class="profile-empty">
2119 <p class="profile-empty-text">
2120 No repositories yet
2121 {user?.id === ownerUser?.id ? "." : ` — ${ownerName} is just getting started.`}
2122 </p>
2123 {user?.id === ownerUser?.id && (
2124 <a href="/new" class="btn btn-primary btn-sm">
2125 + Create your first
2126 </a>
2127 )}
2128 </div>
06d5ffeClaude2129 ) : (
2130 <div class="card-grid">
2131 {repos.map((repo) => (
2132 <RepoCard repo={repo} ownerName={ownerName} />
2133 ))}
2134 </div>
2135 )}
fc1817aClaude2136 </Layout>
2137 );
2138});
2139
06d5ffeClaude2140// Star/unstar a repo
2141web.post("/:owner/:repo/star", requireAuth, async (c) => {
2142 const { owner: ownerName, repo: repoName } = c.req.param();
2143 const user = c.get("user")!;
2144
2145 try {
2146 const [ownerUser] = await db
2147 .select()
2148 .from(users)
2149 .where(eq(users.username, ownerName))
2150 .limit(1);
2151 if (!ownerUser) return c.redirect(`/${ownerName}/${repoName}`);
2152
2153 const [repo] = await db
2154 .select()
2155 .from(repositories)
2156 .where(
2157 and(
2158 eq(repositories.ownerId, ownerUser.id),
2159 eq(repositories.name, repoName)
2160 )
2161 )
2162 .limit(1);
2163 if (!repo) return c.redirect(`/${ownerName}/${repoName}`);
2164
2165 // Toggle star
2166 const [existing] = await db
2167 .select()
2168 .from(stars)
2169 .where(
2170 and(eq(stars.userId, user.id), eq(stars.repositoryId, repo.id))
2171 )
2172 .limit(1);
2173
2174 if (existing) {
2175 await db.delete(stars).where(eq(stars.id, existing.id));
2176 await db
2177 .update(repositories)
2178 .set({ starCount: Math.max(0, repo.starCount - 1) })
2179 .where(eq(repositories.id, repo.id));
2180 } else {
2181 await db.insert(stars).values({
2182 userId: user.id,
2183 repositoryId: repo.id,
2184 });
2185 await db
2186 .update(repositories)
2187 .set({ starCount: repo.starCount + 1 })
2188 .where(eq(repositories.id, repo.id));
2189 }
2190 } catch {
2191 // DB error — ignore
2192 }
2193
2194 return c.redirect(`/${ownerName}/${repoName}`);
2195});
2196
fc1817aClaude2197// Repository overview — file tree at HEAD
2198web.get("/:owner/:repo", async (c) => {
2199 const { owner, repo } = c.req.param();
06d5ffeClaude2200 const user = c.get("user");
fc1817aClaude2201
f1dc7c7Claude2202 // ── Loading skeleton (flag-gated) ──
2203 // Renders an SSR'd shell with file-tree + README placeholders when
2204 // `?skeleton=1` is set. Lets the user see the page structure before
2205 // git ops finish. Behind a flag for now so we never flash before the
2206 // real content lands.
2207 if (c.req.query("skeleton") === "1") {
2208 return c.html(
2209 <Layout title={`${owner}/${repo}`} user={user}>
2210 <style
2211 dangerouslySetInnerHTML={{
2212 __html: `
2213 .repo-skel { background: linear-gradient(90deg, var(--bg-secondary) 0%, var(--bg-elevated) 50%, var(--bg-secondary) 100%); background-size: 200% 100%; animation: repoSkelShimmer 1.4s infinite; border-radius: 6px; display: block; }
2214 @keyframes repoSkelShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
2215 @media (prefers-reduced-motion: reduce) { .repo-skel { animation: none; } }
2216 .repo-skel-hero { height: 132px; border-radius: 16px; margin-bottom: var(--space-4); }
2217 .repo-skel-nav { height: 36px; border-radius: 8px; margin-bottom: var(--space-4); }
2218 .repo-skel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-5); align-items: start; }
2219 @media (max-width: 960px) { .repo-skel-grid { grid-template-columns: minmax(0, 1fr); } }
2220 .repo-skel-branch { height: 32px; width: 200px; border-radius: 8px; margin-bottom: 12px; }
2221 .repo-skel-tree { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-5); }
2222 .repo-skel-tree-row { height: 36px; border-radius: 8px; }
2223 .repo-skel-readme { height: 320px; border-radius: 12px; }
2224 .repo-skel-side { display: flex; flex-direction: column; gap: var(--space-4); }
2225 .repo-skel-side-card { height: 180px; border-radius: 12px; }
2226 `,
2227 }}
2228 />
2229 <div class="repo-skel repo-skel-hero" aria-hidden="true" />
2230 <div class="repo-skel repo-skel-nav" aria-hidden="true" />
2231 <div class="repo-skel-grid" aria-hidden="true">
2232 <div>
2233 <div class="repo-skel repo-skel-branch" />
2234 <div class="repo-skel-tree">
2235 {Array.from({ length: 8 }).map(() => (
2236 <div class="repo-skel repo-skel-tree-row" />
2237 ))}
2238 </div>
2239 <div class="repo-skel repo-skel-readme" />
2240 </div>
2241 <aside class="repo-skel-side">
2242 <div class="repo-skel repo-skel-side-card" />
2243 <div class="repo-skel repo-skel-side-card" />
2244 </aside>
2245 </div>
2246 <span style="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0" role="status" aria-live="polite">
2247 Loading {owner}/{repo}…
2248 </span>
2249 </Layout>
2250 );
2251 }
2252
8f50ed0Claude2253 // F1 — fire-and-forget traffic tracking. Never awaits; never throws.
2254 trackByName(owner, repo, "view", {
2255 userId: user?.id || null,
2256 path: `/${owner}/${repo}`,
2257 ip: c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || null,
2258 userAgent: c.req.header("user-agent") || null,
2259 referer: c.req.header("referer") || null,
a28cedeClaude2260 }).catch((err) => {
2261 console.warn(
2262 `[web] view tracking failed for ${owner}/${repo}:`,
2263 err instanceof Error ? err.message : err
2264 );
2265 });
8f50ed0Claude2266
fc1817aClaude2267 if (!(await repoExists(owner, repo))) {
2268 return c.html(
06d5ffeClaude2269 <Layout title="Not Found" user={user}>
fc1817aClaude2270 <div class="empty-state">
2271 <h2>Repository not found</h2>
2272 <p>
2273 {owner}/{repo} does not exist.
2274 </p>
2275 </div>
2276 </Layout>,
2277 404
2278 );
2279 }
2280
05b973eClaude2281 // Parallelize all independent operations
2282 const [defaultBranch, branches] = await Promise.all([
2283 getDefaultBranch(owner, repo).then((b) => b || "main"),
2284 listBranches(owner, repo),
2285 ]);
2286 const [tree, starInfo] = await Promise.all([
2287 getTree(owner, repo, defaultBranch),
2288 // Star info fetched in parallel with tree
2289 (async () => {
2290 try {
2291 const [ownerUser] = await db
2292 .select()
2293 .from(users)
2294 .where(eq(users.username, owner))
2295 .limit(1);
71cd5ecClaude2296 if (!ownerUser)
2297 return {
2298 starCount: 0,
2299 starred: false,
2300 archived: false,
2301 isTemplate: false,
544d842Claude2302 forkCount: 0,
2303 description: null as string | null,
2304 pushedAt: null as Date | null,
2305 createdAt: null as Date | null,
cb5a796Claude2306 repoId: null as string | null,
2307 repoOwnerId: null as string | null,
71cd5ecClaude2308 };
05b973eClaude2309 const [repoRow] = await db
2310 .select()
2311 .from(repositories)
2312 .where(
2313 and(
2314 eq(repositories.ownerId, ownerUser.id),
2315 eq(repositories.name, repo)
2316 )
06d5ffeClaude2317 )
05b973eClaude2318 .limit(1);
71cd5ecClaude2319 if (!repoRow)
2320 return {
2321 starCount: 0,
2322 starred: false,
2323 archived: false,
2324 isTemplate: false,
544d842Claude2325 forkCount: 0,
2326 description: null as string | null,
2327 pushedAt: null as Date | null,
2328 createdAt: null as Date | null,
cb5a796Claude2329 repoId: null as string | null,
2330 repoOwnerId: null as string | null,
71cd5ecClaude2331 };
05b973eClaude2332 let starred = false;
06d5ffeClaude2333 if (user) {
2334 const [star] = await db
2335 .select()
2336 .from(stars)
2337 .where(
2338 and(
2339 eq(stars.userId, user.id),
2340 eq(stars.repositoryId, repoRow.id)
2341 )
2342 )
2343 .limit(1);
2344 starred = !!star;
2345 }
71cd5ecClaude2346 return {
2347 starCount: repoRow.starCount,
2348 starred,
2349 archived: repoRow.isArchived,
2350 isTemplate: repoRow.isTemplate,
544d842Claude2351 forkCount: repoRow.forkCount,
2352 description: repoRow.description as string | null,
2353 pushedAt: (repoRow.pushedAt as Date | null) ?? null,
2354 createdAt: (repoRow.createdAt as Date | null) ?? null,
cb5a796Claude2355 repoId: repoRow.id as string,
2356 repoOwnerId: repoRow.ownerId as string,
71cd5ecClaude2357 };
05b973eClaude2358 } catch {
71cd5ecClaude2359 return {
2360 starCount: 0,
2361 starred: false,
2362 archived: false,
2363 isTemplate: false,
544d842Claude2364 forkCount: 0,
2365 description: null as string | null,
2366 pushedAt: null as Date | null,
2367 createdAt: null as Date | null,
cb5a796Claude2368 repoId: null as string | null,
2369 repoOwnerId: null as string | null,
71cd5ecClaude2370 };
06d5ffeClaude2371 }
05b973eClaude2372 })(),
2373 ]);
544d842Claude2374 const {
2375 starCount,
2376 starred,
2377 archived,
2378 isTemplate,
2379 forkCount,
2380 description,
2381 pushedAt,
2382 createdAt,
cb5a796Claude2383 repoId,
2384 repoOwnerId,
544d842Claude2385 } = starInfo;
2386
cb5a796Claude2387 // Pending-comments banner data (lazy + best-effort). Only the repo
2388 // owner sees the banner, so non-owner views skip the DB hit entirely.
2389 let repoHomePendingCount = 0;
2390 if (user && repoOwnerId && user.id === repoOwnerId && repoId) {
2391 try {
2392 const { countPendingForRepo } = await import(
2393 "../lib/comment-moderation"
2394 );
2395 repoHomePendingCount = await countPendingForRepo(repoId);
2396 } catch {
2397 /* swallow */
2398 }
2399 }
2400
544d842Claude2401 // Repo-home polish — shared style block (Block 2.A — parallel session 2.A).
2402 // Scoped via .repo-home-* class prefix to prevent bleed into other surfaces.
2403 const repoHomeCss = `
2404 .repo-home-hero {
2405 position: relative;
2406 margin-bottom: var(--space-5);
2407 padding: var(--space-5) var(--space-6);
2408 background: var(--bg-elevated);
2409 border: 1px solid var(--border);
2410 border-radius: 16px;
2411 overflow: hidden;
2412 }
2413 .repo-home-hero::before {
2414 content: '';
2415 position: absolute;
2416 top: 0; left: 0; right: 0;
2417 height: 2px;
2418 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
2419 opacity: 0.7;
2420 pointer-events: none;
2421 }
2422 .repo-home-hero-orb-wrap {
2423 position: absolute;
2424 inset: -25% -10% auto auto;
2425 width: 360px;
2426 height: 360px;
2427 pointer-events: none;
2428 z-index: 0;
2429 }
2430 .repo-home-hero-orb {
2431 position: absolute;
2432 inset: 0;
2433 background: radial-gradient(circle, rgba(140,109,255,0.18), rgba(54,197,214,0.09) 45%, transparent 70%);
2434 filter: blur(80px);
2435 opacity: 0.7;
2436 animation: repoHomeOrb 14s ease-in-out infinite;
2437 }
2438 @keyframes repoHomeOrb {
2439 0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.55; }
2440 50% { transform: scale(1.1) translate(-10px, 8px); opacity: 0.8; }
2441 }
2442 @media (prefers-reduced-motion: reduce) {
2443 .repo-home-hero-orb { animation: none; }
2444 }
2445 .repo-home-hero-inner {
2446 position: relative;
2447 z-index: 1;
2448 }
2449 .repo-home-hero .repo-header { margin-bottom: var(--space-3); }
2450 .repo-home-eyebrow {
2451 font-size: 12px;
2452 font-family: var(--font-mono);
2453 color: var(--text-muted);
2454 letter-spacing: 0.1em;
2455 text-transform: uppercase;
2456 margin-bottom: var(--space-2);
2457 }
2458 .repo-home-eyebrow strong { color: var(--accent); font-weight: 600; }
2459 .repo-home-description {
2460 font-size: 15px;
2461 line-height: 1.55;
2462 color: var(--text);
2463 margin: 0;
2464 max-width: 720px;
2465 }
2466 .repo-home-description-empty {
2467 font-size: 14px;
2468 color: var(--text-muted);
2469 font-style: italic;
2470 margin: 0;
2471 }
2472 .repo-home-stat-row {
2473 display: flex;
2474 flex-wrap: wrap;
2475 gap: var(--space-4);
2476 margin-top: var(--space-3);
2477 font-size: 13px;
2478 color: var(--text-muted);
2479 }
2480 .repo-home-stat {
2481 display: inline-flex;
2482 align-items: center;
2483 gap: 6px;
2484 }
2485 .repo-home-stat strong {
2486 color: var(--text-strong);
2487 font-weight: 600;
2488 font-variant-numeric: tabular-nums;
2489 }
2490 .repo-home-stat .repo-home-stat-icon {
2491 color: var(--text-faint);
2492 font-size: 14px;
2493 line-height: 1;
2494 }
2495 .repo-home-stat a {
2496 color: var(--text-muted);
2497 transition: color var(--t-fast) var(--ease);
2498 }
2499 .repo-home-stat a:hover { color: var(--accent); text-decoration: none; }
2500
2501 /* Two-column layout: file tree + sidebar */
2502 .repo-home-grid {
2503 display: grid;
2504 grid-template-columns: minmax(0, 1fr) 280px;
2505 gap: var(--space-5);
2506 align-items: start;
2507 }
2508 @media (max-width: 960px) {
2509 .repo-home-grid { grid-template-columns: minmax(0, 1fr); }
2510 }
2511 .repo-home-main { min-width: 0; }
2512
2513 /* Sidebar card */
2514 .repo-home-side {
2515 display: flex;
2516 flex-direction: column;
2517 gap: var(--space-4);
2518 }
2519 .repo-home-side-card {
2520 background: var(--bg-elevated);
2521 border: 1px solid var(--border);
2522 border-radius: 12px;
2523 padding: var(--space-4);
2524 }
2525 .repo-home-side-title {
2526 font-size: 11px;
2527 font-family: var(--font-mono);
2528 letter-spacing: 0.12em;
2529 text-transform: uppercase;
2530 color: var(--text-muted);
2531 margin: 0 0 var(--space-3);
2532 font-weight: 600;
2533 }
2534 .repo-home-side-row {
2535 display: flex;
2536 justify-content: space-between;
2537 align-items: center;
2538 gap: var(--space-2);
2539 font-size: 13px;
2540 padding: 6px 0;
2541 border-top: 1px solid var(--border);
2542 }
2543 .repo-home-side-row:first-of-type { border-top: 0; padding-top: 0; }
2544 .repo-home-side-key {
2545 color: var(--text-muted);
2546 display: inline-flex;
2547 align-items: center;
2548 gap: 6px;
2549 }
2550 .repo-home-side-val {
2551 color: var(--text-strong);
2552 font-weight: 500;
2553 font-variant-numeric: tabular-nums;
2554 max-width: 60%;
2555 text-align: right;
2556 overflow: hidden;
2557 text-overflow: ellipsis;
2558 white-space: nowrap;
2559 }
2560 .repo-home-side-val a { color: var(--text-strong); }
2561 .repo-home-side-val a:hover { color: var(--accent); text-decoration: none; }
2562
2563 /* Clone / Code tabs */
2564 .repo-home-clone {
2565 background: var(--bg-elevated);
2566 border: 1px solid var(--border);
2567 border-radius: 12px;
2568 overflow: hidden;
2569 }
2570 .repo-home-clone-tabs {
2571 display: flex;
2572 gap: 0;
2573 background: var(--bg-secondary);
2574 border-bottom: 1px solid var(--border);
2575 padding: 0 var(--space-2);
2576 }
2577 .repo-home-clone-tab {
2578 appearance: none;
2579 background: transparent;
2580 border: 0;
2581 border-bottom: 2px solid transparent;
2582 padding: 9px 12px;
2583 font-size: 12px;
2584 font-weight: 500;
2585 color: var(--text-muted);
2586 cursor: pointer;
2587 transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
2588 font-family: inherit;
2589 margin-bottom: -1px;
2590 }
2591 .repo-home-clone-tab:hover { color: var(--text-strong); }
2592 .repo-home-clone-tab[aria-selected="true"] {
2593 color: var(--text-strong);
2594 border-bottom-color: var(--accent);
2595 }
2596 .repo-home-clone-body {
2597 padding: var(--space-3);
2598 display: flex;
2599 align-items: center;
2600 gap: var(--space-2);
2601 }
2602 .repo-home-clone-input {
2603 flex: 1;
2604 min-width: 0;
2605 font-family: var(--font-mono);
2606 font-size: 12px;
2607 background: var(--bg);
2608 border: 1px solid var(--border);
2609 border-radius: 8px;
2610 padding: 8px 10px;
2611 color: var(--text-strong);
2612 overflow: hidden;
2613 text-overflow: ellipsis;
2614 white-space: nowrap;
2615 }
2616 .repo-home-clone-copy {
2617 appearance: none;
2618 background: var(--bg-secondary);
2619 border: 1px solid var(--border);
2620 color: var(--text-strong);
2621 border-radius: 8px;
2622 padding: 8px 12px;
2623 font-size: 12px;
2624 font-weight: 600;
2625 cursor: pointer;
2626 transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
2627 font-family: inherit;
2628 }
2629 .repo-home-clone-copy:hover { background: var(--bg-hover); border-color: var(--border-strong, var(--border)); }
2630 .repo-home-clone-pane { display: none; }
2631 .repo-home-clone-pane[data-active="true"] { display: flex; }
2632
2633 /* README card */
2634 .repo-home-readme {
2635 margin-top: var(--space-5);
2636 background: var(--bg-elevated);
2637 border: 1px solid var(--border);
2638 border-radius: 12px;
2639 overflow: hidden;
2640 }
2641 .repo-home-readme-head {
2642 display: flex;
2643 align-items: center;
2644 gap: 8px;
2645 padding: 10px 16px;
2646 background: var(--bg-secondary);
2647 border-bottom: 1px solid var(--border);
2648 font-size: 13px;
2649 color: var(--text-muted);
2650 }
2651 .repo-home-readme-head .repo-home-readme-icon {
2652 color: var(--accent);
2653 font-size: 14px;
2654 }
2655 .repo-home-readme-body {
2656 padding: var(--space-5) var(--space-6);
2657 }
2658
2659 /* Empty-state CTA */
2660 .repo-home-empty {
2661 position: relative;
2662 margin-top: var(--space-4);
2663 background: var(--bg-elevated);
2664 border: 1px solid var(--border);
2665 border-radius: 16px;
2666 padding: var(--space-6);
2667 overflow: hidden;
2668 }
2669 .repo-home-empty::before {
2670 content: '';
2671 position: absolute;
2672 top: 0; left: 0; right: 0;
2673 height: 2px;
2674 background: linear-gradient(90deg, transparent 0%, #8c6dff 30%, #36c5d6 70%, transparent 100%);
2675 opacity: 0.7;
2676 pointer-events: none;
2677 }
2678 .repo-home-empty-eyebrow {
2679 font-size: 12px;
2680 font-family: var(--font-mono);
2681 color: var(--accent);
2682 letter-spacing: 0.12em;
2683 text-transform: uppercase;
2684 margin-bottom: var(--space-2);
2685 font-weight: 600;
2686 }
2687 .repo-home-empty-title {
2688 font-family: var(--font-display);
2689 font-weight: 800;
2690 letter-spacing: -0.025em;
2691 font-size: clamp(22px, 3vw, 30px);
2692 line-height: 1.1;
2693 margin: 0 0 var(--space-2);
2694 color: var(--text-strong);
2695 }
2696 .repo-home-empty-sub {
2697 color: var(--text-muted);
2698 font-size: 14px;
2699 line-height: 1.55;
2700 max-width: 640px;
2701 margin: 0 0 var(--space-4);
2702 }
2703 .repo-home-empty-snippet {
2704 background: var(--bg);
2705 border: 1px solid var(--border);
2706 border-radius: 10px;
2707 padding: var(--space-3) var(--space-4);
2708 font-family: var(--font-mono);
2709 font-size: 12.5px;
2710 line-height: 1.7;
2711 color: var(--text-strong);
2712 overflow-x: auto;
2713 white-space: pre;
2714 margin: 0;
2715 }
2716 .repo-home-empty-snippet .repo-home-cmt { color: var(--text-faint); }
2717 .repo-home-empty-snippet .repo-home-cmd { color: var(--accent); }
2718
2719 @media (max-width: 720px) {
2720 .repo-home-hero { padding: var(--space-4) var(--space-4); }
2721 .repo-home-clone-body { flex-direction: column; align-items: stretch; }
2722 .repo-home-clone-copy { width: 100%; }
f1dc7c7Claude2723 .repo-home-stat-row { gap: var(--space-2) var(--space-3); font-size: 12.5px; }
2724 .repo-home-side-val { max-width: 55%; }
2725 .repo-home-clone-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
2726 .repo-home-clone-tab { min-height: 44px; padding: 11px 14px; }
2727 .repo-home-side-card { padding: var(--space-3); }
544d842Claude2728 }
2729 `;
2730 const cloneHttpsUrl = `${config.appBaseUrl}/${owner}/${repo}.git`;
2731 // Best-effort SSH URL. If APP_BASE_URL is a hostname, this looks right; for
2732 // localhost it'll still render and just be slightly silly (which is fine for dev).
2733 let cloneSshUrl = `git@gluecron.com:${owner}/${repo}.git`;
2734 try {
2735 const host = new URL(config.appBaseUrl).hostname;
2736 if (host && host !== "localhost" && host !== "127.0.0.1") {
2737 cloneSshUrl = `git@${host}:${owner}/${repo}.git`;
2738 }
2739 } catch {
2740 // Fall through to default.
2741 }
2742 const cloneCliCmd = `gluecron clone ${owner}/${repo}`;
2743 const formatRelative = (date: Date | null): string => {
2744 if (!date) return "never";
2745 const ms = Date.now() - date.getTime();
2746 const s = Math.max(0, Math.round(ms / 1000));
2747 if (s < 60) return "just now";
2748 const m = Math.round(s / 60);
2749 if (m < 60) return `${m} min ago`;
2750 const h = Math.round(m / 60);
2751 if (h < 24) return `${h}h ago`;
2752 const d = Math.round(h / 24);
2753 if (d < 30) return `${d}d ago`;
2754 const mo = Math.round(d / 30);
2755 if (mo < 12) return `${mo}mo ago`;
2756 const y = Math.round(d / 365);
2757 return `${y}y ago`;
2758 };
06d5ffeClaude2759
fc1817aClaude2760 if (tree.length === 0) {
2761 return c.html(
06d5ffeClaude2762 <Layout title={`${owner}/${repo}`} user={user}>
544d842Claude2763 <style dangerouslySetInnerHTML={{ __html: repoHomeCss }} />
2764 <div class="repo-home-hero">
2765 <div class="repo-home-hero-orb-wrap" aria-hidden="true">
2766 <div class="repo-home-hero-orb" />
2767 </div>
2768 <div class="repo-home-hero-inner">
2769 <div class="repo-home-eyebrow">
2770 <strong>Repository</strong> · {owner}
2771 </div>
2772 <RepoHeader
2773 owner={owner}
2774 repo={repo}
2775 starCount={starCount}
2776 starred={starred}
2777 forkCount={forkCount}
2778 currentUser={user?.username}
2779 archived={archived}
2780 isTemplate={isTemplate}
2781 />
2782 {description ? (
2783 <p class="repo-home-description">{description}</p>
2784 ) : (
2785 <p class="repo-home-description-empty">
2786 No description yet — push a README to tell the world what this
2787 ships.
2788 </p>
2789 )}
2790 </div>
2791 </div>
fc1817aClaude2792 <RepoNav owner={owner} repo={repo} active="code" />
544d842Claude2793 <div class="repo-home-empty">
2794 <div class="repo-home-empty-eyebrow">Getting started</div>
2795 <h2 class="repo-home-empty-title">
2796 Push your first commit to{" "}
2797 <span class="gradient-text">{repo}</span>.
2798 </h2>
2799 <p class="repo-home-empty-sub">
2800 This repository is empty. Paste the snippet below in an existing
2801 project directory to wire it up to Gluecron — your push triggers
2802 gate checks and AI review automatically.
2803 </p>
2804 <pre class="repo-home-empty-snippet">
2805 <span class="repo-home-cmt">
2806 # from an existing project directory
2807 </span>
2808 {"\n"}
2809 <span class="repo-home-cmd">git remote add</span>
2810 {` origin ${cloneHttpsUrl}`}
2811 {"\n"}
2812 <span class="repo-home-cmd">git branch</span>
2813 {` -M main`}
2814 {"\n"}
2815 <span class="repo-home-cmd">git push</span>
2816 {` -u origin main`}
2817 </pre>
fc1817aClaude2818 </div>
2819 </Layout>
2820 );
2821 }
2822
2823 const readme = await getReadme(owner, repo, defaultBranch);
2824
544d842Claude2825 // Sidebar facts — derived from data we already have.
2826 const fileCount = tree.filter((e: any) => e.type !== "tree").length;
2827 const dirCount = tree.filter((e: any) => e.type === "tree").length;
2828
fc1817aClaude2829 return c.html(
06d5ffeClaude2830 <Layout title={`${owner}/${repo}`} user={user}>
544d842Claude2831 <style dangerouslySetInnerHTML={{ __html: repoHomeCss }} />
2832 <div class="repo-home-hero">
2833 <div class="repo-home-hero-orb-wrap" aria-hidden="true">
2834 <div class="repo-home-hero-orb" />
2835 </div>
2836 <div class="repo-home-hero-inner">
2837 <div class="repo-home-eyebrow">
2838 <strong>Repository</strong> · {owner}
2839 </div>
2840 <RepoHeader
2841 owner={owner}
2842 repo={repo}
2843 starCount={starCount}
2844 starred={starred}
2845 forkCount={forkCount}
2846 currentUser={user?.username}
2847 archived={archived}
2848 isTemplate={isTemplate}
2849 />
2850 {description ? (
2851 <p class="repo-home-description">{description}</p>
2852 ) : (
2853 <p class="repo-home-description-empty">
2854 No description yet.
2855 </p>
2856 )}
2857 <div class="repo-home-stat-row" aria-label="Repository stats">
2858 <span class="repo-home-stat" title="Default branch">
2859 <span class="repo-home-stat-icon">{"⎇"}</span>
2860 <strong>{defaultBranch}</strong>
2861 </span>
2862 <a
2863 href={`/${owner}/${repo}/commits/${defaultBranch}`}
2864 class="repo-home-stat"
2865 title="Browse all branches"
2866 >
2867 <span class="repo-home-stat-icon">{"⊢"}</span>
2868 <strong>{branches.length}</strong>{" "}
2869 branch{branches.length === 1 ? "" : "es"}
2870 </a>
2871 <span class="repo-home-stat" title="Top-level entries">
2872 <span class="repo-home-stat-icon">{"■"}</span>
2873 <strong>{fileCount}</strong> file{fileCount === 1 ? "" : "s"}
2874 {dirCount > 0 && (
2875 <>
2876 {" · "}
2877 <strong>{dirCount}</strong> dir{dirCount === 1 ? "" : "s"}
2878 </>
2879 )}
2880 </span>
2881 {pushedAt && (
2882 <span class="repo-home-stat" title={`Last push: ${pushedAt.toISOString()}`}>
2883 <span class="repo-home-stat-icon">{"↻"}</span>
2884 Updated <strong>{formatRelative(pushedAt)}</strong>
2885 </span>
2886 )}
2887 </div>
2888 </div>
2889 </div>
71cd5ecClaude2890 {isTemplate && user && user.username !== owner && (
2891 <div
2892 class="panel"
dc26881CC LABS App2893 style="margin-bottom:var(--space-4);padding:var(--space-3);display:flex;align-items:center;justify-content:space-between;gap:var(--space-3)"
71cd5ecClaude2894 >
2895 <div style="font-size:13px">
2896 <strong>Template repository.</strong> Create a new repository from
2897 this template's files.
2898 </div>
2899 <form
001af43Claude2900 method="post"
71cd5ecClaude2901 action={`/${owner}/${repo}/use-template`}
dc26881CC LABS App2902 style="display:flex;gap:var(--space-2);align-items:center"
71cd5ecClaude2903 >
2904 <input
2905 type="text"
2906 name="name"
2907 placeholder="new-repo-name"
2908 required
2c3ba6ecopilot-swe-agent[bot]2909 aria-label="New repository name"
71cd5ecClaude2910 style="width:200px"
2911 />
2912 <button type="submit" class="btn btn-primary">
2913 Use this template
2914 </button>
2915 </form>
2916 </div>
2917 )}
fc1817aClaude2918 <RepoNav owner={owner} repo={repo} active="code" />
cb5a796Claude2919 <RepoHomePendingBanner
2920 owner={owner}
2921 repo={repo}
2922 count={repoHomePendingCount}
2923 />
c6018a5Claude2924 {/* ─── Per-repo AI surfaces — RepoNav is locked, so the discovery
2925 row sits just below the nav as a slim CTA strip. Scoped under
2926 `.repo-ai-cta-` so the styles can't bleed onto other pages. ─── */}
2927 <style
2928 dangerouslySetInnerHTML={{
2929 __html: `
2930 .repo-ai-cta-row {
2931 display: flex;
2932 flex-wrap: wrap;
2933 gap: 8px;
2934 margin: 12px 0 18px;
2935 padding: 10px 14px;
2936 background: linear-gradient(135deg, rgba(140,109,255,0.06), rgba(54,197,214,0.04));
2937 border: 1px solid var(--border);
2938 border-radius: 10px;
2939 position: relative;
2940 overflow: hidden;
2941 }
2942 .repo-ai-cta-row::before {
2943 content: '';
2944 position: absolute;
2945 top: 0; left: 0; right: 0;
2946 height: 1px;
2947 background: linear-gradient(90deg, transparent 0%, rgba(140,109,255,0.45) 30%, rgba(54,197,214,0.45) 70%, transparent 100%);
2948 opacity: 0.7;
2949 pointer-events: none;
2950 }
2951 .repo-ai-cta-label {
2952 font-size: 11px;
2953 font-weight: 600;
2954 letter-spacing: 0.06em;
2955 text-transform: uppercase;
2956 color: var(--accent);
2957 align-self: center;
2958 padding-right: 8px;
2959 border-right: 1px solid var(--border);
2960 margin-right: 4px;
2961 }
2962 .repo-ai-cta {
2963 display: inline-flex;
2964 align-items: center;
2965 gap: 6px;
2966 padding: 5px 10px;
2967 font-size: 12.5px;
2968 font-weight: 500;
2969 color: var(--text);
2970 background: var(--bg);
2971 border: 1px solid var(--border);
2972 border-radius: 7px;
2973 text-decoration: none;
2974 transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
2975 }
2976 .repo-ai-cta:hover {
2977 border-color: rgba(140,109,255,0.45);
2978 color: var(--text-strong);
2979 background: rgba(140,109,255,0.06);
2980 text-decoration: none;
2981 }
2982 .repo-ai-cta-icon {
2983 opacity: 0.75;
2984 font-size: 12px;
2985 }
2986 @media (max-width: 640px) {
2987 .repo-ai-cta-row { flex-direction: column; align-items: stretch; }
2988 .repo-ai-cta-label { border-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-right: 0; }
2989 }
2990 `,
2991 }}
2992 />
2993 <nav class="repo-ai-cta-row" aria-label="AI surfaces for this repository">
2994 <span class="repo-ai-cta-label">AI surfaces</span>
2995 <a class="repo-ai-cta" href={`/${owner}/${repo}/chat`} title="Rubber-duck chat grounded in this repo">
2996 <span class="repo-ai-cta-icon" aria-hidden="true">{"\u{1F4AC}"}</span>
2997 Chat
2998 </a>
2999 <a class="repo-ai-cta" href={`/${owner}/${repo}/previews`} title="Ephemeral preview URLs per branch">
3000 <span class="repo-ai-cta-icon" aria-hidden="true">{"\u{1F30D}"}</span>
3001 Previews
3002 </a>
3003 <a class="repo-ai-cta" href={`/${owner}/${repo}/migrations/propose`} title="AI proposes the Drizzle migration for a schema change">
3004 <span class="repo-ai-cta-icon" aria-hidden="true">{"⛁"}</span>
3005 Migrations
3006 </a>
3007 <a class="repo-ai-cta" href={`/${owner}/${repo}/semantic-search`} title="Embedding-backed code search">
3008 <span class="repo-ai-cta-icon" aria-hidden="true">{"✨"}</span>
3009 Semantic search
3010 </a>
3011 <a class="repo-ai-cta" href={`/${owner}/${repo}/releases/new`} title="Draft release notes with AI">
3012 <span class="repo-ai-cta-icon" aria-hidden="true">{"\u{1F3F7}"}</span>
3013 AI release notes
3014 </a>
3015 </nav>
544d842Claude3016 <div class="repo-home-grid">
3017 <div class="repo-home-main">
3018 <BranchSwitcher
3019 owner={owner}
3020 repo={repo}
3021 currentRef={defaultBranch}
3022 branches={branches}
3023 pathType="tree"
3024 />
3025 <FileTable
3026 entries={tree}
3027 owner={owner}
3028 repo={repo}
3029 ref={defaultBranch}
3030 path=""
3031 />
3032 {readme && (() => {
3033 const readmeHtml = renderMarkdown(readme);
3034 return (
3035 <div class="repo-home-readme">
3036 <div class="repo-home-readme-head">
3037 <span class="repo-home-readme-icon">{"☰"}</span>
3038 <span>README.md</span>
3039 </div>
3040 <style>{markdownCss}</style>
3041 <div class="markdown-body repo-home-readme-body">
3042 {html([readmeHtml] as unknown as TemplateStringsArray)}
3043 </div>
3044 </div>
3045 );
3046 })()}
3047 </div>
3048 <aside class="repo-home-side" aria-label="Repository details">
3049 <div class="repo-home-clone">
3050 <div class="repo-home-clone-tabs" role="tablist" aria-label="Clone protocol">
3051 <button
3052 type="button"
3053 class="repo-home-clone-tab"
3054 role="tab"
3055 aria-selected="true"
3056 data-pane="https"
3057 data-repo-home-clone-tab
3058 >
3059 HTTPS
3060 </button>
3061 <button
3062 type="button"
3063 class="repo-home-clone-tab"
3064 role="tab"
3065 aria-selected="false"
3066 data-pane="ssh"
3067 data-repo-home-clone-tab
3068 >
3069 SSH
3070 </button>
3071 <button
3072 type="button"
3073 class="repo-home-clone-tab"
3074 role="tab"
3075 aria-selected="false"
3076 data-pane="cli"
3077 data-repo-home-clone-tab
3078 >
3079 CLI
3080 </button>
3081 </div>
3082 <div
3083 class="repo-home-clone-pane"
3084 data-pane="https"
3085 data-active="true"
3086 role="tabpanel"
3087 >
3088 <div class="repo-home-clone-body">
3089 <input
3090 class="repo-home-clone-input"
3091 type="text"
3092 value={cloneHttpsUrl}
3093 readonly
3094 aria-label="HTTPS clone URL"
3095 data-repo-home-clone-input
3096 />
3097 <button
3098 type="button"
3099 class="repo-home-clone-copy"
3100 data-repo-home-copy={cloneHttpsUrl}
3101 >
3102 Copy
3103 </button>
3104 </div>
3105 </div>
3106 <div
3107 class="repo-home-clone-pane"
3108 data-pane="ssh"
3109 data-active="false"
3110 role="tabpanel"
3111 >
3112 <div class="repo-home-clone-body">
3113 <input
3114 class="repo-home-clone-input"
3115 type="text"
3116 value={cloneSshUrl}
3117 readonly
3118 aria-label="SSH clone URL"
3119 data-repo-home-clone-input
3120 />
3121 <button
3122 type="button"
3123 class="repo-home-clone-copy"
3124 data-repo-home-copy={cloneSshUrl}
3125 >
3126 Copy
3127 </button>
3128 </div>
3129 </div>
3130 <div
3131 class="repo-home-clone-pane"
3132 data-pane="cli"
3133 data-active="false"
3134 role="tabpanel"
3135 >
3136 <div class="repo-home-clone-body">
3137 <input
3138 class="repo-home-clone-input"
3139 type="text"
3140 value={cloneCliCmd}
3141 readonly
3142 aria-label="Gluecron CLI clone command"
3143 data-repo-home-clone-input
3144 />
3145 <button
3146 type="button"
3147 class="repo-home-clone-copy"
3148 data-repo-home-copy={cloneCliCmd}
3149 >
3150 Copy
3151 </button>
3152 </div>
79136bbClaude3153 </div>
fc1817aClaude3154 </div>
544d842Claude3155 <div class="repo-home-side-card">
3156 <h3 class="repo-home-side-title">About</h3>
3157 <div class="repo-home-side-row">
3158 <span class="repo-home-side-key">Default branch</span>
3159 <span class="repo-home-side-val">{defaultBranch}</span>
3160 </div>
3161 <div class="repo-home-side-row">
3162 <span class="repo-home-side-key">Branches</span>
3163 <span class="repo-home-side-val">
3164 <a href={`/${owner}/${repo}/commits/${defaultBranch}`}>
3165 {branches.length}
3166 </a>
3167 </span>
3168 </div>
3169 <div class="repo-home-side-row">
3170 <span class="repo-home-side-key">Stars</span>
3171 <span class="repo-home-side-val">{starCount}</span>
3172 </div>
3173 <div class="repo-home-side-row">
3174 <span class="repo-home-side-key">Forks</span>
3175 <span class="repo-home-side-val">{forkCount}</span>
3176 </div>
3177 {pushedAt && (
3178 <div class="repo-home-side-row">
3179 <span class="repo-home-side-key">Last push</span>
3180 <span class="repo-home-side-val">
3181 {formatRelative(pushedAt)}
3182 </span>
3183 </div>
3184 )}
3185 {createdAt && (
3186 <div class="repo-home-side-row">
3187 <span class="repo-home-side-key">Created</span>
3188 <span class="repo-home-side-val">
3189 {formatRelative(createdAt)}
3190 </span>
3191 </div>
3192 )}
3193 {(archived || isTemplate) && (
3194 <div class="repo-home-side-row">
3195 <span class="repo-home-side-key">State</span>
3196 <span class="repo-home-side-val">
3197 {archived ? "Archived" : "Template"}
3198 </span>
3199 </div>
3200 )}
3201 </div>
3202 </aside>
3203 </div>
3204 <script
3205 dangerouslySetInnerHTML={{
3206 __html: `
3207 (function(){
3208 var tabs = document.querySelectorAll('[data-repo-home-clone-tab]');
3209 tabs.forEach(function(tab){
3210 tab.addEventListener('click', function(){
3211 var target = tab.getAttribute('data-pane');
3212 tabs.forEach(function(t){
3213 t.setAttribute('aria-selected', t === tab ? 'true' : 'false');
3214 });
3215 var panes = document.querySelectorAll('.repo-home-clone-pane');
3216 panes.forEach(function(p){
3217 p.setAttribute('data-active', p.getAttribute('data-pane') === target ? 'true' : 'false');
3218 });
3219 });
3220 });
3221 var copyBtns = document.querySelectorAll('[data-repo-home-copy]');
3222 copyBtns.forEach(function(btn){
3223 btn.addEventListener('click', function(){
3224 var text = btn.getAttribute('data-repo-home-copy') || '';
3225 var done = function(){
3226 var prev = btn.textContent;
3227 btn.textContent = 'Copied';
3228 setTimeout(function(){ btn.textContent = prev; }, 1200);
3229 };
3230 if (navigator.clipboard && navigator.clipboard.writeText) {
3231 navigator.clipboard.writeText(text).then(done, done);
3232 } else {
3233 var ta = document.createElement('textarea');
3234 ta.value = text;
3235 document.body.appendChild(ta);
3236 ta.select();
3237 try { document.execCommand('copy'); } catch (e) {}
3238 document.body.removeChild(ta);
3239 done();
3240 }
3241 });
3242 });
3243 })();
3244 `,
3245 }}
3246 />
fc1817aClaude3247 </Layout>
3248 );
3249});
3250
3251// Browse tree at ref/path
3252web.get("/:owner/:repo/tree/:ref{.+$}", async (c) => {
3253 const { owner, repo } = c.req.param();
06d5ffeClaude3254 const user = c.get("user");
fc1817aClaude3255 const refAndPath = c.req.param("ref");
3256
3257 const branches = await listBranches(owner, repo);
3258 let ref = "";
3259 let treePath = "";
3260
3261 for (const branch of branches) {
3262 if (refAndPath === branch || refAndPath.startsWith(branch + "/")) {
3263 ref = branch;
3264 treePath = refAndPath.slice(branch.length + 1);
3265 break;
3266 }
3267 }
3268
3269 if (!ref) {
3270 const slashIdx = refAndPath.indexOf("/");
3271 if (slashIdx === -1) {
3272 ref = refAndPath;
3273 } else {
3274 ref = refAndPath.slice(0, slashIdx);
3275 treePath = refAndPath.slice(slashIdx + 1);
3276 }
3277 }
3278
3279 const tree = await getTree(owner, repo, ref, treePath);
efb11c5Claude3280 const fileCount = tree.filter((e: any) => e.type !== "tree").length;
3281 const dirCount = tree.filter((e: any) => e.type === "tree").length;
fc1817aClaude3282
3283 return c.html(
06d5ffeClaude3284 <Layout title={`${treePath || "/"} — ${owner}/${repo}`} user={user}>
efb11c5Claude3285 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude3286 <RepoHeader owner={owner} repo={repo} />
3287 <RepoNav owner={owner} repo={repo} active="code" />
efb11c5Claude3288 <div class="tree-header">
3289 <div class="tree-header-row">
3290 <BranchSwitcher
3291 owner={owner}
3292 repo={repo}
3293 currentRef={ref}
3294 branches={branches}
3295 pathType="tree"
3296 subPath={treePath}
3297 />
3298 <div class="tree-header-stats">
3299 <span class="tree-stat" title="Entries in this directory">
3300 <strong>{fileCount}</strong> file{fileCount === 1 ? "" : "s"}
3301 {dirCount > 0 && (
3302 <>
3303 {" · "}
3304 <strong>{dirCount}</strong> dir{dirCount === 1 ? "" : "s"}
3305 </>
3306 )}
3307 </span>
3308 <a
3309 href={`/${owner}/${repo}/search`}
3310 class="tree-stat tree-stat-link"
3311 title="Search code in this repository"
3312 >
3313 {"⌕"} Search
3314 </a>
3315 </div>
3316 </div>
3317 <div class="tree-breadcrumb-row">
3318 <Breadcrumb owner={owner} repo={repo} ref={ref} path={treePath} />
3319 </div>
3320 </div>
fc1817aClaude3321 <FileTable
3322 entries={tree}
3323 owner={owner}
3324 repo={repo}
3325 ref={ref}
3326 path={treePath}
3327 />
3328 </Layout>
3329 );
3330});
3331
06d5ffeClaude3332// View file blob with syntax highlighting
fc1817aClaude3333web.get("/:owner/:repo/blob/:ref{.+$}", async (c) => {
3334 const { owner, repo } = c.req.param();
06d5ffeClaude3335 const user = c.get("user");
fc1817aClaude3336 const refAndPath = c.req.param("ref");
3337
3338 const branches = await listBranches(owner, repo);
3339 let ref = "";
3340 let filePath = "";
3341
3342 for (const branch of branches) {
3343 if (refAndPath.startsWith(branch + "/")) {
3344 ref = branch;
3345 filePath = refAndPath.slice(branch.length + 1);
3346 break;
3347 }
3348 }
3349
3350 if (!ref) {
3351 const slashIdx = refAndPath.indexOf("/");
3352 if (slashIdx === -1) return c.text("Not found", 404);
3353 ref = refAndPath.slice(0, slashIdx);
3354 filePath = refAndPath.slice(slashIdx + 1);
3355 }
3356
3357 const blob = await getBlob(owner, repo, ref, filePath);
3358 if (!blob) {
3359 return c.html(
06d5ffeClaude3360 <Layout title="Not Found" user={user}>
fc1817aClaude3361 <div class="empty-state">
3362 <h2>File not found</h2>
3363 </div>
3364 </Layout>,
3365 404
3366 );
3367 }
3368
06d5ffeClaude3369 const fileName = filePath.split("/").pop() || filePath;
efb11c5Claude3370 const lineCount = blob.isBinary
3371 ? 0
3372 : (blob.content.endsWith("\n")
3373 ? blob.content.split("\n").length - 1
3374 : blob.content.split("\n").length);
3375 const formatBytes = (n: number): string => {
3376 if (n < 1024) return `${n} B`;
3377 if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
3378 return `${(n / (1024 * 1024)).toFixed(1)} MB`;
3379 };
fc1817aClaude3380
3381 return c.html(
06d5ffeClaude3382 <Layout title={`${filePath} — ${owner}/${repo}`} user={user}>
efb11c5Claude3383 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude3384 <RepoHeader owner={owner} repo={repo} />
3385 <RepoNav owner={owner} repo={repo} active="code" />
efb11c5Claude3386 <div class="blob-toolbar">
3387 <BranchSwitcher
3388 owner={owner}
3389 repo={repo}
3390 currentRef={ref}
3391 branches={branches}
3392 pathType="blob"
3393 subPath={filePath}
3394 />
3395 <div class="blob-breadcrumb">
3396 <Breadcrumb owner={owner} repo={repo} ref={ref} path={filePath} />
3397 </div>
3398 </div>
3399 <div class="blob-view blob-card">
3400 <div class="blob-header blob-header-polished">
3401 <div class="blob-header-meta">
3402 <span class="blob-header-icon" aria-hidden="true">
3403 {"📄"}
3404 </span>
3405 <span class="blob-header-name">{fileName}</span>
3406 <span class="blob-header-size">
3407 {formatBytes(blob.size)}
3408 {!blob.isBinary && (
3409 <>
3410 {" · "}
3411 {lineCount} line{lineCount === 1 ? "" : "s"}
3412 </>
3413 )}
3414 </span>
3415 </div>
3416 <div class="blob-header-actions">
3417 <a
3418 href={`/${owner}/${repo}/raw/${ref}/${filePath}`}
3419 class="blob-pill"
3420 >
79136bbClaude3421 Raw
3422 </a>
efb11c5Claude3423 <a
3424 href={`/${owner}/${repo}/blame/${ref}/${filePath}`}
3425 class="blob-pill"
3426 >
79136bbClaude3427 Blame
3428 </a>
efb11c5Claude3429 <a
3430 href={`/${owner}/${repo}/timeline/${ref}/${filePath}`}
3431 class="blob-pill"
3432 >
16b325cClaude3433 History
3434 </a>
0074234Claude3435 {user && (
efb11c5Claude3436 <a
3437 href={`/${owner}/${repo}/edit/${ref}/${filePath}`}
3438 class="blob-pill blob-pill-accent"
3439 >
0074234Claude3440 Edit
3441 </a>
3442 )}
efb11c5Claude3443 </div>
fc1817aClaude3444 </div>
3445 {blob.isBinary ? (
efb11c5Claude3446 <div class="blob-binary">
fc1817aClaude3447 Binary file not shown.
3448 </div>
06d5ffeClaude3449 ) : (() => {
3450 const { html: highlighted, language } = highlightCode(
3451 blob.content,
3452 fileName
3453 );
3454 if (language) {
3455 return (
3456 <HighlightedCode
3457 highlightedHtml={highlighted}
efb11c5Claude3458 lineCount={lineCount}
06d5ffeClaude3459 />
3460 );
3461 }
3462 const lines = blob.content.split("\n");
3463 if (lines[lines.length - 1] === "") lines.pop();
3464 return <PlainCode lines={lines} />;
3465 })()}
fc1817aClaude3466 </div>
3467 </Layout>
3468 );
3469});
3470
398a10cClaude3471// ─── Branches list ────────────────────────────────────────────────────────
3472// Lightweight `git for-each-ref` enrichment so each row shows last-commit
3473// author + relative time + ahead/behind vs the default branch. No DB. All
3474// data comes from git plumbing; failures degrade gracefully (counts omitted).
3475web.get("/:owner/:repo/branches", async (c) => {
3476 const { owner, repo } = c.req.param();
3477 const user = c.get("user");
3478
3479 if (!(await repoExists(owner, repo))) return c.notFound();
3480
3481 const defaultBranch = (await getDefaultBranch(owner, repo)) || "main";
3482 const branches = await listBranches(owner, repo);
3483 const repoDir = getRepoPath(owner, repo);
3484
3485 type BranchRow = {
3486 name: string;
3487 isDefault: boolean;
3488 sha: string;
3489 subject: string;
3490 author: string;
3491 date: string;
3492 ahead: number;
3493 behind: number;
3494 };
3495
3496 const runGit = async (args: string[]): Promise<string> => {
3497 try {
3498 const proc = Bun.spawn(["git", ...args], {
3499 cwd: repoDir,
3500 stdout: "pipe",
3501 stderr: "pipe",
3502 });
3503 const out = await new Response(proc.stdout).text();
3504 await proc.exited;
3505 return out;
3506 } catch {
3507 return "";
3508 }
3509 };
3510
3511 const meta = await runGit([
3512 "for-each-ref",
3513 "--sort=-committerdate",
3514 "--format=%(refname:short)%00%(objectname)%00%(subject)%00%(authorname)%00%(committerdate:iso-strict)",
3515 "refs/heads/",
3516 ]);
3517 const metaByName: Record<
3518 string,
3519 { sha: string; subject: string; author: string; date: string }
3520 > = {};
3521 for (const line of meta.split("\n").filter(Boolean)) {
3522 const [name, sha, subject, author, date] = line.split("\0");
3523 metaByName[name] = { sha, subject, author, date };
3524 }
3525
3526 const branchOrder = [...branches].sort((a, b) => {
3527 if (a === defaultBranch) return -1;
3528 if (b === defaultBranch) return 1;
3529 const aDate = metaByName[a]?.date || "";
3530 const bDate = metaByName[b]?.date || "";
3531 return bDate.localeCompare(aDate);
3532 });
3533
3534 const rows: BranchRow[] = [];
3535 for (const name of branchOrder) {
3536 const m = metaByName[name] || { sha: "", subject: "", author: "", date: "" };
3537 let ahead = 0;
3538 let behind = 0;
3539 if (name !== defaultBranch && metaByName[defaultBranch]) {
3540 const out = await runGit([
3541 "rev-list",
3542 "--left-right",
3543 "--count",
3544 `${defaultBranch}...${name}`,
3545 ]);
3546 const parts = out.trim().split(/\s+/);
3547 if (parts.length === 2) {
3548 behind = parseInt(parts[0], 10) || 0;
3549 ahead = parseInt(parts[1], 10) || 0;
3550 }
3551 }
3552 rows.push({
3553 name,
3554 isDefault: name === defaultBranch,
3555 sha: m.sha,
3556 subject: m.subject,
3557 author: m.author,
3558 date: m.date,
3559 ahead,
3560 behind,
3561 });
3562 }
3563
3564 const relative = (iso: string): string => {
3565 if (!iso) return "—";
3566 const d = new Date(iso);
3567 if (Number.isNaN(d.getTime())) return "—";
3568 const diff = Date.now() - d.getTime();
3569 const m = Math.floor(diff / 60000);
3570 if (m < 1) return "just now";
3571 if (m < 60) return `${m} min ago`;
3572 const h = Math.floor(m / 60);
3573 if (h < 24) return `${h} hr${h === 1 ? "" : "s"} ago`;
3574 const dd = Math.floor(h / 24);
3575 if (dd < 30) return `${dd} day${dd === 1 ? "" : "s"} ago`;
3576 return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
3577 };
3578
3579 const success = c.req.query("success");
3580 const error = c.req.query("error");
3581
3582 return c.html(
3583 <Layout title={`Branches — ${owner}/${repo}`} user={user}>
3584 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
3585 <RepoHeader owner={owner} repo={repo} />
3586 <RepoNav owner={owner} repo={repo} active="code" />
3587 <div
3588 class="branches-wrap"
3589 style="max-width:1100px;margin:0 auto;padding:var(--space-5) var(--space-4) var(--space-8)"
3590 >
3591 <header class="branches-head" style="margin-bottom:var(--space-5)">
3592 <div
3593 class="branches-eyebrow"
3594 style="display:inline-flex;align-items:center;gap:8px;text-transform:uppercase;font-family:var(--font-mono);font-size:11px;letter-spacing:0.16em;color:var(--text-muted);font-weight:600;margin-bottom:10px"
3595 >
3596 <span
3597 class="branches-eyebrow-dot"
3598 aria-hidden="true"
3599 style="width:8px;height:8px;border-radius:9999px;background:linear-gradient(135deg,#8c6dff,#36c5d6);box-shadow:0 0 0 3px rgba(140,109,255,0.18)"
3600 />
3601 Repository · Branches
3602 </div>
3603 <h1
3604 class="branches-title"
3605 style="font-family:var(--font-display);font-size:clamp(24px,3.4vw,36px);font-weight:800;letter-spacing:-0.028em;line-height:1.1;margin:0 0 6px;color:var(--text-strong)"
3606 >
3607 <span class="gradient-text">{rows.length}</span>{" "}
3608 branch{rows.length === 1 ? "" : "es"}
3609 </h1>
3610 <p
3611 class="branches-sub"
3612 style="margin:0;font-size:14px;color:var(--text-muted);line-height:1.5;max-width:700px"
3613 >
3614 All work-in-progress lines for{" "}
3615 <code style="font-size:12.5px">{owner}/{repo}</code>. Ahead/behind
3616 counts are relative to{" "}
3617 <code style="font-size:12.5px">{defaultBranch}</code>.
3618 </p>
3619 </header>
3620
3621 {success && (
3622 <div style="margin-bottom:var(--space-4);padding:10px 14px;border-radius:10px;font-size:13.5px;border:1px solid rgba(52,211,153,0.40);background:rgba(52,211,153,0.08);color:#bbf7d0">
3623 {decodeURIComponent(success)}
3624 </div>
3625 )}
3626 {error && (
3627 <div style="margin-bottom:var(--space-4);padding:10px 14px;border-radius:10px;font-size:13.5px;border:1px solid rgba(248,113,113,0.40);background:rgba(248,113,113,0.08);color:#fecaca">
3628 {decodeURIComponent(error)}
3629 </div>
3630 )}
3631
3632 {rows.length === 0 ? (
3633 <div class="commits-empty">
3634 <div class="commits-empty-orb" aria-hidden="true" />
3635 <div class="commits-empty-inner">
3636 <div class="commits-empty-icon" aria-hidden="true">
3637 <svg
3638 width="22"
3639 height="22"
3640 viewBox="0 0 24 24"
3641 fill="none"
3642 stroke="currentColor"
3643 stroke-width="2"
3644 stroke-linecap="round"
3645 stroke-linejoin="round"
3646 >
3647 <line x1="6" y1="3" x2="6" y2="15" />
3648 <circle cx="18" cy="6" r="3" />
3649 <circle cx="6" cy="18" r="3" />
3650 <path d="M18 9a9 9 0 0 1-9 9" />
3651 </svg>
3652 </div>
3653 <h3 class="commits-empty-title">No branches yet</h3>
3654 <p class="commits-empty-sub">
3655 Push your first commit to create the default branch.
3656 </p>
3657 </div>
3658 </div>
3659 ) : (
3660 <div class="branches-list">
3661 {rows.map((r) => (
3662 <div class="branches-row">
3663 <div class="branches-row-icon" aria-hidden="true">
3664 <svg
3665 width="14"
3666 height="14"
3667 viewBox="0 0 24 24"
3668 fill="none"
3669 stroke="currentColor"
3670 stroke-width="2"
3671 stroke-linecap="round"
3672 stroke-linejoin="round"
3673 >
3674 <line x1="6" y1="3" x2="6" y2="15" />
3675 <circle cx="18" cy="6" r="3" />
3676 <circle cx="6" cy="18" r="3" />
3677 <path d="M18 9a9 9 0 0 1-9 9" />
3678 </svg>
3679 </div>
3680 <div class="branches-row-main">
3681 <div class="branches-row-name">
3682 <a href={`/${owner}/${repo}/tree/${r.name}`}>{r.name}</a>
3683 {r.isDefault && (
3684 <span
3685 class="branches-row-default"
3686 title="Default branch"
3687 >
3688 Default
3689 </span>
3690 )}
3691 </div>
3692 <div class="branches-row-meta">
3693 {r.subject ? (
3694 <>
3695 <strong>{r.author || "—"}</strong>
3696 <span class="sep">·</span>
3697 <span
3698 title={r.date ? new Date(r.date).toISOString() : ""}
3699 >
3700 updated {relative(r.date)}
3701 </span>
3702 {r.sha && (
3703 <>
3704 <span class="sep">·</span>
3705 <a
3706 href={`/${owner}/${repo}/commit/${r.sha}`}
3707 style="font-family:var(--font-mono);font-size:11.5px;color:var(--text-muted);text-decoration:none"
3708 >
3709 {r.sha.slice(0, 7)}
3710 </a>
3711 </>
3712 )}
3713 </>
3714 ) : (
3715 <span>No commit metadata</span>
3716 )}
3717 </div>
3718 </div>
3719 <div class="branches-row-side">
3720 {!r.isDefault && (r.ahead > 0 || r.behind > 0) && (
3721 <span
3722 class="branches-row-divergence"
3723 title={`${r.ahead} ahead, ${r.behind} behind ${defaultBranch}`}
3724 >
3725 <span class="ahead">{r.ahead} ahead</span>
3726 <span style="opacity:0.4">|</span>
3727 <span class="behind">{r.behind} behind</span>
3728 </span>
3729 )}
3730 <div class="branches-row-actions">
3731 <a
3732 href={`/${owner}/${repo}/commits/${r.name}`}
3733 class="branches-btn"
3734 title="View commits on this branch"
3735 >
3736 Commits
3737 </a>
3738 {!r.isDefault &&
3739 user &&
3740 user.username === owner && (
3741 <form
3742 method="post"
3743 action={`/${owner}/${repo}/branches/${encodeURIComponent(r.name)}/delete`}
3744 style="margin:0"
3745 onsubmit={`return confirm('Delete branch \\'${r.name}\\'? This cannot be undone.')`}
3746 >
3747 <button
3748 type="submit"
3749 class="branches-btn branches-btn-danger"
3750 >
3751 Delete
3752 </button>
3753 </form>
3754 )}
3755 </div>
3756 </div>
3757 </div>
3758 ))}
3759 </div>
3760 )}
3761 </div>
3762 </Layout>
3763 );
3764});
3765
3766// Delete a branch (owner only). Uses `git branch -D` so we can drop refs
3767// that are not merged into the default branch — matches the explicit
3768// confirmation on the row's delete button.
3769web.post("/:owner/:repo/branches/:name/delete", requireAuth, async (c) => {
3770 const { owner, repo } = c.req.param();
3771 const branchName = decodeURIComponent(c.req.param("name"));
3772 const user = c.get("user")!;
3773
3774 // Owner-only check (mirrors collaborators.tsx pattern).
3775 const [ownerRow] = await db
3776 .select()
3777 .from(users)
3778 .where(eq(users.username, owner))
3779 .limit(1);
3780 if (!ownerRow || ownerRow.id !== user.id) {
3781 return c.redirect(
3782 `/${owner}/${repo}/branches?error=Only+the+owner+can+delete+branches`
3783 );
3784 }
3785
3786 const defaultBranch = (await getDefaultBranch(owner, repo)) || "main";
3787 if (branchName === defaultBranch) {
3788 return c.redirect(
3789 `/${owner}/${repo}/branches?error=Cannot+delete+the+default+branch`
3790 );
3791 }
3792
3793 const branches = await listBranches(owner, repo);
3794 if (!branches.includes(branchName)) {
3795 return c.redirect(
3796 `/${owner}/${repo}/branches?error=Branch+not+found`
3797 );
3798 }
3799
3800 try {
3801 const repoDir = getRepoPath(owner, repo);
3802 const proc = Bun.spawn(["git", "branch", "-D", branchName], {
3803 cwd: repoDir,
3804 stdout: "pipe",
3805 stderr: "pipe",
3806 });
3807 await proc.exited;
3808 if (proc.exitCode !== 0) {
3809 return c.redirect(
3810 `/${owner}/${repo}/branches?error=Delete+failed`
3811 );
3812 }
3813 } catch {
3814 return c.redirect(`/${owner}/${repo}/branches?error=Delete+failed`);
3815 }
3816
3817 return c.redirect(`/${owner}/${repo}/branches?success=Branch+deleted`);
3818});
3819
3820// ─── Tags list ────────────────────────────────────────────────────────────
3821// Pulls from `listTags` (sorted newest first). For each tag we look up an
3822// associated release row so the "View release" CTA can deep-link directly
3823// without making the user hunt for it.
3824web.get("/:owner/:repo/tags", async (c) => {
3825 const { owner, repo } = c.req.param();
3826 const user = c.get("user");
3827
3828 if (!(await repoExists(owner, repo))) return c.notFound();
3829
3830 const tags = await listTags(owner, repo);
3831
3832 // Map tags -> releases. Best-effort; releases table may not exist in
3833 // every test setup, so any error falls through with an empty set.
3834 const tagsWithReleases = new Set<string>();
3835 try {
3836 const [ownerRow] = await db
3837 .select()
3838 .from(users)
3839 .where(eq(users.username, owner))
3840 .limit(1);
3841 if (ownerRow) {
3842 const [repoRow] = await db
3843 .select()
3844 .from(repositories)
3845 .where(
3846 and(
3847 eq(repositories.ownerId, ownerRow.id),
3848 eq(repositories.name, repo)
3849 )
3850 )
3851 .limit(1);
3852 if (repoRow) {
3853 // Raw SQL so we don't need to import the releases schema here.
3854 const result = await db.execute(
3855 sql`SELECT tag FROM releases WHERE repository_id = ${repoRow.id}`
3856 );
3857 const rows: any[] = (result as any).rows || (result as any) || [];
3858 for (const row of rows) {
3859 const tag = row?.tag;
3860 if (typeof tag === "string") tagsWithReleases.add(tag);
3861 }
3862 }
3863 }
3864 } catch {
3865 // No releases table or DB error — leave set empty.
3866 }
3867
3868 const relative = (iso: string): string => {
3869 if (!iso) return "—";
3870 const d = new Date(iso);
3871 if (Number.isNaN(d.getTime())) return "—";
3872 const diff = Date.now() - d.getTime();
3873 const m = Math.floor(diff / 60000);
3874 if (m < 1) return "just now";
3875 if (m < 60) return `${m} min ago`;
3876 const h = Math.floor(m / 60);
3877 if (h < 24) return `${h} hr${h === 1 ? "" : "s"} ago`;
3878 const dd = Math.floor(h / 24);
3879 if (dd < 30) return `${dd} day${dd === 1 ? "" : "s"} ago`;
3880 return d.toLocaleDateString("en-US", {
3881 month: "short",
3882 day: "numeric",
3883 year: "numeric",
3884 });
3885 };
3886
3887 return c.html(
3888 <Layout title={`Tags — ${owner}/${repo}`} user={user}>
3889 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
3890 <RepoHeader owner={owner} repo={repo} />
3891 <RepoNav owner={owner} repo={repo} active="code" />
3892 <div
3893 class="tags-wrap"
3894 style="max-width:1100px;margin:0 auto;padding:var(--space-5) var(--space-4) var(--space-8)"
3895 >
3896 <header class="tags-head" style="margin-bottom:var(--space-5)">
3897 <div
3898 class="tags-eyebrow"
3899 style="display:inline-flex;align-items:center;gap:8px;text-transform:uppercase;font-family:var(--font-mono);font-size:11px;letter-spacing:0.16em;color:var(--text-muted);font-weight:600;margin-bottom:10px"
3900 >
3901 <span
3902 class="tags-eyebrow-dot"
3903 aria-hidden="true"
3904 style="width:8px;height:8px;border-radius:9999px;background:linear-gradient(135deg,#8c6dff,#36c5d6);box-shadow:0 0 0 3px rgba(140,109,255,0.18)"
3905 />
3906 Repository · Tags
3907 </div>
3908 <h1
3909 class="tags-title"
3910 style="font-family:var(--font-display);font-size:clamp(24px,3.4vw,36px);font-weight:800;letter-spacing:-0.028em;line-height:1.1;margin:0 0 6px;color:var(--text-strong)"
3911 >
3912 <span class="gradient-text">{tags.length}</span>{" "}
3913 tag{tags.length === 1 ? "" : "s"}
3914 </h1>
3915 <p
3916 class="tags-sub"
3917 style="margin:0;font-size:14px;color:var(--text-muted);line-height:1.5;max-width:700px"
3918 >
3919 Named points in the history — typically releases, milestones,
3920 or shipped versions. Click a tag to browse the tree at that
3921 revision.
3922 </p>
3923 </header>
3924
3925 {tags.length === 0 ? (
3926 <div class="commits-empty">
3927 <div class="commits-empty-orb" aria-hidden="true" />
3928 <div class="commits-empty-inner">
3929 <div class="commits-empty-icon" aria-hidden="true">
3930 <svg
3931 width="22"
3932 height="22"
3933 viewBox="0 0 24 24"
3934 fill="none"
3935 stroke="currentColor"
3936 stroke-width="2"
3937 stroke-linecap="round"
3938 stroke-linejoin="round"
3939 >
3940 <path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z" />
3941 <line x1="7" y1="7" x2="7.01" y2="7" />
3942 </svg>
3943 </div>
3944 <h3 class="commits-empty-title">No tags yet</h3>
3945 <p class="commits-empty-sub">
3946 Tag a commit to mark a release or milestone. From the CLI:{" "}
3947 <code>git tag v0.1.0 &amp;&amp; git push --tags</code>.
3948 </p>
3949 </div>
3950 </div>
3951 ) : (
3952 <div class="tags-list">
3953 {tags.map((t) => {
3954 const hasRelease = tagsWithReleases.has(t.name);
3955 return (
3956 <div class="tags-row">
3957 <div class="tags-row-icon" aria-hidden="true">
3958 <svg
3959 width="14"
3960 height="14"
3961 viewBox="0 0 24 24"
3962 fill="none"
3963 stroke="currentColor"
3964 stroke-width="2"
3965 stroke-linecap="round"
3966 stroke-linejoin="round"
3967 >
3968 <path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z" />
3969 <line x1="7" y1="7" x2="7.01" y2="7" />
3970 </svg>
3971 </div>
3972 <div class="tags-row-main">
3973 <div class="tags-row-name">
3974 <a
3975 href={`/${owner}/${repo}/tree/${t.name}`}
3976 style="text-decoration:none"
3977 >
3978 <span class="tags-row-version">{t.name}</span>
3979 </a>
3980 </div>
3981 <div class="tags-row-meta">
3982 <span
3983 title={t.date ? new Date(t.date).toISOString() : ""}
3984 >
3985 Tagged {relative(t.date)}
3986 </span>
3987 <span class="sep">·</span>
3988 <a
3989 href={`/${owner}/${repo}/commit/${t.sha}`}
3990 class="tags-row-sha"
3991 title={t.sha}
3992 >
3993 {t.sha.slice(0, 7)}
3994 </a>
3995 </div>
3996 </div>
3997 <div class="tags-row-side">
3998 <a
3999 href={`/${owner}/${repo}/tree/${t.name}`}
4000 class="tags-row-link"
4001 >
4002 Browse files
4003 </a>
4004 {hasRelease && (
4005 <a
4006 href={`/${owner}/${repo}/releases/tag/${t.name}`}
4007 class="tags-row-link"
4008 style="color:#67e8f9;border-color:rgba(54,197,214,0.35);background:rgba(54,197,214,0.06)"
4009 >
4010 View release
4011 </a>
4012 )}
4013 </div>
4014 </div>
4015 );
4016 })}
4017 </div>
4018 )}
4019 </div>
4020 </Layout>
4021 );
4022});
4023
fc1817aClaude4024// Commit log
4025web.get("/:owner/:repo/commits/:ref?", async (c) => {
4026 const { owner, repo } = c.req.param();
06d5ffeClaude4027 const user = c.get("user");
fc1817aClaude4028 const ref =
4029 c.req.param("ref") || (await getDefaultBranch(owner, repo)) || "main";
06d5ffeClaude4030 const branches = await listBranches(owner, repo);
fc1817aClaude4031
4032 const commits = await listCommits(owner, repo, ref, 50);
4033
3951454Claude4034 // Block J3 — batch-fetch cached verification results for the page.
4035 let verifications: Record<string, { verified: boolean; reason: string }> = {};
4036 try {
4037 const [ownerRow] = await db
4038 .select()
4039 .from(users)
4040 .where(eq(users.username, owner))
4041 .limit(1);
4042 if (ownerRow) {
4043 const [repoRow] = await db
4044 .select()
4045 .from(repositories)
4046 .where(
4047 and(
4048 eq(repositories.ownerId, ownerRow.id),
4049 eq(repositories.name, repo)
4050 )
4051 )
4052 .limit(1);
4053 if (repoRow && commits.length > 0) {
4054 const rows = await db
4055 .select()
4056 .from(commitVerifications)
4057 .where(
4058 and(
4059 eq(commitVerifications.repositoryId, repoRow.id),
4060 inArray(
4061 commitVerifications.commitSha,
4062 commits.map((c) => c.sha)
4063 )
4064 )
4065 );
4066 for (const r of rows) {
4067 verifications[r.commitSha] = {
4068 verified: r.verified,
4069 reason: r.reason,
4070 };
4071 }
4072 }
4073 }
4074 } catch {
4075 // DB unavailable — skip the badges gracefully.
4076 }
4077
fc1817aClaude4078 return c.html(
06d5ffeClaude4079 <Layout title={`Commits — ${owner}/${repo}`} user={user}>
efb11c5Claude4080 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude4081 <RepoHeader owner={owner} repo={repo} />
4082 <RepoNav owner={owner} repo={repo} active="commits" />
efb11c5Claude4083 <div class="commits-hero">
4084 <div class="commits-hero-orb-wrap" aria-hidden="true">
4085 <div class="commits-hero-orb" />
fc1817aClaude4086 </div>
efb11c5Claude4087 <div class="commits-hero-inner">
4088 <div class="commits-eyebrow">
4089 <strong>History</strong> · {owner}/{repo}
4090 </div>
4091 <h1 class="commits-title">
4092 <span class="gradient-text">{commits.length}</span> recent commit
4093 {commits.length === 1 ? "" : "s"} on{" "}
4094 <span class="commits-branch">{ref}</span>
4095 </h1>
4096 <p class="commits-sub">
4097 Browse the project's history. Click any commit to see the full
4098 diff, AI review notes, and signature status.
4099 </p>
4100 </div>
4101 </div>
4102 <div class="commits-toolbar">
4103 <BranchSwitcher
3951454Claude4104 owner={owner}
4105 repo={repo}
efb11c5Claude4106 currentRef={ref}
4107 branches={branches}
4108 pathType="commits"
3951454Claude4109 />
398a10cClaude4110 <div class="commits-toolbar-actions">
4111 <a href={`/${owner}/${repo}/branches`} class="commits-toolbar-link">
4112 {"⊢"} Branches
4113 </a>
4114 <a href={`/${owner}/${repo}/tags`} class="commits-toolbar-link">
4115 {"#"} Tags
4116 </a>
4117 </div>
efb11c5Claude4118 </div>
4119 {commits.length === 0 ? (
4120 <div class="commits-empty">
398a10cClaude4121 <div class="commits-empty-orb" aria-hidden="true" />
4122 <div class="commits-empty-inner">
4123 <div class="commits-empty-icon" aria-hidden="true">
4124 <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
4125 <circle cx="12" cy="12" r="4" />
4126 <line x1="1.05" y1="12" x2="7" y2="12" />
4127 <line x1="17.01" y1="12" x2="22.96" y2="12" />
4128 </svg>
4129 </div>
4130 <h3 class="commits-empty-title">No commits yet</h3>
4131 <p class="commits-empty-sub">
4132 This branch is empty. Push your first commit, or use the
4133 web editor to create a file.
4134 </p>
4135 </div>
efb11c5Claude4136 </div>
4137 ) : (
4138 <div class="commits-list-wrap">
398a10cClaude4139 {(() => {
4140 // Group commits by day for the section headers.
4141 const dayLabel = (iso: string): string => {
4142 const d = new Date(iso);
4143 if (Number.isNaN(d.getTime())) return "Unknown";
4144 const today = new Date();
4145 const yesterday = new Date(today);
4146 yesterday.setDate(today.getDate() - 1);
4147 const sameDay = (a: Date, b: Date) =>
4148 a.getFullYear() === b.getFullYear() &&
4149 a.getMonth() === b.getMonth() &&
4150 a.getDate() === b.getDate();
4151 if (sameDay(d, today)) return "Today";
4152 if (sameDay(d, yesterday)) return "Yesterday";
4153 return d.toLocaleDateString("en-US", {
4154 month: "long",
4155 day: "numeric",
4156 year: today.getFullYear() === d.getFullYear() ? undefined : "numeric",
4157 });
4158 };
4159 const relative = (iso: string): string => {
4160 const d = new Date(iso);
4161 if (Number.isNaN(d.getTime())) return "";
4162 const diff = Date.now() - d.getTime();
4163 const m = Math.floor(diff / 60000);
4164 if (m < 1) return "just now";
4165 if (m < 60) return `${m} min ago`;
4166 const h = Math.floor(m / 60);
4167 if (h < 24) return `${h} hr${h === 1 ? "" : "s"} ago`;
4168 const dd = Math.floor(h / 24);
4169 if (dd < 30) return `${dd} day${dd === 1 ? "" : "s"} ago`;
4170 return d.toLocaleDateString("en-US", {
4171 month: "short",
4172 day: "numeric",
4173 });
4174 };
4175 const initial = (name: string): string =>
4176 (name || "?").trim().charAt(0).toUpperCase() || "?";
4177 // Build groups preserving order.
4178 const groups: Array<{ label: string; items: typeof commits }> = [];
4179 let lastLabel = "";
4180 for (const cm of commits) {
4181 const label = dayLabel(cm.date);
4182 if (label !== lastLabel) {
4183 groups.push({ label, items: [] });
4184 lastLabel = label;
4185 }
4186 groups[groups.length - 1].items.push(cm);
4187 }
4188 return groups.map((g) => (
4189 <>
4190 <div class="commits-day-head">
4191 <span class="commits-day-head-dot" aria-hidden="true" />
4192 Commits on {g.label}
4193 </div>
4194 {g.items.map((cm) => {
4195 const v = verifications[cm.sha];
4196 return (
4197 <div class="commits-row">
4198 <div class="commits-avatar" aria-hidden="true">
4199 {initial(cm.author)}
4200 </div>
4201 <div class="commits-row-body">
4202 <div class="commits-row-msg">
4203 <a href={`/${owner}/${repo}/commit/${cm.sha}`}>
4204 {cm.message}
4205 </a>
4206 {v?.verified && (
4207 <span
4208 class="commits-row-verified"
4209 title="Signed with a registered key"
4210 >
4211 Verified
4212 </span>
4213 )}
4214 </div>
4215 <div class="commits-row-meta">
4216 <strong>{cm.author}</strong>
4217 <span class="sep">·</span>
4218 <span
4219 class="commits-row-time"
4220 title={new Date(cm.date).toISOString()}
4221 >
4222 committed {relative(cm.date)}
4223 </span>
4224 {cm.parentShas.length > 1 && (
4225 <>
4226 <span class="sep">·</span>
4227 <span>merge of {cm.parentShas.length} parents</span>
4228 </>
4229 )}
4230 </div>
4231 </div>
4232 <div class="commits-row-side">
4233 <a
4234 href={`/${owner}/${repo}/commit/${cm.sha}`}
4235 class="commits-row-sha"
4236 title={cm.sha}
4237 >
4238 {cm.sha.slice(0, 7)}
4239 </a>
4240 <button
4241 type="button"
4242 class="commits-row-copy"
4243 data-copy-sha={cm.sha}
4244 title="Copy full SHA"
4245 aria-label={`Copy SHA ${cm.sha}`}
4246 >
4247 <svg width="13" height="13" viewBox="0 0 16 16" fill="none" aria-hidden="true">
4248 <path fill="currentColor" d="M4 1.5h6A1.5 1.5 0 0 1 11.5 3v1h-1V3a.5.5 0 0 0-.5-.5H4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h1v1H4A1.5 1.5 0 0 1 2.5 11V3A1.5 1.5 0 0 1 4 1.5Z" />
4249 <path fill="currentColor" d="M6 5.5h6A1.5 1.5 0 0 1 13.5 7v6A1.5 1.5 0 0 1 12 14.5H6A1.5 1.5 0 0 1 4.5 13V7A1.5 1.5 0 0 1 6 5.5Zm0 1A.5.5 0 0 0 5.5 7v6a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 .5-.5V7a.5.5 0 0 0-.5-.5H6Z" />
4250 </svg>
4251 </button>
4252 </div>
4253 </div>
4254 );
4255 })}
4256 </>
4257 ));
4258 })()}
efb11c5Claude4259 </div>
fc1817aClaude4260 )}
398a10cClaude4261 <script
4262 dangerouslySetInnerHTML={{
4263 __html: `
4264 (function(){
4265 document.addEventListener('click', function(e){
4266 var t = e.target; if (!t) return;
4267 var btn = t.closest && t.closest('[data-copy-sha]');
4268 if (!btn) return;
4269 e.preventDefault();
4270 var sha = btn.getAttribute('data-copy-sha') || '';
4271 if (!navigator.clipboard) return;
4272 navigator.clipboard.writeText(sha).then(function(){
4273 btn.classList.add('is-copied');
4274 setTimeout(function(){ btn.classList.remove('is-copied'); }, 1200);
4275 }).catch(function(){});
4276 });
4277 })();
4278 `,
4279 }}
4280 />
fc1817aClaude4281 </Layout>
4282 );
4283});
4284
4285// Single commit with diff
4286web.get("/:owner/:repo/commit/:sha", async (c) => {
4287 const { owner, repo, sha } = c.req.param();
06d5ffeClaude4288 const user = c.get("user");
fc1817aClaude4289
05b973eClaude4290 // Fetch commit, full message, and diff in parallel
4291 const [commit, fullMessage, diffResult] = await Promise.all([
4292 getCommit(owner, repo, sha),
4293 getCommitFullMessage(owner, repo, sha),
4294 getDiff(owner, repo, sha),
4295 ]);
fc1817aClaude4296 if (!commit) {
4297 return c.html(
06d5ffeClaude4298 <Layout title="Not Found" user={user}>
fc1817aClaude4299 <div class="empty-state">
4300 <h2>Commit not found</h2>
4301 </div>
4302 </Layout>,
4303 404
4304 );
4305 }
4306
3951454Claude4307 // Block J3 — try to verify this commit's signature.
4308 let verification:
4309 | { verified: boolean; reason: string; signatureType: string | null }
4310 | null = null;
0cdfd89Claude4311 // Block J8 — external CI commit statuses rollup.
4312 let statusCombined:
4313 | {
4314 state: "pending" | "success" | "failure";
4315 total: number;
4316 contexts: Array<{
4317 context: string;
4318 state: string;
4319 description: string | null;
4320 targetUrl: string | null;
4321 }>;
4322 }
4323 | null = null;
3951454Claude4324 try {
4325 const [ownerRow] = await db
4326 .select()
4327 .from(users)
4328 .where(eq(users.username, owner))
4329 .limit(1);
4330 if (ownerRow) {
4331 const [repoRow] = await db
4332 .select()
4333 .from(repositories)
4334 .where(
4335 and(
4336 eq(repositories.ownerId, ownerRow.id),
4337 eq(repositories.name, repo)
4338 )
4339 )
4340 .limit(1);
4341 if (repoRow) {
4342 const { verifyCommit } = await import("../lib/signatures");
4343 const v = await verifyCommit(repoRow.id, owner, repo, commit.sha);
4344 verification = {
4345 verified: v.verified,
4346 reason: v.reason,
4347 signatureType: v.signatureType,
4348 };
0cdfd89Claude4349 try {
4350 const { combinedStatus } = await import("../lib/commit-statuses");
4351 const combined = await combinedStatus(repoRow.id, commit.sha);
4352 if (combined.total > 0) {
4353 statusCombined = {
4354 state: combined.state as any,
4355 total: combined.total,
4356 contexts: combined.contexts.map((c) => ({
4357 context: c.context,
4358 state: c.state,
4359 description: c.description,
4360 targetUrl: c.targetUrl,
4361 })),
4362 };
4363 }
4364 } catch {
4365 statusCombined = null;
4366 }
3951454Claude4367 }
4368 }
4369 } catch {
4370 verification = null;
4371 }
4372
05b973eClaude4373 const { files, raw } = diffResult;
fc1817aClaude4374
efb11c5Claude4375 // Diff stats: count additions / deletions across all files for the
4376 // header summary bar. Computed here from the parsed diff so we don't
4377 // touch the DiffView component.
4378 let additions = 0;
4379 let deletions = 0;
4380 for (const f of files) {
4381 const hunks = (f as any).hunks as Array<any> | undefined;
4382 if (Array.isArray(hunks)) {
4383 for (const h of hunks) {
4384 const lines = (h?.lines || []) as Array<any>;
4385 for (const ln of lines) {
4386 const t = ln?.type || ln?.kind;
4387 if (t === "add" || t === "added" || t === "+") additions += 1;
4388 else if (t === "del" || t === "deleted" || t === "delete" || t === "-")
4389 deletions += 1;
4390 }
4391 }
4392 }
4393 }
4394 // Fall back: scan raw if file-level counting yielded zero (it's just a
4395 // header polish — never let a parsing miss break the page).
4396 if (additions === 0 && deletions === 0 && typeof raw === "string") {
4397 for (const line of raw.split("\n")) {
4398 if (line.startsWith("+") && !line.startsWith("+++")) additions += 1;
4399 else if (line.startsWith("-") && !line.startsWith("---")) deletions += 1;
4400 }
4401 }
4402 const fileCount = files.length;
4403
fc1817aClaude4404 return c.html(
06d5ffeClaude4405 <Layout title={`${commit.message} — ${owner}/${repo}`} user={user}>
efb11c5Claude4406 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude4407 <RepoHeader owner={owner} repo={repo} />
efb11c5Claude4408 <div class="commit-detail-card">
4409 <div class="commit-detail-eyebrow">
4410 <strong>Commit</strong>
4411 <span class="commit-detail-sha-pill" title={commit.sha}>
4412 {commit.sha.slice(0, 7)}
4413 </span>
3951454Claude4414 {verification && verification.reason !== "unsigned" && (
4415 <span
efb11c5Claude4416 class={`commit-detail-verify ${
3951454Claude4417 verification.verified
efb11c5Claude4418 ? "commit-detail-verify-ok"
4419 : "commit-detail-verify-warn"
3951454Claude4420 }`}
4421 title={`${verification.signatureType?.toUpperCase() || ""} · ${verification.reason}`}
4422 >
4423 {verification.verified ? "Verified" : verification.reason}
4424 </span>
4425 )}
fc1817aClaude4426 </div>
efb11c5Claude4427 <h1 class="commit-detail-title">{commit.message}</h1>
4428 {fullMessage !== commit.message && (
4429 <pre class="commit-detail-body">{fullMessage}</pre>
4430 )}
4431 <div class="commit-detail-meta">
4432 <span class="commit-detail-author">
4433 <strong>{commit.author}</strong> committed on{" "}
4434 {new Date(commit.date).toLocaleDateString("en-US", {
4435 month: "long",
4436 day: "numeric",
4437 year: "numeric",
4438 })}
4439 </span>
fc1817aClaude4440 {commit.parentShas.length > 0 && (
efb11c5Claude4441 <span class="commit-detail-parents">
4442 {commit.parentShas.length === 1 ? "Parent" : "Parents"}:{" "}
4443 {commit.parentShas.map((p, idx) => (
4444 <>
4445 {idx > 0 && " "}
4446 <a
4447 href={`/${owner}/${repo}/commit/${p}`}
4448 class="commit-detail-sha-link"
4449 >
4450 {p.slice(0, 7)}
4451 </a>
4452 </>
fc1817aClaude4453 ))}
4454 </span>
4455 )}
4456 </div>
efb11c5Claude4457 <div class="commit-detail-stats">
4458 <span class="commit-detail-stat">
4459 <strong>{fileCount}</strong>{" "}
4460 file{fileCount === 1 ? "" : "s"} changed
4461 </span>
4462 <span class="commit-detail-stat commit-detail-stat-add">
4463 <span class="commit-detail-stat-mark">+</span>
4464 <strong>{additions}</strong>
4465 </span>
4466 <span class="commit-detail-stat commit-detail-stat-del">
4467 <span class="commit-detail-stat-mark">−</span>
4468 <strong>{deletions}</strong>
4469 </span>
4470 <span class="commit-detail-sha-full" title="Full SHA">
4471 {commit.sha}
4472 </span>
4473 </div>
0cdfd89Claude4474 {statusCombined && (
efb11c5Claude4475 <div class="commit-detail-checks">
4476 <div class="commit-detail-checks-head">
4477 <strong>Checks</strong>
4478 <span class="commit-detail-checks-summary">
4479 {statusCombined.total} total ·{" "}
4480 <span
4481 class={`commit-detail-check-state commit-detail-check-state-${statusCombined.state}`}
4482 >
4483 {statusCombined.state}
4484 </span>
0cdfd89Claude4485 </span>
efb11c5Claude4486 </div>
4487 <div class="commit-detail-check-row">
0cdfd89Claude4488 {statusCombined.contexts.map((cx) => (
4489 <span
efb11c5Claude4490 class={`commit-detail-check commit-detail-check-${cx.state}`}
0cdfd89Claude4491 title={cx.description || cx.context}
4492 >
4493 {cx.targetUrl ? (
efb11c5Claude4494 <a href={cx.targetUrl} rel="noopener">
0cdfd89Claude4495 {cx.context}: {cx.state}
4496 </a>
4497 ) : (
4498 <>
4499 {cx.context}: {cx.state}
4500 </>
4501 )}
4502 </span>
4503 ))}
4504 </div>
4505 </div>
4506 )}
fc1817aClaude4507 </div>
ea9ed4cClaude4508 <DiffView
4509 raw={raw}
4510 files={files}
4511 viewFileBase={`/${owner}/${repo}/blob/${commit.sha}`}
4512 />
fc1817aClaude4513 </Layout>
4514 );
4515});
4516
79136bbClaude4517// Raw file download
4518web.get("/:owner/:repo/raw/:ref{.+$}", async (c) => {
4519 const { owner, repo } = c.req.param();
4520 const refAndPath = c.req.param("ref");
4521
4522 const branches = await listBranches(owner, repo);
4523 let ref = "";
4524 let filePath = "";
4525
4526 for (const branch of branches) {
4527 if (refAndPath.startsWith(branch + "/")) {
4528 ref = branch;
4529 filePath = refAndPath.slice(branch.length + 1);
4530 break;
4531 }
4532 }
4533
4534 if (!ref) {
4535 const slashIdx = refAndPath.indexOf("/");
4536 if (slashIdx === -1) return c.text("Not found", 404);
4537 ref = refAndPath.slice(0, slashIdx);
4538 filePath = refAndPath.slice(slashIdx + 1);
4539 }
4540
4541 const data = await getRawBlob(owner, repo, ref, filePath);
4542 if (!data) return c.text("Not found", 404);
4543
4544 const fileName = filePath.split("/").pop() || "file";
772a24fClaude4545 return new Response(data as BodyInit, {
79136bbClaude4546 headers: {
4547 "Content-Type": "application/octet-stream",
4548 "Content-Disposition": `attachment; filename="${fileName}"`,
05b973eClaude4549 "Cache-Control": "public, max-age=300, stale-while-revalidate=60",
79136bbClaude4550 },
4551 });
4552});
4553
4554// Blame view
4555web.get("/:owner/:repo/blame/:ref{.+$}", async (c) => {
4556 const { owner, repo } = c.req.param();
4557 const user = c.get("user");
4558 const refAndPath = c.req.param("ref");
4559
4560 const branches = await listBranches(owner, repo);
4561 let ref = "";
4562 let filePath = "";
4563
4564 for (const branch of branches) {
4565 if (refAndPath.startsWith(branch + "/")) {
4566 ref = branch;
4567 filePath = refAndPath.slice(branch.length + 1);
4568 break;
4569 }
4570 }
4571
4572 if (!ref) {
4573 const slashIdx = refAndPath.indexOf("/");
4574 if (slashIdx === -1) return c.text("Not found", 404);
4575 ref = refAndPath.slice(0, slashIdx);
4576 filePath = refAndPath.slice(slashIdx + 1);
4577 }
4578
4579 const blameLines = await getBlame(owner, repo, ref, filePath);
4580 if (blameLines.length === 0) {
4581 return c.html(
4582 <Layout title="Not Found" user={user}>
4583 <div class="empty-state">
4584 <h2>File not found</h2>
4585 </div>
4586 </Layout>,
4587 404
4588 );
4589 }
4590
4591 const fileName = filePath.split("/").pop() || filePath;
efb11c5Claude4592 // Unique contributors (by author) tracked once for the header chip.
4593 const blameAuthors = new Set<string>();
4594 for (const ln of blameLines) blameAuthors.add(ln.author);
79136bbClaude4595
4596 return c.html(
4597 <Layout title={`Blame: ${filePath} — ${owner}/${repo}`} user={user}>
efb11c5Claude4598 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
79136bbClaude4599 <RepoHeader owner={owner} repo={repo} />
4600 <RepoNav owner={owner} repo={repo} active="code" />
398a10cClaude4601 <header class="blame-head">
4602 <div class="blame-eyebrow">
4603 <span class="blame-eyebrow-dot" aria-hidden="true" />
4604 Blame · Line-by-line history
4605 </div>
4606 <h1 class="blame-title">
4607 <code>{fileName}</code>
4608 </h1>
4609 <p class="blame-sub">
4610 Each line is annotated with the commit that last touched it.
4611 Click any SHA to jump to that commit and see the surrounding
4612 change.
4613 </p>
4614 </header>
efb11c5Claude4615 <div class="blame-toolbar">
4616 <Breadcrumb owner={owner} repo={repo} ref={ref} path={filePath} />
4617 </div>
398a10cClaude4618 <div class="blame-card">
4619 <div class="blame-header">
efb11c5Claude4620 <div class="blame-header-meta">
4621 <span class="blame-header-icon" aria-hidden="true">{"⎙"}</span>
4622 <span class="blame-header-name">{fileName}</span>
4623 <span class="blame-header-tag">Blame</span>
4624 <span class="blame-header-stats">
4625 {blameLines.length} line{blameLines.length === 1 ? "" : "s"} ·{" "}
4626 {blameAuthors.size} contributor
4627 {blameAuthors.size === 1 ? "" : "s"}
4628 </span>
4629 </div>
4630 <div class="blame-header-actions">
4631 <a
4632 href={`/${owner}/${repo}/blob/${ref}/${filePath}`}
4633 class="blob-pill"
4634 >
4635 Normal view
4636 </a>
4637 <a
4638 href={`/${owner}/${repo}/raw/${ref}/${filePath}`}
4639 class="blob-pill"
4640 >
4641 Raw
4642 </a>
4643 </div>
79136bbClaude4644 </div>
398a10cClaude4645 <div style="overflow-x:auto">
4646 <table class="blame-table">
79136bbClaude4647 <tbody>
4648 {blameLines.map((line, i) => {
4649 const showInfo =
4650 i === 0 || blameLines[i - 1].sha !== line.sha;
4651 return (
398a10cClaude4652 <tr class={showInfo ? "blame-row-first" : ""}>
4653 <td class="blame-gutter">
79136bbClaude4654 {showInfo && (
398a10cClaude4655 <span class="blame-gutter-inner">
79136bbClaude4656 <a
4657 href={`/${owner}/${repo}/commit/${line.sha}`}
398a10cClaude4658 class="blame-gutter-sha"
4659 title={`Commit ${line.sha}`}
79136bbClaude4660 >
4661 {line.sha.slice(0, 7)}
398a10cClaude4662 </a>
4663 <span class="blame-gutter-author" title={line.author}>
4664 {line.author}
4665 </span>
4666 </span>
79136bbClaude4667 )}
4668 </td>
398a10cClaude4669 <td class="blame-line-num">{line.lineNum}</td>
4670 <td class="blame-line-content">{line.content}</td>
79136bbClaude4671 </tr>
4672 );
4673 })}
4674 </tbody>
4675 </table>
4676 </div>
4677 </div>
4678 </Layout>
4679 );
4680});
4681
4682// Search
4683web.get("/:owner/:repo/search", async (c) => {
4684 const { owner, repo } = c.req.param();
4685 const user = c.get("user");
4686 const q = c.req.query("q") || "";
4687
4688 if (!(await repoExists(owner, repo))) return c.notFound();
4689
4690 const defaultBranch = (await getDefaultBranch(owner, repo)) || "main";
4691 let results: Array<{ file: string; lineNum: number; line: string }> = [];
4692
4693 if (q.trim()) {
4694 results = await searchCode(owner, repo, defaultBranch, q.trim());
4695 }
4696
4697 return c.html(
4698 <Layout title={`Search — ${owner}/${repo}`} user={user}>
efb11c5Claude4699 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
79136bbClaude4700 <RepoHeader owner={owner} repo={repo} />
4701 <RepoNav owner={owner} repo={repo} active="code" />
efb11c5Claude4702 <div class="search-hero">
4703 <div class="search-eyebrow">
4704 <strong>Search</strong> · {owner}/{repo}
4705 </div>
4706 <h1 class="search-title">
4707 Find any line in <span class="gradient-text">{repo}</span>
4708 </h1>
4709 <form
4710 method="get"
4711 action={`/${owner}/${repo}/search`}
4712 class="search-form"
4713 role="search"
4714 >
4715 <div class="search-input-wrap">
4716 <span class="search-input-icon" aria-hidden="true">{"⌕"}</span>
4717 <input
4718 type="text"
4719 name="q"
4720 value={q}
4721 placeholder="Search code on the default branch…"
4722 aria-label="Search code"
4723 class="search-input"
4724 autocomplete="off"
4725 autofocus
4726 />
4727 </div>
4728 <button type="submit" class="btn btn-primary search-submit">
79136bbClaude4729 Search
4730 </button>
efb11c5Claude4731 </form>
4732 </div>
79136bbClaude4733 {q && (
efb11c5Claude4734 <div class="search-results-head">
4735 <span class="search-results-count">
4736 <strong>{results.length}</strong> result
4737 {results.length !== 1 ? "s" : ""}
4738 </span>
4739 <span class="search-results-query">
4740 for <span class="search-results-q">"{q}"</span> on{" "}
4741 <code>{defaultBranch}</code>
4742 </span>
4743 </div>
79136bbClaude4744 )}
efb11c5Claude4745 {q && results.length === 0 ? (
4746 <div class="search-empty">
4747 <p>
4748 No matches for <strong>"{q}"</strong>. Try a shorter query or check
4749 you're on the right branch.
4750 </p>
4751 </div>
4752 ) : results.length > 0 ? (
79136bbClaude4753 <div class="search-results">
4754 {(() => {
4755 // Group by file
4756 const grouped: Record<
4757 string,
4758 Array<{ lineNum: number; line: string }>
4759 > = {};
4760 for (const r of results) {
4761 if (!grouped[r.file]) grouped[r.file] = [];
4762 grouped[r.file].push({ lineNum: r.lineNum, line: r.line });
4763 }
4764 return Object.entries(grouped).map(([file, matches]) => (
efb11c5Claude4765 <div class="search-file diff-file">
4766 <div class="search-file-head diff-file-header">
79136bbClaude4767 <a
4768 href={`/${owner}/${repo}/blob/${defaultBranch}/${file}`}
efb11c5Claude4769 class="search-file-link"
79136bbClaude4770 >
4771 {file}
4772 </a>
efb11c5Claude4773 <span class="search-file-count">
4774 {matches.length} match{matches.length === 1 ? "" : "es"}
4775 </span>
79136bbClaude4776 </div>
4777 <div class="blob-code">
4778 <table>
4779 <tbody>
4780 {matches.map((m) => (
4781 <tr>
4782 <td class="line-num">{m.lineNum}</td>
4783 <td class="line-content">{m.line}</td>
4784 </tr>
4785 ))}
4786 </tbody>
4787 </table>
4788 </div>
4789 </div>
4790 ));
4791 })()}
4792 </div>
efb11c5Claude4793 ) : null}
79136bbClaude4794 </Layout>
4795 );
4796});
4797
fc1817aClaude4798export default web;