Remove vLatest concept and associated files
Remove the concept of "vLatest" throughout the codebase to encourage use of McpbManifestAny which supports all manifest versions. Changes include: - Delete src/schemas/latest.ts and src/schemas_loose/latest.ts - Remove vLatest and latest-related exports from schema index files - Remove McpbManifestLatest type, replace McpbManifest to point to McpbManifestAny - Remove LATEST_MANIFEST_VERSION, LATEST_MANIFEST_SCHEMA constants - Update all main export files (index.ts, cli.ts, node.ts) to export from 0.3.js instead of latest.js - Update tests to use v0_3.McpbManifestSchema explicitly - Add @deprecated annotation to McpbManifest directing users to McpbManifestAny This encourages better version compatibility by using the union type that supports all manifest versions rather than assuming a single "latest" version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d7f76fc02d
commit
30a3b8e779
10 changed files with 20 additions and 56 deletions
|
|
@ -3,7 +3,7 @@ export * from "./cli/init.js";
|
||||||
export * from "./cli/pack.js";
|
export * from "./cli/pack.js";
|
||||||
|
|
||||||
// Include all shared exports
|
// Include all shared exports
|
||||||
export * from "./schemas/latest.js";
|
export * from "./schemas/0.3.js";
|
||||||
export * from "./shared/config.js";
|
export * from "./shared/config.js";
|
||||||
export * from "./shared/constants.js";
|
export * from "./shared/constants.js";
|
||||||
export * from "./types.js";
|
export * from "./types.js";
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export * from "./cli/unpack.js";
|
||||||
export * from "./node/files.js";
|
export * from "./node/files.js";
|
||||||
export * from "./node/sign.js";
|
export * from "./node/sign.js";
|
||||||
export * from "./node/validate.js";
|
export * from "./node/validate.js";
|
||||||
export * from "./schemas/latest.js";
|
export * from "./schemas/0.3.js";
|
||||||
export * from "./shared/config.js";
|
export * from "./shared/config.js";
|
||||||
export * from "./shared/constants.js";
|
export * from "./shared/constants.js";
|
||||||
export * from "./types.js";
|
export * from "./types.js";
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export * from "./node/sign.js";
|
||||||
export * from "./node/validate.js";
|
export * from "./node/validate.js";
|
||||||
|
|
||||||
// Include all shared exports
|
// Include all shared exports
|
||||||
export * from "./schemas/latest.js";
|
export * from "./schemas/0.3.js";
|
||||||
export * from "./shared/config.js";
|
export * from "./shared/config.js";
|
||||||
export * from "./shared/constants.js";
|
export * from "./shared/constants.js";
|
||||||
export * from "./types.js";
|
export * from "./types.js";
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,6 @@ export * as v0_1 from "./0.1.js";
|
||||||
export * as v0_2 from "./0.2.js";
|
export * as v0_2 from "./0.2.js";
|
||||||
export * as v0_3 from "./0.3.js";
|
export * as v0_3 from "./0.3.js";
|
||||||
export * as vAny from "./any.js";
|
export * as vAny from "./any.js";
|
||||||
export * as vLatest from "./latest.js";
|
|
||||||
export {
|
|
||||||
MANIFEST_VERSION as LATEST_MANIFEST_VERSION,
|
|
||||||
McpbManifestSchema as LatestMcpbManifestSchema,
|
|
||||||
McpbManifestSchema, // backwards compatibility - exports latest schema
|
|
||||||
} from "./latest.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of manifest versions to their strict schemas
|
* Map of manifest versions to their strict schemas
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from "./0.3.js";
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
export * as v0_1 from "./0.1.js";
|
export * as v0_1 from "./0.1.js";
|
||||||
export * as v0_2 from "./0.2.js";
|
export * as v0_2 from "./0.2.js";
|
||||||
export * as v0_3 from "./0.3.js";
|
export * as v0_3 from "./0.3.js";
|
||||||
export * as latest from "./latest.js";
|
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from "./0.3.js";
|
|
||||||
|
|
@ -1,17 +1,9 @@
|
||||||
import { McpbManifestSchema as ManifestSchemaV0_1 } from "../schemas/0.1.js";
|
import { McpbManifestSchema as ManifestSchemaV0_1 } from "../schemas/0.1.js";
|
||||||
import { McpbManifestSchema as ManifestSchemaV0_2 } from "../schemas/0.2.js";
|
import { McpbManifestSchema as ManifestSchemaV0_2 } from "../schemas/0.2.js";
|
||||||
import { McpbManifestSchema as ManifestSchemaV0_3 } from "../schemas/0.3.js";
|
import { McpbManifestSchema as ManifestSchemaV0_3 } from "../schemas/0.3.js";
|
||||||
import { McpbManifestSchema as CurrentManifestSchema } from "../schemas/latest.js";
|
|
||||||
import { McpbManifestSchema as LooseManifestSchemaV0_1 } from "../schemas_loose/0.1.js";
|
import { McpbManifestSchema as LooseManifestSchemaV0_1 } from "../schemas_loose/0.1.js";
|
||||||
import { McpbManifestSchema as LooseManifestSchemaV0_2 } from "../schemas_loose/0.2.js";
|
import { McpbManifestSchema as LooseManifestSchemaV0_2 } from "../schemas_loose/0.2.js";
|
||||||
import { McpbManifestSchema as LooseManifestSchemaV0_3 } from "../schemas_loose/0.3.js";
|
import { McpbManifestSchema as LooseManifestSchemaV0_3 } from "../schemas_loose/0.3.js";
|
||||||
import { McpbManifestSchema as CurrentLooseManifestSchema } from "../schemas_loose/latest.js";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Latest manifest version - the version that new manifests should use
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export const LATEST_MANIFEST_VERSION = "0.3" as const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default manifest version for new packages
|
* Default manifest version for new packages
|
||||||
|
|
@ -35,15 +27,3 @@ export const MANIFEST_SCHEMAS_LOOSE = {
|
||||||
"0.2": LooseManifestSchemaV0_2,
|
"0.2": LooseManifestSchemaV0_2,
|
||||||
"0.3": LooseManifestSchemaV0_3,
|
"0.3": LooseManifestSchemaV0_3,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the latest manifest schema based on LATEST_MANIFEST_VERSION
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export const LATEST_MANIFEST_SCHEMA = CurrentManifestSchema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the latest loose manifest schema based on LATEST_MANIFEST_VERSION
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export const LATEST_MANIFEST_SCHEMA_LOOSE = CurrentLooseManifestSchema;
|
|
||||||
|
|
|
||||||
19
src/types.ts
19
src/types.ts
|
|
@ -8,14 +8,13 @@ import type {
|
||||||
McpbManifestPlatformOverrideSchema,
|
McpbManifestPlatformOverrideSchema,
|
||||||
McpbManifestPromptSchema,
|
McpbManifestPromptSchema,
|
||||||
McpbManifestRepositorySchema,
|
McpbManifestRepositorySchema,
|
||||||
McpbManifestSchema,
|
|
||||||
McpbManifestServerSchema,
|
McpbManifestServerSchema,
|
||||||
McpbManifestToolSchema,
|
McpbManifestToolSchema,
|
||||||
McpbSignatureInfoSchema,
|
McpbSignatureInfoSchema,
|
||||||
McpbUserConfigurationOptionSchema,
|
McpbUserConfigurationOptionSchema,
|
||||||
McpbUserConfigValuesSchema,
|
McpbUserConfigValuesSchema,
|
||||||
McpServerConfigSchema,
|
McpServerConfigSchema,
|
||||||
} from "./schemas/latest.js";
|
} from "./schemas/0.3.js";
|
||||||
|
|
||||||
export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;
|
export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;
|
||||||
|
|
||||||
|
|
@ -47,22 +46,16 @@ export type McpbUserConfigurationOption = z.infer<
|
||||||
|
|
||||||
export type McpbUserConfigValues = z.infer<typeof McpbUserConfigValuesSchema>;
|
export type McpbUserConfigValues = z.infer<typeof McpbUserConfigValuesSchema>;
|
||||||
|
|
||||||
/**
|
|
||||||
* McpbManifest type for the latest manifest version only
|
|
||||||
* Use this when you specifically need the latest version.
|
|
||||||
*/
|
|
||||||
export type McpbManifestLatest = z.infer<typeof McpbManifestSchema>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias for McpbManifestLatest for backwards compatibility.
|
|
||||||
*/
|
|
||||||
export type McpbManifest = McpbManifestLatest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* McpbManifest type representing the union of all manifest versions
|
* McpbManifest type representing the union of all manifest versions
|
||||||
*/
|
*/
|
||||||
export type McpbManifestAny = z.infer<typeof McpbManifestSchemaAny>;
|
export type McpbManifestAny = z.infer<typeof McpbManifestSchemaAny>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use McpbManifestAny instead to support all manifest versions.
|
||||||
|
*/
|
||||||
|
export type McpbManifest = McpbManifestAny;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about a MCPB package signature
|
* Information about a MCPB package signature
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import { McpbManifestSchema, v0_2, v0_3 } from "../src/schemas/index.js";
|
import { v0_2, v0_3 } from "../src/schemas/index.js";
|
||||||
|
|
||||||
describe("McpbManifestSchema", () => {
|
describe("McpbManifestSchema", () => {
|
||||||
it("should validate a valid manifest", () => {
|
it("should validate a valid manifest", () => {
|
||||||
|
|
@ -9,7 +9,7 @@ describe("McpbManifestSchema", () => {
|
||||||
const manifestContent = readFileSync(manifestPath, "utf-8");
|
const manifestContent = readFileSync(manifestPath, "utf-8");
|
||||||
const manifestData = JSON.parse(manifestContent);
|
const manifestData = JSON.parse(manifestContent);
|
||||||
|
|
||||||
const result = McpbManifestSchema.safeParse(manifestData);
|
const result = v0_3.McpbManifestSchema.safeParse(manifestData);
|
||||||
|
|
||||||
expect(result.success).toBe(true);
|
expect(result.success).toBe(true);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|
@ -23,11 +23,11 @@ describe("McpbManifestSchema", () => {
|
||||||
const manifestContent = readFileSync(manifestPath, "utf-8");
|
const manifestContent = readFileSync(manifestPath, "utf-8");
|
||||||
const manifestData = JSON.parse(manifestContent);
|
const manifestData = JSON.parse(manifestContent);
|
||||||
|
|
||||||
const result = McpbManifestSchema.safeParse(manifestData);
|
const result = v0_3.McpbManifestSchema.safeParse(manifestData);
|
||||||
|
|
||||||
expect(result.success).toBe(false);
|
expect(result.success).toBe(false);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const errors = result.error.issues.map((issue) => issue.path.join("."));
|
const errors = result.error.issues.map((issue: any) => issue.path.join("."));
|
||||||
expect(errors).toContain("author.name");
|
expect(errors).toContain("author.name");
|
||||||
expect(errors).toContain("author.email");
|
expect(errors).toContain("author.email");
|
||||||
expect(errors).toContain("server.type");
|
expect(errors).toContain("server.type");
|
||||||
|
|
@ -134,7 +134,7 @@ describe("McpbManifestSchema", () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = McpbManifestSchema.safeParse(fullManifest);
|
const result = v0_3.McpbManifestSchema.safeParse(fullManifest);
|
||||||
|
|
||||||
expect(result.success).toBe(true);
|
expect(result.success).toBe(true);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|
@ -167,7 +167,7 @@ describe("McpbManifestSchema", () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(true);
|
expect(result.success).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -270,10 +270,10 @@ describe("McpbManifestSchema", () => {
|
||||||
default_locale: "en-US",
|
default_locale: "en-US",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(false);
|
expect(result.success).toBe(false);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const messages = result.error.issues.map((issue) => issue.message);
|
const messages = result.error.issues.map((issue: any) => issue.message);
|
||||||
expect(messages.join(" ")).toContain("${locale}");
|
expect(messages.join(" ")).toContain("${locale}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -286,7 +286,7 @@ describe("McpbManifestSchema", () => {
|
||||||
default_locale: "en_us",
|
default_locale: "en_us",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(false);
|
expect(result.success).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -298,7 +298,7 @@ describe("McpbManifestSchema", () => {
|
||||||
default_locale: "en-US",
|
default_locale: "en-US",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(true);
|
expect(result.success).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -322,7 +322,7 @@ describe("McpbManifestSchema", () => {
|
||||||
...base,
|
...base,
|
||||||
icons: [{ src: "assets/icon.png", size: "16", theme: "light" }],
|
icons: [{ src: "assets/icon.png", size: "16", theme: "light" }],
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(false);
|
expect(result.success).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -331,7 +331,7 @@ describe("McpbManifestSchema", () => {
|
||||||
...base,
|
...base,
|
||||||
icons: [{ src: "assets/icon.png", size: "128x128" }],
|
icons: [{ src: "assets/icon.png", size: "128x128" }],
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(true);
|
expect(result.success).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue