aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/outdated.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-24 00:23:30 +0900
committernsfisis <nsfisis@gmail.com>2026-02-24 00:23:30 +0900
commitaf0df92e1ecc82823a510646b7545278caeac4b8 (patch)
tree4b735eed50dd369895600c2f7cfd0039d274b2af /crates/mozart/src/commands/outdated.rs
parent2622fa3089d1df249276083d157e43b080a59100 (diff)
downloadphp-mozart-af0df92e1ecc82823a510646b7545278caeac4b8.tar.gz
php-mozart-af0df92e1ecc82823a510646b7545278caeac4b8.tar.zst
php-mozart-af0df92e1ecc82823a510646b7545278caeac4b8.zip
feat(cache): enable repo cache for all Packagist API calls
Remove the Option wrapper from repo_cache in ResolveRequest, LockFileGenerationRequest, and fetch_package_versions. All commands now initialize a Cache via build_cache_config(cli.no_cache), ensuring Packagist metadata is cached to disk (respecting --no-cache flag). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/outdated.rs')
-rw-r--r--crates/mozart/src/commands/outdated.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/mozart/src/commands/outdated.rs b/crates/mozart/src/commands/outdated.rs
index 09e36a9..4d0226d 100644
--- a/crates/mozart/src/commands/outdated.rs
+++ b/crates/mozart/src/commands/outdated.rs
@@ -102,6 +102,9 @@ pub async fn execute(
cli: &super::Cli,
console: &mozart_core::console::Console,
) -> anyhow::Result<()> {
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let repo_cache = mozart_registry::cache::Cache::repo(&cache_config);
+
// Validate mutually exclusive level filters
let level_count = args.major_only as u8 + args.minor_only as u8 + args.patch_only as u8;
if level_count > 1 {
@@ -172,7 +175,7 @@ pub async fn execute(
}
// Fetch latest version from Packagist
- let latest = match fetch_latest_version(&pkg.name).await {
+ let latest = match fetch_latest_version(&pkg.name, &repo_cache).await {
Ok(v) => v,
Err(_) => {
// Skip packages we can't fetch (platform packages, private, etc.)
@@ -323,11 +326,14 @@ fn load_locked_packages(working_dir: &Path, no_dev: bool) -> anyhow::Result<Vec<
// ─── Version fetching ────────────────────────────────────────────────────────
-async fn fetch_latest_version(name: &str) -> anyhow::Result<PackageInfo> {
+async fn fetch_latest_version(
+ name: &str,
+ repo_cache: &mozart_registry::cache::Cache,
+) -> anyhow::Result<PackageInfo> {
use mozart_core::package::Stability;
use mozart_registry::version::find_best_candidate;
- let versions = mozart_registry::packagist::fetch_package_versions(name, None).await?;
+ let versions = mozart_registry::packagist::fetch_package_versions(name, repo_cache).await?;
let best = find_best_candidate(&versions, Stability::Stable)
.ok_or_else(|| anyhow::anyhow!("No stable version found for {name}"))?;