Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.
TypeScript agent-skillsanimationcanvasclaude-codeclaude-pluginclaude-skillscodex-plugincreative-codecreative-codingcreative-toolsdeterministicgenerative-arthand-drawnillustrationlaunch-videomotion-designmotion-graphicspluginprocedural-generationskill
chore: sync the plugin mirror
Alex Greenshpun6cdc7b6715e7
diff --git a/plugins/anidoodle/.claude-plugin/plugin.json b/plugins/anidoodle/.claude-plugin/plugin.jsonindex a815201..77ef15a 100644--- a/plugins/anidoodle/.claude-plugin/plugin.json+++ b/plugins/anidoodle/.claude-plugin/plugin.json@@ -2,7 +2,7 @@"name": "anidoodle","displayName": "anidoodle","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",- "version": "0.6.2",+ "version": "0.6.3","icon": "./assets/icon.png","author": {"name": "Alex Greenshpun",diff --git a/plugins/anidoodle/.codex-plugin/plugin.json b/plugins/anidoodle/.codex-plugin/plugin.jsonindex 31184b7..bd2cbb0 100644--- a/plugins/anidoodle/.codex-plugin/plugin.json+++ b/plugins/anidoodle/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "anidoodle",- "version": "0.6.2",+ "version": "0.6.3","description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.","skills": "./skills/","interface": {diff --git a/plugins/anidoodle/skills/anidoodle/engine/package.json b/plugins/anidoodle/skills/anidoodle/engine/package.jsonindex c69800a..08d287f 100644--- a/plugins/anidoodle/skills/anidoodle/engine/package.json+++ b/plugins/anidoodle/skills/anidoodle/engine/package.json@@ -1,6 +1,6 @@{"name": "anidoodle-engine",- "version": "0.6.2",+ "version": "0.6.3","private": true,"type": "module","description": "Portable art core + backend adapters for illustrations, animations and films drawn entirely in code.",diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/audio.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/audio.mjsindex 13e8713..cacb998 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/audio.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/audio.mjs@@ -1,12 +1,11 @@// Interleaved stereo Float32 transport stays unclipped until the final AAC encoder.import { build } from 'esbuild';import { writeFileSync } from 'node:fs';-import { resolve } from 'node:path';-import { pathToFileURL } from 'node:url';import { overlay } from './overlay.mjs';import { splitShape, requireFilm } from './names.mjs';import { loadBanks, soundIds, printSounds, soundsNotice } from './sounds.mjs';import { soundsDir } from './soundfetch.mjs';+import { isMain } from "./is-main.mjs";let filmModuleId = 0;/** Film and music registry share one bundle, so its audio closure sees the loaded banks. */@@ -47,7 +46,7 @@ export const float32Wav = ({ sampleRate, frames, float32 }) => {h.write("data", 36); h.writeUInt32LE(pcm.length, 40);return Buffer.concat([h, pcm]);};-if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {+if (isMain(import.meta.url)) {const title = requireFilm(process.argv[2], 'audio', 'node tools/audio.mjs <film> <out.wav>');if (!process.argv[3]) throw new Error('audio needs an output WAV path');const { film, music } = await loadFilmModule(title);diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/build-page.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/build-page.mjsindex 15900ab..0fbcce2 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/build-page.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/build-page.mjs@@ -7,6 +7,7 @@ import { extname, join, relative, resolve } from "node:path";import { overlay, resolveOverlay } from "./overlay.mjs";import { requireFilm, splitShape } from "./names.mjs";import { loadFilmModule, prepareFilmSounds, filmFloat32 } from './audio.mjs';+import { isMain } from "./is-main.mjs";// BAKE KEYS (see Env.bake and hosts/page.ts). Every module that exports `const X: Film` is tagged// in the bundle with its own path, and each tagged module gets a hash of its WHOLE import closure@@ -65,4 +66,4 @@ export const buildPage = async ({ entry, out, title, plugins: extra = [] }) => {const meta = film.meta;return { out, bytes: html.length, meta, assets: Object.keys(film.assets.images) };};-if (import.meta.url === `file://${process.argv[1]}`) { const title = requireFilm(process.argv[2], "build-page", "node tools/build-page.mjs <film>"); const r = await buildPage({ entry: `src/hosts/page-${title}.ts`, out: `dist/${title}.html`, title }); console.log(`built ${r.out} (${(r.bytes / 1024).toFixed(0)} KB, self-contained)`); }+if (isMain(import.meta.url)) { const title = requireFilm(process.argv[2], "build-page", "node tools/build-page.mjs <film>"); const r = await buildPage({ entry: `src/hosts/page-${title}.ts`, out: `dist/${title}.html`, title }); console.log(`built ${r.out} (${(r.bytes / 1024).toFixed(0)} KB, self-contained)`); }diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/captions.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/captions.mjsindex 0af1eb0..7b942d4 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/captions.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/captions.mjs@@ -10,6 +10,7 @@ import { dirname, resolve } from "node:path";import { overlay } from "./overlay.mjs";import { requireFilm, splitShape } from "./names.mjs";import { toSrt, toVtt } from "./avsync.mjs";+import { isMain } from "./is-main.mjs";export const filmMeta = async (name) => {const { base, shape } = splitShape(name);@@ -25,7 +26,7 @@ export const writeCaptions = async (name, out = `out/${name}`) => {writeFileSync(srt, toSrt(caps, meta.fps)); writeFileSync(vtt, toVtt(caps, meta.fps));return { count: caps.length, files: [srt, vtt] };};-if (import.meta.url === `file://${process.argv[1]}`) {+if (isMain(import.meta.url)) {const name = requireFilm(process.argv[2], "captions", "node tools/captions.mjs <film>[-<shape>] [--out out/<film>]");const i = process.argv.indexOf("--out"), r = await writeCaptions(name, i > 0 ? process.argv[i + 1] : undefined);if (!r.count) { console.error(`captions: ${name} has no meta.captions (a launch template film writes them; add your own to meta.captions)`); process.exit(1); }diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjsindex 7288187..c48481f 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjs@@ -10,9 +10,12 @@// node tools/deck.mjs test # the deck and the dealer hold their own rules// Weights: role (workhorse 3, accent 2, signature 1) x energy fit (same 1, "any" 0.7, other 0.25).// A deal has one opening, one close, at most one signature card, and no card twice.-import { existsSync, readFileSync, readdirSync } from "node:fs";+import { execFileSync, spawnSync } from "node:child_process";+import { mkdtempSync, readFileSync, readdirSync, rmSync, symlinkSync } from "node:fs";+import { tmpdir } from "node:os";import { dirname, join } from "node:path";import { fileURLToPath } from "node:url";+import { isMain } from "./is-main.mjs";const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", ".."), DECK = JSON.parse(readFileSync(join(ROOT, "references", "motion-deck.json"), "utf8"));const CATS = ["open", "seam", "camera", "reveal", "type", "acting", "emphasis", "close"], MIDDLE = CATS.filter((c) => c !== "open" && c !== "close");@@ -64,10 +67,19 @@ const selfTest = () => {const tally = (energy) => { let hi = 0, n = 0; for (let s = 1; s <= 400; s++) for (const m of deal({ kind: "story", energy, seconds: 30, seed: s })) { n++; if (m.energy === "high") hi++; } return hi / n; };say(tally("high") > tally("calm") * 1.5, `a high-energy film is dealt more high-energy cards than a calm one (${(tally("high") * 100).toFixed(0)}% against ${(tally("calm") * 100).toFixed(0)}%)`);say(deal({ cat: "seam", n: 3, kind: "launch", seed: 3 }).every((m) => m.cat === "seam") && deal({ cat: "seam", n: 3, seed: 3 }).length === 3, "--cat deals from one category only");+ // run through a link, as an installed skill is: the tool must still know it is the one being run+ { const dir = mkdtempSync(join(tmpdir(), "deck-")), link = join(dir, "engine"); let out = "";+ const quiet = [];+ try { symlinkSync(join(ROOT, "engine"), link, "dir"); out = execFileSync(process.execPath, [join(link, "tools", "deck.mjs"), "deal", "--seed", "3", "--kind", "story"], { encoding: "utf8" });+ // every tool that can also be imported by another must still answer when it is the one being run+ for (const t of ["registry", "popscan", "captions", "audio", "build-page", "soundpack"]) { const r = spawnSync(process.execPath, [join(link, "tools", `${t}.mjs`)], { encoding: "utf8", cwd: link }); if (!`${r.stdout}${r.stderr}`.trim()) quiet.push(t); }+ } catch (e) { out = `failed: ${e.message}`; } finally { rmSync(dir, { recursive: true, force: true }); }+ say(out.startsWith("DECK seed 3") && out.includes("build:"), "run through a symlinked folder, it still deals");+ say(!quiet.length, `six other tools answer through the link too${quiet.length ? ` silent: ${quiet.join(", ")}` : ""}`); }console.log(`\nDECK: ${fails ? "FAIL" : "PASS"}`); process.exit(fails ? 1 : 0);};-if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {+if (isMain(import.meta.url)) {const die = (m) => { console.error(`deck: ${m}`); process.exit(2); };const [cmd, ...args] = process.argv.slice(2), val = (k) => { const i = args.indexOf(k); return i >= 0 ? args[i + 1] : undefined; };const num = (k, least, whole) => { if (!args.includes(k)) return undefined; const x = Number(val(k)); if (val(k) === undefined || !Number.isFinite(x) || x < least || (whole && !Number.isInteger(x))) die(`${k} takes ${whole ? "a whole number" : "a number"} of ${least} or more (got ${val(k)})`); return x; };diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/is-main.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/is-main.mjsnew file mode 100644index 0000000..0f501af--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/is-main.mjs@@ -0,0 +1,10 @@+// IS-MAIN. Is this module the script node was asked to run, or was it imported by another tool?+// Compared by where the two paths really are: an installed skill is often reached through a link,+// and node resolves the module's own path through it while leaving the command line's as typed.+// if (isMain(import.meta.url)) { ...command line... }+import { realpathSync } from "node:fs";+import { resolve } from "node:path";+import { fileURLToPath } from "node:url";++const real = (p) => { try { return realpathSync(p); } catch { return resolve(p); } };+export const isMain = (url) => !!process.argv[1] && real(fileURLToPath(url)) === real(process.argv[1]);diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/popscan.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/popscan.mjsindex 529f704..b3bfab0 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/popscan.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/popscan.mjs@@ -16,8 +16,8 @@import { execFileSync } from "node:child_process";import { existsSync, mkdirSync } from "node:fs";import { basename, resolve } from "node:path";-import { pathToFileURL } from "node:url";import { greyFrames } from "./motion.mjs";+import { isMain } from "./is-main.mjs";// The detector: pure, frames in -> findings out, no I/O. `frames` is any (sync or async)// iterable of width*height greyscale bytes. Findings: { frame, box [x0,y0,x1,y1] as frame@@ -67,7 +67,7 @@ export const scanPops = async (frames, { width: W, height: H, grid = 12, min = 0return findings;};-const MAIN = process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href;+const MAIN = isMain(import.meta.url);if (MAIN) {const arg = (k, d) => { const i = process.argv.indexOf(`--${k}`); return i > 0 ? process.argv[i + 1] : d; };const die = (m) => { console.error(`popscan: ${m}`); process.exit(2); };diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/registry.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/registry.mjsindex c54dbf0..252b72e 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/registry.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/registry.mjs@@ -7,6 +7,7 @@import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";import { dirname, join, resolve } from "node:path";import { fileURLToPath } from "node:url";+import { isMain } from "./is-main.mjs";export const ENGINE = resolve(dirname(fileURLToPath(import.meta.url)), "..");export const ROOT = resolve(ENGINE, "..");@@ -72,7 +73,7 @@ const writeOutputs = (styles) => {].join("\n"));};-if (import.meta.url === `file://${process.argv[1]}`) {+if (isMain(import.meta.url)) {const styles = loadRegistry();writeOutputs(styles);for (const s of styles) console.log(` ${s.id.padEnd(14)} ${s.name.padEnd(32)} ${s.drawFilm ? "film " + s.drawFilm : "no film "}${s.source === "scanned" ? "" : " (legacy)"}`);diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/soundpack.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/soundpack.mjsindex 80f4026..e359bf7 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/soundpack.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/soundpack.mjs@@ -17,7 +17,7 @@ import { execFileSync } from "node:child_process";import { createHash } from "node:crypto";import { readFileSync, writeFileSync, existsSync, statSync, mkdirSync, openSync, closeSync, writeSync } from "node:fs";import { join, dirname, basename } from "node:path";-import { pathToFileURL } from "node:url";+import { isMain } from "./is-main.mjs";const SR = 48000;const VCSL_RAW = "https://raw.githubusercontent.com/sgossner/VCSL/master/";@@ -918,7 +918,7 @@ const only = onlyFlag >= 0 ? args.splice(onlyFlag, 2)[1].split(",") : null;const recipes = only ? RECIPES.filter((r) => only.includes(r.id)) : RECIPES;if (only && recipes.length !== only.length) { console.error(`unknown instrument in --only: ${only.filter((o) => !RECIPES.some((r) => r.id === o))}`); process.exit(2); }-if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) (async () => {+if (isMain(import.meta.url)) (async () => {if (cmd === "fetch" && args.length === 1) await fetchFiles(needed(recipes, tree()), args[0]);else if (cmd === "build" && args.length === 2) await buildPack(args[0], args[1], recipes);else if (cmd === "verify" && args.length === 1) verifyPack(args[0]);