UNPKG

research-cli

Version:

AI-powered research assistant with web search capabilities and beautiful terminal UI

101 lines • 4.01 kB
/** * Config subcommand application - Typer-inspired structure * * This module creates a Typer-style subcommand app for configuration * management with extensible structure for future features. */ import { Command } from "@commander-js/extra-typings"; import { InteractiveUI } from "../ui/interactive.js"; /** * Create the config subcommand application * This follows Typer's pattern of creating modular command apps */ export function createConfigApp() { const configCommand = new Command("config").description("āš™ļø Manage CLI configuration"); // Basic config commands (M1 placeholder, ready for M3 expansion) configCommand .command("init") .description("Initialize configuration file") .action(async () => { await handleInit(); }); configCommand .command("show") .description("Show current configuration") .action(async () => { await handleShow(); }); configCommand .command("reset") .description("Reset configuration to defaults") .option("--force", "Skip confirmation prompt") .action(async (options) => { await handleReset(options); }); configCommand .command("set") .description("Set a configuration value") .argument("<key>", "Configuration key to set") .argument("<value>", "Value to set") .action(async (key, value) => { await handleSet(key, value); }); configCommand .command("get") .description("Get a configuration value") .argument("<key>", "Configuration key to get") .action(async (key) => { await handleGet(key); }); return configCommand; } // Command handlers - Clean separation following Typer patterns async function handleInit() { console.log("šŸ”§ Initializing configuration..."); console.log("Configuration management will be fully implemented in M3 milestone"); console.log("\nFor now, you can:"); console.log(" • Use 'research-cli auth' commands to manage API keys"); console.log(" • Set provider with --provider option"); console.log(" • Configure options via command line flags"); } async function handleShow() { console.log("šŸ“‹ Current Configuration:"); console.log("Configuration display will be implemented in M3 milestone"); console.log("\nCurrent status:"); console.log(" • API keys: Use 'research-cli auth list' to view"); console.log(" • Default provider: openai (configurable via --provider)"); console.log(" • Web search: enabled by default (--web/--no-web)"); } async function handleReset(options) { if (!options.force) { const shouldReset = await InteractiveUI.confirmAction("Reset all configuration to defaults?", false); if (!shouldReset) { console.log("\nšŸ‘‹ Cancelled"); return; } } console.log("šŸ”„ Resetting configuration..."); console.log("Configuration reset will be implemented in M3 milestone"); console.log("āœ… Reset complete (when implemented)"); } async function handleSet(key, value) { console.log(`āš™ļø Setting ${key} = ${value}`); console.log("Configuration setting will be implemented in M3 milestone"); console.log("\nValid configuration keys (planned):"); console.log(" • default_provider"); console.log(" • web_search_enabled"); console.log(" • output_format"); console.log(" • max_tokens"); console.log(" • temperature"); } async function handleGet(key) { console.log(`šŸ“– Getting value for: ${key}`); console.log("Configuration getting will be implemented in M3 milestone"); console.log("\nCurrent defaults:"); console.log(" • default_provider: openai"); console.log(" • web_search_enabled: true"); console.log(" • output_format: md"); console.log(" • max_tokens: (not set)"); console.log(" • temperature: (not set)"); } //# sourceMappingURL=config-app.js.map