Skip to content

refactor: decompose git/operations.rs into focused modules#376

Merged
Wirasm merged 1 commit into
mainfrom
kild/331-decompose-git-ops
Feb 11, 2026
Merged

refactor: decompose git/operations.rs into focused modules#376
Wirasm merged 1 commit into
mainfrom
kild/331-decompose-git-ops

Conversation

@Wirasm

@Wirasm Wirasm commented Feb 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Split the 2,280-line git/operations.rs into 5 focused files by responsibility: naming.rs, validation.rs, status.rs, health.rs, overlaps.rs
  • Updated mod.rs with re-exports for cleaner caller paths (crate::git::kild_branch_name instead of crate::git::operations::kild_branch_name)
  • Migrated all 22 affected files across kild-core and kild crates — zero references to git::operations remain

Pure code movement refactor. No behavioral changes; all tests pass with identical assertions.

Closes #331

Test plan

  • cargo fmt --check passes
  • cargo clippy --all -- -D warnings passes (0 warnings)
  • cargo test --all passes (782 kild-core tests, all crates green)
  • cargo build --all succeeds
  • grep -r "git::operations" crates/ returns nothing

@Wirasm

Wirasm commented Feb 11, 2026

Copy link
Copy Markdown
Owner Author

PR Review Summary

Critical Issues (0 found)

None.

Important Issues (0 found)

None.

Suggestions (0 found)

None.

Strengths

  • Excellent separation of concerns — each module has a single, clear responsibility
  • Proper visibility controls (pub(super) for internal helpers)
  • Conservative error handling with graceful degradation
  • Consistent structured logging following project conventions
  • Comprehensive test coverage across all 5 new modules (65+ tests)
  • All 22 affected files migrated cleanly with zero lingering git::operations references
  • Re-exports from git/mod.rs maintain ergonomic import paths

Documentation Updates

None needed — all docs reference the git/ module at the right abstraction level (purpose, not internal structure).

Verdict

READY TO MERGE

Clean refactoring that improves maintainability without behavioral changes. All validations pass (fmt, clippy, test, build).

Split the 2,280-line operations.rs into 5 files by responsibility:
- naming.rs: path sanitization, branch names, project ID generation
- validation.rs: branch/arg validation, git directory checks
- status.rs: diff stats, worktree status, git stats aggregation
- health.rs: branch health metrics with pub(super) shared helpers
- overlaps.rs: file overlap detection across kilds

Updated mod.rs with re-exports so callers use cleaner paths
(e.g. crate::git::kild_branch_name instead of
crate::git::operations::kild_branch_name). Tests moved with
their code, no behavioral changes.
@Wirasm Wirasm force-pushed the kild/331-decompose-git-ops branch from 694dbe2 to 6f357b8 Compare February 11, 2026 11:30
@Wirasm Wirasm merged commit 959ebf8 into main Feb 11, 2026
1 check 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.

refactor: decompose git/operations.rs (2,279 lines)

1 participant