aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/remove.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-09 02:29:35 +0900
committernsfisis <nsfisis@gmail.com>2026-05-09 02:29:49 +0900
commitf0192390ae1d89981f59395307e885a595f86eef (patch)
tree45810437c406c2a6c5bc062b30f2dbbf1326eb59 /crates/mozart/src/commands/remove.rs
parent720430c0d08817f1113cbf35b541eaf673679fb9 (diff)
downloadphp-mozart-f0192390ae1d89981f59395307e885a595f86eef.tar.gz
php-mozart-f0192390ae1d89981f59395307e885a595f86eef.tar.zst
php-mozart-f0192390ae1d89981f59395307e885a595f86eef.zip
refactor(update): Slice A — align update.rs with Composer's UpdateCommand pipeline
- Rename ChangeKind::Remove → Uninstall, drop Unchanged variant (propagate to remove.rs / require.rs); mirrors Composer's UninstallOperation naming - Fix magic-keyword mirrors detection: use Composer's count-diff semantic (any keyword triggers mirrors mode) instead of all-are-magic; mutex check now fires correctly for mixed lists like `update foo lock` - Add --patch-only pre-solve lock-presence check (previously missing; Composer throws InvalidArgumentException when no lock exists) - Add --patch-only pre-solve constraint injection: inject >=M.N.P.0,<M.(N+1).0.0 into temporary_constraints before the resolver runs, mirroring UpdateCommand::execute 177-195 - Delegate --bump-after-update to bump::do_bump (mirrors Composer's BumpCommand::doBump delegate); add \!--lock guard per Composer 280-282 - Drop parse_minimum_stability wrapper; call package::Stability::parse directly - Replace is_platform_dep with is_platform_package from mozart_core::platform (the local variant was incomplete: missed hhvm and composer pseudo-packages) - Wrap "Lock file operations" and "Writing lock file" in <info> tags - Update --no-suggest deprecation wording to match Composer 3 message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/remove.rs')
-rw-r--r--crates/mozart/src/commands/remove.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs
index 2941867..f2a841c 100644
--- a/crates/mozart/src/commands/remove.rs
+++ b/crates/mozart/src/commands/remove.rs
@@ -375,7 +375,7 @@ pub async fn execute(
.collect();
let removals: Vec<_> = changes
.iter()
- .filter(|c| matches!(c.kind, super::update::ChangeKind::Remove { .. }))
+ .filter(|c| matches!(c.kind, super::update::ChangeKind::Uninstall { .. }))
.collect();
console.info(&console_format!(
@@ -390,7 +390,7 @@ pub async fn execute(
for change in &changes {
match &change.kind {
- super::update::ChangeKind::Remove { old_version } => {
+ super::update::ChangeKind::Uninstall { old_version } => {
if args.dry_run {
console.info(&format!(
" - Would remove {} ({})",
@@ -432,7 +432,6 @@ pub async fn execute(
));
}
}
- super::update::ChangeKind::Unchanged => {}
}
}
@@ -861,7 +860,7 @@ mod tests {
assert!(composer.require.contains_key("psr/log"));
}
- /// After re-resolve, removed packages appear as `ChangeKind::Remove` in the change report.
+ /// After re-resolve, removed packages appear as `ChangeKind::Uninstall` in the change report.
#[test]
fn test_remove_change_report_shows_removals() {
let old_lock = minimal_lock(vec![
@@ -878,10 +877,10 @@ mod tests {
assert!(
matches!(
&changes[0].kind,
- super::super::update::ChangeKind::Remove { old_version }
+ super::super::update::ChangeKind::Uninstall { old_version }
if old_version == "3.8.0"
),
- "monolog/monolog should appear as a Remove change"
+ "monolog/monolog should appear as an Uninstall change"
);
}