3a6c80558d
A punktfunk-plugin-* package that scans ROM directories, maps them to emulators, fetches box art, and reconciles them into the host game library under provider id `rom-manager` — with a console-hosted web UI. Engine (pure, unit-tested core): - Table-driven platform registry (~25 consoles) + emulator registry with best-effort per-OS detection (PATH / Flatpak / known paths) and RetroArch core discovery. - Scanner with disc folding (m3u/cue/gdi), archive gating, excludes. - No-Intro title parsing + optional per-platform region dedupe. - Security-critical quoting seam: POSIX single-quote + Windows double-quote with hostile-name refusal; ROM filenames never reach a shell un-quoted. - Pure desired-state reconcile (stable external_ids, scale guard, fingerprint skip) → full-replace PUT /library/provider/rom-manager. Box art (like Steam ROM Manager): SteamGridDB primary (portrait/hero/logo/ header, fuzzy match, operator API key) behind a provider seam, with keyless libretro-thumbnails as the zero-setup fallback (`auto` default). UI: console-hosted via the SDK `servePluginUi` (zero plugin-side auth) with a plugin-local REST/SSE API and a self-contained React SPA (Setup / Emulators / Games / Sync). Standalone password-gated fallback for host-only installs. CLI: scan / detect / preview / sync / uninstall / set-password. 48 engine tests, typecheck + biome clean, SPA builds. Verified end-to-end: scan → detect → reconcile PUT, fingerprint idempotence, and the standalone UI serving SPA + REST. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
21 lines
1.1 KiB
TypeScript
21 lines
1.1 KiB
TypeScript
// The host side of the reconcile (design §2). We PUT the declarative entry list to the provider
|
|
// endpoint and let the host diff by `external_id` (stable ids, orphan drop, manual entries untouched).
|
|
// Done through `pf.request` rather than the typed `pf.api.*` deliberately: under the packaged runner
|
|
// the facade is built by the runner's *bundled* SDK copy, whose generated client may predate an
|
|
// endpoint — the untyped request seam is version-skew-proof (same reasoning as `servePluginUi`).
|
|
|
|
import type { Punktfunk } from "@punktfunk/host";
|
|
import { PROVIDER_ID } from "./const.js";
|
|
import type { ProviderEntryInput } from "./wire.js";
|
|
|
|
/** Full-replace reconcile: the host makes the library match `entries` exactly for this provider. */
|
|
export const reconcileProvider = (
|
|
pf: Punktfunk,
|
|
entries: ProviderEntryInput[],
|
|
): Promise<unknown> =>
|
|
pf.request("PUT", `/library/provider/${PROVIDER_ID}`, entries);
|
|
|
|
/** Clean uninstall: remove every entry this provider owns. */
|
|
export const deleteProvider = (pf: Punktfunk): Promise<unknown> =>
|
|
pf.request("DELETE", `/library/provider/${PROVIDER_ID}`);
|