Documentation
¶
Overview ¶
Package logicalnames centralizes conversion between logical names and file paths, and provides parent-derivation utilities for the Code from Spec node hierarchy.
Logical name prefixes:
- ROOT — spec nodes (code-from-spec/spec/**/_node.md)
- TEST — test nodes (code-from-spec/spec/**/*.test.md)
- EXTERNAL — external dependencies (code-from-spec/external/**/_external.md)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasParent ¶
HasParent determines whether a logical name has a parent node.
Returns (hasParent, ok) where ok indicates whether the input is a valid logical name at all.
Rules (ref: ROOT/tech_design/internal/logical_names §HasParent):
ROOT → (false, true) — root has no parent ROOT/<path> → (true, true) TEST → (true, true) — parent is ROOT TEST/<path> → (true, true) TEST/<path>(name) → (true, true) EXTERNAL/<name> → (false, true) — externals have no parent EXTERNAL → (false, false) — bare EXTERNAL is not valid "" → (false, false)
func ParentLogicalName ¶
ParentLogicalName derives the parent's logical name from a node's logical name.
Returns (parent, true) on success, ("", false) if the node has no parent. The caller should confirm HasParent returns (true, true) before calling this function.
Rules (ref: ROOT/tech_design/internal/logical_names §ParentLogicalName):
ROOT/x → ROOT ROOT/x/y → ROOT/x TEST → ROOT TEST/x → ROOT/x TEST/x(name) → ROOT/x
func PathFromLogicalName ¶
PathFromLogicalName resolves a logical name to a file path relative to the project root.
Resolution rules (ref: ROOT/tech_design/internal/logical_names §PathFromLogicalName):
ROOT → code-from-spec/spec/_node.md ROOT/<path> → code-from-spec/spec/<path>/_node.md TEST → code-from-spec/spec/default.test.md TEST/<path> → code-from-spec/spec/<path>/default.test.md TEST/<path>(name) → code-from-spec/spec/<path>/<name>.test.md EXTERNAL/<name> → code-from-spec/external/<name>/_external.md
Returns ("", false) if the input does not match any known pattern.
Types ¶
This section is empty.