fix yargs

This commit is contained in:
Ramnique Singh 2025-11-21 11:43:59 +05:30
parent 97e47faca8
commit 014c8a56f5

View file

@ -11,7 +11,8 @@ yargs(hideBin(process.argv))
(y) => y (y) => y
.option("agent", { .option("agent", {
type: "string", type: "string",
description: "The agent to run (defaults to copilot)", description: "The agent to run",
default: "copilot",
}) })
.option("run_id", { .option("run_id", {
type: "string", type: "string",
@ -26,10 +27,9 @@ yargs(hideBin(process.argv))
description: "Do not interact with the user", description: "Do not interact with the user",
default: false, default: false,
}), }),
async (argv) => { (argv) => {
let agent = argv.agent ?? "copilot"; app({
await app({ agent: argv.agent,
agent,
runId: argv.run_id, runId: argv.run_id,
input: argv.input, input: argv.input,
noInteractive: argv.noInteractive, noInteractive: argv.noInteractive,
@ -47,23 +47,23 @@ yargs(hideBin(process.argv))
const exampleName = String(argv.example).trim(); const exampleName = String(argv.example).trim();
try { try {
const imported = await importExample(exampleName); const imported = await importExample(exampleName);
// Build output message // Build output message
const output = [ const output = [
`✓ Imported example '${exampleName}'`, `✓ Imported example '${exampleName}'`,
` Agents: ${imported.importedAgents.join(", ")}`, ` Agents: ${imported.importedAgents.join(", ")}`,
` Primary: ${imported.entryAgent}`, ` Primary: ${imported.entryAgent}`,
]; ];
if (imported.addedServers.length > 0) { if (imported.addedServers.length > 0) {
output.push(` MCP servers added: ${imported.addedServers.join(", ")}`); output.push(` MCP servers added: ${imported.addedServers.join(", ")}`);
} }
if (imported.skippedServers.length > 0) { if (imported.skippedServers.length > 0) {
output.push(` MCP servers skipped (already configured): ${imported.skippedServers.join(", ")}`); output.push(` MCP servers skipped (already configured): ${imported.skippedServers.join(", ")}`);
} }
console.log(output.join("\n")); console.log(output.join("\n"));
if (imported.postInstallInstructions) { if (imported.postInstallInstructions) {
console.log("\n" + "=".repeat(60)); console.log("\n" + "=".repeat(60));
console.log("POST-INSTALL INSTRUCTIONS"); console.log("POST-INSTALL INSTRUCTIONS");
@ -71,7 +71,7 @@ yargs(hideBin(process.argv))
console.log(imported.postInstallInstructions); console.log(imported.postInstallInstructions);
console.log("=".repeat(60) + "\n"); console.log("=".repeat(60) + "\n");
} }
console.log(`\nRun: rowboatx --agent ${imported.entryAgent}`); console.log(`\nRun: rowboatx --agent ${imported.entryAgent}`);
} catch (error) { } catch (error) {
console.error("Error:", error?.message ?? error); console.error("Error:", error?.message ?? error);