mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 07:01:30 +00:00
Merge pull request #1285 from ferologics/exit-early
fix(coding-agent): exit early for help/version/export/list-models (fixes #1277)
This commit is contained in:
commit
6c741cbd46
2 changed files with 8 additions and 6 deletions
|
|
@ -579,18 +579,18 @@ export async function main(args: string[]) {
|
|||
|
||||
if (parsed.version) {
|
||||
console.log(VERSION);
|
||||
return;
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (parsed.help) {
|
||||
printHelp();
|
||||
return;
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (parsed.listModels !== undefined) {
|
||||
const searchPattern = typeof parsed.listModels === "string" ? parsed.listModels : undefined;
|
||||
await listModels(modelRegistry, searchPattern);
|
||||
return;
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Read piped stdin content (if any) - skip for RPC mode which uses stdin for JSON-RPC
|
||||
|
|
@ -605,16 +605,17 @@ export async function main(args: string[]) {
|
|||
}
|
||||
|
||||
if (parsed.export) {
|
||||
let result: string;
|
||||
try {
|
||||
const outputPath = parsed.messages.length > 0 ? parsed.messages[0] : undefined;
|
||||
const result = await exportFromFile(parsed.export, outputPath);
|
||||
console.log(`Exported to: ${result}`);
|
||||
return;
|
||||
result = await exportFromFile(parsed.export, outputPath);
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof Error ? error.message : "Failed to export session";
|
||||
console.error(chalk.red(`Error: ${message}`));
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Exported to: ${result}`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (parsed.mode === "rpc" && parsed.fileArgs.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue