Bug #103858
closedtypo3 list command does not work propperly for other formats then txt
0%
Description
ddev exec bin/typo3 list
and
ddev exec bin/typo3 list --format=json > commands.json
For example the first contains the site namespace while it is missing in the second.
I verified this to happen in the current main-Core and in installations of TYPO3 13.1 and 12.4.
I suspect this is to the fact that the ListCommand registers a custom TextDescriptor
for format txt but not the other supported formats.
We - the documentation team - want to use the json format to auto-generate documentation:
https://github.com/TYPO3-Documentation/t3docs-console-command so this bug is now really hindering that...
Updated by Garvin Hicking 6 months ago
I'll try to get at least a PoC for this as a core patch. Problem is the main TextDescriptor is heavily patched from vanilla symfony, and all that had to be duplicated to the jsonDescriptor (and probably xml too). Might be harder than it sounds due to all that custom processing.
Updated by Gerrit Code Review 2 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86247
Updated by Gerrit Code Review 2 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86247
Updated by Garvin Hicking 2 months ago
- Status changed from Under Review to Closed
The problem here is that the Symfony Descriptor API does not integrate well with TYPO3's custom commandregistry. There's currently no way to inject a different command/namespace list and to re-use the JsonDescriptor of Symfony, leading to a lot of code duplication.
A proper way would be to patch the Symfony JsonDescriptor and create a different API that allows injecting other commands, but that would take a lot of effort.
For now, the "sane" way to get this to work is using a custom extension providing a custom CLI command that uses the fully bootstrapped TYPO3 command list, which uses the "normal" Symfony command registration, and not the TYPO3 custom one. A very basic extension is this:
https://packagist.org/packages/garvinhicking/clinspector-gadget
This has been integrated as a PR into the docs repos:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/4772
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/4771
and should work well. The upside is that it will also work for TYPO3 v11-13 since it's a very, very basic CLI command.
I'm closing this issue for now, if you think that is a mistake, please let me know.