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.tsxBlame717 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";
1d4ff60Claude27import settingsIntegrationsRoutes from "./routes/settings-integrations";
28import integrationsChatRoutes from "./routes/integrations-chat";
e75eddcClaude29import agentsRoutes from "./routes/agents";
79136bbClaude30import issueRoutes from "./routes/issues";
cb5a796Claude31import commentModerationRoutes from "./routes/comment-moderation";
79136bbClaude32import repoSettings from "./routes/repo-settings";
23d1a81Claude33import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude34import teamCollaboratorRoutes from "./routes/team-collaborators";
35import invitesRoutes from "./routes/invites";
36import liveEventsRoutes from "./routes/live-events";
3c03977Claude37import prLiveRoutes from "./routes/pr-live";
79136bbClaude38import compareRoutes from "./routes/compare";
0074234Claude39import pullRoutes from "./routes/pulls";
79ed944Claude40import prSandboxRoutes from "./routes/pr-sandbox";
9b3a183Claude41import devEnvRoutes from "./routes/dev-env";
0074234Claude42import editorRoutes from "./routes/editor";
c81ab7aClaude43import forkRoutes from "./routes/fork";
44import webhookRoutes from "./routes/webhooks";
45import exploreRoutes from "./routes/explore";
46import tokenRoutes from "./routes/tokens";
43de941Claude47import contributorRoutes from "./routes/contributors";
699e5c7Claude48import healthRoutes from "./routes/health-probe";
49import healthDashboardRoutes from "./routes/health";
2316be6Claude50import statusRoutes from "./routes/status";
b1be050CC LABS App51import adminStatusRoutes from "./routes/admin-status";
80bed05Claude52import helpRoutes from "./routes/help";
b0148e9Claude53import marketingRoutes from "./routes/marketing";
5f2e749Claude54import pricingRoutes from "./routes/pricing";
5618f9aClaude55import seoRoutes from "./routes/seo";
05cdb85Claude56import versionRoutes from "./routes/version";
f295f78Dictation App57import { platformStatus } from "./routes/platform-status";
52ad8b1Claude58import publicStatsRoutes from "./routes/public-stats";
59import demoRoutes from "./routes/demo";
16b325cClaude60import insightRoutes from "./routes/insights";
8d1483cClaude61import doraRoutes from "./routes/dora";
f1ab587Claude62import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude63import legalRoutes from "./routes/legal";
4b66018Claude64import legalDmcaRoutes from "./routes/legal/dmca";
65import legalTermsRoutes from "./routes/legal/terms";
66import legalPrivacyRoutes from "./routes/legal/privacy";
67import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude68import importRoutes from "./routes/import";
14c3cc8Claude69import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App70import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude71import migrationRoutes from "./routes/migrations";
72import specsRoutes from "./routes/specs";
23d0abfClaude73import refactorRoutes from "./routes/refactors";
79136bbClaude74import webRoutes from "./routes/web";
0316dbbClaude75import hookRoutes from "./routes/hooks";
76import eventsRoutes from "./routes/events";
77import passkeyRoutes from "./routes/passkeys";
78import oauthRoutes from "./routes/oauth";
79import developerAppsRoutes from "./routes/developer-apps";
80import themeRoutes from "./routes/theme";
81import auditRoutes from "./routes/audit";
82import reactionRoutes from "./routes/reactions";
83import savedReplyRoutes from "./routes/saved-replies";
84import deploymentRoutes from "./routes/deployments";
85import orgRoutes from "./routes/orgs";
86import notificationRoutes from "./routes/notifications";
87import onboardingRoutes from "./routes/onboarding";
88import adminRoutes from "./routes/admin";
f764c07Claude89import adminDeploysRoutes from "./routes/admin-deploys";
90import adminDeploysPageRoutes from "./routes/admin-deploys-page";
783dd46Claude91import adminServerTargetsRoutes from "./routes/admin-server-targets";
90c7531Claude92import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User93import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App94import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User95import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude96import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude97import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude98import advisoriesRoutes from "./routes/advisories";
99import aiChangelogRoutes from "./routes/ai-changelog";
100import aiExplainRoutes from "./routes/ai-explain";
101import aiTestsRoutes from "./routes/ai-tests";
102import askRoutes from "./routes/ask";
38d31d3Claude103import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude104import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude105import billingRoutes from "./routes/billing";
8809b87Claude106import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude107import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude108import codeScanningRoutes from "./routes/code-scanning";
109import commitStatusesRoutes from "./routes/commit-statuses";
110import copilotRoutes from "./routes/copilot";
111import depUpdaterRoutes from "./routes/dep-updater";
112import depsRoutes from "./routes/deps";
113import discussionsRoutes from "./routes/discussions";
114import environmentsRoutes from "./routes/environments";
4bbacbeClaude115import previewsRoutes from "./routes/previews";
79ed944Claude116import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude117import followsRoutes from "./routes/follows";
118import gatesRoutes from "./routes/gates";
119import gistsRoutes from "./routes/gists";
120import graphqlRoutes from "./routes/graphql";
2c2163eClaude121import mcpRoutes from "./routes/mcp";
0316dbbClaude122import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude123import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude124import mergeQueueRoutes from "./routes/merge-queue";
125import mirrorsRoutes from "./routes/mirrors";
126import orgInsightsRoutes from "./routes/org-insights";
127import packagesRoutes from "./routes/packages";
128import packagesApiRoutes from "./routes/packages-api";
129import pagesRoutes from "./routes/pages";
130import projectsRoutes from "./routes/projects";
131import protectedTagsRoutes from "./routes/protected-tags";
132import pwaRoutes from "./routes/pwa";
46d6165Claude133import installRoutes from "./routes/install";
cd4f63bTest User134import dxtRoutes from "./routes/dxt";
662ce86Claude135import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude136import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude137import claudeIntegration from "./routes/claude-integration";
138import connectRoutes from "./routes/connect";
05ab9b1Claude139import pushWatchRoutes from "./routes/push-watch";
140import orgSecretsRoutes from "./routes/org-secrets";
0316dbbClaude141import releasesRoutes from "./routes/releases";
142import requiredChecksRoutes from "./routes/required-checks";
143import rulesetsRoutes from "./routes/rulesets";
144import searchRoutes from "./routes/search";
145import semanticSearchRoutes from "./routes/semantic-search";
146import signingKeysRoutes from "./routes/signing-keys";
147import sponsorsRoutes from "./routes/sponsors";
148import ssoRoutes from "./routes/sso";
46d6165Claude149import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude150import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude151import symbolsRoutes from "./routes/symbols";
152import templatesRoutes from "./routes/templates";
153import trafficRoutes from "./routes/traffic";
154import wikisRoutes from "./routes/wikis";
155import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude156import workflowArtifactsRoutes from "./routes/workflow-artifacts";
157import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude158import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude159import standupRoutes from "./routes/standups";
52ad8b1Claude160import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude161import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User162import playgroundRoutes from "./routes/playground";
a2b3e99Claude163import crossRepoSearchRoutes from "./routes/cross-repo-search";
164import pushNotifRoutes from "./routes/push-notifications";
9fbe6cdClaude165import velocityRoutes from "./routes/velocity";
166import { staleBranchRoutes } from "./routes/stale-branches";
59b6fb2Claude167import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
168import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude169import { noCache } from "./middleware/no-cache";
79136bbClaude170
2316901Claude171import type { AuthEnv } from "./middleware/auth";
bf19c50Test User172import { softAuth } from "./middleware/auth";
2316901Claude173
174const app = new Hono<AuthEnv>();
79136bbClaude175
3ef4c9dClaude176// Request context (request ID, start time) runs before everything else
177app.use("*", requestContext);
05b973eClaude178// Middleware — compression first (wraps all responses)
179app.use("*", compress());
f1ffd50Claude180
181// ETag middleware — returns 304 Not Modified on unchanged responses.
182// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
183// SSE + the API surface where it would interfere with streaming.
184app.use("*", async (c, next) => {
185 const p = c.req.path;
186 if (
187 p.includes(".git/") ||
188 p.startsWith("/live-events") ||
189 p.startsWith("/api/events/deploy") ||
3c03977Claude190 p.startsWith("/admin/status") ||
191 // PR live co-editing SSE stream — never etag streaming responses.
192 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude193 ) {
194 return next();
195 }
196 return etag()(c, next);
197});
198
199// Cache-Control middleware — sets sensible defaults on public, anonymous
200// requests. Crontech (when wired as our edge layer) and downstream
201// browsers will honor these. Auth'd users get private,no-store
202// automatically — we never cache responses tied to a session.
203app.use("*", async (c, next) => {
204 await next();
205 // Don't overwrite explicit headers set by route handlers — BUT the
206 // ETag middleware unconditionally sets "private, no-cache, must-
207 // revalidate" so we have to treat that specific value as "no
208 // policy chosen yet" and apply ours. Any route that explicitly set
209 // a different cache-control wins.
210 const existing = c.res.headers.get("cache-control");
211 const etagDefault =
212 existing === "private, no-cache, must-revalidate" ||
213 existing === "no-cache";
214 if (existing && !etagDefault) return;
215 // Anything past auth: private + no-store (avoid leaking session
216 // content into shared caches). softAuth runs before this on the
217 // request, but the response side is what we're stamping.
218 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
219 const p = c.req.path;
220 // Always private for known-authed paths regardless of cookie.
221 if (
222 p.startsWith("/admin") ||
223 p.startsWith("/settings") ||
224 p.startsWith("/dashboard") ||
225 p.startsWith("/notifications") ||
226 p.startsWith("/connect/") ||
227 hasSession
228 ) {
229 c.res.headers.set("cache-control", "private, no-store");
230 return;
231 }
232 // Public marketing surfaces — short edge cache, longer browser cache,
233 // stale-while-revalidate so the user never waits on a stale fetch.
234 const isMarketing =
235 p === "/" ||
236 p === "/features" ||
237 p === "/pricing" ||
238 p === "/about" ||
239 p === "/vs-github" ||
240 p === "/explore" ||
241 p === "/help" ||
242 p === "/changelog" ||
243 p.startsWith("/legal/") ||
244 p === "/terms" ||
245 p === "/privacy" ||
246 p === "/acceptable-use" ||
247 p.startsWith("/docs/");
248 if (isMarketing) {
249 c.res.headers.set(
250 "cache-control",
251 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
252 );
253 return;
254 }
255 // Public repo browse pages — cache aggressively. Edge invalidates
256 // on push via the post-receive hook (future Crontech surge purge).
257 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
258 c.res.headers.set(
259 "cache-control",
260 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
261 );
262 return;
263 }
264 // Default: don't cache anything we haven't explicitly opted in.
265 c.res.headers.set("cache-control", "private, no-store");
266});
05b973eClaude267// Logger only on non-git routes to avoid overhead on clone/push
268app.use("*", async (c, next) => {
269 if (c.req.path.includes(".git/")) return next();
270 return logger()(c, next);
271});
79136bbClaude272app.use("/api/*", cors());
bf19c50Test User273// Global softAuth — populates c.get("user") for every downstream middleware
274// + route. This was previously per-route, which meant rate-limit middleware
275// (and anything else inspecting auth state) always saw a null user. Keep
276// individual routes free to add requireAuth on top for hard gating; this
277// just establishes the user object cheaply.
278app.use("*", softAuth);
290ea77Claude279
36cc17aClaude280// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude281// pre-redesign markup. JSON / static assets keep their own cache rules; only
282// text/html responses get the no-cache stamp. Without this, every push to
283// main left users staring at cached 80s-looking pages from before the design
284// landed.
36cc17aClaude285//
286// We deliberately use `private, no-cache, must-revalidate` rather than
287// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
288// which makes every Back/Forward press a cold server round-trip — that
289// contributed to the "every nav feels like a fresh login" UX complaint.
290// `no-cache` still revalidates on direct fetch but lets bfcache hold the
291// page in memory between navigations.
290ea77Claude292app.use("*", async (c, next) => {
293 await next();
294 const ct = c.res.headers.get("content-type") || "";
295 if (ct.startsWith("text/html")) {
36cc17aClaude296 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude297 }
298});
826eccfTest User299// Rate-limit API + auth endpoints.
300//
a41e675Test User301// `/api/*`: 1000/min per IP — generous so an admin clicking around the
302// operator console (or a CDN/proxy concentrating multiple users behind one
303// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
304// rate limits below, not this one.
305//
306// `authedMultiplier` is set but only fires when an upstream middleware has
307// already populated c.get("user") — most app.use() chains apply softAuth
308// per-route, so the multiplier is best-effort. Keep the anonymous base
309// high enough that humans never feel it.
310//
311// Skip-paths: dashboard plumbing endpoints that the layout polls on a
312// fixed cadence and that we don't want consuming any bucket:
313// /api/version — layout polls every 15s
826eccfTest User314// /api/notifications/count — nav bell unread-count fetcher
315// /pwa/vapid-public-key — fetched once per push-notification opt-in
316app.use(
317 "/api/*",
a41e675Test User318 rateLimit(1000, 60_000, "api", {
826eccfTest User319 authedMultiplier: 4,
320 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
321 })
322);
0316dbbClaude323app.use("/login", rateLimit(20, 60_000, "login"));
324app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude325// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
326app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User327// BLOCK Q2 — throttle magic-link sign-in for the same reason.
328app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude329
59b6fb2Claude330// CSRF protection — set token on all requests, validate on mutations
331app.use("*", csrfToken);
332app.use("*", csrfProtect);
333
45e31d0Claude334// Rate limit auth routes
335app.use("/login", authRateLimit);
336app.use("/register", authRateLimit);
337
59b6fb2Claude338// Rate limit git operations
339app.use("/:owner/:repo.git/*", gitRateLimit);
340
341// Rate limit search
342app.use("/:owner/:repo/search", searchRateLimit);
343app.use("/explore", searchRateLimit);
79136bbClaude344
f5b9ef5Claude345// No-cache for HTML — ensures browsers and proxies never serve stale pages.
346// The middleware only stamps text/html responses so static assets keep
347// their own cache policies unchanged.
348app.use("*", noCache);
349
79136bbClaude350// Git Smart HTTP protocol routes (must be before web routes)
351app.route("/", gitRoutes);
352
45e31d0Claude353// REST API v1 (legacy)
79136bbClaude354app.route("/", apiRoutes);
355
52ad8b1Claude356// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
357// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
358// router's catch-shape, and BEFORE adminRoutes so the live /demo page
359// wins over the legacy /demo redirect in src/routes/admin.tsx.
360app.route("/", demoRoutes);
361
0316dbbClaude362// REST API v2 (basePath /api/v2)
363app.route("/", apiV2Routes);
364
e75eddcClaude365// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
366// Mounted alongside apiV2Routes (its own basePath, no path conflict).
367app.route("/", agentsRoutes);
368
ad6d4adClaude369// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
370app.route("/", hookRoutes);
21f8dbdClaude371app.route("/api/events", eventsRoutes);
ad6d4adClaude372
45e31d0Claude373// API documentation
374app.route("/", apiDocsRoutes);
4a80519Claude375app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude376// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
377app.route("/", pullsDashboardRoutes);
e9aa4d8Claude378// Issue command center — global issue dashboard with AI-triage + autopilot signal
379app.route("/", issuesDashboardRoutes);
380// Personal activity timeline — every event across the user's repos, with
381// AI-driven events surfaced separately (the Gluecron differentiator).
382app.route("/", activityRoutes);
383// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
384app.route("/", inboxRoutes);
56801e1Claude385// AI standup feed — daily / weekly Claude-generated team brief
386app.route("/", standupRoutes);
79136bbClaude387
388// Auth routes (register, login, logout)
389app.route("/", authRoutes);
390
c63b860Claude391// BLOCK P1 — Password reset (forgot-password + reset-password)
392app.route("/", passwordResetRoutes);
393
394// BLOCK P2 — Email verification (verify-email + resend)
395app.route("/", emailVerificationRoutes);
396
cd4f63bTest User397// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
398app.route("/", magicLinkRoutes);
399
79136bbClaude400// Settings routes (profile, SSH keys)
401app.route("/", settingsRoutes);
402
7298a17Claude403// 2FA / TOTP settings (Block B4)
404app.route("/", settings2faRoutes);
405
e75eddcClaude406// Agent multiplayer — /settings/agents management UI
407app.route("/", settingsAgentsRoutes);
408
1d4ff60Claude409// Chat integrations — Slack / Discord / Teams (/settings/integrations
410// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
411app.route("/", settingsIntegrationsRoutes);
412app.route("/", integrationsChatRoutes);
413
2df1f8cClaude414// WebAuthn / passkey routes (Block B5)
415app.route("/", passkeyRoutes);
416
058d752Claude417// OAuth 2.0 provider (Block B6)
418app.route("/", oauthRoutes);
419app.route("/", developerAppsRoutes);
420
6fc53bdClaude421// Theme toggle (dark/light cookie)
422app.route("/", themeRoutes);
423
424// Audit log UI
425app.route("/", auditRoutes);
426
427// Reactions API (issues, PRs, comments)
428app.route("/", reactionRoutes);
429
24cf2caClaude430// Saved replies (per-user canned comment templates)
431app.route("/", savedReplyRoutes);
432
433// Environments + deployment history UI
434app.route("/", deploymentRoutes);
435
6563f0aClaude436// Organizations + teams (Block B1)
437app.route("/", orgRoutes);
438
c81ab7aClaude439// API tokens
440app.route("/", tokenRoutes);
441
59b6fb2Claude442// Notifications
3ef4c9dClaude443app.route("/", notificationRoutes);
444
79136bbClaude445// Repo settings (description, visibility, delete)
446app.route("/", repoSettings);
447
23d1a81Claude448// Repo collaborators (add/list/remove)
449app.route("/", collaboratorRoutes);
450
04f6b7fClaude451// Team-based repo collaborators (invite a whole team)
452app.route("/", teamCollaboratorRoutes);
453
454// Collaborator invite accept flow (token-based)
455app.route("/", invitesRoutes);
456
457// Real-time SSE endpoint (topic-based live updates)
458app.route("/", liveEventsRoutes);
459
3c03977Claude460// PR live co-editing — presence + cursors + content sync via SSE.
461app.route("/", prLiveRoutes);
462
c81ab7aClaude463// Webhooks management
464app.route("/", webhookRoutes);
465
79136bbClaude466// Compare view (branch diffs)
467app.route("/", compareRoutes);
468
469// Issue tracker
470app.route("/", issueRoutes);
471
cb5a796Claude472// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
473// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
474// the `/:owner/:repo/comments/*` paths resolve before the broader PR
475// patterns kick in.
476app.route("/", commentModerationRoutes);
477
0074234Claude478// Pull requests
479app.route("/", pullRoutes);
79ed944Claude480// PR sandboxes — runnable per-PR environments. Migration 0067.
481app.route("/", prSandboxRoutes);
0074234Claude482
9b3a183Claude483// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
484app.route("/", devEnvRoutes);
485
c81ab7aClaude486// Fork
487app.route("/", forkRoutes);
488
0074234Claude489// Web file editor
490app.route("/", editorRoutes);
491
43de941Claude492// Contributors
493app.route("/", contributorRoutes);
494
699e5c7Claude495// Health liveness + metrics endpoints
2c34075Claude496app.route("/", healthRoutes);
497
f295f78Dictation App498// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
499app.route("/api/platform-status", platformStatus);
500
52ad8b1Claude501// Block L4 — Public stats counters (powers landing-page social proof)
502app.route("/", publicStatsRoutes);
503
504// Block L3 — Live /demo page + /api/v2/demo/* endpoints
505app.route("/", demoRoutes);
506
2316be6Claude507// Public /status — human-readable platform health page
508app.route("/", statusRoutes);
509
b1be050CC LABS App510// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
511// Mounted near the public status route so the two surfaces are visible
512// side-by-side; routes are gated by isSiteAdmin internally.
513app.route("/", adminStatusRoutes);
514
80bed05Claude515// /help — quickstart + API cheatsheet
516app.route("/", helpRoutes);
517
5f2e749Claude518// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
519// so the new editorial pricing layout wins the route; the legacy marketing
520// pricing remains as a safety net but is shadowed at the router.
521app.route("/", pricingRoutes);
522
b0148e9Claude523// /pricing, /features, /about — marketing surface
524app.route("/", marketingRoutes);
525
5618f9aClaude526// SEO: robots.txt + sitemap.xml
527app.route("/", seoRoutes);
528
05cdb85Claude529// /api/version — live build SHA + uptime; client poller uses this to
530// surface 'New version available — reload' banners on deploy.
531app.route("/", versionRoutes);
532
699e5c7Claude533// Health dashboard (per-repo health page)
534app.route("/", healthDashboardRoutes);
535
9dd96b9Test User536// Block R1 — site-admin operations console. MUST be mounted BEFORE
537// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
538// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
539app.route("/", adminOpsRoutes);
f2c00b4CC LABS App540// BLOCK W — Self-host status + bootstrap dashboard.
541app.route("/", adminSelfHostRoutes);
826eccfTest User542// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
543app.route("/", adminDiagnoseRoutes);
9dd96b9Test User544
16b325cClaude545// Insights (time-travel, dependencies, rollback)
546app.route("/", insightRoutes);
547
8d1483cClaude548// DORA metrics page (/:owner/:repo/insights/dora)
549app.route("/", doraRoutes);
550
f1ab587Claude551// Command center dashboard
552app.route("/", dashboardRoutes);
553
36b4cbdClaude554// Legal pages (terms, privacy, AUP)
555app.route("/", legalRoutes);
4b66018Claude556// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
557// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
558// /acceptable-use); these are the formal versions that the legal pages
559// internally link to each other.
560app.route("/", legalTermsRoutes);
561app.route("/", legalPrivacyRoutes);
562app.route("/", legalAcceptableUseRoutes);
563app.route("/", legalDmcaRoutes);
36b4cbdClaude564
bdbd0deClaude565// GitHub import / migration
566app.route("/", importRoutes);
14c3cc8Claude567app.route("/", importBulkRoutes);
f390cfaCC LABS App568app.route("/", importSecretsRoutes);
14c3cc8Claude569app.route("/", migrationRoutes);
570
571// Spec-to-PR (experimental AI-generated draft PRs)
572app.route("/", specsRoutes);
23d0abfClaude573app.route("/", refactorRoutes);
bdbd0deClaude574
c81ab7aClaude575// Explore page
576app.route("/", exploreRoutes);
577
59b6fb2Claude578// Onboarding
579app.route("/", onboardingRoutes);
580
0316dbbClaude581// Admin + feature routes
582app.route("/", adminRoutes);
509c376Claude583app.route("/", adminIntegrationsRoutes);
79ed944Claude584app.route("/", adminAdvancementRoutes);
f764c07Claude585app.route("/", adminDeploysRoutes);
586app.route("/", adminDeploysPageRoutes);
783dd46Claude587app.route("/", adminServerTargetsRoutes);
90c7531Claude588app.route("/", claudeWebRoutes);
9dd96b9Test User589// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude590app.route("/", advisoriesRoutes);
591app.route("/", aiChangelogRoutes);
592app.route("/", aiExplainRoutes);
593app.route("/", aiTestsRoutes);
594app.route("/", askRoutes);
38d31d3Claude595app.route("/", repoChatRoutes);
ee7e577Claude596// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
597// repoChatRoutes so the two surfaces share the catch-all priority.
598app.route("/", personalChatRoutes);
0316dbbClaude599app.route("/", billingRoutes);
8809b87Claude600app.route("/", billingUsageRoutes);
6778ad2Claude601app.route("/", stripeWebhookRoutes);
0316dbbClaude602app.route("/", codeScanningRoutes);
603app.route("/", commitStatusesRoutes);
604app.route("/", copilotRoutes);
605app.route("/", depUpdaterRoutes);
606app.route("/", depsRoutes);
607app.route("/", discussionsRoutes);
608app.route("/", environmentsRoutes);
4bbacbeClaude609app.route("/", previewsRoutes);
79ed944Claude610app.route("/", docsTrackingRoutes);
0316dbbClaude611app.route("/", followsRoutes);
612app.route("/", gatesRoutes);
613app.route("/", gistsRoutes);
614app.route("/", graphqlRoutes);
2c2163eClaude615app.route("/", mcpRoutes);
0316dbbClaude616app.route("/", marketplaceRoutes);
5ca514aClaude617app.route("/", marketplaceAgentsRoutes);
0316dbbClaude618app.route("/", mergeQueueRoutes);
619app.route("/", mirrorsRoutes);
620app.route("/", orgInsightsRoutes);
621app.route("/", packagesRoutes);
622app.route("/", packagesApiRoutes);
623app.route("/", pagesRoutes);
624app.route("/", projectsRoutes);
625app.route("/", protectedTagsRoutes);
626app.route("/", pwaRoutes);
46d6165Claude627app.route("/", installRoutes);
cd4f63bTest User628// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
629app.route("/", dxtRoutes);
662ce86Claude630// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
631// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
632app.route("/", connectClaudeRoutes);
f5b9ef5Claude633// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
634app.route("/", claudeIntegration);
635// Connect guide — public onboarding page (/connect/claude-guide).
636app.route("/", connectRoutes);
05ab9b1Claude637// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
638app.route("/", pushWatchRoutes);
639// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
640app.route("/", orgSecretsRoutes);
a2b3e99Claude641// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
642app.route("/", crossRepoSearchRoutes);
643// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
644app.route("/", pushNotifRoutes);
9fbe6cdClaude645// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
646app.route("/", velocityRoutes);
647// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
648app.route("/", staleBranchRoutes);
ebbb527Claude649// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
650// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
651app.route("/", claudeDeployRoutes);
0316dbbClaude652app.route("/", releasesRoutes);
653app.route("/", requiredChecksRoutes);
654app.route("/", rulesetsRoutes);
655app.route("/", searchRoutes);
656app.route("/", semanticSearchRoutes);
657app.route("/", signingKeysRoutes);
658app.route("/", sponsorsRoutes);
659app.route("/", ssoRoutes);
46d6165Claude660app.route("/", githubOauthRoutes);
582cdacClaude661app.route("/", googleOauthRoutes);
0316dbbClaude662app.route("/", symbolsRoutes);
663app.route("/", templatesRoutes);
664app.route("/", trafficRoutes);
665app.route("/", wikisRoutes);
666app.route("/", workflowsRoutes);
5ff9cc2Claude667app.route("/", workflowArtifactsRoutes);
668app.route("/", workflowSecretsRoutes);
46d6165Claude669app.route("/", sleepModeRoutes);
52ad8b1Claude670app.route("/", vsGithubRoutes);
0316dbbClaude671
45f3b73Claude672// Voice-to-PR — phone-first dictation → spec or issue
673app.route("/", voiceRoutes);
674
cd4f63bTest User675// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
676// before the web catch-all so the bare `/play` literal wins over the
677// `/:owner` user-profile route.
678app.route("/", playgroundRoutes);
679
79136bbClaude680// Web UI (catch-all, must be last)
681app.route("/", webRoutes);
682
c63b860Claude683// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
684// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude685app.notFound((c) => {
36cc17aClaude686 const user = c.get("user") ?? null;
79136bbClaude687 return c.html(
c63b860Claude688 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude689 404
690 );
691});
692
c63b860Claude693// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
694// view. Trace block only shown outside production.
79136bbClaude695app.onError((err, c) => {
80bed05Claude696 reportError(err, {
697 requestId: c.get("requestId"),
698 path: c.req.path,
699 method: c.req.method,
700 });
c63b860Claude701 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
702 // back to the context value set by request-context middleware.
703 const requestId =
704 c.req.header("x-request-id") ||
705 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude706 const user = c.get("user") ?? null;
c63b860Claude707 const trace =
708 process.env.NODE_ENV !== "production" && err && err.message
709 ? err.message
710 : undefined;
79136bbClaude711 return c.html(
c63b860Claude712 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude713 500
714 );
715});
716
717export default app;