Internal

Internal Runtime Functions

Internal runtime helpers resolve document sources, parse recognized files, and build reader models.

parserruntimereaderinternals

These functions are implementation details of the bundled reader, not part of a stable public API.

function

readDocumentCollection

readDocumentCollection(): Promise<DocumentCollection>

Load all recognized Neenja documents and return the full reader collection.

Behavior

no visible concepts.

  • Resolves the documents directory.
  • Reads recognized document files.
  • Parses documentation, project plan, and task tree documents.
  • Builds documents, documentsBySlug, and defaultDocument.
  • Uses the project plan as defaultDocument when documentation exists but has

function

readDocumentationDocument

readDocumentationDocument(): Promise<DocumentationDocument>

Load and parse the documentation document only.

Behavior
  • Supports single-document reader callers.
  • Reads NEENJA_DOCUMENTATION_PATH or the default documentation path.
  • Parses concepts, filters by visibility, and builds a type index.

function

parseConcept

parseConcept(block: string): Concept

Parse one ## Concept: block into the in-memory documentation concept model.

Behavior
  • Reads concept metadata such as ID, Privacy, Type, and Category.
  • Routes the body through the Markdown parser or structured entry parser based on ConceptKind.

function

parsePlanSection

parsePlanSection(block: string): PlanSection

Parse one ## Plan: block into a technical project-plan section.

Behavior
  • Reads ID, Area, and optional Summary.
  • Keeps non-metadata section content as Markdown.
  • Parses body content before the first ### heading as intro Markdown.
  • Parses each ### heading as a PlanDetailBlock.

function

parsePlanDetailBlock

parsePlanDetailBlock(block: string, usedIds: Set<string>): PlanDetailBlock

Parse one ### technical detail block inside a project-plan section.

Behavior
  • Derives a unique block ID from the heading.
  • Keeps the block body as Markdown content.

function

parsePlanMetadataFields

parsePlanMetadataFields(lines: string[]): { metadata: Record<string, string>; bodyStartIndex: number }

Parse the small metadata header at the start of a project-plan section.

Behavior
  • Accepts only ID, Area, and Summary as project-plan metadata.
  • Stops before the first non-metadata line so it can render as Markdown body content.
  • Returns the index where body parsing should continue.

function

parseYamlTaskNode

parseYamlTaskNode(rawTask: RawTaskNode, parentId: string | undefined, usedIds: Set<string>): { task: TaskNode; children: RawTaskNode[] }

Parse one YAML task object into a task node before derived graph relationships are applied.

Behavior

children.

  • Reads id, title, status, area, dependsOn, details, and nested
  • Normalizes status aliases such as doing to in-progress and completed to done.
  • Parses details as Markdown content.

function

resolveDocumentDirectoryPath

resolveDocumentDirectoryPath(): Promise<string>

Resolve the directory that should be scanned for recognized Neenja documents.

Behavior
  • Uses NEENJA_DOCUMENTS_DIR or NEENJA_DOCUMENTS_PATH when present.
  • Falls back to ${NEENJA_PROJECT_ROOT}/.neenja or ${process.cwd()}/.neenja.

function

buildTypeIndex

buildTypeIndex(concepts: Concept[]): Record<string, TypeReferenceTarget>

Collect the first visible occurrence of each documented type name so inline type mentions can navigate to the matching type entry.