repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

fix(uv): skip shell shims on Windows

ea7c7ada3f51319224d7293eaf2886c9ec523c93

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (3)

extensions/uv/README.md

Modified
25 25 Operational behavior:
27 -- prepends `intercepted-commands/` to `PATH` for bash tool executions
27 +- prepends `intercepted-commands/` to `PATH` on Unix
28 28 - blocks `pip` and `pip3` with `uv add` / `uv run --with` guidance
29 29 - blocks `poetry` with `uv init`, `uv add`, `uv sync`, and `uv run` guidance
30 30 - blocks explicit `python -m pip`, `python -m venv`, and `python -m py_compile`
31 31 - routes `python` and `python3` PATH shim calls through `uv run --python <real-python> python`
32 32 - avoids shim recursion by resolving a Python interpreter outside `intercepted-commands/`
33 +- skips extensionless shell shims on Windows; spawn-time blockers still apply
33 34 - warns on session start when `uv` is missing from `PATH`
35 36 Explicit interpreter paths can bypass PATH shims.

extensions/uv/__tests__/harness.test.ts

Modified
40 40 __test.getBlockedCommandMessage("uv run python script.py"),
41 41 ).toBeNull();
44 + it("does not expose extensionless shell shims to Windows", () => {
45 + const ctx = {
46 + command: "python --version",
47 + cwd: "C:/repo",
48 + env: { Path: "C:/Windows" },
49 + };
51 + expect(__test.prependInterceptedCommands(ctx, "win32")).toBe(ctx);
52 + });

extensions/uv/index.ts

Modified
20 20 return Object.keys(env).find((key) => key.toLowerCase() === "path") ?? "PATH";
23 -function prependInterceptedCommands(ctx: BashSpawnContext): BashSpawnContext {
23 +function prependInterceptedCommands(
24 + ctx: BashSpawnContext,
25 + platform = process.platform,
26 +): BashSpawnContext {
27 + if (platform === "win32") return ctx;
24 28 const key = pathEnvKey(ctx.env);
25 29 const path = [INTERCEPTED_COMMANDS_PATH, ctx.env[key]]
26 30 .filter(Boolean)