gh pr view *

built-in
20.2% Savings
38 Commands
4.5K Tokens saved
2 Tests

Install

tokf install 0f101899d310d6f4c5a49ca10eebf3cc8c0bdd7cf35b5ccd030fbb306be47eb7
Safety checks passed

Filter definition

command = "gh pr view *"
description = "Structured JSON extraction of PR details with review status and body"
run = "gh pr view {args} --json number,title,state,author,headRefName,baseRefName,reviewDecision,labels,assignees,milestone,body"
passthrough_args = ["--web", "-w"]

[json]

[[json.extract]]
path = "$.number"
as = "number"

[[json.extract]]
path = "$.title"
as = "title"

[[json.extract]]
path = "$.state"
as = "state"

[[json.extract]]
path = "$.author.login"
as = "author"

[[json.extract]]
path = "$.headRefName"
as = "head"

[[json.extract]]
path = "$.baseRefName"
as = "base"

[[json.extract]]
path = "$.reviewDecision"
as = "review"

[[json.extract]]
path = "$.milestone"
as = "milestone"

[[json.extract]]
path = "$.body"
as = "body"

[[json.extract]]
path = "$.labels[*]"
as = "labels"

[[json.extract.fields]]
field = "name"
as = "name"

[[json.extract]]
path = "$.assignees[*]"
as = "assignees"

[[json.extract.fields]]
field = "login"
as = "login"

[on_success]
output = "#{number} {title}\nstate: {state}\nauthor: {author}\nbranch: {head} -> {base}\nreview: {review}\nassignees: {assignees | each: \"{login}\" | join: \", \"}\nlabels: {labels | each: \"{name}\" | join: \", \"}\nmilestone: {milestone}\n--\n{body}"

[on_failure]
tail = 10

Examples

auth error shows tail ~39 tokens → ~39 tokens
Raw output
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.
Filtered output
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.
PR view extracts JSON fields ~71 tokens → ~48 tokens (32% saved)
Raw output
{"assignees":[],"author":{"login":"scarf005"},"baseRefName":"trunk","body":"Summary of changes...","headRefName":"fix/repo-fork","labels":[{"name":"external"}],"milestone":null,"number":12813,"reviewDecision":"REVIEW_REQUIRED","state":"OPEN","title":"fix(repo fork): set default repo"}
Filtered output
#12813 fix(repo fork): set default repo
state: OPEN
author: scarf005
branch: fix/repo-fork -> trunk
review: REVIEW_REQUIRED
assignees: 
labels: external
milestone: null
--
Summary of changes...
Warning: Community filters are third-party code. Review the filter definition above before installing it in production environments.
Browse all filters