Skip to content

[3.0] Add check-update command and CheckUpdateInterface for artifacts#1044

Open
crazywhalecc wants to merge 13 commits intov3-refactor/extensionsfrom
v3-feat/check-update
Open

[3.0] Add check-update command and CheckUpdateInterface for artifacts#1044
crazywhalecc wants to merge 13 commits intov3-refactor/extensionsfrom
v3-feat/check-update

Conversation

@crazywhalecc
Copy link
Owner

@crazywhalecc crazywhalecc commented Feb 28, 2026

What does this PR do?

This PR implements the check-update command and update check interfaces for several commonly used download types: filelist, git, ghrel, ghtar, ghtagtar, php-release, and pie.

Note that php-release type will return an update requirement when using --with-php to specify different major versions.

Closes #895

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php or *.json, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:sort-config
  • If it's an extension or dependency update, please ensure the following:
    • Add your test combination to src/globals/test-extensions.php.
    • If adding new or fixing bugs, add commit message containing extension test or test extensions to trigger full test suite.

@crazywhalecc crazywhalecc changed the title V3 feat/check update [3.0] Add check-update command and CheckUpdateInterface for artifacts Feb 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-update command and plumbing in ArtifactDownloader to perform update checks.
  • Add CheckUpdateInterface / CheckUpdateResult and 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.

@crazywhalecc
Copy link
Owner Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants