plan

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpFrontmatterSet   = "frontmatter_set"
	OpFrontmatterUnset = "frontmatter_unset"
	OpFrontmatterMerge = "frontmatter_merge"
	OpGeneratedRegion  = "generated_region_render"
	OpNoteCreate       = "note_create"
)

Variables

Functions

This section is empty.

Types

type ApplyResult

type ApplyResult struct {
	PlanDescription     string     `json:"plan_description"`
	OperationsTotal     int        `json:"operations_total"`
	OperationsCompleted int        `json:"operations_completed"`
	Operations          []OpResult `json:"operations"`
	Committed           bool       `json:"committed"`
	CommitSHA           string     `json:"commit_sha,omitempty"`
}

type Executor

type Executor struct {
	VaultPath string
	Detector  git.RepoStateDetector
	Checker   *git.PolicyChecker
	Committer *git.Committer
	Registry  *schema.Registry
	Config    *vault.Config
}

Executor orchestrates plan execution: validate, git policy check, execute ops in order, rollback on failure, optional batch commit.

func (*Executor) Apply

func (e *Executor) Apply(p Plan, dryRun, diff, commit bool) (*ApplyResult, error)

Apply executes a plan: validate → git policy → execute ops → rollback on failure → optional commit.

type OpError

type OpError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

func ValidatePlan

func ValidatePlan(p Plan, reg *schema.Registry) []OpError

ValidatePlan checks a Plan for structural validity against the type registry. It returns a slice of OpErrors describing every problem found. An empty slice means the plan is valid.

type OpResult

type OpResult struct {
	Op        string   `json:"op"`
	Target    string   `json:"target,omitempty"`
	Path      string   `json:"path,omitempty"`
	ID        string   `json:"id,omitempty"`
	Status    string   `json:"status"`
	WriteHash string   `json:"write_hash,omitempty"`
	Error     *OpError `json:"error,omitempty"`
}

func CreateNote

func CreateNote(vaultPath string, op Operation) (*OpResult, error)

type Operation

type Operation struct {
	Op          string                 `json:"op"`
	Target      string                 `json:"target,omitempty"`
	Key         string                 `json:"key,omitempty"`
	Value       interface{}            `json:"value,omitempty"`
	Fields      map[string]interface{} `json:"fields,omitempty"`
	SectionKey  string                 `json:"section_key,omitempty"`
	Template    string                 `json:"template,omitempty"`
	Path        string                 `json:"path,omitempty"`
	Type        string                 `json:"type,omitempty"`
	Frontmatter map[string]interface{} `json:"frontmatter,omitempty"`
	Body        string                 `json:"body,omitempty"`
}

type Plan

type Plan struct {
	Version     int         `json:"version"`
	Description string      `json:"description"`
	Operations  []Operation `json:"operations"`
}

Jump to

Keyboard shortcuts

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