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: the environment-gated test scripts stop depending on sh
rponea413b3c5c6e6
diff --git a/docs/guide/testing.md b/docs/guide/testing.mdindex e821b70d..3e01c4da 100644--- a/docs/guide/testing.md+++ b/docs/guide/testing.md@@ -90,7 +90,7 @@ explicitly opt-in, use no committed secret and fail before spending money unless| Command | What it tests | Prerequisites ||---|---|---|| `pnpm test:whisperx-service` | Python WhisperX service | Python 3.13, uv, frozen sync |-| `pnpm test:image-opencv` | the shared OpenCV Raster interpreter across both request variants | `HYPIT_OPENCV_TESTS=1`, `HYPIT_OPENCV_PYTHON` |+| `pnpm test:image-opencv` | the shared OpenCV Raster interpreter across both request variants | the service's own interpreter at `services/image-opencv/.venv`; set `HYPIT_OPENCV_PYTHON` to use another || `pnpm test:browser-visual` | rendered geometry, stacking and clipping in a real browser | a Chrome the HyperFrames CLI can start, `ffmpeg`, and `HYPIT_TEST_FONT_PATH` off macOS || `pnpm smoke:kie` | Live paid KIE generation | `KIE_API_KEY` |diff --git a/docs/zh/guide/testing.md b/docs/zh/guide/testing.mdindex a8799d35..9dff4416 100644--- a/docs/zh/guide/testing.md+++ b/docs/zh/guide/testing.md@@ -79,7 +79,7 @@ test("generates a video", async (t) => {| 命令 | 测试内容 | 前置条件 ||---|---|---|| `pnpm test:whisperx-service` | Python WhisperX 服务 | Python 3.13、uv、frozen sync |-| `pnpm test:image-opencv` | OpenCV 图像变换 | `HYPIT_OPENCV_TESTS=1`、`HYPIT_OPENCV_PYTHON` |+| `pnpm test:image-opencv` | OpenCV 图像变换 | 服务自带的解释器,位于 `services/image-opencv/.venv`;要用别的解释器就设 `HYPIT_OPENCV_PYTHON` || `pnpm test:browser-visual` | 真实浏览器中的渲染几何、层叠与裁剪 | HyperFrames CLI 能启动的 Chrome、`ffmpeg`;非 macOS 还需 `HYPIT_TEST_FONT_PATH` || `pnpm smoke:kie` | 实时付费的 KIE 生成 | `KIE_API_KEY` |diff --git a/package.json b/package.jsonindex 4e50c1ae..c6b746b4 100644--- a/package.json+++ b/package.json@@ -15,9 +15,9 @@"docs:preview": "vitepress preview docs","test": "node test/run.mjs","test:release": "node --import tsx --test test/repository-hygiene.test.mjs",- "test:whisperx-service": "uv run --project services/whisperx --frozen python -m unittest discover -s services/whisperx/tests -p 'test_*.py'",- "test:browser-visual": "HYPIT_BROWSER_TESTS=1 node --import tsx --test packages/hyperframes/test/browser-visual.test.ts",- "test:image-opencv": "HYPIT_OPENCV_TESTS=1 HYPIT_OPENCV_PYTHON=services/image-opencv/.venv/bin/python node --import tsx --test packages/provider-image-opencv-local/test/provider.test.ts",+ "test:whisperx-service": "uv run --project services/whisperx --frozen python -m unittest discover -s services/whisperx/tests -p \"test_*.py\"",+ "test:browser-visual": "node test/run.mjs browser-visual",+ "test:image-opencv": "node test/run.mjs image-opencv","smoke:kie": "node --import tsx packages/provider-kie/test/live-smoke.ts","hypit": "node bin/hypit.mjs","caption:playground": "pnpm --filter @hypit/caption-playground exec node --import tsx start.ts",diff --git a/test/run.mjs b/test/run.mjsindex 7efbb3e4..2171f29e 100644--- a/test/run.mjs+++ b/test/run.mjs@@ -1,17 +1,23 @@/**- * Run the repository's test suite.+ * Run one of the repository's test suites.*- * This exists because a glob in a package script passes through a shell, and which shell is not- * the same everywhere: pnpm hands the script body to `/bin/sh` on POSIX and to `cmd.exe` on- * Windows. `cmd.exe` neither strips the quotes nor expands the pattern, so patterns written for- * `sh` arrive at `node --test` as literal text and match nothing.+ * This exists because a package script passes through a shell, and which shell is not the same+ * everywhere: pnpm hands the script body to `/bin/sh` on POSIX and to `cmd.exe` on Windows. What+ * `sh` reads as syntax, `cmd.exe` reads as text. A quoted glob arrives with its quotes still+ * attached and matches nothing; a leading `VAR=1` is looked up as the name of a program to run.** Matching nothing is the dangerous half. `node --test` reports "tests 0" and exits 0, so a suite- * that ran not one test is indistinguishable from a suite that passed. Expanding the patterns here- * takes the shell out of the question, and gives the count somewhere to be checked.+ * that ran not one test is indistinguishable from a suite that passed. Deciding the files and the+ * environment here takes the shell out of the question, and gives the count somewhere to be+ * checked.+ *+ * node test/run.mjs every unit test+ * node test/run.mjs browser-visual the browser suite, which needs a browser and ffmpeg+ * node test/run.mjs image-opencv the OpenCV suite, which needs the service's interpreter*/import { spawnSync } from "node:child_process";import { globSync } from "node:fs";+import { join } from "node:path";const patterns = ["packages/*/test/**/*.test.ts",@@ -24,16 +30,56 @@ const patterns = [/** A suite that ran nothing is not a suite that passed. Today the patterns find 104. */const minimumFiles = 100;-const files = [...new Set(patterns.flatMap((pattern) => globSync(pattern)))].sort();-if (files.length < minimumFiles) {- console.error(`expected at least ${minimumFiles} test files, found ${files.length}:`);- for (const pattern of patterns) console.error(` ${pattern} matched ${globSync(pattern).length}`);- process.exit(1);+/**+ * The venv layout Python chose for this platform.+ *+ * `provider-image-opencv-local` already branches on this to find the interpreter it manages; the+ * script that runs its tests used to spell the POSIX half and only that.+ */+function managedPython(project) {+ return process.platform === "win32"+ ? join(project, ".venv", "Scripts", "python.exe")+ : join(project, ".venv", "bin", "python");+}++const suites = {+ "browser-visual": {+ files: ["packages/hyperframes/test/browser-visual.test.ts"],+ env: { HYPIT_BROWSER_TESTS: "1" },+ },+ "image-opencv": {+ files: ["packages/provider-image-opencv-local/test/provider.test.ts"],+ env: {+ HYPIT_OPENCV_TESTS: "1",+ HYPIT_OPENCV_PYTHON: managedPython("services/image-opencv"),+ },+ },+};++const name = process.argv[2];+if (name !== undefined && !Object.hasOwn(suites, name)) {+ console.error(`unknown suite ${name}; expected one of ${Object.keys(suites).join(", ")}`);+ process.exit(2);+}++const suite = name === undefined ? undefined : suites[name];+let files;+if (suite === undefined) {+ files = [...new Set(patterns.flatMap((pattern) => globSync(pattern)))].sort();+ if (files.length < minimumFiles) {+ console.error(`expected at least ${minimumFiles} test files, found ${files.length}:`);+ for (const pattern of patterns) console.error(` ${pattern} matched ${globSync(pattern).length}`);+ process.exit(1);+ }+} else {+ files = suite.files;}const result = spawnSync(process.execPath, ["--import", "tsx", "--test", ...files], {stdio: "inherit",windowsHide: true,+ // What the caller already chose wins: these are defaults for running the suite, not a policy.+ env: { ...suite?.env, ...process.env },});if (result.error !== undefined) throw result.error;process.exit(result.status ?? 1);