refactor: modularize supervisor.rs into focused submodules#175
Merged
Conversation
Split the 1,715-line supervisor.rs into a supervisor/ directory with focused modules for better maintainability: - mod.rs: Supervisor struct, public API, startup/shutdown, signals - state.rs: State access layer (daemon/shell CRUD operations) - lifecycle.rs: run(), run_once(), stop() - process spawning/monitoring - autostop.rs: Autostop logic and boot daemon startup - retry.rs: Retry logic with exponential backoff - watchers.rs: Background tasks (interval, cron, file watching) - ipc_handlers.rs: IPC request dispatch No functional changes - public API remains unchanged. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the monolithic 1,715-line supervisor.rs file into a modular directory structure with focused submodules, improving code organization and maintainability without changing functionality.
Changes:
- Split
supervisor.rsinto seven focused modules undersrc/supervisor/ - Moved helper functions and types to appropriate modules
- Re-exported necessary types in
mod.rsfor backward compatibility
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/supervisor/mod.rs | Main module file defining Supervisor struct, public API, and coordinating submodules |
| src/supervisor/state.rs | State access layer for daemon/shell CRUD operations |
| src/supervisor/lifecycle.rs | Core daemon lifecycle management (run, run_once, stop) |
| src/supervisor/autostop.rs | Autostop logic and boot daemon startup functionality |
| src/supervisor/retry.rs | Retry logic with exponential backoff for failed daemons |
| src/supervisor/watchers.rs | Background tasks for interval, cron, and file watching |
| src/supervisor/ipc_handlers.rs | IPC request dispatch and handling |
| src/supervisor.rs | Removed original monolithic file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
jdx
added a commit
that referenced
this pull request
Jan 20, 2026
## 🤖 New release * `pitchfork-cli`: 1.1.0 -> 1.2.0 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [1.2.0](v1.1.0...v1.2.0) - 2026-01-19 ### Added - enhance miette error diagnostics with source highlighting and URLs ([#183](#183)) - add structured IPC error types with miette diagnostics ([#181](#181)) - add structured config error types with file path context ([#182](#182)) - add config editor to TUI for creating and editing daemons ([#171](#171)) - add custom diagnostic error types with miette ([#180](#180)) ### Other - improve miette error handling adoption ([#177](#177)) - modularize supervisor.rs into focused submodules ([#175](#175)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Release 1.2.0** > > - Bump version to `1.2.0` in `Cargo.toml`, `Cargo.lock`, `docs/cli/commands.json`, `docs/cli/index.md`, and `pitchfork.usage.kdl` > - Regenerate CLI docs/usage specs to reflect the new version > - Update `CHANGELOG.md` with highlights: enhanced `miette` diagnostics (source highlighting, URLs), structured IPC/config error types, custom diagnostic errors, TUI config editor; plus adoption improvements and supervisor modularization > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 32b3259. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.
Summary
supervisor.rsinto asupervisor/directory with focused modulesNew Module Structure
mod.rsstate.rslifecycle.rsrun(),run_once(),stop()- process spawning and monitoringautostop.rsretry.rswatchers.rsipc_handlers.rsTest plan
cargo nextest run)cargo clippy --all-targets --all-features -- -D warnings)cargo fmt --check)🤖 Generated with Claude Code
Note
Reorganizes the supervisor into cohesive modules for clarity and maintainability with no behavioral changes.
supervisor/mod.rsto wire startup, signals, refresh, IPC server, and shared statestate.rs(re-exportsUpsertDaemonOpts)run,run_once,stop) and regex cache tolifecycle.rsautostop.rsretry.rsand cron/interval/file watchers inwatchers.rsipc_handlers.rssrc/supervisor.rsand maintains the same public API surfaceWritten by Cursor Bugbot for commit dfa78c9. This will update automatically on new commits. Configure here.