$ show LykosAI/StabilityMatrix
Stability Matrix is a cross-platform desktop application (Windows, macOS, Linux) that serves as a unified package manager, model browser, and inference UI for AI image generation tools like Stable Diffusion, ComfyUI, Fooocus, and Forge. The codebase is built with .NET 9 using Avalonia UI (with legacy WPF remnants) and follows the MVVM pattern with CommunityToolkit.Mvvm and DI via Injectio. Key entry points include the MainWindow, PackageManagerPage, InferencePage (text-to-image, image-to-image, video, upscale), and CheckpointBrowserPage (CivitAI, HuggingFace, OpenModelDB). The system manages Python virtual environments, installs packages via pip/uv, and orchestrates inference through ComfyUI's API or built-in Gemini providers. External dependencies include Refit for API clients, LiteDB for local caching, and SkiaSharp for image processing. The architecture is a modular monolith with clear separation of concerns via service interfaces, view models, and custom controls.
The LLM identified 5 files worth highlighting for reuse:
Provides a strongly-typed, fluent API for constructing ComfyUI node graphs. It registers typed nodes, ensures unique names, and tracks extension requirements. This pattern is reusable for any graph-based workflow system and demonstrates careful design to prevent invalid connections.
An immutable argument builder for command-line processes with automatic quoting, deduplication, and support for Windows/Linux/macOS. It centralizes the complexities of argument escaping (e.g., paths with spaces, environment variable expansion) and is easily extracted for reuse in any .NET project that launches subprocesses.
Provides async file copy/move operations with progress reporting and SHA256-based conflict resolution. It handles common edge cases (read-only files, concurrent access) and uses platform-appropriate buffer sizes. This is a standalone utility that can be reused in any file management context.
Implements a robust recovery strategy for corrupted JSON settings files, handling null bytes, truncated braces, and property-level fallback. This demonstrates a deep understanding of real-world file corruption patterns and is applicable to any application that persists user settings as JSON.
Reads, writes, and removes custom metadata chunks (e.g., 'smproj', 'parameters') from PNG files without relying on System.Drawing. It correctly handles chunk ordering and length limitations. This is reusable for any application that needs to embed or extract metadata from PNG images.