Documentation
¶
Overview ¶
Package publisher constructs immutable output plans and coordinates project rendering.
Package publisher owns application-level output publication.
Index ¶
- Constants
- func ConfigReferencePresentation(key string, model *ConfigReference, status string) (presentation.Document, error)
- func IsLocalDocTemplate(templateID string) bool
- type AgentDialect
- type ArtifactRole
- type Backup
- type Capability
- type Change
- type ConfigKeyRow
- type ConfigReference
- type ContextPreparation
- type DataKeyRow
- type Effect
- type InitAuthority
- type Layout
- type OutputDeclaration
- type OutputInput
- type OutputNode
- type OutputPlan
- type OutputPolicy
- type OutputRecipe
- type PartialError
- type Preparation
- func (p Preparation) ADRs() adr.Corpus
- func (p Preparation) EffectiveSkills() map[string]bool
- func (p Preparation) GeneratedOutput() generatedcheck.AdditionalInput
- func (p Preparation) InitCollisions() ([]string, error)
- func (p Preparation) Pitfalls() pitfall.Corpus
- func (p Preparation) Plan() outputplan.Plan
- func (p Preparation) Plans() []plan.Plan
- func (p Preparation) PlansError() error
- func (p Preparation) ResidentMarker(name string) (outputplan.Output, error)
- func (p Preparation) Topics() topic.Corpus
- func (p Preparation) Vocabulary() vocabularycheck.Input
- type ProjectTreeReader
- type Publisher
- func (p *Publisher) BuildConfigReference() (ConfigReference, error)
- func (p *Publisher) InitCollisions() ([]string, error)
- func (p *Publisher) Initialize(seed InitAuthority) (Result, error)
- func (p *Publisher) InitializeLeased(ctx context.Context, lease *filesystem.Lease, seed InitAuthority) (Result, error)
- func (p *Publisher) Plan() (outputplan.Plan, error)
- func (p *Publisher) PreflightLocalDoc(doc config.LocalDoc) error
- func (p *Publisher) Prepare() (Preparation, error)
- func (p *Publisher) PrepareContext() (ContextPreparation, error)
- func (p *Publisher) SyncLeased(ctx context.Context, lease *filesystem.Lease) (Result, error)
- type RenderedFile
- type Result
- func (r Result) Backups() []Backup
- func (r Result) Changes() []Change
- func (r Result) Effects() []Effect
- func (r Result) HasCommittedEffects() bool
- func (r Result) Mutation() (presentation.Mutation, error)
- func (r Result) PartialMutation() (presentation.Mutation, error)
- func (r Result) Pruned() []string
- type Target
- type TargetOutput
- type TargetOutputInput
- type TargetOutputProducer
- type VarRow
Constants ¶
const ( // ArtifactConfig identifies an authored configuration input. ArtifactConfig = outputplan.ArtifactConfig // ArtifactLock identifies the managed project lock. ArtifactLock = outputplan.ArtifactLock // ArtifactManifest identifies manifest authority. ArtifactManifest = outputplan.ArtifactManifest // ArtifactTemplate identifies an embedded template input. ArtifactTemplate = outputplan.ArtifactTemplate // ArtifactConventionPart identifies an authored convention part. ArtifactConventionPart = outputplan.ArtifactConventionPart // ArtifactAuthoredData identifies authored sidecar data. ArtifactAuthoredData = outputplan.ArtifactAuthoredData // ArtifactTopicMetadata identifies authored topic metadata. ArtifactTopicMetadata = outputplan.ArtifactTopicMetadata // ArtifactClaimPart identifies an authored current-state claim part. ArtifactClaimPart = outputplan.ArtifactClaimPart // ArtifactDecisionRecord identifies an architecture decision record. ArtifactDecisionRecord = outputplan.ArtifactDecisionRecord // ArtifactManagedOutput identifies an existing managed output input. ArtifactManagedOutput = outputplan.ArtifactManagedOutput // ArtifactProtocolDescriptor identifies a runtime protocol descriptor. ArtifactProtocolDescriptor = outputplan.ArtifactProtocolDescriptor )
const ( // MarkdownAgentDialect preserves the Markdown target-dialect compatibility value. MarkdownAgentDialect = projectstate.MarkdownAgentDialect // PlainAgentDialect preserves the plain-text target-dialect compatibility value. PlainAgentDialect = projectstate.PlainAgentDialect )
const ( // CapabilitySubagentTools preserves the subagent-tools capability value. CapabilitySubagentTools = projectstate.CapabilitySubagentTools // CapabilitySessionHandoff preserves the session-handoff capability value. CapabilitySessionHandoff = projectstate.CapabilitySessionHandoff // CapabilityEffortSessions preserves the effort-sessions capability value. CapabilityEffortSessions = projectstate.CapabilityEffortSessions )
const TargetOutputTemplate = projectstate.TargetOutputTemplate
TargetOutputTemplate preserves the template-producer compatibility value.
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 ¶
IsLocalDocTemplate is the bounded recognition policy outer composition passes to uninstall.
Types ¶
type AgentDialect ¶
type AgentDialect = projectstate.AgentDialect
AgentDialect preserves the project package's target-dialect compatibility name.
type ArtifactRole ¶
type ArtifactRole = outputplan.ArtifactRole
ArtifactRole preserves the project package's declaration-role compatibility name.
type Backup ¶
type Backup struct {
Path string // project-relative file that was overwritten
Bak string // project-relative backup copy (.awf-bak[.N])
Index bool // the file is the generated ADR/domain index (ownership-takeover note)
}
Backup records a foreign file preserved before sync overwrote its path.
type Capability ¶
type Capability = projectstate.Capability
Capability preserves the project package's target-capability compatibility name.
type Change ¶
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" (the upstream template source moved), "config" (the project's effective inputs - vars, sidecar, parts - moved), "template+config" (both), "internal" (hashes unmoved: a non-hashed input such as the binary's version stamp), "regenerated" (a generated index, which carries no hashes to attribute), or "added" (no prior entry). The provenance triage signal for reviewing a large sync diff - upstream churn vs the project's own inputs.
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 ContextPreparation ¶ added in v0.41.0
type ContextPreparation struct {
// contains filtered or unexported fields
}
ContextPreparation is Publisher's focused semantic and declaration projection for ordinary context. It intentionally has no rendered output nodes or check projections.
func (ContextPreparation) ADRs ¶ added in v0.41.0
func (p ContextPreparation) ADRs() adr.Corpus
ADRs returns a defensive ADR corpus.
func (ContextPreparation) Declarations ¶ added in v0.41.0
func (p ContextPreparation) Declarations() []outputplan.Declaration
Declarations returns defensive output declarations without an output plan.
func (ContextPreparation) Plans ¶ added in v0.41.0
func (p ContextPreparation) Plans() []plan.Plan
Plans returns a defensive parsed-plan projection.
func (ContextPreparation) Topics ¶ added in v0.41.0
func (p ContextPreparation) Topics() topic.Corpus
Topics returns a defensive topic corpus.
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 Effect ¶ added in v0.41.0
Effect is one committed filesystem fact and its stable retry or recovery action.
type InitAuthority ¶
type InitAuthority struct{ InitializedWithVersion string }
InitAuthority is the explicit provenance supplied only by first adoption.
type Layout ¶
type Layout struct {
DocsDir string
ADRDir string
IndexMd string
PlansDir 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 OutputDeclaration ¶
type OutputDeclaration struct {
Path string
TemplateID string
Declarers []string
Inputs []OutputInput
Dependencies []string
}
OutputDeclaration records one deterministic declared output and its inputs.
type OutputInput ¶
type OutputInput struct {
Path string
Role ArtifactRole
}
OutputInput records one semantic input consumed by a declared output.
type OutputNode ¶
type OutputNode struct {
Path string
Recipe OutputRecipe
Policy OutputPolicy
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
Declarations []OutputDeclaration
}
OutputPlan is the single desired-output authority consumed by rendering, sync, manifest/prune, checks, and planned-output reporting.
type OutputPolicy ¶
type OutputPolicy = outputplan.Policy
OutputPolicy preserves the project package's output-policy compatibility name.
type OutputRecipe ¶
type OutputRecipe struct {
TemplateID, TemplateHash, ConfigHash string
Policy OutputPolicy
Encoder AgentDialect
Provenance string
}
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 PartialError ¶ added in v0.41.0
PartialError reports a failed publication after one or more committed effects.
func (*PartialError) Error ¶ added in v0.41.0
func (e *PartialError) Error() string
func (*PartialError) Unwrap ¶ added in v0.41.0
func (e *PartialError) Unwrap() error
type Preparation ¶
type Preparation struct {
// contains filtered or unexported fields
}
Preparation is one Publisher-owned derivation and its direct semantic projections for residual consumers.
func (Preparation) ADRs ¶
func (p Preparation) ADRs() adr.Corpus
ADRs returns a defensive ADR corpus derived from the selected operation tree.
func (Preparation) EffectiveSkills ¶
func (p Preparation) EffectiveSkills() map[string]bool
EffectiveSkills returns a defensive projection of the operation's effective skills.
func (Preparation) GeneratedOutput ¶
func (p Preparation) GeneratedOutput() generatedcheck.AdditionalInput
GeneratedOutput returns a defensive prepared projection for generated-output checks.
func (Preparation) InitCollisions ¶
func (p Preparation) InitCollisions() ([]string, error)
InitCollisions reports unmanaged paths in this exact prepared universe that already exist at the tracked root.
func (Preparation) Pitfalls ¶
func (p Preparation) Pitfalls() pitfall.Corpus
Pitfalls returns a defensive pitfall corpus derived from the selected operation tree.
func (Preparation) Plan ¶
func (p Preparation) Plan() outputplan.Plan
Plan returns the one immutable plan constructed for this operation.
func (Preparation) Plans ¶
func (p Preparation) Plans() []plan.Plan
Plans returns a defensive projection of the operation's parsed plans.
func (Preparation) PlansError ¶
func (p Preparation) PlansError() error
PlansError returns diagnostics or another error from parsing the selected plans.
func (Preparation) ResidentMarker ¶
func (p Preparation) ResidentMarker(name string) (outputplan.Output, error)
ResidentMarker selects the marker from this preparation's existing plan.
func (Preparation) Topics ¶
func (p Preparation) Topics() topic.Corpus
Topics returns a defensive topic corpus derived from the selected operation tree.
func (Preparation) Vocabulary ¶
func (p Preparation) Vocabulary() vocabularycheck.Input
Vocabulary returns a defensive prepared vocabulary projection.
type ProjectTreeReader ¶
type ProjectTreeReader = outputplan.TreeReader
ProjectTreeReader preserves the concise producer-internal name for the neutral operation tree reader.
func NewFilesystemReader ¶
func NewFilesystemReader(root string) ProjectTreeReader
NewFilesystemReader opens the ordinary working-tree reader used by Publisher.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is the sole output-plan construction and rendering coordinator.
func New ¶
func New(state *projectstate.ProjectState, cfg *config.Config, read ProjectTreeReader, version string) *Publisher
New composes a Publisher from immutable loaded facts and an explicit operation tree reader.
func (*Publisher) BuildConfigReference ¶
func (p *Publisher) BuildConfigReference() (ConfigReference, error)
BuildConfigReference derives the live configuration reference from this operation's plan.
func (*Publisher) InitCollisions ¶
InitCollisions reports unmanaged planned paths that already exist at the tracked root.
func (*Publisher) Initialize ¶ added in v0.41.0
func (p *Publisher) Initialize(seed InitAuthority) (Result, error)
Initialize derives and publishes a first adoption in one transaction.
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. Preparation intentionally has no mutator.
func (*Publisher) Plan ¶
func (p *Publisher) Plan() (outputplan.Plan, error)
Plan derives exactly one immutable plan for this operation.
func (*Publisher) PreflightLocalDoc ¶
PreflightLocalDoc validates one candidate against the complete output inventory.
func (*Publisher) Prepare ¶
func (p *Publisher) Prepare() (Preparation, error)
Prepare derives one operation universe and constructs exactly one immutable plan.
func (*Publisher) PrepareContext ¶ added in v0.41.0
func (p *Publisher) PrepareContext() (ContextPreparation, error)
PrepareContext derives only the semantic and declaration facts ordinary context needs. It deliberately does not construct rendered nodes or check projections.
func (*Publisher) SyncLeased ¶ added in v0.41.0
SyncLeased derives and publishes under a lease acquired before mutable authority loading by the operation owner.
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 OutputPolicy
// Declarer identifies the producer requesting this output.
Declarer string
DeclarerProjection string
Encoder AgentDialect
Provenance render.CommentStyle
// ConsumedInputs is observed at the render seam, independently of
// buildOutputDeclarations: the context artifact report reads the observed
// set, so a declaration omission or role mistake shows there rather than
// being papered over by the declaration it was derived from.
ConsumedInputs []OutputInput
ObservedTemplateID string
// contains filtered or unexported fields
}
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result records only mutations committed before the terminal outcome.
func (Result) HasCommittedEffects ¶ added in v0.41.0
HasCommittedEffects reports whether publication crossed a mutation boundary. It lets a composing operation retain Publisher's owner-rendered partial outcome without depending on Publisher's concrete effect representation.
func (Result) Mutation ¶
func (r Result) Mutation() (presentation.Mutation, error)
Mutation maps this semantic result to the central presentation grammar.
func (Result) PartialMutation ¶ added in v0.41.0
func (r Result) PartialMutation() (presentation.Mutation, error)
PartialMutation presents every committed effect and its recovery action.
type Target ¶
type Target = projectstate.Target
Target preserves the project package's resolved-target compatibility name.
type TargetOutput ¶
type TargetOutput = projectstate.TargetOutput
TargetOutput preserves the project package's target-output compatibility name.
type TargetOutputInput ¶
type TargetOutputInput = projectstate.TargetOutputInput
TargetOutputInput preserves the project package's target-input compatibility name.
type TargetOutputProducer ¶
type TargetOutputProducer = projectstate.TargetOutputProducer
TargetOutputProducer preserves the project package's producer compatibility name.