aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/show.rs
AgeCommit message (Collapse)Author
2026-05-11test(commands): remove per-command testsnsfisis
2026-05-11refactor(package): rename traits and switch dep maps to IndexMapnsfisis
Rename Package/CompletePackage to PackageInterface/CompletePackageInterface to mirror Composer's interface names, and split each into its own module under crates/mozart-core/src/package/. Switch dependency-link and metadata maps from BTreeMap to indexmap::IndexMap so serialized JSON preserves the original key ordering rather than sorting alphabetically — matching PHP associative-array semantics. The --sort-packages behaviour in `require` is preserved via sort_unstable_keys.
2026-05-10refactor(io): introduce IoInterface trait mirroring Composer IOInterfacensfisis
Add an `IoInterface` trait in mozart-core::console that mirrors `\Composer\IO\IOInterface`, implement it for `Console`, and switch commands, the auditor, and the suggested-packages reporter to accept the abstracted IO (typically `Arc<Mutex<Box<dyn IoInterface>>>` at the command boundary, `&dyn IoInterface` deeper down) instead of `&Console`. The console_writeln\!/write\! macros now go through `IoInterface::verbosity()` via the lock so any implementor works.
2026-05-10refactor(workspace): consolidate crates into mozart-corensfisis
Merged mozart-archiver, mozart-autoload, mozart-registry, mozart-sat-resolver, and mozart-vcs into mozart-core to align the source layout with Composer's structure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09refactor(show): make format field non-optional with default "text"nsfisis
Replace `Option<String>` with `String` + `default_value = "text"` and derive `Default` on `ShowArgs`, eliminating local `as_deref().unwrap_or` bindings. outdated.rs switches to `..Default::default()` for the fields it doesn't set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09refactor(console): accept format args directly in console_writeln! macrosnsfisis
Eliminate the nested &console_format!(...) boilerplate at every call site by teaching console_writeln!, console_write!, console_writeln_error!, and console_write_error! to accept a format literal + variadic args directly, matching the println!/eprintln! ergonomics. Propagate the format string span into generated code so rustc errors point to the right location. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09refactor(show): Slice A — align show.rs with Composer's ShowCommand pipelinensfisis
- A3: wire --major-only/--minor-only/--patch-only version constraint filtering in fetch_latest_for_package (mirrors ShowCommand::findLatestPackage 1500-1515) - A4: implement --sort-by-age ordering by release date - A5: add abandoned-package warning after each list row - A6: print color legend before list when --latest is on; ASCII markers (\! ~ =) in non-decorated mode - A7: split list into "Direct dependencies" / "Transitive dependencies" sections when --latest && \!--direct (mirrors Composer 671-695) - A8: replace local is_platform_package with mozart_core::platform::is_platform_package - A9: emit --installed deprecation warning (mirrors Composer 143-145) - A10: apply --strict exit-code check in both installed and locked paths - A11: fetch and display latest: line in single-package detail view - A12: add conflict/provide/replace link sections to detail view - A13: add released/names/support/autoload fields to detail view - A14: use "locked" JSON key for --locked output (was incorrectly "installed") - A15: unify show_installed_package_detail + show_locked_package_detail into a single PackageDetail struct + print_package_detail function Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08fix(browse): mirror Composer's HomeCommand semanticsnsfisis
Replace the hand-rolled composer.json -> composer.lock -> Packagist fallback with a BrowseRepos composite that dispatches via a uniform find_packages(name) over the root package, the local installed repository, and the Packagist remote -- matching HomeCommand's initializeRepos() + findPackages() loop. - Extend InstalledPackageEntry with homepage/support so the local repo carries the same fields HomeCommand reads off CompletePackageInterface; propagate them through locked_to_installed_entry. - Collapse three extract_url_from_* helpers into a single handle_package mirror. - Relax is_valid_url to a filter_var(FILTER_VALIDATE_URL) analog (drop the http/https scheme allowlist). - Route warnings and "No package specified" notices to stderr; match HomeCommand's exact wording. - Merge the macOS/Linux open_browser branches; add the literal "web" window-title argument on Windows.
2026-05-06refactor(console): add write macros and migrate commands to use themnsfisis
2026-05-05chore: remove redundant commentsnsfisis
2026-05-05refactor(commands): consolidate working_dir resolution into Cli methodnsfisis
2026-05-04feat(show): expand license output with name, OSI flag, and URLnsfisis
Mirror Composer's Command\ShowCommand::printLicenses(): emit one line per license identifier, expanded to "<full name> (<id>) [(OSI approved)] <url>" when the id is in the SPDX database, or just the id otherwise. The URL is built by mozart-spdx-licenses' new LicenseInfo::url() so the construction lives in the SPDX crate, like Composer's SpdxLicenses::getLicenseByIdentifier().
2026-05-03refactor: switch internal maps/sets from HashMap to IndexMapnsfisis
Adopt indexmap workspace-wide so iteration order is deterministic and follows insertion order. The non-deterministic order of std HashMap otherwise leaks into resolver decisions when multiple valid solutions exist (e.g. cyclic require pairs under prefer-lowest), making behavior flaky and divergent from Composer's PHP-array semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-02-24feat(cache): enable repo cache for all Packagist API callsnsfisis
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>
2026-02-23refactor(cli): route command output through Console abstractionnsfisis
Replace direct println\!/eprintln\! calls with console.write(), console.info(), and console.write_stdout() across all command handlers to respect verbosity settings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23fix(update): implement --with constraints, inline shorthand, and APCu ↵nsfisis
passthrough - Parse and apply --with temporary constraints to the resolver - Support inline constraint shorthand (vendor/pkg:1.0.*) - Reject --lock combined with specific package names - Filter magic keywords (lock/nothing/mirrors) from package list - Pass APCu CLI flags through to InstallConfig instead of hardcoding Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23fix(show): validate option combinations and support --ignore wildcardsnsfisis
- Reject invalid option combinations: --direct with --all/--platform/--available, --tree with --all/--available/--latest/--path, --self with package argument - Reject unsupported --format values (only "text" and "json" allowed) - Warn when --ignore is used without --outdated - Support wildcard patterns in --ignore values via matches_wildcard Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23fix(show,outdated): align outdated classification and wildcard handling with ↵nsfisis
Composer - Extract matches_wildcard to mozart-core for reuse across commands - Support wildcard patterns in --package and --ignore arguments - Use ^<installed_version> for semver-safe classification instead of root constraint - Replace std::process::exit(1) with bail_silent for proper cleanup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22fix(show,outdated): reject multiple level filters at oncensfisis
Composer errors when more than one of --major-only, --minor-only, or --patch-only is specified. Mozart was silently giving --major-only precedence. Now both show and outdated commands validate mutual exclusivity with the same error message as Composer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22refactor(console): add console_format! proc macro and migrate all commandsnsfisis
Introduce a Symfony Console-style tag macro that replaces verbose patterns like `console::info(&format!("text {name}"))` with `console_format!("<info>text {name}</info>")`. Supports all 6 tag types (info, comment, error, question, highlight, warning) with format argument distribution across multiple tagged segments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22refactor(async): migrate from blocking HTTP to async/await with tokionsfisis
Replace reqwest::blocking with async reqwest across the entire codebase. All command execute functions, registry API calls (packagist, downloader, resolver, lockfile), and the main entry point now use async/await with the tokio runtime. The pubgrub resolver runs on spawn_blocking since its DependencyProvider trait is synchronous, using Handle::block_on for async I/O within that context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22refactor(workspace): split monolithic crate into 6 workspace cratesnsfisis
Extract modules from the single `mozart` crate into 5 focused library crates to improve compilation parallelism and architectural clarity: - mozart-constraint: version constraint parser (independent) - mozart-core: base types, console, validation, platform utilities - mozart-archiver: archive creation (tar, zip, bzip2) - mozart-registry: Packagist API, cache, resolver, downloader, lockfile - mozart-autoload: autoloader generation and PHP scanner Refactor Console::from_cli and build_cache_config to accept primitive args instead of &Cli to break circular dependencies. Introduce [workspace.dependencies] for centralized version management. Remove 9 unused direct dependencies from the CLI crate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21feat(console): add structured error handling, verbosity, and suggestionsnsfisis
Implement Phase 7.2 error handling & UX infrastructure: - Add exit_code module with MozartError, bail()/bail_silent() helpers, and Composer-compatible exit code constants (0-5, 100) - Redesign Console struct with Verbosity enum (Quiet/Normal/Verbose/ VeryVerbose/Debug), ANSI auto-detection via IsTerminal, and verbosity-gated output methods (info/verbose/debug/error) - Thread Console through all 33 command execute() signatures - Replace all std::process::exit() calls with structured MozartError returns handled in main() - Migrate eprintln\! status messages to console.info() for quiet-mode suppression - Add suggest module with Levenshtein distance and "Did you mean?" formatting for future package name suggestions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21feat(check-platform-reqs): implement command to verify PHP platform requirementsnsfisis
Collects platform requirements (php, ext-*, lib-*, composer-*-api) from lock file, installed.json, and root composer.json, then compares them against the detected PHP environment. Supports text/JSON output and exit codes 0 (pass), 1 (failed), 2 (missing). Extracts shared platform detection into a new platform.rs module, reused by both check-platform-reqs and show --platform. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21feat(cache): add filesystem-backed cache with TTL expiration and size-limited GCnsfisis
Implement a cache module with CacheConfig and Cache structs supporting read/write (string and binary), atomic writes via temp+rename, TTL-based expiration, and size-limited garbage collection. Wire the repo cache into packagist.rs and resolver.rs for API response caching, and the files cache into downloader.rs for dist archive caching. Implement the clear-cache command with full clear and --gc modes. All existing call sites pass None for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21feat(show): implement --tree, --latest, --outdated, --available, --platform, ↵nsfisis
and --format=json Replace stub messages with full implementations for all show command extensions: dependency tree rendering from lock file, latest version fetching from Packagist, outdated filtering with update classification, available versions listing, platform package detection via PHP CLI, and JSON output format across all modes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21feat(show): implement show command with installed, locked, and self modesnsfisis
Replaces the todo!() stub with full implementation supporting: - List mode with aligned columns (name, version, description) - Detail mode for single package inspection - --locked mode reading from composer.lock - --self mode reading from composer.json - --no-dev, --direct, --name-only, --path filtering - Wildcard pattern matching for package name filters - Graceful stubs for unimplemented options (--tree, --available, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11change commands::*::execute() signaturesnsfisis
2026-02-11enable workspacensfisis