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.tsxBlame695 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";
90c7531Claude91import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User92import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App93import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User94import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude95import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude96import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude97import advisoriesRoutes from "./routes/advisories";
98import aiChangelogRoutes from "./routes/ai-changelog";
99import aiExplainRoutes from "./routes/ai-explain";
100import aiTestsRoutes from "./routes/ai-tests";
101import askRoutes from "./routes/ask";
38d31d3Claude102import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude103import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude104import billingRoutes from "./routes/billing";
8809b87Claude105import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude106import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude107import codeScanningRoutes from "./routes/code-scanning";
108import commitStatusesRoutes from "./routes/commit-statuses";
109import copilotRoutes from "./routes/copilot";
110import depUpdaterRoutes from "./routes/dep-updater";
111import depsRoutes from "./routes/deps";
112import discussionsRoutes from "./routes/discussions";
113import environmentsRoutes from "./routes/environments";
4bbacbeClaude114import previewsRoutes from "./routes/previews";
79ed944Claude115import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude116import followsRoutes from "./routes/follows";
117import gatesRoutes from "./routes/gates";
118import gistsRoutes from "./routes/gists";
119import graphqlRoutes from "./routes/graphql";
2c2163eClaude120import mcpRoutes from "./routes/mcp";
0316dbbClaude121import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude122import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude123import mergeQueueRoutes from "./routes/merge-queue";
124import mirrorsRoutes from "./routes/mirrors";
125import orgInsightsRoutes from "./routes/org-insights";
126import packagesRoutes from "./routes/packages";
127import packagesApiRoutes from "./routes/packages-api";
128import pagesRoutes from "./routes/pages";
129import projectsRoutes from "./routes/projects";
130import protectedTagsRoutes from "./routes/protected-tags";
131import pwaRoutes from "./routes/pwa";
46d6165Claude132import installRoutes from "./routes/install";
cd4f63bTest User133import dxtRoutes from "./routes/dxt";
662ce86Claude134import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude135import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude136import claudeIntegration from "./routes/claude-integration";
137import connectRoutes from "./routes/connect";
0316dbbClaude138import releasesRoutes from "./routes/releases";
139import requiredChecksRoutes from "./routes/required-checks";
140import rulesetsRoutes from "./routes/rulesets";
141import searchRoutes from "./routes/search";
142import semanticSearchRoutes from "./routes/semantic-search";
143import signingKeysRoutes from "./routes/signing-keys";
144import sponsorsRoutes from "./routes/sponsors";
145import ssoRoutes from "./routes/sso";
46d6165Claude146import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude147import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude148import symbolsRoutes from "./routes/symbols";
149import templatesRoutes from "./routes/templates";
150import trafficRoutes from "./routes/traffic";
151import wikisRoutes from "./routes/wikis";
152import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude153import workflowArtifactsRoutes from "./routes/workflow-artifacts";
154import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude155import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude156import standupRoutes from "./routes/standups";
52ad8b1Claude157import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude158import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User159import playgroundRoutes from "./routes/playground";
59b6fb2Claude160import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
161import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude162import { noCache } from "./middleware/no-cache";
79136bbClaude163
2316901Claude164import type { AuthEnv } from "./middleware/auth";
bf19c50Test User165import { softAuth } from "./middleware/auth";
2316901Claude166
167const app = new Hono<AuthEnv>();
79136bbClaude168
3ef4c9dClaude169// Request context (request ID, start time) runs before everything else
170app.use("*", requestContext);
05b973eClaude171// Middleware — compression first (wraps all responses)
172app.use("*", compress());
f1ffd50Claude173
174// ETag middleware — returns 304 Not Modified on unchanged responses.
175// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
176// SSE + the API surface where it would interfere with streaming.
177app.use("*", async (c, next) => {
178 const p = c.req.path;
179 if (
180 p.includes(".git/") ||
181 p.startsWith("/live-events") ||
182 p.startsWith("/api/events/deploy") ||
3c03977Claude183 p.startsWith("/admin/status") ||
184 // PR live co-editing SSE stream — never etag streaming responses.
185 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude186 ) {
187 return next();
188 }
189 return etag()(c, next);
190});
191
192// Cache-Control middleware — sets sensible defaults on public, anonymous
193// requests. Crontech (when wired as our edge layer) and downstream
194// browsers will honor these. Auth'd users get private,no-store
195// automatically — we never cache responses tied to a session.
196app.use("*", async (c, next) => {
197 await next();
198 // Don't overwrite explicit headers set by route handlers — BUT the
199 // ETag middleware unconditionally sets "private, no-cache, must-
200 // revalidate" so we have to treat that specific value as "no
201 // policy chosen yet" and apply ours. Any route that explicitly set
202 // a different cache-control wins.
203 const existing = c.res.headers.get("cache-control");
204 const etagDefault =
205 existing === "private, no-cache, must-revalidate" ||
206 existing === "no-cache";
207 if (existing && !etagDefault) return;
208 // Anything past auth: private + no-store (avoid leaking session
209 // content into shared caches). softAuth runs before this on the
210 // request, but the response side is what we're stamping.
211 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
212 const p = c.req.path;
213 // Always private for known-authed paths regardless of cookie.
214 if (
215 p.startsWith("/admin") ||
216 p.startsWith("/settings") ||
217 p.startsWith("/dashboard") ||
218 p.startsWith("/notifications") ||
219 p.startsWith("/connect/") ||
220 hasSession
221 ) {
222 c.res.headers.set("cache-control", "private, no-store");
223 return;
224 }
225 // Public marketing surfaces — short edge cache, longer browser cache,
226 // stale-while-revalidate so the user never waits on a stale fetch.
227 const isMarketing =
228 p === "/" ||
229 p === "/features" ||
230 p === "/pricing" ||
231 p === "/about" ||
232 p === "/vs-github" ||
233 p === "/explore" ||
234 p === "/help" ||
235 p === "/changelog" ||
236 p.startsWith("/legal/") ||
237 p === "/terms" ||
238 p === "/privacy" ||
239 p === "/acceptable-use" ||
240 p.startsWith("/docs/");
241 if (isMarketing) {
242 c.res.headers.set(
243 "cache-control",
244 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
245 );
246 return;
247 }
248 // Public repo browse pages — cache aggressively. Edge invalidates
249 // on push via the post-receive hook (future Crontech surge purge).
250 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
251 c.res.headers.set(
252 "cache-control",
253 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
254 );
255 return;
256 }
257 // Default: don't cache anything we haven't explicitly opted in.
258 c.res.headers.set("cache-control", "private, no-store");
259});
05b973eClaude260// Logger only on non-git routes to avoid overhead on clone/push
261app.use("*", async (c, next) => {
262 if (c.req.path.includes(".git/")) return next();
263 return logger()(c, next);
264});
79136bbClaude265app.use("/api/*", cors());
bf19c50Test User266// Global softAuth — populates c.get("user") for every downstream middleware
267// + route. This was previously per-route, which meant rate-limit middleware
268// (and anything else inspecting auth state) always saw a null user. Keep
269// individual routes free to add requireAuth on top for hard gating; this
270// just establishes the user object cheaply.
271app.use("*", softAuth);
290ea77Claude272
36cc17aClaude273// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude274// pre-redesign markup. JSON / static assets keep their own cache rules; only
275// text/html responses get the no-cache stamp. Without this, every push to
276// main left users staring at cached 80s-looking pages from before the design
277// landed.
36cc17aClaude278//
279// We deliberately use `private, no-cache, must-revalidate` rather than
280// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
281// which makes every Back/Forward press a cold server round-trip — that
282// contributed to the "every nav feels like a fresh login" UX complaint.
283// `no-cache` still revalidates on direct fetch but lets bfcache hold the
284// page in memory between navigations.
290ea77Claude285app.use("*", async (c, next) => {
286 await next();
287 const ct = c.res.headers.get("content-type") || "";
288 if (ct.startsWith("text/html")) {
36cc17aClaude289 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude290 }
291});
826eccfTest User292// Rate-limit API + auth endpoints.
293//
a41e675Test User294// `/api/*`: 1000/min per IP — generous so an admin clicking around the
295// operator console (or a CDN/proxy concentrating multiple users behind one
296// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
297// rate limits below, not this one.
298//
299// `authedMultiplier` is set but only fires when an upstream middleware has
300// already populated c.get("user") — most app.use() chains apply softAuth
301// per-route, so the multiplier is best-effort. Keep the anonymous base
302// high enough that humans never feel it.
303//
304// Skip-paths: dashboard plumbing endpoints that the layout polls on a
305// fixed cadence and that we don't want consuming any bucket:
306// /api/version — layout polls every 15s
826eccfTest User307// /api/notifications/count — nav bell unread-count fetcher
308// /pwa/vapid-public-key — fetched once per push-notification opt-in
309app.use(
310 "/api/*",
a41e675Test User311 rateLimit(1000, 60_000, "api", {
826eccfTest User312 authedMultiplier: 4,
313 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
314 })
315);
0316dbbClaude316app.use("/login", rateLimit(20, 60_000, "login"));
317app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude318// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
319app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User320// BLOCK Q2 — throttle magic-link sign-in for the same reason.
321app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude322
59b6fb2Claude323// CSRF protection — set token on all requests, validate on mutations
324app.use("*", csrfToken);
325app.use("*", csrfProtect);
326
45e31d0Claude327// Rate limit auth routes
328app.use("/login", authRateLimit);
329app.use("/register", authRateLimit);
330
59b6fb2Claude331// Rate limit git operations
332app.use("/:owner/:repo.git/*", gitRateLimit);
333
334// Rate limit search
335app.use("/:owner/:repo/search", searchRateLimit);
336app.use("/explore", searchRateLimit);
79136bbClaude337
f5b9ef5Claude338// No-cache for HTML — ensures browsers and proxies never serve stale pages.
339// The middleware only stamps text/html responses so static assets keep
340// their own cache policies unchanged.
341app.use("*", noCache);
342
79136bbClaude343// Git Smart HTTP protocol routes (must be before web routes)
344app.route("/", gitRoutes);
345
45e31d0Claude346// REST API v1 (legacy)
79136bbClaude347app.route("/", apiRoutes);
348
52ad8b1Claude349// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
350// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
351// router's catch-shape, and BEFORE adminRoutes so the live /demo page
352// wins over the legacy /demo redirect in src/routes/admin.tsx.
353app.route("/", demoRoutes);
354
0316dbbClaude355// REST API v2 (basePath /api/v2)
356app.route("/", apiV2Routes);
357
e75eddcClaude358// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
359// Mounted alongside apiV2Routes (its own basePath, no path conflict).
360app.route("/", agentsRoutes);
361
ad6d4adClaude362// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
363app.route("/", hookRoutes);
21f8dbdClaude364app.route("/api/events", eventsRoutes);
ad6d4adClaude365
45e31d0Claude366// API documentation
367app.route("/", apiDocsRoutes);
4a80519Claude368app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude369// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
370app.route("/", pullsDashboardRoutes);
e9aa4d8Claude371// Issue command center — global issue dashboard with AI-triage + autopilot signal
372app.route("/", issuesDashboardRoutes);
373// Personal activity timeline — every event across the user's repos, with
374// AI-driven events surfaced separately (the Gluecron differentiator).
375app.route("/", activityRoutes);
376// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
377app.route("/", inboxRoutes);
56801e1Claude378// AI standup feed — daily / weekly Claude-generated team brief
379app.route("/", standupRoutes);
79136bbClaude380
381// Auth routes (register, login, logout)
382app.route("/", authRoutes);
383
c63b860Claude384// BLOCK P1 — Password reset (forgot-password + reset-password)
385app.route("/", passwordResetRoutes);
386
387// BLOCK P2 — Email verification (verify-email + resend)
388app.route("/", emailVerificationRoutes);
389
cd4f63bTest User390// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
391app.route("/", magicLinkRoutes);
392
79136bbClaude393// Settings routes (profile, SSH keys)
394app.route("/", settingsRoutes);
395
7298a17Claude396// 2FA / TOTP settings (Block B4)
397app.route("/", settings2faRoutes);
398
e75eddcClaude399// Agent multiplayer — /settings/agents management UI
400app.route("/", settingsAgentsRoutes);
401
1d4ff60Claude402// Chat integrations — Slack / Discord / Teams (/settings/integrations
403// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
404app.route("/", settingsIntegrationsRoutes);
405app.route("/", integrationsChatRoutes);
406
2df1f8cClaude407// WebAuthn / passkey routes (Block B5)
408app.route("/", passkeyRoutes);
409
058d752Claude410// OAuth 2.0 provider (Block B6)
411app.route("/", oauthRoutes);
412app.route("/", developerAppsRoutes);
413
6fc53bdClaude414// Theme toggle (dark/light cookie)
415app.route("/", themeRoutes);
416
417// Audit log UI
418app.route("/", auditRoutes);
419
420// Reactions API (issues, PRs, comments)
421app.route("/", reactionRoutes);
422
24cf2caClaude423// Saved replies (per-user canned comment templates)
424app.route("/", savedReplyRoutes);
425
426// Environments + deployment history UI
427app.route("/", deploymentRoutes);
428
6563f0aClaude429// Organizations + teams (Block B1)
430app.route("/", orgRoutes);
431
c81ab7aClaude432// API tokens
433app.route("/", tokenRoutes);
434
59b6fb2Claude435// Notifications
3ef4c9dClaude436app.route("/", notificationRoutes);
437
79136bbClaude438// Repo settings (description, visibility, delete)
439app.route("/", repoSettings);
440
23d1a81Claude441// Repo collaborators (add/list/remove)
442app.route("/", collaboratorRoutes);
443
04f6b7fClaude444// Team-based repo collaborators (invite a whole team)
445app.route("/", teamCollaboratorRoutes);
446
447// Collaborator invite accept flow (token-based)
448app.route("/", invitesRoutes);
449
450// Real-time SSE endpoint (topic-based live updates)
451app.route("/", liveEventsRoutes);
452
3c03977Claude453// PR live co-editing — presence + cursors + content sync via SSE.
454app.route("/", prLiveRoutes);
455
c81ab7aClaude456// Webhooks management
457app.route("/", webhookRoutes);
458
79136bbClaude459// Compare view (branch diffs)
460app.route("/", compareRoutes);
461
462// Issue tracker
463app.route("/", issueRoutes);
464
cb5a796Claude465// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
466// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
467// the `/:owner/:repo/comments/*` paths resolve before the broader PR
468// patterns kick in.
469app.route("/", commentModerationRoutes);
470
0074234Claude471// Pull requests
472app.route("/", pullRoutes);
79ed944Claude473// PR sandboxes — runnable per-PR environments. Migration 0067.
474app.route("/", prSandboxRoutes);
0074234Claude475
9b3a183Claude476// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
477app.route("/", devEnvRoutes);
478
c81ab7aClaude479// Fork
480app.route("/", forkRoutes);
481
0074234Claude482// Web file editor
483app.route("/", editorRoutes);
484
43de941Claude485// Contributors
486app.route("/", contributorRoutes);
487
699e5c7Claude488// Health liveness + metrics endpoints
2c34075Claude489app.route("/", healthRoutes);
490
f295f78Dictation App491// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
492app.route("/api/platform-status", platformStatus);
493
52ad8b1Claude494// Block L4 — Public stats counters (powers landing-page social proof)
495app.route("/", publicStatsRoutes);
496
497// Block L3 — Live /demo page + /api/v2/demo/* endpoints
498app.route("/", demoRoutes);
499
2316be6Claude500// Public /status — human-readable platform health page
501app.route("/", statusRoutes);
502
b1be050CC LABS App503// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
504// Mounted near the public status route so the two surfaces are visible
505// side-by-side; routes are gated by isSiteAdmin internally.
506app.route("/", adminStatusRoutes);
507
80bed05Claude508// /help — quickstart + API cheatsheet
509app.route("/", helpRoutes);
510
5f2e749Claude511// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
512// so the new editorial pricing layout wins the route; the legacy marketing
513// pricing remains as a safety net but is shadowed at the router.
514app.route("/", pricingRoutes);
515
b0148e9Claude516// /pricing, /features, /about — marketing surface
517app.route("/", marketingRoutes);
518
5618f9aClaude519// SEO: robots.txt + sitemap.xml
520app.route("/", seoRoutes);
521
05cdb85Claude522// /api/version — live build SHA + uptime; client poller uses this to
523// surface 'New version available — reload' banners on deploy.
524app.route("/", versionRoutes);
525
699e5c7Claude526// Health dashboard (per-repo health page)
527app.route("/", healthDashboardRoutes);
528
9dd96b9Test User529// Block R1 — site-admin operations console. MUST be mounted BEFORE
530// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
531// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
532app.route("/", adminOpsRoutes);
f2c00b4CC LABS App533// BLOCK W — Self-host status + bootstrap dashboard.
534app.route("/", adminSelfHostRoutes);
826eccfTest User535// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
536app.route("/", adminDiagnoseRoutes);
9dd96b9Test User537
16b325cClaude538// Insights (time-travel, dependencies, rollback)
539app.route("/", insightRoutes);
540
f1ab587Claude541// Command center dashboard
542app.route("/", dashboardRoutes);
543
36b4cbdClaude544// Legal pages (terms, privacy, AUP)
545app.route("/", legalRoutes);
4b66018Claude546// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
547// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
548// /acceptable-use); these are the formal versions that the legal pages
549// internally link to each other.
550app.route("/", legalTermsRoutes);
551app.route("/", legalPrivacyRoutes);
552app.route("/", legalAcceptableUseRoutes);
553app.route("/", legalDmcaRoutes);
36b4cbdClaude554
bdbd0deClaude555// GitHub import / migration
556app.route("/", importRoutes);
14c3cc8Claude557app.route("/", importBulkRoutes);
f390cfaCC LABS App558app.route("/", importSecretsRoutes);
14c3cc8Claude559app.route("/", migrationRoutes);
560
561// Spec-to-PR (experimental AI-generated draft PRs)
562app.route("/", specsRoutes);
23d0abfClaude563app.route("/", refactorRoutes);
bdbd0deClaude564
c81ab7aClaude565// Explore page
566app.route("/", exploreRoutes);
567
59b6fb2Claude568// Onboarding
569app.route("/", onboardingRoutes);
570
0316dbbClaude571// Admin + feature routes
572app.route("/", adminRoutes);
509c376Claude573app.route("/", adminIntegrationsRoutes);
79ed944Claude574app.route("/", adminAdvancementRoutes);
f764c07Claude575app.route("/", adminDeploysRoutes);
576app.route("/", adminDeploysPageRoutes);
783dd46Claude577app.route("/", adminServerTargetsRoutes);
90c7531Claude578app.route("/", claudeWebRoutes);
9dd96b9Test User579// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude580app.route("/", advisoriesRoutes);
581app.route("/", aiChangelogRoutes);
582app.route("/", aiExplainRoutes);
583app.route("/", aiTestsRoutes);
584app.route("/", askRoutes);
38d31d3Claude585app.route("/", repoChatRoutes);
ee7e577Claude586// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
587// repoChatRoutes so the two surfaces share the catch-all priority.
588app.route("/", personalChatRoutes);
0316dbbClaude589app.route("/", billingRoutes);
8809b87Claude590app.route("/", billingUsageRoutes);
6778ad2Claude591app.route("/", stripeWebhookRoutes);
0316dbbClaude592app.route("/", codeScanningRoutes);
593app.route("/", commitStatusesRoutes);
594app.route("/", copilotRoutes);
595app.route("/", depUpdaterRoutes);
596app.route("/", depsRoutes);
597app.route("/", discussionsRoutes);
598app.route("/", environmentsRoutes);
4bbacbeClaude599app.route("/", previewsRoutes);
79ed944Claude600app.route("/", docsTrackingRoutes);
0316dbbClaude601app.route("/", followsRoutes);
602app.route("/", gatesRoutes);
603app.route("/", gistsRoutes);
604app.route("/", graphqlRoutes);
2c2163eClaude605app.route("/", mcpRoutes);
0316dbbClaude606app.route("/", marketplaceRoutes);
5ca514aClaude607app.route("/", marketplaceAgentsRoutes);
0316dbbClaude608app.route("/", mergeQueueRoutes);
609app.route("/", mirrorsRoutes);
610app.route("/", orgInsightsRoutes);
611app.route("/", packagesRoutes);
612app.route("/", packagesApiRoutes);
613app.route("/", pagesRoutes);
614app.route("/", projectsRoutes);
615app.route("/", protectedTagsRoutes);
616app.route("/", pwaRoutes);
46d6165Claude617app.route("/", installRoutes);
cd4f63bTest User618// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
619app.route("/", dxtRoutes);
662ce86Claude620// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
621// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
622app.route("/", connectClaudeRoutes);
f5b9ef5Claude623// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
624app.route("/", claudeIntegration);
625// Connect guide — public onboarding page (/connect/claude-guide).
626app.route("/", connectRoutes);
ebbb527Claude627// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
628// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
629app.route("/", claudeDeployRoutes);
0316dbbClaude630app.route("/", releasesRoutes);
631app.route("/", requiredChecksRoutes);
632app.route("/", rulesetsRoutes);
633app.route("/", searchRoutes);
634app.route("/", semanticSearchRoutes);
635app.route("/", signingKeysRoutes);
636app.route("/", sponsorsRoutes);
637app.route("/", ssoRoutes);
46d6165Claude638app.route("/", githubOauthRoutes);
582cdacClaude639app.route("/", googleOauthRoutes);
0316dbbClaude640app.route("/", symbolsRoutes);
641app.route("/", templatesRoutes);
642app.route("/", trafficRoutes);
643app.route("/", wikisRoutes);
644app.route("/", workflowsRoutes);
5ff9cc2Claude645app.route("/", workflowArtifactsRoutes);
646app.route("/", workflowSecretsRoutes);
46d6165Claude647app.route("/", sleepModeRoutes);
52ad8b1Claude648app.route("/", vsGithubRoutes);
0316dbbClaude649
45f3b73Claude650// Voice-to-PR — phone-first dictation → spec or issue
651app.route("/", voiceRoutes);
652
cd4f63bTest User653// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
654// before the web catch-all so the bare `/play` literal wins over the
655// `/:owner` user-profile route.
656app.route("/", playgroundRoutes);
657
79136bbClaude658// Web UI (catch-all, must be last)
659app.route("/", webRoutes);
660
c63b860Claude661// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
662// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude663app.notFound((c) => {
36cc17aClaude664 const user = c.get("user") ?? null;
79136bbClaude665 return c.html(
c63b860Claude666 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude667 404
668 );
669});
670
c63b860Claude671// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
672// view. Trace block only shown outside production.
79136bbClaude673app.onError((err, c) => {
80bed05Claude674 reportError(err, {
675 requestId: c.get("requestId"),
676 path: c.req.path,
677 method: c.req.method,
678 });
c63b860Claude679 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
680 // back to the context value set by request-context middleware.
681 const requestId =
682 c.req.header("x-request-id") ||
683 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude684 const user = c.get("user") ?? null;
c63b860Claude685 const trace =
686 process.env.NODE_ENV !== "production" && err && err.message
687 ? err.message
688 : undefined;
79136bbClaude689 return c.html(
c63b860Claude690 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude691 500
692 );
693});
694
695export default app;