public function run(string $sync = null): int
    {
        $containerCache = console()->matchCommand(ContainerCacheCommand::COMMAND);
        $consoleCache   = console()->matchCommand(ConsoleCacheCommand::COMMAND);
        $eventsCache    = console()->matchCommand(EventsCacheCommand::COMMAND);
        $routesCache    = console()->matchCommand(RoutesCacheCommand::COMMAND);

        console()->dispatchCommand($containerCache);
        console()->dispatchCommand($consoleCache);
        console()->dispatchCommand($eventsCache);
        console()->dispatchCommand($routesCache);

        $configCache = console()->matchCommand(ConfigCacheCommand::COMMAND);
        console()->dispatchCommand($configCache);

        if (null !== $sync && config()['app']['debug']) {
            $files = [
                config()['console']['cacheFilePath'],
                config()['container']['cacheFilePath'],
                config()['events']['cacheFilePath'],
                config()['routing']['cacheFilePath'],
                config()['cacheFilePath'],
            ];

            foreach ($files as $file) {
                copy($file, str_replace('site', 'sync', $file));
                output()->writeMessage('Copied: ' . $file, true);
            }
        }

        return 0;
    }