Skip to content

Ensure codegen and OpenAPI CLI commands work without database/transport connectivity #2471

@jeremydmiller

Description

@jeremydmiller

Summary

Analyze whether codegen and OpenAPI generation CLI commands still require manual disabling of persistence and external transports. If they do, make this automatic so users don't need workaround code.

Current workarounds documented in AI skills

Workaround 1 — Command Line Diagnostics skill:

if (Environment.GetCommandLineArgs().Contains("codegen"))
{
    services.DisableAllExternalWolverineTransports();
    services.DisableAllWolverineMessagePersistence();
}

Workaround 2 — Code Generation skill (Aspire / OpenAPI conflict):

When Aspire provides connection strings at runtime, codegen write fails because it can't connect to databases. Current workaround:

public static bool IsCodegenRun()
{
    return Assembly.GetEntryAssembly()?.GetName().Name == "GetDocument.Insider"
        || Environment.GetCommandLineArgs().Contains("codegen");
}

if (IsCodegenRun())
{
    services.DisableAllExternalWolverineTransports();
    services.DisableAllWolverineMessagePersistence();
}

Both are code smells — the framework should handle this internally.

Expected behavior

Running any of these commands should work without database or broker connectivity:

  • dotnet run codegen write
  • dotnet run codegen preview
  • OpenAPI document generation (via GetDocument.Insider)
  • dotnet run describe (already works without DB?)

Wolverine should detect that it's running a code-generation or metadata-only command and automatically suppress persistence and transport initialization. This covers both the general codegen case and the Aspire-specific scenario where connection strings aren't available at build time.

Context

The AI skills for Critter Stack currently document both workarounds — in the Command Line Diagnostics skill and the Code Generation skill. If Wolverine handles this automatically, we can remove both and simplify the guidance significantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions