Add Commerce, user, and address management CLI tools#13
Conversation
- Add 4 new tools: CreateProduct, CreateVariant, DeleteVariant, GetOrderStatuses - Register CLI commands, HTTP routes, controllers, and SKILLS docs for new tools - Fix GetProduct/GetProducts to use property access for defaultSku/defaultPrice - Fix UpdateVariant to use basePrice instead of volatile price setter - Fill coverage gaps across all 10 existing Commerce tools (29 new tests) - Install Commerce 5.5.4 as dev dependency with ibericode/vat replacement - Configure Commerce project config stubs (store, product type, order status, gateway)
Let Valinor's `allowScalarValueCasting()` handle string-to-int conversion when the target parameter expects an int, avoiding type mismatches for parameters expecting `string|null`.
Adds GetStores, GetStore, and UpdateStore tools for managing Commerce store configuration (checkout behavior, pricing strategies, address requirements, currency). Includes StoresController, CLI commands, HTTP routes, SKILLS docs, and 37 new tests including a CommerceNotInstalledTest that verifies all Commerce tools gracefully handle missing Commerce installations.
|
@markhuot I got all the basic Commerce functionality covered: products, variants, product types, orders, stores. My tests pass locally because I have Craft 5.9 installed, but looks like the CI test action is trying to install 5.8 which has a security advisory and the whole thing fails. I could pin ~5.9 in the project composer.json, but you mentioned you were trying to stay compatible with lower versions of Craft so I didn't want to do that without talking to you. Or maybe you have a better idea for a workaround. Currently Craft is just installed as a dependency of your Pest plugin, so it's not listed in the project composer.json at all. One other thing to mention: I tweaked the argument parser slightly to not infer argument types initially. Otherwise it fails when running something like |
Expose Craft users, groups, permissions, and the global user field layout through the CLI and API so agents can manage accounts without editing project config.
|
I updated the github action to just pin to 5.9 for now. I have a separate branch where I’m hoping to add 4.x support and I can tackle older 5.x versions in the same pass. So, for now, we can just pin to the latest version here and worry about moving forward. I’m good with this if you are. Feel free to merge! |
Summary
Highlights