logicalnames

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logicalnames centralizes conversion between logical names and file paths, as well as parent derivation for the Code from Spec spec tree.

Spec ref: ROOT/tech_design/internal/logical_names § "Intent"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasParent

func HasParent(logicalName string) (hasParent, ok bool)

HasParent determines whether a logical name has a parent node. Returns (hasParent, ok) where ok indicates whether the input is a valid logical name.

Spec ref: ROOT/tech_design/internal/logical_names § "HasParent"

Rules:

  • ROOT → (false, true) — no parent
  • ROOT/<path> → (true, true) — has parent
  • TEST → (true, true) — parent is ROOT
  • TEST/<path> → (true, true) — parent is ROOT/<path>
  • TEST/<path>(<name>) → (true, true) — parent is ROOT/<path>
  • EXTERNAL/<name> → (false, true) — no parent
  • EXTERNAL (bare) → (false, false) — invalid
  • "" or anything else → (false, false) — invalid

func ParentLogicalName

func ParentLogicalName(logicalName string) (string, bool)

ParentLogicalName derives the parent's logical name from a node's logical name. Returns (parent, true) on success, or ("", false) if the node has no parent. Only call after confirming HasParent returns true.

Spec ref: ROOT/tech_design/internal/logical_names § "ParentLogicalName"

Rules:

  • ROOT/<path> → strip last segment; if one segment remains, parent is ROOT
  • TEST → ROOT
  • TEST/<path> → ROOT/<path>
  • TEST/<path>(<name>) → ROOT/<path>

func PathFromLogicalName

func PathFromLogicalName(logicalName string) (string, bool)

PathFromLogicalName resolves a logical name to a file path relative to the project root. Returns (path, true) on success or ("", false) if the input does not match any known pattern.

Spec ref: ROOT/tech_design/internal/logical_names § "PathFromLogicalName"

Resolution 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL