Commit Graph

22 Commits (main)

Author SHA1 Message Date
mula.liu 51f9fdb085 Merge dev: consolidate navigation and absorb 0.1.13 features
- Space cleaning becomes one hub with junk / duplicates / large files tabs.
- System maintenance becomes one hub with repair / privacy / optimisation tabs.
- Permissions gains grouped startup entries, leftovers, advanced entries and
  grouped context-menu handlers.
- Desktop widget gets its own page and the desktop watch loop.
- Keep the security scan, quarantine and allowlist stack from main, and keep
  the tabbed settings page with its security section.
- Navigation: 维护 / 安全 / 洞察 / 桌面, with history and settings pinned at
  the bottom. Legacy cleanup/purge/storage/startup deep links map to the new
  pages.
- Remove second-level descriptions under page titles and trailing periods.
- Version 0.1.13 to match the merged feature set.
2026-11-25 17:30:48 +08:00
lijunjie cdc60fbe6d 卸载增强:来源徽章、安装不完整检测与残留记录清理(G2 完成 C 批)
- AppInfo 新增 uninstall_string/reg_key/dead 字段(serde default,全平台默认值)
- Windows 卸载扫描:MsiQueryProductStateW 探测 MSI 产品状态,安装目录与卸载器双缺失 → 「安装不完整」
- 包管理器来源徽章:winget/scoop/Chocolatey/JetBrains Toolbox/Microsoft Store 按路径指纹识别
- 死应用卸载方案:幽灵 bundle 行改为锁定说明,新增 app_remove_record 命令删除孤儿注册表记录(HKLM 走一次 UAC 提权 reg.exe,HKCU 进程内直删)
- 应用页 UI:安装不完整红色徽章 + 包管理器来源徽章 + 清理残留引导卡
- AI 模型体积诚实化:manifest 行只带自身字节,cluster 总额写入 note,杜绝 清理点 求和双计
- 修正 squid-engine Cargo.toml 误置的 libc 依赖段
- demo 点击测试扩至 53 项全过(隐私锁定/永久删除、优化开关与恢复默认、进阶启动项签名徽章与开关、卸载徽章与残留清理)
2026-11-24 11:43:17 +08:00
lijunjie ef15297e4d A 批:重复文件三级漏斗 + 大文件独立页 + 存储空间矩形图(学习 MangoDisk,保留回收站护城河)
重复文件(D1/D2):
- 新引擎 duplicates.rs:大小分组 → 头中尾 16KiB 采样哈希 → 全量 SHA-256 三级漏斗,
  哈希按 路径+大小+mtime 落盘缓存(hash-cache.json),重扫只算变化的文件
- 每组确认即流式推入结果(Event::Group),扫描不再是不透明转圈;漏斗各级淘汰数实时计数
- 智能选择每组保留一份(路径最短/最早两种策略),微信 FileStorage 副本自动标个人文件、不默认勾选
- 删除走唯一 delete::execute:安全复校 + 回收站 + 历史撤销;全卷安全放宽(with_volume_wide_safety)
- squid dupes CLI 子命令;真机 34k 文件冷扫约 1s,正确识别 23 组重复

大文件(D3):
- analyze::large_files 多盘阈值+类型过滤扫描;休眠标记、网盘可能有副本提示、镜像占用锁定、隐藏系统关键文件
- large_files_scan/delete 命令 + 独立页面,删除同样进回收站

矩形图(D4):
- 纯前端 squarify treemap(~130 行,无新依赖),与列表共用 storage_explore 缓存,秒开、点块下钻

共享改动:Category 新增 duplicates/ai-tools/privacy + Event::Group 流式事件;进度事件带 bigfiles/duplicates 文案
2026-11-24 10:46:58 +08:00
mula.liu ea1465d192 Release Squid 0.1.11 with security allowlist 2026-11-22 15:44:07 +08:00
lijunjie 6a664515b3 深度扫描目录改为全自动发现,界面撤掉目录配置(学习 Mole 零配置)
- 引擎自动发现项目容器:各固定磁盘根下一层的 repos/code/dev/projects/
  work/src/documents 等目录(大小写不敏感、去重),主目录本体浅层兜底;
  不存在的目录概念从此消失,settings.toml 里手写 purge_roots 仍作追加生效。
- 空间清理页「深度扫描目录」从按钮+弹层改为一行说明「自动发现:桌面、
  文档、各磁盘根目录下的项目目录(无需设置)」;概览页智能扫描同步传空。
- 移除 roots_status 命令与前端弹层组件;内置默认 purge_roots 清空。
- 实测本机 dry-run:自动发现 4 处根、命中 21.36 GB 构建产物(此前配置清单
  15 处里 14 处不存在)。无头断言:静态说明渲染、弹层入口消失、
  purge_scan 收到空 roots。fmt/test/clippy×2/pnpm check+build 全绿。
2026-11-21 10:51:53 +08:00
lijunjie 3bb3aeca42 深度扫描目录改为可检视清单(对齐 Mole);Git 保护开关移除
- 深度扫描目录:点击不再只弹文件夹框,展开清单逐行显示每个目录(✓ 存在 /
  ⌀ 不存在已跳过),支持移除、添加、恢复默认;折叠态文案改为
  「N 处有效 · M 处不存在已跳过」;所有增删即时写入配置文件(原先只存内存,
  重启即丢)。
- 默认清单 Windows 化:桌面 / 文档 / source\repos(VS 默认)等惯例目录前置。
- 界面移除「Git 保护」开关:它本来就是默认安全兜底,现在永远开启;
  需要绕过走 CLI --all。
- 新增 roots_status 命令与 settings 持久化 purgeRoots;无头浏览器 10 项
  点击断言全过;cargo fmt/test/clippy、pnpm check/build 全绿。
2026-11-21 10:16:32 +08:00
lijunjie e3eba338a7 借鉴 Mole 的 12 项安全架构与交互全部落地;修复启动项开关失效
- 空间清理:扫描实时计数(已统计 N 文件 · X,进度封顶 99%);分类算完一个亮一个;
  清理点/文件行「X 未使用」休眠标签;node_modules 可删依据面板(锁文件/安装记录/
  手改检测/Git/年龄);低风险走底部绿色内联确认条(Esc 取消),对话框新增
  「刚刚逐路径复核过」审计面板;结果页按原因分组展示未处理项并给下一步按钮;
  清理清单导出 Markdown(含依据与受保护项)。
- 存储空间:新增「隐藏的吃空间大户」(更新缓存/休眠/页面文件/WinSxS/手机备份/旧下载);
  文件夹测量缓存 10 分钟 + 新鲜度标注 + 重新测量,删除后缓存自动作废。
- 引擎:微信/QQ 聊天文件、浏览器 IndexedDB 离线数据、搜狗词库等个人文件在扫描结果
  以待解锁行呈现且删除层强制拒删;preflight 删除前逐路径复核;白名单消费审计
  (设置页标注每条规则最近是否命中)。
- 修复:权限管理开机启动项开关点击无效/弹回——StartupApproved 标记改用最小注册表
  权限写入(原 KEY_ALL_ACCESS 在安全软件驻留的机器上直接被拒),拒绝访问时自动
  UAC 提权重试并回读核实;计划任务/服务同样支持提权通道;开关失败新增红色气泡。
- 无头浏览器 29 项点击断言全过;cargo test/clippy/fmt、pnpm check/build 全绿;0.1.10 重新打包。
2026-11-20 18:54:02 +08:00
mula.liu cea60cc6c1 Release Squid 0.1.9 with low-CPU desktop monitor
Merge the dev monitor optimizations on top of the unreleased 0.1.8 desktop work: shared light snapshots, visibility-aware polling, CPU history/per-core panel, and a resize/redock guard that stops the widget IPC loop.

Also carries the desktop widget, permissions/security, storage-volume fixes, update-installer cleanup category, tray template icon, and Windows Recycle Bin wording.
2026-11-19 10:21:43 +08:00
lijunjie a3253ad38f Squid 0.1.10:升级安装包清理、CPU 面板、回收站文案与桌面小工具降占用
- 清理新增「升级安装包」分类:已知应用精确规则(微信/企微/WPS/网易邮箱等)+ AppData 启发式扫描;只匹配安装包形态、≥7 天、1MiB 起,运行中应用锁定;删除确认弹条「跳过升级包,只删其余」
- 桌面小工具新增 CPU 面板:总占用曲线 + 整行逻辑核心渐变柱(绿→黄→橙→红连续插值,悬停显示核心 N 百分比,0 起编号,柱宽随核心数自适应)
- Windows 上「废纸篓」文案全链路改为「回收站」(bootstrap.binNoun 驱动,macOS 不变)
- 常驻 CPU 优化:轻/全两档采样(system_snapshot(full))、双窗口共享 2s 采样缓存、主窗口收托盘与小工具折叠时完全停止轮询
- 修复小工具自适应尺寸→重锚定 IPC 死循环(主进程+渲染进程空转、每循环写一次 widget.json);同时修复由此摘除 prefs 依赖引入的面板高度不自适应回归
- 版本升至 0.1.10(4 处同步),release/0.1.10 全套发布文件(安装包/便携包/SHA256/更新清单/一键安装.bat)
2026-11-19 00:08:56 +08:00
lijunjie 67a68b4fbb Squid 0.1.6-0.1.9: 权限管理、桌面小工具、概览/卸载修复
权限管理(新增页):开机启动项按软件分组 + 中文软件名 + 每行图标;
右键菜单对齐电脑管家颗粒度(文件/文件夹/桌面/驱动器/所有对象 横向
分类导航、创建者列、模块图标、占位名回退安装目录名、系统内置过滤、
模块去重);弹窗拦截(窗口/规则图标、一键建规则、常驻观察者)。
数据源 crates/squid-platform/src/permissions.rs + src-tauri manage.rs。

桌面小工具(新增,仿飞牛):桌面层无边框窗口(HWND_BOTTOM,压在
壁纸上、其他窗口下),运行状态圆环 / 网络与磁盘曲线 / 存储空间条,
独立面板开关、不透明度(90-100)、频率、停靠角、折叠记忆、拖拽位置
持久化;主界面「桌面小工具」管理页 + 托盘开关;widget.json 持久化。
src-tauri/src/widget.rs、src/pages/Widget{Window,Page}.tsx、
src/components/WidgetPanels.tsx。

概览页:本机配置面板(主板/CPU/内存条/硬盘型号/显卡,原生 API 读取)、
Windows 11 版本识别修复(构建号规则)、盘符百分比、无滚动的紧凑布局。
squid-platform hardware_info + squid-stats gpu_usage 字段。

卸载应用:EstimatedSize/实测目录修复 0 B;应用图标(DisplayIcon 解析、
老图标 AND 掩码、.lnk 目标跟踪)。

安装:NSIS 自定义模板静默覆盖升级(不弹卸载旧版页,继承安装位置与
%APPDATA% 配置);管家环境发布必带 一键安装.bat(复制到 C 盘 %TEMP%
再启动,docs/RELEASE.md 记录);release/0.1.6-0.1.9 归档。

测试:scracth 目录写入被端点防护拒绝时优雅跳过(core/engine/rules/tui);
widget 序列化契约 3 个新单测;工作区 199 测试全绿。
2026-11-18 11:52:36 +08:00
mula.liu 8490f9213c Release Squid 0.1.7 with redesigned overview and corrected system metrics 2026-11-08 10:09:13 +08:00
mula.liu eb8f899fe0 Release Squid 0.1.6 with malware scanning and startup management
Adds the Protection half of the app: a Security page (quick / full / custom
scans, findings by confidence, quarantine and restore) and a Startup items
page (LaunchAgents, login items, registry Run, scheduled tasks, services),
plus a Processes tab on the real-time monitor that joins a running process to
the entry that launched it. XProtect and Defender stay the real-time
protection — Squid only reads what they report, uploads nothing, and installs
no daemon, kext or privileged helper.

On the interface, the two new screens reuse the vocabulary the older screens
already had instead of starting a second one: `.panel`, `.status-chip`,
`.search-field`, `.icon-button`, `.text-button`, `.metric-icon` with `tone-*`,
`.settings-row`. Findings, startup entries and quarantined files share one row
shape, so a row is one definition for three screens. Explanatory copy was cut to
one sentence per screen and per control, and a count now sits on the filter that
produces it rather than also in a summary line above.

Two defects fixed on the way:

- `src-tauri` is excluded from the root workspace and had no `[profile.release]`
  of its own, so no desktop build had ever been stripped; the universal binary
  is 20.6 MiB smaller now. `panic` stays unwind — turning a failed request into
  a dead app is not a change this release should be making.
- The schedule note was built in Rust as an English string, so a Chinese
  interface showed "squid only scans when you ask." beside everything else in
  Chinese. The schedule is now described once, in the frontend, in both
  languages.
2026-11-07 11:09:37 +08:00
mula.liu 6d9db8b700 Release Squid 0.1.5 with language and startup controls 2026-11-05 23:39:38 +08:00
mula.liu 09ba6c6b36 Release Squid 0.1.3 with tray support
- Hide up-to-date messaging in the update panel
- Simplify primary navigation to Overview, Cleanup, and Applications
- Keep Squid running in the tray with cleanup and purge actions
- Package macOS, Windows, and update manifest artifacts
2026-11-05 11:40:42 +08:00
mula.liu f65021de03 Measure long paths, and clean up after a failing fixture
`windows_allocation` built its UTF-16 argument with `to_string_lossy`, so a
path that an `OsString` can hold but a `String` cannot arrived at
`GetCompressedFileSizeW` with replacement characters in it, and any path past
the 260-character legacy limit was answered with `ERROR_PATH_NOT_FOUND` — the
deep `node_modules` trees this tool exists to measure cross that line
routinely. `wide_path` keeps every UTF-16 unit and adds the verbatim prefix
only where it is honest (absolute, no `.` or `..`), because the prefix also
switches off normalisation.

The scratch-directory fixture now removes itself even when an assertion
panics halfway through. That is not housekeeping: a file extended with
`set_len` is charged as if written in full, and one surviving fixture sat on
the test machine's disk at 11 GB — in `AppData\Local\Temp`, where squid then
correctly offered it back as junk.
2026-10-15 18:53:31 +08:00
mula.liu d74420f24a Ask NTFS for stored bytes, not for allocated clusters
`FileStandardInfo.AllocationSize` turned out to be the wrong question. Measured
against `fsutil` and `compact` on a real Windows 10 volume:

- it returns the cluster-rounded logical length for ordinary files, including
  1 GiB files extended by `SetEndOfFile` (NTFS does hand over the whole tail,
  and free space moves accordingly) and sub-cluster files living in `$MFT`;
- it reported the full 8 MiB for a file `compact` accounts as 1,572,864 stored
  bytes, i.e. it is blind to NTFS compression, which is the one way Windows
  really does hide size on disk;
- `FSCTL_QUERY_ALLOCATED_RANGES` reported that same compressed file as fully
  allocated, so "which clusters exist" is not "what do they weigh".

`GetCompressedFileSizeW` answers 1,572,864, matching `compact` byte for byte.
It takes the path we already hold instead of a handle, so it is one query per
file rather than a `CreateFileW` pair, and it keeps answering while another
process holds the file open exclusively — the normal state of a cache file.
That also removes the `ALLOCATION_PROBE_MIN` cutoff: it existed to avoid a
handle per small file, and small files on a compressed volume need the honest
number just as much.

Guard the zero answer behind `FILE_ATTRIBUTE_COMPRESSED`/`SPARSE_FILE` (free
from the `Metadata` we already have) so a deleted-but-still-open file cannot
zero out a total the user is about to act on, and read `GetLastError` to tell
failure from a genuine 4 GiB-minus-one length.

Tests: each platform now gets the fixture that provokes its own divergence —
POSIX holes for `st_blocks`, and a `compact`-compressed file for the Windows
path. The old Windows sparse fixture proved nothing: extending a file does not
hole out on NTFS, and `FSCTL_SET_SPARSE` is refused outright on this volume
(`ERROR_INVALID_FUNCTION`), as is `FSCTL_SET_COMPRESSION`
(`ERROR_ACCESS_DENIED`) even for a file we created ourselves.
2026-10-15 17:25:17 +08:00
mula.liu 69dd3b5456 Stop matching path separators in suffixes
The purge test compared rendered path strings against `demo/node_modules` and
friends, so on Windows every positive assertion failed and the negative one —
`loose/dist` must not be offered — passed for the wrong reason. Assertions now
compare trailing components, which is what they meant all along and holds on
both separators.

`category_index` made the same assumption in production: it lowercased the path
and looked for `/library/caches`, so a leftover root was only ever reclassified
on the OS whose separator it was written for.
2026-10-15 16:51:00 +08:00
mula.liu 7584811e91 Measure what NTFS actually allocated, and unbreak the /Applications test
Real Windows 10 hardware turned up two failures the macOS and cross-compile
checks could not see:

- squid-core::fs reported every file's logical length as its allocated size,
  because `allocated_bytes` returned 0 on non-Unix and `on_disk()` then fell
  back to logical. NTFS only answers the allocation question through a handle,
  so ask `GetFileInformationByHandleEx(FileStandardInfo)` for files big enough
  to distort a total. Files below the cutoff keep counting as their length,
  which is also what keeps MFT-resident entries — they report an allocation of
  0 — from shrinking a cache cleanup down to nothing.
- the "a plain user can still uninstall into /Applications" safety test hard
  coded a Unix path, so on Windows it asserted that a folder the policy never
  looked at was refused. The fixture now comes from the policy's own shared
  install folder, `/Applications` on Unix and the machine-wide program-data
  folders on Windows.

Also added:

- `a_written_file_reports_what_the_volume_gave_it`, the cross-platform
  invariant the missing backend silently violated.
- the sparse-file test now marks its file sparse via `fsutil` on Windows and
  skips when the volume will not cooperate, instead of pretending a hole
  exists.
- `scripts/win-sync.sh`, `scripts/win-check.ps1` and `scripts/win-hwcheck.ps1`
  for iterating against a LAN Windows host over SSH without git credentials.
2026-10-15 16:43:41 +08:00
mula.liu 13dfcce22f Windows-friendly elevation hints
- new squid_core::elevation_hint(): sudo on Unix, elevated Administrator
  terminal on Windows; used by the locked-item notes in clean/uninstall
  and the user-only safety refusal.
- the Permission error no longer tells Windows users to grant Full Disk
  Access (a macOS-only concept).
2026-10-15 15:26:12 +08:00
mula.liu 5619b1467d Windows: safety layer, rule engine fixes, and 30 built-in cleanup rules
- paths: platform-semantic comparisons. Component keys are lower-cased
  and canonical \\?\\ verbatim prefixes folded away on Windows, so
  is_within/same_path/depth_below/relative_below match how the OS
  actually resolves paths; pretty() got the same treatment.
- safety: drive roots and UNC roots are hard-denied (is_root_like);
  Windows hard-deny grows env-derived entries (SystemRoot, ProgramFiles,
  ProgramData, USERPROFILE, ...); DENY_EXACT gains the AppData tree and
  shell folders; OUTSIDE_HOME_OK becomes platform-supplied
  (%ProgramData%, %PUBLIC% mirror /Applications); a path containing
  $Recycle.Bin / System Volume Information / Recovery is always refused;
  the canonicalize-vs-expected symlink probe now compares with
  platform semantics instead of raw equality.
- rules: $VAR heads stop at backslashes too; ${VAR} resolves in every
  occurrence; glob component matching is case-insensitive on Windows;
  protect patterns normalise \\ to / so protections keep working there;
  anchor_for keeps drive prefixes instead of bailing out, and folds
  Prefix+RootDir into a rooted C:\ anchor.
- rules/windows.toml: 30 rules for Win10/11 (temp, WER/crash dumps,
  browser caches, shell caches, dev caches, Windows.old, Package Cache)
  embedded under cfg(windows) and parse-checked on every host.
2026-10-15 15:23:19 +08:00
mula.liu 122e81cb4d Windows: real platform layer, recycle-bin trash backend, cross-compile CI
- squid-core: trash moves behind a platform seam — Windows recycles via
  IFileOperation (shell owns $Recycle.Bin bookkeeping; ledger records no
  physical path there), Unix keeps the rename/copy path untouched
- squid-core: default cleanup anchors per platform; Unix-only helpers
  (getuid, statvfs-style trash dirs, symlink copy) gated
- squid-platform: windows.rs rewritten — installed apps from the uninstall
  registry (HKLM 64/32-bit views + HKCU, SystemComponent/patch filtering),
  BIOS/NT version keys for hardware/OS strings, sysinfo for volumes and
  running processes; winreg replaces the PowerShell stub
- squid-stats: COMPUTERNAME hostname off-unix; battery parsers gated
- CI: .gitlab-ci.yml with a Linux job that cross-checks the whole workspace
  against x86_64-pc-windows-msvc, plus a manual tagged Windows job driven by
  scripts/ci-windows.ps1 (build + test on a real machine)
- host (macOS) tests, clippy -D warnings and fmt stay green
2026-10-15 14:56:55 +08:00
mula.liu 54585ffc40 squid 0.1.0: macOS 磁盘清理(CLI + TUI) 2026-10-13 17:00:50 +08:00