Documentation
¶
Overview ¶
Package chainresolver resolves the ordered list of files that form the context chain for a given target logical name. The chain is divided into three groups: ancestor spec nodes (root → parent), the target node itself, and cross-tree / external dependencies declared in the target's frontmatter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
Chain is the complete, ordered context for a code generation subagent. It mirrors the structure described in the Code from Spec methodology:
- Ancestors: all spec nodes from ROOT down to (but not including) Target, sorted alphabetically by logical name.
- Target: the leaf node (or test node) being implemented.
- Dependencies: cross-tree (ROOT/) and external (EXTERNAL/) depends_on entries declared by the target, sorted alphabetically by logical name.
func ResolveChain ¶
ResolveChain builds the complete chain for the given target logical name.
Step 1 – Ancestors and Target:
Walk up the tree via ParentLogicalName, collecting every logical name from the target to ROOT. Sort alphabetically — because logical names use path notation (ROOT/a/b) alphabetical order is top-down. The last item in the sorted slice is the Target; the remaining items are Ancestors.
Step 2 – Dependencies:
Read the target node's frontmatter. If the target is a TEST/ node, also read the parent leaf node's frontmatter and merge their DependsOn lists. Resolve each entry to a ChainItem and sort by logical name.
Returns an error if any logical name cannot be resolved, frontmatter cannot be parsed, or a glob pattern fails to evaluate.