docs: function main(env, cb) {
      var appConfig,
          options = {
              port: ~~env.args.shift(),
              context: util.parseCsvObj(env.opts.context),
              perf: env.opts.perf
          };
  
      if (env.opts.loglevel) {
          log.level = env.opts.loglevel;
      }
  
      if (!env.app) {
          cb(util.error(1, 'No package.json, please re-try from your application’s directory.'));
          return;
      }
  
      if (!(env.app.dependencies && env.app.dependencies.mojito)) {
          log.error('The current directory doesn’t appear to be a Mojito application.');
          cb(util.error(3, 'Mojito isn’t a dependency in package.json. Try `npm i --save mojito`.'));
          return;
      }
  
      if (!env.mojito) {
          cb(util.error(3, 'Mojito is not installed locally. Try `npm i mojito`'));
          return;
      }
  
      // get application.json for the current context, because we need appPort
      appConfig = getAppConfig(env.mojito.path, env.cwd, options.context);
  
      if (!appConfig) {
          cb(util.error(3, 'Cannot read application.json.'));
          return;
      }
  
      if (!options.port) {
          options.port = process.env.PORT || appConfig.appPort || 8666;
      }
  
      exec(env, options, cb);
  }