mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
fix(skills): the launcher's floor is 0.9.65, the oldest release Desktop ships (#8159)
* fix(skills): the launcher's floor is 0.9.65, the oldest release Desktop ships The skill launcher now refuses any HyperFrames release older than 0.9.65, the oldest release the HyperFrames Desktop app ships. This applies to --cli-version, to HYPERFRAMES_STANDALONE_CLI_VERSION, to a helper started with --script and to a plugin manifest pin. A standalone install's default npx range starts at 0.9.65. Every plugin manifest in this repo already pins 0.9.65. The skills guide and the plugin installation reference name the current floor, and a test keeps them in step with the launcher. Desktop's release checks read the floor from the published launcher, so a comment asks that it stay a string literal. * test(skills): a helper started with --script forwards a release at the launcher's floor The accept loop now also starts a --script helper, so all four paths are shown accepting 0.9.65.
This commit is contained in:
@@ -153,8 +153,8 @@ particular release, the agent passes `--cli-version latest` or `--cli-version <e
|
||||
the installed launcher before the CLI command. This also works for releases with a prerelease
|
||||
suffix. A project's `package.json` pin does not choose that release; the agent runs a pinned
|
||||
release only when you ask for it. The launcher refuses a release older than its floor, whether a
|
||||
plugin pins it or the agent selects it. The floor is the oldest release with the protections for
|
||||
projects you receive from others. Plugin installs keep their pin.
|
||||
plugin pins it or the agent selects it. The floor (currently 0.9.65) is the oldest release with
|
||||
the protections for projects you receive from others. Plugin installs keep their pin.
|
||||
The agent runs a project's own npm scripts only when you ask for one by name.
|
||||
|
||||
## Install more only when you need it
|
||||
|
||||
@@ -137,6 +137,22 @@ test("the project upgrade flow stops on a failed check instead of running the pr
|
||||
assert.match(lifecycle, /unless the person asks for that release/);
|
||||
});
|
||||
|
||||
// fails without the fix: the docs said only "its floor", so a reader could not tell which releases
|
||||
// the launcher refuses.
|
||||
test("the launcher docs name the launcher's current floor", () => {
|
||||
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), "utf8");
|
||||
const floor = /^const CLI_FLOOR = "([^"]+)";$/m.exec(
|
||||
read("skills/hyperframes/scripts/plugin-cli.mjs"),
|
||||
)?.[1];
|
||||
assert.ok(floor);
|
||||
for (const path of [
|
||||
"docs/guides/skills.mdx",
|
||||
"skills/hyperframes/references/plugin-installation.md",
|
||||
]) {
|
||||
assert.ok(read(path).replace(/\s+/g, " ").includes(`floor (currently ${floor})`), path);
|
||||
}
|
||||
});
|
||||
|
||||
test("reads the registered commands, quoted or not", () => {
|
||||
const source = `const commandLoaders = {\n init: () => x,\n "catch-up": () => y,\n};`;
|
||||
assert.deepEqual([...registeredCommands(source)], ["init", "catch-up"]);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"files": 3
|
||||
},
|
||||
"hyperframes": {
|
||||
"hash": "4c6990e1a05bfec1",
|
||||
"hash": "e39e211438a19c73",
|
||||
"files": 81
|
||||
},
|
||||
"hyperframes-cli": {
|
||||
|
||||
@@ -24,8 +24,8 @@ Without a plugin manifest, the launcher runs the newest compatible published CLI
|
||||
release, put `--cli-version latest` or `--cli-version <exact-version>` before the command.
|
||||
Take an exact version from the person, from the version an upgrade moves the pins to, or from
|
||||
`--cli-version latest --version`. Never take it from the project's own files: a `package.json`
|
||||
pin does not choose the CLI unless the person asks for that release. The launcher refuses a release older than its floor, the oldest one with the
|
||||
protections for received projects, and its error names the floor.
|
||||
pin does not choose the CLI unless the person asks for that release. The launcher refuses a release older than its floor (currently 0.9.65), the oldest one with
|
||||
the protections for received projects, and its error names the floor.
|
||||
Use the launcher from the loaded skill installation for commands shown in CLI output, too.
|
||||
For example, run `node "<SKILLS>/hyperframes/scripts/plugin-cli.mjs" --cli-version latest --version`
|
||||
to read the current release. If the installed launcher lacks this option, ask the person to update
|
||||
|
||||
@@ -21,7 +21,8 @@ const manifests = [
|
||||
// The oldest release this launcher starts, for a plugin pin or any standalone selection. It matches
|
||||
// the oldest release the HyperFrames Desktop app ships, which has every protection for projects
|
||||
// received from someone else, so a pin copied from a project never runs a CLI without them.
|
||||
const CLI_FLOOR = "0.9.64";
|
||||
// Desktop's release checks read this line from the published package, so it stays a string literal.
|
||||
const CLI_FLOOR = "0.9.65";
|
||||
export const STANDALONE_CLI = `hyperframes@>=${CLI_FLOOR}`;
|
||||
|
||||
const realOrResolved = (path) => {
|
||||
|
||||
@@ -64,7 +64,7 @@ test("a standalone install runs the newest CLI that moves into the project, and
|
||||
cwd: "/work/project",
|
||||
npmCwd: "/home/person",
|
||||
});
|
||||
assert.equal(STANDALONE_CLI, "hyperframes@>=0.9.64");
|
||||
assert.equal(STANDALONE_CLI, "hyperframes@>=0.9.65");
|
||||
assert.equal(result.command, "npx");
|
||||
assert.equal(result.cwd, "/home/person");
|
||||
assert.deepEqual(result.args, ["--yes", STANDALONE_CLI, "skills", "update"]);
|
||||
@@ -97,7 +97,7 @@ test("standalone release selection keeps npm in the home folder and passes only
|
||||
};
|
||||
for (const [release, args] of [
|
||||
["latest", ["upgrade", "--project", ".", "--check"]],
|
||||
["0.9.64+build-1", ["--version"]],
|
||||
["0.9.65+build-1", ["--version"]],
|
||||
["1.0.0-rc.1", ["reverse", "start", "a b.mp4"]],
|
||||
]) {
|
||||
const run = invocation(["--cli-version", release, ...args], options);
|
||||
@@ -121,8 +121,8 @@ test("standalone release selection keeps npm in the home folder and passes only
|
||||
/requires latest or an exact/,
|
||||
);
|
||||
}
|
||||
for (const release of ["0.9.33", "0.9.64-rc.1+build"]) {
|
||||
assert.throws(() => invocation(["--cli-version", release], options), /0\.9\.64 or newer/);
|
||||
for (const release of ["0.9.33", "0.9.65-rc.1+build"]) {
|
||||
assert.throws(() => invocation(["--cli-version", release], options), /0\.9\.65 or newer/);
|
||||
}
|
||||
assert.throws(
|
||||
() => invocation(["--cli-version", "latest"], { version: "1.2.3" }),
|
||||
@@ -134,18 +134,20 @@ test("standalone release selection keeps npm in the home folder and passes only
|
||||
// received project's package.json could start a CLI without the protections for received projects.
|
||||
test("a standalone selection older than the floor is refused, by flag or by environment", () => {
|
||||
const options = { version: null, platform: "linux", npmCwd: "/home/person", env: {} };
|
||||
const tooOld = /lacks protections for received projects; this launcher runs 0\.9\.64 or newer/;
|
||||
for (const release of ["0.9.34", "0.9.40", "0.9.63"]) {
|
||||
const tooOld = /lacks protections for received projects; this launcher runs 0\.9\.65 or newer/;
|
||||
for (const release of ["0.9.34", "0.9.63", "0.9.64"]) {
|
||||
assert.throws(() => invocation(["--cli-version", release, "check"], options), tooOld);
|
||||
const env = { HYPERFRAMES_STANDALONE_CLI_VERSION: release };
|
||||
assert.throws(() => invocation(["check"], { ...options, env }), tooOld);
|
||||
assert.throws(() => invocation(["--script", "helper.mjs"], { ...options, env }), tooOld);
|
||||
}
|
||||
for (const release of ["latest", "0.9.64", "0.10.0"]) {
|
||||
for (const release of ["latest", "0.9.65", "0.10.0"]) {
|
||||
const env = { HYPERFRAMES_STANDALONE_CLI_VERSION: release };
|
||||
const spec = `hyperframes@${release}`;
|
||||
assert.equal(invocation(["--cli-version", release, "check"], options).args[1], spec);
|
||||
assert.equal(invocation(["check"], { ...options, env }).args[1], spec);
|
||||
const helper = invocation(["--script", "helper.mjs"], { ...options, env });
|
||||
assert.equal(helper.env.HYPERFRAMES_STANDALONE_CLI_VERSION, release);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -304,11 +306,11 @@ for (const [install, manifest, spec] of [
|
||||
}
|
||||
|
||||
test("rejects a plugin release older than the first one this launcher runs", (t) => {
|
||||
for (const version of ["0.9.33", "0.9.64-alpha.1", "0.8.99"]) {
|
||||
for (const version of ["0.9.33", "0.9.64", "0.9.65-alpha.1", "0.8.99"]) {
|
||||
const { root } = fixture(t, "plugin.json", version);
|
||||
assert.throws(() => pluginVersion(root), /this launcher runs 0\.9\.64 or newer/);
|
||||
assert.throws(() => pluginVersion(root), /this launcher runs 0\.9\.65 or newer/);
|
||||
}
|
||||
for (const version of ["0.9.64", "0.10.0", "1.0.0-beta.1"]) {
|
||||
for (const version of ["0.9.65", "0.10.0", "1.0.0-beta.1"]) {
|
||||
const { root } = fixture(t, "plugin.json", version);
|
||||
assert.equal(pluginVersion(root), version);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user