"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupCommand = exports.initCommand = void 0;
const commander_1 = require("commander");
const logger_1 = require("../utils/logger");
const error_handler_1 = require("../utils/error.handler");
const components_service_1 = __importDefault(require("../services/components/components.service"));
const app_service_1 = __importDefault(require("../services/app.service"));
const nextSteps_1 = require("../utils/nextSteps");
const logger = logger_1.Logger.getInstance();
exports.initCommand = new commander_1.Command('init')
    .description('Initialize a new io.cd project in the current directory')
    .action(() => {
    logger.info('Init command called');
    console.log('Initializing project - Phase 3 implementation required');
});
exports.setupCommand = new commander_1.Command('setup')
    .description('Prepares the seed for first usage. This will install components, and install packages for all apps')
    .action(async () => {
    try {
        logger.info('Setting up the seed...');
        const componentsService = components_service_1.default;
        // Install components first
        await componentsService.installComponents();
        // Pin component versions for reproducible builds
        await componentsService.pinComponentVersions();
        // Install packages for all apps
        await app_service_1.default.installAllApps();
        logger.info('Seed prepared successfully!');
        (0, nextSteps_1.printNextSteps)([
            'Run "npm run start" to start the development environment',
            'Run "npm run build" to create distributable packages'
        ]);
    }
    catch (error) {
        error_handler_1.ErrorHandler.handle(error);
    }
});
//# sourceMappingURL=setup.command.js.map