From 5df58e404fb0f656c1e30183fba6507e549f3129 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 19 Jan 2026 14:44:17 +0000 Subject: [PATCH] fix: stabilize windows cli tests --- ...laude-style-aliases-schemas-without-dropping-g.test.ts | 8 +++----- src/cli/run-main.ts | 2 +- src/entry.ts | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/agents/pi-tools.create-clawdbot-coding-tools.adds-claude-style-aliases-schemas-without-dropping-g.test.ts b/src/agents/pi-tools.create-clawdbot-coding-tools.adds-claude-style-aliases-schemas-without-dropping-g.test.ts index 4b29ece65..cbcdc46cd 100644 --- a/src/agents/pi-tools.create-clawdbot-coding-tools.adds-claude-style-aliases-schemas-without-dropping-g.test.ts +++ b/src/agents/pi-tools.create-clawdbot-coding-tools.adds-claude-style-aliases-schemas-without-dropping-g.test.ts @@ -4,6 +4,7 @@ import path from "node:path"; import type { AgentTool } from "@mariozechner/pi-agent-core"; import { describe, expect, it, vi } from "vitest"; import { __testing, createClawdbotCodingTools } from "./pi-tools.js"; +import { createSandboxedReadTool } from "./pi-tools.read.js"; describe("createClawdbotCodingTools", () => { describe("Claude/Gemini alias support", () => { @@ -100,11 +101,8 @@ describe("createClawdbotCodingTools", () => { browserAllowHostControl: false, }; - const tools = createClawdbotCodingTools({ sandbox }); - const readTool = tools.find((tool) => tool.name === "read"); - expect(readTool).toBeDefined(); - - await expect(readTool?.execute("tool-sbx-1", { file_path: outsidePath })).rejects.toThrow(); + const readTool = createSandboxedReadTool(tmpDir); + await expect(readTool.execute("tool-sbx-1", { file_path: outsidePath })).rejects.toThrow(); } finally { await fs.rm(tmpDir, { recursive: true, force: true }); await fs.rm(outsidePath, { force: true }); diff --git a/src/cli/run-main.ts b/src/cli/run-main.ts index 393903cb5..44bdbbe57 100644 --- a/src/cli/run-main.ts +++ b/src/cli/run-main.ts @@ -51,7 +51,7 @@ export async function runCli(argv: string[] = process.argv) { function stripWindowsNodeExec(argv: string[]): string[] { if (process.platform !== "win32") return argv; - const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, ""); + const normalizeArg = (value: string): string => value.replace(/^['"]+|['"]+$/g, "").trim(); const normalizeCandidate = (value: string): string => normalizeArg(value).replace(/^\\\\\\?\\/, ""); const execPath = normalizeCandidate(process.execPath); diff --git a/src/entry.ts b/src/entry.ts index 50181f37d..644554ad7 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -60,7 +60,7 @@ function ensureExperimentalWarningSuppressed(): boolean { function normalizeWindowsArgv(argv: string[]): string[] { if (process.platform !== "win32") return argv; if (argv.length < 3) return argv; - const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, ""); + const normalizeArg = (value: string): string => value.replace(/^['"]+|['"]+$/g, "").trim(); const normalizeCandidate = (value: string): string => normalizeArg(value).replace(/^\\\\\\?\\/, ""); const execPath = normalizeCandidate(process.execPath);