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.tsxBlame626 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";
92import billingRoutes from "./routes/billing";
6778ad2Claude93import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude94import codeScanningRoutes from "./routes/code-scanning";
95import commitStatusesRoutes from "./routes/commit-statuses";
96import copilotRoutes from "./routes/copilot";
97import depUpdaterRoutes from "./routes/dep-updater";
98import depsRoutes from "./routes/deps";
99import discussionsRoutes from "./routes/discussions";
100import environmentsRoutes from "./routes/environments";
101import followsRoutes from "./routes/follows";
102import gatesRoutes from "./routes/gates";
103import gistsRoutes from "./routes/gists";
104import graphqlRoutes from "./routes/graphql";
2c2163eClaude105import mcpRoutes from "./routes/mcp";
0316dbbClaude106import marketplaceRoutes from "./routes/marketplace";
107import mergeQueueRoutes from "./routes/merge-queue";
108import mirrorsRoutes from "./routes/mirrors";
109import orgInsightsRoutes from "./routes/org-insights";
110import packagesRoutes from "./routes/packages";
111import packagesApiRoutes from "./routes/packages-api";
112import pagesRoutes from "./routes/pages";
113import projectsRoutes from "./routes/projects";
114import protectedTagsRoutes from "./routes/protected-tags";
115import pwaRoutes from "./routes/pwa";
46d6165Claude116import installRoutes from "./routes/install";
cd4f63bTest User117import dxtRoutes from "./routes/dxt";
662ce86Claude118import connectClaudeRoutes from "./routes/connect-claude";
0316dbbClaude119import releasesRoutes from "./routes/releases";
120import requiredChecksRoutes from "./routes/required-checks";
121import rulesetsRoutes from "./routes/rulesets";
122import searchRoutes from "./routes/search";
123import semanticSearchRoutes from "./routes/semantic-search";
124import signingKeysRoutes from "./routes/signing-keys";
125import sponsorsRoutes from "./routes/sponsors";
126import ssoRoutes from "./routes/sso";
46d6165Claude127import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude128import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude129import symbolsRoutes from "./routes/symbols";
130import templatesRoutes from "./routes/templates";
131import trafficRoutes from "./routes/traffic";
132import wikisRoutes from "./routes/wikis";
133import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude134import workflowArtifactsRoutes from "./routes/workflow-artifacts";
135import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude136import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude137import standupRoutes from "./routes/standups";
52ad8b1Claude138import vsGithubRoutes from "./routes/vs-github";
cd4f63bTest User139import playgroundRoutes from "./routes/playground";
59b6fb2Claude140import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
141import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude142
2316901Claude143import type { AuthEnv } from "./middleware/auth";
bf19c50Test User144import { softAuth } from "./middleware/auth";
2316901Claude145
146const app = new Hono<AuthEnv>();
79136bbClaude147
3ef4c9dClaude148// Request context (request ID, start time) runs before everything else
149app.use("*", requestContext);
05b973eClaude150// Middleware — compression first (wraps all responses)
151app.use("*", compress());
f1ffd50Claude152
153// ETag middleware — returns 304 Not Modified on unchanged responses.
154// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
155// SSE + the API surface where it would interfere with streaming.
156app.use("*", async (c, next) => {
157 const p = c.req.path;
158 if (
159 p.includes(".git/") ||
160 p.startsWith("/live-events") ||
161 p.startsWith("/api/events/deploy") ||
162 p.startsWith("/admin/status")
163 ) {
164 return next();
165 }
166 return etag()(c, next);
167});
168
169// Cache-Control middleware — sets sensible defaults on public, anonymous
170// requests. Crontech (when wired as our edge layer) and downstream
171// browsers will honor these. Auth'd users get private,no-store
172// automatically — we never cache responses tied to a session.
173app.use("*", async (c, next) => {
174 await next();
175 // Don't overwrite explicit headers set by route handlers — BUT the
176 // ETag middleware unconditionally sets "private, no-cache, must-
177 // revalidate" so we have to treat that specific value as "no
178 // policy chosen yet" and apply ours. Any route that explicitly set
179 // a different cache-control wins.
180 const existing = c.res.headers.get("cache-control");
181 const etagDefault =
182 existing === "private, no-cache, must-revalidate" ||
183 existing === "no-cache";
184 if (existing && !etagDefault) return;
185 // Anything past auth: private + no-store (avoid leaking session
186 // content into shared caches). softAuth runs before this on the
187 // request, but the response side is what we're stamping.
188 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
189 const p = c.req.path;
190 // Always private for known-authed paths regardless of cookie.
191 if (
192 p.startsWith("/admin") ||
193 p.startsWith("/settings") ||
194 p.startsWith("/dashboard") ||
195 p.startsWith("/notifications") ||
196 p.startsWith("/connect/") ||
197 hasSession
198 ) {
199 c.res.headers.set("cache-control", "private, no-store");
200 return;
201 }
202 // Public marketing surfaces — short edge cache, longer browser cache,
203 // stale-while-revalidate so the user never waits on a stale fetch.
204 const isMarketing =
205 p === "/" ||
206 p === "/features" ||
207 p === "/pricing" ||
208 p === "/about" ||
209 p === "/vs-github" ||
210 p === "/explore" ||
211 p === "/help" ||
212 p === "/changelog" ||
213 p.startsWith("/legal/") ||
214 p === "/terms" ||
215 p === "/privacy" ||
216 p === "/acceptable-use" ||
217 p.startsWith("/docs/");
218 if (isMarketing) {
219 c.res.headers.set(
220 "cache-control",
221 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
222 );
223 return;
224 }
225 // Public repo browse pages — cache aggressively. Edge invalidates
226 // on push via the post-receive hook (future Crontech surge purge).
227 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
228 c.res.headers.set(
229 "cache-control",
230 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
231 );
232 return;
233 }
234 // Default: don't cache anything we haven't explicitly opted in.
235 c.res.headers.set("cache-control", "private, no-store");
236});
05b973eClaude237// Logger only on non-git routes to avoid overhead on clone/push
238app.use("*", async (c, next) => {
239 if (c.req.path.includes(".git/")) return next();
240 return logger()(c, next);
241});
79136bbClaude242app.use("/api/*", cors());
bf19c50Test User243// Global softAuth — populates c.get("user") for every downstream middleware
244// + route. This was previously per-route, which meant rate-limit middleware
245// (and anything else inspecting auth state) always saw a null user. Keep
246// individual routes free to add requireAuth on top for hard gating; this
247// just establishes the user object cheaply.
248app.use("*", softAuth);
290ea77Claude249
36cc17aClaude250// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude251// pre-redesign markup. JSON / static assets keep their own cache rules; only
252// text/html responses get the no-cache stamp. Without this, every push to
253// main left users staring at cached 80s-looking pages from before the design
254// landed.
36cc17aClaude255//
256// We deliberately use `private, no-cache, must-revalidate` rather than
257// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
258// which makes every Back/Forward press a cold server round-trip — that
259// contributed to the "every nav feels like a fresh login" UX complaint.
260// `no-cache` still revalidates on direct fetch but lets bfcache hold the
261// page in memory between navigations.
290ea77Claude262app.use("*", async (c, next) => {
263 await next();
264 const ct = c.res.headers.get("content-type") || "";
265 if (ct.startsWith("text/html")) {
36cc17aClaude266 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude267 }
268});
826eccfTest User269// Rate-limit API + auth endpoints.
270//
a41e675Test User271// `/api/*`: 1000/min per IP — generous so an admin clicking around the
272// operator console (or a CDN/proxy concentrating multiple users behind one
273// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
274// rate limits below, not this one.
275//
276// `authedMultiplier` is set but only fires when an upstream middleware has
277// already populated c.get("user") — most app.use() chains apply softAuth
278// per-route, so the multiplier is best-effort. Keep the anonymous base
279// high enough that humans never feel it.
280//
281// Skip-paths: dashboard plumbing endpoints that the layout polls on a
282// fixed cadence and that we don't want consuming any bucket:
283// /api/version — layout polls every 15s
826eccfTest User284// /api/notifications/count — nav bell unread-count fetcher
285// /pwa/vapid-public-key — fetched once per push-notification opt-in
286app.use(
287 "/api/*",
a41e675Test User288 rateLimit(1000, 60_000, "api", {
826eccfTest User289 authedMultiplier: 4,
290 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
291 })
292);
0316dbbClaude293app.use("/login", rateLimit(20, 60_000, "login"));
294app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude295// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
296app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User297// BLOCK Q2 — throttle magic-link sign-in for the same reason.
298app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude299
59b6fb2Claude300// CSRF protection — set token on all requests, validate on mutations
301app.use("*", csrfToken);
302app.use("*", csrfProtect);
303
45e31d0Claude304// Rate limit auth routes
305app.use("/login", authRateLimit);
306app.use("/register", authRateLimit);
307
59b6fb2Claude308// Rate limit git operations
309app.use("/:owner/:repo.git/*", gitRateLimit);
310
311// Rate limit search
312app.use("/:owner/:repo/search", searchRateLimit);
313app.use("/explore", searchRateLimit);
79136bbClaude314
315// Git Smart HTTP protocol routes (must be before web routes)
316app.route("/", gitRoutes);
317
45e31d0Claude318// REST API v1 (legacy)
79136bbClaude319app.route("/", apiRoutes);
320
52ad8b1Claude321// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
322// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
323// router's catch-shape, and BEFORE adminRoutes so the live /demo page
324// wins over the legacy /demo redirect in src/routes/admin.tsx.
325app.route("/", demoRoutes);
326
0316dbbClaude327// REST API v2 (basePath /api/v2)
328app.route("/", apiV2Routes);
329
e75eddcClaude330// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
331// Mounted alongside apiV2Routes (its own basePath, no path conflict).
332app.route("/", agentsRoutes);
333
ad6d4adClaude334// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
335app.route("/", hookRoutes);
21f8dbdClaude336app.route("/api/events", eventsRoutes);
ad6d4adClaude337
45e31d0Claude338// API documentation
339app.route("/", apiDocsRoutes);
4a80519Claude340app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude341// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
342app.route("/", pullsDashboardRoutes);
e9aa4d8Claude343// Issue command center — global issue dashboard with AI-triage + autopilot signal
344app.route("/", issuesDashboardRoutes);
345// Personal activity timeline — every event across the user's repos, with
346// AI-driven events surfaced separately (the Gluecron differentiator).
347app.route("/", activityRoutes);
348// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
349app.route("/", inboxRoutes);
56801e1Claude350// AI standup feed — daily / weekly Claude-generated team brief
351app.route("/", standupRoutes);
79136bbClaude352
353// Auth routes (register, login, logout)
354app.route("/", authRoutes);
355
c63b860Claude356// BLOCK P1 — Password reset (forgot-password + reset-password)
357app.route("/", passwordResetRoutes);
358
359// BLOCK P2 — Email verification (verify-email + resend)
360app.route("/", emailVerificationRoutes);
361
cd4f63bTest User362// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
363app.route("/", magicLinkRoutes);
364
79136bbClaude365// Settings routes (profile, SSH keys)
366app.route("/", settingsRoutes);
367
7298a17Claude368// 2FA / TOTP settings (Block B4)
369app.route("/", settings2faRoutes);
370
e75eddcClaude371// Agent multiplayer — /settings/agents management UI
372app.route("/", settingsAgentsRoutes);
373
2df1f8cClaude374// WebAuthn / passkey routes (Block B5)
375app.route("/", passkeyRoutes);
376
058d752Claude377// OAuth 2.0 provider (Block B6)
378app.route("/", oauthRoutes);
379app.route("/", developerAppsRoutes);
380
6fc53bdClaude381// Theme toggle (dark/light cookie)
382app.route("/", themeRoutes);
383
384// Audit log UI
385app.route("/", auditRoutes);
386
387// Reactions API (issues, PRs, comments)
388app.route("/", reactionRoutes);
389
24cf2caClaude390// Saved replies (per-user canned comment templates)
391app.route("/", savedReplyRoutes);
392
393// Environments + deployment history UI
394app.route("/", deploymentRoutes);
395
6563f0aClaude396// Organizations + teams (Block B1)
397app.route("/", orgRoutes);
398
c81ab7aClaude399// API tokens
400app.route("/", tokenRoutes);
401
59b6fb2Claude402// Notifications
3ef4c9dClaude403app.route("/", notificationRoutes);
404
79136bbClaude405// Repo settings (description, visibility, delete)
406app.route("/", repoSettings);
407
23d1a81Claude408// Repo collaborators (add/list/remove)
409app.route("/", collaboratorRoutes);
410
04f6b7fClaude411// Team-based repo collaborators (invite a whole team)
412app.route("/", teamCollaboratorRoutes);
413
414// Collaborator invite accept flow (token-based)
415app.route("/", invitesRoutes);
416
417// Real-time SSE endpoint (topic-based live updates)
418app.route("/", liveEventsRoutes);
419
c81ab7aClaude420// Webhooks management
421app.route("/", webhookRoutes);
422
79136bbClaude423// Compare view (branch diffs)
424app.route("/", compareRoutes);
425
426// Issue tracker
427app.route("/", issueRoutes);
428
0074234Claude429// Pull requests
430app.route("/", pullRoutes);
431
c81ab7aClaude432// Fork
433app.route("/", forkRoutes);
434
0074234Claude435// Web file editor
436app.route("/", editorRoutes);
437
43de941Claude438// Contributors
439app.route("/", contributorRoutes);
440
699e5c7Claude441// Health liveness + metrics endpoints
2c34075Claude442app.route("/", healthRoutes);
443
f295f78Dictation App444// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
445app.route("/api/platform-status", platformStatus);
446
52ad8b1Claude447// Block L4 — Public stats counters (powers landing-page social proof)
448app.route("/", publicStatsRoutes);
449
450// Block L3 — Live /demo page + /api/v2/demo/* endpoints
451app.route("/", demoRoutes);
452
2316be6Claude453// Public /status — human-readable platform health page
454app.route("/", statusRoutes);
455
b1be050CC LABS App456// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
457// Mounted near the public status route so the two surfaces are visible
458// side-by-side; routes are gated by isSiteAdmin internally.
459app.route("/", adminStatusRoutes);
460
80bed05Claude461// /help — quickstart + API cheatsheet
462app.route("/", helpRoutes);
463
5f2e749Claude464// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
465// so the new editorial pricing layout wins the route; the legacy marketing
466// pricing remains as a safety net but is shadowed at the router.
467app.route("/", pricingRoutes);
468
b0148e9Claude469// /pricing, /features, /about — marketing surface
470app.route("/", marketingRoutes);
471
5618f9aClaude472// SEO: robots.txt + sitemap.xml
473app.route("/", seoRoutes);
474
05cdb85Claude475// /api/version — live build SHA + uptime; client poller uses this to
476// surface 'New version available — reload' banners on deploy.
477app.route("/", versionRoutes);
478
699e5c7Claude479// Health dashboard (per-repo health page)
480app.route("/", healthDashboardRoutes);
481
9dd96b9Test User482// Block R1 — site-admin operations console. MUST be mounted BEFORE
483// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
484// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
485app.route("/", adminOpsRoutes);
f2c00b4CC LABS App486// BLOCK W — Self-host status + bootstrap dashboard.
487app.route("/", adminSelfHostRoutes);
826eccfTest User488// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
489app.route("/", adminDiagnoseRoutes);
9dd96b9Test User490
16b325cClaude491// Insights (time-travel, dependencies, rollback)
492app.route("/", insightRoutes);
493
f1ab587Claude494// Command center dashboard
495app.route("/", dashboardRoutes);
496
36b4cbdClaude497// Legal pages (terms, privacy, AUP)
498app.route("/", legalRoutes);
4b66018Claude499// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
500// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
501// /acceptable-use); these are the formal versions that the legal pages
502// internally link to each other.
503app.route("/", legalTermsRoutes);
504app.route("/", legalPrivacyRoutes);
505app.route("/", legalAcceptableUseRoutes);
506app.route("/", legalDmcaRoutes);
36b4cbdClaude507
bdbd0deClaude508// GitHub import / migration
509app.route("/", importRoutes);
14c3cc8Claude510app.route("/", importBulkRoutes);
f390cfaCC LABS App511app.route("/", importSecretsRoutes);
14c3cc8Claude512app.route("/", migrationRoutes);
513
514// Spec-to-PR (experimental AI-generated draft PRs)
515app.route("/", specsRoutes);
bdbd0deClaude516
c81ab7aClaude517// Explore page
518app.route("/", exploreRoutes);
519
59b6fb2Claude520// Onboarding
521app.route("/", onboardingRoutes);
522
0316dbbClaude523// Admin + feature routes
524app.route("/", adminRoutes);
509c376Claude525app.route("/", adminIntegrationsRoutes);
f764c07Claude526app.route("/", adminDeploysRoutes);
527app.route("/", adminDeploysPageRoutes);
9dd96b9Test User528// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude529app.route("/", advisoriesRoutes);
530app.route("/", aiChangelogRoutes);
531app.route("/", aiExplainRoutes);
532app.route("/", aiTestsRoutes);
533app.route("/", askRoutes);
534app.route("/", billingRoutes);
6778ad2Claude535app.route("/", stripeWebhookRoutes);
0316dbbClaude536app.route("/", codeScanningRoutes);
537app.route("/", commitStatusesRoutes);
538app.route("/", copilotRoutes);
539app.route("/", depUpdaterRoutes);
540app.route("/", depsRoutes);
541app.route("/", discussionsRoutes);
542app.route("/", environmentsRoutes);
543app.route("/", followsRoutes);
544app.route("/", gatesRoutes);
545app.route("/", gistsRoutes);
546app.route("/", graphqlRoutes);
2c2163eClaude547app.route("/", mcpRoutes);
0316dbbClaude548app.route("/", marketplaceRoutes);
549app.route("/", mergeQueueRoutes);
550app.route("/", mirrorsRoutes);
551app.route("/", orgInsightsRoutes);
552app.route("/", packagesRoutes);
553app.route("/", packagesApiRoutes);
554app.route("/", pagesRoutes);
555app.route("/", projectsRoutes);
556app.route("/", protectedTagsRoutes);
557app.route("/", pwaRoutes);
46d6165Claude558app.route("/", installRoutes);
cd4f63bTest User559// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
560app.route("/", dxtRoutes);
662ce86Claude561// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
562// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
563app.route("/", connectClaudeRoutes);
0316dbbClaude564app.route("/", releasesRoutes);
565app.route("/", requiredChecksRoutes);
566app.route("/", rulesetsRoutes);
567app.route("/", searchRoutes);
568app.route("/", semanticSearchRoutes);
569app.route("/", signingKeysRoutes);
570app.route("/", sponsorsRoutes);
571app.route("/", ssoRoutes);
46d6165Claude572app.route("/", githubOauthRoutes);
582cdacClaude573app.route("/", googleOauthRoutes);
0316dbbClaude574app.route("/", symbolsRoutes);
575app.route("/", templatesRoutes);
576app.route("/", trafficRoutes);
577app.route("/", wikisRoutes);
578app.route("/", workflowsRoutes);
5ff9cc2Claude579app.route("/", workflowArtifactsRoutes);
580app.route("/", workflowSecretsRoutes);
46d6165Claude581app.route("/", sleepModeRoutes);
52ad8b1Claude582app.route("/", vsGithubRoutes);
0316dbbClaude583
cd4f63bTest User584// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
585// before the web catch-all so the bare `/play` literal wins over the
586// `/:owner` user-profile route.
587app.route("/", playgroundRoutes);
588
79136bbClaude589// Web UI (catch-all, must be last)
590app.route("/", webRoutes);
591
c63b860Claude592// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
593// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude594app.notFound((c) => {
36cc17aClaude595 const user = c.get("user") ?? null;
79136bbClaude596 return c.html(
c63b860Claude597 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude598 404
599 );
600});
601
c63b860Claude602// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
603// view. Trace block only shown outside production.
79136bbClaude604app.onError((err, c) => {
80bed05Claude605 reportError(err, {
606 requestId: c.get("requestId"),
607 path: c.req.path,
608 method: c.req.method,
609 });
c63b860Claude610 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
611 // back to the context value set by request-context middleware.
612 const requestId =
613 c.req.header("x-request-id") ||
614 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude615 const user = c.get("user") ?? null;
c63b860Claude616 const trace =
617 process.env.NODE_ENV !== "production" && err && err.message
618 ? err.message
619 : undefined;
79136bbClaude620 return c.html(
c63b860Claude621 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude622 500
623 );
624});
625
626export default app;