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.tsxBlame640 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";
4bbacbeClaude103import previewsRoutes from "./routes/previews";
0316dbbClaude104import followsRoutes from "./routes/follows";
105import gatesRoutes from "./routes/gates";
106import gistsRoutes from "./routes/gists";
107import graphqlRoutes from "./routes/graphql";
2c2163eClaude108import mcpRoutes from "./routes/mcp";
0316dbbClaude109import marketplaceRoutes from "./routes/marketplace";
110import mergeQueueRoutes from "./routes/merge-queue";
111import mirrorsRoutes from "./routes/mirrors";
112import orgInsightsRoutes from "./routes/org-insights";
113import packagesRoutes from "./routes/packages";
114import packagesApiRoutes from "./routes/packages-api";
115import pagesRoutes from "./routes/pages";
116import projectsRoutes from "./routes/projects";
117import protectedTagsRoutes from "./routes/protected-tags";
118import pwaRoutes from "./routes/pwa";
46d6165Claude119import installRoutes from "./routes/install";
cd4f63bTest User120import dxtRoutes from "./routes/dxt";
662ce86Claude121import connectClaudeRoutes from "./routes/connect-claude";
0316dbbClaude122import releasesRoutes from "./routes/releases";
123import requiredChecksRoutes from "./routes/required-checks";
124import rulesetsRoutes from "./routes/rulesets";
125import searchRoutes from "./routes/search";
126import semanticSearchRoutes from "./routes/semantic-search";
127import signingKeysRoutes from "./routes/signing-keys";
128import sponsorsRoutes from "./routes/sponsors";
129import ssoRoutes from "./routes/sso";
46d6165Claude130import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude131import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude132import symbolsRoutes from "./routes/symbols";
133import templatesRoutes from "./routes/templates";
134import trafficRoutes from "./routes/traffic";
135import wikisRoutes from "./routes/wikis";
136import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude137import workflowArtifactsRoutes from "./routes/workflow-artifacts";
138import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude139import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude140import standupRoutes from "./routes/standups";
52ad8b1Claude141import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude142import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User143import playgroundRoutes from "./routes/playground";
59b6fb2Claude144import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
145import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude146
2316901Claude147import type { AuthEnv } from "./middleware/auth";
bf19c50Test User148import { softAuth } from "./middleware/auth";
2316901Claude149
150const app = new Hono<AuthEnv>();
79136bbClaude151
3ef4c9dClaude152// Request context (request ID, start time) runs before everything else
153app.use("*", requestContext);
05b973eClaude154// Middleware — compression first (wraps all responses)
155app.use("*", compress());
f1ffd50Claude156
157// ETag middleware — returns 304 Not Modified on unchanged responses.
158// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
159// SSE + the API surface where it would interfere with streaming.
160app.use("*", async (c, next) => {
161 const p = c.req.path;
162 if (
163 p.includes(".git/") ||
164 p.startsWith("/live-events") ||
165 p.startsWith("/api/events/deploy") ||
3c03977Claude166 p.startsWith("/admin/status") ||
167 // PR live co-editing SSE stream — never etag streaming responses.
168 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude169 ) {
170 return next();
171 }
172 return etag()(c, next);
173});
174
175// Cache-Control middleware — sets sensible defaults on public, anonymous
176// requests. Crontech (when wired as our edge layer) and downstream
177// browsers will honor these. Auth'd users get private,no-store
178// automatically — we never cache responses tied to a session.
179app.use("*", async (c, next) => {
180 await next();
181 // Don't overwrite explicit headers set by route handlers — BUT the
182 // ETag middleware unconditionally sets "private, no-cache, must-
183 // revalidate" so we have to treat that specific value as "no
184 // policy chosen yet" and apply ours. Any route that explicitly set
185 // a different cache-control wins.
186 const existing = c.res.headers.get("cache-control");
187 const etagDefault =
188 existing === "private, no-cache, must-revalidate" ||
189 existing === "no-cache";
190 if (existing && !etagDefault) return;
191 // Anything past auth: private + no-store (avoid leaking session
192 // content into shared caches). softAuth runs before this on the
193 // request, but the response side is what we're stamping.
194 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
195 const p = c.req.path;
196 // Always private for known-authed paths regardless of cookie.
197 if (
198 p.startsWith("/admin") ||
199 p.startsWith("/settings") ||
200 p.startsWith("/dashboard") ||
201 p.startsWith("/notifications") ||
202 p.startsWith("/connect/") ||
203 hasSession
204 ) {
205 c.res.headers.set("cache-control", "private, no-store");
206 return;
207 }
208 // Public marketing surfaces — short edge cache, longer browser cache,
209 // stale-while-revalidate so the user never waits on a stale fetch.
210 const isMarketing =
211 p === "/" ||
212 p === "/features" ||
213 p === "/pricing" ||
214 p === "/about" ||
215 p === "/vs-github" ||
216 p === "/explore" ||
217 p === "/help" ||
218 p === "/changelog" ||
219 p.startsWith("/legal/") ||
220 p === "/terms" ||
221 p === "/privacy" ||
222 p === "/acceptable-use" ||
223 p.startsWith("/docs/");
224 if (isMarketing) {
225 c.res.headers.set(
226 "cache-control",
227 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
228 );
229 return;
230 }
231 // Public repo browse pages — cache aggressively. Edge invalidates
232 // on push via the post-receive hook (future Crontech surge purge).
233 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
234 c.res.headers.set(
235 "cache-control",
236 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
237 );
238 return;
239 }
240 // Default: don't cache anything we haven't explicitly opted in.
241 c.res.headers.set("cache-control", "private, no-store");
242});
05b973eClaude243// Logger only on non-git routes to avoid overhead on clone/push
244app.use("*", async (c, next) => {
245 if (c.req.path.includes(".git/")) return next();
246 return logger()(c, next);
247});
79136bbClaude248app.use("/api/*", cors());
bf19c50Test User249// Global softAuth — populates c.get("user") for every downstream middleware
250// + route. This was previously per-route, which meant rate-limit middleware
251// (and anything else inspecting auth state) always saw a null user. Keep
252// individual routes free to add requireAuth on top for hard gating; this
253// just establishes the user object cheaply.
254app.use("*", softAuth);
290ea77Claude255
36cc17aClaude256// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude257// pre-redesign markup. JSON / static assets keep their own cache rules; only
258// text/html responses get the no-cache stamp. Without this, every push to
259// main left users staring at cached 80s-looking pages from before the design
260// landed.
36cc17aClaude261//
262// We deliberately use `private, no-cache, must-revalidate` rather than
263// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
264// which makes every Back/Forward press a cold server round-trip — that
265// contributed to the "every nav feels like a fresh login" UX complaint.
266// `no-cache` still revalidates on direct fetch but lets bfcache hold the
267// page in memory between navigations.
290ea77Claude268app.use("*", async (c, next) => {
269 await next();
270 const ct = c.res.headers.get("content-type") || "";
271 if (ct.startsWith("text/html")) {
36cc17aClaude272 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude273 }
274});
826eccfTest User275// Rate-limit API + auth endpoints.
276//
a41e675Test User277// `/api/*`: 1000/min per IP — generous so an admin clicking around the
278// operator console (or a CDN/proxy concentrating multiple users behind one
279// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
280// rate limits below, not this one.
281//
282// `authedMultiplier` is set but only fires when an upstream middleware has
283// already populated c.get("user") — most app.use() chains apply softAuth
284// per-route, so the multiplier is best-effort. Keep the anonymous base
285// high enough that humans never feel it.
286//
287// Skip-paths: dashboard plumbing endpoints that the layout polls on a
288// fixed cadence and that we don't want consuming any bucket:
289// /api/version — layout polls every 15s
826eccfTest User290// /api/notifications/count — nav bell unread-count fetcher
291// /pwa/vapid-public-key — fetched once per push-notification opt-in
292app.use(
293 "/api/*",
a41e675Test User294 rateLimit(1000, 60_000, "api", {
826eccfTest User295 authedMultiplier: 4,
296 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
297 })
298);
0316dbbClaude299app.use("/login", rateLimit(20, 60_000, "login"));
300app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude301// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
302app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User303// BLOCK Q2 — throttle magic-link sign-in for the same reason.
304app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude305
59b6fb2Claude306// CSRF protection — set token on all requests, validate on mutations
307app.use("*", csrfToken);
308app.use("*", csrfProtect);
309
45e31d0Claude310// Rate limit auth routes
311app.use("/login", authRateLimit);
312app.use("/register", authRateLimit);
313
59b6fb2Claude314// Rate limit git operations
315app.use("/:owner/:repo.git/*", gitRateLimit);
316
317// Rate limit search
318app.use("/:owner/:repo/search", searchRateLimit);
319app.use("/explore", searchRateLimit);
79136bbClaude320
321// Git Smart HTTP protocol routes (must be before web routes)
322app.route("/", gitRoutes);
323
45e31d0Claude324// REST API v1 (legacy)
79136bbClaude325app.route("/", apiRoutes);
326
52ad8b1Claude327// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
328// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
329// router's catch-shape, and BEFORE adminRoutes so the live /demo page
330// wins over the legacy /demo redirect in src/routes/admin.tsx.
331app.route("/", demoRoutes);
332
0316dbbClaude333// REST API v2 (basePath /api/v2)
334app.route("/", apiV2Routes);
335
e75eddcClaude336// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
337// Mounted alongside apiV2Routes (its own basePath, no path conflict).
338app.route("/", agentsRoutes);
339
ad6d4adClaude340// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
341app.route("/", hookRoutes);
21f8dbdClaude342app.route("/api/events", eventsRoutes);
ad6d4adClaude343
45e31d0Claude344// API documentation
345app.route("/", apiDocsRoutes);
4a80519Claude346app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude347// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
348app.route("/", pullsDashboardRoutes);
e9aa4d8Claude349// Issue command center — global issue dashboard with AI-triage + autopilot signal
350app.route("/", issuesDashboardRoutes);
351// Personal activity timeline — every event across the user's repos, with
352// AI-driven events surfaced separately (the Gluecron differentiator).
353app.route("/", activityRoutes);
354// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
355app.route("/", inboxRoutes);
56801e1Claude356// AI standup feed — daily / weekly Claude-generated team brief
357app.route("/", standupRoutes);
79136bbClaude358
359// Auth routes (register, login, logout)
360app.route("/", authRoutes);
361
c63b860Claude362// BLOCK P1 — Password reset (forgot-password + reset-password)
363app.route("/", passwordResetRoutes);
364
365// BLOCK P2 — Email verification (verify-email + resend)
366app.route("/", emailVerificationRoutes);
367
cd4f63bTest User368// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
369app.route("/", magicLinkRoutes);
370
79136bbClaude371// Settings routes (profile, SSH keys)
372app.route("/", settingsRoutes);
373
7298a17Claude374// 2FA / TOTP settings (Block B4)
375app.route("/", settings2faRoutes);
376
e75eddcClaude377// Agent multiplayer — /settings/agents management UI
378app.route("/", settingsAgentsRoutes);
379
2df1f8cClaude380// WebAuthn / passkey routes (Block B5)
381app.route("/", passkeyRoutes);
382
058d752Claude383// OAuth 2.0 provider (Block B6)
384app.route("/", oauthRoutes);
385app.route("/", developerAppsRoutes);
386
6fc53bdClaude387// Theme toggle (dark/light cookie)
388app.route("/", themeRoutes);
389
390// Audit log UI
391app.route("/", auditRoutes);
392
393// Reactions API (issues, PRs, comments)
394app.route("/", reactionRoutes);
395
24cf2caClaude396// Saved replies (per-user canned comment templates)
397app.route("/", savedReplyRoutes);
398
399// Environments + deployment history UI
400app.route("/", deploymentRoutes);
401
6563f0aClaude402// Organizations + teams (Block B1)
403app.route("/", orgRoutes);
404
c81ab7aClaude405// API tokens
406app.route("/", tokenRoutes);
407
59b6fb2Claude408// Notifications
3ef4c9dClaude409app.route("/", notificationRoutes);
410
79136bbClaude411// Repo settings (description, visibility, delete)
412app.route("/", repoSettings);
413
23d1a81Claude414// Repo collaborators (add/list/remove)
415app.route("/", collaboratorRoutes);
416
04f6b7fClaude417// Team-based repo collaborators (invite a whole team)
418app.route("/", teamCollaboratorRoutes);
419
420// Collaborator invite accept flow (token-based)
421app.route("/", invitesRoutes);
422
423// Real-time SSE endpoint (topic-based live updates)
424app.route("/", liveEventsRoutes);
425
3c03977Claude426// PR live co-editing — presence + cursors + content sync via SSE.
427app.route("/", prLiveRoutes);
428
c81ab7aClaude429// Webhooks management
430app.route("/", webhookRoutes);
431
79136bbClaude432// Compare view (branch diffs)
433app.route("/", compareRoutes);
434
435// Issue tracker
436app.route("/", issueRoutes);
437
0074234Claude438// Pull requests
439app.route("/", pullRoutes);
440
c81ab7aClaude441// Fork
442app.route("/", forkRoutes);
443
0074234Claude444// Web file editor
445app.route("/", editorRoutes);
446
43de941Claude447// Contributors
448app.route("/", contributorRoutes);
449
699e5c7Claude450// Health liveness + metrics endpoints
2c34075Claude451app.route("/", healthRoutes);
452
f295f78Dictation App453// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
454app.route("/api/platform-status", platformStatus);
455
52ad8b1Claude456// Block L4 — Public stats counters (powers landing-page social proof)
457app.route("/", publicStatsRoutes);
458
459// Block L3 — Live /demo page + /api/v2/demo/* endpoints
460app.route("/", demoRoutes);
461
2316be6Claude462// Public /status — human-readable platform health page
463app.route("/", statusRoutes);
464
b1be050CC LABS App465// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
466// Mounted near the public status route so the two surfaces are visible
467// side-by-side; routes are gated by isSiteAdmin internally.
468app.route("/", adminStatusRoutes);
469
80bed05Claude470// /help — quickstart + API cheatsheet
471app.route("/", helpRoutes);
472
5f2e749Claude473// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
474// so the new editorial pricing layout wins the route; the legacy marketing
475// pricing remains as a safety net but is shadowed at the router.
476app.route("/", pricingRoutes);
477
b0148e9Claude478// /pricing, /features, /about — marketing surface
479app.route("/", marketingRoutes);
480
5618f9aClaude481// SEO: robots.txt + sitemap.xml
482app.route("/", seoRoutes);
483
05cdb85Claude484// /api/version — live build SHA + uptime; client poller uses this to
485// surface 'New version available — reload' banners on deploy.
486app.route("/", versionRoutes);
487
699e5c7Claude488// Health dashboard (per-repo health page)
489app.route("/", healthDashboardRoutes);
490
9dd96b9Test User491// Block R1 — site-admin operations console. MUST be mounted BEFORE
492// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
493// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
494app.route("/", adminOpsRoutes);
f2c00b4CC LABS App495// BLOCK W — Self-host status + bootstrap dashboard.
496app.route("/", adminSelfHostRoutes);
826eccfTest User497// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
498app.route("/", adminDiagnoseRoutes);
9dd96b9Test User499
16b325cClaude500// Insights (time-travel, dependencies, rollback)
501app.route("/", insightRoutes);
502
f1ab587Claude503// Command center dashboard
504app.route("/", dashboardRoutes);
505
36b4cbdClaude506// Legal pages (terms, privacy, AUP)
507app.route("/", legalRoutes);
4b66018Claude508// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
509// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
510// /acceptable-use); these are the formal versions that the legal pages
511// internally link to each other.
512app.route("/", legalTermsRoutes);
513app.route("/", legalPrivacyRoutes);
514app.route("/", legalAcceptableUseRoutes);
515app.route("/", legalDmcaRoutes);
36b4cbdClaude516
bdbd0deClaude517// GitHub import / migration
518app.route("/", importRoutes);
14c3cc8Claude519app.route("/", importBulkRoutes);
f390cfaCC LABS App520app.route("/", importSecretsRoutes);
14c3cc8Claude521app.route("/", migrationRoutes);
522
523// Spec-to-PR (experimental AI-generated draft PRs)
524app.route("/", specsRoutes);
bdbd0deClaude525
c81ab7aClaude526// Explore page
527app.route("/", exploreRoutes);
528
59b6fb2Claude529// Onboarding
530app.route("/", onboardingRoutes);
531
0316dbbClaude532// Admin + feature routes
533app.route("/", adminRoutes);
509c376Claude534app.route("/", adminIntegrationsRoutes);
f764c07Claude535app.route("/", adminDeploysRoutes);
536app.route("/", adminDeploysPageRoutes);
9dd96b9Test User537// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude538app.route("/", advisoriesRoutes);
539app.route("/", aiChangelogRoutes);
540app.route("/", aiExplainRoutes);
541app.route("/", aiTestsRoutes);
542app.route("/", askRoutes);
38d31d3Claude543app.route("/", repoChatRoutes);
0316dbbClaude544app.route("/", billingRoutes);
6778ad2Claude545app.route("/", stripeWebhookRoutes);
0316dbbClaude546app.route("/", codeScanningRoutes);
547app.route("/", commitStatusesRoutes);
548app.route("/", copilotRoutes);
549app.route("/", depUpdaterRoutes);
550app.route("/", depsRoutes);
551app.route("/", discussionsRoutes);
552app.route("/", environmentsRoutes);
4bbacbeClaude553app.route("/", previewsRoutes);
0316dbbClaude554app.route("/", followsRoutes);
555app.route("/", gatesRoutes);
556app.route("/", gistsRoutes);
557app.route("/", graphqlRoutes);
2c2163eClaude558app.route("/", mcpRoutes);
0316dbbClaude559app.route("/", marketplaceRoutes);
560app.route("/", mergeQueueRoutes);
561app.route("/", mirrorsRoutes);
562app.route("/", orgInsightsRoutes);
563app.route("/", packagesRoutes);
564app.route("/", packagesApiRoutes);
565app.route("/", pagesRoutes);
566app.route("/", projectsRoutes);
567app.route("/", protectedTagsRoutes);
568app.route("/", pwaRoutes);
46d6165Claude569app.route("/", installRoutes);
cd4f63bTest User570// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
571app.route("/", dxtRoutes);
662ce86Claude572// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
573// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
574app.route("/", connectClaudeRoutes);
0316dbbClaude575app.route("/", releasesRoutes);
576app.route("/", requiredChecksRoutes);
577app.route("/", rulesetsRoutes);
578app.route("/", searchRoutes);
579app.route("/", semanticSearchRoutes);
580app.route("/", signingKeysRoutes);
581app.route("/", sponsorsRoutes);
582app.route("/", ssoRoutes);
46d6165Claude583app.route("/", githubOauthRoutes);
582cdacClaude584app.route("/", googleOauthRoutes);
0316dbbClaude585app.route("/", symbolsRoutes);
586app.route("/", templatesRoutes);
587app.route("/", trafficRoutes);
588app.route("/", wikisRoutes);
589app.route("/", workflowsRoutes);
5ff9cc2Claude590app.route("/", workflowArtifactsRoutes);
591app.route("/", workflowSecretsRoutes);
46d6165Claude592app.route("/", sleepModeRoutes);
52ad8b1Claude593app.route("/", vsGithubRoutes);
0316dbbClaude594
45f3b73Claude595// Voice-to-PR — phone-first dictation → spec or issue
596app.route("/", voiceRoutes);
597
cd4f63bTest User598// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
599// before the web catch-all so the bare `/play` literal wins over the
600// `/:owner` user-profile route.
601app.route("/", playgroundRoutes);
602
79136bbClaude603// Web UI (catch-all, must be last)
604app.route("/", webRoutes);
605
c63b860Claude606// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
607// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude608app.notFound((c) => {
36cc17aClaude609 const user = c.get("user") ?? null;
79136bbClaude610 return c.html(
c63b860Claude611 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude612 404
613 );
614});
615
c63b860Claude616// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
617// view. Trace block only shown outside production.
79136bbClaude618app.onError((err, c) => {
80bed05Claude619 reportError(err, {
620 requestId: c.get("requestId"),
621 path: c.req.path,
622 method: c.req.method,
623 });
c63b860Claude624 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
625 // back to the context value set by request-context middleware.
626 const requestId =
627 c.req.header("x-request-id") ||
628 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude629 const user = c.get("user") ?? null;
c63b860Claude630 const trace =
631 process.env.NODE_ENV !== "production" && err && err.message
632 ? err.message
633 : undefined;
79136bbClaude634 return c.html(
c63b860Claude635 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude636 500
637 );
638});
639
640export default app;