Enforce non-empty positional cwd arguments in CLI parser

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 00:20:54 +00:00
1 parent b2d7c19868
commit 223f4063ec
2 files changed
+5 -1

No files matched your search

+4
View File
@@ -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",
+1 -1
View File
@@ -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;
}