Skip to content

Separate source sets for voice generation and daemon parts#2

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/separate-source-sets-audio-daemon
Draft

Separate source sets for voice generation and daemon parts#2
Copilot wants to merge 3 commits intomainfrom
copilot/separate-source-sets-audio-daemon

Conversation

Copy link

Copilot AI commented Oct 23, 2025

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.rs file (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 delegation
  • src/gen.rs (134 lines) - Voice generation functionality
    • handle_gen() - Main entry point for the gen command
    • generate_voice_files() - VOICEVOX voice file generation
    • create_progress_bar() - Progress bar utilities
    • validate_interval() - Input validation
  • src/run.rs (91 lines) - Daemon/run functionality
    • handle_run() - Main entry point for the run command
    • check_voice_files() - Voice file validation
    • get_idle_minutes() - User idle time detection
    • validate_interval() - Input validation
  • src/voicevox.rs (unchanged) - Shared VOICEVOX client module

Benefits

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 rustfmt

Technical 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 gen module, while all daemon/scheduling/playback logic is isolated in the run module. The main.rs file now serves only as the entry point that parses CLI arguments and delegates to the appropriate module.

Testing

  • ✅ Code review passed with no issues
  • ✅ All code formatted with rustfmt
  • ✅ CI/CD will validate builds on Ubuntu, Windows, and macOS
Original 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.

Copilot AI and others added 2 commits October 23, 2025 16:49
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
Copilot AI requested a review from Meatwo310 October 23, 2025 16:56
@Meatwo310
Copy link
Owner

🫠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants