perf: cache winget list to avoid per-app subprocess calls#5
Conversation
…tstrap Co-authored-by: ycookiey <70356861+ycookiey@users.noreply.github.com>
…-sync - Add install/wingetfile.json for declarative winget app list - Add install/winget.ps1 to install from wingetfile.json - Add winget export auto-sync to pwsh/sync.ps1 - Remove install/claude-code.ps1 (out of scope) - Remove install/google-ime.ps1 (consolidated into wingetfile.json) - Update setup.ps1 to call winget.ps1 instead of individual scripts - Update README.md to reflect wingetfile.json Co-authored-by: ycookiey <70356861+ycookiey@users.noreply.github.com>
Co-authored-by: ycookiey <70356861+ycookiey@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Scoop と同様に、Winget アプリを install/wingetfile.json で宣言的に管理し、setup.ps1 の導入処理と pwsh/sync.ps1 の自動同期フローに組み込む PR。
Changes:
install/wingetfile.jsonを追加し、Winget アプリの宣言的リストを導入install/winget.ps1を追加し、未導入アプリのみをwinget installで導入pwsh/sync.ps1にwinget exportベースの wingetfile 自動同期を追加(winget ソースのみ)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.ps1 | セットアップ中に install/winget.ps1 を実行して winget アプリ導入を統合 |
| pwsh/sync.ps1 | winget export から install/wingetfile.json を自動生成・更新する同期処理を追加 |
| install/wingetfile.json | Winget 管理対象アプリの宣言ファイルを新規追加 |
| install/winget.ps1 | wingetfile.json を読み、未インストール分のみ導入するインストーラを新規追加 |
| README.md | Winget アプリが wingetfile から自動導入される旨を追記 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: ycookiey <70356861+ycookiey@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds Winget-based app installation to the dotfiles bootstrap flow and improves performance by avoiding repeated WinGet subprocess calls during install checks, while also introducing a Wingetfile sync mechanism.
Changes:
- Invoke a new
install/winget.ps1fromsetup.ps1to install apps listed ininstall/wingetfile.json. - Add Winget export-based synchronization to regenerate
install/wingetfile.jsonfrom installed Winget-source packages. - Update README to document Wingetfile-driven installs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.ps1 | Calls the new Winget installer script during setup and logs the step. |
| pwsh/sync.ps1 | Adds winget export-based generation of install/wingetfile.json. |
| install/wingetfile.json | Introduces declarative Winget app list (initial entry). |
| install/winget.ps1 | Implements Winget install loop with a cached installed-apps check. |
| README.md | Documents that Winget apps are installed from install/wingetfile.json. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the dotfiles bootstrap/setup pipeline by adding Winget-based app installation (driven by install/wingetfile.json) and by avoiding per-app winget list subprocess calls via a cached installed-apps lookup.
Changes:
- Add
install/winget.ps1andinstall/wingetfile.jsonto install Winget apps duringsetup.ps1. - Extend
pwsh/sync.ps1to auto-generate/syncinstall/wingetfile.jsonfromwinget export(winget source only). - Update README to document Winget app installation via
wingetfile.json.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.ps1 | Runs the new Winget install step as part of setup. |
| pwsh/sync.ps1 | Adds best-effort sync of install/wingetfile.json using winget export. |
| install/wingetfile.json | Introduces the Winget app manifest (initial app list). |
| install/winget.ps1 | Installs Winget apps and caches installed apps to reduce subprocess overhead. |
| README.md | Documents that Winget apps are installed from install/wingetfile.json. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Cache list of installed apps once to avoid repeated winget invocations in the loop | ||
| $installedAppIds = @{} | ||
| $installedAppsOutput = winget list --output json 2>$null | ||
| if ($LASTEXITCODE -eq 0) { | ||
| try { |
There was a problem hiding this comment.
Updated the PR description to accurately reflect the implementation: winget list --output json → JSON parse → hashtable lookup ($installedAppIds.ContainsKey()), not regex matching.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
install/winget.ps1was callingwinget list --id <id> -einside the loop for every app inwingetfile.json, making setup time linear in app count due to repeated subprocess overhead.winget list --output jsononce before the loop, parse JSON, and build a hashtable of installed package IDs for O(1) lookupwinget list --idwith$installedAppIds.ContainsKey()against the cached hashtable, ensuring exact ID matching without regex false positivesinstall/wingetfile.jsonpath🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.