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.

merge: absorb SVS closing-text fix into recipe

kashorin6314a9e79e26
diff --cc packages/recipe/test/source-closure.test.ts
index 97449900,9273ac41..f93800fa
--- a/packages/recipe/test/source-closure.test.ts
+++ b/packages/recipe/test/source-closure.test.ts
@@@ -313,26 -313,17 +313,33 @@@ test("quoted Recipe values may contain
assert.equal(sheet.recipes[0]?.value.properties.text, "first; second } /* literal */");
});
-test("quoted Recipe text may contain a sheet closing tag", () => {
- const prompt = "Show a literal </sheet> tag in the output";
- const source = `<sheet version="1">demo.prompt { text: ${formatSvsValue(prompt)}; }</sheet>`;
- const sheet = parseSvs("prompt.svs", source);
- assert.equal(sheet.recipes[0]?.value.properties.text, prompt);
- assert.throws(() => parseSvs("trailing.svs", `${source} extra`),
- (error: unknown) => error instanceof SvsSyntaxError && error.code === "SVS_TRAILING");
- assert.throws(() => parseSvs("twice.svs", `${source}</sheet>`),
- (error: unknown) => error instanceof SvsSyntaxError && error.code === "SVS_TRAILING");
- assert.throws(() => parseSvs("unclosed.svs", source.replace(/<\/sheet>$/u, "")),
- (error: unknown) => error instanceof SvsSyntaxError && error.code === "SVS_ROOT_UNCLOSED");
+test("quoted Recipe values may contain the sheet closing text without ending the document", () => {
+ const sheet = parseRecipe(
+ "literal-close.svs",
+ '<sheet version="1">demo.prompt { text: "write </sheet> literally"; }</sheet>',
+ );
+ assert.equal(sheet.recipes[0]?.value.properties.text, "write </sheet> literally");
+ assert.throws(
+ () => parseRecipe(
+ "missing-close.svs",
+ '<sheet version="1">demo.prompt { text: "write </sheet> literally"; }',
+ ),
+ (error: unknown) => error instanceof RecipeSyntaxError && error.code === "SVS_ROOT_UNCLOSED",
+ );
+ assert.throws(
+ () => parseRecipe(
+ "trailing.svs",
+ '<sheet version="1">demo.prompt { text: "write </sheet> literally"; }</sheet> trailing',
+ ),
+ (error: unknown) => error instanceof RecipeSyntaxError && error.code === "SVS_TRAILING",
+ );
++ assert.throws(
++ () => parseRecipe(
++ "second-close.svs",
++ '<sheet version="1">demo.prompt { text: "write </sheet> literally"; }</sheet></sheet>',
++ ),
++ (error: unknown) => error instanceof RecipeSyntaxError && error.code === "SVS_TRAILING",
++ );
});
test("SVS parses and serializes canonical arrays and objects as one Recipe value", () => {
diff --cc packages/text/test/text.test.ts
index e1e848b3,28ed3cf0..2f06d2d5
--- a/packages/text/test/text.test.ts
+++ b/packages/text/test/text.test.ts
@@@ -2,7 -2,7 +2,7 @@@ import assert from "node:assert/strict"
import test from "node:test";
import { parseStructuredElement } from "@hypit/markup";
import type { SurfaceResolvedReference } from "@hypit/markup";
- import { recipeType } from "@hypit/recipe";
-import { formatSvsValue, parseSvs, svsRecipeType } from "@hypit/svs";
++import { formatRecipeValue, parseRecipe, recipeType } from "@hypit/recipe";
import {
bindText,
@@@ -15,9 -15,21 +15,21 @@@
sealTextBindings,
sealTextTemplate,
textTypes,
- textTemplateFromSvsRecipes,
++ textTemplateFromRecipes,
verifyTextTemplate,
} from "@hypit/text";
-test("Text Templates keep a sheet closing tag in prompt text", () => {
++test("Text Templates keep sheet closing text inside authored prompt text", () => {
+ const prompt = "Show the literal </sheet> tag in the video";
+ const source = `<sheet version="1">
+ text-template.demo {}
- text-template.demo.block.example { kind: fixed; order: 0; text: ${formatSvsValue(prompt)}; }
++ text-template.demo.block.example { kind: fixed; order: 0; text: ${formatRecipeValue(prompt)}; }
+ </sheet>`;
- const recipes = parseSvs("template.svs", source).recipes.map((recipe) => recipe.value);
- const template = textTemplateFromSvsRecipes(recipes, "demo");
++ const recipes = parseRecipe("template.svs", source).recipes.map((recipe) => recipe.value);
++ const template = textTemplateFromRecipes(recipes, "demo");
+ assert.equal(renderText(template, sealTextBindings({})).value, prompt);
+ });
+
test("text programs compose nested templates, choices, lists and transforms", () => {
const template = sealTextTemplate({