-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(discover): expand rules coverage for git, kubectl, jq and ignore ln #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ pub struct RtkRule { | |
|
|
||
| // Patterns ordered to match RULES indices exactly. | ||
| pub const PATTERNS: &[&str] = &[ | ||
| r"^git\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)", | ||
| r"^git\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree|checkout|switch|remote|config|ls-files|tag|merge|rebase|reset|clean|clone|init|submodule|cherry-pick|revert|rm|mv|bisect|blame|reflog|shortlog|describe|archive|bundle|notes)", | ||
| r"^gh\s+(pr|issue|run|repo|api|release)", | ||
| r"^cargo\s+(build|test|clippy|check|fmt|install)", | ||
| r"^pnpm\s+(list|ls|outdated|install)", | ||
|
|
@@ -33,7 +33,7 @@ pub const PATTERNS: &[&str] = &[ | |
| r"^(npx\s+|pnpm\s+)?playwright", | ||
| r"^(npx\s+|pnpm\s+)?prisma", | ||
| r"^docker\s+(ps|images|logs|run|exec|build|compose\s+(ps|logs|build))", | ||
| r"^kubectl\s+(get|logs|describe|apply)", | ||
| r"^kubectl\s+(get|logs|describe|apply|create|delete|edit|scale|rollout|top|port-forward|config|exec|run|patch|label|annotate|explain|auth)", | ||
| r"^tree(\s|$)", | ||
| r"^diff\s+", | ||
| r"^curl\s+", | ||
|
|
@@ -88,6 +88,8 @@ pub const PATTERNS: &[&str] = &[ | |
| r"^trunk\s+build", | ||
| r"^uv\s+(sync|pip\s+install)\b", | ||
| r"^yamllint\b", | ||
| // jq — TOML filter exists (src/filters/jq.toml) but was missing from discover | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be handled by #894 |
||
| r"^jq\b", | ||
| ]; | ||
|
|
||
| pub const RULES: &[RtkRule] = &[ | ||
|
|
@@ -653,6 +655,15 @@ pub const RULES: &[RtkRule] = &[ | |
| subcmd_savings: &[], | ||
| subcmd_status: &[], | ||
| }, | ||
| // jq — TOML filter exists (src/filters/jq.toml) but was missing from discover | ||
| RtkRule { | ||
| rtk_cmd: "rtk jq", | ||
| rewrite_prefixes: &["jq"], | ||
| category: "System", | ||
| savings_pct: 60.0, | ||
| subcmd_savings: &[], | ||
| subcmd_status: &[], | ||
| }, | ||
| ]; | ||
|
|
||
| /// Commands to ignore (shell builtins, trivial, already rtk). | ||
|
|
@@ -706,6 +717,8 @@ pub const IGNORED_PREFIXES: &[&str] = &[ | |
| "while ", | ||
| "if ", | ||
| "case ", | ||
| "ln ", | ||
| "ln\t", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this should be added. Tab is a completion key in most terminals, it shouldn't be easy to use it in command lines and I'm not sure LLM would use it either. If it's a real case however, this should be handled globally and not just for that particular command |
||
| ]; | ||
|
|
||
| pub const IGNORED_EXACT: &[&str] = &[ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you sort commands in alphabetical order to ease maintenance burden 🙏