mindcraft/controller/init-agent.js

28 lines
723 B
JavaScript
Raw Normal View History

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