aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-core/src/lib.rs
AgeCommit message (Collapse)Author
2026-05-08fix(suggests): align with Composer's SuggestsCommand pipelinensfisis
Port `Composer\Installer\SuggestedPackagesReporter` to `mozart_core::installer` (modes, add_package, add_suggestions_from_package, output, output_minimalistic, escape_output) and slim `commands/suggests.rs` to mirror `SuggestsCommand::execute`. Defines `HasSuggests`, `InstalledRepoLite`, `RootInfo` as the minimal stand-ins for Composer's `PackageInterface` / `InstalledRepository` / `onlyDependentsOf`. Also fixes a latent bug where `provide`/`replace` virtuals were read from `extra_fields` (always empty after a serde round-trip into LockedPackage's typed fields) and moves the "additional suggestions ... --all" hint to fire after the rendered sections, matching Composer's order.
2026-05-08fix(diagnose): align with Composer's DiagnoseCommand orchestrationnsfisis
Restructures diagnose to mirror Composer's 17-step DiagnoseCommand: adds composer.json schema validation, custom composer-repo connectivity, COMPOSER_IPRESOLVE warning, and the checkConnectivityAndComposerNetworkHttpEnablement preflight; drops Mozart-only extras (cache-dir, lock freshness, trailing summary). Extracts the manifest validator into mozart-core::config_validator so both ValidateCommand and DiagnoseCommand depend on the shared module rather than each other -- the same shape Composer uses with Util\\ConfigValidator. Adds a thin HttpDownloader wrapper in mozart-core::http, shadowing Composer's Util\\HttpDownloader. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08fix(licenses): align with Composer's LicensesCommand pipelinensfisis
Drive the command from Composer::require() and route the (installed | locked) branch through the ported PackageSorter, RepositoryUtils::filterRequiredPackages, and PackageInfo helpers in mozart-core. --no-dev for installed packages now filters via root.require closure instead of dev_package_names membership; text output annotates the name cell with an OSC 8 hyperlink to the view-source/homepage URL; summary ties resolve in first-seen order via IndexMap + stable sort_by_key(Reverse(count)) to mirror PHP's arsort().
2026-05-05feat(core): port Factory::createConfig() as factory::create_config()nsfisis
Adds crates/mozart-core/src/factory.rs with get_cache_dir(), get_data_dir(), and create_config() — a Rust port of Composer\Factory::createConfig() (auth loading and htaccess creation are out of scope for now). Also fixes a correctness bug on Linux: the previous Config::default() resolved cache-dir to $XDG_CONFIG_HOME/composer/cache via the {$home}/cache placeholder, whereas Composer uses the XDG cache base ($XDG_CACHE_HOME or ~/.cache), giving ~/.cache/composer. Callers updated: - Composer::load() uses create_config() as the global baseline before merging project-level config. - config command execute_read() builds the global baseline with create_config() and overlays local config on top when not --global, matching Composer's actual layering order. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05refactor(core): replace ComposerConfig with typed Config structnsfisis
Config uses serde with kebab-case field mapping; known properties are strongly-typed fields and unknown keys flow into an extra BTreeMap. resolve_references is moved to the new config module.
2026-05-05feat(core): add Composer struct mirroring requireComposer/tryComposernsfisis
Introduce mozart_core::composer::Composer with require()/try_load() constructors and a config() accessor, modelled on PHP Composer's BaseCommand::requireComposer / tryComposer. ComposerConfig and composer_home move into mozart-core so Composer::load can resolve placeholders consistently. Migrate dump-autoload, archive, exec and run-script away from ad-hoc composer.json reads. exec and run-script now fail when composer.json is missing instead of silently falling back to "vendor/bin", matching the upstream requireComposer contract. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05refactor(core): centralize version constant in mozart-corensfisis
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-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(http): centralize User-Agent string in mozart-corensfisis
Add mozart_core::http::user_agent() that returns a consistent "Mozart/<version> (<os>; <arch>)" string. Replace all scattered user-agent definitions across mozart-registry and mozart CLI commands. 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>