---
name: glab-read
description: >
  Read-only GitLab lookups through one script instead of an ad hoc
  `glab ... | python3 -c` pipe: MR or issue fields and description, review
  threads (unresolved, by id, with reactions), per-file diff counts and
  filtered diff lines, issue and MR search. Use whenever a task needs to
  read an MR, issue, or review thread from GitLab. Never writes to GitLab.
---

Run `scripts/glab-read.py` (stdlib Python, shells out to `glab`). Do not
write a throwaway parser for the shapes below.

| Need | Command |
| --- | --- |
| MR fields and description | `glab-read.py mr [IID] [--fields iid,sha,pipeline]` |
| Issue fields and description | `glab-read.py issue IID` |
| Open review threads | `glab-read.py threads IID --unresolved` |
| One thread, every note | `glab-read.py threads IID --id <prefix>` |
| One thread by a note id | `glab-read.py threads IID --note <note-id>` |
| Did I react to the first note | add `--emoji` to `threads` |
| Changed files with +/- counts | `glab-read.py files IID` |
| Diff lines of one file | `glab-read.py files IID --path <substr> [--grep <regex>]` |
| Find issues or MRs | `glab-read.py search issues\|mrs <query> [--state S] [--author U]` |
| Is this MR mine | `glab-read.py mine IID` (exit 1 when someone else authored it) |

`-R group/project` overrides the project taken from the origin remote.
`--max N` clips each note body or diff line.

For anything the script lacks (raw repo files, posting, description
round-trips), use `glab api` directly and add the shape here when it recurs.
