From d0d8d43ba37d2179c4bd92018169d48f6633d14e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 8 May 2026 23:59:29 +0900 Subject: fix(validate): align with Composer's ValidateCommand pipeline - Wire Composer::try_load_from_file so validate uses typed Config.lock instead of a raw JSON read for the should-check-lock decision - Surface LockFile::get_missing_requirement_info in check_lock_freshness, mirroring Composer's locker->getMissingRequirementInfo call - Replace inline per-dep error/warning printing with output_result calls so each dependency gets the same header format as the root file - Switch --with-dependencies to RepositoryManager + InstallationManager; skip metapackages; fall back to vendor walk when Composer unavailable - Move license wrong-type from warnings to errors (divergence #10), matching ValidatingArrayLoader's classification Co-Authored-By: Claude Sonnet 4.6 --- crates/mozart-core/src/composer.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/mozart-core/src/composer.rs') diff --git a/crates/mozart-core/src/composer.rs b/crates/mozart-core/src/composer.rs index effcae4..c76f428 100644 --- a/crates/mozart-core/src/composer.rs +++ b/crates/mozart-core/src/composer.rs @@ -644,6 +644,18 @@ impl Composer { create_composer(project_dir, &composer_json).map(Some) } + /// Load Composer state keyed on a specific `composer.json` file, deriving + /// the project directory from `file.parent()`. Mirrors + /// `ValidateCommand::createComposerInstance($file)` — Composer keys + /// instances on a file rather than a directory for non-default paths. + pub fn try_load_from_file(file: &Path) -> anyhow::Result> { + let project_dir = file + .parent() + .map(Path::to_path_buf) + .unwrap_or_else(|| PathBuf::from(".")); + Self::try_load(project_dir) + } + pub fn project_dir(&self) -> &Path { &self.project_dir } -- cgit v1.3.1