feat: migrate config beside executable

This commit is contained in:
QiuSW
2026-07-27 11:33:22 +08:00
parent 206794f78c
commit eeb7950806
9 changed files with 307 additions and 42 deletions
+4 -4
View File
@@ -3,7 +3,7 @@ id: T-403
title: 便携配置路径与安全 legacy 迁移
phase: 4
deps: [T-202, T-309]
status: TODO
status: DONE
created: 2026-07-27
owner: codex
---
@@ -29,8 +29,8 @@ owner: codex
## 执行记录
- 状态:TODO
- 变更:已完成需求、架构、API、交互和迁移决策记录;待实施。
- 验证:待执行。
- 状态:DONE
- 变更:新增 exe 同级 `DefaultPath()`、legacy `LegacyPath()`、统一 `OpenDefault()` 与严格目标优先的原子迁移。CLI 和 GUI 均改用该入口;GUI 配置不可用时提供不含路径或配置内容的恢复反馈,CLI 返回稳定泛化错误。补充根目录配置和临时文件忽略规则。
- 验证:已执行 `gofmt`、`go test ./...`、`go test -race ./cmd/chub ./internal/platform/config`、`go vet ./...`、`go build -o build/chub.exe ./cmd/chub` 和 `powershell -ExecutionPolicy Bypass -File scripts/smoke-windows.ps1`,均通过。Windows smoke 已验证 CLI 从 exe 同级 Store 读取配置。
- 阻塞:无。
- 残余风险:程序安装到不可写目录时 strict portable 策略会拒绝保存;可配置路径/安装版回退留待后续任务。