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

36 lines
957 B
JavaScript

"use strict";
const assert = require("node:assert/strict");
const { execFileSync } = require("node:child_process");
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 latest release tag", () => {
const expectedVersion = execFileSync(
"git",
["describe", "--tags", "--abbrev=0"],
{ encoding: "utf8" },
).trim();
for (const manifestPath of manifestPaths) {
assert.equal(
readManifestVersion(manifestPath),
expectedVersion,
`${manifestPath} must use version ${expectedVersion}`,
);
}
});