refactor: extract variable appPackagesFlat