Skip to content

Expand leading ~/ to home directory in config file paths - #1936

Merged
waldekmastykarz merged 5 commits into
mainfrom
copilot/expand-home-directory-in-config-paths
Oct 21, 2026
Merged

waldekmastykarz merged 5 commits into
mainfrom
copilot/expand-home-directory-in-config-paths

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Config paths support ~appFolder and ~dataFolder but not ~/. A path like ~/mocks/mocks.json is resolved relative to the config file, as if ~ were a folder name. Shells, git and mitmproxy all treat it as the home directory.

Changes

  • ProxyUtils.ReplacePathTokens: expands a leading ~/ (and ~\ on Windows only) to Environment.SpecialFolder.UserProfile before the existing token replacement. Every caller picks this up: GetFullPath, --config-file, plugin paths, mock/error/data files and @file response bodies.
    • Only a leading ~/ is expanded. ~foo/..., a/~/b and a bare ~ are left unchanged.
    • If no home directory is available, the path is returned unchanged.
    • Plugin-path callers turn \ into / before this runs, so ~\ in pluginPath is also expanded on Linux and macOS.
  • Tests: ProxyUtilsTests covers expansion, the Windows-only backslash form, paths that must not change, and GetFullPath resolving to home rather than the config folder.
  • Docs: mentions ~/ in the --config-file help text, .github/copilot-instructions.md and skills/dev-proxy/references/configuration.md.

Example

"mocksPlugin": {
  // before: <config dir>/~/mocks/mocks.json
  // after:  /home/<user>/mocks/mocks.json
  "mocksFile": "~/mocks/mocks.json"
}
Copilot AI and others added 2 commits October 20, 2026 10:49
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copilot AI changed the title [WIP] Expand ~/ to home directory in config file paths Oct 20, 2026
Copilot AI requested a review from waldekmastykarz October 20, 2026 10:51
@waldekmastykarz
waldekmastykarz marked this pull request as ready for review October 20, 2026 17:49
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner October 20, 2026 17:49
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:49

Copilot AI left a comment

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.

🟢 Approval recommended

Static review supports the requested behavior with no unresolved findings; automated tests were not executed.

No open issues 🎉

What changed in this PR

Adds home-directory expansion to Dev Proxy’s shared path handling, addressing #1933.

Changes:

  • Expands leading ~/ and Windows ~\, preserving other tilde forms.
  • Adds path-resolution tests and updates help and documentation.
  • Updates transitive dependency lock entries.
File Description
skills/​dev-proxy/​references/​configuration.md Documents home-relative paths.
DevProxy/​packages.lock.json Updates application dependency graph.
DevProxy/​Commands/​DevProxyCommand.cs Documents ~/ in CLI help.
DevProxy.Proxy.Kestrel/​packages.lock.json Updates proxy dependency graph.
DevProxy.Abstractions/​Utils/​ProxyUtils.cs Implements shared home-directory expansion.
DevProxy.Abstractions.Tests/​Utils/​ProxyUtilsTests.cs Covers expansion and unchanged path forms.
.github/​copilot-instructions.md Documents supported path tokens.

Review effort: Balanced

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

@copilot build is failing. Fix

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>

Copilot AI commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot build is failing. Fix

Refreshed the two consumer lock files in 64656e6. Locked-mode restore, the full solution build, and all 17 ProxyUtilsTests pass.

@waldekmastykarz
waldekmastykarz merged commit e68ad6c into main Oct 21, 2026
6 checks passed
@waldekmastykarz
waldekmastykarz deleted the copilot/expand-home-directory-in-config-paths branch November 28, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants