mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
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:
co-authored by
Claude Opus 5.5
parent
35753f3821
commit
b2acef5869
@@ -210,7 +210,7 @@ describe("hyperframes skills", () => {
|
||||
const first = state.spawnCalls[0];
|
||||
expect(first).toBeDefined();
|
||||
expect(first!.command).toBe("npx");
|
||||
expect(first!.args).toContain("skills");
|
||||
expect(first!.args).toContain("skills@1.5.13");
|
||||
expect(first!.args).toContain("add");
|
||||
expect(first!.env?.GIT_CLONE_PROTECTION_ACTIVE).toBe("0");
|
||||
// --full-depth clones the repo; skip LFS so we don't drag in unrelated blobs.
|
||||
@@ -223,7 +223,7 @@ describe("hyperframes skills", () => {
|
||||
"npx",
|
||||
["--version"],
|
||||
[
|
||||
"skills",
|
||||
"skills@1.5.13",
|
||||
"add",
|
||||
"https://github.com/heygen-com/hyperframes",
|
||||
"--skill",
|
||||
@@ -240,7 +240,7 @@ describe("hyperframes skills", () => {
|
||||
"npx",
|
||||
["--version"],
|
||||
[
|
||||
"skills",
|
||||
"skills@1.5.13",
|
||||
"add",
|
||||
"https://github.com/heygen-com/hyperframes",
|
||||
"--skill",
|
||||
@@ -261,7 +261,7 @@ describe("hyperframes skills", () => {
|
||||
"/s",
|
||||
"/c",
|
||||
"npx.cmd",
|
||||
"skills",
|
||||
"skills@1.5.13",
|
||||
"add",
|
||||
"https://github.com/heygen-com/hyperframes",
|
||||
"--skill",
|
||||
@@ -322,6 +322,25 @@ describe("hyperframes skills", () => {
|
||||
expect(agentValue).not.toBe("*");
|
||||
});
|
||||
|
||||
// The install uses the ref the check compared against (the CLI's release
|
||||
// tag), resolved once, through the pinned skills CLI.
|
||||
it("skills update installs at the ref its check read, through the pinned skills CLI", async () => {
|
||||
setPlatform("linux");
|
||||
const { checkSkills } = await import("../utils/skillsManifest.js");
|
||||
vi.mocked(checkSkills).mockResolvedValueOnce({ ...DEFAULT_CHECK, ref: "v0.9.3" } as never);
|
||||
|
||||
await runSkillsUpdate();
|
||||
|
||||
expect(await commandExitCode()).toBe(0);
|
||||
const args = state.spawnCalls[0]?.args ?? [];
|
||||
expect(args.slice(0, 3)).toEqual([
|
||||
"skills@1.5.13",
|
||||
"add",
|
||||
"https://github.com/heygen-com/hyperframes#v0.9.3",
|
||||
]);
|
||||
expect(args).toContain("--full-depth");
|
||||
});
|
||||
|
||||
it("skills update refreshes an outdated installed workflow (but never expands)", async () => {
|
||||
setPlatform("linux");
|
||||
const { checkSkills } = await import("../utils/skillsManifest.js");
|
||||
|
||||
@@ -5,6 +5,7 @@ import * as clack from "../ui/prompts.js";
|
||||
import { c } from "../ui/colors.js";
|
||||
import { diag } from "../ui/diagnostics.js";
|
||||
import { buildNpxCommand } from "../utils/npxCommand.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import { withMeta } from "../utils/updateCheck.js";
|
||||
import {
|
||||
checkSkills,
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
presentSkills,
|
||||
RETIRED_SKILLS,
|
||||
retiredSkillNotice,
|
||||
cliReleaseTag,
|
||||
type SkillDiff,
|
||||
type SkillsCheckResult,
|
||||
} from "../utils/skillsManifest.js";
|
||||
@@ -105,7 +107,7 @@ function spawnNpx(args: string[], opts: { cwd?: string } = {}): Promise<void> {
|
||||
// Why --copy: real files (not the upstream symlink default, which re-serialises
|
||||
// each SKILL.md's frontmatter) so an installed bundle byte-matches the published
|
||||
// manifest and `skills check` reads it as current. Why --full-depth: it forces a
|
||||
// full `git clone` of HEAD; without it even a full-URL `skills add` fetches the
|
||||
// full `git clone` of the requested ref; without it even a full-URL `skills add` fetches the
|
||||
// skills.sh registry blob, which lags GitHub main by hours, so a fresh install
|
||||
// would read as several skills "outdated" (verified: blob → ~9 outdated;
|
||||
// --full-depth → all current).
|
||||
@@ -129,13 +131,16 @@ function skillSelectionArgs(selection: SkillSelection): string[] {
|
||||
return names.flatMap((name) => ["--skill", name]);
|
||||
}
|
||||
|
||||
// Pinned: a bare `npx skills` runs whatever upstream published last.
|
||||
const SKILLS_CLI = "skills@1.5.13";
|
||||
|
||||
function runSkillsAdd(
|
||||
source: string,
|
||||
selection: SkillSelection,
|
||||
opts: { cwd?: string } = {},
|
||||
): Promise<void> {
|
||||
return spawnNpx(
|
||||
["skills", "add", source, ...skillSelectionArgs(selection), ...GLOBAL_INSTALL_ARGS_TAIL],
|
||||
[SKILLS_CLI, "add", source, ...skillSelectionArgs(selection), ...GLOBAL_INSTALL_ARGS_TAIL],
|
||||
opts,
|
||||
);
|
||||
}
|
||||
@@ -147,10 +152,9 @@ function runSkillsAdd(
|
||||
// on the Windows `cmd.exe` spawn path, where arg escaping is fragile.
|
||||
const PLAIN_SKILL_NAME = /^[a-z0-9][a-z0-9._-]*$/i;
|
||||
|
||||
// Use the full GitHub URL (not the `owner/repo` slug) as the clone source. The
|
||||
// freshness comes from --full-depth (see GLOBAL_INSTALL_ARGS_TAIL), which clones the
|
||||
// repo at latest `main`; the URL just names what to clone. Our freshness check
|
||||
// resolves "latest" straight from GitHub too, so install and check agree.
|
||||
// Use the full GitHub URL (not the `owner/repo` slug) as the clone source.
|
||||
// --full-depth (see GLOBAL_INSTALL_ARGS_TAIL) clones it at `#<ref>`: the ref the
|
||||
// check read its manifest at (this CLI's release tag), so check and install agree.
|
||||
const SOURCES = [{ name: "HyperFrames", url: "https://github.com/heygen-com/hyperframes" }];
|
||||
|
||||
// Fan HyperFrames' own skills out to every other installed agent. Scope by the
|
||||
@@ -242,13 +246,14 @@ function sanitizeSelection(selection: SkillSelection): SkillSelection | null {
|
||||
|
||||
async function installSkills(
|
||||
selection: SkillSelection,
|
||||
opts: { cwd?: string; strict?: boolean } = {},
|
||||
opts: { cwd?: string; strict?: boolean; ref: string },
|
||||
): Promise<void> {
|
||||
const safeSelection = sanitizeSelection(selection);
|
||||
if (safeSelection === null) return;
|
||||
|
||||
if (!skillsToolingReady(opts.strict ?? false)) return;
|
||||
|
||||
const { ref } = opts;
|
||||
// stderr (via diag): installSkills runs on the `skills update --json` path before
|
||||
// its JSON envelope is written to stdout — progress here must not corrupt it.
|
||||
for (const source of SOURCES) {
|
||||
@@ -256,7 +261,7 @@ async function installSkills(
|
||||
diag.notice(c.bold(`Installing ${source.name} skills...`));
|
||||
diag.notice();
|
||||
try {
|
||||
await runSkillsAdd(source.url, safeSelection, opts);
|
||||
await runSkillsAdd(ref === "main" ? source.url : `${source.url}#${ref}`, safeSelection, opts);
|
||||
} catch (err) {
|
||||
if (opts.strict) throw err instanceof Error ? err : new Error(String(err));
|
||||
// warn, not notice: this is a non-fatal skip after a caught install error.
|
||||
@@ -341,7 +346,7 @@ export async function updateSkills(
|
||||
// that no longer exists, and verifyInstalled would strict-throw on a
|
||||
// "failure" that was never real. Resolving canonically means a retired
|
||||
// skill simply never appears as a target in the first place.
|
||||
check = await checkSkills({ cwd: opts.cwd, canonical: true });
|
||||
check = await checkSkills({ cwd: opts.cwd, canonical: true, cliVersion: VERSION });
|
||||
} catch (err) {
|
||||
// A *malformed* canonical manifest (the server was reached, but served a
|
||||
// bad shape) is otherwise indistinguishable from being offline — both fall
|
||||
@@ -402,7 +407,7 @@ export async function updateSkills(
|
||||
};
|
||||
|
||||
if (toInstall.length > 0) {
|
||||
await installSkills(result.installed, { cwd: opts.cwd, strict });
|
||||
await installSkills(result.installed, { cwd: opts.cwd, strict, ref: check.ref ?? "main" });
|
||||
verifyInstalled(result.installed, { strict, cwd: opts.cwd });
|
||||
}
|
||||
// The install (or the fresh canonical check confirming everything current)
|
||||
@@ -479,7 +484,11 @@ async function updateSkillsOffline(
|
||||
);
|
||||
|
||||
if (absent.length > 0) {
|
||||
await installSkills(absent, { cwd: opts.cwd, strict: opts.strict });
|
||||
await installSkills(absent, {
|
||||
cwd: opts.cwd,
|
||||
strict: opts.strict,
|
||||
ref: cliReleaseTag(VERSION) ?? "main",
|
||||
});
|
||||
verifyInstalled(absent, opts);
|
||||
}
|
||||
return {
|
||||
@@ -572,6 +581,7 @@ const checkCommand = defineCommand({
|
||||
const result = await checkSkills({
|
||||
dir: args.dir,
|
||||
source: args.source,
|
||||
cliVersion: VERSION,
|
||||
});
|
||||
|
||||
if (args.json) console.log(JSON.stringify(withMeta(result), null, 2));
|
||||
|
||||
Reference in New Issue
Block a user