Expand tilde (~) in config paths like derivedDataPath#301
Expand tilde (~) in config paths like derivedDataPath#301trmquang93 wants to merge 2 commits intogetsentry:mainfrom
Conversation
…etsentry#287) The list_devices tool included deviceId in nextStepParams for build_device, but build_device does not accept a deviceId parameter (it builds generically for the iOS device platform). This caused the CLI to render an invalid suggestion like: xcodebuildmcp device build --device-id "DEVICE_UDID" Remove deviceId from build_device's nextStepParams. The build_run_device and test_device entries correctly retain deviceId since those tools require it.
Paths containing ~ (e.g. ~/.derivedData) were not expanded, causing a literal ~ directory to be created in the project root. Add tilde expansion in both path resolution functions: - resolvePathFromCwd in build-utils.ts (runtime path resolution) - normalizePathValue in project-config.ts (config YAML loading) This allows shared config files to use ~/... paths that work across team members with different home directories.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| } | ||
| if (pathValue.startsWith('~/')) { | ||
| return path.join(homedir(), pathValue.slice(2)); | ||
| } |
There was a problem hiding this comment.
Duplicate resolvePathFromCwd missing tilde expansion
Medium Severity
There's a duplicate resolvePathFromCwd function in build-settings.ts that was not updated with tilde expansion. Paths like ~/.derivedData/myproject will be correctly expanded during builds (via build-utils.ts) but will remain unexpanded when resolving app paths from build settings (used by build_run_device and get_device_app_path). This creates inconsistent behavior where derivedDataPath with ~ works for building but fails for subsequent operations like getting the app path.


Summary
Fixes #283
Paths containing
~(e.g.~/.derivedData) in config were not expanded, causing a literal~directory to be created in the project root instead of resolving to the user's home directory.Changes
Added tilde expansion in two path resolution functions:
resolvePathFromCwdinbuild-utils.ts-- handles runtime path resolution when buildingnormalizePathValueinproject-config.ts-- handles path resolution when loadingconfig.yamlBoth functions now expand
~and~/...to the user's home directory before checking if the path is absolute or resolving relative to cwd.This enables shared config files (committed to the repo) to use
~/...paths that resolve correctly across team members with different home directories, as described in the issue.Test plan
build-utils.test.ts: verifies~/.derivedData/testexpands to$HOME/.derivedData/testin xcodebuild commandproject-config.test.ts: verifies~/.derivedData/myprojectexpands correctly when loaded from YAML config