Skip to content

Add CLI command to preview generated code for a specific handler or HTTP endpoint #2467

@jeremydmiller

Description

@jeremydmiller

Summary

Add a CLI command that outputs the generated source code for a single message handler or HTTP endpoint, rather than dumping all generated code via codegen preview.

Proposed usage

# By message type name
dotnet run -- codegen preview --handler MyApp.Commands.CreateOrder

# By HTTP route
dotnet run -- codegen preview --route "POST /api/orders"

# By handler class name
dotnet run -- codegen preview --handler CreateOrderHandler

Motivation

dotnet run -- codegen preview dumps the generated code for every handler and endpoint, which can be thousands of lines in a real application. When troubleshooting a specific handler — checking middleware ordering, service resolution, transaction wrapping, or exception handling — you need to find the relevant section in a wall of output.

A targeted command would:

  1. Make troubleshooting faster — go directly to the handler you care about
  2. Enable AI-assisted tooling — coding agents can request the generated code for a specific handler to diagnose issues (middleware not applied, service location instead of inlining, missing transaction wrapping)
  3. Support dotnet run -- describe-style quick diagnostics without code changes

Output should include

  • The full generated handler adapter class
  • Which middleware methods are woven in and their order
  • How each dependency is resolved (inlined singleton, generated constructor call, or service location)
  • Transaction wrapping if present

Context

The AI skills for Critter Stack plan to use this for troubleshooting Wolverine behavior in AI-assisted workflows. Being able to ask "show me the generated code for this specific handler" is a key diagnostic capability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions