2025-11-05 13:28:38 +05:30
|
|
|
#!/usr/bin/env node
|
2025-11-15 01:51:22 +05:30
|
|
|
import yargs from 'yargs';
|
|
|
|
|
import { hideBin } from 'yargs/helpers';
|
2025-12-16 14:48:04 +05:30
|
|
|
import { app, modelConfig, importExample, listExamples, exportWorkflow } from '../dist/app.js';
|
|
|
|
|
import { runTui } from '../dist/tui/index.js';
|
2025-11-05 13:28:38 +05:30
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
yargs(hideBin(process.argv))
|
2025-11-18 20:38:14 +05:30
|
|
|
|
2025-11-15 01:51:22 +05:30
|
|
|
.command(
|
|
|
|
|
"$0",
|
|
|
|
|
"Run rowboatx",
|
|
|
|
|
(y) => y
|
2025-11-18 20:38:14 +05:30
|
|
|
.option("agent", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "The agent to run",
|
|
|
|
|
default: "copilot",
|
|
|
|
|
})
|
|
|
|
|
.option("run_id", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "Continue an existing run",
|
|
|
|
|
})
|
|
|
|
|
.option("input", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "The input to the agent",
|
|
|
|
|
})
|
|
|
|
|
.option("no-interactive", {
|
|
|
|
|
type: "boolean",
|
|
|
|
|
description: "Do not interact with the user",
|
|
|
|
|
default: false,
|
|
|
|
|
}),
|
2025-11-15 01:51:22 +05:30
|
|
|
(argv) => {
|
|
|
|
|
app({
|
|
|
|
|
agent: argv.agent,
|
|
|
|
|
runId: argv.run_id,
|
|
|
|
|
input: argv.input,
|
2025-11-16 20:58:31 +05:30
|
|
|
noInteractive: argv.noInteractive,
|
2025-11-15 01:51:22 +05:30
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
)
|
2025-12-16 14:48:04 +05:30
|
|
|
.command(
|
|
|
|
|
"ui",
|
|
|
|
|
"Launch the interactive Rowboat dashboard",
|
|
|
|
|
(y) => y
|
|
|
|
|
.option("server-url", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "Rowboat server base URL",
|
|
|
|
|
}),
|
|
|
|
|
(argv) => {
|
|
|
|
|
runTui({
|
|
|
|
|
serverUrl: argv.serverUrl,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
)
|
2025-11-25 20:00:43 +05:30
|
|
|
.command(
|
|
|
|
|
"import",
|
|
|
|
|
"Import an example workflow (--example) or custom workflow from file (--file)",
|
|
|
|
|
(y) => y
|
|
|
|
|
.option("example", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "Name of built-in example to import",
|
|
|
|
|
})
|
|
|
|
|
.option("file", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "Path to custom workflow JSON file",
|
|
|
|
|
})
|
|
|
|
|
.check((argv) => {
|
|
|
|
|
if (!argv.example && !argv.file) {
|
|
|
|
|
throw new Error("Either --example or --file must be provided");
|
|
|
|
|
}
|
|
|
|
|
if (argv.example && argv.file) {
|
|
|
|
|
throw new Error("Cannot use both --example and --file at the same time");
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}),
|
|
|
|
|
async (argv) => {
|
|
|
|
|
try {
|
|
|
|
|
if (argv.example) {
|
|
|
|
|
await importExample(String(argv.example).trim());
|
|
|
|
|
} else if (argv.file) {
|
|
|
|
|
await importExample(undefined, String(argv.file).trim());
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error:", error?.message ?? error);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.command(
|
|
|
|
|
"list-examples",
|
|
|
|
|
"List all available example workflows",
|
|
|
|
|
(y) => y,
|
|
|
|
|
async () => {
|
|
|
|
|
try {
|
|
|
|
|
const examples = await listExamples();
|
|
|
|
|
if (examples.length === 0) {
|
|
|
|
|
console.error("No packaged examples are available to list.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (const example of examples) {
|
|
|
|
|
console.log(example);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error?.message ?? error);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.command(
|
|
|
|
|
"export",
|
|
|
|
|
"Export a workflow with all dependencies (outputs to stdout)",
|
|
|
|
|
(y) => y
|
|
|
|
|
.option("agent", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "Entry agent name to export",
|
|
|
|
|
demandOption: true,
|
|
|
|
|
}),
|
|
|
|
|
async (argv) => {
|
|
|
|
|
try {
|
|
|
|
|
await exportWorkflow(String(argv.agent).trim());
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error:", error?.message ?? error);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
2025-11-20 16:41:41 +05:30
|
|
|
.command(
|
|
|
|
|
"model-config",
|
|
|
|
|
"Select model",
|
|
|
|
|
(y) => y,
|
|
|
|
|
(argv) => {
|
|
|
|
|
modelConfig();
|
|
|
|
|
}
|
|
|
|
|
)
|
2025-11-25 20:00:43 +05:30
|
|
|
.parse();
|