Is there a supported way to get what attributes a lightning component has programmatically, given its name, that could identify (global) attributes on components from managed packages as well?
The metadata api is able to retrieve the full markup for components from managed packages, which would allow for parsing out the attributes, but I'm not sure if this is intentional. It also loses the namespace. So if you do a retrieve call for a__MyComp__c, b__MyComp__c, and MyComp__c, you will only get one of them back, and there's no indication as to which one it is.
The tooling api surfaces the namespace properly, but you won't get the markup for managed components. It will be "(hidden)" instead.