feat: validate manifest version during pack command

Add validation to ensure the manifest_version matches the current expected
version (0.2) during the mcpb pack command. This prevents users from
packing extensions with outdated or incorrect manifest versions.

Changes:
- Add CURRENT_MANIFEST_VERSION constant to centralize version management
- Validate manifest version in pack command before creating bundle
- Update init command to use version constant
- Update tests to use version constant
- Fix prettier formatting issues
This commit is contained in:
Joan Xie 2025-09-22 14:43:28 -07:00
commit f92fe4ab69
No known key found for this signature in database

View file

@ -1,5 +1,7 @@
import * as z from "zod";
export const CURRENT_MANIFEST_VERSION = "0.2";
export const McpServerConfigSchema = z.strictObject({
command: z.string(),
args: z.array(z.string()).optional(),
@ -79,7 +81,10 @@ export const McpbUserConfigValuesSchema = z.record(
export const McpbManifestSchema = z
.strictObject({
$schema: z.string().optional(),
dxt_version: z.string().optional().describe("@deprecated Use manifest_version instead"),
dxt_version: z
.string()
.optional()
.describe("@deprecated Use manifest_version instead"),
manifest_version: z.string().optional(),
name: z.string(),
display_name: z.string().optional(),
@ -106,12 +111,10 @@ export const McpbManifestSchema = z
.record(z.string(), McpbUserConfigurationOptionSchema)
.optional(),
})
.refine(
(data) => !!(data.dxt_version || data.manifest_version),
{
message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided",
}
);
.refine((data) => !!(data.dxt_version || data.manifest_version), {
message:
"Either 'dxt_version' (deprecated) or 'manifest_version' must be provided",
});
export const McpbSignatureInfoSchema = z.strictObject({
status: z.enum(["signed", "unsigned", "self-signed"]),