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.tsxBlame681 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";
f1ab587Claude61import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude62import legalRoutes from "./routes/legal";
4b66018Claude63import legalDmcaRoutes from "./routes/legal/dmca";
64import legalTermsRoutes from "./routes/legal/terms";
65import legalPrivacyRoutes from "./routes/legal/privacy";
66import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude67import importRoutes from "./routes/import";
14c3cc8Claude68import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App69import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude70import migrationRoutes from "./routes/migrations";
71import specsRoutes from "./routes/specs";
23d0abfClaude72import refactorRoutes from "./routes/refactors";
79136bbClaude73import webRoutes from "./routes/web";
0316dbbClaude74import hookRoutes from "./routes/hooks";
75import eventsRoutes from "./routes/events";
76import passkeyRoutes from "./routes/passkeys";
77import oauthRoutes from "./routes/oauth";
78import developerAppsRoutes from "./routes/developer-apps";
79import themeRoutes from "./routes/theme";
80import auditRoutes from "./routes/audit";
81import reactionRoutes from "./routes/reactions";
82import savedReplyRoutes from "./routes/saved-replies";
83import deploymentRoutes from "./routes/deployments";
84import orgRoutes from "./routes/orgs";
85import notificationRoutes from "./routes/notifications";
86import onboardingRoutes from "./routes/onboarding";
87import adminRoutes from "./routes/admin";
f764c07Claude88import adminDeploysRoutes from "./routes/admin-deploys";
89import adminDeploysPageRoutes from "./routes/admin-deploys-page";
783dd46Claude90import adminServerTargetsRoutes from "./routes/admin-server-targets";
9dd96b9Test User91import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App92import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User93import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude94import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude95import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude96import advisoriesRoutes from "./routes/advisories";
97import aiChangelogRoutes from "./routes/ai-changelog";
98import aiExplainRoutes from "./routes/ai-explain";
99import aiTestsRoutes from "./routes/ai-tests";
100import askRoutes from "./routes/ask";
38d31d3Claude101import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude102import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude103import billingRoutes from "./routes/billing";
8809b87Claude104import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude105import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude106import codeScanningRoutes from "./routes/code-scanning";
107import commitStatusesRoutes from "./routes/commit-statuses";
108import copilotRoutes from "./routes/copilot";
109import depUpdaterRoutes from "./routes/dep-updater";
110import depsRoutes from "./routes/deps";
111import discussionsRoutes from "./routes/discussions";
112import environmentsRoutes from "./routes/environments";
4bbacbeClaude113import previewsRoutes from "./routes/previews";
79ed944Claude114import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude115import followsRoutes from "./routes/follows";
116import gatesRoutes from "./routes/gates";
117import gistsRoutes from "./routes/gists";
118import graphqlRoutes from "./routes/graphql";
2c2163eClaude119import mcpRoutes from "./routes/mcp";
0316dbbClaude120import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude121import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude122import mergeQueueRoutes from "./routes/merge-queue";
123import mirrorsRoutes from "./routes/mirrors";
124import orgInsightsRoutes from "./routes/org-insights";
125import packagesRoutes from "./routes/packages";
126import packagesApiRoutes from "./routes/packages-api";
127import pagesRoutes from "./routes/pages";
128import projectsRoutes from "./routes/projects";
129import protectedTagsRoutes from "./routes/protected-tags";
130import pwaRoutes from "./routes/pwa";
46d6165Claude131import installRoutes from "./routes/install";
cd4f63bTest User132import dxtRoutes from "./routes/dxt";
662ce86Claude133import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude134import claudeDeployRoutes from "./routes/claude-deploy";
0316dbbClaude135import releasesRoutes from "./routes/releases";
136import requiredChecksRoutes from "./routes/required-checks";
137import rulesetsRoutes from "./routes/rulesets";
138import searchRoutes from "./routes/search";
139import semanticSearchRoutes from "./routes/semantic-search";
140import signingKeysRoutes from "./routes/signing-keys";
141import sponsorsRoutes from "./routes/sponsors";
142import ssoRoutes from "./routes/sso";
46d6165Claude143import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude144import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude145import symbolsRoutes from "./routes/symbols";
146import templatesRoutes from "./routes/templates";
147import trafficRoutes from "./routes/traffic";
148import wikisRoutes from "./routes/wikis";
149import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude150import workflowArtifactsRoutes from "./routes/workflow-artifacts";
151import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude152import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude153import standupRoutes from "./routes/standups";
52ad8b1Claude154import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude155import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User156import playgroundRoutes from "./routes/playground";
59b6fb2Claude157import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
158import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude159
2316901Claude160import type { AuthEnv } from "./middleware/auth";
bf19c50Test User161import { softAuth } from "./middleware/auth";
2316901Claude162
163const app = new Hono<AuthEnv>();
79136bbClaude164
3ef4c9dClaude165// Request context (request ID, start time) runs before everything else
166app.use("*", requestContext);
05b973eClaude167// Middleware — compression first (wraps all responses)
168app.use("*", compress());
f1ffd50Claude169
170// ETag middleware — returns 304 Not Modified on unchanged responses.
171// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
172// SSE + the API surface where it would interfere with streaming.
173app.use("*", async (c, next) => {
174 const p = c.req.path;
175 if (
176 p.includes(".git/") ||
177 p.startsWith("/live-events") ||
178 p.startsWith("/api/events/deploy") ||
3c03977Claude179 p.startsWith("/admin/status") ||
180 // PR live co-editing SSE stream — never etag streaming responses.
181 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude182 ) {
183 return next();
184 }
185 return etag()(c, next);
186});
187
188// Cache-Control middleware — sets sensible defaults on public, anonymous
189// requests. Crontech (when wired as our edge layer) and downstream
190// browsers will honor these. Auth'd users get private,no-store
191// automatically — we never cache responses tied to a session.
192app.use("*", async (c, next) => {
193 await next();
194 // Don't overwrite explicit headers set by route handlers — BUT the
195 // ETag middleware unconditionally sets "private, no-cache, must-
196 // revalidate" so we have to treat that specific value as "no
197 // policy chosen yet" and apply ours. Any route that explicitly set
198 // a different cache-control wins.
199 const existing = c.res.headers.get("cache-control");
200 const etagDefault =
201 existing === "private, no-cache, must-revalidate" ||
202 existing === "no-cache";
203 if (existing && !etagDefault) return;
204 // Anything past auth: private + no-store (avoid leaking session
205 // content into shared caches). softAuth runs before this on the
206 // request, but the response side is what we're stamping.
207 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
208 const p = c.req.path;
209 // Always private for known-authed paths regardless of cookie.
210 if (
211 p.startsWith("/admin") ||
212 p.startsWith("/settings") ||
213 p.startsWith("/dashboard") ||
214 p.startsWith("/notifications") ||
215 p.startsWith("/connect/") ||
216 hasSession
217 ) {
218 c.res.headers.set("cache-control", "private, no-store");
219 return;
220 }
221 // Public marketing surfaces — short edge cache, longer browser cache,
222 // stale-while-revalidate so the user never waits on a stale fetch.
223 const isMarketing =
224 p === "/" ||
225 p === "/features" ||
226 p === "/pricing" ||
227 p === "/about" ||
228 p === "/vs-github" ||
229 p === "/explore" ||
230 p === "/help" ||
231 p === "/changelog" ||
232 p.startsWith("/legal/") ||
233 p === "/terms" ||
234 p === "/privacy" ||
235 p === "/acceptable-use" ||
236 p.startsWith("/docs/");
237 if (isMarketing) {
238 c.res.headers.set(
239 "cache-control",
240 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
241 );
242 return;
243 }
244 // Public repo browse pages — cache aggressively. Edge invalidates
245 // on push via the post-receive hook (future Crontech surge purge).
246 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
247 c.res.headers.set(
248 "cache-control",
249 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
250 );
251 return;
252 }
253 // Default: don't cache anything we haven't explicitly opted in.
254 c.res.headers.set("cache-control", "private, no-store");
255});
05b973eClaude256// Logger only on non-git routes to avoid overhead on clone/push
257app.use("*", async (c, next) => {
258 if (c.req.path.includes(".git/")) return next();
259 return logger()(c, next);
260});
79136bbClaude261app.use("/api/*", cors());
bf19c50Test User262// Global softAuth — populates c.get("user") for every downstream middleware
263// + route. This was previously per-route, which meant rate-limit middleware
264// (and anything else inspecting auth state) always saw a null user. Keep
265// individual routes free to add requireAuth on top for hard gating; this
266// just establishes the user object cheaply.
267app.use("*", softAuth);
290ea77Claude268
36cc17aClaude269// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude270// pre-redesign markup. JSON / static assets keep their own cache rules; only
271// text/html responses get the no-cache stamp. Without this, every push to
272// main left users staring at cached 80s-looking pages from before the design
273// landed.
36cc17aClaude274//
275// We deliberately use `private, no-cache, must-revalidate` rather than
276// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
277// which makes every Back/Forward press a cold server round-trip — that
278// contributed to the "every nav feels like a fresh login" UX complaint.
279// `no-cache` still revalidates on direct fetch but lets bfcache hold the
280// page in memory between navigations.
290ea77Claude281app.use("*", async (c, next) => {
282 await next();
283 const ct = c.res.headers.get("content-type") || "";
284 if (ct.startsWith("text/html")) {
36cc17aClaude285 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude286 }
287});
826eccfTest User288// Rate-limit API + auth endpoints.
289//
a41e675Test User290// `/api/*`: 1000/min per IP — generous so an admin clicking around the
291// operator console (or a CDN/proxy concentrating multiple users behind one
292// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
293// rate limits below, not this one.
294//
295// `authedMultiplier` is set but only fires when an upstream middleware has
296// already populated c.get("user") — most app.use() chains apply softAuth
297// per-route, so the multiplier is best-effort. Keep the anonymous base
298// high enough that humans never feel it.
299//
300// Skip-paths: dashboard plumbing endpoints that the layout polls on a
301// fixed cadence and that we don't want consuming any bucket:
302// /api/version — layout polls every 15s
826eccfTest User303// /api/notifications/count — nav bell unread-count fetcher
304// /pwa/vapid-public-key — fetched once per push-notification opt-in
305app.use(
306 "/api/*",
a41e675Test User307 rateLimit(1000, 60_000, "api", {
826eccfTest User308 authedMultiplier: 4,
309 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
310 })
311);
0316dbbClaude312app.use("/login", rateLimit(20, 60_000, "login"));
313app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude314// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
315app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User316// BLOCK Q2 — throttle magic-link sign-in for the same reason.
317app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude318
59b6fb2Claude319// CSRF protection — set token on all requests, validate on mutations
320app.use("*", csrfToken);
321app.use("*", csrfProtect);
322
45e31d0Claude323// Rate limit auth routes
324app.use("/login", authRateLimit);
325app.use("/register", authRateLimit);
326
59b6fb2Claude327// Rate limit git operations
328app.use("/:owner/:repo.git/*", gitRateLimit);
329
330// Rate limit search
331app.use("/:owner/:repo/search", searchRateLimit);
332app.use("/explore", searchRateLimit);
79136bbClaude333
334// Git Smart HTTP protocol routes (must be before web routes)
335app.route("/", gitRoutes);
336
45e31d0Claude337// REST API v1 (legacy)
79136bbClaude338app.route("/", apiRoutes);
339
52ad8b1Claude340// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
341// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
342// router's catch-shape, and BEFORE adminRoutes so the live /demo page
343// wins over the legacy /demo redirect in src/routes/admin.tsx.
344app.route("/", demoRoutes);
345
0316dbbClaude346// REST API v2 (basePath /api/v2)
347app.route("/", apiV2Routes);
348
e75eddcClaude349// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
350// Mounted alongside apiV2Routes (its own basePath, no path conflict).
351app.route("/", agentsRoutes);
352
ad6d4adClaude353// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
354app.route("/", hookRoutes);
21f8dbdClaude355app.route("/api/events", eventsRoutes);
ad6d4adClaude356
45e31d0Claude357// API documentation
358app.route("/", apiDocsRoutes);
4a80519Claude359app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude360// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
361app.route("/", pullsDashboardRoutes);
e9aa4d8Claude362// Issue command center — global issue dashboard with AI-triage + autopilot signal
363app.route("/", issuesDashboardRoutes);
364// Personal activity timeline — every event across the user's repos, with
365// AI-driven events surfaced separately (the Gluecron differentiator).
366app.route("/", activityRoutes);
367// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
368app.route("/", inboxRoutes);
56801e1Claude369// AI standup feed — daily / weekly Claude-generated team brief
370app.route("/", standupRoutes);
79136bbClaude371
372// Auth routes (register, login, logout)
373app.route("/", authRoutes);
374
c63b860Claude375// BLOCK P1 — Password reset (forgot-password + reset-password)
376app.route("/", passwordResetRoutes);
377
378// BLOCK P2 — Email verification (verify-email + resend)
379app.route("/", emailVerificationRoutes);
380
cd4f63bTest User381// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
382app.route("/", magicLinkRoutes);
383
79136bbClaude384// Settings routes (profile, SSH keys)
385app.route("/", settingsRoutes);
386
7298a17Claude387// 2FA / TOTP settings (Block B4)
388app.route("/", settings2faRoutes);
389
e75eddcClaude390// Agent multiplayer — /settings/agents management UI
391app.route("/", settingsAgentsRoutes);
392
1d4ff60Claude393// Chat integrations — Slack / Discord / Teams (/settings/integrations
394// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
395app.route("/", settingsIntegrationsRoutes);
396app.route("/", integrationsChatRoutes);
397
2df1f8cClaude398// WebAuthn / passkey routes (Block B5)
399app.route("/", passkeyRoutes);
400
058d752Claude401// OAuth 2.0 provider (Block B6)
402app.route("/", oauthRoutes);
403app.route("/", developerAppsRoutes);
404
6fc53bdClaude405// Theme toggle (dark/light cookie)
406app.route("/", themeRoutes);
407
408// Audit log UI
409app.route("/", auditRoutes);
410
411// Reactions API (issues, PRs, comments)
412app.route("/", reactionRoutes);
413
24cf2caClaude414// Saved replies (per-user canned comment templates)
415app.route("/", savedReplyRoutes);
416
417// Environments + deployment history UI
418app.route("/", deploymentRoutes);
419
6563f0aClaude420// Organizations + teams (Block B1)
421app.route("/", orgRoutes);
422
c81ab7aClaude423// API tokens
424app.route("/", tokenRoutes);
425
59b6fb2Claude426// Notifications
3ef4c9dClaude427app.route("/", notificationRoutes);
428
79136bbClaude429// Repo settings (description, visibility, delete)
430app.route("/", repoSettings);
431
23d1a81Claude432// Repo collaborators (add/list/remove)
433app.route("/", collaboratorRoutes);
434
04f6b7fClaude435// Team-based repo collaborators (invite a whole team)
436app.route("/", teamCollaboratorRoutes);
437
438// Collaborator invite accept flow (token-based)
439app.route("/", invitesRoutes);
440
441// Real-time SSE endpoint (topic-based live updates)
442app.route("/", liveEventsRoutes);
443
3c03977Claude444// PR live co-editing — presence + cursors + content sync via SSE.
445app.route("/", prLiveRoutes);
446
c81ab7aClaude447// Webhooks management
448app.route("/", webhookRoutes);
449
79136bbClaude450// Compare view (branch diffs)
451app.route("/", compareRoutes);
452
453// Issue tracker
454app.route("/", issueRoutes);
455
cb5a796Claude456// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
457// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
458// the `/:owner/:repo/comments/*` paths resolve before the broader PR
459// patterns kick in.
460app.route("/", commentModerationRoutes);
461
0074234Claude462// Pull requests
463app.route("/", pullRoutes);
79ed944Claude464// PR sandboxes — runnable per-PR environments. Migration 0067.
465app.route("/", prSandboxRoutes);
0074234Claude466
9b3a183Claude467// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
468app.route("/", devEnvRoutes);
469
c81ab7aClaude470// Fork
471app.route("/", forkRoutes);
472
0074234Claude473// Web file editor
474app.route("/", editorRoutes);
475
43de941Claude476// Contributors
477app.route("/", contributorRoutes);
478
699e5c7Claude479// Health liveness + metrics endpoints
2c34075Claude480app.route("/", healthRoutes);
481
f295f78Dictation App482// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
483app.route("/api/platform-status", platformStatus);
484
52ad8b1Claude485// Block L4 — Public stats counters (powers landing-page social proof)
486app.route("/", publicStatsRoutes);
487
488// Block L3 — Live /demo page + /api/v2/demo/* endpoints
489app.route("/", demoRoutes);
490
2316be6Claude491// Public /status — human-readable platform health page
492app.route("/", statusRoutes);
493
b1be050CC LABS App494// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
495// Mounted near the public status route so the two surfaces are visible
496// side-by-side; routes are gated by isSiteAdmin internally.
497app.route("/", adminStatusRoutes);
498
80bed05Claude499// /help — quickstart + API cheatsheet
500app.route("/", helpRoutes);
501
5f2e749Claude502// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
503// so the new editorial pricing layout wins the route; the legacy marketing
504// pricing remains as a safety net but is shadowed at the router.
505app.route("/", pricingRoutes);
506
b0148e9Claude507// /pricing, /features, /about — marketing surface
508app.route("/", marketingRoutes);
509
5618f9aClaude510// SEO: robots.txt + sitemap.xml
511app.route("/", seoRoutes);
512
05cdb85Claude513// /api/version — live build SHA + uptime; client poller uses this to
514// surface 'New version available — reload' banners on deploy.
515app.route("/", versionRoutes);
516
699e5c7Claude517// Health dashboard (per-repo health page)
518app.route("/", healthDashboardRoutes);
519
9dd96b9Test User520// Block R1 — site-admin operations console. MUST be mounted BEFORE
521// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
522// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
523app.route("/", adminOpsRoutes);
f2c00b4CC LABS App524// BLOCK W — Self-host status + bootstrap dashboard.
525app.route("/", adminSelfHostRoutes);
826eccfTest User526// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
527app.route("/", adminDiagnoseRoutes);
9dd96b9Test User528
16b325cClaude529// Insights (time-travel, dependencies, rollback)
530app.route("/", insightRoutes);
531
f1ab587Claude532// Command center dashboard
533app.route("/", dashboardRoutes);
534
36b4cbdClaude535// Legal pages (terms, privacy, AUP)
536app.route("/", legalRoutes);
4b66018Claude537// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
538// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
539// /acceptable-use); these are the formal versions that the legal pages
540// internally link to each other.
541app.route("/", legalTermsRoutes);
542app.route("/", legalPrivacyRoutes);
543app.route("/", legalAcceptableUseRoutes);
544app.route("/", legalDmcaRoutes);
36b4cbdClaude545
bdbd0deClaude546// GitHub import / migration
547app.route("/", importRoutes);
14c3cc8Claude548app.route("/", importBulkRoutes);
f390cfaCC LABS App549app.route("/", importSecretsRoutes);
14c3cc8Claude550app.route("/", migrationRoutes);
551
552// Spec-to-PR (experimental AI-generated draft PRs)
553app.route("/", specsRoutes);
23d0abfClaude554app.route("/", refactorRoutes);
bdbd0deClaude555
c81ab7aClaude556// Explore page
557app.route("/", exploreRoutes);
558
59b6fb2Claude559// Onboarding
560app.route("/", onboardingRoutes);
561
0316dbbClaude562// Admin + feature routes
563app.route("/", adminRoutes);
509c376Claude564app.route("/", adminIntegrationsRoutes);
79ed944Claude565app.route("/", adminAdvancementRoutes);
f764c07Claude566app.route("/", adminDeploysRoutes);
567app.route("/", adminDeploysPageRoutes);
783dd46Claude568app.route("/", adminServerTargetsRoutes);
9dd96b9Test User569// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude570app.route("/", advisoriesRoutes);
571app.route("/", aiChangelogRoutes);
572app.route("/", aiExplainRoutes);
573app.route("/", aiTestsRoutes);
574app.route("/", askRoutes);
38d31d3Claude575app.route("/", repoChatRoutes);
ee7e577Claude576// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
577// repoChatRoutes so the two surfaces share the catch-all priority.
578app.route("/", personalChatRoutes);
0316dbbClaude579app.route("/", billingRoutes);
8809b87Claude580app.route("/", billingUsageRoutes);
6778ad2Claude581app.route("/", stripeWebhookRoutes);
0316dbbClaude582app.route("/", codeScanningRoutes);
583app.route("/", commitStatusesRoutes);
584app.route("/", copilotRoutes);
585app.route("/", depUpdaterRoutes);
586app.route("/", depsRoutes);
587app.route("/", discussionsRoutes);
588app.route("/", environmentsRoutes);
4bbacbeClaude589app.route("/", previewsRoutes);
79ed944Claude590app.route("/", docsTrackingRoutes);
0316dbbClaude591app.route("/", followsRoutes);
592app.route("/", gatesRoutes);
593app.route("/", gistsRoutes);
594app.route("/", graphqlRoutes);
2c2163eClaude595app.route("/", mcpRoutes);
0316dbbClaude596app.route("/", marketplaceRoutes);
5ca514aClaude597app.route("/", marketplaceAgentsRoutes);
0316dbbClaude598app.route("/", mergeQueueRoutes);
599app.route("/", mirrorsRoutes);
600app.route("/", orgInsightsRoutes);
601app.route("/", packagesRoutes);
602app.route("/", packagesApiRoutes);
603app.route("/", pagesRoutes);
604app.route("/", projectsRoutes);
605app.route("/", protectedTagsRoutes);
606app.route("/", pwaRoutes);
46d6165Claude607app.route("/", installRoutes);
cd4f63bTest User608// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
609app.route("/", dxtRoutes);
662ce86Claude610// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
611// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
612app.route("/", connectClaudeRoutes);
ebbb527Claude613// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
614// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
615app.route("/", claudeDeployRoutes);
0316dbbClaude616app.route("/", releasesRoutes);
617app.route("/", requiredChecksRoutes);
618app.route("/", rulesetsRoutes);
619app.route("/", searchRoutes);
620app.route("/", semanticSearchRoutes);
621app.route("/", signingKeysRoutes);
622app.route("/", sponsorsRoutes);
623app.route("/", ssoRoutes);
46d6165Claude624app.route("/", githubOauthRoutes);
582cdacClaude625app.route("/", googleOauthRoutes);
0316dbbClaude626app.route("/", symbolsRoutes);
627app.route("/", templatesRoutes);
628app.route("/", trafficRoutes);
629app.route("/", wikisRoutes);
630app.route("/", workflowsRoutes);
5ff9cc2Claude631app.route("/", workflowArtifactsRoutes);
632app.route("/", workflowSecretsRoutes);
46d6165Claude633app.route("/", sleepModeRoutes);
52ad8b1Claude634app.route("/", vsGithubRoutes);
0316dbbClaude635
45f3b73Claude636// Voice-to-PR — phone-first dictation → spec or issue
637app.route("/", voiceRoutes);
638
cd4f63bTest User639// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
640// before the web catch-all so the bare `/play` literal wins over the
641// `/:owner` user-profile route.
642app.route("/", playgroundRoutes);
643
79136bbClaude644// Web UI (catch-all, must be last)
645app.route("/", webRoutes);
646
c63b860Claude647// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
648// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude649app.notFound((c) => {
36cc17aClaude650 const user = c.get("user") ?? null;
79136bbClaude651 return c.html(
c63b860Claude652 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude653 404
654 );
655});
656
c63b860Claude657// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
658// view. Trace block only shown outside production.
79136bbClaude659app.onError((err, c) => {
80bed05Claude660 reportError(err, {
661 requestId: c.get("requestId"),
662 path: c.req.path,
663 method: c.req.method,
664 });
c63b860Claude665 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
666 // back to the context value set by request-context middleware.
667 const requestId =
668 c.req.header("x-request-id") ||
669 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude670 const user = c.get("user") ?? null;
c63b860Claude671 const trace =
672 process.env.NODE_ENV !== "production" && err && err.message
673 ? err.message
674 : undefined;
79136bbClaude675 return c.html(
c63b860Claude676 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude677 500
678 );
679});
680
681export default app;