From b9cbd1393083d5cfbf99869af08f56eb16a23e07 Mon Sep 17 00:00:00 2001 From: Ulysse Mavrocordatos Date: Mon, 20 Jul 2026 10:01:36 +0200 Subject: [PATCH] scaffold generated CLI integration point in main.rs openapi-transformer will regenerate pup CLI command modules from the OpenAPI spec into src/generated.rs (see DataDog/pup#651, the pilot run for this pipeline). Land the wiring ahead of that so main.rs never needs touching again on future regenerations: mod generated, flatten GeneratedCommand into the Commands enum so generated subcommands appear as top-level peers, and route the arm through main_inner() following the existing per-domain pattern. src/generated.rs here is a placeholder with an empty GeneratedCommand enum, not #651's actual generated output - #651 hand-writes a top-level downtime command (list/get/create/cancel) that collides on the subcommand name with the generated Downtime variant it introduces (clap panics at runtime: "command name `downtime` is duplicated"). That collision needs a product decision - retire/merge the hand-written downtime command, or pick a different pilot operation upstream - before any generated variants land. This PR only establishes the scaffold; #651 becomes a pure additive diff to generated.rs (and new sibling modules) once that decision is made. --- src/generated.rs | 15 +++++++++++++++ src/main.rs | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/generated.rs diff --git a/src/generated.rs b/src/generated.rs new file mode 100644 index 00000000..4fe4a5cd --- /dev/null +++ b/src/generated.rs @@ -0,0 +1,15 @@ +// Stable integration point for openapi-transformer-generated pup commands. +// +// Future regenerations add variants to `GeneratedCommand` (and new modules +// alongside this file) in place; main.rs never needs to change again. + +use anyhow::Result; + +use crate::config::Config; + +#[derive(clap::Subcommand)] +pub enum GeneratedCommand {} + +pub async fn run(_cfg: &Config, command: GeneratedCommand) -> Result<()> { + match command {} +} diff --git a/src/main.rs b/src/main.rs index 1b431abf..09b6c923 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ mod config; mod extensions; mod filter; mod formatter; +mod generated; #[cfg(not(target_arch = "wasm32"))] mod runbooks; #[cfg(not(target_arch = "wasm32"))] @@ -2865,6 +2866,8 @@ enum Commands { #[command(subcommand)] action: WorkflowActions, }, + #[command(flatten)] + Generated(generated::GeneratedCommand), } // ---- Extensions ---- @@ -15905,6 +15908,11 @@ async fn main_inner() -> anyhow::Result<()> { } }, }, + // --- Generated --- + Commands::Generated(action) => { + cfg.validate_auth()?; + generated::run(&cfg, action).await?; + } // --- LLM Observability --- Commands::LlmObs { action } => { cfg.validate_auth()?;