Skip to content

Improve help text: I/O contract, dynamic commands, config precedence, startup noise #1544

@waldekmastykarz

Description

@waldekmastykarz

Parent: #1534

Problem

Several aspects of the CLI behavior are undocumented in --help and only discoverable by reading source code or running experiments:

1. No I/O contract

Help text doesn't state where output goes (stdout vs stderr). The actual routing is:

  • LogLevel.Information and below → stdout
  • LogLevel.Warning and above → stderr
  • Validation errors → stdout (mixed with help text)
  • jwt create token → stdout (via Console.WriteLine)

An agent capturing stdout to get the JWT token might also capture log noise.

2. Dynamic plugin commands are invisible

Available commands change based on which config file is loaded (plugins can contribute commands via GetCommands()). An agent reading --help with one config sees different commands than with another. There's no indication this is happening.

3. Config file precedence undocumented

Dev Proxy silently looks for devproxyrc.json in the current directory. Paths can use ~appFolder token. The option precedence is: CLI flag > config file > hardcoded default. None of this is in --help.

4. Startup log noise on --help and --version

Running devproxy --help outputs plugin initialization logs before the help text:

 info    1 error responses loaded from .../devproxy-errors.json

This pollutes otherwise clean informational output.

Rationale

Agents build mental models from --help. Implicit behaviors that affect output content, command availability, or configuration resolution must be documented — agents have no other way to discover them.

Proposed solution

I/O contract — add to root --help:

Output:
  Primary output goes to stdout. Errors and diagnostics go to stderr.
  Use --output json for structured output.

Dynamic commands — add note to commands section:

Commands:
  cert             Manage the Dev Proxy certificate
  config           Manage Dev Proxy configs
  ...

  Additional commands may be available depending on configured plugins.
  Use -c <config-file> to load a specific configuration.

Config file — update --config-file description:

-c, --config-file <config-file>  Path to config file. Defaults to devproxyrc.json
                                  in current directory. Supports ~appFolder token.

Config precedence — add to root --help:

Configuration precedence:
  CLI flags > config file > defaults

Suppress startup noise

When --help or --version is invoked, suppress all plugin initialization and log output. These are pure informational commands with no side effects — they should produce clean output only.

Affected code

  • DevProxy/Commands/DevProxyCommand.cs — help text additions
  • DevProxy/Program.cs — suppress initialization on help/version
  • DevProxy/Extensions/IServiceCollectionExtensions.cs — potentially skip plugin loading for help/version

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions