Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
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.tsxBlame747 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";
9b3a183Claude41import devEnvRoutes from "./routes/dev-env";
0074234Claude42import editorRoutes from "./routes/editor";
c81ab7aClaude43import forkRoutes from "./routes/fork";
44import webhookRoutes from "./routes/webhooks";
45import exploreRoutes from "./routes/explore";
46import tokenRoutes from "./routes/tokens";
43de941Claude47import contributorRoutes from "./routes/contributors";
699e5c7Claude48import healthRoutes from "./routes/health-probe";
49import healthDashboardRoutes from "./routes/health";
2316be6Claude50import statusRoutes from "./routes/status";
b1be050CC LABS App51import adminStatusRoutes from "./routes/admin-status";
80bed05Claude52import helpRoutes from "./routes/help";
e1fc7dbClaude53import changelogRoutes from "./routes/changelog";
e0e4219Claude54import docsRoutes from "./routes/docs";
b0148e9Claude55import marketingRoutes from "./routes/marketing";
5f2e749Claude56import pricingRoutes from "./routes/pricing";
5618f9aClaude57import seoRoutes from "./routes/seo";
05cdb85Claude58import versionRoutes from "./routes/version";
f295f78Dictation App59import { platformStatus } from "./routes/platform-status";
52ad8b1Claude60import publicStatsRoutes from "./routes/public-stats";
61import demoRoutes from "./routes/demo";
16b325cClaude62import insightRoutes from "./routes/insights";
8d1483cClaude63import doraRoutes from "./routes/dora";
f1ab587Claude64import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude65import legalRoutes from "./routes/legal";
4b66018Claude66import legalDmcaRoutes from "./routes/legal/dmca";
67import legalTermsRoutes from "./routes/legal/terms";
68import legalPrivacyRoutes from "./routes/legal/privacy";
69import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude70import importRoutes from "./routes/import";
14c3cc8Claude71import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App72import importSecretsRoutes from "./routes/import-secrets";
14c3cc8Claude73import migrationRoutes from "./routes/migrations";
74import specsRoutes from "./routes/specs";
23d0abfClaude75import refactorRoutes from "./routes/refactors";
79136bbClaude76import webRoutes from "./routes/web";
0316dbbClaude77import hookRoutes from "./routes/hooks";
78import eventsRoutes from "./routes/events";
79import passkeyRoutes from "./routes/passkeys";
80import oauthRoutes from "./routes/oauth";
81import developerAppsRoutes from "./routes/developer-apps";
82import themeRoutes from "./routes/theme";
83import auditRoutes from "./routes/audit";
84import reactionRoutes from "./routes/reactions";
85import savedReplyRoutes from "./routes/saved-replies";
86import deploymentRoutes from "./routes/deployments";
87import orgRoutes from "./routes/orgs";
88import notificationRoutes from "./routes/notifications";
89import onboardingRoutes from "./routes/onboarding";
90import adminRoutes from "./routes/admin";
f764c07Claude91import adminDeploysRoutes from "./routes/admin-deploys";
92import adminDeploysPageRoutes from "./routes/admin-deploys-page";
783dd46Claude93import adminServerTargetsRoutes from "./routes/admin-server-targets";
9aaa128Claude94import deployTargetsRoutes from "./routes/deploy-targets";
90c7531Claude95import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User96import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App97import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User98import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude99import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude100import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude101import advisoriesRoutes from "./routes/advisories";
102import aiChangelogRoutes from "./routes/ai-changelog";
103import aiExplainRoutes from "./routes/ai-explain";
104import aiTestsRoutes from "./routes/ai-tests";
105import askRoutes from "./routes/ask";
38d31d3Claude106import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude107import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude108import billingRoutes from "./routes/billing";
8809b87Claude109import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude110import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude111import codeScanningRoutes from "./routes/code-scanning";
112import commitStatusesRoutes from "./routes/commit-statuses";
113import copilotRoutes from "./routes/copilot";
114import depUpdaterRoutes from "./routes/dep-updater";
115import depsRoutes from "./routes/deps";
116import discussionsRoutes from "./routes/discussions";
117import environmentsRoutes from "./routes/environments";
4bbacbeClaude118import previewsRoutes from "./routes/previews";
79ed944Claude119import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude120import followsRoutes from "./routes/follows";
121import gatesRoutes from "./routes/gates";
122import gistsRoutes from "./routes/gists";
123import graphqlRoutes from "./routes/graphql";
2c2163eClaude124import mcpRoutes from "./routes/mcp";
0316dbbClaude125import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude126import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude127import mergeQueueRoutes from "./routes/merge-queue";
128import mirrorsRoutes from "./routes/mirrors";
129import orgInsightsRoutes from "./routes/org-insights";
130import packagesRoutes from "./routes/packages";
131import packagesApiRoutes from "./routes/packages-api";
132import pagesRoutes from "./routes/pages";
133import projectsRoutes from "./routes/projects";
134import protectedTagsRoutes from "./routes/protected-tags";
135import pwaRoutes from "./routes/pwa";
46d6165Claude136import installRoutes from "./routes/install";
cd4f63bTest User137import dxtRoutes from "./routes/dxt";
662ce86Claude138import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude139import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude140import claudeIntegration from "./routes/claude-integration";
141import connectRoutes from "./routes/connect";
05ab9b1Claude142import pushWatchRoutes from "./routes/push-watch";
143import orgSecretsRoutes from "./routes/org-secrets";
0316dbbClaude144import releasesRoutes from "./routes/releases";
145import requiredChecksRoutes from "./routes/required-checks";
146import rulesetsRoutes from "./routes/rulesets";
147import searchRoutes from "./routes/search";
148import semanticSearchRoutes from "./routes/semantic-search";
149import signingKeysRoutes from "./routes/signing-keys";
150import sponsorsRoutes from "./routes/sponsors";
151import ssoRoutes from "./routes/sso";
46d6165Claude152import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude153import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude154import symbolsRoutes from "./routes/symbols";
155import templatesRoutes from "./routes/templates";
156import trafficRoutes from "./routes/traffic";
157import wikisRoutes from "./routes/wikis";
158import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude159import workflowArtifactsRoutes from "./routes/workflow-artifacts";
160import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude161import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude162import standupRoutes from "./routes/standups";
52ad8b1Claude163import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude164import voiceRoutes from "./routes/voice-to-pr";
cd4f63bTest User165import playgroundRoutes from "./routes/playground";
a2b3e99Claude166import crossRepoSearchRoutes from "./routes/cross-repo-search";
167import pushNotifRoutes from "./routes/push-notifications";
9fbe6cdClaude168import velocityRoutes from "./routes/velocity";
169import { staleBranchRoutes } from "./routes/stale-branches";
22f43f3Claude170import pulseRoutes from "./routes/pulse";
74d8c4dClaude171import healthScoreRoutes from "./routes/health-score";
172import hotFilesRoutes from "./routes/hot-files";
adf5e18Claude173import developerProgramRoutes from "./routes/developer-program";
891efbeClaude174import shareRoutes from "./routes/share";
59b6fb2Claude175import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
176import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude177import { noCache } from "./middleware/no-cache";
79136bbClaude178
2316901Claude179import type { AuthEnv } from "./middleware/auth";
bf19c50Test User180import { softAuth } from "./middleware/auth";
2316901Claude181
182const app = new Hono<AuthEnv>();
79136bbClaude183
3ef4c9dClaude184// Request context (request ID, start time) runs before everything else
185app.use("*", requestContext);
05b973eClaude186// Middleware — compression first (wraps all responses)
187app.use("*", compress());
f1ffd50Claude188
189// ETag middleware — returns 304 Not Modified on unchanged responses.
190// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
191// SSE + the API surface where it would interfere with streaming.
192app.use("*", async (c, next) => {
193 const p = c.req.path;
194 if (
195 p.includes(".git/") ||
196 p.startsWith("/live-events") ||
197 p.startsWith("/api/events/deploy") ||
3c03977Claude198 p.startsWith("/admin/status") ||
199 // PR live co-editing SSE stream — never etag streaming responses.
200 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude201 ) {
202 return next();
203 }
204 return etag()(c, next);
205});
206
207// Cache-Control middleware — sets sensible defaults on public, anonymous
208// requests. Crontech (when wired as our edge layer) and downstream
209// browsers will honor these. Auth'd users get private,no-store
210// automatically — we never cache responses tied to a session.
211app.use("*", async (c, next) => {
212 await next();
213 // Don't overwrite explicit headers set by route handlers — BUT the
214 // ETag middleware unconditionally sets "private, no-cache, must-
215 // revalidate" so we have to treat that specific value as "no
216 // policy chosen yet" and apply ours. Any route that explicitly set
217 // a different cache-control wins.
218 const existing = c.res.headers.get("cache-control");
219 const etagDefault =
220 existing === "private, no-cache, must-revalidate" ||
221 existing === "no-cache";
222 if (existing && !etagDefault) return;
223 // Anything past auth: private + no-store (avoid leaking session
224 // content into shared caches). softAuth runs before this on the
225 // request, but the response side is what we're stamping.
226 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
227 const p = c.req.path;
228 // Always private for known-authed paths regardless of cookie.
229 if (
230 p.startsWith("/admin") ||
231 p.startsWith("/settings") ||
232 p.startsWith("/dashboard") ||
233 p.startsWith("/notifications") ||
234 p.startsWith("/connect/") ||
235 hasSession
236 ) {
237 c.res.headers.set("cache-control", "private, no-store");
238 return;
239 }
240 // Public marketing surfaces — short edge cache, longer browser cache,
241 // stale-while-revalidate so the user never waits on a stale fetch.
242 const isMarketing =
243 p === "/" ||
244 p === "/features" ||
245 p === "/pricing" ||
246 p === "/about" ||
247 p === "/vs-github" ||
248 p === "/explore" ||
249 p === "/help" ||
250 p === "/changelog" ||
251 p.startsWith("/legal/") ||
252 p === "/terms" ||
253 p === "/privacy" ||
254 p === "/acceptable-use" ||
255 p.startsWith("/docs/");
256 if (isMarketing) {
257 c.res.headers.set(
258 "cache-control",
259 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
260 );
261 return;
262 }
263 // Public repo browse pages — cache aggressively. Edge invalidates
264 // on push via the post-receive hook (future Crontech surge purge).
265 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
266 c.res.headers.set(
267 "cache-control",
268 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
269 );
270 return;
271 }
272 // Default: don't cache anything we haven't explicitly opted in.
273 c.res.headers.set("cache-control", "private, no-store");
274});
05b973eClaude275// Logger only on non-git routes to avoid overhead on clone/push
276app.use("*", async (c, next) => {
277 if (c.req.path.includes(".git/")) return next();
278 return logger()(c, next);
279});
79136bbClaude280app.use("/api/*", cors());
bf19c50Test User281// Global softAuth — populates c.get("user") for every downstream middleware
282// + route. This was previously per-route, which meant rate-limit middleware
283// (and anything else inspecting auth state) always saw a null user. Keep
284// individual routes free to add requireAuth on top for hard gating; this
285// just establishes the user object cheaply.
286app.use("*", softAuth);
290ea77Claude287
36cc17aClaude288// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude289// pre-redesign markup. JSON / static assets keep their own cache rules; only
290// text/html responses get the no-cache stamp. Without this, every push to
291// main left users staring at cached 80s-looking pages from before the design
292// landed.
36cc17aClaude293//
294// We deliberately use `private, no-cache, must-revalidate` rather than
295// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
296// which makes every Back/Forward press a cold server round-trip — that
297// contributed to the "every nav feels like a fresh login" UX complaint.
298// `no-cache` still revalidates on direct fetch but lets bfcache hold the
299// page in memory between navigations.
290ea77Claude300app.use("*", async (c, next) => {
301 await next();
302 const ct = c.res.headers.get("content-type") || "";
303 if (ct.startsWith("text/html")) {
36cc17aClaude304 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude305 }
306});
826eccfTest User307// Rate-limit API + auth endpoints.
308//
a41e675Test User309// `/api/*`: 1000/min per IP — generous so an admin clicking around the
310// operator console (or a CDN/proxy concentrating multiple users behind one
311// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
312// rate limits below, not this one.
313//
314// `authedMultiplier` is set but only fires when an upstream middleware has
315// already populated c.get("user") — most app.use() chains apply softAuth
316// per-route, so the multiplier is best-effort. Keep the anonymous base
317// high enough that humans never feel it.
318//
319// Skip-paths: dashboard plumbing endpoints that the layout polls on a
320// fixed cadence and that we don't want consuming any bucket:
321// /api/version — layout polls every 15s
826eccfTest User322// /api/notifications/count — nav bell unread-count fetcher
323// /pwa/vapid-public-key — fetched once per push-notification opt-in
324app.use(
325 "/api/*",
a41e675Test User326 rateLimit(1000, 60_000, "api", {
826eccfTest User327 authedMultiplier: 4,
328 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
329 })
330);
0316dbbClaude331app.use("/login", rateLimit(20, 60_000, "login"));
332app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude333// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
334app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User335// BLOCK Q2 — throttle magic-link sign-in for the same reason.
336app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude337
59b6fb2Claude338// CSRF protection — set token on all requests, validate on mutations
339app.use("*", csrfToken);
340app.use("*", csrfProtect);
341
45e31d0Claude342// Rate limit auth routes
343app.use("/login", authRateLimit);
344app.use("/register", authRateLimit);
345
59b6fb2Claude346// Rate limit git operations
347app.use("/:owner/:repo.git/*", gitRateLimit);
348
349// Rate limit search
350app.use("/:owner/:repo/search", searchRateLimit);
351app.use("/explore", searchRateLimit);
79136bbClaude352
f5b9ef5Claude353// No-cache for HTML — ensures browsers and proxies never serve stale pages.
354// The middleware only stamps text/html responses so static assets keep
355// their own cache policies unchanged.
356app.use("*", noCache);
357
79136bbClaude358// Git Smart HTTP protocol routes (must be before web routes)
359app.route("/", gitRoutes);
360
45e31d0Claude361// REST API v1 (legacy)
79136bbClaude362app.route("/", apiRoutes);
363
52ad8b1Claude364// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
365// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
366// router's catch-shape, and BEFORE adminRoutes so the live /demo page
367// wins over the legacy /demo redirect in src/routes/admin.tsx.
368app.route("/", demoRoutes);
369
0316dbbClaude370// REST API v2 (basePath /api/v2)
371app.route("/", apiV2Routes);
372
e75eddcClaude373// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
374// Mounted alongside apiV2Routes (its own basePath, no path conflict).
375app.route("/", agentsRoutes);
376
ad6d4adClaude377// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
378app.route("/", hookRoutes);
21f8dbdClaude379app.route("/api/events", eventsRoutes);
ad6d4adClaude380
45e31d0Claude381// API documentation
382app.route("/", apiDocsRoutes);
4a80519Claude383app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude384// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
385app.route("/", pullsDashboardRoutes);
e9aa4d8Claude386// Issue command center — global issue dashboard with AI-triage + autopilot signal
387app.route("/", issuesDashboardRoutes);
388// Personal activity timeline — every event across the user's repos, with
389// AI-driven events surfaced separately (the Gluecron differentiator).
390app.route("/", activityRoutes);
391// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
392app.route("/", inboxRoutes);
56801e1Claude393// AI standup feed — daily / weekly Claude-generated team brief
394app.route("/", standupRoutes);
79136bbClaude395
396// Auth routes (register, login, logout)
397app.route("/", authRoutes);
398
c63b860Claude399// BLOCK P1 — Password reset (forgot-password + reset-password)
400app.route("/", passwordResetRoutes);
401
402// BLOCK P2 — Email verification (verify-email + resend)
403app.route("/", emailVerificationRoutes);
404
cd4f63bTest User405// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
406app.route("/", magicLinkRoutes);
407
79136bbClaude408// Settings routes (profile, SSH keys)
409app.route("/", settingsRoutes);
410
7298a17Claude411// 2FA / TOTP settings (Block B4)
412app.route("/", settings2faRoutes);
413
e75eddcClaude414// Agent multiplayer — /settings/agents management UI
415app.route("/", settingsAgentsRoutes);
416
1d4ff60Claude417// Chat integrations — Slack / Discord / Teams (/settings/integrations
418// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
419app.route("/", settingsIntegrationsRoutes);
420app.route("/", integrationsChatRoutes);
421
2df1f8cClaude422// WebAuthn / passkey routes (Block B5)
423app.route("/", passkeyRoutes);
424
058d752Claude425// OAuth 2.0 provider (Block B6)
426app.route("/", oauthRoutes);
427app.route("/", developerAppsRoutes);
428
6fc53bdClaude429// Theme toggle (dark/light cookie)
430app.route("/", themeRoutes);
431
432// Audit log UI
433app.route("/", auditRoutes);
434
435// Reactions API (issues, PRs, comments)
436app.route("/", reactionRoutes);
437
24cf2caClaude438// Saved replies (per-user canned comment templates)
439app.route("/", savedReplyRoutes);
440
441// Environments + deployment history UI
442app.route("/", deploymentRoutes);
443
6563f0aClaude444// Organizations + teams (Block B1)
445app.route("/", orgRoutes);
446
c81ab7aClaude447// API tokens
448app.route("/", tokenRoutes);
449
59b6fb2Claude450// Notifications
3ef4c9dClaude451app.route("/", notificationRoutes);
452
79136bbClaude453// Repo settings (description, visibility, delete)
454app.route("/", repoSettings);
455
23d1a81Claude456// Repo collaborators (add/list/remove)
457app.route("/", collaboratorRoutes);
458
04f6b7fClaude459// Team-based repo collaborators (invite a whole team)
460app.route("/", teamCollaboratorRoutes);
461
462// Collaborator invite accept flow (token-based)
463app.route("/", invitesRoutes);
464
465// Real-time SSE endpoint (topic-based live updates)
466app.route("/", liveEventsRoutes);
467
3c03977Claude468// PR live co-editing — presence + cursors + content sync via SSE.
469app.route("/", prLiveRoutes);
470
c81ab7aClaude471// Webhooks management
472app.route("/", webhookRoutes);
473
79136bbClaude474// Compare view (branch diffs)
475app.route("/", compareRoutes);
476
477// Issue tracker
478app.route("/", issueRoutes);
479
cb5a796Claude480// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
481// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
482// the `/:owner/:repo/comments/*` paths resolve before the broader PR
483// patterns kick in.
484app.route("/", commentModerationRoutes);
485
0074234Claude486// Pull requests
487app.route("/", pullRoutes);
79ed944Claude488// PR sandboxes — runnable per-PR environments. Migration 0067.
489app.route("/", prSandboxRoutes);
0074234Claude490
9b3a183Claude491// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
492app.route("/", devEnvRoutes);
493
c81ab7aClaude494// Fork
495app.route("/", forkRoutes);
496
0074234Claude497// Web file editor
498app.route("/", editorRoutes);
499
43de941Claude500// Contributors
501app.route("/", contributorRoutes);
502
699e5c7Claude503// Health liveness + metrics endpoints
2c34075Claude504app.route("/", healthRoutes);
505
f295f78Dictation App506// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
507app.route("/api/platform-status", platformStatus);
508
52ad8b1Claude509// Block L4 — Public stats counters (powers landing-page social proof)
510app.route("/", publicStatsRoutes);
511
512// Block L3 — Live /demo page + /api/v2/demo/* endpoints
513app.route("/", demoRoutes);
514
2316be6Claude515// Public /status — human-readable platform health page
516app.route("/", statusRoutes);
517
b1be050CC LABS App518// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
519// Mounted near the public status route so the two surfaces are visible
520// side-by-side; routes are gated by isSiteAdmin internally.
521app.route("/", adminStatusRoutes);
522
80bed05Claude523// /help — quickstart + API cheatsheet
524app.route("/", helpRoutes);
525
e0e4219Claude526// /docs — expanded documentation site (getting started, workflow YAML, MCP, API, agents)
527app.route("/", docsRoutes);
528
5f2e749Claude529// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
530// so the new editorial pricing layout wins the route; the legacy marketing
531// pricing remains as a safety net but is shadowed at the router.
532app.route("/", pricingRoutes);
533
e1fc7dbClaude534// /changelog — manually curated platform release history
535app.route("/", changelogRoutes);
536
b0148e9Claude537// /pricing, /features, /about — marketing surface
538app.route("/", marketingRoutes);
539
adf5e18Claude540// /developer-program — partner + marketplace revenue-share page
541app.route("/", developerProgramRoutes);
542
5618f9aClaude543// SEO: robots.txt + sitemap.xml
544app.route("/", seoRoutes);
545
05cdb85Claude546// /api/version — live build SHA + uptime; client poller uses this to
547// surface 'New version available — reload' banners on deploy.
548app.route("/", versionRoutes);
549
699e5c7Claude550// Health dashboard (per-repo health page)
551app.route("/", healthDashboardRoutes);
552
9dd96b9Test User553// Block R1 — site-admin operations console. MUST be mounted BEFORE
554// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
555// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
556app.route("/", adminOpsRoutes);
f2c00b4CC LABS App557// BLOCK W — Self-host status + bootstrap dashboard.
558app.route("/", adminSelfHostRoutes);
826eccfTest User559// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
560app.route("/", adminDiagnoseRoutes);
9dd96b9Test User561
16b325cClaude562// Insights (time-travel, dependencies, rollback)
563app.route("/", insightRoutes);
564
8d1483cClaude565// DORA metrics page (/:owner/:repo/insights/dora)
566app.route("/", doraRoutes);
567
f1ab587Claude568// Command center dashboard
569app.route("/", dashboardRoutes);
570
36b4cbdClaude571// Legal pages (terms, privacy, AUP)
572app.route("/", legalRoutes);
4b66018Claude573// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
574// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
575// /acceptable-use); these are the formal versions that the legal pages
576// internally link to each other.
577app.route("/", legalTermsRoutes);
578app.route("/", legalPrivacyRoutes);
579app.route("/", legalAcceptableUseRoutes);
580app.route("/", legalDmcaRoutes);
36b4cbdClaude581
bdbd0deClaude582// GitHub import / migration
583app.route("/", importRoutes);
14c3cc8Claude584app.route("/", importBulkRoutes);
f390cfaCC LABS App585app.route("/", importSecretsRoutes);
14c3cc8Claude586app.route("/", migrationRoutes);
587
588// Spec-to-PR (experimental AI-generated draft PRs)
589app.route("/", specsRoutes);
23d0abfClaude590app.route("/", refactorRoutes);
bdbd0deClaude591
c81ab7aClaude592// Explore page
593app.route("/", exploreRoutes);
594
59b6fb2Claude595// Onboarding
596app.route("/", onboardingRoutes);
597
0316dbbClaude598// Admin + feature routes
599app.route("/", adminRoutes);
509c376Claude600app.route("/", adminIntegrationsRoutes);
79ed944Claude601app.route("/", adminAdvancementRoutes);
f764c07Claude602app.route("/", adminDeploysRoutes);
603app.route("/", adminDeploysPageRoutes);
783dd46Claude604app.route("/", adminServerTargetsRoutes);
9aaa128Claude605app.route("/", deployTargetsRoutes);
90c7531Claude606app.route("/", claudeWebRoutes);
9dd96b9Test User607// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude608app.route("/", advisoriesRoutes);
609app.route("/", aiChangelogRoutes);
610app.route("/", aiExplainRoutes);
611app.route("/", aiTestsRoutes);
612app.route("/", askRoutes);
38d31d3Claude613app.route("/", repoChatRoutes);
ee7e577Claude614// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
615// repoChatRoutes so the two surfaces share the catch-all priority.
616app.route("/", personalChatRoutes);
0316dbbClaude617app.route("/", billingRoutes);
8809b87Claude618app.route("/", billingUsageRoutes);
6778ad2Claude619app.route("/", stripeWebhookRoutes);
0316dbbClaude620app.route("/", codeScanningRoutes);
621app.route("/", commitStatusesRoutes);
622app.route("/", copilotRoutes);
623app.route("/", depUpdaterRoutes);
624app.route("/", depsRoutes);
625app.route("/", discussionsRoutes);
626app.route("/", environmentsRoutes);
4bbacbeClaude627app.route("/", previewsRoutes);
79ed944Claude628app.route("/", docsTrackingRoutes);
0316dbbClaude629app.route("/", followsRoutes);
630app.route("/", gatesRoutes);
631app.route("/", gistsRoutes);
632app.route("/", graphqlRoutes);
2c2163eClaude633app.route("/", mcpRoutes);
0316dbbClaude634app.route("/", marketplaceRoutes);
5ca514aClaude635app.route("/", marketplaceAgentsRoutes);
0316dbbClaude636app.route("/", mergeQueueRoutes);
637app.route("/", mirrorsRoutes);
638app.route("/", orgInsightsRoutes);
639app.route("/", packagesRoutes);
640app.route("/", packagesApiRoutes);
641app.route("/", pagesRoutes);
642app.route("/", projectsRoutes);
643app.route("/", protectedTagsRoutes);
644app.route("/", pwaRoutes);
46d6165Claude645app.route("/", installRoutes);
cd4f63bTest User646// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
647app.route("/", dxtRoutes);
662ce86Claude648// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
649// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
650app.route("/", connectClaudeRoutes);
f5b9ef5Claude651// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
652app.route("/", claudeIntegration);
653// Connect guide — public onboarding page (/connect/claude-guide).
654app.route("/", connectRoutes);
05ab9b1Claude655// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
656app.route("/", pushWatchRoutes);
657// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
658app.route("/", orgSecretsRoutes);
a2b3e99Claude659// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
660app.route("/", crossRepoSearchRoutes);
661// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
662app.route("/", pushNotifRoutes);
9fbe6cdClaude663// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
664app.route("/", velocityRoutes);
665// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
666app.route("/", staleBranchRoutes);
22f43f3Claude667// Repository Pulse — BLOCK M12 — /:owner/:repo/pulse
668app.route("/", pulseRoutes);
74d8c4dClaude669// Repository Health Score — BLOCK M14 — /:owner/:repo/insights/health
670app.route("/", healthScoreRoutes);
671// Hot Files Heatmap — BLOCK M16 — /:owner/:repo/insights/hotfiles
672app.route("/", hotFilesRoutes);
ebbb527Claude673// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
674// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
675app.route("/", claudeDeployRoutes);
0316dbbClaude676app.route("/", releasesRoutes);
677app.route("/", requiredChecksRoutes);
678app.route("/", rulesetsRoutes);
679app.route("/", searchRoutes);
680app.route("/", semanticSearchRoutes);
681app.route("/", signingKeysRoutes);
682app.route("/", sponsorsRoutes);
683app.route("/", ssoRoutes);
46d6165Claude684app.route("/", githubOauthRoutes);
582cdacClaude685app.route("/", googleOauthRoutes);
0316dbbClaude686app.route("/", symbolsRoutes);
687app.route("/", templatesRoutes);
688app.route("/", trafficRoutes);
689app.route("/", wikisRoutes);
690app.route("/", workflowsRoutes);
5ff9cc2Claude691app.route("/", workflowArtifactsRoutes);
692app.route("/", workflowSecretsRoutes);
46d6165Claude693app.route("/", sleepModeRoutes);
52ad8b1Claude694app.route("/", vsGithubRoutes);
0316dbbClaude695
45f3b73Claude696// Voice-to-PR — phone-first dictation → spec or issue
697app.route("/", voiceRoutes);
698
cd4f63bTest User699// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
700// before the web catch-all so the bare `/play` literal wins over the
701// `/:owner` user-profile route.
702app.route("/", playgroundRoutes);
703
891efbeClaude704// Shareable AI hours-saved OG image card + landing page.
705// /share/hours-saved?user=:username → 1200×630 SVG (og:image)
706// /share/:username → HTML page with og:image meta + Twitter share
707// Mounted BEFORE webRoutes so /share/* doesn't fall through to the /:owner profile route.
708app.route("/", shareRoutes);
709
79136bbClaude710// Web UI (catch-all, must be last)
711app.route("/", webRoutes);
712
c63b860Claude713// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
714// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude715app.notFound((c) => {
36cc17aClaude716 const user = c.get("user") ?? null;
79136bbClaude717 return c.html(
c63b860Claude718 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude719 404
720 );
721});
722
c63b860Claude723// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
724// view. Trace block only shown outside production.
79136bbClaude725app.onError((err, c) => {
80bed05Claude726 reportError(err, {
727 requestId: c.get("requestId"),
728 path: c.req.path,
729 method: c.req.method,
730 });
c63b860Claude731 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
732 // back to the context value set by request-context middleware.
733 const requestId =
734 c.req.header("x-request-id") ||
735 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude736 const user = c.get("user") ?? null;
c63b860Claude737 const trace =
738 process.env.NODE_ENV !== "production" && err && err.message
739 ? err.message
740 : undefined;
79136bbClaude741 return c.html(
c63b860Claude742 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude743 500
744 );
745});
746
747export default app;