Skip to content

Commit a303e17

Browse files
authored
Fix path for Chrome DevTools external plugin (#1784)
* Fixing path on chrome devtools external pluginPath is to the folder in the repo where the plugin structure starts, not where the plugin.json file lives. * Updating validation scripts and guidance to avoid this mistake again
1 parent 8a43097 commit a303e17

7 files changed

Lines changed: 32 additions & 28 deletions

File tree

.github/ISSUE_TEMPLATE/external-plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ body:
4444
id: plugin-path
4545
attributes:
4646
label: Plugin path inside the repository
47-
description: Optional if the plugin lives at the repository root.
48-
placeholder: .github/plugins/my-plugin
47+
description: Optional if the plugin lives at the repository root. Otherwise, enter the folder where the plugin structure starts, not the plugin.json file.
48+
placeholder: plugins/my-plugin
4949
validations:
5050
required: false
5151
- type: input

.github/plugin/marketplace.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
"source": {
127127
"source": "github",
128128
"repo": "ChromeDevTools/chrome-devtools-mcp",
129-
"path": ".github/plugin/plugin.json",
130129
"ref": "chrome-devtools-mcp-v1.0.1"
131130
}
132131
},

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ For entries committed to `plugins/external.json`, the current marketplace valida
221221
- `repository` as an HTTPS GitHub URL
222222
- `keywords` as lowercase hyphenated tags
223223
- `source.source: "github"` plus `source.repo` in `owner/repo` format
224-
- optional `source.path` values to stay relative to the repository root
224+
- optional `source.path` values of `/` for repository root, or a repository-relative folder where the plugin structure starts (do not point to `plugin.json` directly)
225225

226226
The public-submission policy builds on those rules and also requires `license` plus an immutable `source.ref`.
227227

eng/external-plugin-validation.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export const EXTERNAL_PLUGIN_POLICIES = Object.freeze({
2323
}),
2424
});
2525

26+
const EXTERNAL_PLUGIN_ROOT_MANIFEST_PATHS = Object.freeze([
27+
"plugin.json",
28+
".github/plugin/plugin.json",
29+
".plugin/plugin.json",
30+
]);
31+
2632
function resolvePolicy(policy) {
2733
if (!policy) {
2834
return EXTERNAL_PLUGIN_POLICIES.marketplace;
@@ -203,12 +209,20 @@ function validateHomepage(homepage, prefix, errors) {
203209
validateHttpsUrl(homepage, "homepage", prefix, errors);
204210
}
205211

212+
function formatExpectedPluginRootMessage() {
213+
return EXTERNAL_PLUGIN_ROOT_MANIFEST_PATHS.map((manifestPath) => `"${manifestPath}"`).join(", ");
214+
}
215+
206216
function validateRelativePath(pathValue, prefix, errors) {
207217
if (!isNonEmptyString(pathValue)) {
208218
errors.push(`${prefix}: "source.path" must be a non-empty string when provided`);
209219
return;
210220
}
211221

222+
if (pathValue === "/") {
223+
return;
224+
}
225+
212226
const normalized = path.posix.normalize(pathValue);
213227
const segments = pathValue.split("/");
214228

@@ -219,6 +233,16 @@ function validateRelativePath(pathValue, prefix, errors) {
219233
if (pathValue.includes("\\")) {
220234
errors.push(`${prefix}: "source.path" must use forward slashes`);
221235
}
236+
237+
if (normalized === ".") {
238+
errors.push(`${prefix}: "source.path" must be "/" for the repository root or a plugin root directory relative to the repository root`);
239+
}
240+
241+
if (path.posix.basename(normalized) === "plugin.json") {
242+
errors.push(
243+
`${prefix}: "source.path" must point to the plugin root directory, not the manifest file; relative to "source.path", expected one of ${formatExpectedPluginRootMessage()}`
244+
);
245+
}
222246
}
223247

224248
function validateImmutableRef(ref, prefix, errors) {

plugins/external.json

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"source": {
7474
"source": "github",
7575
"repo": "ChromeDevTools/chrome-devtools-mcp",
76-
"path": ".github/plugin/plugin.json",
7776
"ref": "chrome-devtools-mcp-v1.0.1"
7877
}
7978
},
@@ -194,13 +193,7 @@
194193
"url": "https://www.figma.com"
195194
},
196195
"homepage": "https://github.com/figma/mcp-server-guide",
197-
"keywords": [
198-
"figma",
199-
"design",
200-
"mcp",
201-
"ui",
202-
"code-connect"
203-
],
196+
"keywords": ["figma", "design", "mcp", "ui", "code-connect"],
204197
"repository": "https://github.com/figma/mcp-server-guide",
205198
"source": {
206199
"source": "github",
@@ -272,14 +265,7 @@
272265
"url": "https://www.microsoft.com"
273266
},
274267
"homepage": "https://github.com/microsoft/Build-CLI",
275-
"keywords": [
276-
"microsoft",
277-
"build",
278-
"ignite",
279-
"events",
280-
"sessions",
281-
"learn"
282-
],
268+
"keywords": ["microsoft", "build", "ignite", "events", "sessions", "learn"],
283269
"license": "Apache-2.0",
284270
"repository": "https://github.com/microsoft/Build-CLI",
285271
"source": {
@@ -296,12 +282,7 @@
296282
"url": "https://www.microsoft.com"
297283
},
298284
"homepage": "https://github.com/dotnet/modernize-dotnet",
299-
"keywords": [
300-
"modernization",
301-
"upgrade",
302-
"migration",
303-
"dotnet"
304-
],
285+
"keywords": ["modernization", "upgrade", "migration", "dotnet"],
305286
"license": "MIT",
306287
"repository": "https://github.com/dotnet/modernize-dotnet",
307288
"source": {

website/src/scripts/modal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ async function openPluginModal(
10551055
function getExternalPluginUrl(plugin: Plugin): string {
10561056
if (plugin.source?.source === "github" && plugin.source.repo) {
10571057
const base = `https://github.com/${plugin.source.repo}`;
1058-
return plugin.source.path
1058+
return plugin.source.path && plugin.source.path !== "/"
10591059
? `${base}/tree/main/${plugin.source.path}`
10601060
: base;
10611061
}

website/src/scripts/pages/plugins-render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function sortPlugins<T extends RenderablePlugin>(
4949
function getExternalPluginUrl(plugin: RenderablePlugin): string {
5050
if (plugin.source?.source === 'github' && plugin.source.repo) {
5151
const base = `https://github.com/${plugin.source.repo}`;
52-
return plugin.source.path ? `${base}/tree/main/${plugin.source.path}` : base;
52+
return plugin.source.path && plugin.source.path !== '/' ? `${base}/tree/main/${plugin.source.path}` : base;
5353
}
5454

5555
return sanitizeUrl(plugin.repository || plugin.homepage);

0 commit comments

Comments
 (0)