Files
agent-skills/scripts/validate-versions-test.js
T

32 lines
905 B
JavaScript

"use strict";
const assert = require("node:assert/strict");
const { readFileSync } = require("node:fs");
const test = require("node:test");
const manifestPaths = [
"plugin.json",
".codex-plugin/plugin.json",
".claude-plugin/plugin.json",
".claude-plugin/marketplace.json",
".agents/plugins/marketplace.json",
];
function readManifestVersion(manifestPath) {
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
return manifest.version ?? manifest.plugins?.[0]?.version;
}
test("all plugin manifests use the root plugin.json version", () => {
const expectedVersion = readManifestVersion("plugin.json");
assert.ok(expectedVersion, "plugin.json must define a version");
for (const manifestPath of manifestPaths) {
assert.equal(
readManifestVersion(manifestPath),
expectedVersion,
`${manifestPath} must use version ${expectedVersion}`,
);
}
});