-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Parent: #1534
Problem
There's no way for an agent to validate a Dev Proxy configuration file without actually starting the proxy. Starting the proxy modifies system state (system proxy settings, certificate installation, etc.) and is a long-running process. An agent that wants to verify its config changes are correct before starting the proxy has no safe option.
Rationale
Agents iteratively build and refine configuration files. A validate-then-fix loop is a core agent workflow pattern: generate config → validate → parse errors → fix → retry. Without a validation command, the agent must start the full proxy to discover config errors, which is slow, has side effects, and blocks the terminal.
Proposed solution
Add devproxy config validate [--config-file path] subcommand:
- Parse the config file
- Validate JSON against the schema
- Check that referenced plugins exist and can load
- Validate URL patterns are syntactically correct
- Check that referenced mock files / external files exist
- Return structured output (especially with
--output json)
Human output:
✓ Configuration is valid
Config file: ./devproxyrc.json
Plugins: 3 loaded
URLs to watch: 2 patterns
Warnings:
- plugins[2].configSection.mocksFile: File 'mocks.json' not found
JSON output (--output json):
{
"valid": true,
"configFile": "./devproxyrc.json",
"plugins": ["MockResponsePlugin", "RateLimitingPlugin", "RetryAfterPlugin"],
"urlsToWatch": ["https://api.example.com/*", "https://graph.microsoft.com/*"],
"errors": [],
"warnings": [
{
"path": "plugins[2].configSection.mocksFile",
"message": "File 'mocks.json' not found"
}
]
}Error output:
{
"valid": false,
"errors": [
{
"path": "plugins[1].name",
"message": "Plugin 'NonExistentPlugin' not found"
}
],
"warnings": []
}Exit code 0 for valid, 1 for invalid.
Affected code
DevProxy/Commands/ConfigCommand.cs— addvalidatesubcommand- May need to factor out config loading/validation logic from
Program.csand plugin initialization