fix(cli): no auto-update across 0.x minors; install skills at the CLI's release tag (#7013)

* fix(cli): no auto-update across 0.x minors; install skills at the CLI's release tag

- autoUpdate: before 1.0 a minor bump counts as a major one, so 0.8.x -> 0.9.x
  is a notice, not a silent background install. From 1.0 on, the major alone.
- skills: `skills update` / bare `skills` / `init` install from
  heygen-com/hyperframes#v<VERSION>, and `skills check` plus the background
  freshness nudge read the manifest at the same tag. A build the repo has no
  tag for (dev build) falls back to main, as before.
- skills: run the upstream installer as `npx skills@1.7.4` instead of an
  unpinned `npx skills`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep the comment share of the touched files from rising

Comment ratchet: trim the comments added in the previous commit. No code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): pass the CLI version into the skills check instead of importing it

scripts/clawhub-unlist-retired.mjs loads skillsManifest.ts from source under
plain node, which cannot resolve a relative `../version.js` import. Callers now
pass `cliVersion` (and skillsSourceRef takes it as an argument), so the module
keeps importing only node builtins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): read skills at the CLI's tag without a probe; pin skills@1.5.13

- A release build reads the manifest at its own tag directly (publish pushes
  the tag before npm publish). Only a 404 for that manifest falls back to main;
  a timeout, missing git or proxy error now surfaces instead of quietly
  comparing against main, so the background nudge can't cache a false
  "outdated" count.
- checkSkills returns the ref it read, and skills update installs from that
  same ref, so check and install can't disagree within one run.
- Pin skills@1.5.13 (it parses `#<ref>` too) so the pin matches the version
  agentDirs.generated.ts and the lock-path notes were checked against.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(cli): split the tag and main manifest fetches

Fallow flagged fetchRemoteManifest's CRAP score (31.6 > 30). The tag fetch
(404 is the only fallback to main) and the SHA-pinned main fetch are now their
own functions. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): never auto-upgrade a Homebrew install

`brew upgrade hyperframes` installs whatever formula the tap holds, so a
background run scheduled for an allowed patch could still cross a 0.x minor.
Homebrew installs now only get the update notice naming `brew upgrade`.
A new test drives the scheduler through the real installer detection and
installer script: no spawn on Homebrew, a versioned npm install for a patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Wenbo Zhu
2026-11-03 13:21:39 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 35753f3821
commit b2acef5869
12 changed files with 445 additions and 60 deletions
+32 -21
View File
@@ -12,9 +12,9 @@
* marker. The user is now on the new version.
*
* Guardrails:
* - Never auto-update across major versions. The user opts in explicitly
* via `hyperframes upgrade`.
* - Skip on CI, unattended runs (agents, no TTY), dev mode, unknown installer, ephemeral exec (npx),
* - Never auto-update across major versions (or minor versions while in
* 0.x). The user opts in explicitly via `hyperframes upgrade`.
* - Skip on CI, unattended runs (agents, no TTY), dev mode, Homebrew, unknown installer, ephemeral exec (npx),
* or when `HYPERFRAMES_NO_AUTO_INSTALL` / `HYPERFRAMES_NO_UPDATE_CHECK`
* is set.
* - If a previous install is still in flight (less than 10 min old), don't
@@ -53,10 +53,11 @@ function isAutoInstallDisabled(): boolean {
);
}
/** Parse a semver-ish string's major number; returns NaN for pre-releases etc. */
function majorOf(version: string): number {
const match = /^(\d+)\./.exec(version);
return match?.[1] ? Number.parseInt(match[1], 10) : Number.NaN;
/** `0.<minor>` before 1.0 (a 0.x minor may break), `<major>` after; null when unparsable. */
function breakingLine(version: string): string | null {
const match = /^(\d+)\.(\d+)\./.exec(version);
if (!match) return null;
return match[1] === "0" ? `0.${match[2]}` : String(match[1]);
}
/**
@@ -242,18 +243,33 @@ function isSilentUpgrade(latestVersion: string, currentVersion: string): boolean
}
if (cmp <= 0) return false;
// Major-version jumps carry breaking-change risk. Don't silent-install;
// the existing `printUpdateNotice` banner nudges the user to run
// `hyperframes upgrade` explicitly.
const latestMajor = majorOf(latestVersion);
const currentMajor = majorOf(currentVersion);
if (Number.isFinite(latestMajor) && Number.isFinite(currentMajor) && latestMajor > currentMajor) {
// Major-version jumps (minor jumps while in 0.x) carry breaking-change risk.
// Don't silent-install; the existing `printUpdateNotice` banner nudges the
// user to run `hyperframes upgrade` explicitly.
const latestLine = breakingLine(latestVersion);
const currentLine = breakingLine(currentVersion);
if (latestLine !== null && currentLine !== null && latestLine !== currentLine) {
log(`[skip] major-bump ${currentVersion} -> ${latestVersion}`);
return false;
}
return true;
}
/** The install to run unattended, or null when this installer cannot be held to `version`. */
function backgroundInstaller(
version: string,
): { installCommand: string; invocation: InstallInvocation } | null {
const installer = detectInstaller();
if (installer.kind === "skip" || installer.kind === "brew") {
const brew = `brew upgrade installs the tap's formula, not ${version}; notice only`;
log(`[skip] ${installer.kind === "brew" ? brew : installer.reason}`);
return null;
}
const installCommand = installer.installCommand(version);
const invocation = installInvocation(installer.kind, version);
return installCommand && invocation ? { installCommand, invocation } : null;
}
/**
* If a new version is available and policy allows, kick off a detached
* installer. Returns whether an install was spawned (for tests).
@@ -262,14 +278,9 @@ export function scheduleBackgroundInstall(latestVersion: string, currentVersion:
if (isAutoInstallDisabled()) return false;
if (!isSilentUpgrade(latestVersion, currentVersion)) return false;
const installer = detectInstaller();
if (installer.kind === "skip") {
log(`[skip] ${installer.reason}`);
return false;
}
const installCommand = installer.installCommand(latestVersion);
const invocation = installInvocation(installer.kind, latestVersion);
if (!installCommand || !invocation) return false;
const installer = backgroundInstaller(latestVersion);
if (!installer) return false;
const { installCommand, invocation } = installer;
const config = readConfig();