aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/global.rs
AgeCommit message (Collapse)Author
2026-05-11test(commands): remove per-command testsnsfisis
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-09refactor(composer): move Composer and Factory from mozart-core to mozartnsfisis
Composer needs DownloadManager (from mozart-registry), but mozart-core sits below mozart-registry in the dependency graph — adding the field would create a dependency cycle. Moving Composer and create_composer to the mozart CLI crate breaks the cycle and lets the root state container hold a DownloadManager. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05chore: remove redundant commentsnsfisis
2026-02-23fix(global): add ~/.composer fallback, XDG auto-detection, and no-arg handlingnsfisis
Rewrite composer_home() with Composer-compatible resolution: detect XDG environment (any XDG_* var or /etc/xdg), prefer existing directories, and fall back to ~/.composer for legacy systems. Consolidate duplicate composer_home_dir() from global.rs into shared config_helpers. Accept no subcommand gracefully with a helpful error instead of a parse error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22feat(cli): match Composer's --version output formatnsfisis
Replace clap's built-in --version with custom handler that outputs Composer-compatible version info: Mozart version line, PHP version with binary path, and diagnose hint. Add detect_php_version_and_binary() to mozart-core platform module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22fix(platform): detect PHP version from runtime instead of hardcoding 8.1nsfisis
PlatformConfig::new() was hardcoded to PHP 8.1 with a fixed extension list, causing resolution failures for packages requiring newer PHP (e.g. Laravel 12 requires >=8.2). Now calls detect_platform() to discover the actual PHP version, extensions and capabilities. Also adds a mutex to composer_home_dir tests to prevent env-var races. 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(global): implement command to run subcommands in global Composer dirnsfisis
Resolves global home from $COMPOSER_HOME, $XDG_CONFIG_HOME, or $HOME/.config/composer, then re-dispatches the given subcommand with --working-dir set to that path. Forwards all global CLI flags and accepts hyphen-prefixed trailing arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11change commands::*::execute() signaturesnsfisis
2026-02-11enable workspacensfisis