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.tsxBlame720 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";
22f43f3Claude167import pulseRoutes from "./routes/pulse";
59b6fb2Claude168import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
169import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude170import { noCache } from "./middleware/no-cache";
79136bbClaude171
2316901Claude172import type { AuthEnv } from "./middleware/auth";
bf19c50Test User173import { softAuth } from "./middleware/auth";
2316901Claude174
175const app = new Hono<AuthEnv>();
79136bbClaude176
3ef4c9dClaude177// Request context (request ID, start time) runs before everything else
178app.use("*", requestContext);
05b973eClaude179// Middleware — compression first (wraps all responses)
180app.use("*", compress());
f1ffd50Claude181
182// ETag middleware — returns 304 Not Modified on unchanged responses.
183// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
184// SSE + the API surface where it would interfere with streaming.
185app.use("*", async (c, next) => {
186 const p = c.req.path;
187 if (
188 p.includes(".git/") ||
189 p.startsWith("/live-events") ||
190 p.startsWith("/api/events/deploy") ||
3c03977Claude191 p.startsWith("/admin/status") ||
192 // PR live co-editing SSE stream — never etag streaming responses.
193 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude194 ) {
195 return next();
196 }
197 return etag()(c, next);
198});
199
200// Cache-Control middleware — sets sensible defaults on public, anonymous
201// requests. Crontech (when wired as our edge layer) and downstream
202// browsers will honor these. Auth'd users get private,no-store
203// automatically — we never cache responses tied to a session.
204app.use("*", async (c, next) => {
205 await next();
206 // Don't overwrite explicit headers set by route handlers — BUT the
207 // ETag middleware unconditionally sets "private, no-cache, must-
208 // revalidate" so we have to treat that specific value as "no
209 // policy chosen yet" and apply ours. Any route that explicitly set
210 // a different cache-control wins.
211 const existing = c.res.headers.get("cache-control");
212 const etagDefault =
213 existing === "private, no-cache, must-revalidate" ||
214 existing === "no-cache";
215 if (existing && !etagDefault) return;
216 // Anything past auth: private + no-store (avoid leaking session
217 // content into shared caches). softAuth runs before this on the
218 // request, but the response side is what we're stamping.
219 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
220 const p = c.req.path;
221 // Always private for known-authed paths regardless of cookie.
222 if (
223 p.startsWith("/admin") ||
224 p.startsWith("/settings") ||
225 p.startsWith("/dashboard") ||
226 p.startsWith("/notifications") ||
227 p.startsWith("/connect/") ||
228 hasSession
229 ) {
230 c.res.headers.set("cache-control", "private, no-store");
231 return;
232 }
233 // Public marketing surfaces — short edge cache, longer browser cache,
234 // stale-while-revalidate so the user never waits on a stale fetch.
235 const isMarketing =
236 p === "/" ||
237 p === "/features" ||
238 p === "/pricing" ||
239 p === "/about" ||
240 p === "/vs-github" ||
241 p === "/explore" ||
242 p === "/help" ||
243 p === "/changelog" ||
244 p.startsWith("/legal/") ||
245 p === "/terms" ||
246 p === "/privacy" ||
247 p === "/acceptable-use" ||
248 p.startsWith("/docs/");
249 if (isMarketing) {
250 c.res.headers.set(
251 "cache-control",
252 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
253 );
254 return;
255 }
256 // Public repo browse pages — cache aggressively. Edge invalidates
257 // on push via the post-receive hook (future Crontech surge purge).
258 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
259 c.res.headers.set(
260 "cache-control",
261 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
262 );
263 return;
264 }
265 // Default: don't cache anything we haven't explicitly opted in.
266 c.res.headers.set("cache-control", "private, no-store");
267});
05b973eClaude268// Logger only on non-git routes to avoid overhead on clone/push
269app.use("*", async (c, next) => {
270 if (c.req.path.includes(".git/")) return next();
271 return logger()(c, next);
272});
79136bbClaude273app.use("/api/*", cors());
bf19c50Test User274// Global softAuth — populates c.get("user") for every downstream middleware
275// + route. This was previously per-route, which meant rate-limit middleware
276// (and anything else inspecting auth state) always saw a null user. Keep
277// individual routes free to add requireAuth on top for hard gating; this
278// just establishes the user object cheaply.
279app.use("*", softAuth);
290ea77Claude280
36cc17aClaude281// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude282// pre-redesign markup. JSON / static assets keep their own cache rules; only
283// text/html responses get the no-cache stamp. Without this, every push to
284// main left users staring at cached 80s-looking pages from before the design
285// landed.
36cc17aClaude286//
287// We deliberately use `private, no-cache, must-revalidate` rather than
288// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
289// which makes every Back/Forward press a cold server round-trip — that
290// contributed to the "every nav feels like a fresh login" UX complaint.
291// `no-cache` still revalidates on direct fetch but lets bfcache hold the
292// page in memory between navigations.
290ea77Claude293app.use("*", async (c, next) => {
294 await next();
295 const ct = c.res.headers.get("content-type") || "";
296 if (ct.startsWith("text/html")) {
36cc17aClaude297 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude298 }
299});
826eccfTest User300// Rate-limit API + auth endpoints.
301//
a41e675Test User302// `/api/*`: 1000/min per IP — generous so an admin clicking around the
303// operator console (or a CDN/proxy concentrating multiple users behind one
304// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
305// rate limits below, not this one.
306//
307// `authedMultiplier` is set but only fires when an upstream middleware has
308// already populated c.get("user") — most app.use() chains apply softAuth
309// per-route, so the multiplier is best-effort. Keep the anonymous base
310// high enough that humans never feel it.
311//
312// Skip-paths: dashboard plumbing endpoints that the layout polls on a
313// fixed cadence and that we don't want consuming any bucket:
314// /api/version — layout polls every 15s
826eccfTest User315// /api/notifications/count — nav bell unread-count fetcher
316// /pwa/vapid-public-key — fetched once per push-notification opt-in
317app.use(
318 "/api/*",
a41e675Test User319 rateLimit(1000, 60_000, "api", {
826eccfTest User320 authedMultiplier: 4,
321 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
322 })
323);
0316dbbClaude324app.use("/login", rateLimit(20, 60_000, "login"));
325app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude326// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
327app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User328// BLOCK Q2 — throttle magic-link sign-in for the same reason.
329app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude330
59b6fb2Claude331// CSRF protection — set token on all requests, validate on mutations
332app.use("*", csrfToken);
333app.use("*", csrfProtect);
334
45e31d0Claude335// Rate limit auth routes
336app.use("/login", authRateLimit);
337app.use("/register", authRateLimit);
338
59b6fb2Claude339// Rate limit git operations
340app.use("/:owner/:repo.git/*", gitRateLimit);
341
342// Rate limit search
343app.use("/:owner/:repo/search", searchRateLimit);
344app.use("/explore", searchRateLimit);
79136bbClaude345
f5b9ef5Claude346// No-cache for HTML — ensures browsers and proxies never serve stale pages.
347// The middleware only stamps text/html responses so static assets keep
348// their own cache policies unchanged.
349app.use("*", noCache);
350
79136bbClaude351// Git Smart HTTP protocol routes (must be before web routes)
352app.route("/", gitRoutes);
353
45e31d0Claude354// REST API v1 (legacy)
79136bbClaude355app.route("/", apiRoutes);
356
52ad8b1Claude357// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
358// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
359// router's catch-shape, and BEFORE adminRoutes so the live /demo page
360// wins over the legacy /demo redirect in src/routes/admin.tsx.
361app.route("/", demoRoutes);
362
0316dbbClaude363// REST API v2 (basePath /api/v2)
364app.route("/", apiV2Routes);
365
e75eddcClaude366// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
367// Mounted alongside apiV2Routes (its own basePath, no path conflict).
368app.route("/", agentsRoutes);
369
ad6d4adClaude370// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
371app.route("/", hookRoutes);
21f8dbdClaude372app.route("/api/events", eventsRoutes);
ad6d4adClaude373
45e31d0Claude374// API documentation
375app.route("/", apiDocsRoutes);
4a80519Claude376app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude377// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
378app.route("/", pullsDashboardRoutes);
e9aa4d8Claude379// Issue command center — global issue dashboard with AI-triage + autopilot signal
380app.route("/", issuesDashboardRoutes);
381// Personal activity timeline — every event across the user's repos, with
382// AI-driven events surfaced separately (the Gluecron differentiator).
383app.route("/", activityRoutes);
384// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
385app.route("/", inboxRoutes);
56801e1Claude386// AI standup feed — daily / weekly Claude-generated team brief
387app.route("/", standupRoutes);
79136bbClaude388
389// Auth routes (register, login, logout)
390app.route("/", authRoutes);
391
c63b860Claude392// BLOCK P1 — Password reset (forgot-password + reset-password)
393app.route("/", passwordResetRoutes);
394
395// BLOCK P2 — Email verification (verify-email + resend)
396app.route("/", emailVerificationRoutes);
397
cd4f63bTest User398// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
399app.route("/", magicLinkRoutes);
400
79136bbClaude401// Settings routes (profile, SSH keys)
402app.route("/", settingsRoutes);
403
7298a17Claude404// 2FA / TOTP settings (Block B4)
405app.route("/", settings2faRoutes);
406
e75eddcClaude407// Agent multiplayer — /settings/agents management UI
408app.route("/", settingsAgentsRoutes);
409
1d4ff60Claude410// Chat integrations — Slack / Discord / Teams (/settings/integrations
411// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
412app.route("/", settingsIntegrationsRoutes);
413app.route("/", integrationsChatRoutes);
414
2df1f8cClaude415// WebAuthn / passkey routes (Block B5)
416app.route("/", passkeyRoutes);
417
058d752Claude418// OAuth 2.0 provider (Block B6)
419app.route("/", oauthRoutes);
420app.route("/", developerAppsRoutes);
421
6fc53bdClaude422// Theme toggle (dark/light cookie)
423app.route("/", themeRoutes);
424
425// Audit log UI
426app.route("/", auditRoutes);
427
428// Reactions API (issues, PRs, comments)
429app.route("/", reactionRoutes);
430
24cf2caClaude431// Saved replies (per-user canned comment templates)
432app.route("/", savedReplyRoutes);
433
434// Environments + deployment history UI
435app.route("/", deploymentRoutes);
436
6563f0aClaude437// Organizations + teams (Block B1)
438app.route("/", orgRoutes);
439
c81ab7aClaude440// API tokens
441app.route("/", tokenRoutes);
442
59b6fb2Claude443// Notifications
3ef4c9dClaude444app.route("/", notificationRoutes);
445
79136bbClaude446// Repo settings (description, visibility, delete)
447app.route("/", repoSettings);
448
23d1a81Claude449// Repo collaborators (add/list/remove)
450app.route("/", collaboratorRoutes);
451
04f6b7fClaude452// Team-based repo collaborators (invite a whole team)
453app.route("/", teamCollaboratorRoutes);
454
455// Collaborator invite accept flow (token-based)
456app.route("/", invitesRoutes);
457
458// Real-time SSE endpoint (topic-based live updates)
459app.route("/", liveEventsRoutes);
460
3c03977Claude461// PR live co-editing — presence + cursors + content sync via SSE.
462app.route("/", prLiveRoutes);
463
c81ab7aClaude464// Webhooks management
465app.route("/", webhookRoutes);
466
79136bbClaude467// Compare view (branch diffs)
468app.route("/", compareRoutes);
469
470// Issue tracker
471app.route("/", issueRoutes);
472
cb5a796Claude473// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
474// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
475// the `/:owner/:repo/comments/*` paths resolve before the broader PR
476// patterns kick in.
477app.route("/", commentModerationRoutes);
478
0074234Claude479// Pull requests
480app.route("/", pullRoutes);
79ed944Claude481// PR sandboxes — runnable per-PR environments. Migration 0067.
482app.route("/", prSandboxRoutes);
0074234Claude483
9b3a183Claude484// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
485app.route("/", devEnvRoutes);
486
c81ab7aClaude487// Fork
488app.route("/", forkRoutes);
489
0074234Claude490// Web file editor
491app.route("/", editorRoutes);
492
43de941Claude493// Contributors
494app.route("/", contributorRoutes);
495
699e5c7Claude496// Health liveness + metrics endpoints
2c34075Claude497app.route("/", healthRoutes);
498
f295f78Dictation App499// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
500app.route("/api/platform-status", platformStatus);
501
52ad8b1Claude502// Block L4 — Public stats counters (powers landing-page social proof)
503app.route("/", publicStatsRoutes);
504
505// Block L3 — Live /demo page + /api/v2/demo/* endpoints
506app.route("/", demoRoutes);
507
2316be6Claude508// Public /status — human-readable platform health page
509app.route("/", statusRoutes);
510
b1be050CC LABS App511// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
512// Mounted near the public status route so the two surfaces are visible
513// side-by-side; routes are gated by isSiteAdmin internally.
514app.route("/", adminStatusRoutes);
515
80bed05Claude516// /help — quickstart + API cheatsheet
517app.route("/", helpRoutes);
518
5f2e749Claude519// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
520// so the new editorial pricing layout wins the route; the legacy marketing
521// pricing remains as a safety net but is shadowed at the router.
522app.route("/", pricingRoutes);
523
b0148e9Claude524// /pricing, /features, /about — marketing surface
525app.route("/", marketingRoutes);
526
5618f9aClaude527// SEO: robots.txt + sitemap.xml
528app.route("/", seoRoutes);
529
05cdb85Claude530// /api/version — live build SHA + uptime; client poller uses this to
531// surface 'New version available — reload' banners on deploy.
532app.route("/", versionRoutes);
533
699e5c7Claude534// Health dashboard (per-repo health page)
535app.route("/", healthDashboardRoutes);
536
9dd96b9Test User537// Block R1 — site-admin operations console. MUST be mounted BEFORE
538// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
539// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
540app.route("/", adminOpsRoutes);
f2c00b4CC LABS App541// BLOCK W — Self-host status + bootstrap dashboard.
542app.route("/", adminSelfHostRoutes);
826eccfTest User543// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
544app.route("/", adminDiagnoseRoutes);
9dd96b9Test User545
16b325cClaude546// Insights (time-travel, dependencies, rollback)
547app.route("/", insightRoutes);
548
8d1483cClaude549// DORA metrics page (/:owner/:repo/insights/dora)
550app.route("/", doraRoutes);
551
f1ab587Claude552// Command center dashboard
553app.route("/", dashboardRoutes);
554
36b4cbdClaude555// Legal pages (terms, privacy, AUP)
556app.route("/", legalRoutes);
4b66018Claude557// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
558// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
559// /acceptable-use); these are the formal versions that the legal pages
560// internally link to each other.
561app.route("/", legalTermsRoutes);
562app.route("/", legalPrivacyRoutes);
563app.route("/", legalAcceptableUseRoutes);
564app.route("/", legalDmcaRoutes);
36b4cbdClaude565
bdbd0deClaude566// GitHub import / migration
567app.route("/", importRoutes);
14c3cc8Claude568app.route("/", importBulkRoutes);
f390cfaCC LABS App569app.route("/", importSecretsRoutes);
14c3cc8Claude570app.route("/", migrationRoutes);
571
572// Spec-to-PR (experimental AI-generated draft PRs)
573app.route("/", specsRoutes);
23d0abfClaude574app.route("/", refactorRoutes);
bdbd0deClaude575
c81ab7aClaude576// Explore page
577app.route("/", exploreRoutes);
578
59b6fb2Claude579// Onboarding
580app.route("/", onboardingRoutes);
581
0316dbbClaude582// Admin + feature routes
583app.route("/", adminRoutes);
509c376Claude584app.route("/", adminIntegrationsRoutes);
79ed944Claude585app.route("/", adminAdvancementRoutes);
f764c07Claude586app.route("/", adminDeploysRoutes);
587app.route("/", adminDeploysPageRoutes);
783dd46Claude588app.route("/", adminServerTargetsRoutes);
90c7531Claude589app.route("/", claudeWebRoutes);
9dd96b9Test User590// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude591app.route("/", advisoriesRoutes);
592app.route("/", aiChangelogRoutes);
593app.route("/", aiExplainRoutes);
594app.route("/", aiTestsRoutes);
595app.route("/", askRoutes);
38d31d3Claude596app.route("/", repoChatRoutes);
ee7e577Claude597// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
598// repoChatRoutes so the two surfaces share the catch-all priority.
599app.route("/", personalChatRoutes);
0316dbbClaude600app.route("/", billingRoutes);
8809b87Claude601app.route("/", billingUsageRoutes);
6778ad2Claude602app.route("/", stripeWebhookRoutes);
0316dbbClaude603app.route("/", codeScanningRoutes);
604app.route("/", commitStatusesRoutes);
605app.route("/", copilotRoutes);
606app.route("/", depUpdaterRoutes);
607app.route("/", depsRoutes);
608app.route("/", discussionsRoutes);
609app.route("/", environmentsRoutes);
4bbacbeClaude610app.route("/", previewsRoutes);
79ed944Claude611app.route("/", docsTrackingRoutes);
0316dbbClaude612app.route("/", followsRoutes);
613app.route("/", gatesRoutes);
614app.route("/", gistsRoutes);
615app.route("/", graphqlRoutes);
2c2163eClaude616app.route("/", mcpRoutes);
0316dbbClaude617app.route("/", marketplaceRoutes);
5ca514aClaude618app.route("/", marketplaceAgentsRoutes);
0316dbbClaude619app.route("/", mergeQueueRoutes);
620app.route("/", mirrorsRoutes);
621app.route("/", orgInsightsRoutes);
622app.route("/", packagesRoutes);
623app.route("/", packagesApiRoutes);
624app.route("/", pagesRoutes);
625app.route("/", projectsRoutes);
626app.route("/", protectedTagsRoutes);
627app.route("/", pwaRoutes);
46d6165Claude628app.route("/", installRoutes);
cd4f63bTest User629// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
630app.route("/", dxtRoutes);
662ce86Claude631// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
632// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
633app.route("/", connectClaudeRoutes);
f5b9ef5Claude634// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
635app.route("/", claudeIntegration);
636// Connect guide — public onboarding page (/connect/claude-guide).
637app.route("/", connectRoutes);
05ab9b1Claude638// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
639app.route("/", pushWatchRoutes);
640// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
641app.route("/", orgSecretsRoutes);
a2b3e99Claude642// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
643app.route("/", crossRepoSearchRoutes);
644// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
645app.route("/", pushNotifRoutes);
9fbe6cdClaude646// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
647app.route("/", velocityRoutes);
648// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
649app.route("/", staleBranchRoutes);
22f43f3Claude650// Repository Pulse — BLOCK M12 — /:owner/:repo/pulse
651app.route("/", pulseRoutes);
ebbb527Claude652// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
653// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
654app.route("/", claudeDeployRoutes);
0316dbbClaude655app.route("/", releasesRoutes);
656app.route("/", requiredChecksRoutes);
657app.route("/", rulesetsRoutes);
658app.route("/", searchRoutes);
659app.route("/", semanticSearchRoutes);
660app.route("/", signingKeysRoutes);
661app.route("/", sponsorsRoutes);
662app.route("/", ssoRoutes);
46d6165Claude663app.route("/", githubOauthRoutes);
582cdacClaude664app.route("/", googleOauthRoutes);
0316dbbClaude665app.route("/", symbolsRoutes);
666app.route("/", templatesRoutes);
667app.route("/", trafficRoutes);
668app.route("/", wikisRoutes);
669app.route("/", workflowsRoutes);
5ff9cc2Claude670app.route("/", workflowArtifactsRoutes);
671app.route("/", workflowSecretsRoutes);
46d6165Claude672app.route("/", sleepModeRoutes);
52ad8b1Claude673app.route("/", vsGithubRoutes);
0316dbbClaude674
45f3b73Claude675// Voice-to-PR — phone-first dictation → spec or issue
676app.route("/", voiceRoutes);
677
cd4f63bTest User678// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
679// before the web catch-all so the bare `/play` literal wins over the
680// `/:owner` user-profile route.
681app.route("/", playgroundRoutes);
682
79136bbClaude683// Web UI (catch-all, must be last)
684app.route("/", webRoutes);
685
c63b860Claude686// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
687// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude688app.notFound((c) => {
36cc17aClaude689 const user = c.get("user") ?? null;
79136bbClaude690 return c.html(
c63b860Claude691 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude692 404
693 );
694});
695
c63b860Claude696// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
697// view. Trace block only shown outside production.
79136bbClaude698app.onError((err, c) => {
80bed05Claude699 reportError(err, {
700 requestId: c.get("requestId"),
701 path: c.req.path,
702 method: c.req.method,
703 });
c63b860Claude704 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
705 // back to the context value set by request-context middleware.
706 const requestId =
707 c.req.header("x-request-id") ||
708 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude709 const user = c.get("user") ?? null;
c63b860Claude710 const trace =
711 process.env.NODE_ENV !== "production" && err && err.message
712 ? err.message
713 : undefined;
79136bbClaude714 return c.html(
c63b860Claude715 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude716 500
717 );
718});
719
720export default app;