Skip to content

feat: add glab (GitLab CLI) proxy support#854

Open
Smasherr wants to merge 3 commits intortk-ai:developfrom
Smasherr:feat/glab-support
Open

feat: add glab (GitLab CLI) proxy support#854
Smasherr wants to merge 3 commits intortk-ai:developfrom
Smasherr:feat/glab-support

Conversation

@Smasherr
Copy link

@Smasherr Smasherr commented Mar 26, 2026

Summary

  • Add token-optimized filtering for GitLab CLI (glab) commands, following the established gh_cmd.rs pattern
  • Filter mr list/view, issue list/view, ci list/trace, release view with 40-97% token savings
  • All other glab subcommands (api, pipeline, etc.) pass through with usage tracking
  • Include discover rules for automatic hook rewrite (glab -> rtk glab)

Closes #851

Coverage

Command Strategy Savings
glab mr list JSON -> compact text with state/draft icons ~97%
glab mr view JSON -> essential fields + filtered description ~93%
glab issue list JSON -> compact text with state icons ~80%
glab issue view JSON -> essential fields + filtered description ~75%
glab ci list JSON -> status icons + ref + source ~90%
glab ci trace Strip ANSI, section markers, runner boilerplate ~40-60%
glab release view Strip SOURCES block + markdown noise ~63%
glab release list Passthrough (already compact text) tracked
glab api, glab * Passthrough tracked

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test (1132 passed, 0 failed)
  • Manual testing: rtk glab mr list, rtk glab mr view, rtk glab ci list, rtk glab ci trace, rtk glab release view output inspected
  • rtk gain --history confirms savings: mr list 97%, mr view 93%, ci list 90%, release view 63%
  • rtk rewrite "glab mr list" outputs rtk glab mr list (hook integration works)

@Smasherr Smasherr force-pushed the feat/glab-support branch from 809e088 to 2af7033 Compare March 26, 2026 08:55
@CLAassistant
Copy link

CLAassistant commented Mar 26, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Smasherr
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@Smasherr Smasherr changed the base branch from master to develop March 26, 2026 09:43
@aeppling
Copy link
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git detects renames automatically. If you get import conflicts, update the paths:

use crate::git;        // now: use crate::cmds::git::git;
use crate::tracking;   // now: use crate::core::tracking;
use crate::config;     // now: use crate::core::config;
use crate::init;       // now: use crate::hooks::init;
use crate::gain;       // now: use crate::analytics::gain;

Need help rebasing? Tag @aeppling

github-actions bot and others added 3 commits March 26, 2026 21:31
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 rtk-ai#851
Add token-optimized filtering for two more glab subcommand groups:

CI/CD pipelines:
- `glab ci list`: Compact pipeline listing with status icons (~90% savings)
- `glab ci trace`: Strip ANSI codes, section markers, runner boilerplate,
  git fetch noise, and artifact upload details. Keep commands, build output,
  warnings, errors, and job result.

Releases:
- `glab release list`: Passthrough (already compact text output)
- `glab release view`: Strip SOURCES block (archive URLs are noise),
  filter markdown noise (HTML comments, images, horizontal rules)

Also:
- Add lazy_static regex for CI section markers and bare ANSI codes
- Update discover rules pattern and savings estimates
- Add test fixtures and unit tests for all new filters
@Smasherr Smasherr force-pushed the feat/glab-support branch from d052aa6 to af05b14 Compare March 26, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add glab api proxy support

3 participants