Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/mcp-server/src/cli/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,27 @@ describe('cli', () => {
expect(result.options.uninstallYes).toBe(true);
});

it('should parse create-plugin command with name', () => {
const result = parseArgs(['create-plugin', 'my-plugin']);

expect(result.command).toBe('create-plugin');
expect(result.options.createPluginName).toBe('my-plugin');
});

it('should parse create-plugin command with --template flag', () => {
const result = parseArgs(['create-plugin', 'my-plugin', '--template', 'full']);

expect(result.command).toBe('create-plugin');
expect(result.options.createPluginName).toBe('my-plugin');
expect(result.options.createPluginTemplate).toBe('full');
});

it('should parse create-plugin without template as undefined', () => {
const result = parseArgs(['create-plugin', 'my-plugin']);

expect(result.options.createPluginTemplate).toBeUndefined();
});

it('should parse init with --yes flag', () => {
const result = parseArgs(['init', '--yes']);

Expand Down
40 changes: 40 additions & 0 deletions apps/mcp-server/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
UninstallOptions,
SearchOptions,
UpdateOptions,
CreatePluginOptions,
} from './cli.types';
import type { CompletionOptions } from './completion';

Expand All @@ -29,6 +30,7 @@ export interface ParsedArgs {
| 'uninstall'
| 'search'
| 'update'
| 'create-plugin'
| 'mcp'
| 'tui'
| 'completion'
Expand All @@ -40,6 +42,7 @@ export interface ParsedArgs {
Partial<UninstallOptions> &
Partial<SearchOptions> &
Partial<UpdateOptions> &
Partial<CreatePluginOptions> &
Partial<CompletionOptions>;
}

Expand Down Expand Up @@ -112,6 +115,19 @@ export function parseArgs(args: string[]): ParsedArgs {
};
}

if (command === 'create-plugin') {
const createPluginName = args[1];
let createPluginTemplate: string | undefined;
const templateIdx = args.indexOf('--template');
if (templateIdx !== -1) {
createPluginTemplate = args[templateIdx + 1];
}
return {
command: 'create-plugin',
options: { ...options, createPluginName, createPluginTemplate },
};
}

if (command === 'completion') {
const shell = args[1];
return {
Expand Down Expand Up @@ -160,6 +176,7 @@ Usage:
codingbuddy mcp Start MCP server (stdio mode)
codingbuddy tui Monitor agent execution in real-time
codingbuddy tui --restart Restart TUI client (fixes blank screen)
codingbuddy create-plugin <name> Scaffold a new plugin project
codingbuddy completion <shell> Generate shell completions (bash, zsh, fish)
codingbuddy --help Show this help
codingbuddy --version Show version
Expand All @@ -180,6 +197,8 @@ Examples:
codingbuddy update my-plugin Update a specific plugin
codingbuddy uninstall my-plugin Remove a plugin
codingbuddy uninstall my-plugin -y Remove without confirmation
codingbuddy create-plugin my-plugin Scaffold minimal plugin
codingbuddy create-plugin my-plugin --template full Scaffold with examples
codingbuddy mcp Start MCP server for AI assistants

Note:
Expand Down Expand Up @@ -324,6 +343,27 @@ export async function main(args: string[] = process.argv.slice(2)): Promise<void
break;
}

case 'create-plugin': {
const { runCreatePlugin } = await import('./plugin/create-plugin.command');
if (!options.createPluginName) {
process.stderr.write(
'Error: Missing plugin name. Usage: codingbuddy create-plugin <name> [--template minimal|full]\n',
);
process.exitCode = 1;
break;
}
const template = options.createPluginTemplate === 'full' ? 'full' : 'minimal';
const createResult = await runCreatePlugin({
name: options.createPluginName,
outputDir: process.cwd(),
template,
});
if (!createResult.success) {
process.exitCode = 1;
}
break;
}

case 'completion': {
const { runCompletion } = await import('./completion');
if (!options.shell) {
Expand Down
10 changes: 10 additions & 0 deletions apps/mcp-server/src/cli/cli.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ export interface UpdateOptions {
updatePluginName?: string;
}

/**
* Create-plugin command options (parsed from CLI args)
*/
export interface CreatePluginOptions {
/** Plugin name */
createPluginName?: string;
/** Template type: minimal or full */
createPluginTemplate?: string;
}

/**
* Console output levels
*/
Expand Down
Loading
Loading