cleanix-cli 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. cleanix_cli-1.2.0/MANIFEST.in +4 -0
  2. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/PKG-INFO +59 -4
  3. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/README.md +58 -3
  4. cleanix_cli-1.2.0/RELEASING.md +64 -0
  5. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/__init__.py +1 -1
  6. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/__init__.py +16 -0
  7. cleanix_cli-1.2.0/cleanix/cleaners/big_files.py +83 -0
  8. cleanix_cli-1.2.0/cleanix/cleaners/browser_profiles.py +319 -0
  9. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/bsd.py +16 -10
  10. cleanix_cli-1.2.0/cleanix/cleaners/containerd.py +82 -0
  11. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/containers.py +36 -7
  12. cleanix_cli-1.2.0/cleanix/cleaners/downloads.py +91 -0
  13. cleanix_cli-1.2.0/cleanix/cleaners/duplicates.py +164 -0
  14. cleanix_cli-1.2.0/cleanix/cleaners/project_cruft.py +185 -0
  15. cleanix_cli-1.2.0/cleanix/cleaners/toolchains.py +149 -0
  16. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cli.py +354 -8
  17. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/config.py +46 -2
  18. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/history.py +36 -3
  19. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/report.py +23 -0
  20. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/safety.py +60 -15
  21. cleanix_cli-1.2.0/cleanix/scheduler/__init__.py +34 -0
  22. cleanix_cli-1.2.0/cleanix/scheduler/cron.py +137 -0
  23. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/scheduler/launchd.py +1 -1
  24. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/scheduler/systemd.py +6 -2
  25. cleanix_cli-1.2.0/cleanix.1 +202 -0
  26. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix_cli.egg-info/PKG-INFO +59 -4
  27. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix_cli.egg-info/SOURCES.txt +17 -0
  28. cleanix_cli-1.2.0/packaging/README.md +49 -0
  29. cleanix_cli-1.2.0/packaging/aur/PKGBUILD +40 -0
  30. cleanix_cli-1.2.0/packaging/homebrew/cleanix.rb +45 -0
  31. cleanix_cli-1.2.0/packaging/rpm/cleanix-cli.spec +56 -0
  32. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/pyproject.toml +1 -1
  33. cleanix_cli-1.2.0/requirements.txt +2 -0
  34. cleanix_cli-1.2.0/scripts/gen_manpage.py +105 -0
  35. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/tests/test_cleanix.py +386 -7
  36. cleanix_cli-1.1.0/cleanix/scheduler/__init__.py +0 -22
  37. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/__main__.py +0 -0
  38. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/ai_cli.py +0 -0
  39. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/ai_tools.py +0 -0
  40. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/app_cruft.py +0 -0
  41. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/apple_litter.py +0 -0
  42. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/apps.py +0 -0
  43. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/apt.py +0 -0
  44. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/base.py +0 -0
  45. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/broken_symlinks.py +0 -0
  46. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/browsers.py +0 -0
  47. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/coredumps.py +0 -0
  48. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/desktop_extras.py +0 -0
  49. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/dev_caches.py +0 -0
  50. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/distro_pkg.py +0 -0
  51. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/dnf.py +0 -0
  52. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/editor_litter.py +0 -0
  53. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/font_cache.py +0 -0
  54. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/ide.py +0 -0
  55. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/kernels.py +0 -0
  56. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/lang_caches.py +0 -0
  57. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/linux_extras.py +0 -0
  58. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/localizations.py +0 -0
  59. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/logs.py +0 -0
  60. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/macos.py +0 -0
  61. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/macos_extra.py +0 -0
  62. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/memory.py +0 -0
  63. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/more_pkg.py +0 -0
  64. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/npm_cache.py +0 -0
  65. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/packaging_extras.py +0 -0
  66. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/pacman.py +0 -0
  67. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/pip_cache.py +0 -0
  68. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/snapshots.py +0 -0
  69. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/sys_extras.py +0 -0
  70. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/temp_files.py +0 -0
  71. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/thumbnails.py +0 -0
  72. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/trash.py +0 -0
  73. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/user_cache.py +0 -0
  74. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/cleaners/virtualization.py +0 -0
  75. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/completion.py +0 -0
  76. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/__init__.py +0 -0
  77. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/context.py +0 -0
  78. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/engine.py +0 -0
  79. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/models.py +0 -0
  80. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/platform.py +0 -0
  81. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/quarantine.py +0 -0
  82. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/registry.py +0 -0
  83. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/core/utils.py +0 -0
  84. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix/reset.py +0 -0
  85. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix_cli.egg-info/dependency_links.txt +0 -0
  86. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix_cli.egg-info/entry_points.txt +0 -0
  87. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix_cli.egg-info/requires.txt +0 -0
  88. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/cleanix_cli.egg-info/top_level.txt +0 -0
  89. {cleanix_cli-1.1.0 → cleanix_cli-1.2.0}/setup.cfg +0 -0
@@ -0,0 +1,4 @@
1
+ include README.md RELEASING.md LICENSE requirements.txt
2
+ include cleanix.1
3
+ recursive-include packaging *
4
+ include scripts/gen_manpage.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cleanix-cli
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: A safe, thorough scheduled system cleaner for every *nix (Linux, macOS, BSD).
5
5
  Author: cleanix-cli contributors
6
6
  License: MIT
@@ -123,7 +123,61 @@ last day is always left alone, so cleaning never disturbs a live agent session.
123
123
  Cleaners never offer the same path twice: dedicated cleaners own their
124
124
  directories and the generic `~/.cache` catch-all defers to them.
125
125
 
126
- ## Container leftovers (Docker / Podman)
126
+ ## More reclamation & review
127
+
128
+ - **Old toolchain versions** (`toolchains`). Version managers hoard
129
+ multi-gigabyte installed runtimes — old `~/.nvm` node builds, `~/.pyenv` /
130
+ `~/.rbenv` versions, `rustup` toolchains, SDKMAN candidates, `asdf` installs.
131
+ Cleanix keeps the **active** version (always protected) plus the newest
132
+ `keep_toolchain_versions` (default 2) and offers the rest for removal. It
133
+ *skips a manager entirely if it can't prove which version is active* — pair
134
+ with `clean --quarantine` to make removals reversible. Disable with
135
+ `prune_old_toolchains: false`.
136
+ - **Stale project cruft** (`project_cruft`, report-only). Finds regenerable
137
+ `node_modules` / `.venv` / `target` / `.gradle` dirs in projects under
138
+ `project_scan_dirs` you haven't touched in `project_stale_days` (default 120).
139
+ - **Large files** (`big_files`, report-only). The biggest files in `$HOME`, so
140
+ you can see what filled the disk. Never deletes — just a sized list + `rm` hint.
141
+ - **Duplicate files** (`duplicates`, report-only). Identical large files (same
142
+ size + SHA-256) grouped with the space reclaimable by keeping one copy.
143
+ - **Stale downloads** (`downloads`, report-only). Old, large installers/ISOs in
144
+ `~/Downloads` (which stays hard-protected from deletion).
145
+ - **Orphaned browser profiles** (`browser_profiles`, report-only). Secondary
146
+ Chrome/Chromium/Firefox profiles idle for `browser_profile_stale_days`, with a
147
+ clear warning that a profile holds bookmarks/passwords/history.
148
+
149
+ ## Working with what a scan finds
150
+
151
+ - `cleanix explain <id>` — read-only, shows the **exact** paths/commands one
152
+ cleaner would consider (with size, root, delete-vs-report), for building trust.
153
+ - `cleanix clean --interactive` — pick individual items from a checklist before
154
+ removing (selection is per-item, not just per-cleaner).
155
+ - `cleanix clean --simulate` — write the exact target list to a file, delete
156
+ nothing (stronger than the dry-run summary).
157
+ - `cleanix clean --execute` — writes a **per-file audit manifest** to
158
+ `~/.local/state/cleanix/runs/` and prints the real `df` free-space change.
159
+ - `--profile safe|balanced|aggressive` — one flag to bundle the opt-in settings
160
+ (aggressive enables offline-repo/backup/locale/all-image pruning; it never
161
+ bundles volume removal).
162
+ - `--min-size 100M` — ignore items below a threshold to cut table noise.
163
+ - `cleanix scan --json` emits a **versioned** schema (`schema_version`, host,
164
+ os, `cleanable_bytes` vs `report_only_bytes`) for CI/tooling.
165
+ - `cleanix dashboard` — lifetime reclaim trend (sparkline) plus the last
166
+ scheduled scan's top sources, at a glance.
167
+
168
+ ## Install & packaging
169
+
170
+ - **PyPI:** `pip install cleanix-cli` (or `pipx install cleanix-cli`).
171
+ - **Standalone binaries** are attached to each [GitHub Release] alongside a
172
+ `SHA256SUMS` file and keyless **build-provenance attestations** — verify a
173
+ download with `gh attestation verify <file> --repo CloudOpsWorld/cleanix-cli`.
174
+ - **Homebrew / AUR / Fedora** packaging lives under [`packaging/`](packaging/),
175
+ along with a `cleanix.1` **man page** generated from the CLI
176
+ (`python scripts/gen_manpage.py`).
177
+
178
+ [GitHub Release]: https://github.com/CloudOpsWorld/cleanix-cli/releases
179
+
180
+ ## Container leftovers (Docker / Podman / nerdctl / crictl)
127
181
 
128
182
  A *leftover* is anything the engine keeps that **no existing container
129
183
  references** and can be regenerated. Each category is surfaced as its own item
@@ -223,8 +277,9 @@ sudo cleanix clean --only memory_macos --execute # macOS `purge`
223
277
  - **Root-aware.** Cleaners that need root are clearly flagged and skipped (with a
224
278
  note) when you run unprivileged.
225
279
  - **Scheduling.** Install a periodic read-only scan that reports (and notifies)
226
- on a daily/weekly/monthly cadence — a **systemd user timer** on Linux/BSD, a
227
- **launchd LaunchAgent** on macOS. Same `cleanix schedule` command on both.
280
+ on a daily/weekly/monthly cadence — a **systemd user timer** on Linux, a
281
+ **launchd LaunchAgent** on macOS, and a **cron job** on the BSDs (or any
282
+ system with `crontab` but no systemd). Same `cleanix schedule` command on all.
228
283
 
229
284
  ## Install
230
285
 
@@ -88,7 +88,61 @@ last day is always left alone, so cleaning never disturbs a live agent session.
88
88
  Cleaners never offer the same path twice: dedicated cleaners own their
89
89
  directories and the generic `~/.cache` catch-all defers to them.
90
90
 
91
- ## Container leftovers (Docker / Podman)
91
+ ## More reclamation & review
92
+
93
+ - **Old toolchain versions** (`toolchains`). Version managers hoard
94
+ multi-gigabyte installed runtimes — old `~/.nvm` node builds, `~/.pyenv` /
95
+ `~/.rbenv` versions, `rustup` toolchains, SDKMAN candidates, `asdf` installs.
96
+ Cleanix keeps the **active** version (always protected) plus the newest
97
+ `keep_toolchain_versions` (default 2) and offers the rest for removal. It
98
+ *skips a manager entirely if it can't prove which version is active* — pair
99
+ with `clean --quarantine` to make removals reversible. Disable with
100
+ `prune_old_toolchains: false`.
101
+ - **Stale project cruft** (`project_cruft`, report-only). Finds regenerable
102
+ `node_modules` / `.venv` / `target` / `.gradle` dirs in projects under
103
+ `project_scan_dirs` you haven't touched in `project_stale_days` (default 120).
104
+ - **Large files** (`big_files`, report-only). The biggest files in `$HOME`, so
105
+ you can see what filled the disk. Never deletes — just a sized list + `rm` hint.
106
+ - **Duplicate files** (`duplicates`, report-only). Identical large files (same
107
+ size + SHA-256) grouped with the space reclaimable by keeping one copy.
108
+ - **Stale downloads** (`downloads`, report-only). Old, large installers/ISOs in
109
+ `~/Downloads` (which stays hard-protected from deletion).
110
+ - **Orphaned browser profiles** (`browser_profiles`, report-only). Secondary
111
+ Chrome/Chromium/Firefox profiles idle for `browser_profile_stale_days`, with a
112
+ clear warning that a profile holds bookmarks/passwords/history.
113
+
114
+ ## Working with what a scan finds
115
+
116
+ - `cleanix explain <id>` — read-only, shows the **exact** paths/commands one
117
+ cleaner would consider (with size, root, delete-vs-report), for building trust.
118
+ - `cleanix clean --interactive` — pick individual items from a checklist before
119
+ removing (selection is per-item, not just per-cleaner).
120
+ - `cleanix clean --simulate` — write the exact target list to a file, delete
121
+ nothing (stronger than the dry-run summary).
122
+ - `cleanix clean --execute` — writes a **per-file audit manifest** to
123
+ `~/.local/state/cleanix/runs/` and prints the real `df` free-space change.
124
+ - `--profile safe|balanced|aggressive` — one flag to bundle the opt-in settings
125
+ (aggressive enables offline-repo/backup/locale/all-image pruning; it never
126
+ bundles volume removal).
127
+ - `--min-size 100M` — ignore items below a threshold to cut table noise.
128
+ - `cleanix scan --json` emits a **versioned** schema (`schema_version`, host,
129
+ os, `cleanable_bytes` vs `report_only_bytes`) for CI/tooling.
130
+ - `cleanix dashboard` — lifetime reclaim trend (sparkline) plus the last
131
+ scheduled scan's top sources, at a glance.
132
+
133
+ ## Install & packaging
134
+
135
+ - **PyPI:** `pip install cleanix-cli` (or `pipx install cleanix-cli`).
136
+ - **Standalone binaries** are attached to each [GitHub Release] alongside a
137
+ `SHA256SUMS` file and keyless **build-provenance attestations** — verify a
138
+ download with `gh attestation verify <file> --repo CloudOpsWorld/cleanix-cli`.
139
+ - **Homebrew / AUR / Fedora** packaging lives under [`packaging/`](packaging/),
140
+ along with a `cleanix.1` **man page** generated from the CLI
141
+ (`python scripts/gen_manpage.py`).
142
+
143
+ [GitHub Release]: https://github.com/CloudOpsWorld/cleanix-cli/releases
144
+
145
+ ## Container leftovers (Docker / Podman / nerdctl / crictl)
92
146
 
93
147
  A *leftover* is anything the engine keeps that **no existing container
94
148
  references** and can be regenerated. Each category is surfaced as its own item
@@ -188,8 +242,9 @@ sudo cleanix clean --only memory_macos --execute # macOS `purge`
188
242
  - **Root-aware.** Cleaners that need root are clearly flagged and skipped (with a
189
243
  note) when you run unprivileged.
190
244
  - **Scheduling.** Install a periodic read-only scan that reports (and notifies)
191
- on a daily/weekly/monthly cadence — a **systemd user timer** on Linux/BSD, a
192
- **launchd LaunchAgent** on macOS. Same `cleanix schedule` command on both.
245
+ on a daily/weekly/monthly cadence — a **systemd user timer** on Linux, a
246
+ **launchd LaunchAgent** on macOS, and a **cron job** on the BSDs (or any
247
+ system with `crontab` but no systemd). Same `cleanix schedule` command on all.
193
248
 
194
249
  ## Install
195
250
 
@@ -0,0 +1,64 @@
1
+ # Releasing cleanix-cli
2
+
3
+ Publishing is fully automated via GitHub Actions, modeled on a
4
+ push-to-`main`-triggers-release flow.
5
+
6
+ ## Workflows
7
+
8
+ | Workflow | Trigger | What it does |
9
+ |----------|---------|--------------|
10
+ | `.github/workflows/ci.yml` | push / PR to `main`/`master` | Test matrix (Ubuntu + macOS × Python 3.9–3.13), advisory ruff lint & mypy |
11
+ | `.github/workflows/build.yml` | `workflow_call` / manual | Runs tests, builds standalone binaries (Linux + macOS via PyInstaller) and the wheel/sdist (`python -m build` + `twine check`) |
12
+ | `.github/workflows/release.yml` | push to `main`/`master` | Detects a new version, tags it, builds artifacts, creates a GitHub Release, and publishes to PyPI |
13
+
14
+ ## How a release happens
15
+
16
+ 1. Bump the version in **both** `pyproject.toml` and `cleanix/__init__.py`
17
+ (the release workflow fails if they disagree).
18
+ 2. Commit and push to `main`.
19
+ 3. `release.yml` will:
20
+ - see the version has no matching `vX.Y.Z` git tag,
21
+ - create and push that tag,
22
+ - build binaries + wheel/sdist,
23
+ - create a GitHub Release with the binaries and package attached,
24
+ - publish the wheel/sdist to PyPI.
25
+
26
+ If the tag already exists, the release is skipped — so pushing unrelated commits
27
+ never re-releases.
28
+
29
+ ## One-time PyPI setup (Trusted Publishing — recommended)
30
+
31
+ No API token required. On PyPI:
32
+
33
+ 1. Create the project owner/account, then go to **PyPI → Your projects →
34
+ Publishing → Add a new pending publisher** with:
35
+ - Owner: your GitHub org/user
36
+ - Repository: `cleanix-cli`
37
+ - Workflow name: `release.yml`
38
+ - Environment: `pypi`
39
+ 2. In the GitHub repo, create an **Environment** named `pypi`
40
+ (Settings → Environments) — optionally add required reviewers for a manual
41
+ approval gate before publish.
42
+
43
+ That's it: `release.yml` requests an OIDC token (`id-token: write`) and PyPI
44
+ trusts it.
45
+
46
+ ### Alternative: API token
47
+
48
+ If you prefer a token, add a repository secret `PYPI_API_TOKEN` and uncomment the
49
+ `password:` line in the `publish-pypi` job of `release.yml`.
50
+
51
+ ## Testing the pipeline first
52
+
53
+ - Run **Build** manually (Actions → Build → Run workflow) to confirm binaries and
54
+ the package build without cutting a release.
55
+ - Optionally point at **TestPyPI** first by adding `repository-url:
56
+ https://test.pypi.org/legacy/` to the publish step.
57
+
58
+ ## Local dry run
59
+
60
+ ```bash
61
+ pip install build twine
62
+ python -m build
63
+ twine check dist/*
64
+ ```
@@ -1,4 +1,4 @@
1
1
  """Cleanix — a safe, thorough scheduled system cleaner for Linux, macOS and BSD."""
2
2
 
3
- __version__ = "1.1.0"
3
+ __version__ = "1.2.0"
4
4
  __all__ = ["__version__"]
@@ -25,6 +25,13 @@ from cleanix.cleaners.dev_caches import DevCacheCleaner
25
25
  from cleanix.cleaners.pip_cache import PipCacheCleaner
26
26
  from cleanix.cleaners.npm_cache import NpmCacheCleaner
27
27
  from cleanix.cleaners.containers import DockerCleaner, PodmanCleaner
28
+ from cleanix.cleaners.containerd import CrictlCleaner, NerdctlCleaner
29
+ from cleanix.cleaners.toolchains import ToolchainVersionCleaner
30
+ from cleanix.cleaners.project_cruft import ProjectCruftCleaner
31
+ from cleanix.cleaners.big_files import BigFileReporter
32
+ from cleanix.cleaners.downloads import DownloadsReporter
33
+ from cleanix.cleaners.browser_profiles import BrowserProfileReporter
34
+ from cleanix.cleaners.duplicates import DuplicateFileReporter
28
35
 
29
36
  # Logs / crashes
30
37
  from cleanix.cleaners.logs import JournalCleaner, RotatedLogCleaner
@@ -171,6 +178,10 @@ ALL_CLEANERS: List[Type[Cleaner]] = [
171
178
  NpmCacheCleaner,
172
179
  DockerCleaner,
173
180
  PodmanCleaner,
181
+ NerdctlCleaner,
182
+ CrictlCleaner,
183
+ # Language / toolchain versions
184
+ ToolchainVersionCleaner,
174
185
  # Logs & crashes
175
186
  RotatedLogCleaner,
176
187
  JournalCleaner,
@@ -247,6 +258,11 @@ ALL_CLEANERS: List[Type[Cleaner]] = [
247
258
  SnapshotReporter,
248
259
  TimeMachineReporter,
249
260
  DeviceBackupReporter,
261
+ ProjectCruftCleaner,
262
+ BigFileReporter,
263
+ DownloadsReporter,
264
+ BrowserProfileReporter,
265
+ DuplicateFileReporter,
250
266
  # macOS extras
251
267
  MacExtraCachesCleaner,
252
268
  MacContainerCacheCleaner,
@@ -0,0 +1,83 @@
1
+ """Large-file finder (report-only).
2
+
3
+ A user who has filled their disk usually wants to *see* what is eating the
4
+ space, not have cleanix guess which giant files are junk — a 40 GiB video or VM
5
+ image may be exactly what they wanted to keep. So this cleaner never deletes
6
+ anything: it walks the home tree, surfaces the biggest files (with sizes and a
7
+ manual removal hint), and leaves the decision to the human.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import heapq
13
+ import os
14
+ import stat
15
+ from typing import Iterable, List, Tuple
16
+
17
+ from cleanix.cleaners.base import Cleaner
18
+ from cleanix.core.models import CleanableItem
19
+ from cleanix.core.platform import ALL
20
+ from cleanix.core.utils import (
21
+ _allocated_bytes,
22
+ home,
23
+ human_size,
24
+ modified_within,
25
+ walk_pruned,
26
+ )
27
+
28
+ # Leave anything touched within the last few minutes alone: a very recent mtime
29
+ # suggests the file is being actively written (a download in progress, a render
30
+ # still spooling), and its size is not yet meaningful.
31
+ _IN_USE_MINUTES = 5.0
32
+
33
+
34
+ class BigFileReporter(Cleaner):
35
+ id = "big_files"
36
+ name = "Large files"
37
+ description = "Biggest files in your home directory (report only)"
38
+ requires_root = False
39
+ platforms = (ALL,)
40
+
41
+ def find_items(self) -> Iterable[CleanableItem]:
42
+ min_bytes = int(
43
+ getattr(self.config, "big_file_min_size_mb", 500.0) * 1024 * 1024
44
+ )
45
+ top_n = int(getattr(self.config, "big_files_top_n", 20))
46
+ if top_n <= 0:
47
+ return
48
+
49
+ # Keep a running min-heap of the top-N largest files seen so far. Each
50
+ # entry is (size, path); the smallest sits at heap[0] and is evicted
51
+ # once the heap is full and a bigger file arrives.
52
+ heap: List[Tuple[int, str]] = []
53
+
54
+ for dirpath, _dirnames, filenames in walk_pruned(home()):
55
+ for name in filenames:
56
+ fpath = os.path.join(dirpath, name)
57
+ try:
58
+ st = os.lstat(fpath)
59
+ except OSError:
60
+ continue
61
+ # Files only, never symlinks (walk_pruned already avoids
62
+ # descending through symlinked dirs).
63
+ if not stat.S_ISREG(st.st_mode):
64
+ continue
65
+ size = _allocated_bytes(st)
66
+ if size < min_bytes:
67
+ continue
68
+ if modified_within(fpath, _IN_USE_MINUTES):
69
+ continue
70
+ if len(heap) < top_n:
71
+ heapq.heappush(heap, (size, fpath))
72
+ elif size > heap[0][0]:
73
+ heapq.heapreplace(heap, (size, fpath))
74
+
75
+ # Emit largest-first.
76
+ for size, fpath in sorted(heap, key=lambda t: t[0], reverse=True):
77
+ item = self.report_item(
78
+ fpath,
79
+ f"Large file: {os.path.basename(fpath)} ({human_size(size)})",
80
+ hint="review and remove manually if no longer needed: rm <path>",
81
+ )
82
+ if item:
83
+ yield item
@@ -0,0 +1,319 @@
1
+ """Orphaned / secondary browser profiles and heavy rebuildable profile subdirs.
2
+
3
+ This cleaner is **report-only** by design: it never yields a deletable item.
4
+ Deleting the wrong browser profile is data loss — a profile holds the user's
5
+ bookmarks, saved passwords, history and open tabs — so cleanix only *surfaces*
6
+ candidates (with sizes and removal guidance) and leaves the decision to the
7
+ user.
8
+
9
+ It deliberately covers what the browser *cache* cleaner
10
+ (:mod:`cleanix.cleaners.browsers`) does not:
11
+
12
+ * whole **non-default profiles** that look abandoned (no activity for
13
+ ``browser_profile_stale_days`` days);
14
+ * a handful of heavy, rebuildable per-profile subdirs the cache cleaner leaves
15
+ alone — ``Crash Reports``, ``GrShaderCache``, ``Service Worker/CacheStorage``,
16
+ session-restore backups and ``Old Data`` — surfaced report-only.
17
+
18
+ Both Linux/XDG and macOS layouts are handled; paths are resolved per-OS.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import os
24
+ import time
25
+ from pathlib import Path
26
+ from typing import Iterable, Optional, Tuple
27
+
28
+ from cleanix.cleaners.base import Cleaner
29
+ from cleanix.core.models import CleanableItem
30
+ from cleanix.core.platform import ALL, is_macos
31
+ from cleanix.core.utils import home, human_size, iter_children, path_size
32
+
33
+ # Upper bound on how many items we surface, so a machine with dozens of profiles
34
+ # cannot flood the report.
35
+ _MAX_ITEMS = 200
36
+
37
+ # Heavy, rebuildable per-profile subdirs the cache cleaner does NOT cover.
38
+ # Reported (never deleted) so the user can reclaim space knowingly. Each entry
39
+ # is (relative path components, human label).
40
+ _CHROMIUM_HEAVY_SUBDIRS: Tuple[Tuple[Tuple[str, ...], str], ...] = (
41
+ (("Crash Reports",), "crash reports"),
42
+ (("GrShaderCache",), "GPU shader cache"),
43
+ (("Service Worker", "CacheStorage"), "service-worker CacheStorage"),
44
+ (("Sessions",), "session-restore backups"),
45
+ (("Old Data",), "old profile data"),
46
+ )
47
+
48
+
49
+ def _dir_is_symlink(p: Path) -> bool:
50
+ try:
51
+ return p.is_symlink()
52
+ except OSError:
53
+ return True
54
+
55
+
56
+ def _mtime(p: Path) -> float:
57
+ """lstat mtime of ``p`` (0.0 if it cannot be read)."""
58
+ try:
59
+ return os.lstat(p).st_mtime
60
+ except OSError:
61
+ return 0.0
62
+
63
+
64
+ def _last_activity(profile: Path) -> float:
65
+ """Best-effort "last used" timestamp for a chromium/firefox profile.
66
+
67
+ Uses the newest of the profile directory's own mtime and the mtime of the
68
+ file that the browser touches on virtually every navigation (Chromium's
69
+ ``History`` SQLite db, or Firefox's ``places.sqlite``). This is a far better
70
+ activity signal than the directory mtime alone.
71
+ """
72
+ newest = _mtime(profile)
73
+ for marker in ("History", "places.sqlite"):
74
+ m = _mtime(profile / marker)
75
+ if m > newest:
76
+ newest = m
77
+ return newest
78
+
79
+
80
+ def _idle_days(profile: Path) -> Optional[float]:
81
+ """Days since the profile was last active, or ``None`` if unknown."""
82
+ ts = _last_activity(profile)
83
+ if ts <= 0:
84
+ return None
85
+ return max(0.0, (time.time() - ts) / 86400.0)
86
+
87
+
88
+ class BrowserProfileReporter(Cleaner):
89
+ id = "browser_profiles"
90
+ name = "Orphaned browser profiles"
91
+ description = (
92
+ "Stale/secondary browser profiles & heavy profile subdirs (report only)"
93
+ )
94
+ requires_root = False
95
+ # Applies everywhere; per-OS paths are resolved inside find_items().
96
+ platforms = (ALL,)
97
+
98
+ # -- support-dir discovery ----------------------------------------------
99
+ def _chromium_roots(self) -> Iterable[Tuple[str, Path]]:
100
+ """Yield (browser label, support dir) for installed chromium browsers."""
101
+ h = home()
102
+ if is_macos():
103
+ appsup = h / "Library" / "Application Support"
104
+ candidates = [
105
+ ("Chrome", appsup / "Google" / "Chrome"),
106
+ ("Chromium", appsup / "Chromium"),
107
+ ("Edge", appsup / "Microsoft Edge"),
108
+ ("Brave", appsup / "BraveSoftware" / "Brave-Browser"),
109
+ ]
110
+ else:
111
+ cfg = h / ".config"
112
+ candidates = [
113
+ ("Chrome", cfg / "google-chrome"),
114
+ ("Chromium", cfg / "chromium"),
115
+ ("Edge", cfg / "microsoft-edge"),
116
+ ("Brave", cfg / "BraveSoftware" / "Brave-Browser"),
117
+ ]
118
+ for label, root in candidates:
119
+ try:
120
+ if root.is_dir() and not _dir_is_symlink(root):
121
+ yield label, root
122
+ except OSError:
123
+ continue
124
+
125
+ def _firefox_roots(self) -> Iterable[Path]:
126
+ h = home()
127
+ if is_macos():
128
+ root = h / "Library" / "Application Support" / "Firefox"
129
+ else:
130
+ root = h / ".mozilla" / "firefox"
131
+ try:
132
+ if root.is_dir() and not _dir_is_symlink(root):
133
+ yield root
134
+ except OSError:
135
+ return
136
+
137
+ # -- chromium ------------------------------------------------------------
138
+ def _is_profile_dir(self, child: Path) -> bool:
139
+ name = child.name
140
+ return name == "Default" or name.startswith("Profile ")
141
+
142
+ def _chromium_items(self) -> Iterable[CleanableItem]:
143
+ stale_days = float(getattr(self.config, "browser_profile_stale_days", 90.0))
144
+ for label, root in self._chromium_roots():
145
+ for child in iter_children(root):
146
+ try:
147
+ if not child.is_dir() or _dir_is_symlink(child):
148
+ continue
149
+ except OSError:
150
+ continue
151
+ if not self._is_profile_dir(child):
152
+ continue
153
+
154
+ idle = _idle_days(child)
155
+ # Only surface a profile that looks abandoned. The Default /
156
+ # active profile is only surfaced if it, too, is stale.
157
+ if idle is not None and idle >= stale_days:
158
+ size = path_size(child)
159
+ if size > 0:
160
+ item = self.report_item(
161
+ child,
162
+ f"Possibly-orphaned {label} profile '{child.name}' "
163
+ f"({human_size(size)}, {int(idle)}d idle)",
164
+ hint=(
165
+ "CONTAINS BOOKMARKS, SAVED PASSWORDS & HISTORY — "
166
+ "do not delete blindly. If you no longer use it, "
167
+ f"remove it from {label}'s profile manager "
168
+ "(Settings -> profiles / the people icon), which "
169
+ "safely detaches and deletes the profile."
170
+ ),
171
+ )
172
+ if item:
173
+ yield item
174
+
175
+ # Heavy rebuildable subdirs the cache cleaner does not touch.
176
+ for parts, sublabel in _CHROMIUM_HEAVY_SUBDIRS:
177
+ target = child.joinpath(*parts)
178
+ try:
179
+ if not target.is_dir() or _dir_is_symlink(target):
180
+ continue
181
+ except OSError:
182
+ continue
183
+ if path_size(target) <= 0:
184
+ continue
185
+ item = self.report_item(
186
+ target,
187
+ f"{label} {child.name}: {sublabel} "
188
+ f"({human_size(path_size(target))})",
189
+ hint=(
190
+ "Rebuildable by the browser, but not cleared by the "
191
+ "cache cleaner. Safe to remove while the browser is "
192
+ "closed; it will be regenerated on next launch."
193
+ ),
194
+ )
195
+ if item:
196
+ yield item
197
+
198
+ # -- firefox -------------------------------------------------------------
199
+ def _firefox_default_names(self, root: Path) -> set:
200
+ """Profile dir names that profiles.ini marks as default/active.
201
+
202
+ Parsed leniently: any ``Path=`` under a section whose ``Default=1`` (or
203
+ any ``[Install...]`` default) is treated as an active profile to skip.
204
+ Returns the set of directory *names* (basename of the Path=value).
205
+ """
206
+ ini = root / "profiles.ini"
207
+ names: set = set()
208
+ try:
209
+ if not ini.is_file():
210
+ return names
211
+ text = ini.read_text(errors="replace")
212
+ except OSError:
213
+ return names
214
+
215
+ section_path: Optional[str] = None
216
+ section_is_default = False
217
+
218
+ def _flush():
219
+ if section_path and section_is_default:
220
+ names.add(Path(section_path).name)
221
+
222
+ for raw in text.splitlines():
223
+ line = raw.strip()
224
+ if line.startswith("[") and line.endswith("]"):
225
+ _flush()
226
+ header = line[1:-1]
227
+ # [Install...] sections point at the active profile via Default=.
228
+ section_path = None
229
+ section_is_default = header.startswith("Install")
230
+ continue
231
+ if "=" not in line:
232
+ continue
233
+ key, _, value = line.partition("=")
234
+ key = key.strip()
235
+ value = value.strip()
236
+ if key == "Path":
237
+ section_path = value
238
+ elif key == "Default":
239
+ if section_path is None:
240
+ # [InstallXXX] Default=<path to active profile>
241
+ if value:
242
+ names.add(Path(value).name)
243
+ elif value == "1":
244
+ section_is_default = True
245
+ _flush()
246
+ return names
247
+
248
+ def _firefox_items(self) -> Iterable[CleanableItem]:
249
+ stale_days = float(getattr(self.config, "browser_profile_stale_days", 90.0))
250
+ for root in self._firefox_roots():
251
+ defaults = self._firefox_default_names(root)
252
+ for child in iter_children(root):
253
+ try:
254
+ if not child.is_dir() or _dir_is_symlink(child):
255
+ continue
256
+ except OSError:
257
+ continue
258
+ name = child.name
259
+ # Firefox profiles are "<random>.<name>"; skip infra dirs.
260
+ if "." not in name or name in ("Crash Reports", "Pending Pings"):
261
+ continue
262
+ if name in defaults:
263
+ continue # never surface the active/default profile
264
+
265
+ idle = _idle_days(child)
266
+ if idle is None or idle < stale_days:
267
+ continue
268
+ size = path_size(child)
269
+ if size <= 0:
270
+ continue
271
+ item = self.report_item(
272
+ child,
273
+ f"Possibly-orphaned Firefox profile '{name}' "
274
+ f"({human_size(size)}, {int(idle)}d idle)",
275
+ hint=(
276
+ "CONTAINS BOOKMARKS, SAVED PASSWORDS & HISTORY — do not "
277
+ "delete blindly. If unused, remove it via "
278
+ "about:profiles or the Profile Manager "
279
+ "(firefox -P) which deletes it safely."
280
+ ),
281
+ )
282
+ if item:
283
+ yield item
284
+
285
+ # Session-restore backups: heavy, rebuildable, not a cache dir.
286
+ sessions = child / "sessionstore-backups"
287
+ try:
288
+ heavy = sessions.is_dir() and not _dir_is_symlink(sessions)
289
+ except OSError:
290
+ heavy = False
291
+ if heavy and path_size(sessions) > 0:
292
+ sitem = self.report_item(
293
+ sessions,
294
+ f"Firefox {name}: session-restore backups "
295
+ f"({human_size(path_size(sessions))})",
296
+ hint=(
297
+ "Recovery copies of previous tab sessions. Removing "
298
+ "them (browser closed) only drops the ability to "
299
+ "restore old windows; not covered by the cache cleaner."
300
+ ),
301
+ )
302
+ if sitem:
303
+ yield sitem
304
+
305
+ # -- entry point ---------------------------------------------------------
306
+ def find_items(self) -> Iterable[CleanableItem]:
307
+ count = 0
308
+ try:
309
+ producers = (self._chromium_items(), self._firefox_items())
310
+ except Exception: # noqa: BLE001 - defensive
311
+ return
312
+ for producer in producers:
313
+ for item in producer:
314
+ if item is None:
315
+ continue
316
+ yield item
317
+ count += 1
318
+ if count >= _MAX_ITEMS:
319
+ return