public function getDiscoveryManager()
    {
        if (!$this->started) {
            throw new LogicException('Puli was not started');
        }

        if (!$this->discoveryManager && $this->context instanceof ProjectContext) {
            $this->discoveryManager = new DiscoveryManagerImpl(
                $this->context,
                $this->getDiscovery(),
                $this->getModuleManager()->findModules(Expr::method('isEnabled', Expr::same(true))),
                $this->getJsonStorage(),
                $this->logger
            );
        }

        return $this->discoveryManager;
    }