mindcraft/controller/init-agent.js
2023-12-10 20:18:20 -06:00

27 lines
723 B
JavaScript

import { Agent } from '../agent.js';
import yargs from 'yargs';
const args = process.argv.slice(2);
if (args.length < 1) {
console.log('Usage: node init_agent.js <agent_name> [-c] [-a]');
process.exit(1);
}
const argv = yargs(args)
.option('clear_memory', {
alias: 'c',
type: 'boolean',
description: 'restart memory from scratch'
})
.option('autostart', {
alias: 'a',
type: 'boolean',
description: 'automatically prompt the agent on startup'
}).argv
const name = argv._[0];
const clear_memory = !!argv.clear_memory;
const autostart = !!argv.autostart;
const save_path = './bots/'+name+'.json';
new Agent(name, save_path, clear_memory, autostart);