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.tsxBlame732 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";
e1fc7dbClaude53import changelogRoutes from "./routes/changelog";
b0148e9Claude54import marketingRoutes from "./routes/marketing";
5f2e749Claude55import pricingRoutes from "./routes/pricing";
5618f9aClaude56import seoRoutes from "./routes/seo";
05cdb85Claude57import versionRoutes from "./routes/version";
f295f78Dictation App58import { platformStatus } from "./routes/platform-status";
52ad8b1Claude59import publicStatsRoutes from "./routes/public-stats";
60import demoRoutes from "./routes/demo";
16b325cClaude61import insightRoutes from "./routes/insights";
8d1483cClaude62import doraRoutes from "./routes/dora";
f1ab587Claude63import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude64import legalRoutes from "./routes/legal";
4b66018Claude65import legalDmcaRoutes from "./routes/legal/dmca";
66import legalTermsRoutes from "./routes/legal/terms";
67import legalPrivacyRoutes from "./routes/legal/privacy";
68import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude69import importRoutes from "./routes/import";
14c3cc8Claude70import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App71import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude72import migrationRoutes from "./routes/migrations";
73import specsRoutes from "./routes/specs";
23d0abfClaude74import refactorRoutes from "./routes/refactors";
79136bbClaude75import webRoutes from "./routes/web";
0316dbbClaude76import hookRoutes from "./routes/hooks";
77import eventsRoutes from "./routes/events";
78import passkeyRoutes from "./routes/passkeys";
79import oauthRoutes from "./routes/oauth";
80import developerAppsRoutes from "./routes/developer-apps";
81import themeRoutes from "./routes/theme";
82import auditRoutes from "./routes/audit";
83import reactionRoutes from "./routes/reactions";
84import savedReplyRoutes from "./routes/saved-replies";
85import deploymentRoutes from "./routes/deployments";
86import orgRoutes from "./routes/orgs";
87import notificationRoutes from "./routes/notifications";
88import onboardingRoutes from "./routes/onboarding";
89import adminRoutes from "./routes/admin";
f764c07Claude90import adminDeploysRoutes from "./routes/admin-deploys";
91import adminDeploysPageRoutes from "./routes/admin-deploys-page";
783dd46Claude92import adminServerTargetsRoutes from "./routes/admin-server-targets";
9aaa128Claude93import deployTargetsRoutes from "./routes/deploy-targets";
90c7531Claude94import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User95import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App96import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User97import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude98import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude99import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude100import advisoriesRoutes from "./routes/advisories";
101import aiChangelogRoutes from "./routes/ai-changelog";
102import aiExplainRoutes from "./routes/ai-explain";
103import aiTestsRoutes from "./routes/ai-tests";
104import askRoutes from "./routes/ask";
38d31d3Claude105import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude106import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude107import billingRoutes from "./routes/billing";
8809b87Claude108import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude109import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude110import codeScanningRoutes from "./routes/code-scanning";
111import commitStatusesRoutes from "./routes/commit-statuses";
112import copilotRoutes from "./routes/copilot";
113import depUpdaterRoutes from "./routes/dep-updater";
114import depsRoutes from "./routes/deps";
115import discussionsRoutes from "./routes/discussions";
116import environmentsRoutes from "./routes/environments";
4bbacbeClaude117import previewsRoutes from "./routes/previews";
79ed944Claude118import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude119import followsRoutes from "./routes/follows";
120import gatesRoutes from "./routes/gates";
121import gistsRoutes from "./routes/gists";
122import graphqlRoutes from "./routes/graphql";
2c2163eClaude123import mcpRoutes from "./routes/mcp";
0316dbbClaude124import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude125import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude126import mergeQueueRoutes from "./routes/merge-queue";
127import mirrorsRoutes from "./routes/mirrors";
128import orgInsightsRoutes from "./routes/org-insights";
129import packagesRoutes from "./routes/packages";
130import packagesApiRoutes from "./routes/packages-api";
131import pagesRoutes from "./routes/pages";
132import projectsRoutes from "./routes/projects";
133import protectedTagsRoutes from "./routes/protected-tags";
134import pwaRoutes from "./routes/pwa";
46d6165Claude135import installRoutes from "./routes/install";
cd4f63bTest User136import dxtRoutes from "./routes/dxt";
662ce86Claude137import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude138import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude139import claudeIntegration from "./routes/claude-integration";
140import connectRoutes from "./routes/connect";
05ab9b1Claude141import pushWatchRoutes from "./routes/push-watch";
142import orgSecretsRoutes from "./routes/org-secrets";
0316dbbClaude143import releasesRoutes from "./routes/releases";
144import requiredChecksRoutes from "./routes/required-checks";
145import rulesetsRoutes from "./routes/rulesets";
146import searchRoutes from "./routes/search";
147import semanticSearchRoutes from "./routes/semantic-search";
148import signingKeysRoutes from "./routes/signing-keys";
149import sponsorsRoutes from "./routes/sponsors";
150import ssoRoutes from "./routes/sso";
46d6165Claude151import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude152import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude153import symbolsRoutes from "./routes/symbols";
154import templatesRoutes from "./routes/templates";
155import trafficRoutes from "./routes/traffic";
156import wikisRoutes from "./routes/wikis";
157import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude158import workflowArtifactsRoutes from "./routes/workflow-artifacts";
159import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude160import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude161import standupRoutes from "./routes/standups";
52ad8b1Claude162import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude163import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User164import playgroundRoutes from "./routes/playground";
a2b3e99Claude165import crossRepoSearchRoutes from "./routes/cross-repo-search";
166import pushNotifRoutes from "./routes/push-notifications";
9fbe6cdClaude167import velocityRoutes from "./routes/velocity";
168import { staleBranchRoutes } from "./routes/stale-branches";
22f43f3Claude169import pulseRoutes from "./routes/pulse";
74d8c4dClaude170import healthScoreRoutes from "./routes/health-score";
171import hotFilesRoutes from "./routes/hot-files";
59b6fb2Claude172import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
173import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude174import { noCache } from "./middleware/no-cache";
79136bbClaude175
2316901Claude176import type { AuthEnv } from "./middleware/auth";
bf19c50Test User177import { softAuth } from "./middleware/auth";
2316901Claude178
179const app = new Hono<AuthEnv>();
79136bbClaude180
3ef4c9dClaude181// Request context (request ID, start time) runs before everything else
182app.use("*", requestContext);
05b973eClaude183// Middleware — compression first (wraps all responses)
184app.use("*", compress());
f1ffd50Claude185
186// ETag middleware — returns 304 Not Modified on unchanged responses.
187// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
188// SSE + the API surface where it would interfere with streaming.
189app.use("*", async (c, next) => {
190 const p = c.req.path;
191 if (
192 p.includes(".git/") ||
193 p.startsWith("/live-events") ||
194 p.startsWith("/api/events/deploy") ||
3c03977Claude195 p.startsWith("/admin/status") ||
196 // PR live co-editing SSE stream — never etag streaming responses.
197 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude198 ) {
199 return next();
200 }
201 return etag()(c, next);
202});
203
204// Cache-Control middleware — sets sensible defaults on public, anonymous
205// requests. Crontech (when wired as our edge layer) and downstream
206// browsers will honor these. Auth'd users get private,no-store
207// automatically — we never cache responses tied to a session.
208app.use("*", async (c, next) => {
209 await next();
210 // Don't overwrite explicit headers set by route handlers — BUT the
211 // ETag middleware unconditionally sets "private, no-cache, must-
212 // revalidate" so we have to treat that specific value as "no
213 // policy chosen yet" and apply ours. Any route that explicitly set
214 // a different cache-control wins.
215 const existing = c.res.headers.get("cache-control");
216 const etagDefault =
217 existing === "private, no-cache, must-revalidate" ||
218 existing === "no-cache";
219 if (existing && !etagDefault) return;
220 // Anything past auth: private + no-store (avoid leaking session
221 // content into shared caches). softAuth runs before this on the
222 // request, but the response side is what we're stamping.
223 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
224 const p = c.req.path;
225 // Always private for known-authed paths regardless of cookie.
226 if (
227 p.startsWith("/admin") ||
228 p.startsWith("/settings") ||
229 p.startsWith("/dashboard") ||
230 p.startsWith("/notifications") ||
231 p.startsWith("/connect/") ||
232 hasSession
233 ) {
234 c.res.headers.set("cache-control", "private, no-store");
235 return;
236 }
237 // Public marketing surfaces — short edge cache, longer browser cache,
238 // stale-while-revalidate so the user never waits on a stale fetch.
239 const isMarketing =
240 p === "/" ||
241 p === "/features" ||
242 p === "/pricing" ||
243 p === "/about" ||
244 p === "/vs-github" ||
245 p === "/explore" ||
246 p === "/help" ||
247 p === "/changelog" ||
248 p.startsWith("/legal/") ||
249 p === "/terms" ||
250 p === "/privacy" ||
251 p === "/acceptable-use" ||
252 p.startsWith("/docs/");
253 if (isMarketing) {
254 c.res.headers.set(
255 "cache-control",
256 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
257 );
258 return;
259 }
260 // Public repo browse pages — cache aggressively. Edge invalidates
261 // on push via the post-receive hook (future Crontech surge purge).
262 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
263 c.res.headers.set(
264 "cache-control",
265 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
266 );
267 return;
268 }
269 // Default: don't cache anything we haven't explicitly opted in.
270 c.res.headers.set("cache-control", "private, no-store");
271});
05b973eClaude272// Logger only on non-git routes to avoid overhead on clone/push
273app.use("*", async (c, next) => {
274 if (c.req.path.includes(".git/")) return next();
275 return logger()(c, next);
276});
79136bbClaude277app.use("/api/*", cors());
bf19c50Test User278// Global softAuth — populates c.get("user") for every downstream middleware
279// + route. This was previously per-route, which meant rate-limit middleware
280// (and anything else inspecting auth state) always saw a null user. Keep
281// individual routes free to add requireAuth on top for hard gating; this
282// just establishes the user object cheaply.
283app.use("*", softAuth);
290ea77Claude284
36cc17aClaude285// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude286// pre-redesign markup. JSON / static assets keep their own cache rules; only
287// text/html responses get the no-cache stamp. Without this, every push to
288// main left users staring at cached 80s-looking pages from before the design
289// landed.
36cc17aClaude290//
291// We deliberately use `private, no-cache, must-revalidate` rather than
292// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
293// which makes every Back/Forward press a cold server round-trip — that
294// contributed to the "every nav feels like a fresh login" UX complaint.
295// `no-cache` still revalidates on direct fetch but lets bfcache hold the
296// page in memory between navigations.
290ea77Claude297app.use("*", async (c, next) => {
298 await next();
299 const ct = c.res.headers.get("content-type") || "";
300 if (ct.startsWith("text/html")) {
36cc17aClaude301 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude302 }
303});
826eccfTest User304// Rate-limit API + auth endpoints.
305//
a41e675Test User306// `/api/*`: 1000/min per IP — generous so an admin clicking around the
307// operator console (or a CDN/proxy concentrating multiple users behind one
308// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
309// rate limits below, not this one.
310//
311// `authedMultiplier` is set but only fires when an upstream middleware has
312// already populated c.get("user") — most app.use() chains apply softAuth
313// per-route, so the multiplier is best-effort. Keep the anonymous base
314// high enough that humans never feel it.
315//
316// Skip-paths: dashboard plumbing endpoints that the layout polls on a
317// fixed cadence and that we don't want consuming any bucket:
318// /api/version — layout polls every 15s
826eccfTest User319// /api/notifications/count — nav bell unread-count fetcher
320// /pwa/vapid-public-key — fetched once per push-notification opt-in
321app.use(
322 "/api/*",
a41e675Test User323 rateLimit(1000, 60_000, "api", {
826eccfTest User324 authedMultiplier: 4,
325 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
326 })
327);
0316dbbClaude328app.use("/login", rateLimit(20, 60_000, "login"));
329app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude330// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
331app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User332// BLOCK Q2 — throttle magic-link sign-in for the same reason.
333app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude334
59b6fb2Claude335// CSRF protection — set token on all requests, validate on mutations
336app.use("*", csrfToken);
337app.use("*", csrfProtect);
338
45e31d0Claude339// Rate limit auth routes
340app.use("/login", authRateLimit);
341app.use("/register", authRateLimit);
342
59b6fb2Claude343// Rate limit git operations
344app.use("/:owner/:repo.git/*", gitRateLimit);
345
346// Rate limit search
347app.use("/:owner/:repo/search", searchRateLimit);
348app.use("/explore", searchRateLimit);
79136bbClaude349
f5b9ef5Claude350// No-cache for HTML — ensures browsers and proxies never serve stale pages.
351// The middleware only stamps text/html responses so static assets keep
352// their own cache policies unchanged.
353app.use("*", noCache);
354
79136bbClaude355// Git Smart HTTP protocol routes (must be before web routes)
356app.route("/", gitRoutes);
357
45e31d0Claude358// REST API v1 (legacy)
79136bbClaude359app.route("/", apiRoutes);
360
52ad8b1Claude361// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
362// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
363// router's catch-shape, and BEFORE adminRoutes so the live /demo page
364// wins over the legacy /demo redirect in src/routes/admin.tsx.
365app.route("/", demoRoutes);
366
0316dbbClaude367// REST API v2 (basePath /api/v2)
368app.route("/", apiV2Routes);
369
e75eddcClaude370// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
371// Mounted alongside apiV2Routes (its own basePath, no path conflict).
372app.route("/", agentsRoutes);
373
ad6d4adClaude374// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
375app.route("/", hookRoutes);
21f8dbdClaude376app.route("/api/events", eventsRoutes);
ad6d4adClaude377
45e31d0Claude378// API documentation
379app.route("/", apiDocsRoutes);
4a80519Claude380app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude381// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
382app.route("/", pullsDashboardRoutes);
e9aa4d8Claude383// Issue command center — global issue dashboard with AI-triage + autopilot signal
384app.route("/", issuesDashboardRoutes);
385// Personal activity timeline — every event across the user's repos, with
386// AI-driven events surfaced separately (the Gluecron differentiator).
387app.route("/", activityRoutes);
388// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
389app.route("/", inboxRoutes);
56801e1Claude390// AI standup feed — daily / weekly Claude-generated team brief
391app.route("/", standupRoutes);
79136bbClaude392
393// Auth routes (register, login, logout)
394app.route("/", authRoutes);
395
c63b860Claude396// BLOCK P1 — Password reset (forgot-password + reset-password)
397app.route("/", passwordResetRoutes);
398
399// BLOCK P2 — Email verification (verify-email + resend)
400app.route("/", emailVerificationRoutes);
401
cd4f63bTest User402// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
403app.route("/", magicLinkRoutes);
404
79136bbClaude405// Settings routes (profile, SSH keys)
406app.route("/", settingsRoutes);
407
7298a17Claude408// 2FA / TOTP settings (Block B4)
409app.route("/", settings2faRoutes);
410
e75eddcClaude411// Agent multiplayer — /settings/agents management UI
412app.route("/", settingsAgentsRoutes);
413
1d4ff60Claude414// Chat integrations — Slack / Discord / Teams (/settings/integrations
415// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
416app.route("/", settingsIntegrationsRoutes);
417app.route("/", integrationsChatRoutes);
418
2df1f8cClaude419// WebAuthn / passkey routes (Block B5)
420app.route("/", passkeyRoutes);
421
058d752Claude422// OAuth 2.0 provider (Block B6)
423app.route("/", oauthRoutes);
424app.route("/", developerAppsRoutes);
425
6fc53bdClaude426// Theme toggle (dark/light cookie)
427app.route("/", themeRoutes);
428
429// Audit log UI
430app.route("/", auditRoutes);
431
432// Reactions API (issues, PRs, comments)
433app.route("/", reactionRoutes);
434
24cf2caClaude435// Saved replies (per-user canned comment templates)
436app.route("/", savedReplyRoutes);
437
438// Environments + deployment history UI
439app.route("/", deploymentRoutes);
440
6563f0aClaude441// Organizations + teams (Block B1)
442app.route("/", orgRoutes);
443
c81ab7aClaude444// API tokens
445app.route("/", tokenRoutes);
446
59b6fb2Claude447// Notifications
3ef4c9dClaude448app.route("/", notificationRoutes);
449
79136bbClaude450// Repo settings (description, visibility, delete)
451app.route("/", repoSettings);
452
23d1a81Claude453// Repo collaborators (add/list/remove)
454app.route("/", collaboratorRoutes);
455
04f6b7fClaude456// Team-based repo collaborators (invite a whole team)
457app.route("/", teamCollaboratorRoutes);
458
459// Collaborator invite accept flow (token-based)
460app.route("/", invitesRoutes);
461
462// Real-time SSE endpoint (topic-based live updates)
463app.route("/", liveEventsRoutes);
464
3c03977Claude465// PR live co-editing — presence + cursors + content sync via SSE.
466app.route("/", prLiveRoutes);
467
c81ab7aClaude468// Webhooks management
469app.route("/", webhookRoutes);
470
79136bbClaude471// Compare view (branch diffs)
472app.route("/", compareRoutes);
473
474// Issue tracker
475app.route("/", issueRoutes);
476
cb5a796Claude477// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
478// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
479// the `/:owner/:repo/comments/*` paths resolve before the broader PR
480// patterns kick in.
481app.route("/", commentModerationRoutes);
482
0074234Claude483// Pull requests
484app.route("/", pullRoutes);
79ed944Claude485// PR sandboxes — runnable per-PR environments. Migration 0067.
486app.route("/", prSandboxRoutes);
0074234Claude487
9b3a183Claude488// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
489app.route("/", devEnvRoutes);
490
c81ab7aClaude491// Fork
492app.route("/", forkRoutes);
493
0074234Claude494// Web file editor
495app.route("/", editorRoutes);
496
43de941Claude497// Contributors
498app.route("/", contributorRoutes);
499
699e5c7Claude500// Health liveness + metrics endpoints
2c34075Claude501app.route("/", healthRoutes);
502
f295f78Dictation App503// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
504app.route("/api/platform-status", platformStatus);
505
52ad8b1Claude506// Block L4 — Public stats counters (powers landing-page social proof)
507app.route("/", publicStatsRoutes);
508
509// Block L3 — Live /demo page + /api/v2/demo/* endpoints
510app.route("/", demoRoutes);
511
2316be6Claude512// Public /status — human-readable platform health page
513app.route("/", statusRoutes);
514
b1be050CC LABS App515// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
516// Mounted near the public status route so the two surfaces are visible
517// side-by-side; routes are gated by isSiteAdmin internally.
518app.route("/", adminStatusRoutes);
519
80bed05Claude520// /help — quickstart + API cheatsheet
521app.route("/", helpRoutes);
522
5f2e749Claude523// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
524// so the new editorial pricing layout wins the route; the legacy marketing
525// pricing remains as a safety net but is shadowed at the router.
526app.route("/", pricingRoutes);
527
e1fc7dbClaude528// /changelog — manually curated platform release history
529app.route("/", changelogRoutes);
530
b0148e9Claude531// /pricing, /features, /about — marketing surface
532app.route("/", marketingRoutes);
533
5618f9aClaude534// SEO: robots.txt + sitemap.xml
535app.route("/", seoRoutes);
536
05cdb85Claude537// /api/version — live build SHA + uptime; client poller uses this to
538// surface 'New version available — reload' banners on deploy.
539app.route("/", versionRoutes);
540
699e5c7Claude541// Health dashboard (per-repo health page)
542app.route("/", healthDashboardRoutes);
543
9dd96b9Test User544// Block R1 — site-admin operations console. MUST be mounted BEFORE
545// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
546// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
547app.route("/", adminOpsRoutes);
f2c00b4CC LABS App548// BLOCK W — Self-host status + bootstrap dashboard.
549app.route("/", adminSelfHostRoutes);
826eccfTest User550// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
551app.route("/", adminDiagnoseRoutes);
9dd96b9Test User552
16b325cClaude553// Insights (time-travel, dependencies, rollback)
554app.route("/", insightRoutes);
555
8d1483cClaude556// DORA metrics page (/:owner/:repo/insights/dora)
557app.route("/", doraRoutes);
558
f1ab587Claude559// Command center dashboard
560app.route("/", dashboardRoutes);
561
36b4cbdClaude562// Legal pages (terms, privacy, AUP)
563app.route("/", legalRoutes);
4b66018Claude564// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
565// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
566// /acceptable-use); these are the formal versions that the legal pages
567// internally link to each other.
568app.route("/", legalTermsRoutes);
569app.route("/", legalPrivacyRoutes);
570app.route("/", legalAcceptableUseRoutes);
571app.route("/", legalDmcaRoutes);
36b4cbdClaude572
bdbd0deClaude573// GitHub import / migration
574app.route("/", importRoutes);
14c3cc8Claude575app.route("/", importBulkRoutes);
f390cfaCC LABS App576app.route("/", importSecretsRoutes);
14c3cc8Claude577app.route("/", migrationRoutes);
578
579// Spec-to-PR (experimental AI-generated draft PRs)
580app.route("/", specsRoutes);
23d0abfClaude581app.route("/", refactorRoutes);
bdbd0deClaude582
c81ab7aClaude583// Explore page
584app.route("/", exploreRoutes);
585
59b6fb2Claude586// Onboarding
587app.route("/", onboardingRoutes);
588
0316dbbClaude589// Admin + feature routes
590app.route("/", adminRoutes);
509c376Claude591app.route("/", adminIntegrationsRoutes);
79ed944Claude592app.route("/", adminAdvancementRoutes);
f764c07Claude593app.route("/", adminDeploysRoutes);
594app.route("/", adminDeploysPageRoutes);
783dd46Claude595app.route("/", adminServerTargetsRoutes);
9aaa128Claude596app.route("/", deployTargetsRoutes);
90c7531Claude597app.route("/", claudeWebRoutes);
9dd96b9Test User598// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude599app.route("/", advisoriesRoutes);
600app.route("/", aiChangelogRoutes);
601app.route("/", aiExplainRoutes);
602app.route("/", aiTestsRoutes);
603app.route("/", askRoutes);
38d31d3Claude604app.route("/", repoChatRoutes);
ee7e577Claude605// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
606// repoChatRoutes so the two surfaces share the catch-all priority.
607app.route("/", personalChatRoutes);
0316dbbClaude608app.route("/", billingRoutes);
8809b87Claude609app.route("/", billingUsageRoutes);
6778ad2Claude610app.route("/", stripeWebhookRoutes);
0316dbbClaude611app.route("/", codeScanningRoutes);
612app.route("/", commitStatusesRoutes);
613app.route("/", copilotRoutes);
614app.route("/", depUpdaterRoutes);
615app.route("/", depsRoutes);
616app.route("/", discussionsRoutes);
617app.route("/", environmentsRoutes);
4bbacbeClaude618app.route("/", previewsRoutes);
79ed944Claude619app.route("/", docsTrackingRoutes);
0316dbbClaude620app.route("/", followsRoutes);
621app.route("/", gatesRoutes);
622app.route("/", gistsRoutes);
623app.route("/", graphqlRoutes);
2c2163eClaude624app.route("/", mcpRoutes);
0316dbbClaude625app.route("/", marketplaceRoutes);
5ca514aClaude626app.route("/", marketplaceAgentsRoutes);
0316dbbClaude627app.route("/", mergeQueueRoutes);
628app.route("/", mirrorsRoutes);
629app.route("/", orgInsightsRoutes);
630app.route("/", packagesRoutes);
631app.route("/", packagesApiRoutes);
632app.route("/", pagesRoutes);
633app.route("/", projectsRoutes);
634app.route("/", protectedTagsRoutes);
635app.route("/", pwaRoutes);
46d6165Claude636app.route("/", installRoutes);
cd4f63bTest User637// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
638app.route("/", dxtRoutes);
662ce86Claude639// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
640// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
641app.route("/", connectClaudeRoutes);
f5b9ef5Claude642// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
643app.route("/", claudeIntegration);
644// Connect guide — public onboarding page (/connect/claude-guide).
645app.route("/", connectRoutes);
05ab9b1Claude646// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
647app.route("/", pushWatchRoutes);
648// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
649app.route("/", orgSecretsRoutes);
a2b3e99Claude650// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
651app.route("/", crossRepoSearchRoutes);
652// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
653app.route("/", pushNotifRoutes);
9fbe6cdClaude654// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
655app.route("/", velocityRoutes);
656// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
657app.route("/", staleBranchRoutes);
22f43f3Claude658// Repository Pulse — BLOCK M12 — /:owner/:repo/pulse
659app.route("/", pulseRoutes);
74d8c4dClaude660// Repository Health Score — BLOCK M14 — /:owner/:repo/insights/health
661app.route("/", healthScoreRoutes);
662// Hot Files Heatmap — BLOCK M16 — /:owner/:repo/insights/hotfiles
663app.route("/", hotFilesRoutes);
ebbb527Claude664// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
665// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
666app.route("/", claudeDeployRoutes);
0316dbbClaude667app.route("/", releasesRoutes);
668app.route("/", requiredChecksRoutes);
669app.route("/", rulesetsRoutes);
670app.route("/", searchRoutes);
671app.route("/", semanticSearchRoutes);
672app.route("/", signingKeysRoutes);
673app.route("/", sponsorsRoutes);
674app.route("/", ssoRoutes);
46d6165Claude675app.route("/", githubOauthRoutes);
582cdacClaude676app.route("/", googleOauthRoutes);
0316dbbClaude677app.route("/", symbolsRoutes);
678app.route("/", templatesRoutes);
679app.route("/", trafficRoutes);
680app.route("/", wikisRoutes);
681app.route("/", workflowsRoutes);
5ff9cc2Claude682app.route("/", workflowArtifactsRoutes);
683app.route("/", workflowSecretsRoutes);
46d6165Claude684app.route("/", sleepModeRoutes);
52ad8b1Claude685app.route("/", vsGithubRoutes);
0316dbbClaude686
45f3b73Claude687// Voice-to-PR — phone-first dictation → spec or issue
688app.route("/", voiceRoutes);
689
cd4f63bTest User690// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
691// before the web catch-all so the bare `/play` literal wins over the
692// `/:owner` user-profile route.
693app.route("/", playgroundRoutes);
694
79136bbClaude695// Web UI (catch-all, must be last)
696app.route("/", webRoutes);
697
c63b860Claude698// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
699// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude700app.notFound((c) => {
36cc17aClaude701 const user = c.get("user") ?? null;
79136bbClaude702 return c.html(
c63b860Claude703 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude704 404
705 );
706});
707
c63b860Claude708// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
709// view. Trace block only shown outside production.
79136bbClaude710app.onError((err, c) => {
80bed05Claude711 reportError(err, {
712 requestId: c.get("requestId"),
713 path: c.req.path,
714 method: c.req.method,
715 });
c63b860Claude716 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
717 // back to the context value set by request-context middleware.
718 const requestId =
719 c.req.header("x-request-id") ||
720 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude721 const user = c.get("user") ?? null;
c63b860Claude722 const trace =
723 process.env.NODE_ENV !== "production" && err && err.message
724 ? err.message
725 : undefined;
79136bbClaude726 return c.html(
c63b860Claude727 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude728 500
729 );
730});
731
732export default app;