/** * CLI Source Helpers * * Pure conversion helpers extracted from src/cli.ts so they can be unit-tested * without invoking commander or process.exit. Logic lives here; cli.ts re-exports * what it needs. * * This module is the SINGLE factory for plugin-source construction. Every * update-check flow (CLI check-updates/migrate/schedule, UI Updates tab, * UI + CLI auto-update) builds its SourceRegistry here so source coverage * can never diverge between flows again (June 9 2026 audit, P0 finding: * four divergent source-registry constructions left hangar/geysermc/jenkins * plugins permanently uncheckable in the primary flows). * * @since v2.11.16 — extracted from cli.ts createSourceInstances */ import { SourceRegistry } from './core/sources/index.js'; import type { IPluginSource, ServerPlatform, SourceConfig } from './core/types/index.js'; /** * Result of attempting to instantiate sources from config. * * Failures are captured per-source so a single broken config entry can't * silently kill update checks for every source — the caller decides whether * to surface or ignore individual errors. */ export interface SourceCreationResult { sources: IPluginSource[]; errors: string[]; } /** * Cross-cutting options threaded into source construction. */ export interface SourceCreationOptions { /** * GitHub API token (from `PluginatorConfig.GITHUB_TOKEN`). Raises the GitHub * rate limit from 60/hr (unauthenticated) to 5,000/hr. Precedence: a * per-source `apiKey` on the github config entry wins, then this option, * then `process.env.GITHUB_TOKEN` as the final fallback. */ githubToken?: string; /** * Voxel (ex-Polymart) buyer token (from `PluginatorConfig.POLYMART_TOKEN`). * Optional — version checks are unauthenticated; the token unlocks the * official `getDownloadURL` buyer-download flow for owned resources. * Same precedence as githubToken: per-source `apiKey` > this option > * `process.env.POLYMART_TOKEN`. */ polymartToken?: string; /** * BuiltByBit Ultimate "Private" token (from * `PluginatorConfig.BUILTBYBIT_TOKEN`). Required for the source to do * anything — the Ultimate API rejects unauthenticated requests, so without * a token BuiltByBitSource answers null/[] with zero network calls. * Same precedence as githubToken: per-source `apiKey` > this option > * `process.env.BUILTBYBIT_TOKEN`. */ builtbybitToken?: string; /** * Server platform (from `PluginatorConfig.SERVER_PLATFORM`, W3 groundwork). * Applied at factory time to the platform-aware sources (Modrinth, Hangar, * GeyserMC) via their `setServerPlatform` setters — the smallest viable * carrier: the update-check path stays platform-agnostic because the * selection is baked into the source instances it is handed. Omitted or * 'bukkit' = pre-W3 behavior. */ serverPlatform?: ServerPlatform; } /** * Instantiate plugin sources from configuration entries. * * - Disabled entries are skipped (not an error). * - Unknown types (`ninsys`, future additions) are silently skipped * to preserve forward-compat with newer config files. * - `bukkit` (CurseForge) is also skipped: the source was retired — its API * key plumbing was never wired so it could never return data, and zero * registry entries referenced it. The type stays in PluginSourceType so * existing user configs still parse. * - Per-source instantiation failures are captured in `errors` rather than * thrown, so one bad Jenkins URL doesn't kill the rest of the registry. */ export declare function createSourceInstances(sourceConfigs: SourceConfig[], options?: SourceCreationOptions): SourceCreationResult; /** * Build a SourceRegistry from configuration entries. * * Single construction path for every update-check flow. Per-source * instantiation failures are skipped (same contract as the original * createSourceRegistry in workflows/auto-update.ts); use * {@link createSourceInstances} directly when the caller needs the errors. * * Always appends a web-manifest resolver (Phase 3 W1b) unless the config * already declares a `web` entry: web-typed plugins carry their manifest URL * in the composite identifier so the resolver needs no config of its own — * and most user sources.json files predate the type entirely. The resolver * is inert (zero network calls) until a web-typed plugin is checked. An * explicit `web` config entry — even a disabled one — takes precedence, so * users can still turn web checks off. */ export declare function buildSourceRegistry(sourceConfigs: SourceConfig[], options?: SourceCreationOptions): SourceRegistry; /** * Load the user's sources + app config and return a fully-populated registry. * * Convenience for flows that don't already hold loaded configs. Pass * `sourceConfigs` to skip the sources-file read — the app config is still * loaded so GITHUB_TOKEN reaches the GitHubSource either way. */ export declare function loadSourceRegistry(sourceConfigs?: SourceConfig[]): Promise; //# sourceMappingURL=cli-source-helpers.d.ts.map