Code in core should not call click or run commands directly. Such a call should be done in the cli.
core
cli