Expand tilde (~) in config paths like derivedDataPath#301
Expand tilde (~) in config paths like derivedDataPath#301trmquang93 wants to merge 4 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.
The duplicate resolvePathFromCwd in build-settings.ts was missing tilde expansion. This caused derivedDataPath with ~ to work during builds but fail when resolving app paths from build settings (used by build_run_device and get_device_app_path).
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.
Move the tilde expansion logic into a shared utils/expand-home.ts module and use it from all four call sites: build-utils.ts, project-config.ts, build-settings.ts, and cli/commands/init.ts. The shared version handles both ~/ and ~\ (Windows) consistently, matching the behavior that was previously only in init.ts.
|
Hi @trmquang93 — first, thank you for filing this fix and for the original implementation work. The reproduction in #283 and the approach you took (a single shared Unfortunately this PR can't be merged as-is. Two issues, both purely mechanical and not a reflection on the change itself:
I've reimplemented the fix from scratch against current Going to close this in favor of #370. Thanks again for the contribution — the fix is shipping, just under a different commit hash. |

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