WP CLI Get all Enqueued Scripts and Styles

You can’t, and it doesn’t make sense to do so.

Different pages/URLs enqueue different things, e.g. a WP Admin page won’t enqueue the same styles and scripts, widgets might enqueue things conditionally, etc.

But in WP CLI those hooks don’t run, and there is no page or frontend. So the question doesn’t make sense at a fundamental level. It isn’t enough to know the URL either, you need to render the page to know which scripts and styles are enqueued. There is no way to know in advance.

Could you render the page in WP CLI? Unlikely, a CLI environment will be missing a lot of the environment that a browser request has. For example, there is no URL, no GET/POST, no current user, cookies, etc.

The closest you can get to this, is a curl request. Just know that the security policy you generate will be specific to that page, and will be missing other scripts and styles, e.g. things only enqueued for admins/logged in users/other pages/etc.