From a4990748b5666526f283350ceebc4a11c44ff178 Mon Sep 17 00:00:00 2001 From: Boris Starkov Date: Fri, 24 Oct 2025 15:05:58 +0100 Subject: [PATCH 1/2] split help views by modules --- README.md | 2 +- src/agents/commands/index.ts | 19 +++ src/agents/ui/AgentsHelpView.tsx | 152 ++++++++++++++++++ src/auth/commands/index.ts | 19 +++ src/auth/ui/AuthHelpView.tsx | 118 ++++++++++++++ src/cli.ts | 7 +- src/components/commands/index.ts | 19 +++ src/components/ui/ComponentsHelpView.tsx | 82 ++++++++++ src/tests/commands/index.ts | 19 +++ src/tests/ui/TestsHelpView.tsx | 129 +++++++++++++++ src/tools/commands/index.ts | 19 +++ src/tools/ui/ToolsHelpView.tsx | 130 +++++++++++++++ src/ui/views/HelpView.tsx | 194 ++++------------------- 13 files changed, 745 insertions(+), 164 deletions(-) create mode 100644 src/agents/ui/AgentsHelpView.tsx create mode 100644 src/auth/ui/AuthHelpView.tsx create mode 100644 src/components/ui/ComponentsHelpView.tsx create mode 100644 src/tests/ui/TestsHelpView.tsx create mode 100644 src/tools/ui/ToolsHelpView.tsx diff --git a/README.md b/README.md index 4d4a2dc..62ce6fc 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ elevenlabs agents init --override # Override existing files and recreate **Override mode** (`--override`): When you need to reset your project: - Overwrites all configuration files - Recreates directory structure from scratch -- ⚠️ **Warning**: This will delete all existing configurations in `agent_configs/`, `tool_configs/`, and `test_configs/` +- **Warning**: This will delete all existing configurations in `agent_configs/`, `tool_configs/`, and `test_configs/` Use `--override` when: - You want to start fresh with a clean configuration diff --git a/src/agents/commands/index.ts b/src/agents/commands/index.ts index 7e20f7f..c9dfc89 100644 --- a/src/agents/commands/index.ts +++ b/src/agents/commands/index.ts @@ -1,4 +1,6 @@ import { Command } from 'commander'; +import { render } from 'ink'; +import React from 'react'; import { createInitCommand } from './init.js'; import { createAddCommand } from './add.js'; import { createListCommand } from './list.js'; @@ -9,11 +11,28 @@ import { createPullCommand } from './pull.js'; import { createTemplatesCommand } from './templates.js'; import { createWidgetCommand } from './widget.js'; import { createTestCommand } from './test.js'; +import AgentsHelpView from '../ui/AgentsHelpView.js'; export function createAgentsCommand(): Command { const agents = new Command('agents'); agents.description('Manage ElevenLabs agents'); + // Disable default help + agents.helpOption(false); + agents.addHelpCommand(false); + + // Add custom help option + agents.option('-h, --help', 'Display help information'); + + // Custom action when agents command is run without subcommands + agents.action(async (options) => { + const { waitUntilExit } = render( + React.createElement(AgentsHelpView) + ); + await waitUntilExit(); + process.exit(0); + }); + agents.addCommand(createInitCommand()); agents.addCommand(createAddCommand()); agents.addCommand(createListCommand()); diff --git a/src/agents/ui/AgentsHelpView.tsx b/src/agents/ui/AgentsHelpView.tsx new file mode 100644 index 0000000..8fec2eb --- /dev/null +++ b/src/agents/ui/AgentsHelpView.tsx @@ -0,0 +1,152 @@ +// @ts-nocheck +import React, { useEffect } from "react"; +import { Box, Text, useApp } from "ink"; +import App from "../../ui/App.js"; +import theme from "../../ui/themes/elevenlabs.js"; + +interface Command { + name: string; + description: string; + options?: Array<{ flag: string; description: string }>; +} + +const commands: Command[] = [ + { + name: "init [path]", + description: "Initialize project", + options: [ + { flag: "--override", description: "Recreate existing project" }, + ], + }, + { + name: "add ", + description: "Create a new agent and push to remote", + options: [ + { flag: "--config-path ", description: "Custom config path" }, + { flag: "--template