Skip to content

Commit ae5ab09

Browse files
committed
Add stack Number field to local model and schema
The new Stacks REST API exposes a human-facing stack number (shown in the github.com UI) alongside the internal stack id. Add a Number field to the stack.Stack model and document it in schema.json so it can be persisted in the .git/gh-stack file. Purely additive; behavior is unchanged until callers populate it. Copilot-Session: 03673c26-a245-42da-93ed-dfcebc92a740
1 parent 37505c7 commit ae5ab09

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎internal/stack/schema.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
"properties": {
2929
"id": {
3030
"type": "string",
31-
"description": "Identifier for this stack, populated from the API when available."
31+
"description": "Global identifier for this stack, populated from the API when available."
32+
},
33+
"number": {
34+
"type": "integer",
35+
"description": "Repo-scoped number identifying this stack, displayed in the GitHub UI. Used as the primary way to reference a stack."
3236
},
3337
"prefix": {
3438
"type": "string",

‎internal/stack/stack.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type BranchRef struct {
4343
// Stack represents a single stack of branches.
4444
type Stack struct {
4545
ID string `json:"id,omitempty"`
46+
Number int `json:"number,omitempty"`
4647
Prefix string `json:"prefix,omitempty"`
4748
Numbered bool `json:"numbered,omitempty"`
4849
Trunk BranchRef `json:"trunk"`

‎internal/stack/stack_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ func TestLoad_Save_RoundTrip(t *testing.T) {
235235
Stacks: []Stack{
236236
{
237237
ID: "s1",
238+
Number: 7,
238239
Prefix: "feat",
239240
Trunk: BranchRef{Branch: "main", Head: "abc123"},
240241
Branches: []BranchRef{
@@ -256,6 +257,7 @@ func TestLoad_Save_RoundTrip(t *testing.T) {
256257

257258
s := loaded.Stacks[0]
258259
assert.Equal(t, "s1", s.ID)
260+
assert.Equal(t, 7, s.Number)
259261
assert.Equal(t, "feat", s.Prefix)
260262
assert.Equal(t, "main", s.Trunk.Branch)
261263
assert.Equal(t, "abc123", s.Trunk.Head)

0 commit comments

Comments
 (0)