Skip to content

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

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

Expand tilde (~) in config paths like derivedDataPath#301
trmquang93 wants to merge 2 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.
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.

}
if (pathValue.startsWith('~/')) {
return path.join(homedir(), pathValue.slice(2));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

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