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.tsxBlame632 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";
27import agentsRoutes from "./routes/agents";
79136bbClaude28import issueRoutes from "./routes/issues";
29import repoSettings from "./routes/repo-settings";
23d1a81Claude30import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude31import teamCollaboratorRoutes from "./routes/team-collaborators";
32import invitesRoutes from "./routes/invites";
33import liveEventsRoutes from "./routes/live-events";
79136bbClaude34import compareRoutes from "./routes/compare";
0074234Claude35import pullRoutes from "./routes/pulls";
36import editorRoutes from "./routes/editor";
c81ab7aClaude37import forkRoutes from "./routes/fork";
38import webhookRoutes from "./routes/webhooks";
39import exploreRoutes from "./routes/explore";
40import tokenRoutes from "./routes/tokens";
43de941Claude41import contributorRoutes from "./routes/contributors";
699e5c7Claude42import healthRoutes from "./routes/health-probe";
43import healthDashboardRoutes from "./routes/health";
2316be6Claude44import statusRoutes from "./routes/status";
b1be050CC LABS App45import adminStatusRoutes from "./routes/admin-status";
80bed05Claude46import helpRoutes from "./routes/help";
b0148e9Claude47import marketingRoutes from "./routes/marketing";
5f2e749Claude48import pricingRoutes from "./routes/pricing";
5618f9aClaude49import seoRoutes from "./routes/seo";
05cdb85Claude50import versionRoutes from "./routes/version";
f295f78Dictation App51import { platformStatus } from "./routes/platform-status";
52ad8b1Claude52import publicStatsRoutes from "./routes/public-stats";
53import demoRoutes from "./routes/demo";
16b325cClaude54import insightRoutes from "./routes/insights";
f1ab587Claude55import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude56import legalRoutes from "./routes/legal";
4b66018Claude57import legalDmcaRoutes from "./routes/legal/dmca";
58import legalTermsRoutes from "./routes/legal/terms";
59import legalPrivacyRoutes from "./routes/legal/privacy";
60import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude61import importRoutes from "./routes/import";
14c3cc8Claude62import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App63import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude64import migrationRoutes from "./routes/migrations";
65import specsRoutes from "./routes/specs";
79136bbClaude66import webRoutes from "./routes/web";
0316dbbClaude67import hookRoutes from "./routes/hooks";
68import eventsRoutes from "./routes/events";
69import passkeyRoutes from "./routes/passkeys";
70import oauthRoutes from "./routes/oauth";
71import developerAppsRoutes from "./routes/developer-apps";
72import themeRoutes from "./routes/theme";
73import auditRoutes from "./routes/audit";
74import reactionRoutes from "./routes/reactions";
75import savedReplyRoutes from "./routes/saved-replies";
76import deploymentRoutes from "./routes/deployments";
77import orgRoutes from "./routes/orgs";
78import notificationRoutes from "./routes/notifications";
79import onboardingRoutes from "./routes/onboarding";
80import adminRoutes from "./routes/admin";
f764c07Claude81import adminDeploysRoutes from "./routes/admin-deploys";
82import adminDeploysPageRoutes from "./routes/admin-deploys-page";
9dd96b9Test User83import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App84import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User85import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude86import adminIntegrationsRoutes from "./routes/admin-integrations";
0316dbbClaude87import advisoriesRoutes from "./routes/advisories";
88import aiChangelogRoutes from "./routes/ai-changelog";
89import aiExplainRoutes from "./routes/ai-explain";
90import aiTestsRoutes from "./routes/ai-tests";
91import askRoutes from "./routes/ask";
38d31d3Claude92import repoChatRoutes from "./routes/repo-chat";
0316dbbClaude93import billingRoutes from "./routes/billing";
6778ad2Claude94import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude95import codeScanningRoutes from "./routes/code-scanning";
96import commitStatusesRoutes from "./routes/commit-statuses";
97import copilotRoutes from "./routes/copilot";
98import depUpdaterRoutes from "./routes/dep-updater";
99import depsRoutes from "./routes/deps";
100import discussionsRoutes from "./routes/discussions";
101import environmentsRoutes from "./routes/environments";
102import followsRoutes from "./routes/follows";
103import gatesRoutes from "./routes/gates";
104import gistsRoutes from "./routes/gists";
105import graphqlRoutes from "./routes/graphql";
2c2163eClaude106import mcpRoutes from "./routes/mcp";
0316dbbClaude107import marketplaceRoutes from "./routes/marketplace";
108import mergeQueueRoutes from "./routes/merge-queue";
109import mirrorsRoutes from "./routes/mirrors";
110import orgInsightsRoutes from "./routes/org-insights";
111import packagesRoutes from "./routes/packages";
112import packagesApiRoutes from "./routes/packages-api";
113import pagesRoutes from "./routes/pages";
114import projectsRoutes from "./routes/projects";
115import protectedTagsRoutes from "./routes/protected-tags";
116import pwaRoutes from "./routes/pwa";
46d6165Claude117import installRoutes from "./routes/install";
cd4f63bTest User118import dxtRoutes from "./routes/dxt";
662ce86Claude119import connectClaudeRoutes from "./routes/connect-claude";
0316dbbClaude120import releasesRoutes from "./routes/releases";
121import requiredChecksRoutes from "./routes/required-checks";
122import rulesetsRoutes from "./routes/rulesets";
123import searchRoutes from "./routes/search";
124import semanticSearchRoutes from "./routes/semantic-search";
125import signingKeysRoutes from "./routes/signing-keys";
126import sponsorsRoutes from "./routes/sponsors";
127import ssoRoutes from "./routes/sso";
46d6165Claude128import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude129import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude130import symbolsRoutes from "./routes/symbols";
131import templatesRoutes from "./routes/templates";
132import trafficRoutes from "./routes/traffic";
133import wikisRoutes from "./routes/wikis";
134import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude135import workflowArtifactsRoutes from "./routes/workflow-artifacts";
136import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude137import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude138import standupRoutes from "./routes/standups";
52ad8b1Claude139import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude140import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User141import playgroundRoutes from "./routes/playground";
59b6fb2Claude142import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
143import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude144
2316901Claude145import type { AuthEnv } from "./middleware/auth";
bf19c50Test User146import { softAuth } from "./middleware/auth";
2316901Claude147
148const app = new Hono<AuthEnv>();
79136bbClaude149
3ef4c9dClaude150// Request context (request ID, start time) runs before everything else
151app.use("*", requestContext);
05b973eClaude152// Middleware — compression first (wraps all responses)
153app.use("*", compress());
f1ffd50Claude154
155// ETag middleware — returns 304 Not Modified on unchanged responses.
156// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
157// SSE + the API surface where it would interfere with streaming.
158app.use("*", async (c, next) => {
159 const p = c.req.path;
160 if (
161 p.includes(".git/") ||
162 p.startsWith("/live-events") ||
163 p.startsWith("/api/events/deploy") ||
164 p.startsWith("/admin/status")
165 ) {
166 return next();
167 }
168 return etag()(c, next);
169});
170
171// Cache-Control middleware — sets sensible defaults on public, anonymous
172// requests. Crontech (when wired as our edge layer) and downstream
173// browsers will honor these. Auth'd users get private,no-store
174// automatically — we never cache responses tied to a session.
175app.use("*", async (c, next) => {
176 await next();
177 // Don't overwrite explicit headers set by route handlers — BUT the
178 // ETag middleware unconditionally sets "private, no-cache, must-
179 // revalidate" so we have to treat that specific value as "no
180 // policy chosen yet" and apply ours. Any route that explicitly set
181 // a different cache-control wins.
182 const existing = c.res.headers.get("cache-control");
183 const etagDefault =
184 existing === "private, no-cache, must-revalidate" ||
185 existing === "no-cache";
186 if (existing && !etagDefault) return;
187 // Anything past auth: private + no-store (avoid leaking session
188 // content into shared caches). softAuth runs before this on the
189 // request, but the response side is what we're stamping.
190 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
191 const p = c.req.path;
192 // Always private for known-authed paths regardless of cookie.
193 if (
194 p.startsWith("/admin") ||
195 p.startsWith("/settings") ||
196 p.startsWith("/dashboard") ||
197 p.startsWith("/notifications") ||
198 p.startsWith("/connect/") ||
199 hasSession
200 ) {
201 c.res.headers.set("cache-control", "private, no-store");
202 return;
203 }
204 // Public marketing surfaces — short edge cache, longer browser cache,
205 // stale-while-revalidate so the user never waits on a stale fetch.
206 const isMarketing =
207 p === "/" ||
208 p === "/features" ||
209 p === "/pricing" ||
210 p === "/about" ||
211 p === "/vs-github" ||
212 p === "/explore" ||
213 p === "/help" ||
214 p === "/changelog" ||
215 p.startsWith("/legal/") ||
216 p === "/terms" ||
217 p === "/privacy" ||
218 p === "/acceptable-use" ||
219 p.startsWith("/docs/");
220 if (isMarketing) {
221 c.res.headers.set(
222 "cache-control",
223 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
224 );
225 return;
226 }
227 // Public repo browse pages — cache aggressively. Edge invalidates
228 // on push via the post-receive hook (future Crontech surge purge).
229 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
230 c.res.headers.set(
231 "cache-control",
232 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
233 );
234 return;
235 }
236 // Default: don't cache anything we haven't explicitly opted in.
237 c.res.headers.set("cache-control", "private, no-store");
238});
05b973eClaude239// Logger only on non-git routes to avoid overhead on clone/push
240app.use("*", async (c, next) => {
241 if (c.req.path.includes(".git/")) return next();
242 return logger()(c, next);
243});
79136bbClaude244app.use("/api/*", cors());
bf19c50Test User245// Global softAuth — populates c.get("user") for every downstream middleware
246// + route. This was previously per-route, which meant rate-limit middleware
247// (and anything else inspecting auth state) always saw a null user. Keep
248// individual routes free to add requireAuth on top for hard gating; this
249// just establishes the user object cheaply.
250app.use("*", softAuth);
290ea77Claude251
36cc17aClaude252// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude253// pre-redesign markup. JSON / static assets keep their own cache rules; only
254// text/html responses get the no-cache stamp. Without this, every push to
255// main left users staring at cached 80s-looking pages from before the design
256// landed.
36cc17aClaude257//
258// We deliberately use `private, no-cache, must-revalidate` rather than
259// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
260// which makes every Back/Forward press a cold server round-trip — that
261// contributed to the "every nav feels like a fresh login" UX complaint.
262// `no-cache` still revalidates on direct fetch but lets bfcache hold the
263// page in memory between navigations.
290ea77Claude264app.use("*", async (c, next) => {
265 await next();
266 const ct = c.res.headers.get("content-type") || "";
267 if (ct.startsWith("text/html")) {
36cc17aClaude268 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude269 }
270});
826eccfTest User271// Rate-limit API + auth endpoints.
272//
a41e675Test User273// `/api/*`: 1000/min per IP — generous so an admin clicking around the
274// operator console (or a CDN/proxy concentrating multiple users behind one
275// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
276// rate limits below, not this one.
277//
278// `authedMultiplier` is set but only fires when an upstream middleware has
279// already populated c.get("user") — most app.use() chains apply softAuth
280// per-route, so the multiplier is best-effort. Keep the anonymous base
281// high enough that humans never feel it.
282//
283// Skip-paths: dashboard plumbing endpoints that the layout polls on a
284// fixed cadence and that we don't want consuming any bucket:
285// /api/version — layout polls every 15s
826eccfTest User286// /api/notifications/count — nav bell unread-count fetcher
287// /pwa/vapid-public-key — fetched once per push-notification opt-in
288app.use(
289 "/api/*",
a41e675Test User290 rateLimit(1000, 60_000, "api", {
826eccfTest User291 authedMultiplier: 4,
292 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
293 })
294);
0316dbbClaude295app.use("/login", rateLimit(20, 60_000, "login"));
296app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude297// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
298app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User299// BLOCK Q2 — throttle magic-link sign-in for the same reason.
300app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude301
59b6fb2Claude302// CSRF protection — set token on all requests, validate on mutations
303app.use("*", csrfToken);
304app.use("*", csrfProtect);
305
45e31d0Claude306// Rate limit auth routes
307app.use("/login", authRateLimit);
308app.use("/register", authRateLimit);
309
59b6fb2Claude310// Rate limit git operations
311app.use("/:owner/:repo.git/*", gitRateLimit);
312
313// Rate limit search
314app.use("/:owner/:repo/search", searchRateLimit);
315app.use("/explore", searchRateLimit);
79136bbClaude316
317// Git Smart HTTP protocol routes (must be before web routes)
318app.route("/", gitRoutes);
319
45e31d0Claude320// REST API v1 (legacy)
79136bbClaude321app.route("/", apiRoutes);
322
52ad8b1Claude323// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
324// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
325// router's catch-shape, and BEFORE adminRoutes so the live /demo page
326// wins over the legacy /demo redirect in src/routes/admin.tsx.
327app.route("/", demoRoutes);
328
0316dbbClaude329// REST API v2 (basePath /api/v2)
330app.route("/", apiV2Routes);
331
e75eddcClaude332// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
333// Mounted alongside apiV2Routes (its own basePath, no path conflict).
334app.route("/", agentsRoutes);
335
ad6d4adClaude336// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
337app.route("/", hookRoutes);
21f8dbdClaude338app.route("/api/events", eventsRoutes);
ad6d4adClaude339
45e31d0Claude340// API documentation
341app.route("/", apiDocsRoutes);
4a80519Claude342app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude343// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
344app.route("/", pullsDashboardRoutes);
e9aa4d8Claude345// Issue command center — global issue dashboard with AI-triage + autopilot signal
346app.route("/", issuesDashboardRoutes);
347// Personal activity timeline — every event across the user's repos, with
348// AI-driven events surfaced separately (the Gluecron differentiator).
349app.route("/", activityRoutes);
350// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
351app.route("/", inboxRoutes);
56801e1Claude352// AI standup feed — daily / weekly Claude-generated team brief
353app.route("/", standupRoutes);
79136bbClaude354
355// Auth routes (register, login, logout)
356app.route("/", authRoutes);
357
c63b860Claude358// BLOCK P1 — Password reset (forgot-password + reset-password)
359app.route("/", passwordResetRoutes);
360
361// BLOCK P2 — Email verification (verify-email + resend)
362app.route("/", emailVerificationRoutes);
363
cd4f63bTest User364// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
365app.route("/", magicLinkRoutes);
366
79136bbClaude367// Settings routes (profile, SSH keys)
368app.route("/", settingsRoutes);
369
7298a17Claude370// 2FA / TOTP settings (Block B4)
371app.route("/", settings2faRoutes);
372
e75eddcClaude373// Agent multiplayer — /settings/agents management UI
374app.route("/", settingsAgentsRoutes);
375
2df1f8cClaude376// WebAuthn / passkey routes (Block B5)
377app.route("/", passkeyRoutes);
378
058d752Claude379// OAuth 2.0 provider (Block B6)
380app.route("/", oauthRoutes);
381app.route("/", developerAppsRoutes);
382
6fc53bdClaude383// Theme toggle (dark/light cookie)
384app.route("/", themeRoutes);
385
386// Audit log UI
387app.route("/", auditRoutes);
388
389// Reactions API (issues, PRs, comments)
390app.route("/", reactionRoutes);
391
24cf2caClaude392// Saved replies (per-user canned comment templates)
393app.route("/", savedReplyRoutes);
394
395// Environments + deployment history UI
396app.route("/", deploymentRoutes);
397
6563f0aClaude398// Organizations + teams (Block B1)
399app.route("/", orgRoutes);
400
c81ab7aClaude401// API tokens
402app.route("/", tokenRoutes);
403
59b6fb2Claude404// Notifications
3ef4c9dClaude405app.route("/", notificationRoutes);
406
79136bbClaude407// Repo settings (description, visibility, delete)
408app.route("/", repoSettings);
409
23d1a81Claude410// Repo collaborators (add/list/remove)
411app.route("/", collaboratorRoutes);
412
04f6b7fClaude413// Team-based repo collaborators (invite a whole team)
414app.route("/", teamCollaboratorRoutes);
415
416// Collaborator invite accept flow (token-based)
417app.route("/", invitesRoutes);
418
419// Real-time SSE endpoint (topic-based live updates)
420app.route("/", liveEventsRoutes);
421
c81ab7aClaude422// Webhooks management
423app.route("/", webhookRoutes);
424
79136bbClaude425// Compare view (branch diffs)
426app.route("/", compareRoutes);
427
428// Issue tracker
429app.route("/", issueRoutes);
430
0074234Claude431// Pull requests
432app.route("/", pullRoutes);
433
c81ab7aClaude434// Fork
435app.route("/", forkRoutes);
436
0074234Claude437// Web file editor
438app.route("/", editorRoutes);
439
43de941Claude440// Contributors
441app.route("/", contributorRoutes);
442
699e5c7Claude443// Health liveness + metrics endpoints
2c34075Claude444app.route("/", healthRoutes);
445
f295f78Dictation App446// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
447app.route("/api/platform-status", platformStatus);
448
52ad8b1Claude449// Block L4 — Public stats counters (powers landing-page social proof)
450app.route("/", publicStatsRoutes);
451
452// Block L3 — Live /demo page + /api/v2/demo/* endpoints
453app.route("/", demoRoutes);
454
2316be6Claude455// Public /status — human-readable platform health page
456app.route("/", statusRoutes);
457
b1be050CC LABS App458// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
459// Mounted near the public status route so the two surfaces are visible
460// side-by-side; routes are gated by isSiteAdmin internally.
461app.route("/", adminStatusRoutes);
462
80bed05Claude463// /help — quickstart + API cheatsheet
464app.route("/", helpRoutes);
465
5f2e749Claude466// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
467// so the new editorial pricing layout wins the route; the legacy marketing
468// pricing remains as a safety net but is shadowed at the router.
469app.route("/", pricingRoutes);
470
b0148e9Claude471// /pricing, /features, /about — marketing surface
472app.route("/", marketingRoutes);
473
5618f9aClaude474// SEO: robots.txt + sitemap.xml
475app.route("/", seoRoutes);
476
05cdb85Claude477// /api/version — live build SHA + uptime; client poller uses this to
478// surface 'New version available — reload' banners on deploy.
479app.route("/", versionRoutes);
480
699e5c7Claude481// Health dashboard (per-repo health page)
482app.route("/", healthDashboardRoutes);
483
9dd96b9Test User484// Block R1 — site-admin operations console. MUST be mounted BEFORE
485// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
486// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
487app.route("/", adminOpsRoutes);
f2c00b4CC LABS App488// BLOCK W — Self-host status + bootstrap dashboard.
489app.route("/", adminSelfHostRoutes);
826eccfTest User490// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
491app.route("/", adminDiagnoseRoutes);
9dd96b9Test User492
16b325cClaude493// Insights (time-travel, dependencies, rollback)
494app.route("/", insightRoutes);
495
f1ab587Claude496// Command center dashboard
497app.route("/", dashboardRoutes);
498
36b4cbdClaude499// Legal pages (terms, privacy, AUP)
500app.route("/", legalRoutes);
4b66018Claude501// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
502// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
503// /acceptable-use); these are the formal versions that the legal pages
504// internally link to each other.
505app.route("/", legalTermsRoutes);
506app.route("/", legalPrivacyRoutes);
507app.route("/", legalAcceptableUseRoutes);
508app.route("/", legalDmcaRoutes);
36b4cbdClaude509
bdbd0deClaude510// GitHub import / migration
511app.route("/", importRoutes);
14c3cc8Claude512app.route("/", importBulkRoutes);
f390cfaCC LABS App513app.route("/", importSecretsRoutes);
14c3cc8Claude514app.route("/", migrationRoutes);
515
516// Spec-to-PR (experimental AI-generated draft PRs)
517app.route("/", specsRoutes);
bdbd0deClaude518
c81ab7aClaude519// Explore page
520app.route("/", exploreRoutes);
521
59b6fb2Claude522// Onboarding
523app.route("/", onboardingRoutes);
524
0316dbbClaude525// Admin + feature routes
526app.route("/", adminRoutes);
509c376Claude527app.route("/", adminIntegrationsRoutes);
f764c07Claude528app.route("/", adminDeploysRoutes);
529app.route("/", adminDeploysPageRoutes);
9dd96b9Test User530// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude531app.route("/", advisoriesRoutes);
532app.route("/", aiChangelogRoutes);
533app.route("/", aiExplainRoutes);
534app.route("/", aiTestsRoutes);
535app.route("/", askRoutes);
38d31d3Claude536app.route("/", repoChatRoutes);
0316dbbClaude537app.route("/", billingRoutes);
6778ad2Claude538app.route("/", stripeWebhookRoutes);
0316dbbClaude539app.route("/", codeScanningRoutes);
540app.route("/", commitStatusesRoutes);
541app.route("/", copilotRoutes);
542app.route("/", depUpdaterRoutes);
543app.route("/", depsRoutes);
544app.route("/", discussionsRoutes);
545app.route("/", environmentsRoutes);
546app.route("/", followsRoutes);
547app.route("/", gatesRoutes);
548app.route("/", gistsRoutes);
549app.route("/", graphqlRoutes);
2c2163eClaude550app.route("/", mcpRoutes);
0316dbbClaude551app.route("/", marketplaceRoutes);
552app.route("/", mergeQueueRoutes);
553app.route("/", mirrorsRoutes);
554app.route("/", orgInsightsRoutes);
555app.route("/", packagesRoutes);
556app.route("/", packagesApiRoutes);
557app.route("/", pagesRoutes);
558app.route("/", projectsRoutes);
559app.route("/", protectedTagsRoutes);
560app.route("/", pwaRoutes);
46d6165Claude561app.route("/", installRoutes);
cd4f63bTest User562// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
563app.route("/", dxtRoutes);
662ce86Claude564// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
565// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
566app.route("/", connectClaudeRoutes);
0316dbbClaude567app.route("/", releasesRoutes);
568app.route("/", requiredChecksRoutes);
569app.route("/", rulesetsRoutes);
570app.route("/", searchRoutes);
571app.route("/", semanticSearchRoutes);
572app.route("/", signingKeysRoutes);
573app.route("/", sponsorsRoutes);
574app.route("/", ssoRoutes);
46d6165Claude575app.route("/", githubOauthRoutes);
582cdacClaude576app.route("/", googleOauthRoutes);
0316dbbClaude577app.route("/", symbolsRoutes);
578app.route("/", templatesRoutes);
579app.route("/", trafficRoutes);
580app.route("/", wikisRoutes);
581app.route("/", workflowsRoutes);
5ff9cc2Claude582app.route("/", workflowArtifactsRoutes);
583app.route("/", workflowSecretsRoutes);
46d6165Claude584app.route("/", sleepModeRoutes);
52ad8b1Claude585app.route("/", vsGithubRoutes);
0316dbbClaude586
45f3b73Claude587// Voice-to-PR — phone-first dictation → spec or issue
588app.route("/", voiceRoutes);
589
cd4f63bTest User590// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
591// before the web catch-all so the bare `/play` literal wins over the
592// `/:owner` user-profile route.
593app.route("/", playgroundRoutes);
594
79136bbClaude595// Web UI (catch-all, must be last)
596app.route("/", webRoutes);
597
c63b860Claude598// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
599// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude600app.notFound((c) => {
36cc17aClaude601 const user = c.get("user") ?? null;
79136bbClaude602 return c.html(
c63b860Claude603 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude604 404
605 );
606});
607
c63b860Claude608// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
609// view. Trace block only shown outside production.
79136bbClaude610app.onError((err, c) => {
80bed05Claude611 reportError(err, {
612 requestId: c.get("requestId"),
613 path: c.req.path,
614 method: c.req.method,
615 });
c63b860Claude616 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
617 // back to the context value set by request-context middleware.
618 const requestId =
619 c.req.header("x-request-id") ||
620 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude621 const user = c.get("user") ?? null;
c63b860Claude622 const trace =
623 process.env.NODE_ENV !== "production" && err && err.message
624 ? err.message
625 : undefined;
79136bbClaude626 return c.html(
c63b860Claude627 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude628 500
629 );
630});
631
632export default app;