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.tsxBlame669 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";
0074234Claude41import editorRoutes from "./routes/editor";
c81ab7aClaude42import forkRoutes from "./routes/fork";
43import webhookRoutes from "./routes/webhooks";
44import exploreRoutes from "./routes/explore";
45import tokenRoutes from "./routes/tokens";
43de941Claude46import contributorRoutes from "./routes/contributors";
699e5c7Claude47import healthRoutes from "./routes/health-probe";
48import healthDashboardRoutes from "./routes/health";
2316be6Claude49import statusRoutes from "./routes/status";
b1be050CC LABS App50import adminStatusRoutes from "./routes/admin-status";
80bed05Claude51import helpRoutes from "./routes/help";
b0148e9Claude52import marketingRoutes from "./routes/marketing";
5f2e749Claude53import pricingRoutes from "./routes/pricing";
5618f9aClaude54import seoRoutes from "./routes/seo";
05cdb85Claude55import versionRoutes from "./routes/version";
f295f78Dictation App56import { platformStatus } from "./routes/platform-status";
52ad8b1Claude57import publicStatsRoutes from "./routes/public-stats";
58import demoRoutes from "./routes/demo";
16b325cClaude59import insightRoutes from "./routes/insights";
f1ab587Claude60import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude61import legalRoutes from "./routes/legal";
4b66018Claude62import legalDmcaRoutes from "./routes/legal/dmca";
63import legalTermsRoutes from "./routes/legal/terms";
64import legalPrivacyRoutes from "./routes/legal/privacy";
65import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude66import importRoutes from "./routes/import";
14c3cc8Claude67import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App68import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude69import migrationRoutes from "./routes/migrations";
70import specsRoutes from "./routes/specs";
23d0abfClaude71import refactorRoutes from "./routes/refactors";
79136bbClaude72import webRoutes from "./routes/web";
0316dbbClaude73import hookRoutes from "./routes/hooks";
74import eventsRoutes from "./routes/events";
75import passkeyRoutes from "./routes/passkeys";
76import oauthRoutes from "./routes/oauth";
77import developerAppsRoutes from "./routes/developer-apps";
78import themeRoutes from "./routes/theme";
79import auditRoutes from "./routes/audit";
80import reactionRoutes from "./routes/reactions";
81import savedReplyRoutes from "./routes/saved-replies";
82import deploymentRoutes from "./routes/deployments";
83import orgRoutes from "./routes/orgs";
84import notificationRoutes from "./routes/notifications";
85import onboardingRoutes from "./routes/onboarding";
86import adminRoutes from "./routes/admin";
f764c07Claude87import adminDeploysRoutes from "./routes/admin-deploys";
88import adminDeploysPageRoutes from "./routes/admin-deploys-page";
9dd96b9Test User89import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App90import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User91import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude92import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude93import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude94import advisoriesRoutes from "./routes/advisories";
95import aiChangelogRoutes from "./routes/ai-changelog";
96import aiExplainRoutes from "./routes/ai-explain";
97import aiTestsRoutes from "./routes/ai-tests";
98import askRoutes from "./routes/ask";
38d31d3Claude99import repoChatRoutes from "./routes/repo-chat";
0316dbbClaude100import billingRoutes from "./routes/billing";
8809b87Claude101import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude102import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude103import codeScanningRoutes from "./routes/code-scanning";
104import commitStatusesRoutes from "./routes/commit-statuses";
105import copilotRoutes from "./routes/copilot";
106import depUpdaterRoutes from "./routes/dep-updater";
107import depsRoutes from "./routes/deps";
108import discussionsRoutes from "./routes/discussions";
109import environmentsRoutes from "./routes/environments";
4bbacbeClaude110import previewsRoutes from "./routes/previews";
79ed944Claude111import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude112import followsRoutes from "./routes/follows";
113import gatesRoutes from "./routes/gates";
114import gistsRoutes from "./routes/gists";
115import graphqlRoutes from "./routes/graphql";
2c2163eClaude116import mcpRoutes from "./routes/mcp";
0316dbbClaude117import marketplaceRoutes from "./routes/marketplace";
118import mergeQueueRoutes from "./routes/merge-queue";
119import mirrorsRoutes from "./routes/mirrors";
120import orgInsightsRoutes from "./routes/org-insights";
121import packagesRoutes from "./routes/packages";
122import packagesApiRoutes from "./routes/packages-api";
123import pagesRoutes from "./routes/pages";
124import projectsRoutes from "./routes/projects";
125import protectedTagsRoutes from "./routes/protected-tags";
126import pwaRoutes from "./routes/pwa";
46d6165Claude127import installRoutes from "./routes/install";
cd4f63bTest User128import dxtRoutes from "./routes/dxt";
662ce86Claude129import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude130import claudeDeployRoutes from "./routes/claude-deploy";
0316dbbClaude131import releasesRoutes from "./routes/releases";
132import requiredChecksRoutes from "./routes/required-checks";
133import rulesetsRoutes from "./routes/rulesets";
134import searchRoutes from "./routes/search";
135import semanticSearchRoutes from "./routes/semantic-search";
136import signingKeysRoutes from "./routes/signing-keys";
137import sponsorsRoutes from "./routes/sponsors";
138import ssoRoutes from "./routes/sso";
46d6165Claude139import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude140import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude141import symbolsRoutes from "./routes/symbols";
142import templatesRoutes from "./routes/templates";
143import trafficRoutes from "./routes/traffic";
144import wikisRoutes from "./routes/wikis";
145import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude146import workflowArtifactsRoutes from "./routes/workflow-artifacts";
147import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude148import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude149import standupRoutes from "./routes/standups";
52ad8b1Claude150import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude151import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User152import playgroundRoutes from "./routes/playground";
59b6fb2Claude153import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
154import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude155
2316901Claude156import type { AuthEnv } from "./middleware/auth";
bf19c50Test User157import { softAuth } from "./middleware/auth";
2316901Claude158
159const app = new Hono<AuthEnv>();
79136bbClaude160
3ef4c9dClaude161// Request context (request ID, start time) runs before everything else
162app.use("*", requestContext);
05b973eClaude163// Middleware — compression first (wraps all responses)
164app.use("*", compress());
f1ffd50Claude165
166// ETag middleware — returns 304 Not Modified on unchanged responses.
167// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
168// SSE + the API surface where it would interfere with streaming.
169app.use("*", async (c, next) => {
170 const p = c.req.path;
171 if (
172 p.includes(".git/") ||
173 p.startsWith("/live-events") ||
174 p.startsWith("/api/events/deploy") ||
3c03977Claude175 p.startsWith("/admin/status") ||
176 // PR live co-editing SSE stream — never etag streaming responses.
177 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude178 ) {
179 return next();
180 }
181 return etag()(c, next);
182});
183
184// Cache-Control middleware — sets sensible defaults on public, anonymous
185// requests. Crontech (when wired as our edge layer) and downstream
186// browsers will honor these. Auth'd users get private,no-store
187// automatically — we never cache responses tied to a session.
188app.use("*", async (c, next) => {
189 await next();
190 // Don't overwrite explicit headers set by route handlers — BUT the
191 // ETag middleware unconditionally sets "private, no-cache, must-
192 // revalidate" so we have to treat that specific value as "no
193 // policy chosen yet" and apply ours. Any route that explicitly set
194 // a different cache-control wins.
195 const existing = c.res.headers.get("cache-control");
196 const etagDefault =
197 existing === "private, no-cache, must-revalidate" ||
198 existing === "no-cache";
199 if (existing && !etagDefault) return;
200 // Anything past auth: private + no-store (avoid leaking session
201 // content into shared caches). softAuth runs before this on the
202 // request, but the response side is what we're stamping.
203 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
204 const p = c.req.path;
205 // Always private for known-authed paths regardless of cookie.
206 if (
207 p.startsWith("/admin") ||
208 p.startsWith("/settings") ||
209 p.startsWith("/dashboard") ||
210 p.startsWith("/notifications") ||
211 p.startsWith("/connect/") ||
212 hasSession
213 ) {
214 c.res.headers.set("cache-control", "private, no-store");
215 return;
216 }
217 // Public marketing surfaces — short edge cache, longer browser cache,
218 // stale-while-revalidate so the user never waits on a stale fetch.
219 const isMarketing =
220 p === "/" ||
221 p === "/features" ||
222 p === "/pricing" ||
223 p === "/about" ||
224 p === "/vs-github" ||
225 p === "/explore" ||
226 p === "/help" ||
227 p === "/changelog" ||
228 p.startsWith("/legal/") ||
229 p === "/terms" ||
230 p === "/privacy" ||
231 p === "/acceptable-use" ||
232 p.startsWith("/docs/");
233 if (isMarketing) {
234 c.res.headers.set(
235 "cache-control",
236 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
237 );
238 return;
239 }
240 // Public repo browse pages — cache aggressively. Edge invalidates
241 // on push via the post-receive hook (future Crontech surge purge).
242 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
243 c.res.headers.set(
244 "cache-control",
245 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
246 );
247 return;
248 }
249 // Default: don't cache anything we haven't explicitly opted in.
250 c.res.headers.set("cache-control", "private, no-store");
251});
05b973eClaude252// Logger only on non-git routes to avoid overhead on clone/push
253app.use("*", async (c, next) => {
254 if (c.req.path.includes(".git/")) return next();
255 return logger()(c, next);
256});
79136bbClaude257app.use("/api/*", cors());
bf19c50Test User258// Global softAuth — populates c.get("user") for every downstream middleware
259// + route. This was previously per-route, which meant rate-limit middleware
260// (and anything else inspecting auth state) always saw a null user. Keep
261// individual routes free to add requireAuth on top for hard gating; this
262// just establishes the user object cheaply.
263app.use("*", softAuth);
290ea77Claude264
36cc17aClaude265// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude266// pre-redesign markup. JSON / static assets keep their own cache rules; only
267// text/html responses get the no-cache stamp. Without this, every push to
268// main left users staring at cached 80s-looking pages from before the design
269// landed.
36cc17aClaude270//
271// We deliberately use `private, no-cache, must-revalidate` rather than
272// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
273// which makes every Back/Forward press a cold server round-trip — that
274// contributed to the "every nav feels like a fresh login" UX complaint.
275// `no-cache` still revalidates on direct fetch but lets bfcache hold the
276// page in memory between navigations.
290ea77Claude277app.use("*", async (c, next) => {
278 await next();
279 const ct = c.res.headers.get("content-type") || "";
280 if (ct.startsWith("text/html")) {
36cc17aClaude281 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude282 }
283});
826eccfTest User284// Rate-limit API + auth endpoints.
285//
a41e675Test User286// `/api/*`: 1000/min per IP — generous so an admin clicking around the
287// operator console (or a CDN/proxy concentrating multiple users behind one
288// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
289// rate limits below, not this one.
290//
291// `authedMultiplier` is set but only fires when an upstream middleware has
292// already populated c.get("user") — most app.use() chains apply softAuth
293// per-route, so the multiplier is best-effort. Keep the anonymous base
294// high enough that humans never feel it.
295//
296// Skip-paths: dashboard plumbing endpoints that the layout polls on a
297// fixed cadence and that we don't want consuming any bucket:
298// /api/version — layout polls every 15s
826eccfTest User299// /api/notifications/count — nav bell unread-count fetcher
300// /pwa/vapid-public-key — fetched once per push-notification opt-in
301app.use(
302 "/api/*",
a41e675Test User303 rateLimit(1000, 60_000, "api", {
826eccfTest User304 authedMultiplier: 4,
305 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
306 })
307);
0316dbbClaude308app.use("/login", rateLimit(20, 60_000, "login"));
309app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude310// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
311app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User312// BLOCK Q2 — throttle magic-link sign-in for the same reason.
313app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude314
59b6fb2Claude315// CSRF protection — set token on all requests, validate on mutations
316app.use("*", csrfToken);
317app.use("*", csrfProtect);
318
45e31d0Claude319// Rate limit auth routes
320app.use("/login", authRateLimit);
321app.use("/register", authRateLimit);
322
59b6fb2Claude323// Rate limit git operations
324app.use("/:owner/:repo.git/*", gitRateLimit);
325
326// Rate limit search
327app.use("/:owner/:repo/search", searchRateLimit);
328app.use("/explore", searchRateLimit);
79136bbClaude329
330// Git Smart HTTP protocol routes (must be before web routes)
331app.route("/", gitRoutes);
332
45e31d0Claude333// REST API v1 (legacy)
79136bbClaude334app.route("/", apiRoutes);
335
52ad8b1Claude336// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
337// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
338// router's catch-shape, and BEFORE adminRoutes so the live /demo page
339// wins over the legacy /demo redirect in src/routes/admin.tsx.
340app.route("/", demoRoutes);
341
0316dbbClaude342// REST API v2 (basePath /api/v2)
343app.route("/", apiV2Routes);
344
e75eddcClaude345// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
346// Mounted alongside apiV2Routes (its own basePath, no path conflict).
347app.route("/", agentsRoutes);
348
ad6d4adClaude349// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
350app.route("/", hookRoutes);
21f8dbdClaude351app.route("/api/events", eventsRoutes);
ad6d4adClaude352
45e31d0Claude353// API documentation
354app.route("/", apiDocsRoutes);
4a80519Claude355app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude356// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
357app.route("/", pullsDashboardRoutes);
e9aa4d8Claude358// Issue command center — global issue dashboard with AI-triage + autopilot signal
359app.route("/", issuesDashboardRoutes);
360// Personal activity timeline — every event across the user's repos, with
361// AI-driven events surfaced separately (the Gluecron differentiator).
362app.route("/", activityRoutes);
363// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
364app.route("/", inboxRoutes);
56801e1Claude365// AI standup feed — daily / weekly Claude-generated team brief
366app.route("/", standupRoutes);
79136bbClaude367
368// Auth routes (register, login, logout)
369app.route("/", authRoutes);
370
c63b860Claude371// BLOCK P1 — Password reset (forgot-password + reset-password)
372app.route("/", passwordResetRoutes);
373
374// BLOCK P2 — Email verification (verify-email + resend)
375app.route("/", emailVerificationRoutes);
376
cd4f63bTest User377// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
378app.route("/", magicLinkRoutes);
379
79136bbClaude380// Settings routes (profile, SSH keys)
381app.route("/", settingsRoutes);
382
7298a17Claude383// 2FA / TOTP settings (Block B4)
384app.route("/", settings2faRoutes);
385
e75eddcClaude386// Agent multiplayer — /settings/agents management UI
387app.route("/", settingsAgentsRoutes);
388
1d4ff60Claude389// Chat integrations — Slack / Discord / Teams (/settings/integrations
390// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
391app.route("/", settingsIntegrationsRoutes);
392app.route("/", integrationsChatRoutes);
393
2df1f8cClaude394// WebAuthn / passkey routes (Block B5)
395app.route("/", passkeyRoutes);
396
058d752Claude397// OAuth 2.0 provider (Block B6)
398app.route("/", oauthRoutes);
399app.route("/", developerAppsRoutes);
400
6fc53bdClaude401// Theme toggle (dark/light cookie)
402app.route("/", themeRoutes);
403
404// Audit log UI
405app.route("/", auditRoutes);
406
407// Reactions API (issues, PRs, comments)
408app.route("/", reactionRoutes);
409
24cf2caClaude410// Saved replies (per-user canned comment templates)
411app.route("/", savedReplyRoutes);
412
413// Environments + deployment history UI
414app.route("/", deploymentRoutes);
415
6563f0aClaude416// Organizations + teams (Block B1)
417app.route("/", orgRoutes);
418
c81ab7aClaude419// API tokens
420app.route("/", tokenRoutes);
421
59b6fb2Claude422// Notifications
3ef4c9dClaude423app.route("/", notificationRoutes);
424
79136bbClaude425// Repo settings (description, visibility, delete)
426app.route("/", repoSettings);
427
23d1a81Claude428// Repo collaborators (add/list/remove)
429app.route("/", collaboratorRoutes);
430
04f6b7fClaude431// Team-based repo collaborators (invite a whole team)
432app.route("/", teamCollaboratorRoutes);
433
434// Collaborator invite accept flow (token-based)
435app.route("/", invitesRoutes);
436
437// Real-time SSE endpoint (topic-based live updates)
438app.route("/", liveEventsRoutes);
439
3c03977Claude440// PR live co-editing — presence + cursors + content sync via SSE.
441app.route("/", prLiveRoutes);
442
c81ab7aClaude443// Webhooks management
444app.route("/", webhookRoutes);
445
79136bbClaude446// Compare view (branch diffs)
447app.route("/", compareRoutes);
448
449// Issue tracker
450app.route("/", issueRoutes);
451
cb5a796Claude452// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
453// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
454// the `/:owner/:repo/comments/*` paths resolve before the broader PR
455// patterns kick in.
456app.route("/", commentModerationRoutes);
457
0074234Claude458// Pull requests
459app.route("/", pullRoutes);
79ed944Claude460// PR sandboxes — runnable per-PR environments. Migration 0067.
461app.route("/", prSandboxRoutes);
0074234Claude462
c81ab7aClaude463// Fork
464app.route("/", forkRoutes);
465
0074234Claude466// Web file editor
467app.route("/", editorRoutes);
468
43de941Claude469// Contributors
470app.route("/", contributorRoutes);
471
699e5c7Claude472// Health liveness + metrics endpoints
2c34075Claude473app.route("/", healthRoutes);
474
f295f78Dictation App475// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
476app.route("/api/platform-status", platformStatus);
477
52ad8b1Claude478// Block L4 — Public stats counters (powers landing-page social proof)
479app.route("/", publicStatsRoutes);
480
481// Block L3 — Live /demo page + /api/v2/demo/* endpoints
482app.route("/", demoRoutes);
483
2316be6Claude484// Public /status — human-readable platform health page
485app.route("/", statusRoutes);
486
b1be050CC LABS App487// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
488// Mounted near the public status route so the two surfaces are visible
489// side-by-side; routes are gated by isSiteAdmin internally.
490app.route("/", adminStatusRoutes);
491
80bed05Claude492// /help — quickstart + API cheatsheet
493app.route("/", helpRoutes);
494
5f2e749Claude495// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
496// so the new editorial pricing layout wins the route; the legacy marketing
497// pricing remains as a safety net but is shadowed at the router.
498app.route("/", pricingRoutes);
499
b0148e9Claude500// /pricing, /features, /about — marketing surface
501app.route("/", marketingRoutes);
502
5618f9aClaude503// SEO: robots.txt + sitemap.xml
504app.route("/", seoRoutes);
505
05cdb85Claude506// /api/version — live build SHA + uptime; client poller uses this to
507// surface 'New version available — reload' banners on deploy.
508app.route("/", versionRoutes);
509
699e5c7Claude510// Health dashboard (per-repo health page)
511app.route("/", healthDashboardRoutes);
512
9dd96b9Test User513// Block R1 — site-admin operations console. MUST be mounted BEFORE
514// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
515// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
516app.route("/", adminOpsRoutes);
f2c00b4CC LABS App517// BLOCK W — Self-host status + bootstrap dashboard.
518app.route("/", adminSelfHostRoutes);
826eccfTest User519// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
520app.route("/", adminDiagnoseRoutes);
9dd96b9Test User521
16b325cClaude522// Insights (time-travel, dependencies, rollback)
523app.route("/", insightRoutes);
524
f1ab587Claude525// Command center dashboard
526app.route("/", dashboardRoutes);
527
36b4cbdClaude528// Legal pages (terms, privacy, AUP)
529app.route("/", legalRoutes);
4b66018Claude530// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
531// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
532// /acceptable-use); these are the formal versions that the legal pages
533// internally link to each other.
534app.route("/", legalTermsRoutes);
535app.route("/", legalPrivacyRoutes);
536app.route("/", legalAcceptableUseRoutes);
537app.route("/", legalDmcaRoutes);
36b4cbdClaude538
bdbd0deClaude539// GitHub import / migration
540app.route("/", importRoutes);
14c3cc8Claude541app.route("/", importBulkRoutes);
f390cfaCC LABS App542app.route("/", importSecretsRoutes);
14c3cc8Claude543app.route("/", migrationRoutes);
544
545// Spec-to-PR (experimental AI-generated draft PRs)
546app.route("/", specsRoutes);
23d0abfClaude547app.route("/", refactorRoutes);
bdbd0deClaude548
c81ab7aClaude549// Explore page
550app.route("/", exploreRoutes);
551
59b6fb2Claude552// Onboarding
553app.route("/", onboardingRoutes);
554
0316dbbClaude555// Admin + feature routes
556app.route("/", adminRoutes);
509c376Claude557app.route("/", adminIntegrationsRoutes);
79ed944Claude558app.route("/", adminAdvancementRoutes);
f764c07Claude559app.route("/", adminDeploysRoutes);
560app.route("/", adminDeploysPageRoutes);
9dd96b9Test User561// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude562app.route("/", advisoriesRoutes);
563app.route("/", aiChangelogRoutes);
564app.route("/", aiExplainRoutes);
565app.route("/", aiTestsRoutes);
566app.route("/", askRoutes);
38d31d3Claude567app.route("/", repoChatRoutes);
0316dbbClaude568app.route("/", billingRoutes);
8809b87Claude569app.route("/", billingUsageRoutes);
6778ad2Claude570app.route("/", stripeWebhookRoutes);
0316dbbClaude571app.route("/", codeScanningRoutes);
572app.route("/", commitStatusesRoutes);
573app.route("/", copilotRoutes);
574app.route("/", depUpdaterRoutes);
575app.route("/", depsRoutes);
576app.route("/", discussionsRoutes);
577app.route("/", environmentsRoutes);
4bbacbeClaude578app.route("/", previewsRoutes);
79ed944Claude579app.route("/", docsTrackingRoutes);
0316dbbClaude580app.route("/", followsRoutes);
581app.route("/", gatesRoutes);
582app.route("/", gistsRoutes);
583app.route("/", graphqlRoutes);
2c2163eClaude584app.route("/", mcpRoutes);
0316dbbClaude585app.route("/", marketplaceRoutes);
586app.route("/", mergeQueueRoutes);
587app.route("/", mirrorsRoutes);
588app.route("/", orgInsightsRoutes);
589app.route("/", packagesRoutes);
590app.route("/", packagesApiRoutes);
591app.route("/", pagesRoutes);
592app.route("/", projectsRoutes);
593app.route("/", protectedTagsRoutes);
594app.route("/", pwaRoutes);
46d6165Claude595app.route("/", installRoutes);
cd4f63bTest User596// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
597app.route("/", dxtRoutes);
662ce86Claude598// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
599// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
600app.route("/", connectClaudeRoutes);
ebbb527Claude601// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
602// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
603app.route("/", claudeDeployRoutes);
0316dbbClaude604app.route("/", releasesRoutes);
605app.route("/", requiredChecksRoutes);
606app.route("/", rulesetsRoutes);
607app.route("/", searchRoutes);
608app.route("/", semanticSearchRoutes);
609app.route("/", signingKeysRoutes);
610app.route("/", sponsorsRoutes);
611app.route("/", ssoRoutes);
46d6165Claude612app.route("/", githubOauthRoutes);
582cdacClaude613app.route("/", googleOauthRoutes);
0316dbbClaude614app.route("/", symbolsRoutes);
615app.route("/", templatesRoutes);
616app.route("/", trafficRoutes);
617app.route("/", wikisRoutes);
618app.route("/", workflowsRoutes);
5ff9cc2Claude619app.route("/", workflowArtifactsRoutes);
620app.route("/", workflowSecretsRoutes);
46d6165Claude621app.route("/", sleepModeRoutes);
52ad8b1Claude622app.route("/", vsGithubRoutes);
0316dbbClaude623
45f3b73Claude624// Voice-to-PR — phone-first dictation → spec or issue
625app.route("/", voiceRoutes);
626
cd4f63bTest User627// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
628// before the web catch-all so the bare `/play` literal wins over the
629// `/:owner` user-profile route.
630app.route("/", playgroundRoutes);
631
79136bbClaude632// Web UI (catch-all, must be last)
633app.route("/", webRoutes);
634
c63b860Claude635// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
636// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude637app.notFound((c) => {
36cc17aClaude638 const user = c.get("user") ?? null;
79136bbClaude639 return c.html(
c63b860Claude640 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude641 404
642 );
643});
644
c63b860Claude645// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
646// view. Trace block only shown outside production.
79136bbClaude647app.onError((err, c) => {
80bed05Claude648 reportError(err, {
649 requestId: c.get("requestId"),
650 path: c.req.path,
651 method: c.req.method,
652 });
c63b860Claude653 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
654 // back to the context value set by request-context middleware.
655 const requestId =
656 c.req.header("x-request-id") ||
657 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude658 const user = c.get("user") ?? null;
c63b860Claude659 const trace =
660 process.env.NODE_ENV !== "production" && err && err.message
661 ? err.message
662 : undefined;
79136bbClaude663 return c.html(
c63b860Claude664 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude665 500
666 );
667});
668
669export default app;