#!/usr/bin/env node

import { createColors } from 'colorette';
import { Command } from 'commander';
import { readFile } from 'node:fs/promises';
import { URL } from 'node:url';
import newCmd from '#commands/new';

createColors({ useColor: true });

const botkit = new Command();

const packageFile = new URL('../package.json', import.meta.url);
const packageJson = JSON.parse(await readFile(packageFile, 'utf8'));

botkit.name('botkit').version(packageJson.version);

botkit
	.command('new')
	.description('Create a new bot project')
	.alias('n')
	.argument('[name]', 'The name of the bot')
	.option('-v, --verbose')
	.action(newCmd);

botkit.parse(process.argv);
