Skip to main content

CLI wrapper around GitLab Discussions REST API for listing, creating, and managing MR discussions

Project description

glab-discussion

CLI wrapper around GitLab Discussions REST API for listing, creating, and managing merge request discussions. Built on top of glab for authentication.

Why

The glab CLI has no native support for merge request discussions. Reviewing comments, replying to threads, adding inline code review notes, and resolving discussions all require manual API calls with complex nested JSON payloads. This tool wraps those APIs into simple commands, with an incremental dump mode designed for AI agent workflows — each discussion thread gets its own file, only changed threads are rewritten, and bot authors are automatically tagged.

Installation

uv tool install glab-discussion

Claude Code plugin

The repo includes a Claude Code plugin with:

  • a skill that teaches AI agents how to use glab-discussion
  • a PreToolUse hook that blocks glab api .../discussions|notes calls and glab mr view --comments, redirecting the agent to use glab-discussion instead. This keeps thread IDs, resolve state, and inline diff positions in scope rather than letting the agent wrangle raw API JSON.
claude plugin marketplace add fprochazka/glab-discussion
claude plugin install glab-discussion@fprochazka-glab-discussion

To upgrade after a new release:

uv tool install --force glab-discussion
claude plugin marketplace update fprochazka-glab-discussion
claude plugin update glab-discussion@fprochazka-glab-discussion

Usage

By default, the MR is auto-detected from the current git branch (via glab mr view). Override with --mr-url or --hostname/--project/--mr-iid.

read

Read MR discussions. Prints to stdout by default, or writes per-thread files with --dump. In non-interactive environments (AI agents, piped output), --dump is the default.

glab-discussion read                 # auto-detect MR from git branch
glab-discussion read --dump          # one file per thread, incrementally updated
glab-discussion read --dump --full   # clear and rewrite all files
glab-discussion read --no-dump       # force stdout even in non-interactive mode

write

Create a new discussion, reply to a thread, or add an inline diff note.

glab-discussion write --body "Comment text"
glab-discussion write --reply-to DISCUSSION_ID --body "Reply"
glab-discussion write --file path/to/file.py --new-line 42 --body "Issue here"
glab-discussion write --file path/to/file.py --old-line 10 --body "Was wrong"
echo "From stdin" | glab-discussion write --body -

--new-line corresponds to the file on the MR source branch — if the branch is checked out locally, local file line numbers match directly. --old-line refers to the target branch version.

diff

Show the MR diff annotated with old/new line numbers, so you know which line numbers to use with write --new-line or --old-line.

glab-discussion diff
glab-discussion diff --file path/to/file.py
glab-discussion diff --version 3

resolve

Resolve or unresolve a discussion.

glab-discussion resolve DISCUSSION_ID
glab-discussion resolve DISCUSSION_ID --unresolve

edit

Edit an existing note's body.

glab-discussion edit NOTE_ID --body "Updated text"
echo "From stdin" | glab-discussion edit NOTE_ID --body -

delete

Delete a note.

glab-discussion delete NOTE_ID

Requirements

  • glab CLI installed and authenticated
  • Python 3.12+

Development

git clone https://github.com/fprochazka/glab-discussion.git
cd glab-discussion
uv sync --dev

Run tests and linting:

uv run ruff format .
uv run ruff check .
uv run pytest

Releasing

Version is derived automatically from git tags via hatch-vcs — no manual version bumping needed.

Before tagging, bump the version in both plugin manifest files:

  • coding-agent-plugins/claude-code/.claude-plugin/plugin.json
  • .claude-plugin/marketplace.json

Wait for CI to pass on master, then tag, push, and create a GitHub release:

# Review changes since last release
git log $(git describe --tags --abbrev=0)..HEAD --oneline

git tag v<version>
git push origin v<version>
gh release create v<version> --title "v<version>" --notes "..."

The publish.yml GitHub Action builds and publishes to PyPI automatically via trusted publishing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glab_discussion-0.2.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glab_discussion-0.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file glab_discussion-0.2.0.tar.gz.

File metadata

  • Download URL: glab_discussion-0.2.0.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glab_discussion-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bed8216bc2887a4655b59b72e94c2a4b927a3522fcf2bd4b2a843f894320c80e
MD5 58cc4d98aacb0cea10b1f914e1a23251
BLAKE2b-256 ac2d2d6974666fc22c3bcb1aa9ccedd449f945f9db56b36e62e5eb23d3c30a28

See more details on using hashes here.

Provenance

The following attestation bundles were made for glab_discussion-0.2.0.tar.gz:

Publisher: publish.yml on fprochazka/glab-discussion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file glab_discussion-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: glab_discussion-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glab_discussion-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34c69adf54c641951729c779dda7249027307d936a972194a0d691f0918f09db
MD5 d3a58ccc5d3ae218d545d7f070f946b9
BLAKE2b-256 6d2f515878b9b88e32806fbe0924a7a506cc100169f47900c97491f9dbe69948

See more details on using hashes here.

Provenance

The following attestation bundles were made for glab_discussion-0.2.0-py3-none-any.whl:

Publisher: publish.yml on fprochazka/glab-discussion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page