diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 0243ed841..c374cc647 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed the `--cwd` launch flag so it is parsed and can override the startup directory instead of always falling back to the current process directory or home auto-switch target. + ## [15.10.1] - 2026-06-07 ### Added diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.ts index 707d87c54..feec309ba 100644 --- a/packages/coding-agent/src/cli/args.ts +++ b/packages/coding-agent/src/cli/args.ts @@ -109,6 +109,8 @@ export function parseArgs(inputArgs: string[], extensionFlags?: Map { + it("parses --cwd with a space-separated directory", () => { + const result = parseArgs(["--cwd", "/work/project", "hello"]); + + expect(result.cwd).toBe("/work/project"); + expect(result.messages).toEqual(["hello"]); + }); + + it("parses --cwd=value without leaking the value into messages", () => { + const result = parseArgs(["--cwd=/work/project", "hello"]); + + expect(result.cwd).toBe("/work/project"); + expect(result.messages).toEqual(["hello"]); + }); +});