<commit_before>import os from 'os'
import path from 'path'
import fs from 'fs'
import util from '../util'
import chalk from 'chalk'
import nodemon from 'nodemon'
import { monitorCtrlC } from 'monitorctrlc'
import { execSync } from 'child_process'

const getPath = path => {
  if (os.platform() === 'win32') {
    const shortPath = execSync(`@echo off && for %I in ("${path}") do echo %~sI`)
    return shortPath.toString('utf8').replace(/(\n|\r)+$/, '')
  } else {
    return path
  }
}

/**
 * Entry point of botpress
 *
 * It will do the following things:
 *
 * 1. Find botpress instance creator in `node_modules` folder in current project.
 * 2. Find the `botfile.js` which will be injected into the creator to create the instance.
 * 3. Start the botpress instance.
 */
module.exports = (projectPath, options) => {
  let Botpress = null

  if (!projectPath || typeof projectPath !== 'string') {
    projectPath = '.'
  }

  projectPath = path.resolve(projectPath)

  try {
    Botpress = require(path.join(projectPath, 'node_modules', 'botpress')).Botpress()
  } catch (err) {
    util.print('error', err.message)
    util.print('error', err.stack)
    util.print('error', '(fatal) Could not load the local version of botpress')
    util.print('Hint: 1) have you used `botpress init` to create a new bot the proper way?')
    util.print('Hint: 2) Do you have read and write permissions on the current directory?')<commit_msg>chore(core): no need for local botpress import<commit_after>import os from 'os'
import path from 'path'
import fs from 'fs'
import util from '../util'
import chalk from 'chalk'
import nodemon from 'nodemon'
import { monitorCtrlC } from 'monitorctrlc'
import { execSync } from 'child_process'

const getPath = path => {
  if (os.platform() === 'win32') {
    const shortPath = execSync(`@echo off && for %I in ("${path}") do echo %~sI`)
    return shortPath.toString('utf8').replace(/(\n|\r)+$/, '')
  } else {
    return path
  }
}

/**
 * Entry point of botpress
 *
 * It will do the following things:
 *
 * 1. Find botpress instance creator in `node_modules` folder in current project.
 * 2. Find the `botfile.js` which will be injected into the creator to create the instance.
 * 3. Start the botpress instance.
 */
module.exports = (projectPath, options) => {
  let Botpress = null

  if (!projectPath || typeof projectPath !== 'string') {
    projectPath = '.'
  }

  projectPath = path.resolve(projectPath)

  try {
    const botpress = require('..')
    Botpress = botpress.Botpress()
  } catch (err) {
    util.print('error', err.message)
    util.print('error', err.stack)
    util.print('error', '(fatal) Could not load the local version of botpress')
    util.print('Hint: 1) have you used `botpress init` to create a new bot the proper way?')
    util.print('Hint: 2) Do you have read and write permissions on the current directory?')
{'fraction_non_alphanumeric': 0.1373913043478261, 'fraction_numerical': 0.005565217391304348, 'mean_word_length': 3.6993464052287583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1871947', 'n_tokens_mistral': 899, 'n_tokens_neox': 877, 'n_words': 322}