From a63bd228cfad62a9ada4dc03573048bd6bb481e6 Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:01:39 +0000 Subject: [PATCH 1/7] fix: Create a usable project during login --- src/commands/auth/index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/commands/auth/index.ts b/src/commands/auth/index.ts index 9ecfb90..15b7d15 100644 --- a/src/commands/auth/index.ts +++ b/src/commands/auth/index.ts @@ -19,6 +19,18 @@ export function registerAuthCommands(program: Command): void { const config = await loadConfig(); const project = config.currentProject || "default"; await storeApiKey(project, opts.apiKey); + await updateConfig((config) => ({ + ...config, + currentProject: project, + projects: { + ...config.projects, + [project]: config.projects[project] ?? { + organizationId: "", + organizationName: "", + baseUrl: process.env["WAVE_BASE_URL"] ?? "https://wave.online", + }, + }, + })); console.log(chalk.green(`API key stored for project "${project}".`)); return; } @@ -40,6 +52,14 @@ export function registerAuthCommands(program: Command): void { await updateConfig((config) => ({ ...config, currentProject: project, + projects: { + ...config.projects, + [project]: config.projects[project] ?? { + organizationId: "", + organizationName: "", + baseUrl, + }, + }, })); console.log(chalk.green("\nAuthentication complete. You can now use the WAVE CLI.")); From da5520cfa6c51c7394beec2dc406e52ddac7eb3b Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:01:45 +0000 Subject: [PATCH 2/7] fix: Restrict authenticated API requests to the configured host --- src/commands/api/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/commands/api/index.ts b/src/commands/api/index.ts index 6278306..a396f01 100644 --- a/src/commands/api/index.ts +++ b/src/commands/api/index.ts @@ -24,9 +24,12 @@ export function registerApiCommands(program: Command): void { } const baseUrl = config.projects[project]?.baseUrl ?? "https://wave.online"; - const url = path.startsWith("http") - ? path - : `${baseUrl}${path.startsWith("/") ? path : `/${path}`}`; + const base = new URL(baseUrl); + const requested = new URL(path, `${base.origin}/`); + if (requested.protocol !== "https:" || requested.origin !== base.origin) { + throw new Error("API requests must use the configured WAVE HTTPS host"); + } + const url = requested.toString(); const headers: Record = { Authorization: `Bearer ${apiKey}`, From 3eae3c6074fe0734e7887fec7a49040174ce6499 Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:01:51 +0000 Subject: [PATCH 3/7] fix: Add ESLint as a development dependency --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9ed97cf..1350e9f 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "@types/inquirer": "^9.0.7", "@types/node": "^22.13.0", "@types/ws": "^8.5.14", + "eslint": "^9.17.0", "tsup": "^8.0.0", "typescript": "^5.9.3", "vitest": "^4.0.16" From 0bdf0ff0beca5eb07b361e8e536b21158a0bffd8 Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:02:04 +0000 Subject: [PATCH 4/7] fix: Correct SDK package references in templates --- templates/api-integration/package.json | 2 +- templates/api-integration/src/index.ts | 2 +- templates/blank/package.json | 2 +- templates/blank/src/index.ts | 2 +- templates/multi-camera/package.json | 2 +- templates/multi-camera/src/index.ts | 2 +- templates/podcast/package.json | 2 +- templates/podcast/src/index.ts | 2 +- templates/srt-contribution/package.json | 2 +- templates/srt-contribution/src/index.ts | 2 +- templates/studio-plugin/package.json | 2 +- templates/studio-plugin/src/index.ts | 2 +- templates/webhook-handler/package.json | 2 +- templates/webhook-handler/src/index.ts | 2 +- templates/webrtc-demo/package.json | 2 +- templates/webrtc-demo/src/index.ts | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/templates/api-integration/package.json b/templates/api-integration/package.json index 4c3e541..f0b058d 100644 --- a/templates/api-integration/package.json +++ b/templates/api-integration/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/api-integration/src/index.ts b/templates/api-integration/src/index.ts index b54a1bb..3dbd00d 100644 --- a/templates/api-integration/src/index.ts +++ b/templates/api-integration/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/blank/package.json b/templates/blank/package.json index 54d5320..1207de4 100644 --- a/templates/blank/package.json +++ b/templates/blank/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/blank/src/index.ts b/templates/blank/src/index.ts index d117971..ce00421 100644 --- a/templates/blank/src/index.ts +++ b/templates/blank/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/multi-camera/package.json b/templates/multi-camera/package.json index 3167bf4..3ce7add 100644 --- a/templates/multi-camera/package.json +++ b/templates/multi-camera/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/multi-camera/src/index.ts b/templates/multi-camera/src/index.ts index 18cc6ea..2c93734 100644 --- a/templates/multi-camera/src/index.ts +++ b/templates/multi-camera/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/podcast/package.json b/templates/podcast/package.json index ec247d1..7cad930 100644 --- a/templates/podcast/package.json +++ b/templates/podcast/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/podcast/src/index.ts b/templates/podcast/src/index.ts index 5278bf7..640ff2e 100644 --- a/templates/podcast/src/index.ts +++ b/templates/podcast/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/srt-contribution/package.json b/templates/srt-contribution/package.json index 59b00fd..0dcfd23 100644 --- a/templates/srt-contribution/package.json +++ b/templates/srt-contribution/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/srt-contribution/src/index.ts b/templates/srt-contribution/src/index.ts index 62dcef0..f9e3d53 100644 --- a/templates/srt-contribution/src/index.ts +++ b/templates/srt-contribution/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/studio-plugin/package.json b/templates/studio-plugin/package.json index 4524c82..00a1ae3 100644 --- a/templates/studio-plugin/package.json +++ b/templates/studio-plugin/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/studio-plugin/src/index.ts b/templates/studio-plugin/src/index.ts index 3e7448d..9f172f8 100644 --- a/templates/studio-plugin/src/index.ts +++ b/templates/studio-plugin/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/webhook-handler/package.json b/templates/webhook-handler/package.json index c2fd75d..8cb4e86 100644 --- a/templates/webhook-handler/package.json +++ b/templates/webhook-handler/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0", + "@wave-av/sdk": "^2.0.0", "express": "^4.21.0" }, "devDependencies": { diff --git a/templates/webhook-handler/src/index.ts b/templates/webhook-handler/src/index.ts index c59b68c..8d0ffc4 100644 --- a/templates/webhook-handler/src/index.ts +++ b/templates/webhook-handler/src/index.ts @@ -1,5 +1,5 @@ import express from "express"; -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, diff --git a/templates/webrtc-demo/package.json b/templates/webrtc-demo/package.json index 07192dc..dfdecf7 100644 --- a/templates/webrtc-demo/package.json +++ b/templates/webrtc-demo/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@wave/sdk": "^2.0.0" + "@wave-av/sdk": "^2.0.0" }, "devDependencies": { "tsx": "^4.0.0", diff --git a/templates/webrtc-demo/src/index.ts b/templates/webrtc-demo/src/index.ts index 681fb51..61a4623 100644 --- a/templates/webrtc-demo/src/index.ts +++ b/templates/webrtc-demo/src/index.ts @@ -1,4 +1,4 @@ -import { Wave } from "@wave/sdk"; +import { Wave } from "@wave-av/sdk"; const wave = new Wave({ apiKey: process.env.WAVE_API_KEY!, From 382adee7799528e540ecef4d3644b2bf98e53f89 Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:02:10 +0000 Subject: [PATCH 5/7] fix: Add the missing shared types module --- src/types/index.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/types/index.ts diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..d714bc7 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,30 @@ +export interface DeviceAuthResponse { + device_code: string; + user_code: string; + verification_uri: string; + verification_uri_complete?: string; + expires_in: number; + interval: number; +} + +export interface TokenResponse { + access_token: string; + token_type?: string; + expires_in?: number; + refresh_token?: string; +} + +export interface WaveConfig { + version: string; + currentProject: string; + projects: Record; + defaults: { outputFormat: OutputFormat; protocol?: string; color: "auto" | "on" | "off" }; + telemetry: { enabled: boolean; errorReporting: boolean }; +} + +export type OutputFormat = "table" | "json" | "yaml"; From c04931d21b9cf86c2d6a4bda643d293e04452d96 Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:02:18 +0000 Subject: [PATCH 6/7] fix: Resolve bundled templates from the package root --- src/commands/init/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/init/index.ts b/src/commands/init/index.ts index f1f5ff8..8a14d6d 100644 --- a/src/commands/init/index.ts +++ b/src/commands/init/index.ts @@ -2,7 +2,7 @@ import { Command } from "commander"; import chalk from "chalk"; import { writeFile, mkdir, readFile, readdir, copyFile } from "node:fs/promises"; import { existsSync } from "node:fs"; -import { join, dirname, resolve } from "node:path"; +import { join, dirname, resolve, sep } from "node:path"; import { fileURLToPath } from "node:url"; import { spawnSync } from "node:child_process"; import { wrapCommand } from "../../lib/errors.js"; @@ -56,7 +56,8 @@ const TEMPLATES: TemplateDefinition[] = [ function getTemplatesDir(): string { const thisFile = fileURLToPath(import.meta.url); // Walk up from src/commands/init/ or dist/commands/init/ to package root - const packageRoot = resolve(dirname(thisFile), "..", "..", ".."); + const fileDir = dirname(thisFile); + const packageRoot = fileDir.endsWith(`${sep}dist`) ? resolve(fileDir, "..") : resolve(fileDir, "..", "..", ".."); return join(packageRoot, "templates"); } From bff31999208a88e6959b9e41ed187b9f68d2c7ff Mon Sep 17 00:00:00 2001 From: "qodo-code-review[bot]" <151058649+qodo-code-review[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 02:02:25 +0000 Subject: [PATCH 7/7] fix: Reconnect when SSE streams close cleanly --- src/lib/sse-client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/sse-client.ts b/src/lib/sse-client.ts index 63f1aec..bc4be74 100644 --- a/src/lib/sse-client.ts +++ b/src/lib/sse-client.ts @@ -93,7 +93,9 @@ export async function connectSSE( while (!controller.signal.aborted) { const { done, value } = await reader.read(); - if (done) break; + if (done) { + throw new Error("SSE connection closed"); + } buffer += decoder.decode(value, { stream: true });