Skip to content

Add dev-cache-cleaner extension#27117

Open
gfazioli wants to merge 2 commits intoraycast:mainfrom
gfazioli:ext/dev-cache-cleaner
Open

Add dev-cache-cleaner extension#27117
gfazioli wants to merge 2 commits intoraycast:mainfrom
gfazioli:ext/dev-cache-cleaner

Conversation

@gfazioli
Copy link
Copy Markdown
Contributor

@gfazioli gfazioli commented Apr 12, 2026

Description

Dev Cache Cleaner — Scan and clean developer caches, build artifacts, and orphaned dependencies to reclaim disk space. No external tools required — works out of the box.

Commands

  • Scan Caches — Full scan with dashboard showing reclaimable space by category, clean selectively or all at once
  • Clean Safe Caches — Scan and instantly clean all safe caches with one click (with confirmation dialog)
  • Cache Status — Menu bar showing total reclaimable space with cached results for instant access

What It Scans (6 categories)

  • Package Manager Caches — npm, Yarn, pnpm, Homebrew, CocoaPods, pip, Composer
  • Build Artifacts & Dependencies — 22 types including node_modules, .next, .nuxt, .turbo, venv, Pods, DerivedData, target, dist, build, and more (only flags artifacts older than 30 days)
  • Xcode & iOS — DerivedData, Archives, Device Support, Simulators (via xcrun)
  • Docker — images, containers, volumes, build cache (via docker CLI)
  • Language Caches — Gradle, Maven, Cargo, Go, Ruby
  • System Caches & Logs — user logs, top application caches

Safety

  • Every item classified as Safe (green) or Review (orange)
  • Safe items are pure caches that tools re-download automatically
  • Review items (Xcode Archives, Docker volumes, app caches) always require explicit confirmation
  • Clean Safe Caches shows a confirmation dialog listing all items before any deletion
  • Uses tool-specific commands where needed (npm, brew, docker, xcrun, pnpm, go) instead of blind rm -rf
  • Never touches source code, documents, personal files, configs, or system files

Screencast

Scan Caches Detail Panel
scan detail
Build Artifacts Confirmation Dialog
artifacts confirm
Menu Bar
menu

Checklist

@raycastbot raycastbot added new extension Label for PRs with new extensions platform: macOS labels Apr 12, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@gfazioli gfazioli marked this pull request as ready for review April 13, 2026 04:59
Copilot AI review requested due to automatic review settings April 13, 2026 04:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Raycast extension (“Dev Cache Cleaner”) to scan developer-related caches/artifacts and optionally clean them, including a menu bar status command.

Changes:

  • Introduces scanners for multiple cache categories (package managers, build artifacts, Xcode, Docker, language caches, system caches).
  • Adds UI commands for interactive scanning/cleaning and a menu bar indicator with cached results.
  • Adds extension configuration, types, utilities, and documentation/metadata.

Reviewed changes

Copilot reviewed 22 out of 29 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
extensions/dev-cache-cleaner/package.json Defines the Raycast extension, commands, and preferences.
extensions/dev-cache-cleaner/tsconfig.json TypeScript compilation settings for the extension.
extensions/dev-cache-cleaner/eslint.config.js ESLint configuration for consistent linting.
extensions/dev-cache-cleaner/.prettierrc Prettier formatting rules for the extension.
extensions/dev-cache-cleaner/.gitignore Ignores build/runtime artifacts and dependencies.
extensions/dev-cache-cleaner/README.md User-facing documentation for safety, commands, and scanned locations.
extensions/dev-cache-cleaner/CHANGELOG.md Changelog for the extension release history.
extensions/dev-cache-cleaner/src/types/index.ts Core types for scan results, categories, and risk levels.
extensions/dev-cache-cleaner/src/utils/disk.ts Disk/tool helpers (sizes, age formatting, tool availability).
extensions/dev-cache-cleaner/src/utils/format.ts Builds detail markdown shown in the list detail panel.
extensions/dev-cache-cleaner/src/utils/cleaner.ts Implements cleaning actions for scan results.
extensions/dev-cache-cleaner/src/utils/cache-store.ts Persists/retrieves scan results for fast menu bar rendering.
extensions/dev-cache-cleaner/src/scanners/index.ts Orchestrates calling all scanners with progress updates.
extensions/dev-cache-cleaner/src/scanners/package-caches.ts Scans common package manager caches (npm/Yarn/pnpm/brew/etc.).
extensions/dev-cache-cleaner/src/scanners/project-artifacts.ts Scans project directories for older build artifacts (find-based).
extensions/dev-cache-cleaner/src/scanners/xcode.ts Scans Xcode/iOS related directories and simulator cleanup.
extensions/dev-cache-cleaner/src/scanners/docker.ts Scans Docker reclaimable space via docker CLI.
extensions/dev-cache-cleaner/src/scanners/language-caches.ts Scans caches for Gradle/Maven/Cargo/Go/Ruby.
extensions/dev-cache-cleaner/src/scanners/system.ts Scans user logs and large app caches under ~/Library/Caches.
extensions/dev-cache-cleaner/src/scan-caches.tsx Main interactive UI for scanning, filtering, and per-item cleaning.
extensions/dev-cache-cleaner/src/clean-safe-caches.ts One-shot command to clean all “safe” items after confirmation.
extensions/dev-cache-cleaner/src/menu-bar.tsx Menu bar command showing reclaimable space and quick actions.

Comment thread extensions/dev-cache-cleaner/src/utils/disk.ts Outdated
Comment thread extensions/dev-cache-cleaner/src/utils/cleaner.ts Outdated
Comment thread extensions/dev-cache-cleaner/src/scanners/xcode.ts
Comment thread extensions/dev-cache-cleaner/src/utils/cache-store.ts Outdated
Comment thread extensions/dev-cache-cleaner/src/scan-caches.tsx Outdated
Comment thread extensions/dev-cache-cleaner/src/scanners/package-caches.ts
Comment thread extensions/dev-cache-cleaner/src/scanners/system.ts Outdated
Comment thread extensions/dev-cache-cleaner/CHANGELOG.md
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR adds a new Dev Cache Cleaner extension that scans and cleans developer caches, build artifacts, and language caches across 6 categories. The extension is well-structured with appropriate safety guards (risk levels, confirmation dialogs, tool-specific clean commands), but has one P1 bug that needs fixing before merge:

  • Duplicate entries with conflicting risk labels: scanSystem() iterates all of ~/Library/Caches without excluding the subdirectories already covered by scanPackageCaches(). Yarn, Homebrew, CocoaPods, pip, and Composer caches each appear twice — once as safe and once as moderate — which confuses users and can cause incorrect freed-space accounting.

Confidence Score: 4/5

Safe to merge after fixing the duplicate-entry bug in system.ts; all other findings are P2 style/rule issues.

One P1 bug (duplicate scan results with conflicting risk levels) needs to be resolved before merge. The remaining findings are rule-compliance issues (unused dependency, manual preference typing, rm vs trash) that don't block functionality but should be addressed per repo standards.

extensions/dev-cache-cleaner/src/scanners/system.ts — needs SKIP_ENTRIES guard to avoid re-scanning paths already covered by scanPackageCaches

Important Files Changed

Filename Overview
extensions/dev-cache-cleaner/src/scanners/system.ts Scans ~/Library/Caches without excluding paths already covered by scanPackageCaches, creating duplicate entries with conflicting risk levels for Yarn, Homebrew, CocoaPods, pip, and Composer.
extensions/dev-cache-cleaner/src/clean-safe-caches.ts Confirmation dialog shows items filtered without the available flag, so the promised size/count may exceed what cleanAllSafe actually frees.
extensions/dev-cache-cleaner/src/scanners/project-artifacts.ts getPreferenceValues is manually typed inline instead of using the auto-generated Preferences type from raycast-env.d.ts.
extensions/dev-cache-cleaner/package.json @raycast/utils is listed as a runtime dependency but is never imported in any source file.
extensions/dev-cache-cleaner/src/utils/cleaner.ts Uses execFileSync (synchronous, blocks event loop) and rm -rf instead of Raycast's trash() API; otherwise clean delegation logic is well-structured.
extensions/dev-cache-cleaner/src/scan-caches.tsx Main view with grouped listing, filter dropdown, detail panel, and per-item clean actions; well-structured with good confirmation guards for moderate-risk items.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/dev-cache-cleaner/src/scanners/system.ts
Line: 37-65

Comment:
**Duplicate entries with conflicting risk levels**

`scanSystem()` iterates all of `~/Library/Caches` without excluding the subdirectories already scanned by `scanPackageCaches()`. Yarn (`~/Library/Caches/Yarn`), Homebrew (`~/Library/Caches/Homebrew`), CocoaPods (`~/Library/Caches/CocoaPods`), pip (`~/Library/Caches/pip`), and Composer (`~/Library/Caches/composer`) will each appear twice in the results — once as `risk: "safe"` under "Package Manager Caches" and once as `risk: "moderate"` under "System Caches & Logs". The second entry's moderate classification contradicts the first's safe one, and if a user cleans both the freed-bytes accounting will be wrong.

Add the known package-cache folder names to a skip set so those entries are emitted exactly once:

```suggestion
/** System cache prefixes to skip (Apple-managed, regenerate quickly) */
const SKIP_PREFIXES = ["com.apple.", "CloudKit", "SiriTTS"];

/** Cache subdirectories already handled by scanPackageCaches — skip to avoid duplicates */
const SKIP_ENTRIES = new Set(["Yarn", "Homebrew", "CocoaPods", "pip", "composer"]);
```

Then in the loop:
```ts
if (SKIP_PREFIXES.some((prefix) => entry.startsWith(prefix))) continue;
if (SKIP_ENTRIES.has(entry)) continue;
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/dev-cache-cleaner/package.json
Line: 76

Comment:
**Unused `@raycast/utils` dependency**

`@raycast/utils` is listed as a runtime dependency but is never imported in any source file under `src/`. Remove it to keep the bundle lean.

```suggestion
    "@raycast/api": "^1.104.12"
```

**Rule Used:** What: Every dependency listed in package.json must... ([source](https://app.greptile.com/review/custom-context?memory=bffc60eb-f9f2-4219-b804-76e29e267d43))

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/dev-cache-cleaner/src/scanners/project-artifacts.ts
Line: 60

Comment:
**Manually typed `getPreferenceValues` call**

Preference types are auto-generated in `raycast-env.d.ts` — inline type annotations like `<{ projectPaths?: string; minAgeDays?: string }>` can go out of sync with `package.json` and create maintenance overhead.

```suggestion
  const prefs = getPreferenceValues<Preferences>();
```

**Rule Used:** What: Don't manually type `getPreferenceValues()` ... ([source](https://app.greptile.com/review/custom-context?memory=61aa4fa9-b8e8-41b4-8b27-f888b95b75af))

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/dev-cache-cleaner/src/utils/cleaner.ts
Line: 16-20

Comment:
**`rm -rf` instead of Raycast's `trash()` API**

The project guidelines prefer `trash()` from `@raycast/api` over shelling out to `rm`. For a cache cleaner, permanently deleting (rather than trashing) may be intentional since trashing large directories doesn't immediately free space, but the convention in this repo is to use `trash()`. If permanent deletion is required, at minimum document the rationale in a comment here so the pattern is clearly intentional and not an oversight.

**Rule Used:** What: Use Raycast's built-in `trash()` method inst... ([source](https://app.greptile.com/review/custom-context?memory=5c4ec1d2-9af4-490f-becf-e0030e4ba525))

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/dev-cache-cleaner/src/clean-safe-caches.ts
Line: 14-53

Comment:
**Confirmation dialog count/size overstates what will actually be cleaned**

`safeResults` is built with `r.risk === "safe" && r.size > 0`, but `cleanAllSafe` (called on line 51) additionally requires `result.available`. If any safe item has `available: false` (e.g., the npm cache directory exists but `npm` is not in `$PATH`), the confirmation dialog promises to free more bytes across more items than will actually be cleaned. Consider applying the same `available` filter when building `safeResults`:

```suggestion
    const safeResults = results.filter((r) => r.risk === "safe" && r.available && r.size > 0);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Initial release of Dev Cache Cleaner ext..." | Re-trigger Greptile

Comment thread extensions/dev-cache-cleaner/src/scanners/system.ts
Comment thread extensions/dev-cache-cleaner/package.json
Comment thread extensions/dev-cache-cleaner/src/scanners/project-artifacts.ts Outdated
Comment thread extensions/dev-cache-cleaner/src/utils/cleaner.ts
Comment thread extensions/dev-cache-cleaner/src/clean-safe-caches.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants