Files
systemic-game-design-course/tools/expansion-check.mjs
T
Lucas WintherandClaude Opus 5.5 ad0701395d fix(tools): stage course cards from M5, audit noun words without flagging identifiers, Node<24.2 main guard, rename-proof expansion-check, safe check-links
- cardDirs: course/cards only from Module 5 (spec 6.2a); fixture modules 04/05 and tests
- coupling-audit: noun words match as UPPERCASE, PascalCase or a whole string literal;
  lowercase identifiers like key/flag pass; card names keep every variant
- isMain() argv guard replaces import.meta.main in coupling-audit and verify-references;
  engines.node >=22
- expansion-check: git diff --no-renames so moving engine code into content fails
- start-module and other tools: clear error when .course.json is missing
- check-links: malformed URLs reported as invalid URL instead of throwing

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:06:56 +01:00

20 lines
1.0 KiB
JavaScript

#!/usr/bin/env node
// Expansion Drop must touch only content: fail if any changed path is under an engine dir.
import { execFileSync } from "node:child_process";
import { posix } from "node:path";
import { fail, readCourseConfig } from "./lib.mjs";
const [ws, baseRef] = process.argv.slice(2);
if (!ws || !baseRef) fail("usage: expansion-check.mjs <workspaceDir> <baseRef>");
const git = (...a) => execFileSync("git", a, { cwd: ws, encoding: "utf8" }).split("\n").filter(Boolean);
const cfg = readCourseConfig(ws);
const changed = new Set([
...git("diff", "--name-only", "--no-renames", "--relative", baseRef),
...git("ls-files", "--others", "--exclude-standard"),
]);
const engine = (cfg.engineDirs || []).map((d) => posix.normalize(d).replace(/\/$/, ""));
const bad = [...changed].filter((p) => engine.some((d) => p === d || p.startsWith(d + "/")));
if (bad.length) fail("expansion-check: engine changed during Expansion Drop\n" + bad.map((p) => " " + p).join("\n"));
console.log(`expansion-check: ok (${changed.size} changed, none in engine)`);