Skip to content

armgit / hypit

Public Imported from GitHub
0

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.

chore(results): drop unpublished layout migration

kashorin3a922ad578fd
diff --git a/bin/hypit-migrate-flat-results.mjs b/bin/hypit-migrate-flat-results.mjs
deleted file mode 100755
index bc475959..00000000
--- a/bin/hypit-migrate-flat-results.mjs
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env node
-
-import { dirname, resolve } from "node:path";
-import { fileURLToPath } from "node:url";
-import { register } from "tsx/esm/api";
-
-const args = process.argv.slice(2);
-if (args.length === 1 && ["--help", "-h"].includes(args[0])) {
- console.log("usage: hypit-migrate-flat-results <result-root>");
- process.exit(0);
-}
-if (args.length !== 1) {
- console.error("usage: hypit-migrate-flat-results <result-root>");
- process.exit(2);
-}
-
-register();
-const distributionRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
-const { installDistributionPackageResolution } = await import(
- "../packages/package-loader-node/src/distribution-resolution.ts"
-);
-installDistributionPackageResolution([distributionRoot]);
-const { migrateFlatBuildResults } = await import("../packages/build-result-fs/src/migrate.ts");
-const root = resolve(args[0]);
-try {
- const moved = await migrateFlatBuildResults(root);
- console.log(`moved ${moved.length} flat Build Result${moved.length === 1 ? "" : "s"} under ${root}`);
-} catch (error) {
- console.error(error instanceof Error ? error.message : String(error));
- process.exitCode = 1;
-}
diff --git a/package.json b/package.json
index 230a1fe2..d52f9b8c 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,6 @@
"type": "module",
"bin": {
"hypit": "./bin/hypit.mjs",
- "hypit-migrate-flat-results": "./bin/hypit-migrate-flat-results.mjs",
"hypit-studio": "./bin/hypit-studio.mjs",
"hypit-preview-check": "./bin/hypit-preview-check.mjs",
"hypit-reference-video-tools": "./packages/reference-video-tools/bin/reference-video-tools.mjs"
diff --git a/packages/build-result-fs/README.md b/packages/build-result-fs/README.md
index 14103c44..25891f88 100644
--- a/packages/build-result-fs/README.md
+++ b/packages/build-result-fs/README.md
@@ -27,12 +27,3 @@ project-wide history database. Browsing sorts the shallow date buckets and enume
only inside the dates reached while filling the requested cursor page; only those Result manifests are
opened. File reads support byte ranges. Active diagnosis checks the selected directory (or its nearest
existing parent) for read/write access without creating a probe file.
-
-Development checkouts that still contain the former flat `<result-root>/<build-id>` layout can move
-those Results explicitly:
-
-```bash
-hypit-migrate-flat-results /absolute/path/to/.hypit/results
-```
-
-Normal repository reads never invoke this migration and never fall back to the flat layout.
diff --git a/packages/build-result-fs/src/migrate.ts b/packages/build-result-fs/src/migrate.ts
deleted file mode 100644
index 96169b59..00000000
--- a/packages/build-result-fs/src/migrate.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { mkdir, readdir, rename, stat } from "node:fs/promises";
-import { dirname, join, resolve } from "node:path";
-
-import { buildResultDirectory, readBuildResult } from "@hypit/build-result";
-
-function assert(condition: unknown, message: string): asserts condition {
- if (!condition) throw new Error(message);
-}
-
-async function exists(path: string): Promise<boolean> {
- return await stat(path).then(() => true, (error: unknown) => {
- if (error instanceof Error && "code" in error && error.code === "ENOENT") return false;
- throw error;
- });
-}
-
-/** Move current-format Results from the former flat layout into their Build-id date buckets. */
-export async function migrateFlatBuildResults(root: string): Promise<readonly string[]> {
- const directory = resolve(root);
- const entries = await readdir(directory, { withFileTypes: true }).catch((error: unknown) => {
- if (error instanceof Error && "code" in error && error.code === "ENOENT") return [];
- throw error;
- });
- const moves: Array<{ readonly build: string; readonly source: string; readonly destination: string }> = [];
- for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
- if (!entry.isDirectory()) continue;
- let destination: string;
- try {
- destination = buildResultDirectory(directory, entry.name);
- } catch {
- continue;
- }
- const source = join(directory, entry.name);
- assert(await readBuildResult(source) !== undefined,
- `${source} is named like a Build but has no Result manifest`);
- assert(!await exists(destination),
- `Build Result ${entry.name} already exists at ${destination}`);
- moves.push({ build: entry.name, source, destination });
- }
- for (const move of moves) {
- await mkdir(dirname(move.destination), { recursive: true });
- await rename(move.source, move.destination);
- }
- return moves.map((move) => move.build);
-}
diff --git a/packages/build-result-fs/test/migrate.test.ts b/packages/build-result-fs/test/migrate.test.ts
deleted file mode 100644
index 1b06cd35..00000000
--- a/packages/build-result-fs/test/migrate.test.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import assert from "node:assert/strict";
-import { mkdir, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
-import { tmpdir } from "node:os";
-import { join } from "node:path";
-import test from "node:test";
-
-import { buildResultDirectory, FileBuildResultRepository } from "@hypit/build-result";
-
-import { migrateFlatBuildResults } from "../src/migrate.js";
-
-test("the explicit filesystem migration moves one flat Result into its date bucket", async () => {
- const root = await mkdtemp(join(tmpdir(), "hypit-flat-result-migration-"));
- const build = "bld_20260902T100000000Z_0000000001";
- const flat = join(root, build);
- try {
- await mkdir(flat);
- await writeFile(join(flat, "result.json"), `${JSON.stringify({
- format: "hypit.build-result@2",
- source: { path: "main.svml" },
- targets: [],
- outcome: "complete",
- finishedAt: 1,
- outputs: {},
- })}\n`);
-
- assert.deepEqual(await migrateFlatBuildResults(root), [build]);
- assert.equal(await stat(flat).then(() => true, () => false), false);
- assert.equal(JSON.parse(await readFile(join(buildResultDirectory(root, build), "result.json"), "utf8")).format,
- "hypit.build-result@2");
- assert.equal((await new FileBuildResultRepository(root).read(build))?.id, build);
- assert.deepEqual(await migrateFlatBuildResults(root), []);
- } finally {
- await rm(root, { recursive: true, force: true });
- }
-});