The design language that makes your AI harness better at design.
JavaScript
Recognise the CLI package by its platform pins, not its name (#1000)
Paul Bakausab3a5e28d4f8
diff --git a/scripts/lib/validate-plugin-versions.js b/scripts/lib/validate-plugin-versions.jsindex a3ff26fe8..b2ab9de12 100644--- a/scripts/lib/validate-plugin-versions.js+++ b/scripts/lib/validate-plugin-versions.js@@ -122,12 +122,14 @@ export function collectPluginVersions(rootDir) {{// The npm CLI shares the skill's version: one number for users to read// 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.+ // the CLI, and it is the one that pins the engine's platform packages:+ // impeccable-site builds the skill from a tree whose root package.json is+ // the site's own, also named impeccable, at its own version.relPath: 'package.json',read: (raw) => {const pkg = JSON.parse(raw);- return pkg.name === 'impeccable' ? pkg.version : SKIP;+ const isCli = Object.keys(pkg.optionalDependencies || {}).some((k) => k.startsWith('@impeccable/cli-'));+ return isCli ? pkg.version : SKIP;},},{diff --git a/tests/validate-plugin-versions.test.js b/tests/validate-plugin-versions.test.jsindex 64ff96131..50d79911a 100644--- a/tests/validate-plugin-versions.test.js+++ b/tests/validate-plugin-versions.test.js@@ -61,19 +61,19 @@ describe('collectPluginVersions', () => {test('flags an npm package.json whose version drifted from the skill', () => {writeFixture(root, { plugin: '3.7.1', marketplace: '3.7.1' });- fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'impeccable', version: '3.6.0' }));+ fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'impeccable', version: '3.6.0', optionalDependencies: { '@impeccable/cli-darwin-arm64': '0.1.14' } }));const { mismatches } = collectPluginVersions(root);expect(mismatches).toEqual([{ relPath: 'package.json', found: '3.6.0', expected: '3.7.1' }]);- fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'impeccable', version: '3.7.1' }));+ fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'impeccable', version: '3.7.1', optionalDependencies: { '@impeccable/cli-darwin-arm64': '0.1.14' } }));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.+ // the site's own, also named impeccable, 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' }));+ fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'impeccable', version: '3.2.1' }));const { checked, mismatches } = collectPluginVersions(root);expect(mismatches).toEqual([]);expect(checked.some((c) => c.relPath === 'package.json')).toBe(false);