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.tsxBlame4805 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`;
60323c5Claude2731 // SSH URL — port-aware:
2732 // Standard port 22 → git@host:owner/repo.git
2733 // Non-standard port → ssh://git@host:PORT/owner/repo.git
544d842Claude2734 let cloneSshUrl = `git@gluecron.com:${owner}/${repo}.git`;
2735 try {
2736 const host = new URL(config.appBaseUrl).hostname;
60323c5Claude2737 const sshHost = (host && host !== "localhost" && host !== "127.0.0.1")
2738 ? host
2739 : "localhost";
2740 const sshPort = config.sshPort;
2741 if (sshPort === 22) {
2742 cloneSshUrl = `git@${sshHost}:${owner}/${repo}.git`;
2743 } else {
2744 cloneSshUrl = `ssh://git@${sshHost}:${sshPort}/${owner}/${repo}.git`;
544d842Claude2745 }
2746 } catch {
2747 // Fall through to default.
2748 }
2749 const cloneCliCmd = `gluecron clone ${owner}/${repo}`;
2750 const formatRelative = (date: Date | null): string => {
2751 if (!date) return "never";
2752 const ms = Date.now() - date.getTime();
2753 const s = Math.max(0, Math.round(ms / 1000));
2754 if (s < 60) return "just now";
2755 const m = Math.round(s / 60);
2756 if (m < 60) return `${m} min ago`;
2757 const h = Math.round(m / 60);
2758 if (h < 24) return `${h}h ago`;
2759 const d = Math.round(h / 24);
2760 if (d < 30) return `${d}d ago`;
2761 const mo = Math.round(d / 30);
2762 if (mo < 12) return `${mo}mo ago`;
2763 const y = Math.round(d / 365);
2764 return `${y}y ago`;
2765 };
06d5ffeClaude2766
fc1817aClaude2767 if (tree.length === 0) {
2768 return c.html(
06d5ffeClaude2769 <Layout title={`${owner}/${repo}`} user={user}>
544d842Claude2770 <style dangerouslySetInnerHTML={{ __html: repoHomeCss }} />
2771 <div class="repo-home-hero">
2772 <div class="repo-home-hero-orb-wrap" aria-hidden="true">
2773 <div class="repo-home-hero-orb" />
2774 </div>
2775 <div class="repo-home-hero-inner">
2776 <div class="repo-home-eyebrow">
2777 <strong>Repository</strong> · {owner}
2778 </div>
2779 <RepoHeader
2780 owner={owner}
2781 repo={repo}
2782 starCount={starCount}
2783 starred={starred}
2784 forkCount={forkCount}
2785 currentUser={user?.username}
2786 archived={archived}
2787 isTemplate={isTemplate}
2788 />
2789 {description ? (
2790 <p class="repo-home-description">{description}</p>
2791 ) : (
2792 <p class="repo-home-description-empty">
2793 No description yet — push a README to tell the world what this
2794 ships.
2795 </p>
2796 )}
2797 </div>
2798 </div>
fc1817aClaude2799 <RepoNav owner={owner} repo={repo} active="code" />
544d842Claude2800 <div class="repo-home-empty">
2801 <div class="repo-home-empty-eyebrow">Getting started</div>
2802 <h2 class="repo-home-empty-title">
2803 Push your first commit to{" "}
2804 <span class="gradient-text">{repo}</span>.
2805 </h2>
2806 <p class="repo-home-empty-sub">
2807 This repository is empty. Paste the snippet below in an existing
2808 project directory to wire it up to Gluecron — your push triggers
2809 gate checks and AI review automatically.
2810 </p>
2811 <pre class="repo-home-empty-snippet">
2812 <span class="repo-home-cmt">
2813 # from an existing project directory
2814 </span>
2815 {"\n"}
2816 <span class="repo-home-cmd">git remote add</span>
2817 {` origin ${cloneHttpsUrl}`}
2818 {"\n"}
2819 <span class="repo-home-cmd">git branch</span>
2820 {` -M main`}
2821 {"\n"}
2822 <span class="repo-home-cmd">git push</span>
2823 {` -u origin main`}
2824 </pre>
fc1817aClaude2825 </div>
2826 </Layout>
2827 );
2828 }
2829
2830 const readme = await getReadme(owner, repo, defaultBranch);
2831
544d842Claude2832 // Sidebar facts — derived from data we already have.
2833 const fileCount = tree.filter((e: any) => e.type !== "tree").length;
2834 const dirCount = tree.filter((e: any) => e.type === "tree").length;
2835
fc1817aClaude2836 return c.html(
06d5ffeClaude2837 <Layout title={`${owner}/${repo}`} user={user}>
544d842Claude2838 <style dangerouslySetInnerHTML={{ __html: repoHomeCss }} />
2839 <div class="repo-home-hero">
2840 <div class="repo-home-hero-orb-wrap" aria-hidden="true">
2841 <div class="repo-home-hero-orb" />
2842 </div>
2843 <div class="repo-home-hero-inner">
2844 <div class="repo-home-eyebrow">
2845 <strong>Repository</strong> · {owner}
2846 </div>
2847 <RepoHeader
2848 owner={owner}
2849 repo={repo}
2850 starCount={starCount}
2851 starred={starred}
2852 forkCount={forkCount}
2853 currentUser={user?.username}
2854 archived={archived}
2855 isTemplate={isTemplate}
2856 />
2857 {description ? (
2858 <p class="repo-home-description">{description}</p>
2859 ) : (
2860 <p class="repo-home-description-empty">
2861 No description yet.
2862 </p>
2863 )}
2864 <div class="repo-home-stat-row" aria-label="Repository stats">
2865 <span class="repo-home-stat" title="Default branch">
2866 <span class="repo-home-stat-icon">{"⎇"}</span>
2867 <strong>{defaultBranch}</strong>
2868 </span>
2869 <a
2870 href={`/${owner}/${repo}/commits/${defaultBranch}`}
2871 class="repo-home-stat"
2872 title="Browse all branches"
2873 >
2874 <span class="repo-home-stat-icon">{"⊢"}</span>
2875 <strong>{branches.length}</strong>{" "}
2876 branch{branches.length === 1 ? "" : "es"}
2877 </a>
2878 <span class="repo-home-stat" title="Top-level entries">
2879 <span class="repo-home-stat-icon">{"■"}</span>
2880 <strong>{fileCount}</strong> file{fileCount === 1 ? "" : "s"}
2881 {dirCount > 0 && (
2882 <>
2883 {" · "}
2884 <strong>{dirCount}</strong> dir{dirCount === 1 ? "" : "s"}
2885 </>
2886 )}
2887 </span>
2888 {pushedAt && (
2889 <span class="repo-home-stat" title={`Last push: ${pushedAt.toISOString()}`}>
2890 <span class="repo-home-stat-icon">{"↻"}</span>
2891 Updated <strong>{formatRelative(pushedAt)}</strong>
2892 </span>
2893 )}
2894 </div>
2895 </div>
2896 </div>
71cd5ecClaude2897 {isTemplate && user && user.username !== owner && (
2898 <div
2899 class="panel"
dc26881CC LABS App2900 style="margin-bottom:var(--space-4);padding:var(--space-3);display:flex;align-items:center;justify-content:space-between;gap:var(--space-3)"
71cd5ecClaude2901 >
2902 <div style="font-size:13px">
2903 <strong>Template repository.</strong> Create a new repository from
2904 this template's files.
2905 </div>
2906 <form
001af43Claude2907 method="post"
71cd5ecClaude2908 action={`/${owner}/${repo}/use-template`}
dc26881CC LABS App2909 style="display:flex;gap:var(--space-2);align-items:center"
71cd5ecClaude2910 >
2911 <input
2912 type="text"
2913 name="name"
2914 placeholder="new-repo-name"
2915 required
2c3ba6ecopilot-swe-agent[bot]2916 aria-label="New repository name"
71cd5ecClaude2917 style="width:200px"
2918 />
2919 <button type="submit" class="btn btn-primary">
2920 Use this template
2921 </button>
2922 </form>
2923 </div>
2924 )}
fc1817aClaude2925 <RepoNav owner={owner} repo={repo} active="code" />
cb5a796Claude2926 <RepoHomePendingBanner
2927 owner={owner}
2928 repo={repo}
2929 count={repoHomePendingCount}
2930 />
c6018a5Claude2931 {/* ─── Per-repo AI surfaces — RepoNav is locked, so the discovery
2932 row sits just below the nav as a slim CTA strip. Scoped under
2933 `.repo-ai-cta-` so the styles can't bleed onto other pages. ─── */}
2934 <style
2935 dangerouslySetInnerHTML={{
2936 __html: `
2937 .repo-ai-cta-row {
2938 display: flex;
2939 flex-wrap: wrap;
2940 gap: 8px;
2941 margin: 12px 0 18px;
2942 padding: 10px 14px;
2943 background: linear-gradient(135deg, rgba(140,109,255,0.06), rgba(54,197,214,0.04));
2944 border: 1px solid var(--border);
2945 border-radius: 10px;
2946 position: relative;
2947 overflow: hidden;
2948 }
2949 .repo-ai-cta-row::before {
2950 content: '';
2951 position: absolute;
2952 top: 0; left: 0; right: 0;
2953 height: 1px;
2954 background: linear-gradient(90deg, transparent 0%, rgba(140,109,255,0.45) 30%, rgba(54,197,214,0.45) 70%, transparent 100%);
2955 opacity: 0.7;
2956 pointer-events: none;
2957 }
2958 .repo-ai-cta-label {
2959 font-size: 11px;
2960 font-weight: 600;
2961 letter-spacing: 0.06em;
2962 text-transform: uppercase;
2963 color: var(--accent);
2964 align-self: center;
2965 padding-right: 8px;
2966 border-right: 1px solid var(--border);
2967 margin-right: 4px;
2968 }
2969 .repo-ai-cta {
2970 display: inline-flex;
2971 align-items: center;
2972 gap: 6px;
2973 padding: 5px 10px;
2974 font-size: 12.5px;
2975 font-weight: 500;
2976 color: var(--text);
2977 background: var(--bg);
2978 border: 1px solid var(--border);
2979 border-radius: 7px;
2980 text-decoration: none;
2981 transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
2982 }
2983 .repo-ai-cta:hover {
2984 border-color: rgba(140,109,255,0.45);
2985 color: var(--text-strong);
2986 background: rgba(140,109,255,0.06);
2987 text-decoration: none;
2988 }
2989 .repo-ai-cta-icon {
2990 opacity: 0.75;
2991 font-size: 12px;
2992 }
2993 @media (max-width: 640px) {
2994 .repo-ai-cta-row { flex-direction: column; align-items: stretch; }
2995 .repo-ai-cta-label { border-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-right: 0; }
2996 }
2997 `,
2998 }}
2999 />
3000 <nav class="repo-ai-cta-row" aria-label="AI surfaces for this repository">
3001 <span class="repo-ai-cta-label">AI surfaces</span>
3002 <a class="repo-ai-cta" href={`/${owner}/${repo}/chat`} title="Rubber-duck chat grounded in this repo">
3003 <span class="repo-ai-cta-icon" aria-hidden="true">{"\u{1F4AC}"}</span>
3004 Chat
3005 </a>
3006 <a class="repo-ai-cta" href={`/${owner}/${repo}/previews`} title="Ephemeral preview URLs per branch">
3007 <span class="repo-ai-cta-icon" aria-hidden="true">{"\u{1F30D}"}</span>
3008 Previews
3009 </a>
3010 <a class="repo-ai-cta" href={`/${owner}/${repo}/migrations/propose`} title="AI proposes the Drizzle migration for a schema change">
3011 <span class="repo-ai-cta-icon" aria-hidden="true">{"⛁"}</span>
3012 Migrations
3013 </a>
3014 <a class="repo-ai-cta" href={`/${owner}/${repo}/semantic-search`} title="Embedding-backed code search">
3015 <span class="repo-ai-cta-icon" aria-hidden="true">{"✨"}</span>
3016 Semantic search
3017 </a>
3018 <a class="repo-ai-cta" href={`/${owner}/${repo}/releases/new`} title="Draft release notes with AI">
3019 <span class="repo-ai-cta-icon" aria-hidden="true">{"\u{1F3F7}"}</span>
3020 AI release notes
3021 </a>
3022 </nav>
544d842Claude3023 <div class="repo-home-grid">
3024 <div class="repo-home-main">
3025 <BranchSwitcher
3026 owner={owner}
3027 repo={repo}
3028 currentRef={defaultBranch}
3029 branches={branches}
3030 pathType="tree"
3031 />
3032 <FileTable
3033 entries={tree}
3034 owner={owner}
3035 repo={repo}
3036 ref={defaultBranch}
3037 path=""
3038 />
3039 {readme && (() => {
3040 const readmeHtml = renderMarkdown(readme);
3041 return (
3042 <div class="repo-home-readme">
3043 <div class="repo-home-readme-head">
3044 <span class="repo-home-readme-icon">{"☰"}</span>
3045 <span>README.md</span>
3046 </div>
3047 <style>{markdownCss}</style>
3048 <div class="markdown-body repo-home-readme-body">
3049 {html([readmeHtml] as unknown as TemplateStringsArray)}
3050 </div>
3051 </div>
3052 );
3053 })()}
3054 </div>
3055 <aside class="repo-home-side" aria-label="Repository details">
3056 <div class="repo-home-clone">
3057 <div class="repo-home-clone-tabs" role="tablist" aria-label="Clone protocol">
3058 <button
3059 type="button"
3060 class="repo-home-clone-tab"
3061 role="tab"
3062 aria-selected="true"
3063 data-pane="https"
3064 data-repo-home-clone-tab
3065 >
3066 HTTPS
3067 </button>
3068 <button
3069 type="button"
3070 class="repo-home-clone-tab"
3071 role="tab"
3072 aria-selected="false"
3073 data-pane="ssh"
3074 data-repo-home-clone-tab
3075 >
3076 SSH
3077 </button>
3078 <button
3079 type="button"
3080 class="repo-home-clone-tab"
3081 role="tab"
3082 aria-selected="false"
3083 data-pane="cli"
3084 data-repo-home-clone-tab
3085 >
3086 CLI
3087 </button>
3088 </div>
3089 <div
3090 class="repo-home-clone-pane"
3091 data-pane="https"
3092 data-active="true"
3093 role="tabpanel"
3094 >
3095 <div class="repo-home-clone-body">
3096 <input
3097 class="repo-home-clone-input"
3098 type="text"
3099 value={cloneHttpsUrl}
3100 readonly
3101 aria-label="HTTPS clone URL"
3102 data-repo-home-clone-input
3103 />
3104 <button
3105 type="button"
3106 class="repo-home-clone-copy"
3107 data-repo-home-copy={cloneHttpsUrl}
3108 >
3109 Copy
3110 </button>
3111 </div>
3112 </div>
3113 <div
3114 class="repo-home-clone-pane"
3115 data-pane="ssh"
3116 data-active="false"
3117 role="tabpanel"
3118 >
3119 <div class="repo-home-clone-body">
3120 <input
3121 class="repo-home-clone-input"
3122 type="text"
3123 value={cloneSshUrl}
3124 readonly
3125 aria-label="SSH clone URL"
3126 data-repo-home-clone-input
3127 />
3128 <button
3129 type="button"
3130 class="repo-home-clone-copy"
3131 data-repo-home-copy={cloneSshUrl}
3132 >
3133 Copy
3134 </button>
3135 </div>
3136 </div>
3137 <div
3138 class="repo-home-clone-pane"
3139 data-pane="cli"
3140 data-active="false"
3141 role="tabpanel"
3142 >
3143 <div class="repo-home-clone-body">
3144 <input
3145 class="repo-home-clone-input"
3146 type="text"
3147 value={cloneCliCmd}
3148 readonly
3149 aria-label="Gluecron CLI clone command"
3150 data-repo-home-clone-input
3151 />
3152 <button
3153 type="button"
3154 class="repo-home-clone-copy"
3155 data-repo-home-copy={cloneCliCmd}
3156 >
3157 Copy
3158 </button>
3159 </div>
79136bbClaude3160 </div>
fc1817aClaude3161 </div>
544d842Claude3162 <div class="repo-home-side-card">
3163 <h3 class="repo-home-side-title">About</h3>
3164 <div class="repo-home-side-row">
3165 <span class="repo-home-side-key">Default branch</span>
3166 <span class="repo-home-side-val">{defaultBranch}</span>
3167 </div>
3168 <div class="repo-home-side-row">
3169 <span class="repo-home-side-key">Branches</span>
3170 <span class="repo-home-side-val">
3171 <a href={`/${owner}/${repo}/commits/${defaultBranch}`}>
3172 {branches.length}
3173 </a>
3174 </span>
3175 </div>
3176 <div class="repo-home-side-row">
3177 <span class="repo-home-side-key">Stars</span>
3178 <span class="repo-home-side-val">{starCount}</span>
3179 </div>
3180 <div class="repo-home-side-row">
3181 <span class="repo-home-side-key">Forks</span>
3182 <span class="repo-home-side-val">{forkCount}</span>
3183 </div>
3184 {pushedAt && (
3185 <div class="repo-home-side-row">
3186 <span class="repo-home-side-key">Last push</span>
3187 <span class="repo-home-side-val">
3188 {formatRelative(pushedAt)}
3189 </span>
3190 </div>
3191 )}
3192 {createdAt && (
3193 <div class="repo-home-side-row">
3194 <span class="repo-home-side-key">Created</span>
3195 <span class="repo-home-side-val">
3196 {formatRelative(createdAt)}
3197 </span>
3198 </div>
3199 )}
3200 {(archived || isTemplate) && (
3201 <div class="repo-home-side-row">
3202 <span class="repo-home-side-key">State</span>
3203 <span class="repo-home-side-val">
3204 {archived ? "Archived" : "Template"}
3205 </span>
3206 </div>
3207 )}
3208 </div>
3209 </aside>
3210 </div>
3211 <script
3212 dangerouslySetInnerHTML={{
3213 __html: `
3214 (function(){
3215 var tabs = document.querySelectorAll('[data-repo-home-clone-tab]');
3216 tabs.forEach(function(tab){
3217 tab.addEventListener('click', function(){
3218 var target = tab.getAttribute('data-pane');
3219 tabs.forEach(function(t){
3220 t.setAttribute('aria-selected', t === tab ? 'true' : 'false');
3221 });
3222 var panes = document.querySelectorAll('.repo-home-clone-pane');
3223 panes.forEach(function(p){
3224 p.setAttribute('data-active', p.getAttribute('data-pane') === target ? 'true' : 'false');
3225 });
3226 });
3227 });
3228 var copyBtns = document.querySelectorAll('[data-repo-home-copy]');
3229 copyBtns.forEach(function(btn){
3230 btn.addEventListener('click', function(){
3231 var text = btn.getAttribute('data-repo-home-copy') || '';
3232 var done = function(){
3233 var prev = btn.textContent;
3234 btn.textContent = 'Copied';
3235 setTimeout(function(){ btn.textContent = prev; }, 1200);
3236 };
3237 if (navigator.clipboard && navigator.clipboard.writeText) {
3238 navigator.clipboard.writeText(text).then(done, done);
3239 } else {
3240 var ta = document.createElement('textarea');
3241 ta.value = text;
3242 document.body.appendChild(ta);
3243 ta.select();
3244 try { document.execCommand('copy'); } catch (e) {}
3245 document.body.removeChild(ta);
3246 done();
3247 }
3248 });
3249 });
3250 })();
3251 `,
3252 }}
3253 />
fc1817aClaude3254 </Layout>
3255 );
3256});
3257
3258// Browse tree at ref/path
3259web.get("/:owner/:repo/tree/:ref{.+$}", async (c) => {
3260 const { owner, repo } = c.req.param();
06d5ffeClaude3261 const user = c.get("user");
fc1817aClaude3262 const refAndPath = c.req.param("ref");
3263
3264 const branches = await listBranches(owner, repo);
3265 let ref = "";
3266 let treePath = "";
3267
3268 for (const branch of branches) {
3269 if (refAndPath === branch || refAndPath.startsWith(branch + "/")) {
3270 ref = branch;
3271 treePath = refAndPath.slice(branch.length + 1);
3272 break;
3273 }
3274 }
3275
3276 if (!ref) {
3277 const slashIdx = refAndPath.indexOf("/");
3278 if (slashIdx === -1) {
3279 ref = refAndPath;
3280 } else {
3281 ref = refAndPath.slice(0, slashIdx);
3282 treePath = refAndPath.slice(slashIdx + 1);
3283 }
3284 }
3285
3286 const tree = await getTree(owner, repo, ref, treePath);
efb11c5Claude3287 const fileCount = tree.filter((e: any) => e.type !== "tree").length;
3288 const dirCount = tree.filter((e: any) => e.type === "tree").length;
fc1817aClaude3289
3290 return c.html(
06d5ffeClaude3291 <Layout title={`${treePath || "/"} — ${owner}/${repo}`} user={user}>
efb11c5Claude3292 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude3293 <RepoHeader owner={owner} repo={repo} />
3294 <RepoNav owner={owner} repo={repo} active="code" />
efb11c5Claude3295 <div class="tree-header">
3296 <div class="tree-header-row">
3297 <BranchSwitcher
3298 owner={owner}
3299 repo={repo}
3300 currentRef={ref}
3301 branches={branches}
3302 pathType="tree"
3303 subPath={treePath}
3304 />
3305 <div class="tree-header-stats">
3306 <span class="tree-stat" title="Entries in this directory">
3307 <strong>{fileCount}</strong> file{fileCount === 1 ? "" : "s"}
3308 {dirCount > 0 && (
3309 <>
3310 {" · "}
3311 <strong>{dirCount}</strong> dir{dirCount === 1 ? "" : "s"}
3312 </>
3313 )}
3314 </span>
3315 <a
3316 href={`/${owner}/${repo}/search`}
3317 class="tree-stat tree-stat-link"
3318 title="Search code in this repository"
3319 >
3320 {"⌕"} Search
3321 </a>
3322 </div>
3323 </div>
3324 <div class="tree-breadcrumb-row">
3325 <Breadcrumb owner={owner} repo={repo} ref={ref} path={treePath} />
3326 </div>
3327 </div>
fc1817aClaude3328 <FileTable
3329 entries={tree}
3330 owner={owner}
3331 repo={repo}
3332 ref={ref}
3333 path={treePath}
3334 />
3335 </Layout>
3336 );
3337});
3338
06d5ffeClaude3339// View file blob with syntax highlighting
fc1817aClaude3340web.get("/:owner/:repo/blob/:ref{.+$}", async (c) => {
3341 const { owner, repo } = c.req.param();
06d5ffeClaude3342 const user = c.get("user");
fc1817aClaude3343 const refAndPath = c.req.param("ref");
3344
3345 const branches = await listBranches(owner, repo);
3346 let ref = "";
3347 let filePath = "";
3348
3349 for (const branch of branches) {
3350 if (refAndPath.startsWith(branch + "/")) {
3351 ref = branch;
3352 filePath = refAndPath.slice(branch.length + 1);
3353 break;
3354 }
3355 }
3356
3357 if (!ref) {
3358 const slashIdx = refAndPath.indexOf("/");
3359 if (slashIdx === -1) return c.text("Not found", 404);
3360 ref = refAndPath.slice(0, slashIdx);
3361 filePath = refAndPath.slice(slashIdx + 1);
3362 }
3363
3364 const blob = await getBlob(owner, repo, ref, filePath);
3365 if (!blob) {
3366 return c.html(
06d5ffeClaude3367 <Layout title="Not Found" user={user}>
fc1817aClaude3368 <div class="empty-state">
3369 <h2>File not found</h2>
3370 </div>
3371 </Layout>,
3372 404
3373 );
3374 }
3375
06d5ffeClaude3376 const fileName = filePath.split("/").pop() || filePath;
efb11c5Claude3377 const lineCount = blob.isBinary
3378 ? 0
3379 : (blob.content.endsWith("\n")
3380 ? blob.content.split("\n").length - 1
3381 : blob.content.split("\n").length);
3382 const formatBytes = (n: number): string => {
3383 if (n < 1024) return `${n} B`;
3384 if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
3385 return `${(n / (1024 * 1024)).toFixed(1)} MB`;
3386 };
fc1817aClaude3387
3388 return c.html(
06d5ffeClaude3389 <Layout title={`${filePath} — ${owner}/${repo}`} user={user}>
efb11c5Claude3390 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude3391 <RepoHeader owner={owner} repo={repo} />
3392 <RepoNav owner={owner} repo={repo} active="code" />
efb11c5Claude3393 <div class="blob-toolbar">
3394 <BranchSwitcher
3395 owner={owner}
3396 repo={repo}
3397 currentRef={ref}
3398 branches={branches}
3399 pathType="blob"
3400 subPath={filePath}
3401 />
3402 <div class="blob-breadcrumb">
3403 <Breadcrumb owner={owner} repo={repo} ref={ref} path={filePath} />
3404 </div>
3405 </div>
3406 <div class="blob-view blob-card">
3407 <div class="blob-header blob-header-polished">
3408 <div class="blob-header-meta">
3409 <span class="blob-header-icon" aria-hidden="true">
3410 {"📄"}
3411 </span>
3412 <span class="blob-header-name">{fileName}</span>
3413 <span class="blob-header-size">
3414 {formatBytes(blob.size)}
3415 {!blob.isBinary && (
3416 <>
3417 {" · "}
3418 {lineCount} line{lineCount === 1 ? "" : "s"}
3419 </>
3420 )}
3421 </span>
3422 </div>
3423 <div class="blob-header-actions">
3424 <a
3425 href={`/${owner}/${repo}/raw/${ref}/${filePath}`}
3426 class="blob-pill"
3427 >
79136bbClaude3428 Raw
3429 </a>
efb11c5Claude3430 <a
3431 href={`/${owner}/${repo}/blame/${ref}/${filePath}`}
3432 class="blob-pill"
3433 >
79136bbClaude3434 Blame
3435 </a>
efb11c5Claude3436 <a
3437 href={`/${owner}/${repo}/timeline/${ref}/${filePath}`}
3438 class="blob-pill"
3439 >
16b325cClaude3440 History
3441 </a>
0074234Claude3442 {user && (
efb11c5Claude3443 <a
3444 href={`/${owner}/${repo}/edit/${ref}/${filePath}`}
3445 class="blob-pill blob-pill-accent"
3446 >
0074234Claude3447 Edit
3448 </a>
3449 )}
efb11c5Claude3450 </div>
fc1817aClaude3451 </div>
3452 {blob.isBinary ? (
efb11c5Claude3453 <div class="blob-binary">
fc1817aClaude3454 Binary file not shown.
3455 </div>
06d5ffeClaude3456 ) : (() => {
3457 const { html: highlighted, language } = highlightCode(
3458 blob.content,
3459 fileName
3460 );
3461 if (language) {
3462 return (
3463 <HighlightedCode
3464 highlightedHtml={highlighted}
efb11c5Claude3465 lineCount={lineCount}
06d5ffeClaude3466 />
3467 );
3468 }
3469 const lines = blob.content.split("\n");
3470 if (lines[lines.length - 1] === "") lines.pop();
3471 return <PlainCode lines={lines} />;
3472 })()}
fc1817aClaude3473 </div>
3474 </Layout>
3475 );
3476});
3477
398a10cClaude3478// ─── Branches list ────────────────────────────────────────────────────────
3479// Lightweight `git for-each-ref` enrichment so each row shows last-commit
3480// author + relative time + ahead/behind vs the default branch. No DB. All
3481// data comes from git plumbing; failures degrade gracefully (counts omitted).
3482web.get("/:owner/:repo/branches", async (c) => {
3483 const { owner, repo } = c.req.param();
3484 const user = c.get("user");
3485
3486 if (!(await repoExists(owner, repo))) return c.notFound();
3487
3488 const defaultBranch = (await getDefaultBranch(owner, repo)) || "main";
3489 const branches = await listBranches(owner, repo);
3490 const repoDir = getRepoPath(owner, repo);
3491
3492 type BranchRow = {
3493 name: string;
3494 isDefault: boolean;
3495 sha: string;
3496 subject: string;
3497 author: string;
3498 date: string;
3499 ahead: number;
3500 behind: number;
3501 };
3502
3503 const runGit = async (args: string[]): Promise<string> => {
3504 try {
3505 const proc = Bun.spawn(["git", ...args], {
3506 cwd: repoDir,
3507 stdout: "pipe",
3508 stderr: "pipe",
3509 });
3510 const out = await new Response(proc.stdout).text();
3511 await proc.exited;
3512 return out;
3513 } catch {
3514 return "";
3515 }
3516 };
3517
3518 const meta = await runGit([
3519 "for-each-ref",
3520 "--sort=-committerdate",
3521 "--format=%(refname:short)%00%(objectname)%00%(subject)%00%(authorname)%00%(committerdate:iso-strict)",
3522 "refs/heads/",
3523 ]);
3524 const metaByName: Record<
3525 string,
3526 { sha: string; subject: string; author: string; date: string }
3527 > = {};
3528 for (const line of meta.split("\n").filter(Boolean)) {
3529 const [name, sha, subject, author, date] = line.split("\0");
3530 metaByName[name] = { sha, subject, author, date };
3531 }
3532
3533 const branchOrder = [...branches].sort((a, b) => {
3534 if (a === defaultBranch) return -1;
3535 if (b === defaultBranch) return 1;
3536 const aDate = metaByName[a]?.date || "";
3537 const bDate = metaByName[b]?.date || "";
3538 return bDate.localeCompare(aDate);
3539 });
3540
3541 const rows: BranchRow[] = [];
3542 for (const name of branchOrder) {
3543 const m = metaByName[name] || { sha: "", subject: "", author: "", date: "" };
3544 let ahead = 0;
3545 let behind = 0;
3546 if (name !== defaultBranch && metaByName[defaultBranch]) {
3547 const out = await runGit([
3548 "rev-list",
3549 "--left-right",
3550 "--count",
3551 `${defaultBranch}...${name}`,
3552 ]);
3553 const parts = out.trim().split(/\s+/);
3554 if (parts.length === 2) {
3555 behind = parseInt(parts[0], 10) || 0;
3556 ahead = parseInt(parts[1], 10) || 0;
3557 }
3558 }
3559 rows.push({
3560 name,
3561 isDefault: name === defaultBranch,
3562 sha: m.sha,
3563 subject: m.subject,
3564 author: m.author,
3565 date: m.date,
3566 ahead,
3567 behind,
3568 });
3569 }
3570
3571 const relative = (iso: string): string => {
3572 if (!iso) return "—";
3573 const d = new Date(iso);
3574 if (Number.isNaN(d.getTime())) return "—";
3575 const diff = Date.now() - d.getTime();
3576 const m = Math.floor(diff / 60000);
3577 if (m < 1) return "just now";
3578 if (m < 60) return `${m} min ago`;
3579 const h = Math.floor(m / 60);
3580 if (h < 24) return `${h} hr${h === 1 ? "" : "s"} ago`;
3581 const dd = Math.floor(h / 24);
3582 if (dd < 30) return `${dd} day${dd === 1 ? "" : "s"} ago`;
3583 return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
3584 };
3585
3586 const success = c.req.query("success");
3587 const error = c.req.query("error");
3588
3589 return c.html(
3590 <Layout title={`Branches — ${owner}/${repo}`} user={user}>
3591 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
3592 <RepoHeader owner={owner} repo={repo} />
3593 <RepoNav owner={owner} repo={repo} active="code" />
3594 <div
3595 class="branches-wrap"
3596 style="max-width:1100px;margin:0 auto;padding:var(--space-5) var(--space-4) var(--space-8)"
3597 >
3598 <header class="branches-head" style="margin-bottom:var(--space-5)">
3599 <div
3600 class="branches-eyebrow"
3601 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"
3602 >
3603 <span
3604 class="branches-eyebrow-dot"
3605 aria-hidden="true"
3606 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)"
3607 />
3608 Repository · Branches
3609 </div>
3610 <h1
3611 class="branches-title"
3612 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)"
3613 >
3614 <span class="gradient-text">{rows.length}</span>{" "}
3615 branch{rows.length === 1 ? "" : "es"}
3616 </h1>
3617 <p
3618 class="branches-sub"
3619 style="margin:0;font-size:14px;color:var(--text-muted);line-height:1.5;max-width:700px"
3620 >
3621 All work-in-progress lines for{" "}
3622 <code style="font-size:12.5px">{owner}/{repo}</code>. Ahead/behind
3623 counts are relative to{" "}
3624 <code style="font-size:12.5px">{defaultBranch}</code>.
3625 </p>
3626 </header>
3627
3628 {success && (
3629 <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">
3630 {decodeURIComponent(success)}
3631 </div>
3632 )}
3633 {error && (
3634 <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">
3635 {decodeURIComponent(error)}
3636 </div>
3637 )}
3638
3639 {rows.length === 0 ? (
3640 <div class="commits-empty">
3641 <div class="commits-empty-orb" aria-hidden="true" />
3642 <div class="commits-empty-inner">
3643 <div class="commits-empty-icon" aria-hidden="true">
3644 <svg
3645 width="22"
3646 height="22"
3647 viewBox="0 0 24 24"
3648 fill="none"
3649 stroke="currentColor"
3650 stroke-width="2"
3651 stroke-linecap="round"
3652 stroke-linejoin="round"
3653 >
3654 <line x1="6" y1="3" x2="6" y2="15" />
3655 <circle cx="18" cy="6" r="3" />
3656 <circle cx="6" cy="18" r="3" />
3657 <path d="M18 9a9 9 0 0 1-9 9" />
3658 </svg>
3659 </div>
3660 <h3 class="commits-empty-title">No branches yet</h3>
3661 <p class="commits-empty-sub">
3662 Push your first commit to create the default branch.
3663 </p>
3664 </div>
3665 </div>
3666 ) : (
3667 <div class="branches-list">
3668 {rows.map((r) => (
3669 <div class="branches-row">
3670 <div class="branches-row-icon" aria-hidden="true">
3671 <svg
3672 width="14"
3673 height="14"
3674 viewBox="0 0 24 24"
3675 fill="none"
3676 stroke="currentColor"
3677 stroke-width="2"
3678 stroke-linecap="round"
3679 stroke-linejoin="round"
3680 >
3681 <line x1="6" y1="3" x2="6" y2="15" />
3682 <circle cx="18" cy="6" r="3" />
3683 <circle cx="6" cy="18" r="3" />
3684 <path d="M18 9a9 9 0 0 1-9 9" />
3685 </svg>
3686 </div>
3687 <div class="branches-row-main">
3688 <div class="branches-row-name">
3689 <a href={`/${owner}/${repo}/tree/${r.name}`}>{r.name}</a>
3690 {r.isDefault && (
3691 <span
3692 class="branches-row-default"
3693 title="Default branch"
3694 >
3695 Default
3696 </span>
3697 )}
3698 </div>
3699 <div class="branches-row-meta">
3700 {r.subject ? (
3701 <>
3702 <strong>{r.author || "—"}</strong>
3703 <span class="sep">·</span>
3704 <span
3705 title={r.date ? new Date(r.date).toISOString() : ""}
3706 >
3707 updated {relative(r.date)}
3708 </span>
3709 {r.sha && (
3710 <>
3711 <span class="sep">·</span>
3712 <a
3713 href={`/${owner}/${repo}/commit/${r.sha}`}
3714 style="font-family:var(--font-mono);font-size:11.5px;color:var(--text-muted);text-decoration:none"
3715 >
3716 {r.sha.slice(0, 7)}
3717 </a>
3718 </>
3719 )}
3720 </>
3721 ) : (
3722 <span>No commit metadata</span>
3723 )}
3724 </div>
3725 </div>
3726 <div class="branches-row-side">
3727 {!r.isDefault && (r.ahead > 0 || r.behind > 0) && (
3728 <span
3729 class="branches-row-divergence"
3730 title={`${r.ahead} ahead, ${r.behind} behind ${defaultBranch}`}
3731 >
3732 <span class="ahead">{r.ahead} ahead</span>
3733 <span style="opacity:0.4">|</span>
3734 <span class="behind">{r.behind} behind</span>
3735 </span>
3736 )}
3737 <div class="branches-row-actions">
3738 <a
3739 href={`/${owner}/${repo}/commits/${r.name}`}
3740 class="branches-btn"
3741 title="View commits on this branch"
3742 >
3743 Commits
3744 </a>
3745 {!r.isDefault &&
3746 user &&
3747 user.username === owner && (
3748 <form
3749 method="post"
3750 action={`/${owner}/${repo}/branches/${encodeURIComponent(r.name)}/delete`}
3751 style="margin:0"
3752 onsubmit={`return confirm('Delete branch \\'${r.name}\\'? This cannot be undone.')`}
3753 >
3754 <button
3755 type="submit"
3756 class="branches-btn branches-btn-danger"
3757 >
3758 Delete
3759 </button>
3760 </form>
3761 )}
3762 </div>
3763 </div>
3764 </div>
3765 ))}
3766 </div>
3767 )}
3768 </div>
3769 </Layout>
3770 );
3771});
3772
3773// Delete a branch (owner only). Uses `git branch -D` so we can drop refs
3774// that are not merged into the default branch — matches the explicit
3775// confirmation on the row's delete button.
3776web.post("/:owner/:repo/branches/:name/delete", requireAuth, async (c) => {
3777 const { owner, repo } = c.req.param();
3778 const branchName = decodeURIComponent(c.req.param("name"));
3779 const user = c.get("user")!;
3780
3781 // Owner-only check (mirrors collaborators.tsx pattern).
3782 const [ownerRow] = await db
3783 .select()
3784 .from(users)
3785 .where(eq(users.username, owner))
3786 .limit(1);
3787 if (!ownerRow || ownerRow.id !== user.id) {
3788 return c.redirect(
3789 `/${owner}/${repo}/branches?error=Only+the+owner+can+delete+branches`
3790 );
3791 }
3792
3793 const defaultBranch = (await getDefaultBranch(owner, repo)) || "main";
3794 if (branchName === defaultBranch) {
3795 return c.redirect(
3796 `/${owner}/${repo}/branches?error=Cannot+delete+the+default+branch`
3797 );
3798 }
3799
3800 const branches = await listBranches(owner, repo);
3801 if (!branches.includes(branchName)) {
3802 return c.redirect(
3803 `/${owner}/${repo}/branches?error=Branch+not+found`
3804 );
3805 }
3806
3807 try {
3808 const repoDir = getRepoPath(owner, repo);
3809 const proc = Bun.spawn(["git", "branch", "-D", branchName], {
3810 cwd: repoDir,
3811 stdout: "pipe",
3812 stderr: "pipe",
3813 });
3814 await proc.exited;
3815 if (proc.exitCode !== 0) {
3816 return c.redirect(
3817 `/${owner}/${repo}/branches?error=Delete+failed`
3818 );
3819 }
3820 } catch {
3821 return c.redirect(`/${owner}/${repo}/branches?error=Delete+failed`);
3822 }
3823
3824 return c.redirect(`/${owner}/${repo}/branches?success=Branch+deleted`);
3825});
3826
3827// ─── Tags list ────────────────────────────────────────────────────────────
3828// Pulls from `listTags` (sorted newest first). For each tag we look up an
3829// associated release row so the "View release" CTA can deep-link directly
3830// without making the user hunt for it.
3831web.get("/:owner/:repo/tags", async (c) => {
3832 const { owner, repo } = c.req.param();
3833 const user = c.get("user");
3834
3835 if (!(await repoExists(owner, repo))) return c.notFound();
3836
3837 const tags = await listTags(owner, repo);
3838
3839 // Map tags -> releases. Best-effort; releases table may not exist in
3840 // every test setup, so any error falls through with an empty set.
3841 const tagsWithReleases = new Set<string>();
3842 try {
3843 const [ownerRow] = await db
3844 .select()
3845 .from(users)
3846 .where(eq(users.username, owner))
3847 .limit(1);
3848 if (ownerRow) {
3849 const [repoRow] = await db
3850 .select()
3851 .from(repositories)
3852 .where(
3853 and(
3854 eq(repositories.ownerId, ownerRow.id),
3855 eq(repositories.name, repo)
3856 )
3857 )
3858 .limit(1);
3859 if (repoRow) {
3860 // Raw SQL so we don't need to import the releases schema here.
3861 const result = await db.execute(
3862 sql`SELECT tag FROM releases WHERE repository_id = ${repoRow.id}`
3863 );
3864 const rows: any[] = (result as any).rows || (result as any) || [];
3865 for (const row of rows) {
3866 const tag = row?.tag;
3867 if (typeof tag === "string") tagsWithReleases.add(tag);
3868 }
3869 }
3870 }
3871 } catch {
3872 // No releases table or DB error — leave set empty.
3873 }
3874
3875 const relative = (iso: string): string => {
3876 if (!iso) return "—";
3877 const d = new Date(iso);
3878 if (Number.isNaN(d.getTime())) return "—";
3879 const diff = Date.now() - d.getTime();
3880 const m = Math.floor(diff / 60000);
3881 if (m < 1) return "just now";
3882 if (m < 60) return `${m} min ago`;
3883 const h = Math.floor(m / 60);
3884 if (h < 24) return `${h} hr${h === 1 ? "" : "s"} ago`;
3885 const dd = Math.floor(h / 24);
3886 if (dd < 30) return `${dd} day${dd === 1 ? "" : "s"} ago`;
3887 return d.toLocaleDateString("en-US", {
3888 month: "short",
3889 day: "numeric",
3890 year: "numeric",
3891 });
3892 };
3893
3894 return c.html(
3895 <Layout title={`Tags — ${owner}/${repo}`} user={user}>
3896 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
3897 <RepoHeader owner={owner} repo={repo} />
3898 <RepoNav owner={owner} repo={repo} active="code" />
3899 <div
3900 class="tags-wrap"
3901 style="max-width:1100px;margin:0 auto;padding:var(--space-5) var(--space-4) var(--space-8)"
3902 >
3903 <header class="tags-head" style="margin-bottom:var(--space-5)">
3904 <div
3905 class="tags-eyebrow"
3906 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"
3907 >
3908 <span
3909 class="tags-eyebrow-dot"
3910 aria-hidden="true"
3911 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)"
3912 />
3913 Repository · Tags
3914 </div>
3915 <h1
3916 class="tags-title"
3917 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)"
3918 >
3919 <span class="gradient-text">{tags.length}</span>{" "}
3920 tag{tags.length === 1 ? "" : "s"}
3921 </h1>
3922 <p
3923 class="tags-sub"
3924 style="margin:0;font-size:14px;color:var(--text-muted);line-height:1.5;max-width:700px"
3925 >
3926 Named points in the history — typically releases, milestones,
3927 or shipped versions. Click a tag to browse the tree at that
3928 revision.
3929 </p>
3930 </header>
3931
3932 {tags.length === 0 ? (
3933 <div class="commits-empty">
3934 <div class="commits-empty-orb" aria-hidden="true" />
3935 <div class="commits-empty-inner">
3936 <div class="commits-empty-icon" aria-hidden="true">
3937 <svg
3938 width="22"
3939 height="22"
3940 viewBox="0 0 24 24"
3941 fill="none"
3942 stroke="currentColor"
3943 stroke-width="2"
3944 stroke-linecap="round"
3945 stroke-linejoin="round"
3946 >
3947 <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" />
3948 <line x1="7" y1="7" x2="7.01" y2="7" />
3949 </svg>
3950 </div>
3951 <h3 class="commits-empty-title">No tags yet</h3>
3952 <p class="commits-empty-sub">
3953 Tag a commit to mark a release or milestone. From the CLI:{" "}
3954 <code>git tag v0.1.0 &amp;&amp; git push --tags</code>.
3955 </p>
3956 </div>
3957 </div>
3958 ) : (
3959 <div class="tags-list">
3960 {tags.map((t) => {
3961 const hasRelease = tagsWithReleases.has(t.name);
3962 return (
3963 <div class="tags-row">
3964 <div class="tags-row-icon" aria-hidden="true">
3965 <svg
3966 width="14"
3967 height="14"
3968 viewBox="0 0 24 24"
3969 fill="none"
3970 stroke="currentColor"
3971 stroke-width="2"
3972 stroke-linecap="round"
3973 stroke-linejoin="round"
3974 >
3975 <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" />
3976 <line x1="7" y1="7" x2="7.01" y2="7" />
3977 </svg>
3978 </div>
3979 <div class="tags-row-main">
3980 <div class="tags-row-name">
3981 <a
3982 href={`/${owner}/${repo}/tree/${t.name}`}
3983 style="text-decoration:none"
3984 >
3985 <span class="tags-row-version">{t.name}</span>
3986 </a>
3987 </div>
3988 <div class="tags-row-meta">
3989 <span
3990 title={t.date ? new Date(t.date).toISOString() : ""}
3991 >
3992 Tagged {relative(t.date)}
3993 </span>
3994 <span class="sep">·</span>
3995 <a
3996 href={`/${owner}/${repo}/commit/${t.sha}`}
3997 class="tags-row-sha"
3998 title={t.sha}
3999 >
4000 {t.sha.slice(0, 7)}
4001 </a>
4002 </div>
4003 </div>
4004 <div class="tags-row-side">
4005 <a
4006 href={`/${owner}/${repo}/tree/${t.name}`}
4007 class="tags-row-link"
4008 >
4009 Browse files
4010 </a>
4011 {hasRelease && (
4012 <a
4013 href={`/${owner}/${repo}/releases/tag/${t.name}`}
4014 class="tags-row-link"
4015 style="color:#67e8f9;border-color:rgba(54,197,214,0.35);background:rgba(54,197,214,0.06)"
4016 >
4017 View release
4018 </a>
4019 )}
4020 </div>
4021 </div>
4022 );
4023 })}
4024 </div>
4025 )}
4026 </div>
4027 </Layout>
4028 );
4029});
4030
fc1817aClaude4031// Commit log
4032web.get("/:owner/:repo/commits/:ref?", async (c) => {
4033 const { owner, repo } = c.req.param();
06d5ffeClaude4034 const user = c.get("user");
fc1817aClaude4035 const ref =
4036 c.req.param("ref") || (await getDefaultBranch(owner, repo)) || "main";
06d5ffeClaude4037 const branches = await listBranches(owner, repo);
fc1817aClaude4038
4039 const commits = await listCommits(owner, repo, ref, 50);
4040
3951454Claude4041 // Block J3 — batch-fetch cached verification results for the page.
4042 let verifications: Record<string, { verified: boolean; reason: string }> = {};
4043 try {
4044 const [ownerRow] = await db
4045 .select()
4046 .from(users)
4047 .where(eq(users.username, owner))
4048 .limit(1);
4049 if (ownerRow) {
4050 const [repoRow] = await db
4051 .select()
4052 .from(repositories)
4053 .where(
4054 and(
4055 eq(repositories.ownerId, ownerRow.id),
4056 eq(repositories.name, repo)
4057 )
4058 )
4059 .limit(1);
4060 if (repoRow && commits.length > 0) {
4061 const rows = await db
4062 .select()
4063 .from(commitVerifications)
4064 .where(
4065 and(
4066 eq(commitVerifications.repositoryId, repoRow.id),
4067 inArray(
4068 commitVerifications.commitSha,
4069 commits.map((c) => c.sha)
4070 )
4071 )
4072 );
4073 for (const r of rows) {
4074 verifications[r.commitSha] = {
4075 verified: r.verified,
4076 reason: r.reason,
4077 };
4078 }
4079 }
4080 }
4081 } catch {
4082 // DB unavailable — skip the badges gracefully.
4083 }
4084
fc1817aClaude4085 return c.html(
06d5ffeClaude4086 <Layout title={`Commits — ${owner}/${repo}`} user={user}>
efb11c5Claude4087 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude4088 <RepoHeader owner={owner} repo={repo} />
4089 <RepoNav owner={owner} repo={repo} active="commits" />
efb11c5Claude4090 <div class="commits-hero">
4091 <div class="commits-hero-orb-wrap" aria-hidden="true">
4092 <div class="commits-hero-orb" />
fc1817aClaude4093 </div>
efb11c5Claude4094 <div class="commits-hero-inner">
4095 <div class="commits-eyebrow">
4096 <strong>History</strong> · {owner}/{repo}
4097 </div>
4098 <h1 class="commits-title">
4099 <span class="gradient-text">{commits.length}</span> recent commit
4100 {commits.length === 1 ? "" : "s"} on{" "}
4101 <span class="commits-branch">{ref}</span>
4102 </h1>
4103 <p class="commits-sub">
4104 Browse the project's history. Click any commit to see the full
4105 diff, AI review notes, and signature status.
4106 </p>
4107 </div>
4108 </div>
4109 <div class="commits-toolbar">
4110 <BranchSwitcher
3951454Claude4111 owner={owner}
4112 repo={repo}
efb11c5Claude4113 currentRef={ref}
4114 branches={branches}
4115 pathType="commits"
3951454Claude4116 />
398a10cClaude4117 <div class="commits-toolbar-actions">
4118 <a href={`/${owner}/${repo}/branches`} class="commits-toolbar-link">
4119 {"⊢"} Branches
4120 </a>
4121 <a href={`/${owner}/${repo}/tags`} class="commits-toolbar-link">
4122 {"#"} Tags
4123 </a>
4124 </div>
efb11c5Claude4125 </div>
4126 {commits.length === 0 ? (
4127 <div class="commits-empty">
398a10cClaude4128 <div class="commits-empty-orb" aria-hidden="true" />
4129 <div class="commits-empty-inner">
4130 <div class="commits-empty-icon" aria-hidden="true">
4131 <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
4132 <circle cx="12" cy="12" r="4" />
4133 <line x1="1.05" y1="12" x2="7" y2="12" />
4134 <line x1="17.01" y1="12" x2="22.96" y2="12" />
4135 </svg>
4136 </div>
4137 <h3 class="commits-empty-title">No commits yet</h3>
4138 <p class="commits-empty-sub">
4139 This branch is empty. Push your first commit, or use the
4140 web editor to create a file.
4141 </p>
4142 </div>
efb11c5Claude4143 </div>
4144 ) : (
4145 <div class="commits-list-wrap">
398a10cClaude4146 {(() => {
4147 // Group commits by day for the section headers.
4148 const dayLabel = (iso: string): string => {
4149 const d = new Date(iso);
4150 if (Number.isNaN(d.getTime())) return "Unknown";
4151 const today = new Date();
4152 const yesterday = new Date(today);
4153 yesterday.setDate(today.getDate() - 1);
4154 const sameDay = (a: Date, b: Date) =>
4155 a.getFullYear() === b.getFullYear() &&
4156 a.getMonth() === b.getMonth() &&
4157 a.getDate() === b.getDate();
4158 if (sameDay(d, today)) return "Today";
4159 if (sameDay(d, yesterday)) return "Yesterday";
4160 return d.toLocaleDateString("en-US", {
4161 month: "long",
4162 day: "numeric",
4163 year: today.getFullYear() === d.getFullYear() ? undefined : "numeric",
4164 });
4165 };
4166 const relative = (iso: string): string => {
4167 const d = new Date(iso);
4168 if (Number.isNaN(d.getTime())) return "";
4169 const diff = Date.now() - d.getTime();
4170 const m = Math.floor(diff / 60000);
4171 if (m < 1) return "just now";
4172 if (m < 60) return `${m} min ago`;
4173 const h = Math.floor(m / 60);
4174 if (h < 24) return `${h} hr${h === 1 ? "" : "s"} ago`;
4175 const dd = Math.floor(h / 24);
4176 if (dd < 30) return `${dd} day${dd === 1 ? "" : "s"} ago`;
4177 return d.toLocaleDateString("en-US", {
4178 month: "short",
4179 day: "numeric",
4180 });
4181 };
4182 const initial = (name: string): string =>
4183 (name || "?").trim().charAt(0).toUpperCase() || "?";
4184 // Build groups preserving order.
4185 const groups: Array<{ label: string; items: typeof commits }> = [];
4186 let lastLabel = "";
4187 for (const cm of commits) {
4188 const label = dayLabel(cm.date);
4189 if (label !== lastLabel) {
4190 groups.push({ label, items: [] });
4191 lastLabel = label;
4192 }
4193 groups[groups.length - 1].items.push(cm);
4194 }
4195 return groups.map((g) => (
4196 <>
4197 <div class="commits-day-head">
4198 <span class="commits-day-head-dot" aria-hidden="true" />
4199 Commits on {g.label}
4200 </div>
4201 {g.items.map((cm) => {
4202 const v = verifications[cm.sha];
4203 return (
4204 <div class="commits-row">
4205 <div class="commits-avatar" aria-hidden="true">
4206 {initial(cm.author)}
4207 </div>
4208 <div class="commits-row-body">
4209 <div class="commits-row-msg">
4210 <a href={`/${owner}/${repo}/commit/${cm.sha}`}>
4211 {cm.message}
4212 </a>
4213 {v?.verified && (
4214 <span
4215 class="commits-row-verified"
4216 title="Signed with a registered key"
4217 >
4218 Verified
4219 </span>
4220 )}
4221 </div>
4222 <div class="commits-row-meta">
4223 <strong>{cm.author}</strong>
4224 <span class="sep">·</span>
4225 <span
4226 class="commits-row-time"
4227 title={new Date(cm.date).toISOString()}
4228 >
4229 committed {relative(cm.date)}
4230 </span>
4231 {cm.parentShas.length > 1 && (
4232 <>
4233 <span class="sep">·</span>
4234 <span>merge of {cm.parentShas.length} parents</span>
4235 </>
4236 )}
4237 </div>
4238 </div>
4239 <div class="commits-row-side">
4240 <a
4241 href={`/${owner}/${repo}/commit/${cm.sha}`}
4242 class="commits-row-sha"
4243 title={cm.sha}
4244 >
4245 {cm.sha.slice(0, 7)}
4246 </a>
4247 <button
4248 type="button"
4249 class="commits-row-copy"
4250 data-copy-sha={cm.sha}
4251 title="Copy full SHA"
4252 aria-label={`Copy SHA ${cm.sha}`}
4253 >
4254 <svg width="13" height="13" viewBox="0 0 16 16" fill="none" aria-hidden="true">
4255 <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" />
4256 <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" />
4257 </svg>
4258 </button>
4259 </div>
4260 </div>
4261 );
4262 })}
4263 </>
4264 ));
4265 })()}
efb11c5Claude4266 </div>
fc1817aClaude4267 )}
398a10cClaude4268 <script
4269 dangerouslySetInnerHTML={{
4270 __html: `
4271 (function(){
4272 document.addEventListener('click', function(e){
4273 var t = e.target; if (!t) return;
4274 var btn = t.closest && t.closest('[data-copy-sha]');
4275 if (!btn) return;
4276 e.preventDefault();
4277 var sha = btn.getAttribute('data-copy-sha') || '';
4278 if (!navigator.clipboard) return;
4279 navigator.clipboard.writeText(sha).then(function(){
4280 btn.classList.add('is-copied');
4281 setTimeout(function(){ btn.classList.remove('is-copied'); }, 1200);
4282 }).catch(function(){});
4283 });
4284 })();
4285 `,
4286 }}
4287 />
fc1817aClaude4288 </Layout>
4289 );
4290});
4291
4292// Single commit with diff
4293web.get("/:owner/:repo/commit/:sha", async (c) => {
4294 const { owner, repo, sha } = c.req.param();
06d5ffeClaude4295 const user = c.get("user");
fc1817aClaude4296
05b973eClaude4297 // Fetch commit, full message, and diff in parallel
4298 const [commit, fullMessage, diffResult] = await Promise.all([
4299 getCommit(owner, repo, sha),
4300 getCommitFullMessage(owner, repo, sha),
4301 getDiff(owner, repo, sha),
4302 ]);
fc1817aClaude4303 if (!commit) {
4304 return c.html(
06d5ffeClaude4305 <Layout title="Not Found" user={user}>
fc1817aClaude4306 <div class="empty-state">
4307 <h2>Commit not found</h2>
4308 </div>
4309 </Layout>,
4310 404
4311 );
4312 }
4313
3951454Claude4314 // Block J3 — try to verify this commit's signature.
4315 let verification:
4316 | { verified: boolean; reason: string; signatureType: string | null }
4317 | null = null;
0cdfd89Claude4318 // Block J8 — external CI commit statuses rollup.
4319 let statusCombined:
4320 | {
4321 state: "pending" | "success" | "failure";
4322 total: number;
4323 contexts: Array<{
4324 context: string;
4325 state: string;
4326 description: string | null;
4327 targetUrl: string | null;
4328 }>;
4329 }
4330 | null = null;
3951454Claude4331 try {
4332 const [ownerRow] = await db
4333 .select()
4334 .from(users)
4335 .where(eq(users.username, owner))
4336 .limit(1);
4337 if (ownerRow) {
4338 const [repoRow] = await db
4339 .select()
4340 .from(repositories)
4341 .where(
4342 and(
4343 eq(repositories.ownerId, ownerRow.id),
4344 eq(repositories.name, repo)
4345 )
4346 )
4347 .limit(1);
4348 if (repoRow) {
4349 const { verifyCommit } = await import("../lib/signatures");
4350 const v = await verifyCommit(repoRow.id, owner, repo, commit.sha);
4351 verification = {
4352 verified: v.verified,
4353 reason: v.reason,
4354 signatureType: v.signatureType,
4355 };
0cdfd89Claude4356 try {
4357 const { combinedStatus } = await import("../lib/commit-statuses");
4358 const combined = await combinedStatus(repoRow.id, commit.sha);
4359 if (combined.total > 0) {
4360 statusCombined = {
4361 state: combined.state as any,
4362 total: combined.total,
4363 contexts: combined.contexts.map((c) => ({
4364 context: c.context,
4365 state: c.state,
4366 description: c.description,
4367 targetUrl: c.targetUrl,
4368 })),
4369 };
4370 }
4371 } catch {
4372 statusCombined = null;
4373 }
3951454Claude4374 }
4375 }
4376 } catch {
4377 verification = null;
4378 }
4379
05b973eClaude4380 const { files, raw } = diffResult;
fc1817aClaude4381
efb11c5Claude4382 // Diff stats: count additions / deletions across all files for the
4383 // header summary bar. Computed here from the parsed diff so we don't
4384 // touch the DiffView component.
4385 let additions = 0;
4386 let deletions = 0;
4387 for (const f of files) {
4388 const hunks = (f as any).hunks as Array<any> | undefined;
4389 if (Array.isArray(hunks)) {
4390 for (const h of hunks) {
4391 const lines = (h?.lines || []) as Array<any>;
4392 for (const ln of lines) {
4393 const t = ln?.type || ln?.kind;
4394 if (t === "add" || t === "added" || t === "+") additions += 1;
4395 else if (t === "del" || t === "deleted" || t === "delete" || t === "-")
4396 deletions += 1;
4397 }
4398 }
4399 }
4400 }
4401 // Fall back: scan raw if file-level counting yielded zero (it's just a
4402 // header polish — never let a parsing miss break the page).
4403 if (additions === 0 && deletions === 0 && typeof raw === "string") {
4404 for (const line of raw.split("\n")) {
4405 if (line.startsWith("+") && !line.startsWith("+++")) additions += 1;
4406 else if (line.startsWith("-") && !line.startsWith("---")) deletions += 1;
4407 }
4408 }
4409 const fileCount = files.length;
4410
fc1817aClaude4411 return c.html(
06d5ffeClaude4412 <Layout title={`${commit.message} — ${owner}/${repo}`} user={user}>
efb11c5Claude4413 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
fc1817aClaude4414 <RepoHeader owner={owner} repo={repo} />
efb11c5Claude4415 <div class="commit-detail-card">
4416 <div class="commit-detail-eyebrow">
4417 <strong>Commit</strong>
4418 <span class="commit-detail-sha-pill" title={commit.sha}>
4419 {commit.sha.slice(0, 7)}
4420 </span>
3951454Claude4421 {verification && verification.reason !== "unsigned" && (
4422 <span
efb11c5Claude4423 class={`commit-detail-verify ${
3951454Claude4424 verification.verified
efb11c5Claude4425 ? "commit-detail-verify-ok"
4426 : "commit-detail-verify-warn"
3951454Claude4427 }`}
4428 title={`${verification.signatureType?.toUpperCase() || ""} · ${verification.reason}`}
4429 >
4430 {verification.verified ? "Verified" : verification.reason}
4431 </span>
4432 )}
fc1817aClaude4433 </div>
efb11c5Claude4434 <h1 class="commit-detail-title">{commit.message}</h1>
4435 {fullMessage !== commit.message && (
4436 <pre class="commit-detail-body">{fullMessage}</pre>
4437 )}
4438 <div class="commit-detail-meta">
4439 <span class="commit-detail-author">
4440 <strong>{commit.author}</strong> committed on{" "}
4441 {new Date(commit.date).toLocaleDateString("en-US", {
4442 month: "long",
4443 day: "numeric",
4444 year: "numeric",
4445 })}
4446 </span>
fc1817aClaude4447 {commit.parentShas.length > 0 && (
efb11c5Claude4448 <span class="commit-detail-parents">
4449 {commit.parentShas.length === 1 ? "Parent" : "Parents"}:{" "}
4450 {commit.parentShas.map((p, idx) => (
4451 <>
4452 {idx > 0 && " "}
4453 <a
4454 href={`/${owner}/${repo}/commit/${p}`}
4455 class="commit-detail-sha-link"
4456 >
4457 {p.slice(0, 7)}
4458 </a>
4459 </>
fc1817aClaude4460 ))}
4461 </span>
4462 )}
4463 </div>
efb11c5Claude4464 <div class="commit-detail-stats">
4465 <span class="commit-detail-stat">
4466 <strong>{fileCount}</strong>{" "}
4467 file{fileCount === 1 ? "" : "s"} changed
4468 </span>
4469 <span class="commit-detail-stat commit-detail-stat-add">
4470 <span class="commit-detail-stat-mark">+</span>
4471 <strong>{additions}</strong>
4472 </span>
4473 <span class="commit-detail-stat commit-detail-stat-del">
4474 <span class="commit-detail-stat-mark">−</span>
4475 <strong>{deletions}</strong>
4476 </span>
4477 <span class="commit-detail-sha-full" title="Full SHA">
4478 {commit.sha}
4479 </span>
4480 </div>
0cdfd89Claude4481 {statusCombined && (
efb11c5Claude4482 <div class="commit-detail-checks">
4483 <div class="commit-detail-checks-head">
4484 <strong>Checks</strong>
4485 <span class="commit-detail-checks-summary">
4486 {statusCombined.total} total ·{" "}
4487 <span
4488 class={`commit-detail-check-state commit-detail-check-state-${statusCombined.state}`}
4489 >
4490 {statusCombined.state}
4491 </span>
0cdfd89Claude4492 </span>
efb11c5Claude4493 </div>
4494 <div class="commit-detail-check-row">
0cdfd89Claude4495 {statusCombined.contexts.map((cx) => (
4496 <span
efb11c5Claude4497 class={`commit-detail-check commit-detail-check-${cx.state}`}
0cdfd89Claude4498 title={cx.description || cx.context}
4499 >
4500 {cx.targetUrl ? (
efb11c5Claude4501 <a href={cx.targetUrl} rel="noopener">
0cdfd89Claude4502 {cx.context}: {cx.state}
4503 </a>
4504 ) : (
4505 <>
4506 {cx.context}: {cx.state}
4507 </>
4508 )}
4509 </span>
4510 ))}
4511 </div>
4512 </div>
4513 )}
fc1817aClaude4514 </div>
ea9ed4cClaude4515 <DiffView
4516 raw={raw}
4517 files={files}
4518 viewFileBase={`/${owner}/${repo}/blob/${commit.sha}`}
4519 />
fc1817aClaude4520 </Layout>
4521 );
4522});
4523
79136bbClaude4524// Raw file download
4525web.get("/:owner/:repo/raw/:ref{.+$}", async (c) => {
4526 const { owner, repo } = c.req.param();
4527 const refAndPath = c.req.param("ref");
4528
4529 const branches = await listBranches(owner, repo);
4530 let ref = "";
4531 let filePath = "";
4532
4533 for (const branch of branches) {
4534 if (refAndPath.startsWith(branch + "/")) {
4535 ref = branch;
4536 filePath = refAndPath.slice(branch.length + 1);
4537 break;
4538 }
4539 }
4540
4541 if (!ref) {
4542 const slashIdx = refAndPath.indexOf("/");
4543 if (slashIdx === -1) return c.text("Not found", 404);
4544 ref = refAndPath.slice(0, slashIdx);
4545 filePath = refAndPath.slice(slashIdx + 1);
4546 }
4547
4548 const data = await getRawBlob(owner, repo, ref, filePath);
4549 if (!data) return c.text("Not found", 404);
4550
4551 const fileName = filePath.split("/").pop() || "file";
772a24fClaude4552 return new Response(data as BodyInit, {
79136bbClaude4553 headers: {
4554 "Content-Type": "application/octet-stream",
4555 "Content-Disposition": `attachment; filename="${fileName}"`,
05b973eClaude4556 "Cache-Control": "public, max-age=300, stale-while-revalidate=60",
79136bbClaude4557 },
4558 });
4559});
4560
4561// Blame view
4562web.get("/:owner/:repo/blame/:ref{.+$}", async (c) => {
4563 const { owner, repo } = c.req.param();
4564 const user = c.get("user");
4565 const refAndPath = c.req.param("ref");
4566
4567 const branches = await listBranches(owner, repo);
4568 let ref = "";
4569 let filePath = "";
4570
4571 for (const branch of branches) {
4572 if (refAndPath.startsWith(branch + "/")) {
4573 ref = branch;
4574 filePath = refAndPath.slice(branch.length + 1);
4575 break;
4576 }
4577 }
4578
4579 if (!ref) {
4580 const slashIdx = refAndPath.indexOf("/");
4581 if (slashIdx === -1) return c.text("Not found", 404);
4582 ref = refAndPath.slice(0, slashIdx);
4583 filePath = refAndPath.slice(slashIdx + 1);
4584 }
4585
4586 const blameLines = await getBlame(owner, repo, ref, filePath);
4587 if (blameLines.length === 0) {
4588 return c.html(
4589 <Layout title="Not Found" user={user}>
4590 <div class="empty-state">
4591 <h2>File not found</h2>
4592 </div>
4593 </Layout>,
4594 404
4595 );
4596 }
4597
4598 const fileName = filePath.split("/").pop() || filePath;
efb11c5Claude4599 // Unique contributors (by author) tracked once for the header chip.
4600 const blameAuthors = new Set<string>();
4601 for (const ln of blameLines) blameAuthors.add(ln.author);
79136bbClaude4602
4603 return c.html(
4604 <Layout title={`Blame: ${filePath} — ${owner}/${repo}`} user={user}>
efb11c5Claude4605 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
79136bbClaude4606 <RepoHeader owner={owner} repo={repo} />
4607 <RepoNav owner={owner} repo={repo} active="code" />
398a10cClaude4608 <header class="blame-head">
4609 <div class="blame-eyebrow">
4610 <span class="blame-eyebrow-dot" aria-hidden="true" />
4611 Blame · Line-by-line history
4612 </div>
4613 <h1 class="blame-title">
4614 <code>{fileName}</code>
4615 </h1>
4616 <p class="blame-sub">
4617 Each line is annotated with the commit that last touched it.
4618 Click any SHA to jump to that commit and see the surrounding
4619 change.
4620 </p>
4621 </header>
efb11c5Claude4622 <div class="blame-toolbar">
4623 <Breadcrumb owner={owner} repo={repo} ref={ref} path={filePath} />
4624 </div>
398a10cClaude4625 <div class="blame-card">
4626 <div class="blame-header">
efb11c5Claude4627 <div class="blame-header-meta">
4628 <span class="blame-header-icon" aria-hidden="true">{"⎙"}</span>
4629 <span class="blame-header-name">{fileName}</span>
4630 <span class="blame-header-tag">Blame</span>
4631 <span class="blame-header-stats">
4632 {blameLines.length} line{blameLines.length === 1 ? "" : "s"} ·{" "}
4633 {blameAuthors.size} contributor
4634 {blameAuthors.size === 1 ? "" : "s"}
4635 </span>
4636 </div>
4637 <div class="blame-header-actions">
4638 <a
4639 href={`/${owner}/${repo}/blob/${ref}/${filePath}`}
4640 class="blob-pill"
4641 >
4642 Normal view
4643 </a>
4644 <a
4645 href={`/${owner}/${repo}/raw/${ref}/${filePath}`}
4646 class="blob-pill"
4647 >
4648 Raw
4649 </a>
4650 </div>
79136bbClaude4651 </div>
398a10cClaude4652 <div style="overflow-x:auto">
4653 <table class="blame-table">
79136bbClaude4654 <tbody>
4655 {blameLines.map((line, i) => {
4656 const showInfo =
4657 i === 0 || blameLines[i - 1].sha !== line.sha;
4658 return (
398a10cClaude4659 <tr class={showInfo ? "blame-row-first" : ""}>
4660 <td class="blame-gutter">
79136bbClaude4661 {showInfo && (
398a10cClaude4662 <span class="blame-gutter-inner">
79136bbClaude4663 <a
4664 href={`/${owner}/${repo}/commit/${line.sha}`}
398a10cClaude4665 class="blame-gutter-sha"
4666 title={`Commit ${line.sha}`}
79136bbClaude4667 >
4668 {line.sha.slice(0, 7)}
398a10cClaude4669 </a>
4670 <span class="blame-gutter-author" title={line.author}>
4671 {line.author}
4672 </span>
4673 </span>
79136bbClaude4674 )}
4675 </td>
398a10cClaude4676 <td class="blame-line-num">{line.lineNum}</td>
4677 <td class="blame-line-content">{line.content}</td>
79136bbClaude4678 </tr>
4679 );
4680 })}
4681 </tbody>
4682 </table>
4683 </div>
4684 </div>
4685 </Layout>
4686 );
4687});
4688
4689// Search
4690web.get("/:owner/:repo/search", async (c) => {
4691 const { owner, repo } = c.req.param();
4692 const user = c.get("user");
4693 const q = c.req.query("q") || "";
4694
4695 if (!(await repoExists(owner, repo))) return c.notFound();
4696
4697 const defaultBranch = (await getDefaultBranch(owner, repo)) || "main";
4698 let results: Array<{ file: string; lineNum: number; line: string }> = [];
4699
4700 if (q.trim()) {
4701 results = await searchCode(owner, repo, defaultBranch, q.trim());
4702 }
4703
4704 return c.html(
4705 <Layout title={`Search — ${owner}/${repo}`} user={user}>
efb11c5Claude4706 <style dangerouslySetInnerHTML={{ __html: codeBrowseCss }} />
79136bbClaude4707 <RepoHeader owner={owner} repo={repo} />
4708 <RepoNav owner={owner} repo={repo} active="code" />
efb11c5Claude4709 <div class="search-hero">
4710 <div class="search-eyebrow">
4711 <strong>Search</strong> · {owner}/{repo}
4712 </div>
4713 <h1 class="search-title">
4714 Find any line in <span class="gradient-text">{repo}</span>
4715 </h1>
4716 <form
4717 method="get"
4718 action={`/${owner}/${repo}/search`}
4719 class="search-form"
4720 role="search"
4721 >
4722 <div class="search-input-wrap">
4723 <span class="search-input-icon" aria-hidden="true">{"⌕"}</span>
4724 <input
4725 type="text"
4726 name="q"
4727 value={q}
4728 placeholder="Search code on the default branch…"
4729 aria-label="Search code"
4730 class="search-input"
4731 autocomplete="off"
4732 autofocus
4733 />
4734 </div>
4735 <button type="submit" class="btn btn-primary search-submit">
79136bbClaude4736 Search
4737 </button>
efb11c5Claude4738 </form>
4739 </div>
79136bbClaude4740 {q && (
efb11c5Claude4741 <div class="search-results-head">
4742 <span class="search-results-count">
4743 <strong>{results.length}</strong> result
4744 {results.length !== 1 ? "s" : ""}
4745 </span>
4746 <span class="search-results-query">
4747 for <span class="search-results-q">"{q}"</span> on{" "}
4748 <code>{defaultBranch}</code>
4749 </span>
4750 </div>
79136bbClaude4751 )}
efb11c5Claude4752 {q && results.length === 0 ? (
4753 <div class="search-empty">
4754 <p>
4755 No matches for <strong>"{q}"</strong>. Try a shorter query or check
4756 you're on the right branch.
4757 </p>
4758 </div>
4759 ) : results.length > 0 ? (
79136bbClaude4760 <div class="search-results">
4761 {(() => {
4762 // Group by file
4763 const grouped: Record<
4764 string,
4765 Array<{ lineNum: number; line: string }>
4766 > = {};
4767 for (const r of results) {
4768 if (!grouped[r.file]) grouped[r.file] = [];
4769 grouped[r.file].push({ lineNum: r.lineNum, line: r.line });
4770 }
4771 return Object.entries(grouped).map(([file, matches]) => (
efb11c5Claude4772 <div class="search-file diff-file">
4773 <div class="search-file-head diff-file-header">
79136bbClaude4774 <a
4775 href={`/${owner}/${repo}/blob/${defaultBranch}/${file}`}
efb11c5Claude4776 class="search-file-link"
79136bbClaude4777 >
4778 {file}
4779 </a>
efb11c5Claude4780 <span class="search-file-count">
4781 {matches.length} match{matches.length === 1 ? "" : "es"}
4782 </span>
79136bbClaude4783 </div>
4784 <div class="blob-code">
4785 <table>
4786 <tbody>
4787 {matches.map((m) => (
4788 <tr>
4789 <td class="line-num">{m.lineNum}</td>
4790 <td class="line-content">{m.line}</td>
4791 </tr>
4792 ))}
4793 </tbody>
4794 </table>
4795 </div>
4796 </div>
4797 ));
4798 })()}
4799 </div>
efb11c5Claude4800 ) : null}
79136bbClaude4801 </Layout>
4802 );
4803});
4804
fc1817aClaude4805export default web;