fix(cli): drop redundant --minimum-release-age flag on re-exec

We only ever invoke `npx` (the npm binary), whose cooldown config is
`min-release-age`. The camelCase `--minimum-release-age` is pnpm/bun's
spelling, and those aren't reached via npx (they use `pnpm dlx` / `bunx`),
so the extra flag was dead weight npm silently ignored. Keep only
`--min-release-age=0`.
This commit is contained in:
Bilal Godil 2026-05-29 12:08:17 -07:00
parent 1a272ba025
commit 31603e7ff5
2 changed files with 8 additions and 15 deletions

View File

@ -118,7 +118,6 @@ describe("buildNpxInvocation", () => {
expect(args).toEqual([
"--yes",
"--min-release-age=0",
"--minimum-release-age=0",
"-p",
"@hexclave/cli@2.8.110",
"stack",
@ -139,10 +138,8 @@ describe("buildNpxInvocation", () => {
binName: "stack",
forwardArgs: [],
});
// Both keys npm has shipped: `min-release-age` (days, >=11.10.0) and the
// earlier `minimumReleaseAge` (minutes, >=11.6.1).
// npm's `min-release-age` (>=11.10.0) would otherwise block the latest.
expect(args).toContain("--min-release-age=0");
expect(args).toContain("--minimum-release-age=0");
});
it("preserves args that start with dashes or contain spaces as individual argv elements", () => {
@ -153,7 +150,7 @@ describe("buildNpxInvocation", () => {
forwardArgs: ["dev", "--flag=a b", "--", "echo", "hello world"],
});
expect(args).toEqual([
"--yes", "--min-release-age=0", "--minimum-release-age=0", "-p", "@hexclave/cli@2.8.110", "stack",
"--yes", "--min-release-age=0", "-p", "@hexclave/cli@2.8.110", "stack",
"dev", "--flag=a b", "--", "echo", "hello world",
]);
});
@ -205,7 +202,7 @@ describe("decideReexec", () => {
expect(decision.reexec).toBe(true);
if (decision.reexec) {
expect(decision.invocation.args).toEqual([
"--yes", "--min-release-age=0", "--minimum-release-age=0", "-p", "@hexclave/cli@2.8.110", "stack", "dev", "--config-file", "x",
"--yes", "--min-release-age=0", "-p", "@hexclave/cli@2.8.110", "stack", "dev", "--config-file", "x",
]);
}
});

View File

@ -155,16 +155,12 @@ export function buildNpxInvocation(opts: {
command,
args: [
"--yes",
// Override any global "cooldown" for this call only — we always want the
// just-published latest, and a pinned version newer than the cooldown
// window otherwise fails with ETARGET (which would kill `stack dev`).
// npm's real config is `min-release-age` (days, npm >=11.10.0), so
// `--min-release-age=0` is what matters for npx. We also pass the
// camelCase `--minimum-release-age=0` (the spelling pnpm/bun use, in case
// npx is shimmed to them) defensively — npm silently ignores config flags
// it doesn't recognize, so the extra flag is harmless.
// Override any global npm "cooldown" for this call only — we always want
// the just-published latest, and npx of a pinned version newer than the
// cooldown window otherwise fails with ETARGET (which would kill
// `stack dev`). npm's config is `min-release-age` (days, npm >=11.10.0);
// older npm silently ignores the unknown flag.
"--min-release-age=0",
"--minimum-release-age=0",
"-p",
`${opts.packageName}@${opts.version}`,
opts.binName,