|
1 | 1 | ## 1. Tab 补全与 Prompt 性能修复 |
2 | 2 |
|
3 | | -- [ ] 1.1 在 `profile/features/environment.ps1` 中将 starship 的 `Invoke-WithFileCache` Generator 从 `{ & starship init powershell }` 改为 `{ & starship init powershell --print-full-init }`,使缓存包含完整初始化脚本 |
4 | | -- [ ] 1.2 删除现有的 `profile/.cache/starship-init-powershell.ps1` 缓存文件,强制下次加载时重建 |
5 | | -- [ ] 1.3 在 `profile/core/encoding.ps1` 中将 `Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete` 改为 `Set-PSReadLineKeyHandler -Key Tab -Function Complete` |
| 3 | +- [x] 1.1 在 `profile/features/environment.ps1` 中将 starship 的 `Invoke-WithFileCache` Generator 从 `{ & starship init powershell }` 改为 `{ & starship init powershell --print-full-init }`,使缓存包含完整初始化脚本 |
| 4 | +- [x] 1.2 删除现有的 `profile/.cache/starship-init-powershell.ps1` 缓存文件,强制下次加载时重建 |
| 5 | +- [x] 1.3 在 `profile/core/encoding.ps1` 中将 `Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete` 改为 `Set-PSReadLineKeyHandler -Key Tab -Function Complete` |
6 | 6 |
|
7 | 7 | ## 2. 编码初始化优化 |
8 | 8 |
|
9 | | -- [ ] 2.1 在 `profile/core/encoding.ps1` 中移除 `Get-Command -Name Set-PSReadLineKeyHandler` 检查,直接调用 `Set-PSReadLineKeyHandler`(PowerShell 7+ 内置 PSReadLine) |
10 | | -- [ ] 2.2 将 `Get-Command -Name Register-FzfHistorySmartKeyBinding` 改为 `Get-Command -Name Register-FzfHistorySmartKeyBinding -CommandType Function` |
| 9 | +- [x] 2.1 在 `profile/core/encoding.ps1` 中移除 `Get-Command -Name Set-PSReadLineKeyHandler` 检查,直接调用 `Set-PSReadLineKeyHandler`(PowerShell 7+ 内置 PSReadLine) |
| 10 | +- [x] 2.2 将 `Get-Command -Name Register-FzfHistorySmartKeyBinding` 改为 `Get-Command -Name Register-FzfHistorySmartKeyBinding -CommandType Function` |
11 | 11 |
|
12 | 12 | ## 3. 工具检测批量化 |
13 | 13 |
|
14 | | -- [ ] 3.1 在 `profile/features/environment.ps1` 的 `Initialize-Environment` 中,将工具初始化循环前的逐个 `Test-EXEProgram` 替换为单次 `Get-Command -Name @('starship','zoxide','sccache','fnm') -CommandType Application` 批量查询 |
15 | | -- [ ] 3.2 将批量查询结果存入 HashSet,后续用 `$availableTools.Contains($name)` 替代 `Test-EXEProgram` 调用 |
16 | | -- [ ] 3.3 保留工具未安装时的提示逻辑不变 |
| 14 | +- [x] 3.1 在 `profile/features/environment.ps1` 的 `Initialize-Environment` 中,将工具初始化循环前的逐个 `Test-EXEProgram` 替换为单次 `Get-Command -Name @('starship','zoxide','sccache','fnm') -CommandType Application` 批量查询 |
| 15 | +- [x] 3.2 将批量查询结果存入 HashSet,后续用 `$availableTools.Contains($name)` 替代 `Test-EXEProgram` 调用 |
| 16 | +- [x] 3.3 保留工具未安装时的提示逻辑不变 |
17 | 17 |
|
18 | 18 | ## 4. 代理探测优化 |
19 | 19 |
|
20 | | -- [ ] 4.1 在 `psutils/modules/proxy.psm1` 的 `Set-Proxy auto` 中将 TCP 超时从 100ms 缩短为 50ms |
21 | | -- [ ] 4.2 在 `Set-Proxy on` 中移除二次端口检测(200ms timeout 的 TCP 连接),改为直接设置环境变量 |
22 | | -- [ ] 4.3 在 `Initialize-Environment` 中为 `Set-Proxy auto` 包装 `Invoke-WithCache` 缓存层,缓存有效期 5 分钟 |
| 20 | +- [x] 4.1 在 `psutils/modules/proxy.psm1` 的 `Set-Proxy auto` 中将 TCP 超时从 100ms 缩短为 50ms |
| 21 | +- [x] 4.2 在 `Set-Proxy on` 中移除二次端口检测(200ms timeout 的 TCP 连接),改为直接设置环境变量 |
| 22 | +- [x] 4.3 在 `Initialize-Environment` 中为 `Set-Proxy auto` 包装 `Invoke-WithCache` 缓存层,缓存有效期 5 分钟 |
23 | 23 |
|
24 | 24 | ## 5. PSModulePath 精简 |
25 | 25 |
|
26 | | -- [ ] 5.1 在 `profile/core/loadModule.ps1` 中移除将项目父目录 `$moduleParent` 追加到 `PSModulePath` 的逻辑 |
27 | | -- [ ] 5.2 保留 PSModulePath 去重逻辑 |
| 26 | +- [x] 5.1 在 `profile/core/loadModule.ps1` 中移除将项目父目录 `$moduleParent` 追加到 `PSModulePath` 的逻辑 |
| 27 | +- [x] 5.2 保留 PSModulePath 去重逻辑 |
28 | 28 |
|
29 | 29 | ## 6. 分阶段计时诊断 |
30 | 30 |
|
31 | | -- [ ] 6.1 在 `profile/profile.ps1` 中用 `[System.Diagnostics.Stopwatch]` 替换 `Get-Date` 计时 |
32 | | -- [ ] 6.2 在关键阶段(模块加载、代理检测、工具初始化、别名注册)插入计时点 |
33 | | -- [ ] 6.3 实现 `$script:ProfileTimings` 变量存储各阶段耗时 |
34 | | -- [ ] 6.4 实现 `POWERSHELL_PROFILE_TIMING=1` 环境变量控制的详细计时输出 |
35 | | -- [ ] 6.5 默认模式下通过 `Write-Verbose` 输出计时信息 |
| 31 | +- [x] 6.1 在 `profile/profile.ps1` 中用 `[System.Diagnostics.Stopwatch]` 替换 `Get-Date` 计时 |
| 32 | +- [x] 6.2 在关键阶段(模块加载、代理检测、工具初始化、别名注册)插入计时点 |
| 33 | +- [x] 6.3 实现 `$script:ProfileTimings` 变量存储各阶段耗时 |
| 34 | +- [x] 6.4 实现 `POWERSHELL_PROFILE_TIMING=1` 环境变量控制的详细计时输出 |
| 35 | +- [x] 6.5 默认模式下通过 `Write-Verbose` 输出计时信息 |
36 | 36 |
|
37 | 37 | ## 7. 验证与测试 |
38 | 38 |
|
39 | | -- [ ] 7.1 在 Windows 上验证 Full 模式加载时间降至 ~1s 以内 |
40 | | -- [ ] 7.2 验证 Tab 补全响应速度恢复正常(即时响应) |
41 | | -- [ ] 7.3 验证 starship prompt 正常显示(缓存重建后不再每次 spawn 进程) |
42 | | -- [ ] 7.4 验证 Minimal 和 UltraMinimal 模式行为不变 |
43 | | -- [ ] 7.5 验证所有别名、函数、环境变量在 Full 模式下仍可用 |
44 | | -- [ ] 7.6 运行 `pnpm test:profile` 确保 profile 测试通过 |
45 | | -- [ ] 7.7 运行 `pnpm qa` 确保整体质量 |
| 39 | +- [ ] 7.1 在 Windows 上验证 Full 模式加载时间降至 ~1s 以内(需手动验证) |
| 40 | +- [ ] 7.2 验证 Tab 补全响应速度恢复正常(需手动验证) |
| 41 | +- [ ] 7.3 验证 starship prompt 正常显示(需手动验证) |
| 42 | +- [ ] 7.4 验证 Minimal 和 UltraMinimal 模式行为不变(需手动验证) |
| 43 | +- [ ] 7.5 验证所有别名、函数、环境变量在 Full 模式下仍可用(需手动验证) |
| 44 | +- [x] 7.6 运行 `pnpm test:profile` 确保 profile 测试通过 |
| 45 | +- [x] 7.7 运行 `pnpm qa` 确保整体质量 |
0 commit comments