unified

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

unified/bundle.go

unified/oci.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundleDigest

func BundleDigest(bundle *Bundle) (string, error)

BundleDigest returns the digest of the serializable release content.

func SaveBundle

func SaveBundle(bundle *Bundle, filePath string) error

SaveBundle saves a bundle to disk

Types

type Bundle

type Bundle struct {
	Name          string            `json:"name"`
	Version       string            `json:"version"`
	Description   string            `json:"description"`
	VerbHash      string            `json:"verb_hash"`
	CreatedAt     time.Time         `json:"created_at"`
	SchemaFiles   []string          `json:"schema_files"`
	VerbFiles     []string          `json:"verb_files"`
	RuleFiles     []string          `json:"rule_files"`
	ListSpec      *list.Spec        `json:"-"`
	FlowSpec      *fl.Spec          `json:"-"`
	Rules         []RuleSummary     `json:"rules,omitempty"`
	Flows         []FlowSummary     `json:"flows,omitempty"`
	RuleSources   []RuleSource      `json:"rule_sources,omitempty"`
	FactTypes     []FactTypeSummary `json:"fact_types,omitempty"`
	VerbSpecs     []VerbSpecSummary `json:"verb_specs,omitempty"`
	RequiredFacts []string          `json:"required_facts"`
	PIIMasks      []string          `json:"pii_masks,omitempty"`
}

Bundle represents a compiled bundle of rules and schemas

func LoadBundle

func LoadBundle(filePath string) (*Bundle, error)

LoadBundle loads a bundle from disk

type BundleBuilder

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

BundleBuilder helps construct a bundle

func NewBundleBuilder

func NewBundleBuilder(name, version string) *BundleBuilder

NewBundleBuilder creates a new bundle builder

func (*BundleBuilder) Build

func (bb *BundleBuilder) Build() (*Bundle, error)

Build builds the bundle from the specified directories

func (*BundleBuilder) RegisterSchemaLoader

func (bb *BundleBuilder) RegisterSchemaLoader(loader interface{}) *BundleBuilder

RegisterSchemaLoader registers a loader for schema files

func (*BundleBuilder) SkipRuleCompilation

func (bb *BundleBuilder) SkipRuleCompilation() *BundleBuilder

SkipRuleCompilation skips the compilation of rules Useful for testing when rule compilation is not the focus

func (*BundleBuilder) WithDescription

func (bb *BundleBuilder) WithDescription(desc string) *BundleBuilder

WithDescription sets the bundle description

func (*BundleBuilder) WithPIIMasks

func (bb *BundleBuilder) WithPIIMasks(masks []string) *BundleBuilder

WithPIIMasks sets the PII masking paths

func (*BundleBuilder) WithRulesDir

func (bb *BundleBuilder) WithRulesDir(dir string) *BundleBuilder

WithRulesDir specifies the directory for rule files

func (*BundleBuilder) WithSchemaDir

func (bb *BundleBuilder) WithSchemaDir(dir string) *BundleBuilder

WithSchemaDir specifies the directory for schema files

func (*BundleBuilder) WithVerbDir

func (bb *BundleBuilder) WithVerbDir(dir string) *BundleBuilder

WithVerbDir specifies the directory for verb files

func (*BundleBuilder) WithVerbSpecFiles

func (bb *BundleBuilder) WithVerbSpecFiles(paths []string) *BundleBuilder

WithVerbSpecFiles registers verb spec schema files for type checking.

type BundleRequirement

type BundleRequirement struct {
	Name          string         `json:"name"`
	Version       string         `json:"version"`
	Registry      string         `json:"registry,omitempty"`
	OCI           string         `json:"oci,omitempty"`
	File          string         `json:"file,omitempty"`
	Checksum      string         `json:"checksum,omitempty"`
	Optional      bool           `json:"optional,omitempty"`
	Compatibility *Compatibility `json:"compatibility,omitempty"`
}

BundleRequirement describes a bundle dependency.

type Compatibility

type Compatibility struct {
	Effectus string            `json:"effectus,omitempty"`
	Bundles  map[string]string `json:"bundles,omitempty"`
}

Compatibility describes compatibility constraints for a bundle.

type ExtensionManifest

type ExtensionManifest struct {
	Name        string              `json:"name"`
	Version     string              `json:"version"`
	Description string              `json:"description,omitempty"`
	Effectus    string              `json:"effectus,omitempty"`
	Registries  []RegistryConfig    `json:"registries,omitempty"`
	Bundles     []BundleRequirement `json:"bundles"`
}

ExtensionManifest describes a set of bundle dependencies.

func LoadExtensionManifest

func LoadExtensionManifest(path string) (*ExtensionManifest, error)

LoadExtensionManifest loads a manifest from disk.

type FactTypeSummary

type FactTypeSummary struct {
	Path string `json:"path"`
	Type string `json:"type"`
}

FactTypeSummary describes a fact path and its inferred type.

func SummarizeFactTypes

func SummarizeFactTypes(ts *types.TypeSystem) []FactTypeSummary

SummarizeFactTypes returns a stable summary of registered fact paths and types.

type FlowSummary

type FlowSummary struct {
	Name       string   `json:"name"`
	Priority   int      `json:"priority"`
	Predicates []string `json:"predicates,omitempty"`
	FactPaths  []string `json:"fact_paths,omitempty"`
	Verbs      []string `json:"verbs,omitempty"`
}

FlowSummary summarizes a compiled flow.

func SummarizeFlows

func SummarizeFlows(spec *fl.Spec) []FlowSummary

SummarizeFlows returns a summary of flows suitable for JSON export.

type OCIBundlePuller

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

OCIBundlePuller handles pulling bundles from OCI registries

func NewOCIBundlePuller

func NewOCIBundlePuller(outputDir string) *OCIBundlePuller

NewOCIBundlePuller creates a new OCI bundle puller

func NewOCIBundlePullerWithPolicy

func NewOCIBundlePullerWithPolicy(outputDir string, verification loader.OCIVerificationPolicy) *OCIBundlePuller

func (*OCIBundlePuller) Pull

func (p *OCIBundlePuller) Pull(imageRef string) (*Bundle, error)

Pull pulls a bundle from an OCI registry

func (*OCIBundlePuller) PullWithData

func (p *OCIBundlePuller) PullWithData(imageRef string) (*Bundle, []byte, error)

PullWithData pulls a bundle and returns the raw bundle metadata bytes.

func (*OCIBundlePuller) PullWithDataContext

func (p *OCIBundlePuller) PullWithDataContext(ctx context.Context, imageRef string) (*Bundle, []byte, error)

type OCIBundlePusher

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

OCIBundlePusher handles pushing bundles to OCI registries

func NewOCIBundlePusher

func NewOCIBundlePusher(bundle *Bundle) *OCIBundlePusher

NewOCIBundlePusher creates a new OCI bundle pusher

func (*OCIBundlePusher) Push

func (p *OCIBundlePusher) Push(imageRef string) error

Push pushes the bundle to an OCI registry

func (*OCIBundlePusher) WithRulesDir

func (p *OCIBundlePusher) WithRulesDir(dir string) *OCIBundlePusher

WithRulesDir sets the rules directory

func (*OCIBundlePusher) WithSchemaDir

func (p *OCIBundlePusher) WithSchemaDir(dir string) *OCIBundlePusher

WithSchemaDir sets the schema directory

func (*OCIBundlePusher) WithVerbDir

func (p *OCIBundlePusher) WithVerbDir(dir string) *OCIBundlePusher

WithVerbDir sets the verb directory

type RegistryConfig

type RegistryConfig struct {
	Name    string `json:"name"`
	Base    string `json:"base"`
	Type    string `json:"type,omitempty"` // "oci" (default) or "file"
	Default bool   `json:"default,omitempty"`
}

RegistryConfig defines where bundles are resolved.

type ResolvedBundle

type ResolvedBundle struct {
	Name       string  `json:"name"`
	Version    string  `json:"version"`
	Source     string  `json:"source"`
	Location   string  `json:"location"`
	RootDir    string  `json:"root_dir"`
	BundlePath string  `json:"bundle_path"`
	Checksum   string  `json:"checksum"`
	Bundle     *Bundle `json:"-"`
}

ResolvedBundle describes a resolved bundle dependency.

func ResolveManifest

func ResolveManifest(manifest *ExtensionManifest, baseDir string, opts ResolverOptions) ([]ResolvedBundle, error)

ResolveManifest resolves bundles from a manifest.

func ResolveManifestFile

func ResolveManifestFile(path string, opts ResolverOptions) ([]ResolvedBundle, error)

ResolveManifestFile resolves bundles from a manifest on disk.

type ResolverOptions

type ResolverOptions struct {
	CacheDir        string
	DefaultRegistry string
	Registries      []RegistryConfig
	EngineVersion   string
	VerifyChecksum  bool
	AllowFile       bool
	AllowOCI        bool
}

ResolverOptions configures how bundle manifests are resolved.

type RuleEffectSummary

type RuleEffectSummary struct {
	Verb string                 `json:"verb"`
	Args map[string]interface{} `json:"args,omitempty"`
}

RuleEffectSummary summarizes a verb effect in a rule.

type RuleSource

type RuleSource struct {
	Path    string `json:"path"`
	Format  string `json:"format"`
	Content string `json:"content"`
}

RuleSource carries the original rule file content.

type RuleSummary

type RuleSummary struct {
	Name       string              `json:"name"`
	Priority   int                 `json:"priority"`
	Predicates []string            `json:"predicates,omitempty"`
	FactPaths  []string            `json:"fact_paths,omitempty"`
	Effects    []RuleEffectSummary `json:"effects,omitempty"`
}

RuleSummary summarizes a compiled list rule.

func SummarizeRules

func SummarizeRules(spec *list.Spec) []RuleSummary

SummarizeRules returns a summary of list rules suitable for JSON export.

type VerbSpecSummary

type VerbSpecSummary struct {
	Name         string            `json:"name"`
	Description  string            `json:"description,omitempty"`
	Capability   string            `json:"capability,omitempty"`
	InverseVerb  string            `json:"inverse,omitempty"`
	ArgTypes     map[string]string `json:"arg_types,omitempty"`
	RequiredArgs []string          `json:"required_args,omitempty"`
	ReturnType   string            `json:"return_type,omitempty"`
}

VerbSpecSummary captures the verb signature metadata for UI/status.

func SummarizeVerbSpecs

func SummarizeVerbSpecs(ts *types.TypeSystem) []VerbSpecSummary

SummarizeVerbSpecs returns a stable summary of registered verb specs.

Jump to

Keyboard shortcuts

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