Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/cli/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { z } from "zod";

// Import the schema for DEFAULT_MANIFEST_VERSION
// TODO: Allow dynamic manifest version choice
import type { McpbManifestSchema } from "../schemas/0.2.js";
import type { McpbManifestSchema } from "../schemas/0.3.js";
import { DEFAULT_MANIFEST_VERSION } from "../shared/constants.js";

interface PackageJson {
Expand Down Expand Up @@ -877,10 +877,10 @@ export function buildManifest(
license: string;
repository?: { type: string; url: string };
},
// localization?: {
// resources: string;
// default_locale: string;
// },
localization?: {
resources: string;
default_locale: string;
},
): z.infer<typeof McpbManifestSchema> {
const { name, displayName, version, description, authorName } = basicInfo;
const { authorEmail, authorUrl } = authorInfo;
Expand Down Expand Up @@ -909,7 +909,7 @@ export function buildManifest(
...(visualAssets.screenshots.length > 0
? { screenshots: visualAssets.screenshots }
: {}),
// ...(localization ? { localization } : {}),
...(localization ? { localization } : {}),
server: {
type: serverType,
entry_point: entryPoint,
Expand Down Expand Up @@ -994,9 +994,9 @@ export async function initExtension(
const visualAssets = nonInteractive
? { icon: "", icons: [], screenshots: [] }
: await promptVisualAssets();
// const localization = nonInteractive
// ? undefined
// : await promptLocalization();
const localization = nonInteractive
? undefined
: await promptLocalization();
const serverConfig = nonInteractive
? getDefaultServerConfig(packageData)
: await promptServerConfig(packageData);
Expand Down Expand Up @@ -1029,6 +1029,7 @@ export async function initExtension(
compatibility,
userConfig,
optionalFields,
localization,
);

// Write manifest
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const LATEST_MANIFEST_VERSION = "0.3" as const;
/**
* Default manifest version for new packages
*/
export const DEFAULT_MANIFEST_VERSION = "0.2" as const;
export const DEFAULT_MANIFEST_VERSION = "0.3" as const;

/**
* Map of manifest versions to their strict schemas
Expand Down
15 changes: 10 additions & 5 deletions test/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe("init functions", () => {
keywords: "",
license: "",
},
// undefined, // localization
undefined, // localization
);

expect(manifest).toEqual({
Expand Down Expand Up @@ -315,10 +315,11 @@ describe("init functions", () => {
license: "MIT",
repository: { type: "git", url: "https://github.com/user/repo" },
},
// { // localization
// resources: "resources/${locale}.json",
// default_locale: "en-US",
// },
{
// localization
resources: "resources/${locale}.json",
default_locale: "en-US",
},
);

expect(manifest).toEqual({
Expand Down Expand Up @@ -388,6 +389,10 @@ describe("init functions", () => {
keywords: ["test", "extension", "mcp"],
license: "MIT",
repository: { type: "git", url: "https://github.com/user/repo" },
localization: {
default_locale: "en-US",
resources: "resources/${locale}.json",
},
});
});
});
Expand Down