Skip to content

Commit a6c0bec

Browse files
tianhaocuiclaude
andcommitted
fix: resolve duplicate option registration in export and import commands
The `export` and `import` commands each registered the same required option twice (once for gemini, once for codex), causing commander to throw on startup and making the entire CLI unusable. Additionally, `case 'codex'` was placed inside the `default` branch in both switch statements, so it could never be matched correctly. Changes: - Merge duplicate `.requiredOption()` calls into a single call listing all supported formats - Move `case 'codex'` out of `default` as an independent case with its own `break` Fixes #53 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 24ed359 commit a6c0bec

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/commands/export.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ interface ExportOptions {
2525

2626
export const exportCommand = new Command('export')
2727
.description('Export agent to other formats')
28-
.requiredOption('-f, --format <format>', 'Export format (system-prompt, claude-code, openai, crewai, openclaw, nanobot, lyzr, github, copilot, opencode, cursor, gemini)')
29-
.requiredOption('-f, --format <format>', 'Export format (system-prompt, claude-code, openai, crewai, openclaw, nanobot, lyzr, github, copilot, opencode, cursor, codex)')
28+
.requiredOption('-f, --format <format>', 'Export format (system-prompt, claude-code, openai, crewai, openclaw, nanobot, lyzr, github, copilot, opencode, cursor, gemini, codex)')
3029
.option('-d, --dir <dir>', 'Agent directory', '.')
3130
.option('-o, --output <output>', 'Output file path')
3231
.action(async (options: ExportOptions) => {
@@ -75,12 +74,12 @@ export const exportCommand = new Command('export')
7574
case 'gemini':
7675
result = exportToGeminiString(dir);
7776
break;
77+
case 'codex':
78+
result = exportToCodexString(dir);
79+
break;
7880
default:
7981
error(`Unknown format: ${options.format}`);
80-
info('Supported formats: system-prompt, claude-code, openai, crewai, openclaw, nanobot, lyzr, github, copilot, opencode, cursor, gemini');
81-
case 'codex':
82-
result = exportToCodexString(dir);
83-
info('Supported formats: system-prompt, claude-code, openai, crewai, openclaw, nanobot, lyzr, github, copilot, opencode, cursor, codex');
82+
info('Supported formats: system-prompt, claude-code, openai, crewai, openclaw, nanobot, lyzr, github, copilot, opencode, cursor, gemini, codex');
8483
process.exit(1);
8584
}
8685

src/commands/import.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,7 @@ function parseSections(markdown: string): [string, string][] {
521521

522522
export const importCommand = new Command('import')
523523
.description('Import from other agent formats')
524-
.requiredOption('--from <format>', 'Source format (claude, cursor, crewai, opencode, gemini)')
525-
.requiredOption('--from <format>', 'Source format (claude, cursor, crewai, opencode, codex)')
524+
.requiredOption('--from <format>', 'Source format (claude, cursor, crewai, opencode, gemini, codex)')
526525
.argument('<path>', 'Source file or directory path')
527526
.option('-d, --dir <dir>', 'Target directory', '.')
528527
.action((sourcePath: string, options: ImportOptions) => {
@@ -549,12 +548,12 @@ export const importCommand = new Command('import')
549548
case 'gemini':
550549
importFromGemini(sourcePath, targetDir);
551550
break;
551+
case 'codex':
552+
importFromCodex(sourcePath, targetDir);
553+
break;
552554
default:
553555
error(`Unknown format: ${options.from}`);
554-
info('Supported formats: claude, cursor, crewai, opencode, gemini');
555-
case 'codex':
556-
importFromCodex(sourcePath, targetDir);
557-
info('Supported formats: claude, cursor, crewai, opencode, codex');
556+
info('Supported formats: claude, cursor, crewai, opencode, gemini, codex');
558557
process.exit(1);
559558
}
560559

0 commit comments

Comments
 (0)