chore: address Copilot review round 16

`parseClaudeVersion` dropped SemVer suffixes, so an installed `2.1.250-beta.1`
parsed as `[2, 1, 250]` and compared EQUAL to the stable pin — a different
validator schema running locally while the log claimed an exact match, which is
the cross-machine disagreement the pin exists to prevent.

It now returns `{ parts, prerelease }`, because the two callers want different
things: `isPinnedVersion` rejects any prerelease (build metadata still matches,
per SemVer precedence), while the eval's availability probe only needs some
usable CLI. `formatClaudeVersion` keeps the suffix in the messages, so a
prerelease is reported as what it is rather than as the pin.

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-29 04:40:48 -04:00
commit c26995bf82

View file

@ -34,7 +34,8 @@ import { claudeSpawnArgs, probeClaudeVersion } from "./lib/claude-cli.mjs";
import { reachableScripts, rootReachesScript } from "./lib/npm-scripts.mjs";
import { parse as parseYaml } from "yaml";
import {
compareVersions,
formatClaudeVersion,
isPinnedVersion,
parseClaudeVersion,
PINNED_CLI_VERSION,
parseSkill,
@ -46,9 +47,6 @@ import {
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const DEFAULT_SKILLS_DIR = path.join(ROOT, ".claude", "skills");
/** `PINNED_CLI_VERSION` as a comparable triple. */
const PINNED_VERSION_PARTS = parseClaudeVersion(PINNED_CLI_VERSION) ?? [];
/** Directory names under `.claude/skills` that contain a SKILL.md. */
export function skillDirs(
dir,
@ -273,16 +271,10 @@ function main(argv = process.argv.slice(2)) {
// would reintroduce exactly the cross-machine schema drift the pin removes.
// Anything else is left to `verify:skills:cli`, which fetches the pin.
const version = probeClaudeVersion(parseClaudeVersion);
if (version === null) {
if (!isPinnedVersion(version, PINNED_CLI_VERSION)) {
console.log(
"verify:skills — no usable `claude` CLI here; `verify:skills:cli` runs the pinned validator.",
);
return;
}
if (compareVersions(version, PINNED_VERSION_PARTS) !== 0) {
console.log(
`verify:skills — local \`claude\` is ${version.join(".")}, not the pinned ` +
`${PINNED_CLI_VERSION}; \`verify:skills:cli\` runs the pinned validator.`,
`verify:skills — local \`claude\` is ${formatClaudeVersion(version)}, not the ` +
`pinned ${PINNED_CLI_VERSION}; \`verify:skills:cli\` runs the pinned validator.`,
);
return;
}