diff --git a/README.md b/README.md index 16988beea..1d81e2bb7 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,15 @@ rtk oc get services # OpenShift service list rtk oc logs # Deduplicated logs ``` +### Infrastructure as Code +```bash +rtk pulumi preview # Strip header/URL/duration noise +rtk pulumi up # Compact apply output +rtk pulumi destroy # Compact destroy output +rtk pulumi refresh # Drift summary +rtk pulumi stack # Stack metadata (strips owner/timestamps) +``` + ### Data & Analytics ```bash rtk json config.json # Structure without values diff --git a/src/core/toml_filter.rs b/src/core/toml_filter.rs index f752a2169..164b3e69b 100644 --- a/src/core/toml_filter.rs +++ b/src/core/toml_filter.rs @@ -1589,6 +1589,11 @@ match_command = "^make\\b" "poetry-install", "pre-commit", "ps", + "pulumi-destroy", + "pulumi-preview", + "pulumi-refresh", + "pulumi-stack", + "pulumi-up", "quarto-render", "rsync", "shellcheck", @@ -1622,8 +1627,8 @@ match_command = "^make\\b" let filters = make_filters(BUILTIN_TOML); assert_eq!( filters.len(), - 58, - "Expected exactly 58 built-in filters, got {}. \ + 63, + "Expected exactly 63 built-in filters, got {}. \ Update this count when adding/removing filters in src/filters/.", filters.len() ); @@ -1680,11 +1685,11 @@ expected = "output line 1\noutput line 2" let combined = format!("{}\n\n{}", BUILTIN_TOML, new_filter); let filters = make_filters(&combined); - // All 58 existing filters still present + 1 new = 59 + // All 63 existing filters still present + 1 new = 64 assert_eq!( filters.len(), - 59, - "Expected 59 filters after concat (58 built-in + 1 new)" + 64, + "Expected 64 filters after concat (63 built-in + 1 new)" ); // New filter is discoverable diff --git a/src/discover/rules.rs b/src/discover/rules.rs index 78d5e0058..e9bf1b1f3 100644 --- a/src/discover/rules.rs +++ b/src/discover/rules.rs @@ -752,6 +752,21 @@ pub const RULES: &[RtkRule] = &[ subcmd_savings: &[], subcmd_status: &[], }, + RtkRule { + pattern: r"^pulumi\s+(preview|up|destroy|refresh|stack)(\s|$)", + rtk_cmd: "rtk pulumi", + rewrite_prefixes: &["pulumi"], + category: "Infra", + savings_pct: 45.0, + subcmd_savings: &[ + ("up", 66.0), + ("destroy", 72.0), + ("refresh", 35.0), + ("preview", 25.0), + ("stack", 29.0), + ], + subcmd_status: &[], + }, RtkRule { pattern: r"^quarto\s+render", rtk_cmd: "rtk quarto", diff --git a/src/filters/pulumi-destroy.toml b/src/filters/pulumi-destroy.toml new file mode 100644 index 000000000..1052c0ff6 --- /dev/null +++ b/src/filters/pulumi-destroy.toml @@ -0,0 +1,60 @@ +[filters.pulumi-destroy] +description = "Compact Pulumi destroy output" +match_command = "^pulumi\\s+destroy(\\s|$)" +strip_ansi = true +strip_lines_matching = [ + "^\\s*$", + "^Destroying \\(", + "^Previewing (update|destroy)", + "^View in Browser", + "^View Live:", + "^Duration:", + "^Permalink:", + "^\\s*Type\\s+Name\\s+", + "^Loading policy packs", + "^@ (Previewing (update|destroy)|Destroying)", + "^More information at:", + "^Use `pulumi ", + "^The resources in the stack have been deleted", + "^If you want to remove the stack completely", + "^\\s+-\\s+.*\\bdeleting\\s+\\(", + "^\\s{4,}at\\s+\\S+\\s*\\(", + "^\\s{4,}at\\s+/", + "^\\s+at\\s+processTicksAndRejections", + "^\\s+promise:\\s+Promise", + "^\\s+\\[Circular", + "^\\s*