winclean-cli 0.1.0 → 0.1.1

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.
package/DART_LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright 2012, the Dart project authors.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above
9
+ copyright notice, this list of conditions and the following
10
+ disclaimer in the documentation and/or other materials provided
11
+ with the distribution.
12
+ * Neither the name of Google LLC nor the names of its
13
+ contributors may be used to endorse or promote products derived
14
+ from this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,41 +1,345 @@
1
1
  # winclean
2
2
 
3
- Windows temp and cache cleaner. Ships a self-contained `win32-x64` executable;
4
- no Dart SDK required.
3
+ A junk cleaner for Windows 10 and 11 that runs in the terminal. It scans the usual temp and cache locations, lets you pick what to remove, and exits. No window, no tray icon, no background process.
5
4
 
6
- ## Install
5
+ **[English](#english) | [Русский](#русский)**
6
+
7
+ ---
8
+
9
+ ## English
10
+
11
+ winclean removes the junk that builds up on a Windows machine: user and Windows temp files, browser caches, crash dumps, Windows Update downloads, Prefetch data, Error Reporting dumps, Windows logs, the Recycle Bin, and caches from developer tools and apps (npm, pip, uv, Pub, Go, NVIDIA, D3D, Steam, Epic, PowerToys). It does not touch cookies, browser history, downloads, or documents.
12
+
13
+ Run it by hand: a keyboard-driven screen lists every discovered target with its size, you choose what to clean, and it does the work and closes. Nothing keeps running afterwards.
14
+
15
+ The interface is in English.
16
+
17
+ ### What you need
18
+
19
+ | | |
20
+ |---|---|
21
+ | Operating system | Windows 10 or Windows 11 (64-bit) |
22
+ | Node.js | version 18 or newer, only for the npm launcher. The cleaner itself is a self-contained Dart AOT build and does not need Dart or Node. |
23
+ | Terminal | Windows Terminal or PowerShell works best |
24
+
25
+ A few targets (Windows temp, Windows Update cache, Prefetch, Error Reporting, Windows logs, Recycle Bin) need administrator rights. Without elevation they are shown as `needs admin` and cannot be selected. In non-interactive output they are marked `needs admin` instead of failing silently.
26
+
27
+ ### Install, step by step (no prior experience needed)
28
+
29
+ If you have never installed a command-line tool before, follow these in order.
30
+
31
+ **1. Install Node.js.**
32
+ Node.js runs the small npm launcher. Go to [nodejs.org](https://nodejs.org), download the version labelled "LTS", and run the installer. Keep every option at its default and click through to the end.
33
+
34
+ **2. Open a terminal.**
35
+ Press the Start button, type "PowerShell", and open it. This is the window where you type commands.
36
+
37
+ **3. Check that Node.js is there.**
38
+ Type this and press Enter:
39
+
40
+ ```powershell
41
+ node --version
42
+ ```
43
+
44
+ If you see something like `v20.11.0`, Node.js is installed. If you get an error, close the terminal, open a new one, and try again. A fresh terminal is needed so it picks up the new installation.
45
+
46
+ **4. Install winclean.**
7
47
 
8
48
  ```powershell
9
49
  npm install -g winclean-cli
10
50
  ```
11
51
 
12
- ## Usage
52
+ The `-g` part installs it globally, which means the `winclean` command works from any terminal.
53
+
54
+ **5. Run it.**
55
+
56
+ ```powershell
57
+ winclean
58
+ ```
59
+
60
+ If the command is not found right after installing, close the terminal and open a new one, then run `winclean` again. The new terminal picks up the updated path.
61
+
62
+ ### Install from source (for developers)
63
+
64
+ Requires the Dart SDK 3.11 or newer.
65
+
66
+ From the repository root:
67
+
68
+ ```powershell
69
+ dart pub get
70
+ dart run bin/winclean.dart
71
+ ```
72
+
73
+ There is no build step for normal use. To create the standalone AOT build:
74
+
75
+ ```powershell
76
+ dart compile aot-snapshot bin/winclean.dart -o winclean.aot
77
+ dartaotruntime winclean.aot
78
+ ```
79
+
80
+ The npm package is assembled with `tool/build-npm.ps1`, which compiles the AOT snapshot and copies `dartaotruntime.exe` into `npm/vendor/`.
81
+
82
+ ### First run
83
+
84
+ There is no setup wizard. The first launch opens the selector. Sizes are scanned in the background, rows sort largest first, and every target you are allowed to use starts selected. Uncheck anything you do not want, then press `Enter` to clean.
85
+
86
+ Press `q` or `Esc` to cancel without deleting anything.
87
+
88
+ ### The screens
89
+
90
+ | Screen | What it does |
91
+ |---|---|
92
+ | Select | Targets found on this machine, their size and file count, selection state, and a running total. Toggle with `Space`, confirm with `Enter`. |
93
+ | Running | Live progress for each selected target: files, bytes, busy files, skipped links, and current state. |
94
+ | Results | Final per-target results and totals. Errors are shown below the table. Press `q` or `Esc` to exit. |
95
+
96
+ Keys: `↑↓` move, `PgUp/PgDn` scroll a page, `Home/End` jump to start or end, `Space` toggle, `Enter` confirm, `q`/`Esc` cancel or exit.
97
+
98
+ ### What it cleans
99
+
100
+ Targets are discovered from the current machine; only existing folders appear in the selector. Rows you can use are selected by default. Admin-only rows become selectable and selected when the terminal is elevated.
101
+
102
+ | Category | Admin | Notes |
103
+ |---|:---:|---|
104
+ | User temp | | `%TEMP%` |
105
+ | Windows temp | admin | `%SystemRoot%\Temp` |
106
+ | Crash dumps | | `%LOCALAPPDATA%\CrashDumps` |
107
+ | INetCache | | `%LOCALAPPDATA%\Microsoft\Windows\INetCache` |
108
+ | Browser caches | | Chrome, Edge, Brave `Cache` and `Code Cache` per profile; Firefox `cache2`. Logins, cookies, and history stay. |
109
+ | Developer and tool caches | | Go build, npm, pip, uv, Pub, NVIDIA DXCache/GLCache, D3DSCache, Explorer cache, Steam htmlcache/appcache, Epic webcache, PowerToys Updates, Cryptnet URL cache. Only folders that exist are listed. |
110
+ | System elements | | Upgrade leftovers under `%TEMP%\NLTmpMnt\...`, only when present |
111
+ | Windows Update cache | admin | already-installed update downloads |
112
+ | Prefetch | admin | first launch of an app afterwards is a little slower |
113
+ | Windows Error Reports | admin | crash dumps (WER) |
114
+ | Windows logs | admin | `%SystemRoot%\Logs` |
115
+ | Recycle Bin | admin | deletion is irreversible |
116
+
117
+ ### Command-line options
13
118
 
14
119
  ```powershell
15
- winclean # interactive TUI: pick targets, watch progress, review results
16
- winclean --dry-run # report what would be deleted
17
- winclean --json # machine-readable output
18
- winclean --quiet # print only the total
19
- winclean --older-than 7d
120
+ winclean --dry-run # report what would be deleted, change nothing
121
+ winclean --older-than 7d # only files older than the given duration (30m, 12h, 7d)
122
+ winclean --json # machine-readable output on stdout
123
+ winclean --quiet # print only the total
124
+ winclean --help
20
125
  ```
21
126
 
22
- Run `winclean --help` for all options.
127
+ `--older-than 0` (the default) means no age filter.
128
+
129
+ The interactive selector is used only when both stdin and stdout are terminals and neither `--json` nor `--quiet` is set. Redirected or piped output goes to the plain-text or JSON path.
130
+
131
+ **Warning:** `--json`, `--quiet`, and redirected output skip the selector and process every discovered target without confirmation. Run `winclean --dry-run` first when you are unsure.
132
+
133
+ Exit codes: `0` when no target reported errors, `1` when at least one target had an error, `2` for invalid arguments or an unexpected failure.
134
+
135
+ ### Safety
136
+
137
+ The design limits the damage in advance.
138
+
139
+ - A target must be an absolute path. A bare drive root such as `C:\` is always refused.
140
+ - Protected locations (`SystemRoot`, `USERPROFILE`, `LOCALAPPDATA`, `APPDATA`, `ProgramFiles`, `ProgramData`) are never cleaned as targets. Any target that contains one of them is refused too, so `C:\`, `C:\Users`, and `C:\Windows` cannot be selected by mistake.
141
+ - Symlinks and junctions are skipped, never followed.
142
+ - Busy files are skipped and counted; they are not forced or retried forever.
143
+ - Duplicate target paths are merged.
144
+ - Missing folders are reported as `missing`, not treated as errors.
145
+ - The cleaner never deletes the target root folder itself, only its contents.
146
+ - Every result is reported per target, with errors and exit code.
147
+ - There is no config file, whitelist, plugin, or command execution path. Selection is made in the TUI or by the flags above.
148
+
149
+ Browser caches may be partially skipped while the browser is open because those files are busy. Close the browser for a complete clean.
150
+
151
+ ### Uninstall
152
+
153
+ ```powershell
154
+ npm uninstall -g winclean-cli
155
+ ```
156
+
157
+ The cleaner stores no settings, history, or logs. Removing the package is enough.
158
+
159
+ ### For developers
160
+
161
+ ```powershell
162
+ dart pub get
163
+ dart run bin/winclean.dart
164
+ dart run bin/winclean.dart --dry-run --quiet --older-than 0
165
+ dart test
166
+ dart analyze lib test bin
167
+ ```
168
+
169
+ When testing, never run a destructive clean (Recycle Bin, browser caches, real temp folders) on a machine you care about. Use `--dry-run`, or point the library at isolated test folders.
170
+
171
+ The interactive TUI is documented in `docs/TUI_DESIGN.md` in the repository.
172
+
173
+ ### License
174
+
175
+ [BSD 3-Clause](./LICENSE). The package includes the Dart runtime, also under the BSD 3-Clause license; see [`DART_LICENSE`](./DART_LICENSE).
176
+
177
+ ---
178
+
179
+ ## Русский
23
180
 
24
- ## Safety
181
+ winclean удаляет мусор, который накапливается в Windows: временные файлы пользователя и Windows, кэш браузеров, дампы после сбоев, загруженные обновления Windows, Prefetch, отчёты об ошибках, логи Windows, Корзину, а также кэш инструментов и приложений (npm, pip, uv, Pub, Go, NVIDIA, D3D, Steam, Epic, PowerToys). Cookies, историю браузера, папку «Загрузки» и документы программа не трогает.
25
182
 
26
- - Cleaning requires selected targets; nothing is deleted until you confirm.
27
- - Protected paths (`SystemRoot`, `USERPROFILE`, `LOCALAPPDATA`, `APPDATA`,
28
- `ProgramFiles`, `ProgramData`) are never cleaned.
29
- - Windows Temp and Windows Update cache need an elevated shell.
30
- - `--dry-run` previews without deleting.
183
+ Запуск ручной: экран с управлением с клавиатуры показывает найденные цели и их размер, вы выбираете, что чистить, программа делает работу и закрывается. Ничего не остаётся работать в фоне.
184
+
185
+ Интерфейс на английском.
186
+
187
+ ### Что нужно
188
+
189
+ | | |
190
+ |---|---|
191
+ | Операционная система | Windows 10 или Windows 11 (64-bit) |
192
+ | Node.js | версия 18 или новее, только для npm-запускатора. Сам клинер — самостоятельная Dart AOT-сборка, Dart и Node ему не нужны. |
193
+ | Терминал | лучше всего Windows Terminal или PowerShell |
194
+
195
+ Нескольким целям (временные файлы Windows, кэш обновлений Windows, Prefetch, отчёты об ошибках, логи Windows, Корзина) нужны права администратора. Без них они показываются как `needs admin` и не выбираются. В неинтерактивном выводе они помечаются `needs admin`, а не падают молча.
196
+
197
+ ### Установка по шагам (опыт не нужен)
198
+
199
+ Если вы никогда не ставили программы из командной строки, делайте по порядку.
200
+
201
+ **1. Поставьте Node.js.**
202
+ Node.js запускает небольшой npm-запускатор. Зайдите на [nodejs.org](https://nodejs.org), скачайте версию с пометкой «LTS» и запустите установщик. Оставляйте все галочки по умолчанию и дойдите до конца.
203
+
204
+ **2. Откройте терминал.**
205
+ Нажмите «Пуск», наберите «PowerShell» и откройте его. Это окно, куда вы вводите команды.
206
+
207
+ **3. Проверьте, что Node.js на месте.**
208
+ Введите и нажмите Enter:
209
+
210
+ ```powershell
211
+ node --version
212
+ ```
213
+
214
+ Если видите что-то вроде `v20.11.0`, значит Node.js установлен. Если выходит ошибка, закройте терминал, откройте новый и попробуйте снова. Новый терминал нужен, чтобы он подхватил установку.
215
+
216
+ **4. Установите winclean.**
217
+
218
+ ```powershell
219
+ npm install -g winclean-cli
220
+ ```
221
+
222
+ Часть `-g` ставит программу глобально, то есть команда `winclean` будет работать из любого терминала.
223
+
224
+ **5. Запустите.**
225
+
226
+ ```powershell
227
+ winclean
228
+ ```
229
+
230
+ Если сразу после установки команда не находится, закройте терминал, откройте новый и снова наберите `winclean`. Новый терминал подхватит обновлённый путь.
231
+
232
+ ### Установка из исходников (для разработчиков)
233
+
234
+ Нужен Dart SDK 3.11 или новее.
235
+
236
+ Из корня репозитория:
237
+
238
+ ```powershell
239
+ dart pub get
240
+ dart run bin/winclean.dart
241
+ ```
242
+
243
+ Для обычного запуска шага сборки нет. Чтобы собрать самостоятельную AOT-сборку:
244
+
245
+ ```powershell
246
+ dart compile aot-snapshot bin/winclean.dart -o winclean.aot
247
+ dartaotruntime winclean.aot
248
+ ```
249
+
250
+ npm-пакет собирается скриптом `tool/build-npm.ps1`: он компилирует AOT-снимок и копирует `dartaotruntime.exe` в `npm/vendor/`.
251
+
252
+ ### Первый запуск
253
+
254
+ Мастера настройки нет. При первом запуске сразу открывается выбор целей. Размеры сканируются в фоне, строки сортируются от больших к меньшим, все доступные цели изначально отмечены. Снимите галочки с того, что чистить не нужно, и нажмите `Enter`.
255
+
256
+ `q` или `Esc` отменяют выбор без удаления.
257
+
258
+ ### Экраны
259
+
260
+ | Экран | Что делает |
261
+ |---|---|
262
+ | Выбор | Найденные на машине цели, их размер и число файлов, состояние выбора и общий итог. `Space` переключает, `Enter` подтверждает. |
263
+ | Выполнение | Живой прогресс по каждой выбранной цели: файлы, байты, занятые файлы, пропущенные ссылки, состояние. |
264
+ | Результаты | Итог по каждой цели и общий итог. Ошибки показываются под таблицей. `q` или `Esc` — выход. |
265
+
266
+ Клавиши: `↑↓` перемещение, `PgUp/PgDn` прокрутка страницей, `Home/End` в начало или конец, `Space` переключить, `Enter` подтвердить, `q`/`Esc` отмена или выход.
267
+
268
+ ### Что чистит
269
+
270
+ Цели ищутся на текущей машине; в списке появляются только существующие папки. Доступные строки отмечены по умолчанию. Строки, требующие администратора, становятся доступными и отмеченными, если терминал запущен с повышением прав.
271
+
272
+ | Категория | Админ | Примечания |
273
+ |---|:---:|---|
274
+ | Временные файлы пользователя | | `%TEMP%` |
275
+ | Временные файлы Windows | админ | `%SystemRoot%\Temp` |
276
+ | Дампы после сбоев | | `%LOCALAPPDATA%\CrashDumps` |
277
+ | INetCache | | `%LOCALAPPDATA%\Microsoft\Windows\INetCache` |
278
+ | Кэш браузеров | | Chrome, Edge, Brave: `Cache` и `Code Cache` по профилям; Firefox: `cache2`. Входы, cookies и история остаются. |
279
+ | Кэш инструментов и приложений | | Go build, npm, pip, uv, Pub, NVIDIA DXCache/GLCache, D3DSCache, кэш Explorer, Steam htmlcache/appcache, Epic webcache, PowerToys Updates, Cryptnet URL cache. Показываются только существующие папки. |
280
+ | Элементы системы | | Остатки обновления в `%TEMP%\NLTmpMnt\...`, только если есть |
281
+ | Кэш обновлений Windows | админ | уже установленные файлы обновлений |
282
+ | Prefetch | админ | первый запуск программы после этого чуть медленнее |
283
+ | Отчёты об ошибках Windows | админ | дампы WER |
284
+ | Логи Windows | админ | `%SystemRoot%\Logs` |
285
+ | Корзина | админ | удаление необратимо |
286
+
287
+ ### Параметры командной строки
288
+
289
+ ```powershell
290
+ winclean --dry-run # показать, что было бы удалено, ничего не меняя
291
+ winclean --older-than 7d # только файлы старше указанного срока (30m, 12h, 7d)
292
+ winclean --json # машиночитаемый вывод в stdout
293
+ winclean --quiet # печатать только итог
294
+ winclean --help
295
+ ```
296
+
297
+ `--older-than 0` (значение по умолчанию) означает отсутствие фильтра по возрасту.
298
+
299
+ Интерактивный выбор используется, только когда stdin и stdout — терминалы и не заданы `--json` или `--quiet`. При перенаправлении вывода программа переходит в обычный текстовый или JSON-режим.
300
+
301
+ **Внимание:** `--json`, `--quiet` и перенаправленный вывод пропускают экран выбора и обрабатывают все найденные цели без подтверждения. Если не уверены, сначала запустите `winclean --dry-run`.
302
+
303
+ Коды выхода: `0` — ни одна цель не сообщила об ошибке, `1` — хотя бы одна цель с ошибкой, `2` — неверные аргументы или непредвиденный сбой.
304
+
305
+ ### Безопасность
306
+
307
+ Программа заранее ограничивает ущерб.
308
+
309
+ - Цель должна быть абсолютным путём. Голый корень диска вроде `C:\` всегда отклоняется.
310
+ - Защищённые каталоги (`SystemRoot`, `USERPROFILE`, `LOCALAPPDATA`, `APPDATA`, `ProgramFiles`, `ProgramData`) никогда не чистятся как цели. Любая цель, которая содержит такой каталог, тоже отклоняется, поэтому `C:\`, `C:\Users` и `C:\Windows` нельзя выбрать по ошибке.
311
+ - Символические ссылки и junction-точки пропускаются, по ним программа не идёт.
312
+ - Занятые файлы пропускаются и подсчитываются; их не пытаются удалить силой и не повторяют бесконечно.
313
+ - Дублирующиеся пути целей объединяются.
314
+ - Отсутствующие папки помечаются как `missing`, а не считаются ошибкой.
315
+ - Корневая папка цели не удаляется, очищается только её содержимое.
316
+ - Результат по каждой цели выводится отдельно, с ошибками и кодом выхода.
317
+ - Нет файла конфигурации, whitelist, плагинов и путей выполнения команд. Выбор делается в TUI или параметрами выше.
318
+
319
+ Кэш браузера может очиститься не полностью, если браузер открыт: занятые файлы пропускаются. Для полной очистки закройте браузер.
320
+
321
+ ### Удаление
322
+
323
+ ```powershell
324
+ npm uninstall -g winclean-cli
325
+ ```
326
+
327
+ Программа не хранит настройки, историю или логи. Удаления пакета достаточно.
328
+
329
+ ### Для разработчиков
330
+
331
+ ```powershell
332
+ dart pub get
333
+ dart run bin/winclean.dart
334
+ dart run bin/winclean.dart --dry-run --quiet --older-than 0
335
+ dart test
336
+ dart analyze lib test bin
337
+ ```
31
338
 
32
- ## Requirements
339
+ При тестировании никогда не запускайте удаляющую чистку (Корзина, кэш браузеров, реальные временные папки) на машине, которую жалко. Используйте `--dry-run` или направьте библиотеку на изолированные тестовые папки.
33
340
 
34
- - Windows x64
35
- - Node.js 18 or newer (only for the npm launcher)
341
+ Устройство интерактивного TUI описано в `docs/TUI_DESIGN.md` в репозитории.
36
342
 
37
- The interactive TUI needs both stdin and stdout attached to a terminal.
38
- Redirected or piped output uses plain text or JSON instead.
343
+ ### Лицензия
39
344
 
40
- The executable is not code-signed. Windows Smart App Control may block
41
- unsigned programs; if Windows blocks it, use a signed release when available.
345
+ [BSD 3-Clause](./LICENSE). В пакет входит runtime Dart, тоже под лицензией BSD 3-Clause; см. [`DART_LICENSE`](./DART_LICENSE).
package/bin/winclean.js CHANGED
@@ -4,12 +4,16 @@
4
4
  const { spawn } = require('node:child_process');
5
5
  const path = require('node:path');
6
6
 
7
- const exe = path.join(__dirname, '..', 'vendor', 'winclean.exe');
7
+ const vendor = path.join(__dirname, '..', 'vendor');
8
+ const runtime = path.join(vendor, 'dartaotruntime.exe');
9
+ const snapshot = path.join(vendor, 'winclean.aot');
8
10
 
9
- const child = spawn(exe, process.argv.slice(2), { stdio: 'inherit' });
11
+ const child = spawn(runtime, [snapshot, ...process.argv.slice(2)], {
12
+ stdio: 'inherit',
13
+ });
10
14
 
11
15
  child.on('error', (error) => {
12
- console.error(`winclean: failed to launch ${exe}: ${error.message}`);
16
+ console.error(`winclean: failed to launch ${runtime}: ${error.message}`);
13
17
  process.exit(1);
14
18
  });
15
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "winclean-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Windows temp and cache cleaner with an interactive TUI",
5
5
  "license": "BSD-3-Clause",
6
6
  "author": "winclean contributors",
@@ -9,7 +9,9 @@
9
9
  },
10
10
  "files": [
11
11
  "bin/winclean.js",
12
- "vendor/winclean.exe",
12
+ "vendor/dartaotruntime.exe",
13
+ "vendor/winclean.aot",
14
+ "DART_LICENSE",
13
15
  "README.md",
14
16
  "LICENSE"
15
17
  ],
index 921e2ac..910574d 100644
Binary file
Binary file