`gh stack view --json` omits the stack number that the text output prints

Open Beginner friendly
#416 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
cli

Research direction

Start at the gh stack view --json entry point and compare its payload with the human-readable gh stack view --short output. The change is done when the JSON includes the stack identifier as a top-level number field, while the existing branches, currentBranch, and trunk fields remain available; check the command's existing tests if present.

Written by the indexing model from the issue text.

Description

feature request topic: cli - view

Summary

gh stack view prints the stack number in its human-readable output, but gh stack view --json omits it:

$ gh stack view --short
Stack #6
» stack-b-one ○ #4 (current)
...

$ gh stack view --json | jq 'keys'
[
  "branches",
  "currentBranch",
  "trunk"
]

The per-branch objects carry pr.number, pr.url and pr.state, but the stack's own identifier is nowhere in the payload.

Why this matters

The stack number is the identifier gh stack checkout and gh stack link take, and the one shown in the GitHub stack UI — so it is the natural key for any automation. Because it is missing from the machine-readable output, scripts have to scrape it from gh stack submit's human-readable text (✓ Stack created on GitHub with 2 PRs (stack #6)) or from the UI.

Expected

Include the stack number as a top-level field in --json output, e.g. "number": 6, so --json is sufficient on its own.

Environment

  • gh 2.97.0
  • gh-stack v0.1.0
  • git 2.50.1
  • macOS 26.4.1, darwin/arm64
Dominant language
Go
Stars
1.5k
Forks
73
Avg merge
1d 8h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/gh-stack

All issues in github/gh-stack

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.