2026-02-21 05:18:57 +00:00
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
import { createProgram } from '../../src/index.js';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* End-to-end tests that verify CLI command registration and help output
|
|
|
|
|
* without requiring a running daemon.
|
|
|
|
|
*/
|
|
|
|
|
describe('CLI command registration (e2e)', () => {
|
|
|
|
|
it('program has all expected commands', () => {
|
|
|
|
|
const program = createProgram();
|
|
|
|
|
const commandNames = program.commands.map((c) => c.name());
|
|
|
|
|
|
|
|
|
|
expect(commandNames).toContain('config');
|
|
|
|
|
expect(commandNames).toContain('status');
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
expect(commandNames).toContain('login');
|
|
|
|
|
expect(commandNames).toContain('logout');
|
2026-02-21 05:18:57 +00:00
|
|
|
expect(commandNames).toContain('get');
|
|
|
|
|
expect(commandNames).toContain('describe');
|
|
|
|
|
expect(commandNames).toContain('instance');
|
|
|
|
|
expect(commandNames).toContain('apply');
|
|
|
|
|
expect(commandNames).toContain('setup');
|
|
|
|
|
expect(commandNames).toContain('claude');
|
|
|
|
|
expect(commandNames).toContain('project');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('instance command has lifecycle subcommands', () => {
|
|
|
|
|
const program = createProgram();
|
|
|
|
|
const instance = program.commands.find((c) => c.name() === 'instance');
|
|
|
|
|
expect(instance).toBeDefined();
|
|
|
|
|
|
|
|
|
|
const subcommands = instance!.commands.map((c) => c.name());
|
|
|
|
|
expect(subcommands).toContain('list');
|
|
|
|
|
expect(subcommands).toContain('start');
|
|
|
|
|
expect(subcommands).toContain('stop');
|
|
|
|
|
expect(subcommands).toContain('restart');
|
|
|
|
|
expect(subcommands).toContain('remove');
|
|
|
|
|
expect(subcommands).toContain('logs');
|
|
|
|
|
expect(subcommands).toContain('inspect');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('claude command has config management subcommands', () => {
|
|
|
|
|
const program = createProgram();
|
|
|
|
|
const claude = program.commands.find((c) => c.name() === 'claude');
|
|
|
|
|
expect(claude).toBeDefined();
|
|
|
|
|
|
|
|
|
|
const subcommands = claude!.commands.map((c) => c.name());
|
|
|
|
|
expect(subcommands).toContain('generate');
|
|
|
|
|
expect(subcommands).toContain('show');
|
|
|
|
|
expect(subcommands).toContain('add');
|
|
|
|
|
expect(subcommands).toContain('remove');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('project command has CRUD subcommands', () => {
|
|
|
|
|
const program = createProgram();
|
|
|
|
|
const project = program.commands.find((c) => c.name() === 'project');
|
|
|
|
|
expect(project).toBeDefined();
|
|
|
|
|
|
|
|
|
|
const subcommands = project!.commands.map((c) => c.name());
|
|
|
|
|
expect(subcommands).toContain('list');
|
|
|
|
|
expect(subcommands).toContain('create');
|
|
|
|
|
expect(subcommands).toContain('delete');
|
|
|
|
|
expect(subcommands).toContain('show');
|
|
|
|
|
expect(subcommands).toContain('profiles');
|
|
|
|
|
expect(subcommands).toContain('set-profiles');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('displays version', () => {
|
|
|
|
|
const program = createProgram();
|
|
|
|
|
expect(program.version()).toBeDefined();
|
|
|
|
|
expect(program.version()).toMatch(/^\d+\.\d+\.\d+$/);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('displays help without error', () => {
|
|
|
|
|
const program = createProgram();
|
|
|
|
|
const helpText = program.helpInformation();
|
|
|
|
|
expect(helpText).toContain('mcpctl');
|
|
|
|
|
expect(helpText).toContain('Manage MCP servers');
|
|
|
|
|
});
|
|
|
|
|
});
|