<commit_before>import * as path from 'path'
import * as fs from 'fs'
import { ModuleLoader } from './module-loader'
import packageJson from '../package.json'
import { inject, injectable, tagged } from 'inversify'
import { TYPES } from './misc/types'
import { Logger } from './misc/interfaces'
import HTTPServer from './server'

const MODULES_CONFIG_PATH = '/modules.config.json'

@injectable()
export class Botpress {
  projectLocation: string
  botpressPath: string
  configLocation: string

  modulesConfig: any
  version: string

  constructor(
    @inject(TYPES.ModuleLoader) private moduleLoader: ModuleLoader,
    @inject(TYPES.HTTPServer) private httpServer: HTTPServer,
    @inject(TYPES.Logger) private logger: Logger
  ) {
    this.version = packageJson.version
    console.log(process.title)
    this.botpressPath = path.join(process.cwd(), 'dist') // /dist
    this.configLocation = path.join(this.botpressPath, '/config')
    console.log(this.botpressPath, this.configLocation)
  }

  private async initialize() {
    this.trackStats()
    this.createDatabase()
    this.loadModules()
    this.startServer()
  }

  private async startServer() {
    await this.httpServer.start()
  }

  private trackStats(): any {
    // TODO
  }

  private createDatabase(): any {
    // TODO
  }

  private async loadModules() {
    const modules = await this.moduleLoader.getAvailableModules()
    console.log(modules)
  }

  start() {
    this.initialize()
  }
}<commit_msg>periodically check modules<commit_after>import * as path from 'path'
import * as fs from 'fs'
import { ModuleLoader } from './module-loader'
import packageJson from '../package.json'
import { inject, injectable, tagged } from 'inversify'
import { TYPES } from './misc/types'
import { Logger } from './misc/interfaces'
import HTTPServer from './server'

const MODULES_CONFIG_PATH = '/modules.config.json'

@injectable()
export class Botpress {
  projectLocation: string
  botpressPath: string
  configLocation: string

  modulesConfig: any
  version: string

  constructor(
    @inject(TYPES.ModuleLoader) private moduleLoader: ModuleLoader,
    @inject(TYPES.HTTPServer) private httpServer: HTTPServer,
    @inject(TYPES.Logger) private logger: Logger
  ) {
    this.version = packageJson.version
    console.log(process.title)
    this.botpressPath = path.join(process.cwd(), 'dist') // /dist
    this.configLocation = path.join(this.botpressPath, '/config')
    console.log(this.botpressPath, this.configLocation)
  }

  private async initialize() {
    this.trackStats()
    this.createDatabase()
    this.loadModules()
    this.startServer()
  }

  private async startServer() {
    await this.httpServer.start()
  }

  private trackStats(): any {
    // TODO
  }

  private createDatabase(): any {
    // TODO
  }

  private loadModules() {
    setInterval(async () => {
      const modules = await this.moduleLoader.getAvailableModules()
      console.log(modules)
    }, 5000)
  }

  start() {
    this.initialize()
  }
}
{'fraction_non_alphanumeric': 0.12091938707528314, 'fraction_numerical': 0.0013324450366422385, 'mean_word_length': 3.605828220858896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4983854', 'n_tokens_mistral': 911, 'n_tokens_neox': 907, 'n_words': 219}