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.tsxBlame936 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";
cc34156Claude19import digestRoutes from "./routes/digest";
e9aa4d8Claude20import activityRoutes from "./routes/activity";
79136bbClaude21import authRoutes from "./routes/auth";
c63b860Claude22import passwordResetRoutes from "./routes/password-reset";
23import emailVerificationRoutes from "./routes/email-verification";
cd4f63bTest User24import magicLinkRoutes from "./routes/magic-link";
79136bbClaude25import settingsRoutes from "./routes/settings";
7298a17Claude26import settings2faRoutes from "./routes/settings-2fa";
e75eddcClaude27import settingsAgentsRoutes from "./routes/settings-agents";
1d4ff60Claude28import settingsIntegrationsRoutes from "./routes/settings-integrations";
29import integrationsChatRoutes from "./routes/integrations-chat";
e75eddcClaude30import agentsRoutes from "./routes/agents";
ef3fd93Claude31import agentPipelinesRoutes from "./routes/agent-pipelines";
79136bbClaude32import issueRoutes from "./routes/issues";
85c4e13Claude33import milestonesRoutes from "./routes/milestones";
f928118Claude34import shipAgentRoutes from "./routes/ship-agent";
cb5a796Claude35import commentModerationRoutes from "./routes/comment-moderation";
79136bbClaude36import repoSettings from "./routes/repo-settings";
479dcd9Claude37import automationSettingsRoutes from "./routes/automation-settings";
23d1a81Claude38import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude39import teamCollaboratorRoutes from "./routes/team-collaborators";
40import invitesRoutes from "./routes/invites";
41import liveEventsRoutes from "./routes/live-events";
3c03977Claude42import prLiveRoutes from "./routes/pr-live";
79136bbClaude43import compareRoutes from "./routes/compare";
0074234Claude44import pullRoutes from "./routes/pulls";
79ed944Claude45import prSandboxRoutes from "./routes/pr-sandbox";
9b3a183Claude46import devEnvRoutes from "./routes/dev-env";
0074234Claude47import editorRoutes from "./routes/editor";
6f2809fClaude48import aiEditorRoutes from "./routes/ai-editor";
c81ab7aClaude49import forkRoutes from "./routes/fork";
50import webhookRoutes from "./routes/webhooks";
51import exploreRoutes from "./routes/explore";
52import tokenRoutes from "./routes/tokens";
43de941Claude53import contributorRoutes from "./routes/contributors";
699e5c7Claude54import healthRoutes from "./routes/health-probe";
55import healthDashboardRoutes from "./routes/health";
2316be6Claude56import statusRoutes from "./routes/status";
b1be050CC LABS App57import adminStatusRoutes from "./routes/admin-status";
80bed05Claude58import helpRoutes from "./routes/help";
e1fc7dbClaude59import changelogRoutes from "./routes/changelog";
e0e4219Claude60import docsRoutes from "./routes/docs";
b0148e9Claude61import marketingRoutes from "./routes/marketing";
5f2e749Claude62import pricingRoutes from "./routes/pricing";
9f29b65Claude63import enterpriseRoutes from "./routes/enterprise";
5618f9aClaude64import seoRoutes from "./routes/seo";
05cdb85Claude65import versionRoutes from "./routes/version";
f295f78Dictation App66import { platformStatus } from "./routes/platform-status";
52ad8b1Claude67import publicStatsRoutes from "./routes/public-stats";
68import demoRoutes from "./routes/demo";
16b325cClaude69import insightRoutes from "./routes/insights";
8286942Claude70import engineeringInsightsRoutes from "./routes/engineering-insights";
8d1483cClaude71import doraRoutes from "./routes/dora";
f1ab587Claude72import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude73import legalRoutes from "./routes/legal";
4b66018Claude74import legalDmcaRoutes from "./routes/legal/dmca";
75import legalTermsRoutes from "./routes/legal/terms";
76import legalPrivacyRoutes from "./routes/legal/privacy";
77import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude78import importRoutes from "./routes/import";
14c3cc8Claude79import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App80import importSecretsRoutes from "./routes/import-secrets";
bb2dea9Claude81import actionsImporterRoutes from "./routes/actions-importer";
14c3cc8Claude82import migrationRoutes from "./routes/migrations";
ba23fe2Claude83import migrationAssistantRoutes from "./routes/migration-assistant";
9a8b8deClaude84import migrateRoutes from "./routes/migrate";
14c3cc8Claude85import specsRoutes from "./routes/specs";
23d0abfClaude86import refactorRoutes from "./routes/refactors";
b665cacClaude87import codebaseMigratorRoutes from "./routes/codebase-migrator";
79136bbClaude88import webRoutes from "./routes/web";
0316dbbClaude89import hookRoutes from "./routes/hooks";
90import eventsRoutes from "./routes/events";
91import passkeyRoutes from "./routes/passkeys";
92import oauthRoutes from "./routes/oauth";
93import developerAppsRoutes from "./routes/developer-apps";
94import themeRoutes from "./routes/theme";
95import auditRoutes from "./routes/audit";
96import reactionRoutes from "./routes/reactions";
97import savedReplyRoutes from "./routes/saved-replies";
98import deploymentRoutes from "./routes/deployments";
2c61840Claude99import pipelineRoutes from "./routes/pipeline";
0316dbbClaude100import orgRoutes from "./routes/orgs";
101import notificationRoutes from "./routes/notifications";
102import onboardingRoutes from "./routes/onboarding";
103import adminRoutes from "./routes/admin";
7293c67Claude104import adminDeletionsRoutes from "./routes/admin-deletions";
105import adminStripeRoutes from "./routes/admin-stripe";
f764c07Claude106import adminDeploysRoutes from "./routes/admin-deploys";
107import adminDeploysPageRoutes from "./routes/admin-deploys-page";
783dd46Claude108import adminServerTargetsRoutes from "./routes/admin-server-targets";
9aaa128Claude109import deployTargetsRoutes from "./routes/deploy-targets";
90c7531Claude110import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User111import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App112import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User113import adminDiagnoseRoutes from "./routes/admin-diagnose";
f9814d2Claude114import adminCommandRoutes from "./routes/admin-command";
509c376Claude115import adminIntegrationsRoutes from "./routes/admin-integrations";
bc519aeClaude116import adminEnvHealthRoutes from "./routes/admin-env-health";
79ed944Claude117import adminAdvancementRoutes from "./routes/admin-advancement";
ba9e143Claude118import adminSecurityRoutes from "./routes/admin-security";
119import settingsSessionsRoutes from "./routes/settings-sessions";
0316dbbClaude120import advisoriesRoutes from "./routes/advisories";
121import aiChangelogRoutes from "./routes/ai-changelog";
0a69faaClaude122import explainRoutes from "./routes/explain";
0316dbbClaude123import aiExplainRoutes from "./routes/ai-explain";
2be65d0Claude124import archaeologyRoutes from "./routes/ai-archaeology";
0316dbbClaude125import aiTestsRoutes from "./routes/ai-tests";
126import askRoutes from "./routes/ask";
38d31d3Claude127import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude128import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude129import billingRoutes from "./routes/billing";
8809b87Claude130import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude131import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude132import codeScanningRoutes from "./routes/code-scanning";
da3fc18Claude133import securityRoutes from "./routes/security";
0316dbbClaude134import commitStatusesRoutes from "./routes/commit-statuses";
135import copilotRoutes from "./routes/copilot";
f5d020fClaude136import { pairProgrammerRoutes } from "./routes/pair-programmer";
0316dbbClaude137import depUpdaterRoutes from "./routes/dep-updater";
138import depsRoutes from "./routes/deps";
139import discussionsRoutes from "./routes/discussions";
140import environmentsRoutes from "./routes/environments";
4bbacbeClaude141import previewsRoutes from "./routes/previews";
79ed944Claude142import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude143import followsRoutes from "./routes/follows";
144import gatesRoutes from "./routes/gates";
145import gistsRoutes from "./routes/gists";
146import graphqlRoutes from "./routes/graphql";
2c2163eClaude147import mcpRoutes from "./routes/mcp";
0316dbbClaude148import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude149import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude150import mergeQueueRoutes from "./routes/merge-queue";
151import mirrorsRoutes from "./routes/mirrors";
152import orgInsightsRoutes from "./routes/org-insights";
2be65d0Claude153import orgHealthRoutes from "./routes/org-health";
0316dbbClaude154import packagesRoutes from "./routes/packages";
155import packagesApiRoutes from "./routes/packages-api";
845fd8aClaude156import ociRegistryRoutes from "./routes/oci-registry";
0316dbbClaude157import pagesRoutes from "./routes/pages";
158import projectsRoutes from "./routes/projects";
159import protectedTagsRoutes from "./routes/protected-tags";
160import pwaRoutes from "./routes/pwa";
46d6165Claude161import installRoutes from "./routes/install";
cd4f63bTest User162import dxtRoutes from "./routes/dxt";
662ce86Claude163import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude164import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude165import claudeIntegration from "./routes/claude-integration";
166import connectRoutes from "./routes/connect";
05ab9b1Claude167import pushWatchRoutes from "./routes/push-watch";
168import orgSecretsRoutes from "./routes/org-secrets";
0316dbbClaude169import releasesRoutes from "./routes/releases";
170import requiredChecksRoutes from "./routes/required-checks";
171import rulesetsRoutes from "./routes/rulesets";
172import searchRoutes from "./routes/search";
173import semanticSearchRoutes from "./routes/semantic-search";
77cf834Claude174import nlSearchRoutes from "./routes/nl-search";
0316dbbClaude175import signingKeysRoutes from "./routes/signing-keys";
176import sponsorsRoutes from "./routes/sponsors";
177import ssoRoutes from "./routes/sso";
3a845e4Claude178import samlSsoRoutes from "./routes/saml-sso";
179import scimRoutes from "./routes/scim";
180import orgSsoSettingsRoutes from "./routes/org-sso-settings";
46d6165Claude181import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude182import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude183import symbolsRoutes from "./routes/symbols";
184import templatesRoutes from "./routes/templates";
185import trafficRoutes from "./routes/traffic";
186import wikisRoutes from "./routes/wikis";
187import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude188import workflowArtifactsRoutes from "./routes/workflow-artifacts";
189import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude190import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude191import standupRoutes from "./routes/standups";
52ad8b1Claude192import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude193import voiceRoutes from "./routes/voice-to-pr";
3122762Claude194import blogRoutes from "./routes/blog";
cd4f63bTest User195import playgroundRoutes from "./routes/playground";
a2b3e99Claude196import crossRepoSearchRoutes from "./routes/cross-repo-search";
197import pushNotifRoutes from "./routes/push-notifications";
9fbe6cdClaude198import velocityRoutes from "./routes/velocity";
199import { staleBranchRoutes } from "./routes/stale-branches";
22f43f3Claude200import pulseRoutes from "./routes/pulse";
74d8c4dClaude201import healthScoreRoutes from "./routes/health-score";
77cf834Claude202import repoHealthRoutes from "./routes/repo-health";
74d8c4dClaude203import hotFilesRoutes from "./routes/hot-files";
bcc4020Claude204import debtMapRoutes from "./routes/debt-map";
1d6db4dClaude205import busFactorRoutes from "./routes/bus-factor";
2be65d0Claude206import testGapsRoutes from "./routes/test-gaps";
f5d020fClaude207import crossRepoImpactRoutes from "./routes/cross-repo-impact";
adf5e18Claude208import developerProgramRoutes from "./routes/developer-program";
891efbeClaude209import shareRoutes from "./routes/share";
70e3293Claude210import incidentHookRoutes from "./routes/incident-hooks";
77cf834Claude211import workspaceRoutes from "./routes/ai-workspace";
2c61840Claude212import workspaceHubRoutes from "./routes/workspace-hub";
59b6fb2Claude213import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
214import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude215import { noCache } from "./middleware/no-cache";
79136bbClaude216
2316901Claude217import type { AuthEnv } from "./middleware/auth";
bf19c50Test User218import { softAuth } from "./middleware/auth";
2316901Claude219
220const app = new Hono<AuthEnv>();
79136bbClaude221
3ef4c9dClaude222// Request context (request ID, start time) runs before everything else
223app.use("*", requestContext);
05b973eClaude224// Middleware — compression first (wraps all responses)
225app.use("*", compress());
f1ffd50Claude226
227// ETag middleware — returns 304 Not Modified on unchanged responses.
228// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
229// SSE + the API surface where it would interfere with streaming.
230app.use("*", async (c, next) => {
231 const p = c.req.path;
232 if (
233 p.includes(".git/") ||
234 p.startsWith("/live-events") ||
235 p.startsWith("/api/events/deploy") ||
3c03977Claude236 p.startsWith("/admin/status") ||
237 // PR live co-editing SSE stream — never etag streaming responses.
238 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude239 ) {
240 return next();
241 }
242 return etag()(c, next);
243});
244
245// Cache-Control middleware — sets sensible defaults on public, anonymous
9ecf5a4Claude246// requests. Vapron (when wired as our edge layer) and downstream
f1ffd50Claude247// browsers will honor these. Auth'd users get private,no-store
248// automatically — we never cache responses tied to a session.
249app.use("*", async (c, next) => {
250 await next();
251 // Don't overwrite explicit headers set by route handlers — BUT the
252 // ETag middleware unconditionally sets "private, no-cache, must-
253 // revalidate" so we have to treat that specific value as "no
254 // policy chosen yet" and apply ours. Any route that explicitly set
255 // a different cache-control wins.
256 const existing = c.res.headers.get("cache-control");
257 const etagDefault =
258 existing === "private, no-cache, must-revalidate" ||
259 existing === "no-cache";
260 if (existing && !etagDefault) return;
261 // Anything past auth: private + no-store (avoid leaking session
262 // content into shared caches). softAuth runs before this on the
263 // request, but the response side is what we're stamping.
264 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
265 const p = c.req.path;
266 // Always private for known-authed paths regardless of cookie.
267 if (
268 p.startsWith("/admin") ||
269 p.startsWith("/settings") ||
270 p.startsWith("/dashboard") ||
271 p.startsWith("/notifications") ||
272 p.startsWith("/connect/") ||
273 hasSession
274 ) {
275 c.res.headers.set("cache-control", "private, no-store");
276 return;
277 }
278 // Public marketing surfaces — short edge cache, longer browser cache,
279 // stale-while-revalidate so the user never waits on a stale fetch.
280 const isMarketing =
281 p === "/" ||
282 p === "/features" ||
283 p === "/pricing" ||
284 p === "/about" ||
285 p === "/vs-github" ||
286 p === "/explore" ||
287 p === "/help" ||
288 p === "/changelog" ||
9f29b65Claude289 p === "/enterprise" ||
f1ffd50Claude290 p.startsWith("/legal/") ||
291 p === "/terms" ||
292 p === "/privacy" ||
293 p === "/acceptable-use" ||
294 p.startsWith("/docs/");
295 if (isMarketing) {
296 c.res.headers.set(
297 "cache-control",
298 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
299 );
300 return;
301 }
302 // Public repo browse pages — cache aggressively. Edge invalidates
9ecf5a4Claude303 // on push via the post-receive hook (future Vapron surge purge).
f1ffd50Claude304 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
305 c.res.headers.set(
306 "cache-control",
307 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
308 );
309 return;
310 }
311 // Default: don't cache anything we haven't explicitly opted in.
312 c.res.headers.set("cache-control", "private, no-store");
313});
05b973eClaude314// Logger only on non-git routes to avoid overhead on clone/push
315app.use("*", async (c, next) => {
316 if (c.req.path.includes(".git/")) return next();
317 return logger()(c, next);
318});
79136bbClaude319app.use("/api/*", cors());
bf19c50Test User320// Global softAuth — populates c.get("user") for every downstream middleware
321// + route. This was previously per-route, which meant rate-limit middleware
322// (and anything else inspecting auth state) always saw a null user. Keep
323// individual routes free to add requireAuth on top for hard gating; this
324// just establishes the user object cheaply.
325app.use("*", softAuth);
290ea77Claude326
36cc17aClaude327// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude328// pre-redesign markup. JSON / static assets keep their own cache rules; only
329// text/html responses get the no-cache stamp. Without this, every push to
330// main left users staring at cached 80s-looking pages from before the design
331// landed.
36cc17aClaude332//
333// We deliberately use `private, no-cache, must-revalidate` rather than
334// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
335// which makes every Back/Forward press a cold server round-trip — that
336// contributed to the "every nav feels like a fresh login" UX complaint.
337// `no-cache` still revalidates on direct fetch but lets bfcache hold the
338// page in memory between navigations.
290ea77Claude339app.use("*", async (c, next) => {
340 await next();
341 const ct = c.res.headers.get("content-type") || "";
342 if (ct.startsWith("text/html")) {
36cc17aClaude343 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude344 }
345});
826eccfTest User346// Rate-limit API + auth endpoints.
347//
a41e675Test User348// `/api/*`: 1000/min per IP — generous so an admin clicking around the
349// operator console (or a CDN/proxy concentrating multiple users behind one
350// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
351// rate limits below, not this one.
352//
353// `authedMultiplier` is set but only fires when an upstream middleware has
354// already populated c.get("user") — most app.use() chains apply softAuth
355// per-route, so the multiplier is best-effort. Keep the anonymous base
356// high enough that humans never feel it.
357//
358// Skip-paths: dashboard plumbing endpoints that the layout polls on a
359// fixed cadence and that we don't want consuming any bucket:
360// /api/version — layout polls every 15s
826eccfTest User361// /api/notifications/count — nav bell unread-count fetcher
362// /pwa/vapid-public-key — fetched once per push-notification opt-in
363app.use(
364 "/api/*",
a41e675Test User365 rateLimit(1000, 60_000, "api", {
826eccfTest User366 authedMultiplier: 4,
367 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
368 })
369);
0316dbbClaude370app.use("/login", rateLimit(20, 60_000, "login"));
371app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude372// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
373app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User374// BLOCK Q2 — throttle magic-link sign-in for the same reason.
375app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude376
59b6fb2Claude377// CSRF protection — set token on all requests, validate on mutations
378app.use("*", csrfToken);
379app.use("*", csrfProtect);
380
45e31d0Claude381// Rate limit auth routes
382app.use("/login", authRateLimit);
383app.use("/register", authRateLimit);
384
59b6fb2Claude385// Rate limit git operations
386app.use("/:owner/:repo.git/*", gitRateLimit);
387
388// Rate limit search
389app.use("/:owner/:repo/search", searchRateLimit);
390app.use("/explore", searchRateLimit);
79136bbClaude391
f5b9ef5Claude392// No-cache for HTML — ensures browsers and proxies never serve stale pages.
393// The middleware only stamps text/html responses so static assets keep
394// their own cache policies unchanged.
395app.use("*", noCache);
396
79136bbClaude397// Git Smart HTTP protocol routes (must be before web routes)
398app.route("/", gitRoutes);
399
45e31d0Claude400// REST API v1 (legacy)
79136bbClaude401app.route("/", apiRoutes);
402
52ad8b1Claude403// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
404// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
405// router's catch-shape, and BEFORE adminRoutes so the live /demo page
406// wins over the legacy /demo redirect in src/routes/admin.tsx.
407app.route("/", demoRoutes);
408
0316dbbClaude409// REST API v2 (basePath /api/v2)
410app.route("/", apiV2Routes);
411
e75eddcClaude412// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
413// Mounted alongside apiV2Routes (its own basePath, no path conflict).
414app.route("/", agentsRoutes);
415
ef3fd93Claude416// Multi-agent pipeline UI — /:owner/:repo/agents (list, new, live view).
417// Must be before webRoutes (the catch-all) so the /agents sub-paths are
418// resolved before the generic tree/blob route takes over.
419app.route("/", agentPipelinesRoutes);
420
ad6d4adClaude421// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
422app.route("/", hookRoutes);
21f8dbdClaude423app.route("/api/events", eventsRoutes);
ad6d4adClaude424
45e31d0Claude425// API documentation
426app.route("/", apiDocsRoutes);
4a80519Claude427app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude428// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
429app.route("/", pullsDashboardRoutes);
e9aa4d8Claude430// Issue command center — global issue dashboard with AI-triage + autopilot signal
431app.route("/", issuesDashboardRoutes);
432// Personal activity timeline — every event across the user's repos, with
433// AI-driven events surfaced separately (the Gluecron differentiator).
434app.route("/", activityRoutes);
435// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
436app.route("/", inboxRoutes);
56801e1Claude437// AI standup feed — daily / weekly Claude-generated team brief
438app.route("/", standupRoutes);
cc34156Claude439// Smart morning digest — AI-curated daily developer queue (/digest)
440app.route("/", digestRoutes);
79136bbClaude441
442// Auth routes (register, login, logout)
443app.route("/", authRoutes);
444
c63b860Claude445// BLOCK P1 — Password reset (forgot-password + reset-password)
446app.route("/", passwordResetRoutes);
447
448// BLOCK P2 — Email verification (verify-email + resend)
449app.route("/", emailVerificationRoutes);
450
cd4f63bTest User451// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
452app.route("/", magicLinkRoutes);
453
79136bbClaude454// Settings routes (profile, SSH keys)
455app.route("/", settingsRoutes);
456
ba9e143Claude457// Session management (SOC 2 CC6.1 — /settings/sessions)
458app.route("/", settingsSessionsRoutes);
459
7298a17Claude460// 2FA / TOTP settings (Block B4)
461app.route("/", settings2faRoutes);
462
e75eddcClaude463// Agent multiplayer — /settings/agents management UI
464app.route("/", settingsAgentsRoutes);
465
1d4ff60Claude466// Chat integrations — Slack / Discord / Teams (/settings/integrations
467// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
468app.route("/", settingsIntegrationsRoutes);
469app.route("/", integrationsChatRoutes);
470
2df1f8cClaude471// WebAuthn / passkey routes (Block B5)
472app.route("/", passkeyRoutes);
473
058d752Claude474// OAuth 2.0 provider (Block B6)
475app.route("/", oauthRoutes);
476app.route("/", developerAppsRoutes);
477
6fc53bdClaude478// Theme toggle (dark/light cookie)
479app.route("/", themeRoutes);
480
481// Audit log UI
482app.route("/", auditRoutes);
483
484// Reactions API (issues, PRs, comments)
485app.route("/", reactionRoutes);
486
24cf2caClaude487// Saved replies (per-user canned comment templates)
488app.route("/", savedReplyRoutes);
489
490// Environments + deployment history UI
491app.route("/", deploymentRoutes);
2c61840Claude492// Unified CI/CD pipeline timeline
493app.route("/", pipelineRoutes);
24cf2caClaude494
6563f0aClaude495// Organizations + teams (Block B1)
496app.route("/", orgRoutes);
497
c81ab7aClaude498// API tokens
499app.route("/", tokenRoutes);
500
59b6fb2Claude501// Notifications
3ef4c9dClaude502app.route("/", notificationRoutes);
503
79136bbClaude504// Repo settings (description, visibility, delete)
505app.route("/", repoSettings);
479dcd9Claude506// Per-repo automation settings (off / suggest / auto) — migration 0106
507app.route("/", automationSettingsRoutes);
79136bbClaude508
23d1a81Claude509// Repo collaborators (add/list/remove)
510app.route("/", collaboratorRoutes);
511
04f6b7fClaude512// Team-based repo collaborators (invite a whole team)
513app.route("/", teamCollaboratorRoutes);
514
515// Collaborator invite accept flow (token-based)
516app.route("/", invitesRoutes);
517
518// Real-time SSE endpoint (topic-based live updates)
519app.route("/", liveEventsRoutes);
520
3c03977Claude521// PR live co-editing — presence + cursors + content sync via SSE.
522app.route("/", prLiveRoutes);
523
c81ab7aClaude524// Webhooks management
525app.route("/", webhookRoutes);
526
79136bbClaude527// Compare view (branch diffs)
528app.route("/", compareRoutes);
529
530// Issue tracker
531app.route("/", issueRoutes);
532
85c4e13Claude533// Milestones — group issues + PRs toward a shared goal with due dates + progress tracking.
534// Mounted after issueRoutes so /:owner/:repo/issues/* paths win before the milestone patterns.
535app.route("/", milestonesRoutes);
536
f928118Claude537// Ship Agent — autonomous AI feature implementation
538app.route("/", shipAgentRoutes);
539
77cf834Claude540// AI Copilot Workspace — issue-to-PR autonomous agent
541app.route("/", workspaceRoutes);
2c61840Claude542app.route("/", workspaceHubRoutes);
77cf834Claude543
cb5a796Claude544// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
545// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
546// the `/:owner/:repo/comments/*` paths resolve before the broader PR
547// patterns kick in.
548app.route("/", commentModerationRoutes);
549
0074234Claude550// Pull requests
551app.route("/", pullRoutes);
09d5f39Claude552
2be65d0Claude553// Streaming PR review — SSE stream + embeddable widget
554// Mounted immediately after pullRoutes so /:owner/:repo/pulls/:number/review/*
555// resolves before the webRoutes catch-all takes over.
556import streamingReviewRoutes from "./routes/streaming-review";
557app.route("/", streamingReviewRoutes);
558
09d5f39Claude559// /stage PR preview — serve built static files from .stage-previews/{jobId}/
560// Registered immediately after pullRoutes so the path `/preview/:id/*` is
561// specific enough to never clash with repo browse routes (`/:owner/:repo/*`).
562app.get("/preview/:stageJobId/*", async (c) => {
563 const { stageJobId } = c.req.param();
564 // Validate job ID format (UUID)
565 if (!/^[0-9a-f-]{32,}$/i.test(stageJobId)) {
566 return c.text("Not found", 404);
567 }
568 const { getPreviewDir, isPreviewExpired } = await import("./lib/pr-stage");
569 if (isPreviewExpired(stageJobId)) {
570 return c.html(
571 "<html><body style='font-family:sans-serif;padding:40px;color:#888'>" +
572 "<h2>Preview expired</h2><p>This stage preview has expired (48h TTL). " +
573 "Comment <code>/stage</code> on the PR to redeploy.</p></body></html>",
574 410
575 );
576 }
577 const { join } = await import("path");
578 const previewDir = getPreviewDir(stageJobId);
579 // Extract the wildcard path after /preview/:id/
580 const rawPath = c.req.path.replace(/^\/preview\/[^/]+/, "") || "/";
581 const filePath = rawPath === "/" || rawPath === "" ? "/index.html" : rawPath;
582 const fullPath = join(previewDir, filePath);
583 const file = Bun.file(fullPath);
584 if (!(await file.exists())) {
585 // Try index.html fallback (SPA behaviour)
586 const indexFile = Bun.file(join(previewDir, "index.html"));
587 if (await indexFile.exists()) {
588 const html = await indexFile.text();
589 return c.html(html);
590 }
591 return c.text("Not found", 404);
592 }
593 const content = await file.arrayBuffer();
594 const ext = fullPath.split(".").pop()?.toLowerCase() ?? "";
595 const contentTypeMap: Record<string, string> = {
596 html: "text/html; charset=utf-8",
597 htm: "text/html; charset=utf-8",
598 css: "text/css; charset=utf-8",
599 js: "application/javascript; charset=utf-8",
600 mjs: "application/javascript; charset=utf-8",
601 json: "application/json; charset=utf-8",
602 png: "image/png",
603 jpg: "image/jpeg",
604 jpeg: "image/jpeg",
605 gif: "image/gif",
606 svg: "image/svg+xml",
607 ico: "image/x-icon",
608 webp: "image/webp",
609 woff: "font/woff",
610 woff2: "font/woff2",
611 ttf: "font/ttf",
612 txt: "text/plain; charset=utf-8",
613 xml: "application/xml",
614 webmanifest: "application/manifest+json",
615 };
616 const ct = contentTypeMap[ext] ?? "application/octet-stream";
617 return c.body(content, 200, {
618 "content-type": ct,
619 "cache-control": "public, max-age=300",
620 "x-stage-job-id": stageJobId,
621 });
622});
623
79ed944Claude624// PR sandboxes — runnable per-PR environments. Migration 0067.
625app.route("/", prSandboxRoutes);
0074234Claude626
9b3a183Claude627// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
628app.route("/", devEnvRoutes);
629
c81ab7aClaude630// Fork
631app.route("/", forkRoutes);
632
0074234Claude633// Web file editor
634app.route("/", editorRoutes);
635
6f2809fClaude636// AI editor API routes (inline suggestions, explain, fix)
637app.route("/", aiEditorRoutes);
638
43de941Claude639// Contributors
640app.route("/", contributorRoutes);
641
699e5c7Claude642// Health liveness + metrics endpoints
2c34075Claude643app.route("/", healthRoutes);
644
f295f78Dictation App645// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
646app.route("/api/platform-status", platformStatus);
647
52ad8b1Claude648// Block L4 — Public stats counters (powers landing-page social proof)
649app.route("/", publicStatsRoutes);
650
651// Block L3 — Live /demo page + /api/v2/demo/* endpoints
652app.route("/", demoRoutes);
653
2316be6Claude654// Public /status — human-readable platform health page
655app.route("/", statusRoutes);
656
b1be050CC LABS App657// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
658// Mounted near the public status route so the two surfaces are visible
659// side-by-side; routes are gated by isSiteAdmin internally.
660app.route("/", adminStatusRoutes);
661
80bed05Claude662// /help — quickstart + API cheatsheet
663app.route("/", helpRoutes);
664
e0e4219Claude665// /docs — expanded documentation site (getting started, workflow YAML, MCP, API, agents)
666app.route("/", docsRoutes);
667
5f2e749Claude668// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
669// so the new editorial pricing layout wins the route; the legacy marketing
670// pricing remains as a safety net but is shadowed at the router.
671app.route("/", pricingRoutes);
672
e1fc7dbClaude673// /changelog — manually curated platform release history
674app.route("/", changelogRoutes);
675
9f29b65Claude676// Enterprise sales page + contact form lead capture.
677app.route("/", enterpriseRoutes);
678
b0148e9Claude679// /pricing, /features, /about — marketing surface
680app.route("/", marketingRoutes);
681
adf5e18Claude682// /developer-program — partner + marketplace revenue-share page
683app.route("/", developerProgramRoutes);
684
5618f9aClaude685// SEO: robots.txt + sitemap.xml
686app.route("/", seoRoutes);
687
05cdb85Claude688// /api/version — live build SHA + uptime; client poller uses this to
689// surface 'New version available — reload' banners on deploy.
690app.route("/", versionRoutes);
691
699e5c7Claude692// Health dashboard (per-repo health page)
693app.route("/", healthDashboardRoutes);
694
9dd96b9Test User695// Block R1 — site-admin operations console. MUST be mounted BEFORE
696// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
697// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
698app.route("/", adminOpsRoutes);
f2c00b4CC LABS App699// BLOCK W — Self-host status + bootstrap dashboard.
700app.route("/", adminSelfHostRoutes);
826eccfTest User701// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
702app.route("/", adminDiagnoseRoutes);
f9814d2Claude703// Unified admin command center — /admin/command
704app.route("/", adminCommandRoutes);
9dd96b9Test User705
16b325cClaude706// Insights (time-travel, dependencies, rollback)
707app.route("/", insightRoutes);
708
8286942Claude709// Engineering Intelligence Dashboard — /insights + /:owner/:repo/insights/engineering
710app.route("/", engineeringInsightsRoutes);
711
8d1483cClaude712// DORA metrics page (/:owner/:repo/insights/dora)
713app.route("/", doraRoutes);
714
f1ab587Claude715// Command center dashboard
716app.route("/", dashboardRoutes);
717
36b4cbdClaude718// Legal pages (terms, privacy, AUP)
719app.route("/", legalRoutes);
4b66018Claude720// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
721// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
722// /acceptable-use); these are the formal versions that the legal pages
723// internally link to each other.
724app.route("/", legalTermsRoutes);
725app.route("/", legalPrivacyRoutes);
726app.route("/", legalAcceptableUseRoutes);
727app.route("/", legalDmcaRoutes);
36b4cbdClaude728
bdbd0deClaude729// GitHub import / migration
730app.route("/", importRoutes);
14c3cc8Claude731app.route("/", importBulkRoutes);
f390cfaCC LABS App732app.route("/", importSecretsRoutes);
bb2dea9Claude733// GitHub Actions → Gluecron gates.yml importer (stateless converter)
734app.route("/", actionsImporterRoutes);
14c3cc8Claude735app.route("/", migrationRoutes);
ba23fe2Claude736app.route("/", migrationAssistantRoutes);
9a8b8deClaude737// GitHub Org Migration Wizard — live progress bulk importer
738app.route("/", migrateRoutes);
14c3cc8Claude739
740// Spec-to-PR (experimental AI-generated draft PRs)
741app.route("/", specsRoutes);
23d0abfClaude742app.route("/", refactorRoutes);
b665cacClaude743app.route("/", codebaseMigratorRoutes);
bdbd0deClaude744
c81ab7aClaude745// Explore page
746app.route("/", exploreRoutes);
747
59b6fb2Claude748// Onboarding
749app.route("/", onboardingRoutes);
750
0316dbbClaude751// Admin + feature routes
752app.route("/", adminRoutes);
7293c67Claude753app.route("/", adminDeletionsRoutes);
754app.route("/", adminStripeRoutes);
ba9e143Claude755
756// SOC 2 security dashboard + readiness checklist (/admin/security, /admin/soc2)
757app.route("/", adminSecurityRoutes);
509c376Claude758app.route("/", adminIntegrationsRoutes);
bc519aeClaude759app.route("/", adminEnvHealthRoutes);
79ed944Claude760app.route("/", adminAdvancementRoutes);
f764c07Claude761app.route("/", adminDeploysRoutes);
762app.route("/", adminDeploysPageRoutes);
783dd46Claude763app.route("/", adminServerTargetsRoutes);
9aaa128Claude764app.route("/", deployTargetsRoutes);
90c7531Claude765app.route("/", claudeWebRoutes);
9dd96b9Test User766// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude767app.route("/", advisoriesRoutes);
768app.route("/", aiChangelogRoutes);
0a69faaClaude769// "Explain This Repo" — rich structured AI analysis dashboard (mounted before
770// the simpler aiExplainRoutes so the new routes win on /:owner/:repo/explain).
771app.route("/", explainRoutes);
0316dbbClaude772app.route("/", aiExplainRoutes);
2be65d0Claude773app.route("/", archaeologyRoutes);
0316dbbClaude774app.route("/", aiTestsRoutes);
775app.route("/", askRoutes);
38d31d3Claude776app.route("/", repoChatRoutes);
ee7e577Claude777// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
778// repoChatRoutes so the two surfaces share the catch-all priority.
779app.route("/", personalChatRoutes);
0316dbbClaude780app.route("/", billingRoutes);
8809b87Claude781app.route("/", billingUsageRoutes);
6778ad2Claude782app.route("/", stripeWebhookRoutes);
0316dbbClaude783app.route("/", codeScanningRoutes);
da3fc18Claude784// Dependency CVE scanner findings page — /:owner/:repo/security/vulnerabilities
785app.route("/", securityRoutes);
0316dbbClaude786app.route("/", commitStatusesRoutes);
787app.route("/", copilotRoutes);
f5d020fClaude788app.route("/", pairProgrammerRoutes);
0316dbbClaude789app.route("/", depUpdaterRoutes);
790app.route("/", depsRoutes);
791app.route("/", discussionsRoutes);
792app.route("/", environmentsRoutes);
4bbacbeClaude793app.route("/", previewsRoutes);
79ed944Claude794app.route("/", docsTrackingRoutes);
0316dbbClaude795app.route("/", followsRoutes);
796app.route("/", gatesRoutes);
797app.route("/", gistsRoutes);
798app.route("/", graphqlRoutes);
2c2163eClaude799app.route("/", mcpRoutes);
0316dbbClaude800app.route("/", marketplaceRoutes);
5ca514aClaude801app.route("/", marketplaceAgentsRoutes);
0316dbbClaude802app.route("/", mergeQueueRoutes);
803app.route("/", mirrorsRoutes);
804app.route("/", orgInsightsRoutes);
b02ce30Claude805app.route("/", orgHealthRoutes);
0316dbbClaude806app.route("/", packagesRoutes);
807app.route("/", packagesApiRoutes);
845fd8aClaude808// OCI / Docker container registry — /v2/* (OCI Distribution Spec v1.0)
809app.route("/", ociRegistryRoutes);
0316dbbClaude810app.route("/", pagesRoutes);
811app.route("/", projectsRoutes);
812app.route("/", protectedTagsRoutes);
813app.route("/", pwaRoutes);
46d6165Claude814app.route("/", installRoutes);
cd4f63bTest User815// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
816app.route("/", dxtRoutes);
662ce86Claude817// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
818// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
819app.route("/", connectClaudeRoutes);
f5b9ef5Claude820// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
821app.route("/", claudeIntegration);
822// Connect guide — public onboarding page (/connect/claude-guide).
823app.route("/", connectRoutes);
05ab9b1Claude824// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
825app.route("/", pushWatchRoutes);
826// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
827app.route("/", orgSecretsRoutes);
a2b3e99Claude828// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
829app.route("/", crossRepoSearchRoutes);
830// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
831app.route("/", pushNotifRoutes);
9fbe6cdClaude832// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
833app.route("/", velocityRoutes);
834// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
835app.route("/", staleBranchRoutes);
22f43f3Claude836// Repository Pulse — BLOCK M12 — /:owner/:repo/pulse
837app.route("/", pulseRoutes);
74d8c4dClaude838// Repository Health Score — BLOCK M14 — /:owner/:repo/insights/health
839app.route("/", healthScoreRoutes);
77cf834Claude840// Repository Health Score breakdown page — /:owner/:repo/health
841app.route("/", repoHealthRoutes);
74d8c4dClaude842// Hot Files Heatmap — BLOCK M16 — /:owner/:repo/insights/hotfiles
843app.route("/", hotFilesRoutes);
bcc4020Claude844// AI Technical Debt Map — /:owner/:repo/debt-map (visual debt graph + Claude analysis)
845app.route("/", debtMapRoutes);
1d6db4dClaude846// Bus Factor Analysis — /:owner/:repo/insights/bus-factor
847app.route("/", busFactorRoutes);
b02ce30Claude848// Test Gap Detector — /:owner/:repo/insights/test-gaps
849app.route("/", testGapsRoutes);
f5d020fClaude850// Cross-Repo Dependency Impact Detection — /:owner/:repo/pulls/:number/cross-repo-impact
851app.route("/", crossRepoImpactRoutes);
ebbb527Claude852// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
853// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
854app.route("/", claudeDeployRoutes);
0316dbbClaude855app.route("/", releasesRoutes);
856app.route("/", requiredChecksRoutes);
857app.route("/", rulesetsRoutes);
858app.route("/", searchRoutes);
859app.route("/", semanticSearchRoutes);
77cf834Claude860app.route("/", nlSearchRoutes);
0316dbbClaude861app.route("/", signingKeysRoutes);
862app.route("/", sponsorsRoutes);
863app.route("/", ssoRoutes);
3a845e4Claude864// Enterprise per-org SAML 2.0 + OIDC SSO routes
865app.route("/", samlSsoRoutes);
866// SCIM 2.0 user provisioning endpoints
867app.route("/", scimRoutes);
868// Per-org SSO + SCIM admin settings UI
869app.route("/", orgSsoSettingsRoutes);
46d6165Claude870app.route("/", githubOauthRoutes);
582cdacClaude871app.route("/", googleOauthRoutes);
0316dbbClaude872app.route("/", symbolsRoutes);
873app.route("/", templatesRoutes);
874app.route("/", trafficRoutes);
875app.route("/", wikisRoutes);
876app.route("/", workflowsRoutes);
5ff9cc2Claude877app.route("/", workflowArtifactsRoutes);
878app.route("/", workflowSecretsRoutes);
46d6165Claude879app.route("/", sleepModeRoutes);
52ad8b1Claude880app.route("/", vsGithubRoutes);
0316dbbClaude881
45f3b73Claude882// Voice-to-PR — phone-first dictation → spec or issue
883app.route("/", voiceRoutes);
884
3122762Claude885// Blog / Devlog — public posts, no DB
886app.route("/", blogRoutes);
887
cd4f63bTest User888// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
889// before the web catch-all so the bare `/play` literal wins over the
890// `/:owner` user-profile route.
891app.route("/", playgroundRoutes);
892
891efbeClaude893// Shareable AI hours-saved OG image card + landing page.
894// /share/hours-saved?user=:username → 1200×630 SVG (og:image)
895// /share/:username → HTML page with og:image meta + Twitter share
896// Mounted BEFORE webRoutes so /share/* doesn't fall through to the /:owner profile route.
897app.route("/", shareRoutes);
898
79136bbClaude899// Web UI (catch-all, must be last)
900app.route("/", webRoutes);
901
c63b860Claude902// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
903// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude904app.notFound((c) => {
36cc17aClaude905 const user = c.get("user") ?? null;
79136bbClaude906 return c.html(
c63b860Claude907 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude908 404
909 );
910});
911
c63b860Claude912// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
913// view. Trace block only shown outside production.
79136bbClaude914app.onError((err, c) => {
80bed05Claude915 reportError(err, {
916 requestId: c.get("requestId"),
917 path: c.req.path,
918 method: c.req.method,
919 });
c63b860Claude920 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
921 // back to the context value set by request-context middleware.
922 const requestId =
923 c.req.header("x-request-id") ||
924 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude925 const user = c.get("user") ?? null;
c63b860Claude926 const trace =
927 process.env.NODE_ENV !== "production" && err && err.message
928 ? err.message
929 : undefined;
79136bbClaude930 return c.html(
c63b860Claude931 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude932 500
933 );
934});
935
936export default app;