use super::report::RtkStatus;

pub struct RtkRule {
    pub pattern: &'static str,
    pub rtk_cmd: &'static str,
    pub rewrite_prefixes: &'static [&'static str],
    pub category: &'static str,
    pub savings_pct: f64,
    pub subcmd_savings: &'static [(&'static str, f64)],
    pub subcmd_status: &'static [(&'static str, RtkStatus)],
}

pub const RULES: &[RtkRule] = &[
    RtkRule {
        pattern: r"^(?:git|yadm)\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)",
        rtk_cmd: "rtk git",
        rewrite_prefixes: &["git", "yadm"],
        category: "Git",
        savings_pct: 70.0,
        subcmd_savings: &[
            ("diff", 80.0),
            ("show", 80.0),
            ("add", 59.0),
            ("commit", 59.0),
        ],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^gh\s+(pr|issue|run|repo|api|release)",
        rtk_cmd: "rtk gh",
        rewrite_prefixes: &["gh"],
        category: "GitHub",
        savings_pct: 82.0,
        subcmd_savings: &[("pr", 87.0), ("run", 82.0), ("issue", 80.0)],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^cargo\s+(build|test|clippy|check|fmt|install)",
        rtk_cmd: "rtk cargo",
        rewrite_prefixes: &["cargo"],
        category: "Cargo",
        savings_pct: 80.0,
        subcmd_savings: &[("test", 90.0), ("check", 80.0)],
        subcmd_status: &[("fmt", RtkStatus::Passthrough)],
    },
    RtkRule {
        pattern: r"^pnpm\s+(exec|i|install|list|ls|outdated|run|run-script)",
        rtk_cmd: "rtk pnpm",
        rewrite_prefixes: &["pnpm"],
        category: "PackageManager",
        savings_pct: 80.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^npm\s+(exec|run|run-script|rum|urn|x)\s+",
        rtk_cmd: "rtk npm",
        rewrite_prefixes: &["npm"],
        category: "PackageManager",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^npx\s+",
        rtk_cmd: "rtk npx",
        rewrite_prefixes: &["npx"],
        category: "PackageManager",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(cat|head|tail)\s+",
        rtk_cmd: "rtk read",
        rewrite_prefixes: &["cat", "head", "tail"],
        category: "Files",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(rg|grep)\s+",
        rtk_cmd: "rtk grep",
        rewrite_prefixes: &["rg", "grep"],
        category: "Files",
        savings_pct: 75.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^ls(\s|$)",
        rtk_cmd: "rtk ls",
        rewrite_prefixes: &["ls"],
        category: "Files",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^find\s+",
        rtk_cmd: "rtk find",
        rewrite_prefixes: &["find"],
        category: "Files",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?tsc(\s|$)",
        rtk_cmd: "rtk tsc",
        rewrite_prefixes: &[
            "npm exec tsc",
            "npm rum tsc",
            "npm run tsc",
            "npm run-script tsc",
            "npm tsc",
            "npm urn tsc",
            "npm x tsc",
            "npx tsc",
            "pnpm dlx tsc",
            "pnpm exec tsc",
            "pnpm run tsc",
            "pnpm run-script tsc",
            "pnpm tsc",
            "pnpx tsc",
            "tsc",
        ],
        category: "Build",
        savings_pct: 83.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?(biome|eslint|lint)(\s|$)",
        rtk_cmd: "rtk lint",
        rewrite_prefixes: &[
            "biome",
            "eslint",
            "lint",
            "npm biome",
            "npm eslint",
            "npm exec biome",
            "npm exec eslint",
            "npm lint",
            "npm rum biome",
            "npm rum eslint",
            "npm rum lint",
            "npm run biome",
            "npm run eslint",
            "npm run lint",
            "npm run-script biome",
            "npm run-script eslint",
            "npm run-script lint",
            "npm urn biome",
            "npm urn eslint",
            "npm urn lint",
            "npm x biome",
            "npm x eslint",
            "npx biome",
            "npx eslint",
            "npx lint",
            "pnpm biome",
            "pnpm dlx biome",
            "pnpm dlx eslint",
            "pnpm eslint",
            "pnpm exec biome",
            "pnpm exec eslint",
            "pnpm lint",
            "pnpm run biome",
            "pnpm run eslint",
            "pnpm run lint",
            "pnpm run-script biome",
            "pnpm run-script eslint",
            "pnpm run-script lint",
            "pnpx biome",
            "pnpx eslint",
            "pnpx lint",
        ],
        category: "Build",
        savings_pct: 84.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?prettier",
        rtk_cmd: "rtk prettier",
        rewrite_prefixes: &[
            "npm exec prettier",
            "npm prettier",
            "npm rum prettier",
            "npm run prettier",
            "npm run-script prettier",
            "npm urn prettier",
            "npm x prettier",
            "npx prettier",
            "pnpm dlx prettier",
            "pnpm exec prettier",
            "pnpm prettier",
            "pnpm run prettier",
            "pnpm run-script prettier",
            "pnpx prettier",
            "prettier",
        ],
        category: "Build",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?next\s+build",
        rtk_cmd: "rtk next",
        rewrite_prefixes: &[
            "next build",
            "npm exec next build",
            "npm next build",
            "npm rum next build",
            "npm run next build",
            "npm run-script next build",
            "npm urn next build",
            "npm x next build",
            "npx next build",
            "pnpm dlx next build",
            "pnpm exec next build",
            "pnpm next build",
            "pnpm run next build",
            "pnpm run-script next build",
            "pnpx next build",
        ],
        category: "Build",
        savings_pct: 87.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?jest(\s+run)?(\s|$)",
        rtk_cmd: "rtk jest",
        rewrite_prefixes: &[
            "jest run",
            "jest",
            "npm exec jest run",
            "npm exec jest",
            "npm jest run",
            "npm jest",
            "npm rum jest run",
            "npm rum jest",
            "npm run jest run",
            "npm run jest",
            "npm run-script jest run",
            "npm run-script jest",
            "npm urn jest run",
            "npm urn jest",
            "npm x jest run",
            "npm x jest",
            "npx jest run",
            "npx jest",
            "pnpm dlx jest run",
            "pnpm dlx jest",
            "pnpm exec jest run",
            "pnpm exec jest",
            "pnpm jest run",
            "pnpm jest",
            "pnpm run jest run",
            "pnpm run jest",
            "pnpm run-script jest run",
            "pnpm run-script jest",
            "pnpx jest run",
            "pnpx jest",
        ],
        category: "Tests",
        savings_pct: 99.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?vitest(\s+run)?(\s|$)",
        rtk_cmd: "rtk vitest",
        rewrite_prefixes: &[
            "npm exec vitest run",
            "npm exec vitest",
            "npm rum vitest run",
            "npm rum vitest",
            "npm run vitest run",
            "npm run vitest",
            "npm run-script vitest run",
            "npm run-script vitest",
            "npm urn vitest run",
            "npm urn vitest",
            "npm vitest run",
            "npm vitest",
            "npm x vitest run",
            "npm x vitest",
            "npx vitest run",
            "npx vitest",
            "pnpm dlx vitest run",
            "pnpm dlx vitest",
            "pnpm exec vitest run",
            "pnpm exec vitest",
            "pnpm run vitest run",
            "pnpm run vitest",
            "pnpm run-script vitest run",
            "pnpm run-script vitest",
            "pnpm vitest run",
            "pnpm vitest",
            "pnpx vitest run",
            "pnpx vitest",
            "vitest run",
            "vitest",
        ],
        category: "Tests",
        savings_pct: 99.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?playwright",
        rtk_cmd: "rtk playwright",
        rewrite_prefixes: &[
            "npm exec playwright",
            "npm playwright",
            "npm rum playwright",
            "npm run playwright",
            "npm run-script playwright",
            "npm urn playwright",
            "npm x playwright",
            "npx playwright",
            "playwright",
            "pnpm dlx playwright",
            "pnpm exec playwright",
            "pnpm playwright",
            "pnpm run playwright",
            "pnpm run-script playwright",
            "pnpx playwright",
        ],
        category: "Tests",
        savings_pct: 94.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?prisma",
        rtk_cmd: "rtk prisma",
        rewrite_prefixes: &[
            "npm exec prisma",
            "npm prisma",
            "npm rum prisma",
            "npm run prisma",
            "npm run-script prisma",
            "npm urn prisma",
            "npm x prisma",
            "npx prisma",
            "pnpm dlx prisma",
            "pnpm exec prisma",
            "pnpm prisma",
            "pnpm run prisma",
            "pnpm run-script prisma",
            "pnpx prisma",
            "prisma",
        ],
        category: "Build",
        savings_pct: 88.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^docker\s+(ps|images|logs|run|exec|build|compose\s+(ps|logs|build))",
        rtk_cmd: "rtk docker",
        rewrite_prefixes: &["docker"],
        category: "Infra",
        savings_pct: 85.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^kubectl\s+(get|logs|describe|apply)",
        rtk_cmd: "rtk kubectl",
        rewrite_prefixes: &["kubectl"],
        category: "Infra",
        savings_pct: 85.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^tree(\s|$)",
        rtk_cmd: "rtk tree",
        rewrite_prefixes: &["tree"],
        category: "Files",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^diff\s+",
        rtk_cmd: "rtk diff",
        rewrite_prefixes: &["diff"],
        category: "Files",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^curl\s+",
        rtk_cmd: "rtk curl",
        rewrite_prefixes: &["curl"],
        category: "Network",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^wget\s+",
        rtk_cmd: "rtk wget",
        rewrite_prefixes: &["wget"],
        category: "Network",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(python3?\s+-m\s+)?mypy(\s|$)",
        rtk_cmd: "rtk mypy",
        rewrite_prefixes: &["python3 -m mypy", "python -m mypy", "mypy"],
        category: "Build",
        savings_pct: 80.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^ruff\s+(check|format)",
        rtk_cmd: "rtk ruff",
        rewrite_prefixes: &["ruff"],
        category: "Python",
        savings_pct: 80.0,
        subcmd_savings: &[("check", 80.0), ("format", 75.0)],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(python[0-9.]*\s+-m\s+)?pytest(\s|$)",
        rtk_cmd: "rtk pytest",
        rewrite_prefixes: &["python3 -m pytest", "python -m pytest", "pytest"],
        category: "Python",
        savings_pct: 90.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(pip3?|uv\s+pip)\s+(list|outdated|install|show)",
        rtk_cmd: "rtk pip",
        rewrite_prefixes: &["pip3", "pip", "uv pip"],
        category: "Python",
        savings_pct: 75.0,
        subcmd_savings: &[("list", 75.0), ("outdated", 80.0)],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^go\s+(test|build|vet)",
        rtk_cmd: "rtk go",
        rewrite_prefixes: &["go"],
        category: "Go",
        savings_pct: 85.0,
        subcmd_savings: &[("test", 90.0), ("build", 80.0), ("vet", 75.0)],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(?:golangci-lint|golangci)\s+(run)(?:\s|$)",
        rtk_cmd: "rtk golangci-lint run",
        rewrite_prefixes: &["golangci-lint run", "golangci run"],
        category: "Go",
        savings_pct: 85.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^bundle\s+(install|update)\b",
        rtk_cmd: "rtk bundle",
        rewrite_prefixes: &["bundle"],
        category: "Ruby",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(?:bundle\s+exec\s+)?(?:bin/)?(?:rake|rails)\s+test",
        rtk_cmd: "rtk rake",
        rewrite_prefixes: &[
            "bundle exec rails",
            "bundle exec rake",
            "bin/rails",
            "rails",
            "rake",
        ],
        category: "Ruby",
        savings_pct: 85.0,
        subcmd_savings: &[("test", 90.0)],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(?:bundle\s+exec\s+)?rspec(?:\s|$)",
        rtk_cmd: "rtk rspec",
        rewrite_prefixes: &["bundle exec rspec", "bin/rspec", "rspec"],
        category: "Tests",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^(?:bundle\s+exec\s+)?rubocop(?:\s|$)",
        rtk_cmd: "rtk rubocop",
        rewrite_prefixes: &["bundle exec rubocop", "rubocop"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^aws\s+",
        rtk_cmd: "rtk aws",
        rewrite_prefixes: &["aws"],
        category: "Infra",
        savings_pct: 80.0,
        subcmd_savings: &[
            ("sts", 80.0),
            ("s3", 60.0),
            ("ec2", 85.0),
            ("ecs", 90.0),
            ("rds", 80.0),
            ("cloudformation", 90.0),
            ("logs", 88.0),
            ("lambda", 90.0),
            ("iam", 85.0),
            ("dynamodb", 70.0),
            ("s3api", 75.0),
            ("eks", 87.0),
            ("sqs", 78.0),
            ("secretsmanager", 75.0),
        ],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^psql(\s|$)",
        rtk_cmd: "rtk psql",
        rewrite_prefixes: &["psql"],
        category: "Infra",
        savings_pct: 75.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^ansible-playbook\b",
        rtk_cmd: "rtk ansible-playbook",
        rewrite_prefixes: &["ansible-playbook"],
        category: "Infra",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^brew\s+(install|upgrade)\b",
        rtk_cmd: "rtk brew",
        rewrite_prefixes: &["brew"],
        category: "PackageManager",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^composer\s+(install|update|require)\b",
        rtk_cmd: "rtk composer",
        rewrite_prefixes: &["composer"],
        category: "PackageManager",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^df(\s|$)",
        rtk_cmd: "rtk df",
        rewrite_prefixes: &["df"],
        category: "System",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^dotnet\s+build\b",
        rtk_cmd: "rtk dotnet",
        rewrite_prefixes: &["dotnet"],
        category: "Build",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^du\b",
        rtk_cmd: "rtk du",
        rewrite_prefixes: &["du"],
        category: "System",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^fail2ban-client\b",
        rtk_cmd: "rtk fail2ban-client",
        rewrite_prefixes: &["fail2ban-client"],
        category: "Infra",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^gcloud\b",
        rtk_cmd: "rtk gcloud",
        rewrite_prefixes: &["gcloud"],
        category: "Infra",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^hadolint\b",
        rtk_cmd: "rtk hadolint",
        rewrite_prefixes: &["hadolint"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^helm\b",
        rtk_cmd: "rtk helm",
        rewrite_prefixes: &["helm"],
        category: "Infra",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^iptables\b",
        rtk_cmd: "rtk iptables",
        rewrite_prefixes: &["iptables"],
        category: "Infra",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^make\b",
        rtk_cmd: "rtk make",
        rewrite_prefixes: &["make"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^markdownlint\b",
        rtk_cmd: "rtk markdownlint",
        rewrite_prefixes: &["markdownlint"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^mix\s+(compile|format)(\s|$)",
        rtk_cmd: "rtk mix",
        rewrite_prefixes: &["mix"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^mvn\s+(compile|package|clean|install)\b",
        rtk_cmd: "rtk mvn",
        rewrite_prefixes: &["mvn"],
        category: "Build",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^ping\b",
        rtk_cmd: "rtk ping",
        rewrite_prefixes: &["ping"],
        category: "Network",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^pio\s+run",
        rtk_cmd: "rtk pio",
        rewrite_prefixes: &["pio"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^poetry\s+(install|lock|update)\b",
        rtk_cmd: "rtk poetry",
        rewrite_prefixes: &["poetry"],
        category: "Python",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^pre-commit\b",
        rtk_cmd: "rtk pre-commit",
        rewrite_prefixes: &["pre-commit"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^ps(\s|$)",
        rtk_cmd: "rtk ps",
        rewrite_prefixes: &["ps"],
        category: "System",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^quarto\s+render",
        rtk_cmd: "rtk quarto",
        rewrite_prefixes: &["quarto"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^rsync\b",
        rtk_cmd: "rtk rsync",
        rewrite_prefixes: &["rsync"],
        category: "Network",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^shellcheck\b",
        rtk_cmd: "rtk shellcheck",
        rewrite_prefixes: &["shellcheck"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^shopify\s+theme\s+(push|pull)",
        rtk_cmd: "rtk shopify",
        rewrite_prefixes: &["shopify"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^sops\b",
        rtk_cmd: "rtk sops",
        rewrite_prefixes: &["sops"],
        category: "Infra",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^swift\s+(build|test)\b",
        rtk_cmd: "rtk swift",
        rewrite_prefixes: &["swift"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[("test", 90.0)],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^systemctl\s+status\b",
        rtk_cmd: "rtk systemctl",
        rewrite_prefixes: &["systemctl"],
        category: "System",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^terraform\s+plan",
        rtk_cmd: "rtk terraform",
        rewrite_prefixes: &["terraform"],
        category: "Infra",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^tofu\s+(fmt|init|plan|validate)(\s|$)",
        rtk_cmd: "rtk tofu",
        rewrite_prefixes: &["tofu"],
        category: "Infra",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^trunk\s+build",
        rtk_cmd: "rtk trunk",
        rewrite_prefixes: &["trunk"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^uv\s+(sync|pip\s+install)\b",
        rtk_cmd: "rtk uv",
        rewrite_prefixes: &["uv"],
        category: "Python",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^yamllint\b",
        rtk_cmd: "rtk yamllint",
        rewrite_prefixes: &["yamllint"],
        category: "Build",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^wc(\s|$)",
        rtk_cmd: "rtk wc",
        rewrite_prefixes: &["wc"],
        category: "Files",
        savings_pct: 60.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^gt\s+",
        rtk_cmd: "rtk gt",
        rewrite_prefixes: &["gt"],
        category: "Git",
        savings_pct: 70.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
    RtkRule {
        pattern: r"^liquibase(?:\s|$)",
        rtk_cmd: "rtk liquibase",
        rewrite_prefixes: &["liquibase"],
        category: "Infra",
        savings_pct: 65.0,
        subcmd_savings: &[],
        subcmd_status: &[],
    },
];

pub const IGNORED_PREFIXES: &[&str] = &[
    "cd ",
    "cd\t",
    "echo ",
    "printf ",
    "export ",
    "source ",
    "mkdir ",
    "rm ",
    "mv ",
    "cp ",
    "chmod ",
    "chown ",
    "touch ",
    "which ",
    "type ",
    "test ",
    "true",
    "false",
    "sleep ",
    "wait",
    "kill ",
    "set ",
    "unset ",
    "sort ",
    "uniq ",
    "tr ",
    "cut ",
    "awk ",
    "sed ",
    "python3 -c",
    "python -c",
    "node -e",
    "ruby -e",
    "rtk ",
    "pwd",
    "bash ",
    "sh ",
    "then\n",
    "then ",
    "else\n",
    "else ",
    "do\n",
    "do ",
    "for ",
    "while ",
    "if ",
    "case ",
];

pub const IGNORED_EXACT: &[&str] = &[
    "cd", "echo", "true", "false", "wait", "pwd", "bash", "sh", "fi", "done",
];
