/** * GitHub Source * * Fetches plugin information from GitHub releases using API v3 * API Docs: https://docs.github.com/en/rest */ import type { PluginInfo, PluginSourceType } from '../types/index.js'; import { BasePluginSource } from './base.js'; interface RateLimitState { remaining: number; limit: number; resetAt: Date; } export declare class GitHubSource extends BasePluginSource { readonly id = "github"; readonly name = "GitHub Releases"; readonly type: PluginSourceType; private static readonly API_BASE; private static readonly RATE_LIMIT_BUFFER; private static readonly RELEASE_FALLBACK_COUNT; private apiToken; private rateLimit; /** * Set GitHub API token for higher rate limits */ setApiToken(token: string): void; getRateLimitState(): RateLimitState | null; private shouldWaitForRateLimit; private getRateLimitWaitTime; private updateRateLimitFromHeaders; /** * Get plugin info by repo slug (owner/repo) */ getPluginInfo(repoSlug: string): Promise; /** * Search for plugins (searches repositories with 'minecraft-plugin' topic) */ searchPlugins(query: string, limit?: number): Promise; getLatestVersion(repoSlug: string): Promise; private getLatestRelease; getAllReleases(repoSlug: string, limit?: number): Promise; protected buildHeaders(additional?: Record): Record; /** * Override fetchJson to capture rate limit headers from every response. * Delegates to base class for URL validation, error handling, and JSON parsing. * * Wires the same composed AbortSignal as base.fetchJson (Phase 3 audit * API [5]) — caller signal + timeout, whichever fires first. */ protected fetchJson(url: string, options?: RequestInit): Promise; /** * Fetch JSON with rate limit pre-check. * Waits for rate limit reset if needed, then delegates to fetchJson. */ private fetchJsonWithRateLimit; private parseRelease; /** * Find the best JAR asset from a release using segment-based scoring. * * Replaces the old substring vetoes ('sources'/'javadoc'/'api'/'-dev'/ * '-snapshot') which rejected legitimate plugins whose NAME contains a * vetoed word (PlaceholderAPI-2.11.7.jar, item-nbt-api-plugin-*.jar) and * returned no asset at all — downloadUrl ended up '' and downloads silently * never happened (Phase 1 audit: sources-review.md Finding 5). Scoring * deprioritizes library artifacts and wrong-platform builds instead, and * NEVER returns empty when at least one .jar asset exists. */ private findJarAsset; /** Positive when `a` is a better plugin-JAR candidate than `b` */ private compareJarAssets; /** * Score a JAR asset's name. Segment-based (split on non-alphanumerics) so * 'PlaceholderAPI' never matches the 'api' library penalty, while * 'coolplugin-api-1.0.jar' does. */ private scoreJarAsset; /** * Clean version string (remove 'v' prefix, etc.) */ private cleanVersion; } export {}; //# sourceMappingURL=github.d.ts.map