Skip to content

Expand tilde (~) in config paths like derivedDataPath#301

Open
trmquang93 wants to merge 4 commits intogetsentry:mainfrom
trmquang93:fix/283-expand-tilde-in-config-paths
Open

Expand tilde (~) in config paths like derivedDataPath#301
trmquang93 wants to merge 4 commits intogetsentry:mainfrom
trmquang93:fix/283-expand-tilde-in-config-paths

Conversation

@trmquang93
Copy link
Copy Markdown

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:

  • resolvePathFromCwd in build-utils.ts -- handles runtime path resolution when building
  • normalizePathValue in project-config.ts -- handles path resolution when loading config.yaml

Both 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

  • Added test in build-utils.test.ts: verifies ~/.derivedData/test expands to $HOME/.derivedData/test in xcodebuild command
  • Added test in project-config.test.ts: verifies ~/.derivedData/myproject expands correctly when loaded from YAML config
  • All existing tests pass (35 tests across both files)
  • Pre-commit hooks (format, lint, build, tests) pass

…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).
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Expand ~ (tilde) in derived data path passed via config

1 participant