env-ai
Version:
AI Assistant for Your Local Environment
50 lines (46 loc) • 1.43 kB
JavaScript
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { r as rmDeprecationAlerts } from './shared/env-ai.D0G3pQvO.mjs';
import { argv } from 'node:process';
rmDeprecationAlerts();
console.warn = () => {
};
const args = hideBin(argv);
const cli = async () => {
const _cli = yargs(args);
const { default: CHAT } = await import('./chunks/index.mjs');
const chat = new CHAT(_cli);
const consts = chat._const;
_cli.scriptName(consts.projectName).version(consts.version).usage(`${consts.projectDesc}
Usage: $0 <command> [options]`).command(chat.run()).showHelpOnFail(false).locale("en").help().alias("h", "help").alias("v", "version");
return {
/**
* Checks for available updates for the cli and notifies the user
* if one is available.
*
* **IMPORTANT:** not use if you want build a binary of the cli
*/
updater: async () => {
const { updater } = await import('./chunks/updater.mjs');
await updater({ name: consts.projectName, version: consts.version });
},
/**
* Runs the cli.
*
* If no command is provided, the help menu is shown.
*
* @returns {Promise<void>}
*/
run: async () => {
const argv2 = await _cli.argv;
if (argv2._.length === 0) _cli.showHelp("log");
}
};
};
const run = async () => {
const app = await cli();
await app.updater();
await app.run();
};
run();