The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 16:00 UTC
fix(provider-core): mise updates a tool configured by its backend name (#36472)
Julius Marminge committed
Nov 13, 2026 at 17:39 UTC
e3715430015ba2e7cfc87c754ed456cf0a23a873
2 files changed
+38
-10
packages/provider-core/src/server/maintenanceResolver.test.ts
+29
-9
@@ -175,8 +175,16 @@ function miseSpawner(
175
exitCode = latest.exitCode ?? 0;
176
} else if (args[0] === "ls") {
177
// `mise ls --json <tool>` lists one tool's installs; without a tool, every tool's.
178
+ // A registry short name also lists installs configured under a backend, like `npm:<pkg>`.
179
const tool = args.slice(1).find((arg) => !arg.startsWith("-"));
179
- stdout = JSON.stringify(tool ? (answers.installed[tool] ?? []) : answers.installed);
180
+ const configured = tool
181
+ ? Object.keys(answers.installed).find((name) => name.replace(/^[^:]+:/, "") === tool)
182
+ : undefined;
183
+ stdout = JSON.stringify(
184
+ tool
185
+ ? (answers.installed[tool] ?? answers.installed[configured ?? ""] ?? [])
186
+ : answers.installed,
187
+ );
188
} else {
189
exitCode = 1;
190
}
@@ -208,6 +216,8 @@ function miseFixture(
216
readonly misePresent?: boolean;
217
readonly tool?: string;
218
readonly dataDir?: string;
219
+ /** The backend name the config requests the tool by, such as `npm:package-tool`. */
220
+ readonly backend?: string;
221
} = {},
222
) {
223
const miseBinDir = NodePath.join(tempDir, "mise-bin");
@@ -216,8 +226,15 @@ function miseFixture(
226
const toolDir = NodePath.join(
227
options.dataDir ?? NodePath.join(tempDir, "mise"),
228
"installs",
219
- "package-tool",
229
+ options.backend ? options.backend.replace(/[:@/]+/g, "-") : "package-tool",
230
);
231
+ if (options.backend) {
232
+ NodeFS.mkdirSync(toolDir, { recursive: true });
233
+ NodeFS.writeFileSync(
234
+ NodePath.join(toolDir, ".mise.backend.toml"),
235
+ `short = "${options.backend}"\nfull = "${options.backend}"\nexplicit_backend = true\n`,
236
+ );
237
+ }
238
const latestDir = NodePath.join(toolDir, "latest");
239
let installPath = "";
240
let binaryPath = "";
@@ -236,7 +253,7 @@ function miseFixture(
253
const installed = (
254
install: { readonly requested_version?: string; readonly active?: boolean } = {},
255
) => ({
239
- [options.tool ?? "package-tool"]: [
256
+ [options.tool ?? options.backend ?? "package-tool"]: [
257
{ install_path: installPath, requested_version: "latest", active: true, ...install },
258
],
259
});
@@ -1978,15 +1995,18 @@ it.layer(
1995
{ name: "its latest link", via: "latest" },
1996
{ name: "a latest link in a custom data dir", via: "latest", dataDir: "data" },
1997
{ name: "a shim", via: "shim" },
1998
+ // `mise upgrade package-tool` skips a tool configured by its backend name.
1999
+ { name: "a shim to a backend-configured install", via: "shim", backend: "npm:package-tool" },
2000
])(
2001
"upgrades the mapped mise tool through $name requested as latest",
2002
(fixture) =>
2003
Effect.gen(function* () {
2004
const tempDir = yield* makeTempDir("t3-mise-upgrade");
1986
- const mise = miseFixture(
1987
- tempDir,
1988
- fixture.dataDir ? { dataDir: NodePath.join(tempDir, fixture.dataDir) } : {},
1989
- );
2005
+ const mise = miseFixture(tempDir, {
2006
+ ...(fixture.dataDir ? { dataDir: NodePath.join(tempDir, fixture.dataDir) } : {}),
2007
+ ...(fixture.backend ? { backend: fixture.backend } : {}),
2008
+ });
2009
+ const upgradeTool = fixture.backend ?? "package-tool";
2010
const binaryPath =
2011
fixture.via === "latest"
2012
? mise.latestBinaryPath
@@ -2004,9 +2024,9 @@ it.layer(
2024
);
2025
2026
expect(capabilities.update).toMatchObject({
2007
- command: "mise upgrade package-tool",
2027
+ command: `mise upgrade ${upgradeTool}`,
2028
executable: mise.misePath,
2009
- args: ["upgrade", "package-tool"],
2029
+ args: ["upgrade", upgradeTool],
2030
});
2031
expect(spawned).toContainEqual([mise.misePath, "which", "package-tool"]);
2032
// Resolution proves ownership but never asks mise for releases.
packages/provider-core/src/server/maintenanceResolver.ts
+9
-1
@@ -654,7 +654,15 @@ export const resolveMiseProviderMaintenance = Effect.fn("resolveMiseProviderMain
654
const resolved = normalizeCommandPath(context.resolvedCommandPath);
655
if (!latestDirs.some((dir) => isUnder(resolved, dir))) return manual(binaryPath);
656
}
657
- const args = ["upgrade", miseTool];
657
+ // `mise upgrade <short name>` skips a tool configured by its backend name, like `npm:<pkg>`.
658
+ const configured = Option.getOrUndefined(
659
+ decodeMiseInstalls(yield* runProbe(misePath, ["ls", "--json", "--installed"], context.env)),
660
+ );
661
+ const configuredTool =
662
+ Object.entries(configured ?? {}).find(([, installs]) =>
663
+ installs.some((candidate) => candidate.install_path === install.install_path),
664
+ )?.[0] ?? miseTool;
665
+ const args = ["upgrade", configuredTool];
666
const services = yield* Effect.context<ProviderMaintenanceResolverServices>();
667
const capabilities = makeProviderMaintenanceCapabilities({
668
...owner,