I tried to use extensions.getByType<VersionCatalogsExtension>().named("libs")
but got error: Extension of type ‘VersionCatalogsExtension’ does not exist. Currently registered extension types: [ExtraPropertiesExtension]
I don’t think you can do it, except by parsing the TOML file yourself.
The settings script defines the version catalog, so it cannot use it yet, one of the typical hen and egg problems.
As I said, hen and egg.
Settings script provides version catalogs, from applied settings plugins, from DSL in the settings script, from the default TOML file, …
So a proper API cannot be provided as the version catalogs are simply not yet established at that time.
But if you have it in a file and you know that, there is nothing stopping you to process that file.