usecasecatalog

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UseCaseSchema       = "stackkits-use-case-catalog/v1"
	EvidenceSchema      = "stackkits-use-case-evidence/v1"
	CompatibilitySchema = "stackkits-compatibility/v1"
)

Variables

This section is empty.

Functions

func DiscoverRepoRoot

func DiscoverRepoRoot(start string) (string, error)

func Generate

func Generate(repoRoot string, release ReleaseIdentity, generatorVersion string) (UseCaseManifest, CompatibilityManifest, []InternalUseCase, error)

func GenerateWithPassedTests

func GenerateWithPassedTests(repoRoot string, release ReleaseIdentity, generatorVersion string) (UseCaseManifest, CompatibilityManifest, []InternalUseCase, error)

func GenerateWithReceipt

func GenerateWithReceipt(repoRoot string, release ReleaseIdentity, generatorVersion string, receipt *TestReceipt) (UseCaseManifest, CompatibilityManifest, []InternalUseCase, error)

func MarshalCanonical added in v0.42.0

func MarshalCanonical(document any) ([]byte, error)

MarshalCanonical encodes a decoded document the way JavaScript consumers recompute contentDigest (JSON.stringify with sorted keys): encoding/json sorts map keys, but its default HTML escaping of &, < and > would make any title such as "Documents & Files" fail their digest check.

func RenderInternalMarkdown

func RenderInternalMarkdown(entries []InternalUseCase) string

func WriteJSON

func WriteJSON(path string, value any) error

Types

type ApplicationDelivery

type ApplicationDelivery struct {
	// Native authoring binds the catalog's default implementation to the
	// module whose explicit profiles must accompany a selected workload.
	DefaultAlternativeRef string               `json:"defaultAlternativeRef,omitempty"`
	DefaultModuleRef      string               `json:"defaultModuleRef,omitempty"`
	UseCaseRef            string               `json:"useCaseRef"`
	WorkloadRef           string               `json:"workloadRef"`
	AdapterRef            string               `json:"adapterRef"`
	AdapterName           string               `json:"adapterName"`
	Status                string               `json:"status"`
	Capabilities          DeliveryCapabilities `json:"capabilities"`
}

type AuthoringAlternative

type AuthoringAlternative struct {
	ID      string            `json:"id"`
	Name    string            `json:"name"`
	Modules []AuthoringModule `json:"modules"`
}

type AuthoringModule

type AuthoringModule struct {
	ID              string   `json:"id"`
	ComputeProfiles []string `json:"computeProfiles"`
}

type AuthoringWorkload

type AuthoringWorkload struct {
	ID                 string                 `json:"id"`
	DefaultAlternative string                 `json:"defaultAlternative"`
	Alternatives       []AuthoringAlternative `json:"alternatives"`
}

type Capability added in v0.47.7

type Capability struct {
	ID                  string            `json:"id"`
	Name                string            `json:"name"`
	Help                string            `json:"help,omitempty"`
	Required            bool              `json:"required"`
	EnabledByDefault    bool              `json:"enabledByDefault"`
	Requires            []string          `json:"requires"`
	RequiresAccelerator bool              `json:"requiresAccelerator"`
	Default             CapabilityOption  `json:"default"`
	Alternative         *CapabilityOption `json:"alternative,omitempty"`
}

Capability is an independently selectable capability module of a use case; the projection of foundation.#UseCaseCapabilityModule.

func (Capability) Options added in v0.47.7

func (c Capability) Options() []CapabilityOption

Options returns the default and, when declared, the alternative.

type CapabilityOption added in v0.47.7

type CapabilityOption struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Note        string `json:"note,omitempty"`
	Realization string `json:"realization"`
	// Pending names what a recorded option waits for; authoring repeats it
	// in the refusal so the owner learns the exact blocker.
	Pending        string `json:"pending,omitempty"`
	WorkloadRef    string `json:"workloadRef,omitempty"`
	AlternativeRef string `json:"alternativeRef,omitempty"`
	// AlternativeRefs lists every alternative of WorkloadRef that installs
	// this tool; AlternativeRef is the one used unless another capability of
	// the use case decides the workload. Empty means only AlternativeRef.
	AlternativeRefs []string `json:"alternativeRefs,omitempty"`
}

CapabilityOption is one tool that can realize a capability module; the projection of foundation.#UseCaseCapabilityOption. An installing option names the Architecture v2 workload alternative that realizes it; a recorded option is planned and refused by authoring.

func (CapabilityOption) InstallsWith added in v0.48.0

func (o CapabilityOption) InstallsWith(alternativeRef string) bool

InstallsWith reports whether the option's tool is part of the named alternative of its workload.

type CompatibilityManifest

type CompatibilityManifest struct {
	SchemaVersion    string          `json:"schemaVersion"`
	Release          ReleaseIdentity `json:"release"`
	GeneratedAt      string          `json:"generatedAt"`
	GeneratorVersion string          `json:"generatorVersion"`
	Compatibility    struct {
		OS                  []OSCompatibility     `json:"os"`
		ApplicationDelivery []ApplicationDelivery `json:"applicationDelivery"`
	} `json:"compatibility"`
	ContentDigest string `json:"contentDigest"`
}

type Component

type Component struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Role string `json:"role"`
	Kind string `json:"kind"`
	// Realization is derived for alternative components only: "install" when
	// the use case's Architecture v2 workload admits the alternative, so the
	// pinned release can install it; "recorded" when the choice is kept as the
	// owner's target preference for a later release. Never authored.
	Realization string `json:"realization,omitempty"`
}

type DeliveryCapabilities

type DeliveryCapabilities struct {
	Deployment     bool `json:"deployment"`
	RouteTLS       bool `json:"routeTLS"`
	StatusEvidence bool `json:"statusEvidence"`
	BackupRestore  bool `json:"backupRestore"`
}

type EvidenceManifest

type EvidenceManifest struct {
	SchemaVersion    string            `json:"schemaVersion"`
	SourceSHA        string            `json:"sourceSha"`
	GeneratedAt      string            `json:"generatedAt"`
	GeneratorVersion string            `json:"generatorVersion"`
	UseCases         []InternalUseCase `json:"useCases"`
	ContentDigest    string            `json:"contentDigest"`
}

func NewEvidenceManifest

func NewEvidenceManifest(sourceSHA, generatedAt, generatorVersion string, entries []InternalUseCase) (EvidenceManifest, error)

type Gate

type Gate struct {
	ID         string   `json:"id"`
	Status     string   `json:"status"`
	ReasonCode string   `json:"reasonCode"`
	Detail     string   `json:"detail"`
	Sources    []string `json:"sources"`
}

type InternalUseCase

type InternalUseCase struct {
	UseCase
	Gates []Gate `json:"gates"`
}

type MainUseCase added in v0.42.0

type MainUseCase struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

MainUseCase is the owner-accepted main use case a catalog entry is grouped under; CUE constrains the id and derives the title.

type OSCompatibility

type OSCompatibility struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Version      string `json:"version"`
	Architecture string `json:"architecture"`
	Status       string `json:"status"`
	Reason       string `json:"reason,omitempty"`
	EvidenceRef  string `json:"evidenceRef,omitempty"`
}

type ReleaseIdentity

type ReleaseIdentity struct {
	Tag             string `json:"tag"`
	Version         string `json:"version"`
	SourceSHA       string `json:"sourceSha"`
	PublicSourceSHA string `json:"publicSourceSha"`
	ReleaseURL      string `json:"releaseUrl"`
}

type RuntimeEvidenceReceipt

type RuntimeEvidenceReceipt struct {
	SchemaVersion string `json:"schemaVersion"`
	SourceSHA     string `json:"sourceSha"`
	UseCases      []struct {
		UseCaseRef  string `json:"useCaseRef"`
		Status      string `json:"status"`
		EvidenceRef string `json:"evidenceRef"`
	} `json:"useCases"`
}

type Setting

type Setting struct {
	ID          string          `json:"id"`
	Name        string          `json:"name"`
	Kind        string          `json:"kind"`
	Group       string          `json:"group"`
	Depth       string          `json:"depth"`
	Help        string          `json:"help,omitempty"`
	Options     []SettingOption `json:"options,omitempty"`
	Default     any             `json:"default"`
	Placeholder string          `json:"placeholder,omitempty"`
	Realization string          `json:"realization"`
	// WorkloadRef names the Architecture v2 application workload a toggle
	// selects in the StackSpec when it is on; such a setting installs.
	WorkloadRef string `json:"workloadRef,omitempty"`
	// AcceleratorProfileOf names the Architecture v2 module whose accelerator
	// profile a non-default option selects; the default option selects none.
	AcceleratorProfileOf string `json:"acceleratorProfileOf,omitempty"`
}

Setting is a decision an operator makes about a use case before install; the projection of foundation.#UseCaseSetting. `Default` is a string for choice and text settings and a bool for toggles, exactly as declared.

type SettingOption

type SettingOption struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Note string `json:"note,omitempty"`
}

SettingOption is one choice of a choice-kind setting.

type TestReceipt

type TestReceipt struct {
	SchemaVersion string   `json:"schemaVersion"`
	SourceSHA     string   `json:"sourceSha"`
	Status        string   `json:"status"`
	UseCaseRefs   []string `json:"useCaseRefs"`
}

func NewTestReceipt

func NewTestReceipt(sourceSHA string, useCases []UseCase) (TestReceipt, error)

type UseCase

type UseCase struct {
	ID           string                           `json:"id"`
	Title        string                           `json:"title"`
	Description  string                           `json:"description"`
	Components   []Component                      `json:"components"`
	MainUseCase  MainUseCase                      `json:"mainUseCase"`
	ComputeTiers map[string]UseCaseComputeTierFit `json:"computeTiers,omitempty"`
	Settings     []Setting                        `json:"settings,omitempty"`
	// Capabilities are the independently selectable capability modules of
	// this use case (`stackkit init --use-case-capability`).
	Capabilities       []Capability           `json:"capabilities,omitempty"`
	Docs               string                 `json:"docs,omitempty"`
	DefaultAlternative string                 `json:"defaultAlternative,omitempty"`
	Alternatives       []AuthoringAlternative `json:"alternatives,omitempty"`
	// AddOns are application workloads of this use case the owner selects in
	// addition to the primary workload, each with its own module profiles.
	AddOns []AuthoringWorkload `json:"addOns,omitempty"`
}

func LoadUseCaseComputeTiers

func LoadUseCaseComputeTiers(repoRoot string) ([]UseCase, error)

LoadUseCaseComputeTiers returns package compute-tier fits for Unifier/MCP.

type UseCaseComputeTierFit

type UseCaseComputeTierFit struct {
	Included   bool         `json:"included"`
	Functions  []string     `json:"functions,omitempty"`
	Load       *UseCaseLoad `json:"load,omitempty"`
	ModuleSlug string       `json:"moduleSlug,omitempty"`
	Reason     string       `json:"reason,omitempty"`
	Notes      []string     `json:"notes,omitempty"`
}

UseCaseComputeTierFit is the Unifier-readable surface of one package on one install.computeTier graph. Apply does not read it.

type UseCaseLoad

type UseCaseLoad struct {
	Residency string `json:"residency"`
	Baseline  string `json:"baseline"`
	Burst     string `json:"burst"`
}

type UseCaseManifest

type UseCaseManifest struct {
	SchemaVersion    string          `json:"schemaVersion"`
	Release          ReleaseIdentity `json:"release"`
	GeneratedAt      string          `json:"generatedAt"`
	GeneratorVersion string          `json:"generatorVersion"`
	Catalog          struct {
		UseCases []UseCase           `json:"useCases"`
		KitCores []AuthoringWorkload `json:"kitCores,omitempty"`
	} `json:"catalog"`
	ContentDigest string `json:"contentDigest"`
}

Jump to

Keyboard shortcuts

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