aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/create_project_command.rs
AgeCommit message (Collapse)Author
2026-07-04fix(create-project-command): split chained config.borrow_mut() callsnsfisis
install_project's fluent builder chain called config.borrow_mut() four times inline as method arguments. Rust extends every argument temporary's lifetime to the end of the enclosing statement, so the first borrow_mut() was still alive when the second one ran, panicking with "already borrowed". Compute each value into a local before the chain instead, matching the pattern already used in install/update/require/remove_command.rs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-06-29chore(lint): ban bare `use anyhow::Result` and fully qualify itnsfisis
Add a no_banned_use linter that forbids importing anyhow::Result, and update all call sites to reference it via its fully-qualified path so it is never confused with std::result::Result. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28refactor: add linternsfisis
2026-06-27refactor(composer): hold managers behind *Interface traitsnsfisis
Composer/PartialComposer exposed its RepositoryManager, InstallationManager, EventDispatcher, Locker, DownloadManager, AutoloadGenerator and ArchiveManager as concrete types, but Composer's public setters (setDownloadManager() etc.) let plugins swap in subclasses. Introduce a *Interface trait per manager and store each as Rc<RefCell<dyn ...Interface>> so a replacement is honored. Only Composer's slots and the sinks fed from its accessors become trait objects; managers injected concretely at construction keep their concrete references, matching PHP semantics. Fluent setters on the affected classes now return () and Locker::update_hash is de-generified to a boxed FnOnce so the traits stay object-safe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27refactor(command): replace composer_full_mut with shared composer_fullnsfisis
The compiler confirms none of the call sites invoke a &mut self method on the returned Composer, so the exclusive RefMut borrow was never needed and only risked borrow check conflict. Switch every site to the shared composer_full borrow and drop the now-dead composer_full_mut helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27refactor: fix compiler warnings and clippy warningsnsfisis
2026-06-24fix(console): make Command/BaseCommand methods take &selfnsfisis
The Command trait and Composer's BaseCommand took &mut self, so dispatch held a borrow_mut on the command's RefCell for the whole call. A command re-entering itself (e.g. the help command describing itself) then panicked with "RefCell already borrowed". All Command/BaseCommand methods now take &self and the command state is interior-mutable (Cell/RefCell). Shared borrows coexist, so re-entrant describe paths no longer conflict. Getters that returned references now return Ref guards; the descriptor describe_* methods take &dyn Command; mixin accessors return Ref/RefMut. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20fix(path): propagate PathBufnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20refactor(php-shim): drop Box wrapping from PhpMixed List/Arraynsfisis
The List and Array variants of PhpMixed boxed their elements unnecessarily. Store PhpMixed values directly and update all callers accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20refactor: auto-fix clippy warningsnsfisis
2026-06-20feat(help): replace all "php composer.phar" in help text with "shirabe"nsfisis
2026-06-19feat(command): implement Symfony Commandnsfisis
2026-06-14fix(command): resolve infinite recursion in command initializensfisis
ConfigCommand/InitCommand::initialize called self.initialize, which resolved to the inherent method itself instead of the inherited BaseCommand::initialize (PHP's parent::initialize), recursing forever. Disambiguate to the trait method. CreateProjectCommand's create_composer_instance/create_audit_config were pure pass-through wrappers that PHP does not override; they recursed into themselves. Remove them so calls resolve to the inherited BaseCommand trait methods (the create_audit_config wrapper also had a &Config vs &mut Config signature mismatch). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14refactor(pcre): drop Result from Preg method return typesnsfisis
The Preg methods panic on PCRE failure (per the file header rationale), so their anyhow::Result wrappers never carried an Err. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14refactor(pcre): drop strict-groups Preg variantsnsfisis
Rust's type system already distinguishes participating from non-participating capture groups via Option, so the *StrictGroups methods add no safety here. Remove them and switch callers to the plain variants.
2026-06-12feat(symfony-console): port Symfony Console and make the workspace compilensfisis
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11feat(console): resolve phase-b TODOs in doRun and IO wiringnsfisis
Wire up ConsoleIO with HelperSet/QuestionHelper, register the ErrorHandler with the IO instance, and fall back to a default output in run(). Replace resolved phase-b TODOs across the console, command, io, factory, installer, dependency_resolver, and util modules; reclassify the remaining blockers (typed Symfony command registry, stdin resource caching) as phase-c. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10feat(phase-c): resolve cross-module phase-b TODOsnsfisis
2026-06-10feat(phase-c): resolve exception-handling phase-b TODOsnsfisis
* Catch specific exception types instead of broad/placeholder handling. * Drop the shim Countable trait.
2026-06-08feat(phase-c): resolve closure-capture phase-b TODOs in config/create-projectnsfisis
Port Config::process() to the real Preg::replace_callback, whose closure borrows &self/flags and calls get_with_flags; surface get() errors via a captured cell so process now returns Result. Switch the replace_callback shim bounds to FnMut to allow the error-capturing closure. Wire CreateProjectCommand suggestion collection through the Rc<RefCell> reporter's interior mutation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08refactor(external-packages): drop component segment from symfony pathsnsfisis
Align the Symfony namespace mapping with the documented convention (symfony::component::X -> symfony::X) and remove now-unused console stub files. Update all import paths across the workspace. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07feat(phase-c): resolve dynamic-dispatch phase-b TODOsnsfisis
Replace the PHP `call_user_func([$obj, $method], ...)` / `$obj->{'get'.$x}()` dynamic dispatches (category E) with static Rust dispatch. - json_config_source: inject the clean-update as a typed `FnOnce(&mut JsonManipulator) -> Result<bool>` closure instead of a method-name string, dropping the call_user_func_array round-trip through PhpMixed args. The auth-config method override moves into the add/remove_config_setting closures. - config_command: dispatch addConfigSetting/addProperty on the concrete JsonConfigSource via match. - locker: select getRequires/getDevRequires and getReplaces/getProvides via match on the existing handle getters (previously stubbed to empty Vec). - create_project_command: reuse the existing get_links_for_type helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07feat(phase-c): resolve owned-argument phase-b TODOsnsfisis
Replace value-by-value signature workarounds with proper ownership: - validate_json_schema: borrow JsonFile via ValidateJsonInput<&JsonFile>, restoring the dropped local auth file validation call - Auditor::audit / Solver::new / create_pool: pass cloned Rc handles and share Pool via Rc<RefCell<Pool>>; create_pool now takes &mut Request - MarkAlias{Installed,Uninstalled}Operation: hand over AliasPackageHandle from the alias-confirmed branch - dispatch_installer_event: clone the base Transaction (Rc-backed contents) and enable the PRE_OPERATIONS_EXEC dispatch - SuggestedPackagesReporter: share between command and installer via Rc<RefCell<>> to mirror PHP reference semantics PrePoolCreateEvent remains a TODO: it is plugin-only and would require a speculative Rc migration of Request whose payload is never read today.
2026-06-07refactor(phase-c): share PlatformRepository and RepositorySet via handlesnsfisis
PHP shares a single PlatformRepository by reference across the RepositorySet, createRequest, VersionSelector, and (in show) the installed repository. The port worked with owned values / &mut, so it could not share: create_repository_set silently dropped the platform repo from the pool (PlatformRepository is not Clone), show rebuilt a fresh PlatformRepository per use, and the package discovery / show version selectors were stubbed because VersionSelector wanted an owned RepositorySet. Thread the existing PlatformRepositoryHandle (Rc<RefCell<PlatformRepository>>) through installer.rs and show, restoring the RootPackageRepository + platform repo registration and implementing same_repository via RepositoryInterfaceHandle ptr_eq. Hold package-discovery repos as a shared RepositoryInterfaceHandle, and share RepositorySet as Rc<RefCell<RepositorySet>> in the set caches and VersionSelector (which only reads it), unblocking both stubbed selector sites and dropping show's placeholder set. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07feat(shirabe): resolve phase-b TODOs with shared ownershipnsfisis
Replace TODO(phase-b) placeholders (todo!() and commented-out code) with real implementations: - Share JsonFile via Rc<RefCell<JsonFile>> so JsonConfigSource and the owning command can hold the same instance (base_config_command, config_command, repository_command, require_command, create_project, remove_command, factory) - Change InstallerInterface methods (is_installed, download, prepare, cleanup, get_install_path) to &mut self so initialize_vendor_dir can run, propagated to all installer implementations - Pass io/config/filesystem/process by clone instead of moving or stubbing (auth_helper, svn_driver, curl_downloader, library_installer) - Make TransportException Clone and store it by value in VcsRepository - Clone operations in Transaction sort, root_aliases/temporary_constraints in RepositorySet::create_pool, and share CompletePackage via handle in PlatformRepository - Wire up set_option, set_requires/set_dev_requires, installation manager setters, BumpCommand::set_composer, and clean_backups/set_local_phar
2026-06-06refactor(command): share Input/OutputInterface via Rc<RefCell>nsfisis
Convert InputInterface and OutputInterface parameters from &dyn/&mut dyn references to Rc<RefCell<dyn ...>> shared ownership across the command, console, and IO layers, matching the Phase C shared-ownership approach already used for IOInterface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06fix(array-dumper): emit package links and require Link pretty constraintnsfisis
Resolve the phase-b TODO that left the supported-link-types loop as dead code (links were always an empty Vec), so requires/conflicts/provides/ replaces/require-dev are dumped again via PackageInterface::get_links_for_type, matching the PHP magic-call loop. Every Link in production is constructed with a pretty constraint (all ArrayLoader/AliasPackage/PlatformRepository/InstalledRepository sites pass one), so make Link::pretty_constraint a required String instead of Option<String>. get_pretty_constraint() now returns &str directly rather than anyhow::Result<&str>, dropping the unreachable UnexpectedValueException guard, and all call sites are updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06refactor(repository): make read methods fallible and take &mut selfnsfisis
Change RepositoryInterface and WritableRepositoryInterface read methods (find_package, find_packages, get_packages, load_packages, search, get_providers, get_canonical_packages) to take &mut self and return anyhow::Result, so lazy-loading repositories such as ComposerRepository can perform fallible I/O and mutate internal state on access. Update all implementors and call sites to propagate the Result and pass mutable references. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05feat(dependency-resolver): share operations via Rc, drop clone_boxnsfisis
OperationInterface::clone_box (a todo!() trait-object clone stub) is removed in favor of Rc<dyn OperationInterface> shared ownership. All its methods are &self, so operations are immutable value objects that Rc can share; pushing the same operation into multiple lists (installer's install/uninstall splits) becomes a cheap Rc clone instead of clone_box. Box<dyn OperationInterface> is replaced with Rc<dyn ...> across Transaction (and its Lock/LocalRepo wrappers), Installer, PackageEvent, InstallationManager and EventDispatcher; Box::new operation constructions become Rc::new. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05feat(filter): share platform req filter via Rc, drop clone_boxnsfisis
PlatformRequirementFilterInterface::clone_box (a todo!() trait-object clone stub) is removed in favor of Rc<dyn ...> shared ownership, matching PHP's by-reference sharing of the single filter object. Box<dyn ...> is replaced with Rc<dyn ...> across the factory, Solver/RuleSetGenerator, VersionSelector, AutoloadGenerator, Installer and the command layer (BaseCommand/PackageDiscoveryTrait and their impls); clone_box call sites become Rc clones. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04feat(package): implement PackageInterface accessor layer for ↵nsfisis
Package/CompletePackage/RootPackage Fill the trait-impl todo!() across the package accessor layer so loaded packages are actually usable (the ArrayLoader::load path depends on it): - Package: implement BasePackage/PackageInterface from struct fields and existing inherent methods; Display via get_unique_name. - CompletePackage: delegate PackageInterface to inner Package. - RootPackage: delegate CompletePackageInterface/PackageInterface to inner CompletePackage; RootPackageInterface link setters delegate to Package. Correct three unfaithful trait signatures found during implementation: - get_target_dir returns Option<String> (PHP computes a normalized value; a borrow cannot represent it, and AliasPackage could not implement &str across its aliasOf handle). - RootPackageInterface link setters take IndexMap<String, Link>, matching Package and the real ArrayLoader caller (PHP RootPackage inherits Package::setRequires; the Link[] docblock was imprecise). - get_full_pretty_version takes a DisplayMode enum instead of a raw i64; the match is now exhaustive, so it returns String without an error path. Move mirror conversion to the boundaries: PackageInterface mirror methods use Vec<Mirror> (the typed form, matching the inherent methods), with array<->Mirror conversion done by the producer (ComposerRepository) and consumer (ArrayDumper). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04feat: resolve trivial todo!() sites with existing constructorsnsfisis
Replace todo!("VersionParser::new()") with VersionParser::new() at 6 call sites (array_loader, base_command, create_project_command, vcs_repository, http_downloader x2) and EventDispatcher::io_clone with self.io.clone(). All targets already exist on their types. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03feat(downcast): wire package/repo/filter instanceof checks via existing ↵nsfisis
handle/as_any Resolve three category-4 TODO(phase-b) placeholders that were short-circuited to None/true, by routing them through downcast mechanisms that already exist: - package_sorter: PackageInterfaceHandle::as_root() for the instanceof RootPackageInterface check that adds dev-requires - platform_repository::is_complete_package: as_complete().is_some(), consistent with the inlined check already in add_package - create_project_command: PlatformRequirementFilterInterface::as_any() downcast to IgnoreAllPlatformRequirementFilter No new trait infrastructure introduced. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29refactor(io): unify IOInterface params to Rc<RefCell<dyn _>>nsfisis
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28refactor(repository): introduce Rc<RefCell<_>> handles for repositoriesnsfisis
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26refactor(io): share IOInterface via Rc<RefCell<dyn _>> handlensfisis
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25refactor(package): introduce Rc<RefCell<_>> handles for packagesnsfisis
PHP packages have reference semantics, so introduce shared-ownership handles over an AnyPackage enum (PackageInterfaceHandle and friends) and replace Box<dyn PackageInterface> throughout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22refactor: share Pool via Rc<RefCell>nsfisis
Convert Pool to Rc<RefCell<Pool>> so Solver, Decisions, and RuleSetGenerator share it, resolving the todo!() placeholders that blocked the dependency resolver (Phase C shared ownership). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22refactor(composer): unify Composer/PartialComposer via Rc handlesnsfisis
Model PHP's `Composer extends PartialComposer` as a PartialOrFullComposer enum and merge partial_composer.rs into composer.rs. Introduce ComposerHandle / PartialComposerHandle (plus their Weak variants) so the graph can be shared, and build it at once with Rc::new_cyclic in the factory to resolve the back-reference cycles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20refactor: re-export module items to shorten import pathsnsfisis
2026-05-20fix(compile): fix all remaining compile errorsnsfisis
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19fix(compile): fix more random compile errorsnsfisis
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19fix(compile): fix various compile errorsnsfisis
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17fix(compile): convert Command struct to traitnsfisis
Symfony Command was a struct but used as dyn Trait (Box<dyn Command>) in console/application.rs. Convert it to a trait with CommandBase as the concrete stub, and add impl Command for all Composer commands.
2026-05-17fix(compile): add stubs for missing trait implementationsnsfisis
2026-05-17fix(compile): implement abstract class traits across all typesnsfisis
Implement BaseCommand trait and other abstract class traits across all command, downloader, io, package, and VCS driver types. Also fix trait method signatures for composer_mut and io_mut to return mutable references to Option rather than Option of mutable references.
2026-05-17chore(style): cargo fmtnsfisis
2026-05-16feat(port): port CreateProjectCommand.phpnsfisis
2026-05-12feat(init): add scaffold filesnsfisis