There's a very similar afm CLI that can be installed via Homebrew.
https://github.com/scouzi1966/maclocal-api
done
brew tap Arthur-Ficial/tap brew install Arthur-Ficial/tap/apfel
No need for the extra tap step, this works fine alone:
brew install Arthur-Ficial/tap/apfel