[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75HT4R8BHKHPHJKV37E5KWW":3,"skill-same:01M75HT4R8BHKHPHJKV37E5KWW":56},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":17,"linkOnly":18,"markdownContent":19,"markdownBody":19,"frontMatter":20,"refName":21,"commitSha":22,"skillDirectory":23,"forksCount":12,"repositoryHtmlUrl":24,"repositoryHomepageUrl":6,"ownerHtmlUrl":25,"ownerBlogUrl":26,"ownerDescription":6,"updatedAt":27,"install":28,"resources":41},"01M75HT4R8BHKHPHJKV37E5KWW","gh-stack",null,"Vesynta\u002Flatex-infrastructure","Vesynta","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F73799126?v=4","01M75HSX1KKNNAFRZJAFP5MRE2","01M75HSX2MP1KGMGZ3VGAJDG29",0,"MIT","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fgh-stack\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"______________________________________________________________________\n\n## name: gh-stack description: > Manages stacked PRs and splits multi-part work into reviewable branches with gh-stack. Use for stack creation, viewing, edits, push, submit, sync, rebase, merge, or checkout; when asked to split or isolate work for review; whenever a user mentions a stack, branch layers, dependent PRs, or gh stack; or when a stack is checked out. metadata: author: github version: \"0.1.0\"\n\n# gh-stack\n\n`gh stack` is a [GitHub CLI](https:\u002F\u002Fcli.github.com\u002F) extension for stacked branches and pull\nrequests. A stack is an ordered chain of branches rooted on a trunk, where each branch has one PR\nbased on the branch below it, so a reviewer sees only that layer's diff.\n\n`gh stack` prints a stack trunk-first, left to right:\n\n```text\n(main) \u003C- auth \u003C- api \u003C- frontend\n```\n\nLeft is the **bottom**, right is the **top**. `auth` is based on `main` and merges first;\n`frontend` merges last. `up` moves toward the top, away from trunk; `down` moves toward it.\nFoundational work belongs at the bottom, code that depends on it above. For how to choose the\nlayers, read `references\u002Fstack-design.md`.\n\n## This repo\n\nGit HTTPS must use the persisted `gh` login (`gh auth git-credential`). Windows Git Credential\nManager helpers copied from a host gitconfig (`manager`, `wincred`) are invalid in these Linux\nimages — [`.devcontainer\u002Fsetup-git-https.sh`](..\u002F..\u002F..\u002F.devcontainer\u002Fsetup-git-https.sh) strips\nthem. Do not install GCM in the container. Do not PATH-wrap `git` to inject `-c credential.helper`\n(deadlock if the helper calls `git`). Do not set `GIT_CONFIG_NOSYSTEM` (drops `safe.directory`).\nDo not print `gh auth token` or enable `GIT_TRACE` \u002F `GIT_CURL_VERBOSE` in logs or docs.\n\nFor a repository cloned under `.agents\u002Fcontext\u002F`, its checks and any `git commit` \u002F\n`gh stack add -Am` run in **that clone’s** DevContainer image (see `nested-context-work`).\n`gh stack view --json` \u002F `gh pr edit` from this container are fine.\n\n`GIT_TERMINAL_PROMPT=0`. Always pass a stack\u002FPR\u002Fbranch to `checkout`. A successful `checkout` is\nnot proof that `git fetch` \u002F `git push` work.\n\nA long pre-push hook can run before the pack upload. An auth hang looks different: an idle\n`git-remote-https` with no hook child processes.\n\nSmoke before treating stacks as built-in (non-TTY):\n\n```bash\nGIT_TERMINAL_PROMPT=0 git ls-remote origin HEAD \u003C\u002Fdev\u002Fnull\n```\n\nStderr must not mention `credential-manager` or `wincred`. Then `gh stack view --json` (exit 2 =\nnot in a stack, OK; exit 9 = stacked PRs not enabled on the repo).\n\n## Setup\n\n```bash\ngh extension install github\u002Fgh-stack\ngit config rerere.enabled true         # remember conflict resolutions\ngit config remote.pushDefault origin   # required if the repo has more than one remote\n```\n\nThe DevContainer bakes the extension. Humans using Copilot may also run `gh skill install github\u002Fgh-stack`; this repository’s source of truth is `.agents\u002Fskills\u002Fgh-stack\u002F`.\n\n## Non-interactive use\n\n`gh stack` branches on whether **stdout is a TTY**. Piped, most commands error cleanly or print\nstatic text; under a PTY the same commands open a prompt or a full-screen TUI and block forever.\nAgent harnesses differ, so always pass the flags below instead of relying on that detection.\n\n**Multiple remotes:** never run `push`, `submit`, `sync`, `rebase`, or `link` without\n`--remote \u003Cname>` unless `remote.pushDefault` is configured. `checkout` and `trunk` have no\n`--remote` flag and require the config.\n\n| Always run                                | Never run bare      | Why                                           |\n| ----------------------------------------- | ------------------- | --------------------------------------------- |\n| `gh stack view --json`                    | `gh stack view`     | opens a TUI under a PTY                       |\n| `gh stack submit --auto`                  | `gh stack submit`   | prompts for a title per new PR                |\n| `gh stack merge \u003Ctarget> --yes`           | `gh pr merge`       | `gh pr merge` cannot merge a stack            |\n| `gh stack init \u003Cbranch>...`               | `gh stack init`     | prompts for branch names                      |\n| `gh stack add \u003Cbranch>`                   | `gh stack add`      | prompts for a name, and fails even when piped |\n| `gh stack checkout \u003Ctarget>`              | `gh stack checkout` | opens a selection menu                        |\n| `gh stack up` \u002F `down` \u002F `top` \u002F `bottom` | `gh stack switch`   | `switch` is menu-only                         |\n| —                                         | `gh stack modify`   | TUI-only, no non-interactive path             |\n\n- `view --short` is safe in both modes, but it is formatted for humans. Use `--json` to parse.\n- **`checkout \u003Cpr>` when a different local stack already covers those branches** cannot be forced.\n  Run `gh stack unstack --local` first (this keeps the stack on GitHub), then retry.\n\n## Branch placement\n\n- **Starting multi-part work:** create the stack before writing files. Do not implement every\n  concern on trunk and split it later. Put one dependent concern in each layer, bottom to top.\n- **Editing an existing stack:** check out the layer that owns the change before editing. Never\n  commit a lower layer's concern on the current top branch. Run `gh stack view --json`; if\n  ownership is unclear, inspect `git log --all -- \u003Cpath>`. Then check out the owner, edit, commit,\n  rebase upstack, and return to top.\n\n```bash\ngh stack down                   # or: gh stack checkout api\ngit add ... && git commit -m \"Add get-user endpoint\"\ngh stack rebase --upstack       # replay every branch above onto the change\ngh stack top                    # return to where you were\ngh stack push\n```\n\n## Core loop\n\n```bash\ngh stack init auth              # create the stack and check out its branch\ngit add ... && git commit -m \"Add auth middleware\"\ngh stack add api                # next layer, branched from the current one\ngit add ... && git commit -m \"Add API routes\"\ngh stack submit --auto          # push every branch and open draft PRs\ngh stack view --json            # confirm\n```\n\nAdd `--open` to `submit` to create PRs ready for review instead of drafts. Branch names are\nverbatim — `gh stack add refactor\u002Ffoo` creates `refactor\u002Ffoo`.\n\n## Staying in sync\n\n```bash\ngh stack sync                   # fetch, reconcile with GitHub, rebase, push, refresh PR state\ngh stack sync --prune           # also delete local branches for merged PRs\n```\n\nPruning never happens without `--prune` when non-interactive. If the local and remote stacks have\ndiverged, `sync` prints both chains, makes no changes, and exits 0 with `Sync aborted` — see\n`references\u002Ftroubleshooting.md`.\n\n## Merging\n\nScope the merge with an argument:\n\n```bash\ngh stack merge 42 --yes          # PR #42 plus every unmerged PR below it\ngh stack merge 7 --yes           # every unmerged PR in stack #7\ngh stack merge 42 --yes --squash # or --merge, --rebase, --merge-method \u003Cmethod>\n```\n\nPass a PR number to merge that PR and every unmerged PR below it, or a stack number to merge every\nunmerged PR in that stack. The operation is all-or-nothing: if any PR in that set cannot merge,\nnone do.\n\nWithout a method flag the last-used method is reused. If the base branch uses a merge queue, the\nstack is queued instead and the queue picks the method, ignoring any flag you passed with a\nwarning; queued PRs may land in separate groups.\n\n## Reading state\n\n`gh stack view --json` writes JSON to **stdout**. Status messages go to **stderr** — do not parse\nthem, branch on exit codes instead.\n\n```text\ntrunk           string\ncurrentBranch   string\nbranches[]      name, head, base, isCurrent, isMerged, isQueued, needsRebase\nbranches[].pr   number, url, state (\"OPEN\" | \"MERGED\" | \"QUEUED\"); absent when no PR exists\n```\n\n`base` is the saved SHA of the parent branch that this branch was last known to contain. It may be\nolder than the parent's current tip. `needsRebase` is true when the current parent tip is no longer\nan ancestor of the branch.\n\n## Exit codes\n\n| Code | Meaning                    | Recovery                                                   |\n| ---- | -------------------------- | ---------------------------------------------------------- |\n| 0    | Success                    | —                                                          |\n| 1    | Generic error              | Read stderr                                                |\n| 2    | Not in a stack             | `gh stack init`, or `gh stack checkout \u003Ctarget>`           |\n| 3    | Rebase conflict            | Follow the Exit 3 recovery below                           |\n| 4    | GitHub API failure         | Check `gh auth status`, retry                              |\n| 5    | Invalid arguments          | Fix the invocation; see `\u003Ccommand> --help`                 |\n| 6    | Disambiguation required    | Branch is in several stacks; check out a non-shared branch |\n| 7    | Rebase already in progress | `gh stack rebase --continue` or `--abort`                  |\n| 8    | Stack file locked          | Another `gh stack` process is writing; retry after ~5s     |\n| 9    | Stacked PRs unavailable    | Not enabled on the repository; tell the user               |\n| 10   | Modify recovery required   | `gh stack modify --abort`                                  |\n\n**Exit 3 recovery:**\n\n- After `gh stack rebase`: resolve the files, run `git add`, then\n  `gh stack rebase --continue`; use `gh stack rebase --abort` to restore the stack.\n- After `gh stack sync`: the stack has already been restored. Run `gh stack rebase` to recreate the\n  conflict, then resolve and continue as above.\n\n## Constraints\n\n- Stacks are strictly linear: one parent, at most one child. Use separate stacks for parallel work.\n- There is no non-interactive reorder or removal. Errors may suggest `gh stack modify`, but it is\n  TUI-only — restructure with `unstack` then `init` instead.\n- PR titles and bodies are auto-generated. Use `gh pr edit` afterwards to change them.\n\n## More detail\n\n`gh stack \u003Ccommand> --help` is authoritative for flags and arguments. Note that\n`gh stack help \u003Ccommand>` does **not** work — it prints the top-level help.\n\nOpen the reference whose trigger matches the task; no need to preload all three.\n\n- `references\u002Fstack-design.md` — read before creating a stack, when deciding how many layers to\n  use, what belongs in each one, or whether work belongs in a new stack.\n- `references\u002Fcommands.md` — read when a command fails unexpectedly or you need its preconditions,\n  side effects, atomicity, or ordering guarantees.\n- `references\u002Ftroubleshooting.md` — read on a rebase conflict, after a squash-merge, on local and\n  remote divergence, when restructuring a stack, or when driving stacks from another tool.\n",{},"dev","07d7eecfbb1c5c64b26e5c37c8ec5031a2849eb7",".agents\u002Fskills\u002Fgh-stack","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure","https:\u002F\u002Fgithub.com\u002FVesynta","www.vesynta.com","2026-11-15 03:30:51",{"source":7,"skillName":5,"commands":29,"prompt":39,"zipAvailable":40},[30,33,36],{"tool":31,"command":32},"npx","npx skills add Vesynta\u002Flatex-infrastructure --skill gh-stack",{"tool":34,"command":35},"bunx","bunx skills add Vesynta\u002Flatex-infrastructure --skill gh-stack",{"tool":37,"command":38},"pnpm","pnpm dlx skills add Vesynta\u002Flatex-infrastructure --skill gh-stack","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fgh-stack\u002FSKILL.md",true,[42,48,52],{"path":43,"resourceType":44,"resourceTypeDesc":45,"sizeBytes":46,"sourceHtmlUrl":47},"references\u002Fcommands.md","REFERENCE","参考文档",9104,"https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fgh-stack\u002Freferences\u002Fcommands.md",{"path":49,"resourceType":44,"resourceTypeDesc":45,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fstack-design.md",4213,"https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fgh-stack\u002Freferences\u002Fstack-design.md",{"path":53,"resourceType":44,"resourceTypeDesc":45,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Ftroubleshooting.md",6712,"https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fgh-stack\u002Freferences\u002Ftroubleshooting.md",[57,63,69,75,81,87],{"skillNo":58,"name":59,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":17},"01M75HTHA998WAHH35BSBP3DMB","ci-triage","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.github\u002Fskills\u002Fci-triage\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":17},"01M75HTF6HER1QBTD91Z30CHWG","tooling-workflow","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Ftooling-workflow\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":17},"01M75HTCAE4XNEX04DRKQYBJTA","plan-checkpoint","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fplan-checkpoint\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":17},"01M75HT962T9KF3F0376CC79PG","nested-context-work","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fnested-context-work\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":17},"01M75HT6RVAK3VJ8S9TN332KK0","local-checks","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Flocal-checks\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":8,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":17},"01M75HT1CN8BCHM9NTMHAEDKZH","engineering-discipline","https:\u002F\u002Fgithub.com\u002FVesynta\u002Flatex-infrastructure\u002Fblob\u002Fdev\u002F.agents\u002Fskills\u002Fengineering-discipline\u002FSKILL.md",[],[]]