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:
38
src/cli/tests/cli.test.ts
Normal file
38
src/cli/tests/cli.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { createProgram } from '../src/index.js';
|
||||
|
||||
describe('createProgram', () => {
|
||||
it('creates a Commander program', () => {
|
||||
const program = createProgram();
|
||||
expect(program.name()).toBe('mcpctl');
|
||||
});
|
||||
|
||||
it('has version flag', () => {
|
||||
const program = createProgram();
|
||||
expect(program.version()).toBe('0.1.0');
|
||||
});
|
||||
|
||||
it('has config subcommand', () => {
|
||||
const program = createProgram();
|
||||
const config = program.commands.find((c) => c.name() === 'config');
|
||||
expect(config).toBeDefined();
|
||||
});
|
||||
|
||||
it('has status subcommand', () => {
|
||||
const program = createProgram();
|
||||
const status = program.commands.find((c) => c.name() === 'status');
|
||||
expect(status).toBeDefined();
|
||||
});
|
||||
|
||||
it('has output option', () => {
|
||||
const program = createProgram();
|
||||
const opt = program.options.find((o) => o.long === '--output');
|
||||
expect(opt).toBeDefined();
|
||||
});
|
||||
|
||||
it('has daemon-url option', () => {
|
||||
const program = createProgram();
|
||||
const opt = program.options.find((o) => o.long === '--daemon-url');
|
||||
expect(opt).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user