Skip to content

refactor(commands): split setup.rs into setup/ submodules (T-SP-2 #8)#235

Merged
Destynova2 merged 1 commit intomainfrom
refactor/setup-split-sp2
Apr 20, 2026
Merged

refactor(commands): split setup.rs into setup/ submodules (T-SP-2 #8)#235
Destynova2 merged 1 commit intomainfrom
refactor/setup-split-sp2

Conversation

@Destynova2
Copy link
Copy Markdown
Contributor

Summary

Decomposes the 1877-LOC god-file src/commands/setup.rs into a cohesive src/commands/setup/ directory with behavior-preserving submodules. Audit 2026-04-20 item #8.

  • 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 + snapshot test
  • output.rs (269) — recap, status, chain_doctor, chain_auto_flow
  • screens/{tools,auth,fallback,compliance,budget,endpoints}.rs (36-163) — per-screen interaction

Public API unchanged: pub async fn run_setup_wizard(&Path, &SetupFlags) and pub struct SetupFlags keep the same signatures. Caller in src/main.rs:70,75 requires no change.

strip_fallback was pub(crate) with no external callers — now private to writer.rs.

Snapshot file moved to src/commands/setup/snapshots/ and its test path updated to match the new writer::tests module.

Test plan

  • cargo build passes
  • cargo clippy --all-targets -- -D warnings clean
  • cargo test --lib — 949 passed, 0 failed (11 setup-specific tests all pass)
  • cargo check --no-default-features clean
  • cargo fmt --all -- --check clean
  • No single submodule exceeds 500 LoC
  • CI gates green

@Destynova2 Destynova2 enabled auto-merge April 20, 2026 19:02
…-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.
@Destynova2 Destynova2 force-pushed the refactor/setup-split-sp2 branch from 17c97af to 6e2cd41 Compare April 20, 2026 20:27
@Destynova2 Destynova2 merged commit 00deaa3 into main Apr 20, 2026
43 checks passed
@Destynova2 Destynova2 deleted the refactor/setup-split-sp2 branch April 20, 2026 20:34
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.

1 participant