Skip to content

refactor(devtools): modularize by package manager#21

Merged
Sstark97 merged 1 commit intomainfrom
feature/issue-9-modularize-devtools
Feb 3, 2026
Merged

refactor(devtools): modularize by package manager#21
Sstark97 merged 1 commit intomainfrom
feature/issue-9-modularize-devtools

Conversation

@Sstark97
Copy link
Owner

@Sstark97 Sstark97 commented Feb 3, 2026

Summary

Split devtools.sh (598 lines) into isolated modules per package manager, following Single Responsibility Principle. Each module is independently sourceable and testable. devtools.sh now acts as a lightweight orchestrator.

Changes

  • New modules in src/modules/package-managers/:
    • maven.sh — Maven cache cleanup
    • gradle.sh — Gradle cache cleanup (outdated versions + complete)
    • node.sh — Node.js caches (npm, yarn, pnpm) + NVM
    • python.sh — Python caches (pip, poetry)
    • sdkman.sh — SDKMAN temp files
  • devtools.sh reduced to orchestrator: sources all modules, exposes devtools_clean() as the single entry point
  • Removed dead code: unused helper functions (get_npm_cache_info, get_yarn_cache_info, get_pnpm_cache_info, get_pip_cache_info, get_poetry_cache_info) and unused constant NODE_CACHE_SIZE_THRESHOLD_MB

What stays the same

  • External API (devtools_clean()) unchanged — no impact on bin/devsweep or menu.sh
  • Cleanup execution order preserved: Maven → Gradle → Node.js → NVM → SDKMAN → Python
  • All three modes respected per module: normal, dry-run, analyze
  • Double-source guards on every module

Test results

All 126 tests passing (115 unit + 11 e2e), including all existing devtools_test.sh and analyze_mode_test.sh tests without modifications.

Closes #9

New structure:
  src/modules/package-managers/
    maven.sh   - Maven cache cleanup
    gradle.sh  - Gradle cache cleanup (outdated + complete)
    node.sh    - Node.js caches (npm, yarn, pnpm) + NVM
    python.sh  - Python caches (pip, poetry)
    sdkman.sh  - SDKMAN temp files

devtools.sh now acts as orchestrator: sources all modules and exposes
devtools_clean() as the single entry point. External API unchanged.

Closes #9
@Sstark97 Sstark97 merged commit c8d98ae into main Feb 3, 2026
2 checks passed
@Sstark97 Sstark97 deleted the feature/issue-9-modularize-devtools branch February 3, 2026 21:30
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: Modularize devtools.sh by package manager

1 participant