Skip to content

feat: add read-only setup plan preview - #10

Merged
forgottenlab merged 1 commit into
mainfrom
codex/p1-a-setup-plan
Nov 21, 2026
Merged

forgottenlab merged 1 commit into
mainfrom
codex/p1-a-setup-plan

Conversation

@forgottenlab

Copy link
Copy Markdown
Owner

改动 / What changed

本次为 PathPilot 新增 P1-A 首次初始化规划能力。用户可以在不修改本机配置或目录的情况下,预览受管目录布局及潜在冲突。

主要改动

  • 新增 pathpilot setup plan --root <path> --source <path> 命令,支持 --json 输出。
  • 新增 app/core/planning.py,与现有运行时共用 22 项受管目录定义。
  • 区分待创建目录、可复用目录和阻断项,并提示应用时需要重新验证。
  • 检测受保护路径、来源重叠、同名文件冲突、不可访问来源及不安全的路径重定向。
  • 配置缺失时使用内存默认值;配置损坏时仅报告错误,不覆盖或重命名原文件。
  • 同步更新 CLI 指引、中英文 README、CHANGELOG 和相关测试。

使用示例

pathpilot setup plan --root "D:\PathPilot" --source "C:\Downloads" --json

存在阻断项时,命令返回非零退出码,同时保留可解析的 JSON 输出。

检查 / How it was checked

Codex 已在本地完成以下验证:

  • P1-A 专项测试:8 passed。
  • 相关回归测试:52 passed,1 skipped。
  • 验证 CLI --help 和阻断状态下的 JSON 输出。
  • 验证成功与阻断场景均不会新增或修改配置、日志、锁文件、.corrupt 文件及受管目录。
  • 对比执行前后的文件清单、内容和修改时间,确认预览保持只读。

跳过的是现有 Windows 符号链接测试,当前账户缺少创建符号链接所需的权限。

以上结果来自本地验证,GitHub CI 结果以本 PR 实际检查为准。

范围与限制 / Scope and limitations

本次仅实现显式路径的只读规划,不包含:

  • 自动选盘及 Windows Known Folder 探测。
  • setup apply 或实际目录创建。
  • Windows Downloads 重定向、环境变量修改或文件迁移。
  • GUI 修改、Watcher 启动或真实安装器执行。

规划预览不通过创建测试文件判断写入权限。未来应用时必须重新验证目录权限与路径状态。

English Summary

  • Add a read-only setup planner for explicit root and source paths.
  • Reuse 22 managed directory definitions.
  • Report planned, reusable, and blocked paths with structured JSON output.
  • Preserve configuration and filesystem state during previews, including error cases.
  • Validation: 8 focused tests passed; 52 related tests passed and 1 was skipped due to Windows symlink permissions.

Automatic drive discovery and setup application remain out of scope.

@forgottenlab
forgottenlab merged commit 5f4622f into main Nov 21, 2026
8 checks passed
@forgottenlab
forgottenlab deleted the codex/p1-a-setup-plan branch November 21, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant