File tree Expand file tree Collapse file tree
.trellis/tasks/05-20-skills-installer-private-module-split Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # design: skills installer private module split
2+
3+ ## Scope
4+
5+ 本任务只拆分 ` ai/skills/Install-Skills.ps1 ` 内部的 skills 安装器领域逻辑。拆出的文件放在 ` ai/skills/private/ ` ,通过入口脚本 dot-source 加载,不进入 ` psutils ` ,也不改变配置字段、安装语义或外部命令参数。
6+
7+ 入口脚本继续作为唯一 CLI 入口,负责:
8+
9+ * 声明参数与脚本级帮助。
10+ * 初始化 ` Set-StrictMode ` 、` $ErrorActionPreference ` 、` $script:SkillsInstallerRoot ` 、` $script:SkillsRepoRoot ` 。
11+ * 导入 ` psutils/modules/process.psm1 ` 与 ` psutils/modules/config.psm1 ` 。
12+ * 按顺序加载私有脚本。
13+ * 保留 ` Invoke-SkillsInstallMain ` 与最终 ` exit ` 调用。
14+
15+ ## File Layout
16+
17+ 新增 ` ai/skills/private/ ` :
18+
19+ * ` bootstrap.ps1 `
20+ * 字符串数组转换、默认路径、用户目录、agent skill 目录、已安装目录检查。
21+ * ` plan.ps1 `
22+ * 配置读取、agent/scope/source 解析、命令计划、完整安装计划生成。
23+ * ` presentation.ps1 `
24+ * 安装计划展示与脚本级确认。
25+ * ` execution.ps1 `
26+ * tool check、pending plan 过滤、单步执行和计划执行。
27+
28+ ## Load Order
29+
30+ ` Install-Skills.ps1 ` 先导入共享 ` psutils ` 模块,再按以下顺序 dot-source 私有脚本:
31+
32+ 1 . ` bootstrap.ps1 `
33+ 2 . ` plan.ps1 `
34+ 3 . ` presentation.ps1 `
35+ 4 . ` execution.ps1 `
36+
37+ 这个顺序保证私有脚本可以直接复用共享配置/进程 helper,以及前置私有 helper。
38+
39+ ## Compatibility
40+
41+ * 保留现有函数名,测试继续通过 dot-source ` Install-Skills.ps1 ` 访问这些函数。
42+ * 保留 ` SKILLS_INSTALLER_SKIP_MAIN=1 ` 测试入口语义。
43+ * 保留 ` WhatIf ` 、` DryRun ` 、` Yes ` 、` Force ` 行为。
44+ * 保留日志文件创建与命令执行器注入方式。
45+
46+ ## Tradeoffs
47+
48+ 本轮不引入 ` .psm1 ` 模块导出或构建型单文件 bundle。当前优先目标是降低入口脚本体积和提高领域边界可读性;如果后续需要发布单文件脚本,可再增加构建脚本把 ` private/*.ps1 ` inline 到 bundle。
49+
50+ ## Rollback
51+
52+ 如拆分后出现加载或作用域问题,可把 ` private/*.ps1 ` 的函数按原顺序合并回 ` Install-Skills.ps1 ` ,删除 dot-source 加载块即可恢复单文件结构。
Original file line number Diff line number Diff line change 1+ # implement: skills installer private module split
2+
3+ ## Checklist
4+
5+ 1 . 准备任务状态
6+ * 补齐 ` design.md ` 与 ` implement.md ` 。
7+ * 执行 ` task.py start ` 将任务状态切到 ` in_progress ` 。
8+ 2 . 新建私有脚本目录
9+ * 创建 ` ai/skills/private/bootstrap.ps1 ` 。
10+ * 创建 ` ai/skills/private/plan.ps1 ` 。
11+ * 创建 ` ai/skills/private/presentation.ps1 ` 。
12+ * 创建 ` ai/skills/private/execution.ps1 ` 。
13+ 3 . 迁移函数
14+ * 将无 CLI 参数依赖的 helper 按边界移动到私有脚本。
15+ * 入口脚本保留参数、共享模块导入、私有脚本加载、` Invoke-SkillsInstallMain ` 与最终执行块。
16+ * 保留原有 comment-based help,不改变函数名和参数。
17+ 4 . 验证兼容性
18+ * ` pnpm exec pwsh -NoProfile -File ./scripts/pwsh/devops/Invoke-PesterMode.ps1 -Mode serial -Path ./tests/SkillsInstaller.Tests.ps1 `
19+ * ` pnpm qa `
20+ * ` pnpm test:pwsh:all `
21+ 5 . Review gate
22+ * 确认 ` Install-Skills.ps1 ` 行数明显下降。
23+ * 确认没有新增 ` psutils ` 领域外逻辑。
24+ * 确认工作区只包含本任务相关文件。
25+
26+ ## Rollback Points
27+
28+ * 私有脚本加载失败:先检查 dot-source 路径和加载顺序。
29+ * 函数不可见:确认测试仍 dot-source 入口脚本,而不是直接调用私有脚本。
30+ * 行为回归:通过 ` git diff ` 比对迁移块,优先恢复对应函数原文再缩小拆分范围。
Original file line number Diff line number Diff line change 33 "name" : " skills-installer-private-module-split" ,
44 "title" : " skills installer private module split" ,
55 "description" : " " ,
6- "status" : " planning " ,
6+ "status" : " in_progress " ,
77 "dev_type" : null ,
88 "scope" : null ,
99 "package" : null ,
You can’t perform that action at this time.
0 commit comments