Imports:
  - Types:
      - DocumentNode
      - DocumentRoot
    From: goga/ast/nodes
  - Types:
      - ASTRuleError
      - DocumentRuleError
    From: goga/ast/errors

Usages:
  nodes: |
    Consumer uses the manifest goga/ast/nodes and its API to work with document structure.
  conventions: .goga/usages/conventions.md

Annotations: |
  When developing and testing: follow the practice `conventions`.

---

"DocumentRule(name: str)":
  location: document.py
  annotations: |
    Describes a single document-level validation rule.

    `name`: rule name
  properties:
    name -> str: |
      The name with which the rule was created.
  methods:
    "check(node: DocumentNode) -> errors:list[DocumentRuleError]": |
      Validates the node against the rule.

      `node`: the node to validate
      `errors`: list of errors from the validation

"ASTRule(tree: list[DocumentRoot], name: str)":
  location: ast.py
  annotations: |
    Describes a single rule applied globally across all documents.

    `tree`: the document tree to apply the rule to. The tree can be read using practice `nodes`.
    `name`: rule name
  properties:
    name -> str: |
      The name with which the rule was created.
    tree -> list[DocumentRoot]: |
      The document tree passed at construction.
  methods:
    "check(document: DocumentRoot) -> errors:list[ASTRuleError]": |
      Validates the document against the rule.

      `document`: the document to validate
      `errors`: list of errors from the validation

---

Author: Mikhail Trifonov
CreatedAt: 14/05/26

Description: |
  Base rule types for validating CODEMANIFEST documents.
