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.tsxBlame649 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";
31import repoSettings from "./routes/repo-settings";
23d1a81Claude32import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude33import teamCollaboratorRoutes from "./routes/team-collaborators";
34import invitesRoutes from "./routes/invites";
35import liveEventsRoutes from "./routes/live-events";
3c03977Claude36import prLiveRoutes from "./routes/pr-live";
79136bbClaude37import compareRoutes from "./routes/compare";
0074234Claude38import pullRoutes from "./routes/pulls";
39import editorRoutes from "./routes/editor";
c81ab7aClaude40import forkRoutes from "./routes/fork";
41import webhookRoutes from "./routes/webhooks";
42import exploreRoutes from "./routes/explore";
43import tokenRoutes from "./routes/tokens";
43de941Claude44import contributorRoutes from "./routes/contributors";
699e5c7Claude45import healthRoutes from "./routes/health-probe";
46import healthDashboardRoutes from "./routes/health";
2316be6Claude47import statusRoutes from "./routes/status";
b1be050CC LABS App48import adminStatusRoutes from "./routes/admin-status";
80bed05Claude49import helpRoutes from "./routes/help";
b0148e9Claude50import marketingRoutes from "./routes/marketing";
5f2e749Claude51import pricingRoutes from "./routes/pricing";
5618f9aClaude52import seoRoutes from "./routes/seo";
05cdb85Claude53import versionRoutes from "./routes/version";
f295f78Dictation App54import { platformStatus } from "./routes/platform-status";
52ad8b1Claude55import publicStatsRoutes from "./routes/public-stats";
56import demoRoutes from "./routes/demo";
16b325cClaude57import insightRoutes from "./routes/insights";
f1ab587Claude58import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude59import legalRoutes from "./routes/legal";
4b66018Claude60import legalDmcaRoutes from "./routes/legal/dmca";
61import legalTermsRoutes from "./routes/legal/terms";
62import legalPrivacyRoutes from "./routes/legal/privacy";
63import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude64import importRoutes from "./routes/import";
14c3cc8Claude65import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App66import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude67import migrationRoutes from "./routes/migrations";
68import specsRoutes from "./routes/specs";
23d0abfClaude69import refactorRoutes from "./routes/refactors";
79136bbClaude70import webRoutes from "./routes/web";
0316dbbClaude71import hookRoutes from "./routes/hooks";
72import eventsRoutes from "./routes/events";
73import passkeyRoutes from "./routes/passkeys";
74import oauthRoutes from "./routes/oauth";
75import developerAppsRoutes from "./routes/developer-apps";
76import themeRoutes from "./routes/theme";
77import auditRoutes from "./routes/audit";
78import reactionRoutes from "./routes/reactions";
79import savedReplyRoutes from "./routes/saved-replies";
80import deploymentRoutes from "./routes/deployments";
81import orgRoutes from "./routes/orgs";
82import notificationRoutes from "./routes/notifications";
83import onboardingRoutes from "./routes/onboarding";
84import adminRoutes from "./routes/admin";
f764c07Claude85import adminDeploysRoutes from "./routes/admin-deploys";
86import adminDeploysPageRoutes from "./routes/admin-deploys-page";
9dd96b9Test User87import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App88import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User89import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude90import adminIntegrationsRoutes from "./routes/admin-integrations";
0316dbbClaude91import advisoriesRoutes from "./routes/advisories";
92import aiChangelogRoutes from "./routes/ai-changelog";
93import aiExplainRoutes from "./routes/ai-explain";
94import aiTestsRoutes from "./routes/ai-tests";
95import askRoutes from "./routes/ask";
38d31d3Claude96import repoChatRoutes from "./routes/repo-chat";
0316dbbClaude97import billingRoutes from "./routes/billing";
6778ad2Claude98import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude99import codeScanningRoutes from "./routes/code-scanning";
100import commitStatusesRoutes from "./routes/commit-statuses";
101import copilotRoutes from "./routes/copilot";
102import depUpdaterRoutes from "./routes/dep-updater";
103import depsRoutes from "./routes/deps";
104import discussionsRoutes from "./routes/discussions";
105import environmentsRoutes from "./routes/environments";
4bbacbeClaude106import previewsRoutes from "./routes/previews";
0316dbbClaude107import followsRoutes from "./routes/follows";
108import gatesRoutes from "./routes/gates";
109import gistsRoutes from "./routes/gists";
110import graphqlRoutes from "./routes/graphql";
2c2163eClaude111import mcpRoutes from "./routes/mcp";
0316dbbClaude112import marketplaceRoutes from "./routes/marketplace";
113import mergeQueueRoutes from "./routes/merge-queue";
114import mirrorsRoutes from "./routes/mirrors";
115import orgInsightsRoutes from "./routes/org-insights";
116import packagesRoutes from "./routes/packages";
117import packagesApiRoutes from "./routes/packages-api";
118import pagesRoutes from "./routes/pages";
119import projectsRoutes from "./routes/projects";
120import protectedTagsRoutes from "./routes/protected-tags";
121import pwaRoutes from "./routes/pwa";
46d6165Claude122import installRoutes from "./routes/install";
cd4f63bTest User123import dxtRoutes from "./routes/dxt";
662ce86Claude124import connectClaudeRoutes from "./routes/connect-claude";
0316dbbClaude125import releasesRoutes from "./routes/releases";
126import requiredChecksRoutes from "./routes/required-checks";
127import rulesetsRoutes from "./routes/rulesets";
128import searchRoutes from "./routes/search";
129import semanticSearchRoutes from "./routes/semantic-search";
130import signingKeysRoutes from "./routes/signing-keys";
131import sponsorsRoutes from "./routes/sponsors";
132import ssoRoutes from "./routes/sso";
46d6165Claude133import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude134import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude135import symbolsRoutes from "./routes/symbols";
136import templatesRoutes from "./routes/templates";
137import trafficRoutes from "./routes/traffic";
138import wikisRoutes from "./routes/wikis";
139import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude140import workflowArtifactsRoutes from "./routes/workflow-artifacts";
141import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude142import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude143import standupRoutes from "./routes/standups";
52ad8b1Claude144import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude145import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User146import playgroundRoutes from "./routes/playground";
59b6fb2Claude147import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
148import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude149
2316901Claude150import type { AuthEnv } from "./middleware/auth";
bf19c50Test User151import { softAuth } from "./middleware/auth";
2316901Claude152
153const app = new Hono<AuthEnv>();
79136bbClaude154
3ef4c9dClaude155// Request context (request ID, start time) runs before everything else
156app.use("*", requestContext);
05b973eClaude157// Middleware — compression first (wraps all responses)
158app.use("*", compress());
f1ffd50Claude159
160// ETag middleware — returns 304 Not Modified on unchanged responses.
161// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
162// SSE + the API surface where it would interfere with streaming.
163app.use("*", async (c, next) => {
164 const p = c.req.path;
165 if (
166 p.includes(".git/") ||
167 p.startsWith("/live-events") ||
168 p.startsWith("/api/events/deploy") ||
3c03977Claude169 p.startsWith("/admin/status") ||
170 // PR live co-editing SSE stream — never etag streaming responses.
171 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude172 ) {
173 return next();
174 }
175 return etag()(c, next);
176});
177
178// Cache-Control middleware — sets sensible defaults on public, anonymous
179// requests. Crontech (when wired as our edge layer) and downstream
180// browsers will honor these. Auth'd users get private,no-store
181// automatically — we never cache responses tied to a session.
182app.use("*", async (c, next) => {
183 await next();
184 // Don't overwrite explicit headers set by route handlers — BUT the
185 // ETag middleware unconditionally sets "private, no-cache, must-
186 // revalidate" so we have to treat that specific value as "no
187 // policy chosen yet" and apply ours. Any route that explicitly set
188 // a different cache-control wins.
189 const existing = c.res.headers.get("cache-control");
190 const etagDefault =
191 existing === "private, no-cache, must-revalidate" ||
192 existing === "no-cache";
193 if (existing && !etagDefault) return;
194 // Anything past auth: private + no-store (avoid leaking session
195 // content into shared caches). softAuth runs before this on the
196 // request, but the response side is what we're stamping.
197 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
198 const p = c.req.path;
199 // Always private for known-authed paths regardless of cookie.
200 if (
201 p.startsWith("/admin") ||
202 p.startsWith("/settings") ||
203 p.startsWith("/dashboard") ||
204 p.startsWith("/notifications") ||
205 p.startsWith("/connect/") ||
206 hasSession
207 ) {
208 c.res.headers.set("cache-control", "private, no-store");
209 return;
210 }
211 // Public marketing surfaces — short edge cache, longer browser cache,
212 // stale-while-revalidate so the user never waits on a stale fetch.
213 const isMarketing =
214 p === "/" ||
215 p === "/features" ||
216 p === "/pricing" ||
217 p === "/about" ||
218 p === "/vs-github" ||
219 p === "/explore" ||
220 p === "/help" ||
221 p === "/changelog" ||
222 p.startsWith("/legal/") ||
223 p === "/terms" ||
224 p === "/privacy" ||
225 p === "/acceptable-use" ||
226 p.startsWith("/docs/");
227 if (isMarketing) {
228 c.res.headers.set(
229 "cache-control",
230 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
231 );
232 return;
233 }
234 // Public repo browse pages — cache aggressively. Edge invalidates
235 // on push via the post-receive hook (future Crontech surge purge).
236 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
237 c.res.headers.set(
238 "cache-control",
239 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
240 );
241 return;
242 }
243 // Default: don't cache anything we haven't explicitly opted in.
244 c.res.headers.set("cache-control", "private, no-store");
245});
05b973eClaude246// Logger only on non-git routes to avoid overhead on clone/push
247app.use("*", async (c, next) => {
248 if (c.req.path.includes(".git/")) return next();
249 return logger()(c, next);
250});
79136bbClaude251app.use("/api/*", cors());
bf19c50Test User252// Global softAuth — populates c.get("user") for every downstream middleware
253// + route. This was previously per-route, which meant rate-limit middleware
254// (and anything else inspecting auth state) always saw a null user. Keep
255// individual routes free to add requireAuth on top for hard gating; this
256// just establishes the user object cheaply.
257app.use("*", softAuth);
290ea77Claude258
36cc17aClaude259// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude260// pre-redesign markup. JSON / static assets keep their own cache rules; only
261// text/html responses get the no-cache stamp. Without this, every push to
262// main left users staring at cached 80s-looking pages from before the design
263// landed.
36cc17aClaude264//
265// We deliberately use `private, no-cache, must-revalidate` rather than
266// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
267// which makes every Back/Forward press a cold server round-trip — that
268// contributed to the "every nav feels like a fresh login" UX complaint.
269// `no-cache` still revalidates on direct fetch but lets bfcache hold the
270// page in memory between navigations.
290ea77Claude271app.use("*", async (c, next) => {
272 await next();
273 const ct = c.res.headers.get("content-type") || "";
274 if (ct.startsWith("text/html")) {
36cc17aClaude275 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude276 }
277});
826eccfTest User278// Rate-limit API + auth endpoints.
279//
a41e675Test User280// `/api/*`: 1000/min per IP — generous so an admin clicking around the
281// operator console (or a CDN/proxy concentrating multiple users behind one
282// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
283// rate limits below, not this one.
284//
285// `authedMultiplier` is set but only fires when an upstream middleware has
286// already populated c.get("user") — most app.use() chains apply softAuth
287// per-route, so the multiplier is best-effort. Keep the anonymous base
288// high enough that humans never feel it.
289//
290// Skip-paths: dashboard plumbing endpoints that the layout polls on a
291// fixed cadence and that we don't want consuming any bucket:
292// /api/version — layout polls every 15s
826eccfTest User293// /api/notifications/count — nav bell unread-count fetcher
294// /pwa/vapid-public-key — fetched once per push-notification opt-in
295app.use(
296 "/api/*",
a41e675Test User297 rateLimit(1000, 60_000, "api", {
826eccfTest User298 authedMultiplier: 4,
299 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
300 })
301);
0316dbbClaude302app.use("/login", rateLimit(20, 60_000, "login"));
303app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude304// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
305app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User306// BLOCK Q2 — throttle magic-link sign-in for the same reason.
307app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude308
59b6fb2Claude309// CSRF protection — set token on all requests, validate on mutations
310app.use("*", csrfToken);
311app.use("*", csrfProtect);
312
45e31d0Claude313// Rate limit auth routes
314app.use("/login", authRateLimit);
315app.use("/register", authRateLimit);
316
59b6fb2Claude317// Rate limit git operations
318app.use("/:owner/:repo.git/*", gitRateLimit);
319
320// Rate limit search
321app.use("/:owner/:repo/search", searchRateLimit);
322app.use("/explore", searchRateLimit);
79136bbClaude323
324// Git Smart HTTP protocol routes (must be before web routes)
325app.route("/", gitRoutes);
326
45e31d0Claude327// REST API v1 (legacy)
79136bbClaude328app.route("/", apiRoutes);
329
52ad8b1Claude330// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
331// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
332// router's catch-shape, and BEFORE adminRoutes so the live /demo page
333// wins over the legacy /demo redirect in src/routes/admin.tsx.
334app.route("/", demoRoutes);
335
0316dbbClaude336// REST API v2 (basePath /api/v2)
337app.route("/", apiV2Routes);
338
e75eddcClaude339// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
340// Mounted alongside apiV2Routes (its own basePath, no path conflict).
341app.route("/", agentsRoutes);
342
ad6d4adClaude343// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
344app.route("/", hookRoutes);
21f8dbdClaude345app.route("/api/events", eventsRoutes);
ad6d4adClaude346
45e31d0Claude347// API documentation
348app.route("/", apiDocsRoutes);
4a80519Claude349app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude350// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
351app.route("/", pullsDashboardRoutes);
e9aa4d8Claude352// Issue command center — global issue dashboard with AI-triage + autopilot signal
353app.route("/", issuesDashboardRoutes);
354// Personal activity timeline — every event across the user's repos, with
355// AI-driven events surfaced separately (the Gluecron differentiator).
356app.route("/", activityRoutes);
357// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
358app.route("/", inboxRoutes);
56801e1Claude359// AI standup feed — daily / weekly Claude-generated team brief
360app.route("/", standupRoutes);
79136bbClaude361
362// Auth routes (register, login, logout)
363app.route("/", authRoutes);
364
c63b860Claude365// BLOCK P1 — Password reset (forgot-password + reset-password)
366app.route("/", passwordResetRoutes);
367
368// BLOCK P2 — Email verification (verify-email + resend)
369app.route("/", emailVerificationRoutes);
370
cd4f63bTest User371// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
372app.route("/", magicLinkRoutes);
373
79136bbClaude374// Settings routes (profile, SSH keys)
375app.route("/", settingsRoutes);
376
7298a17Claude377// 2FA / TOTP settings (Block B4)
378app.route("/", settings2faRoutes);
379
e75eddcClaude380// Agent multiplayer — /settings/agents management UI
381app.route("/", settingsAgentsRoutes);
382
1d4ff60Claude383// Chat integrations — Slack / Discord / Teams (/settings/integrations
384// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
385app.route("/", settingsIntegrationsRoutes);
386app.route("/", integrationsChatRoutes);
387
2df1f8cClaude388// WebAuthn / passkey routes (Block B5)
389app.route("/", passkeyRoutes);
390
058d752Claude391// OAuth 2.0 provider (Block B6)
392app.route("/", oauthRoutes);
393app.route("/", developerAppsRoutes);
394
6fc53bdClaude395// Theme toggle (dark/light cookie)
396app.route("/", themeRoutes);
397
398// Audit log UI
399app.route("/", auditRoutes);
400
401// Reactions API (issues, PRs, comments)
402app.route("/", reactionRoutes);
403
24cf2caClaude404// Saved replies (per-user canned comment templates)
405app.route("/", savedReplyRoutes);
406
407// Environments + deployment history UI
408app.route("/", deploymentRoutes);
409
6563f0aClaude410// Organizations + teams (Block B1)
411app.route("/", orgRoutes);
412
c81ab7aClaude413// API tokens
414app.route("/", tokenRoutes);
415
59b6fb2Claude416// Notifications
3ef4c9dClaude417app.route("/", notificationRoutes);
418
79136bbClaude419// Repo settings (description, visibility, delete)
420app.route("/", repoSettings);
421
23d1a81Claude422// Repo collaborators (add/list/remove)
423app.route("/", collaboratorRoutes);
424
04f6b7fClaude425// Team-based repo collaborators (invite a whole team)
426app.route("/", teamCollaboratorRoutes);
427
428// Collaborator invite accept flow (token-based)
429app.route("/", invitesRoutes);
430
431// Real-time SSE endpoint (topic-based live updates)
432app.route("/", liveEventsRoutes);
433
3c03977Claude434// PR live co-editing — presence + cursors + content sync via SSE.
435app.route("/", prLiveRoutes);
436
c81ab7aClaude437// Webhooks management
438app.route("/", webhookRoutes);
439
79136bbClaude440// Compare view (branch diffs)
441app.route("/", compareRoutes);
442
443// Issue tracker
444app.route("/", issueRoutes);
445
0074234Claude446// Pull requests
447app.route("/", pullRoutes);
448
c81ab7aClaude449// Fork
450app.route("/", forkRoutes);
451
0074234Claude452// Web file editor
453app.route("/", editorRoutes);
454
43de941Claude455// Contributors
456app.route("/", contributorRoutes);
457
699e5c7Claude458// Health liveness + metrics endpoints
2c34075Claude459app.route("/", healthRoutes);
460
f295f78Dictation App461// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
462app.route("/api/platform-status", platformStatus);
463
52ad8b1Claude464// Block L4 — Public stats counters (powers landing-page social proof)
465app.route("/", publicStatsRoutes);
466
467// Block L3 — Live /demo page + /api/v2/demo/* endpoints
468app.route("/", demoRoutes);
469
2316be6Claude470// Public /status — human-readable platform health page
471app.route("/", statusRoutes);
472
b1be050CC LABS App473// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
474// Mounted near the public status route so the two surfaces are visible
475// side-by-side; routes are gated by isSiteAdmin internally.
476app.route("/", adminStatusRoutes);
477
80bed05Claude478// /help — quickstart + API cheatsheet
479app.route("/", helpRoutes);
480
5f2e749Claude481// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
482// so the new editorial pricing layout wins the route; the legacy marketing
483// pricing remains as a safety net but is shadowed at the router.
484app.route("/", pricingRoutes);
485
b0148e9Claude486// /pricing, /features, /about — marketing surface
487app.route("/", marketingRoutes);
488
5618f9aClaude489// SEO: robots.txt + sitemap.xml
490app.route("/", seoRoutes);
491
05cdb85Claude492// /api/version — live build SHA + uptime; client poller uses this to
493// surface 'New version available — reload' banners on deploy.
494app.route("/", versionRoutes);
495
699e5c7Claude496// Health dashboard (per-repo health page)
497app.route("/", healthDashboardRoutes);
498
9dd96b9Test User499// Block R1 — site-admin operations console. MUST be mounted BEFORE
500// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
501// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
502app.route("/", adminOpsRoutes);
f2c00b4CC LABS App503// BLOCK W — Self-host status + bootstrap dashboard.
504app.route("/", adminSelfHostRoutes);
826eccfTest User505// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
506app.route("/", adminDiagnoseRoutes);
9dd96b9Test User507
16b325cClaude508// Insights (time-travel, dependencies, rollback)
509app.route("/", insightRoutes);
510
f1ab587Claude511// Command center dashboard
512app.route("/", dashboardRoutes);
513
36b4cbdClaude514// Legal pages (terms, privacy, AUP)
515app.route("/", legalRoutes);
4b66018Claude516// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
517// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
518// /acceptable-use); these are the formal versions that the legal pages
519// internally link to each other.
520app.route("/", legalTermsRoutes);
521app.route("/", legalPrivacyRoutes);
522app.route("/", legalAcceptableUseRoutes);
523app.route("/", legalDmcaRoutes);
36b4cbdClaude524
bdbd0deClaude525// GitHub import / migration
526app.route("/", importRoutes);
14c3cc8Claude527app.route("/", importBulkRoutes);
f390cfaCC LABS App528app.route("/", importSecretsRoutes);
14c3cc8Claude529app.route("/", migrationRoutes);
530
531// Spec-to-PR (experimental AI-generated draft PRs)
532app.route("/", specsRoutes);
23d0abfClaude533app.route("/", refactorRoutes);
bdbd0deClaude534
c81ab7aClaude535// Explore page
536app.route("/", exploreRoutes);
537
59b6fb2Claude538// Onboarding
539app.route("/", onboardingRoutes);
540
0316dbbClaude541// Admin + feature routes
542app.route("/", adminRoutes);
509c376Claude543app.route("/", adminIntegrationsRoutes);
f764c07Claude544app.route("/", adminDeploysRoutes);
545app.route("/", adminDeploysPageRoutes);
9dd96b9Test User546// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude547app.route("/", advisoriesRoutes);
548app.route("/", aiChangelogRoutes);
549app.route("/", aiExplainRoutes);
550app.route("/", aiTestsRoutes);
551app.route("/", askRoutes);
38d31d3Claude552app.route("/", repoChatRoutes);
0316dbbClaude553app.route("/", billingRoutes);
6778ad2Claude554app.route("/", stripeWebhookRoutes);
0316dbbClaude555app.route("/", codeScanningRoutes);
556app.route("/", commitStatusesRoutes);
557app.route("/", copilotRoutes);
558app.route("/", depUpdaterRoutes);
559app.route("/", depsRoutes);
560app.route("/", discussionsRoutes);
561app.route("/", environmentsRoutes);
4bbacbeClaude562app.route("/", previewsRoutes);
0316dbbClaude563app.route("/", followsRoutes);
564app.route("/", gatesRoutes);
565app.route("/", gistsRoutes);
566app.route("/", graphqlRoutes);
2c2163eClaude567app.route("/", mcpRoutes);
0316dbbClaude568app.route("/", marketplaceRoutes);
569app.route("/", mergeQueueRoutes);
570app.route("/", mirrorsRoutes);
571app.route("/", orgInsightsRoutes);
572app.route("/", packagesRoutes);
573app.route("/", packagesApiRoutes);
574app.route("/", pagesRoutes);
575app.route("/", projectsRoutes);
576app.route("/", protectedTagsRoutes);
577app.route("/", pwaRoutes);
46d6165Claude578app.route("/", installRoutes);
cd4f63bTest User579// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
580app.route("/", dxtRoutes);
662ce86Claude581// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
582// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
583app.route("/", connectClaudeRoutes);
0316dbbClaude584app.route("/", releasesRoutes);
585app.route("/", requiredChecksRoutes);
586app.route("/", rulesetsRoutes);
587app.route("/", searchRoutes);
588app.route("/", semanticSearchRoutes);
589app.route("/", signingKeysRoutes);
590app.route("/", sponsorsRoutes);
591app.route("/", ssoRoutes);
46d6165Claude592app.route("/", githubOauthRoutes);
582cdacClaude593app.route("/", googleOauthRoutes);
0316dbbClaude594app.route("/", symbolsRoutes);
595app.route("/", templatesRoutes);
596app.route("/", trafficRoutes);
597app.route("/", wikisRoutes);
598app.route("/", workflowsRoutes);
5ff9cc2Claude599app.route("/", workflowArtifactsRoutes);
600app.route("/", workflowSecretsRoutes);
46d6165Claude601app.route("/", sleepModeRoutes);
52ad8b1Claude602app.route("/", vsGithubRoutes);
0316dbbClaude603
45f3b73Claude604// Voice-to-PR — phone-first dictation → spec or issue
605app.route("/", voiceRoutes);
606
cd4f63bTest User607// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
608// before the web catch-all so the bare `/play` literal wins over the
609// `/:owner` user-profile route.
610app.route("/", playgroundRoutes);
611
79136bbClaude612// Web UI (catch-all, must be last)
613app.route("/", webRoutes);
614
c63b860Claude615// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
616// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude617app.notFound((c) => {
36cc17aClaude618 const user = c.get("user") ?? null;
79136bbClaude619 return c.html(
c63b860Claude620 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude621 404
622 );
623});
624
c63b860Claude625// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
626// view. Trace block only shown outside production.
79136bbClaude627app.onError((err, c) => {
80bed05Claude628 reportError(err, {
629 requestId: c.get("requestId"),
630 path: c.req.path,
631 method: c.req.method,
632 });
c63b860Claude633 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
634 // back to the context value set by request-context middleware.
635 const requestId =
636 c.req.header("x-request-id") ||
637 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude638 const user = c.get("user") ?? null;
c63b860Claude639 const trace =
640 process.env.NODE_ENV !== "production" && err && err.message
641 ? err.message
642 : undefined;
79136bbClaude643 return c.html(
c63b860Claude644 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude645 500
646 );
647});
648
649export default app;