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

@ -2,6 +2,8 @@ import { execSync } from "node:child_process";
import fs from "node:fs";
import { join } from "node:path";
import { CURRENT_MANIFEST_VERSION } from "../src/schemas.js";
interface ExecSyncError extends Error {
stdout: Buffer;
stderr: Buffer;
@ -91,7 +93,7 @@ describe("DXT CLI", () => {
fs.writeFileSync(
join(tempDir, "manifest.json"),
JSON.stringify({
manifest_version: "1.0",
manifest_version: CURRENT_MANIFEST_VERSION,
name: "Test Extension",
version: "1.0.0",
description: "A test extension",
@ -188,7 +190,7 @@ describe("DXT CLI", () => {
fs.writeFileSync(
join(tempExecDir, "manifest.json"),
JSON.stringify({
manifest_version: "1.0",
manifest_version: CURRENT_MANIFEST_VERSION,
name: "Test Executable Extension",
version: "1.0.0",
description: "A test extension with executable files",