Skip to content

refactor: consolidate parameter passing with structs - #160

Merged
raphi011 merged 1 commit into
mainfrom
many-params
Mar 31, 2026
Merged

raphi011 merged 1 commit into
mainfrom
many-params

Conversation

@raphi011

Copy link
Copy Markdown
Owner

Reduce long parameter lists across checkout, prune, and hook commands by introducing structs that group related parameters.

Breaking Changes

  • None

Test Coverage

  • Unit tests added: 0 (updated existing hooks tests for new HookSelector/PhaseType API)
  • Integration tests added: 0 (existing 45+ integration tests cover all refactored paths)

🤖 Generated with Claude Code

Reduce long parameter lists across checkout, prune, and hook commands:

- hookFlags struct bundles --hook/--no-hook/--arg CLI flags (replaces 3-param triplet across ~10 signatures)
- checkoutOpts struct bundles checkout options (reduces checkoutInRepo from 13 to 3 params)
- HookSelector struct bundles command/action/phase for SelectHooks (replaces positional strings)
- Extract checkoutInRepo into focused helpers: autoStashChanges, fetchForCheckout, createWorktreeForBranch, setUpstreamTracking, preserveWorktreeFiles
- Type Phase as PhaseType for compile-time safety
- Rename hookFlags.Env to RawArgs for clarity
- Fix double fetch resolution (global for routing, per-repo for execution)
- Add cross-reference comments between HookSelector and ParsedTrigger

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.47059% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/wt/checkout_cmd.go 72.99% 25 Missing and 12 partials ⚠️
cmd/wt/pr_cmd.go 75.00% 2 Missing ⚠️
cmd/wt/prune_cmd.go 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@raphi011
raphi011 merged commit 42f86f9 into main Mar 31, 2026
1 of 2 checks passed
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