UNPKG

@2501-ai/cli

Version:

[![npm version](https://img.shields.io/npm/v/@2501-ai/cli.svg)](https://www.npmjs.com/package/@2501-ai/cli) [![HumanEval Score](https://img.shields.io/badge/HumanEval-96.95%25-brightgreen.svg)](https://www.2501.ai/research/full-humaneval-benchmark) [![Lic

57 lines (56 loc) 2.42 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.agentsCommand = void 0; const terminal_kit_1 = require("terminal-kit"); const conf_1 = require("../utils/conf"); const workspace_1 = require("../helpers/workspace"); function agentsCommand(options) { return __awaiter(this, void 0, void 0, function* () { const workspaceUrl = (0, workspace_1.resolveWorkspacePath)({ workspace: options.workspace }); if (options.flush) { yield (0, conf_1.flushAgents)(workspaceUrl, options.all); (0, terminal_kit_1.terminal)('All agents have been flushed from the configuration.\n'); return; } let agents; if (options.all) { agents = (0, conf_1.listAgents)(); } else { agents = (0, conf_1.listAgentsFromWorkspace)(workspaceUrl); } if (agents.length > 0) { terminal_kit_1.terminal.table([ ['Name', 'ID', 'Configuration', 'Workspace'], ...agents.map((agent) => [ agent.name.substring(0, 10), agent.id, agent.configuration, agent.workspace, ]), ], { hasBorder: true, contentHasMarkup: true, borderChars: 'lightRounded', borderAttr: { color: 'blue' }, textAttr: { bgColor: 'default' }, firstRowTextAttr: { bgColor: 'blue' }, width: 80, fit: true, }); } else { (0, terminal_kit_1.terminal)('No agents found.\n'); } }); } exports.agentsCommand = agentsCommand;