Skip to content

Commit 2af7033

Browse files
committed
feat: add glab (GitLab CLI) proxy support
Add token-optimized filtering for GitLab CLI (glab) commands: - `glab mr list`: Compact MR listing with state/draft icons (~85% savings) - `glab mr view`: Essential MR details with filtered description (~80% savings) - `glab issue list`: Compact issue listing (~80% savings) - `glab issue view`: Essential issue details (~75% savings) - All other subcommands (api, pipeline, release): passthrough with tracking Follows the established gh_cmd.rs pattern: - JSON output parsing with serde_json - State icons (ultra_compact mode support) - Description filtering (HTML comments, images, horizontal rules) - Identifier extraction for view commands - Graceful fallback to raw command on filter failure - Exit code propagation Includes: - Test fixtures with sanitized data - Unit tests for all filter functions - Token savings assertions (>=60%) - Discover rules for hook rewrite integration Closes #851
1 parent a00560a commit 2af7033

5 files changed

Lines changed: 1145 additions & 0 deletions

File tree

src/discover/rules.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct RtkRule {
1515
pub const PATTERNS: &[&str] = &[
1616
r"^git\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)",
1717
r"^gh\s+(pr|issue|run|repo|api|release)",
18+
r"^glab\s+(mr|issue|api|pipeline|release|repo)",
1819
r"^cargo\s+(build|test|clippy|check|fmt|install)",
1920
r"^pnpm\s+(list|ls|outdated|install)",
2021
r"^npm\s+(run|exec)",
@@ -110,6 +111,14 @@ pub const RULES: &[RtkRule] = &[
110111
subcmd_savings: &[("pr", 87.0), ("run", 82.0), ("issue", 80.0)],
111112
subcmd_status: &[],
112113
},
114+
RtkRule {
115+
rtk_cmd: "rtk glab",
116+
rewrite_prefixes: &["glab"],
117+
category: "GitLab",
118+
savings_pct: 82.0,
119+
subcmd_savings: &[("mr", 85.0), ("issue", 80.0)],
120+
subcmd_status: &[],
121+
},
113122
RtkRule {
114123
rtk_cmd: "rtk cargo",
115124
rewrite_prefixes: &["cargo"],

0 commit comments

Comments
 (0)