JaimeJunr/claude-code-frontend-skills / plugins/hyperframes/skills/media-use
media-use
VerifiedGet or make any media for a HyperFrames video - music, sound effects, images, icons, logos, voiceover, avatar and generated video, transcripts, cutouts, colour grades and looks - with HeyGen or free local tools, and mix placed audio. Also for footage that looks dark, flat or dull, or should be stylized or hidden.
scripts/transcribe.test.mjs
View on GitHubimport assert from "node:assert/strict";
import { execFileSync, spawnSync } from "node:child_process";
import {
chmodSync,
existsSync,
mkdirSync,
mkdtempSync,
readFileSync,
realpathSync,
rmSync,
writeFileSync,
} from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";
// The stub stands in for the `hyperframes` CLI the caller hands over in HYPERFRAMES_CLI_ENTRY,
// run as `transcribe <in> --dir <dir> ...`: it records its args, writes the CLI's flat array and
// prints the CLI's --json line naming `cliEngine`.
// fails without the fix: parakeet-mlx started in the project, and it reads the default model id
// mlx-community/parakeet-tdt-0.6b-v3 as a folder when the working directory has one.
test(
"parakeet-mlx starts in the home folder; a ./ model path still means the caller's folder",
{ skip: process.platform === "win32" ? "the stand-in runner is an sh script" : false },
() => {
const root = mkdtempSync(join(tmpdir(), "media-use-parakeet-cwd-"));
try {
const home = join(root, "home");
const project = join(root, "project");
mkdirSync(home);
mkdirSync(join(project, "mlx-community", "parakeet-tdt-0.6b-v3"), { recursive: true });
const runner = join(root, "parakeet-mlx");
const record = join(root, "record");
writeFileSync(
runner,
`#!/bin/sh\nprintf '%s\\n' "$PWD" "$3" > "${record}"\n` +
`printf '{"text":"a","sentences":[]}' > "$7/in.json"\n`,
);
chmodSync(runner, 0o755);
writeFileSync(join(project, "in.wav"), "");
const script = fileURLToPath(new URL("./transcribe.mjs", import.meta.url));
const run = (extra = [], parakeet = runner) => {
execFileSync(
process.execPath,
[script, "--input", "in.wav", "--engine", "parakeet", ...extra],
{
cwd: project,
encoding: "utf8",
env: {
...process.env,
HOME: home,
HYPERFRAMES_PARAKEET: parakeet,
HYPERFRAMES_MEDIA_HOME: join(root, "media"),
HYPERFRAMES_NO_TELEMETRY: "1",
},
},
);
return readFileSync(record, "utf8").trimEnd().split("\n");
};
assert.deepEqual(run(), [realpathSync(home), "mlx-community/parakeet-tdt-0.6b-v3"]);
assert.deepEqual(run(["--model", "./models/mine"]), [
realpathSync(home),
join(realpathSync(project), "models", "mine"),
]);
// A runner override written relative to the project still names the project's copy.
writeFileSync(join(project, "parakeet-mlx"), readFileSync(runner));
chmodSync(join(project, "parakeet-mlx"), 0o755);
rmSync(runner);
assert.deepEqual(run([], "./parakeet-mlx"), [
realpathSync(home),
"mlx-community/parakeet-tdt-0.6b-v3",
]);
} finally {
rmSync(root, { recursive: true, force: true });
}
},
);
function runScript(engine, cliEngine) {
const root = mkdtempSync(join(tmpdir(), "media-use-transcribe-"));
try {
const cli = join(root, "cli.mjs");
writeFileSync(
cli,
`import { writeFileSync } from "node:fs";\nconst a = process.argv.slice(2);\n` +
`writeFileSync(${JSON.stringify(join(root, "args"))}, a.join(" "));\n` +
`writeFileSync(a[a.indexOf("--dir") + 1] + "/transcript.json", ` +
`'[{"text":"a","start":0,"end":1},{"text":"b","start":1,"end":2}]');\n` +
`console.log('{"ok":true,"engine":"${cliEngine}"}');\n`,
);
const input = join(root, "in.wav");
writeFileSync(input, "");
const script = fileURLToPath(new URL("./transcribe.mjs", import.meta.url));
const env = { ...process.env, HYPERFRAMES_CLI_ENTRY: cli, HOME: root };
delete env.HYPERFRAMES_PARAKEET;
const out = execFileSync(
process.execPath,
[script, "--input", input, "--engine", engine, "--json"],
{
encoding: "utf8",
env: { ...env, HYPERFRAMES_MEDIA_HOME: join(root, "home"), HYPERFRAMES_NO_TELEMETRY: "1" },
},
);
return { result: JSON.parse(out.trim()), args: readFileSync(join(root, "args"), "utf8") };
} finally {
rmSync(root, { recursive: true, force: true });
}
}
test(
"--engine whisper makes the CLI run whisper and reports the flat transcript's word count",
{ skip: process.platform === "win32" },
() => {
const { result, args } = runScript("whisper", "whisper");
assert.match(args, /--engine whisper --json/);
assert.equal(result.words, 2);
assert.equal(result.engine, "whisper");
},
);
test(
"auto reports the engine the CLI says it ran, Parakeet included",
{ skip: process.platform === "win32" },
() => {
const { result, args } = runScript("auto", "parakeet");
assert.match(args, /--engine auto --json/);
assert.equal(result.engine, "parakeet");
},
);
test(
"--engine parakeet without parakeet-mlx asks the CLI for its Parakeet",
{ skip: process.platform === "win32" },
() => {
const { result, args } = runScript("parakeet", "parakeet");
assert.match(args, /--engine parakeet --json/);
assert.equal(result.engine, "parakeet");
},
);
test(
"a failed --engine parakeet run reports the reason the CLI printed on stdout",
{ skip: process.platform === "win32" },
() => {
const root = mkdtempSync(join(tmpdir(), "media-use-transcribe-"));
try {
const bin = join(root, "bin");
mkdirSync(bin);
const reason =
"Parakeet is not installed. Install it with: hyperframes models install parakeet";
const cli = join(bin, "cli.mjs");
writeFileSync(cli, `console.log('{"ok":false,"error":"${reason}"}');\nprocess.exit(1);\n`);
const input = join(root, "in.wav");
writeFileSync(input, "");
const script = fileURLToPath(new URL("./transcribe.mjs", import.meta.url));
const res = spawnSync(
process.execPath,
[script, "--input", input, "--engine", "parakeet", "--json"],
{
encoding: "utf8",
env: {
...process.env,
HYPERFRAMES_PARAKEET: "",
HYPERFRAMES_CLI_ENTRY: cli,
HOME: root,
HYPERFRAMES_MEDIA_HOME: join(root, "home"),
HYPERFRAMES_NO_TELEMETRY: "1",
},
},
);
assert.equal(res.status, 1);
assert.match(JSON.parse(res.stdout.trim()).error, /hyperframes models install parakeet/);
} finally {
rmSync(root, { recursive: true, force: true });
}
},
);
test(
"without a handed-over CLI it fails with the fix instead of running npx in the project",
{ skip: process.platform === "win32" },
() => {
const root = mkdtempSync(join(tmpdir(), "media-use-transcribe-"));
try {
const bin = join(root, "bin");
mkdirSync(bin);
const marker = join(root, "npx-ran");
writeFileSync(join(bin, "npx"), `#!/bin/sh\ntouch "${marker}"\n`);
chmodSync(join(bin, "npx"), 0o755);
const input = join(root, "in.wav");
writeFileSync(input, "");
const script = fileURLToPath(new URL("./transcribe.mjs", import.meta.url));
const env = {
...process.env,
PATH: `${bin}:${process.env.PATH}`,
HOME: root,
HYPERFRAMES_MEDIA_HOME: join(root, "home"),
HYPERFRAMES_NO_TELEMETRY: "1",
};
delete env.HYPERFRAMES_PARAKEET;
delete env.HYPERFRAMES_CLI_ENTRY;
const res = spawnSync(
process.execPath,
[script, "--input", input, "--engine", "whisper", "--json"],
{ cwd: root, encoding: "utf8", env },
);
assert.equal(res.status, 1);
assert.match(JSON.parse(res.stdout.trim()).error, /HYPERFRAMES_CLI_ENTRY/);
assert.equal(existsSync(marker), false);
} finally {
rmSync(root, { recursive: true, force: true });
}
},
);
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |