bootstrap

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 19 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 bootstrap is the adapter to GTT Bootstrap: it resolves, verifies and installs a catalog, and runs declared operations through the Bootstrap's contract entry point. It holds no GTT semantics.

Index

Constants

View Source
const CanonicalSource = "https://github.com/GTT-Community/gtt-bootstrap.git"

CanonicalSource is the canonical distribution source of GTT Bootstrap.

View Source
const SignatureFile = ".gtt/contract/release.sig"

SignatureFile is the detached release signature a Bootstrap package may carry. It signs the content checksum of every other file of the package.

Variables

View Source
var Now = func() time.Time { return time.Now().UTC() }

Now is the clock used for resolution records.

Functions

func Layout

func Layout(pkg ports.Package) (ports.CoreLayout, error)

Layout reads from the scaffold manifest what the portable core is: the engine and domain layers, the entry points and, when declared, where the initial-source tracking record lives. Only installation structure is read; nothing else in the manifest is interpreted here.

func LocalReasons

func LocalReasons(rel ports.Release, caps []ports.Capability) []string

LocalReasons are the CLI's own reasons to refuse a Bootstrap.

func TrustedKeys

func TrustedKeys(dir string) (map[string]ed25519.PublicKey, error)

TrustedKeys reads the trusted release keys: every <key-id>.pub file in dir holds one base64 ed25519 public key. An unreadable or malformed key is an integrity failure, never skipped.

Types

type Factory

type Factory struct{ Runner ports.Runner }

Factory builds runtimes.

func (Factory) At

func (f Factory) At(root string) ports.Bootstrap

At binds a runtime to a Bootstrap tree.

func (Factory) Installed

func (f Factory) Installed(root string) bool

Installed reports whether root holds the contract entry point.

type Installer

type Installer struct{}

Installer stages and commits the portable core.

func (Installer) Conflicts

func (Installer) Conflicts(pkg ports.Package, projectRoot string) ([]string, error)

Conflicts lists core paths that already exist in the project. A conflict is reported, never merged.

func (Installer) Install

func (i Installer) Install(pkg ports.Package, projectRoot string) (map[string]string, error)

Install stages the core next to the project, then commits it with one rename per top-level path. On any failure everything it created is removed.

func (Installer) Layout

func (Installer) Layout(pkg ports.Package) (ports.CoreLayout, error)

Layout returns the core layout of a package.

func (Installer) Remove

func (Installer) Remove(projectRoot string, layout ports.CoreLayout) error

Remove deletes the core paths from a project (rollback of Install).

type Resolver

type Resolver struct {
	Runner  ports.Runner
	Factory ports.BootstrapFactory
	Home    string // user-level GTT home (cache lives under it)
	Remote  string // configured distribution source; empty = canonical
	// KeysDir holds the trusted release keys. When it holds any, every
	// package must carry a signature that verifies against one of them.
	KeysDir string
}

Resolver finds a Bootstrap catalog in this order: explicit path, the source the project recorded, the verified user cache, the configured source, the canonical source. It never picks an unknown version silently.

func (Resolver) CacheDir

func (r Resolver) CacheDir() string

CacheDir is where verified catalogs are kept, outside any project.

func (Resolver) Resolve

func (r Resolver) Resolve(ctx context.Context, req ports.ResolveRequest) (ports.Package, error)

Resolve returns a catalog on disk. The result is not yet verified.

func (Resolver) Verify

func (r Resolver) Verify(ctx context.Context, pkg *ports.Package) error

Verify checks structure, path safety, release metadata, the content checksum, the release signature and the Bootstrap's own contract check. Any failure is fatal.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime talks to one Bootstrap tree.

func (*Runtime) Capabilities

func (r *Runtime) Capabilities(ctx context.Context) ([]ports.Capability, error)

Capabilities returns the capability registry.

func (*Runtime) CheckContracts

func (r *Runtime) CheckContracts(ctx context.Context) ([]string, error)

CheckContracts returns the problems the Bootstrap finds in its own contracts.

func (*Runtime) Execute

Execute runs one declared operation. An operation the Bootstrap does not declare is refused here, before anything is run.

func (*Runtime) Negotiate

func (r *Runtime) Negotiate(ctx context.Context) (ports.Negotiation, error)

Negotiate asks the Bootstrap whether this CLI is compatible and then applies the CLI-side checks. Anything unknown is an incompatibility.

func (*Runtime) Operations

func (r *Runtime) Operations(ctx context.Context) (map[string]ports.Operation, error)

Operations returns the operation registry (cached per runtime).

func (*Runtime) Release

func (r *Runtime) Release(ctx context.Context) (ports.Release, error)

Release returns the release descriptor.

func (*Runtime) Root

func (r *Runtime) Root() string

Root returns the bound directory.

func (*Runtime) Show

func (r *Runtime) Show(ctx context.Context, contract string) (json.RawMessage, error)

Show returns one contract document as raw JSON.

type Signer

type Signer struct {
	Factory ports.BootstrapFactory
}

Signer creates release keys and signs Bootstrap packages. It is the tool of whoever publishes a Bootstrap release, never part of verification.

func (Signer) Keygen

func (Signer) Keygen(dir, id string) (ports.KeyPair, error)

Keygen writes <id>.key (private, 0600) and <id>.pub in dir. It never overwrites an existing key.

func (Signer) Sign

func (s Signer) Sign(ctx context.Context, root, keyFile string) (ports.SignResult, error)

Sign writes the release signature into a Bootstrap package directory.

Jump to

Keyboard shortcuts

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