Documentation
¶
Overview ¶
Package logicalnames centralizes conversion between logical names and file paths. spec: ROOT/tech_design/internal/logical_names@v26
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.
Rules:
- ROOT → (false, true) — root has no parent
- ROOT/<path> → (true, true) — always has a parent
- TEST (any form) → (true, true) — parent is always in ROOT namespace
- EXTERNAL/<name> → (false, true) — externals have no parent
- anything else → (false, false) — not a valid logical name
func ParentLogicalName ¶
ParentLogicalName derives the parent's logical name from a node's logical name. Returns ("", false) if the node has no parent. Only call after confirming HasParent returns true.
Rules:
- ROOT/<path> → strip last segment; if one segment, parent is ROOT
- TEST → ROOT
- TEST/<path> → ROOT/<path>
- TEST/<path>(<name>) → ROOT/<path>
func PathFromLogicalName ¶
PathFromLogicalName resolves a logical name to a file path relative to the project root. Returns ("", false) if the input does not match any known pattern. Returned paths always use forward slashes as separators.
Rules:
- 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
Types ¶
This section is empty.