From 1c8b3075afc417654bc6beea15aa60a9b40aea2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Almeida?= Date: Sun, 3 May 2026 17:46:28 +0100 Subject: [PATCH] feat(cli): replace self-update with package-manager-owned runtime resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CLI no longer downloads runtime bundles from GitHub on first run. Instead: - A new resolveRuntime() in apps/cli/src/runtime.ts resolves the bundle in three steps: KANDEV_BUNDLE_DIR env var (Homebrew wrapper, tests) → installed @kdlbs/runtime-{platform} npm package → cached download (only when --runtime-version is given explicitly). - apps/cli/src/run.ts is split: launch logic separated from download logic. The download path stays for the explicit --runtime-version flag only. - The --version flag now prints CLI semver (was: runtime tag selector). The old behavior moves to --runtime-version, documented as advanced/debug. - The npm self-update prompt (apps/cli/src/update.ts) is removed entirely. - apps/cli/package.json declares optionalDependencies for five @kdlbs/runtime-{platform} packages and engines.npm: ">=7" (required for optional-dep resolution during npx). - Adds esbuild + a "bundle" script that produces dist/cli.bundle.js — a single-file CJS bundle with all Node deps inlined. The Homebrew formula uses this; the npm package keeps the unbundled dist/cli.js. Tests: 130/130 passing. Bundle smoke-tested in a directory with no node_modules to confirm tree-kill is correctly inlined. --- apps/cli/package.json | 14 +- apps/cli/src/args.test.ts | 14 +- apps/cli/src/args.ts | 19 ++- apps/cli/src/cli.ts | 33 ++-- apps/cli/src/run.ts | 145 ++++++++--------- apps/cli/src/runtime.test.ts | 160 +++++++++++++++++++ apps/cli/src/runtime.ts | 85 ++++++++++ apps/cli/src/update.ts | 86 ---------- apps/pnpm-lock.yaml | 297 ++++++++++++++++++++++++++++++++--- 9 files changed, 654 insertions(+), 199 deletions(-) create mode 100644 apps/cli/src/runtime.test.ts create mode 100644 apps/cli/src/runtime.ts delete mode 100644 apps/cli/src/update.ts diff --git a/apps/cli/package.json b/apps/cli/package.json index e78ec42e37..00509bc7bd 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -2,7 +2,7 @@ "name": "kandev", "version": "0.17.0", "private": false, - "description": "NPX launcher for Kandev", + "description": "Launcher for Kandev — manage tasks, orchestrate agents, review changes, and ship value", "license": "AGPL-3.0-only", "type": "commonjs", "bin": { @@ -13,12 +13,23 @@ "bin", "dist" ], + "engines": { + "npm": ">=7" + }, + "optionalDependencies": { + "@kdlbs/runtime-linux-x64": "0.16.0", + "@kdlbs/runtime-linux-arm64": "0.16.0", + "@kdlbs/runtime-darwin-x64": "0.16.0", + "@kdlbs/runtime-darwin-arm64": "0.16.0", + "@kdlbs/runtime-win32-x64": "0.16.0" + }, "dependencies": { "tar": "^7.5.11", "tree-kill": "^1.2.2" }, "devDependencies": { "@types/node": "^20", + "esbuild": "^0.24.0", "tsx": "^4.15.7", "typescript": "^5", "vitest": "^1.6.0" @@ -26,6 +37,7 @@ "scripts": { "dev": "unset npm_config_prefix && tsx src/cli.ts", "build": "tsc -p tsconfig.json", + "bundle": "esbuild dist/cli.js --bundle --platform=node --format=cjs --outfile=dist/cli.bundle.js", "start": "node dist/cli.js", "test": "vitest run", "prepublishOnly": "pnpm build" diff --git a/apps/cli/src/args.test.ts b/apps/cli/src/args.test.ts index 1e83ab7ede..7e743909a8 100644 --- a/apps/cli/src/args.test.ts +++ b/apps/cli/src/args.test.ts @@ -66,8 +66,18 @@ describe("parseArgs", () => { expect(() => parseArgs(["--port="])).toThrow(/--port value must be an integer/); }); - it("throws ParseError on empty --version=", () => { - expect(() => parseArgs(["--version="])).toThrow(/--version requires a value/); + it("sets showVersion for --version and -V flags", () => { + expect(parseArgs(["--version"]).options.showVersion).toBe(true); + expect(parseArgs(["-V"]).options.showVersion).toBe(true); + }); + + it("parses --runtime-version as runtimeVersion", () => { + expect(parseArgs(["--runtime-version", "v0.16.0"]).options.runtimeVersion).toBe("v0.16.0"); + expect(parseArgs(["--runtime-version=v0.16.0"]).options.runtimeVersion).toBe("v0.16.0"); + }); + + it("throws ParseError on empty --runtime-version=", () => { + expect(() => parseArgs(["--runtime-version="])).toThrow(/--runtime-version requires a value/); }); }); diff --git a/apps/cli/src/args.ts b/apps/cli/src/args.ts index 147a0cca45..254f5bc577 100644 --- a/apps/cli/src/args.ts +++ b/apps/cli/src/args.ts @@ -2,11 +2,12 @@ export type Command = "run" | "dev" | "start"; export type CliOptions = { command: Command; - version?: string; + runtimeVersion?: string; backendPort?: number; webPort?: number; verbose?: boolean; debug?: boolean; + showVersion?: boolean; }; export type ParseResult = { @@ -31,19 +32,23 @@ export function parseArgs(argv: string[]): ParseResult { showHelp = true; continue; } + if (arg === "--version" || arg === "-V") { + opts.showVersion = true; + continue; + } if (arg === "dev" || arg === "run" || arg === "start") { opts.command = arg; continue; } - if (arg === "--version") { - opts.version = takeValue(argv, i, "--version"); + if (arg === "--runtime-version") { + opts.runtimeVersion = takeValue(argv, i, "--runtime-version"); i += 1; continue; } - if (arg.startsWith("--version=")) { - const value = arg.slice("--version=".length); - if (value.length === 0) throw new ParseError("--version requires a value"); - opts.version = value; + if (arg.startsWith("--runtime-version=")) { + const value = arg.slice("--runtime-version=".length); + if (value.length === 0) throw new ParseError("--runtime-version requires a value"); + opts.runtimeVersion = value; continue; } if (arg === "--dev") { diff --git a/apps/cli/src/cli.ts b/apps/cli/src/cli.ts index b1d02c7dc5..2d3baa25e1 100644 --- a/apps/cli/src/cli.ts +++ b/apps/cli/src/cli.ts @@ -7,16 +7,15 @@ import { runDev } from "./dev"; import { runRelease } from "./run"; import { runStart } from "./start"; import { ensureValidPort } from "./ports"; -import { maybePromptForUpdate } from "./update"; function printHelp() { console.log(`kandev launcher Usage: - kandev run [--version ] [--port ] [--verbose] [--debug] + kandev run [--port ] [--verbose] [--debug] kandev dev [--port ] kandev start [--port ] [--verbose] [--debug] - kandev [--version ] [--port ] [--verbose] [--debug] + kandev [--port ] [--verbose] [--debug] kandev --dev [--port ] Examples: @@ -25,16 +24,16 @@ Examples: kandev --dev kandev dev kandev start - kandev --version v0.1.0 + kandev --version kandev --port 3000 kandev --debug Options: dev Use local repo for dev (make dev + next dev) if available. start Use local production build (make build + next start). - run Use release bundles (default). + run Use installed runtime bundle (default). --dev Alias for "dev". - --version Release tag to install (default: latest). + --version, -V Print CLI version and exit. --port Port for the Go backend (the URL kandev opens on in start/run). Alias for --backend-port. Also reads KANDEV_PORT or KANDEV_BACKEND_PORT. @@ -43,11 +42,14 @@ Options: --help, -h Show help. Advanced: - --backend-port Same as --port. - --web-internal-port Override the internal Next.js port. The Go backend - reverse-proxies to it; users hit the backend port. - Also reads KANDEV_WEB_PORT. - --web-port Deprecated alias for --web-internal-port. + --backend-port Same as --port. + --web-internal-port Override the internal Next.js port. The Go backend + reverse-proxies to it; users hit the backend port. + Also reads KANDEV_WEB_PORT. + --web-port Deprecated alias for --web-internal-port. + --runtime-version Download and use a specific release tag instead of + the installed runtime. For debugging only. + Example: kandev --runtime-version v0.16.0 `); } @@ -76,6 +78,12 @@ function findRepoRoot(startDir: string): string | null { async function main(): Promise { const { options, showHelp, deprecatedFlags } = parseArgs(process.argv.slice(2)); + + if (options.showVersion) { + console.log(pkg.version); + return; + } + if (showHelp) { printHelp(); return; @@ -113,9 +121,8 @@ async function main(): Promise { return; } - await maybePromptForUpdate(pkg.version, process.argv.slice(2)); await runRelease({ - version: options.version, + runtimeVersion: options.runtimeVersion, backendPort, webPort, verbose: options.verbose, diff --git a/apps/cli/src/run.ts b/apps/cli/src/run.ts index 82693ab875..84ed794f66 100644 --- a/apps/cli/src/run.ts +++ b/apps/cli/src/run.ts @@ -17,11 +17,12 @@ import { getBinaryName, getPlatformDir } from "./platform"; import { sortVersionsDesc } from "./version"; import { pickAvailablePort } from "./ports"; import { createProcessSupervisor } from "./process"; +import { resolveRuntime } from "./runtime"; import { attachBackendExitHandler, logStartupInfo } from "./shared"; import { launchWebApp, openBrowser } from "./web"; export type RunOptions = { - version?: string; + runtimeVersion?: string; backendPort?: number; webPort?: number; /** Show info logs from backend + web */ @@ -30,14 +31,13 @@ export type RunOptions = { debug?: boolean; }; -type PreparedRelease = { +type PreparedBundle = { bundleDir: string; backendBin: string; backendUrl: string; backendEnv: NodeJS.ProcessEnv; webEnv: NodeJS.ProcessEnv; releaseTag: string; - requestedVersion?: string; webPort: number; agentctlPort: number; dbPath: string; @@ -109,60 +109,69 @@ export function cleanOldReleases(currentTag: string) { } } -async function prepareReleaseBundle({ - version, +/** + * Download a specific release version into the local cache. + * Only used when --runtime-version is given explicitly. + */ +async function downloadRuntimeVersion(runtimeVersion: string): Promise { + const platformDir = getPlatformDir(); + const release = await getRelease(runtimeVersion); + const tag = release.tag_name; + const assetName = `kandev-${platformDir}.tar.gz`; + const cacheDir = path.join(CACHE_DIR, tag, platformDir); + + const archivePath = await ensureAsset(tag, assetName, cacheDir, (downloaded, total) => { + const percent = total ? Math.round((downloaded / total) * 100) : 0; + const mb = (downloaded / (1024 * 1024)).toFixed(1); + const totalMb = total ? (total / (1024 * 1024)).toFixed(1) : "?"; + process.stderr.write(`\r Downloading: ${mb}MB / ${totalMb}MB (${percent}%)`); + }); + process.stderr.write("\n"); + + ensureExtracted(archivePath, cacheDir); + cleanOldReleases(tag); + return tag; +} + +async function prepareBundleForLaunch({ + runtimeVersion, backendPort, webPort, verbose = false, debug = false, -}: RunOptions): Promise { - const platformDir = getPlatformDir(); - let tag: string; - let cacheDir: string; +}: RunOptions): Promise { + let bundleDir: string; + let releaseTag: string; - try { - const release = await getRelease(version); - tag = release.tag_name; - const assetName = `kandev-${platformDir}.tar.gz`; - cacheDir = path.join(CACHE_DIR, tag, platformDir); - - const archivePath = await ensureAsset(tag, assetName, cacheDir, (downloaded, total) => { - const percent = total ? Math.round((downloaded / total) * 100) : 0; - const mb = (downloaded / (1024 * 1024)).toFixed(1); - const totalMb = total ? (total / (1024 * 1024)).toFixed(1) : "?"; - process.stderr.write(`\r Downloading: ${mb}MB / ${totalMb}MB (${percent}%)`); - }); - process.stderr.write("\n"); - - ensureExtracted(archivePath, cacheDir); - cleanOldReleases(tag); - } catch (err) { - // GitHub unreachable — try to launch from cache. - const cached = findCachedRelease(platformDir, version); - if (!cached) { - const target = version ? `version ${version}` : "latest version"; - const reason = err instanceof Error ? err.message : String(err); - throw new Error( - `Failed to fetch ${target} and no cached release found.\n` + - ` Reason: ${reason}\n` + - ` Run kandev once while online to cache a release for offline use.`, - ); + if (runtimeVersion) { + // Explicit version: ensure it is in the cache (downloading if needed), then resolve. + const platformDir = getPlatformDir(); + const cached = findCachedRelease(platformDir, runtimeVersion); + let tag: string; + if (cached) { + tag = cached.tag; + bundleDir = findBundleRoot(cached.cacheDir); + } else { + try { + tag = await downloadRuntimeVersion(runtimeVersion); + const cacheDir = path.join(CACHE_DIR, tag, platformDir); + bundleDir = findBundleRoot(cacheDir); + } catch (err) { + const reason = err instanceof Error ? err.message : String(err); + throw new Error( + `Failed to fetch runtime version ${runtimeVersion}.\n` + + ` Reason: ${reason}\n` + + ` Run kandev once while online to cache a release for offline use.`, + ); + } } - tag = cached.tag; - cacheDir = cached.cacheDir; - process.stderr.write(`[kandev] GitHub unreachable — using cached release ${tag}\n`); - } - - const bundleDir = findBundleRoot(cacheDir); - - const backendBin = path.join(bundleDir, "bin", getBinaryName("kandev")); - if (!fs.existsSync(backendBin)) { - throw new Error(`Backend binary not found at ${backendBin}`); - } - - const agentctlBin = path.join(bundleDir, "bin", getBinaryName("agentctl")); - if (!fs.existsSync(agentctlBin)) { - throw new Error(`agentctl binary not found at ${agentctlBin}`); + releaseTag = tag; + } else { + // Default path: resolve from KANDEV_BUNDLE_DIR or installed npm runtime package. + const resolved = resolveRuntime(); + bundleDir = resolved.bundleDir; + // Use KANDEV_VERSION if set (e.g. by Homebrew wrapper), otherwise show source. + releaseTag = process.env.KANDEV_VERSION ?? `(${resolved.source})`; } const actualBackendPort = backendPort ?? (await pickAvailablePort(DEFAULT_BACKEND_PORT)); @@ -176,10 +185,8 @@ async function prepareReleaseBundle({ fs.mkdirSync(DATA_DIR, { recursive: true }); const dbPath = path.join(DATA_DIR, "kandev.db"); - // Note: Release mode doesn't configure MCP server ports as it uses - // the bundled configuration. Only backend and agentctl ports are set. - // Log level defaults to warn for clean output and can be overridden - // via KANDEV_LOG_LEVEL or --verbose/--debug flags. + const backendBin = path.join(bundleDir, "bin", getBinaryName("kandev")); + const backendEnv: NodeJS.ProcessEnv = { ...process.env, KANDEV_SERVER_PORT: String(actualBackendPort), @@ -194,8 +201,6 @@ async function prepareReleaseBundle({ ...process.env, KANDEV_API_BASE_URL: backendUrl, PORT: String(actualWebPort), - // Ensure Next.js standalone server binds to 127.0.0.1 so localhost health checks work. - // Without this, HOSTNAME from the host environment can cause binding issues. HOSTNAME: "127.0.0.1", }; (webEnv as Record).NODE_ENV = "production"; @@ -206,8 +211,7 @@ async function prepareReleaseBundle({ backendUrl, backendEnv, webEnv, - releaseTag: tag, - requestedVersion: version, + releaseTag, webPort: actualWebPort, agentctlPort, dbPath, @@ -235,17 +239,14 @@ export function attachRingBuffer( return () => buf; } -function launchReleaseApps(prepared: PreparedRelease): { +function launchBundle(prepared: PreparedBundle): { supervisor: ReturnType; backendProc: ReturnType; webServerPath: string; dumpBackendLogs: () => void; } { - const releaseSource = prepared.requestedVersion - ? `(requested: ${prepared.requestedVersion})` - : "(github latest)"; logStartupInfo({ - header: `release: ${prepared.releaseTag} ${releaseSource}`, + header: `release: ${prepared.releaseTag}`, ports: { backendPort: Number(prepared.backendEnv.KANDEV_SERVER_PORT), webPort: prepared.webPort, @@ -259,10 +260,6 @@ function launchReleaseApps(prepared: PreparedRelease): { const supervisor = createProcessSupervisor(); supervisor.attachSignalHandlers(); - // Start backend: ignore stdin, always show stderr immediately. - // In verbose/debug mode stream stdout live; otherwise capture it into a ring - // buffer so we can dump the last few KB if the healthcheck fails (users were - // previously seeing opaque "timed out" errors with no backend context). const backendProc = spawn(prepared.backendBin, [], { cwd: path.dirname(prepared.backendBin), env: prepared.backendEnv, @@ -293,14 +290,20 @@ function launchReleaseApps(prepared: PreparedRelease): { } export async function runRelease({ - version, + runtimeVersion, backendPort, webPort, verbose = false, debug = false, }: RunOptions): Promise { - const prepared = await prepareReleaseBundle({ version, backendPort, webPort, verbose, debug }); - const { supervisor, backendProc, webServerPath, dumpBackendLogs } = launchReleaseApps(prepared); + const prepared = await prepareBundleForLaunch({ + runtimeVersion, + backendPort, + webPort, + verbose, + debug, + }); + const { supervisor, backendProc, webServerPath, dumpBackendLogs } = launchBundle(prepared); const healthTimeoutMs = resolveHealthTimeoutMs(HEALTH_TIMEOUT_MS_RELEASE); console.log("[kandev] starting backend..."); await waitForHealth(prepared.backendUrl, backendProc, healthTimeoutMs, dumpBackendLogs); diff --git a/apps/cli/src/runtime.test.ts b/apps/cli/src/runtime.test.ts new file mode 100644 index 0000000000..1086e20e15 --- /dev/null +++ b/apps/cli/src/runtime.test.ts @@ -0,0 +1,160 @@ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; + +import { resolveRuntime, validateBundle } from "./runtime"; + +// Mock constants so CACHE_DIR points to a temp directory. +const mockCacheDir = { value: "" }; +vi.mock("./constants", () => ({ + get CACHE_DIR() { + return mockCacheDir.value; + }, + DATA_DIR: "/tmp/kandev-test-data", + DEFAULT_BACKEND_PORT: 38429, + DEFAULT_WEB_PORT: 37429, + DEFAULT_AGENTCTL_PORT: 39429, + HEALTH_TIMEOUT_MS_RELEASE: 15000, + RANDOM_PORT_MIN: 10000, + RANDOM_PORT_MAX: 60000, + RANDOM_PORT_RETRIES: 10, +})); + +// Keep getPlatformDir deterministic across test environments. +vi.mock("./platform", () => ({ + getPlatformDir: () => "macos-arm64" as const, + getBinaryName: (base: string) => base, +})); + +const PLATFORM = "macos-arm64"; + +function createFakeBundle(dir: string) { + fs.mkdirSync(path.join(dir, "bin"), { recursive: true }); + fs.writeFileSync(path.join(dir, "bin", "kandev"), "fake"); + fs.writeFileSync(path.join(dir, "bin", "agentctl"), "fake"); + fs.mkdirSync(path.join(dir, "web"), { recursive: true }); + fs.writeFileSync(path.join(dir, "web", "server.js"), "fake"); +} + +describe("validateBundle", () => { + let tmpDir: string; + + beforeEach(() => { + tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "kandev-validate-")); + }); + + afterEach(() => { + fs.rmSync(tmpDir, { recursive: true, force: true }); + }); + + it("passes for a complete bundle", () => { + createFakeBundle(tmpDir); + expect(() => validateBundle(tmpDir)).not.toThrow(); + }); + + it("throws when backend binary is missing", () => { + fs.mkdirSync(path.join(tmpDir, "bin"), { recursive: true }); + fs.writeFileSync(path.join(tmpDir, "bin", "agentctl"), "fake"); + fs.mkdirSync(path.join(tmpDir, "web"), { recursive: true }); + fs.writeFileSync(path.join(tmpDir, "web", "server.js"), "fake"); + expect(() => validateBundle(tmpDir)).toThrow(/Backend binary not found/); + }); + + it("throws when agentctl is missing", () => { + fs.mkdirSync(path.join(tmpDir, "bin"), { recursive: true }); + fs.writeFileSync(path.join(tmpDir, "bin", "kandev"), "fake"); + fs.mkdirSync(path.join(tmpDir, "web"), { recursive: true }); + fs.writeFileSync(path.join(tmpDir, "web", "server.js"), "fake"); + expect(() => validateBundle(tmpDir)).toThrow(/agentctl binary not found/); + }); + + it("throws when web server.js is missing", () => { + fs.mkdirSync(path.join(tmpDir, "bin"), { recursive: true }); + fs.writeFileSync(path.join(tmpDir, "bin", "kandev"), "fake"); + fs.writeFileSync(path.join(tmpDir, "bin", "agentctl"), "fake"); + expect(() => validateBundle(tmpDir)).toThrow(/Web server.*not found/); + }); +}); + +describe("resolveRuntime", () => { + let tmpDir: string; + const origEnv = { ...process.env }; + + beforeEach(() => { + tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "kandev-runtime-")); + mockCacheDir.value = tmpDir; + // Clear relevant env vars before each test + delete process.env.KANDEV_BUNDLE_DIR; + }); + + afterEach(() => { + fs.rmSync(tmpDir, { recursive: true, force: true }); + // Restore env + process.env = { ...origEnv }; + delete process.env.KANDEV_BUNDLE_DIR; + }); + + describe("KANDEV_BUNDLE_DIR (step 1)", () => { + it("resolves from KANDEV_BUNDLE_DIR when set and valid", () => { + const bundleDir = path.join(tmpDir, "bundle"); + createFakeBundle(bundleDir); + process.env.KANDEV_BUNDLE_DIR = bundleDir; + + const result = resolveRuntime(); + expect(result.source).toBe("env"); + expect(result.bundleDir).toBe(bundleDir); + }); + + it("throws when KANDEV_BUNDLE_DIR points to an invalid bundle", () => { + const bundleDir = path.join(tmpDir, "empty-bundle"); + fs.mkdirSync(bundleDir); + process.env.KANDEV_BUNDLE_DIR = bundleDir; + + expect(() => resolveRuntime()).toThrow(/Backend binary not found/); + }); + }); + + describe("cache fallback (step 3 — runtimeVersion only)", () => { + it("resolves from cache when runtimeVersion is given and cache exists", () => { + const tag = "v0.16.0"; + const cacheDir = path.join(tmpDir, tag, PLATFORM, "kandev"); + createFakeBundle(cacheDir); + + const result = resolveRuntime(tag); + expect(result.source).toBe("cache"); + expect(result.tag).toBe(tag); + expect(result.bundleDir).toContain(tag); + }); + + it("throws when runtimeVersion is given but cache dir is missing", () => { + expect(() => resolveRuntime("v9.9.9")).toThrow(/Backend binary not found/); + }); + + it("does not check cache when runtimeVersion is not given", () => { + // Create a cache entry — should not be picked up without runtimeVersion + const tag = "v0.16.0"; + const cacheDir = path.join(tmpDir, tag, PLATFORM, "kandev"); + createFakeBundle(cacheDir); + + // No KANDEV_BUNDLE_DIR, no npm package (require.resolve will fail in test) + // Should throw the "no runtime found" error, not resolve from cache + expect(() => resolveRuntime()).toThrow(/No Kandev runtime found/); + }); + }); + + describe("no runtime found", () => { + it("throws an actionable error message mentioning install paths", () => { + let error: Error | null = null; + try { + resolveRuntime(); + } catch (e) { + error = e as Error; + } + expect(error).not.toBeNull(); + expect(error!.message).toMatch(/npx kandev@latest/); + expect(error!.message).toMatch(/brew install/); + expect(error!.message).toMatch(/--runtime-version/); + }); + }); +}); diff --git a/apps/cli/src/runtime.ts b/apps/cli/src/runtime.ts new file mode 100644 index 0000000000..13fc73f3f8 --- /dev/null +++ b/apps/cli/src/runtime.ts @@ -0,0 +1,85 @@ +import path from "node:path"; +import fs from "node:fs"; + +import { findBundleRoot, resolveWebServerPath } from "./bundle"; +import { CACHE_DIR } from "./constants"; +import { getBinaryName, getPlatformDir, type PlatformDir } from "./platform"; + +// Maps platform.ts dir strings to npm @kdlbs/runtime-* package names. +// platform.ts uses internal names (macos, windows); npm uses os identifiers (darwin, win32). +const PLATFORM_TO_NPM_PACKAGE: Record = { + "linux-x64": "@kdlbs/runtime-linux-x64", + "linux-arm64": "@kdlbs/runtime-linux-arm64", + "macos-x64": "@kdlbs/runtime-darwin-x64", + "macos-arm64": "@kdlbs/runtime-darwin-arm64", + "windows-x64": "@kdlbs/runtime-win32-x64", +}; + +export type RuntimeSource = "env" | "npm" | "cache"; + +export type ResolvedRuntime = { + bundleDir: string; + source: RuntimeSource; + tag?: string; +}; + +/** + * Resolve the runtime bundle directory using a three-step priority chain: + * + * 1. KANDEV_BUNDLE_DIR env var — set by the Homebrew formula wrapper and useful + * for local testing. Skips all other resolution. + * 2. Installed npm runtime package — looks for @kdlbs/runtime-{platform} in + * node_modules via Node module resolution. Only works after `npx kandev@latest` + * or `npm install -g kandev` (npm 7+). + * 3. Cached download — only checked when runtimeVersion is explicitly specified + * via --runtime-version. Used by the explicit version download path in run.ts. + * + * Throws with an actionable error message if no runtime is found. + */ +export function resolveRuntime(runtimeVersion?: string): ResolvedRuntime { + const envBundleDir = process.env.KANDEV_BUNDLE_DIR; + if (envBundleDir) { + validateBundle(envBundleDir); + return { bundleDir: envBundleDir, source: "env" }; + } + + const platformDir = getPlatformDir(); + const packageName = PLATFORM_TO_NPM_PACKAGE[platformDir]; + try { + const pkgJsonPath = require.resolve(`${packageName}/package.json`); + const packageRoot = path.dirname(pkgJsonPath); + validateBundle(packageRoot); + return { bundleDir: packageRoot, source: "npm" }; + } catch { + // Package not installed or invalid — fall through. + } + + if (runtimeVersion) { + const cacheDir = path.join(CACHE_DIR, runtimeVersion, platformDir); + const bundleDir = findBundleRoot(cacheDir); + validateBundle(bundleDir); + return { bundleDir, source: "cache", tag: runtimeVersion }; + } + + throw new Error( + `No Kandev runtime found for ${platformDir}.\n` + + ` Install via npm (requires npm 7+): npx kandev@latest\n` + + ` Install via Homebrew: brew install kdlbs/kandev/kandev\n` + + ` Download a specific version (debug): kandev --runtime-version `, + ); +} + +export function validateBundle(bundleDir: string): void { + const backendBin = path.join(bundleDir, "bin", getBinaryName("kandev")); + if (!fs.existsSync(backendBin)) { + throw new Error(`Backend binary not found in bundle at ${bundleDir}`); + } + const agentctlBin = path.join(bundleDir, "bin", getBinaryName("agentctl")); + if (!fs.existsSync(agentctlBin)) { + throw new Error(`agentctl binary not found in bundle at ${bundleDir}`); + } + const webServerPath = resolveWebServerPath(bundleDir); + if (!webServerPath) { + throw new Error(`Web server (server.js) not found in bundle at ${bundleDir}`); + } +} diff --git a/apps/cli/src/update.ts b/apps/cli/src/update.ts deleted file mode 100644 index 749d7a999f..0000000000 --- a/apps/cli/src/update.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { spawn } from "node:child_process"; -import https from "node:https"; -import readline from "node:readline"; - -import { compareVersions } from "./version"; - -function requestJson(url: string): Promise { - return new Promise((resolve, reject) => { - const req = https.get(url, { headers: { "User-Agent": "kandev-npx" } }, (res) => { - if (res.statusCode !== 200) { - return reject(new Error(`HTTP ${res.statusCode} fetching ${url}`)); - } - let body = ""; - res.on("data", (chunk) => (body += chunk)); - res.on("end", () => { - try { - resolve(JSON.parse(body) as T); - } catch { - reject(new Error(`Failed to parse JSON from ${url}`)); - } - }); - }); - req.setTimeout(5000, () => { - req.destroy(new Error(`Request timed out fetching ${url}`)); - }); - req.on("error", reject); - }); -} - -async function getLatestNpmVersion(): Promise { - const data = await requestJson<{ "dist-tags"?: { latest?: string } }>( - "https://registry.npmjs.org/kandev", - ); - return data?.["dist-tags"]?.latest; -} - -function promptYesNo(question: string, defaultYes = false): Promise { - return new Promise((resolve) => { - if (!process.stdin.isTTY) { - resolve(false); - return; - } - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }); - const suffix = defaultYes ? "[Y/n]" : "[y/N]"; - rl.question(`${question} ${suffix} `, (answer: string) => { - rl.close(); - const normalized = String(answer || "") - .trim() - .toLowerCase(); - if (!normalized) { - resolve(Boolean(defaultYes)); - return; - } - resolve(normalized === "y" || normalized === "yes"); - }); - }); -} - -export async function maybePromptForUpdate(currentVersion: string, args: string[]) { - // Allow disabling update checks for CI or automation. - if (process.env.KANDEV_SKIP_UPDATE === "1" || process.env.KANDEV_NO_UPDATE_PROMPT === "1") { - return; - } - try { - const latest = await getLatestNpmVersion(); - if (!latest) return; - if (compareVersions(latest, currentVersion) <= 0) return; - const wantsUpdate = await promptYesNo( - `Update available: ${currentVersion} -> ${latest}. Update now?`, - false, - ); - if (!wantsUpdate) return; - const env = { ...process.env, KANDEV_SKIP_UPDATE: "1" }; - const child = spawn("npx", ["kandev@latest", ...args], { - stdio: "inherit", - env, - }); - child.on("exit", (code) => process.exit(code || 0)); - await new Promise(() => {}); - } catch { - // ignore update errors - } -} diff --git a/apps/pnpm-lock.yaml b/apps/pnpm-lock.yaml index 7e200e42a7..334ee5a1af 100644 --- a/apps/pnpm-lock.yaml +++ b/apps/pnpm-lock.yaml @@ -32,7 +32,7 @@ importers: dependencies: tar: specifier: ^7.5.11 - version: 7.5.11 + version: 7.5.13 tree-kill: specifier: ^1.2.2 version: 1.2.2 @@ -40,6 +40,9 @@ importers: '@types/node': specifier: ^20 version: 20.19.28 + esbuild: + specifier: ^0.24.0 + version: 0.24.2 tsx: specifier: ^4.15.7 version: 4.21.0 @@ -400,7 +403,7 @@ importers: version: 0.55.1 next: specifier: 16.1.7 - version: 16.1.7(@babel/core@7.28.6)(@playwright/test@1.58.2)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) + version: 16.1.7(@playwright/test@1.58.2)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.2.3(react@19.2.3))(react@19.2.3) @@ -454,7 +457,7 @@ importers: version: 2.0.7(react-dom@19.2.3(react@19.2.3))(react@19.2.3) styled-jsx: specifier: 5.1.6 - version: 5.1.6(@babel/core@7.28.6)(react@19.2.3) + version: 5.1.6(react@19.2.3) tailwind-merge: specifier: ^3.4.0 version: 3.4.0 @@ -890,6 +893,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.24.2': + resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + '@esbuild/aix-ppc64@0.27.2': resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==} engines: {node: '>=18'} @@ -902,6 +911,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.24.2': + resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm64@0.27.2': resolution: {integrity: sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==} engines: {node: '>=18'} @@ -914,6 +929,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-arm@0.24.2': + resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.27.2': resolution: {integrity: sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==} engines: {node: '>=18'} @@ -926,6 +947,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/android-x64@0.24.2': + resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + '@esbuild/android-x64@0.27.2': resolution: {integrity: sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==} engines: {node: '>=18'} @@ -938,6 +965,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.24.2': + resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-arm64@0.27.2': resolution: {integrity: sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==} engines: {node: '>=18'} @@ -950,6 +983,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.24.2': + resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + '@esbuild/darwin-x64@0.27.2': resolution: {integrity: sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==} engines: {node: '>=18'} @@ -962,6 +1001,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.24.2': + resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-arm64@0.27.2': resolution: {integrity: sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==} engines: {node: '>=18'} @@ -974,6 +1019,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.24.2': + resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + '@esbuild/freebsd-x64@0.27.2': resolution: {integrity: sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==} engines: {node: '>=18'} @@ -986,6 +1037,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.24.2': + resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm64@0.27.2': resolution: {integrity: sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==} engines: {node: '>=18'} @@ -998,6 +1055,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.24.2': + resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + '@esbuild/linux-arm@0.27.2': resolution: {integrity: sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==} engines: {node: '>=18'} @@ -1010,6 +1073,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.24.2': + resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-ia32@0.27.2': resolution: {integrity: sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==} engines: {node: '>=18'} @@ -1022,6 +1091,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.24.2': + resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.27.2': resolution: {integrity: sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==} engines: {node: '>=18'} @@ -1034,6 +1109,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.24.2': + resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-mips64el@0.27.2': resolution: {integrity: sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==} engines: {node: '>=18'} @@ -1046,6 +1127,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.24.2': + resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-ppc64@0.27.2': resolution: {integrity: sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==} engines: {node: '>=18'} @@ -1058,6 +1145,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.24.2': + resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-riscv64@0.27.2': resolution: {integrity: sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==} engines: {node: '>=18'} @@ -1070,6 +1163,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.24.2': + resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-s390x@0.27.2': resolution: {integrity: sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==} engines: {node: '>=18'} @@ -1082,12 +1181,24 @@ packages: cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.24.2': + resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + '@esbuild/linux-x64@0.27.2': resolution: {integrity: sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==} engines: {node: '>=18'} cpu: [x64] os: [linux] + '@esbuild/netbsd-arm64@0.24.2': + resolution: {integrity: sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + '@esbuild/netbsd-arm64@0.27.2': resolution: {integrity: sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==} engines: {node: '>=18'} @@ -1100,12 +1211,24 @@ packages: cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.24.2': + resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + '@esbuild/netbsd-x64@0.27.2': resolution: {integrity: sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] + '@esbuild/openbsd-arm64@0.24.2': + resolution: {integrity: sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + '@esbuild/openbsd-arm64@0.27.2': resolution: {integrity: sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==} engines: {node: '>=18'} @@ -1118,6 +1241,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.24.2': + resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + '@esbuild/openbsd-x64@0.27.2': resolution: {integrity: sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==} engines: {node: '>=18'} @@ -1136,6 +1265,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.24.2': + resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + '@esbuild/sunos-x64@0.27.2': resolution: {integrity: sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==} engines: {node: '>=18'} @@ -1148,6 +1283,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.24.2': + resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-arm64@0.27.2': resolution: {integrity: sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==} engines: {node: '>=18'} @@ -1160,6 +1301,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.24.2': + resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-ia32@0.27.2': resolution: {integrity: sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==} engines: {node: '>=18'} @@ -1172,6 +1319,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.24.2': + resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@esbuild/win32-x64@0.27.2': resolution: {integrity: sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==} engines: {node: '>=18'} @@ -4219,6 +4372,11 @@ packages: engines: {node: '>=12'} hasBin: true + esbuild@0.24.2: + resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} + engines: {node: '>=18'} + hasBin: true + esbuild@0.27.2: resolution: {integrity: sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==} engines: {node: '>=18'} @@ -6411,8 +6569,8 @@ packages: resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} engines: {node: '>=6'} - tar@7.5.11: - resolution: {integrity: sha512-ChjMH33/KetonMTAtpYdgUFr0tbz69Fp2v7zWxQfYZX4g5ZN2nOBXm1R2xyA+lMIKrLKIoKAwFj93jE/avX9cQ==} + tar@7.5.13: + resolution: {integrity: sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==} engines: {node: '>=18'} tiny-invariant@1.3.3: @@ -7474,120 +7632,183 @@ snapshots: '@esbuild/aix-ppc64@0.21.5': optional: true + '@esbuild/aix-ppc64@0.24.2': + optional: true + '@esbuild/aix-ppc64@0.27.2': optional: true '@esbuild/android-arm64@0.21.5': optional: true + '@esbuild/android-arm64@0.24.2': + optional: true + '@esbuild/android-arm64@0.27.2': optional: true '@esbuild/android-arm@0.21.5': optional: true + '@esbuild/android-arm@0.24.2': + optional: true + '@esbuild/android-arm@0.27.2': optional: true '@esbuild/android-x64@0.21.5': optional: true + '@esbuild/android-x64@0.24.2': + optional: true + '@esbuild/android-x64@0.27.2': optional: true '@esbuild/darwin-arm64@0.21.5': optional: true + '@esbuild/darwin-arm64@0.24.2': + optional: true + '@esbuild/darwin-arm64@0.27.2': optional: true '@esbuild/darwin-x64@0.21.5': optional: true + '@esbuild/darwin-x64@0.24.2': + optional: true + '@esbuild/darwin-x64@0.27.2': optional: true '@esbuild/freebsd-arm64@0.21.5': optional: true + '@esbuild/freebsd-arm64@0.24.2': + optional: true + '@esbuild/freebsd-arm64@0.27.2': optional: true '@esbuild/freebsd-x64@0.21.5': optional: true + '@esbuild/freebsd-x64@0.24.2': + optional: true + '@esbuild/freebsd-x64@0.27.2': optional: true '@esbuild/linux-arm64@0.21.5': optional: true + '@esbuild/linux-arm64@0.24.2': + optional: true + '@esbuild/linux-arm64@0.27.2': optional: true '@esbuild/linux-arm@0.21.5': optional: true + '@esbuild/linux-arm@0.24.2': + optional: true + '@esbuild/linux-arm@0.27.2': optional: true '@esbuild/linux-ia32@0.21.5': optional: true + '@esbuild/linux-ia32@0.24.2': + optional: true + '@esbuild/linux-ia32@0.27.2': optional: true '@esbuild/linux-loong64@0.21.5': optional: true + '@esbuild/linux-loong64@0.24.2': + optional: true + '@esbuild/linux-loong64@0.27.2': optional: true '@esbuild/linux-mips64el@0.21.5': optional: true + '@esbuild/linux-mips64el@0.24.2': + optional: true + '@esbuild/linux-mips64el@0.27.2': optional: true '@esbuild/linux-ppc64@0.21.5': optional: true + '@esbuild/linux-ppc64@0.24.2': + optional: true + '@esbuild/linux-ppc64@0.27.2': optional: true '@esbuild/linux-riscv64@0.21.5': optional: true + '@esbuild/linux-riscv64@0.24.2': + optional: true + '@esbuild/linux-riscv64@0.27.2': optional: true '@esbuild/linux-s390x@0.21.5': optional: true + '@esbuild/linux-s390x@0.24.2': + optional: true + '@esbuild/linux-s390x@0.27.2': optional: true '@esbuild/linux-x64@0.21.5': optional: true + '@esbuild/linux-x64@0.24.2': + optional: true + '@esbuild/linux-x64@0.27.2': optional: true + '@esbuild/netbsd-arm64@0.24.2': + optional: true + '@esbuild/netbsd-arm64@0.27.2': optional: true '@esbuild/netbsd-x64@0.21.5': optional: true + '@esbuild/netbsd-x64@0.24.2': + optional: true + '@esbuild/netbsd-x64@0.27.2': optional: true + '@esbuild/openbsd-arm64@0.24.2': + optional: true + '@esbuild/openbsd-arm64@0.27.2': optional: true '@esbuild/openbsd-x64@0.21.5': optional: true + '@esbuild/openbsd-x64@0.24.2': + optional: true + '@esbuild/openbsd-x64@0.27.2': optional: true @@ -7597,24 +7818,36 @@ snapshots: '@esbuild/sunos-x64@0.21.5': optional: true + '@esbuild/sunos-x64@0.24.2': + optional: true + '@esbuild/sunos-x64@0.27.2': optional: true '@esbuild/win32-arm64@0.21.5': optional: true + '@esbuild/win32-arm64@0.24.2': + optional: true + '@esbuild/win32-arm64@0.27.2': optional: true '@esbuild/win32-ia32@0.21.5': optional: true + '@esbuild/win32-ia32@0.24.2': + optional: true + '@esbuild/win32-ia32@0.27.2': optional: true '@esbuild/win32-x64@0.21.5': optional: true + '@esbuild/win32-x64@0.24.2': + optional: true + '@esbuild/win32-x64@0.27.2': optional: true @@ -10724,6 +10957,34 @@ snapshots: '@esbuild/win32-ia32': 0.21.5 '@esbuild/win32-x64': 0.21.5 + esbuild@0.24.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.24.2 + '@esbuild/android-arm': 0.24.2 + '@esbuild/android-arm64': 0.24.2 + '@esbuild/android-x64': 0.24.2 + '@esbuild/darwin-arm64': 0.24.2 + '@esbuild/darwin-x64': 0.24.2 + '@esbuild/freebsd-arm64': 0.24.2 + '@esbuild/freebsd-x64': 0.24.2 + '@esbuild/linux-arm': 0.24.2 + '@esbuild/linux-arm64': 0.24.2 + '@esbuild/linux-ia32': 0.24.2 + '@esbuild/linux-loong64': 0.24.2 + '@esbuild/linux-mips64el': 0.24.2 + '@esbuild/linux-ppc64': 0.24.2 + '@esbuild/linux-riscv64': 0.24.2 + '@esbuild/linux-s390x': 0.24.2 + '@esbuild/linux-x64': 0.24.2 + '@esbuild/netbsd-arm64': 0.24.2 + '@esbuild/netbsd-x64': 0.24.2 + '@esbuild/openbsd-arm64': 0.24.2 + '@esbuild/openbsd-x64': 0.24.2 + '@esbuild/sunos-x64': 0.24.2 + '@esbuild/win32-arm64': 0.24.2 + '@esbuild/win32-ia32': 0.24.2 + '@esbuild/win32-x64': 0.24.2 + esbuild@0.27.2: optionalDependencies: '@esbuild/aix-ppc64': 0.27.2 @@ -10766,8 +11027,8 @@ snapshots: '@next/eslint-plugin-next': 16.1.1 eslint: 9.39.2(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.2(jiti@2.6.1)) - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.2(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)) + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.2(jiti@2.6.1)) eslint-plugin-react: 7.37.5(eslint@9.39.2(jiti@2.6.1)) eslint-plugin-react-hooks: 7.0.1(eslint@9.39.2(jiti@2.6.1)) @@ -10789,7 +11050,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.2(jiti@2.6.1)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.3 @@ -10800,22 +11061,22 @@ snapshots: tinyglobby: 0.2.15 unrs-resolver: 1.11.1 optionalDependencies: - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.2(jiti@2.6.1)) + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)) transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.2(jiti@2.6.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3) eslint: 9.39.2(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.2(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)) transitivePeerDependencies: - supports-color - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.2(jiti@2.6.1)): + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -10826,7 +11087,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.39.2(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.2(jiti@2.6.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.53.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)))(eslint@9.39.2(jiti@2.6.1)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -12382,7 +12643,7 @@ snapshots: react: 19.2.3 react-dom: 19.2.3(react@19.2.3) - next@16.1.7(@babel/core@7.28.6)(@playwright/test@1.58.2)(react-dom@19.2.3(react@19.2.3))(react@19.2.3): + next@16.1.7(@playwright/test@1.58.2)(react-dom@19.2.3(react@19.2.3))(react@19.2.3): dependencies: '@next/env': 16.1.7 '@swc/helpers': 0.5.15 @@ -12391,7 +12652,7 @@ snapshots: postcss: 8.4.31 react: 19.2.3 react-dom: 19.2.3(react@19.2.3) - styled-jsx: 5.1.6(@babel/core@7.28.6)(react@19.2.3) + styled-jsx: 5.1.6(react@19.2.3) optionalDependencies: '@next/swc-darwin-arm64': 16.1.7 '@next/swc-darwin-x64': 16.1.7 @@ -13534,12 +13795,10 @@ snapshots: dependencies: inline-style-parser: 0.2.7 - styled-jsx@5.1.6(@babel/core@7.28.6)(react@19.2.3): + styled-jsx@5.1.6(react@19.2.3): dependencies: client-only: 0.0.1 react: 19.2.3 - optionalDependencies: - '@babel/core': 7.28.6 stylis@4.3.6: {} @@ -13561,7 +13820,7 @@ snapshots: tapable@2.3.0: {} - tar@7.5.11: + tar@7.5.13: dependencies: '@isaacs/fs-minipass': 4.0.1 chownr: 3.0.0