feat: build CLI core framework with Commander.js

Add CLI entry point with Commander.js, config management (~/.mcpctl/config.json
with Zod validation), output formatters (table/json/yaml), config and status
commands with dependency injection for testing. Fix sanitizeString regex ordering.
67 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-02-21 04:17:31 +00:00
parent dc45f5981b
commit 247b4967e5
20 changed files with 808 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
import { z } from 'zod';
export const McpctlConfigSchema = z.object({
/** mcpd daemon endpoint */
daemonUrl: z.string().default('http://localhost:3000'),
/** Active registries for search */
registries: z.array(z.enum(['official', 'glama', 'smithery'])).default(['official', 'glama', 'smithery']),
/** Cache TTL in milliseconds */
cacheTTLMs: z.number().int().positive().default(3_600_000),
/** HTTP proxy URL */
httpProxy: z.string().optional(),
/** HTTPS proxy URL */
httpsProxy: z.string().optional(),
/** Default output format */
outputFormat: z.enum(['table', 'json', 'yaml']).default('table'),
/** Smithery API key */
smitheryApiKey: z.string().optional(),
});
export type McpctlConfig = z.infer<typeof McpctlConfigSchema>;
export const DEFAULT_CONFIG: McpctlConfig = McpctlConfigSchema.parse({});