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
- func CatalogNames(cat *catalog.Catalog, singular string) ([]string, bool)
- func CheckStagedDriftRoot(ctx context.Context, root string) ([]manifest.Drift, error)
- func ConfigReferencePresentation(key string, model *ConfigReference, status string) (presentation.Document, error)
- func CurrentStateCategories(report CurrentStateReport, staged bool) ([]presentation.ReportCategory, error)
- func DriftCategories(drift []manifest.Drift, staged bool) ([]presentation.ReportCategory, error)
- func IsFreeformDomainKind(singular string) bool
- func IsLocalDocTemplate(templateID string) bool
- func Kinds() []string
- func KnownTargets() []string
- func NeededVars() (map[string]bool, error)
- func PitfallScaffoldDocument(sourcePath string) (presentation.Document, error)
- func PluralKind(singular string) (string, bool)
- func PotentialVarConsumers() (map[string][]string, error)
- func ScaffoldConfig(prefix string, vars map[string]string, scopes []string) ([]byte, error)
- func SyncMutation(backups []Backup, changes []Change, pruned []string) (presentation.Mutation, error)
- func ValidateSchemaMinimumVersion(schema int, version string) error
- func VerifyCommitPolicyAt(ctx context.Context, root string, targets []string) (presentation.Document, commitpolicy.Outcome, error)
- type AgentDialect
- type ArtifactRole
- type Backup
- type Capability
- type Change
- type CheckReport
- type CommitAuthorizationResult
- type ConfigKeyRow
- type ConfigReference
- type ContextState
- type CurrentStateReport
- type DataKeyRow
- type InitAuthority
- type Layout
- type LoadConfigTree
- type Loader
- type NumberAssignment
- type NumberingReport
- type OutputDeclaration
- type OutputInput
- type OutputNode
- type OutputPlan
- type OutputPolicy
- type OutputRecipe
- type PitfallScaffoldCleanupError
- type PlanContext
- type PlanReference
- type Project
- func (p *Project) AdvisoryNotes(ctx context.Context) ([]string, error)
- func (p *Project) Audit(ctx context.Context, base, head string) ([]audit.Finding, int, error)
- func (p *Project) Check(ctx context.Context) ([]manifest.Drift, error)
- func (p *Project) CheckCommitAuthorization(ctx context.Context, msg commitmsg.Message) (CommitAuthorizationResult, error)
- func (p *Project) CheckCurrentState(ctx context.Context) (CurrentStateReport, error)
- func (p *Project) CheckReport(ctx context.Context) (CheckReport, error)
- func (p *Project) CheckStaged(ctx context.Context) (CurrentStateReport, error)
- func (p *Project) CheckStagedDrift(ctx context.Context) ([]manifest.Drift, error)
- func (p *Project) CommitPolicyPresentation(outcome commitpolicy.Outcome) (presentation.Document, error)
- func (p *Project) ConfigReferenceModel(ctx context.Context) (ConfigReference, error)
- func (p *Project) ContextState(ctx context.Context) (ContextState, error)
- func (p *Project) InitCollisions(ctx context.Context) ([]string, error)
- func (p *Project) InitializeReport(ctx context.Context, seed InitAuthority) ([]Backup, []Change, []string, error)
- func (p *Project) ListDocument(kindFilter string) (presentation.Document, error)
- func (p *Project) NewADR(ctx context.Context, title string) (string, error)
- func (p *Project) NewPitfall(title string) (document presentation.Document, returnErr error)
- func (p *Project) NewPlan(title string) (string, error)
- func (p *Project) NumberPendingADRs(ctx context.Context, slugs []string) (NumberingReport, error)
- func (p *Project) OutputPlan(ctx context.Context) (*OutputPlan, error)
- func (p *Project) PlannedOutputs(ctx context.Context) ([]string, error)
- func (p *Project) PreflightLocalDoc(ctx context.Context, doc config.LocalDoc) error
- func (p *Project) QueryTopic(ctx context.Context, selector string, opts topic.QueryOptions) (topic.QueryResult, error)
- func (p *Project) ReadPlan(name, selector string) ([]byte, error)
- func (p *Project) RenderResidentMarker(ctx context.Context, name string) (RenderedFile, error)
- func (p *Project) SyncReport(ctx context.Context) ([]Backup, []Change, []string, error)
- func (p *Project) VerifyCommitPolicy(ctx context.Context, targets []string) commitpolicy.Outcome
- type ProjectTreeReader
- type RenderedFile
- type ResolveResidentRoot
- type Target
- type TargetOutput
- type TargetOutputInput
- type TargetOutputProducer
- type VarRow
Constants ¶
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.
const Version = "0.37.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 ¶
CatalogNames returns the catalog pool for a singular CLI kind; ok is false for a kind with no catalog pool (domains).
func CheckStagedDriftRoot ¶ added in v0.30.0
CheckStagedDriftRoot compares rendered output entirely within the staged universe without loading working-tree project configuration.
func ConfigReferencePresentation ¶ added in v0.30.0
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 CurrentStateCategories ¶ added in v0.30.0
func CurrentStateCategories(report CurrentStateReport, staged bool) ([]presentation.ReportCategory, error)
CurrentStateCategories maps current-state findings into their check-report vocabulary.
func DriftCategories ¶ added in v0.30.0
func DriftCategories(drift []manifest.Drift, staged bool) ([]presentation.ReportCategory, error)
DriftCategories maps drift findings into their check-report vocabulary.
func IsFreeformDomainKind ¶ added in v0.30.0
IsFreeformDomainKind reports whether the singular CLI kind is the freeform domains kind (no catalog pool).
func IsLocalDocTemplate ¶ added in v0.36.0
IsLocalDocTemplate is the bounded recognition policy outer composition passes to uninstall without leaking the template identity into resident.
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
NeededVars returns the var names referenced by the full rendered catalog.
func PitfallScaffoldDocument ¶ added in v0.34.0
func PitfallScaffoldDocument(sourcePath string) (presentation.Document, error)
PitfallScaffoldDocument maps a created source path to the CLI presentation grammar.
func PluralKind ¶
PluralKind maps a singular CLI kind token to its descriptor plural.
func PotentialVarConsumers ¶ added in v0.14.0
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 ¶
ScaffoldConfig generates a .awf/config.yaml with every catalog template's referenced vars, the self-pinning bootstrap, and the resolved commit scopes.
func SyncMutation ¶ added in v0.30.0
func SyncMutation(backups []Backup, changes []Change, pruned []string) (presentation.Mutation, error)
SyncMutation maps the completed sync outcome into presentation-owned syntax. Backup ownership and output provenance stay semantic facts of this package.
func ValidateSchemaMinimumVersion ¶ added in v0.30.0
ValidateSchemaMinimumVersion confirms that version is new enough to render a schema generation. The command gate calls it for the current generation, so registering a migration without its release mapping fails before rendering.
func VerifyCommitPolicyAt ¶ added in v0.30.0
func VerifyCommitPolicyAt(ctx context.Context, root string, targets []string) (presentation.Document, commitpolicy.Outcome, error)
VerifyCommitPolicyAt resolves the invoking worktree and returns its typed outcome together with its model-owned presentation.
Types ¶
type AgentDialect ¶ added in v0.18.0
type AgentDialect string
AgentDialect names the target-native encoding for rendered agents.
const ( MarkdownAgentDialect AgentDialect = "markdown" PlainAgentDialect AgentDialect = "plain" )
type ArtifactRole ¶ added in v0.22.0
type ArtifactRole string
ArtifactRole classifies a path in the output plan and the context artifact report by its function in the render pipeline.
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 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" CapabilityEffortSessions Capability = "effort-sessions" )
type Change ¶ added in v0.13.0
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 CheckReport ¶ added in v0.30.0
CheckReport is the ordinary check operation's blocking drift and advisory notes, derived from one operation-owned plan parse.
type CommitAuthorizationResult ¶ added in v0.30.0
type CommitAuthorizationResult struct {
Category string
Condition string
ChangedIndex bool
ChangedMessage bool
ChangedMergeState bool
NextActions []string
}
CommitAuthorizationResult is the non-mutating outcome of definitive commit-message stale-merge authorization.
func (CommitAuthorizationResult) Diagnostic ¶ added in v0.30.0
func (r CommitAuthorizationResult) Diagnostic() (presentation.Diagnostic, error)
Diagnostic maps this non-mutating authorization outcome to the shared actionable presentation shape. All safety axes remain explicit even when none moved, so a hook user can safely distinguish correction from retry.
type ConfigKeyRow ¶ added in v0.30.0
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 ¶ added in v0.30.0
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 ¶ added in v0.30.0
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 ContextState ¶ added in v0.30.0
type ContextState struct {
// Layout is the docs layout derived from the snapshot's own config.
Layout Layout
// Cfg is the configuration parsed from the snapshot, not from disk: the
// query classifies the universe it was handed.
Cfg *config.Config
// Loaded is the parsed ADR and topic view of that same snapshot.
Loaded currentstate.Loaded
// PlanState is the parsed plan view and resolved reverse ADR links from that snapshot.
PlanState PlanContext
// Tree is the snapshot the universe was loaded from.
Tree *snapshot.Tree
// Lock is the parsed output manifest, nil when the tree carries none.
Lock *manifest.Lock
// Declarations is the output plan the artifact projection attributes paths to.
Declarations []OutputDeclaration
// Eligible is the coverage universe: every scannable snapshot file that is
// not a generated output (a lock entry), not matched by a contextIgnore
// glob, not under a resident root, and not inside a nested adopter tree.
Eligible []string
}
ContextState is the loaded universe the context query reads and the single seam between the sync core and internal/contextq (ADR-0195 item 2). The core keeps the loading machinery - working and staged current-state loads, lock reads, declaration building, and eligible-path selection - and hands the result over whole; the query package derives everything else from these fields and reaches no further into the core.
Every field is a construction input written by one of the two constructors below and never afterwards, so a ContextState value is immutable in practice and safe to share (code-design/state-ownership).
func StagedContextState ¶ added in v0.30.0
func StagedContextState(ctx context.Context, root string) (ContextState, error)
StagedContextState assembles the index universe at root. It deliberately never loads working-tree configuration: the staged answer is computed entirely from what is staged.
type CurrentStateReport ¶ added in v0.22.0
type CurrentStateReport struct {
Static []currentstate.Finding
Provisional []currentstate.Introduction
Coverage []topic.CoverageFinding
PlanDrift []manifest.Drift
PlanNotes []string
}
CurrentStateReport is the routed outcome of a current-state check over one snapshot: the static ADR-to-claim handshake findings (all blocking), staged older-format introductions awaiting commit-message evidence, and the coverage/fan-out findings, which carry ranks fixed in code rather than configured - coverage at error, fan-out at warn (ADR-0183). 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(ctx context.Context, 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: provisional older-format introductions and coverage/fan-out findings at warn. Provisional introductions are not findings because the staged boundary lacks definitive merge-parent and message evidence; every independently derivable finding remains blocking.
type DataKeyRow ¶ added in v0.30.0
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 ¶ added in v0.22.0
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)
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 LoadConfigTree ¶ added in v0.30.0
LoadConfigTree loads one project's configuration tree.
type Loader ¶ added in v0.30.0
type Loader struct {
// contains filtered or unexported fields
}
Loader owns project-opening policy over explicitly selected dependencies.
func NewLoader ¶ added in v0.30.0
func NewLoader(loadConfigTree LoadConfigTree, standard *catalog.Catalog, resolveResidentRoot ResolveResidentRoot, repo *awfgit.Repo) *Loader
NewLoader constructs project-opening policy with its required composed Git handle. A nil handle is always a composition error.
func NewLoaderWithoutRepository ¶ added in v0.30.0
func NewLoaderWithoutRepository(loadConfigTree LoadConfigTree, standard *catalog.Catalog, resolveResidentRoot ResolveResidentRoot) *Loader
NewLoaderWithoutRepository is the explicit fresh-adoption path for a tree known not to be a repository.
type NumberAssignment ¶ added in v0.30.0
NumberAssignment is one pending record's slug and the number numbering gave it.
type NumberingReport ¶ added in v0.30.0
type NumberingReport struct {
Assignments []NumberAssignment
}
NumberingReport is the mapping one numbering run assigned, in assignment order, so it can be pasted into the integration commit message.
func (NumberingReport) Presentation ¶ added in v0.30.0
func (r NumberingReport) Presentation() (presentation.Document, error)
Presentation maps the project-owned numbering result to the closed tree.
type OutputDeclaration ¶ added in v0.22.0
type OutputDeclaration struct {
Path string
TemplateID string
Declarers []string
Inputs []OutputInput
Dependencies []string
}
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
// contains filtered or unexported fields
}
OutputNode is one path in the deterministic internal output plan.
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
}
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 PitfallScaffoldCleanupError ¶ added in v0.34.0
PitfallScaffoldCleanupError reports a committed authored source whose publication temporary still requires cleanup.
func (*PitfallScaffoldCleanupError) Diagnostic ¶ added in v0.34.0
func (e *PitfallScaffoldCleanupError) Diagnostic() (presentation.Diagnostic, error)
Diagnostic maps the committed scaffold outcome to actionable CLI output.
func (*PitfallScaffoldCleanupError) Error ¶ added in v0.34.0
func (e *PitfallScaffoldCleanupError) Error() string
func (*PitfallScaffoldCleanupError) Unwrap ¶ added in v0.34.0
func (e *PitfallScaffoldCleanupError) Unwrap() error
Unwrap preserves the committed-publication and cleanup failure identities.
type PlanContext ¶ added in v0.32.0
PlanContext carries the parsed plan snapshot and its resolved reverse ADR links. It is assembled once by project with the same immutable tree as the ADR corpus.
func (PlanContext) LinkedPlans ¶ added in v0.32.0
func (c PlanContext) LinkedPlans(identity string) []string
LinkedPlans returns the normalized repository-relative paths linked to identity.
type PlanReference ¶ added in v0.32.0
type PlanReference struct {
Path, Filename string
}
PlanReference identifies one plan linked to an ADR. Paths are repository-relative.
type Project ¶
type Project struct {
// Root is the invoking checkout and remains the sole tracked-config authority.
Root string
Cfg *config.Config
Cat *catalog.Catalog
Targets []Target
// contains filtered or unexported fields
}
func Open ¶
Open is the transitional compatibility entry point for callers not yet migrated to outer composition. New code composes a Loader explicitly.
func (*Project) AdvisoryNotes ¶ added in v0.10.0
AdvisoryNotes returns the compatibility projection of the non-failing notes produced by one operation-scoped plan parse.
func (*Project) Audit ¶
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) CheckCommitAuthorization ¶ added in v0.30.0
func (p *Project) CheckCommitAuthorization(ctx context.Context, msg commitmsg.Message) (CommitAuthorizationResult, error)
CheckCommitAuthorization validates the index, first parent, every incoming MERGE_HEAD parent, and the cleaned final message without mutating any axis.
func (*Project) CheckCurrentState ¶ added in v0.22.0
func (p *Project) CheckCurrentState(ctx context.Context) (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 and fan-out always evaluate, whether or not the project configures a currentState policy (ADR-0192).
func (*Project) CheckReport ¶ added in v0.30.0
func (p *Project) CheckReport(ctx context.Context) (CheckReport, error)
CheckReport performs one ordinary project check. Plans are parsed once and the typed set is threaded to both blocking and advisory consumers.
func (*Project) CheckStaged ¶ added in v0.22.0
func (p *Project) CheckStaged(ctx context.Context) (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 and fan-out always evaluate, whether or not the staged config declares a currentState policy (ADR-0192).
func (*Project) CheckStagedDrift ¶ added in v0.30.0
CheckStagedDrift renders from the index configuration and compares only the stale and hand-edited rendered-output properties against that same index.
func (*Project) CommitPolicyPresentation ¶ added in v0.30.0
func (p *Project) CommitPolicyPresentation(outcome commitpolicy.Outcome) (presentation.Document, error)
CommitPolicyPresentation maps one verifier outcome using the project configuration.
func (*Project) ConfigReferenceModel ¶ added in v0.14.0
func (p *Project) ConfigReferenceModel(ctx context.Context) (ConfigReference, error)
ConfigReferenceModel computes the reference's four typed collections (ConfigKeys, VarEntries, SidecarFields, DataKeys) with live project state - the `awf config` command's data source.
func (*Project) ContextState ¶ added in v0.30.0
func (p *Project) ContextState(ctx context.Context) (ContextState, error)
ContextState assembles the working-tree universe. The universe project it derives the catalog, targets, and layout from is built from the snapshot's own configuration rather than the caller's, so the query answers about the tree it was given.
func (*Project) InitCollisions ¶
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(ctx context.Context, 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) ListDocument ¶ added in v0.30.0
func (p *Project) ListDocument(kindFilter string) (presentation.Document, error)
ListDocument renders the fixed catalog and configured domain inventory.
func (*Project) NewADR ¶ added in v0.6.0
NewADR scaffolds a new ADR file under the project's decisions dir from the rendered template, with its title/date filled in and marker comments stripped, refusing to overwrite an existing file. It is branch-aware (ADR-0202 item 5): on the integration branch it allocates the next sequential number, and anywhere else - including a detached HEAD or an unreadable repository - it writes a slug-identified pending record that `awf adr number` numbers at integration. Mirrors the CheckInvariants/Audit pattern - cmd/awf reaches this only through this exported method, never internal/project.Layout directly.
func (*Project) NewPitfall ¶ added in v0.34.0
func (p *Project) NewPitfall(title string) (document presentation.Document, returnErr error)
NewPitfall loads the current corpus, creates one canonical source exclusively, and returns project-owned presentation for its repository-relative path.
func (*Project) NewPlan ¶ added in v0.18.0
NewPlan scaffolds a new plan under docsDir/plans from the rendered plans template. Mirrors NewADR minus sequential numbering (ADR-0098).
func (*Project) NumberPendingADRs ¶ added in v0.30.0
NumberPendingADRs numbers the corpus's pending records at integration (ADR-0202 item 8). It runs in the effort worktree after the integration branch has been merged in and before the merge back: with exactly one pending record a bare call numbers it, and with several the caller must name every pending slug in the intended add-before-revise order.
The effect surface is exhaustive and matches item 9: each named record is renamed and its heading rewritten through internal/adr's seam, the authored claim parts take the slug-to-number substitution, and the project re-renders so the generated topic docs and the decision INDEX match. No status-history event, no already-numbered record, and no plan is touched.
It deliberately does not precondition on a green check. A green check between merge-in and numbering is the norm now that ADR-0191 removed the global state sequence, but an unrelated merge finding must not deadlock the one command that can resolve the corpus.
Every refusal happens before the first rename, so a refused run leaves the corpus exactly as it found it. Past that point the run is partial-completion: the renames and the substitution are already on disk, so a failing re-render returns the assignments alongside its error rather than an empty report. The mapping is what the integration commit message needs, and the caller cannot reconstruct it once the pending files are gone.
func (*Project) OutputPlan ¶ added in v0.18.0
func (p *Project) OutputPlan(ctx context.Context) (*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. OutputPlan derives the ADR corpus, the topic corpus, and the effective skill set at its own entry and threads them to every producer that needs one. An operation that already derived them enters through outputPlan instead, so one lifecycle call performs each derivation exactly once.
func (*Project) PlannedOutputs ¶
PlannedOutputs returns plan write paths.
func (*Project) PreflightLocalDoc ¶ added in v0.36.0
PreflightLocalDoc validates one candidate declaration against the complete project output plan without mutating the opened project's configuration.
func (*Project) QueryTopic ¶ added in v0.18.0
func (p *Project) QueryTopic(ctx context.Context, selector string, opts topic.QueryOptions) (topic.QueryResult, error)
QueryTopic assembles one read-only topic or claim projection from one intrinsically routed working snapshot. Active state and operation history therefore cannot come from different worktree universes.
func (*Project) ReadPlan ¶ added in v0.30.0
ReadPlan resolves an exact plan filename or stem beneath the configured plans directory and returns internal/plan's executable projection unchanged.
func (*Project) RenderResidentMarker ¶ added in v0.33.0
RenderResidentMarker returns the exact resident marker from the ordinary output plan, including template execution and provenance banner injection.
func (*Project) SyncReport ¶ added in v0.3.0
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) VerifyCommitPolicy ¶ added in v0.30.0
VerifyCommitPolicy evaluates explicit revisions through this invoking project's configured policy.
type ProjectTreeReader ¶ added in v0.22.0
type ProjectTreeReader interface {
ReadFile(path string) ([]byte, bool, error)
Paths(prefix string) ([]string, error)
}
ProjectTreeReader is the read-only input authority for output declarations. Reads distinguish absence from a fault, and Paths reports a fault rather than a short list: either loss would silently narrow the drift oracle.
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 ResolveResidentRoot ¶ added in v0.30.0
ResolveResidentRoot maps an invoking checkout to the root that owns resident state. It takes the operation's context because the resolution reaches Git.
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).
type TargetOutput ¶ added in v0.18.0
type TargetOutput struct {
Path string
// SkillName derives a target-native skill path; exactly one of it and Path is set.
SkillName string
RequiresSkill 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"
)
Source Files
¶
- adrnumber.go
- agent.go
- banner.go
- check.go
- check_presentation.go
- commitpolicy.go
- confighash.go
- configreference.go
- configreference_print.go
- contextstate.go
- currentstate.go
- datamerge.go
- gatedcommands.go
- glossary.go
- install.go
- kind.go
- layout.go
- list_presentation.go
- output_plan.go
- pitfalls.go
- placeholders.go
- plan_context.go
- plan_read.go
- project.go
- render.go
- scaffold.go
- singleton.go
- staged_drift.go
- staged_plan.go
- sweep.go
- sync_presentation.go
- target.go
- topics.go
- validate.go