Documentation
¶
Overview ¶
Package ports declares the interfaces through which use cases reach every external system, and the operational data they exchange. Nothing here carries GTT methodology: these are operational abstractions only.
Index ¶
- type ADE
- type ADEExecutor
- type AgentAdapter
- type AgentRegistry
- type Bootstrap
- type BootstrapFactory
- type Candidate
- type Capability
- type Command
- type CoreLayout
- type Git
- type HandoffContract
- type Installer
- type KeyPair
- type Logger
- type Negotiation
- type Operation
- type OperationArg
- type OperationRequest
- type OperationResult
- type Option
- type Package
- type Prompter
- type Release
- type ReleaseSigner
- type Reporter
- type ResolveRequest
- type Resolver
- type Result
- type Runner
- type SignResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ADE ¶
type ADE struct {
ID string
Name string
DetectPaths []string
Binary string
Entry string
Enforcement string
OwnedPaths []string // project paths the Bootstrap declares as this ADE's
Version int // version of the registry entry
}
ADE is one entry of the Bootstrap ADE registry, reduced to what the CLI operates on.
type ADEExecutor ¶
type ADEExecutor interface {
ID() string
Available() bool
BuildCommand(contract HandoffContract) Command
Execute(ctx context.Context, contract HandoffContract) error
}
ADEExecutor knows how to detect and start one ADE. It knows no methodology.
type AgentAdapter ¶
type AgentAdapter interface {
ID() string
Name() string
// Version is the version of the adapter's registry entry.
Version() int
// Detect returns the signals observed in the project or on the machine.
// A signal makes the agent a candidate and nothing more.
Detect(projectRoot string, runner Runner) []string
// ContextLocations are the project paths the adapter manages.
ContextLocations() []string
// InstructionEntry is the file the agent reads first.
InstructionEntry() string
}
AgentAdapter is the integration of one ADE/agent as the CLI operates it: how it is detected and which project locations hold its context. Every name and path comes from the Bootstrap ADE registry, so a new ADE needs a registry entry and no CLI change. Validating and synchronising the context are Bootstrap operations, not adapter methods.
type AgentRegistry ¶
type AgentRegistry interface {
Adapters() []AgentAdapter
Adapter(id string) (AgentAdapter, bool)
}
AgentRegistry is the set of agents GTT has an integration for.
type Bootstrap ¶
type Bootstrap interface {
Root() string
Release(ctx context.Context) (Release, error)
// Negotiate fails closed: any doubt is an incompatibility.
Negotiate(ctx context.Context) (Negotiation, error)
Capabilities(ctx context.Context) ([]Capability, error)
Operations(ctx context.Context) (map[string]Operation, error)
Show(ctx context.Context, contract string) (json.RawMessage, error)
CheckContracts(ctx context.Context) ([]string, error)
Execute(ctx context.Context, req OperationRequest) (OperationResult, error)
}
Bootstrap is the runtime boundary to one Bootstrap tree (an installed project or a catalog). Implementations hide every Bootstrap detail.
type BootstrapFactory ¶
type BootstrapFactory interface {
At(root string) Bootstrap
// Installed reports whether root holds a Bootstrap contract surface.
Installed(root string) bool
}
BootstrapFactory binds a runtime to a directory.
type Candidate ¶
type Candidate struct {
ADE
Signals []string
Status string // Bootstrap-reported status when installed, else ""
}
Candidate is a detected ADE: an observation, never a choice.
type Capability ¶
type Capability struct {
ID string `json:"id"`
Version int `json:"version"`
Operations []string `json:"operations"`
Summary string `json:"summary"`
}
Capability is one entry of the Bootstrap capability registry.
type Command ¶
type Command struct {
Path string
Args []string
Dir string
Env []string
Interactive bool // attach the terminal instead of capturing output
}
Command is one structured process invocation: a trusted executable, its arguments, environment additions and working directory.
type CoreLayout ¶
type CoreLayout struct {
Paths []string // every top-level file and directory, slash separated
// Package are the paths that hold Bootstrap package content (the engine
// and the entry points); the governed domain is never among them.
Package []string
// Rewritten are the engine paths the manifest declares as derived or as
// state (a trailing slash names a directory): the Bootstrap's own scripts
// rewrite them, so a difference there is never a local customization.
Rewritten []string
// Tracking is where the Bootstrap declares the initial-source tracking
// record (manifest section `tracking:`); empty when it declares none.
Tracking string
}
CoreLayout is what the scaffold manifest says the portable core is.
type HandoffContract ¶
HandoffContract is what the CLI delivers to an ADE. Its content comes from the Bootstrap; the CLI never authors instructions.
type Installer ¶
type Installer interface {
Layout(pkg Package) (CoreLayout, error)
Conflicts(pkg Package, projectRoot string) ([]string, error)
// Install copies the core and returns the ledger path -> sha256.
Install(pkg Package, projectRoot string) (map[string]string, error)
Remove(projectRoot string, layout CoreLayout) error
}
Installer stages and commits the portable core into a project.
type KeyPair ¶
type KeyPair struct {
ID string `json:"key_id"`
Private string `json:"private_key"`
Public string `json:"public_key"`
}
KeyPair names the files of a release signing key.
type Logger ¶
Logger receives internal log lines (error, warn, info, debug). They go to stderr, never to the result, and must never carry tokens, credentials or environment values.
type Negotiation ¶
Negotiation is the compatibility decision. Compatible false means the project must not be touched.
type Operation ¶
type Operation struct {
Version int `json:"version"`
Args []OperationArg `json:"args"`
Mutates bool `json:"mutates"`
HumanAuthority bool `json:"human_authority"`
Outputs struct {
Format string `json:"format"`
Contract string `json:"contract"`
} `json:"outputs"`
}
Operation is one entry of the Bootstrap operation registry.
type OperationArg ¶
type OperationArg struct {
Name string `json:"name"`
Type string `json:"type"`
Required bool `json:"required"`
Values []string `json:"values"`
}
OperationArg is one declared argument of an operation.
type OperationRequest ¶
type OperationRequest struct {
Operation string
Args map[string]string
// Apply performs the change; without it a mutating operation is a dry run.
Apply bool
// ConfirmedByHuman must be set only after the human actually confirmed.
ConfirmedByHuman bool
}
OperationRequest asks the Bootstrap to run one declared operation.
type OperationResult ¶
type OperationResult struct {
Operation string
ExitCode int
Stdout string
Stderr string
Format string
Applied bool
}
OperationResult is the envelope the Bootstrap returns.
func (OperationResult) JSON ¶
func (r OperationResult) JSON(v any) error
JSON decodes a JSON-format result into v.
func (OperationResult) OK ¶
func (r OperationResult) OK() bool
OK reports a zero exit of the implementation.
type Package ¶
type Package struct {
Root string
Source string // local | recorded | cache | remote
Origin string // path or URL it came from
Checksum string
Release Release
// Integrity and Signature are the verification results, recorded as-is.
Integrity string
Signature string
}
Package is a resolved Bootstrap catalog on disk.
type Prompter ¶
type Prompter interface {
Interactive() bool
Confirm(question string, def bool) (bool, error)
Select(title string, options []Option) (int, error)
MultiSelect(title string, options []Option) ([]int, error)
}
Prompter asks the human. Every method returns core.ErrCancelled-compatible errors when input ends, and must not be used when Interactive is false.
type Release ¶
type Release struct {
Bootstrap struct {
ID string `json:"id"`
Version string `json:"version"`
SchemaVersion int `json:"schema_version"`
Channel string `json:"channel"`
} `json:"bootstrap"`
Scaffold struct {
Version int `json:"version"`
Manifest string `json:"manifest"`
} `json:"scaffold"`
Canon string `json:"canon"`
Compatibility struct {
CLI struct {
MinVersion string `json:"min_version"`
MaxVersion *string `json:"max_version"`
} `json:"cli"`
Schema struct {
Version int `json:"version"`
} `json:"schema"`
} `json:"compatibility"`
RequiresCLICapabilities []string `json:"requires_cli_capabilities"`
SupportedLanguages []string `json:"supported_languages"`
Contracts map[string]int `json:"contracts"`
}
Release is the Bootstrap release descriptor.
type ReleaseSigner ¶
type ReleaseSigner interface {
Keygen(dir, id string) (KeyPair, error)
Sign(ctx context.Context, root, keyFile string) (SignResult, error)
}
ReleaseSigner creates release keys and signs Bootstrap packages. It is for whoever publishes a Bootstrap release; verification never uses it.
type Reporter ¶
type Reporter interface {
Info(format string, args ...any)
// Detail is shown only when the human asked for detail.
Detail(text string)
}
Reporter receives progress lines meant for a human. Implementations stay silent when machine-readable output was requested.
type ResolveRequest ¶
type ResolveRequest struct {
Path string // explicit --bootstrap
Version string // --bootstrap-version
Offline bool
Recorded string // source recorded by the project, if any
Refresh bool // look for a newer release instead of reusing the cache
Checksum string // expected checksum, if the caller has one
}
ResolveRequest states how the human asked for a Bootstrap.
type Resolver ¶
type Resolver interface {
Resolve(ctx context.Context, req ResolveRequest) (Package, error)
Verify(ctx context.Context, pkg *Package) error
}
Resolver finds and verifies a Bootstrap catalog.