core

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package core holds the CLI's own identity and its exit and error contract. It depends on nothing but the standard library.

Index

Constants

View Source
const BootstrapID = "gtt-bootstrap"

BootstrapID is the only Bootstrap identity this CLI operates.

View Source
const BootstrapPin = "1.6.0"

BootstrapPin is the exact GTT Bootstrap release this CLI release ships with. Pinning the CLI therefore pins the Bootstrap. It is resolved from its release tag (BootstrapTag), never from a branch head; another release is used only when the human names it explicitly.

View Source
const OutputSchema = 1

OutputSchema is the version of every JSON document the CLI emits.

Variables

View Source
var BootstrapSchemas = []int{1}

BootstrapSchemas are the Bootstrap schema versions this CLI understands.

View Source
var CLICapabilities = []string{"contract.negotiate.v1", "operation.execute.v1"}

CLICapabilities are the capability ids this CLI declares to a Bootstrap during negotiation.

View Source
var ErrCancelled = &Error{Code: ExitCancelled, What: "Cancelled."}

ErrCancelled is returned when the human declines.

View Source
var SupportedCapabilities = map[string]int{
	"project.detect":       1,
	"ade.detect":           1,
	"ade.install":          1,
	"template.materialize": 1,
	"methodology.profile":  1,
	"source.select":        1,
	"validation":           1,
	"status":               1,
	"freeze":               1,
	"session-context":      1,
	"export-policy":        1,
	"recovery":             1,
	"guard":                1,
	"retrieval":            1,
	"developer-experience": 1,
}

SupportedCapabilities maps each Bootstrap capability this CLI consumes to the version it implements. A Bootstrap that offers one of these at another version is refused; a capability not listed here is simply not used.

View Source
var Version = baseVersion

Version is the CLI release. Each release pins one Bootstrap release (BootstrapPin) with the same number: GTT is released as a suite (ADR-005), and compatibility is still negotiated, never assumed. Release builds set it with -ldflags; `go install module@vX.Y.Z` takes it from the module version; a plain source build keeps this base value.

Functions

func BootstrapTag added in v1.1.0

func BootstrapTag(version string) string

BootstrapTag is the release tag of a Bootstrap version.

func CompareSemver

func CompareSemver(a, b [3]int) int

CompareSemver returns -1, 0 or 1.

func ParseSemver

func ParseSemver(s string) (v [3]int, ok bool)

ParseSemver parses MAJOR.MINOR.PATCH; ok is false for anything else.

Types

type Error

type Error struct {
	Code       ExitCode
	What       string
	Why        string
	Next       string
	Unmodified bool // true when the project is known to be untouched
	Err        error
}

Error is a user-facing error: what happened, why, and what to do next.

func Errorf

func Errorf(code ExitCode, format string, args ...any) *Error

Errorf builds an Error with only a code and a message.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ExitCode

type ExitCode int

ExitCode is the v1.0 exit contract.

const (
	ExitOK           ExitCode = 0
	ExitFailure      ExitCode = 1 // validation / operational failure
	ExitIncompatible ExitCode = 2 // CLI/Bootstrap incompatibility
	ExitUsage        ExitCode = 3 // invalid invocation
	ExitCancelled    ExitCode = 4 // user cancellation
	ExitConflict     ExitCode = 5 // project state conflict
	ExitIntegrity    ExitCode = 6 // Bootstrap integrity failure
	ExitUnavailable  ExitCode = 7 // external dependency unavailable
)

func CodeOf

func CodeOf(err error) ExitCode

CodeOf maps any error to its exit code.

Jump to

Keyboard shortcuts

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