Separate source sets for voice generation and daemon parts#2
Draft
Separate source sets for voice generation and daemon parts#2
Conversation
Co-authored-by: Meatwo310 <72017364+Meatwo310@users.noreply.github.com>
Co-authored-by: Meatwo310 <72017364+Meatwo310@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Separate source sets for audio generation and daemon
Separate source sets for voice generation and daemon parts
Oct 23, 2025
Owner
|
🫠 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR refactors the codebase to separate the voice generation functionality (音声生成部) and daemon functionality (デーモン部) into distinct modules, addressing the modularity issue described in the original request.
Changes
Before
The entire application logic was contained in a single
src/main.rsfile (276 lines), mixing CLI parsing, voice generation, daemon logic, and utility functions together in a monolithic structure.After
The code is now organized into focused, single-responsibility modules:
src/main.rs(67 lines) - Simplified to only CLI argument parsing and delegationsrc/gen.rs(134 lines) - Voice generation functionalityhandle_gen()- Main entry point for the gen commandgenerate_voice_files()- VOICEVOX voice file generationcreate_progress_bar()- Progress bar utilitiesvalidate_interval()- Input validationsrc/run.rs(91 lines) - Daemon/run functionalityhandle_run()- Main entry point for the run commandcheck_voice_files()- Voice file validationget_idle_minutes()- User idle time detectionvalidate_interval()- Input validationsrc/voicevox.rs(unchanged) - Shared VOICEVOX client moduleBenefits
✨ Separation of Concerns - Each module has a clear, single responsibility
🔧 Improved Maintainability - Easier to locate and modify specific functionality
📁 Better Code Organization - Follows Rust best practices for module structure
🔄 No Breaking Changes - Pure refactoring that maintains 100% backward compatibility
🎨 Code Quality - All code formatted with
rustfmtTechnical Details
This is a pure refactoring with no functional changes. The public API (CLI commands and their behavior) remains identical. All voice generation logic is isolated in the
genmodule, while all daemon/scheduling/playback logic is isolated in therunmodule. Themain.rsfile now serves only as the entry point that parses CLI arguments and delegates to the appropriate module.Testing
rustfmtOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.