Skip to content

Commit c86f146

Browse files
committed
Fix linting errors and unit tests
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent dde346c commit c86f146

File tree

11 files changed

+86
-308
lines changed

11 files changed

+86
-308
lines changed

CANONICAL_REFS_IMPLEMENTATION_SUMMARY.md

Lines changed: 0 additions & 236 deletions
This file was deleted.

docs/reference/api/openapi.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ components:
332332
- identifier
333333
- version
334334
properties:
335+
registryType:
336+
type: string
337+
enum: [npm]
335338
identifier:
336339
type: string
337340
description: "NPM package name (with or without @scope)"
@@ -360,6 +363,9 @@ components:
360363
- identifier
361364
- version
362365
properties:
366+
registryType:
367+
type: string
368+
enum: [pypi]
363369
identifier:
364370
type: string
365371
description: "PyPI package name"
@@ -388,6 +394,9 @@ components:
388394
- identifier
389395
- version
390396
properties:
397+
registryType:
398+
type: string
399+
enum: [nuget]
391400
identifier:
392401
type: string
393402
description: "NuGet package ID"
@@ -415,6 +424,9 @@ components:
415424
required:
416425
- identifier
417426
properties:
427+
registryType:
428+
type: string
429+
enum: [oci]
418430
identifier:
419431
type: string
420432
description: "Full OCI image reference including registry, namespace, image, and tag/digest. Registry defaults to docker.io if not specified. Must include at least a tag or digest."
@@ -435,6 +447,9 @@ components:
435447
- identifier
436448
- fileSha256
437449
properties:
450+
registryType:
451+
type: string
452+
enum: [mcpb]
438453
identifier:
439454
type: string
440455
format: uri

docs/reference/server-json/server.schema.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@
178178
"format": "uri",
179179
"minLength": 1,
180180
"type": "string"
181+
},
182+
"registryType": {
183+
"enum": [
184+
"mcpb"
185+
],
186+
"type": "string"
181187
}
182188
},
183189
"required": [
@@ -209,6 +215,12 @@
209215
"format": "uri",
210216
"type": "string"
211217
},
218+
"registryType": {
219+
"enum": [
220+
"npm"
221+
],
222+
"type": "string"
223+
},
212224
"version": {
213225
"description": "Package version. Must be a specific version. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3', '\u003e=1.2.3', '1.x', '1.*').",
214226
"example": "1.0.2",
@@ -282,6 +294,12 @@
282294
"format": "uri",
283295
"type": "string"
284296
},
297+
"registryType": {
298+
"enum": [
299+
"nuget"
300+
],
301+
"type": "string"
302+
},
285303
"version": {
286304
"description": "Package version. Must be a specific version. Version ranges are rejected.",
287305
"example": "1.0.2",
@@ -319,6 +337,12 @@
319337
],
320338
"minLength": 1,
321339
"type": "string"
340+
},
341+
"registryType": {
342+
"enum": [
343+
"oci"
344+
],
345+
"type": "string"
322346
}
323347
},
324348
"required": [
@@ -490,6 +514,12 @@
490514
"format": "uri",
491515
"type": "string"
492516
},
517+
"registryType": {
518+
"enum": [
519+
"pypi"
520+
],
521+
"type": "string"
522+
},
493523
"version": {
494524
"description": "Package version. Must be a specific version. Version ranges are rejected.",
495525
"example": "1.0.2",

internal/api/handlers/v0/publish_registry_validation_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ func TestPublishRegistryValidation(t *testing.T) {
9595
{
9696
RegistryType: model.RegistryTypeMCPB,
9797
Identifier: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
98-
Version: "0.0.36",
9998
FileSHA256: "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce",
10099
Transport: model.Transport{
101100
Type: model.TransportTypeStdio,
@@ -146,7 +145,6 @@ func TestPublishRegistryValidation(t *testing.T) {
146145
{
147146
RegistryType: model.RegistryTypeMCPB,
148147
Identifier: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
149-
Version: "1.0.0",
150148
FileSHA256: "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce",
151149
Transport: model.Transport{
152150
Type: model.TransportTypeStdio,
@@ -206,7 +204,6 @@ func TestPublishRegistryValidation(t *testing.T) {
206204
{
207205
RegistryType: model.RegistryTypeMCPB,
208206
Identifier: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
209-
Version: "1.0.0",
210207
FileSHA256: "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce",
211208
Transport: model.Transport{
212209
Type: model.TransportTypeStdio,

internal/validators/registries/mcpb.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,3 @@ func isValidGitLabReleaseURL(path string) bool {
158158

159159
return false
160160
}
161-
162-
// inferMCPBRegistryBaseURL infers the registry base URL from an MCPB identifier
163-
func inferMCPBRegistryBaseURL(identifier string) (string, error) {
164-
parsedURL, err := url.Parse(identifier)
165-
if err != nil {
166-
return "", err
167-
}
168-
169-
host := strings.ToLower(parsedURL.Host)
170-
switch host {
171-
case "github.com", "www.github.com":
172-
return model.RegistryURLGitHub, nil
173-
case "gitlab.com", "www.gitlab.com":
174-
return model.RegistryURLGitLab, nil
175-
default:
176-
return "", fmt.Errorf("invalid host for MCPB package: %s, expected github or gitlab", host)
177-
}
178-
}

0 commit comments

Comments
 (0)