How to use shop instance in CLI context?

Well, when you are in CLI, the actual shop is not defined. If you want to refer to a particular one, you’d neet to create the shop context first. It is feasible but perhaps a bit tricky.