Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
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.tsxBlame638 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";
e75eddcClaude26import settingsAgentsRoutes from "./routes/settings-agents";
27import agentsRoutes from "./routes/agents";
79136bbClaude28import issueRoutes from "./routes/issues";
29import repoSettings from "./routes/repo-settings";
23d1a81Claude30import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude31import teamCollaboratorRoutes from "./routes/team-collaborators";
32import invitesRoutes from "./routes/invites";
33import liveEventsRoutes from "./routes/live-events";
3c03977Claude34import prLiveRoutes from "./routes/pr-live";
79136bbClaude35import compareRoutes from "./routes/compare";
0074234Claude36import pullRoutes from "./routes/pulls";
37import editorRoutes from "./routes/editor";
c81ab7aClaude38import forkRoutes from "./routes/fork";
39import webhookRoutes from "./routes/webhooks";
40import exploreRoutes from "./routes/explore";
41import tokenRoutes from "./routes/tokens";
43de941Claude42import contributorRoutes from "./routes/contributors";
699e5c7Claude43import healthRoutes from "./routes/health-probe";
44import healthDashboardRoutes from "./routes/health";
2316be6Claude45import statusRoutes from "./routes/status";
b1be050CC LABS App46import adminStatusRoutes from "./routes/admin-status";
80bed05Claude47import helpRoutes from "./routes/help";
b0148e9Claude48import marketingRoutes from "./routes/marketing";
5f2e749Claude49import pricingRoutes from "./routes/pricing";
5618f9aClaude50import seoRoutes from "./routes/seo";
05cdb85Claude51import versionRoutes from "./routes/version";
f295f78Dictation App52import { platformStatus } from "./routes/platform-status";
52ad8b1Claude53import publicStatsRoutes from "./routes/public-stats";
54import demoRoutes from "./routes/demo";
16b325cClaude55import insightRoutes from "./routes/insights";
f1ab587Claude56import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude57import legalRoutes from "./routes/legal";
4b66018Claude58import legalDmcaRoutes from "./routes/legal/dmca";
59import legalTermsRoutes from "./routes/legal/terms";
60import legalPrivacyRoutes from "./routes/legal/privacy";
61import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude62import importRoutes from "./routes/import";
14c3cc8Claude63import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App64import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude65import migrationRoutes from "./routes/migrations";
66import specsRoutes from "./routes/specs";
79136bbClaude67import webRoutes from "./routes/web";
0316dbbClaude68import hookRoutes from "./routes/hooks";
69import eventsRoutes from "./routes/events";
70import passkeyRoutes from "./routes/passkeys";
71import oauthRoutes from "./routes/oauth";
72import developerAppsRoutes from "./routes/developer-apps";
73import themeRoutes from "./routes/theme";
74import auditRoutes from "./routes/audit";
75import reactionRoutes from "./routes/reactions";
76import savedReplyRoutes from "./routes/saved-replies";
77import deploymentRoutes from "./routes/deployments";
78import orgRoutes from "./routes/orgs";
79import notificationRoutes from "./routes/notifications";
80import onboardingRoutes from "./routes/onboarding";
81import adminRoutes from "./routes/admin";
f764c07Claude82import adminDeploysRoutes from "./routes/admin-deploys";
83import adminDeploysPageRoutes from "./routes/admin-deploys-page";
9dd96b9Test User84import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App85import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User86import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude87import adminIntegrationsRoutes from "./routes/admin-integrations";
0316dbbClaude88import advisoriesRoutes from "./routes/advisories";
89import aiChangelogRoutes from "./routes/ai-changelog";
90import aiExplainRoutes from "./routes/ai-explain";
91import aiTestsRoutes from "./routes/ai-tests";
92import askRoutes from "./routes/ask";
38d31d3Claude93import repoChatRoutes from "./routes/repo-chat";
0316dbbClaude94import billingRoutes from "./routes/billing";
6778ad2Claude95import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude96import codeScanningRoutes from "./routes/code-scanning";
97import commitStatusesRoutes from "./routes/commit-statuses";
98import copilotRoutes from "./routes/copilot";
99import depUpdaterRoutes from "./routes/dep-updater";
100import depsRoutes from "./routes/deps";
101import discussionsRoutes from "./routes/discussions";
102import environmentsRoutes from "./routes/environments";
103import followsRoutes from "./routes/follows";
104import gatesRoutes from "./routes/gates";
105import gistsRoutes from "./routes/gists";
106import graphqlRoutes from "./routes/graphql";
2c2163eClaude107import mcpRoutes from "./routes/mcp";
0316dbbClaude108import marketplaceRoutes from "./routes/marketplace";
109import mergeQueueRoutes from "./routes/merge-queue";
110import mirrorsRoutes from "./routes/mirrors";
111import orgInsightsRoutes from "./routes/org-insights";
112import packagesRoutes from "./routes/packages";
113import packagesApiRoutes from "./routes/packages-api";
114import pagesRoutes from "./routes/pages";
115import projectsRoutes from "./routes/projects";
116import protectedTagsRoutes from "./routes/protected-tags";
117import pwaRoutes from "./routes/pwa";
46d6165Claude118import installRoutes from "./routes/install";
cd4f63bTest User119import dxtRoutes from "./routes/dxt";
662ce86Claude120import connectClaudeRoutes from "./routes/connect-claude";
0316dbbClaude121import releasesRoutes from "./routes/releases";
122import requiredChecksRoutes from "./routes/required-checks";
123import rulesetsRoutes from "./routes/rulesets";
124import searchRoutes from "./routes/search";
125import semanticSearchRoutes from "./routes/semantic-search";
126import signingKeysRoutes from "./routes/signing-keys";
127import sponsorsRoutes from "./routes/sponsors";
128import ssoRoutes from "./routes/sso";
46d6165Claude129import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude130import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude131import symbolsRoutes from "./routes/symbols";
132import templatesRoutes from "./routes/templates";
133import trafficRoutes from "./routes/traffic";
134import wikisRoutes from "./routes/wikis";
135import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude136import workflowArtifactsRoutes from "./routes/workflow-artifacts";
137import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude138import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude139import standupRoutes from "./routes/standups";
52ad8b1Claude140import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude141import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User142import playgroundRoutes from "./routes/playground";
59b6fb2Claude143import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
144import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude145
2316901Claude146import type { AuthEnv } from "./middleware/auth";
bf19c50Test User147import { softAuth } from "./middleware/auth";
2316901Claude148
149const app = new Hono<AuthEnv>();
79136bbClaude150
3ef4c9dClaude151// Request context (request ID, start time) runs before everything else
152app.use("*", requestContext);
05b973eClaude153// Middleware — compression first (wraps all responses)
154app.use("*", compress());
f1ffd50Claude155
156// ETag middleware — returns 304 Not Modified on unchanged responses.
157// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
158// SSE + the API surface where it would interfere with streaming.
159app.use("*", async (c, next) => {
160 const p = c.req.path;
161 if (
162 p.includes(".git/") ||
163 p.startsWith("/live-events") ||
164 p.startsWith("/api/events/deploy") ||
3c03977Claude165 p.startsWith("/admin/status") ||
166 // PR live co-editing SSE stream — never etag streaming responses.
167 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude168 ) {
169 return next();
170 }
171 return etag()(c, next);
172});
173
174// Cache-Control middleware — sets sensible defaults on public, anonymous
175// requests. Crontech (when wired as our edge layer) and downstream
176// browsers will honor these. Auth'd users get private,no-store
177// automatically — we never cache responses tied to a session.
178app.use("*", async (c, next) => {
179 await next();
180 // Don't overwrite explicit headers set by route handlers — BUT the
181 // ETag middleware unconditionally sets "private, no-cache, must-
182 // revalidate" so we have to treat that specific value as "no
183 // policy chosen yet" and apply ours. Any route that explicitly set
184 // a different cache-control wins.
185 const existing = c.res.headers.get("cache-control");
186 const etagDefault =
187 existing === "private, no-cache, must-revalidate" ||
188 existing === "no-cache";
189 if (existing && !etagDefault) return;
190 // Anything past auth: private + no-store (avoid leaking session
191 // content into shared caches). softAuth runs before this on the
192 // request, but the response side is what we're stamping.
193 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
194 const p = c.req.path;
195 // Always private for known-authed paths regardless of cookie.
196 if (
197 p.startsWith("/admin") ||
198 p.startsWith("/settings") ||
199 p.startsWith("/dashboard") ||
200 p.startsWith("/notifications") ||
201 p.startsWith("/connect/") ||
202 hasSession
203 ) {
204 c.res.headers.set("cache-control", "private, no-store");
205 return;
206 }
207 // Public marketing surfaces — short edge cache, longer browser cache,
208 // stale-while-revalidate so the user never waits on a stale fetch.
209 const isMarketing =
210 p === "/" ||
211 p === "/features" ||
212 p === "/pricing" ||
213 p === "/about" ||
214 p === "/vs-github" ||
215 p === "/explore" ||
216 p === "/help" ||
217 p === "/changelog" ||
218 p.startsWith("/legal/") ||
219 p === "/terms" ||
220 p === "/privacy" ||
221 p === "/acceptable-use" ||
222 p.startsWith("/docs/");
223 if (isMarketing) {
224 c.res.headers.set(
225 "cache-control",
226 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
227 );
228 return;
229 }
230 // Public repo browse pages — cache aggressively. Edge invalidates
231 // on push via the post-receive hook (future Crontech surge purge).
232 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
233 c.res.headers.set(
234 "cache-control",
235 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
236 );
237 return;
238 }
239 // Default: don't cache anything we haven't explicitly opted in.
240 c.res.headers.set("cache-control", "private, no-store");
241});
05b973eClaude242// Logger only on non-git routes to avoid overhead on clone/push
243app.use("*", async (c, next) => {
244 if (c.req.path.includes(".git/")) return next();
245 return logger()(c, next);
246});
79136bbClaude247app.use("/api/*", cors());
bf19c50Test User248// Global softAuth — populates c.get("user") for every downstream middleware
249// + route. This was previously per-route, which meant rate-limit middleware
250// (and anything else inspecting auth state) always saw a null user. Keep
251// individual routes free to add requireAuth on top for hard gating; this
252// just establishes the user object cheaply.
253app.use("*", softAuth);
290ea77Claude254
36cc17aClaude255// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude256// pre-redesign markup. JSON / static assets keep their own cache rules; only
257// text/html responses get the no-cache stamp. Without this, every push to
258// main left users staring at cached 80s-looking pages from before the design
259// landed.
36cc17aClaude260//
261// We deliberately use `private, no-cache, must-revalidate` rather than
262// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
263// which makes every Back/Forward press a cold server round-trip — that
264// contributed to the "every nav feels like a fresh login" UX complaint.
265// `no-cache` still revalidates on direct fetch but lets bfcache hold the
266// page in memory between navigations.
290ea77Claude267app.use("*", async (c, next) => {
268 await next();
269 const ct = c.res.headers.get("content-type") || "";
270 if (ct.startsWith("text/html")) {
36cc17aClaude271 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude272 }
273});
826eccfTest User274// Rate-limit API + auth endpoints.
275//
a41e675Test User276// `/api/*`: 1000/min per IP — generous so an admin clicking around the
277// operator console (or a CDN/proxy concentrating multiple users behind one
278// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
279// rate limits below, not this one.
280//
281// `authedMultiplier` is set but only fires when an upstream middleware has
282// already populated c.get("user") — most app.use() chains apply softAuth
283// per-route, so the multiplier is best-effort. Keep the anonymous base
284// high enough that humans never feel it.
285//
286// Skip-paths: dashboard plumbing endpoints that the layout polls on a
287// fixed cadence and that we don't want consuming any bucket:
288// /api/version — layout polls every 15s
826eccfTest User289// /api/notifications/count — nav bell unread-count fetcher
290// /pwa/vapid-public-key — fetched once per push-notification opt-in
291app.use(
292 "/api/*",
a41e675Test User293 rateLimit(1000, 60_000, "api", {
826eccfTest User294 authedMultiplier: 4,
295 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
296 })
297);
0316dbbClaude298app.use("/login", rateLimit(20, 60_000, "login"));
299app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude300// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
301app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User302// BLOCK Q2 — throttle magic-link sign-in for the same reason.
303app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude304
59b6fb2Claude305// CSRF protection — set token on all requests, validate on mutations
306app.use("*", csrfToken);
307app.use("*", csrfProtect);
308
45e31d0Claude309// Rate limit auth routes
310app.use("/login", authRateLimit);
311app.use("/register", authRateLimit);
312
59b6fb2Claude313// Rate limit git operations
314app.use("/:owner/:repo.git/*", gitRateLimit);
315
316// Rate limit search
317app.use("/:owner/:repo/search", searchRateLimit);
318app.use("/explore", searchRateLimit);
79136bbClaude319
320// Git Smart HTTP protocol routes (must be before web routes)
321app.route("/", gitRoutes);
322
45e31d0Claude323// REST API v1 (legacy)
79136bbClaude324app.route("/", apiRoutes);
325
52ad8b1Claude326// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
327// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
328// router's catch-shape, and BEFORE adminRoutes so the live /demo page
329// wins over the legacy /demo redirect in src/routes/admin.tsx.
330app.route("/", demoRoutes);
331
0316dbbClaude332// REST API v2 (basePath /api/v2)
333app.route("/", apiV2Routes);
334
e75eddcClaude335// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
336// Mounted alongside apiV2Routes (its own basePath, no path conflict).
337app.route("/", agentsRoutes);
338
ad6d4adClaude339// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
340app.route("/", hookRoutes);
21f8dbdClaude341app.route("/api/events", eventsRoutes);
ad6d4adClaude342
45e31d0Claude343// API documentation
344app.route("/", apiDocsRoutes);
4a80519Claude345app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude346// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
347app.route("/", pullsDashboardRoutes);
e9aa4d8Claude348// Issue command center — global issue dashboard with AI-triage + autopilot signal
349app.route("/", issuesDashboardRoutes);
350// Personal activity timeline — every event across the user's repos, with
351// AI-driven events surfaced separately (the Gluecron differentiator).
352app.route("/", activityRoutes);
353// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
354app.route("/", inboxRoutes);
56801e1Claude355// AI standup feed — daily / weekly Claude-generated team brief
356app.route("/", standupRoutes);
79136bbClaude357
358// Auth routes (register, login, logout)
359app.route("/", authRoutes);
360
c63b860Claude361// BLOCK P1 — Password reset (forgot-password + reset-password)
362app.route("/", passwordResetRoutes);
363
364// BLOCK P2 — Email verification (verify-email + resend)
365app.route("/", emailVerificationRoutes);
366
cd4f63bTest User367// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
368app.route("/", magicLinkRoutes);
369
79136bbClaude370// Settings routes (profile, SSH keys)
371app.route("/", settingsRoutes);
372
7298a17Claude373// 2FA / TOTP settings (Block B4)
374app.route("/", settings2faRoutes);
375
e75eddcClaude376// Agent multiplayer — /settings/agents management UI
377app.route("/", settingsAgentsRoutes);
378
2df1f8cClaude379// WebAuthn / passkey routes (Block B5)
380app.route("/", passkeyRoutes);
381
058d752Claude382// OAuth 2.0 provider (Block B6)
383app.route("/", oauthRoutes);
384app.route("/", developerAppsRoutes);
385
6fc53bdClaude386// Theme toggle (dark/light cookie)
387app.route("/", themeRoutes);
388
389// Audit log UI
390app.route("/", auditRoutes);
391
392// Reactions API (issues, PRs, comments)
393app.route("/", reactionRoutes);
394
24cf2caClaude395// Saved replies (per-user canned comment templates)
396app.route("/", savedReplyRoutes);
397
398// Environments + deployment history UI
399app.route("/", deploymentRoutes);
400
6563f0aClaude401// Organizations + teams (Block B1)
402app.route("/", orgRoutes);
403
c81ab7aClaude404// API tokens
405app.route("/", tokenRoutes);
406
59b6fb2Claude407// Notifications
3ef4c9dClaude408app.route("/", notificationRoutes);
409
79136bbClaude410// Repo settings (description, visibility, delete)
411app.route("/", repoSettings);
412
23d1a81Claude413// Repo collaborators (add/list/remove)
414app.route("/", collaboratorRoutes);
415
04f6b7fClaude416// Team-based repo collaborators (invite a whole team)
417app.route("/", teamCollaboratorRoutes);
418
419// Collaborator invite accept flow (token-based)
420app.route("/", invitesRoutes);
421
422// Real-time SSE endpoint (topic-based live updates)
423app.route("/", liveEventsRoutes);
424
3c03977Claude425// PR live co-editing — presence + cursors + content sync via SSE.
426app.route("/", prLiveRoutes);
427
c81ab7aClaude428// Webhooks management
429app.route("/", webhookRoutes);
430
79136bbClaude431// Compare view (branch diffs)
432app.route("/", compareRoutes);
433
434// Issue tracker
435app.route("/", issueRoutes);
436
0074234Claude437// Pull requests
438app.route("/", pullRoutes);
439
c81ab7aClaude440// Fork
441app.route("/", forkRoutes);
442
0074234Claude443// Web file editor
444app.route("/", editorRoutes);
445
43de941Claude446// Contributors
447app.route("/", contributorRoutes);
448
699e5c7Claude449// Health liveness + metrics endpoints
2c34075Claude450app.route("/", healthRoutes);
451
f295f78Dictation App452// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
453app.route("/api/platform-status", platformStatus);
454
52ad8b1Claude455// Block L4 — Public stats counters (powers landing-page social proof)
456app.route("/", publicStatsRoutes);
457
458// Block L3 — Live /demo page + /api/v2/demo/* endpoints
459app.route("/", demoRoutes);
460
2316be6Claude461// Public /status — human-readable platform health page
462app.route("/", statusRoutes);
463
b1be050CC LABS App464// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
465// Mounted near the public status route so the two surfaces are visible
466// side-by-side; routes are gated by isSiteAdmin internally.
467app.route("/", adminStatusRoutes);
468
80bed05Claude469// /help — quickstart + API cheatsheet
470app.route("/", helpRoutes);
471
5f2e749Claude472// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
473// so the new editorial pricing layout wins the route; the legacy marketing
474// pricing remains as a safety net but is shadowed at the router.
475app.route("/", pricingRoutes);
476
b0148e9Claude477// /pricing, /features, /about — marketing surface
478app.route("/", marketingRoutes);
479
5618f9aClaude480// SEO: robots.txt + sitemap.xml
481app.route("/", seoRoutes);
482
05cdb85Claude483// /api/version — live build SHA + uptime; client poller uses this to
484// surface 'New version available — reload' banners on deploy.
485app.route("/", versionRoutes);
486
699e5c7Claude487// Health dashboard (per-repo health page)
488app.route("/", healthDashboardRoutes);
489
9dd96b9Test User490// Block R1 — site-admin operations console. MUST be mounted BEFORE
491// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
492// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
493app.route("/", adminOpsRoutes);
f2c00b4CC LABS App494// BLOCK W — Self-host status + bootstrap dashboard.
495app.route("/", adminSelfHostRoutes);
826eccfTest User496// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
497app.route("/", adminDiagnoseRoutes);
9dd96b9Test User498
16b325cClaude499// Insights (time-travel, dependencies, rollback)
500app.route("/", insightRoutes);
501
f1ab587Claude502// Command center dashboard
503app.route("/", dashboardRoutes);
504
36b4cbdClaude505// Legal pages (terms, privacy, AUP)
506app.route("/", legalRoutes);
4b66018Claude507// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
508// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
509// /acceptable-use); these are the formal versions that the legal pages
510// internally link to each other.
511app.route("/", legalTermsRoutes);
512app.route("/", legalPrivacyRoutes);
513app.route("/", legalAcceptableUseRoutes);
514app.route("/", legalDmcaRoutes);
36b4cbdClaude515
bdbd0deClaude516// GitHub import / migration
517app.route("/", importRoutes);
14c3cc8Claude518app.route("/", importBulkRoutes);
f390cfaCC LABS App519app.route("/", importSecretsRoutes);
14c3cc8Claude520app.route("/", migrationRoutes);
521
522// Spec-to-PR (experimental AI-generated draft PRs)
523app.route("/", specsRoutes);
bdbd0deClaude524
c81ab7aClaude525// Explore page
526app.route("/", exploreRoutes);
527
59b6fb2Claude528// Onboarding
529app.route("/", onboardingRoutes);
530
0316dbbClaude531// Admin + feature routes
532app.route("/", adminRoutes);
509c376Claude533app.route("/", adminIntegrationsRoutes);
f764c07Claude534app.route("/", adminDeploysRoutes);
535app.route("/", adminDeploysPageRoutes);
9dd96b9Test User536// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude537app.route("/", advisoriesRoutes);
538app.route("/", aiChangelogRoutes);
539app.route("/", aiExplainRoutes);
540app.route("/", aiTestsRoutes);
541app.route("/", askRoutes);
38d31d3Claude542app.route("/", repoChatRoutes);
0316dbbClaude543app.route("/", billingRoutes);
6778ad2Claude544app.route("/", stripeWebhookRoutes);
0316dbbClaude545app.route("/", codeScanningRoutes);
546app.route("/", commitStatusesRoutes);
547app.route("/", copilotRoutes);
548app.route("/", depUpdaterRoutes);
549app.route("/", depsRoutes);
550app.route("/", discussionsRoutes);
551app.route("/", environmentsRoutes);
552app.route("/", followsRoutes);
553app.route("/", gatesRoutes);
554app.route("/", gistsRoutes);
555app.route("/", graphqlRoutes);
2c2163eClaude556app.route("/", mcpRoutes);
0316dbbClaude557app.route("/", marketplaceRoutes);
558app.route("/", mergeQueueRoutes);
559app.route("/", mirrorsRoutes);
560app.route("/", orgInsightsRoutes);
561app.route("/", packagesRoutes);
562app.route("/", packagesApiRoutes);
563app.route("/", pagesRoutes);
564app.route("/", projectsRoutes);
565app.route("/", protectedTagsRoutes);
566app.route("/", pwaRoutes);
46d6165Claude567app.route("/", installRoutes);
cd4f63bTest User568// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
569app.route("/", dxtRoutes);
662ce86Claude570// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
571// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
572app.route("/", connectClaudeRoutes);
0316dbbClaude573app.route("/", releasesRoutes);
574app.route("/", requiredChecksRoutes);
575app.route("/", rulesetsRoutes);
576app.route("/", searchRoutes);
577app.route("/", semanticSearchRoutes);
578app.route("/", signingKeysRoutes);
579app.route("/", sponsorsRoutes);
580app.route("/", ssoRoutes);
46d6165Claude581app.route("/", githubOauthRoutes);
582cdacClaude582app.route("/", googleOauthRoutes);
0316dbbClaude583app.route("/", symbolsRoutes);
584app.route("/", templatesRoutes);
585app.route("/", trafficRoutes);
586app.route("/", wikisRoutes);
587app.route("/", workflowsRoutes);
5ff9cc2Claude588app.route("/", workflowArtifactsRoutes);
589app.route("/", workflowSecretsRoutes);
46d6165Claude590app.route("/", sleepModeRoutes);
52ad8b1Claude591app.route("/", vsGithubRoutes);
0316dbbClaude592
45f3b73Claude593// Voice-to-PR — phone-first dictation → spec or issue
594app.route("/", voiceRoutes);
595
cd4f63bTest User596// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
597// before the web catch-all so the bare `/play` literal wins over the
598// `/:owner` user-profile route.
599app.route("/", playgroundRoutes);
600
79136bbClaude601// Web UI (catch-all, must be last)
602app.route("/", webRoutes);
603
c63b860Claude604// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
605// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude606app.notFound((c) => {
36cc17aClaude607 const user = c.get("user") ?? null;
79136bbClaude608 return c.html(
c63b860Claude609 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude610 404
611 );
612});
613
c63b860Claude614// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
615// view. Trace block only shown outside production.
79136bbClaude616app.onError((err, c) => {
80bed05Claude617 reportError(err, {
618 requestId: c.get("requestId"),
619 path: c.req.path,
620 method: c.req.method,
621 });
c63b860Claude622 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
623 // back to the context value set by request-context middleware.
624 const requestId =
625 c.req.header("x-request-id") ||
626 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude627 const user = c.get("user") ?? null;
c63b860Claude628 const trace =
629 process.env.NODE_ENV !== "production" && err && err.message
630 ? err.message
631 : undefined;
79136bbClaude632 return c.html(
c63b860Claude633 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude634 500
635 );
636});
637
638export default app;