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.tsxBlame728 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";
9aaa128Claude92import deployTargetsRoutes from "./routes/deploy-targets";
90c7531Claude93import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User94import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App95import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User96import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude97import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude98import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude99import advisoriesRoutes from "./routes/advisories";
100import aiChangelogRoutes from "./routes/ai-changelog";
101import aiExplainRoutes from "./routes/ai-explain";
102import aiTestsRoutes from "./routes/ai-tests";
103import askRoutes from "./routes/ask";
38d31d3Claude104import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude105import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude106import billingRoutes from "./routes/billing";
8809b87Claude107import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude108import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude109import codeScanningRoutes from "./routes/code-scanning";
110import commitStatusesRoutes from "./routes/commit-statuses";
111import copilotRoutes from "./routes/copilot";
112import depUpdaterRoutes from "./routes/dep-updater";
113import depsRoutes from "./routes/deps";
114import discussionsRoutes from "./routes/discussions";
115import environmentsRoutes from "./routes/environments";
4bbacbeClaude116import previewsRoutes from "./routes/previews";
79ed944Claude117import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude118import followsRoutes from "./routes/follows";
119import gatesRoutes from "./routes/gates";
120import gistsRoutes from "./routes/gists";
121import graphqlRoutes from "./routes/graphql";
2c2163eClaude122import mcpRoutes from "./routes/mcp";
0316dbbClaude123import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude124import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude125import mergeQueueRoutes from "./routes/merge-queue";
126import mirrorsRoutes from "./routes/mirrors";
127import orgInsightsRoutes from "./routes/org-insights";
128import packagesRoutes from "./routes/packages";
129import packagesApiRoutes from "./routes/packages-api";
130import pagesRoutes from "./routes/pages";
131import projectsRoutes from "./routes/projects";
132import protectedTagsRoutes from "./routes/protected-tags";
133import pwaRoutes from "./routes/pwa";
46d6165Claude134import installRoutes from "./routes/install";
cd4f63bTest User135import dxtRoutes from "./routes/dxt";
662ce86Claude136import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude137import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude138import claudeIntegration from "./routes/claude-integration";
139import connectRoutes from "./routes/connect";
05ab9b1Claude140import pushWatchRoutes from "./routes/push-watch";
141import orgSecretsRoutes from "./routes/org-secrets";
0316dbbClaude142import releasesRoutes from "./routes/releases";
143import requiredChecksRoutes from "./routes/required-checks";
144import rulesetsRoutes from "./routes/rulesets";
145import searchRoutes from "./routes/search";
146import semanticSearchRoutes from "./routes/semantic-search";
147import signingKeysRoutes from "./routes/signing-keys";
148import sponsorsRoutes from "./routes/sponsors";
149import ssoRoutes from "./routes/sso";
46d6165Claude150import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude151import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude152import symbolsRoutes from "./routes/symbols";
153import templatesRoutes from "./routes/templates";
154import trafficRoutes from "./routes/traffic";
155import wikisRoutes from "./routes/wikis";
156import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude157import workflowArtifactsRoutes from "./routes/workflow-artifacts";
158import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude159import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude160import standupRoutes from "./routes/standups";
52ad8b1Claude161import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude162import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User163import playgroundRoutes from "./routes/playground";
a2b3e99Claude164import crossRepoSearchRoutes from "./routes/cross-repo-search";
165import pushNotifRoutes from "./routes/push-notifications";
9fbe6cdClaude166import velocityRoutes from "./routes/velocity";
167import { staleBranchRoutes } from "./routes/stale-branches";
22f43f3Claude168import pulseRoutes from "./routes/pulse";
74d8c4dClaude169import healthScoreRoutes from "./routes/health-score";
170import hotFilesRoutes from "./routes/hot-files";
59b6fb2Claude171import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
172import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude173import { noCache } from "./middleware/no-cache";
79136bbClaude174
2316901Claude175import type { AuthEnv } from "./middleware/auth";
bf19c50Test User176import { softAuth } from "./middleware/auth";
2316901Claude177
178const app = new Hono<AuthEnv>();
79136bbClaude179
3ef4c9dClaude180// Request context (request ID, start time) runs before everything else
181app.use("*", requestContext);
05b973eClaude182// Middleware — compression first (wraps all responses)
183app.use("*", compress());
f1ffd50Claude184
185// ETag middleware — returns 304 Not Modified on unchanged responses.
186// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
187// SSE + the API surface where it would interfere with streaming.
188app.use("*", async (c, next) => {
189 const p = c.req.path;
190 if (
191 p.includes(".git/") ||
192 p.startsWith("/live-events") ||
193 p.startsWith("/api/events/deploy") ||
3c03977Claude194 p.startsWith("/admin/status") ||
195 // PR live co-editing SSE stream — never etag streaming responses.
196 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude197 ) {
198 return next();
199 }
200 return etag()(c, next);
201});
202
203// Cache-Control middleware — sets sensible defaults on public, anonymous
204// requests. Crontech (when wired as our edge layer) and downstream
205// browsers will honor these. Auth'd users get private,no-store
206// automatically — we never cache responses tied to a session.
207app.use("*", async (c, next) => {
208 await next();
209 // Don't overwrite explicit headers set by route handlers — BUT the
210 // ETag middleware unconditionally sets "private, no-cache, must-
211 // revalidate" so we have to treat that specific value as "no
212 // policy chosen yet" and apply ours. Any route that explicitly set
213 // a different cache-control wins.
214 const existing = c.res.headers.get("cache-control");
215 const etagDefault =
216 existing === "private, no-cache, must-revalidate" ||
217 existing === "no-cache";
218 if (existing && !etagDefault) return;
219 // Anything past auth: private + no-store (avoid leaking session
220 // content into shared caches). softAuth runs before this on the
221 // request, but the response side is what we're stamping.
222 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
223 const p = c.req.path;
224 // Always private for known-authed paths regardless of cookie.
225 if (
226 p.startsWith("/admin") ||
227 p.startsWith("/settings") ||
228 p.startsWith("/dashboard") ||
229 p.startsWith("/notifications") ||
230 p.startsWith("/connect/") ||
231 hasSession
232 ) {
233 c.res.headers.set("cache-control", "private, no-store");
234 return;
235 }
236 // Public marketing surfaces — short edge cache, longer browser cache,
237 // stale-while-revalidate so the user never waits on a stale fetch.
238 const isMarketing =
239 p === "/" ||
240 p === "/features" ||
241 p === "/pricing" ||
242 p === "/about" ||
243 p === "/vs-github" ||
244 p === "/explore" ||
245 p === "/help" ||
246 p === "/changelog" ||
247 p.startsWith("/legal/") ||
248 p === "/terms" ||
249 p === "/privacy" ||
250 p === "/acceptable-use" ||
251 p.startsWith("/docs/");
252 if (isMarketing) {
253 c.res.headers.set(
254 "cache-control",
255 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
256 );
257 return;
258 }
259 // Public repo browse pages — cache aggressively. Edge invalidates
260 // on push via the post-receive hook (future Crontech surge purge).
261 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
262 c.res.headers.set(
263 "cache-control",
264 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
265 );
266 return;
267 }
268 // Default: don't cache anything we haven't explicitly opted in.
269 c.res.headers.set("cache-control", "private, no-store");
270});
05b973eClaude271// Logger only on non-git routes to avoid overhead on clone/push
272app.use("*", async (c, next) => {
273 if (c.req.path.includes(".git/")) return next();
274 return logger()(c, next);
275});
79136bbClaude276app.use("/api/*", cors());
bf19c50Test User277// Global softAuth — populates c.get("user") for every downstream middleware
278// + route. This was previously per-route, which meant rate-limit middleware
279// (and anything else inspecting auth state) always saw a null user. Keep
280// individual routes free to add requireAuth on top for hard gating; this
281// just establishes the user object cheaply.
282app.use("*", softAuth);
290ea77Claude283
36cc17aClaude284// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude285// pre-redesign markup. JSON / static assets keep their own cache rules; only
286// text/html responses get the no-cache stamp. Without this, every push to
287// main left users staring at cached 80s-looking pages from before the design
288// landed.
36cc17aClaude289//
290// We deliberately use `private, no-cache, must-revalidate` rather than
291// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
292// which makes every Back/Forward press a cold server round-trip — that
293// contributed to the "every nav feels like a fresh login" UX complaint.
294// `no-cache` still revalidates on direct fetch but lets bfcache hold the
295// page in memory between navigations.
290ea77Claude296app.use("*", async (c, next) => {
297 await next();
298 const ct = c.res.headers.get("content-type") || "";
299 if (ct.startsWith("text/html")) {
36cc17aClaude300 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude301 }
302});
826eccfTest User303// Rate-limit API + auth endpoints.
304//
a41e675Test User305// `/api/*`: 1000/min per IP — generous so an admin clicking around the
306// operator console (or a CDN/proxy concentrating multiple users behind one
307// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
308// rate limits below, not this one.
309//
310// `authedMultiplier` is set but only fires when an upstream middleware has
311// already populated c.get("user") — most app.use() chains apply softAuth
312// per-route, so the multiplier is best-effort. Keep the anonymous base
313// high enough that humans never feel it.
314//
315// Skip-paths: dashboard plumbing endpoints that the layout polls on a
316// fixed cadence and that we don't want consuming any bucket:
317// /api/version — layout polls every 15s
826eccfTest User318// /api/notifications/count — nav bell unread-count fetcher
319// /pwa/vapid-public-key — fetched once per push-notification opt-in
320app.use(
321 "/api/*",
a41e675Test User322 rateLimit(1000, 60_000, "api", {
826eccfTest User323 authedMultiplier: 4,
324 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
325 })
326);
0316dbbClaude327app.use("/login", rateLimit(20, 60_000, "login"));
328app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude329// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
330app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User331// BLOCK Q2 — throttle magic-link sign-in for the same reason.
332app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude333
59b6fb2Claude334// CSRF protection — set token on all requests, validate on mutations
335app.use("*", csrfToken);
336app.use("*", csrfProtect);
337
45e31d0Claude338// Rate limit auth routes
339app.use("/login", authRateLimit);
340app.use("/register", authRateLimit);
341
59b6fb2Claude342// Rate limit git operations
343app.use("/:owner/:repo.git/*", gitRateLimit);
344
345// Rate limit search
346app.use("/:owner/:repo/search", searchRateLimit);
347app.use("/explore", searchRateLimit);
79136bbClaude348
f5b9ef5Claude349// No-cache for HTML — ensures browsers and proxies never serve stale pages.
350// The middleware only stamps text/html responses so static assets keep
351// their own cache policies unchanged.
352app.use("*", noCache);
353
79136bbClaude354// Git Smart HTTP protocol routes (must be before web routes)
355app.route("/", gitRoutes);
356
45e31d0Claude357// REST API v1 (legacy)
79136bbClaude358app.route("/", apiRoutes);
359
52ad8b1Claude360// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
361// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
362// router's catch-shape, and BEFORE adminRoutes so the live /demo page
363// wins over the legacy /demo redirect in src/routes/admin.tsx.
364app.route("/", demoRoutes);
365
0316dbbClaude366// REST API v2 (basePath /api/v2)
367app.route("/", apiV2Routes);
368
e75eddcClaude369// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
370// Mounted alongside apiV2Routes (its own basePath, no path conflict).
371app.route("/", agentsRoutes);
372
ad6d4adClaude373// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
374app.route("/", hookRoutes);
21f8dbdClaude375app.route("/api/events", eventsRoutes);
ad6d4adClaude376
45e31d0Claude377// API documentation
378app.route("/", apiDocsRoutes);
4a80519Claude379app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude380// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
381app.route("/", pullsDashboardRoutes);
e9aa4d8Claude382// Issue command center — global issue dashboard with AI-triage + autopilot signal
383app.route("/", issuesDashboardRoutes);
384// Personal activity timeline — every event across the user's repos, with
385// AI-driven events surfaced separately (the Gluecron differentiator).
386app.route("/", activityRoutes);
387// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
388app.route("/", inboxRoutes);
56801e1Claude389// AI standup feed — daily / weekly Claude-generated team brief
390app.route("/", standupRoutes);
79136bbClaude391
392// Auth routes (register, login, logout)
393app.route("/", authRoutes);
394
c63b860Claude395// BLOCK P1 — Password reset (forgot-password + reset-password)
396app.route("/", passwordResetRoutes);
397
398// BLOCK P2 — Email verification (verify-email + resend)
399app.route("/", emailVerificationRoutes);
400
cd4f63bTest User401// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
402app.route("/", magicLinkRoutes);
403
79136bbClaude404// Settings routes (profile, SSH keys)
405app.route("/", settingsRoutes);
406
7298a17Claude407// 2FA / TOTP settings (Block B4)
408app.route("/", settings2faRoutes);
409
e75eddcClaude410// Agent multiplayer — /settings/agents management UI
411app.route("/", settingsAgentsRoutes);
412
1d4ff60Claude413// Chat integrations — Slack / Discord / Teams (/settings/integrations
414// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
415app.route("/", settingsIntegrationsRoutes);
416app.route("/", integrationsChatRoutes);
417
2df1f8cClaude418// WebAuthn / passkey routes (Block B5)
419app.route("/", passkeyRoutes);
420
058d752Claude421// OAuth 2.0 provider (Block B6)
422app.route("/", oauthRoutes);
423app.route("/", developerAppsRoutes);
424
6fc53bdClaude425// Theme toggle (dark/light cookie)
426app.route("/", themeRoutes);
427
428// Audit log UI
429app.route("/", auditRoutes);
430
431// Reactions API (issues, PRs, comments)
432app.route("/", reactionRoutes);
433
24cf2caClaude434// Saved replies (per-user canned comment templates)
435app.route("/", savedReplyRoutes);
436
437// Environments + deployment history UI
438app.route("/", deploymentRoutes);
439
6563f0aClaude440// Organizations + teams (Block B1)
441app.route("/", orgRoutes);
442
c81ab7aClaude443// API tokens
444app.route("/", tokenRoutes);
445
59b6fb2Claude446// Notifications
3ef4c9dClaude447app.route("/", notificationRoutes);
448
79136bbClaude449// Repo settings (description, visibility, delete)
450app.route("/", repoSettings);
451
23d1a81Claude452// Repo collaborators (add/list/remove)
453app.route("/", collaboratorRoutes);
454
04f6b7fClaude455// Team-based repo collaborators (invite a whole team)
456app.route("/", teamCollaboratorRoutes);
457
458// Collaborator invite accept flow (token-based)
459app.route("/", invitesRoutes);
460
461// Real-time SSE endpoint (topic-based live updates)
462app.route("/", liveEventsRoutes);
463
3c03977Claude464// PR live co-editing — presence + cursors + content sync via SSE.
465app.route("/", prLiveRoutes);
466
c81ab7aClaude467// Webhooks management
468app.route("/", webhookRoutes);
469
79136bbClaude470// Compare view (branch diffs)
471app.route("/", compareRoutes);
472
473// Issue tracker
474app.route("/", issueRoutes);
475
cb5a796Claude476// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
477// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
478// the `/:owner/:repo/comments/*` paths resolve before the broader PR
479// patterns kick in.
480app.route("/", commentModerationRoutes);
481
0074234Claude482// Pull requests
483app.route("/", pullRoutes);
79ed944Claude484// PR sandboxes — runnable per-PR environments. Migration 0067.
485app.route("/", prSandboxRoutes);
0074234Claude486
9b3a183Claude487// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
488app.route("/", devEnvRoutes);
489
c81ab7aClaude490// Fork
491app.route("/", forkRoutes);
492
0074234Claude493// Web file editor
494app.route("/", editorRoutes);
495
43de941Claude496// Contributors
497app.route("/", contributorRoutes);
498
699e5c7Claude499// Health liveness + metrics endpoints
2c34075Claude500app.route("/", healthRoutes);
501
f295f78Dictation App502// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
503app.route("/api/platform-status", platformStatus);
504
52ad8b1Claude505// Block L4 — Public stats counters (powers landing-page social proof)
506app.route("/", publicStatsRoutes);
507
508// Block L3 — Live /demo page + /api/v2/demo/* endpoints
509app.route("/", demoRoutes);
510
2316be6Claude511// Public /status — human-readable platform health page
512app.route("/", statusRoutes);
513
b1be050CC LABS App514// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
515// Mounted near the public status route so the two surfaces are visible
516// side-by-side; routes are gated by isSiteAdmin internally.
517app.route("/", adminStatusRoutes);
518
80bed05Claude519// /help — quickstart + API cheatsheet
520app.route("/", helpRoutes);
521
5f2e749Claude522// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
523// so the new editorial pricing layout wins the route; the legacy marketing
524// pricing remains as a safety net but is shadowed at the router.
525app.route("/", pricingRoutes);
526
b0148e9Claude527// /pricing, /features, /about — marketing surface
528app.route("/", marketingRoutes);
529
5618f9aClaude530// SEO: robots.txt + sitemap.xml
531app.route("/", seoRoutes);
532
05cdb85Claude533// /api/version — live build SHA + uptime; client poller uses this to
534// surface 'New version available — reload' banners on deploy.
535app.route("/", versionRoutes);
536
699e5c7Claude537// Health dashboard (per-repo health page)
538app.route("/", healthDashboardRoutes);
539
9dd96b9Test User540// Block R1 — site-admin operations console. MUST be mounted BEFORE
541// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
542// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
543app.route("/", adminOpsRoutes);
f2c00b4CC LABS App544// BLOCK W — Self-host status + bootstrap dashboard.
545app.route("/", adminSelfHostRoutes);
826eccfTest User546// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
547app.route("/", adminDiagnoseRoutes);
9dd96b9Test User548
16b325cClaude549// Insights (time-travel, dependencies, rollback)
550app.route("/", insightRoutes);
551
8d1483cClaude552// DORA metrics page (/:owner/:repo/insights/dora)
553app.route("/", doraRoutes);
554
f1ab587Claude555// Command center dashboard
556app.route("/", dashboardRoutes);
557
36b4cbdClaude558// Legal pages (terms, privacy, AUP)
559app.route("/", legalRoutes);
4b66018Claude560// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
561// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
562// /acceptable-use); these are the formal versions that the legal pages
563// internally link to each other.
564app.route("/", legalTermsRoutes);
565app.route("/", legalPrivacyRoutes);
566app.route("/", legalAcceptableUseRoutes);
567app.route("/", legalDmcaRoutes);
36b4cbdClaude568
bdbd0deClaude569// GitHub import / migration
570app.route("/", importRoutes);
14c3cc8Claude571app.route("/", importBulkRoutes);
f390cfaCC LABS App572app.route("/", importSecretsRoutes);
14c3cc8Claude573app.route("/", migrationRoutes);
574
575// Spec-to-PR (experimental AI-generated draft PRs)
576app.route("/", specsRoutes);
23d0abfClaude577app.route("/", refactorRoutes);
bdbd0deClaude578
c81ab7aClaude579// Explore page
580app.route("/", exploreRoutes);
581
59b6fb2Claude582// Onboarding
583app.route("/", onboardingRoutes);
584
0316dbbClaude585// Admin + feature routes
586app.route("/", adminRoutes);
509c376Claude587app.route("/", adminIntegrationsRoutes);
79ed944Claude588app.route("/", adminAdvancementRoutes);
f764c07Claude589app.route("/", adminDeploysRoutes);
590app.route("/", adminDeploysPageRoutes);
783dd46Claude591app.route("/", adminServerTargetsRoutes);
9aaa128Claude592app.route("/", deployTargetsRoutes);
90c7531Claude593app.route("/", claudeWebRoutes);
9dd96b9Test User594// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude595app.route("/", advisoriesRoutes);
596app.route("/", aiChangelogRoutes);
597app.route("/", aiExplainRoutes);
598app.route("/", aiTestsRoutes);
599app.route("/", askRoutes);
38d31d3Claude600app.route("/", repoChatRoutes);
ee7e577Claude601// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
602// repoChatRoutes so the two surfaces share the catch-all priority.
603app.route("/", personalChatRoutes);
0316dbbClaude604app.route("/", billingRoutes);
8809b87Claude605app.route("/", billingUsageRoutes);
6778ad2Claude606app.route("/", stripeWebhookRoutes);
0316dbbClaude607app.route("/", codeScanningRoutes);
608app.route("/", commitStatusesRoutes);
609app.route("/", copilotRoutes);
610app.route("/", depUpdaterRoutes);
611app.route("/", depsRoutes);
612app.route("/", discussionsRoutes);
613app.route("/", environmentsRoutes);
4bbacbeClaude614app.route("/", previewsRoutes);
79ed944Claude615app.route("/", docsTrackingRoutes);
0316dbbClaude616app.route("/", followsRoutes);
617app.route("/", gatesRoutes);
618app.route("/", gistsRoutes);
619app.route("/", graphqlRoutes);
2c2163eClaude620app.route("/", mcpRoutes);
0316dbbClaude621app.route("/", marketplaceRoutes);
5ca514aClaude622app.route("/", marketplaceAgentsRoutes);
0316dbbClaude623app.route("/", mergeQueueRoutes);
624app.route("/", mirrorsRoutes);
625app.route("/", orgInsightsRoutes);
626app.route("/", packagesRoutes);
627app.route("/", packagesApiRoutes);
628app.route("/", pagesRoutes);
629app.route("/", projectsRoutes);
630app.route("/", protectedTagsRoutes);
631app.route("/", pwaRoutes);
46d6165Claude632app.route("/", installRoutes);
cd4f63bTest User633// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
634app.route("/", dxtRoutes);
662ce86Claude635// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
636// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
637app.route("/", connectClaudeRoutes);
f5b9ef5Claude638// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
639app.route("/", claudeIntegration);
640// Connect guide — public onboarding page (/connect/claude-guide).
641app.route("/", connectRoutes);
05ab9b1Claude642// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
643app.route("/", pushWatchRoutes);
644// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
645app.route("/", orgSecretsRoutes);
a2b3e99Claude646// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
647app.route("/", crossRepoSearchRoutes);
648// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
649app.route("/", pushNotifRoutes);
9fbe6cdClaude650// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
651app.route("/", velocityRoutes);
652// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
653app.route("/", staleBranchRoutes);
22f43f3Claude654// Repository Pulse — BLOCK M12 — /:owner/:repo/pulse
655app.route("/", pulseRoutes);
74d8c4dClaude656// Repository Health Score — BLOCK M14 — /:owner/:repo/insights/health
657app.route("/", healthScoreRoutes);
658// Hot Files Heatmap — BLOCK M16 — /:owner/:repo/insights/hotfiles
659app.route("/", hotFilesRoutes);
ebbb527Claude660// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
661// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
662app.route("/", claudeDeployRoutes);
0316dbbClaude663app.route("/", releasesRoutes);
664app.route("/", requiredChecksRoutes);
665app.route("/", rulesetsRoutes);
666app.route("/", searchRoutes);
667app.route("/", semanticSearchRoutes);
668app.route("/", signingKeysRoutes);
669app.route("/", sponsorsRoutes);
670app.route("/", ssoRoutes);
46d6165Claude671app.route("/", githubOauthRoutes);
582cdacClaude672app.route("/", googleOauthRoutes);
0316dbbClaude673app.route("/", symbolsRoutes);
674app.route("/", templatesRoutes);
675app.route("/", trafficRoutes);
676app.route("/", wikisRoutes);
677app.route("/", workflowsRoutes);
5ff9cc2Claude678app.route("/", workflowArtifactsRoutes);
679app.route("/", workflowSecretsRoutes);
46d6165Claude680app.route("/", sleepModeRoutes);
52ad8b1Claude681app.route("/", vsGithubRoutes);
0316dbbClaude682
45f3b73Claude683// Voice-to-PR — phone-first dictation → spec or issue
684app.route("/", voiceRoutes);
685
cd4f63bTest User686// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
687// before the web catch-all so the bare `/play` literal wins over the
688// `/:owner` user-profile route.
689app.route("/", playgroundRoutes);
690
79136bbClaude691// Web UI (catch-all, must be last)
692app.route("/", webRoutes);
693
c63b860Claude694// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
695// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude696app.notFound((c) => {
36cc17aClaude697 const user = c.get("user") ?? null;
79136bbClaude698 return c.html(
c63b860Claude699 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude700 404
701 );
702});
703
c63b860Claude704// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
705// view. Trace block only shown outside production.
79136bbClaude706app.onError((err, c) => {
80bed05Claude707 reportError(err, {
708 requestId: c.get("requestId"),
709 path: c.req.path,
710 method: c.req.method,
711 });
c63b860Claude712 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
713 // back to the context value set by request-context middleware.
714 const requestId =
715 c.req.header("x-request-id") ||
716 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude717 const user = c.get("user") ?? null;
c63b860Claude718 const trace =
719 process.env.NODE_ENV !== "production" && err && err.message
720 ? err.message
721 : undefined;
79136bbClaude722 return c.html(
c63b860Claude723 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude724 500
725 );
726});
727
728export default app;