Documentation
¶
Overview ¶
Package component provides the Reconcilable provider for workspace components.
Part of ADR-060 Phase 1: report-only drift detection.
The provider detects drift between the declared component registry (.cog/conf/components.cog.md) and live on-disk state (indexed blobs). Phase 1 is report-only — ApplyPlan prints what it would do but does not execute destructive actions.
Extracted from apps/cogos root in Wave 1a of ADR-085 (subpackage decomposition). The component registry/indexer types and helpers still live in the main package; this package reaches them through the DI function variables declared below. The main package wires them in an init() hook (see apps/cogos/component_wiring.go).
Index ¶
- Variables
- func SetWorkspaceRoot(root string)
- type Blob
- type ComponentProvider
- func (c *ComponentProvider) ApplyPlan(ctx context.Context, plan *reconcile.Plan) ([]reconcile.Result, error)
- func (c *ComponentProvider) BuildState(config any, live any, existing *reconcile.State) (*reconcile.State, error)
- func (c *ComponentProvider) ComputePlan(config any, live any, state *reconcile.State) (*reconcile.Plan, error)
- func (c *ComponentProvider) FetchLive(ctx context.Context, config any) (any, error)
- func (c *ComponentProvider) Health() reconcile.ResourceStatus
- func (c *ComponentProvider) LoadConfig(root string) (any, error)
- func (c *ComponentProvider) Type() string
- type ReconcilerConfig
- type Registry
- type RegistryDecl
Constants ¶
This section is empty.
Variables ¶
var ( // LoadRegistry loads and returns the declared component registry. LoadRegistry func(root string) (*Registry, error) // IndexComponentPaths runs the indexer and returns the list of known // component paths (keys of the Merkle index). IndexComponentPaths func(root string) ([]string, error) // LoadBlob loads a single indexed blob for the given component path. LoadBlob func(root, path string) (*Blob, error) // EncodePath produces the stable reconcile address fragment for a // component path. EncodePath func(path string) string // NowISO returns the current timestamp in ISO-8601 form. NowISO func() string )
Functions ¶
func SetWorkspaceRoot ¶ added in v0.4.0
func SetWorkspaceRoot(root string)
SetWorkspaceRoot injects the resolved workspace path into this package so that Health() can resolve the component config path without depending on workspace.ResolveWorkspace(). Called by engine.SetProvidersWorkspace immediately after LoadConfig resolves cfg.WorkspaceRoot.
Types ¶
type Blob ¶
type Blob struct {
Kind string
TreeHash string
CommitHash string
BlobHash string
Dirty bool
Language string
BuildSystem string
IndexedAt string
}
Blob is the structural view of a single indexed component blob.
type ComponentProvider ¶
type ComponentProvider struct {
// contains filtered or unexported fields
}
ComponentProvider implements reconcile.Reconcilable for workspace component management.
func (*ComponentProvider) ApplyPlan ¶
func (c *ComponentProvider) ApplyPlan(ctx context.Context, plan *reconcile.Plan) ([]reconcile.Result, error)
ApplyPlan is Phase 1: report-only. Prints what would be done but does not execute any destructive actions.
func (*ComponentProvider) BuildState ¶
func (c *ComponentProvider) BuildState(config any, live any, existing *reconcile.State) (*reconcile.State, error)
BuildState constructs reconcile state from live blobs.
func (*ComponentProvider) ComputePlan ¶
func (c *ComponentProvider) ComputePlan(config any, live any, state *reconcile.State) (*reconcile.Plan, error)
ComputePlan compares declared config (registry) against live state (blobs) and produces a reconciliation plan.
func (*ComponentProvider) FetchLive ¶
FetchLive runs the component indexer and loads individual blobs for comparison. Returns map[string]*Blob keyed by component path.
func (*ComponentProvider) Health ¶
func (c *ComponentProvider) Health() reconcile.ResourceStatus
Health returns the current three-axis status of the component subsystem.
func (*ComponentProvider) LoadConfig ¶
func (c *ComponentProvider) LoadConfig(root string) (any, error)
LoadConfig loads the component registry from .cog/conf/components.cog.md.
func (*ComponentProvider) Type ¶
func (c *ComponentProvider) Type() string
type ReconcilerConfig ¶
type ReconcilerConfig struct {
PruneUnregistered bool
}
ReconcilerConfig mirrors the reconciler sub-config the provider reads.
type Registry ¶
type Registry struct {
Reconciler ReconcilerConfig
Components map[string]RegistryDecl
}
Registry is the structural view of the component registry the provider needs. The concrete main-package ComponentRegistry is converted into this shape by LoadRegistry.
type RegistryDecl ¶
RegistryDecl describes a single declared component. Mirrors the fields component_provider.go reads from the main-package ComponentDecl type.