refactor(commands): split setup.rs into setup/ submodules (T-SP-2 #8)#235
Merged
Destynova2 merged 1 commit intomainfrom Apr 20, 2026
Merged
refactor(commands): split setup.rs into setup/ submodules (T-SP-2 #8)#235Destynova2 merged 1 commit intomainfrom
Destynova2 merged 1 commit intomainfrom
Conversation
…-SP-2 #8) Decomposes the god-file `src/commands/setup.rs` into a cohesive `src/commands/setup/` directory with behavior-preserving submodules: - mod.rs (294) — run_setup_wizard + run_edit_section orchestration - types.rs (190) — shared structs/enums/constants - input.rs (128) — TTY input primitives - detect.rs (217) — env, config, preset discovery - writer.rs (474) — TOML mutations + atomic writes + tests - output.rs (269) — recap, status, chain_doctor, chain_auto_flow - screens/{tools,auth,fallback,compliance,budget,endpoints}.rs (45-163) Public API unchanged: `pub async fn run_setup_wizard` and `pub struct SetupFlags` keep the same signatures. `strip_fallback` was `pub(crate)` with no external callers — now private to `writer.rs`. Snapshot relocated to `src/commands/setup/snapshots/` and its test path updated to match the new `writer::tests` module. All 11 setup tests pass; no behavior change.
17c97af to
6e2cd41
Compare
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
Decomposes the 1877-LOC god-file
src/commands/setup.rsinto a cohesivesrc/commands/setup/directory with behavior-preserving submodules. Audit 2026-04-20 item #8.mod.rs(294) —run_setup_wizard+run_edit_sectionorchestrationtypes.rs(190) — shared structs, enums, constantsinput.rs(128) — TTY input primitivesdetect.rs(217) — env / config / preset discoverywriter.rs(474) — TOML mutations + atomic writes + snapshot testoutput.rs(269) — recap, status, chain_doctor, chain_auto_flowscreens/{tools,auth,fallback,compliance,budget,endpoints}.rs(36-163) — per-screen interactionPublic API unchanged:
pub async fn run_setup_wizard(&Path, &SetupFlags)andpub struct SetupFlagskeep the same signatures. Caller insrc/main.rs:70,75requires no change.strip_fallbackwaspub(crate)with no external callers — now private towriter.rs.Snapshot file moved to
src/commands/setup/snapshots/and its test path updated to match the newwriter::testsmodule.Test plan
cargo buildpassescargo clippy --all-targets -- -D warningscleancargo test --lib— 949 passed, 0 failed (11 setup-specific tests all pass)cargo check --no-default-featurescleancargo fmt --all -- --checkclean