castor icon indicating copy to clipboard operation
castor copied to clipboard

feat(execute): introduce remote execution command

Open joelwurtz opened this issue 1 year ago • 3 comments

Ref https://github.com/jolicode/castor/issues/488

This add a new command which allow castor to execute remote package

As an example you could do the following :

castor execute  friendsofphp/php-cs-fixer@php-cs-fixer fix --dry-run --diff

Which will

  • download the friendsofphp/php-cs-fixer package
  • execute the php-cs-fixer binary from it with args fix --dry-run --diff
  • remove the package once it has been executed

It could also use a specific version by doing :

castor execute  friendsofphp/php-cs-fixer:v3.57.1@php-cs-fixer fix --dry-run --diff

TODO :

  • [ ] Tests
  • [ ] Documentation

joelwurtz avatar Jul 26 '24 12:07 joelwurtz

Hi ✋

It sounds pretty cool to run some PHP tools without the need to create a composer.json file 😄

Remove the package once it has been executed.

In certain scenarios, like when working locally, it might be beneficial to retain these packages rather than removing them each time. What do you think about adding an option to prevent the automatic removal of packages?


One idea that comes to mind is for running tools like PHPStan with extensions. It could be useful to provide additional dependencies, such as phpstan/phpstan-symfony

For example, you could execute the following command:

castor execute --deps phpstan/phpstan-symfony phpstan/phpstan@phpstan xxx

This would allow you to easily add the necessary dependencies for specific tools or extensions.

TheoD02 avatar Jul 26 '24 13:07 TheoD02

Hello, do you have time to finish this PR?

lyrixx avatar Apr 02 '25 17:04 lyrixx

No problem, i just wasn't sure this is a feature we want ?

joelwurtz avatar Apr 02 '25 22:04 joelwurtz

I'm not sure I'll use it, but the code is well isolated, so 👍🏼 for me.

lyrixx avatar May 07 '25 16:05 lyrixx

See also

  • https://github.com/imliam/cpx
  • https://github.com/eduardocruz/phpx

lyrixx avatar Jun 02 '25 09:06 lyrixx

ready for review

joelwurtz avatar Jun 27 '25 12:06 joelwurtz