fix(skill): pin packaged commands to the shipping package version (#1346)
Fixes #1338. Use canonical product identity for bundled command versions and keep build-cache fixtures aligned. Verified 10 focused tests, actual CLI installation/repair/uninstall scenarios and all 19 final-head CI checks. Co-authored-by: Yi-111-a <97448247+Yi-111-a@users.noreply.github.com>
This commit is contained in:
@@ -151,6 +151,8 @@ const createBuildCacheFixture = async (): Promise<string> => {
|
||||
const scripts = asRecord(packageJson?.scripts);
|
||||
if (
|
||||
packageJson === undefined ||
|
||||
typeof packageJson.name !== "string" ||
|
||||
typeof packageJson.version !== "string" ||
|
||||
typeof scripts?.["build:cached"] !== "string"
|
||||
)
|
||||
throw new Error("package is missing its cached build command");
|
||||
@@ -189,12 +191,11 @@ const createBuildCacheFixture = async (): Promise<string> => {
|
||||
);
|
||||
await writeFile(
|
||||
join(root, "scripts/cache-fixture-build.mjs"),
|
||||
`import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
const { name, version } = JSON.parse(await readFile("package.json", "utf8"));
|
||||
`import { mkdir, writeFile } from "node:fs/promises";
|
||||
await mkdir("dist", { recursive: true });
|
||||
await writeFile("dist/cache-fixture.js", "built");
|
||||
await writeFile("dist/catalogIdentity.js", "export const CATALOG_IDENTITY = { counts: { mcp_tools: 1 } };\\n");
|
||||
await writeFile("dist/generatedPackageMetadata.js", "export const PACKAGE_METADATA = " + JSON.stringify({ name, version }) + ";\\n");
|
||||
await writeFile("dist/identity.js", ${JSON.stringify(`export const PRODUCT_IDENTITY = ${JSON.stringify({ packageSpecifier: `${packageJson.name}@latest`, registrationPackageSpecifier: `${packageJson.name}@${packageJson.version}` })};\n`)});
|
||||
`,
|
||||
);
|
||||
await createNodeModulesLinks(root);
|
||||
|
||||
Reference in New Issue
Block a user