Skip to content
Open
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
27 changes: 27 additions & 0 deletions apps/orchestrator/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5784,6 +5784,29 @@ async function runInstanceCommand(args: ParsedArgs) {
}
}

async function runTemplateCommand(args: ParsedArgs) {
const outputJson = readBool(args.flags, "json", false);
const subcommand = args.positionals[1];
const { openworkUrl, token } = readOpenworkClientAuth(args);
const baseUrl = openworkUrl.replace(/\/$/, "");
const headers: Record<string, string> = {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
};

try {
if (subcommand === "list") {
const result = await fetchJson(`${baseUrl}/v1/templates`, { headers });
outputResult({ ok: true, ...result }, outputJson);
return;
}
throw new Error("template requires list");
} catch (error) {
outputError(error, outputJson);
process.exitCode = 1;
}
}

async function runRouterDaemon(args: ParsedArgs) {
const outputJson = readBool(args.flags, "json", false);
const verbose = readBool(args.flags, "verbose", false, "OPENWORK_VERBOSE");
Expand Down Expand Up @@ -8628,6 +8651,10 @@ async function main() {
await runInstanceCommand(args);
return;
}
if (command === "template" || command === "templates") {
await runTemplateCommand(args);
return;
}
if (command === "approvals") {
await runApprovals(args);
return;
Expand Down