Documentation
¶
Overview ¶
Package ghstack implements the stack ports on top of GitHub's gh-stack extension. Stack metadata is read directly from the extension's <git-dir>/gh-stack file (documented, schema version 1); every mutation goes through `gh stack` commands so the file is never written by us.
Index ¶
- Constants
- type Backend
- func (b *Backend) Abort(ctx context.Context, repo git.Repo) error
- func (b *Backend) AddTop(ctx context.Context, repo git.Repo, name string) error
- func (b *Backend) Continue(ctx context.Context, repo git.Repo) error
- func (b *Backend) InitStack(ctx context.Context, repo git.Repo, trunk string, branches []string) error
- func (b *Backend) Load(_ context.Context, repo git.Repo) (*stack.Graph, error)
- func (b *Backend) Preflight(ctx context.Context) error
- func (b *Backend) Restack(ctx context.Context, repo git.Repo, scope stack.Scope) error
- func (b *Backend) Submit(ctx context.Context, repo git.Repo, o stack.SubmitOptions) (stack.SubmitResult, error)
- func (b *Backend) Sync(ctx context.Context, repo git.Repo, o stack.SyncOptions) (stack.SyncResult, error)
- type Option
Constants ¶
const FileName = "gh-stack"
FileName is the gh-stack metadata file inside the git directory.
const SchemaVersion = 1
SchemaVersion is the only version this adapter understands.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements the stack ports via gh-stack.
func (*Backend) InitStack ¶
func (b *Backend) InitStack(ctx context.Context, repo git.Repo, trunk string, branches []string) error
InitStack runs `gh stack init --base <trunk> <branches...>`.
func (*Backend) Load ¶
Load implements stack.Metadata by reading <git-dir>/gh-stack. A missing file means no stacks; it never runs gh.
func (*Backend) Preflight ¶
Preflight verifies gh and the gh-stack extension are installed. The result is cached per Backend for the life of the process.
func (*Backend) Restack ¶
Restack runs the local-only form of `gh stack rebase`: no fetch and no trunk update. The bottom branch is never rebased onto trunk in this mode.
type Option ¶
type Option func(*Backend)
Option configures a Backend.
func WithOutput ¶
WithOutput relays the output of long running gh stack commands (submit, sync) to w as it is produced instead of only returning it afterwards. The CLI sets this to stderr; the MCP server never does.