From 223f4063ecbb148bec7517eb220ebbf3f43cf25b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 00:20:54 +0000 Subject: [PATCH] Enforce non-empty positional cwd arguments in CLI parser Co-authored-by: Theo Browne --- apps/t3/src/cli.test.ts | 4 ++++ apps/t3/src/cli.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/t3/src/cli.test.ts b/apps/t3/src/cli.test.ts index fd87b77782..200bfd520c 100644 --- a/apps/t3/src/cli.test.ts +++ b/apps/t3/src/cli.test.ts @@ -118,6 +118,10 @@ describe("parseCliOptions", () => { expect(options.launchCwd).toBe(path.resolve("apps/renderer")); }); + it("rejects whitespace-only positional cwd arguments", () => { + expect(() => parseCliOptions([" "], {}, "/workspace")).toThrow("Invalid value for [path]"); + }); + it("rejects multiple positional cwd arguments", () => { expect(() => parseCliOptions(["apps/renderer", "apps/t3"], {}, "/workspace")).toThrow( "Unexpected positional argument: apps/t3", diff --git a/apps/t3/src/cli.ts b/apps/t3/src/cli.ts index 2fd52a1efc..32080f73ba 100644 --- a/apps/t3/src/cli.ts +++ b/apps/t3/src/cli.ts @@ -184,7 +184,7 @@ export function parseCliOptions( if (usedPositionalCwd) { throw new Error(`Unexpected positional argument: ${arg}`); } - launchCwd = path.resolve(arg); + launchCwd = parseExplicitPath(arg, "[path]"); usedPositionalCwd = true; continue; }