diff --git a/CHANGELOG.md b/CHANGELOG.md index 19cf8bc0..f6d309de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### Fixed - Update UI automation guard guidance to point at `debug_continue` when paused. - Fix tool loading bugs in static tool registration. +- Fix xcodemake command argument corruption when project directory path appears as substring in non-path arguments. ## [1.16.0] - 2025-12-30 - Remove dynamic tool discovery (`discover_tools`) and `XCODEBUILDMCP_DYNAMIC_TOOLS`. Use `XCODEBUILDMCP_ENABLED_WORKFLOWS` to limit startup tool registration. diff --git a/src/utils/xcodemake.ts b/src/utils/xcodemake.ts index 00a46f39..e0e817ac 100644 --- a/src/utils/xcodemake.ts +++ b/src/utils/xcodemake.ts @@ -210,8 +210,14 @@ export async function executeXcodemakeCommand( const xcodemakeCommand = [getXcodemakeCommand(), ...buildArgs]; - // Remove projectDir from arguments - const command = xcodemakeCommand.map((arg) => arg.replace(projectDir + '/', '')); + // Remove projectDir from arguments if present at the start + const prefix = projectDir + '/'; + const command = xcodemakeCommand.map((arg) => { + if (arg.startsWith(prefix)) { + return arg.substring(prefix.length); + } + return arg; + }); return getDefaultCommandExecutor()(command, logPrefix); }