publisher

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Overview

Package publisher constructs immutable output plans and coordinates project rendering.

Package publisher owns application-level output publication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigReferencePresentation

func ConfigReferencePresentation(key string, model *ConfigReference, status string) (presentation.Document, error)

ConfigReferencePresentation maps the typed reference into Collection. The reference model remains project-owned; presentation owns only the grammar.

func IsLocalDocTemplate

func IsLocalDocTemplate(templateID string) bool

IsLocalDocTemplate is the bounded recognition policy outer composition passes to uninstall.

func NewFilesystemReader

func NewFilesystemReader(root string) outputplan.TreeReader

NewFilesystemReader opens the ordinary working-tree reader used by Publisher.

func ReplaceLocalDocumentBody added in v0.44.0

func ReplaceLocalDocumentBody(output []byte, body string) ([]byte, error)

ReplaceLocalDocumentBody replaces only the adopter-owned body of a rendered configured local document. The marker recognition and framing policy stay with the same boundary owner used by ordinary in-place readback.

Types

type Change

type Change struct {
	Path  string
	Cause string
}

Change records a sync-written file whose rendered bytes differ from the prior lock's or whose required mode was corrected, with the cause the lock's hashes able to attribute: "template", "config", "template+config", "internal", "regenerated", or "added".

type ConfigKeyRow

type ConfigKeyRow struct {
	Path, Type, Default, Description, Availability, Current string
}

ConfigKeyRow renders one config.yaml key or sidecar field in the config reference: a `configKeys` row always carries a resolved Current value, a `sidecarFields` row never does (there is no project-relative live value for a sidecar's own field), and the static catalog-only model leaves Current empty on every row.

type ConfigReference

type ConfigReference struct {
	ConfigKeys    []ConfigKeyRow
	VarEntries    []VarRow
	SidecarFields []ConfigKeyRow
	DataKeys      []DataKeyRow
}

ConfigReference is the typed presentation model for `awf config`: the four dedicated collections PrintConfigReference renders, produced either with live project state (ConfigReferenceModel) or catalog-only (StaticConfigReference). It is the typed counterpart to the map[string]any shape configReferenceData still builds for the doc generator - a renamed field here is a compile error, never a silently empty render.

func StaticConfigReference

func StaticConfigReference() (ConfigReference, error)

StaticConfigReference projects configspec (plus catalog-wide potential consumers) into the same typed collections the live model uses, minus live project state - the pre-adoption fallback `awf config` prints outside an adopted tree.

type DataKeyRow

type DataKeyRow struct {
	Artifact, Key, Description, State string
}

DataKeyRow renders one per-artifact data key. State reports its observable catalog/project layering state.

type InitAuthority

type InitAuthority struct{ InitializedWithVersion string }

InitAuthority is the explicit provenance supplied only by first adoption.

type Layout

type Layout struct {
	DocsDir    string
	Docs       map[string]string // catalog name -> output path (inv: layout-docs-full-catalog)
	Singletons map[string]string // template key -> output path
	DomainsDir string
}

Layout is the fixed, awf-given docs layout in typed form for Go consumers. These paths are not configurable through the project tree. templateMap projects it into the .layout template namespace (templates read a map, not unexported struct fields) and into the per-file ConfigHash. The mandatory-singleton paths are not struct fields: they derive from the catalog doc collection in templateMap (ADR-0061).

type OutputInput

type OutputInput struct {
	Path string
	Role outputplan.ArtifactRole
}

OutputInput records one semantic input consumed by a declared output.

type OutputNode

type OutputNode struct {
	Path                string
	Recipe              OutputRecipe
	Policy              outputplan.Policy
	Declarers           []string
	DeclarerProjections []string
	DependsOn           []string
	ConsumedInputs      []OutputInput
	ObservedTemplateID  string
	// contains filtered or unexported fields
}

OutputNode is one path in the deterministic internal output plan.

type OutputPlan

type OutputPlan struct {
	Nodes []OutputNode
}

OutputPlan is the single desired-output authority consumed by rendering, sync, manifest/prune, checks, and planned-output reporting.

type OutputRecipe

type OutputRecipe struct {
	TemplateID, TemplateHash, ConfigHash string
	Policy                               outputplan.Policy
}

OutputRecipe is the normalized, output-affecting declaration used for collision diagnostics and configuration hashes. Target identity is kept on OutputNode declarers rather than here, so compatible shared outputs coalesce.

type ProjectSession added in v0.46.0

type ProjectSession interface {
	Root() string
	Roots() resident.Roots
	Config() *config.Config
	Reader() outputplan.TreeReader
	Catalog() *catalog.Catalog
	Targets() []artifactregistry.Target
}

ProjectSession is the read-only project selection consumed by Publisher. The concrete authority owner is project.Session.

type Publisher

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

Publisher is the sole output-plan construction and rendering coordinator. One Publisher is one immutable operation: all readers share its one derived universe, and publication may be attempted only once.

func New

func New(session ProjectSession, version string) *Publisher

New composes a Publisher from one authoritative project Session.

func (*Publisher) BuildConfigReference

func (p *Publisher) BuildConfigReference() (ConfigReference, error)

BuildConfigReference derives the live configuration reference from this operation's files.

func (*Publisher) GeneratedOutput added in v0.46.0

func (p *Publisher) GeneratedOutput() (generatedcheck.AdditionalInput, error)

GeneratedOutput returns the operation's frozen generated-output input.

func (*Publisher) Glossary added in v0.46.0

func (p *Publisher) Glossary() (glossarycheck.Input, error)

Glossary returns the operation's frozen glossary input.

func (*Publisher) InitCollisions

func (p *Publisher) InitCollisions() ([]string, error)

InitCollisions uses the path-only definition projection. In particular it must remain safe before init prompts: probing a foreign path is not an authoritative render pass and never executes a template.

func (*Publisher) InitCollisionsAt added in v0.46.0

func (p *Publisher) InitCollisionsAt(root string) ([]string, error)

InitCollisionsAt probes only the supplied filesystem paths. It intentionally builds definitions, not an operation plan, so initialization can refuse a foreign file before prompting or executing a render closure.

func (*Publisher) Initialize added in v0.41.0

func (p *Publisher) Initialize(seed InitAuthority) (Result, error)

Initialize derives and publishes a first adoption through one ordered publication.

func (*Publisher) InitializeLeased added in v0.41.0

func (p *Publisher) InitializeLeased(ctx context.Context, lease *filesystem.Lease, seed InitAuthority) (Result, error)

InitializeLeased derives and publishes first-adoption output under the operation's pre-authority lease.

func (*Publisher) Pitfalls added in v0.46.0

func (p *Publisher) Pitfalls() (pitfall.Corpus, error)

Pitfalls returns the operation's frozen pitfall corpus. These narrow accessors share Plan's cached derivation rather than starting a second planning pass.

func (*Publisher) Plan

func (p *Publisher) Plan() (outputplan.Plan, error)

Plan returns the one immutable desired-output plan for this operation.

func (*Publisher) PreflightLocalDoc

func (p *Publisher) PreflightLocalDoc(doc config.LocalDoc) error

PreflightLocalDoc validates one candidate against the complete output inventory.

func (*Publisher) PreflightSyncLeased added in v0.50.0

func (p *Publisher) PreflightSyncLeased(ctx context.Context, lease *filesystem.Lease) error

PreflightSyncLeased completely validates ordinary publication against the current filesystem without applying any planned mutation.

func (*Publisher) ResidentMarker added in v0.46.0

func (p *Publisher) ResidentMarker(name string) (outputplan.Output, error)

ResidentMarker selects a resident marker from this operation's one plan.

func (*Publisher) SyncLeased added in v0.41.0

func (p *Publisher) SyncLeased(ctx context.Context, lease *filesystem.Lease) (Result, error)

SyncLeased derives and publishes under a lease acquired before mutable authority loading by the operation owner.

func (*Publisher) SyncUpgradeLeased added in v0.50.0

func (p *Publisher) SyncUpgradeLeased(ctx context.Context, lease *filesystem.Lease, floor int) (Result, error)

SyncUpgradeLeased publishes a supported live-schema migration without an intermediate lock write. Publisher consumes the old lock's ownership inventory and writes the complete current lock last.

type RenderedFile

type RenderedFile struct {
	Path         string
	Content      string
	TemplateID   string
	TemplateHash string
	ConfigHash   string
	// RegenChecked excludes this file from the frozen-OutputHash compare; its
	// drift is checked by regeneration instead (ADR-0100). Set on the generated
	// indexes and on any file carrying an in-place-editable section.
	RegenChecked bool
	// Policy declares all lifecycle checks for this path. It replaces
	// template-name and filename inference at plan consumers.
	Policy outputplan.Policy
	// Declarer identifies the producer requesting this output.
	Declarer           string
	DeclarerProjection string

	// ConsumedInputs records provenance at the render seam. Definitions own
	// output identity and dependencies; observed inputs stay coupled to the
	// closure that actually consumed them.
	ConsumedInputs     []OutputInput
	ObservedTemplateID string
	// contains filtered or unexported fields
}

type Result

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

Result records successful output changes and removals, including those made before a later mutation failed.

func (Result) Changes

func (r Result) Changes() []Change

func (Result) FailureMutation added in v0.50.0

func (r Result) FailureMutation() (presentation.Mutation, error)

FailureMutation projects every successfully touched path for a caller that must report an incomplete publication without implying rollback state.

func (Result) Mutation

func (r Result) Mutation() (presentation.Mutation, error)

Mutation maps this semantic result to the central presentation grammar.

func (Result) Pruned

func (r Result) Pruned() []string

func (Result) Touched added in v0.50.0

func (r Result) Touched() []string

type VarRow

type VarRow struct {
	Key, Description, Availability, State, Consumers string
}

VarRow renders one catalog var. State is the three-way live var state (set, empty, absent); it is empty in the static catalog-only model.

Jump to

Keyboard shortcuts

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