Documentation
¶
Overview ¶
Package composition resolves module dependencies and determines deployment order.
Package composition resolves module dependencies and determines deployment order.
Index ¶
- func Argon2IDPHCString(password string) (string, error)
- func BcryptHash(password string) (string, error)
- func GenerateMetadataJSON(spec *models.StackSpec, cr *CompositionResult) ([]byte, error)
- func GenerateRandomPassword(length int) (string, error)
- func GenerateTFVarsJSON(spec *models.StackSpec, cr *CompositionResult) ([]byte, error)
- type CompositionEngine
- type CompositionResult
- type ControlPlaneHandoff
- type DependencyGraph
- type IdentityConfig
- type IdentityMetadata
- type Metadata
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Argon2IDPHCString ¶
func BcryptHash ¶
func GenerateMetadataJSON ¶
func GenerateMetadataJSON(spec *models.StackSpec, cr *CompositionResult) ([]byte, error)
func GenerateRandomPassword ¶
func GenerateTFVarsJSON ¶
func GenerateTFVarsJSON(spec *models.StackSpec, cr *CompositionResult) ([]byte, error)
GenerateTFVarsJSON generates terraform.tfvars.json matching the template variables and overlays composition-owned identity credentials.
Types ¶
type CompositionEngine ¶
type CompositionEngine struct {
// contains filtered or unexported fields
}
CompositionEngine resolves use cases and addons into a set of enabled modules with dependency-ordered deployment and propagated settings.
func NewCompositionEngine ¶
func NewCompositionEngine(contracts []cueval.ModuleContract, stackkit *models.StackKit, spec *models.StackSpec) *CompositionEngine
NewCompositionEngine creates a new engine from loaded contracts, stackkit, and user spec.
func (*CompositionEngine) Resolve ¶
func (e *CompositionEngine) Resolve() (*CompositionResult, error)
Resolve runs the composition pipeline:
- Resolve use cases → required modules
- Resolve addons → additional modules
- Add platform defaults (identity, dashboard)
- Expand transitive dependencies
- Validate and topologically sort
- Propagate settings with context overrides
- Resolve identity configuration
- Resolve S1 placement capability bindings
func (*CompositionEngine) SetModeMatrix ¶
func (e *CompositionEngine) SetModeMatrix(m *cueval.KitModeMatrix)
SetModeMatrix attaches the kit's mode-support matrix (#KitModeSupport). When set, Resolve grades the requested (placement, install, context) cell: unsupported cells hard-fail, scaffolding cells warn. Kits without a matrix (older exported caches) simply skip enforcement.
type CompositionResult ¶
type CompositionResult struct {
// EnabledModules in dependency order (deploy first → deploy last).
EnabledModules []string
// ModuleSettings maps module name → merged settings (perma + flexible + context override).
ModuleSettings map[string]map[string]any
// Warnings are non-fatal issues (e.g., addon requires higher tier).
Warnings []string
// Identity holds the resolved identity configuration.
Identity *IdentityConfig
// Placement holds the resolved S1 capability bindings (nil for S2/S3
// placements, which StackKits-OSS does not realize — see Warnings).
Placement *placement.Result
// ControlPlaneHandoffs records enabled package/runtime profiles whose
// realization is intentionally owned by Admin/TechStack rather than the
// local OSS resolver.
ControlPlaneHandoffs []ControlPlaneHandoff
}
CompositionResult is the output of the engine: which modules to enable, in what order, with what settings, and any warnings.
type ControlPlaneHandoff ¶
type ControlPlaneHandoff struct {
UseCase string `json:"useCase" yaml:"useCase"`
Tool string `json:"tool" yaml:"tool"`
RuntimeProfile string `json:"runtimeProfile" yaml:"runtimeProfile"`
Realization string `json:"realization,omitempty" yaml:"realization,omitempty"`
Reason string `json:"reason" yaml:"reason"`
ProductMCP string `json:"productMcp,omitempty" yaml:"productMcp,omitempty"`
RequiresControlPlane bool `json:"requiresControlPlane,omitempty" yaml:"requiresControlPlane,omitempty"`
RequiresLocalBridge bool `json:"requiresLocalBridge,omitempty" yaml:"requiresLocalBridge,omitempty"`
PlacementModes []string `json:"placementModes,omitempty" yaml:"placementModes,omitempty"`
Contexts []string `json:"contexts,omitempty" yaml:"contexts,omitempty"`
}
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph represents the directed dependency graph of module contracts.
func BuildGraph ¶
func BuildGraph(contracts []cueval.ModuleContract) *DependencyGraph
BuildGraph constructs a dependency graph from module contracts.
func (*DependencyGraph) DependenciesOf ¶
func (g *DependencyGraph) DependenciesOf(module string) []string
DependenciesOf returns the direct dependencies of a module.
func (*DependencyGraph) TopologicalSort ¶
func (g *DependencyGraph) TopologicalSort() ([]string, error)
TopologicalSort returns modules in dependency order (dependencies first). Returns an error if the graph contains a cycle.
func (*DependencyGraph) TransitiveDependencies ¶
func (g *DependencyGraph) TransitiveDependencies(module string) []string
TransitiveDependencies returns all transitive dependencies of a module (not including itself).
func (*DependencyGraph) Validate ¶
func (g *DependencyGraph) Validate() []ValidationError
Validate checks that all dependencies are satisfiable:
- Every required service exists as a module
- Required capabilities are provided by the dependency
- No cycles exist in the graph
type IdentityConfig ¶
type IdentityConfig struct {
// AdminEmail is the primary admin user email.
AdminEmail string
// AdminPassword is the generated admin password (plaintext, for initial setup only).
AdminPassword string
// PocketIDEnabled indicates whether PocketID OIDC provider is enabled.
PocketIDEnabled bool
// TinyAuthEnabled indicates whether TinyAuth ForwardAuth is enabled.
TinyAuthEnabled bool
// OIDCIssuerURL is the PocketID issuer URL (e.g., https://id.example.com).
OIDCIssuerURL string
// OIDCClientID is the generated OAuth2 client ID for TinyAuth→PocketID.
OIDCClientID string
// OIDCClientSecret is the generated OAuth2 client secret for TinyAuth→PocketID.
OIDCClientSecret string
// TinyAuthOAuthEnabled indicates TinyAuth should use PocketID as OAuth provider.
TinyAuthOAuthEnabled bool
// TinyAuthSessionSecret is a random secret for TinyAuth cookie signing.
TinyAuthSessionSecret string
// PocketIDAppURL is the external URL of the PocketID instance.
PocketIDAppURL string
// SecureCookie is resolved from context (local=false, cloud=true).
SecureCookie bool
// AuthMode is the TinyAuth authentication mode.
AuthMode string
}
IdentityConfig holds the resolved identity stack configuration.
type IdentityMetadata ¶
type IdentityMetadata struct {
PocketIDEnabled bool `json:"pocketIdEnabled"`
TinyAuthEnabled bool `json:"tinyAuthEnabled"`
TinyAuthOAuthEnabled bool `json:"tinyAuthOAuthEnabled"`
AuthMode string `json:"authMode,omitempty"`
OIDCIssuerURL string `json:"oidcIssuerUrl,omitempty"`
SecureCookie bool `json:"secureCookie"`
}
type Metadata ¶
type Metadata struct {
SchemaVersion string `json:"schemaVersion"`
StackKit string `json:"stackkit,omitempty"`
InstallMode string `json:"installMode,omitempty"`
PlacementMode string `json:"placementMode,omitempty"`
EnabledModules []string `json:"enabledModules,omitempty"`
Warnings []string `json:"warnings,omitempty"`
ApplicationHandoffs []ControlPlaneHandoff `json:"applicationHandoffs,omitempty"`
Identity *IdentityMetadata `json:"identity,omitempty"`
Placement any `json:"placement,omitempty"`
GeneratedArtifact string `json:"generatedArtifact"`
ManagedBy string `json:"managedBy"`
RuntimeDecisionPath string `json:"runtimeDecisionPath"`
ContainsSecretValues bool `json:"containsSecretValues"`
}
Metadata is the non-secret composition evidence emitted alongside generated tfvars. It deliberately excludes passwords, tokens, and file-backed keys.
func BuildMetadata ¶
func BuildMetadata(spec *models.StackSpec, cr *CompositionResult) Metadata
type ValidationError ¶
ValidationError describes a dependency validation failure.
func (ValidationError) Error ¶
func (e ValidationError) Error() string