feat: auto-download cli binary in editor window#137
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Unity Editor window now downloads the pinned
prefablensCLI binary automatically when it is missing, instead of showing a "Download from GitHub Releases" button on every package-version bump. The download runs off the main thread with progress in the status line, and staleLibrary/PrefabLens/<old-version>/caches are cleaned up best-effort after a successful download.Closes #135
Motivation
Cli.Versionbumps with every package update, so each upgrade dropped users back to the not-found screen for a click that adds nothing: installing the package already expressed intent, the asset is version-pinned from the project's own releases, and the README/site copy has always described the download as automatic. The old code also blocked the Unity main thread behind a modal progress bar, which auto-triggering would have made unacceptable.Changes
Cli.Download()no longer touches Unity APIs (modal progress bar removed) so it can run on a worker thread;.GetAwaiter().GetResult()unwrapsAggregateExceptionfor clean error messagesCli.DownloadAsync(Action<string, string> onDone)mirrors the existingRunAsyncSynchronizationContext pattern; exactly one of (path, error) is non-nullCli.ExtractToandCli.DeleteStaleVersions(best-effort: a locked old-version directory on Windows cannot fail a successful download), both unit-testedPrefabLensWindow.Refresh()auto-starts the download once per session whenCli.Find()misses; status line showsDownloading prefablens v{Version}…; failure falls back to the manual screen with the error and a retry button sharing the sameStartDownloadpath;DownloadThenRefreshdeletedlastStdoutso the post-download re-render cannot be skipped byOnBulkDone's unchanged-output dedupe (this also fixes a pre-existing latent variant on the manual path)EditorPrefsmanual override (PrefabLens.CliPath) and version pinning are unchanged; no PATH searchTesting
dotnet test DotNetTests~/Tests: 25/25 passed (3 new tests: real in-memory zip extraction, stale-version cleanup, missing-root no-op)dotnet csharpier check . --no-msbuild-check: cleanNote
Post-merge manual task: real-Unity GUI smoke — with a fresh
Library/, openWindow > PrefabLensand confirm the automatic download then the changed list; offline, confirm the error + retry screen. The dotnet harness proves compile + pure logic only.