In that case I suppose I need to work out how to install the full XCode
package via the command line.
Uh, it's Apple. They don't *do* that. No Apple-sanctioned CLI access to the App Store (but see https://github.com/argon/mas --- note need to sign in to it with an Apple ID before use), and need to web login with an Apple ID and some level (including free) of developer registration to get it from developer.apple.com.
It's kinda ironic that these days even Microsoft does better (cf. Chocolatey).