Help us shape the future of Go! Take the 2026 Go Developer Survey

usecasecatalog

package
v0.54.18 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 18 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"
)
View Source
const PreviewCatalogFile = "stackkits-preview-use-case-catalog-v1.json"
View Source
const PreviewCatalogSchema = "stackkits.preview-use-case-catalog/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 KitUseCaseRoles added in v0.53.8

func KitUseCaseRoles(root string) (map[string]map[string]string, error)

KitUseCaseRoles returns, per kit directory, the native selection role of every catalog use case the kit's stackfile Definition lists; a required use case counts as default. It is the authority that derived kit metadata (stackkit.yaml) must mirror.

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 ModuleLoads added in v0.53.17

func ModuleLoads(useCases []UseCase) map[string]map[string]UseCaseLoad

ModuleLoads projects the per-tier load declarations of the use cases (ADR-0037 vocabulary: residency, baseline, burst) onto the module IDs of the alternative that each tier names through moduleSlug. The result is keyed by module ID, then by compute profile ID: a tier and a module compute profile share the low, standard and high vocabulary, and a module only receives the load of the profile a plan actually selects.

Only an included tier with a declared load and a moduleSlug that resolves to an alternative contributes. Two declarations that disagree for the same module and profile are dropped from the result, so the load stays unknown rather than taking whichever declaration happened to come first.

func RenderInternalMarkdown

func RenderInternalMarkdown(entries []InternalUseCase) string

func RenderTruthTableMarkdown added in v0.53.1

func RenderTruthTableMarkdown(table TruthTable, publicOnly bool) string

RenderTruthTableMarkdown is shared by every documentation projection.

func WriteJSON

func WriteJSON(path string, value any) error

Types

type AcceleratorProfileFacts added in v0.48.1

type AcceleratorProfileFacts struct {
	Vendor         string          `json:"vendor"`
	Access         string          `json:"access"`
	MinVramGiB     *float64        `json:"minVramGiB,omitempty"`
	MinDriverMajor *float64        `json:"minDriverMajor,omitempty"`
	Maturity       string          `json:"maturity"`
	Reservation    *ResourceBudget `json:"reservation,omitempty"`
}

AcceleratorProfileFacts projects one accelerator profile's device demand.

type AlternativeSetup added in v0.53.1

type AlternativeSetup struct {
	WorkloadRef    string   `json:"workloadRef"`
	AlternativeRef string   `json:"alternativeRef"`
	ActionRefs     []string `json:"actionRefs"`
}

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 {
	Configuration             *ConfigurationInputs `json:"configuration,omitempty"`
	ID                        string               `json:"id"`
	Name                      string               `json:"name"`
	Modules                   []AuthoringModule    `json:"modules"`
	ProvidesRuntimeAdapterRef string               `json:"providesRuntimeAdapterRef,omitempty"`
}

type AuthoringModule

type AuthoringModule struct {
	ID                  string   `json:"id"`
	ComputeProfiles     []string `json:"computeProfiles"`
	StorageProfiles     []string `json:"storageProfiles,omitempty"`
	AcceleratorProfiles []string `json:"acceleratorProfiles,omitempty"`
	// ComputeProfileFacts carries the declared numeric footprint of each
	// profile in ComputeProfiles, keyed by profile ID, so Techstack can size a
	// selection without evaluating CUE. Recommendation stays with Techstack.
	ComputeProfileFacts map[string]ComputeProfileFacts `json:"computeProfileFacts,omitempty"`
	// AcceleratorProfileFacts is the device demand of each accelerator
	// profile the module declares; absent when it declares none.
	AcceleratorProfileFacts map[string]AcceleratorProfileFacts `json:"acceleratorProfileFacts,omitempty"`
}

type AuthoringWorkload

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

type Bundle added in v0.53.8

type Bundle struct {
	ID                    string   `json:"id"`
	Name                  string   `json:"name"`
	Help                  string   `json:"help,omitempty"`
	Examples              []string `json:"examples,omitempty"`
	Capabilities          []string `json:"capabilities"`
	Defaults              []string `json:"defaults"`
	Required              bool     `json:"required"`
	EnabledByDefault      bool     `json:"enabledByDefault"`
	Advanced              bool     `json:"advanced"`
	RecommendsAccelerator bool     `json:"recommendsAccelerator"`
	RequiresSandbox       bool     `json:"requiresSandbox"`
}

Bundle groups capability modules of a use case under one customer-facing choice; the projection of foundation.#UseCaseBundle. Turning a bundle on selects Defaults through the ordinary capability authoring.

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 CatalogContent added in v0.54.10

type CatalogContent struct {
	Authoring struct {
		RetainedRemovalCandidates bool `json:"retainedRemovalCandidates"`
	} `json:"authoring"`
	UseCases []UseCase           `json:"useCases"`
	KitCores []AuthoringWorkload `json:"kitCores,omitempty"`
}

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 ComputeProfileFacts added in v0.48.1

type ComputeProfileFacts struct {
	Maturity      string          `json:"maturity"`
	Executable    bool            `json:"executable"`
	Realization   string          `json:"realization,omitempty"`
	HostFloor     *HostFloor      `json:"hostFloor,omitempty"`
	Reservation   *ResourceBudget `json:"reservation,omitempty"`
	Recommended   *ResourceBudget `json:"recommended,omitempty"`
	Headroom      *ResourceBudget `json:"headroom,omitempty"`
	Architectures []string        `json:"architectures,omitempty"`
	Provenance    json.RawMessage `json:"provenance,omitempty"`
	MeasuredRef   string          `json:"measuredRef,omitempty"`
}

ComputeProfileFacts projects one module compute profile's declared facts. Provenance is carried verbatim when the source declares it.

type ConfigurationInputs added in v0.54.10

type ConfigurationInputs struct {
	Settings   []ConfigurationSetting `json:"settings"`
	SecretRefs []string               `json:"secretRefs"`
}

type ConfigurationSetting added in v0.54.10

type ConfigurationSetting struct {
	Key     string `json:"key"`
	Type    string `json:"type"`
	Label   string `json:"label"`
	Options []any  `json:"options,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 HostFloor added in v0.48.1

type HostFloor struct {
	MinCPUCores                    *float64 `json:"minCpuCores,omitempty"`
	MinRAMGB                       *float64 `json:"minRamGB,omitempty"`
	MinStorageGB                   *float64 `json:"minStorageGB,omitempty"`
	MinAMD64MicroarchitectureLevel *float64 `json:"minAMD64MicroarchitectureLevel,omitempty"`
	AllowedArchitectures           []string `json:"allowedArchitectures,omitempty"`
}

HostFloor is the minimum a node must attest before the profile applies.

type InternalUseCase

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

type KitMembership added in v0.53.1

type KitMembership struct {
	ID   string `json:"id"`
	Role string `json:"role"`
}

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 PreviewCatalog added in v0.54.10

type PreviewCatalog struct {
	SchemaVersion   string                                `json:"schemaVersion"`
	DeclaredVersion string                                `json:"declaredVersion"`
	Source          releaseindex.PreviewCandidateSource   `json:"source"`
	Producer        releaseindex.PreviewCandidateProducer `json:"producer"`
	GeneratedAt     string                                `json:"generatedAt"`
	Catalog         CatalogContent                        `json:"catalog"`
	ContentDigest   string                                `json:"contentDigest"`
}

PreviewCatalog contains generated facts, not a public release or execution grant. The existing producer attests its exact bytes; consumers authenticate those bytes and the source/run against their independent candidate admission.

func GeneratePreviewCatalog added in v0.54.10

func GeneratePreviewCatalog(sourceRoot, catalogRoot, declaredVersion string, source releaseindex.PreviewCandidateSource, producer releaseindex.PreviewCandidateProducer) (PreviewCatalog, error)

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 ResourceBudget added in v0.48.1

type ResourceBudget struct {
	CPUCores  *float64 `json:"cpuCores,omitempty"`
	RAMGB     *float64 `json:"ramGB,omitempty"`
	StorageGB *float64 `json:"storageGB,omitempty"`
}

ResourceBudget is a declared resource envelope. Undeclared axes stay absent, never zero (ADR-0039).

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"`
	// Realization overrides the setting's realization for this option.
	Realization string `json:"realization,omitempty"`
	// MinMemoryGB is the server memory this option needs to run well.
	MinMemoryGB int `json:"minMemoryGb,omitempty"`
	// NeedsAccelerator marks an option that needs a GPU in practice.
	NeedsAccelerator bool `json:"needsAccelerator,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 TruthTable added in v0.53.1

type TruthTable struct {
	Rows         []TruthTableRow `json:"rows"`
	MainUseCases []MainUseCase   `json:"mainUseCases"`
}

func GenerateTruthTable added in v0.53.1

func GenerateTruthTable(root string) (TruthTable, error)

BuildTruthTable evaluates kit membership and accepted intent titles. Counts follow these sources and the public export policy, never an authored number.

type TruthTableCounts added in v0.53.1

type TruthTableCounts struct {
	SchemaVersion       string `json:"schemaVersion"`
	AcceptedMainIntents int    `json:"acceptedMainIntents"`
	CatalogSlugs        int    `json:"catalogSlugs"`
	CatalogMainIntents  int    `json:"catalogMainIntents"`
	PublicCatalogSlugs  int    `json:"publicCatalogSlugs"`
	PublicMainIntents   int    `json:"publicMainIntents"`
}

TruthTableCounts keeps accepted intents, catalog slugs and public export membership separate. These are authoring facts, never installation evidence.

func CountTruthTable added in v0.53.1

func CountTruthTable(table TruthTable) TruthTableCounts

type TruthTableRow added in v0.53.1

type TruthTableRow struct {
	InternalUseCase
	Truth *UseCaseTruth `json:"truth"`
}

type UseCase

type UseCase struct {
	WorkloadRef  string                           `json:"workloadRef,omitempty"`
	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"`
	// Bundles group the capability modules for consumer surfaces.
	Bundles            []Bundle               `json:"bundles,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          CatalogContent  `json:"catalog"`
	ContentDigest    string          `json:"contentDigest"`
}

type UseCaseTruth added in v0.53.1

type UseCaseTruth struct {
	PackageLifecycle string             `json:"packageLifecycle"`
	Visibility       string             `json:"visibility"`
	Kits             []KitMembership    `json:"kits"`
	SetupActions     []AlternativeSetup `json:"setupActions"`
	AgentDeclared    bool               `json:"agentDeclared"`
	AgentSkills      []string           `json:"agentSkills"`
	ExistingSkills   []string           `json:"existingSkills"`
}

UseCaseTruth joins documentation facts to the catalog without promoting a package declaration into runtime or current-source evidence.

Jump to

Keyboard shortcuts

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