docs: pivot launcher to Launcher.exe + portable layout + ~/.cmbot data

- Launcher is a compiled Python/PyInstaller Launcher.exe (retires update.ps1
  and install_local.ps1)
- portable: extract to any writable dir; InstallRoot = Launcher.exe's folder,
  no longer tied to %LOCALAPPDATA%
- user data moves to ~/.cmbot (%USERPROFILE%\.cmbot): always writable, per-user,
  survives program updates; get_data_dir() three-tier (env -> ~/.cmbot -> dev root)
- writability check now applies to the program dir only; first-run seeds default
  templates from app\config into ~/.cmbot
- docs/10 §3/§4/§5/§8/§9/§11/§16 updated; tasks 17.19 added (docs done, code TODO)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 10:37:48 +08:00
co-authored by Claude Opus 4.8
parent 54e42670f7
commit 0c9415fbcd
2 changed files with 75 additions and 48 deletions
+21
View File
@@ -917,6 +917,27 @@
- [ ] 生产前将更新源切到 HTTPS、客户端改用只读账号
- [ ] 真实环境(cm.xiapi.com)端到端实测
### 17.19 启动器改 Launcher.exe + 数据移到 ~/.cmbot(便携模型)
前置阅读:
- `docs/10-lan-update.md`(§3 架构、§4 布局、§5 数据根三级回退、§9 权限、§11、§16 阶段④)
背景:
- 改用编译的 `Launcher.exe`(Python + PyInstaller onefile)取代 `update.ps1`,对终端用户更友好。
- 程序采用便携布局:解压任意可写目录即用,安装根 = `Launcher.exe` 所在目录,不限定 `%LOCALAPPDATA%`。
- 用户数据移到 `~/.cmbot`(`%USERPROFILE%\.cmbot`):始终可写、按用户隔离、不随程序更新丢失。
任务:
- [x] 文档:`docs/10` 改为便携 + `Launcher.exe` + `~/.cmbot` 模型(§3/§4/§5/§8/§9/§11/§16)
- [ ] `get_data_dir()` 三级回退:`CMBOT_DATA_DIR` → 打包态 `~/.cmbot` → 开发态项目根;更新单测
- [ ] `src/launcher.py`:复用 `update_service`,下载 zip→SHA-256→解压→`app/app.old` 切换→启动;安装根可写性检测;首次把 `app\config\` 默认模板播种到 `~/.cmbot`
- [ ] `build.ps1` 增产 `Launcher.exe`(PyInstaller onefile),发布 zip 含 `Launcher.exe` + `app\`
- [ ] 退休 `scripts/update.ps1` 与 `scripts/install_local.ps1`
- [ ] 端到端实测(解压到 D 盘运行、自更新、回滚)
## 18. 后续暂缓任务
以下任务第一阶段暂不做,后续需要时再新增设计文档: