Skip to content

Support creating YAML config files via devproxy config new (extension or --format)#1559

Merged
waldekmastykarz merged 15 commits intomainfrom
copilot/add-yaml-config-support-again
Mar 4, 2026
Merged

Support creating YAML config files via devproxy config new (extension or --format)#1559
waldekmastykarz merged 15 commits intomainfrom
copilot/add-yaml-config-support-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

  • Review new PR comments and identify actionable changes
  • Apply minimal formatting/code updates requested in comments
  • Validate behavior with targeted build/tests and snippet URL checks
  • Run code review and CodeQL checks
  • Reply to actionable comment threads with commit hash
Original prompt

This section details on the original issue you should resolve

<issue_title>Support creating YAML config files via devproxy config new</issue_title>
<issue_description>## Summary

devproxy config new currently defaults to creating a devproxyrc.json file and only generates JSON configs. With YAML config support being added (#1491), the CLI should also support creating YAML-based configuration files.

Expected behavior

  • devproxy config new devproxyrc.yaml should create a valid YAML config file
  • The format should be inferred from the file extension (.yaml/.yml = YAML, .json/.jsonc = JSON)
  • The default should remain devproxyrc.json for backward compatibility

Current behavior

devproxy config new only generates JSON configs regardless of the filename extension. It downloads a JSON snippet from the snippets URL and writes it as-is.

Additional context

Discovered while testing PR #1491 (YAML config support).</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: garrytrinder <11563347+garrytrinder@users.noreply.github.com>
Copilot AI changed the title [WIP] Support creating YAML config files via devproxy config new Support creating YAML config files via devproxy config new Feb 25, 2026
@waldekmastykarz
Copy link
Collaborator

@garrytrinder should we also have a --format json|yaml option in case you want to use the default name but just specify the format? Might be more discoverable than just the file name

@garrytrinder
Copy link
Contributor

@copilot fix the merge conflicts

@garrytrinder
Copy link
Contributor

@garrytrinder should we also have a --format json|yaml option in case you want to use the default name but just specify the format? Might be more discoverable than just the file name

Good idea.

@copilot add a new optional option to the command that can determine the format to be used without specifying the filename

Co-authored-by: garrytrinder <11563347+garrytrinder@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 26, 2026

@garrytrinder should we also have a --format json|yaml option in case you want to use the default name but just specify the format? Might be more discoverable than just the file name

Good idea....

Implemented in e24a670. devproxy config new now supports an optional --format <Json|Yaml> option, and when used without a filename it defaults to devproxyrc.yaml for YAML (otherwise devproxyrc.json).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy config new /tmp/devproxy-config-test/from-extension.yaml --output json (dns block)
    • Triggering command: /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy config new --format yaml /tmp/devproxy-config-test/from-format-default-name-placeholder --output json (dns block)
    • Triggering command: /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy config new --format yaml --output json (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Support creating YAML config files via devproxy config new Support creating YAML config files via devproxy config new (extension or --format) Feb 26, 2026
@garrytrinder garrytrinder marked this pull request as ready for review February 26, 2026 14:56
@garrytrinder garrytrinder requested a review from a team as a code owner February 26, 2026 14:56
Copilot AI review requested due to automatic review settings February 26, 2026 14:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the devproxy config new command to support creating YAML configuration files in addition to the existing JSON format.

Changes:

  • Added format detection based on file extension (.yaml/.yml for YAML, .json/.jsonc for JSON)
  • Introduced a --format option to explicitly specify the output format (json or yaml)
  • Implemented JSON-to-YAML conversion using System.Text.Json and YamlDotNet

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
waldekmastykarz and others added 2 commits February 27, 2026 09:13
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 27, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy config new --format yaml --help (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Collaborator

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

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

LGTM. Build passes, review feedback (JsonDocument disposal, UInt64 precision) has been addressed. The format inference from file extension and the --format option work correctly.

Minor nit: there's a missing blank line between ConvertJsonElement and ResolveConfigFile (around line 617-618), but not a blocker.

@waldekmastykarz waldekmastykarz dismissed their stale review February 28, 2026 09:38

Retracting approval: unable to verify e2e because the v2.2.0 snippets URL is not live yet. The JSON-to-YAML conversion logic was verified in isolation and works correctly. Pending full e2e test once the snippets URL is published.

@waldekmastykarz
Copy link
Collaborator

Code review looks the JSON-to-YAML conversion logic works correctly in isolation (build passes, disposal and precision feedback addressed). However, we cannot verify e2e because config new depends on the snippets URL (https://aka.ms/devproxy/snippets/v2.2.0) which is not live yet (returns HTML instead of JSON). This affects main as well, not just this PR.good

Blocking on: snippets URL for v2.2.0 being published. Once it is live, we can do a full e2e test and re-approve.

@garrytrinder garrytrinder marked this pull request as draft March 2, 2026 10:22
@garrytrinder
Copy link
Contributor

Converted to draft as we need to update the toolkit with YAML snippets and create new aka.ms links for JSON and YAML snippets for v2.2.0

@waldekmastykarz
Copy link
Collaborator

@garrytrinder as we're fixing this, let's add an empty line in the code, in the place mentioned earlier in comments

@garrytrinder
Copy link
Contributor

aka.ms links for v2.2.0 snippets are now live

@copilot

Co-authored-by: garrytrinder <11563347+garrytrinder@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@garrytrinder as we're fixing this, let's add an empty line in the code, in the place mentioned earlier in comments

Done in 0d9ecd2. Added the missing blank line between ConvertJsonElement and ResolveConfigFile in ConfigCommand.cs. No UI changes (CLI-only change).

aka.ms links for v2.2.0 snippets are now live

I ran a targeted config new smoke test after the latest updates; build is passing, and the remaining e2e fetch check is blocked in this sandbox by outbound connectivity to aka.ms (SocketException: Resource temporarily unavailable). The code changes for YAML format support and follow-up review nits are in 0d9ecd2/f01c612/aabf572. No UI changes (CLI-only change).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
    • Triggering command: /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy config new smoke.json (dns block)
    • Triggering command: /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy /home/REDACTED/work/dev-proxy/dev-proxy/DevProxy/bin/Debug/net10.0/devproxy config new --format yaml smoke.yaml (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

waldekmastykarz and others added 2 commits March 4, 2026 08:39
Download snippets from /json or /yaml endpoint instead of a single
URL. Removes client-side JSON-to-YAML conversion since YAML snippets
are now served natively.

Closes #1559
Copy link
Contributor

@garrytrinder garrytrinder left a comment

Choose a reason for hiding this comment

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

Tested config new command with format-specific snippets URLs. All scenarios pass: default JSON, --format yaml, --format json, extension-based inference, format override, and overwrite protection. LGTM.

@garrytrinder garrytrinder marked this pull request as ready for review March 4, 2026 09:41
@waldekmastykarz waldekmastykarz merged commit a5bead6 into main Mar 4, 2026
4 checks passed
@waldekmastykarz waldekmastykarz deleted the copilot/add-yaml-config-support-again branch March 4, 2026 09:51
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.

Support creating YAML config files via devproxy config new

4 participants