How wraient/curd works
Main Components
• CLI Entry Point – Represent the main command under “cmd/curd/main.go”. This is where user input is collected and command-line options (flags like -rofi, -skip-op, etc.) are interpreted.
• Core Business Logic – Inside the “internal” directory, several Go modules implement the core functionalities:
– Anime Retrieval and Listing (internal/anime_list.go, internal/episode_list.go, internal/episode_url.go)
– API Integrations for Anilist, AniSkip, Jikan, and others (internal/anilist.go, internal/aniskip.go, internal/jikan.go, etc.)
– Media Player Integration (internal/player.go) that interfaces with mpv.
– Discord Integration (internal/discord.go) managing the rich presence updates.
– UI & Selection Menu Components (internal/rofi.go, internal/selection_menu.go) for Rofi support and image preview features.
– Config and State Management (internal/config.go, internal/localTracking.go, internal/globals.go, internal/structs.go) handling configuration file reading (“~/.config/curd/curd.conf”) and local history data storage.
– Platform Specific IPC Modules (internal/unix_ipc.go and internal/windows_ipc.go) that manage interprocess or system-specific communications, ensuring compatibility on both Linux and Windows.
External Dependencies and Build Artifacts
• Build Directory – Contains binaries or scripts for different platforms and architectures (build targets for Linux, macOS, Windows). This can be abstracted as a “Deployment/Build” component separate from the core logic.
Relationships and Data Flow
• From there, data flows into respective modules: a module might call API handlers (for example, querying the AniSkip API to determine skipping times, or updating user progress via the Anilist API) and interact with the player module to launch mpv.
• Additionally, configuration management and UI selection via Rofi have bidirectional interactions – the application reads configuration settings on startup and might update them based on user choices.
• Build process separately to indicate how the project is packaged for different platforms.
Architectural Patterns and Design Principles
• Modularity: The clearly separated packages (cmd vs. internal) suggest a modular design where each functionality (API integration, config, UI) is isolated.
• Cross-Platform Considerations: Inclusion of separate files for unix and windows IPC shows that the design accommodates platform-specific differences.
• Dependency Management: The use of Go modules (go.mod, go.sum) and alternative build approaches (Flakes via flake.nix and package.nix) is important for reproducible builds.
• A Block for “CLI Entry Point” (cmd/curd/main.go) showing initial command parsing and flag resolution.
• A block that aggregates “Core Modules” from the internal directory, subdividing it into:
– API Integration Modules (anilist.go, aniskip.go, jikan.go)
– Player & Media Handling (player.go)
– UI Handling (rofi.go, selection_menu.go)
– Config & State Management (config.go, globals.go, localTracking.go)
– Platform-Specific Integrations (unix_ipc.go, windows_ipc.go)
• A block showing “External Dependencies” (mpv, rofi, ueberzugpp) connected to the player and UI components.
• A separate “Build & Deployment” section showing the Build directory and its different platform targets.
• A block for configuration files and persistent storage (“~/.config/curd/curd.conf”) linked to configuration management modules.
Additional Notes
• Don’t shy away from being as detailed as possible. Every module observed in the file tree (and noted in the README for its functionality) should be represented to provide a clear architectural picture.