project

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package project ties config, catalog, render, and manifest together to sync rendered files into a project and check them for drift.

Index

Constants

View Source
const BridgeTrancheComplete = true

BridgeTrancheComplete blocks publication while the two-plan current-state bridge tranche is only partially implemented. Plans 1 and 2 have both landed (migration readiness, attestation, and ordinary-command refusal are all present), so the tranche is complete and publication is unblocked.

View Source
const Version = "0.22.0"

Version is the awf release version - the single version authority (ADR-0049): gate comparisons, the lock stamp, the bootstrap pin, and the CLI output all read this const.

Variables

This section is empty.

Functions

func CatalogNames

func CatalogNames(cat *catalog.Catalog, singular string) ([]string, bool)

CatalogNames returns the catalog pool for a singular CLI kind; ok is false for a kind with no catalog pool (domains).

func CollisionsAt added in v0.6.0

func CollisionsAt(root string, planned []string) ([]string, error)

CollisionsAt filters planned project-relative paths to those that already exist under root and are not recorded in root's lock (not awf-managed). Split from InitCollisions so init's pre-prompt probe can plan outputs in a throwaway scaffold and test them against the real root; the ADR-0016 collision semantics are unchanged.

func DeriveDocTitle added in v0.15.0

func DeriveDocTitle(name string) string

DeriveDocTitle turns a local doc name into a display title: the last path segment, hyphens to spaces, each word capitalized, empty words (from a trailing or double hyphen) dropped. "guides/release-steps" → "Release Steps". awf new doc seeds the sidecar with it, and synthesis falls back to it when the sidecar omits data.title.

func EnabledNames

func EnabledNames(c *config.Config, singular string) ([]string, bool)

EnabledNames returns the config enable array for a singular CLI kind.

func HookNames added in v0.6.0

func HookNames() []string

HookNames returns the git-hook payload names the hooks singleton renders (ADR-0048), for CLI surfaces that enumerate them (the KnownTargets pattern).

func Kinds

func Kinds() []string

Kinds returns the singular CLI kind tokens in display order.

func KnownTargets added in v0.4.0

func KnownTargets() []string

KnownTargets returns the known adapter names in sorted order. The bespoke `awf {enable,disable,list} target` path validates against this set (inv: target-cli).

func NeededVars added in v0.13.0

func NeededVars(trim *config.CatalogTrim) (map[string]bool, error)

NeededVars returns the var names referenced by the templates the scaffolded enabled set will render: the enable arrays scaffoldSelection derives, the always-on singletons (agents-doc + plain), and the default-enabled hook payloads. Init's interactive path prompts only for these (ADR-0086 Decision 6); the scaffold still seeds the full catalog union as empty keys (ADR-0022 unchanged), and an explicit --set/answers value is honored regardless.

func NormalizeContextPaths added in v0.18.0

func NormalizeContextPaths(paths []string) []string

NormalizeContextPaths slash-normalizes, path-cleans, de-duplicates, and sorts the queried paths so the assembly is deterministic.

func PluralKind

func PluralKind(singular string) (string, bool)

PluralKind maps a singular CLI kind token to its config enable-array key.

func PotentialVarConsumers added in v0.14.0

func PotentialVarConsumers() (map[string][]string, error)

PotentialVarConsumers inverts the full catalog's raw template sources into var → sorted consumer labels: the dormant-hint side of the consumption graph (ADR-0088). Raw-source scanning is sound because no partial references .vars - guarded by a test beside the reference's goldens.

func ScaffoldConfig

func ScaffoldConfig(prefix string, vars map[string]string, trim *config.CatalogTrim, scopes []string) ([]byte, []string, error)

ScaffoldConfig generates the bytes of a .awf/config.yaml that enables the workflow-core skills and docs (ADR-0022) and every agent in the embedded catalog (as flat name arrays), and pre-populates the vars block with the union of all {{ .vars.X }} names referenced by every catalog template. Each var is seeded with an empty string so that strict render (missingkey=zero + <no value> check) does not fail on sync, and so a later `awf enable` of an opt-in skill renders cleanly. It also seeds the self-pinning bootstrap (ADR-0040), the git-hook payloads (ADR-0048), and the pure awf wrapper runner (ADR-0156) enabled by default, and writes a resolved commit-scope list to audit.allowedScopes (ADR-0051). The second return value lists the closure additions beyond a trim's explicit selection (kind-prefixed, e.g. "skill reviewing-plan-resync"), empty for the untrimmed default.

func ScaffoldVarRefs added in v0.14.0

func ScaffoldVarRefs(kind string) ([]string, error)

ScaffoldVarRefs returns the vars referenced by the base template a new local artifact of kind ("skill"/"agent") renders from - `awf new`'s seeding surface (ADR-0087 Decision 4). Parts are raw (ADR-0034), so the base template is a local artifact's only var channel; today both bases are varless and this returns empty, but a future base gaining a var reference is seeded correct by construction.

Types

type ADRArtifactContext added in v0.22.0

type ADRArtifactContext struct {
	Number        string                `json:"number"`
	Title         string                `json:"title"`
	Status        string                `json:"status"`
	Mutability    string                `json:"mutability"`
	AuthorityRole string                `json:"authorityRole"`
	Operations    []ADROperationContext `json:"operations"`
}

type ADROperationContext added in v0.22.0

type ADROperationContext struct {
	Operation     string              `json:"operation"`
	Claim         string              `json:"claim"`
	Topic         string              `json:"topic"`
	Progress      string              `json:"progress"`
	StateSequence int                 `json:"stateSequence,omitempty"`
	ClaimState    string              `json:"claimState"`
	Detail        *ADROperationDetail `json:"detail,omitempty"`
}

type ADROperationDetail added in v0.22.0

type ADROperationDetail struct {
	Current     *ClaimDetail        `json:"current,omitempty"`
	History     *topic.ClaimHistory `json:"history,omitempty"`
	MarkerSites []topic.MarkerSite  `json:"markerSites"`
}

type AgentDialect added in v0.18.0

type AgentDialect string

AgentDialect names the target-native encoding for rendered agents.

const (
	MarkdownAgentDialect AgentDialect = "markdown"
	TOMLAgentDialect     AgentDialect = "toml"
	PlainAgentDialect    AgentDialect = "plain"
)
type ArtifactLink struct {
	Path  string `json:"path"`
	Label string `json:"label"`
}

type ArtifactRecord added in v0.22.0

type ArtifactRecord struct {
	Role       ArtifactRole      `json:"role"`
	Identity   string            `json:"identity"`
	Sources    []ArtifactLink    `json:"sources"`
	Outputs    []ArtifactLink    `json:"outputs"`
	Navigation []ArtifactLink    `json:"navigation"`
	Snapshot   *ArtifactSnapshot `json:"snapshot,omitempty"`
}

type ArtifactRole added in v0.22.0

type ArtifactRole string
const (
	ArtifactConfig             ArtifactRole = "config"
	ArtifactLock               ArtifactRole = "lock"
	ArtifactManifest           ArtifactRole = "manifest"
	ArtifactTemplate           ArtifactRole = "template"
	ArtifactConventionPart     ArtifactRole = "convention-part"
	ArtifactAuthoredData       ArtifactRole = "authored-data"
	ArtifactTopicMetadata      ArtifactRole = "topic-metadata"
	ArtifactClaimPart          ArtifactRole = "claim-part"
	ArtifactDecisionRecord     ArtifactRole = "decision-record"
	ArtifactManagedOutput      ArtifactRole = "managed-output"
	ArtifactProtocolDescriptor ArtifactRole = "protocol-descriptor"
)

type ArtifactSnapshot added in v0.22.0

type ArtifactSnapshot struct {
	InManifest bool `json:"inManifest"`
	Drifted    bool `json:"drifted"`
}

type Backup added in v0.3.0

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 added in v0.18.0

type Capability string

Capability is an awf-owned template capability. It is deliberately closed: targets cannot inject arbitrary template data.

const (
	CapabilitySubagentTools  Capability = "subagent-tools"
	CapabilitySessionHandoff Capability = "session-handoff"
)

type Change added in v0.13.0

type Change struct {
	Path  string
	Cause string
}

Change records a sync-written file whose rendered output differs from the prior lock's, with the cause the lock's hashes can 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 ClaimDetail added in v0.22.0

type ClaimDetail struct {
	ID         string             `json:"id"`
	Type       string             `json:"type"`
	Prose      string             `json:"prose"`
	Backing    string             `json:"backing"`
	Verify     string             `json:"verify,omitempty"`
	Sites      []topic.MarkerSite `json:"sites"`
	References ClaimReferences    `json:"references"`
}

type ClaimReferences added in v0.22.0

type ClaimReferences struct {
	Incoming []string `json:"incoming"`
	Outgoing []string `json:"outgoing"`
}

ClaimReferences is the stable reference shape populated by the projection batch.

type ContextPath added in v0.22.0

type ContextPath struct {
	Path     string   `json:"path"`
	Requests []string `json:"requests"`
	// GlobLiteral is true when a user-typed query containing glob
	// metacharacters resolved to a missing or context-ignored path: attribution
	// was suppressed and globs are known to be unexpanded.
	GlobLiteral            bool                `json:"globLiteral,omitempty"`
	Classification         PathClassification  `json:"classification"`
	TargetInsideRepository *bool               `json:"targetInsideRepository,omitempty"`
	NestedRoot             string              `json:"nestedRoot,omitempty"`
	Domains                []DomainRef         `json:"domains"`
	Topics                 []PathTopicRef      `json:"topics"`
	Artifacts              []ArtifactRecord    `json:"artifacts"`
	ADR                    *ADRArtifactContext `json:"adr,omitempty"`
}

type ContextProjection added in v0.22.0

type ContextProjection string
const (
	ContextConcise ContextProjection = "concise"
	ContextFull    ContextProjection = "full"
)

type ContextRequest added in v0.22.0

type ContextRequest struct {
	Query          string        `json:"query"`
	Status         RequestStatus `json:"status"`
	EffectivePaths []string      `json:"effectivePaths"`
}

type ContextResult added in v0.16.0

type ContextResult struct {
	Projection ContextProjection        `json:"projection"`
	Requests   []ContextRequest         `json:"requests"`
	Topics     []InvocationTopicContext `json:"topics"`
	Paths      []ContextPath            `json:"paths"`
}

func StagedContextRoot added in v0.22.0

func StagedContextRoot(root string, paths []string) (ContextResult, error)

StagedContextRoot assembles every result from one immutable index universe.

func StagedContextRootFull added in v0.22.0

func StagedContextRootFull(root string, paths []string) (ContextResult, error)

StagedContextRootFull returns the full projection from the immutable index.

func StagedContextRootFullGitSelection added in v0.22.0

func StagedContextRootFullGitSelection(root string, paths []string) (ContextResult, error)

StagedContextRootFullGitSelection combines Git attribution and full authority.

func StagedContextRootGitSelection added in v0.22.0

func StagedContextRootGitSelection(root string, paths []string) (ContextResult, error)

StagedContextRootGitSelection preserves Git-selected request status in the immutable index universe.

type CurrentStateReport added in v0.22.0

type CurrentStateReport struct {
	Static     []currentstate.Finding
	Coverage   []topic.CoverageFinding
	Advisories []string
}

CurrentStateReport is the routed outcome of a current-state check over one snapshot: the static ADR-to-claim handshake findings (all blocking) and the coverage/fan-out findings (each carrying its configured severity, ADR-0134 item 11). Findings and Notes split the report into blocking lines and non-failing note lines so the command layer never re-derives the routing.

func CheckStagedRoot added in v0.22.0

func CheckStagedRoot(root string) (CurrentStateReport, error)

CheckStagedRoot validates the staged current-state transition without opening working-tree project configuration. The staged command must remain operable when a valid adopted index deliberately deletes or lacks the working config.

func (CurrentStateReport) Findings added in v0.22.0

func (r CurrentStateReport) Findings() []string

Findings returns the blocking lines: every static handshake finding and every coverage/fan-out finding at error severity.

func (CurrentStateReport) Notes added in v0.22.0

func (r CurrentStateReport) Notes() []string

Notes returns the non-failing lines: coverage/fan-out findings at warn severity. Off findings are never emitted by the evaluator, so they never appear here.

type DomainRef added in v0.16.0

type DomainRef struct {
	Name         string `json:"name"`
	CurrentState string `json:"currentState"`
}

DomainRef is an owning domain and its rendered current-state doc path, derived by convention (never a sidecar field - ADR-0086).

type FullTopicContext added in v0.22.0

type FullTopicContext struct {
	Claims  []ClaimDetail   `json:"claims"`
	Pending []PendingChange `json:"pending"`
}

type InitAuthority added in v0.22.0

type InitAuthority struct {
	InitializedWithVersion string
}

InitAuthority is the explicit provenance supplied only by first adoption.

type InvariantReport added in v0.22.0

type InvariantReport struct {
	ID      string   `json:"id"`
	Backing string   `json:"backing"`
	Verify  string   `json:"verify,omitempty"`
	Proofs  []string `json:"proofs,omitempty"`
}

InvariantReport is one invariant claim in the working-tree topic corpus for the standalone `awf invariants` report (ADR-0134): its full claim ID, backing mode (test or unbacked), an unbacked claim's Verify guidance, and the sorted proof-marker sites of a test-backed claim. Rule claims never appear. A backing-contract violation is a corpus load error surfaced by CurrentStateInvariants, never a reported entry.

type InvocationTopicContext added in v0.22.0

type InvocationTopicContext struct {
	ID                 string                  `json:"id"`
	Title              string                  `json:"title"`
	Summary            string                  `json:"summary"`
	Applicability      TopicApplicabilityBrief `json:"applicability"`
	ClaimIDs           []string                `json:"claimIDs"`
	DirectClaims       []ClaimDetail           `json:"directClaims"`
	OmittedDetailCount int                     `json:"omittedDetailCount"`
	TopicCommand       string                  `json:"topicCommand"`
	CoverageCommand    string                  `json:"coverageCommand"`
	Full               *FullTopicContext       `json:"full,omitempty"`
}

InvocationTopicContext is one applicable topic rendered exactly once per invocation: its selectors reduced to a brief with a matched-path count, the uncapped claim-ID roster, and, in the concise projection, the full detail of the invocation's marker-selected direct-claim union (ADR-0147). The full projection leaves DirectClaims empty and carries every claim under Full.

type Layout

type Layout struct {
	DocsDir    string
	ADRDir     string
	IndexMd    string
	PlansDir   string
	Docs       map[string]string // name -> output path; present iff enabled (inv: layout-docs-enabled-only)
	DomainsDir string
}

Layout is the fixed, awf-given docs layout derived from cfg.DocsDir, in typed form for Go consumers. These paths are not configurable through vars. 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 added in v0.22.0

type OutputDeclaration struct {
	Path         string
	TemplateID   string
	Declarers    []string
	Inputs       []OutputInput
	Dependencies []string
	Reservation  bool
}

func BuildOutputDeclarations added in v0.22.0

func BuildOutputDeclarations(cfg *config.Config, cat *catalog.Catalog, targets []Target, read ProjectTreeReader, adrs adr.Corpus) ([]OutputDeclaration, error)

BuildOutputDeclarations enumerates deterministic producer declarations without rendering or materializing the selected tree.

type OutputInput added in v0.22.0

type OutputInput struct {
	Path string
	Role ArtifactRole
}

type OutputNode added in v0.18.0

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

OutputNode is one path in the deterministic internal output plan. A node is either a write or a reservation; reservations protect local artifacts but are never written or entered in the lock manifest.

type OutputPlan added in v0.18.0

type OutputPlan struct{ Nodes []OutputNode }

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

type OutputPolicy added in v0.18.0

type OutputPolicy struct {
	ValidateFrontmatter bool
	ScanReferences      bool
	ScanSkillReferences bool
	Regenerate          bool
	LocalValidation     bool
}

OutputPolicy declares lifecycle behavior for a planned path. It is data on the node, not an inference made by sync or check from a template name or suffix.

type OutputRecipe added in v0.18.0

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 PathClassification added in v0.22.0

type PathClassification string
const (
	PathCovered           PathClassification = "covered"
	PathEligibleUnowned   PathClassification = "eligible-unowned"
	PathContextIgnored    PathClassification = "context-ignored"
	PathGeneratedOutput   PathClassification = "generated-output"
	PathNestedAdopter     PathClassification = "nested-adopter"
	PathSymlink           PathClassification = "symlink"
	PathNotFound          PathClassification = "not-found"
	PathOutsideRepository PathClassification = "outside-repository"
)

type PathTopicRef added in v0.22.0

type PathTopicRef struct {
	ID             string   `json:"id"`
	DirectClaimIDs []string `json:"directClaimIDs"`
}

PathTopicRef attributes one applicable topic to one effective path: the topic's domain-qualified ID and the path's own directly marker-selected claim IDs; topic authority lives in the invocation-level collection (ADR-0147).

type PendingChange added in v0.22.0

type PendingChange struct {
	ADR      string `json:"adr"`
	Title    string `json:"title"`
	Status   string `json:"status"`
	Applied  int    `json:"applied"`
	Declared int    `json:"declared"`
	Op       string `json:"op"`
	Claim    string `json:"claim"`
}

PendingChange is one remaining governed ADR operation targeting a matched topic. It is not yet current and renders separately from current claims.

type PlanOp added in v0.12.0

type PlanOp struct {
	Node       catalog.Node
	Enable     bool
	RequiredBy string
}

PlanOp is one enable-array change in a resolver plan (ADR-0081 Decision 2). RequiredBy carries provenance: the artifact demanding the op ("" for the node the user named).

type Project

type Project struct {
	Root    string
	Cfg     *config.Config
	Cat     *catalog.Catalog
	Targets []Target
	// contains filtered or unexported fields
}

func Open

func Open(root string) (*Project, error)

func (*Project) AdvisoryNotes added in v0.10.0

func (p *Project) AdvisoryNotes() ([]string, error)

AdvisoryNotes returns the non-failing render advisories in print order - the ADR-0045 unset-var notes, the ADR-0070 stub notes, then the ADR-0083 part- marker notes - computed from one RenderAll pass plus the domain-doc generation, which renders outside it.

func (*Project) Audit

func (p *Project) Audit(base, head string) ([]audit.Finding, int, error)

Audit runs the process-conformance audit (ADR-0017) over the caller-supplied commit range. No config key supplies a base: the range is always explicit (ADR-0127 Decision 3).

func (*Project) BackupFile

func (p *Project) BackupFile(rel string) (string, error)

BackupFile copies a colliding project-relative file to a free <path>.awf-bak[.N] sibling (never clobbering a prior backup) and returns the backup's project-relative path.

func (*Project) Check

func (p *Project) Check() ([]manifest.Drift, error)

func (*Project) CheckCurrentState added in v0.22.0

func (p *Project) CheckCurrentState() (CurrentStateReport, error)

CheckCurrentState loads the working-tree current-state view and runs the static ADR-to-claim handshake and the coverage/fan-out evaluator over it (ADR-0135, ADR-0134). It reads exactly one working Tree, so the two checks never mix a working and an index universe. Coverage runs only when the project configures a currentState policy.

func (*Project) CheckStaged added in v0.22.0

func (p *Project) CheckStaged() (CurrentStateReport, error)

CheckStaged loads the HEAD (before) and staged index (after) current-state universes and runs the snapshot-diff transition check between them plus the coverage/fan-out evaluator over the index (ADR-0135, ADR-0134). Both sides are committed or index universes, so a dirty working tree never affects the result. The before side is the empty universe on a repository with no commit yet, and the after config, policy, and eligible paths all come from the index tree so the staged check reads one universe. Coverage runs only when the staged config declares a currentState policy.

func (*Project) ConfigReferenceModel added in v0.14.0

func (p *Project) ConfigReferenceModel() (map[string]any, error)

ConfigReferenceModel computes the reference's four collections (configKeys, varEntries, sidecarFields, dataKeys) with live project state - the `awf config` command's data source, sharing the doc's builder.

func (*Project) ContextFor added in v0.16.0

func (p *Project) ContextFor(paths []string) (ContextResult, error)

ContextFor assembles the read-only current-state context for paths over the working-tree universe (ADR-0134, ADR-0135). It loads exactly one working Tree, so the selection never mixes a working and an index universe, and it writes nothing.

func (*Project) ContextForFull added in v0.22.0

func (p *Project) ContextForFull(paths []string) (ContextResult, error)

ContextForFull returns the complete authority projection from the same model.

func (*Project) ContextForFullGitSelection added in v0.22.0

func (p *Project) ContextForFullGitSelection(paths []string) (ContextResult, error)

ContextForFullGitSelection combines Git request attribution with full authority.

func (*Project) ContextForGitSelection added in v0.22.0

func (p *Project) ContextForGitSelection(paths []string) (ContextResult, error)

ContextForGitSelection preserves Git-selected request status while resolving authority against the same single working universe.

func (*Project) Corpus added in v0.18.0

func (p *Project) Corpus() (adr.Corpus, error)

Corpus returns the project's parsed ADR corpus, loading it on first use within the current invocation and reusing it for the rest of that invocation (ADR-0130 item 1). Threading one view is what collapses the eight-or-so per-check parses a single awf check used to perform.

The cache is per-INVOCATION, not per-Project: every public operation that reads ADRs calls beginInvocation first. A Project outlives a single call, and Check's whole contract is to compare rendered output against the decisions directory as it is on disk right now - so a corpus held across calls would make a Check following a Sync miss an ADR written in between, silently blinding the drift oracle rather than merely serving a stale read.

func (*Project) CurrentStateInvariants added in v0.22.0

func (p *Project) CurrentStateInvariants() ([]InvariantReport, error)

CurrentStateInvariants reports the invariant claims in the working-tree topic corpus (ADR-0134). Authority is the topic claim set: test-backed proof and unbacked Verify contracts are already enforced when the corpus loads, so this reads only typed claims and their qualified proof markers - no ADR is consulted.

func (*Project) InitCollisions

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

InitCollisions returns planned output paths that already exist on disk and are not recorded in the prior lock (i.e. not awf-managed). An awf-managed path that already exists is not a collision - re-init is idempotent.

func (*Project) InitializeReport added in v0.22.0

func (p *Project) InitializeReport(seed InitAuthority) ([]Backup, []Change, []string, error)

InitializeReport renders a first adoption while sealing its existing ADR identities. It has the same reporting contract as SyncReport.

func (*Project) NewADR added in v0.6.0

func (p *Project) NewADR(title string) (string, error)

NewADR scaffolds a new ADR file under the project's decisions dir: the next sequential number, the rendered template with its title/date filled in and marker comments stripped, refusing to overwrite an existing file. Mirrors the CheckInvariants/Audit pattern - cmd/awf reaches this only through this exported method, never internal/project.Layout directly.

func (*Project) NewPlan added in v0.18.0

func (p *Project) NewPlan(title string) (string, error)

NewPlan scaffolds a new plan under docsDir/plans from the rendered plans template. Mirrors NewADR minus sequential numbering (ADR-0098).

func (*Project) OutputPlan added in v0.18.0

func (p *Project) OutputPlan() (*OutputPlan, error)

OutputPlan compiles all output producers. Generated nodes are constructed in dependency order; config reference observes ordinary/domain metadata but is deliberately excluded from its own input.

func (*Project) PlannedOutputs

func (p *Project) PlannedOutputs() ([]string, error)

PlannedOutputs returns plan write paths, excluding local reservations.

func (*Project) QueryTopic added in v0.18.0

func (p *Project) QueryTopic(selector string, opts topic.QueryOptions) (topic.QueryResult, error)

QueryTopic assembles one read-only topic or claim projection from one cutoff-aware working snapshot. Active state and v1 operation history therefore cannot come from different worktree universes.

func (*Project) RenderAll

func (p *Project) RenderAll() ([]RenderedFile, error)

RenderAll renders only plan write nodes in deterministic path order.

func (*Project) ResolveDisable added in v0.16.0

func (p *Project) ResolveDisable(kind, name string) []PlanOp

ResolveDisable plans disabling (kind, name): the node plus every enabled, non-local artifact that transitively requires it (reverse closure, fixed point over direct edges). Local-sidecar artifacts have no catalog edges demanded of them, mirroring the validator's skip.

func (*Project) ResolveEnable added in v0.16.0

func (p *Project) ResolveEnable(kind, name string) []PlanOp

ResolveEnable plans enabling (kind, name): the node plus its missing forward closure. An already-enabled dependency is skipped along with its subtree - the open-time validation invariant guarantees enabled implies closed.

func (*Project) SyncReport added in v0.3.0

func (p *Project) SyncReport() ([]Backup, []Change, []string, error)

SyncReport renders and writes the project, additionally backing up any foreign file (on disk but absent from the start-of-sync lock) before overwriting it - plus a pruned co-owned runner before removing it (ADR-0156 item 9) - and returning those backups (ADR-0035) plus the per-file provenance of output that changed against the prior lock and the lock-relative paths of the files its prune actually removed (both path-sorted; a file whose output is byte-identical, and first-adoption initialization with no prior lock reports no change - a routine re-sync stays silent).

func (*Project) Topics added in v0.18.0

func (p *Project) Topics() (topic.Corpus, error)

func (*Project) Uncovered added in v0.18.0

func (p *Project) Uncovered(scanRoots []string) (UncoveredResult, error)

Uncovered assembles the coverage report over the working-tree eligible paths: those neither generated nor contextIgnore-matched (ADR-0134). scanRoots restrict the report to paths at or beneath them on slash-separated segment boundaries; empty scanRoots scans everything. It writes nothing.

type ProjectTreeReader added in v0.22.0

type ProjectTreeReader interface {
	ReadFile(path string) ([]byte, bool)
	Paths(prefix string) []string
}

ProjectTreeReader is the read-only input authority for output declarations.

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. It is intentionally
	// independent of BuildOutputDeclarations so declaration omissions and role
	// mistakes fail output-plan parity.
	ConsumedInputs     []OutputInput
	ObservedTemplateID string
	// contains filtered or unexported fields
}

type RequestStatus added in v0.22.0

type RequestStatus string
const (
	RequestLiteral           RequestStatus = "literal"
	RequestDirectoryExpanded RequestStatus = "directory-expanded"
	RequestDirectoryEmpty    RequestStatus = "directory-empty"
	RequestGitSelected       RequestStatus = "git-selected"
)

type Target

type Target struct {
	Name           string
	SkillDir       string // dir holding rendered skills, e.g. ".claude/skills"
	AgentDir       string // dir holding rendered agents, e.g. ".claude/agents"
	AgentSuffix    string // agent filename suffix, including its extension
	AgentDialect   AgentDialect
	BridgeFile     string // adapter bridge file at repo root, "" if none
	BridgeTemplate string
	// Capabilities is the closed capability declaration exposed through the
	// fixed targetTemplateData projection.
	Capabilities []Capability
	Outputs      []TargetOutput
}

Target places adapter (tool-specific) artifacts for one runtime. Neutral artifacts (AGENTS.md, docs, domains) are not target-scoped (ADR-0016).

func (Target) AgentPath

func (t Target) AgentPath(name string) string

AgentPath is the output path for a rendered agent under this target.

func (Target) HiddenWorkflowPath added in v0.22.0

func (t Target) HiddenWorkflowPath(name string) string

HiddenWorkflowPath is the fixed, non-discovered Pi workflow body path.

func (Target) SkillPath

func (t Target) SkillPath(prefix, name string) string

SkillPath is the output path for a rendered skill under this target.

func (Target) WorkflowRouterPath added in v0.22.0

func (t Target) WorkflowRouterPath() string

WorkflowRouterPath is the sole discoverable Pi workflow skill path.

type TargetOutput added in v0.18.0

type TargetOutput struct {
	Path           string
	TemplateID     string
	Producer       TargetOutputProducer
	Inputs         []TargetOutputInput
	Encoder        AgentDialect
	Provenance     render.CommentStyle
	Policy         OutputPolicy
	PolicyDeclared bool
}

TargetOutput declares a target-owned non-catalog output such as a project extension.

type TargetOutputInput added in v0.22.0

type TargetOutputInput struct {
	Path string
	Role ArtifactRole
}

type TargetOutputProducer added in v0.22.0

type TargetOutputProducer string
const (
	TargetOutputTemplate          TargetOutputProducer = "template"
	TargetOutputTelemetryProtocol TargetOutputProducer = "telemetry-protocol"
)

type TopicApplicabilityBrief added in v0.22.0

type TopicApplicabilityBrief struct {
	DomainPaths      []string `json:"domainPaths"`
	TopicPaths       []string `json:"topicPaths"`
	DeclaredGlobal   bool     `json:"declaredGlobal"`
	MatchedPathCount int      `json:"matchedPathCount"`
}

TopicApplicabilityBrief is the selectors-plus-count reduction of the shared applicability evidence model; the concrete census stays in `awf topic --coverage` (ADR-0147).

type UncoveredResult added in v0.18.0

type UncoveredResult struct {
	ScanRoots []string         `json:"scanRoots"`
	Unowned   []UnownedEntry   `json:"unowned"`
	Uncovered []UncoveredTopic `json:"uncovered"`
}

UncoveredResult is the read-only coverage report for a set of scan roots: the eligible paths owned by no domain (collapsed to a topmost trailing-slash node) and the domain-owned paths with no claim-bearing scoped topic (ADR-0134). ScanRoots echoes the requested roots (empty = whole repository).

func StagedUncoveredRoot added in v0.22.0

func StagedUncoveredRoot(root string, scanRoots []string) (UncoveredResult, error)

StagedUncoveredRoot reports coverage entirely from the index universe.

type UncoveredTopic added in v0.22.0

type UncoveredTopic struct {
	Path   string `json:"path"`
	Domain string `json:"domain"`
}

UncoveredTopic is one domain-owned path lacking a scoped topic that covers it.

type UninstallReport added in v0.22.0

type UninstallReport struct {
	Removed          int
	MetricsPreserved bool
}

func Uninstall

func Uninstall(root string) (UninstallReport, error)

Uninstall removes awf's generated footprint while preserving dynamic resident workflow metrics. It is a free function so a broken config does not block it. touches-state: rendering/sync-and-drift:uninstall-removes-lock-entries - lock-tracked file removal; proof in install_test.go

type UnownedEntry added in v0.22.0

type UnownedEntry struct {
	Path          string `json:"path"`
	UnownedCount  int    `json:"unownedCount"`
	ExcludedCount int    `json:"excludedCount"`
}

UnownedEntry is one collapsed unowned node: UnownedCount is the in-scope eligible unowned paths it covers, ExcludedCount the in-scope scannable paths beneath it that coverage excludes (generated, context-ignored, metrics-resident, or nested-adopter). Plain file entries keep ExcludedCount zero.

Jump to

Keyboard shortcuts

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