diff

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDatabaseSpecs

func LoadDatabaseSpecs(ctx context.Context, db *gorm.DB) (map[string]JobSpec, error)

LoadDatabaseSpecs loads all jobs from the database into specs keyed by alias.

func LoadDefinitions

func LoadDefinitions(paths []string) (map[string]JobSpec, error)

LoadDefinitions walks the provided paths collecting job definitions.

Types

type CallbackSpec

type CallbackSpec struct {
	Type          string         `json:"type"`
	Configuration map[string]any `json:"configuration"`
}

type Diff

type Diff struct {
	Creates []JobSpec
	Updates []Update
	Deletes []JobSpec
}

Diff captures the comparison between desired and existing specs.

func Compare

func Compare(desired, actual map[string]JobSpec) Diff

Compare generates a diff between desired and actual job specs.

func (Diff) Empty

func (d Diff) Empty() bool

Empty reports whether the diff contains no changes.

type JobSpec

type JobSpec struct {
	Alias       string            `json:"alias"`
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
	// Remediation participates in diffing because it is ENFORCED policy, not
	// documentation: it is what resolves the agent's effective playbook. A
	// remediation-only change that rendered as "no changes" would let an approver
	// wave through a policy edit believing nothing changed — and the same diff is
	// what an ApprovalRequest shows a human.
	Remediation *schema.MetadataRemediation `json:"remediation,omitempty"`
	Trigger     TriggerSpec                 `json:"trigger"`
	Callbacks   []CallbackSpec              `json:"callbacks"`
	Steps       []StepSpec                  `json:"steps"`
}

JobSpec captures the fields that participate in diffing.

func FromDefinition

func FromDefinition(def *schema.Definition) JobSpec

FromDefinition normalises a job definition into a JobSpec.

type StepSpec

type StepSpec struct {
	Engine       string         `json:"engine"`
	Image        string         `json:"image"`
	Command      []string       `json:"command"`
	OutputSchema map[string]any `json:"outputSchema"`
}

type TriggerSpec

type TriggerSpec struct {
	Type          string         `json:"type"`
	Configuration map[string]any `json:"configuration"`
}

type Update

type Update struct {
	Alias string `json:"alias"`
	Diff  string `json:"diff"`
}

Update captures the differences for an existing job.

Jump to

Keyboard shortcuts

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