Skip to content

feat(scanner): register global cache prune commands as vendor cleanups - #27

Merged
ohing504 merged 1 commit into
mainfrom
feat/vendor-cleanup-expansion
Jul 18, 2026
Merged

feat(scanner): register global cache prune commands as vendor cleanups#27
ohing504 merged 1 commit into
mainfrom
feat/vendor-cleanup-expansion

Conversation

@ohing504

Copy link
Copy Markdown
Owner

Summary

Implements #20 — the global scanner now offers each package manager's native cache-prune command through clean --vendor-cleanup, building on the DeleteMethod/VendorCleanup contract from #16.

  • 6 commands registered (all non-destructive — regenerable caches only): brew cleanup -s, npm cache clean --force, yarn cache clean, pnpm store prune, pip cache purge, uv cache prune
  • Uninstalled tools are skipped via PATH lookup, so only installed managers are offered; pip falls back to pip3 when pip isn't on PATH
  • LookPath injectable field (mirrors the existing ProcessRunning stub) keeps the test deterministic regardless of what's installed on CI
  • No CLI changesrunVendorCleanups already collects any VendorCleaner generically, so the global scanner flows through the existing wiring

The destructive-command gate (--include-destructive for docker system prune) is deferred to #17, where an actual destructive command lands.

Scope note

All global caches share one global ecosystem, so --vendor-cleanup runs every installed manager's prune together; individual tools can't be targeted separately. Documented in commands.md.

Test plan

  • TestGlobalScanner_VendorCleanups stubs LookPath (brew + pip3 installed) → asserts exactly those two, the pip3 fallback surfaces in Display, and uninstalled tools are absent
  • go test ./... green; golangci-lint run 0 issues; golden testdata unchanged (VendorCleanups is not serialized)
  • manual clean --eco global --vendor-cleanup --dry-run --yes: yarn (uninstalled) correctly omitted, pip shown as pip3 cache purge

Closes #20

🤖 Generated with Claude Code

https://claude.ai/code/session_013SX3vRs78zFYA2kTRZAtg6

Add VendorCleanups to the global scanner so `clean --vendor-cleanup`
runs each package manager's native cache prune alongside path deletion.

- brew cleanup -s, npm/yarn cache clean, pnpm store prune, pip/uv cache
  prune — all non-destructive (regenerable caches only)
- tools absent from PATH are skipped, so only installed managers run;
  pip falls back to pip3 when pip is not on PATH
- LookPath is an injectable field (mirrors ProcessRunning) for
  deterministic tests

The destructive-command gate (docker system prune) is deferred to #17.

Closes #20

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013SX3vRs78zFYA2kTRZAtg6
@ohing504
ohing504 merged commit 6b753db into main Jul 18, 2026
3 checks passed
@ohing504
ohing504 deleted the feat/vendor-cleanup-expansion branch July 18, 2026 04: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.

Vendor cleanup 확장 (brew/npm/yarn/pnpm/pip/uv)

1 participant