commandbridge

package
v1.0.90 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package commandbridge owns the internal, type-erased handoff between the public command authoring contract, its host adapter, and the existing shortcut runner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct{}

Access seals the small exported handshake required by shortcuts/common. Packages outside this module cannot import an internal package, so these functions cannot become a second business-authoring surface.

type Definition

type Definition struct {
	Metadata   command.CommandMetadata
	Input      command.InputDefinition
	Output     command.OutputDefinition
	ArgsType   reflect.Type
	DataType   reflect.Type
	Hooks      Hooks
	PageOutput bool
}

Definition carries the one public declaration into the private compiler. Metadata, Input, and Output retain extension/command as their sole owner; the compiler lowers them into its private executable representation.

type Hooks

type Hooks struct {
	NewArgs   func() any
	Normalize func(context.Context, RuntimeContext, any) error
	Validate  func(context.Context, RuntimeContext, any) error
	DryRun    func(context.Context, RuntimeContext, any) (any, error)
	Execute   func(context.Context, RuntimeContext, any) (Result, error)
	Renderers map[string]func(io.Writer, any) error
}

Hooks is the type-erased hook set captured while Args and Data are known.

type Result

type Result struct {
	Data       any
	Outcome    string
	Pagination *command.HostPagination
}

Result is the erased successful result returned to the shortcut runner.

type RuntimeContext

type RuntimeContext interface {
	Identity() command.Identity
	Config() core.CliConfig
	APIClient() (*client.APIClient, error)
	FileIO() fileio.FileIO
	InputResolvedFromSource(param string) bool
	ValidatePath(path string) error
	ResolveSavePath(path string) (string, error)
	Stderr() io.Writer
	StartSpinner(label string) func()
	PresentError(err error) error
	IsDryRun() bool
	PaginationOptions() (command.PaginationOptions, error)
	RequireConditionalScopes(scopes ...string) error
}

RuntimeContext is the restricted host capability set consumed by erased hooks. It is internal implementation ABI, not an authoring contract.

Jump to

Keyboard shortcuts

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