How reddevilmidzy/queensac works
Project type and purpose
• This is a Rust-based CLI/service integrated with GitHub Actions that scans a repository for broken links, tries to find replacements, and opens a PR with fixes.
• It is organized as a layered, single-service application (no separate frontend).
Main components
a. Entrypoint (main.rs)
b. Domain layer (src/domain)
c. Git integration layer (src/git)
d. Link Checker service layer (src/link_checker)
e. External dependencies:
• GitHub Repository (source code & hosting)
• GitHub API (for PR creation)
• HTTP endpoints (to validate links)
• File system (to read repo files)
Relationships and data flows
1) main.rs orchestrates the workflow:
– boots the “LinkWorker” (service)
– injects domain types & implementations
2) FileTracker (src/git/file_tracker.rs)
– reads file list from the local clone or GitHub workspace
3) LinkExtractor (src/git/link_extractor.rs)
– parses each file, emits link candidates (domain::repository_url)
4) LinkChecker (src/link_checker/checker.rs & service.rs)
– takes each URL, issues HTTP HEAD/GET via reqwest or similar
– marks valid vs. broken
– for broken, calls search algorithm to find replacements
5) PRGenerator (src/git/pr_generator.rs)
– uses GitHub API client to:
• commit modified files (with replacement links)
• open Pull Request against the origin repo
6) Domain (src/domain)
– defines core types (RepositoryUrl, Time, etc.) and interfaces (traits)
– shared by git & link_checker modules
Architectural patterns & design principles
• Layered/Clean Architecture: separation between domain, infrastructure (git, HTTP), and orchestration (main).
• Dependency Inversion: higher-level modules (service) depend on domain traits, implemented by lower-level modules.
• Single Responsibility: each module (file_tracker, link_extractor, checker, pr_generator) has one well-defined role.
• Extensibility points: domain traits allow swapping HTTP client or Git implementation for testing or future v2 integrations.
1) A rectangle labeled “CLI Entrypoint (main.rs)” at the top center.
– “FileTracker (src/git/file_tracker.rs)”
– “LinkExtractor (src/git/link_extractor.rs)”
– “LinkCheckerService (src/link_checker/service.rs)”
5) On the far right, place “GitHub API” and “GitHub Repo” as external systems.
– GitHub Repo → FileTracker (“Files”)
– FileTracker → LinkExtractor (“RawText”)
– LinkExtractor → LinkCheckerService (“URLs”)
– LinkCheckerService → PRGenerator (“Fixes”)
– PRGenerator → GitHub API (“Create PR”)
– GitHub API → GitHub Repo (“Apply changes”)