Help us shape the future of Go! Take the 2026 Go Developer Survey

scope

package
v0.30.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package scope implements the stackit scope command for managing branch scopes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx context.Context, deps Deps, opts Options, handler Handler) error

Action implements the stackit scope command

Types

type Deps added in v0.30.1

type Deps struct {
	Engine Engine
	Out    output.Output
}

Deps are the collaborators scope needs. Adapters build them from their own runtime state; the action never sees bootstrap types.

type Engine added in v0.30.1

type Engine interface {
	actions.MetadataPushEngine
	engine.BranchLookup
	CurrentBranch(ctx context.Context) *engine.Branch
	Trunk() engine.Branch
	GetScope(branch engine.Branch) engine.Scope
	SetScopeAndMarkForUpdate(ctx context.Context, branch engine.Branch, scope engine.Scope) error
	RenameBranch(ctx context.Context, oldBranch, newBranch engine.Branch) error
}

Engine lists exactly the engine methods scope calls.

type Handler

type Handler interface {
	// PromptConfirmRename prompts user to confirm branch rename after scope change
	// Returns true to proceed with rename, false to skip
	PromptConfirmRename(branchName, oldScope, newScope string) (bool, error)

	// Cleanup restores terminal state (may be no-op)
	Cleanup()

	// IsInteractive returns true if the handler supports interactive prompts
	IsInteractive() bool
}

Handler receives events from scope action

type NullHandler

type NullHandler struct {
	handler.NullBase
}

NullHandler is a no-op handler for when nil is passed. It embeds handler.NullBase for Cleanup() and IsInteractive().

func (*NullHandler) PromptConfirmRename

func (h *NullHandler) PromptConfirmRename(string, string, string) (bool, error)

PromptConfirmRename implements Handler. Returns false (skip rename) for null handler.

type Options

type Options struct {
	Scope string
	Unset bool
	Show  bool
}

Options contains options for the scope command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL