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

app.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.

app.tsxBlame614 lines · 4 contributors
79136bbClaude1import { Hono } from "hono";
2import { logger } from "hono/logger";
3import { cors } from "hono/cors";
05b973eClaude4import { compress } from "hono/compress";
f1ffd50Claude5import { etag } from "hono/etag";
c63b860Claude6// BLOCK O2 — shared error-page surface (404 / 500 / 403).
7import { NotFoundPage, ServerErrorPage } from "./views/error-page";
80bed05Claude8import { reportError } from "./lib/observability";
3ef4c9dClaude9import { requestContext } from "./middleware/request-context";
10import { rateLimit } from "./middleware/rate-limit";
79136bbClaude11import gitRoutes from "./routes/git";
12import apiRoutes from "./routes/api";
45e31d0Claude13import apiV2Routes from "./routes/api-v2";
14import apiDocsRoutes from "./routes/api-docs";
4a80519Claude15import buildAgentSpecRoutes from "./routes/build-agent-spec";
a6ff0f2Claude16import pullsDashboardRoutes from "./routes/pulls-dashboard";
e9aa4d8Claude17import issuesDashboardRoutes from "./routes/issues-dashboard";
18import inboxRoutes from "./routes/inbox";
19import activityRoutes from "./routes/activity";
79136bbClaude20import authRoutes from "./routes/auth";
c63b860Claude21import passwordResetRoutes from "./routes/password-reset";
22import emailVerificationRoutes from "./routes/email-verification";
cd4f63bTest User23import magicLinkRoutes from "./routes/magic-link";
79136bbClaude24import settingsRoutes from "./routes/settings";
7298a17Claude25import settings2faRoutes from "./routes/settings-2fa";
79136bbClaude26import issueRoutes from "./routes/issues";
27import repoSettings from "./routes/repo-settings";
23d1a81Claude28import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude29import teamCollaboratorRoutes from "./routes/team-collaborators";
30import invitesRoutes from "./routes/invites";
31import liveEventsRoutes from "./routes/live-events";
79136bbClaude32import compareRoutes from "./routes/compare";
0074234Claude33import pullRoutes from "./routes/pulls";
34import editorRoutes from "./routes/editor";
c81ab7aClaude35import forkRoutes from "./routes/fork";
36import webhookRoutes from "./routes/webhooks";
37import exploreRoutes from "./routes/explore";
38import tokenRoutes from "./routes/tokens";
43de941Claude39import contributorRoutes from "./routes/contributors";
699e5c7Claude40import healthRoutes from "./routes/health-probe";
41import healthDashboardRoutes from "./routes/health";
2316be6Claude42import statusRoutes from "./routes/status";
b1be050CC LABS App43import adminStatusRoutes from "./routes/admin-status";
80bed05Claude44import helpRoutes from "./routes/help";
b0148e9Claude45import marketingRoutes from "./routes/marketing";
5f2e749Claude46import pricingRoutes from "./routes/pricing";
5618f9aClaude47import seoRoutes from "./routes/seo";
05cdb85Claude48import versionRoutes from "./routes/version";
f295f78Dictation App49import { platformStatus } from "./routes/platform-status";
52ad8b1Claude50import publicStatsRoutes from "./routes/public-stats";
51import demoRoutes from "./routes/demo";
16b325cClaude52import insightRoutes from "./routes/insights";
f1ab587Claude53import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude54import legalRoutes from "./routes/legal";
4b66018Claude55import legalDmcaRoutes from "./routes/legal/dmca";
56import legalTermsRoutes from "./routes/legal/terms";
57import legalPrivacyRoutes from "./routes/legal/privacy";
58import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude59import importRoutes from "./routes/import";
14c3cc8Claude60import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App61import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude62import migrationRoutes from "./routes/migrations";
63import specsRoutes from "./routes/specs";
79136bbClaude64import webRoutes from "./routes/web";
0316dbbClaude65import hookRoutes from "./routes/hooks";
66import eventsRoutes from "./routes/events";
67import passkeyRoutes from "./routes/passkeys";
68import oauthRoutes from "./routes/oauth";
69import developerAppsRoutes from "./routes/developer-apps";
70import themeRoutes from "./routes/theme";
71import auditRoutes from "./routes/audit";
72import reactionRoutes from "./routes/reactions";
73import savedReplyRoutes from "./routes/saved-replies";
74import deploymentRoutes from "./routes/deployments";
75import orgRoutes from "./routes/orgs";
76import notificationRoutes from "./routes/notifications";
77import onboardingRoutes from "./routes/onboarding";
78import adminRoutes from "./routes/admin";
f764c07Claude79import adminDeploysRoutes from "./routes/admin-deploys";
80import adminDeploysPageRoutes from "./routes/admin-deploys-page";
9dd96b9Test User81import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App82import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User83import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude84import adminIntegrationsRoutes from "./routes/admin-integrations";
0316dbbClaude85import advisoriesRoutes from "./routes/advisories";
86import aiChangelogRoutes from "./routes/ai-changelog";
87import aiExplainRoutes from "./routes/ai-explain";
88import aiTestsRoutes from "./routes/ai-tests";
89import askRoutes from "./routes/ask";
90import billingRoutes from "./routes/billing";
6778ad2Claude91import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude92import codeScanningRoutes from "./routes/code-scanning";
93import commitStatusesRoutes from "./routes/commit-statuses";
94import copilotRoutes from "./routes/copilot";
95import depUpdaterRoutes from "./routes/dep-updater";
96import depsRoutes from "./routes/deps";
97import discussionsRoutes from "./routes/discussions";
98import environmentsRoutes from "./routes/environments";
99import followsRoutes from "./routes/follows";
100import gatesRoutes from "./routes/gates";
101import gistsRoutes from "./routes/gists";
102import graphqlRoutes from "./routes/graphql";
2c2163eClaude103import mcpRoutes from "./routes/mcp";
0316dbbClaude104import marketplaceRoutes from "./routes/marketplace";
105import mergeQueueRoutes from "./routes/merge-queue";
106import mirrorsRoutes from "./routes/mirrors";
107import orgInsightsRoutes from "./routes/org-insights";
108import packagesRoutes from "./routes/packages";
109import packagesApiRoutes from "./routes/packages-api";
110import pagesRoutes from "./routes/pages";
111import projectsRoutes from "./routes/projects";
112import protectedTagsRoutes from "./routes/protected-tags";
113import pwaRoutes from "./routes/pwa";
46d6165Claude114import installRoutes from "./routes/install";
cd4f63bTest User115import dxtRoutes from "./routes/dxt";
662ce86Claude116import connectClaudeRoutes from "./routes/connect-claude";
0316dbbClaude117import releasesRoutes from "./routes/releases";
118import requiredChecksRoutes from "./routes/required-checks";
119import rulesetsRoutes from "./routes/rulesets";
120import searchRoutes from "./routes/search";
121import semanticSearchRoutes from "./routes/semantic-search";
122import signingKeysRoutes from "./routes/signing-keys";
123import sponsorsRoutes from "./routes/sponsors";
124import ssoRoutes from "./routes/sso";
46d6165Claude125import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude126import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude127import symbolsRoutes from "./routes/symbols";
128import templatesRoutes from "./routes/templates";
129import trafficRoutes from "./routes/traffic";
130import wikisRoutes from "./routes/wikis";
131import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude132import workflowArtifactsRoutes from "./routes/workflow-artifacts";
133import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude134import sleepModeRoutes from "./routes/sleep-mode";
52ad8b1Claude135import vsGithubRoutes from "./routes/vs-github";
cd4f63bTest User136import playgroundRoutes from "./routes/playground";
59b6fb2Claude137import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
138import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude139
2316901Claude140import type { AuthEnv } from "./middleware/auth";
bf19c50Test User141import { softAuth } from "./middleware/auth";
2316901Claude142
143const app = new Hono<AuthEnv>();
79136bbClaude144
3ef4c9dClaude145// Request context (request ID, start time) runs before everything else
146app.use("*", requestContext);
05b973eClaude147// Middleware — compression first (wraps all responses)
148app.use("*", compress());
f1ffd50Claude149
150// ETag middleware — returns 304 Not Modified on unchanged responses.
151// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
152// SSE + the API surface where it would interfere with streaming.
153app.use("*", async (c, next) => {
154 const p = c.req.path;
155 if (
156 p.includes(".git/") ||
157 p.startsWith("/live-events") ||
158 p.startsWith("/api/events/deploy") ||
159 p.startsWith("/admin/status")
160 ) {
161 return next();
162 }
163 return etag()(c, next);
164});
165
166// Cache-Control middleware — sets sensible defaults on public, anonymous
167// requests. Crontech (when wired as our edge layer) and downstream
168// browsers will honor these. Auth'd users get private,no-store
169// automatically — we never cache responses tied to a session.
170app.use("*", async (c, next) => {
171 await next();
172 // Don't overwrite explicit headers set by route handlers — BUT the
173 // ETag middleware unconditionally sets "private, no-cache, must-
174 // revalidate" so we have to treat that specific value as "no
175 // policy chosen yet" and apply ours. Any route that explicitly set
176 // a different cache-control wins.
177 const existing = c.res.headers.get("cache-control");
178 const etagDefault =
179 existing === "private, no-cache, must-revalidate" ||
180 existing === "no-cache";
181 if (existing && !etagDefault) return;
182 // Anything past auth: private + no-store (avoid leaking session
183 // content into shared caches). softAuth runs before this on the
184 // request, but the response side is what we're stamping.
185 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
186 const p = c.req.path;
187 // Always private for known-authed paths regardless of cookie.
188 if (
189 p.startsWith("/admin") ||
190 p.startsWith("/settings") ||
191 p.startsWith("/dashboard") ||
192 p.startsWith("/notifications") ||
193 p.startsWith("/connect/") ||
194 hasSession
195 ) {
196 c.res.headers.set("cache-control", "private, no-store");
197 return;
198 }
199 // Public marketing surfaces — short edge cache, longer browser cache,
200 // stale-while-revalidate so the user never waits on a stale fetch.
201 const isMarketing =
202 p === "/" ||
203 p === "/features" ||
204 p === "/pricing" ||
205 p === "/about" ||
206 p === "/vs-github" ||
207 p === "/explore" ||
208 p === "/help" ||
209 p === "/changelog" ||
210 p.startsWith("/legal/") ||
211 p === "/terms" ||
212 p === "/privacy" ||
213 p === "/acceptable-use" ||
214 p.startsWith("/docs/");
215 if (isMarketing) {
216 c.res.headers.set(
217 "cache-control",
218 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
219 );
220 return;
221 }
222 // Public repo browse pages — cache aggressively. Edge invalidates
223 // on push via the post-receive hook (future Crontech surge purge).
224 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
225 c.res.headers.set(
226 "cache-control",
227 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
228 );
229 return;
230 }
231 // Default: don't cache anything we haven't explicitly opted in.
232 c.res.headers.set("cache-control", "private, no-store");
233});
05b973eClaude234// Logger only on non-git routes to avoid overhead on clone/push
235app.use("*", async (c, next) => {
236 if (c.req.path.includes(".git/")) return next();
237 return logger()(c, next);
238});
79136bbClaude239app.use("/api/*", cors());
bf19c50Test User240// Global softAuth — populates c.get("user") for every downstream middleware
241// + route. This was previously per-route, which meant rate-limit middleware
242// (and anything else inspecting auth state) always saw a null user. Keep
243// individual routes free to add requireAuth on top for hard gating; this
244// just establishes the user object cheaply.
245app.use("*", softAuth);
290ea77Claude246
36cc17aClaude247// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude248// pre-redesign markup. JSON / static assets keep their own cache rules; only
249// text/html responses get the no-cache stamp. Without this, every push to
250// main left users staring at cached 80s-looking pages from before the design
251// landed.
36cc17aClaude252//
253// We deliberately use `private, no-cache, must-revalidate` rather than
254// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
255// which makes every Back/Forward press a cold server round-trip — that
256// contributed to the "every nav feels like a fresh login" UX complaint.
257// `no-cache` still revalidates on direct fetch but lets bfcache hold the
258// page in memory between navigations.
290ea77Claude259app.use("*", async (c, next) => {
260 await next();
261 const ct = c.res.headers.get("content-type") || "";
262 if (ct.startsWith("text/html")) {
36cc17aClaude263 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude264 }
265});
826eccfTest User266// Rate-limit API + auth endpoints.
267//
a41e675Test User268// `/api/*`: 1000/min per IP — generous so an admin clicking around the
269// operator console (or a CDN/proxy concentrating multiple users behind one
270// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
271// rate limits below, not this one.
272//
273// `authedMultiplier` is set but only fires when an upstream middleware has
274// already populated c.get("user") — most app.use() chains apply softAuth
275// per-route, so the multiplier is best-effort. Keep the anonymous base
276// high enough that humans never feel it.
277//
278// Skip-paths: dashboard plumbing endpoints that the layout polls on a
279// fixed cadence and that we don't want consuming any bucket:
280// /api/version — layout polls every 15s
826eccfTest User281// /api/notifications/count — nav bell unread-count fetcher
282// /pwa/vapid-public-key — fetched once per push-notification opt-in
283app.use(
284 "/api/*",
a41e675Test User285 rateLimit(1000, 60_000, "api", {
826eccfTest User286 authedMultiplier: 4,
287 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
288 })
289);
0316dbbClaude290app.use("/login", rateLimit(20, 60_000, "login"));
291app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude292// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
293app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User294// BLOCK Q2 — throttle magic-link sign-in for the same reason.
295app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude296
59b6fb2Claude297// CSRF protection — set token on all requests, validate on mutations
298app.use("*", csrfToken);
299app.use("*", csrfProtect);
300
45e31d0Claude301// Rate limit auth routes
302app.use("/login", authRateLimit);
303app.use("/register", authRateLimit);
304
59b6fb2Claude305// Rate limit git operations
306app.use("/:owner/:repo.git/*", gitRateLimit);
307
308// Rate limit search
309app.use("/:owner/:repo/search", searchRateLimit);
310app.use("/explore", searchRateLimit);
79136bbClaude311
312// Git Smart HTTP protocol routes (must be before web routes)
313app.route("/", gitRoutes);
314
45e31d0Claude315// REST API v1 (legacy)
79136bbClaude316app.route("/", apiRoutes);
317
52ad8b1Claude318// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
319// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
320// router's catch-shape, and BEFORE adminRoutes so the live /demo page
321// wins over the legacy /demo redirect in src/routes/admin.tsx.
322app.route("/", demoRoutes);
323
0316dbbClaude324// REST API v2 (basePath /api/v2)
325app.route("/", apiV2Routes);
326
ad6d4adClaude327// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
328app.route("/", hookRoutes);
21f8dbdClaude329app.route("/api/events", eventsRoutes);
ad6d4adClaude330
45e31d0Claude331// API documentation
332app.route("/", apiDocsRoutes);
4a80519Claude333app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude334// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
335app.route("/", pullsDashboardRoutes);
e9aa4d8Claude336// Issue command center — global issue dashboard with AI-triage + autopilot signal
337app.route("/", issuesDashboardRoutes);
338// Personal activity timeline — every event across the user's repos, with
339// AI-driven events surfaced separately (the Gluecron differentiator).
340app.route("/", activityRoutes);
341// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
342app.route("/", inboxRoutes);
79136bbClaude343
344// Auth routes (register, login, logout)
345app.route("/", authRoutes);
346
c63b860Claude347// BLOCK P1 — Password reset (forgot-password + reset-password)
348app.route("/", passwordResetRoutes);
349
350// BLOCK P2 — Email verification (verify-email + resend)
351app.route("/", emailVerificationRoutes);
352
cd4f63bTest User353// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
354app.route("/", magicLinkRoutes);
355
79136bbClaude356// Settings routes (profile, SSH keys)
357app.route("/", settingsRoutes);
358
7298a17Claude359// 2FA / TOTP settings (Block B4)
360app.route("/", settings2faRoutes);
361
2df1f8cClaude362// WebAuthn / passkey routes (Block B5)
363app.route("/", passkeyRoutes);
364
058d752Claude365// OAuth 2.0 provider (Block B6)
366app.route("/", oauthRoutes);
367app.route("/", developerAppsRoutes);
368
6fc53bdClaude369// Theme toggle (dark/light cookie)
370app.route("/", themeRoutes);
371
372// Audit log UI
373app.route("/", auditRoutes);
374
375// Reactions API (issues, PRs, comments)
376app.route("/", reactionRoutes);
377
24cf2caClaude378// Saved replies (per-user canned comment templates)
379app.route("/", savedReplyRoutes);
380
381// Environments + deployment history UI
382app.route("/", deploymentRoutes);
383
6563f0aClaude384// Organizations + teams (Block B1)
385app.route("/", orgRoutes);
386
c81ab7aClaude387// API tokens
388app.route("/", tokenRoutes);
389
59b6fb2Claude390// Notifications
3ef4c9dClaude391app.route("/", notificationRoutes);
392
79136bbClaude393// Repo settings (description, visibility, delete)
394app.route("/", repoSettings);
395
23d1a81Claude396// Repo collaborators (add/list/remove)
397app.route("/", collaboratorRoutes);
398
04f6b7fClaude399// Team-based repo collaborators (invite a whole team)
400app.route("/", teamCollaboratorRoutes);
401
402// Collaborator invite accept flow (token-based)
403app.route("/", invitesRoutes);
404
405// Real-time SSE endpoint (topic-based live updates)
406app.route("/", liveEventsRoutes);
407
c81ab7aClaude408// Webhooks management
409app.route("/", webhookRoutes);
410
79136bbClaude411// Compare view (branch diffs)
412app.route("/", compareRoutes);
413
414// Issue tracker
415app.route("/", issueRoutes);
416
0074234Claude417// Pull requests
418app.route("/", pullRoutes);
419
c81ab7aClaude420// Fork
421app.route("/", forkRoutes);
422
0074234Claude423// Web file editor
424app.route("/", editorRoutes);
425
43de941Claude426// Contributors
427app.route("/", contributorRoutes);
428
699e5c7Claude429// Health liveness + metrics endpoints
2c34075Claude430app.route("/", healthRoutes);
431
f295f78Dictation App432// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
433app.route("/api/platform-status", platformStatus);
434
52ad8b1Claude435// Block L4 — Public stats counters (powers landing-page social proof)
436app.route("/", publicStatsRoutes);
437
438// Block L3 — Live /demo page + /api/v2/demo/* endpoints
439app.route("/", demoRoutes);
440
2316be6Claude441// Public /status — human-readable platform health page
442app.route("/", statusRoutes);
443
b1be050CC LABS App444// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
445// Mounted near the public status route so the two surfaces are visible
446// side-by-side; routes are gated by isSiteAdmin internally.
447app.route("/", adminStatusRoutes);
448
80bed05Claude449// /help — quickstart + API cheatsheet
450app.route("/", helpRoutes);
451
5f2e749Claude452// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
453// so the new editorial pricing layout wins the route; the legacy marketing
454// pricing remains as a safety net but is shadowed at the router.
455app.route("/", pricingRoutes);
456
b0148e9Claude457// /pricing, /features, /about — marketing surface
458app.route("/", marketingRoutes);
459
5618f9aClaude460// SEO: robots.txt + sitemap.xml
461app.route("/", seoRoutes);
462
05cdb85Claude463// /api/version — live build SHA + uptime; client poller uses this to
464// surface 'New version available — reload' banners on deploy.
465app.route("/", versionRoutes);
466
699e5c7Claude467// Health dashboard (per-repo health page)
468app.route("/", healthDashboardRoutes);
469
9dd96b9Test User470// Block R1 — site-admin operations console. MUST be mounted BEFORE
471// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
472// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
473app.route("/", adminOpsRoutes);
f2c00b4CC LABS App474// BLOCK W — Self-host status + bootstrap dashboard.
475app.route("/", adminSelfHostRoutes);
826eccfTest User476// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
477app.route("/", adminDiagnoseRoutes);
9dd96b9Test User478
16b325cClaude479// Insights (time-travel, dependencies, rollback)
480app.route("/", insightRoutes);
481
f1ab587Claude482// Command center dashboard
483app.route("/", dashboardRoutes);
484
36b4cbdClaude485// Legal pages (terms, privacy, AUP)
486app.route("/", legalRoutes);
4b66018Claude487// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
488// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
489// /acceptable-use); these are the formal versions that the legal pages
490// internally link to each other.
491app.route("/", legalTermsRoutes);
492app.route("/", legalPrivacyRoutes);
493app.route("/", legalAcceptableUseRoutes);
494app.route("/", legalDmcaRoutes);
36b4cbdClaude495
bdbd0deClaude496// GitHub import / migration
497app.route("/", importRoutes);
14c3cc8Claude498app.route("/", importBulkRoutes);
f390cfaCC LABS App499app.route("/", importSecretsRoutes);
14c3cc8Claude500app.route("/", migrationRoutes);
501
502// Spec-to-PR (experimental AI-generated draft PRs)
503app.route("/", specsRoutes);
bdbd0deClaude504
c81ab7aClaude505// Explore page
506app.route("/", exploreRoutes);
507
59b6fb2Claude508// Onboarding
509app.route("/", onboardingRoutes);
510
0316dbbClaude511// Admin + feature routes
512app.route("/", adminRoutes);
509c376Claude513app.route("/", adminIntegrationsRoutes);
f764c07Claude514app.route("/", adminDeploysRoutes);
515app.route("/", adminDeploysPageRoutes);
9dd96b9Test User516// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude517app.route("/", advisoriesRoutes);
518app.route("/", aiChangelogRoutes);
519app.route("/", aiExplainRoutes);
520app.route("/", aiTestsRoutes);
521app.route("/", askRoutes);
522app.route("/", billingRoutes);
6778ad2Claude523app.route("/", stripeWebhookRoutes);
0316dbbClaude524app.route("/", codeScanningRoutes);
525app.route("/", commitStatusesRoutes);
526app.route("/", copilotRoutes);
527app.route("/", depUpdaterRoutes);
528app.route("/", depsRoutes);
529app.route("/", discussionsRoutes);
530app.route("/", environmentsRoutes);
531app.route("/", followsRoutes);
532app.route("/", gatesRoutes);
533app.route("/", gistsRoutes);
534app.route("/", graphqlRoutes);
2c2163eClaude535app.route("/", mcpRoutes);
0316dbbClaude536app.route("/", marketplaceRoutes);
537app.route("/", mergeQueueRoutes);
538app.route("/", mirrorsRoutes);
539app.route("/", orgInsightsRoutes);
540app.route("/", packagesRoutes);
541app.route("/", packagesApiRoutes);
542app.route("/", pagesRoutes);
543app.route("/", projectsRoutes);
544app.route("/", protectedTagsRoutes);
545app.route("/", pwaRoutes);
46d6165Claude546app.route("/", installRoutes);
cd4f63bTest User547// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
548app.route("/", dxtRoutes);
662ce86Claude549// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
550// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
551app.route("/", connectClaudeRoutes);
0316dbbClaude552app.route("/", releasesRoutes);
553app.route("/", requiredChecksRoutes);
554app.route("/", rulesetsRoutes);
555app.route("/", searchRoutes);
556app.route("/", semanticSearchRoutes);
557app.route("/", signingKeysRoutes);
558app.route("/", sponsorsRoutes);
559app.route("/", ssoRoutes);
46d6165Claude560app.route("/", githubOauthRoutes);
582cdacClaude561app.route("/", googleOauthRoutes);
0316dbbClaude562app.route("/", symbolsRoutes);
563app.route("/", templatesRoutes);
564app.route("/", trafficRoutes);
565app.route("/", wikisRoutes);
566app.route("/", workflowsRoutes);
5ff9cc2Claude567app.route("/", workflowArtifactsRoutes);
568app.route("/", workflowSecretsRoutes);
46d6165Claude569app.route("/", sleepModeRoutes);
52ad8b1Claude570app.route("/", vsGithubRoutes);
0316dbbClaude571
cd4f63bTest User572// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
573// before the web catch-all so the bare `/play` literal wins over the
574// `/:owner` user-profile route.
575app.route("/", playgroundRoutes);
576
79136bbClaude577// Web UI (catch-all, must be last)
578app.route("/", webRoutes);
579
c63b860Claude580// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
581// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude582app.notFound((c) => {
36cc17aClaude583 const user = c.get("user") ?? null;
79136bbClaude584 return c.html(
c63b860Claude585 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude586 404
587 );
588});
589
c63b860Claude590// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
591// view. Trace block only shown outside production.
79136bbClaude592app.onError((err, c) => {
80bed05Claude593 reportError(err, {
594 requestId: c.get("requestId"),
595 path: c.req.path,
596 method: c.req.method,
597 });
c63b860Claude598 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
599 // back to the context value set by request-context middleware.
600 const requestId =
601 c.req.header("x-request-id") ||
602 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude603 const user = c.get("user") ?? null;
c63b860Claude604 const trace =
605 process.env.NODE_ENV !== "production" && err && err.message
606 ? err.message
607 : undefined;
79136bbClaude608 return c.html(
c63b860Claude609 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude610 500
611 );
612});
613
614export default app;