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.tsxBlame675 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";
ee7e577Claude100import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude101import billingRoutes from "./routes/billing";
8809b87Claude102import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude103import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude104import codeScanningRoutes from "./routes/code-scanning";
105import commitStatusesRoutes from "./routes/commit-statuses";
106import copilotRoutes from "./routes/copilot";
107import depUpdaterRoutes from "./routes/dep-updater";
108import depsRoutes from "./routes/deps";
109import discussionsRoutes from "./routes/discussions";
110import environmentsRoutes from "./routes/environments";
4bbacbeClaude111import previewsRoutes from "./routes/previews";
79ed944Claude112import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude113import followsRoutes from "./routes/follows";
114import gatesRoutes from "./routes/gates";
115import gistsRoutes from "./routes/gists";
116import graphqlRoutes from "./routes/graphql";
2c2163eClaude117import mcpRoutes from "./routes/mcp";
0316dbbClaude118import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude119import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude120import mergeQueueRoutes from "./routes/merge-queue";
121import mirrorsRoutes from "./routes/mirrors";
122import orgInsightsRoutes from "./routes/org-insights";
123import packagesRoutes from "./routes/packages";
124import packagesApiRoutes from "./routes/packages-api";
125import pagesRoutes from "./routes/pages";
126import projectsRoutes from "./routes/projects";
127import protectedTagsRoutes from "./routes/protected-tags";
128import pwaRoutes from "./routes/pwa";
46d6165Claude129import installRoutes from "./routes/install";
cd4f63bTest User130import dxtRoutes from "./routes/dxt";
662ce86Claude131import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude132import claudeDeployRoutes from "./routes/claude-deploy";
0316dbbClaude133import releasesRoutes from "./routes/releases";
134import requiredChecksRoutes from "./routes/required-checks";
135import rulesetsRoutes from "./routes/rulesets";
136import searchRoutes from "./routes/search";
137import semanticSearchRoutes from "./routes/semantic-search";
138import signingKeysRoutes from "./routes/signing-keys";
139import sponsorsRoutes from "./routes/sponsors";
140import ssoRoutes from "./routes/sso";
46d6165Claude141import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude142import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude143import symbolsRoutes from "./routes/symbols";
144import templatesRoutes from "./routes/templates";
145import trafficRoutes from "./routes/traffic";
146import wikisRoutes from "./routes/wikis";
147import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude148import workflowArtifactsRoutes from "./routes/workflow-artifacts";
149import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude150import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude151import standupRoutes from "./routes/standups";
52ad8b1Claude152import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude153import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User154import playgroundRoutes from "./routes/playground";
59b6fb2Claude155import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
156import { csrfToken, csrfProtect } from "./middleware/csrf";
79136bbClaude157
2316901Claude158import type { AuthEnv } from "./middleware/auth";
bf19c50Test User159import { softAuth } from "./middleware/auth";
2316901Claude160
161const app = new Hono<AuthEnv>();
79136bbClaude162
3ef4c9dClaude163// Request context (request ID, start time) runs before everything else
164app.use("*", requestContext);
05b973eClaude165// Middleware — compression first (wraps all responses)
166app.use("*", compress());
f1ffd50Claude167
168// ETag middleware — returns 304 Not Modified on unchanged responses.
169// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
170// SSE + the API surface where it would interfere with streaming.
171app.use("*", async (c, next) => {
172 const p = c.req.path;
173 if (
174 p.includes(".git/") ||
175 p.startsWith("/live-events") ||
176 p.startsWith("/api/events/deploy") ||
3c03977Claude177 p.startsWith("/admin/status") ||
178 // PR live co-editing SSE stream — never etag streaming responses.
179 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude180 ) {
181 return next();
182 }
183 return etag()(c, next);
184});
185
186// Cache-Control middleware — sets sensible defaults on public, anonymous
187// requests. Crontech (when wired as our edge layer) and downstream
188// browsers will honor these. Auth'd users get private,no-store
189// automatically — we never cache responses tied to a session.
190app.use("*", async (c, next) => {
191 await next();
192 // Don't overwrite explicit headers set by route handlers — BUT the
193 // ETag middleware unconditionally sets "private, no-cache, must-
194 // revalidate" so we have to treat that specific value as "no
195 // policy chosen yet" and apply ours. Any route that explicitly set
196 // a different cache-control wins.
197 const existing = c.res.headers.get("cache-control");
198 const etagDefault =
199 existing === "private, no-cache, must-revalidate" ||
200 existing === "no-cache";
201 if (existing && !etagDefault) return;
202 // Anything past auth: private + no-store (avoid leaking session
203 // content into shared caches). softAuth runs before this on the
204 // request, but the response side is what we're stamping.
205 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
206 const p = c.req.path;
207 // Always private for known-authed paths regardless of cookie.
208 if (
209 p.startsWith("/admin") ||
210 p.startsWith("/settings") ||
211 p.startsWith("/dashboard") ||
212 p.startsWith("/notifications") ||
213 p.startsWith("/connect/") ||
214 hasSession
215 ) {
216 c.res.headers.set("cache-control", "private, no-store");
217 return;
218 }
219 // Public marketing surfaces — short edge cache, longer browser cache,
220 // stale-while-revalidate so the user never waits on a stale fetch.
221 const isMarketing =
222 p === "/" ||
223 p === "/features" ||
224 p === "/pricing" ||
225 p === "/about" ||
226 p === "/vs-github" ||
227 p === "/explore" ||
228 p === "/help" ||
229 p === "/changelog" ||
230 p.startsWith("/legal/") ||
231 p === "/terms" ||
232 p === "/privacy" ||
233 p === "/acceptable-use" ||
234 p.startsWith("/docs/");
235 if (isMarketing) {
236 c.res.headers.set(
237 "cache-control",
238 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
239 );
240 return;
241 }
242 // Public repo browse pages — cache aggressively. Edge invalidates
243 // on push via the post-receive hook (future Crontech surge purge).
244 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
245 c.res.headers.set(
246 "cache-control",
247 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
248 );
249 return;
250 }
251 // Default: don't cache anything we haven't explicitly opted in.
252 c.res.headers.set("cache-control", "private, no-store");
253});
05b973eClaude254// Logger only on non-git routes to avoid overhead on clone/push
255app.use("*", async (c, next) => {
256 if (c.req.path.includes(".git/")) return next();
257 return logger()(c, next);
258});
79136bbClaude259app.use("/api/*", cors());
bf19c50Test User260// Global softAuth — populates c.get("user") for every downstream middleware
261// + route. This was previously per-route, which meant rate-limit middleware
262// (and anything else inspecting auth state) always saw a null user. Keep
263// individual routes free to add requireAuth on top for hard gating; this
264// just establishes the user object cheaply.
265app.use("*", softAuth);
290ea77Claude266
36cc17aClaude267// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude268// pre-redesign markup. JSON / static assets keep their own cache rules; only
269// text/html responses get the no-cache stamp. Without this, every push to
270// main left users staring at cached 80s-looking pages from before the design
271// landed.
36cc17aClaude272//
273// We deliberately use `private, no-cache, must-revalidate` rather than
274// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
275// which makes every Back/Forward press a cold server round-trip — that
276// contributed to the "every nav feels like a fresh login" UX complaint.
277// `no-cache` still revalidates on direct fetch but lets bfcache hold the
278// page in memory between navigations.
290ea77Claude279app.use("*", async (c, next) => {
280 await next();
281 const ct = c.res.headers.get("content-type") || "";
282 if (ct.startsWith("text/html")) {
36cc17aClaude283 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude284 }
285});
826eccfTest User286// Rate-limit API + auth endpoints.
287//
a41e675Test User288// `/api/*`: 1000/min per IP — generous so an admin clicking around the
289// operator console (or a CDN/proxy concentrating multiple users behind one
290// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
291// rate limits below, not this one.
292//
293// `authedMultiplier` is set but only fires when an upstream middleware has
294// already populated c.get("user") — most app.use() chains apply softAuth
295// per-route, so the multiplier is best-effort. Keep the anonymous base
296// high enough that humans never feel it.
297//
298// Skip-paths: dashboard plumbing endpoints that the layout polls on a
299// fixed cadence and that we don't want consuming any bucket:
300// /api/version — layout polls every 15s
826eccfTest User301// /api/notifications/count — nav bell unread-count fetcher
302// /pwa/vapid-public-key — fetched once per push-notification opt-in
303app.use(
304 "/api/*",
a41e675Test User305 rateLimit(1000, 60_000, "api", {
826eccfTest User306 authedMultiplier: 4,
307 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
308 })
309);
0316dbbClaude310app.use("/login", rateLimit(20, 60_000, "login"));
311app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude312// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
313app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User314// BLOCK Q2 — throttle magic-link sign-in for the same reason.
315app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude316
59b6fb2Claude317// CSRF protection — set token on all requests, validate on mutations
318app.use("*", csrfToken);
319app.use("*", csrfProtect);
320
45e31d0Claude321// Rate limit auth routes
322app.use("/login", authRateLimit);
323app.use("/register", authRateLimit);
324
59b6fb2Claude325// Rate limit git operations
326app.use("/:owner/:repo.git/*", gitRateLimit);
327
328// Rate limit search
329app.use("/:owner/:repo/search", searchRateLimit);
330app.use("/explore", searchRateLimit);
79136bbClaude331
332// Git Smart HTTP protocol routes (must be before web routes)
333app.route("/", gitRoutes);
334
45e31d0Claude335// REST API v1 (legacy)
79136bbClaude336app.route("/", apiRoutes);
337
52ad8b1Claude338// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
339// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
340// router's catch-shape, and BEFORE adminRoutes so the live /demo page
341// wins over the legacy /demo redirect in src/routes/admin.tsx.
342app.route("/", demoRoutes);
343
0316dbbClaude344// REST API v2 (basePath /api/v2)
345app.route("/", apiV2Routes);
346
e75eddcClaude347// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
348// Mounted alongside apiV2Routes (its own basePath, no path conflict).
349app.route("/", agentsRoutes);
350
ad6d4adClaude351// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
352app.route("/", hookRoutes);
21f8dbdClaude353app.route("/api/events", eventsRoutes);
ad6d4adClaude354
45e31d0Claude355// API documentation
356app.route("/", apiDocsRoutes);
4a80519Claude357app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude358// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
359app.route("/", pullsDashboardRoutes);
e9aa4d8Claude360// Issue command center — global issue dashboard with AI-triage + autopilot signal
361app.route("/", issuesDashboardRoutes);
362// Personal activity timeline — every event across the user's repos, with
363// AI-driven events surfaced separately (the Gluecron differentiator).
364app.route("/", activityRoutes);
365// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
366app.route("/", inboxRoutes);
56801e1Claude367// AI standup feed — daily / weekly Claude-generated team brief
368app.route("/", standupRoutes);
79136bbClaude369
370// Auth routes (register, login, logout)
371app.route("/", authRoutes);
372
c63b860Claude373// BLOCK P1 — Password reset (forgot-password + reset-password)
374app.route("/", passwordResetRoutes);
375
376// BLOCK P2 — Email verification (verify-email + resend)
377app.route("/", emailVerificationRoutes);
378
cd4f63bTest User379// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
380app.route("/", magicLinkRoutes);
381
79136bbClaude382// Settings routes (profile, SSH keys)
383app.route("/", settingsRoutes);
384
7298a17Claude385// 2FA / TOTP settings (Block B4)
386app.route("/", settings2faRoutes);
387
e75eddcClaude388// Agent multiplayer — /settings/agents management UI
389app.route("/", settingsAgentsRoutes);
390
1d4ff60Claude391// Chat integrations — Slack / Discord / Teams (/settings/integrations
392// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
393app.route("/", settingsIntegrationsRoutes);
394app.route("/", integrationsChatRoutes);
395
2df1f8cClaude396// WebAuthn / passkey routes (Block B5)
397app.route("/", passkeyRoutes);
398
058d752Claude399// OAuth 2.0 provider (Block B6)
400app.route("/", oauthRoutes);
401app.route("/", developerAppsRoutes);
402
6fc53bdClaude403// Theme toggle (dark/light cookie)
404app.route("/", themeRoutes);
405
406// Audit log UI
407app.route("/", auditRoutes);
408
409// Reactions API (issues, PRs, comments)
410app.route("/", reactionRoutes);
411
24cf2caClaude412// Saved replies (per-user canned comment templates)
413app.route("/", savedReplyRoutes);
414
415// Environments + deployment history UI
416app.route("/", deploymentRoutes);
417
6563f0aClaude418// Organizations + teams (Block B1)
419app.route("/", orgRoutes);
420
c81ab7aClaude421// API tokens
422app.route("/", tokenRoutes);
423
59b6fb2Claude424// Notifications
3ef4c9dClaude425app.route("/", notificationRoutes);
426
79136bbClaude427// Repo settings (description, visibility, delete)
428app.route("/", repoSettings);
429
23d1a81Claude430// Repo collaborators (add/list/remove)
431app.route("/", collaboratorRoutes);
432
04f6b7fClaude433// Team-based repo collaborators (invite a whole team)
434app.route("/", teamCollaboratorRoutes);
435
436// Collaborator invite accept flow (token-based)
437app.route("/", invitesRoutes);
438
439// Real-time SSE endpoint (topic-based live updates)
440app.route("/", liveEventsRoutes);
441
3c03977Claude442// PR live co-editing — presence + cursors + content sync via SSE.
443app.route("/", prLiveRoutes);
444
c81ab7aClaude445// Webhooks management
446app.route("/", webhookRoutes);
447
79136bbClaude448// Compare view (branch diffs)
449app.route("/", compareRoutes);
450
451// Issue tracker
452app.route("/", issueRoutes);
453
cb5a796Claude454// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
455// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
456// the `/:owner/:repo/comments/*` paths resolve before the broader PR
457// patterns kick in.
458app.route("/", commentModerationRoutes);
459
0074234Claude460// Pull requests
461app.route("/", pullRoutes);
79ed944Claude462// PR sandboxes — runnable per-PR environments. Migration 0067.
463app.route("/", prSandboxRoutes);
0074234Claude464
c81ab7aClaude465// Fork
466app.route("/", forkRoutes);
467
0074234Claude468// Web file editor
469app.route("/", editorRoutes);
470
43de941Claude471// Contributors
472app.route("/", contributorRoutes);
473
699e5c7Claude474// Health liveness + metrics endpoints
2c34075Claude475app.route("/", healthRoutes);
476
f295f78Dictation App477// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
478app.route("/api/platform-status", platformStatus);
479
52ad8b1Claude480// Block L4 — Public stats counters (powers landing-page social proof)
481app.route("/", publicStatsRoutes);
482
483// Block L3 — Live /demo page + /api/v2/demo/* endpoints
484app.route("/", demoRoutes);
485
2316be6Claude486// Public /status — human-readable platform health page
487app.route("/", statusRoutes);
488
b1be050CC LABS App489// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
490// Mounted near the public status route so the two surfaces are visible
491// side-by-side; routes are gated by isSiteAdmin internally.
492app.route("/", adminStatusRoutes);
493
80bed05Claude494// /help — quickstart + API cheatsheet
495app.route("/", helpRoutes);
496
5f2e749Claude497// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
498// so the new editorial pricing layout wins the route; the legacy marketing
499// pricing remains as a safety net but is shadowed at the router.
500app.route("/", pricingRoutes);
501
b0148e9Claude502// /pricing, /features, /about — marketing surface
503app.route("/", marketingRoutes);
504
5618f9aClaude505// SEO: robots.txt + sitemap.xml
506app.route("/", seoRoutes);
507
05cdb85Claude508// /api/version — live build SHA + uptime; client poller uses this to
509// surface 'New version available — reload' banners on deploy.
510app.route("/", versionRoutes);
511
699e5c7Claude512// Health dashboard (per-repo health page)
513app.route("/", healthDashboardRoutes);
514
9dd96b9Test User515// Block R1 — site-admin operations console. MUST be mounted BEFORE
516// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
517// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
518app.route("/", adminOpsRoutes);
f2c00b4CC LABS App519// BLOCK W — Self-host status + bootstrap dashboard.
520app.route("/", adminSelfHostRoutes);
826eccfTest User521// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
522app.route("/", adminDiagnoseRoutes);
9dd96b9Test User523
16b325cClaude524// Insights (time-travel, dependencies, rollback)
525app.route("/", insightRoutes);
526
f1ab587Claude527// Command center dashboard
528app.route("/", dashboardRoutes);
529
36b4cbdClaude530// Legal pages (terms, privacy, AUP)
531app.route("/", legalRoutes);
4b66018Claude532// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
533// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
534// /acceptable-use); these are the formal versions that the legal pages
535// internally link to each other.
536app.route("/", legalTermsRoutes);
537app.route("/", legalPrivacyRoutes);
538app.route("/", legalAcceptableUseRoutes);
539app.route("/", legalDmcaRoutes);
36b4cbdClaude540
bdbd0deClaude541// GitHub import / migration
542app.route("/", importRoutes);
14c3cc8Claude543app.route("/", importBulkRoutes);
f390cfaCC LABS App544app.route("/", importSecretsRoutes);
14c3cc8Claude545app.route("/", migrationRoutes);
546
547// Spec-to-PR (experimental AI-generated draft PRs)
548app.route("/", specsRoutes);
23d0abfClaude549app.route("/", refactorRoutes);
bdbd0deClaude550
c81ab7aClaude551// Explore page
552app.route("/", exploreRoutes);
553
59b6fb2Claude554// Onboarding
555app.route("/", onboardingRoutes);
556
0316dbbClaude557// Admin + feature routes
558app.route("/", adminRoutes);
509c376Claude559app.route("/", adminIntegrationsRoutes);
79ed944Claude560app.route("/", adminAdvancementRoutes);
f764c07Claude561app.route("/", adminDeploysRoutes);
562app.route("/", adminDeploysPageRoutes);
9dd96b9Test User563// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude564app.route("/", advisoriesRoutes);
565app.route("/", aiChangelogRoutes);
566app.route("/", aiExplainRoutes);
567app.route("/", aiTestsRoutes);
568app.route("/", askRoutes);
38d31d3Claude569app.route("/", repoChatRoutes);
ee7e577Claude570// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
571// repoChatRoutes so the two surfaces share the catch-all priority.
572app.route("/", personalChatRoutes);
0316dbbClaude573app.route("/", billingRoutes);
8809b87Claude574app.route("/", billingUsageRoutes);
6778ad2Claude575app.route("/", stripeWebhookRoutes);
0316dbbClaude576app.route("/", codeScanningRoutes);
577app.route("/", commitStatusesRoutes);
578app.route("/", copilotRoutes);
579app.route("/", depUpdaterRoutes);
580app.route("/", depsRoutes);
581app.route("/", discussionsRoutes);
582app.route("/", environmentsRoutes);
4bbacbeClaude583app.route("/", previewsRoutes);
79ed944Claude584app.route("/", docsTrackingRoutes);
0316dbbClaude585app.route("/", followsRoutes);
586app.route("/", gatesRoutes);
587app.route("/", gistsRoutes);
588app.route("/", graphqlRoutes);
2c2163eClaude589app.route("/", mcpRoutes);
0316dbbClaude590app.route("/", marketplaceRoutes);
5ca514aClaude591app.route("/", marketplaceAgentsRoutes);
0316dbbClaude592app.route("/", mergeQueueRoutes);
593app.route("/", mirrorsRoutes);
594app.route("/", orgInsightsRoutes);
595app.route("/", packagesRoutes);
596app.route("/", packagesApiRoutes);
597app.route("/", pagesRoutes);
598app.route("/", projectsRoutes);
599app.route("/", protectedTagsRoutes);
600app.route("/", pwaRoutes);
46d6165Claude601app.route("/", installRoutes);
cd4f63bTest User602// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
603app.route("/", dxtRoutes);
662ce86Claude604// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
605// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
606app.route("/", connectClaudeRoutes);
ebbb527Claude607// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
608// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
609app.route("/", claudeDeployRoutes);
0316dbbClaude610app.route("/", releasesRoutes);
611app.route("/", requiredChecksRoutes);
612app.route("/", rulesetsRoutes);
613app.route("/", searchRoutes);
614app.route("/", semanticSearchRoutes);
615app.route("/", signingKeysRoutes);
616app.route("/", sponsorsRoutes);
617app.route("/", ssoRoutes);
46d6165Claude618app.route("/", githubOauthRoutes);
582cdacClaude619app.route("/", googleOauthRoutes);
0316dbbClaude620app.route("/", symbolsRoutes);
621app.route("/", templatesRoutes);
622app.route("/", trafficRoutes);
623app.route("/", wikisRoutes);
624app.route("/", workflowsRoutes);
5ff9cc2Claude625app.route("/", workflowArtifactsRoutes);
626app.route("/", workflowSecretsRoutes);
46d6165Claude627app.route("/", sleepModeRoutes);
52ad8b1Claude628app.route("/", vsGithubRoutes);
0316dbbClaude629
45f3b73Claude630// Voice-to-PR — phone-first dictation → spec or issue
631app.route("/", voiceRoutes);
632
cd4f63bTest User633// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
634// before the web catch-all so the bare `/play` literal wins over the
635// `/:owner` user-profile route.
636app.route("/", playgroundRoutes);
637
79136bbClaude638// Web UI (catch-all, must be last)
639app.route("/", webRoutes);
640
c63b860Claude641// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
642// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude643app.notFound((c) => {
36cc17aClaude644 const user = c.get("user") ?? null;
79136bbClaude645 return c.html(
c63b860Claude646 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude647 404
648 );
649});
650
c63b860Claude651// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
652// view. Trace block only shown outside production.
79136bbClaude653app.onError((err, c) => {
80bed05Claude654 reportError(err, {
655 requestId: c.get("requestId"),
656 path: c.req.path,
657 method: c.req.method,
658 });
c63b860Claude659 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
660 // back to the context value set by request-context middleware.
661 const requestId =
662 c.req.header("x-request-id") ||
663 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude664 const user = c.get("user") ?? null;
c63b860Claude665 const trace =
666 process.env.NODE_ENV !== "production" && err && err.message
667 ? err.message
668 : undefined;
79136bbClaude669 return c.html(
c63b860Claude670 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude671 500
672 );
673});
674
675export default app;