How can I obtain app energy impact data from the command line or applescript?
As far as I know, the raw data used for the Energy calculations can be obtained using the powermetrics CLI:

*** Running tasks ***

Name             PID    CPU ms/s  User%  Deadlines (&lt;2 ms, 2-5 ms)  Wakeups (Intr, Pkg idle)
kernel_task      0      41.14     0.00   267.46  0.20               2290.48 1533.24
WindowServer     186    99.50     73.47  54.93   15.58              73.51   67.31
Terminal         53513  105.38    88.85  0.00    0.00               12.78   10.99