Files
codebase-memory-mcp/tests
Martin Vogel 75e317518c fix(hcl): index .tofu and .tfvars; only top-level blocks are Classes
- OpenTofu configuration (`.tofu`) and variable files (`.tfvars`) had no
  language and were never indexed (cloud-foundation-fabric: 104 `.tofu`,
  208 `.tfvars`).
- Every HCL `block` became a Class, nested ones included: a resource's
  `lifecycle`, `dynamic`/`content` and argument blocks were entities next
  to the resource (cloud-foundation-fabric: `dynamic` 1,342, `content`
  205 beside 898 resources). Only a block directly in the file's body --
  resource, data, module, variable, output, locals, provider, terraform,
  Terragrunt's include/dependency -- is a Class now.
- A file's own assignments (a `.tfvars` file, Terragrunt `inputs`) sit
  one level below the root the variable walk scanned; none was extracted.
  They are Variables now.

On real input (HCL Classes / .tofu+.tfvars files / HCL Variables), against
main: cloud-foundation-fabric 6,324 -> 3,919 / 0 -> 312 / 0 -> 1,067,
kubernetes/k8s.io 2,102 -> 1,590 / 0 -> 11 / 0 -> 42, kubespray
892 -> 804 / 0 -> 13 / 0 -> 174, eks-blueprints 924 -> 733,
kube-hetzner 757 -> 683, deckhouse 976 -> 830; the terragrunt example
keeps its 31 top-level blocks and gains 5 input Variables.

Not changed here: the remaining HCL USAGE edges are generic name guesses
(a `range` call resolves to a Class in <python-builtins>, module outputs
to same-named outputs of unrelated modules), and the name-similarity
config links now also see the 104 OpenTofu files.

The nested-block, .tofu and .tfvars probes and the extension unit test
fail without the change.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-10 13:53:54 +02:00
..