Guidance for AI coding agents working in this repository. Humans are welcome to use it too. For product and
user documentation, start with ReadMe.md and docs/.
- What: Retro Game Cover Downloader — a cross-platform desktop app that scans a ROM folder and downloads missing box art from the public libretro-thumbnails repositories.
- Stack: C# / .NET 10 (
net10.0), Avalonia 12 + Fluent dark theme, MVVM, Serilog, xUnit. - Platforms: Windows, Linux, and macOS; x64 and arm64 self-contained builds.
- Solution:
CSharp_RetroGameCoverDownloader.sln - Default branch:
master - Version:
AssemblyVersioninRetroGameCoverDownloader/RetroGameCoverDownloader.csproj(kept in lockstep with the test project)
- Windows, Linux, or macOS
- .NET 10 SDK
- PowerShell 7 (
pwsh) or the platform shell equivalents (the commands below use PowerShell)
Run from the repository root:
dotnet restore CSharp_RetroGameCoverDownloader.sln
dotnet build CSharp_RetroGameCoverDownloader.sln -c Release --no-restore
dotnet test CSharp_RetroGameCoverDownloader.sln -c Release --no-build
dotnet run --project RetroGameCoverDownloader
# Static analysis (must report zero warnings and errors)
jb inspectcode CSharp_RetroGameCoverDownloader.sln `
--output=inspectcode.sarif --format=Sarif --severity=WARNING --swea
# Build a single self-contained target (or omit -Runtimes for all six)
./scripts/package-release.ps1 -Version 2.0.0 -Runtimes linux-x64 -SkipTestsCI builds and tests on Windows, Linux, and macOS, and publishes win-x64, win-arm64, linux-x64,
linux-arm64, osx-x64, and osx-arm64 artifacts.
- The solution must build with zero warnings. Fix analyzer findings; do not suppress them without a documented reason.
- Tests are fully offline and must stay that way. They never call GitHub, telemetry, or the bug-report endpoint.
- Run focused tests with the usual filters:
dotnet test --filter "FullyQualifiedName~GitHubServiceTests"
dotnet test --filter "DisplayName~RateLimit"| Path | Contents |
|---|---|
RetroGameCoverDownloader/ |
Avalonia application (Assets, Commands, Converters, Helpers, Managers, Models, Services, ViewModels, Views) |
RetroGameCoverDownloader.Tests/ |
xUnit suite (net10.0) mirroring the app's folder structure |
docs/ |
DocFX documentation published to GitHub Pages and the Wiki |
scripts/ |
package-release.ps1 (release bundles) and publish-wiki.ps1 (wiki sync) |
.github/ |
workflows/ (ci.yml, codeql.yml, release.yml, docs.yml) and dependabot.yml |
MainViewModelowns scanning, matching, the download loop, cancellation, and UI state. Dialogs use code-behind for simplicity.GitHubServicehandles all GitHub access (systems list,.gitmodules, trees, cover downloads).IGitHubServiceexists so tests can inject a fake.RateLimiterenforces the 55/4,900 requests-per-hour window;RetryHelperimplements exponential backoff and transient-failure classification;GitHubServicetracks consecutive 503s with a circuit breaker.SettingsManagerpersistssettings.datwith Windows DPAPI (CurrentUserscope plus application entropy) on Windows and AES-GCM with a user-onlysettings.keyon Linux/macOS. It migrates legacysettings.xmlon Windows.AppDialogsandPlatformHelperprovide cross-platform message boxes and shell integration. The screenshot service renders the Avalonia window instead of using platform-specific screen APIs.BugReportService/BugReportSinkwriteerror.logand forward actionable errors; transient network failures, timeouts, rate limits, and cancellations stay informational and are not reported.ApplicationStatsServicesends anonymous launch telemetry (application id + version only).UpdateCheckerServicereads the latest GitHub release and opens the release page; it never auto-updates.
See docs/guide/architecture.md for the full data flow.
- Add the property to
Models/AppSettings.cs. - Update
Managers/SettingsManager.csonly if backward compatibility or migration is required. - Wire it through
MainViewModeland the relevant dialog. - Update
docs/guide/configuration.md. - Add or update tests under
RetroGameCoverDownloader.Tests/.
- Put it in
Services/; add an interface when tests need a fake. - Use
async/awaitend to end, accept aCancellationTokenwhere work can be cancelled, and keep external dependencies injectable or virtualized. - Log with Serilog structured templates and classify failures consistently (transient =
Information, real defect =Error). - Add tests in the matching folder under
RetroGameCoverDownloader.Tests/Services/.
- Create or edit a page in
docs/guide/. - Add new pages to
docs/guide/toc.ymlso DocFX and the wiki sidebar pick them up. - Use relative Markdown links such as
[User Guide](user-guide.md). - Build locally with
dotnet tool install --global docfx --version 2.81.0anddocfx docs/docfx.json. - Keep the site's dark theme and landing-page sidebar intact: customization lives in
docs/template/(public/main.js,public/main.css,public/logo.png), anddocs/docfx.jsonsetsfileMetadata._disableTocforindex.mdbecause the root TOC links to it directly.
- Nullable reference types and implicit usings are enabled; use file-scoped namespaces.
- Follow the existing naming patterns:
...Service,...Manager,...ViewModel,...Item. - Never block the UI thread and never use
async voidoutside Avalonia event handlers. Marshal UI updates through the dispatcher seams onMainViewModel. - Use structured logging (
Log.Information("Loaded {Count} files", count)), not string interpolation, so properties stay queryable. - Keep services testable and deterministic; tests must not depend on the network, the clock, or the real file system when a seam already exists.
- Preserve the existing MVVM boundary: business logic in
MainViewModel/services, presentation in XAML.
- Never commit tokens, passwords, API keys, local user paths, or library contents.
- The GitHub token and proxy password are stored only through
SettingsManager(DPAPI,CurrentUserscope, application entropy). Do not add plaintext storage or a second secret store. - Never log
Authorizationheaders, tokens, proxy passwords, or full settings files, and never include them in bug reports or error messages. - Keep all network calls on HTTPS. Do not add certificate-validation bypasses or disable TLS checks.
- Do not weaken the privacy behavior. Any new telemetry, remote endpoint, or data collection must be
documented in
docs/guide/configuration.mdand reviewed. - GitHub Actions: keep least-privilege
permissions, avoidpull_request_targetwith untrusted checkouts, and never echo secrets. - Report vulnerabilities privately per SECURITY.md; never open a public issue for one.
.github/workflows/ci.ymlbuilds and tests every push and pull request tomaster, and uploads test results plus coverage..github/workflows/codeql.ymlruns CodeQL code scanning for C# and GitHub Actions..github/workflows/docs.ymlbuilds the DocFX site on PRs and documentation pushes, then deploys to GitHub Pages and syncs the wiki onmaster..github/dependabot.ymlkeeps NuGet packages and GitHub Actions up to date every week..github/workflows/release.ymlis approval-gated and publishesrelease_<version>_win-x64.zipandrelease_<version>_win-arm64.zip.- To cut a release: update
WhatsNew.md, bumpAssemblyVersion/FileVersionin both.csprojfiles, push arelease_X.Y.Ztag, review the bundle checksums, and approve thereleaseenvironment. See docs/guide/release-process.md.
-
dotnet build CSharp_RetroGameCoverDownloader.sln -c Releasecompletes with zero warnings. -
dotnet test CSharp_RetroGameCoverDownloader.slnpasses. -
jb inspectcodereports zero warnings and errors. - Platform-specific changes compile for Windows, Linux, and macOS (or CI is running).
- New behavior has tests and existing tests still pass offline.
- User-facing or configuration changes update
docs/guide/anddocs/guide/toc.yml. -
WhatsNew.mdis updated for user-visible changes. - No secrets, tokens, or personal paths were added.
- CI is green.