Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
fix: quote the Windows OAuth authorize URL so cmd keeps query ampersands
fetw5653c25377be
diff --git a/packages/cli/src/oauth.ts b/packages/cli/src/oauth.tsindex 78b199ee..092c8e67 100644--- a/packages/cli/src/oauth.ts+++ b/packages/cli/src/oauth.ts@@ -28,6 +28,49 @@ function tokenExpiry(value: { readonly expires_at?: unknown; readonly expires_inreturn seconds === undefined ? undefined : Date.now() + seconds * 1_000;}+export type AuthorizeBrowserLaunch = {+ readonly command: string;+ readonly args: readonly string[];+ readonly windowsVerbatimArguments: boolean;+};++/**+ * Open the authorize URL in a browser. Windows `cmd /c start` treats `&` as a command+ * separator unless the URL is a later quoted token after an explicit window title.+ */+export function authorizeBrowserLaunch(+ url: string,+ options: { readonly platform?: NodeJS.Platform; readonly comSpec?: string } = {},+): AuthorizeBrowserLaunch {+ const platform = options.platform ?? process.platform;+ if (platform === "win32") {+ const quoted = `"${url.replaceAll("\"", "")}"`;+ return {+ command: options.comSpec ?? process.env.ComSpec ?? "cmd.exe",+ args: ["/d", "/s", "/c", `start "" ${quoted}`],+ windowsVerbatimArguments: true,+ };+ }+ return {+ command: platform === "darwin" ? "open" : "xdg-open",+ args: [url],+ windowsVerbatimArguments: false,+ };+}++function openAuthorizeUrl(url: string): void {+ const launch = authorizeBrowserLaunch(url);+ const child = spawn(launch.command, [...launch.args], {+ stdio: "ignore",+ detached: true,+ windowsHide: true,+ windowsVerbatimArguments: launch.windowsVerbatimArguments,+ });+ // A missing opener must not crash the CLI; the URL is already on the progress line.+ child.once("error", () => undefined);+ child.unref();+}+/** Acquire one OAuth credential from the exact data declared by its Endpoint package. */export async function acquireOAuthCredential(acquisition: CredentialAcquisition,@@ -102,13 +145,8 @@ export async function acquireOAuthCredential(authorize.searchParams.set("code_challenge", challenge);authorize.searchParams.set("code_challenge_method", "S256");options.onProgress?.(`Opening sign-in: ${authorize}`);- if (options.open === undefined) {- const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";- const openerArgs = process.platform === "win32" ? ["/c", "start", "", authorize.toString()] : [authorize.toString()];- spawn(opener, openerArgs, { stdio: "ignore", detached: true, windowsHide: true }).unref();- } else {- options.open(authorize.toString());- }+ if (options.open === undefined) openAuthorizeUrl(authorize.toString());+ else options.open(authorize.toString());const code = await callback;options.onProgress?.("Authorization returned. Exchanging token…");const deadline = AbortSignal.timeout(acquisition.requestTimeoutMs);diff --git a/packages/cli/test/oauth.test.ts b/packages/cli/test/oauth.test.tsindex f9539109..a9452126 100644--- a/packages/cli/test/oauth.test.ts+++ b/packages/cli/test/oauth.test.ts@@ -5,7 +5,7 @@ import test from "node:test";import { decodeOAuth2Credential } from "@hypit/runtime";-import { acquireOAuthCredential } from "../src/oauth.js";+import { acquireOAuthCredential, authorizeBrowserLaunch } from "../src/oauth.js";const acquisition = {kind: "oauth2-pkce" as const,@@ -74,6 +74,19 @@ test("OAuth callback releases another browser connection after sending its page"}});+test("Windows authorize launch quotes the URL so cmd does not split on query ampersands", () => {+ const url = "https://identity.example.test/authorize?response_type=code&client_id=client&redirect_uri=http://127.0.0.1:9/callback";+ const launch = authorizeBrowserLaunch(url, {+ platform: "win32",+ comSpec: "C:\\Windows\\System32\\cmd.exe",+ });+ assert.equal(launch.command, "C:\\Windows\\System32\\cmd.exe");+ assert.equal(launch.windowsVerbatimArguments, true);+ assert.deepEqual(launch.args, ["/d", "/s", "/c", `start "" "${url}"`]);+ assert.equal(authorizeBrowserLaunch(url, { platform: "darwin" }).command, "open");+ assert.deepEqual(authorizeBrowserLaunch(url, { platform: "linux" }).args, [url]);+});+test("OAuth token exchange uses the Endpoint-declared request timeout", async () => {await assert.rejects(async () => await acquireOAuthCredential({ ...acquisition, requestTimeoutMs: 20 }, {