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.

feat(cli): make installed author vocabulary actionable

kashorin1a61e64fce77
diff --git a/packages/video-cli/src/vocabulary.ts b/packages/video-cli/src/vocabulary.ts
index 16df04c4..d36f2496 100644
--- a/packages/video-cli/src/vocabulary.ts
+++ b/packages/video-cli/src/vocabulary.ts
@@ -9,7 +9,12 @@ import {
visualTextSchema, visualTextTypographySchema, visualTrackSchema, visualVideoSchema,
} from "@hypit/composition";
import { markupSurfaceHostFacetAbi } from "@hypit/markup";
-import type { RegisteredSurface, SurfaceAttributeVocabulary, SurfaceVocabulary } from "@hypit/markup";
+import type {
+ RegisteredSurface,
+ SurfaceAttributeVocabulary,
+ SurfacePortVocabulary,
+ SurfaceVocabulary,
+} from "@hypit/markup";
import { exactModelHostAbi } from "@hypit/model-kit";
import { loadNodePackageSelection, locateNodePackage } from "@hypit/package-loader-node";
import type { NodePackageLoadOptions } from "@hypit/package-loader-node";
@@ -270,10 +275,32 @@ function attributeLine(attribute: SurfaceAttributeVocabulary): string {
return ` ${attribute.name}${attribute.required ? "" : "?"} ${shape} ${attribute.summary}`;
}
+function moduleSpecifier(surface: SurfaceListing): string {
+ return `${surface.module.name}@${surface.module.version}`;
+}
+
+function sourceImport(surface: SurfaceListing, vocabulary: SurfaceVocabulary): string {
+ const prefixedTag = vocabulary.example.match(/<([A-Za-z_][A-Za-z0-9_.-]*):([A-Za-z_][A-Za-z0-9_.-]*)\b/u);
+ const alias = prefixedTag?.[2] === surface.tag ? prefixedTag[1] : undefined;
+ return alias === undefined
+ ? `<import from="${moduleSpecifier(surface)}"/>`
+ : `<import as="${alias}" from="${moduleSpecifier(surface)}"/>`;
+}
+
+function portLine(port: SurfacePortVocabulary): string {
+ const type = `${port.type.name} (${port.type.module.name}@${port.type.module.version})`;
+ return ` ${port.name} ${type} ${port.summary}`;
+}
+
function surfaceText(surface: SurfaceListing): string {
const vocabulary = surface.vocabulary as SurfaceVocabulary | undefined;
- const lines = [` <${surface.tag}> ${surface.mode} from ${surface.package}`];
+ const lines = [
+ ` <${surface.tag}> ${surface.mode}`,
+ ` package ${surface.package}`,
+ ` module ${moduleSpecifier(surface)}`,
+ ];
if (vocabulary !== undefined) {
+ lines.push(` import ${sourceImport(surface, vocabulary)}`);
lines.push(` ${vocabulary.summary}`);
if (vocabulary.appearance !== undefined) lines.push(` ${vocabulary.appearance}`);
if (vocabulary.attributes.length > 0) lines.push(" attributes", ...vocabulary.attributes.map(attributeLine));
@@ -281,7 +308,7 @@ function surfaceText(surface: SurfaceListing): string {
lines.push(` child <${child.tag}> (${child.cardinality}) ${child.summary}`, ...(child.attributes ?? []).map(attributeLine));
}
if (vocabulary.ports !== undefined && vocabulary.ports.length > 0) {
- lines.push(" ports", ...vocabulary.ports.map((port) => ` ${JSON.stringify(port)}`));
+ lines.push(" ports", ...vocabulary.ports.map(portLine));
}
lines.push(" example", ...vocabulary.example.split("\n").map((line) => ` ${line}`));
for (const note of vocabulary.notes ?? []) lines.push(` note: ${note}`);
@@ -296,7 +323,7 @@ export function writeVocabularyHelp(io: CliIo): void {
"What a Source may write. Prints installed package manifests; no Runtime Profile, no request, no state.",
"",
" hypit vocabulary every installed package with its tags and models",
- " hypit vocabulary <package…> [--tag <tag>] the Surfaces a package declares: attributes, children, example",
+ " hypit vocabulary <package…> [--tag <tag>] the Surfaces a package declares: module, import, attributes, children, ports, example",
" hypit vocabulary --visual [<shape>] the value shapes and rules a drawing Producer must emit",
"",
"Read the package README the listing names before writing its elements. Add --json for a machine view.",
diff --git a/packages/video-cli/test/vocabulary.test.ts b/packages/video-cli/test/vocabulary.test.ts
index d5f234ee..0234d63e 100644
--- a/packages/video-cli/test/vocabulary.test.ts
+++ b/packages/video-cli/test/vocabulary.test.ts
@@ -64,3 +64,15 @@ test("the command prints human and JSON views", async () => {
await assert.rejects(runVocabularyCli(["vocabulary", "--tag", "x"], io().io, repositoryRoot), /name the package first/);
});
+
+test("the human view distinguishes logical Modules contributed by one physical package", async () => {
+ const human = io();
+ await runVocabularyCli(["vocabulary", "@hypit/gpt-image", "--tag", "Image"], human.io, repositoryRoot);
+ assert.match(human.text(), /package @hypit\/gpt-image/u);
+ assert.match(human.text(), /module @hypit\/gpt-image@1/u);
+ assert.match(human.text(), /import <import as="gpt" from="@hypit\/gpt-image@1"\/>/u);
+ assert.match(human.text(), /module @hypit\/gpt-image\/clean@1/u);
+ assert.match(human.text(), /import <import as="gpt" from="@hypit\/gpt-image\/clean@1"\/>/u);
+ assert.match(human.text(), /image BlobArtifact \(@hypit\/artifact@1\)/u);
+ assert.doesNotMatch(human.text(), /\{"name":"image"/u);
+});
diff --git a/skills/hypit/references/production/authoring.md b/skills/hypit/references/production/authoring.md
index f6f49b8c..89e7d002 100644
--- a/skills/hypit/references/production/authoring.md
+++ b/skills/hypit/references/production/authoring.md
@@ -24,6 +24,28 @@ Author those relationships explicitly. Script Selections and Moments carry meani
speech into real time. Track and Film elements arrange the resulting picture and sound. One Source
carries the whole creative program; its cuts are relationships inside that program.
+When a role first leads to an installed Surface in the current work, query its actual declaration
+before writing the element:
+
+```bash
+hypit vocabulary @hypit/gpt-image --tag Image
+```
+
+Use the logical Module import, tag, attributes, children, ports, and output paths that this project's
+selected installation reports. Query again when the selected package or Distribution has changed, or
+when an error shows that the assumed declaration is no longer the installed one; an already
+established Surface does not need to be rediscovered for every edit. After writing one coherent
+Source or Run change, check that actual entry:
+
+```bash
+hypit check authors/main.svml
+```
+
+`vocabulary` establishes what the selected package declares. `check` resolves the real Source closure
+and verifies its imports, references, types, outputs, and Run choices. `plan` resolves the current
+Run's required capabilities; `hypit doctor` actively diagnoses the selected Profile and account
+reachability. Those are execution questions rather than additional authoring checks.
+
When observation has already produced useful authored data—such as a per-frame region sequence for
placing Caption above a moving head—keep that data in Source or Recipe and pass it through the
component's declared input. It is part of the chosen production design, just like a Frame or Style.
diff --git a/skills/hypit/references/production/vocabulary.md b/skills/hypit/references/production/vocabulary.md
index 0ddce6e1..507342e5 100644
--- a/skills/hypit/references/production/vocabulary.md
+++ b/skills/hypit/references/production/vocabulary.md
@@ -23,10 +23,16 @@ hypit vocabulary @hypit/media-pipeline --tag StillVideo
hypit vocabulary --visual text
```
+Use a focused package and tag query before the first use of an unfamiliar Surface in the current
+production. Query it again when the selected package or Distribution changes, or when `hypit check`
+shows that an assumed declaration is not the installed one. Once the declaration is established in
+the current context, ordinary edits do not require repeating the same query.
+
With no package argument, the command lists every package visible to the current Distribution and
project together with its tags and models. Use that inventory when the role is clear but the owner is
not. A focused package query then reports Surface attributes, children, ports, examples, and designed
-previews. The package README supplies exact behavior that is local to that installed implementation.
+previews, including the logical Module import when one physical package contributes several Modules.
+The package README supplies exact behavior that is local to that installed implementation.
When the question requires more detail, inspect the relevant implementation and exported API. An
existing component can also provide a useful implementation example for a new project package.