A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
Add the Dataverse plugin from microsoft/Dataverse-skills to the marketplace (#658)
Priyanshu Agrawal63d4b2ed3a9d
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex a7b22f81d..72fc236fb 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -39,6 +39,14 @@{"name": "power-automate","source": "./plugins/power-automate"+ },+ {+ "name": "dataverse",+ "source": {+ "source": "git-subdir",+ "url": "microsoft/Dataverse-skills",+ "path": ".github/plugins/dataverse"+ }}]}diff --git a/.github/workflows/validate-repository-metadata.yml b/.github/workflows/validate-repository-metadata.ymlindex aec644dcd..324dae266 100644--- a/.github/workflows/validate-repository-metadata.yml+++ b/.github/workflows/validate-repository-metadata.yml@@ -23,6 +23,12 @@ jobs:- name: validate-open-plugin-namesrun: node scripts/validate-plugin-names.js+ - name: test-legacy-compatibility-validator+ run: node --test scripts/tests/validate-legacy-compatibility.test.js++ - name: test-installer-arguments+ run: node --test scripts/tests/install.test.js+- name: validate-legacy-compatibilityrun: node scripts/validate-legacy-compatibility.jsdiff --git a/AGENTS.md b/AGENTS.mdindex 642edf13d..5a2f36595 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -183,6 +183,21 @@ drifting these files can force users to reinstall. Because mirrors are committedfiles (not symlinks), update both source and legacy copies together, then run`node scripts/validate-legacy-compatibility.js` after metadata changes.+### External plugins++A plugin maintained in another repository (today `dataverse`, from `microsoft/Dataverse-skills`) is listed with a remote `source` object instead of a `./plugins/<name>` path.+Its metadata and legacy mirrors live in that repository, so nothing for it is committed under `plugins/`.+This is the one place where the two marketplace files intentionally differ, because each host reads a different file and spells a subdirectory source differently:++- `marketplace.json` (read by Copilot CLI): `{ "source": "github", "repo": "owner/repo", "path": "sub/dir" }`.+ Copilot CLI rejects `git-subdir` and then refuses the whole marketplace, breaking every plugin in it.+- `.claude-plugin/marketplace.json` (read by Claude Code): `{ "source": "git-subdir", "url": "owner/repo", "path": "sub/dir" }`.+ Claude Code's `github` source ignores `path`, installs the repository root, and loads no skills while still reporting success.++Carry any `ref` or `sha` pin into both entries.+The validator enforces the pairing, and `scripts/tests/validate-legacy-compatibility.test.js` covers it.+After adding or changing an external entry, install it from a local checkout in both hosts (`copilot plugin marketplace add <checkout>` and `claude plugin marketplace add <checkout>`) and confirm its skills load.+## Code Conventions**DRY (Don't Repeat Yourself):** Never duplicate logic across files. Each plugin has shared utilities (e.g., `scripts/lib/`) and shared reference docs (e.g., `references/`). Always check for and reuse existing helpers before writing new code. When adding shared logic, put it in the plugin's shared modules — not in individual skill directories.diff --git a/README.md b/README.mdindex 885f36cef..0aa9de803 100644--- a/README.md+++ b/README.md@@ -28,9 +28,21 @@ The installer automatically:- Installs `pac` CLI if not already installed- Detects available tools (GitHub Copilot CLI, Claude Code)-- Registers the plugin marketplace and installs all listed plugins+- Registers the plugin marketplace and installs all listed plugins except `dataverse`- Enables auto-update so plugins stay current+To also install the [Dataverse](#dataverse-external) plugin, pass `--include-dataverse`:++```powershell+iwr https://raw.githubusercontent.com/microsoft/power-platform-skills/main/scripts/install.js -OutFile install.js; node install.js --include-dataverse; del install.js+```++```bash+curl -fsSL https://raw.githubusercontent.com/microsoft/power-platform-skills/main/scripts/install.js | node - --include-dataverse+```++The `-` tells Node to read the piped script, so the arguments after it reach the installer.+### Manual InstallationIf you prefer to install manually, run these commands inside a GitHub Copilot CLI or Claude Code session:@@ -52,6 +64,7 @@ If you prefer to install manually, run these commands inside a GitHub Copilot CL/plugin install power-apps-mobile-extension@power-platform-skills/plugin install canvas-apps@power-platform-skills/plugin install power-automate@power-platform-skills+ /plugin install dataverse@power-platform-skills```## Available Plugins@@ -117,6 +130,16 @@ Build, edit, run, and debug Power Automate cloud flows via the FlowAgent MCP ser**Stack**: Node.js 18+, Azure CLI (`az login`), self-contained MCP bundle+### [Dataverse](https://github.com/microsoft/Dataverse-skills) (external)++Work with Microsoft Dataverse: connect to an environment, query and change records, manage tables and columns, and handle security, administration, and solutions.++**Stack**: Dataverse MCP server, Dataverse CLI, Python SDK, and PAC CLI++This plugin is maintained in [microsoft/Dataverse-skills](https://github.com/microsoft/Dataverse-skills), and this marketplace installs it straight from that repository's default branch.+Report issues and send changes there.+If you already installed `dataverse` from the `dataverse-skills` marketplace, keep only one of the two installs so its skills are not loaded twice.+## Local DevelopmentTo develop and test plugins locally, follow these steps:@@ -282,6 +305,11 @@ Plugin descriptions, versions, licenses, and keywords are controlled from eachplugin's `.plugin/plugin.json`. This keeps existing subscriptions updating withoutduplicating display/update metadata.+Plugins maintained in other repositories, such as `dataverse`, use a remote `source` object instead of a path.+Copilot CLI reads `marketplace.json` and Claude Code reads `.claude-plugin/marketplace.json`, and they spell a plugin in a repository subdirectory differently.+So `marketplace.json` uses `"source": "github"` with `repo` and `path`, and the legacy file uses `"source": "git-subdir"` with `url` and `path`.+`scripts/validate-legacy-compatibility.js` enforces that pairing.+## Documentation- [Power Pages Code Sites](https://learn.microsoft.com/en-us/power-pages/configure/create-code-sites)diff --git a/marketplace.json b/marketplace.jsonindex a7b22f81d..64d9bcf0b 100644--- a/marketplace.json+++ b/marketplace.json@@ -39,6 +39,14 @@{"name": "power-automate","source": "./plugins/power-automate"+ },+ {+ "name": "dataverse",+ "source": {+ "source": "github",+ "repo": "microsoft/Dataverse-skills",+ "path": ".github/plugins/dataverse"+ }}]}diff --git a/scripts/install.js b/scripts/install.jsindex 4c0fde0e4..faaa5772c 100644--- a/scripts/install.js+++ b/scripts/install.js@@ -6,8 +6,13 @@* the Open Plugins marketplace and install plugins for Claude Code and GitHub Copilot.** Usage:- * node scripts/install.js (from local clone)+ * node scripts/install.js [--include-dataverse] (from local clone)* curl -fsSL https://raw.githubusercontent.com/microsoft/power-platform-skills/main/scripts/install.js | node+ * curl -fsSL https://raw.githubusercontent.com/microsoft/power-platform-skills/main/scripts/install.js | node - --include-dataverse+ *+ * Options:+ * --include-dataverse Also install the dataverse plugin (maintained in microsoft/Dataverse-skills)+ * -h, --help Show this help*/const { execSync } = require("child_process");@@ -22,6 +27,17 @@ const MARKETPLACE_NAME = "power-platform-skills";const GITHUB_RAW = `https://raw.githubusercontent.com/${REPO}/main`;const HOME = os.homedir();+// Marketplace plugins that are installed only when their flag is passed. dataverse is+// maintained in microsoft/Dataverse-skills, and many users already install it from that+// repository's own marketplace; installing it here by default would load its skills twice.+const OPT_IN_PLUGINS = { dataverse: "--include-dataverse" };++const USAGE = `Usage: node install.js [--include-dataverse]++Options:+ --include-dataverse Also install the dataverse plugin (maintained in microsoft/Dataverse-skills)+ -h, --help Show this help`;+// ── Colors (disabled when output is piped) ────────────────────const tty = process.stdout.isTTY;const bold = (s) => (tty ? `\x1b[1m${s}\x1b[0m` : s);@@ -35,6 +51,41 @@ const fail = (msg) => console.log(` ${red("✗")} ${msg}`);const header = (msg) => console.log(`\n${bold(msg)}`);const info = (msg) => console.log(` ${msg}`);+// ── Arguments ─────────────────────────────────────────────────+// `process.argv` differs by launch mode, and the script's own arguments start at index 2+// whenever any are present:+// node scripts/install.js --include-dataverse -> [node, /abs/install.js, "--include-dataverse"]+// curl ... | node - --include-dataverse -> [node, "-", "--include-dataverse"]+// curl ... | node -> [node]+// Unknown arguments fail instead of being ignored, so a typo cannot silently drop a plugin.+function parseArgs(args) {+ const options = { help: false, includedOptIn: new Set() };+ const optInByFlag = new Map(Object.entries(OPT_IN_PLUGINS).map(([plugin, flag]) => [flag, plugin]));+ for (const arg of args) {+ if (arg === "-h" || arg === "--help") {+ options.help = true;+ } else if (optInByFlag.has(arg)) {+ options.includedOptIn.add(optInByFlag.get(arg));+ } else {+ throw new Error(`Unknown argument '${arg}'.\n\n${USAGE}`);+ }+ }+ return options;+}++function selectPlugins(pluginNames, includedOptIn) {+ const selected = [];+ const skipped = [];+ for (const name of pluginNames) {+ if (Object.prototype.hasOwnProperty.call(OPT_IN_PLUGINS, name) && !includedOptIn.has(name)) {+ skipped.push(name);+ } else {+ selected.push(name);+ }+ }+ return { selected, skipped };+}+// ── Helpers ───────────────────────────────────────────────────function hasCommand(cmd) {try {@@ -117,7 +168,9 @@ function enableAutoUpdate(configFile, getMarketplaces) {// ── Marketplace loader ────────────────────────────────────────async function loadMarketplace() {- const scriptDir = process.argv[1] ? path.dirname(path.resolve(process.argv[1])) : process.cwd();+ // `node -` (piped with arguments) sets argv[1] to "-", which is not a script path.+ const scriptPath = process.argv[1] && process.argv[1] !== "-" ? process.argv[1] : null;+ const scriptDir = scriptPath ? path.dirname(path.resolve(scriptPath)) : process.cwd();// Script lives in scripts/, so the repo root is one level upconst repoRoot = path.resolve(scriptDir, "..");const roots = [...new Set([repoRoot, process.cwd()])];@@ -259,6 +312,12 @@ function installCopilot(plugins) {// ── Main ──────────────────────────────────────────────────────async function main() {+ const options = parseArgs(process.argv.slice(2));+ if (options.help) {+ console.log(USAGE);+ return;+ }+console.log("");console.log(bold("Power Platform Skills — Installer"));console.log("──────────────────────────────────");@@ -404,11 +463,18 @@ async function main() {header("Reading marketplace");const manifest = await loadMarketplace();- const plugins = manifest.plugins.map((p) => p.name);+ const { selected: plugins, skipped } = selectPlugins(+ manifest.plugins.map((p) => p.name),+ options.includedOptIn+ );console.log(` Marketplace : ${manifest.name}`);console.log(" Plugins :");for (const p of plugins) console.log(` - ${p}`);+ for (const p of skipped) info(`Skipping ${p} (pass ${OPT_IN_PLUGINS[p]} to install it)`);+ for (const p of options.includedOptIn) {+ if (!plugins.includes(p)) warn(`${OPT_IN_PLUGINS[p]} was passed, but ${p} is not in the marketplace`);+ }if (plugins.length === 0) {warn("No plugins found in the marketplace.");@@ -432,7 +498,15 @@ async function main() {console.log("");}-main().catch((err) => {- fail(`Installation failed: ${err.message}`);- process.exit(1);-});+// Run when executed directly. Piped input (`curl ... | node`) leaves require.main undefined,+// so checking only `require.main === module` would make the one-line installer do nothing.+// Match the stdin module id instead of a missing require.main: `node -e "require(...)"` also+// leaves require.main undefined, and must import the helpers without starting an install.+if (require.main === module || module.id === "[stdin]") {+ main().catch((err) => {+ fail(`Installation failed: ${err.message}`);+ process.exit(1);+ });+}++module.exports = { parseArgs, selectPlugins, OPT_IN_PLUGINS };diff --git a/scripts/tests/install.test.js b/scripts/tests/install.test.jsnew file mode 100644index 000000000..0363494bd--- /dev/null+++ b/scripts/tests/install.test.js@@ -0,0 +1,36 @@+// Covers the installer's argument handling and plugin selection. Importing install.js+// must not start an install, so a regression in its entry-point guard shows up here as a+// test run that tries to register marketplaces instead of passing quietly.++const test = require('node:test');+const assert = require('node:assert');++const { parseArgs, selectPlugins, OPT_IN_PLUGINS } = require('../install.js');++const MARKETPLACE = ['power-pages', 'model-apps', 'dataverse', 'power-automate'];++test('dataverse is opt-in through --include-dataverse', () => {+ assert.equal(OPT_IN_PLUGINS.dataverse, '--include-dataverse');+});++test('without flags, every plugin except dataverse is installed', () => {+ const { selected, skipped } = selectPlugins(MARKETPLACE, parseArgs([]).includedOptIn);+ assert.deepEqual(selected, ['power-pages', 'model-apps', 'power-automate']);+ assert.deepEqual(skipped, ['dataverse']);+});++test('--include-dataverse installs dataverse alongside the other plugins', () => {+ const { selected, skipped } = selectPlugins(MARKETPLACE, parseArgs(['--include-dataverse']).includedOptIn);+ assert.deepEqual(selected, MARKETPLACE);+ assert.deepEqual(skipped, []);+});++test('--help is recognised', () => {+ assert.equal(parseArgs(['--help']).help, true);+ assert.equal(parseArgs(['-h']).help, true);+});++test('an unknown or misspelled argument fails instead of silently skipping a plugin', () => {+ assert.throws(() => parseArgs(['--include-dataverze']), /Unknown argument '--include-dataverze'/);+ assert.throws(() => parseArgs(['dataverse']), /Unknown argument/);+});diff --git a/scripts/tests/validate-legacy-compatibility.test.js b/scripts/tests/validate-legacy-compatibility.test.jsnew file mode 100644index 000000000..fc1837136--- /dev/null+++ b/scripts/tests/validate-legacy-compatibility.test.js@@ -0,0 +1,105 @@+// Guards the marketplace mirror check. Copilot CLI reads marketplace.json and Claude Code+// reads .claude-plugin/marketplace.json, so a wrong source in either file breaks one host+// while the other keeps working. The remote-source cases matter most: a `git-subdir`+// source in marketplace.json makes Copilot CLI refuse the whole marketplace, and a+// `github` source with `path` in the legacy file makes Claude Code install an empty plugin.++const test = require('node:test');+const assert = require('node:assert');+const fs = require('node:fs');+const os = require('node:os');+const path = require('node:path');++const { validate, expectedLegacyRemoteSource } = require('../validate-legacy-compatibility.js');++const OPEN_REMOTE = { source: 'github', repo: 'contoso/plugins', path: 'plugins/widget' };+const LEGACY_REMOTE = { source: 'git-subdir', url: 'contoso/plugins', path: 'plugins/widget' };++const LOCAL_MANIFEST = {+ name: 'local-plugin',+ version: '1.0.0',+ description: 'A local plugin.',+ author: { name: 'Contoso' },+ homepage: 'https://example.com',+ repository: 'https://example.com/repo',+ license: 'MIT',+ keywords: ['local'],+};++function marketplace(remoteSource) {+ return {+ name: 'test-marketplace',+ owner: { name: 'Contoso' },+ metadata: { description: 'Test marketplace', pluginRoot: '.' },+ plugins: [+ { name: 'local-plugin', source: './plugins/local-plugin' },+ { name: 'widget', source: remoteSource },+ ],+ };+}++function writeJson(filePath, value) {+ fs.mkdirSync(path.dirname(filePath), { recursive: true });+ fs.writeFileSync(filePath, JSON.stringify(value, null, 2));+}++const fixtureRoots = [];+test.after(() => {+ for (const root of fixtureRoots) fs.rmSync(root, { recursive: true, force: true });+});++function fixture(openRemote, legacyRemote) {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'legacy-compat-'));+ fixtureRoots.push(root);+ writeJson(path.join(root, 'marketplace.json'), marketplace(openRemote));+ writeJson(path.join(root, '.claude-plugin', 'marketplace.json'), marketplace(legacyRemote));+ writeJson(path.join(root, 'plugins', 'local-plugin', '.plugin', 'plugin.json'), LOCAL_MANIFEST);+ writeJson(path.join(root, 'plugins', 'local-plugin', '.claude-plugin', 'plugin.json'), LOCAL_MANIFEST);+ return root;+}++test('a remote subdirectory plugin passes with github in marketplace.json and git-subdir in the legacy file', () => {+ assert.deepEqual(validate(fixture(OPEN_REMOTE, LEGACY_REMOTE)), []);+});++test('git-subdir in marketplace.json is rejected because Copilot CLI refuses the whole marketplace', () => {+ const errors = validate(fixture(LEGACY_REMOTE, LEGACY_REMOTE));+ assert.ok(errors.some((error) => /must use the "github" type/.test(error)), errors.join('\n'));+});++test('github with path in the legacy file is rejected because Claude Code ignores path', () => {+ const errors = validate(fixture(OPEN_REMOTE, OPEN_REMOTE));+ assert.ok(errors.some((error) => /^widget remote marketplace entry/.test(error)), errors.join('\n'));+});++test('ref and sha pins carry over to the legacy source', () => {+ const sha = 'a'.repeat(40);+ const open = { ...OPEN_REMOTE, ref: 'v1.0.0', sha };+ assert.deepEqual(expectedLegacyRemoteSource(open), { ...LEGACY_REMOTE, ref: 'v1.0.0', sha });+ assert.deepEqual(validate(fixture(open, { ...LEGACY_REMOTE, ref: 'v1.0.0', sha })), []);+ assert.notDeepEqual(validate(fixture(open, LEGACY_REMOTE)), []);+});++test('a repository-root github source mirrors unchanged, since both hosts read it the same way', () => {+ const rootSource = { source: 'github', repo: 'contoso/widget' };+ assert.deepEqual(expectedLegacyRemoteSource(rootSource), rootSource);+ assert.deepEqual(validate(fixture(rootSource, rootSource)), []);+});++test('malformed remote sources are rejected', () => {+ const cases = [+ { ...OPEN_REMOTE, repo: 'not-a-repo' },+ { ...OPEN_REMOTE, path: '../escape' },+ { ...OPEN_REMOTE, path: '/absolute' },+ { ...OPEN_REMOTE, sha: 'abc123' },+ { ...OPEN_REMOTE, extra: true },+ ];+ for (const open of cases) {+ const errors = validate(fixture(open, expectedLegacyRemoteSource(open)));+ assert.ok(errors.length > 0, `expected ${JSON.stringify(open)} to be rejected`);+ }+});++test('the committed marketplace files pass', () => {+ assert.deepEqual(validate(), []);+});diff --git a/scripts/validate-legacy-compatibility.js b/scripts/validate-legacy-compatibility.jsindex ae1d9923f..f7c94e42d 100644--- a/scripts/validate-legacy-compatibility.js+++ b/scripts/validate-legacy-compatibility.js@@ -5,6 +5,9 @@* counterparts. Existing marketplace subscriptions still resolve the legacy paths* during auto-update, so these committed mirror files must stay semantically in* sync whenever marketplace/plugin metadata changes.+ *+ * The one intentional difference is the `source` of a plugin hosted in another+ * repository, which each host spells differently. See REMOTE PLUGIN SOURCES below.*/const fs = require('fs');@@ -12,8 +15,6 @@ const path = require('path');const assert = require('assert/strict');const ROOT = path.resolve(__dirname, '..');-const OPEN_MARKETPLACE_PATH = path.join(ROOT, 'marketplace.json');-const LEGACY_MARKETPLACE_PATH = path.join(ROOT, '.claude-plugin', 'marketplace.json');function readJson(filePath) {return JSON.parse(fs.readFileSync(filePath, 'utf8'));@@ -23,19 +24,80 @@ function normalizeRelative(relativePath) {return relativePath.replace(/\\/g, '/').replace(/\/+$/, '');}-function pluginDirectoryFromOpenEntry(openMarketplace, plugin) {+function pluginDirectoryFromOpenEntry(root, openMarketplace, plugin) {const pluginRoot = openMarketplace.metadata?.pluginRoot || '.';- return path.resolve(ROOT, pluginRoot, plugin.source);+ return path.resolve(root, pluginRoot, plugin.source);}-function expectedLegacySource(pluginDirectory) {- return `./${normalizeRelative(path.relative(ROOT, pluginDirectory))}`;+function expectedLegacySource(root, pluginDirectory) {+ return `./${normalizeRelative(path.relative(root, pluginDirectory))}`;}function assertJsonMirror(legacyPath, sourcePath) {assert.deepEqual(readJson(legacyPath), readJson(sourcePath));}+// ── REMOTE PLUGIN SOURCES ─────────────────────────────────────+// A plugin maintained in another repository is listed with an object `source`+// instead of a `./plugins/<name>` path. When the plugin sits in a subdirectory of+// that repository, Copilot CLI and Claude Code need different spellings, and each+// host reads a different file of ours:+//+// marketplace.json (Copilot CLI reads this one first):+// { "source": "github", "repo": "owner/repo", "path": "sub/dir" }+// .claude-plugin/marketplace.json (Claude Code reads only this one):+// { "source": "git-subdir", "url": "owner/repo", "path": "sub/dir" }+//+// Neither spelling works on the other host, so the two files must differ here:+// - Copilot CLI rejects `git-subdir` with "plugins.N.source: Invalid input" and then+// refuses to add the whole marketplace, which would break every plugin we ship.+// - Claude Code's `github` source has no `path` field. It ignores `path`, installs+// the repository root, and reports success while loading none of the plugin's skills.+// Verified with Claude Code 2.1.285 and Copilot CLI 1.0.90. Docs:+// https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-plugin-reference#plugin-source-types+// https://code.claude.com/docs/en/plugins/marketplace-reference#plugin-sources+const REMOTE_SOURCE_KEYS = ['path', 'ref', 'repo', 'sha', 'source'];+const GITHUB_REPO_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;+const COMMIT_SHA_PATTERN = /^[0-9a-f]{40}$/;++function isRemoteSource(source) {+ return source !== null && typeof source === 'object' && !Array.isArray(source);+}++function assertRemoteOpenSource(source) {+ assert.equal(+ source.source,+ 'github',+ 'a remote source in marketplace.json must use the "github" type; Copilot CLI rejects other types such as "git-subdir" and then refuses the whole marketplace'+ );+ for (const key of Object.keys(source)) {+ assert.ok(REMOTE_SOURCE_KEYS.includes(key), `unsupported remote source key "${key}"`);+ }+ assert.match(String(source.repo), GITHUB_REPO_PATTERN, 'repo must be in owner/repo form');+ if ('path' in source) {+ assert.equal(typeof source.path, 'string', 'path must be a string');+ const segments = source.path.split('/');+ assert.ok(+ source.path !== '' && !source.path.startsWith('/') && !source.path.includes('\\') && !segments.includes('..'),+ 'path must be a forward-slash path relative to the repository root, without ".."'+ );+ }+ if ('ref' in source) {+ assert.equal(typeof source.ref, 'string', 'ref must be a string');+ assert.notEqual(source.ref.trim(), '', 'ref must not be empty');+ }+ if ('sha' in source) {+ assert.match(String(source.sha), COMMIT_SHA_PATTERN, 'sha must be a full 40-character lowercase commit SHA');+ }+}++function expectedLegacyRemoteSource(openSource) {+ const { source, repo, path: subdirectory, ...pin } = openSource;+ // Without a `path`, both hosts read `github` the same way, so the entry mirrors as is.+ if (subdirectory === undefined) return openSource;+ return { source: 'git-subdir', url: repo, path: subdirectory, ...pin };+}+function assertMinimalMarketplaceEntry(plugin) {// Open Plugins marketplace entries only require `name` and `source`. Optional// fields like description/version/license/keywords are override fields, so keep@@ -45,7 +107,8 @@ function assertMinimalMarketplaceEntry(plugin) {assert.deepEqual(Object.keys(plugin).sort(), ['name', 'source']);assert.equal(typeof plugin.name, 'string', 'name must be a string');assert.notEqual(plugin.name.trim(), '', 'name must not be empty');- assert.equal(typeof plugin.source, 'string', 'source must be a string');+ if (isRemoteSource(plugin.source)) return;+ assert.equal(typeof plugin.source, 'string', 'source must be a string or a remote source object');assert.match(plugin.source, /^\.\//, 'source must start with ./');}@@ -90,47 +153,74 @@ function assertPluginMetadata(pluginName, manifest) {}}-const errors = [];+function validate(root = ROOT) {+ const openMarketplacePath = path.join(root, 'marketplace.json');+ const legacyMarketplacePath = path.join(root, '.claude-plugin', 'marketplace.json');+ const errors = [];-function check(label, fn) {- try {- fn();- } catch (error) {- errors.push(`${label}: ${error.message}`);+ function check(label, fn) {+ try {+ fn();+ } catch (error) {+ errors.push(`${label}: ${error.message}`);+ }}-}-check('legacy marketplace manifest', () => {- assert.ok(fs.existsSync(LEGACY_MARKETPLACE_PATH), 'missing .claude-plugin/marketplace.json');- assertJsonMirror(LEGACY_MARKETPLACE_PATH, OPEN_MARKETPLACE_PATH);-});--if (errors.length === 0) {- const openMarketplace = readJson(OPEN_MARKETPLACE_PATH);- const legacyMarketplace = readJson(LEGACY_MARKETPLACE_PATH);- const legacyPlugins = new Map((legacyMarketplace.plugins || []).map((plugin) => [plugin.name, plugin]));- const openPluginNames = new Set();-- check('marketplace name', () => {- assert.equal(legacyMarketplace.name, openMarketplace.name);+ check('legacy marketplace manifest', () => {+ assert.ok(fs.existsSync(legacyMarketplacePath), 'missing .claude-plugin/marketplace.json');});+ if (errors.length > 0) return errors;++ const openMarketplace = readJson(openMarketplacePath);+ const legacyMarketplace = readJson(legacyMarketplacePath);check('marketplace shape', () => {assertMinimalMarketplace(openMarketplace);assertMinimalMarketplace(legacyMarketplace);});+ if (errors.length > 0) return errors;++ // Everything except remote plugin sources must be a byte-for-byte semantic mirror,+ // so compare the files with those sources swapped for their expected legacy form.+ check('legacy marketplace manifest', () => {+ const expectedLegacy = {+ ...openMarketplace,+ plugins: openMarketplace.plugins.map((plugin) =>+ isRemoteSource(plugin.source) ? { ...plugin, source: expectedLegacyRemoteSource(plugin.source) } : plugin+ ),+ };+ assert.deepEqual(legacyMarketplace, expectedLegacy);+ });- for (const plugin of openMarketplace.plugins || []) {+ const legacyPlugins = new Map(legacyMarketplace.plugins.map((plugin) => [plugin.name, plugin]));+ const openPluginNames = new Set();++ for (const plugin of openMarketplace.plugins) {openPluginNames.add(plugin.name);- const pluginDirectory = pluginDirectoryFromOpenEntry(openMarketplace, plugin);++ if (isRemoteSource(plugin.source)) {+ // The plugin's manifests live in its own repository, which owns their metadata+ // and legacy mirrors; CI here deliberately does not fetch them over the network.+ check(`${plugin.name} remote marketplace entry`, () => {+ assertMinimalMarketplaceEntry(plugin);+ assertRemoteOpenSource(plugin.source);+ const legacyPlugin = legacyPlugins.get(plugin.name);+ assert.ok(legacyPlugin, 'missing from .claude-plugin/marketplace.json');+ assertMinimalMarketplaceEntry(legacyPlugin);+ assert.deepEqual(legacyPlugin.source, expectedLegacyRemoteSource(plugin.source));+ });+ continue;+ }++ const pluginDirectory = pluginDirectoryFromOpenEntry(root, openMarketplace, plugin);const openManifestPath = path.join(pluginDirectory, '.plugin', 'plugin.json');const legacyManifestPath = path.join(pluginDirectory, '.claude-plugin', 'plugin.json');- const relativeLegacyManifestPath = normalizeRelative(path.relative(ROOT, legacyManifestPath));+ const relativeLegacyManifestPath = normalizeRelative(path.relative(root, legacyManifestPath));check(`${plugin.name} legacy marketplace entry`, () => {const legacyPlugin = legacyPlugins.get(plugin.name);assert.ok(legacyPlugin, 'missing from .claude-plugin/marketplace.json');- assert.equal(legacyPlugin.source, expectedLegacySource(pluginDirectory));+ assert.equal(legacyPlugin.source, expectedLegacySource(root, pluginDirectory));assertMinimalMarketplaceEntry(plugin);assertMinimalMarketplaceEntry(legacyPlugin);});@@ -151,14 +241,20 @@ if (errors.length === 0) {assert.ok(openPluginNames.has(legacyPluginName), 'not present in marketplace.json');});}++ return errors;}-if (errors.length > 0) {- console.log('Found legacy compatibility metadata issues:');- for (const error of errors) {- console.log(`- ${error}`);+if (require.main === module) {+ const errors = validate();+ if (errors.length > 0) {+ console.log('Found legacy compatibility metadata issues:');+ for (const error of errors) {+ console.log(`- ${error}`);+ }+ process.exit(1);}- process.exit(1);+ console.log('Legacy .claude-plugin compatibility metadata is in sync.');}-console.log('Legacy .claude-plugin compatibility metadata is in sync.');+module.exports = { validate, expectedLegacyRemoteSource, assertRemoteOpenSource };