"use strict"; import fs from 'fs'; import path from 'path'; import settings from '../../settings.mjs'; import toml_settings_read from '../../lib/io/TomlSettings.mjs'; import Agent from '../../lib/agent/Agent.mjs'; // HACK: Make sure __dirname is defined when using es6 modules. I forget where I found this - a PR with a source URL would be great :D const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/")); export default async function () { if(!fs.existsSync(settings.cli.config)) throw new Error(`Error: The config file at '${settings.cli.config}' doesn't appear to exist, or we don't have permission to access it.`); let config = toml_settings_read( path.join(__dirname, "config.default.toml"), settings.cli.config ); let agent = new Agent(config); await agent.init(); }