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.tsxBlame699 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";
0316dbbClaude139import releasesRoutes from "./routes/releases";
140import requiredChecksRoutes from "./routes/required-checks";
141import rulesetsRoutes from "./routes/rulesets";
142import searchRoutes from "./routes/search";
143import semanticSearchRoutes from "./routes/semantic-search";
144import signingKeysRoutes from "./routes/signing-keys";
145import sponsorsRoutes from "./routes/sponsors";
146import ssoRoutes from "./routes/sso";
46d6165Claude147import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude148import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude149import symbolsRoutes from "./routes/symbols";
150import templatesRoutes from "./routes/templates";
151import trafficRoutes from "./routes/traffic";
152import wikisRoutes from "./routes/wikis";
153import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude154import workflowArtifactsRoutes from "./routes/workflow-artifacts";
155import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude156import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude157import standupRoutes from "./routes/standups";
52ad8b1Claude158import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude159import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User160import playgroundRoutes from "./routes/playground";
59b6fb2Claude161import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
162import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude163import { noCache } from "./middleware/no-cache";
79136bbClaude164
2316901Claude165import type { AuthEnv } from "./middleware/auth";
bf19c50Test User166import { softAuth } from "./middleware/auth";
2316901Claude167
168const app = new Hono<AuthEnv>();
79136bbClaude169
3ef4c9dClaude170// Request context (request ID, start time) runs before everything else
171app.use("*", requestContext);
05b973eClaude172// Middleware — compression first (wraps all responses)
173app.use("*", compress());
f1ffd50Claude174
175// ETag middleware — returns 304 Not Modified on unchanged responses.
176// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
177// SSE + the API surface where it would interfere with streaming.
178app.use("*", async (c, next) => {
179 const p = c.req.path;
180 if (
181 p.includes(".git/") ||
182 p.startsWith("/live-events") ||
183 p.startsWith("/api/events/deploy") ||
3c03977Claude184 p.startsWith("/admin/status") ||
185 // PR live co-editing SSE stream — never etag streaming responses.
186 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude187 ) {
188 return next();
189 }
190 return etag()(c, next);
191});
192
193// Cache-Control middleware — sets sensible defaults on public, anonymous
194// requests. Crontech (when wired as our edge layer) and downstream
195// browsers will honor these. Auth'd users get private,no-store
196// automatically — we never cache responses tied to a session.
197app.use("*", async (c, next) => {
198 await next();
199 // Don't overwrite explicit headers set by route handlers — BUT the
200 // ETag middleware unconditionally sets "private, no-cache, must-
201 // revalidate" so we have to treat that specific value as "no
202 // policy chosen yet" and apply ours. Any route that explicitly set
203 // a different cache-control wins.
204 const existing = c.res.headers.get("cache-control");
205 const etagDefault =
206 existing === "private, no-cache, must-revalidate" ||
207 existing === "no-cache";
208 if (existing && !etagDefault) return;
209 // Anything past auth: private + no-store (avoid leaking session
210 // content into shared caches). softAuth runs before this on the
211 // request, but the response side is what we're stamping.
212 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
213 const p = c.req.path;
214 // Always private for known-authed paths regardless of cookie.
215 if (
216 p.startsWith("/admin") ||
217 p.startsWith("/settings") ||
218 p.startsWith("/dashboard") ||
219 p.startsWith("/notifications") ||
220 p.startsWith("/connect/") ||
221 hasSession
222 ) {
223 c.res.headers.set("cache-control", "private, no-store");
224 return;
225 }
226 // Public marketing surfaces — short edge cache, longer browser cache,
227 // stale-while-revalidate so the user never waits on a stale fetch.
228 const isMarketing =
229 p === "/" ||
230 p === "/features" ||
231 p === "/pricing" ||
232 p === "/about" ||
233 p === "/vs-github" ||
234 p === "/explore" ||
235 p === "/help" ||
236 p === "/changelog" ||
237 p.startsWith("/legal/") ||
238 p === "/terms" ||
239 p === "/privacy" ||
240 p === "/acceptable-use" ||
241 p.startsWith("/docs/");
242 if (isMarketing) {
243 c.res.headers.set(
244 "cache-control",
245 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
246 );
247 return;
248 }
249 // Public repo browse pages — cache aggressively. Edge invalidates
250 // on push via the post-receive hook (future Crontech surge purge).
251 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
252 c.res.headers.set(
253 "cache-control",
254 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
255 );
256 return;
257 }
258 // Default: don't cache anything we haven't explicitly opted in.
259 c.res.headers.set("cache-control", "private, no-store");
260});
05b973eClaude261// Logger only on non-git routes to avoid overhead on clone/push
262app.use("*", async (c, next) => {
263 if (c.req.path.includes(".git/")) return next();
264 return logger()(c, next);
265});
79136bbClaude266app.use("/api/*", cors());
bf19c50Test User267// Global softAuth — populates c.get("user") for every downstream middleware
268// + route. This was previously per-route, which meant rate-limit middleware
269// (and anything else inspecting auth state) always saw a null user. Keep
270// individual routes free to add requireAuth on top for hard gating; this
271// just establishes the user object cheaply.
272app.use("*", softAuth);
290ea77Claude273
36cc17aClaude274// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude275// pre-redesign markup. JSON / static assets keep their own cache rules; only
276// text/html responses get the no-cache stamp. Without this, every push to
277// main left users staring at cached 80s-looking pages from before the design
278// landed.
36cc17aClaude279//
280// We deliberately use `private, no-cache, must-revalidate` rather than
281// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
282// which makes every Back/Forward press a cold server round-trip — that
283// contributed to the "every nav feels like a fresh login" UX complaint.
284// `no-cache` still revalidates on direct fetch but lets bfcache hold the
285// page in memory between navigations.
290ea77Claude286app.use("*", async (c, next) => {
287 await next();
288 const ct = c.res.headers.get("content-type") || "";
289 if (ct.startsWith("text/html")) {
36cc17aClaude290 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude291 }
292});
826eccfTest User293// Rate-limit API + auth endpoints.
294//
a41e675Test User295// `/api/*`: 1000/min per IP — generous so an admin clicking around the
296// operator console (or a CDN/proxy concentrating multiple users behind one
297// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
298// rate limits below, not this one.
299//
300// `authedMultiplier` is set but only fires when an upstream middleware has
301// already populated c.get("user") — most app.use() chains apply softAuth
302// per-route, so the multiplier is best-effort. Keep the anonymous base
303// high enough that humans never feel it.
304//
305// Skip-paths: dashboard plumbing endpoints that the layout polls on a
306// fixed cadence and that we don't want consuming any bucket:
307// /api/version — layout polls every 15s
826eccfTest User308// /api/notifications/count — nav bell unread-count fetcher
309// /pwa/vapid-public-key — fetched once per push-notification opt-in
310app.use(
311 "/api/*",
a41e675Test User312 rateLimit(1000, 60_000, "api", {
826eccfTest User313 authedMultiplier: 4,
314 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
315 })
316);
0316dbbClaude317app.use("/login", rateLimit(20, 60_000, "login"));
318app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude319// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
320app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User321// BLOCK Q2 — throttle magic-link sign-in for the same reason.
322app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude323
59b6fb2Claude324// CSRF protection — set token on all requests, validate on mutations
325app.use("*", csrfToken);
326app.use("*", csrfProtect);
327
45e31d0Claude328// Rate limit auth routes
329app.use("/login", authRateLimit);
330app.use("/register", authRateLimit);
331
59b6fb2Claude332// Rate limit git operations
333app.use("/:owner/:repo.git/*", gitRateLimit);
334
335// Rate limit search
336app.use("/:owner/:repo/search", searchRateLimit);
337app.use("/explore", searchRateLimit);
79136bbClaude338
f5b9ef5Claude339// No-cache for HTML — ensures browsers and proxies never serve stale pages.
340// The middleware only stamps text/html responses so static assets keep
341// their own cache policies unchanged.
342app.use("*", noCache);
343
79136bbClaude344// Git Smart HTTP protocol routes (must be before web routes)
345app.route("/", gitRoutes);
346
45e31d0Claude347// REST API v1 (legacy)
79136bbClaude348app.route("/", apiRoutes);
349
52ad8b1Claude350// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
351// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
352// router's catch-shape, and BEFORE adminRoutes so the live /demo page
353// wins over the legacy /demo redirect in src/routes/admin.tsx.
354app.route("/", demoRoutes);
355
0316dbbClaude356// REST API v2 (basePath /api/v2)
357app.route("/", apiV2Routes);
358
e75eddcClaude359// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
360// Mounted alongside apiV2Routes (its own basePath, no path conflict).
361app.route("/", agentsRoutes);
362
ad6d4adClaude363// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
364app.route("/", hookRoutes);
21f8dbdClaude365app.route("/api/events", eventsRoutes);
ad6d4adClaude366
45e31d0Claude367// API documentation
368app.route("/", apiDocsRoutes);
4a80519Claude369app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude370// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
371app.route("/", pullsDashboardRoutes);
e9aa4d8Claude372// Issue command center — global issue dashboard with AI-triage + autopilot signal
373app.route("/", issuesDashboardRoutes);
374// Personal activity timeline — every event across the user's repos, with
375// AI-driven events surfaced separately (the Gluecron differentiator).
376app.route("/", activityRoutes);
377// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
378app.route("/", inboxRoutes);
56801e1Claude379// AI standup feed — daily / weekly Claude-generated team brief
380app.route("/", standupRoutes);
79136bbClaude381
382// Auth routes (register, login, logout)
383app.route("/", authRoutes);
384
c63b860Claude385// BLOCK P1 — Password reset (forgot-password + reset-password)
386app.route("/", passwordResetRoutes);
387
388// BLOCK P2 — Email verification (verify-email + resend)
389app.route("/", emailVerificationRoutes);
390
cd4f63bTest User391// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
392app.route("/", magicLinkRoutes);
393
79136bbClaude394// Settings routes (profile, SSH keys)
395app.route("/", settingsRoutes);
396
7298a17Claude397// 2FA / TOTP settings (Block B4)
398app.route("/", settings2faRoutes);
399
e75eddcClaude400// Agent multiplayer — /settings/agents management UI
401app.route("/", settingsAgentsRoutes);
402
1d4ff60Claude403// Chat integrations — Slack / Discord / Teams (/settings/integrations
404// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
405app.route("/", settingsIntegrationsRoutes);
406app.route("/", integrationsChatRoutes);
407
2df1f8cClaude408// WebAuthn / passkey routes (Block B5)
409app.route("/", passkeyRoutes);
410
058d752Claude411// OAuth 2.0 provider (Block B6)
412app.route("/", oauthRoutes);
413app.route("/", developerAppsRoutes);
414
6fc53bdClaude415// Theme toggle (dark/light cookie)
416app.route("/", themeRoutes);
417
418// Audit log UI
419app.route("/", auditRoutes);
420
421// Reactions API (issues, PRs, comments)
422app.route("/", reactionRoutes);
423
24cf2caClaude424// Saved replies (per-user canned comment templates)
425app.route("/", savedReplyRoutes);
426
427// Environments + deployment history UI
428app.route("/", deploymentRoutes);
429
6563f0aClaude430// Organizations + teams (Block B1)
431app.route("/", orgRoutes);
432
c81ab7aClaude433// API tokens
434app.route("/", tokenRoutes);
435
59b6fb2Claude436// Notifications
3ef4c9dClaude437app.route("/", notificationRoutes);
438
79136bbClaude439// Repo settings (description, visibility, delete)
440app.route("/", repoSettings);
441
23d1a81Claude442// Repo collaborators (add/list/remove)
443app.route("/", collaboratorRoutes);
444
04f6b7fClaude445// Team-based repo collaborators (invite a whole team)
446app.route("/", teamCollaboratorRoutes);
447
448// Collaborator invite accept flow (token-based)
449app.route("/", invitesRoutes);
450
451// Real-time SSE endpoint (topic-based live updates)
452app.route("/", liveEventsRoutes);
453
3c03977Claude454// PR live co-editing — presence + cursors + content sync via SSE.
455app.route("/", prLiveRoutes);
456
c81ab7aClaude457// Webhooks management
458app.route("/", webhookRoutes);
459
79136bbClaude460// Compare view (branch diffs)
461app.route("/", compareRoutes);
462
463// Issue tracker
464app.route("/", issueRoutes);
465
cb5a796Claude466// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
467// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
468// the `/:owner/:repo/comments/*` paths resolve before the broader PR
469// patterns kick in.
470app.route("/", commentModerationRoutes);
471
0074234Claude472// Pull requests
473app.route("/", pullRoutes);
79ed944Claude474// PR sandboxes — runnable per-PR environments. Migration 0067.
475app.route("/", prSandboxRoutes);
0074234Claude476
9b3a183Claude477// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
478app.route("/", devEnvRoutes);
479
c81ab7aClaude480// Fork
481app.route("/", forkRoutes);
482
0074234Claude483// Web file editor
484app.route("/", editorRoutes);
485
43de941Claude486// Contributors
487app.route("/", contributorRoutes);
488
699e5c7Claude489// Health liveness + metrics endpoints
2c34075Claude490app.route("/", healthRoutes);
491
f295f78Dictation App492// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
493app.route("/api/platform-status", platformStatus);
494
52ad8b1Claude495// Block L4 — Public stats counters (powers landing-page social proof)
496app.route("/", publicStatsRoutes);
497
498// Block L3 — Live /demo page + /api/v2/demo/* endpoints
499app.route("/", demoRoutes);
500
2316be6Claude501// Public /status — human-readable platform health page
502app.route("/", statusRoutes);
503
b1be050CC LABS App504// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
505// Mounted near the public status route so the two surfaces are visible
506// side-by-side; routes are gated by isSiteAdmin internally.
507app.route("/", adminStatusRoutes);
508
80bed05Claude509// /help — quickstart + API cheatsheet
510app.route("/", helpRoutes);
511
5f2e749Claude512// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
513// so the new editorial pricing layout wins the route; the legacy marketing
514// pricing remains as a safety net but is shadowed at the router.
515app.route("/", pricingRoutes);
516
b0148e9Claude517// /pricing, /features, /about — marketing surface
518app.route("/", marketingRoutes);
519
5618f9aClaude520// SEO: robots.txt + sitemap.xml
521app.route("/", seoRoutes);
522
05cdb85Claude523// /api/version — live build SHA + uptime; client poller uses this to
524// surface 'New version available — reload' banners on deploy.
525app.route("/", versionRoutes);
526
699e5c7Claude527// Health dashboard (per-repo health page)
528app.route("/", healthDashboardRoutes);
529
9dd96b9Test User530// Block R1 — site-admin operations console. MUST be mounted BEFORE
531// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
532// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
533app.route("/", adminOpsRoutes);
f2c00b4CC LABS App534// BLOCK W — Self-host status + bootstrap dashboard.
535app.route("/", adminSelfHostRoutes);
826eccfTest User536// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
537app.route("/", adminDiagnoseRoutes);
9dd96b9Test User538
16b325cClaude539// Insights (time-travel, dependencies, rollback)
540app.route("/", insightRoutes);
541
8d1483cClaude542// DORA metrics page (/:owner/:repo/insights/dora)
543app.route("/", doraRoutes);
544
f1ab587Claude545// Command center dashboard
546app.route("/", dashboardRoutes);
547
36b4cbdClaude548// Legal pages (terms, privacy, AUP)
549app.route("/", legalRoutes);
4b66018Claude550// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
551// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
552// /acceptable-use); these are the formal versions that the legal pages
553// internally link to each other.
554app.route("/", legalTermsRoutes);
555app.route("/", legalPrivacyRoutes);
556app.route("/", legalAcceptableUseRoutes);
557app.route("/", legalDmcaRoutes);
36b4cbdClaude558
bdbd0deClaude559// GitHub import / migration
560app.route("/", importRoutes);
14c3cc8Claude561app.route("/", importBulkRoutes);
f390cfaCC LABS App562app.route("/", importSecretsRoutes);
14c3cc8Claude563app.route("/", migrationRoutes);
564
565// Spec-to-PR (experimental AI-generated draft PRs)
566app.route("/", specsRoutes);
23d0abfClaude567app.route("/", refactorRoutes);
bdbd0deClaude568
c81ab7aClaude569// Explore page
570app.route("/", exploreRoutes);
571
59b6fb2Claude572// Onboarding
573app.route("/", onboardingRoutes);
574
0316dbbClaude575// Admin + feature routes
576app.route("/", adminRoutes);
509c376Claude577app.route("/", adminIntegrationsRoutes);
79ed944Claude578app.route("/", adminAdvancementRoutes);
f764c07Claude579app.route("/", adminDeploysRoutes);
580app.route("/", adminDeploysPageRoutes);
783dd46Claude581app.route("/", adminServerTargetsRoutes);
90c7531Claude582app.route("/", claudeWebRoutes);
9dd96b9Test User583// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude584app.route("/", advisoriesRoutes);
585app.route("/", aiChangelogRoutes);
586app.route("/", aiExplainRoutes);
587app.route("/", aiTestsRoutes);
588app.route("/", askRoutes);
38d31d3Claude589app.route("/", repoChatRoutes);
ee7e577Claude590// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
591// repoChatRoutes so the two surfaces share the catch-all priority.
592app.route("/", personalChatRoutes);
0316dbbClaude593app.route("/", billingRoutes);
8809b87Claude594app.route("/", billingUsageRoutes);
6778ad2Claude595app.route("/", stripeWebhookRoutes);
0316dbbClaude596app.route("/", codeScanningRoutes);
597app.route("/", commitStatusesRoutes);
598app.route("/", copilotRoutes);
599app.route("/", depUpdaterRoutes);
600app.route("/", depsRoutes);
601app.route("/", discussionsRoutes);
602app.route("/", environmentsRoutes);
4bbacbeClaude603app.route("/", previewsRoutes);
79ed944Claude604app.route("/", docsTrackingRoutes);
0316dbbClaude605app.route("/", followsRoutes);
606app.route("/", gatesRoutes);
607app.route("/", gistsRoutes);
608app.route("/", graphqlRoutes);
2c2163eClaude609app.route("/", mcpRoutes);
0316dbbClaude610app.route("/", marketplaceRoutes);
5ca514aClaude611app.route("/", marketplaceAgentsRoutes);
0316dbbClaude612app.route("/", mergeQueueRoutes);
613app.route("/", mirrorsRoutes);
614app.route("/", orgInsightsRoutes);
615app.route("/", packagesRoutes);
616app.route("/", packagesApiRoutes);
617app.route("/", pagesRoutes);
618app.route("/", projectsRoutes);
619app.route("/", protectedTagsRoutes);
620app.route("/", pwaRoutes);
46d6165Claude621app.route("/", installRoutes);
cd4f63bTest User622// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
623app.route("/", dxtRoutes);
662ce86Claude624// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
625// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
626app.route("/", connectClaudeRoutes);
f5b9ef5Claude627// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
628app.route("/", claudeIntegration);
629// Connect guide — public onboarding page (/connect/claude-guide).
630app.route("/", connectRoutes);
ebbb527Claude631// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
632// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
633app.route("/", claudeDeployRoutes);
0316dbbClaude634app.route("/", releasesRoutes);
635app.route("/", requiredChecksRoutes);
636app.route("/", rulesetsRoutes);
637app.route("/", searchRoutes);
638app.route("/", semanticSearchRoutes);
639app.route("/", signingKeysRoutes);
640app.route("/", sponsorsRoutes);
641app.route("/", ssoRoutes);
46d6165Claude642app.route("/", githubOauthRoutes);
582cdacClaude643app.route("/", googleOauthRoutes);
0316dbbClaude644app.route("/", symbolsRoutes);
645app.route("/", templatesRoutes);
646app.route("/", trafficRoutes);
647app.route("/", wikisRoutes);
648app.route("/", workflowsRoutes);
5ff9cc2Claude649app.route("/", workflowArtifactsRoutes);
650app.route("/", workflowSecretsRoutes);
46d6165Claude651app.route("/", sleepModeRoutes);
52ad8b1Claude652app.route("/", vsGithubRoutes);
0316dbbClaude653
45f3b73Claude654// Voice-to-PR — phone-first dictation → spec or issue
655app.route("/", voiceRoutes);
656
cd4f63bTest User657// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
658// before the web catch-all so the bare `/play` literal wins over the
659// `/:owner` user-profile route.
660app.route("/", playgroundRoutes);
661
79136bbClaude662// Web UI (catch-all, must be last)
663app.route("/", webRoutes);
664
c63b860Claude665// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
666// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude667app.notFound((c) => {
36cc17aClaude668 const user = c.get("user") ?? null;
79136bbClaude669 return c.html(
c63b860Claude670 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude671 404
672 );
673});
674
c63b860Claude675// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
676// view. Trace block only shown outside production.
79136bbClaude677app.onError((err, c) => {
80bed05Claude678 reportError(err, {
679 requestId: c.get("requestId"),
680 path: c.req.path,
681 method: c.req.method,
682 });
c63b860Claude683 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
684 // back to the context value set by request-context middleware.
685 const requestId =
686 c.req.header("x-request-id") ||
687 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude688 const user = c.get("user") ?? null;
c63b860Claude689 const trace =
690 process.env.NODE_ENV !== "production" && err && err.message
691 ? err.message
692 : undefined;
79136bbClaude693 return c.html(
c63b860Claude694 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude695 500
696 );
697});
698
699export default app;