An open-source, faster Devin alternative
TypeScript
cli: --refresh flag on template deploy (#830)
devin-ai-integration[bot]f950f8efdc88
diff --git a/cli/src/api.ts b/cli/src/api.tsindex 1e76c614..f6f31b86 100644--- a/cli/src/api.ts+++ b/cli/src/api.ts@@ -676,15 +676,25 @@ export class OpenComputerClient {);}- async inspectTemplate(repositoryUrl: string): Promise<TemplateInspection> {+ async inspectTemplate(+ repositoryUrl: string,+ options?: { refresh?: boolean },+ ): Promise<TemplateInspection> {const deadline = Date.now() + 10 * 60_000;+ // `refresh` goes on the first request only: sending it while polling would+ // restart the rebuild the flag kicked off.+ let first = true;for (;;) {const result = await this.request<TemplateInspection | TemplateInspectionPreparing>("/api/managed-agents/template-inspections", {method: "POST",- body: JSON.stringify({ repositoryUrl }),+ body: JSON.stringify({+ repositoryUrl,+ ...(first && options?.refresh ? { refresh: true } : {}),+ }),});+ first = false;if ((result as TemplateInspectionPreparing).status !== "preparing") {return result as TemplateInspection;}diff --git a/cli/src/commands.ts b/cli/src/commands.tsindex ee086553..186e0b33 100644--- a/cli/src/commands.ts+++ b/cli/src/commands.ts@@ -1000,6 +1000,7 @@ export async function runCommand(const projectNameOption = option(args, "--project-name");const directoryOption = option(args, "--directory");const confirmed = flag(args, "--yes");+ const refresh = flag(args, "--refresh");const repositoryUrl = args.shift();if (!repositoryUrl) {throw new Error("A GitHub repository URL is required");@@ -1007,6 +1008,7 @@ export async function runCommand(if (args.length) throw new Error(`Unexpected argument: ${args[0]}`);const inspection = await client.inspectTemplate(normalizeTemplateRepositoryUrl(repositoryUrl),+ { refresh },);if (!globals.json) {process.stdout.write(diff --git a/cli/src/index.ts b/cli/src/index.tsindex 93495dfb..3de6c1a4 100644--- a/cli/src/index.ts+++ b/cli/src/index.ts@@ -53,7 +53,7 @@ Usage:opencomputer init <directory|.>opencomputer template validate [directory] [--repository-url <url>] [--app-url <url>]opencomputer template build [directory] [--output <path>]- opencomputer template deploy <repository-url> [--project-name <name>] [--directory <path>]+ opencomputer template deploy <repository-url> [--project-name <name>] [--directory <path>] [--refresh]opencomputer template clone <repository-url> --commit <sha> --project <id> [--directory <path>]opencomputer project clone <project-id> [--directory <path>]opencomputer link (--project <id|slug> | --create-project <name>)