public function aggregate()
    {
        $commands = [];
        foreach ($this->getVisibleCommands() as $name => $cmd) {
            $commands[$name] = $cmd;
        }

        foreach ($this->commandGroups as $g) {
            if ($g->isHidden) {
                continue;
            }
            foreach ($g->getCommands() as $name => $cmd) {
                unset($commands[$name]);
            }
        }

        uasort($this->commandGroups, function ($a, $b) {
            if ($a->getId() === 'dev') {
                return 1;
            }

            return 0;
        });

        return [
            'groups' => $this->commandGroups,
            'commands' => $commands,
        ];
    }