import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';

import { logger } from '../gitzone.logging.js';

/**
 * executes basic project setup for continuing to work.
 * TODO: switch to smartgit
 * @param argvArg
 */
export const run = async (argvArg: any) => {
  logger.log('info', `preparing the project at ${paths.cwd} for development`);
  const smartshellInstance = new plugins.smartshell.Smartshell({
    executor: 'bash',
  });

  await smartshellInstance.execStrict(`cd ${paths.cwd} && git checkout master`);
  await smartshellInstance.execStrict(`cd ${paths.cwd} && git pull origin master`);
  await smartshellInstance.execStrict(`cd ${paths.cwd} && npm ci`);

  await provideNoGitFiles();
};

const provideNoGitFiles = async () => {
  logger.log('warn', 'nogit provision not yet implemented!');
};