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:
parent
3905ceef06
commit
c26995bf82
1 changed files with 102 additions and 54 deletions
|
|
@ -25,14 +25,12 @@ import { fileURLToPath } from "node:url";
|
|||
import { probeClaudeVersion } from "./lib/claude-cli.mjs";
|
||||
import { winShellArgs } from "./lib/win-shell-args.mjs";
|
||||
import {
|
||||
compareVersions,
|
||||
formatClaudeVersion,
|
||||
isPinnedVersion,
|
||||
parseClaudeVersion,
|
||||
PINNED_CLI_VERSION,
|
||||
} from "./lib/skill-manifest.mjs";
|
||||
|
||||
/** `PINNED_CLI_VERSION` as a comparable triple. */
|
||||
const PINNED_VERSION_PARTS = parseClaudeVersion(PINNED_CLI_VERSION) ?? [];
|
||||
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const SKILLS_DIR = ".claude/skills";
|
||||
|
||||
|
|
@ -49,20 +47,17 @@ const SKILLS_DIR = ".claude/skills";
|
|||
* @returns {{ command: string, args: string[], via: string }}
|
||||
*/
|
||||
export function validatorCommand({ version }) {
|
||||
if (
|
||||
version !== null &&
|
||||
compareVersions(version, PINNED_VERSION_PARTS) === 0
|
||||
) {
|
||||
if (isPinnedVersion(version, PINNED_CLI_VERSION)) {
|
||||
return {
|
||||
command: "claude",
|
||||
args: ["plugin", "validate", SKILLS_DIR],
|
||||
via: `local claude ${version.join(".")} (matches the pin)`,
|
||||
via: `local claude ${formatClaudeVersion(version)} (matches the pin)`,
|
||||
};
|
||||
}
|
||||
const why =
|
||||
version === null
|
||||
? "no local CLI"
|
||||
: `local CLI is ${version.join(".")}, not the pinned ${PINNED_CLI_VERSION}`;
|
||||
: `local CLI is ${formatClaudeVersion(version)}, not the pinned ${PINNED_CLI_VERSION}`;
|
||||
return {
|
||||
command: "npx",
|
||||
args: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue