diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-24 00:23:30 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-24 00:23:30 +0900 |
| commit | af0df92e1ecc82823a510646b7545278caeac4b8 (patch) | |
| tree | 4b735eed50dd369895600c2f7cfd0039d274b2af /crates/mozart/src/commands/archive.rs | |
| parent | 2622fa3089d1df249276083d157e43b080a59100 (diff) | |
| download | php-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/archive.rs')
| -rw-r--r-- | crates/mozart/src/commands/archive.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/mozart/src/commands/archive.rs b/crates/mozart/src/commands/archive.rs index 335343d..2490246 100644 --- a/crates/mozart/src/commands/archive.rs +++ b/crates/mozart/src/commands/archive.rs @@ -94,6 +94,9 @@ pub async fn execute( self_exclusion_patterns, }; + let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache); + let repo_cache = mozart_registry::cache::Cache::repo(&cache_config); + // 1. Determine working directory let working_dir = match &cli.working_dir { Some(dir) => PathBuf::from(dir), @@ -150,7 +153,7 @@ pub async fn execute( let meta: PackageMeta = if let Some(ref pkg_name) = args.package { // Remote package mode console.info("Searching for the specified package."); - resolve_remote_package(pkg_name, args.version.as_deref(), console).await? + resolve_remote_package(pkg_name, args.version.as_deref(), &repo_cache, console).await? } else { // Root package mode if !composer_json_path.exists() { @@ -244,6 +247,7 @@ pub async fn execute( async fn resolve_remote_package( package_name: &str, version_constraint: Option<&str>, + repo_cache: &mozart_registry::cache::Cache, console: &mozart_core::console::Console, ) -> anyhow::Result<PackageMeta> { use mozart_core::package::Stability; @@ -265,7 +269,8 @@ async fn resolve_remote_package( let version_constraint = constraint_stripped.as_deref(); // Fetch versions from Packagist - let versions = mozart_registry::packagist::fetch_package_versions(package_name, None).await?; + let versions = + mozart_registry::packagist::fetch_package_versions(package_name, repo_cache).await?; if versions.is_empty() { anyhow::bail!("No versions found for package \"{}\"", package_name); } |
