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.tsxBlame775 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";
ef3fd93Claude30import agentPipelinesRoutes from "./routes/agent-pipelines";
79136bbClaude31import issueRoutes from "./routes/issues";
cb5a796Claude32import commentModerationRoutes from "./routes/comment-moderation";
79136bbClaude33import repoSettings from "./routes/repo-settings";
23d1a81Claude34import collaboratorRoutes from "./routes/collaborators";
04f6b7fClaude35import teamCollaboratorRoutes from "./routes/team-collaborators";
36import invitesRoutes from "./routes/invites";
37import liveEventsRoutes from "./routes/live-events";
3c03977Claude38import prLiveRoutes from "./routes/pr-live";
79136bbClaude39import compareRoutes from "./routes/compare";
0074234Claude40import pullRoutes from "./routes/pulls";
79ed944Claude41import prSandboxRoutes from "./routes/pr-sandbox";
9b3a183Claude42import devEnvRoutes from "./routes/dev-env";
0074234Claude43import editorRoutes from "./routes/editor";
c81ab7aClaude44import forkRoutes from "./routes/fork";
45import webhookRoutes from "./routes/webhooks";
46import exploreRoutes from "./routes/explore";
47import tokenRoutes from "./routes/tokens";
43de941Claude48import contributorRoutes from "./routes/contributors";
699e5c7Claude49import healthRoutes from "./routes/health-probe";
50import healthDashboardRoutes from "./routes/health";
2316be6Claude51import statusRoutes from "./routes/status";
b1be050CC LABS App52import adminStatusRoutes from "./routes/admin-status";
80bed05Claude53import helpRoutes from "./routes/help";
e1fc7dbClaude54import changelogRoutes from "./routes/changelog";
e0e4219Claude55import docsRoutes from "./routes/docs";
b0148e9Claude56import marketingRoutes from "./routes/marketing";
5f2e749Claude57import pricingRoutes from "./routes/pricing";
9f29b65Claude58import enterpriseRoutes from "./routes/enterprise";
5618f9aClaude59import seoRoutes from "./routes/seo";
05cdb85Claude60import versionRoutes from "./routes/version";
f295f78Dictation App61import { platformStatus } from "./routes/platform-status";
52ad8b1Claude62import publicStatsRoutes from "./routes/public-stats";
63import demoRoutes from "./routes/demo";
16b325cClaude64import insightRoutes from "./routes/insights";
8d1483cClaude65import doraRoutes from "./routes/dora";
f1ab587Claude66import dashboardRoutes from "./routes/dashboard";
36b4cbdClaude67import legalRoutes from "./routes/legal";
4b66018Claude68import legalDmcaRoutes from "./routes/legal/dmca";
69import legalTermsRoutes from "./routes/legal/terms";
70import legalPrivacyRoutes from "./routes/legal/privacy";
71import legalAcceptableUseRoutes from "./routes/legal/acceptable-use";
bdbd0deClaude72import importRoutes from "./routes/import";
14c3cc8Claude73import importBulkRoutes from "./routes/import-bulk";
f390cfaCC LABS App74import importSecretsRoutes from "./routes/import-secrets";
bb2dea9Claude75import actionsImporterRoutes from "./routes/actions-importer";
14c3cc8Claude76import migrationRoutes from "./routes/migrations";
9a8b8deClaude77import migrateRoutes from "./routes/migrate";
14c3cc8Claude78import specsRoutes from "./routes/specs";
23d0abfClaude79import refactorRoutes from "./routes/refactors";
79136bbClaude80import webRoutes from "./routes/web";
0316dbbClaude81import hookRoutes from "./routes/hooks";
82import eventsRoutes from "./routes/events";
83import passkeyRoutes from "./routes/passkeys";
84import oauthRoutes from "./routes/oauth";
85import developerAppsRoutes from "./routes/developer-apps";
86import themeRoutes from "./routes/theme";
87import auditRoutes from "./routes/audit";
88import reactionRoutes from "./routes/reactions";
89import savedReplyRoutes from "./routes/saved-replies";
90import deploymentRoutes from "./routes/deployments";
91import orgRoutes from "./routes/orgs";
92import notificationRoutes from "./routes/notifications";
93import onboardingRoutes from "./routes/onboarding";
94import adminRoutes from "./routes/admin";
7293c67Claude95import adminDeletionsRoutes from "./routes/admin-deletions";
96import adminStripeRoutes from "./routes/admin-stripe";
f764c07Claude97import adminDeploysRoutes from "./routes/admin-deploys";
98import adminDeploysPageRoutes from "./routes/admin-deploys-page";
783dd46Claude99import adminServerTargetsRoutes from "./routes/admin-server-targets";
9aaa128Claude100import deployTargetsRoutes from "./routes/deploy-targets";
90c7531Claude101import claudeWebRoutes from "./routes/claude-web";
9dd96b9Test User102import adminOpsRoutes from "./routes/admin-ops";
f2c00b4CC LABS App103import adminSelfHostRoutes from "./routes/admin-self-host";
826eccfTest User104import adminDiagnoseRoutes from "./routes/admin-diagnose";
509c376Claude105import adminIntegrationsRoutes from "./routes/admin-integrations";
79ed944Claude106import adminAdvancementRoutes from "./routes/admin-advancement";
0316dbbClaude107import advisoriesRoutes from "./routes/advisories";
108import aiChangelogRoutes from "./routes/ai-changelog";
109import aiExplainRoutes from "./routes/ai-explain";
110import aiTestsRoutes from "./routes/ai-tests";
111import askRoutes from "./routes/ask";
38d31d3Claude112import repoChatRoutes from "./routes/repo-chat";
ee7e577Claude113import personalChatRoutes from "./routes/personal-chat";
0316dbbClaude114import billingRoutes from "./routes/billing";
8809b87Claude115import billingUsageRoutes from "./routes/billing-usage";
6778ad2Claude116import stripeWebhookRoutes from "./routes/stripe-webhook";
0316dbbClaude117import codeScanningRoutes from "./routes/code-scanning";
118import commitStatusesRoutes from "./routes/commit-statuses";
119import copilotRoutes from "./routes/copilot";
120import depUpdaterRoutes from "./routes/dep-updater";
121import depsRoutes from "./routes/deps";
122import discussionsRoutes from "./routes/discussions";
123import environmentsRoutes from "./routes/environments";
4bbacbeClaude124import previewsRoutes from "./routes/previews";
79ed944Claude125import docsTrackingRoutes from "./routes/docs-tracking";
0316dbbClaude126import followsRoutes from "./routes/follows";
127import gatesRoutes from "./routes/gates";
128import gistsRoutes from "./routes/gists";
129import graphqlRoutes from "./routes/graphql";
2c2163eClaude130import mcpRoutes from "./routes/mcp";
0316dbbClaude131import marketplaceRoutes from "./routes/marketplace";
5ca514aClaude132import marketplaceAgentsRoutes from "./routes/marketplace-agents";
0316dbbClaude133import mergeQueueRoutes from "./routes/merge-queue";
134import mirrorsRoutes from "./routes/mirrors";
135import orgInsightsRoutes from "./routes/org-insights";
136import packagesRoutes from "./routes/packages";
137import packagesApiRoutes from "./routes/packages-api";
845fd8aClaude138import ociRegistryRoutes from "./routes/oci-registry";
0316dbbClaude139import pagesRoutes from "./routes/pages";
140import projectsRoutes from "./routes/projects";
141import protectedTagsRoutes from "./routes/protected-tags";
142import pwaRoutes from "./routes/pwa";
46d6165Claude143import installRoutes from "./routes/install";
cd4f63bTest User144import dxtRoutes from "./routes/dxt";
662ce86Claude145import connectClaudeRoutes from "./routes/connect-claude";
ebbb527Claude146import claudeDeployRoutes from "./routes/claude-deploy";
f5b9ef5Claude147import claudeIntegration from "./routes/claude-integration";
148import connectRoutes from "./routes/connect";
05ab9b1Claude149import pushWatchRoutes from "./routes/push-watch";
150import orgSecretsRoutes from "./routes/org-secrets";
0316dbbClaude151import releasesRoutes from "./routes/releases";
152import requiredChecksRoutes from "./routes/required-checks";
153import rulesetsRoutes from "./routes/rulesets";
154import searchRoutes from "./routes/search";
155import semanticSearchRoutes from "./routes/semantic-search";
156import signingKeysRoutes from "./routes/signing-keys";
157import sponsorsRoutes from "./routes/sponsors";
158import ssoRoutes from "./routes/sso";
46d6165Claude159import githubOauthRoutes from "./routes/github-oauth";
582cdacClaude160import googleOauthRoutes from "./routes/google-oauth";
0316dbbClaude161import symbolsRoutes from "./routes/symbols";
162import templatesRoutes from "./routes/templates";
163import trafficRoutes from "./routes/traffic";
164import wikisRoutes from "./routes/wikis";
165import workflowsRoutes from "./routes/workflows";
5ff9cc2Claude166import workflowArtifactsRoutes from "./routes/workflow-artifacts";
167import workflowSecretsRoutes from "./routes/workflow-secrets";
46d6165Claude168import sleepModeRoutes from "./routes/sleep-mode";
56801e1Claude169import standupRoutes from "./routes/standups";
52ad8b1Claude170import vsGithubRoutes from "./routes/vs-github";
45f3b73Claude171import voiceRoutes from "./routes/voice-to-pr";
3122762Claude172import blogRoutes from "./routes/blog";
cd4f63bTest User173import playgroundRoutes from "./routes/playground";
a2b3e99Claude174import crossRepoSearchRoutes from "./routes/cross-repo-search";
175import pushNotifRoutes from "./routes/push-notifications";
9fbe6cdClaude176import velocityRoutes from "./routes/velocity";
177import { staleBranchRoutes } from "./routes/stale-branches";
22f43f3Claude178import pulseRoutes from "./routes/pulse";
74d8c4dClaude179import healthScoreRoutes from "./routes/health-score";
180import hotFilesRoutes from "./routes/hot-files";
adf5e18Claude181import developerProgramRoutes from "./routes/developer-program";
891efbeClaude182import shareRoutes from "./routes/share";
59b6fb2Claude183import { authRateLimit, gitRateLimit, searchRateLimit } from "./middleware/rate-limit";
184import { csrfToken, csrfProtect } from "./middleware/csrf";
f5b9ef5Claude185import { noCache } from "./middleware/no-cache";
79136bbClaude186
2316901Claude187import type { AuthEnv } from "./middleware/auth";
bf19c50Test User188import { softAuth } from "./middleware/auth";
2316901Claude189
190const app = new Hono<AuthEnv>();
79136bbClaude191
3ef4c9dClaude192// Request context (request ID, start time) runs before everything else
193app.use("*", requestContext);
05b973eClaude194// Middleware — compression first (wraps all responses)
195app.use("*", compress());
f1ffd50Claude196
197// ETag middleware — returns 304 Not Modified on unchanged responses.
198// Saves ~95% bandwidth on repeat visits. Skipped on git protocol +
199// SSE + the API surface where it would interfere with streaming.
200app.use("*", async (c, next) => {
201 const p = c.req.path;
202 if (
203 p.includes(".git/") ||
204 p.startsWith("/live-events") ||
205 p.startsWith("/api/events/deploy") ||
3c03977Claude206 p.startsWith("/admin/status") ||
207 // PR live co-editing SSE stream — never etag streaming responses.
208 /^\/api\/v2\/pulls\/[^/]+\/live(\/|$)/.test(p)
f1ffd50Claude209 ) {
210 return next();
211 }
212 return etag()(c, next);
213});
214
215// Cache-Control middleware — sets sensible defaults on public, anonymous
216// requests. Crontech (when wired as our edge layer) and downstream
217// browsers will honor these. Auth'd users get private,no-store
218// automatically — we never cache responses tied to a session.
219app.use("*", async (c, next) => {
220 await next();
221 // Don't overwrite explicit headers set by route handlers — BUT the
222 // ETag middleware unconditionally sets "private, no-cache, must-
223 // revalidate" so we have to treat that specific value as "no
224 // policy chosen yet" and apply ours. Any route that explicitly set
225 // a different cache-control wins.
226 const existing = c.res.headers.get("cache-control");
227 const etagDefault =
228 existing === "private, no-cache, must-revalidate" ||
229 existing === "no-cache";
230 if (existing && !etagDefault) return;
231 // Anything past auth: private + no-store (avoid leaking session
232 // content into shared caches). softAuth runs before this on the
233 // request, but the response side is what we're stamping.
234 const hasSession = c.req.header("cookie")?.includes("session=") ?? false;
235 const p = c.req.path;
236 // Always private for known-authed paths regardless of cookie.
237 if (
238 p.startsWith("/admin") ||
239 p.startsWith("/settings") ||
240 p.startsWith("/dashboard") ||
241 p.startsWith("/notifications") ||
242 p.startsWith("/connect/") ||
243 hasSession
244 ) {
245 c.res.headers.set("cache-control", "private, no-store");
246 return;
247 }
248 // Public marketing surfaces — short edge cache, longer browser cache,
249 // stale-while-revalidate so the user never waits on a stale fetch.
250 const isMarketing =
251 p === "/" ||
252 p === "/features" ||
253 p === "/pricing" ||
254 p === "/about" ||
255 p === "/vs-github" ||
256 p === "/explore" ||
257 p === "/help" ||
258 p === "/changelog" ||
9f29b65Claude259 p === "/enterprise" ||
f1ffd50Claude260 p.startsWith("/legal/") ||
261 p === "/terms" ||
262 p === "/privacy" ||
263 p === "/acceptable-use" ||
264 p.startsWith("/docs/");
265 if (isMarketing) {
266 c.res.headers.set(
267 "cache-control",
268 "public, max-age=60, s-maxage=300, stale-while-revalidate=86400"
269 );
270 return;
271 }
272 // Public repo browse pages — cache aggressively. Edge invalidates
273 // on push via the post-receive hook (future Crontech surge purge).
274 if (/^\/[^/]+\/[^/]+(\/.*)?$/.test(p) && c.req.method === "GET") {
275 c.res.headers.set(
276 "cache-control",
277 "public, max-age=30, s-maxage=120, stale-while-revalidate=600"
278 );
279 return;
280 }
281 // Default: don't cache anything we haven't explicitly opted in.
282 c.res.headers.set("cache-control", "private, no-store");
283});
05b973eClaude284// Logger only on non-git routes to avoid overhead on clone/push
285app.use("*", async (c, next) => {
286 if (c.req.path.includes(".git/")) return next();
287 return logger()(c, next);
288});
79136bbClaude289app.use("/api/*", cors());
bf19c50Test User290// Global softAuth — populates c.get("user") for every downstream middleware
291// + route. This was previously per-route, which meant rate-limit middleware
292// (and anything else inspecting auth state) always saw a null user. Keep
293// individual routes free to add requireAuth on top for hard gating; this
294// just establishes the user object cheaply.
295app.use("*", softAuth);
290ea77Claude296
36cc17aClaude297// Force-revalidate HTML on every request — kills browser cache holding stale
290ea77Claude298// pre-redesign markup. JSON / static assets keep their own cache rules; only
299// text/html responses get the no-cache stamp. Without this, every push to
300// main left users staring at cached 80s-looking pages from before the design
301// landed.
36cc17aClaude302//
303// We deliberately use `private, no-cache, must-revalidate` rather than
304// `no-store`. `no-store` disables Safari/Chrome's back-forward cache (bfcache),
305// which makes every Back/Forward press a cold server round-trip — that
306// contributed to the "every nav feels like a fresh login" UX complaint.
307// `no-cache` still revalidates on direct fetch but lets bfcache hold the
308// page in memory between navigations.
290ea77Claude309app.use("*", async (c, next) => {
310 await next();
311 const ct = c.res.headers.get("content-type") || "";
312 if (ct.startsWith("text/html")) {
36cc17aClaude313 c.header("cache-control", "private, no-cache, must-revalidate");
290ea77Claude314 }
315});
826eccfTest User316// Rate-limit API + auth endpoints.
317//
a41e675Test User318// `/api/*`: 1000/min per IP — generous so an admin clicking around the
319// operator console (or a CDN/proxy concentrating multiple users behind one
320// IP) doesn't hit the wall. Bot-resistant headroom comes from the auth
321// rate limits below, not this one.
322//
323// `authedMultiplier` is set but only fires when an upstream middleware has
324// already populated c.get("user") — most app.use() chains apply softAuth
325// per-route, so the multiplier is best-effort. Keep the anonymous base
326// high enough that humans never feel it.
327//
328// Skip-paths: dashboard plumbing endpoints that the layout polls on a
329// fixed cadence and that we don't want consuming any bucket:
330// /api/version — layout polls every 15s
826eccfTest User331// /api/notifications/count — nav bell unread-count fetcher
332// /pwa/vapid-public-key — fetched once per push-notification opt-in
333app.use(
334 "/api/*",
a41e675Test User335 rateLimit(1000, 60_000, "api", {
826eccfTest User336 authedMultiplier: 4,
337 skipPaths: ["/api/version", "/api/notifications/count", "/pwa/vapid-public-key"],
338 })
339);
0316dbbClaude340app.use("/login", rateLimit(20, 60_000, "login"));
341app.use("/register", rateLimit(10, 60_000, "register"));
c63b860Claude342// BLOCK P1 — throttle forgot-password to deter enumeration + mail spam.
343app.use("/forgot-password", rateLimit(5, 60_000, "forgot-password"));
cd4f63bTest User344// BLOCK Q2 — throttle magic-link sign-in for the same reason.
345app.use("/login/magic", rateLimit(5, 60_000, "magic-link"));
79136bbClaude346
59b6fb2Claude347// CSRF protection — set token on all requests, validate on mutations
348app.use("*", csrfToken);
349app.use("*", csrfProtect);
350
45e31d0Claude351// Rate limit auth routes
352app.use("/login", authRateLimit);
353app.use("/register", authRateLimit);
354
59b6fb2Claude355// Rate limit git operations
356app.use("/:owner/:repo.git/*", gitRateLimit);
357
358// Rate limit search
359app.use("/:owner/:repo/search", searchRateLimit);
360app.use("/explore", searchRateLimit);
79136bbClaude361
f5b9ef5Claude362// No-cache for HTML — ensures browsers and proxies never serve stale pages.
363// The middleware only stamps text/html responses so static assets keep
364// their own cache policies unchanged.
365app.use("*", noCache);
366
79136bbClaude367// Git Smart HTTP protocol routes (must be before web routes)
368app.route("/", gitRoutes);
369
45e31d0Claude370// REST API v1 (legacy)
79136bbClaude371app.route("/", apiRoutes);
372
52ad8b1Claude373// Block L3 — /demo + /api/v2/demo/* live demo endpoints. Mounted BEFORE
374// apiV2Routes so the /api/v2/demo/* JSON endpoints win over the v2 base
375// router's catch-shape, and BEFORE adminRoutes so the live /demo page
376// wins over the legacy /demo redirect in src/routes/admin.tsx.
377app.route("/", demoRoutes);
378
0316dbbClaude379// REST API v2 (basePath /api/v2)
380app.route("/", apiV2Routes);
381
e75eddcClaude382// Agent multiplayer v1 — /api/v2/agents/* (sessions, leases, usage).
383// Mounted alongside apiV2Routes (its own basePath, no path conflict).
384app.route("/", agentsRoutes);
385
ef3fd93Claude386// Multi-agent pipeline UI — /:owner/:repo/agents (list, new, live view).
387// Must be before webRoutes (the catch-all) so the /agents sub-paths are
388// resolved before the generic tree/blob route takes over.
389app.route("/", agentPipelinesRoutes);
390
ad6d4adClaude391// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
392app.route("/", hookRoutes);
21f8dbdClaude393app.route("/api/events", eventsRoutes);
ad6d4adClaude394
45e31d0Claude395// API documentation
396app.route("/", apiDocsRoutes);
4a80519Claude397app.route("/", buildAgentSpecRoutes);
a6ff0f2Claude398// PR command center — global PR dashboard with AI/GateTest/auto-merge signal
399app.route("/", pullsDashboardRoutes);
e9aa4d8Claude400// Issue command center — global issue dashboard with AI-triage + autopilot signal
401app.route("/", issuesDashboardRoutes);
402// Personal activity timeline — every event across the user's repos, with
403// AI-driven events surfaced separately (the Gluecron differentiator).
404app.route("/", activityRoutes);
405// Unified inbox — mentions + review requests + CI failures + AI events in one timeline
406app.route("/", inboxRoutes);
56801e1Claude407// AI standup feed — daily / weekly Claude-generated team brief
408app.route("/", standupRoutes);
79136bbClaude409
410// Auth routes (register, login, logout)
411app.route("/", authRoutes);
412
c63b860Claude413// BLOCK P1 — Password reset (forgot-password + reset-password)
414app.route("/", passwordResetRoutes);
415
416// BLOCK P2 — Email verification (verify-email + resend)
417app.route("/", emailVerificationRoutes);
418
cd4f63bTest User419// BLOCK Q2 — Magic-link sign-in (/login/magic + callback)
420app.route("/", magicLinkRoutes);
421
79136bbClaude422// Settings routes (profile, SSH keys)
423app.route("/", settingsRoutes);
424
7298a17Claude425// 2FA / TOTP settings (Block B4)
426app.route("/", settings2faRoutes);
427
e75eddcClaude428// Agent multiplayer — /settings/agents management UI
429app.route("/", settingsAgentsRoutes);
430
1d4ff60Claude431// Chat integrations — Slack / Discord / Teams (/settings/integrations
432// + /api/v2/integrations/{slack,discord}/*). See src/lib/chat-bot.ts.
433app.route("/", settingsIntegrationsRoutes);
434app.route("/", integrationsChatRoutes);
435
2df1f8cClaude436// WebAuthn / passkey routes (Block B5)
437app.route("/", passkeyRoutes);
438
058d752Claude439// OAuth 2.0 provider (Block B6)
440app.route("/", oauthRoutes);
441app.route("/", developerAppsRoutes);
442
6fc53bdClaude443// Theme toggle (dark/light cookie)
444app.route("/", themeRoutes);
445
446// Audit log UI
447app.route("/", auditRoutes);
448
449// Reactions API (issues, PRs, comments)
450app.route("/", reactionRoutes);
451
24cf2caClaude452// Saved replies (per-user canned comment templates)
453app.route("/", savedReplyRoutes);
454
455// Environments + deployment history UI
456app.route("/", deploymentRoutes);
457
6563f0aClaude458// Organizations + teams (Block B1)
459app.route("/", orgRoutes);
460
c81ab7aClaude461// API tokens
462app.route("/", tokenRoutes);
463
59b6fb2Claude464// Notifications
3ef4c9dClaude465app.route("/", notificationRoutes);
466
79136bbClaude467// Repo settings (description, visibility, delete)
468app.route("/", repoSettings);
469
23d1a81Claude470// Repo collaborators (add/list/remove)
471app.route("/", collaboratorRoutes);
472
04f6b7fClaude473// Team-based repo collaborators (invite a whole team)
474app.route("/", teamCollaboratorRoutes);
475
476// Collaborator invite accept flow (token-based)
477app.route("/", invitesRoutes);
478
479// Real-time SSE endpoint (topic-based live updates)
480app.route("/", liveEventsRoutes);
481
3c03977Claude482// PR live co-editing — presence + cursors + content sync via SSE.
483app.route("/", prLiveRoutes);
484
c81ab7aClaude485// Webhooks management
486app.route("/", webhookRoutes);
487
79136bbClaude488// Compare view (branch diffs)
489app.route("/", compareRoutes);
490
491// Issue tracker
492app.route("/", issueRoutes);
493
cb5a796Claude494// Comment moderation queue — owner-only `/:owner/:repo/comments/pending`
495// + per-row approve/reject/spam actions. Mounted before `pullRoutes` so
496// the `/:owner/:repo/comments/*` paths resolve before the broader PR
497// patterns kick in.
498app.route("/", commentModerationRoutes);
499
0074234Claude500// Pull requests
501app.route("/", pullRoutes);
79ed944Claude502// PR sandboxes — runnable per-PR environments. Migration 0067.
503app.route("/", prSandboxRoutes);
0074234Claude504
9b3a183Claude505// Cloud dev environments — hosted VS Code in the browser. Migration 0072.
506app.route("/", devEnvRoutes);
507
c81ab7aClaude508// Fork
509app.route("/", forkRoutes);
510
0074234Claude511// Web file editor
512app.route("/", editorRoutes);
513
43de941Claude514// Contributors
515app.route("/", contributorRoutes);
516
699e5c7Claude517// Health liveness + metrics endpoints
2c34075Claude518app.route("/", healthRoutes);
519
f295f78Dictation App520// Cross-product platform status (public, CORS-open — see docs/PLATFORM_STATUS.md)
521app.route("/api/platform-status", platformStatus);
522
52ad8b1Claude523// Block L4 — Public stats counters (powers landing-page social proof)
524app.route("/", publicStatsRoutes);
525
526// Block L3 — Live /demo page + /api/v2/demo/* endpoints
527app.route("/", demoRoutes);
528
2316be6Claude529// Public /status — human-readable platform health page
530app.route("/", statusRoutes);
531
b1be050CC LABS App532// BLOCK S4 — Site-admin synthetic-monitor dashboard (/admin/status).
533// Mounted near the public status route so the two surfaces are visible
534// side-by-side; routes are gated by isSiteAdmin internally.
535app.route("/", adminStatusRoutes);
536
80bed05Claude537// /help — quickstart + API cheatsheet
538app.route("/", helpRoutes);
539
e0e4219Claude540// /docs — expanded documentation site (getting started, workflow YAML, MCP, API, agents)
541app.route("/", docsRoutes);
542
5f2e749Claude543// L8 — public /pricing page (free-tier polish). Mounted BEFORE marketing
544// so the new editorial pricing layout wins the route; the legacy marketing
545// pricing remains as a safety net but is shadowed at the router.
546app.route("/", pricingRoutes);
547
e1fc7dbClaude548// /changelog — manually curated platform release history
549app.route("/", changelogRoutes);
550
9f29b65Claude551// Enterprise sales page + contact form lead capture.
552app.route("/", enterpriseRoutes);
553
b0148e9Claude554// /pricing, /features, /about — marketing surface
555app.route("/", marketingRoutes);
556
adf5e18Claude557// /developer-program — partner + marketplace revenue-share page
558app.route("/", developerProgramRoutes);
559
5618f9aClaude560// SEO: robots.txt + sitemap.xml
561app.route("/", seoRoutes);
562
05cdb85Claude563// /api/version — live build SHA + uptime; client poller uses this to
564// surface 'New version available — reload' banners on deploy.
565app.route("/", versionRoutes);
566
699e5c7Claude567// Health dashboard (per-repo health page)
568app.route("/", healthDashboardRoutes);
569
9dd96b9Test User570// Block R1 — site-admin operations console. MUST be mounted BEFORE
571// insightRoutes because its POST `/:owner/:repo/rollback` catch-all would
572// otherwise intercept `/admin/ops/rollback` (matching :owner=admin :repo=ops).
573app.route("/", adminOpsRoutes);
f2c00b4CC LABS App574// BLOCK W — Self-host status + bootstrap dashboard.
575app.route("/", adminSelfHostRoutes);
826eccfTest User576// BLOCK X — AI health-scan diagnose page (/admin/diagnose).
577app.route("/", adminDiagnoseRoutes);
9dd96b9Test User578
16b325cClaude579// Insights (time-travel, dependencies, rollback)
580app.route("/", insightRoutes);
581
8d1483cClaude582// DORA metrics page (/:owner/:repo/insights/dora)
583app.route("/", doraRoutes);
584
f1ab587Claude585// Command center dashboard
586app.route("/", dashboardRoutes);
587
36b4cbdClaude588// Legal pages (terms, privacy, AUP)
589app.route("/", legalRoutes);
4b66018Claude590// Long-form legal sub-pages — /legal/{terms,privacy,acceptable-use,dmca}.
591// The main `legal.tsx` serves the short canonical paths (/terms, /privacy,
592// /acceptable-use); these are the formal versions that the legal pages
593// internally link to each other.
594app.route("/", legalTermsRoutes);
595app.route("/", legalPrivacyRoutes);
596app.route("/", legalAcceptableUseRoutes);
597app.route("/", legalDmcaRoutes);
36b4cbdClaude598
bdbd0deClaude599// GitHub import / migration
600app.route("/", importRoutes);
14c3cc8Claude601app.route("/", importBulkRoutes);
f390cfaCC LABS App602app.route("/", importSecretsRoutes);
bb2dea9Claude603// GitHub Actions → Gluecron gates.yml importer (stateless converter)
604app.route("/", actionsImporterRoutes);
14c3cc8Claude605app.route("/", migrationRoutes);
9a8b8deClaude606// GitHub Org Migration Wizard — live progress bulk importer
607app.route("/", migrateRoutes);
14c3cc8Claude608
609// Spec-to-PR (experimental AI-generated draft PRs)
610app.route("/", specsRoutes);
23d0abfClaude611app.route("/", refactorRoutes);
bdbd0deClaude612
c81ab7aClaude613// Explore page
614app.route("/", exploreRoutes);
615
59b6fb2Claude616// Onboarding
617app.route("/", onboardingRoutes);
618
0316dbbClaude619// Admin + feature routes
620app.route("/", adminRoutes);
7293c67Claude621app.route("/", adminDeletionsRoutes);
622app.route("/", adminStripeRoutes);
509c376Claude623app.route("/", adminIntegrationsRoutes);
79ed944Claude624app.route("/", adminAdvancementRoutes);
f764c07Claude625app.route("/", adminDeploysRoutes);
626app.route("/", adminDeploysPageRoutes);
783dd46Claude627app.route("/", adminServerTargetsRoutes);
9aaa128Claude628app.route("/", deployTargetsRoutes);
90c7531Claude629app.route("/", claudeWebRoutes);
9dd96b9Test User630// Note: adminOpsRoutes is mounted earlier (before insightRoutes) — see comment above.
0316dbbClaude631app.route("/", advisoriesRoutes);
632app.route("/", aiChangelogRoutes);
633app.route("/", aiExplainRoutes);
634app.route("/", aiTestsRoutes);
635app.route("/", askRoutes);
38d31d3Claude636app.route("/", repoChatRoutes);
ee7e577Claude637// Personal cross-repo chat — `/chat` (user-scoped). Mounted alongside
638// repoChatRoutes so the two surfaces share the catch-all priority.
639app.route("/", personalChatRoutes);
0316dbbClaude640app.route("/", billingRoutes);
8809b87Claude641app.route("/", billingUsageRoutes);
6778ad2Claude642app.route("/", stripeWebhookRoutes);
0316dbbClaude643app.route("/", codeScanningRoutes);
644app.route("/", commitStatusesRoutes);
645app.route("/", copilotRoutes);
646app.route("/", depUpdaterRoutes);
647app.route("/", depsRoutes);
648app.route("/", discussionsRoutes);
649app.route("/", environmentsRoutes);
4bbacbeClaude650app.route("/", previewsRoutes);
79ed944Claude651app.route("/", docsTrackingRoutes);
0316dbbClaude652app.route("/", followsRoutes);
653app.route("/", gatesRoutes);
654app.route("/", gistsRoutes);
655app.route("/", graphqlRoutes);
2c2163eClaude656app.route("/", mcpRoutes);
0316dbbClaude657app.route("/", marketplaceRoutes);
5ca514aClaude658app.route("/", marketplaceAgentsRoutes);
0316dbbClaude659app.route("/", mergeQueueRoutes);
660app.route("/", mirrorsRoutes);
661app.route("/", orgInsightsRoutes);
662app.route("/", packagesRoutes);
663app.route("/", packagesApiRoutes);
845fd8aClaude664// OCI / Docker container registry — /v2/* (OCI Distribution Spec v1.0)
665app.route("/", ociRegistryRoutes);
0316dbbClaude666app.route("/", pagesRoutes);
667app.route("/", projectsRoutes);
668app.route("/", protectedTagsRoutes);
669app.route("/", pwaRoutes);
46d6165Claude670app.route("/", installRoutes);
cd4f63bTest User671// BLOCK Q1 — /gluecron.dxt download (Claude Desktop one-click extension)
672app.route("/", dxtRoutes);
662ce86Claude673// Connect Claude — user-facing one-click MCP setup (/connect/claude). Mounted
674// next to the other one-click flows (install.sh + .dxt) for surface symmetry.
675app.route("/", connectClaudeRoutes);
f5b9ef5Claude676// Claude Code Integration Receiver — /api/claude/connect + /api/claude/session.
677app.route("/", claudeIntegration);
678// Connect guide — public onboarding page (/connect/claude-guide).
679app.route("/", connectRoutes);
05ab9b1Claude680// Push Watch — per-commit live status (gates + deploy + latency) at /:owner/:repo/push/:sha
681app.route("/", pushWatchRoutes);
682// Org Secrets Manager — BLOCK M2 — /orgs/:slug/settings/secrets
683app.route("/", orgSecretsRoutes);
a2b3e99Claude684// Cross-repo code search — BLOCK M3 — /search/code + /api/search/code
685app.route("/", crossRepoSearchRoutes);
686// Browser push notifications — BLOCK M4 — /settings/notifications/push + /api/push/*
687app.route("/", pushNotifRoutes);
9fbe6cdClaude688// Developer Velocity Dashboard — BLOCK M9 — /:owner/:repo/insights/velocity
689app.route("/", velocityRoutes);
690// Stale Branch Cleanup — BLOCK M10 — /:owner/:repo/branches/stale
691app.route("/", staleBranchRoutes);
22f43f3Claude692// Repository Pulse — BLOCK M12 — /:owner/:repo/pulse
693app.route("/", pulseRoutes);
74d8c4dClaude694// Repository Health Score — BLOCK M14 — /:owner/:repo/insights/health
695app.route("/", healthScoreRoutes);
696// Hot Files Heatmap — BLOCK M16 — /:owner/:repo/insights/hotfiles
697app.route("/", hotFilesRoutes);
ebbb527Claude698// Hosted Claude tool-use loops — paste loop, get endpoint, billing meter.
699// See src/routes/claude-deploy.tsx + src/lib/hosted-claude-loop.ts.
700app.route("/", claudeDeployRoutes);
0316dbbClaude701app.route("/", releasesRoutes);
702app.route("/", requiredChecksRoutes);
703app.route("/", rulesetsRoutes);
704app.route("/", searchRoutes);
705app.route("/", semanticSearchRoutes);
706app.route("/", signingKeysRoutes);
707app.route("/", sponsorsRoutes);
708app.route("/", ssoRoutes);
46d6165Claude709app.route("/", githubOauthRoutes);
582cdacClaude710app.route("/", googleOauthRoutes);
0316dbbClaude711app.route("/", symbolsRoutes);
712app.route("/", templatesRoutes);
713app.route("/", trafficRoutes);
714app.route("/", wikisRoutes);
715app.route("/", workflowsRoutes);
5ff9cc2Claude716app.route("/", workflowArtifactsRoutes);
717app.route("/", workflowSecretsRoutes);
46d6165Claude718app.route("/", sleepModeRoutes);
52ad8b1Claude719app.route("/", vsGithubRoutes);
0316dbbClaude720
45f3b73Claude721// Voice-to-PR — phone-first dictation → spec or issue
722app.route("/", voiceRoutes);
723
3122762Claude724// Blog / Devlog — public posts, no DB
725app.route("/", blogRoutes);
726
cd4f63bTest User727// Block Q3 — Anonymous playground (`/play`, `/play/claim`). Mounted
728// before the web catch-all so the bare `/play` literal wins over the
729// `/:owner` user-profile route.
730app.route("/", playgroundRoutes);
731
891efbeClaude732// Shareable AI hours-saved OG image card + landing page.
733// /share/hours-saved?user=:username → 1200×630 SVG (og:image)
734// /share/:username → HTML page with og:image meta + Twitter share
735// Mounted BEFORE webRoutes so /share/* doesn't fall through to the /:owner profile route.
736app.route("/", shareRoutes);
737
79136bbClaude738// Web UI (catch-all, must be last)
739app.route("/", webRoutes);
740
c63b860Claude741// Global 404 — BLOCK O2 routes the shared `NotFoundPage` view so
742// the markup stays consistent with /500 and the admin /403 page.
79136bbClaude743app.notFound((c) => {
36cc17aClaude744 const user = c.get("user") ?? null;
79136bbClaude745 return c.html(
c63b860Claude746 <NotFoundPage user={user} method={c.req.method} path={c.req.path} />,
79136bbClaude747 404
748 );
749});
750
c63b860Claude751// Global error handler — BLOCK O2 uses the shared `ServerErrorPage`
752// view. Trace block only shown outside production.
79136bbClaude753app.onError((err, c) => {
80bed05Claude754 reportError(err, {
755 requestId: c.get("requestId"),
756 path: c.req.path,
757 method: c.req.method,
758 });
c63b860Claude759 // Prefer the inbound `x-request-id` header (LB-supplied) and fall
760 // back to the context value set by request-context middleware.
761 const requestId =
762 c.req.header("x-request-id") ||
763 ((c.get("requestId" as never) as string | undefined) ?? undefined);
36cc17aClaude764 const user = c.get("user") ?? null;
c63b860Claude765 const trace =
766 process.env.NODE_ENV !== "production" && err && err.message
767 ? err.message
768 : undefined;
79136bbClaude769 return c.html(
c63b860Claude770 <ServerErrorPage user={user} requestId={requestId} trace={trace} />,
79136bbClaude771 500
772 );
773});
774
775export default app;