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 EnabledNames(c *config.Config, singular string) ([]string, bool)
- func Kinds() []string
- func KnownTargets() []string
- func PluralKind(singular string) (string, bool)
- func ScaffoldConfig(prefix string, vars map[string]string, inv *config.InvariantConfig, ...) ([]byte, error)
- func Uninstall(root string) (int, error)
- type Backup
- type Layout
- type Project
- func (p *Project) Audit(baseOverride string) ([]audit.Finding, error)
- func (p *Project) BackupFile(rel string) (string, error)
- func (p *Project) Check() ([]manifest.Drift, error)
- func (p *Project) CheckInvariants() ([]invariants.Finding, error)
- func (p *Project) InitCollisions() ([]string, error)
- func (p *Project) PlannedOutputs() ([]string, error)
- func (p *Project) RenderAll() ([]RenderedFile, error)
- func (p *Project) Sync() error
- func (p *Project) SyncReport() ([]Backup, error)
- type RenderedFile
- type Target
Constants ¶
const Version = "0.5.0"
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 EnabledNames ¶
EnabledNames returns the config enable array for a singular CLI kind.
func KnownTargets ¶ added in v0.4.0
func KnownTargets() []string
KnownTargets returns the known adapter names in sorted order. The bespoke `awf {add,remove,list} target` path validates against this set (inv: target-cli). invariant: target-cli
func PluralKind ¶
PluralKind maps a singular CLI kind token to its config enable-array key.
func ScaffoldConfig ¶
func ScaffoldConfig(prefix string, vars map[string]string, inv *config.InvariantConfig, trim *config.CatalogTrim) ([]byte, 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 add` of an opt-in skill renders cleanly. It also seeds the self-pinning bootstrap enabled by default (ADR-0040).
func Uninstall ¶
Uninstall removes awf's generated footprint from root: every file recorded in the lock, the directories left empty by their removal, and the now-stale lock itself. It leaves the authored .awf/ config in place and returns the count of files removed. It is a free function (not a *Project method) so a broken config.yaml does not block uninstall — only the lock and root are needed. invariant: uninstall-removes-lock-tracked
Types ¶
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 Layout ¶
type Layout struct {
DocsDir string
ADRDir string
ActiveMd string
AdrReadme string
AdrTemplate string
PlansDir string
PlansReadme string
Docs map[string]string // name -> output path; present iff enabled (inv: layout-docs-enabled-only)
WorkflowRef string
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.
type Project ¶
func (*Project) Audit ¶
Audit runs the process-conformance audit (ADR-0017) over the branch range. baseOverride wins over the configured base branch when non-empty.
func (*Project) BackupFile ¶
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. invariant: init-force-backs-up
func (*Project) CheckInvariants ¶
func (p *Project) CheckInvariants() ([]invariants.Finding, error)
CheckInvariants reports Implemented-ADR invariant slugs that lack a backing `<marker> invariant: <slug>` comment (per the project's configured invariant sources) under the project root.
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) PlannedOutputs ¶
PlannedOutputs returns the project-relative paths Sync would write: every RenderAll output plus the generated ACTIVE.md and domain docs. Used by awf init to detect collisions before writing (ADR-0016).
func (*Project) RenderAll ¶
func (p *Project) RenderAll() ([]RenderedFile, error)
func (*Project) SyncReport ¶ added in v0.3.0
SyncReport renders and writes the project like Sync, additionally backing up any foreign file (on disk but absent from the start-of-sync lock) before overwriting it, and returning those backups (ADR-0035).
type RenderedFile ¶
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"
BridgeFile string // adapter bridge file at repo root, "" if none
}
Target places adapter (tool-specific) artifacts for one runtime. Neutral artifacts (AGENTS.md, docs, domains) are not target-scoped (ADR-0016).