-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
Summary
The clean --merged command currently only supports GitHub repositories via the gh CLI. It should also support GitLab repositories using the glab CLI.
Current Behavior
clean --mergedrequires the GitHub CLI (gh) and usesgh pr list --head <branch> --state mergedto detect merged PRs- Running against a GitLab-hosted repo fails with:
"Not authenticated with GitHub or not a GitHub repository"
Proposed Behavior
Auto-detect the remote hosting provider and use the appropriate CLI:
- GitHub →
gh pr list --head <branch> --state merged ... - GitLab →
glab mr list --source-branch <branch> --merged ...(or equivalent)
Detection approach
Inspect the origin remote URL to determine the provider:
- URLs containing
github.com→ usegh - URLs containing
gitlab.com(or self-hosted GitLab instances) → useglab
Implementation notes
- The
glabCLI equivalent for checking merged MRs would be something like:
glab mr list --source-branch "$branch" --merged --output json glabauth check:glab auth status- Should fail gracefully if neither
ghnorglabis installed, with a clear error message - Consider supporting self-hosted GitLab instances (glab handles this via
glab auth login --hostname) - Could be extended to other providers (e.g., Bitbucket) in the future
Affected Code
bin/gtrlines ~1114-1210 (cmd_cleanmerged mode)
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels