Commit Graph

26 Commits (e9280208317e80c5baa6ae2002de2a260a8a49c5)

Author SHA1 Message Date
mula.liu 16914f29d8 发布 0.1.15:Windows 卸载调用系统卸载程序并修复应用图标
- Windows 卸载改用应用注册的卸载命令,MSI 使用 msiexec /x,并在完成后清理残留注册表记录
- 从 InstallLocation、MSI、DisplayIcon 与卸载程序路径推断安装目录,修复 0 B 与无法卸载
- Program Files 应用不再被误判为无权限,卸载后自动刷新列表并保留结果摘要
- Windows 与 macOS 应用列表优先显示真实图标,条目键回退到注册表键
- 版本与发布文档更新到 0.1.15
2026-11-30 15:49:56 +08:00
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 450086e835 启动项图标按产品名借卸载注册表的 DisplayIcon
零图标资源的更新服务小程序(腾讯会议 WemeetUpdateSvc、企业微信
WXWorkUpgrader)此前在启动分组里只剩灰色首字母。新机制:stub 的 PE
字符串说出它服务的产品,就用这个 label 去卸载注册表的
DisplayName / DisplayIcon 文件名片段索引里找真身图标;精确命中优先,
否则最长别名伸展(wxworkservice 顺到 wxwork),短于四个字符的键
不参与伸展,绝不张冠李戴。
2026-11-25 12:07:25 +08:00
lijunjie 20abe3aef2 启动项角色名不再自成一组:Windows File System Proxy 归入其他软件
- WinFsp 的 launcher-x64.exe 把 FileDescription 写成 "Windows File System
  Proxy"(看着像系统组件,实则 Navimatics 第三方库),命名优先级取了这句
  角色描述,导致启动列表冒出一个独立软件组
- 新规则 is_component_role_label:以 Windows/Microsoft 开头、以
  proxy/host/agent/service/helper/driver/launcher/broker 等角色词结尾的
  名字视为管道组件而非产品 → named=false,落入其他软件;真实产品名
  (微信、Windows Defender Firewall、WinFsp Launcher 等)不受影响
- 单测×2:角色词表边界断言 + 本机真机断言(WinFsp 行必须未归因;机器无
  WinFsp 自动跳过)
2026-11-25 11:17:46 +08:00
lijunjie 8ca15d5760 启动项套件归组:H3C 家族服务合并为 H3C Workspace 一组
- H3C Workspace/SpaceAgent/Device Redirect 的每个服务桩程序都不带版本字符串
  (FileDescription/ProductName 全空),此前散成一堆单行组和其他软件;
  新规则 attribute_vendor_suites:Program Files 下一家厂商拥有 ≥2 个产品
  子目录即视为套件,弱归因(无名/名字回显技术键/纯英文标签)的行折叠进
  「厂商 Workspace」组(存在 Workspace 子目录时用它命名套件产品);
  带真实人话产品名的 PE(含中文名)绝不误并
- 前端零改动:named+displayName 驱动的分组自动生效,H3C 六项服务进同一组
- 单测×3:suite_path 边界(Common Files/裸文件不算套件)、合成 H3C 布局
  折叠断言、本机真机扫描断言(无 H3C 目录的环境自动跳过)
2026-11-25 11:04:37 +08:00
lijunjie 26ec54a4e8 启动项商店应用归组(ChatGPT 从其他软件独立成组)+ 其他软件换中性图标
- 商店应用(MSIX)的程序文件对普通用户读不到版本信息,全部掉进其他软件;
  新增 windows_store_product:从 WindowsApps\发布者.产品_版本_架构_包哈希\
  包目录名提取产品名(取原路径保留大小写,OpenAI.ChatGPT_… → ChatGPT),
  认出的行归入 ChatGPT 组并带上原图标;带两个单测(含大小写、非商店路径)
- 其他软件组头不再借用组内第一个成员的图标(ChatGPT 蓝图标配"其他软件"
  误导):改用中性九宫格图标(启动项与右键菜单两处共用 GroupIcon 组件)
2026-11-25 09:35:35 +08:00
lijunjie 0cfd360d31 右键菜单按软件分组:同软件的多条菜单项合并为一张卡片
- 与开机启动项同款样式:组头 = 软件图标 + 软件名 + 开启状态(全部开启/
  部分开启 x/y/已全部关闭)+ 共 N 个菜单位置 + 组级总开关(一键开/关该
  软件在本类别的全部处理器);展开见每行的作用面(文件/文件夹/桌面/
  驱动器/所有对象)、创建者与模块路径
- 归组规则与启动项一致:模块带真实产品字符串或能认出安装目录的归入该
  软件组,认不出的落入其他软件(排最后);搜索词命中时自动展开
- 归属标记由后端给出:ShellExtEntry 新增 named 字段(serde default,旧
  manage.json 备份可正常反序列化),manage.rs 的 ExtensionView 透传
- 菜单位置类别页签与计数不变;demo 点击测试 9 断言全过(分组、计数、
  其他软件兜底、总开关批量调用、类别计数联动、搜索展开)
2026-11-25 09:26:35 +08:00
lijunjie 507b81f74a 修复权限管理扫描闪出黑色命令行窗口 + 精简开机启动项芯片标签
- 批量签名核验(signature_grades)调用 powershell.exe 漏了 CREATE_NO_WINDOW:
  Squid 是无控制台 GUI,拉起控制台程序 Windows 会新建窗口——即用户看到的
  "打开权限管理就弹一个黑窗口"。加 0x0800_0000 静默(该函数被开机启动项
  与进阶启动项共用,一处修复两处生效)
- 同类漏网堵上:清理扫描的 git 状态探测(purge.rs run_git/run_git_raw)
  同加隐藏窗口标志;全仓 Command::new 审计其余调用点均已带标志或平台无害
- 开机启动项软件组标题精简:删除来源(注册表/启动文件夹/计划任务/服务×N)、
  触发时机(开机后/登录后/后台常驻)、签名等级(微软/签名有效/未签名/无效)
  芯片与行内签名芯片;仅保留红色「N 个残留」警示与行内 已启用/已禁用/残留
  状态标签——来源与路径明细每行本来就有
2026-11-25 09:18:22 +08:00
lijunjie eca5c836b5 启动项残留检测与 MangoDisk 化改造、重复文件保留副本可删、大文件隐藏页面文件、清理按钮配色修复
- 权限管理·开机启动项:状态筛选段(全部/已启用/已禁用/残留,带实时计数)、「显示系统项」开关(微软签名或 %SystemRoot% 项折进系统组件组)、每组来源芯片(注册表/启动文件夹/计划任务/服务 ×N)与触发时机芯片(开机后/登录后/后台常驻)、签名等级芯片;残留项红框分组 + 行内「删除启动项」+「打开所在文件夹」,展开行显示完整命令行,删除前二次确认说明只删配置不动文件
- 平台层:StartupEntry 新增 target/targetExists/trigger/systemItem/signature/signer;lnk 解析复用同一遍缓存判定程序是否仍在磁盘(相对路径不误报);计划任务按 BootTrigger/LogonTrigger 判定开机后/登录后,服务按 Start 判定;签名核验抽成 advanced::windows::signature_grades 批量共享(一次 PowerShell 进程覆盖整页),启动扫描复用之
- 删除启动项:注册表值/启动文件夹快捷方式/计划任务删除(拒绝访问时走一次性 UAC 并复核),残留服务改为禁用而非卸载;新命令 startup_remove_entry + 前端 removeStartup(ids)
- 重复文件:保留副本复选框开放勾选,勾选后行与芯片转琥珀警示、组头「本组将一份不剩」、汇总条计数、确认条变红并要求「确认完全删除」;锁定的个人文件仍不可选
- 大文件:卷根的 pagefile.sys/swapfile.sys 不再列出(系统持有、删不掉),hiberfil.sys 保留并在说明里提示关闭休眠可释放;新增单测
- 样式:移除 .dup-clean 深红字覆盖(红底压深红字不可读),回归全局 is-danger 白字渐变;页面级按钮配色覆盖列为禁止项

Demo 点击测试 34 断言全过(保留勾选→后端 selection、残留筛选/删除调用、系统项开关、筛选计数)
2026-11-24 21:36:45 +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 337f309c2a C 批(上):隐私清理独立页 + 系统优化 tweaks 目录 + 进阶启动项页签
隐私清理(F1,新一级页面,与空间清理动机不同):
- 新引擎 privacy.rs:Edge/Chrome 浏览记录与 Cookie(含 sqlite journal/WAL 侧文件、
  Session Storage)、最近使用/跳转列表、剪贴板历史(Win+V)、活动历史(ConnectedDevices)
- 浏览器在运行时整条打 🔒 锁(扫描期判定,删除期复校);删除有意绕过回收站
  (profile 半恢复更糟),但逐条写入历史 ledger 供审计;全部默认不勾选

系统优化(F2,新一级页面):
- 新引擎 tweaks.rs:声明式可逆目录 5 项(透明效果/显示扩展名/小组件Web/位置/最近文件),
  每项注册表 key+value+on 值数据化;首次修改前记录原值到 tweaks.json,「恢复全部默认」逐字节还原
- 仅 HKCU、仅真机验证过的低争议项;已是目标值时不写不记录(不谎报更改)
- tweaks_states/set/restore_all 命令 + OptimizationPage

进阶启动项(G1,权限管理新页签):
- 新 squid-platform::advanced:Winlogon Shell/Userinit、AppInit_DLLs、IFEO Debugger、
  BHO 扫描;每项带数字签名信任(批量 Get-AuthenticodeSignature:微软/厂商/未签名/失效)
  与位置说明、风险警示
- 禁用记录原值到 advanced-backup.json 可恢复;自动服务复用现有 startup_set_enabled
- 懒加载:签名批量核验仅在打开该页签时跑一次
2026-11-24 11:17:35 +08:00
lijunjie 7f464e7a19 开机启动项对齐电脑管家:软件分组总开关 + 默认折叠 + 其他软件兜底组
- 后端为每个启动项标注 named(能否归属到真实软件产品:二进制带可用的
  FileDescription/ProductName 才算),无法归属的进「其他软件」组(排最后),
  与管家的归类依据一致。
- 每个软件组标题行:图标、组名、状态(全部开启/部分开启/已全部关闭,橙/绿
  着色)、「共N项」与总开关;总开关一次开/关该组全部细项,点标题行展开细项
  单独控制;默认折叠,搜索时自动全部展开。
- 新增 toggleStartupGroup(逐项调用同一后端开关,失败汇总红色气泡)。
- 无头浏览器 9 项点击断言全过(折叠/计数/其他软件兜底与排序/组展开/总开关
  两连发/状态文案/搜索展开);fmt/test/clippy×2/pnpm check+build 全绿。
2026-11-21 11:16:02 +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
lijunjie 3b76a35e4d 修复空间清理点击无效与权限管理图标缺失
- 空间清理:勾选状态未纳入结果列表的派生缓存(useMemo 依赖缺 selected 集合),
  点击卡片后视图停留在扫描瞬间,看起来全部按钮失灵;现已并入依赖并加注释。
  「可选」角标 pointer-events:none,不再遮挡复选框命中区。
- 权限管理:服务壳程序(Edge elevation_service、电脑管家 qmbsrv、H3C
  SpaceAgent 等)PE 内不含图标资源,ExtractAssociatedIconW 回退成通用瓦片。
  新增 software_icon 回退链:App Paths 注册表 → 卸载信息 DisplayIcon 目录
  映射 → 同目录 .ico/主 exe(带真实图标资源校验),找不到宁可留占位符。
- 已用无头浏览器对演示页执行真实点击断言(8 项全过)后打包 0.1.10。
2026-11-19 17:18:56 +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 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 b2460d506f The system panel may stop a process, once it has asked who is sitting at that number
The system panel has listed processes for a while, and a list of what is running
gets one question asked of it more than any other: this one is wedged, make it
stop. A panel that can name the hung app and then shrugs is scenery, so the
answer here is yes — spent through the machinery the interface already has for
irreversible things, a dialog that names what it is about to do and a log line
afterwards that says what it did.

The *how* is two lines and not very interesting: `kill(2)` with `SIGKILL`, or
`OpenProcess(PROCESS_TERMINATE)` followed by `TerminateProcess`. Both are the
same promise, which is why `squid_platform::process::force_stop` is called a
forced stop on every platform and the dialog says 强制结束 rather than anything
about saving. There is no TERM-then-KILL handshake in here, because there is no
polite promise to keep: the second line of the dialog is 它不会有机会保存任何内容.

`squid_stats::Sampler::stop` does not use `sysinfo`'s own `Process::kill`, and
the reason is the shape of its answer. It returns `false` for every way a stop
can fail, and two of those ways want opposite things from the reader. `ESRCH`
means the process left on its own and nothing is owed but a redraw; `EPERM`
means it is alive and the reader should go find an elevated terminal. Windows
serves the same pair up as `ERROR_INVALID_PARAMETER` and `ERROR_ACCESS_DENIED`.
A bool cannot carry that difference, so squid makes the call itself and keeps
the words the OS gave, quoted inside a sentence this program owns — the OS's
sentence arrives in the language of the OS, and translates no further than its
own frame.

The *whether* is where the damage is, so it is answered twice. First by rule, in
`squid-platform`: never this squid, never the first process of the machine, and
on Windows never one of the six names a boot rests on. Those rules exist because
the operating system does not enforce all of them. An unelevated squid on macOS
cannot reach `WindowServer` whatever it tries; an elevated squid on Windows
*can* open `csrss.exe` for termination, and the reward for one misplaced Enter
is a machine that reboots without asking. Six names is the whole cost of that
guard. `svchost` is deliberately absent from it, because it hosts services a
user may genuinely need to restart and the machine survives losing one — which
is the test a name has to pass before it belongs on that list.

Then by the operating system, whose answer is the only one with any authority
over this user, this token, this moment. Between the two sits the question the
platform module cannot answer, because it is a question about a sample rather
than about a pid: is the process holding this number still the process whose
name the user read? Pids are seat numbers, handed out again, and a process table
is drawn the moment the panel opens and read from seconds later. So
`squid_stats::Sampler::stop` reads the pid again through the new `sample_of`,
applies the rules to the process that is really there, and calls a name that no
longer matches *gone* — the thing that was pointed at really is gone, whichever
direction the pid moved. `shown_name` is why that comparison means anything:
macOS hands over a path and Windows a bare name, and the process table had been
trimming with `split('/')`, which does nothing at all to a Windows path. Nothing
was wrong on screen, because the name was already short there; it became
evidence, and evidence has to be spelled one way.

`x` is the same verb it has always been. On the three file panels it makes the
row under the cursor go away; the system panel has nothing to delete and does
have a process, so the same finger reaches the same meaning, and
`x_is_still_the_delete_key_on_a_list_of_files` pins the old meaning down so that
this one cannot push it aside. `d` still deletes everywhere. The rules are
applied in `ask_stop_process` *before* the dialog rather than after the answer:
a dialog that can only be answered "no" teaches the user that the dialog is
theatre, and the toast that names the rule says the same thing in less time.

Three crates now each hold a `sleeper()`, which is a duplication worth keeping
on purpose. The thing under test has to be a process — `sleep 60`, or
`ping -n 60 127.0.0.1` where `sleep` is not — and a kill feature tested against
a struct is a kill feature that has never killed anything. Twelve tests come
with this: five in the platform module, including the boot list and a vacant pid
reporting itself as gone; three in the sampler, one of which hands a pid to
`stop` under the wrong name and then checks that the innocent process is still
running; four in the interface, walking `x`, `y`, and a refusal from the key
press to the corpse being reaped. 190 tests green across the workspace, with
`cargo fmt --check` and `cargo clippy --workspace --all-targets` clean for the
host and for `x86_64-pc-windows-msvc` — the target where the boot list,
`TerminateProcess` and the parameter-is-incorrect mapping compile at all, which
is also where `the_processes_a_boot_rests_on_are_named_not_guessed` exists.

The Windows 10/11 box carries the part a mac can only compile. `squid.exe`
there builds with `Win32_System_Threading`, clippy clean under `-D warnings`,
185 tests green; and the dialog was read off the screen rather than off the
buffer — `TUI_COLS=140 TUI_ROWS=35 TUI_CP=936`, 2604 samples of the raw ConPTY
stream, 291 settled frames, 0 of them failing the layout judge, including the
confirm itself: `╭ 结束 iNodeCmn.exe? ╮` / `pid 9080 · 1.2% · 15.4 MB` /
`它不会有机会保存任何内容` / `回车 / y 确认 · n / esc 取消`, and 「已取消」 after `n`.
`docs/ARCHITECTURE.md` gains the module and the key, and one of its diagrams
finally admits that `squid-stats` has depended on `squid-platform` for weeks.
2026-10-16 11:49:10 +08:00
mula.liu bf04f2c105 The command line pays for its chrome at the same counter
Three rounds were spent on a TUI that drew several frames over each other on
a cp936 console, and the fix worked: the interface asks the console what it
charges, per character, and draws ASCII where the console charges more than
the layout paid. Meanwhile `squid status`, printed in the same window on the
same machine, still produced a Storage table whose rows were each a screen
and a half long. Nothing in `main.rs` had ever asked what a `█` costs. It
repeats that character twenty-eight times for a gauge and lets the console
do the arithmetic, and the console's arithmetic is different.

`priced` is where a line stops being text and starts being cells, and `row!`
is the one door the body of every report prints through: the eleven places
that draw this program's chrome — the status key/value rows, the volume
gauges, the process table, the tree, the history rows, the whitelist
bullets, the rule headings and their `●`, the doctor's table — all of them
now go through it. It is a macro rather than a helper so the format
arguments stay where they were written, and one door rather than twelve
`println!`s of which eleven remember the console, because the twelfth is the
bug this whole thing is about.

Two refusals are the interesting part.

Nobody is stopped from seeing what a report actually says. Point the output
at a file or a pipe and the text comes back exactly as it was, because a
file is not a console: whatever glass reads the archive tomorrow may well
afford the `█`, and an archive of `#` is a worse record for the sake of a
screen that was never looking. The gate is the same tty question the live
progress line already asked — may this line overwrite a line — so
`live_stream_is_tty` is now `human_stream_is_tty`, since the two questions
have the same answer and deserve one function that says what it is asked.
And `--json` prints data, never through this: rewriting a person's report to
flatter their terminal is a different bug with the same fingerprint.

The price is not measured, even though measuring is what the interface does,
for the reason in `console::prices_unasked`: measurement spends characters,
and a command line is a guest on the screen it is printed to, sitting in a
pipeline or in front of a shell waiting for its next prompt. So it takes the
pessimistic answer the code page implies, which costs it a plainer gauge on
a console whose code page overcharges characters its font could have
carried. `█` becomes `#` there. A table that fits is worth more than a
prettier one that does not.

`no_line_of_chrome_escapes_the_counter` reads the file, with strings,
character literals and comments blanked, and demands that every `print!`,
`println!` and `eprintln!` either go through `priced` or print JSON or print
nothing. The scan exists because this mistake cannot be seen from the
machine it was made on: `println!(" {}", plan)` standing among eleven `row!`
calls is correct on every terminal that charges one cell for everything,
including the one it was typed on, and arrives folded over in front of
somebody else. It reads character literals as literals only when they close
again promptly, because `'static` is not the start of a character literal
and blanking from a lifetime to the next quote hides half a file from an
audit whose entire job is to look at all of it.

On the box, same pseudo-console, same 100x30 window, three reports per
capture and every one of them complete to `MARK_QUIT 0`. On cp936 — the code
page the user's own window is on — the decoded stream contains no `█`, no
`░`, no `─`, no `·`, no `…`, no arrow: the gauge reads
`[#######################.....]` and the headings are underlined with `-`.
On 65001 the same report keeps 104 `█`, 120 `░`, 236 `─`, 32 `·` and both
arrows. Same bytes of intent, two currencies, and the receipt is now in
both.

`win-tui-capture.sh` takes `TUI_ARGS=` so this evidence is repeatable rather
than hand-built: the default still captures the interface and judges it
frame by frame, and `TUI_ARGS="status"` captures a report, where the judge
is simply how many `█` survived.

The architecture document tells the story as one paragraph now, because it
is one story: `console::prices` measures and hands the answers to the
interface, `console::prices_unasked` guesses from the code page and hands
them to the command line, and each side has a test that keeps the characters
it draws and the characters it priced the same list.

178 tests here, two of them this commit's, clean under clippy for the host
and for `x86_64-pc-windows-msvc`, `cargo doc -D warnings` quiet over the
platform and the command line.
2026-10-16 10:32:05 +08:00
mula.liu cc678dee21 Put the price list beside the console, since both programs pay it there
The exchange that stops the TUI overflowing lived in `squid-tui`, next to
the renderer, because that is where the bug was found: several copies of one
frame left on a cp936 console, because `─│█░·…↑↓✓` cost two cells there and
one cell in the layout. But the thing that was wrong was never specific to a
renderer. It is a fact about a console — what this glass charges for a
character whose price Unicode left unsettled — and a fact about a console is
worth exactly as much to the next program that draws on it. `squid status`
draws a volume gauge by repeating `█` twenty-eight times and rules a heading
with `─`. Same price. The difference is that the command line had nobody
asking it.

So `currency` now lives in `squid-platform`, beside `console`, and says in
its own documentation why it is there rather than beside the interface: the
command line and the interface buy the same screen at the same counter.
`Exchange` is the table — indexed by code point, holding the replacement
rather than a bit saying *this one is wrong* because the character is what
the caller needs, and built only when this console actually overcharges,
which is what makes `afford` free on the terminals where there is nothing to
repair. `disputed` says which characters are worth asking about, `cheaper`
what each is worth in characters the console accepts, `witnesses` turns
pieces of chrome into the list of questions to ask. `squid_tui::glyphs`
keeps the half that cannot travel: the walk over a finished ratatui
`Buffer`, which is a question about somebody else's library, now a `Carry`
trait implemented for `Exchange` so that the table and its spending still
read as one motion.

The tests went with their subject rather than staying where the code used to
be: what a shading block costs, and what it is worth in `.`, is a question
about prices, so those seven are in `currency` now, and what is left here is
about frames — three that draw a `Buffer` and check where the borders land,
one that reproduces the original overflow, and the two that hold the
invariant worth defending, that the glyphs this interface draws and the
glyphs it asks the price of are one list. A glyph drawn but never priced
looks correct on every terminal that charges one cell for everything,
including the one it was typed on.

176 tests here — the same number as before the move, which is what a move
ought to leave behind — clean under clippy for the host and for
`x86_64-pc-windows-msvc`, and `cargo doc -D warnings` quiet over both crates.
On the box, with only this commit applied: `RESULT: OK`, and the interface
regression at 140x35 on the code page the complaint came from — 890 samples,
90 settled frames, every one measured and none rejected, box-drawing intact.

One drive-by: `Prices::implied` documented itself by linking to a private
function, which `cargo doc -D warnings` refuses, so the link names the
function instead of promising a URL to something nobody outside the module
can reach.
2026-10-16 10:31:42 +08:00
mula.liu 345f8391ed The probe measured the distance from a cell nobody moved
`symbol_cells` asked the console one question — what does a box-drawing bar
cost — and spent the answer on sixty characters. That was already the wrong
shape of answer: what decides a price is the code page and the font the console
was left on, and nothing promises the box-drawing set and the block-shading set
land on the same side of it. But the measurement was worse than the shape, and
this is the part worth writing down.

To price a character the probe asked the console to move the cursor to an
anchor, wrote the character, read the cursor back, and computed `after.X -
at.X`: the distance from the anchor it had *requested*. On the console this was
chased on, `SetConsoleCursorPosition` returns success without moving anything.
Every read therefore returned the same cursor, and the "cost" of the nth
character was n. The temporary trace said it plainly: 1, 2, 3, and on up to 60.
`match cost { 0 => None, 1 => Single, _ => Double }` then read every character
from the third onwards as two cells wide, which is how a UTF-8 console that
charges one cell for the lot ended up with its rounded card downgraded to
ASCII, and how the earlier "this console prices bars one cell and blocks two"
found its evidence. That split was never measured. It was a counter.

The distance between two reads is the only number here that means what it looks
like, so that is what is read now: ask where the cursor is, write, ask again,
and the step is the price. A step that cannot be a price is no answer at all —
`price_from_step` accepts one cell and two cells and refuses zero, negatives,
three, and sixty, so a cursor that never moved produces a code page's guess
rather than a layout believing a number with no cells behind it. A read that
changed rows is no answer either, and neither is a row with fewer than two
columns left to answer in, and `SetConsoleCursorPosition` is still called but
its return value is deliberately ignored: a ruler that is obeyed asks all sixty
questions of the same cell, and a ruler that is ignored walks one row, which the
characters get wiped out of either way.

Because a ruler can lie in ways that still produce plausible numbers, `prices`
asks for `A` first. `A` costs one cell in every table that measures characters,
so an answer of anything else means the probe is not reading cells, and it says
"symbols unreadable: A does not cost one cell" and takes the code page's answer
instead of laying a screen out against the lie.

The answers are kept as a price list, not a verdict, and `squid-tui` asks it
only about the characters it means to draw (`witnesses`), so a console that
overcharges the shading but not the rules keeps its rounded card and gives up
only the gauges inside it. The module documentation no longer claims a split
price was measured on cp936: what the ConPTY measured there, as on 65001, is one
cell for all sixty. What remains from the real window is the symptom — a card
that fit and a gauge inside it that did not — which is the reason for the list,
not evidence about that box.

Tests: the fair-priced-and-dishonestly-priced console still downgrades only the
disputed set, and `a_step_that_cannot_be_a_price_is_not_an_answer` keeps sixty
from ever being a price again.
2026-10-15 22:28:35 +08:00
mula.liu ca53d1d140 Ask the console what it holds, and what it charges per cell
Both numbers an interface is laid out against used to be taken on trust: the
size the terminal reported, and the one column per glyph that a layout measured
in columns pays for. On the Windows console in front of us, both were wrong,
and both failures arrive at the same place — cells written past the end of a row
reappear at the start of the next one, so the screen becomes several copies of
itself at several offsets and looks like a renderer that cannot count.

`squid-platform::console` measures instead of trusting. It asks three questions
because a console has three ways to be too optimistic — the window, the buffer
behind it, and the largest window it could show at all — and it asks them of the
buffer being *shown*, because entering the alternate screen on a legacy console
activates a second buffer while the process keeps holding the handle it started
with, which then describes a screen nobody is looking at. A window wider than
the cells that exist is where the wrapping starts, so `repair` asks the console
for the cells it does have; a window that slid down its own scrollback moves the
picture without moving the size, which is why the renderer watches the offset too
and wipes rather than diffs when the screen moved under it.

The second measurement is what makes a whole screen break at once. East Asian
Ambiguous characters have no agreed price, and a console left on a Far-Eastern
code page charges two cells for exactly the class of characters an interface is
built out of: the rules, the shading, the arrows, the ticks, the middot. ratatui
charges one, so every row of the layout is longer than the glass by the symbols
it contains. `symbol_cells` writes one box-drawing bar and reads how far the
cursor moved, because the two things that decide the price — code page and
font — are both set outside this program, and `chcp 65001` moves the same bar
back to one cell on the box that charges two.

`squid-tui::glyphs` then rewrites the finished frame one column for one column:
the rules become `|-+`, the gauges `#`, the arrows `<^>v`, so the rows fit
without the layout moving at all. Chinese text and ordinary letters are left
alone — neither is ambiguous, so neither caused the overflow, and a person's
paths and process names are not what an alignment bug should be allowed to
rewrite. `SQUID_SYMBOL_CELLS` overrides the measurement for the case the
measurement cannot reach: over ssh this program measures the console sshd made
for it, not the one on the glass. `SQUID_CONSOLE_TRACE` writes the two buffer
answers side by side, since a hand-made resize leaves no other evidence.
2026-10-15 21:20:14 +08:00
mula.liu 40975f3c8e Let the platform answer questions about the platform
Three things the interface used to assume from its own build rather than from
the machine it was on.

`device()` says whether to address the user's machine as a Mac, a PC, or a
machine. The status line asked the locale, so the Chinese interface on a
Windows box told people to press `s` to scan 这台 Mac.

`bin_noun()` says what the operating system calls the place deleted files wait
in. Windows calls it the Recycle Bin and has no Trash folder to open, so copy
promising "empty the Trash" there sends the user to a control that does not
exist — in the header, in the mode chip, in the group list, in `history`, in
`doctor`, and in the `--trash` help.

`trash_target()` for Linux now resolves the XDG Trash instead of falling back
to "no trash here", which made `doctor` claim deletions were permanent on any
desktop that does have one.
2026-10-15 18:54:51 +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