From 257af308122753c311825523d19e8c939aeaccc5 Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Thu, 30 Oct 2025 16:26:55 -0700 Subject: [PATCH] fix: update icon size property from 'sizes' to 'size' in manifest and schema files --- MANIFEST.md | 12 ++++++------ schemas/mcpb-manifest-latest.schema.json | 4 ++-- schemas/mcpb-manifest-v0.3.schema.json | 4 ++-- src/cli/init.ts | 8 ++++---- src/schemas/0.3.ts | 4 ++-- src/schemas_loose/0.3.ts | 4 ++-- test/init.test.ts | 8 ++++---- test/schemas.test.ts | 8 ++++---- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/MANIFEST.md b/MANIFEST.md index bedc65e..0358799 100644 --- a/MANIFEST.md +++ b/MANIFEST.md @@ -93,12 +93,12 @@ A full `manifest.json` with most of the optional fields looks like this: "icons": [ { "src": "assets/icons/icon-16-light.png", - "sizes": "16x16", + "size": "16x16", "theme": "light" }, { "src": "assets/icons/icon-16-dark.png", - "sizes": "16x16", + "size": "16x16", "theme": "dark" } ], @@ -237,7 +237,7 @@ A full `manifest.json` with most of the optional fields looks like this: ### Optional Fields - **icon**: Path to a png icon file, either relative in the package or a `https://` url. -- **icons**: Array of icon descriptors (`src`, `sizes`, optional `theme`) for light/dark or size-specific assets. +- **icons**: Array of icon descriptors (`src`, `size`, optional `theme`) for light/dark or size-specific assets. - 🌎 **display_name**: Human-friendly name for UI display. This field is localizable. - 🌎 **long_description**: Detailed description for extension stores, markdown. This field is localizable. - **repository**: Source code repository information (type and url). @@ -288,12 +288,12 @@ Use the `icons` array when you need multiple icon variants (different sizes or t ```json "icons": [ - { "src": "assets/icons/icon-16-light.png", "sizes": "16x16", "theme": "light" }, - { "src": "assets/icons/icon-16-dark.png", "sizes": "16x16", "theme": "dark" } + { "src": "assets/icons/icon-16-light.png", "size": "16x16", "theme": "light" }, + { "src": "assets/icons/icon-16-dark.png", "size": "16x16", "theme": "dark" } ] ``` -- `sizes` must be in `WIDTHxHEIGHT` form (e.g., `128x128`). +- `size` must be in `WIDTHxHEIGHT` form (e.g., `128x128`). - `theme` is optional; use values like `light`, `dark`, or platform-specific labels (e.g., `high-contrast`). - The legacy `icon` field remains supported for single assets—clients use it when `icons` is omitted. diff --git a/schemas/mcpb-manifest-latest.schema.json b/schemas/mcpb-manifest-latest.schema.json index a2dc082..64471c5 100644 --- a/schemas/mcpb-manifest-latest.schema.json +++ b/schemas/mcpb-manifest-latest.schema.json @@ -88,7 +88,7 @@ "src": { "type": "string" }, - "sizes": { + "size": { "type": "string", "pattern": "^\\d+x\\d+$" }, @@ -99,7 +99,7 @@ }, "required": [ "src", - "sizes" + "size" ], "additionalProperties": false } diff --git a/schemas/mcpb-manifest-v0.3.schema.json b/schemas/mcpb-manifest-v0.3.schema.json index a2dc082..64471c5 100644 --- a/schemas/mcpb-manifest-v0.3.schema.json +++ b/schemas/mcpb-manifest-v0.3.schema.json @@ -88,7 +88,7 @@ "src": { "type": "string" }, - "sizes": { + "size": { "type": "string", "pattern": "^\\d+x\\d+$" }, @@ -99,7 +99,7 @@ }, "required": [ "src", - "sizes" + "size" ], "additionalProperties": false } diff --git a/src/cli/init.ts b/src/cli/init.ts index 3111b3f..58a7317 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -456,7 +456,7 @@ export async function promptVisualAssets() { const icons: Array<{ src: string; - sizes: string; + size: string; theme?: string; }> = []; @@ -472,7 +472,7 @@ export async function promptVisualAssets() { }, }); - const iconSizes = await input({ + const iconSize = await input({ message: "Icon size (e.g., 16x16):", validate: (value) => { if (!value.trim()) return "Icon size is required"; @@ -490,7 +490,7 @@ export async function promptVisualAssets() { icons.push({ src: iconSrc, - sizes: iconSizes, + size: iconSize, ...(iconTheme.trim() ? { theme: iconTheme.trim() } : {}), }); @@ -825,7 +825,7 @@ export function buildManifest( icon: string; icons: Array<{ src: string; - sizes: string; + size: string; theme?: string; }>; screenshots: string[]; diff --git a/src/schemas/0.3.ts b/src/schemas/0.3.ts index 126b532..2bdc946 100644 --- a/src/schemas/0.3.ts +++ b/src/schemas/0.3.ts @@ -98,11 +98,11 @@ export const McpbManifestLocalizationSchema = z.strictObject({ export const McpbManifestIconSchema = z.strictObject({ src: z.string(), - sizes: z + size: z .string() .regex( ICON_SIZE_REGEX, - 'sizes must be in the format "WIDTHxHEIGHT" (e.g., "16x16")', + 'size must be in the format "WIDTHxHEIGHT" (e.g., "16x16")', ), theme: z.string().min(1, "theme cannot be empty when provided").optional(), }); diff --git a/src/schemas_loose/0.3.ts b/src/schemas_loose/0.3.ts index 6731a36..87ac125 100644 --- a/src/schemas_loose/0.3.ts +++ b/src/schemas_loose/0.3.ts @@ -102,11 +102,11 @@ export const McpbManifestLocalizationSchema = z export const McpbManifestIconSchema = z .object({ src: z.string(), - sizes: z + size: z .string() .regex( ICON_SIZE_REGEX, - 'sizes must be in the format "WIDTHxHEIGHT" (e.g., "16x16")', + 'size must be in the format "WIDTHxHEIGHT" (e.g., "16x16")', ), theme: z.string().min(1).optional(), }) diff --git a/test/init.test.ts b/test/init.test.ts index 4894c9e..caf598f 100644 --- a/test/init.test.ts +++ b/test/init.test.ts @@ -263,12 +263,12 @@ describe("init functions", () => { icons: [ { src: "assets/icons/icon-16-light.png", - sizes: "16x16", + size: "16x16", theme: "light", }, { src: "assets/icons/icon-16-dark.png", - sizes: "16x16", + size: "16x16", theme: "dark", }, ], @@ -341,12 +341,12 @@ describe("init functions", () => { icons: [ { src: "assets/icons/icon-16-light.png", - sizes: "16x16", + size: "16x16", theme: "light", }, { src: "assets/icons/icon-16-dark.png", - sizes: "16x16", + size: "16x16", theme: "dark", }, ], diff --git a/test/schemas.test.ts b/test/schemas.test.ts index d05551a..70f181f 100644 --- a/test/schemas.test.ts +++ b/test/schemas.test.ts @@ -76,12 +76,12 @@ describe("McpbManifestSchema", () => { icons: [ { src: "assets/icons/icon-16-light.png", - sizes: "16x16", + size: "16x16", theme: "light", }, { src: "assets/icons/icon-16-dark.png", - sizes: "16x16", + size: "16x16", theme: "dark", }, ], @@ -320,7 +320,7 @@ describe("McpbManifestSchema", () => { it("rejects icons with invalid size format", () => { const manifest = { ...base, - icons: [{ src: "assets/icon.png", sizes: "16", theme: "light" }], + icons: [{ src: "assets/icon.png", size: "16", theme: "light" }], }; const result = McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(false); @@ -329,7 +329,7 @@ describe("McpbManifestSchema", () => { it("allows icons without theme", () => { const manifest = { ...base, - icons: [{ src: "assets/icon.png", sizes: "128x128" }], + icons: [{ src: "assets/icon.png", size: "128x128" }], }; const result = McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(true);