WeatherKit in commandline app

I am trying to add WeatherKit support to a commandline app to fetch historical data. I've configured an app ID with the WeatherKit entitlement, but WeatherKit does not appear in the Capabilities list to add. When I try to access weather data, it fails with Code=4097 "connection to service named com.apple.weatherkit.authservice" suggesting it's not authorized.

How do I add the WeatherKit entitlement to a commandline Swift app?

WeatherKit in commandline app
 
 
Q