feat: use 0.2 as the default schema (#145)

This commit is contained in:
Samuel Attard 2025-11-01 12:31:25 -07:00 • committed by GitHub
commit 98126b777e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,11 +13,9 @@ import { basename, join, relative, resolve, sep } from "path";
import { getAllFilesWithCount, readMcpbIgnorePatterns } from "../node/files.js";
import { validateManifest } from "../node/validate.js";
import {
LATEST_MANIFEST_SCHEMA,
LATEST_MANIFEST_VERSION,
} from "../shared/constants.js";
import { MANIFEST_SCHEMAS } from "../shared/constants.js";
import { getLogger } from "../shared/log.js";
import { getManifestVersionFromRawData } from "../shared/manifestVersionResolve.js";
import { initExtension } from "./init.js";
interface PackOptions {
@ -95,7 +93,18 @@ export async function packExtension({
try {
const manifestContent = readFileSync(manifestPath, "utf-8");
const manifestData = JSON.parse(manifestContent);
manifest = LATEST_MANIFEST_SCHEMA.parse(manifestData);
const manifestVersion = getManifestVersionFromRawData(manifestData);
if (!manifestVersion) {
logger.error(
`ERROR: Manifest version mismatch. Expected "${Object.keys(MANIFEST_SCHEMAS).join(" or ")}", found "${manifestVersion}"`,
);
logger.error(
` Please update the manifest_version in your manifest.json to a supported version`,
);
return false;
}
manifest = MANIFEST_SCHEMAS[manifestVersion].parse(manifestData);
} catch (error) {
logger.error("ERROR: Failed to parse manifest.json");
if (error instanceof Error) {
@ -104,17 +113,6 @@ export async function packExtension({
return false;
}
const manifestVersion = manifest.manifest_version || manifest.dxt_version;
if (manifestVersion !== LATEST_MANIFEST_VERSION) {
logger.error(
`ERROR: Manifest version mismatch. Expected "${LATEST_MANIFEST_VERSION}", found "${manifestVersion}"`,
);
logger.error(
` Please update the manifest_version in your manifest.json to "${LATEST_MANIFEST_VERSION}"`,
);
return false;
}
// Determine output path
const extensionName = basename(resolvedPath);
const finalOutputPath = outputPath