<commit_before>const fs = require('fs')
const path = require('path')
const prompt = require('prompt-promise')
const randomString = require('./lib/random-string')
const root = path.join(__dirname, '..')
const pkg = require(path.join(root, 'package.json'))

const createFolder = require('./lib/create-folder')

const { promisify } = require('util');
const exec = promisify(require('child_process').exec)

async function initInsights ({ dev = false, login = undefined }) {
  console.log(`Welcome to Insights v${pkg.version}!`)
  console.log('')

  const configFolder = path.join(process.cwd(), '.insights')

  if (fs.existsSync(configFolder)) {
    console.error('!! Fatal Error! The folder ".insights" already exists. Could not complete init.')
    process.exit(1)
  }

  console.log('This script will create a folder ".insights", which will be used to store config data.')
  console.log('Please add it to .gitignore if you\'re running this script inside a project folder!')
  console.log('')

  if (login === undefined) {
    let repeat = true

    console.log('Do you wish to setup Insights in "login" mode, requiring authentication to access the interface')
    console.log('or in standalone "loginless" mode, which is practical only when running in localhost.')
    console.log('')

    while (repeat) {
      const answer = (await prompt('Setup Insights with user accounts and authentication? [Y/n]: ')).trim()
      const letter = answer.toLowerCase()[0]

      if (answer === '' || letter === 'y' || letter === 'n') {
        repeat = false<commit_msg>shorter line length<commit_after>const fs = require('fs')
const path = require('path')
const prompt = require('prompt-promise')
const randomString = require('./lib/random-string')
const root = path.join(__dirname, '..')
const pkg = require(path.join(root, 'package.json'))

const createFolder = require('./lib/create-folder')

const { promisify } = require('util');
const exec = promisify(require('child_process').exec)

async function initInsights ({ dev = false, login = undefined }) {
  console.log(`Welcome to Insights v${pkg.version}!`)
  console.log('')

  const configFolder = path.join(process.cwd(), '.insights')

  if (fs.existsSync(configFolder)) {
    console.error('!! Fatal Error! The folder ".insights" already exists. ')
    console.error('   Could not complete init.')
    process.exit(1)
  }

  console.log('This script will create a folder ".insights", which will be used to store')
  console.log('config data. Please add it to .gitignore if you\'re running this script')
  console.log('inside a project folder!')
  console.log('')

  if (login === undefined) {
    let repeat = true

    console.log('Do you wish to setup Insights in "login" mode, requiring authentication to')
    console.log('access the interface or in standalone "loginless" mode, which is practical')
    console.log('only when running in localhost.')
    console.log('')

    while (repeat) {
      const answer = (await prompt('Setup Insights in "login" mode? (Y/n): ')).trim()
      const letter = answer.toLowerCase()[0]

      if (answer === '' || letter === 'y' || letter === 'n') {
        repeat = false
{'fraction_non_alphanumeric': 0.15036403925292816, 'fraction_numerical': 0.0012662234884457107, 'mean_word_length': 4.031847133757962, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1438231', 'n_tokens_mistral': 917, 'n_tokens_neox': 897, 'n_words': 298}