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:
yi111
2026-10-10 04:47:10 +08:00
committed by GitHub
co-authored by Yi-111-a
parent 048b79878c
commit f39e71ce18
3 changed files with 10 additions and 9 deletions
+4 -4
View File
@@ -20,8 +20,8 @@ const cacheBust = String(Date.now());
const { CATALOG_IDENTITY } = await import(
`${pathToFileURL(join(root, "dist/catalogIdentity.js")).href}?${cacheBust}`
);
const { PACKAGE_METADATA } = await import(
`${pathToFileURL(join(root, "dist/generatedPackageMetadata.js")).href}?${cacheBust}`
const { PRODUCT_IDENTITY } = await import(
`${pathToFileURL(join(root, "dist/identity.js")).href}?${cacheBust}`
);
if (/^\s{2}(?:tool_count|catalog_digest):/mu.test(current))
throw new Error(
@@ -31,8 +31,8 @@ const versionLine = /^ {2}version: "[^"\r\n]+"$/mu;
if (!versionLine.test(current))
throw new Error("Missing authored skill version");
// A shipped skill must run the version it ships with, not whatever `@latest` resolves to.
const latestSpecifier = `${PACKAGE_METADATA.name}@latest`;
const pinnedSpecifier = `${PACKAGE_METADATA.name}@${PACKAGE_METADATA.version}`;
const latestSpecifier = PRODUCT_IDENTITY.packageSpecifier;
const pinnedSpecifier = PRODUCT_IDENTITY.registrationPackageSpecifier;
const source = current
.replace(
versionLine,