The design language that makes your AI harness better at design.
JavaScript
Check the CLI version only against this repo's package.json (#999)
Paul Bakaus18e751118ba6
diff --git a/scripts/lib/validate-plugin-versions.js b/scripts/lib/validate-plugin-versions.jsindex 593ab4653..a3ff26fe8 100644--- a/scripts/lib/validate-plugin-versions.js+++ b/scripts/lib/validate-plugin-versions.js@@ -100,6 +100,9 @@ function extractFromFile(absPath, extract) {* A present-but-malformed root, or one missing its `version` field, instead* reports an entry in `errors` so the build fails loudly rather than passing.*/+// A reader returns SKIP when the file is not the artifact it checks.+const SKIP = Symbol('skip');+export function collectPluginVersions(rootDir) {const rootRel = '.claude-plugin/plugin.json';const rootManifestPath = path.join(rootDir, rootRel);@@ -118,9 +121,14 @@ export function collectPluginVersions(rootDir) {const checks = [{// The npm CLI shares the skill's version: one number for users to read- // off npm, the plugin and the changelog.+ // off npm, the plugin and the changelog. Only this repo's package.json is+ // the CLI: impeccable-site builds the skill from a tree whose root+ // package.json is the site's own, which carries its own version.relPath: 'package.json',- read: (raw) => JSON.parse(raw).version,+ read: (raw) => {+ const pkg = JSON.parse(raw);+ return pkg.name === 'impeccable' ? pkg.version : SKIP;+ },},{relPath: '.claude-plugin/marketplace.json',@@ -156,6 +164,7 @@ export function collectPluginVersions(rootDir) {continue;}const found = result.value;+ if (found === SKIP) continue;checked.push({ relPath, found });if (found !== source) mismatches.push({ relPath, found, expected: source });}diff --git a/tests/validate-plugin-versions.test.js b/tests/validate-plugin-versions.test.jsindex 0793243f5..64ff96131 100644--- a/tests/validate-plugin-versions.test.js+++ b/tests/validate-plugin-versions.test.js@@ -69,6 +69,16 @@ describe('collectPluginVersions', () => {expect(collectPluginVersions(root).mismatches).toEqual([]);});+ test('leaves a package.json that is not the impeccable CLI alone', () => {+ // impeccable-site builds the skill from a tree whose root package.json is+ // the site's own, at its own version.+ writeFixture(root, { plugin: '3.7.1', marketplace: '3.7.1' });+ fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'impeccable-site', version: '3.2.1' }));+ const { checked, mismatches } = collectPluginVersions(root);+ expect(mismatches).toEqual([]);+ expect(checked.some((c) => c.relPath === 'package.json')).toBe(false);+ });+test('flags a lagging marketplace.json (the half the sync workflow cannot repair)', () => {writeFixture(root, { plugin: '3.7.1', marketplace: '3.1.1', subtreePlugin: '3.7.1', skill: '3.7.1' });const { mismatches } = collectPluginVersions(root);