Guard metadata repair and doc sync scripts against symlink targets so repo maintenance tasks cannot overwrite arbitrary local files. Replace recursive skill discovery with an iterative walk that skips symlinked directories, and harden the VideoDB listener to write only private regular files in the user-owned state directory. Also fix the broken pr:preflight script entry and make the last30days skill stop embedding raw user arguments directly in the shell command.
69 lines
2.4 KiB
JavaScript
69 lines
2.4 KiB
JavaScript
const assert = require("assert");
|
|
|
|
const {
|
|
classifyChangedFiles,
|
|
extractChangelogSection,
|
|
getDirectDerivedChanges,
|
|
hasIssueLink,
|
|
hasQualityChecklist,
|
|
requiresReferencesValidation,
|
|
} = require("../../lib/workflow-contract");
|
|
|
|
const contract = {
|
|
derivedFiles: [
|
|
"CATALOG.md",
|
|
"skills_index.json",
|
|
"data/skills_index.json",
|
|
"data/catalog.json",
|
|
"data/bundles.json",
|
|
"data/aliases.json",
|
|
],
|
|
mixedFiles: ["README.md"],
|
|
releaseManagedFiles: ["CHANGELOG.md", "package.json", "package-lock.json", "README.md"],
|
|
};
|
|
|
|
const skillOnly = classifyChangedFiles(["skills/example/SKILL.md"], contract);
|
|
assert.deepStrictEqual(skillOnly.categories, ["skill"]);
|
|
assert.strictEqual(skillOnly.primaryCategory, "skill");
|
|
assert.strictEqual(requiresReferencesValidation(["skills/example/SKILL.md"], contract), false);
|
|
|
|
const docsOnly = classifyChangedFiles(["README.md", "docs/users/faq.md"], contract);
|
|
assert.deepStrictEqual(docsOnly.categories, ["docs"]);
|
|
assert.strictEqual(docsOnly.primaryCategory, "docs");
|
|
assert.strictEqual(requiresReferencesValidation(["README.md"], contract), true);
|
|
|
|
const infraChange = classifyChangedFiles([".github/workflows/ci.yml", "tools/scripts/pr_preflight.cjs"], contract);
|
|
assert.deepStrictEqual(infraChange.categories, ["infra"]);
|
|
assert.strictEqual(infraChange.primaryCategory, "infra");
|
|
assert.strictEqual(requiresReferencesValidation(["tools/scripts/pr_preflight.cjs"], contract), true);
|
|
|
|
const mixedChange = classifyChangedFiles(["skills/example/SKILL.md", "README.md"], contract);
|
|
assert.deepStrictEqual(mixedChange.categories, ["skill", "docs"]);
|
|
assert.strictEqual(mixedChange.primaryCategory, "skill");
|
|
|
|
assert.deepStrictEqual(
|
|
getDirectDerivedChanges(["skills/example/SKILL.md", "data/catalog.json"], contract),
|
|
["data/catalog.json"],
|
|
);
|
|
|
|
const changelog = [
|
|
"## [7.7.0] - 2026-03-13 - \"Merge Friction Reduction\"",
|
|
"",
|
|
"- Line one",
|
|
"",
|
|
"## [7.6.0] - 2026-03-01 - \"Older Release\"",
|
|
"",
|
|
"- Older line",
|
|
"",
|
|
].join("\n");
|
|
|
|
assert.strictEqual(
|
|
extractChangelogSection(changelog, "7.7.0"),
|
|
"## [7.7.0] - 2026-03-13 - \"Merge Friction Reduction\"\n\n- Line one\n",
|
|
);
|
|
|
|
assert.strictEqual(hasQualityChecklist("## Quality Bar Checklist\n- [x] Standards"), true);
|
|
assert.strictEqual(hasQualityChecklist("No template here"), false);
|
|
assert.strictEqual(hasIssueLink("Fixes #123"), true);
|
|
assert.strictEqual(hasIssueLink("Related to #123"), false);
|