nexu-io/openmotion / library/skills/openmotion-design-remix
openmotion-design-remix
VerifiedOpenMotion — Adapt one of six bundled motion compositions using its MOTION_DESIGN.md, preserving timing and movement while replacing the user's copy. Use for these source-backed examples or as a concrete pattern for a reusable motion design package.
scripts/materialize.mjs
View on GitHubimport assert from 'node:assert/strict';
import { cp, mkdir, readFile, readdir, writeFile, lstat, rm } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { createHash } from 'node:crypto';
import path from 'node:path';
import { localize } from './localize.mjs';
// A source-copy helper for this example pack, not a MOTION_DESIGN.md interpreter.
const root = fileURLToPath(new URL('../', import.meta.url));
const [id, variant, destination, customPreset] = process.argv.slice(2);
const catalog = JSON.parse(await readFile(path.join(root, 'sources.json'), 'utf8'));
assert(catalog.items.some(item => item.id === id), 'Choose an ID from sources.json');
assert(['reference', 'remix'].includes(variant), 'Choose reference or remix');
assert(destination, 'Usage: node scripts/materialize.mjs <id> <reference|remix> <new-output-dir> [preset.json]');
const output = path.resolve(destination);
assert(!output.startsWith(root), 'Keep generated projects outside the Skill package');
const presetPath = customPreset ? path.resolve(customPreset) : path.join(root, 'presets', id + '.json');
const preset = JSON.parse(await readFile(presetPath, 'utf8'));
assert.equal(preset.id, id, 'Preset must belong to this source');
let html = await readFile(path.join(root, 'assets', id, 'index.html'), 'utf8');
const sourceSha256 = createHash('sha256').update(html).digest('hex');
assert.equal(sourceSha256, preset.sourceSha256, 'Source changed; review the preset against the new revision');
if (variant === 'remix') {
for (const edit of preset.replacements) {
assert(typeof edit.from === 'string' && edit.from.length > 0 && typeof edit.to === 'string');
assert(Number.isSafeInteger(edit.count) && edit.count > 0);
assert.equal(html.split(edit.from).length - 1, edit.count, 'Replacement count changed: ' + edit.from);
html = html.split(edit.from).join(edit.to);
}
}
html = localize(html);
// Refuse existing files, directories and symlinks. Never overwrite a previous project.
await assert.rejects(lstat(output), { code: 'ENOENT' }, 'Output already exists; choose a new directory');
await mkdir(path.dirname(output), { recursive: true });
await mkdir(output);
try {
for (const entry of await readdir(path.join(root, 'assets', id))) {
await cp(path.join(root, 'assets', id, entry), path.join(output, entry), { recursive: true, force: false, errorOnExist: true });
}
await cp(path.join(root, 'vendor'), path.join(output, 'vendor'), { recursive: true, force: false, errorOnExist: true });
await writeFile(path.join(output, 'index.html'), html);
await cp(path.join(root, 'LICENSE'), path.join(output, 'LICENSE'));
const item = catalog.items.find(item => item.id === id);
await writeFile(path.join(output, 'NOTICE.md'), `# Source and runtime notes\n\nSource: ${item.upstream}\n\nHeyGen Hyperframes source: Apache-2.0 (LICENSE). OpenMotion adds the remix instructions and content preset. Preserve any font licenses in assets/. Original upstream marks remain reference artwork. Browser scripts and fonts are included in vendor/ with checksums and their own licenses; WebGL is required. Node, browser and media tools are installed separately. Displayed code and statistics are illustrative, not product APIs or metrics.\n`);
const design = (await readFile(path.join(root, 'references', id, 'MOTION_DESIGN.md'), 'utf8'))
.replaceAll(`../../assets/${id}/index.html`, 'index.html')
.replaceAll(`../../presets/${id}.json`, 'remix-record.json')
.replaceAll(`../../assets/${id}/reference.mp4`, 'reference.mp4')
.replace('[Pack instructions](../../SKILL.md) · ', '')
.replaceAll('../../NOTICE.md', 'NOTICE.md')
.replace("See the pack's evidence manifest for checks actually completed.", 'Record the checks for this new project separately; previous preview evidence does not cover subsequent edits.');
await writeFile(path.join(output, 'MOTION_DESIGN.md'), design);
await writeFile(path.join(output, 'remix-record.json'), JSON.stringify({ id, variant, upstreamCommit: catalog.upstreamCommit, sourceSha256, outputSha256: createHash('sha256').update(html).digest('hex'), preset }, null, 2) + '\n');
console.log(JSON.stringify({ output, id, variant, entry: 'index.html' }));
} catch (error) {
await rm(output, { recursive: true, force: true });
throw error;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |