@qvac/harness 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harness.bundle +70 -16
- package/dist/prebuilds-manifest.json +8 -0
- package/dist-lib/index.d.ts +2 -1
- package/dist-lib/index.js +60 -59
- package/dist-lib/lib/audio-transcode-bare.js +2 -2
- package/dist-lib/lib/capabilities/completion.d.ts +35 -2
- package/dist-lib/lib/capabilities/completion.js +114 -48
- package/dist-lib/lib/capabilities/download.js +2 -2
- package/dist-lib/lib/capabilities/speech-text.js +1 -1
- package/dist-lib/lib/capabilities/tool-prompt-log.js +1 -1
- package/dist-lib/lib/capabilities/tool-selection.js +2 -2
- package/dist-lib/lib/capabilities/tool-turns.js +1 -1
- package/dist-lib/lib/capabilities/usage-breakdown.js +1 -1
- package/dist-lib/lib/capabilities/voice.js +3 -3
- package/dist-lib/lib/connect.js +12 -11
- package/dist-lib/lib/context-window.js +1 -1
- package/dist-lib/lib/contract-types.d.ts +1 -0
- package/dist-lib/lib/docx/index.js +3 -3
- package/dist-lib/lib/hardware/capability-probe.js +3 -3
- package/dist-lib/lib/hardware/gpu-probe-addon.js +2 -2
- package/dist-lib/lib/hardware/gpu-probe-entry.js +1 -1
- package/dist-lib/lib/helpers/markup-stream-filter.js +1 -1
- package/dist-lib/lib/helpers/run-outcome.js +1 -1
- package/dist-lib/lib/helpers/spawn-path.d.ts +1 -1
- package/dist-lib/lib/helpers/thinking.js +2 -2
- package/dist-lib/lib/helpers/tool-intent.js +1 -1
- package/dist-lib/lib/helpers/tool-label.js +3 -3
- package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/arg-repair.js +1 -1
- package/dist-lib/lib/hooks/built-in/egress.d.ts +1 -1
- package/dist-lib/lib/hooks/built-in/egress.js +2 -2
- package/dist-lib/lib/hooks/built-in/index.js +3 -3
- package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +1 -1
- package/dist-lib/lib/hooks/pipeline.js +4 -4
- package/dist-lib/lib/hooks/registry.js +1 -1
- package/dist-lib/lib/hooks/run.js +1 -1
- package/dist-lib/lib/models/model-catalog.js +4 -4
- package/dist-lib/lib/models/model-delete.js +1 -1
- package/dist-lib/lib/models/model-handle.js +1 -1
- package/dist-lib/lib/models/model-list.js +1 -1
- package/dist-lib/lib/models/model-pool.js +8 -8
- package/dist-lib/lib/models/model-source.js +1 -1
- package/dist-lib/lib/models/music-catalog.d.ts +1 -1
- package/dist-lib/lib/no-redirect-fetch-bare.js +3 -3
- package/dist-lib/lib/no-redirect-fetch-impl.js +1 -1
- package/dist-lib/lib/no-redirect-fetch-node.js +2 -2
- package/dist-lib/lib/resolution-detector.js +1 -1
- package/dist-lib/lib/sdk-loader.js +2 -2
- package/dist-lib/lib/sdk-storage.js +1 -1
- package/dist-lib/lib/serve.js +11 -10
- package/dist-lib/lib/spawn.js +3 -3
- package/dist-lib/lib/staging.js +1 -1
- package/dist-lib/lib/tools/catalog.js +1 -1
- package/dist-lib/lib/tools/create-documents.js +2 -2
- package/dist-lib/lib/tools/edit-documents.js +2 -2
- package/dist-lib/lib/tools/edit-image.js +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/attachments.js +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +1 -1
- package/dist-lib/lib/tools/exec/adapters/python/loader.js +1 -1
- package/dist-lib/lib/tools/exec/adapters/python/memfs.js +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +6 -6
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +3 -3
- package/dist-lib/lib/tools/exec/adapters/python/run-session.js +5 -5
- package/dist-lib/lib/tools/exec/adapters/python/wheels.js +1 -1
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.js +3 -3
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +4 -4
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +1 -1
- package/dist-lib/lib/tools/exec/obsidian/cli-process.js +2 -2
- package/dist-lib/lib/tools/exec/obsidian/cli.js +4 -4
- package/dist-lib/lib/tools/exec/obsidian/command.js +1 -1
- package/dist-lib/lib/tools/exec/obsidian/route.js +7 -7
- package/dist-lib/lib/tools/exec/obsidian/vault-create.js +2 -2
- package/dist-lib/lib/tools/exec/obsidian/vault-fs.js +6 -6
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.js +2 -2
- package/dist-lib/lib/tools/exec/obsidian/vault-read.js +1 -1
- package/dist-lib/lib/tools/exec/obsidian/vault-write.js +2 -2
- package/dist-lib/lib/tools/exec/runner.js +1 -1
- package/dist-lib/lib/tools/exec.js +13 -13
- package/dist-lib/lib/tools/file-glob.js +3 -3
- package/dist-lib/lib/tools/fs/local.js +1 -1
- package/dist-lib/lib/tools/fs/remote.js +1 -1
- package/dist-lib/lib/tools/fs/walk.js +2 -2
- package/dist-lib/lib/tools/generate-image.js +4 -4
- package/dist-lib/lib/tools/generate-music.js +6 -6
- package/dist-lib/lib/tools/grep.js +6 -6
- package/dist-lib/lib/tools/http-request/truncate-response.js +1 -1
- package/dist-lib/lib/tools/http-request.js +9 -9
- package/dist-lib/lib/tools/mcp/utils.js +1 -1
- package/dist-lib/lib/tools/mcp-call.js +8 -8
- package/dist-lib/lib/tools/operations/builders.d.ts +1 -1
- package/dist-lib/lib/tools/operations/builders.js +1 -1
- package/dist-lib/lib/tools/operations/compile.js +1 -1
- package/dist-lib/lib/tools/operations/manifest.d.ts +16 -16
- package/dist-lib/lib/tools/operations/manifest.js +1 -1
- package/dist-lib/lib/tools/outbound-guard.js +1 -1
- package/dist-lib/lib/tools/rag-search.js +1 -1
- package/dist-lib/lib/tools/read-files.js +3 -3
- package/dist-lib/lib/tools/skill.js +8 -8
- package/dist-lib/lib/tools/skills/auth-resolver.js +2 -2
- package/dist-lib/lib/tools/skills/bin-check.js +1 -1
- package/dist-lib/lib/tools/skills/bundled-dir.js +2 -2
- package/dist-lib/lib/tools/skills/catalog.js +10 -10
- package/dist-lib/lib/tools/skills/cli-schema-check.js +1 -1
- package/dist-lib/lib/tools/skills/cli-schema-load.js +1 -1
- package/dist-lib/lib/tools/skills/cli-schema.js +4 -4
- package/dist-lib/lib/tools/skills/credential-check.js +3 -3
- package/dist-lib/lib/tools/skills/credential-grants.js +1 -1
- package/dist-lib/lib/tools/skills/credential-health.js +2 -2
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +1 -1
- package/dist-lib/lib/tools/skills/index.js +5 -5
- package/dist-lib/lib/tools/skills/mention.js +1 -1
- package/dist-lib/lib/tools/skills/overlay-crud.js +1 -1
- package/dist-lib/lib/tools/skills/setup-routes.js +1 -1
- package/dist-lib/lib/tools/skills/skill-settings.js +1 -1
- package/dist-lib/lib/tools/skills/skill-state-constants.d.ts +8 -8
- package/dist-lib/lib/tools/skills/skill-state.js +9 -9
- package/dist-lib/lib/tools/toolsets.d.ts +1 -1
- package/dist-lib/lib/tools/url-guard.js +2 -2
- package/dist-lib/lib/tools/weather-lookup/place.d.ts +11 -0
- package/dist-lib/lib/tools/weather-lookup/place.js +152 -0
- package/dist-lib/lib/tools/weather-lookup/report.d.ts +37 -0
- package/dist-lib/lib/tools/weather-lookup/report.js +56 -0
- package/dist-lib/lib/tools/weather-lookup.d.ts +8 -0
- package/dist-lib/lib/tools/weather-lookup.js +110 -0
- package/dist-lib/lib/tools/web-fetch.js +10 -10
- package/dist-lib/lib/tools/web-search.js +2 -2
- package/dist-lib/lib/transport.js +1 -1
- package/dist-lib/lib/validating-lookup.js +1 -1
- package/dist-lib/lib/web-fetch/embedded-state.js +1 -1
- package/dist-lib/lib/web-fetch/extract.js +1 -1
- package/dist-lib/lib/web-fetch/images.js +1 -1
- package/dist-lib/lib/web-fetch/video.js +1 -1
- package/dist-lib/lib/web-search/engine-registry.js +7 -7
- package/dist-lib/lib/web-search/engines/aol.js +3 -3
- package/dist-lib/lib/web-search/engines/bing.js +4 -4
- package/dist-lib/lib/web-search/engines/brave.js +2 -2
- package/dist-lib/lib/web-search/engines/duckduckgo.js +3 -3
- package/dist-lib/lib/web-search/engines/google.js +4 -4
- package/dist-lib/lib/web-search/engines/wikipedia.js +2 -2
- package/dist-lib/lib/web-search/engines/yahoo.js +3 -3
- package/dist-lib/lib/web-search/fetch-html.js +1 -1
- package/dist-lib/lib/web-search/merge-results.js +1 -1
- package/dist-lib/lib/web-search/orchestrator.js +3 -3
- package/dist-lib/lib/wire.js +28 -0
- package/dist-lib/schema/baseline.js +1 -1
- package/dist-lib/schema/build.js +3 -3
- package/dist-lib/schema/harness.js +5 -2
- package/dist-lib/schema/release-tags.d.ts +2 -1
- package/dist-lib/schema/release-tags.js +9 -7
- package/dist-lib/spec/hrpc/messages.js +22 -7
- package/dist-lib/spec/hyperschema/index.js +22 -7
- package/dist-lib/spec/hyperschema/schema.json +14 -1
- package/dist-lib/spec/hyperschema/types.d.ts +3 -2
- package/package.json +21 -8
- package/worker/harness-sidecar.mjs +2 -0
- package/.claude/skills/asana/SKILL.md +0 -86
- package/.claude/skills/gh-stack/SKILL.md +0 -181
- package/.claude/skills/gh-stack/references/commands.md +0 -177
- package/.claude/skills/gh-stack/references/stack-design.md +0 -97
- package/.claude/skills/gh-stack/references/troubleshooting.md +0 -159
- package/.claude/skills/js-house-style/SKILL.md +0 -671
- package/.claude/skills/kvcache/SKILL.md +0 -171
- package/.claude/skills/pr-create/SKILL.md +0 -180
- package/.claude/skills/pr-review/SKILL.md +0 -217
- package/CLAUDE.md +0 -39
- package/docs/decisions/2026-05-29-kvcache-tool-turns.md +0 -75
- package/docs/decisions/2026-06-02-kvcache-tool-turns-reenabled.md +0 -127
- package/docs/decisions/2026-06-23-android-cpu-llm-defaults.md +0 -126
- package/docs/decisions/2026-07-29-assistant-owned-storage-layout.md +0 -88
- package/docs/decisions/2026-08-04-sidecar-orphan-reaping.md +0 -79
- package/docs/decisions/2026-08-11-pyodide-worker-thread.md +0 -68
- package/docs/decisions/2026-08-17-harness-hook-pipeline.md +0 -84
- package/docs/decisions/2026-08-17-harness-outbound-egress-guard.md +0 -176
- package/docs/decisions/2026-08-20-chat-prompt-prefix-is-stable.md +0 -95
- package/docs/decisions/2026-08-20-kvcache-static-placement.md +0 -109
- package/docs/decisions/2026-08-21-vendored-python-wheels.md +0 -85
- package/docs/decisions/2026-08-26-exec-is-not-gated-by-skills.md +0 -64
- package/docs/decisions/2026-08-27-writable-skills-overlay.md +0 -56
- package/docs/decisions/2026-09-01-skill-operation-manifests.md +0 -53
- package/docs/decisions/2026-09-01-usage-breakdown-is-measured.md +0 -78
- package/docs/decisions/2026-09-03-usage-breakdown-reported-by-the-harness.md +0 -136
- package/docs/decisions/INDEX.md +0 -38
- package/docs/decisions/TEMPLATE.md +0 -32
- package/docs/kvcache-reference.md +0 -655
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gh-stack
|
|
3
|
-
description: >
|
|
4
|
-
Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack.
|
|
5
|
-
Use for stack creation, viewing, edits, push, submit, sync, rebase, merge, or checkout;
|
|
6
|
-
when asked to split or isolate work for review; whenever a user mentions a stack,
|
|
7
|
-
branch layers, dependent PRs, or gh stack; or when a stack is checked out.
|
|
8
|
-
metadata:
|
|
9
|
-
author: github
|
|
10
|
-
version: '0.1.0'
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# gh-stack
|
|
14
|
-
|
|
15
|
-
`gh stack` is a [GitHub CLI](https://cli.github.com/) extension for stacked branches and pull
|
|
16
|
-
requests. A stack is an ordered chain of branches rooted on a trunk, where each branch has one PR
|
|
17
|
-
based on the branch below it, so a reviewer sees only that layer's diff.
|
|
18
|
-
|
|
19
|
-
`gh stack` prints a stack trunk-first, left to right:
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
(main) <- auth <- api <- frontend
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Left is the **bottom**, right is the **top**. `auth` is based on `main` and merges first;
|
|
26
|
-
`frontend` merges last. `up` moves toward the top, away from trunk; `down` moves toward it.
|
|
27
|
-
Foundational work belongs at the bottom, code that depends on it above. For how to choose the
|
|
28
|
-
layers, read `references/stack-design.md`.
|
|
29
|
-
|
|
30
|
-
## Setup
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
gh extension install github/gh-stack
|
|
34
|
-
git config rerere.enabled true # remember conflict resolutions
|
|
35
|
-
git config remote.pushDefault origin # required if the repo has more than one remote
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Non-interactive use
|
|
39
|
-
|
|
40
|
-
`gh stack` branches on whether **stdout is a TTY**. Piped, most commands error cleanly or print
|
|
41
|
-
static text; under a PTY the same commands open a prompt or a full-screen TUI and block forever.
|
|
42
|
-
Agent harnesses differ, so always pass the flags below instead of relying on that detection.
|
|
43
|
-
|
|
44
|
-
**Multiple remotes:** never run `push`, `submit`, `sync`, `rebase`, or `link` without
|
|
45
|
-
`--remote <name>` unless `remote.pushDefault` is configured. `checkout` and `trunk` have no
|
|
46
|
-
`--remote` flag and require the config.
|
|
47
|
-
|
|
48
|
-
| Always run | Never run bare | Why |
|
|
49
|
-
| ----------------------------------------- | ------------------- | --------------------------------------------- |
|
|
50
|
-
| `gh stack view --json` | `gh stack view` | opens a TUI under a PTY |
|
|
51
|
-
| `gh stack submit --auto` | `gh stack submit` | prompts for a title per new PR |
|
|
52
|
-
| `gh stack merge <target> --yes` | `gh pr merge` | `gh pr merge` cannot merge a stack |
|
|
53
|
-
| `gh stack init <branch>...` | `gh stack init` | prompts for branch names |
|
|
54
|
-
| `gh stack add <branch>` | `gh stack add` | prompts for a name, and fails even when piped |
|
|
55
|
-
| `gh stack checkout <target>` | `gh stack checkout` | opens a selection menu |
|
|
56
|
-
| `gh stack up` / `down` / `top` / `bottom` | `gh stack switch` | `switch` is menu-only |
|
|
57
|
-
| — | `gh stack modify` | TUI-only, no non-interactive path |
|
|
58
|
-
|
|
59
|
-
- `view --short` is safe in both modes, but it is formatted for humans. Use `--json` to parse.
|
|
60
|
-
- **`checkout <pr>` when a different local stack already covers those branches** cannot be forced.
|
|
61
|
-
Run `gh stack unstack --local` first (this keeps the stack on GitHub), then retry.
|
|
62
|
-
|
|
63
|
-
## Branch placement
|
|
64
|
-
|
|
65
|
-
- **Starting multi-part work:** create the stack before writing files. Do not implement every
|
|
66
|
-
concern on trunk and split it later. Put one dependent concern in each layer, bottom to top.
|
|
67
|
-
- **Editing an existing stack:** check out the layer that owns the change before editing. Never
|
|
68
|
-
commit a lower layer's concern on the current top branch. Run `gh stack view --json`; if
|
|
69
|
-
ownership is unclear, inspect `git log --all -- <path>`. Then check out the owner, edit, commit,
|
|
70
|
-
rebase upstack, and return to top.
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
gh stack down # or: gh stack checkout api
|
|
74
|
-
git add ... && git commit -m "Add get-user endpoint"
|
|
75
|
-
gh stack rebase --upstack # replay every branch above onto the change
|
|
76
|
-
gh stack top # return to where you were
|
|
77
|
-
gh stack push
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Core loop
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
gh stack init auth # create the stack and check out its branch
|
|
84
|
-
git add ... && git commit -m "Add auth middleware"
|
|
85
|
-
gh stack add api # next layer, branched from the current one
|
|
86
|
-
git add ... && git commit -m "Add API routes"
|
|
87
|
-
gh stack submit --auto # push every branch and open draft PRs
|
|
88
|
-
gh stack view --json # confirm
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Add `--open` to `submit` to create PRs ready for review instead of drafts. Branch names are
|
|
92
|
-
verbatim — `gh stack add refactor/foo` creates `refactor/foo`.
|
|
93
|
-
|
|
94
|
-
## Staying in sync
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
gh stack sync # fetch, reconcile with GitHub, rebase, push, refresh PR state
|
|
98
|
-
gh stack sync --prune # also delete local branches for merged PRs
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Pruning never happens without `--prune` when non-interactive. If the local and remote stacks have
|
|
102
|
-
diverged, `sync` prints both chains, makes no changes, and exits 0 with `Sync aborted` — see
|
|
103
|
-
`references/troubleshooting.md`.
|
|
104
|
-
|
|
105
|
-
## Merging
|
|
106
|
-
|
|
107
|
-
Scope the merge with an argument:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
gh stack merge 42 --yes # PR #42 plus every unmerged PR below it
|
|
111
|
-
gh stack merge 7 --yes # every unmerged PR in stack #7
|
|
112
|
-
gh stack merge 42 --yes --squash # or --merge, --rebase, --merge-method <method>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Pass a PR number to merge that PR and every unmerged PR below it, or a stack number to merge every
|
|
116
|
-
unmerged PR in that stack. The operation is all-or-nothing: if any PR in that set cannot merge,
|
|
117
|
-
none do.
|
|
118
|
-
|
|
119
|
-
Without a method flag the last-used method is reused. If the base branch uses a merge queue, the
|
|
120
|
-
stack is queued instead and the queue picks the method, ignoring any flag you passed with a
|
|
121
|
-
warning; queued PRs may land in separate groups.
|
|
122
|
-
|
|
123
|
-
## Reading state
|
|
124
|
-
|
|
125
|
-
`gh stack view --json` writes JSON to **stdout**. Status messages go to **stderr** — do not parse
|
|
126
|
-
them, branch on exit codes instead.
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
trunk string
|
|
130
|
-
currentBranch string
|
|
131
|
-
branches[] name, head, base, isCurrent, isMerged, isQueued, needsRebase
|
|
132
|
-
branches[].pr number, url, state ("OPEN" | "MERGED" | "QUEUED"); absent when no PR exists
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
`base` is the saved SHA of the parent branch that this branch was last known to contain. It may be
|
|
136
|
-
older than the parent's current tip. `needsRebase` is true when the current parent tip is no longer
|
|
137
|
-
an ancestor of the branch.
|
|
138
|
-
|
|
139
|
-
## Exit codes
|
|
140
|
-
|
|
141
|
-
| Code | Meaning | Recovery |
|
|
142
|
-
| ---- | -------------------------- | ---------------------------------------------------------- |
|
|
143
|
-
| 0 | Success | — |
|
|
144
|
-
| 1 | Generic error | Read stderr |
|
|
145
|
-
| 2 | Not in a stack | `gh stack init`, or `gh stack checkout <target>` |
|
|
146
|
-
| 3 | Rebase conflict | Follow the Exit 3 recovery below |
|
|
147
|
-
| 4 | GitHub API failure | Check `gh auth status`, retry |
|
|
148
|
-
| 5 | Invalid arguments | Fix the invocation; see `<command> --help` |
|
|
149
|
-
| 6 | Disambiguation required | Branch is in several stacks; check out a non-shared branch |
|
|
150
|
-
| 7 | Rebase already in progress | `gh stack rebase --continue` or `--abort` |
|
|
151
|
-
| 8 | Stack file locked | Another `gh stack` process is writing; retry after ~5s |
|
|
152
|
-
| 9 | Stacked PRs unavailable | Not enabled on the repository; tell the user |
|
|
153
|
-
| 10 | Modify recovery required | `gh stack modify --abort` |
|
|
154
|
-
|
|
155
|
-
**Exit 3 recovery:**
|
|
156
|
-
|
|
157
|
-
- After `gh stack rebase`: resolve the files, run `git add`, then
|
|
158
|
-
`gh stack rebase --continue`; use `gh stack rebase --abort` to restore the stack.
|
|
159
|
-
- After `gh stack sync`: the stack has already been restored. Run `gh stack rebase` to recreate the
|
|
160
|
-
conflict, then resolve and continue as above.
|
|
161
|
-
|
|
162
|
-
## Constraints
|
|
163
|
-
|
|
164
|
-
- Stacks are strictly linear: one parent, at most one child. Use separate stacks for parallel work.
|
|
165
|
-
- There is no non-interactive reorder or removal. Errors may suggest `gh stack modify`, but it is
|
|
166
|
-
TUI-only — restructure with `unstack` then `init` instead.
|
|
167
|
-
- PR titles and bodies are auto-generated. Use `gh pr edit` afterwards to change them.
|
|
168
|
-
|
|
169
|
-
## More detail
|
|
170
|
-
|
|
171
|
-
`gh stack <command> --help` is authoritative for flags and arguments. Note that
|
|
172
|
-
`gh stack help <command>` does **not** work — it prints the top-level help.
|
|
173
|
-
|
|
174
|
-
Open the reference whose trigger matches the task; no need to preload all three.
|
|
175
|
-
|
|
176
|
-
- `references/stack-design.md` — read before creating a stack, when deciding how many layers to
|
|
177
|
-
use, what belongs in each one, or whether work belongs in a new stack.
|
|
178
|
-
- `references/commands.md` — read when a command fails unexpectedly or you need its preconditions,
|
|
179
|
-
side effects, atomicity, or ordering guarantees.
|
|
180
|
-
- `references/troubleshooting.md` — read on a rebase conflict, after a squash-merge, on local and
|
|
181
|
-
remote divergence, when restructuring a stack, or when driving stacks from another tool.
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# Command behavior
|
|
2
|
-
|
|
3
|
-
`gh stack <command> --help` is authoritative for flags and arguments. (`gh stack help <command>` only prints the top-level help.) This file only covers behavior `--help` does not
|
|
4
|
-
explain: preconditions, side effects, atomicity, and failure modes.
|
|
5
|
-
|
|
6
|
-
## Contents
|
|
7
|
-
|
|
8
|
-
- [init](#init)
|
|
9
|
-
- [add](#add)
|
|
10
|
-
- [push](#push)
|
|
11
|
-
- [submit](#submit)
|
|
12
|
-
- [link](#link)
|
|
13
|
-
- [sync](#sync)
|
|
14
|
-
- [rebase](#rebase)
|
|
15
|
-
- [view](#view)
|
|
16
|
-
- [checkout](#checkout)
|
|
17
|
-
- [unstack](#unstack)
|
|
18
|
-
- [merge](#merge)
|
|
19
|
-
- [Navigation](#navigation)
|
|
20
|
-
|
|
21
|
-
## init
|
|
22
|
-
|
|
23
|
-
Creates the stack and checks out the **last** branch in the list, so a single `init` can lay down
|
|
24
|
-
the whole chain: `gh stack init auth api frontend`.
|
|
25
|
-
|
|
26
|
-
`init` processes branch arguments from bottom to top. Existing branches are adopted. If the first
|
|
27
|
-
branch does not exist, it is created from the trunk; each later new branch is created from the
|
|
28
|
-
branch immediately before it. There is no separate adopt mode — existence decides. `--base`
|
|
29
|
-
selects a non-default trunk.
|
|
30
|
-
|
|
31
|
-
`init` also enables `git rerere`. Under a TTY the first run in a repo asks for confirmation; set
|
|
32
|
-
`git config rerere.enabled true` beforehand to skip it.
|
|
33
|
-
|
|
34
|
-
## add
|
|
35
|
-
|
|
36
|
-
- **Must run from the top branch** of the stack (or the trunk when the stack is still empty).
|
|
37
|
-
Anywhere else it exits **5** with `can only add branches on top of the stack`. Run `gh stack top`
|
|
38
|
-
first.
|
|
39
|
-
- **Uncommitted changes carry over.** Without `-Am`, `add` does not touch the working tree, so
|
|
40
|
-
staged and unstaged changes follow you onto the new branch. Commit or stash first for a clean start.
|
|
41
|
-
- **`add -Am` commits in place when the current branch has no commits yet** — for example
|
|
42
|
-
immediately after `init` — instead of creating a branch. This is deliberate: the first layer
|
|
43
|
-
usually needs its content before a second layer exists.
|
|
44
|
-
- `-A` and `-u` are mutually exclusive, and both require `-m`.
|
|
45
|
-
|
|
46
|
-
## push
|
|
47
|
-
|
|
48
|
-
Pushes every active (non-merged, non-queued) branch in one multi-ref push with per-branch
|
|
49
|
-
`--force-with-lease`.
|
|
50
|
-
|
|
51
|
-
**Not atomic.** Some branches may update while another is rejected. A rejection means that branch
|
|
52
|
-
moved on the remote; fix that branch and rerun — rerunning is safe and skips what already landed.
|
|
53
|
-
|
|
54
|
-
`push` never creates or updates pull requests. Use `submit` for that.
|
|
55
|
-
|
|
56
|
-
## submit
|
|
57
|
-
|
|
58
|
-
Pushes each active branch, then creates a PR for every branch that lacks one, basing it on the
|
|
59
|
-
first non-merged ancestor, then links them into a Stack on GitHub.
|
|
60
|
-
|
|
61
|
-
- **Not atomic.** Branches are pushed sequentially with per-branch `--force-with-lease`. If a later
|
|
62
|
-
push is rejected, earlier pushes and PR updates stand. Fix the rejection and rerun the same command.
|
|
63
|
-
- **A fully merged stack cannot be extended.** When every PR in the current stack is already merged,
|
|
64
|
-
`submit` forks the remaining unmerged branches into a **new** stack rooted at the trunk and creates
|
|
65
|
-
it on GitHub, leaving the merged stack untouched.
|
|
66
|
-
- **Title generation with `--auto`:** a branch with a single commit uses that commit's subject as
|
|
67
|
-
the title and its body as the PR body. A branch with multiple commits humanizes the branch name
|
|
68
|
-
(hyphens and underscores become spaces). There is no flag for a custom title or body; use
|
|
69
|
-
`gh pr edit` afterwards.
|
|
70
|
-
- `--open` marks new _and existing_ PRs ready for review; without it new PRs are drafts.
|
|
71
|
-
- Requires stacked PRs to be enabled on the repository. If not, `submit` exits **9** when
|
|
72
|
-
non-interactive (under a TTY it offers to create ordinary unstacked PRs instead).
|
|
73
|
-
|
|
74
|
-
## link
|
|
75
|
-
|
|
76
|
-
Creates or updates a stack on GitHub **without any local tracking state**. This is the path for
|
|
77
|
-
branches managed by another tool or living in another worktree — see `troubleshooting.md`.
|
|
78
|
-
|
|
79
|
-
- Arguments are given bottom to top. Each is a branch name or a PR number; a numeric argument is
|
|
80
|
-
tried as a PR number first and falls back to a branch name.
|
|
81
|
-
- **A numeric first argument is treated as a stack number only when a stack with that number
|
|
82
|
-
exists.** In that case the remaining arguments are appended to the top of that stack and you do
|
|
83
|
-
not re-list its current PRs: `gh stack link 7 feature-c`. Arguments already in the stack are
|
|
84
|
-
skipped; arguments belonging to a different stack are rejected.
|
|
85
|
-
- Branch arguments are pushed automatically (non-force, atomic). Missing PRs are created with
|
|
86
|
-
auto-generated titles and correctly chained bases; existing PRs with a wrong base are corrected.
|
|
87
|
-
- Stack membership is **additive only** — `link` never removes a PR from a stack.
|
|
88
|
-
|
|
89
|
-
## sync
|
|
90
|
-
|
|
91
|
-
The routine command. Steps, in order:
|
|
92
|
-
|
|
93
|
-
1. **Fetch** from the remote.
|
|
94
|
-
2. **Reconcile with the GitHub stack.** PRs added to the stack on github.com are pulled down and
|
|
95
|
-
appended locally. On divergence, aborts when non-interactive (see `troubleshooting.md`).
|
|
96
|
-
3. **Fast-forward the trunk.** Skipped when already current; warns when diverged.
|
|
97
|
-
4. **Cascade rebase when needed.** This runs if the trunk moved, a stack branch was fast-forwarded
|
|
98
|
-
from its remote, or a branch no longer contains its expected parent. Merged PRs are handled
|
|
99
|
-
automatically. On conflict, **all branches are restored** to their pre-rebase state and the
|
|
100
|
-
command exits **3**.
|
|
101
|
-
5. **Push** all active branches, atomically.
|
|
102
|
-
6. **Refresh PR state** from GitHub.
|
|
103
|
-
7. **Sync the stack object** — link open PRs into a stack, additively. Only when two or more PRs
|
|
104
|
-
exist. `sync` never opens PRs; that is `submit`.
|
|
105
|
-
8. **Prune** local branches for merged PRs, only when `--prune` is passed in a non-interactive
|
|
106
|
-
environment.
|
|
107
|
-
|
|
108
|
-
## rebase
|
|
109
|
-
|
|
110
|
-
Pulls from the remote and cascade-rebases. Use it when `sync` reported a conflict or when you need
|
|
111
|
-
to rebase only part of the stack.
|
|
112
|
-
|
|
113
|
-
- `--upstack` rebases from the current branch to the top. This is what you run after editing a
|
|
114
|
-
lower layer.
|
|
115
|
-
- `--downstack` rebases from the trunk to the current branch.
|
|
116
|
-
- `--no-trunk` skips fetching and the trunk rebase entirely, aligning stack branches with each
|
|
117
|
-
other only.
|
|
118
|
-
- `--continue` after staging resolutions; `--abort` restores every branch.
|
|
119
|
-
- A merged PR is detected automatically and replayed with `--onto` against the correct target, so a
|
|
120
|
-
squash-merged parent does not produce spurious conflicts.
|
|
121
|
-
- Starting a rebase while one is in progress exits **7**.
|
|
122
|
-
|
|
123
|
-
## view
|
|
124
|
-
|
|
125
|
-
- `--json` writes the machine-readable payload to stdout. Its schema is in `SKILL.md`.
|
|
126
|
-
- Bare `view` opens a full-screen TUI when stdout is a TTY, and prints static text when piped.
|
|
127
|
-
- `--short` prints a compact one-line-per-branch summary and never opens the TUI, but it is
|
|
128
|
-
formatted for humans; parse `--json` instead.
|
|
129
|
-
- `view` refreshes PR state from GitHub as a side effect, best-effort — it does not fail when the
|
|
130
|
-
API is unreachable.
|
|
131
|
-
|
|
132
|
-
## checkout
|
|
133
|
-
|
|
134
|
-
Accepts a stack number, PR number, PR URL, or branch name.
|
|
135
|
-
|
|
136
|
-
- A bare number resolves as a **stack number first**, then a PR number, then a branch name.
|
|
137
|
-
- Stack numbers, PR numbers, and PR URLs fetch from GitHub, pull the branches down, and set the
|
|
138
|
-
stack up locally.
|
|
139
|
-
- If a local stack already exists over those branches with a different composition, `checkout`
|
|
140
|
-
cannot be forced past it. Run `gh stack unstack --local` first, then retry.
|
|
141
|
-
- `checkout` has no flags. It relies on `remote.pushDefault` when several remotes exist.
|
|
142
|
-
|
|
143
|
-
## unstack
|
|
144
|
-
|
|
145
|
-
Removes the stack **grouping** only. It never deletes pull requests or branches.
|
|
146
|
-
|
|
147
|
-
- With no argument it targets the active stack — the one containing the current branch — removing
|
|
148
|
-
it on GitHub and locally.
|
|
149
|
-
- With a stack number it works from anywhere in the repository, tracked locally or not, via the API.
|
|
150
|
-
Local tracking is also removed when present.
|
|
151
|
-
- `--local` removes local tracking only and never contacts GitHub. Combining `--local` with a stack
|
|
152
|
-
number that is not tracked locally is an error.
|
|
153
|
-
- An unknown stack number exits **2**.
|
|
154
|
-
|
|
155
|
-
## merge
|
|
156
|
-
|
|
157
|
-
- Scope with an argument: pass a PR number to merge that PR and every unmerged PR below it in the
|
|
158
|
-
stack, or pass a stack number to merge every unmerged PR in that stack.
|
|
159
|
-
- **All-or-nothing.** If any PR in that exact merge set cannot be merged, none are, and the reason
|
|
160
|
-
is reported.
|
|
161
|
-
- The method comes from `--squash`, `--rebase`, `--merge`, or `--merge-method <method>`. Without
|
|
162
|
-
one, the last-used method is reused.
|
|
163
|
-
- Only basic PR state is checked before merging: open and not a draft. Bypassing merge requirements
|
|
164
|
-
is not supported for stacks.
|
|
165
|
-
- **A merge queue on the base branch overrides everything.** The stack is added to the queue rather
|
|
166
|
-
than merged; the queue chooses the method and any method flag you passed is ignored with a
|
|
167
|
-
warning. Queued PRs are submitted together but land as the queue processes them, so they may merge
|
|
168
|
-
in separate groups rather than all at once.
|
|
169
|
-
- `gh pr merge` cannot merge a stack. Always use `gh stack merge`.
|
|
170
|
-
|
|
171
|
-
## Navigation
|
|
172
|
-
|
|
173
|
-
`up`, `down`, `top`, `bottom`, and `trunk` are always non-interactive. `up` and `down` accept a
|
|
174
|
-
count (`gh stack up 3`). Movement clamps at the stack bounds, and merged branches are skipped when
|
|
175
|
-
navigating from an active branch, so `bottom` lands on the lowest _unmerged_ branch.
|
|
176
|
-
|
|
177
|
-
`gh stack switch` is a selection menu with no non-interactive path. Use the commands above instead.
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Designing a stack
|
|
2
|
-
|
|
3
|
-
How to decide what goes in each layer. Read this before running `gh stack init`.
|
|
4
|
-
|
|
5
|
-
## Contents
|
|
6
|
-
|
|
7
|
-
- [Plan the layers before writing code](#plan-the-layers-before-writing-code)
|
|
8
|
-
- [Branch naming](#branch-naming)
|
|
9
|
-
- [Staging changes deliberately](#staging-changes-deliberately)
|
|
10
|
-
- [When to add a layer](#when-to-add-a-layer)
|
|
11
|
-
- [One stack, one story](#one-stack-one-story)
|
|
12
|
-
|
|
13
|
-
## Plan the layers before writing code
|
|
14
|
-
|
|
15
|
-
A stack is a dependency chain. If code in one layer depends on code in another, the dependency must
|
|
16
|
-
live in the same branch or a lower one. That constraint is much cheaper to satisfy by planning than
|
|
17
|
-
by restructuring later, because there is no non-interactive in-place reorder — fixing the order
|
|
18
|
-
means`unstack` and `init` again.
|
|
19
|
-
|
|
20
|
-
Decide the layers first, then write code into them:
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
(main) <- todo-app/models <- todo-app/api <- todo-app/frontend <- todo-app/integration
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
- `todo-app/models` — shared types and schema
|
|
27
|
-
- `todo-app/api` — routes that use the models
|
|
28
|
-
- `todo-app/frontend` — components that call the routes
|
|
29
|
-
- `todo-app/integration` — tests exercising the whole feature
|
|
30
|
-
|
|
31
|
-
This is illustrative. Infer the stack topic and layer names from the actual task; do not reuse
|
|
32
|
-
`todo-app` or these layer names literally.
|
|
33
|
-
|
|
34
|
-
The failure mode to avoid is writing everything on one branch and trying to split it afterwards.
|
|
35
|
-
If a task is large enough to warrant a stack, create the stack at the start.
|
|
36
|
-
|
|
37
|
-
## Branch naming
|
|
38
|
-
|
|
39
|
-
Prefer a shared topic prefix plus the layer's concern:
|
|
40
|
-
`<topic>/<concern>` — for example, `billing/schema`, `billing/api`, `billing/ui`.
|
|
41
|
-
This keeps related branches recognizable without using generic names that could belong to any
|
|
42
|
-
stack. **User and repository branch naming conventions take precedence; follow them instead.**
|
|
43
|
-
|
|
44
|
-
Names are used exactly as given — nothing is prepended or transformed, and slashes are kept, so
|
|
45
|
-
`gh stack add refactor/foo` creates a branch literally named `refactor/foo`.
|
|
46
|
-
|
|
47
|
-
If you pass `-m` without a branch name, the name is generated from the commit message in
|
|
48
|
-
date-and-slug form (for example `03-24-add_api_routes`). Prefer naming the branch yourself.
|
|
49
|
-
|
|
50
|
-
## Staging changes deliberately
|
|
51
|
-
|
|
52
|
-
Use `git add` and `git commit` directly rather than the `add -Am` shortcut. The point is control
|
|
53
|
-
over which changes land in which branch. With several modified files in the working tree, stage the
|
|
54
|
-
subset that belongs to the current layer, commit it, then create the next branch and stage the rest
|
|
55
|
-
there:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
git add internal/models/user.go internal/models/session.go
|
|
59
|
-
git commit -m "Add user and session models"
|
|
60
|
-
|
|
61
|
-
gh stack add api-routes
|
|
62
|
-
git add internal/api/routes.go internal/api/handlers.go
|
|
63
|
-
git commit -m "Add user API routes"
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Multiple commits per branch are fine. What matters is that every commit in a branch serves the same
|
|
67
|
-
concern, and that a change belonging to a different concern goes in a different branch.
|
|
68
|
-
|
|
69
|
-
Note that `gh stack add <branch>` without `-Am` does not touch the working tree, so uncommitted
|
|
70
|
-
changes carry over to the new branch. Commit or stash first if you want the new layer to start clean.
|
|
71
|
-
|
|
72
|
-
## When to add a layer
|
|
73
|
-
|
|
74
|
-
Add a branch when you start a **different concern that depends on what you have built so far**.
|
|
75
|
-
Signals:
|
|
76
|
-
|
|
77
|
-
- Moving from backend to frontend, or from core logic to tests or documentation
|
|
78
|
-
- The next changes have a different reviewer audience
|
|
79
|
-
- The current branch's diff is already large enough to review on its own
|
|
80
|
-
|
|
81
|
-
A layer that cannot be described in one sentence is usually two layers.
|
|
82
|
-
|
|
83
|
-
## One stack, one story
|
|
84
|
-
|
|
85
|
-
A stack should read as a coherent progression: a reviewer walks the PRs bottom to top and sees the
|
|
86
|
-
feature being built.
|
|
87
|
-
|
|
88
|
-
**Use a single stack** when every branch serves the same feature or project, even if the layers span
|
|
89
|
-
different concerns.
|
|
90
|
-
|
|
91
|
-
**Start a separate stack** for unrelated work — a different feature, an unrelated bug fix, an
|
|
92
|
-
independent refactor. Do not mix efforts into one stack just because you happened to work on both.
|
|
93
|
-
Use `gh stack init` for the new effort, or `gh stack checkout <target>` to move between existing
|
|
94
|
-
stacks.
|
|
95
|
-
|
|
96
|
-
A trivial incidental fix can ride along in the current stack. Once it grows into its own project, it
|
|
97
|
-
deserves its own stack.
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
# Troubleshooting and recovery
|
|
2
|
-
|
|
3
|
-
## Contents
|
|
4
|
-
|
|
5
|
-
- [Rebase conflicts (exit 3)](#rebase-conflicts-exit-3)
|
|
6
|
-
- [After a squash merge](#after-a-squash-merge)
|
|
7
|
-
- [Local and remote stacks have diverged](#local-and-remote-stacks-have-diverged)
|
|
8
|
-
- [Restructuring a stack](#restructuring-a-stack)
|
|
9
|
-
- [Branch belongs to several stacks (exit 6)](#branch-belongs-to-several-stacks-exit-6)
|
|
10
|
-
- [Driving stacks from another tool or worktree](#driving-stacks-from-another-tool-or-worktree)
|
|
11
|
-
- [Stack file is locked (exit 8)](#stack-file-is-locked-exit-8)
|
|
12
|
-
- [An interrupted modify session (exit 10)](#an-interrupted-modify-session-exit-10)
|
|
13
|
-
|
|
14
|
-
## Rebase conflicts (exit 3)
|
|
15
|
-
|
|
16
|
-
`rebase` and `sync` both exit 3 on conflict. `sync` restores every branch to its pre-rebase state
|
|
17
|
-
first, so a failed `sync` leaves nothing half-applied; a failed `rebase` stops mid-flight and waits.
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
gh stack rebase
|
|
21
|
-
# exit 3 — conflicted paths are listed on stderr
|
|
22
|
-
git add <resolved paths>
|
|
23
|
-
gh stack rebase --continue # repeat if the next branch also conflicts
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
`gh stack rebase --abort` restores every branch in the stack, not just the current one.
|
|
27
|
-
|
|
28
|
-
Because `init` enables `git rerere`, a conflict you resolve once is replayed automatically the next
|
|
29
|
-
time the same conflict appears — which is common, since a change low in the stack is rebased through
|
|
30
|
-
every branch above it. Without `rerere`, repeated conflicts may need manual resolution on each
|
|
31
|
-
affected layer.
|
|
32
|
-
|
|
33
|
-
## After a squash merge
|
|
34
|
-
|
|
35
|
-
A squash merge replaces the branch's commits with one new commit, so the originals no longer exist
|
|
36
|
-
in the trunk's history and an ordinary rebase would try to replay them again.
|
|
37
|
-
|
|
38
|
-
`gh stack sync` detects this and rebases with `--onto` against the correct target, skipping the
|
|
39
|
-
merged branch:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
gh stack sync
|
|
43
|
-
gh stack view --json # merged branch reports "isMerged": true, "state": "MERGED"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
No manual action is needed. If the replay conflicts, `sync` restores all branches and exits 3.
|
|
47
|
-
Run `gh stack rebase` to rerun the rebase, which will stop at the conflict and allow you to resolve
|
|
48
|
-
and then `--continue` until complete. Use `gh stack sync --prune` to also delete local branches for
|
|
49
|
-
merged PRs.
|
|
50
|
-
|
|
51
|
-
## Local and remote stacks have diverged
|
|
52
|
-
|
|
53
|
-
Divergence means the local stack and the stack on GitHub changed in different ways — for example
|
|
54
|
-
branches were added locally while a PR was added to the stack on github.com.
|
|
55
|
-
|
|
56
|
-
When non-interactive, `sync` prints both chains, changes nothing, and exits **0** with
|
|
57
|
-
`Sync aborted`. Success here does not mean the sync happened; check for that message, or re-run
|
|
58
|
-
`gh stack view --json` and compare.
|
|
59
|
-
|
|
60
|
-
Two resolution paths:
|
|
61
|
-
|
|
62
|
-
- **Keep the remote version.** Drop local tracking and pull the stack back down.
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
gh stack unstack --local # keeps the stack on GitHub
|
|
66
|
-
gh stack checkout <stack-number> # or a PR number
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
- **Keep the local version.** Remove the grouping on GitHub, then recreate it from local state.
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
gh stack unstack # removes the grouping; PRs and branches survive
|
|
73
|
-
gh stack submit --auto
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Neither path deletes pull requests or branches.
|
|
77
|
-
Remote unstacking leaves PRs that are merging (auto-merge enabled) or are queued (in a merge queue)
|
|
78
|
-
stacked. If needed, clear that state before retrying.
|
|
79
|
-
|
|
80
|
-
## Restructuring a stack
|
|
81
|
-
|
|
82
|
-
There is no non-interactive reorder, rename, or removal. `add` run from the wrong branch suggests
|
|
83
|
-
`gh stack modify`, but that is TUI-only. Tear the stack down and rebuild it instead:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
gh stack unstack # removes local tracking and the GitHub grouping
|
|
87
|
-
# Rename or drop branches, and rewrite ancestry as needed.
|
|
88
|
-
gh stack init --base main branch-1 branch-2 branch-3
|
|
89
|
-
gh stack submit --auto # re-link on GitHub
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
`init` adopts branches that already exist, so the rebuild reuses them rather than creating new ones.
|
|
93
|
-
Existing PRs survive. Once Git ancestry is correct, `submit` updates their base branches and
|
|
94
|
-
re-links the stack on GitHub.
|
|
95
|
-
|
|
96
|
-
Changing metadata does **not** change Git ancestry. Reorder commits first, then rebuild the stack.
|
|
97
|
-
For example, to change `main <- models <- migration <- ui` into
|
|
98
|
-
`main <- migration <- models <- ui`:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
old_models=$(git rev-parse models)
|
|
102
|
-
old_migration=$(git rev-parse migration)
|
|
103
|
-
git rebase --onto main "$old_models" migration
|
|
104
|
-
git rebase --onto migration main models
|
|
105
|
-
git rebase --onto models "$old_migration" ui
|
|
106
|
-
gh stack unstack
|
|
107
|
-
gh stack init --base main migration models ui
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The first rebase moves migration-only commits onto trunk, the second replays model commits above
|
|
111
|
-
them, and the third replays UI-only commits above models. Preserve the old boundary SHAs before
|
|
112
|
-
moving any branch. For a different reorder, identify each layer's range with
|
|
113
|
-
`git log <old-parent>..<branch>`, then replay the ranges bottom to top.
|
|
114
|
-
|
|
115
|
-
## Branch belongs to several stacks (exit 6)
|
|
116
|
-
|
|
117
|
-
Commands exit 6 when the current branch cannot identify a single stack — typically because it is the
|
|
118
|
-
trunk of more than one stack. There is no flag to disambiguate.
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
gh stack checkout <a-branch-unique-to-the-intended-stack>
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Then rerun. Commands that take an explicit stack number (`merge 7`, `unstack 7`) sidestep the
|
|
125
|
-
problem entirely, since they do not infer the stack from the current branch.
|
|
126
|
-
|
|
127
|
-
## Driving stacks from another tool or worktree
|
|
128
|
-
|
|
129
|
-
`gh stack link` creates and updates stacks purely through the API, with no local tracking state.
|
|
130
|
-
Use it when branches are managed by jj, Sapling, git-town, a separate worktree, or any workflow
|
|
131
|
-
where the local `.git/gh-stack` file would be wrong or absent.
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
gh stack link branch-a branch-b branch-c # bottom to top
|
|
135
|
-
gh stack link --base develop --open a b c # non-default trunk, ready for review
|
|
136
|
-
gh stack link 10 20 30 # by PR number
|
|
137
|
-
gh stack link 7 feature-d # append to existing stack #7
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Because `link` writes no local state, the local navigation commands (`up`, `down`, `top`, `bottom`)
|
|
141
|
-
will not work on the result. Use `gh stack checkout <stack-number>` if you later want local tracking.
|
|
142
|
-
|
|
143
|
-
## Stack file is locked (exit 8)
|
|
144
|
-
|
|
145
|
-
Another `gh stack` process holds the exclusive lock on `.git/gh-stack.lock`. The lock times out
|
|
146
|
-
after about five seconds, so wait and retry. A persistent exit 8 means another process still holds
|
|
147
|
-
the lock; identify and stop that process before retrying.
|
|
148
|
-
|
|
149
|
-
## An interrupted modify session (exit 10)
|
|
150
|
-
|
|
151
|
-
`gh stack modify` is TUI-only and should never be invoked by an agent. If a repository is left in
|
|
152
|
-
this state by someone else, restore it:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
gh stack modify --abort
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Related: `submit` also detects a pending modify state, and under a TTY asks before overwriting the
|
|
159
|
-
stack on GitHub with local state.
|