[3.0] Add check-update command and CheckUpdateInterface for artifacts#1044
Open
crazywhalecc wants to merge 13 commits intov3-refactor/extensionsfrom
Open
[3.0] Add check-update command and CheckUpdateInterface for artifacts#1044crazywhalecc wants to merge 13 commits intov3-refactor/extensionsfrom
check-update command and CheckUpdateInterface for artifacts#1044crazywhalecc wants to merge 13 commits intov3-refactor/extensionsfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new check-update CLI command plus a CheckUpdateInterface so artifact downloaders (and custom binaries via attributes) can report whether an update is available, using cached version metadata when present.
Changes:
- Introduce
check-updatecommand and plumbing inArtifactDownloaderto perform update checks. - Add
CheckUpdateInterface/CheckUpdateResultand implement update checking for multiple downloader types (git, ghrel, ghtar/ghtagtar, filelist, php-release, pie). - Persist downloader class metadata in download cache and add a new
#[CustomBinaryCheckUpdate]attribute for custom binary artifacts.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/StaticPHP/Registry/ArtifactLoader.php | Registers #[CustomBinaryCheckUpdate] callbacks during artifact loading. |
| src/StaticPHP/Exception/WrongUsageException.php | Attempts to mark exception as “simple output”. |
| src/StaticPHP/Exception/SPCException.php | Adds simple-output flag + getters/setters for exception handling. |
| src/StaticPHP/Exception/RegistryException.php | Attempts to mark exception as “simple output”. |
| src/StaticPHP/Exception/InterruptException.php | Attempts to mark exception as “simple output”. |
| src/StaticPHP/Exception/ExceptionHandler.php | Switches “minor log” behavior to per-exception isSimpleOutput(). |
| src/StaticPHP/ConsoleApplication.php | Registers the new check-update command. |
| src/StaticPHP/Command/CheckUpdateCommand.php | Implements check-update CLI command with JSON/bare options and --with-php. |
| src/StaticPHP/Attribute/Artifact/CustomBinaryCheckUpdate.php | New attribute to bind custom binary update-check callbacks. |
| src/StaticPHP/Artifact/Downloader/Type/Url.php | Tags download results with downloader class name. |
| src/StaticPHP/Artifact/Downloader/Type/PhpRelease.php | Implements CheckUpdateInterface for php.net releases and git mode. |
| src/StaticPHP/Artifact/Downloader/Type/PIE.php | Implements CheckUpdateInterface for Packagist “pie” artifacts. |
| src/StaticPHP/Artifact/Downloader/Type/LocalDir.php | Tags download results with downloader class name. |
| src/StaticPHP/Artifact/Downloader/Type/HostedPackageBin.php | Tags download results with downloader class name; minor instantiation tweak. |
| src/StaticPHP/Artifact/Downloader/Type/GitHubTarball.php | Implements CheckUpdateInterface for ghtar/ghtagtar and tags results with downloader. |
| src/StaticPHP/Artifact/Downloader/Type/GitHubRelease.php | Implements CheckUpdateInterface for ghrel and tags results with downloader. |
| src/StaticPHP/Artifact/Downloader/Type/Git.php | Implements CheckUpdateInterface; tags results with downloader; stores hash in version for rev. |
| src/StaticPHP/Artifact/Downloader/Type/FileList.php | Implements CheckUpdateInterface; refactors to share “latest version” fetch logic. |
| src/StaticPHP/Artifact/Downloader/Type/CheckUpdateResult.php | New DTO for update check results. |
| src/StaticPHP/Artifact/Downloader/Type/CheckUpdateInterface.php | New interface contract for update checking. |
| src/StaticPHP/Artifact/Downloader/Type/BitBucketTag.php | Tags download results with downloader class name. |
| src/StaticPHP/Artifact/Downloader/DownloadResult.php | Adds optional downloader field and threads it through factory methods. |
| src/StaticPHP/Artifact/ArtifactDownloader.php | Adds core checkUpdate() logic (cache-based + bare mode + custom callbacks). |
| src/StaticPHP/Artifact/ArtifactCache.php | Persists downloader metadata into .cache.json. |
| src/StaticPHP/Artifact/Artifact.php | Stores and resolves custom binary check-update callbacks per platform. |
| src/Package/Artifact/zig.php | Adds custom binary update check implementation via new attribute. |
| src/Package/Artifact/go_xcaddy.php | Adds custom binary update check implementation via new attribute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/StaticPHP/Artifact/Downloader/Type/CheckUpdateInterface.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Owner
Author
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.

What does this PR do?
This PR implements the
check-updatecommand and update check interfaces for several commonly used download types:filelist,git,ghrel,ghtar,ghtagtar,php-release, andpie.Note that
php-releasetype will return an update requirement when using--with-phpto specify different major versions.Closes #895
Checklist before merging
*.phpor*.json, run them locally to ensure your changes are valid:composer cs-fixcomposer analysecomposer testbin/spc dev:sort-configsrc/globals/test-extensions.php.extension testortest extensionsto trigger full test suite.