aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/create_project.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/create_project.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/create_project.rs')
-rw-r--r--crates/mozart/src/commands/create_project.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/mozart/src/commands/create_project.rs b/crates/mozart/src/commands/create_project.rs
index 83ad21d..63d8a1a 100644
--- a/crates/mozart/src/commands/create_project.rs
+++ b/crates/mozart/src/commands/create_project.rs
@@ -272,7 +272,10 @@ pub async fn execute(
));
console.info("Loading composer repositories with package information");
- let versions = packagist::fetch_package_versions(&package_name, None).await?;
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let repo_cache = mozart_registry::cache::Cache::repo(&cache_config);
+
+ let versions = packagist::fetch_package_versions(&package_name, &repo_cache).await?;
// Find the best candidate matching the version constraint and stability
let best = if let Some(ref constraint) = version_constraint {
@@ -411,7 +414,7 @@ pub async fn execute(
platform: PlatformConfig::new(),
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
- repo_cache: None,
+ repo_cache: repo_cache.clone(),
temporary_constraints: HashMap::new(),
repositories: raw.repositories.clone(),
};
@@ -432,7 +435,7 @@ pub async fn execute(
composer_json_content: composer_json_content.clone(),
composer_json: raw.clone(),
include_dev: dev_mode,
- repo_cache: None,
+ repo_cache: repo_cache.clone(),
})
.await?;