@tronsfey/ucli 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/lib/server-client.ts","../src/commands/configure.ts","../src/lib/cache.ts","../src/lib/oas-runner.ts","../src/commands/services.ts","../src/commands/run.ts","../src/commands/refresh.ts","../src/commands/help-cmd.ts","../src/lib/mcp-runner.ts","../src/commands/mcp.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { createRequire } from 'node:module'\nimport { registerConfigure } from './commands/configure.js'\nimport { registerServices } from './commands/services.js'\nimport { registerRun } from './commands/run.js'\nimport { registerRefresh } from './commands/refresh.js'\nimport { registerHelp } from './commands/help-cmd.js'\nimport { registerMcp } from './commands/mcp.js'\n\nconst require = createRequire(import.meta.url)\nconst pkg = require('../package.json') as { version: string; description: string }\n\nconst program = new Command()\n\nprogram\n .name('ucli')\n .description(pkg.description)\n .version(pkg.version, '-v, --version')\n .addHelpCommand(false) // we provide our own help command\n\nregisterConfigure(program)\nregisterServices(program)\nregisterRun(program)\nregisterRefresh(program)\nregisterMcp(program)\nregisterHelp(program)\n\nprogram.parse(process.argv)\n","import Conf from 'conf'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nexport interface CLIConfig {\n serverUrl: string\n token: string\n}\n\nconst conf = new Conf<CLIConfig>({\n projectName: 'ucli',\n schema: {\n serverUrl: { type: 'string' },\n token: { type: 'string' },\n },\n})\n\nexport const cacheDir = join(homedir(), '.cache', 'ucli')\n\nexport function getConfig(): CLIConfig {\n const serverUrl = conf.get('serverUrl')\n const token = conf.get('token')\n\n if (!serverUrl || !token) {\n console.error('ucli is not configured. Run: ucli configure --server <url> --token <jwt>')\n process.exit(1)\n }\n\n return { serverUrl, token }\n}\n\nexport function saveConfig(cfg: CLIConfig): void {\n conf.set('serverUrl', cfg.serverUrl)\n conf.set('token', cfg.token)\n}\n\nexport function isConfigured(): boolean {\n return Boolean(conf.get('serverUrl') && conf.get('token'))\n}\n","/**\n * HTTP client for the ucli-server API.\n * Attaches group JWT and handles common error cases.\n */\nimport axios, { type AxiosInstance } from 'axios'\nimport type { CLIConfig } from '../config.js'\n\nexport interface OASEntryPublic {\n id: string\n name: string\n description: string\n remoteUrl: string\n baseEndpoint: string | null\n authType: 'bearer' | 'api_key' | 'basic' | 'oauth2_cc' | 'none'\n authConfig: Record<string, unknown>\n cacheTtl: number\n}\n\nexport type McpAuthConfig =\n | { type: 'none' }\n | { type: 'http_headers'; headers: Record<string, string> }\n | { type: 'env'; env: Record<string, string> }\n\nexport interface McpEntryPublic {\n id: string\n groupId: string\n name: string\n description: string\n transport: 'http' | 'stdio'\n serverUrl: string | null\n command: string | null\n authConfig: McpAuthConfig\n enabled: boolean\n}\n\nexport class ServerClient {\n private http: AxiosInstance\n\n constructor(cfg: CLIConfig) {\n this.http = axios.create({\n baseURL: cfg.serverUrl.replace(/\\/$/, ''),\n headers: {\n Authorization: `Bearer ${cfg.token}`,\n 'Content-Type': 'application/json',\n },\n timeout: 15_000,\n })\n\n this.http.interceptors.response.use(\n (r) => r,\n (err: unknown) => {\n if (axios.isAxiosError(err)) {\n const status = err.response?.status\n const message = (err.response?.data as { message?: string })?.message ?? err.message\n\n if (status === 401) {\n console.error('Authentication failed. Run: ucli configure --server <url> --token <jwt>')\n process.exit(1)\n }\n\n throw new Error(`Server error ${status ?? 'unknown'}: ${message}`)\n }\n throw err\n },\n )\n }\n\n async listOAS(): Promise<OASEntryPublic[]> {\n const { data } = await this.http.get<OASEntryPublic[]>('/api/v1/oas')\n return data\n }\n\n async getOAS(name: string): Promise<OASEntryPublic> {\n const { data } = await this.http.get<OASEntryPublic>(`/api/v1/oas/${encodeURIComponent(name)}`)\n return data\n }\n\n async listMCP(): Promise<McpEntryPublic[]> {\n const { data } = await this.http.get<McpEntryPublic[]>('/api/v1/mcp')\n return data\n }\n\n async getMCP(name: string): Promise<McpEntryPublic> {\n const { data } = await this.http.get<McpEntryPublic>(`/api/v1/mcp/${encodeURIComponent(name)}`)\n return data\n }\n}\n","import type { Command } from 'commander'\nimport { saveConfig, isConfigured } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\n\nexport function registerConfigure(program: Command): void {\n program\n .command('configure')\n .description('Configure the OAS Gateway server URL and authentication token')\n .requiredOption('--server <url>', 'OAS Gateway server URL (e.g. https://oas.example.com)')\n .requiredOption('--token <jwt>', 'Group JWT token issued by the server admin')\n .action(async (opts: { server: string; token: string }) => {\n const serverUrl = opts.server.replace(/\\/$/, '')\n const token = opts.token\n\n // Validate connectivity before saving\n console.log(`Connecting to ${serverUrl}...`)\n const client = new ServerClient({ serverUrl, token })\n\n try {\n await client.listOAS()\n saveConfig({ serverUrl, token })\n console.log('✓ Configuration saved successfully.')\n console.log(` Server: ${serverUrl}`)\n console.log(` Token: ${token.slice(0, 20)}...`)\n } catch (err) {\n console.error('Connection failed:', (err as Error).message)\n console.error('Please check the server URL and token.')\n process.exit(1)\n }\n })\n}\n","/**\n * Local file cache for OAS entries.\n * Stored at ~/.cache/oas-cli/<name>.json with TTL metadata.\n */\nimport { readFile, writeFile, mkdir } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { cacheDir } from '../config.js'\nimport type { OASEntryPublic } from './server-client.js'\n\ninterface CacheFile {\n entries: OASEntryPublic[]\n fetchedAt: number // ms timestamp\n ttlSec: number // cache duration\n}\n\nconst LIST_CACHE_FILE = join(cacheDir, 'oas-list.json')\n\nasync function ensureCacheDir(): Promise<void> {\n await mkdir(cacheDir, { recursive: true })\n}\n\nexport async function readOASListCache(): Promise<OASEntryPublic[] | null> {\n try {\n const raw = await readFile(LIST_CACHE_FILE, 'utf8')\n const cached: CacheFile = JSON.parse(raw)\n const age = (Date.now() - cached.fetchedAt) / 1000\n if (cached.ttlSec === 0 || age > cached.ttlSec) return null // expired\n return cached.entries\n } catch {\n return null // not found or parse error\n }\n}\n\nexport async function writeOASListCache(entries: OASEntryPublic[], ttlSec: number): Promise<void> {\n await ensureCacheDir()\n const cached: CacheFile = { entries, fetchedAt: Date.now(), ttlSec }\n await writeFile(LIST_CACHE_FILE, JSON.stringify(cached, null, 2), 'utf8')\n}\n\nexport async function clearOASListCache(): Promise<void> {\n try {\n await writeFile(LIST_CACHE_FILE, '{}', 'utf8')\n } catch {\n // ignore if not found\n }\n}\n","/**\n * Bridge between oas-cli and @tronsfey/openapi2cli run mode.\n *\n * Spawns openapi2cli as a child process, injecting auth config\n * as environment variables (never exposed to the agent's shell).\n */\nimport { spawn } from 'node:child_process'\nimport { createRequire } from 'node:module'\nimport { fileURLToPath } from 'node:url'\nimport { join, dirname } from 'node:path'\nimport type { OASEntryPublic } from './server-client.js'\n\nconst require = createRequire(import.meta.url)\n\nfunction resolveOpenapi2CliBin(): string {\n try {\n const pkgPath = require.resolve('@tronsfey/openapi2cli/package.json')\n const pkgDir = dirname(pkgPath)\n // @tronsfey/openapi2cli exposes its binary; find it\n const pkg = require('@tronsfey/openapi2cli/package.json') as { bin?: Record<string, string> }\n const binEntry = pkg.bin?.['openapi2cli'] ?? 'bin/openapi2cli.js'\n return join(pkgDir, binEntry)\n } catch {\n throw new Error(\n '@tronsfey/openapi2cli is not installed. Run: pnpm add @tronsfey/openapi2cli in packages/cli',\n )\n }\n}\n\nexport interface RunOptions {\n entry: OASEntryPublic\n /** Operation command args (e.g. ['listPets', '--limit', '10']) */\n operationArgs: string[]\n format?: 'json' | 'table' | 'yaml'\n query?: string\n}\n\n/**\n * Build auth environment variables for injection into child process.\n * The calling shell (and thus the AI agent) never sees these values.\n */\nfunction buildAuthEnv(entry: OASEntryPublic): Record<string, string> {\n const cfg = entry.authConfig\n const prefix = entry.name.toUpperCase().replace(/[^A-Z0-9]/g, '_')\n\n switch (cfg['type']) {\n case 'bearer':\n return { [`${prefix}_TOKEN`]: cfg['token'] as string }\n\n case 'api_key':\n return { [`${prefix}_API_KEY`]: cfg['key'] as string }\n\n case 'basic':\n return { [`${prefix}_CREDENTIALS`]: `${cfg['username']}:${cfg['password']}` }\n\n case 'oauth2_cc':\n return {\n [`${prefix}_CLIENT_ID`]: cfg['clientId'] as string,\n [`${prefix}_CLIENT_SECRET`]: cfg['clientSecret'] as string,\n [`${prefix}_SCOPES`]: (cfg['scopes'] as string[]).join(' '),\n }\n\n default:\n return {}\n }\n}\n\nexport async function runOperation(opts: RunOptions): Promise<void> {\n const bin = resolveOpenapi2CliBin()\n const { entry, operationArgs, format, query } = opts\n\n const args = [\n 'run',\n '--oas', entry.remoteUrl,\n '--cache-ttl', String(entry.cacheTtl),\n ...(entry.baseEndpoint ? ['--endpoint', entry.baseEndpoint] : []),\n ...(format ? ['--format', format] : []),\n ...(query ? ['--query', query] : []),\n ...operationArgs,\n ]\n\n const authEnv = buildAuthEnv(entry)\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(process.execPath, [bin, ...args], {\n stdio: 'inherit',\n env: {\n ...process.env,\n ...authEnv, // inject auth — not visible to parent shell\n },\n })\n\n child.on('close', (code) => {\n if (code === 0) resolve()\n else reject(new Error(`openapi2cli exited with code ${code}`))\n })\n child.on('error', reject)\n })\n}\n\n/**\n * Get list of available operations for a service by running `--help`.\n * Returns the raw help text from openapi2cli.\n */\nexport async function getServiceHelp(entry: OASEntryPublic): Promise<string> {\n const bin = resolveOpenapi2CliBin()\n const args = [\n 'run',\n '--oas', entry.remoteUrl,\n '--cache-ttl', String(entry.cacheTtl),\n '--help',\n ]\n\n return new Promise<string>((resolve, reject) => {\n let output = ''\n const child = spawn(process.execPath, [bin, ...args], {\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n\n child.stdout?.on('data', (d: Buffer) => { output += d.toString() })\n child.stderr?.on('data', (d: Buffer) => { output += d.toString() })\n child.on('close', () => resolve(output))\n child.on('error', reject)\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { readOASListCache, writeOASListCache } from '../lib/cache.js'\nimport { getServiceHelp } from '../lib/oas-runner.js'\n\nexport function registerServices(program: Command): void {\n const services = program\n .command('services')\n .description('Manage and inspect available OAS services')\n\n // services list\n services\n .command('list')\n .description('List all OAS services available in the current group')\n .option('--no-cache', 'Bypass local cache and fetch fresh from server')\n .action(async (opts: { cache: boolean }) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entries = opts.cache ? await readOASListCache() : null\n\n if (!entries) {\n entries = await client.listOAS()\n if (entries.length > 0) {\n const maxTtl = Math.min(...entries.map((e) => e.cacheTtl))\n await writeOASListCache(entries, maxTtl)\n }\n }\n\n if (entries.length === 0) {\n console.log('No services registered in this group.')\n return\n }\n\n const nameWidth = Math.max(10, ...entries.map((e) => e.name.length))\n console.log(`\\n${'SERVICE'.padEnd(nameWidth)} AUTH DESCRIPTION`)\n console.log(`${'-'.repeat(nameWidth)} -------- ${'-'.repeat(40)}`)\n for (const e of entries) {\n const auth = e.authType.padEnd(8)\n const desc = e.description.length > 60 ? e.description.slice(0, 57) + '...' : e.description\n console.log(`${e.name.padEnd(nameWidth)} ${auth} ${desc}`)\n }\n console.log()\n })\n\n // services info <name>\n services\n .command('info <name>')\n .description('Show detailed information and available operations for a service')\n .action(async (name: string) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getOAS(name)\n } catch (err) {\n console.error(`Service not found: ${name}`)\n console.error('Run `ucli services list` to see available services.')\n process.exit(1)\n }\n\n console.log(`\\nService: ${entry.name}`)\n console.log(`Description: ${entry.description || '(none)'}`)\n console.log(`OAS URL: ${entry.remoteUrl}`)\n if (entry.baseEndpoint) console.log(`Base endpoint: ${entry.baseEndpoint}`)\n console.log(`Auth type: ${entry.authType}`)\n console.log(`Cache TTL: ${entry.cacheTtl}s`)\n\n console.log('\\nAvailable operations:')\n console.log('─'.repeat(60))\n\n const help = await getServiceHelp(entry)\n console.log(help)\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { runOperation } from '../lib/oas-runner.js'\n\nexport function registerRun(program: Command): void {\n program\n .command('run <service> [args...]')\n .description('Execute an operation on a service')\n .option('--format <fmt>', 'Output format: json | table | yaml', 'json')\n .option('--query <jmespath>', 'Filter response with JMESPath expression')\n .option('--data <json>', 'Request body (JSON string or @filename)')\n .allowUnknownOption(true)\n .action(async (\n service: string,\n args: string[],\n opts: { format?: string; query?: string; data?: string; args?: string[] },\n ) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getOAS(service)\n } catch {\n console.error(`Unknown service: ${service}`)\n console.error('Run `ucli services list` to see available services.')\n process.exit(1)\n }\n\n // Collect extra args (pass-through to openapi2cli)\n const extraArgs = opts.args ?? []\n const operationArgs = [\n ...args,\n ...extraArgs,\n ...(opts.data ? ['--data', opts.data] : []),\n ]\n\n const format = opts.format as 'json' | 'table' | 'yaml' | undefined\n const query = opts.query as string | undefined\n\n try {\n await runOperation({\n entry,\n operationArgs,\n ...(format !== undefined ? { format } : {}),\n ...(query !== undefined ? { query } : {}),\n })\n } catch (err) {\n console.error('Operation failed:', (err as Error).message)\n process.exit(1)\n }\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { writeOASListCache, clearOASListCache } from '../lib/cache.js'\n\nexport function registerRefresh(program: Command): void {\n program\n .command('refresh')\n .description('Force-refresh the local OAS cache from the server')\n .action(async () => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n console.log('Refreshing OAS list from server...')\n await clearOASListCache()\n\n const entries = await client.listOAS()\n if (entries.length > 0) {\n const maxTtl = Math.min(...entries.map((e) => e.cacheTtl))\n await writeOASListCache(entries, maxTtl)\n }\n\n console.log(`✓ Refreshed ${entries.length} service(s).`)\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig, isConfigured } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { readOASListCache, writeOASListCache } from '../lib/cache.js'\nimport { getServiceHelp } from '../lib/oas-runner.js'\n\nexport function registerHelp(program: Command): void {\n program\n .command('help [service]')\n .description('Show usage guide. Pass a service name for service-specific operations.')\n .action(async (service?: string) => {\n if (!service) {\n printGeneralHelp()\n if (isConfigured()) {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n let entries = await readOASListCache()\n if (!entries) {\n entries = await client.listOAS()\n if (entries.length > 0) {\n const maxTtl = Math.min(...entries.map((e) => e.cacheTtl))\n await writeOASListCache(entries, maxTtl)\n }\n }\n if (entries.length > 0) {\n console.log('\\nAvailable services:')\n for (const e of entries) {\n console.log(` ${e.name.padEnd(20)} ${e.description}`)\n }\n console.log('\\nTip: Run `ucli help <service>` for service-specific operations.')\n }\n } else {\n console.log('\\nRun `ucli configure --server <url> --token <jwt>` to get started.')\n }\n return\n }\n\n // Service-specific help\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getOAS(service)\n } catch {\n console.error(`Unknown service: ${service}`)\n console.error('Run `ucli services list` to see available services.')\n process.exit(1)\n }\n\n console.log(`\\n=== ${entry.name} ===`)\n console.log(`${entry.description}`)\n console.log(`\\nOAS spec: ${entry.remoteUrl}`)\n console.log('\\nOperations:')\n console.log('─'.repeat(60))\n\n const help = await getServiceHelp(entry)\n console.log(help)\n\n console.log('\\nExamples:')\n console.log(` ucli run ${entry.name} <operation>`)\n console.log(` ucli run ${entry.name} <operation> --format table`)\n console.log(` ucli run ${entry.name} <operation> --query \"results[*].id\"`)\n console.log(` ucli run ${entry.name} <operation> --data '{\"key\":\"value\"}'`)\n })\n}\n\nfunction printGeneralHelp(): void {\n console.log(`\nucli — OpenAPI & MCP Gateway for AI Agents\n════════════════════════════════════════\n\nSETUP\n ucli configure --server <url> --token <jwt>\n Configure server connection and authentication.\n\nDISCOVERY\n ucli services list\n List all OAS services available in your group.\n\n ucli services info <service>\n Show detailed service info and all available operations.\n\n ucli help [service]\n Show this guide, or service-specific operations.\n\nEXECUTION\n ucli run <service> <operation> [options]\n Execute a service operation.\n\n Options:\n --format json|table|yaml Output format (default: json)\n --query <jmespath> Filter response with JMESPath\n --data <json|@file> Request body for POST/PUT/PATCH\n\nMAINTENANCE\n ucli refresh\n Force-refresh the local OAS cache from the server.\n\nERRORS\n 401 Unauthorized → Run: ucli configure --server <url> --token <jwt>\n 404 Not Found → Check service name: ucli services list\n 4xx Client Error → Check operation args: ucli services info <service>\n 5xx Server Error → Retry or run: ucli refresh\n`)\n}\n","/**\n * MCP tool runner using @tronsfey/mcp2cli programmatic API.\n *\n * Auth credentials are injected via McpServerConfig (headers or env) —\n * never passed as CLI arguments (which would be visible in `ps`).\n */\nimport type { McpEntryPublic } from './server-client.js'\n\n// Dynamic imports to avoid top-level await in ESM\nasync function getMcp2cli() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const clientMod = await import('@tronsfey/mcp2cli/dist/client/index.js') as any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const runnerMod = await import('@tronsfey/mcp2cli/dist/runner/index.js') as any\n return { createMcpClient: clientMod.createMcpClient, getTools: runnerMod.getTools, runTool: runnerMod.runTool }\n}\n\nfunction buildMcpConfig(entry: McpEntryPublic): Record<string, unknown> {\n const base: Record<string, unknown> = { type: entry.transport }\n if (entry.transport === 'http') {\n base.url = entry.serverUrl\n } else {\n base.command = entry.command\n }\n const auth = entry.authConfig\n if (auth.type === 'http_headers') {\n base.headers = auth.headers\n } else if (auth.type === 'env') {\n base.env = auth.env\n }\n return base\n}\n\nexport async function listMcpTools(entry: McpEntryPublic): Promise<{ name: string; description?: string }[]> {\n const { createMcpClient, getTools } = await getMcp2cli()\n const config = buildMcpConfig(entry)\n const client = await createMcpClient(config)\n const tools = await getTools(client, config, { noCache: true })\n return tools\n}\n\nexport async function runMcpTool(entry: McpEntryPublic, toolName: string, rawArgs: string[]): Promise<void> {\n const { createMcpClient, getTools, runTool } = await getMcp2cli()\n const config = buildMcpConfig(entry)\n const client = await createMcpClient(config)\n const tools = await getTools(client, config, { noCache: false, cacheTtl: 3600 })\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tool = tools.find((t: any) => t.name === toolName)\n if (!tool) throw new Error(`Tool \"${toolName}\" not found on MCP server \"${entry.name}\"`)\n await runTool(client, tool, rawArgs, {})\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { listMcpTools, runMcpTool } from '../lib/mcp-runner.js'\n\nexport function registerMcp(program: Command): void {\n const mcp = program\n .command('mcp')\n .description('Interact with MCP servers registered in your group')\n\n // mcp list\n mcp\n .command('list')\n .description('List all MCP servers available in the current group')\n .action(async () => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n const entries = await client.listMCP()\n\n if (entries.length === 0) {\n console.log('No MCP servers registered in this group.')\n return\n }\n\n const nameWidth = Math.max(10, ...entries.map(e => e.name.length))\n console.log(`\\n${'SERVER'.padEnd(nameWidth)} TRANSPORT DESCRIPTION`)\n console.log(`${'-'.repeat(nameWidth)} --------- ${'-'.repeat(40)}`)\n for (const e of entries) {\n const desc = e.description.length > 60 ? e.description.slice(0, 57) + '...' : e.description\n console.log(`${e.name.padEnd(nameWidth)} ${e.transport.padEnd(9)} ${desc}`)\n }\n console.log()\n })\n\n // mcp tools <server>\n mcp\n .command('tools <server>')\n .description('List tools available on a MCP server')\n .action(async (serverName: string) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getMCP(serverName)\n } catch {\n console.error(`Unknown MCP server: ${serverName}`)\n console.error('Run `ucli mcp list` to see available servers.')\n process.exit(1)\n }\n\n let tools\n try {\n tools = await listMcpTools(entry)\n } catch (err) {\n console.error('Failed to fetch tools:', (err as Error).message)\n process.exit(1)\n }\n\n if (tools.length === 0) {\n console.log(`No tools found on MCP server \"${serverName}\".`)\n return\n }\n\n console.log(`\\nTools on \"${serverName}\":`)\n console.log('─'.repeat(60))\n for (const t of tools) {\n console.log(` ${t.name}`)\n if (t.description) console.log(` ${t.description}`)\n }\n console.log()\n })\n\n // mcp run <server> <tool> [args...]\n mcp\n .command('run <server> <tool> [args...]')\n .description('Call a tool on a MCP server')\n .action(async (serverName: string, toolName: string, args: string[]) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getMCP(serverName)\n } catch {\n console.error(`Unknown MCP server: ${serverName}`)\n console.error('Run `ucli mcp list` to see available servers.')\n process.exit(1)\n }\n\n try {\n await runMcpTool(entry, toolName, args)\n } catch (err) {\n console.error('Tool execution failed:', (err as Error).message)\n process.exit(1)\n }\n })\n}\n"],"mappings":";;;;AAAA,SAAS,eAAe;AACxB,SAAS,iBAAAA,sBAAqB;;;ACD9B,OAAO,UAAU;AACjB,SAAS,eAAe;AACxB,SAAS,YAAY;AAOrB,IAAM,OAAO,IAAI,KAAgB;AAAA,EAC/B,aAAa;AAAA,EACb,QAAQ;AAAA,IACN,WAAW,EAAE,MAAM,SAAS;AAAA,IAC5B,OAAO,EAAE,MAAM,SAAS;AAAA,EAC1B;AACF,CAAC;AAEM,IAAM,WAAW,KAAK,QAAQ,GAAG,UAAU,MAAM;AAEjD,SAAS,YAAuB;AACrC,QAAM,YAAY,KAAK,IAAI,WAAW;AACtC,QAAM,QAAQ,KAAK,IAAI,OAAO;AAE9B,MAAI,CAAC,aAAa,CAAC,OAAO;AACxB,YAAQ,MAAM,0EAA0E;AACxF,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,EAAE,WAAW,MAAM;AAC5B;AAEO,SAAS,WAAW,KAAsB;AAC/C,OAAK,IAAI,aAAa,IAAI,SAAS;AACnC,OAAK,IAAI,SAAS,IAAI,KAAK;AAC7B;AAEO,SAAS,eAAwB;AACtC,SAAO,QAAQ,KAAK,IAAI,WAAW,KAAK,KAAK,IAAI,OAAO,CAAC;AAC3D;;;AClCA,OAAO,WAAmC;AA+BnC,IAAM,eAAN,MAAmB;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UAAU,EAAE;AACjD,cAAQ,MAAM,+CAA+C;AAC7D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI;AACF,YAAM,WAAW,OAAO,UAAU,IAAI;AAAA,IACxC,SAAS,KAAK;AACZ,cAAQ,MAAM,0BAA2B,IAAc,OAAO;AAC9D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;;;AXxFA,IAAMC,WAAUC,eAAc,YAAY,GAAG;AAC7C,IAAM,MAAMD,SAAQ,iBAAiB;AAErC,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,MAAM,EACX,YAAY,IAAI,WAAW,EAC3B,QAAQ,IAAI,SAAS,eAAe,EACpC,eAAe,KAAK;AAEvB,kBAAkB,OAAO;AACzB,iBAAiB,OAAO;AACxB,YAAY,OAAO;AACnB,gBAAgB,OAAO;AACvB,YAAY,OAAO;AACnB,aAAa,OAAO;AAEpB,QAAQ,MAAM,QAAQ,IAAI;","names":["createRequire","program","join","join","join","require","pkg","program","program","program","program","cfg","client","program","require","createRequire"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/lib/config-encryption.ts","../src/lib/server-client.ts","../src/commands/configure.ts","../src/lib/cache.ts","../src/lib/oas-runner.ts","../src/commands/services.ts","../src/commands/run.ts","../src/commands/refresh.ts","../src/commands/help-cmd.ts","../src/lib/mcp-runner.ts","../src/commands/mcp.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { createRequire } from 'node:module'\nimport { registerConfigure } from './commands/configure.js'\nimport { registerServices } from './commands/services.js'\nimport { registerRun } from './commands/run.js'\nimport { registerRefresh } from './commands/refresh.js'\nimport { registerHelp } from './commands/help-cmd.js'\nimport { registerMcp } from './commands/mcp.js'\n\nconst require = createRequire(import.meta.url)\nconst pkg = require('../package.json') as { version: string; description: string }\n\nconst program = new Command()\n\nprogram\n .name('ucli')\n .description(pkg.description)\n .version(pkg.version, '-v, --version')\n .addHelpCommand(false) // we provide our own help command\n\nregisterConfigure(program)\nregisterServices(program)\nregisterRun(program)\nregisterRefresh(program)\nregisterMcp(program)\nregisterHelp(program)\n\nprogram.parse(process.argv)\n","import Conf from 'conf'\nimport { homedir } from 'node:os'\nimport { join, dirname } from 'node:path'\nimport { chmodSync, mkdirSync } from 'node:fs'\nimport { encryptValue, decryptValue, isEncrypted } from './lib/config-encryption.js'\n\nexport interface CLIConfig {\n serverUrl: string\n token: string\n}\n\nconst conf = new Conf<CLIConfig>({\n projectName: 'ucli',\n schema: {\n serverUrl: { type: 'string' },\n token: { type: 'string' },\n },\n})\n\nexport const cacheDir = join(homedir(), '.cache', 'ucli')\n\n/** Ensure the config file and its directory have restrictive permissions. */\nfunction hardenConfigPermissions(): void {\n try {\n const configPath = conf.path\n const configDir = dirname(configPath)\n mkdirSync(configDir, { recursive: true, mode: 0o700 })\n chmodSync(configDir, 0o700)\n chmodSync(configPath, 0o600)\n } catch {\n // Permission enforcement may fail on some platforms (e.g., Windows)\n console.warn('Warning: Could not enforce restrictive file permissions on config. Token is encrypted but file permissions may be permissive.')\n }\n}\n\nexport function getConfig(): CLIConfig {\n const serverUrl = conf.get('serverUrl')\n const rawToken = conf.get('token')\n\n if (!serverUrl || !rawToken) {\n console.error('ucli is not configured. Run: ucli configure --server <url> --token <jwt>')\n process.exit(1)\n }\n\n const token = decryptValue(rawToken)\n\n // Auto-migrate: re-encrypt legacy plaintext tokens on read\n if (!isEncrypted(rawToken)) {\n conf.set('token', encryptValue(token))\n hardenConfigPermissions()\n }\n\n return { serverUrl, token }\n}\n\nexport function saveConfig(cfg: CLIConfig): void {\n conf.set('serverUrl', cfg.serverUrl)\n conf.set('token', encryptValue(cfg.token))\n hardenConfigPermissions()\n}\n\nexport function isConfigured(): boolean {\n return Boolean(conf.get('serverUrl') && conf.get('token'))\n}\n","/**\n * Config value encryption utilities.\n *\n * Encrypts sensitive config values (e.g., JWT tokens) at rest using AES-256-GCM\n * with a machine-specific derived key. This ensures credentials are never stored\n * in plaintext on disk.\n *\n * Key derivation: PBKDF2(username + hostname, random-salt, 100k iterations, SHA-512)\n * Format: \"enc:v1:<base64(salt + iv + authTag + ciphertext)>\"\n */\nimport {\n createCipheriv,\n createDecipheriv,\n randomBytes,\n pbkdf2Sync,\n} from 'node:crypto'\nimport { hostname, userInfo } from 'node:os'\n\nconst ENC_PREFIX = 'enc:v1:'\nconst ALGORITHM = 'aes-256-gcm'\nconst SALT_LEN = 32\nconst IV_LEN = 12\nconst TAG_LEN = 16\nconst PBKDF2_ITERATIONS = 100_000\n\n/** Derive a 256-bit key from machine-specific identity + per-value random salt. */\nfunction deriveKey(salt: Buffer): Buffer {\n let user = 'default'\n try {\n user = userInfo().username\n } catch {\n // userInfo() may throw on some platforms (e.g., certain containers)\n }\n const material = `ucli:${user}@${hostname()}`\n return pbkdf2Sync(material, salt, PBKDF2_ITERATIONS, 32, 'sha512')\n}\n\n/** Encrypt a plaintext string. Returns prefixed ciphertext string. */\nexport function encryptValue(plaintext: string): string {\n const salt = randomBytes(SALT_LEN)\n const key = deriveKey(salt)\n const iv = randomBytes(IV_LEN)\n const cipher = createCipheriv(ALGORITHM, key, iv)\n const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()])\n const tag = cipher.getAuthTag()\n const packed = Buffer.concat([salt, iv, tag, encrypted])\n return ENC_PREFIX + packed.toString('base64')\n}\n\n/**\n * Decrypt a stored value. If the value has the encryption prefix, it is\n * decrypted; otherwise it is returned as-is for backward compatibility\n * with legacy plaintext configs.\n */\nexport function decryptValue(stored: string): string {\n if (!stored.startsWith(ENC_PREFIX)) {\n return stored\n }\n const packed = Buffer.from(stored.slice(ENC_PREFIX.length), 'base64')\n const salt = packed.subarray(0, SALT_LEN)\n const iv = packed.subarray(SALT_LEN, SALT_LEN + IV_LEN)\n const tag = packed.subarray(SALT_LEN + IV_LEN, SALT_LEN + IV_LEN + TAG_LEN)\n const encrypted = packed.subarray(SALT_LEN + IV_LEN + TAG_LEN)\n const key = deriveKey(salt)\n const decipher = createDecipheriv(ALGORITHM, key, iv)\n decipher.setAuthTag(tag)\n return Buffer.concat([decipher.update(encrypted), decipher.final()]).toString('utf8')\n}\n\n/** Check whether a stored value is encrypted (has the encryption prefix). */\nexport function isEncrypted(value: string): boolean {\n return value.startsWith(ENC_PREFIX)\n}\n","/**\n * HTTP client for the ucli-server API.\n * Attaches group JWT and handles common error cases.\n */\nimport axios, { type AxiosInstance } from 'axios'\nimport type { CLIConfig } from '../config.js'\n\nexport interface OASEntryPublic {\n id: string\n name: string\n description: string\n remoteUrl: string\n baseEndpoint: string | null\n authType: 'bearer' | 'api_key' | 'basic' | 'oauth2_cc' | 'none'\n authConfig: Record<string, unknown>\n cacheTtl: number\n}\n\nexport type McpAuthConfig =\n | { type: 'none' }\n | { type: 'http_headers'; headers: Record<string, string> }\n | { type: 'env'; env: Record<string, string> }\n\nexport interface McpEntryPublic {\n id: string\n groupId: string\n name: string\n description: string\n transport: 'http' | 'stdio'\n serverUrl: string | null\n command: string | null\n authConfig: McpAuthConfig\n enabled: boolean\n}\n\nexport class ServerClient {\n private http: AxiosInstance\n\n constructor(cfg: CLIConfig) {\n this.http = axios.create({\n baseURL: cfg.serverUrl.replace(/\\/$/, ''),\n headers: {\n Authorization: `Bearer ${cfg.token}`,\n 'Content-Type': 'application/json',\n },\n timeout: 15_000,\n })\n\n this.http.interceptors.response.use(\n (r) => r,\n (err: unknown) => {\n if (axios.isAxiosError(err)) {\n const status = err.response?.status\n const message = (err.response?.data as { message?: string })?.message ?? err.message\n\n if (status === 401) {\n console.error('Authentication failed. Run: ucli configure --server <url> --token <jwt>')\n process.exit(1)\n }\n\n throw new Error(`Server error ${status ?? 'unknown'}: ${message}`)\n }\n throw err\n },\n )\n }\n\n async listOAS(): Promise<OASEntryPublic[]> {\n const { data } = await this.http.get<OASEntryPublic[]>('/api/v1/oas')\n return data\n }\n\n async getOAS(name: string): Promise<OASEntryPublic> {\n const { data } = await this.http.get<OASEntryPublic>(`/api/v1/oas/${encodeURIComponent(name)}`)\n return data\n }\n\n async listMCP(): Promise<McpEntryPublic[]> {\n const { data } = await this.http.get<McpEntryPublic[]>('/api/v1/mcp')\n return data\n }\n\n async getMCP(name: string): Promise<McpEntryPublic> {\n const { data } = await this.http.get<McpEntryPublic>(`/api/v1/mcp/${encodeURIComponent(name)}`)\n return data\n }\n}\n","import type { Command } from 'commander'\nimport { saveConfig, isConfigured } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\n\nexport function registerConfigure(program: Command): void {\n program\n .command('configure')\n .description('Configure the OAS Gateway server URL and authentication token')\n .requiredOption('--server <url>', 'OAS Gateway server URL (e.g. https://oas.example.com)')\n .requiredOption('--token <jwt>', 'Group JWT token issued by the server admin')\n .action(async (opts: { server: string; token: string }) => {\n const serverUrl = opts.server.replace(/\\/$/, '')\n const token = opts.token\n\n // Validate connectivity before saving\n console.log(`Connecting to ${serverUrl}...`)\n const client = new ServerClient({ serverUrl, token })\n\n try {\n await client.listOAS()\n saveConfig({ serverUrl, token })\n console.log('✓ Configuration saved successfully.')\n console.log(` Server: ${serverUrl}`)\n console.log(` Token: ${token.slice(0, 20)}...`)\n } catch (err) {\n console.error('Connection failed:', (err as Error).message)\n console.error('Please check the server URL and token.')\n process.exit(1)\n }\n })\n}\n","/**\n * Local file cache for OAS entries.\n * Stored at ~/.cache/oas-cli/<name>.json with TTL metadata.\n *\n * Security: authConfig credential values are stripped before writing.\n * Only { type } is persisted — full secrets are never written to disk.\n */\nimport { readFile, writeFile, mkdir, unlink, chmod } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { cacheDir } from '../config.js'\nimport type { OASEntryPublic } from './server-client.js'\n\ninterface CacheFile {\n entries: OASEntryPublic[]\n fetchedAt: number // ms timestamp\n ttlSec: number // cache duration\n}\n\nconst LIST_CACHE_FILE = join(cacheDir, 'oas-list.json')\n\nasync function ensureCacheDir(): Promise<void> {\n await mkdir(cacheDir, { recursive: true, mode: 0o700 })\n}\n\n/** Strip credential secrets from authConfig — only persist { type }. */\nfunction redactEntries(entries: OASEntryPublic[]): OASEntryPublic[] {\n return entries.map((e) => ({\n ...e,\n authConfig: { type: (e.authConfig as Record<string, unknown>)['type'] ?? e.authType },\n }))\n}\n\nexport async function readOASListCache(): Promise<OASEntryPublic[] | null> {\n try {\n const raw = await readFile(LIST_CACHE_FILE, 'utf8')\n const cached: CacheFile = JSON.parse(raw)\n const age = (Date.now() - cached.fetchedAt) / 1000\n if (cached.ttlSec === 0 || age > cached.ttlSec) return null // expired\n return cached.entries\n } catch {\n return null // not found or parse error\n }\n}\n\nexport async function writeOASListCache(entries: OASEntryPublic[], ttlSec: number): Promise<void> {\n await ensureCacheDir()\n const cached: CacheFile = { entries: redactEntries(entries), fetchedAt: Date.now(), ttlSec }\n await writeFile(LIST_CACHE_FILE, JSON.stringify(cached, null, 2), { encoding: 'utf8', mode: 0o600 })\n await chmod(LIST_CACHE_FILE, 0o600)\n}\n\nexport async function clearOASListCache(): Promise<void> {\n try {\n await unlink(LIST_CACHE_FILE)\n } catch {\n // ignore if not found\n }\n}\n\nexport async function clearOASCache(name: string): Promise<void> {\n try {\n const raw = await readFile(LIST_CACHE_FILE, 'utf8')\n const cached: CacheFile = JSON.parse(raw)\n const entries = Array.isArray(cached.entries) ? cached.entries.filter((e) => e.name !== name) : []\n if (entries.length === 0) {\n await clearOASListCache()\n return\n }\n const next: CacheFile = {\n entries,\n fetchedAt: cached.fetchedAt ?? Date.now(),\n ttlSec: cached.ttlSec ?? 0,\n }\n await writeFile(LIST_CACHE_FILE, JSON.stringify(next, null, 2), { encoding: 'utf8', mode: 0o600 })\n } catch {\n await clearOASListCache()\n }\n}\n","/**\n * Bridge between oas-cli and @tronsfey/openapi2cli run mode.\n *\n * Spawns openapi2cli as a child process, injecting auth config\n * as environment variables (never exposed to the agent's shell).\n */\nimport { spawn } from 'node:child_process'\nimport { createRequire } from 'node:module'\nimport { join, dirname } from 'node:path'\nimport type { OASEntryPublic } from './server-client.js'\n\nconst require = createRequire(import.meta.url)\n\nfunction resolveOpenapi2CliBin(): string {\n try {\n const pkgPath = require.resolve('@tronsfey/openapi2cli/package.json')\n const pkgDir = dirname(pkgPath)\n // @tronsfey/openapi2cli exposes its binary; find it\n const pkg = require('@tronsfey/openapi2cli/package.json') as { bin?: Record<string, string> }\n const binEntry = pkg.bin?.['openapi2cli'] ?? 'bin/openapi2cli.js'\n return join(pkgDir, binEntry)\n } catch {\n throw new Error(\n '@tronsfey/openapi2cli is not installed. Run: pnpm add @tronsfey/openapi2cli in packages/cli',\n )\n }\n}\n\nexport interface RunOptions {\n entry: OASEntryPublic\n /** Operation command args (e.g. ['listPets', '--limit', '10']) */\n operationArgs: string[]\n format?: 'json' | 'table' | 'yaml'\n query?: string\n}\n\n/**\n * Build auth environment variables for injection into child process.\n * The calling shell (and thus the AI agent) never sees these values.\n */\nfunction buildAuthEnv(entry: OASEntryPublic): Record<string, string> {\n const cfg = entry.authConfig\n const prefix = entry.name.toUpperCase().replace(/[^A-Z0-9]/g, '_')\n\n switch (cfg['type']) {\n case 'bearer':\n return { [`${prefix}_TOKEN`]: cfg['token'] as string }\n\n case 'api_key':\n return { [`${prefix}_API_KEY`]: cfg['key'] as string }\n\n case 'basic':\n return { [`${prefix}_CREDENTIALS`]: `${cfg['username']}:${cfg['password']}` }\n\n case 'oauth2_cc':\n return {\n [`${prefix}_CLIENT_ID`]: cfg['clientId'] as string,\n [`${prefix}_CLIENT_SECRET`]: cfg['clientSecret'] as string,\n [`${prefix}_SCOPES`]: (cfg['scopes'] as string[]).join(' '),\n }\n\n default:\n return {}\n }\n}\n\n/**\n * Environment variable allowlist for subprocess execution.\n * Only these variables (when present in the parent) are forwarded to the\n * child process. This prevents leakage of secrets such as cloud credentials,\n * encryption keys, or database passwords that may be in the parent env.\n */\nconst SAFE_ENV_KEYS: readonly string[] = [\n // System essentials\n 'PATH', 'HOME', 'USER', 'LOGNAME', 'SHELL', 'TMPDIR', 'TMP', 'TEMP',\n // Terminal / display\n 'TERM', 'COLORTERM', 'NO_COLOR', 'FORCE_COLOR', 'LANG', 'LC_ALL',\n 'LC_CTYPE', 'LC_MESSAGES', 'LC_COLLATE',\n // Node.js\n 'NODE_ENV', 'NODE_PATH', 'NODE_OPTIONS', 'NODE_EXTRA_CA_CERTS',\n // Network proxy (required for tools behind corporate proxies)\n 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY',\n 'http_proxy', 'https_proxy', 'no_proxy',\n // OS-specific\n 'SYSTEMROOT', 'COMSPEC', 'APPDATA', 'LOCALAPPDATA', 'PROGRAMFILES',\n 'XDG_RUNTIME_DIR', 'XDG_CONFIG_HOME', 'XDG_CACHE_HOME', 'XDG_DATA_HOME',\n]\n\nfunction buildSafeEnv(authEnv: Record<string, string>): Record<string, string> {\n const safe: Record<string, string> = {}\n for (const key of SAFE_ENV_KEYS) {\n if (process.env[key] !== undefined) {\n safe[key] = process.env[key]!\n }\n }\n return { ...safe, ...authEnv }\n}\n\nexport async function runOperation(opts: RunOptions): Promise<void> {\n const bin = resolveOpenapi2CliBin()\n const { entry, operationArgs, format, query } = opts\n\n const args = [\n 'run',\n '--oas', entry.remoteUrl,\n '--cache-ttl', String(entry.cacheTtl),\n ...(entry.baseEndpoint ? ['--endpoint', entry.baseEndpoint] : []),\n ...(format ? ['--format', format] : []),\n ...(query ? ['--query', query] : []),\n ...operationArgs,\n ]\n\n const authEnv = buildAuthEnv(entry)\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(process.execPath, [bin, ...args], {\n stdio: 'inherit',\n env: buildSafeEnv(authEnv),\n })\n\n child.on('close', (code) => {\n if (code === 0) resolve()\n else reject(new Error(`openapi2cli exited with code ${code}`))\n })\n child.on('error', reject)\n })\n}\n\n/**\n * Get list of available operations for a service by running `--help`.\n * Returns the raw help text from openapi2cli.\n */\nexport async function getServiceHelp(entry: OASEntryPublic): Promise<string> {\n const bin = resolveOpenapi2CliBin()\n const args = [\n 'run',\n '--oas', entry.remoteUrl,\n '--cache-ttl', String(entry.cacheTtl),\n '--help',\n ]\n\n return new Promise<string>((resolve, reject) => {\n let output = ''\n const child = spawn(process.execPath, [bin, ...args], {\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n\n child.stdout?.on('data', (d: Buffer) => { output += d.toString() })\n child.stderr?.on('data', (d: Buffer) => { output += d.toString() })\n child.on('close', () => resolve(output))\n child.on('error', reject)\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { readOASListCache, writeOASListCache } from '../lib/cache.js'\nimport { getServiceHelp } from '../lib/oas-runner.js'\n\nexport function registerServices(program: Command): void {\n const services = program\n .command('services')\n .description('Manage and inspect available OAS services')\n\n // services list\n services\n .command('list')\n .description('List all OAS services available in the current group')\n .option('--refresh', 'Bypass local cache and fetch fresh from server')\n .option('--format <fmt>', 'Output format: table | json | yaml', 'table')\n .option('--no-cache', 'Bypass local cache and fetch fresh from server')\n .action(async (opts: { cache: boolean; refresh?: boolean; format?: string }) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n if (!opts.cache) {\n process.emitWarning('The --no-cache flag is deprecated. Please use --refresh instead.')\n }\n\n const useCache = opts.cache && !opts.refresh\n let entries = useCache ? await readOASListCache() : null\n\n if (!entries) {\n entries = await client.listOAS()\n if (entries.length > 0) {\n const maxTtl = Math.min(...entries.map((e) => e.cacheTtl))\n await writeOASListCache(entries, maxTtl)\n }\n }\n\n const format = (opts.format ?? 'table').toLowerCase()\n\n if (entries.length === 0) {\n console.log('No services registered in this group.')\n return\n }\n\n if (format === 'json') {\n // Strip authConfig secrets from JSON output — only expose { type }\n const safe = entries.map(({ authConfig, ...rest }) => ({\n ...rest,\n authConfig: { type: (authConfig as Record<string, unknown>)['type'] ?? rest.authType },\n }))\n console.log(JSON.stringify(safe, null, 2))\n return\n }\n\n const nameWidth = Math.max(10, ...entries.map((e) => e.name.length))\n console.log(`\\n${'SERVICE'.padEnd(nameWidth)} AUTH DESCRIPTION`)\n console.log(`${'-'.repeat(nameWidth)} -------- ${'-'.repeat(40)}`)\n for (const e of entries) {\n const auth = e.authType.padEnd(8)\n const desc = e.description.length > 60 ? e.description.slice(0, 57) + '...' : e.description\n console.log(`${e.name.padEnd(nameWidth)} ${auth} ${desc}`)\n }\n console.log()\n })\n\n // services info <name>\n services\n .command('info <name>')\n .description('Show detailed information and available operations for a service')\n .option('--format <fmt>', 'Output format: table | json | yaml', 'table')\n .action(async (name: string, opts: { format?: string }) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getOAS(name)\n } catch (err) {\n console.error(`Service not found: ${name}`)\n console.error('Run `ucli services list` to see available services.')\n process.exit(1)\n }\n\n const help = await getServiceHelp(entry)\n const format = (opts.format ?? 'table').toLowerCase()\n if (format === 'json') {\n // Strip authConfig secrets from JSON output\n const { authConfig, ...rest } = entry\n const safe = {\n ...rest,\n authConfig: { type: (authConfig as Record<string, unknown>)['type'] ?? rest.authType },\n operationsHelp: help,\n }\n console.log(JSON.stringify(safe, null, 2))\n return\n }\n\n console.log(`\\nService: ${entry.name}`)\n console.log(`Description: ${entry.description || '(none)'}`)\n console.log(`OAS URL: ${entry.remoteUrl}`)\n if (entry.baseEndpoint) console.log(`Base endpoint: ${entry.baseEndpoint}`)\n console.log(`Auth type: ${entry.authType}`)\n console.log(`Cache TTL: ${entry.cacheTtl}s`)\n console.log('\\nAvailable operations:')\n console.log('─'.repeat(60))\n console.log(help)\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { runOperation } from '../lib/oas-runner.js'\n\nexport function registerRun(program: Command): void {\n program\n .command('run [service] [args...]')\n .description('Execute an operation on a service')\n .option('--service <name>', 'Service name (from `services list`)')\n .option('--operation <id>', 'OperationId to execute')\n .option('--params <json>', 'JSON string of operation parameters')\n .option('--format <fmt>', 'Output format: json | table | yaml', 'json')\n .option('--query <jmespath>', 'Filter response with JMESPath expression')\n .option('--data <json>', 'Request body (JSON string or @filename)')\n .allowUnknownOption(true)\n .action(async (\n serviceArg: string | undefined,\n args: string[],\n opts: { service?: string; operation?: string; params?: string; format?: string; query?: string; data?: string; args?: string[] },\n ) => {\n if (serviceArg && opts.service && serviceArg !== opts.service) {\n console.error(`Conflicting service values: positional \"${serviceArg}\" and --service \"${opts.service}\". Use either the positional argument or --service flag, not both.`)\n process.exit(1)\n }\n\n const service = opts.service ?? serviceArg\n if (!service) {\n console.error('Missing service name. Use positional <service> or --service <name>.')\n process.exit(1)\n }\n\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getOAS(service)\n } catch {\n console.error(`Unknown service: ${service}`)\n console.error('Run `ucli services list` to see available services.')\n process.exit(1)\n }\n\n // Collect extra args (pass-through to openapi2cli)\n const extraArgs = opts.args ?? []\n const operationArgs = [...args, ...extraArgs]\n\n if (opts.operation) {\n operationArgs.unshift(opts.operation)\n }\n\n if (opts.params) {\n let parsed: unknown\n try {\n parsed = JSON.parse(opts.params)\n } catch {\n console.error('Invalid --params JSON. Example: --params \\'{\"petId\": 1}\\'')\n process.exit(1)\n }\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n for (const [k, v] of Object.entries(parsed as Record<string, unknown>)) {\n if (v === undefined || v === null) continue\n const strVal = typeof v === 'object' ? JSON.stringify(v) : String(v)\n operationArgs.push(`--${k}`, strVal)\n }\n }\n }\n\n if (opts.data) {\n operationArgs.push('--data', opts.data)\n }\n\n const format = opts.format as 'json' | 'table' | 'yaml' | undefined\n const query = opts.query as string | undefined\n\n try {\n await runOperation({\n entry,\n operationArgs,\n ...(format !== undefined ? { format } : {}),\n ...(query !== undefined ? { query } : {}),\n })\n } catch (err) {\n console.error('Operation failed:', (err as Error).message)\n process.exit(1)\n }\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { writeOASListCache, clearOASListCache, clearOASCache } from '../lib/cache.js'\n\nexport function registerRefresh(program: Command): void {\n program\n .command('refresh')\n .description('Force-refresh the local OAS cache from the server')\n .option('--service <name>', 'Refresh only a specific service')\n .action(async (opts: { service?: string }) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n console.log('Refreshing OAS list from server...')\n if (opts.service) {\n await clearOASCache(opts.service)\n } else {\n await clearOASListCache()\n }\n\n const entries = await client.listOAS()\n if (entries.length > 0) {\n const maxTtl = Math.min(...entries.map((e) => e.cacheTtl))\n await writeOASListCache(entries, maxTtl)\n }\n\n console.log(`✓ Refreshed ${entries.length} service(s).`)\n })\n}\n","import type { Command } from 'commander'\nimport { getConfig, isConfigured } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { readOASListCache, writeOASListCache } from '../lib/cache.js'\nimport { getServiceHelp } from '../lib/oas-runner.js'\n\nexport function registerHelp(program: Command): void {\n program\n .command('help [service]')\n .description('Show usage guide. Pass a service name for service-specific operations.')\n .action(async (service?: string) => {\n if (!service) {\n printGeneralHelp()\n if (isConfigured()) {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n let entries = await readOASListCache()\n if (!entries) {\n entries = await client.listOAS()\n if (entries.length > 0) {\n const maxTtl = Math.min(...entries.map((e) => e.cacheTtl))\n await writeOASListCache(entries, maxTtl)\n }\n }\n if (entries.length > 0) {\n console.log('\\nAvailable services:')\n for (const e of entries) {\n console.log(` ${e.name.padEnd(20)} ${e.description}`)\n }\n console.log('\\nTip: Run `ucli help <service>` for service-specific operations.')\n }\n } else {\n console.log('\\nRun `ucli configure --server <url> --token <jwt>` to get started.')\n }\n return\n }\n\n // Service-specific help\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getOAS(service)\n } catch {\n console.error(`Unknown service: ${service}`)\n console.error('Run `ucli services list` to see available services.')\n process.exit(1)\n }\n\n console.log(`\\n=== ${entry.name} ===`)\n console.log(`${entry.description}`)\n console.log(`\\nOAS spec: ${entry.remoteUrl}`)\n console.log('\\nOperations:')\n console.log('─'.repeat(60))\n\n const help = await getServiceHelp(entry)\n console.log(help)\n\n console.log('\\nExamples:')\n console.log(` ucli run ${entry.name} <operation>`)\n console.log(` ucli run ${entry.name} <operation> --format table`)\n console.log(` ucli run ${entry.name} <operation> --query \"results[*].id\"`)\n console.log(` ucli run ${entry.name} <operation> --data '{\"key\":\"value\"}'`)\n })\n}\n\nfunction printGeneralHelp(): void {\n console.log(`\nucli — OpenAPI & MCP Gateway for AI Agents\n════════════════════════════════════════\n\nSETUP\n ucli configure --server <url> --token <jwt>\n Configure server connection and authentication.\n\nDISCOVERY\n ucli services list\n List all OAS services available in your group.\n\n ucli services info <service>\n Show detailed service info and all available operations.\n\n ucli help [service]\n Show this guide, or service-specific operations.\n\nEXECUTION\n ucli run <service> <operation> [options]\n Execute a service operation.\n\n Options:\n --format json|table|yaml Output format (default: json)\n --query <jmespath> Filter response with JMESPath\n --data <json|@file> Request body for POST/PUT/PATCH\n\nMAINTENANCE\n ucli refresh\n Force-refresh the local OAS cache from the server.\n\nERRORS\n 401 Unauthorized → Run: ucli configure --server <url> --token <jwt>\n 404 Not Found → Check service name: ucli services list\n 4xx Client Error → Check operation args: ucli services info <service>\n 5xx Server Error → Retry or run: ucli refresh\n`)\n}\n","/**\n * MCP tool runner using @tronsfey/mcp2cli programmatic API.\n *\n * Auth credentials are injected via McpServerConfig (headers or env) —\n * never passed as CLI arguments (which would be visible in `ps`).\n */\nimport type { McpEntryPublic } from './server-client.js'\n\n/**\n * Resolve a named export from a module that may be CJS-wrapped (exports live\n * under `module.default`) or a plain ESM module (named exports at top level).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction resolve(mod: any, name: string): unknown {\n if (typeof mod[name] === 'function') return mod[name]\n if (mod.default && typeof mod.default[name] === 'function') return mod.default[name]\n throw new Error(`Cannot resolve export \"${name}\" from module`)\n}\n\nasync function getMcp2cli() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const clientMod = await import('@tronsfey/mcp2cli/dist/client/index.js') as any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const runnerMod = await import('@tronsfey/mcp2cli/dist/runner/index.js') as any\n return {\n createMcpClient: resolve(clientMod, 'createMcpClient') as (...args: unknown[]) => Promise<unknown>,\n getTools: resolve(runnerMod, 'getTools') as (...args: unknown[]) => Promise<{ name: string; description?: string }[]>,\n runTool: resolve(runnerMod, 'runTool') as (...args: unknown[]) => Promise<void>,\n }\n}\n\nasync function closeClient(client: unknown): Promise<void> {\n if (typeof (client as { close?: unknown }).close === 'function') {\n await (client as { close: () => Promise<void> }).close()\n }\n}\n\nfunction buildMcpConfig(entry: McpEntryPublic): Record<string, unknown> {\n const base: Record<string, unknown> = { type: entry.transport }\n if (entry.transport === 'http') {\n base.url = entry.serverUrl\n } else {\n base.command = entry.command\n }\n const auth = entry.authConfig\n if (auth.type === 'http_headers') {\n base.headers = auth.headers\n } else if (auth.type === 'env') {\n base.env = auth.env\n }\n return base\n}\n\nexport async function listMcpTools(entry: McpEntryPublic): Promise<{ name: string; description?: string }[]> {\n const { createMcpClient, getTools } = await getMcp2cli()\n const config = buildMcpConfig(entry)\n const client = await createMcpClient(config)\n try {\n const tools = await getTools(client, config, { noCache: true })\n return tools\n } finally {\n await closeClient(client)\n }\n}\n\nexport async function runMcpTool(entry: McpEntryPublic, toolName: string, rawArgs: string[]): Promise<void> {\n const { createMcpClient, getTools, runTool } = await getMcp2cli()\n const config = buildMcpConfig(entry)\n const client = await createMcpClient(config)\n try {\n const tools = await getTools(client, config, { noCache: false, cacheTtl: 3600 })\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tool = tools.find((t: any) => t.name === toolName)\n if (!tool) throw new Error(`Tool \"${toolName}\" not found on MCP server \"${entry.name}\"`)\n const normalizedArgs: string[] = []\n for (const arg of rawArgs) {\n if (arg.includes('=') && !arg.startsWith('--')) {\n const idx = arg.indexOf('=')\n const key = arg.slice(0, idx)\n const value = arg.slice(idx + 1)\n normalizedArgs.push(`--${key}`, value)\n } else {\n normalizedArgs.push(arg)\n }\n }\n await runTool(client, tool, normalizedArgs, {})\n } finally {\n await closeClient(client)\n }\n}\n","import type { Command } from 'commander'\nimport { getConfig } from '../config.js'\nimport { ServerClient } from '../lib/server-client.js'\nimport { listMcpTools, runMcpTool } from '../lib/mcp-runner.js'\n\nexport function registerMcp(program: Command): void {\n const mcp = program\n .command('mcp')\n .description('Interact with MCP servers registered in your group')\n\n // mcp list\n mcp\n .command('list')\n .description('List all MCP servers available in the current group')\n .option('--format <fmt>', 'Output format: table | json | yaml', 'table')\n .action(async (opts: { format?: string }) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n const entries = await client.listMCP()\n\n if (entries.length === 0) {\n console.log('No MCP servers registered in this group.')\n return\n }\n\n const format = (opts.format ?? 'table').toLowerCase()\n if (format === 'json') {\n // Strip authConfig secrets from JSON output — only expose { type }\n const safe = entries.map(({ authConfig, ...rest }) => ({\n ...rest,\n authConfig: { type: authConfig.type },\n }))\n console.log(JSON.stringify(safe, null, 2))\n return\n }\n\n const nameWidth = Math.max(10, ...entries.map(e => e.name.length))\n console.log(`\\n${'SERVER'.padEnd(nameWidth)} TRANSPORT DESCRIPTION`)\n console.log(`${'-'.repeat(nameWidth)} --------- ${'-'.repeat(40)}`)\n for (const e of entries) {\n const desc = e.description.length > 60 ? e.description.slice(0, 57) + '...' : e.description\n console.log(`${e.name.padEnd(nameWidth)} ${e.transport.padEnd(9)} ${desc}`)\n }\n console.log()\n })\n\n // mcp tools <server>\n mcp\n .command('tools <server>')\n .description('List tools available on a MCP server')\n .option('--format <fmt>', 'Output format: table | json', 'table')\n .action(async (serverName: string, opts: { format?: string }) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getMCP(serverName)\n } catch {\n console.error(`Unknown MCP server: ${serverName}`)\n console.error('Run `ucli mcp list` to see available servers.')\n process.exit(1)\n }\n\n let tools\n try {\n tools = await listMcpTools(entry)\n } catch (err) {\n console.error('Failed to fetch tools:', (err as Error).message)\n process.exit(1)\n }\n\n if (tools.length === 0) {\n console.log(`No tools found on MCP server \"${serverName}\".`)\n return\n }\n\n const format = (opts.format ?? 'table').toLowerCase()\n if (format === 'json') {\n console.log(JSON.stringify(tools, null, 2))\n return\n }\n\n console.log(`\\nTools on \"${serverName}\":`)\n console.log('─'.repeat(60))\n for (const t of tools) {\n console.log(` ${t.name}`)\n if (t.description) console.log(` ${t.description}`)\n }\n console.log()\n })\n\n // mcp run <server> <tool> [args...]\n mcp\n .command('run <server> <tool> [args...]')\n .description('Call a tool on a MCP server')\n .action(async (serverName: string, toolName: string, args: string[]) => {\n const cfg = getConfig()\n const client = new ServerClient(cfg)\n\n let entry\n try {\n entry = await client.getMCP(serverName)\n } catch {\n console.error(`Unknown MCP server: ${serverName}`)\n console.error('Run `ucli mcp list` to see available servers.')\n process.exit(1)\n }\n\n try {\n await runMcpTool(entry, toolName, args)\n } catch (err) {\n console.error('Tool execution failed:', (err as Error).message)\n process.exit(1)\n }\n })\n}\n"],"mappings":";;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,iBAAAA,sBAAqB;;;ACD9B,OAAO,UAAU;AACjB,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AAC9B,SAAS,WAAW,iBAAiB;;;ACOrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,gBAAgB;AAEnC,IAAM,aAAa;AACnB,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,oBAAoB;AAG1B,SAAS,UAAU,MAAsB;AACvC,MAAI,OAAO;AACX,MAAI;AACF,WAAO,SAAS,EAAE;AAAA,EACpB,QAAQ;AAAA,EAER;AACA,QAAM,WAAW,QAAQ,IAAI,IAAI,SAAS,CAAC;AAC3C,SAAO,WAAW,UAAU,MAAM,mBAAmB,IAAI,QAAQ;AACnE;AAGO,SAAS,aAAa,WA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iBAAiB,OAAO;AACxB,YAAY,OAAO;AACnB,gBAAgB,OAAO;AACvB,YAAY,OAAO;AACnB,aAAa,OAAO;AAEpB,QAAQ,MAAM,QAAQ,IAAI;","names":["createRequire","program","join","join","join","dirname","require","pkg","resolve","program","program","program","program","cfg","client","program","require","createRequire"]}
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "module";
3
+ const require = __createRequire(import.meta.url);
2
4
  import {
3
5
  __commonJS,
4
6
  __require
5
- } from "./chunk-NNFC34A5.js";
7
+ } from "./chunk-FJU3QOHW.js";
6
8
 
7
9
  // ../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js
8
10
  var require_color_name = __commonJS({
@@ -5532,4 +5534,4 @@ Available tools (${tools.length}):
5532
5534
  }
5533
5535
  });
5534
5536
  export default require_runner();
5535
- //# sourceMappingURL=runner-VTUGJUH7.js.map
5537
+ //# sourceMappingURL=runner-GVYIJNHN.js.map