feat: add infra filters for terraform, nix, ansible, and opentofu#769
feat: add infra filters for terraform, nix, ansible, and opentofu#769BSD-Yassin wants to merge 4 commits intortk-ai:masterfrom
Conversation
Introduce dedicated rtk nix and rtk terraform handlers to keep high-signal infra output while dropping progress and attribute-level noise. This preserves actionable plan/search summaries and records savings in tracking history for gain analytics.
Introduce a dedicated ansible-playbook handler that keeps task/recap/failure signals while dropping routine noise, and wire it into CLI routing and integrity-protected operational commands so gains are tracked directly.
Treat OpenTofu as a Terraform-equivalent RTK command so infra plans are compressed consistently, tracked in gain history, and rewritten from discover hooks.
📊 Automated PR Analysis
SummaryAdds first-class RTK filter support for Terraform, OpenTofu, Nix, and Ansible-playbook commands, providing compact output with gain tracking. Also extends the discover/rewrite system to recognize and rewrite these commands to their RTK equivalents. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Add an infrastructure command section in the README and record the new first-class infra filters in the Unreleased changelog so the PR scope is explicit for reviewers.
|
Those tools are heavy in my daily workflow, and while debugging an issue, they can be launched in conjunction with aws-cli, docker, curl and eat a lot of tokens. Take this PR as my first reduction of token and the start of a lot of "infra/devops" related reduction. Note : I have not added any automated tests. That could obviously be a blocking step that can be discussed here. The nix command should be alright to test directly on the pipeline or locally but for terraform, ansible and opentofu, I didn't want to create a whole infra for testing each use case. Nor did I want to create an output model file, as I assume that any of those tools will evolve in the future and it would require this output file would need to follow version changes. I have yet to think of a fair solution, I suppose all of them are able to create local resources, that would make a good compromise for an execution test all while not reaching a remote instance to provision / configure. Feel free to ask any questions, remarks or require any improvements, as it is one of my rare contributions, and do note that I obviously helped myself with IA to produce it. |
Summary
rtk terraform,rtk nix, andrtk ansible-playbooksupport for compact infra output with gain tracking.rtk tofusupport as a Terraform-equivalent command by reusing the Terraform filter pipeline and preserving OpenTofu-specific tracking labels.terraform,nix,ansible-playbook, andtofucommands are recognized and rewritten to RTK equivalents.Test plan
cargo fmt --allcargo clippy --all-targetscargo test --allnix-shellwith real tools (terraform,opentofu,ansible,nix) using raw-vs-rtk comparisons:rtk terraform plan -no-colorrtk tofu plan -no-colorrtk nix search nixpkgs hellortk ansible-playbook ...rtk rewrite "tofu plan -lock=false"rtk rewrite "terraform apply -auto-approve"rtk rewrite "nix search nixpkgs hello"rtk rewrite "ansible-playbook ..."Notes
bash scripts/test-all.sh) reports known environment-related failures unrelated to this change (learn/discoverneed Claude sessions, and script used an older globally installedrtkbinary).