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.tsxBlame665 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";
0316dbbClaude130import releasesRoutes from "./routes/releases";
131import requiredChecksRoutes from "./routes/required-checks";
132import rulesetsRoutes from "./routes/rulesets";
133import searchRoutes from "./routes/search";
134import semanticSearchRoutes from "./routes/semantic-search";
135import signingKeysRoutes from "./routes/signing-keys";
136import sponsorsRoutes from "./routes/sponsors";
137import ssoRoutes from "./routes/sso";
46d6165Claude138import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude139import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude140import symbolsRoutes from "./routes/symbols";
141import templatesRoutes from "./routes/templates";
142import trafficRoutes from "./routes/traffic";
143import wikisRoutes from "./routes/wikis";
144import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude145import workflowArtifactsRoutes from "./routes/workflow-artifacts";
146import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude147import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude148import standupRoutes from "./routes/standups";
52ad8b1Claude149import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude150import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User151import playgroundRoutes from "./routes/playground";
59b6fb2Claude152import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
153import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude154
2316901Claude155import type { AuthEnv } from "./middleware/auth";
bf19c50Test User156import { softAuth } from "./middleware/auth";
2316901Claude157
158const app = new Hono<AuthEnv>();
79136bbClaude159
3ef4c9dClaude160// Request context (request ID, start time) runs before everything else
161app.use("*", requestContext);
05b973eClaude162// Middleware — compression first (wraps all responses)
163app.use("*", compress());
f1ffd50Claude164
165// ETag middleware — returns 304 Not Modified on unchanged responses.
166// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
167// SSE + the API surface where it would interfere with streaming.
168app.use("*", async (c, next) => {
169 const p = c.req.path;
170 if (
171 p.includes(".git/") ||
172 p.startsWith("/live-events") ||
173 p.startsWith("/api/events/deploy") ||
3c03977Claude174 p.startsWith("/admin/status") ||
175 // PR live co-editing SSE stream — never etag streaming responses.
176 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude177 ) {
178 return next();
179 }
180 return etag()(c, next);
181});
182
183// Cache-Control middleware — sets sensible defaults on public, anonymous
184// requests. Crontech (when wired as our edge layer) and downstream
185// browsers will honor these. Auth'd users get private,no-store
186// automatically — we never cache responses tied to a session.
187app.use("*", async (c, next) => {
188 await next();
189 // Don't overwrite explicit headers set by route handlers — BUT the
190 // ETag middleware unconditionally sets "private, no-cache, must-
191 // revalidate" so we have to treat that specific value as "no
192 // policy chosen yet" and apply ours. Any route that explicitly set
193 // a different cache-control wins.
194 const existing = c.res.headers.get("cache-control");
195 const etagDefault =
196 existing === "private, no-cache, must-revalidate" ||
197 existing === "no-cache";
198 if (existing && !etagDefault) return;
199 // Anything past auth: private + no-store (avoid leaking session
200 // content into shared caches). softAuth runs before this on the
201 // request, but the response side is what we're stamping.
202 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
203 const p = c.req.path;
204 // Always private for known-authed paths regardless of cookie.
205 if (
206 p.startsWith("/admin") ||
207 p.startsWith("/settings") ||
208 p.startsWith("/dashboard") ||
209 p.startsWith("/notifications") ||
210 p.startsWith("/connect/") ||
211 hasSession
212 ) {
213 c.res.headers.set("cache-control", "private, no-store");
214 return;
215 }
216 // Public marketing surfaces — short edge cache, longer browser cache,
217 // stale-while-revalidate so the user never waits on a stale fetch.
218 const isMarketing =
219 p === "/" ||
220 p === "/features" ||
221 p === "/pricing" ||
222 p === "/about" ||
223 p === "/vs-github" ||
224 p === "/explore" ||
225 p === "/help" ||
226 p === "/changelog" ||
227 p.startsWith("/legal/") ||
228 p === "/terms" ||
229 p === "/privacy" ||
230 p === "/acceptable-use" ||
231 p.startsWith("/docs/");
232 if (isMarketing) {
233 c.res.headers.set(
234 "cache-control",
235 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
236 );
237 return;
238 }
239 // Public repo browse pages — cache aggressively. Edge invalidates
240 // on push via the post-receive hook (future Crontech surge purge).
241 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
242 c.res.headers.set(
243 "cache-control",
244 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
245 );
246 return;
247 }
248 // Default: don't cache anything we haven't explicitly opted in.
249 c.res.headers.set("cache-control", "private, no-store");
250});
05b973eClaude251// Logger only on non-git routes to avoid overhead on clone/push
252app.use("*", async (c, next) => {
253 if (c.req.path.includes(".git/")) return next();
254 return logger()(c, next);
255});
79136bbClaude256app.use("/api/*", cors());
bf19c50Test User257// Global softAuth — populates c.get("user") for every downstream middleware
258// + route. This was previously per-route, which meant rate-limit middleware
259// (and anything else inspecting auth state) always saw a null user. Keep
260// individual routes free to add requireAuth on top for hard gating; this
261// just establishes the user object cheaply.
262app.use("*", softAuth);
290ea77Claude263
36cc17aClaude264// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude265// pre-redesign markup. JSON / static assets keep their own cache rules; only
266// text/html responses get the no-cache stamp. Without this, every push to
267// main left users staring at cached 80s-looking pages from before the design
268// landed.
36cc17aClaude269//
270// We deliberately use `private, no-cache, must-revalidate` rather than
271// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
272// which makes every Back/Forward press a cold server round-trip — that
273// contributed to the "every nav feels like a fresh login" UX complaint.
274// `no-cache` still revalidates on direct fetch but lets bfcache hold the
275// page in memory between navigations.
290ea77Claude276app.use("*", async (c, next) => {
277 await next();
278 const ct = c.res.headers.get("content-type") || "";
279 if (ct.startsWith("text/html")) {
36cc17aClaude280 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude281 }
282});
826eccfTest User283// Rate-limit API + auth endpoints.
284//
a41e675Test User285// `/api/*`: 1000/min per IP — generous so an admin clicking around the
286// operator console (or a CDN/proxy concentrating multiple users behind one
287// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
288// rate limits below, not this one.
289//
290// `authedMultiplier` is set but only fires when an upstream middleware has
291// already populated c.get("user") — most app.use() chains apply softAuth
292// per-route, so the multiplier is best-effort. Keep the anonymous base
293// high enough that humans never feel it.
294//
295// Skip-paths: dashboard plumbing endpoints that the layout polls on a
296// fixed cadence and that we don't want consuming any bucket:
297// /api/version — layout polls every 15s
826eccfTest User298// /api/notifications/count — nav bell unread-count fetcher
299// /pwa/vapid-public-key — fetched once per push-notification opt-in
300app.use(
301 "/api/*",
a41e675Test User302 rateLimit(1000, 60_000, "api", {
826eccfTest User303 authedMultiplier: 4,
304 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
305 })
306);
0316dbbClaude307app.use("/login", rateLimit(20, 60_000, "login"));
308app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude309// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
310app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User311// BLOCK Q2 — throttle magic-link sign-in for the same reason.
312app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude313
59b6fb2Claude314// CSRF protection — set token on all requests, validate on mutations
315app.use("*", csrfToken);
316app.use("*", csrfProtect);
317
45e31d0Claude318// Rate limit auth routes
319app.use("/login", authRateLimit);
320app.use("/register", authRateLimit);
321
59b6fb2Claude322// Rate limit git operations
323app.use("/:owner/:repo.git/*", gitRateLimit);
324
325// Rate limit search
326app.use("/:owner/:repo/search", searchRateLimit);
327app.use("/explore", searchRateLimit);
79136bbClaude328
329// Git Smart HTTP protocol routes (must be before web routes)
330app.route("/", gitRoutes);
331
45e31d0Claude332// REST API v1 (legacy)
79136bbClaude333app.route("/", apiRoutes);
334
52ad8b1Claude335// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
336// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
337// router's catch-shape, and BEFORE adminRoutes so the live /demo page
338// wins over the legacy /demo redirect in src/routes/admin.tsx.
339app.route("/", demoRoutes);
340
0316dbbClaude341// REST API v2 (basePath /api/v2)
342app.route("/", apiV2Routes);
343
e75eddcClaude344// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
345// Mounted alongside apiV2Routes (its own basePath, no path conflict).
346app.route("/", agentsRoutes);
347
ad6d4adClaude348// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
349app.route("/", hookRoutes);
21f8dbdClaude350app.route("/api/events", eventsRoutes);
ad6d4adClaude351
45e31d0Claude352// API documentation
353app.route("/", apiDocsRoutes);
4a80519Claude354app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude355// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
356app.route("/", pullsDashboardRoutes);
e9aa4d8Claude357// Issue command center — global issue dashboard with AI-triage + autopilot signal
358app.route("/", issuesDashboardRoutes);
359// Personal activity timeline — every event across the user's repos, with
360// AI-driven events surfaced separately (the Gluecron differentiator).
361app.route("/", activityRoutes);
362// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
363app.route("/", inboxRoutes);
56801e1Claude364// AI standup feed — daily / weekly Claude-generated team brief
365app.route("/", standupRoutes);
79136bbClaude366
367// Auth routes (register, login, logout)
368app.route("/", authRoutes);
369
c63b860Claude370// BLOCK P1 — Password reset (forgot-password + reset-password)
371app.route("/", passwordResetRoutes);
372
373// BLOCK P2 — Email verification (verify-email + resend)
374app.route("/", emailVerificationRoutes);
375
cd4f63bTest User376// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
377app.route("/", magicLinkRoutes);
378
79136bbClaude379// Settings routes (profile, SSH keys)
380app.route("/", settingsRoutes);
381
7298a17Claude382// 2FA / TOTP settings (Block B4)
383app.route("/", settings2faRoutes);
384
e75eddcClaude385// Agent multiplayer — /settings/agents management UI
386app.route("/", settingsAgentsRoutes);
387
1d4ff60Claude388// Chat integrations — Slack / Discord / Teams (/settings/integrations
389// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
390app.route("/", settingsIntegrationsRoutes);
391app.route("/", integrationsChatRoutes);
392
2df1f8cClaude393// WebAuthn / passkey routes (Block B5)
394app.route("/", passkeyRoutes);
395
058d752Claude396// OAuth 2.0 provider (Block B6)
397app.route("/", oauthRoutes);
398app.route("/", developerAppsRoutes);
399
6fc53bdClaude400// Theme toggle (dark/light cookie)
401app.route("/", themeRoutes);
402
403// Audit log UI
404app.route("/", auditRoutes);
405
406// Reactions API (issues, PRs, comments)
407app.route("/", reactionRoutes);
408
24cf2caClaude409// Saved replies (per-user canned comment templates)
410app.route("/", savedReplyRoutes);
411
412// Environments + deployment history UI
413app.route("/", deploymentRoutes);
414
6563f0aClaude415// Organizations + teams (Block B1)
416app.route("/", orgRoutes);
417
c81ab7aClaude418// API tokens
419app.route("/", tokenRoutes);
420
59b6fb2Claude421// Notifications
3ef4c9dClaude422app.route("/", notificationRoutes);
423
79136bbClaude424// Repo settings (description, visibility, delete)
425app.route("/", repoSettings);
426
23d1a81Claude427// Repo collaborators (add/list/remove)
428app.route("/", collaboratorRoutes);
429
04f6b7fClaude430// Team-based repo collaborators (invite a whole team)
431app.route("/", teamCollaboratorRoutes);
432
433// Collaborator invite accept flow (token-based)
434app.route("/", invitesRoutes);
435
436// Real-time SSE endpoint (topic-based live updates)
437app.route("/", liveEventsRoutes);
438
3c03977Claude439// PR live co-editing — presence + cursors + content sync via SSE.
440app.route("/", prLiveRoutes);
441
c81ab7aClaude442// Webhooks management
443app.route("/", webhookRoutes);
444
79136bbClaude445// Compare view (branch diffs)
446app.route("/", compareRoutes);
447
448// Issue tracker
449app.route("/", issueRoutes);
450
cb5a796Claude451// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
452// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
453// the `/:owner/:repo/comments/*` paths resolve before the broader PR
454// patterns kick in.
455app.route("/", commentModerationRoutes);
456
0074234Claude457// Pull requests
458app.route("/", pullRoutes);
79ed944Claude459// PR sandboxes — runnable per-PR environments. Migration 0067.
460app.route("/", prSandboxRoutes);
0074234Claude461
c81ab7aClaude462// Fork
463app.route("/", forkRoutes);
464
0074234Claude465// Web file editor
466app.route("/", editorRoutes);
467
43de941Claude468// Contributors
469app.route("/", contributorRoutes);
470
699e5c7Claude471// Health liveness + metrics endpoints
2c34075Claude472app.route("/", healthRoutes);
473
f295f78Dictation App474// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
475app.route("/api/platform-status", platformStatus);
476
52ad8b1Claude477// Block L4 — Public stats counters (powers landing-page social proof)
478app.route("/", publicStatsRoutes);
479
480// Block L3 — Live /demo page + /api/v2/demo/* endpoints
481app.route("/", demoRoutes);
482
2316be6Claude483// Public /status — human-readable platform health page
484app.route("/", statusRoutes);
485
b1be050CC LABS App486// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
487// Mounted near the public status route so the two surfaces are visible
488// side-by-side; routes are gated by isSiteAdmin internally.
489app.route("/", adminStatusRoutes);
490
80bed05Claude491// /help — quickstart + API cheatsheet
492app.route("/", helpRoutes);
493
5f2e749Claude494// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
495// so the new editorial pricing layout wins the route; the legacy marketing
496// pricing remains as a safety net but is shadowed at the router.
497app.route("/", pricingRoutes);
498
b0148e9Claude499// /pricing, /features, /about — marketing surface
500app.route("/", marketingRoutes);
501
5618f9aClaude502// SEO: robots.txt + sitemap.xml
503app.route("/", seoRoutes);
504
05cdb85Claude505// /api/version — live build SHA + uptime; client poller uses this to
506// surface 'New version available — reload' banners on deploy.
507app.route("/", versionRoutes);
508
699e5c7Claude509// Health dashboard (per-repo health page)
510app.route("/", healthDashboardRoutes);
511
9dd96b9Test User512// Block R1 — site-admin operations console. MUST be mounted BEFORE
513// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
514// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
515app.route("/", adminOpsRoutes);
f2c00b4CC LABS App516// BLOCK W — Self-host status + bootstrap dashboard.
517app.route("/", adminSelfHostRoutes);
826eccfTest User518// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
519app.route("/", adminDiagnoseRoutes);
9dd96b9Test User520
16b325cClaude521// Insights (time-travel, dependencies, rollback)
522app.route("/", insightRoutes);
523
f1ab587Claude524// Command center dashboard
525app.route("/", dashboardRoutes);
526
36b4cbdClaude527// Legal pages (terms, privacy, AUP)
528app.route("/", legalRoutes);
4b66018Claude529// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
530// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
531// /acceptable-use); these are the formal versions that the legal pages
532// internally link to each other.
533app.route("/", legalTermsRoutes);
534app.route("/", legalPrivacyRoutes);
535app.route("/", legalAcceptableUseRoutes);
536app.route("/", legalDmcaRoutes);
36b4cbdClaude537
bdbd0deClaude538// GitHub import / migration
539app.route("/", importRoutes);
14c3cc8Claude540app.route("/", importBulkRoutes);
f390cfaCC LABS App541app.route("/", importSecretsRoutes);
14c3cc8Claude542app.route("/", migrationRoutes);
543
544// Spec-to-PR (experimental AI-generated draft PRs)
545app.route("/", specsRoutes);
23d0abfClaude546app.route("/", refactorRoutes);
bdbd0deClaude547
c81ab7aClaude548// Explore page
549app.route("/", exploreRoutes);
550
59b6fb2Claude551// Onboarding
552app.route("/", onboardingRoutes);
553
0316dbbClaude554// Admin + feature routes
555app.route("/", adminRoutes);
509c376Claude556app.route("/", adminIntegrationsRoutes);
79ed944Claude557app.route("/", adminAdvancementRoutes);
f764c07Claude558app.route("/", adminDeploysRoutes);
559app.route("/", adminDeploysPageRoutes);
9dd96b9Test User560// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude561app.route("/", advisoriesRoutes);
562app.route("/", aiChangelogRoutes);
563app.route("/", aiExplainRoutes);
564app.route("/", aiTestsRoutes);
565app.route("/", askRoutes);
38d31d3Claude566app.route("/", repoChatRoutes);
0316dbbClaude567app.route("/", billingRoutes);
8809b87Claude568app.route("/", billingUsageRoutes);
6778ad2Claude569app.route("/", stripeWebhookRoutes);
0316dbbClaude570app.route("/", codeScanningRoutes);
571app.route("/", commitStatusesRoutes);
572app.route("/", copilotRoutes);
573app.route("/", depUpdaterRoutes);
574app.route("/", depsRoutes);
575app.route("/", discussionsRoutes);
576app.route("/", environmentsRoutes);
4bbacbeClaude577app.route("/", previewsRoutes);
79ed944Claude578app.route("/", docsTrackingRoutes);
0316dbbClaude579app.route("/", followsRoutes);
580app.route("/", gatesRoutes);
581app.route("/", gistsRoutes);
582app.route("/", graphqlRoutes);
2c2163eClaude583app.route("/", mcpRoutes);
0316dbbClaude584app.route("/", marketplaceRoutes);
585app.route("/", mergeQueueRoutes);
586app.route("/", mirrorsRoutes);
587app.route("/", orgInsightsRoutes);
588app.route("/", packagesRoutes);
589app.route("/", packagesApiRoutes);
590app.route("/", pagesRoutes);
591app.route("/", projectsRoutes);
592app.route("/", protectedTagsRoutes);
593app.route("/", pwaRoutes);
46d6165Claude594app.route("/", installRoutes);
cd4f63bTest User595// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
596app.route("/", dxtRoutes);
662ce86Claude597// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
598// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
599app.route("/", connectClaudeRoutes);
0316dbbClaude600app.route("/", releasesRoutes);
601app.route("/", requiredChecksRoutes);
602app.route("/", rulesetsRoutes);
603app.route("/", searchRoutes);
604app.route("/", semanticSearchRoutes);
605app.route("/", signingKeysRoutes);
606app.route("/", sponsorsRoutes);
607app.route("/", ssoRoutes);
46d6165Claude608app.route("/", githubOauthRoutes);
582cdacClaude609app.route("/", googleOauthRoutes);
0316dbbClaude610app.route("/", symbolsRoutes);
611app.route("/", templatesRoutes);
612app.route("/", trafficRoutes);
613app.route("/", wikisRoutes);
614app.route("/", workflowsRoutes);
5ff9cc2Claude615app.route("/", workflowArtifactsRoutes);
616app.route("/", workflowSecretsRoutes);
46d6165Claude617app.route("/", sleepModeRoutes);
52ad8b1Claude618app.route("/", vsGithubRoutes);
0316dbbClaude619
45f3b73Claude620// Voice-to-PR — phone-first dictation → spec or issue
621app.route("/", voiceRoutes);
622
cd4f63bTest User623// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
624// before the web catch-all so the bare `/play` literal wins over the
625// `/:owner` user-profile route.
626app.route("/", playgroundRoutes);
627
79136bbClaude628// Web UI (catch-all, must be last)
629app.route("/", webRoutes);
630
c63b860Claude631// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
632// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude633app.notFound((c) => {
36cc17aClaude634 const user = c.get("user") ?? null;
79136bbClaude635 return c.html(
c63b860Claude636 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude637 404
638 );
639});
640
c63b860Claude641// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
642// view. Trace block only shown outside production.
79136bbClaude643app.onError((err, c) => {
80bed05Claude644 reportError(err, {
645 requestId: c.get("requestId"),
646 path: c.req.path,
647 method: c.req.method,
648 });
c63b860Claude649 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
650 // back to the context value set by request-context middleware.
651 const requestId =
652 c.req.header("x-request-id") ||
653 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude654 const user = c.get("user") ?? null;
c63b860Claude655 const trace =
656 process.env.NODE_ENV !== "production" && err && err.message
657 ? err.message
658 : undefined;
79136bbClaude659 return c.html(
c63b860Claude660 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude661 500
662 );
663});
664
665export default app;