Repository navigation
fix(kubectl): support global flags before subcommand, add exec/delete/rollout and 15 more subcommands - #1196
Closed
ousamabenyounes wants to merge 2 commits into
Closed
ousamabenyounes wants to merge 2 commits into
ousamabenyounes wants to merge 2 commits into
Conversation
Collaborator
📊 Automated PR Analysis
SummaryFixes kubectl command classification and rewriting to support global flags (like --context, -n, --kubeconfig) appearing before the subcommand, which were previously causing commands to be silently skipped. Also extends the recognized subcommand list from 4 to 19+ entries and fixes git log output truncation for user-specified formats. Review Checklist
Linked issues: #927 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
…commands (#927) The classify/rewrite pattern only matched subcommands in first position, so `kubectl --context foo get pods` or `kubectl -n ns exec pod` were not rewritten by the hook or flagged as missed savings. Update the RtkRule pattern to skip zero or more global flags (--long-opt[=val|-n val) before matching the subcommand, and extend the subcommand list from 4 to 19 entries (exec, delete, create, patch, rollout, scale, port-forward, top, diff, wait, events, run, expose, auth, cp, version, config, api-resources, label, annotate, edit, replace, cordon, drain, taint). Add regression tests for --context, -n, and exec cases. Closes #927 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
`rewrite_command` now requires a third `transparent_prefixes: &[String]` argument on develop. Update the 3 kubectl global-flag assertions added in this PR to pass `&[]` so the project compiles cleanly post-rebase. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
Author
|
@aepling — rebased on RED → GREEN proof ( Ready for re-review 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kubectlclassify/rewrite regex only matched subcommands in the first token position, so commands likekubectl --context foo get podsorkubectl -n ns exec pod -- bashwere silently skipped — not rewritten by the hook and not flagged as missed savings byrtk discoverRtkRulepattern to allow zero or more global flags (--long-opt[=val],-f val) before the subcommand anchorget,logs,describe,apply) to 19 entries:exec,delete,create,patch,rollout,scale,port-forward,top,diff,wait,events,run,expose,auth,cp,version,config,api-resources,label,annotate,edit,replace,cordon,drain,taint--context,-n, andexecpatternsTest plan
cargo fmt --allpassescargo clippy --all-targets— no new errors (only pre-existing warnings)cargo test --all— all 1379 tests passtest_rewrite_kubectl_with_context_flag,test_rewrite_kubectl_short_namespace_flag,test_rewrite_kubectl_exec_subcommand,test_classify_kubectl_exec,test_classify_kubectl_delete,test_classify_kubectl_rolloutCloses #927
🤖 Generated with Ora Studio
Vibe Coded by Ousama Ben Younes
Developed With Ora Studio (Claude Code)