///
The `gh.gg` application leverages a type-safe tRPC API layer to facilitate seamless communication between the frontend and backend services. This document outlines the main routers and their key proce
163 views
~163 views from guests
Guest views are estimated from total page views. These include anonymous visitors and users who weren't logged in when they viewed the page.
The gh.gg application leverages a type-safe tRPC API layer to facilitate seamless communication between the frontend and backend services. This document outlines the main routers and their key procedures (endpoints), providing a clear understanding of their functionality and data contracts.
appRouter (Core User & System)The main application router, handling core user authentication details and general application-wide procedures.
me.query(): { user: User, message: string }
// Fetches details of the currently authenticated user.updateProfile(Input: { name?: string, bio?: string }): { success: boolean, message: string, user: User }
// Updates the authenticated user's profile information.githubRouter (GitHub Data & Interactions)Responsible for interacting with the GitHub API to fetch repository, file, and user data. This router abstracts direct GitHub API calls.
github.files(Input: { owner: string, repo: string, ref?: string, path?: string }): GitHubFilesResponse
// Fetches file metadata and content from a specified repository path or branch.github.getBranches(Input: { owner: string, repo: string }): string[]
// Retrieves a list of available branches for a given GitHub repository.github.getRepoInfo(Input: { owner: string, repo: string }): RepositoryInfo
// Fetches high-level information about a specific GitHub repository.github.getUserRepositories(Input: { username?: string, limit?: number }): RepoSummary[]
// Retrieves a list of public repositories for an authenticated user or a specified username.scorecardRouter (Repository Scorecards)Manages the AI-powered generation and retrieval of repository scorecards.
scorecard.publicGetScorecard(Input: { user: string, repo: string, ref?: string, version?: number }): { scorecard: ScorecardData, cached: boolean, stale: boolean, lastUpdated: Date, error?: string }
// Retrieves a cached scorecard for a repository, either the latest or a specific version.scorecard.generateScorecard(Input: { user: string, repo: string, ref: string, files: RepoFile[] }): { scorecard: ScorecardData, cached: boolean, stale: boolean, lastUpdated: Date }
// Triggers AI generation of a new repository scorecard based on provided file contents.scorecard.getScorecardVersions(Input: { user: string, repo: string, ref: string }): Array<{ version: number, updatedAt: Date }>
// Lists all available historical versions of a repository scorecard.aiSlopRouter (AI Code Quality & Slop Detection)Handles AI analysis specifically for code quality issues and the detection of "AI Slop" patterns within a codebase.
aiSlop.publicGetAISlop(Input: { user: string, repo: string, ref?: string, version?: number }): { analysis: AISlopData, cached: boolean, stale: boolean, lastUpdated: Date, error?: string }
// Retrieves a cached AI slop analysis report for a repository.aiSlop.detectAISlop(Input: { user: string, repo: string, ref: string, files: RepoFile[] }): { analysis: AISlopData, cached: boolean, stale: boolean, lastUpdated: Date }
// Triggers AI detection of "AI Slop" and common code quality issues in specified files.aiSlop.getAISlopVersions(Input: { user: string, repo: string, ref: string }): Array<{ version: number, updatedAt: Date }>
// Lists all available historical versions of an AI slop analysis.diagramRouter (AI Diagram Generation)Manages the AI-powered generation and retrieval of interactive diagrams (e.g., flowcharts, class diagrams) for repositories.
diagram.generateDiagram(Input: DiagramAnalysisParams): { diagramCode: string, format: string, diagramType: DiagramType, cached: boolean, stale: boolean, lastUpdated: Date }
// Triggers AI generation of a Mermaid diagram based on repository files and specified type/options.diagram.publicGetDiagram(Input: { owner: string, repo: string, ref?: string, diagramType: DiagramType, version?: number }): { diagramCode: string, format: string, diagramType: DiagramType, cached: boolean, stale: boolean, lastUpdated: Date, error?: string }
// Retrieves a cached diagram for a repository by its type and an optional version.profileRouter (Developer Profiles)Manages the AI-powered generation and retrieval of developer profiles based on their GitHub activity.
profile.publicGetProfile(Input: { username: string, version?: number }): { profile: DeveloperProfile, cached: boolean, stale: boolean, lastUpdated: Date, error?: string }
// Retrieves a cached developer profile for a given GitHub username, by version or latest.profile.generateProfileMutation(Input: { username: string, includeCodeAnalysis?: boolean, selectedRepos?: string[] }): { profile: DeveloperProfile }
// Triggers AI generation of a new developer profile, with options to include code analysis or focus on specific repositories.profile.getDeveloperEmail(Input: { username: string }): { email: string | null }
// Attempts to find and return the public email address associated with a GitHub username.arenaRouter (Dev Arena)Handles developer arena battles, competitive rankings, and leaderboard management.
arena.getLeaderboard(Input: { limit?: number, offset?: number, tier?: string }): DeveloperRanking[]
// Retrieves a paginated list of developers on the global leaderboard, optionally filtered by tier.arena.challengeDeveloper(Input: { opponentUsername: string, criteria?: BattleCriteria[] }): ArenaBattle
// Initiates an AI-judged code battle between the authenticated user and a specified opponent.arena.getMyRanking(): DeveloperRanking
// Retrieves the authenticated user's current ranking and battle statistics in the Dev Arena.scoreHistoryRouter (Historical Scores)Provides historical data for user ELO ratings and repository analysis scores.
scoreHistory.getUserScoreHistory(Input: { username: string, limit?: number }): UserScoreHistory[]
// Fetches a chronological history of ELO rating changes for a specific developer.scoreHistory.getRepoScoreHistory(Input: { repoOwner: string, repoName: string, ref?: string, limit?: number }): RepoScoreHistory[]
// Fetches the historical overall score for a repository over time.userRouter (User Settings & Plans)Manages user-specific settings, API keys for BYOK (Bring Your Own Key) functionality, and subscription details.
user.getCurrentPlan(): { plan: 'free' | 'byok' | 'pro' | null, managedTokenUsage?: number, byokTokenUsage?: number }
// Retrieves the authenticated user's current subscription plan and current month's token usage.user.saveApiKey(Input: { apiKey: string }): { success: boolean }
// Saves an encrypted Google Gemini API key for the authenticated user.user.getApiKeyStatus(): { hasKey: boolean }
// Checks if the authenticated user has a BYOK (Bring Your Own Key) API key configured.featuredRouter (Featured & Sponsored Repositories)Manages lists of repositories that are featured or sponsored on the platform.
featured.getFeaturedRepos(): FeaturedRepo[]
// Retrieves a list of repositories highlighted as "featured".featured.getSponsorRepos(): FeaturedRepo[]
// Retrieves a list of repositories that are currently sponsoring the platform.billingRouter (Payments & Subscriptions)Handles integration with Stripe for payment processing and subscription management.
billing.createCheckoutSession(Input: { plan: 'byok' | 'pro' }): { url: string | null }
// Creates a Stripe checkout session for initiating a new subscription.billing.getBillingPortal(): { url: string | null }
// Generates a link to the Stripe customer portal, allowing users to manage their subscriptions.billing.getSubscription(): UserSubscription | null
// Retrieves the authenticated user's Stripe subscription details from the database.adminRouter (Administrator Tools)Provides administrative functionalities for system management and analytics, accessible only to designated admin users.
admin.getUsageStats(Input: { startDate: Date, endDate: Date }): { summary: TokenUsageSummary, usage: TokenUsage[] }
// Retrieves aggregated and detailed token usage statistics for all users within a specified date range.admin.getAllUsers(): User[]
// Fetches a comprehensive list of all registered users on the platform.admin.getDailyStats(Input: { days?: number }): DailyStat[]
// Retrieves daily cost and revenue statistics for a given number of recent days.webhooksRouter (GitHub Webhook Settings)Manages GitHub App webhook preferences and provides information about the user's GitHub App installations.
webhooks.getInstallationInfo(): GitHubAppInstallationInfo | null
// Retrieves details about the authenticated user's GitHub App installation (if any).webhooks.getRepositories(): InstallationRepository[]
// Lists repositories that are accessible via the user's GitHub App installation.webhooks.updatePreferences(Input: { prReviewEnabled?: boolean, autoUpdateEnabled?: boolean, minScoreThreshold?: number, excludedRepos?: string[] }): WebhookPreferences
// Updates the automated PR review preferences for the GitHub App installation.githubAnalysisRouter (GitHub PR & Issue Analysis)Provides on-demand AI analysis for GitHub Pull Requests and Issues.
githubAnalysis.getPullRequestDetails(Input: { owner: string, repo: string, number: number }): PullRequestDetails
// Fetches detailed information about a specific pull request.githubAnalysis.getCachedPrAnalysis(Input: { owner: string, repo: string, number: number }): PrAnalysis | null
// Retrieves a previously cached AI analysis for a pull request.githubAnalysis.analyzePullRequest(Input: { owner: string, repo: string, number: number }): PrAnalysis
// Triggers AI analysis for a pull request, returning a detailed review.githubAnalysis.getIssueDetails(Input: { owner: string, repo: string, number: number }): IssueDetails
// Fetches detailed information about a specific GitHub issue.githubAnalysis.getCachedIssueAnalysis(Input: { owner: string, repo: string, number: number }): IssueAnalysis | null
// Retrieves a previously cached AI analysis for an issue.githubAnalysis.analyzeIssue(Input: { owner: string, repo: string, number: number }): IssueAnalysis
// Triggers AI analysis for a GitHub issue, providing triage suggestions and quality assessment.wikiRouter (AI Wiki Documentation)Manages the generation, retrieval, and deletion of AI-generated wiki documentation for repositories.
wiki.getWikiTableOfContents(Input: { owner: string, repo: string }): WikiTableOfContents
// Retrieves the table of contents (list of pages) for a repository's AI-generated wiki.wiki.getWikiPage(Input: { owner: string, repo: string, slug: string, version?: number }): WikiPageContent | null
// Retrieves the content of a specific wiki page by its slug and an optional version.wiki.generateRepositoryWiki(Input: { owner: string, repo: string, files: RepoFile[], packageJson?: Record<string, unknown>, readme?: string }): { success: boolean, version: number, pages: WikiPageContent[], usage: TokenUsageSummary }
// Triggers AI generation of a complete, multi-page wiki for a repository based on its code.wiki.deleteRepositoryWiki(Input: { owner: string, repo: string }): { success: boolean }
// Deletes all AI-generated wiki pages associated with a specific repository.📚 Documentation Auto-Generated by gh.gg↗
Last updated: 2024-07-29