Skip to content

An agent skill for creating detailed, interactive isometric illustrations of real-world machines and complex systems. Generates polished SVGs with optional WebGL shaders and 3D effects.

Reject unsupported gallery license values

Preetinder Kalsi6b65036c857c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c9e657..03d43f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ All notable changes to Anatomy are recorded here. The format follows [Keep a Cha
### Fixed
+- `publish.mjs` rejects unsupported license values before building a figure, matching the community gallery's MIT and CC-BY-4.0 schema.
- `capture.mjs` waits for the page to load before it touches it, even with `--wait 0`, and gives up with an error when Chrome leaves a request unanswered for 60 s instead of hanging.
- `drive.mjs` `until` times a condition inside the page, so one that is already true passes however short the wait, even on a slow machine; a promise that never settles still times out.
- Start headless Chrome on Windows from an elevated terminal: `capture.mjs`, `drive.mjs` and `turn-check.mjs` pass `--do-not-de-elevate` there. Chrome otherwise relaunches itself without the elevation, the process the script started exits with code 0, and the check stops with `Chrome exited before startup: 0` while the relaunched browser stays running.
diff --git a/scripts/publish.mjs b/scripts/publish.mjs
index 956ab2c..bba237b 100644
--- a/scripts/publish.mjs
+++ b/scripts/publish.mjs
@@ -10,6 +10,7 @@ const SOURCE_TYPES = [".mjs", ".js", ".css", ".html", ".json", ".md", ".txt", ".
const SKIP_DIRS = ["node_modules", "shots", ".git"];
const ID = /^[a-z0-9]+(-[a-z0-9]+)*$/;
const AGENTS = ["Claude Code", "OpenCode", "Codex", "Antigravity", "Other"];
+const LICENSES = ["MIT", "CC-BY-4.0"];
const KINDS = ["SVG", "SVG + WebGL", "SVG + 3D", "SVG + WebGL + 3D"];
const posix = (path) => path.split(sep).join("/");
@@ -71,6 +72,7 @@ function parse(argv) {
for (const key of ["source", "into", "id", "title", "prompt", "author"]) if (!options[key]) usage(`missing ${key === "source" ? "the figure folder" : `--${key}`}`);
if (!ID.test(options.id)) usage("--id must be kebab-case, like token-bucket-bench");
if (!AGENTS.includes(options.agent)) usage(`--agent must be one of: ${AGENTS.join(", ")}`);
+ if (!LICENSES.includes(options.license)) usage(`--license must be one of: ${LICENSES.join(", ")}`);
if (options.kind && !KINDS.includes(options.kind)) usage(`--kind must be one of: ${KINDS.join(", ")}`);
return options;
}
diff --git a/scripts/publish.test.mjs b/scripts/publish.test.mjs
index 3499a8a..f7eb7f4 100644
--- a/scripts/publish.test.mjs
+++ b/scripts/publish.test.mjs
@@ -65,6 +65,30 @@ test("publishing refuses a folder that is not a gallery clone", () => {
}
});
+test("publisher accepts only the gallery's supported licenses", () => {
+ const repo = gallery();
+ const command = (license, id) => spawnSync(process.execPath, [
+ join(SKILL, "scripts", "publish.mjs"), join(SKILL, "examples", "dial-indicator"),
+ "--into", repo, "--id", id, "--title", "Dial indicator", "--prompt", "/anatomy a dial indicator",
+ "--author", "Octo-Cat", "--license", license, "--no-preview",
+ ], { encoding: "utf8" });
+ try {
+ for (const license of ["MIT", "CC-BY-4.0"]) {
+ const id = license.toLowerCase().replace(/[^a-z0-9]+/g, "-");
+ const result = command(license, id);
+ assert.equal(result.status, 0, result.stderr);
+ const figure = JSON.parse(readFileSync(join(repo, "figures", "octo-cat", id, "figure.json"), "utf8"));
+ assert.equal(figure.license, license);
+ }
+ const invalid = command("GPL-3.0", "unsupported-license");
+ assert.equal(invalid.status, 1);
+ assert.match(invalid.stderr, /--license must be one of: MIT, CC-BY-4\.0/);
+ assert.ok(!existsSync(join(repo, "figures", "octo-cat", "unsupported-license")));
+ } finally {
+ rmSync(repo, { recursive: true, force: true });
+ }
+});
+
import { submitPlan } from "./publish.mjs";
test("--submit: people who can push get a branch; everyone else a fork made for them", () => {